|
3 | 3 | * Copyright (c) 2025 - 2025 Vaadin Ltd.
|
4 | 4 | * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
5 | 5 | */
|
6 |
| -import { css, html, LitElement, nothing } from 'lit'; |
| 6 | +import { html, LitElement, nothing } from 'lit'; |
7 | 7 | import { getFocusableElements } from '@vaadin/a11y-base/src/focus-utils.js';
|
8 | 8 | import { defineCustomElement } from '@vaadin/component-base/src/define.js';
|
9 | 9 | import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
|
10 | 10 | import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js';
|
11 | 11 | import { ResizeMixin } from '@vaadin/component-base/src/resize-mixin.js';
|
12 | 12 | import { SlotStylesMixin } from '@vaadin/component-base/src/slot-styles-mixin.js';
|
13 | 13 | import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
14 |
| -import { transitionStyles } from './vaadin-master-detail-layout-transition-styles.js'; |
| 14 | +import { masterDetailLayoutStyles } from './styles/vaadin-master-detail-layout-styles.js'; |
| 15 | +import { masterDetailLayoutTransitionStyles } from './styles/vaadin-master-detail-layout-transition-styles.js'; |
15 | 16 |
|
16 | 17 | /**
|
17 | 18 | * `<vaadin-master-detail-layout>` is a web component for building UIs with a master
|
@@ -63,154 +64,7 @@ class MasterDetailLayout extends SlotStylesMixin(ResizeMixin(ElementMixin(Themab
|
63 | 64 | }
|
64 | 65 |
|
65 | 66 | static get styles() {
|
66 |
| - return css` |
67 |
| - :host { |
68 |
| - display: flex; |
69 |
| - box-sizing: border-box; |
70 |
| - height: 100%; |
71 |
| - } |
72 |
| -
|
73 |
| - :host([hidden]) { |
74 |
| - display: none !important; |
75 |
| - } |
76 |
| -
|
77 |
| - :host(:not([has-detail])) [part='detail'], |
78 |
| - [part='backdrop'] { |
79 |
| - display: none; |
80 |
| - } |
81 |
| -
|
82 |
| - :host([orientation='horizontal']) [part='master'] { |
83 |
| - max-width: 100%; |
84 |
| - } |
85 |
| -
|
86 |
| - /* Drawer mode */ |
87 |
| - :host(:is([drawer], [stack])) { |
88 |
| - position: relative; |
89 |
| - } |
90 |
| -
|
91 |
| - :host(:is([drawer], [stack])[containment='layout']) [part='detail'], |
92 |
| - :host([drawer][containment='layout']) [part='backdrop'] { |
93 |
| - position: absolute; |
94 |
| - } |
95 |
| -
|
96 |
| - :host(:is([drawer], [stack])[containment='viewport']) [part='detail'], |
97 |
| - :host([drawer][containment='viewport']) [part='backdrop'] { |
98 |
| - position: fixed; |
99 |
| - } |
100 |
| -
|
101 |
| - :host([drawer][has-detail]) [part='backdrop'] { |
102 |
| - display: block; |
103 |
| - inset: 0; |
104 |
| - z-index: 1; |
105 |
| - } |
106 |
| -
|
107 |
| - :host(:is([drawer], [stack])) [part='detail'] { |
108 |
| - z-index: 1; |
109 |
| - } |
110 |
| -
|
111 |
| - :host([drawer][orientation='horizontal']) [part='detail'] { |
112 |
| - inset-inline-end: 0; |
113 |
| - height: 100%; |
114 |
| - width: var(--_detail-min-size, min-content); |
115 |
| - max-width: 100%; |
116 |
| - } |
117 |
| -
|
118 |
| - :host([drawer][orientation='horizontal'][containment='viewport']) [part='detail'] { |
119 |
| - inset-block-start: 0; |
120 |
| - } |
121 |
| -
|
122 |
| - /* No fixed size */ |
123 |
| - :host(:not([has-master-size])) [part='master'], |
124 |
| - :host(:not([has-detail-size])) [part='detail'] { |
125 |
| - flex-grow: 1; |
126 |
| - flex-basis: 50%; |
127 |
| - } |
128 |
| -
|
129 |
| - /* Fixed size */ |
130 |
| - :host([has-master-size]) [part='master'], |
131 |
| - :host([has-detail-size]) [part='detail'] { |
132 |
| - flex-shrink: 0; |
133 |
| - } |
134 |
| -
|
135 |
| - :host([has-master-size][orientation='horizontal']) [part='master'] { |
136 |
| - width: var(--_master-size); |
137 |
| - } |
138 |
| -
|
139 |
| - :host([has-detail-size][orientation='horizontal']:not([stack])) [part='detail'] { |
140 |
| - width: var(--_detail-size); |
141 |
| - } |
142 |
| -
|
143 |
| - :host([has-master-size][has-detail-size]) [part='master'] { |
144 |
| - flex-grow: 1; |
145 |
| - flex-basis: var(--_master-size); |
146 |
| - } |
147 |
| -
|
148 |
| - :host([has-master-size][has-detail-size]) [part='detail'] { |
149 |
| - flex-grow: 1; |
150 |
| - flex-basis: var(--_detail-size); |
151 |
| - } |
152 |
| -
|
153 |
| - /* Min size */ |
154 |
| - :host([has-master-min-size][has-detail][orientation='horizontal']:not([drawer]):not([stack])) [part='master'] { |
155 |
| - min-width: var(--_master-min-size); |
156 |
| - } |
157 |
| -
|
158 |
| - :host([has-detail-min-size][orientation='horizontal']:not([drawer]):not([stack])) [part='detail'] { |
159 |
| - min-width: var(--_detail-min-size); |
160 |
| - } |
161 |
| -
|
162 |
| - :host([has-master-min-size]) [part='master'], |
163 |
| - :host([has-detail-min-size]) [part='detail'] { |
164 |
| - flex-shrink: 0; |
165 |
| - } |
166 |
| -
|
167 |
| - /* Vertical */ |
168 |
| - :host([orientation='vertical']) { |
169 |
| - flex-direction: column; |
170 |
| - } |
171 |
| -
|
172 |
| - :host([orientation='vertical'][drawer]) [part='master'] { |
173 |
| - max-height: 100%; |
174 |
| - } |
175 |
| -
|
176 |
| - :host([orientation='vertical'][drawer]) [part='detail'] { |
177 |
| - inset-block-end: 0; |
178 |
| - width: 100%; |
179 |
| - height: var(--_detail-min-size, min-content); |
180 |
| - } |
181 |
| -
|
182 |
| - :host([drawer][orientation='vertical'][containment='viewport']) [part='detail'] { |
183 |
| - inset-inline-start: 0; |
184 |
| - } |
185 |
| -
|
186 |
| - /* Fixed size */ |
187 |
| - :host([has-master-size][orientation='vertical']) [part='master'] { |
188 |
| - height: var(--_master-size); |
189 |
| - } |
190 |
| -
|
191 |
| - :host([has-detail-size][orientation='vertical']:not([stack])) [part='detail'] { |
192 |
| - height: var(--_detail-size); |
193 |
| - } |
194 |
| -
|
195 |
| - /* Min size */ |
196 |
| - :host([has-master-min-size][orientation='vertical']:not([drawer])) [part='master'], |
197 |
| - :host([has-master-min-size][orientation='vertical'][drawer]) { |
198 |
| - min-height: var(--_master-min-size); |
199 |
| - } |
200 |
| -
|
201 |
| - :host([has-detail-min-size][orientation='vertical']:not([drawer]):not([stack])) [part='detail'] { |
202 |
| - min-height: var(--_detail-min-size); |
203 |
| - } |
204 |
| -
|
205 |
| - /* Stack mode */ |
206 |
| - :host([stack]) [part='master'] { |
207 |
| - max-height: 100%; |
208 |
| - } |
209 |
| -
|
210 |
| - :host([stack]) [part='detail'] { |
211 |
| - inset: 0; |
212 |
| - } |
213 |
| - `; |
| 67 | + return masterDetailLayoutStyles; |
214 | 68 | }
|
215 | 69 |
|
216 | 70 | static get properties() {
|
@@ -388,7 +242,7 @@ class MasterDetailLayout extends SlotStylesMixin(ResizeMixin(ElementMixin(Themab
|
388 | 242 |
|
389 | 243 | /** @override */
|
390 | 244 | get slotStyles() {
|
391 |
| - return [transitionStyles]; |
| 245 | + return [masterDetailLayoutTransitionStyles]; |
392 | 246 | }
|
393 | 247 |
|
394 | 248 | /** @protected */
|
|
0 commit comments