mtrl 0.2.6 → 0.2.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/demo/build.ts +349 -0
- package/demo/index.html +110 -0
- package/demo/main.js +448 -0
- package/demo/styles.css +239 -0
- package/index.ts +18 -0
- package/package.json +14 -3
- package/server.ts +86 -0
- package/src/components/badge/api.ts +70 -63
- package/src/components/badge/badge.ts +16 -2
- package/src/components/badge/config.ts +66 -13
- package/src/components/badge/features.ts +51 -42
- package/src/components/badge/index.ts +27 -2
- package/src/components/badge/types.ts +62 -30
- package/src/components/bottom-app-bar/bottom-app-bar.ts +154 -0
- package/src/components/bottom-app-bar/config.ts +29 -0
- package/src/components/bottom-app-bar/index.ts +17 -0
- package/src/components/bottom-app-bar/types.ts +114 -0
- package/src/components/button/api.ts +5 -0
- package/src/components/button/button.ts +0 -1
- package/src/components/button/config.ts +6 -2
- package/src/components/button/index.ts +10 -2
- package/src/components/button/types.ts +20 -2
- package/src/components/card/card.ts +13 -25
- package/src/components/card/config.ts +83 -30
- package/src/components/card/content.ts +8 -10
- package/src/components/card/features.ts +4 -3
- package/src/components/card/index.ts +29 -2
- package/src/components/card/types.ts +33 -22
- package/src/components/checkbox/config.ts +3 -4
- package/src/components/checkbox/index.ts +1 -2
- package/src/components/checkbox/types.ts +12 -3
- package/src/components/chip/api.ts +170 -221
- package/src/components/chip/chip.ts +34 -302
- package/src/components/chip/config.ts +1 -2
- package/src/components/chip/index.ts +10 -2
- package/src/components/chip/types.ts +224 -35
- package/src/components/datepicker/api.ts +265 -0
- package/src/components/datepicker/config.ts +141 -0
- package/src/components/datepicker/datepicker.ts +341 -0
- package/src/components/datepicker/index.ts +12 -0
- package/src/components/datepicker/render.ts +450 -0
- package/src/components/datepicker/types.ts +397 -0
- package/src/components/datepicker/utils.ts +289 -0
- package/src/components/dialog/api.ts +55 -21
- package/src/components/dialog/config.ts +12 -9
- package/src/components/dialog/dialog.ts +6 -3
- package/src/components/dialog/features.ts +345 -151
- package/src/components/dialog/index.ts +38 -8
- package/src/components/dialog/types.ts +40 -14
- package/src/components/divider/config.ts +81 -0
- package/src/components/divider/divider.ts +37 -0
- package/src/components/divider/features.ts +207 -0
- package/src/components/divider/index.ts +9 -0
- package/src/components/divider/types.ts +55 -0
- package/src/components/extended-fab/api.ts +141 -0
- package/src/components/extended-fab/config.ts +112 -0
- package/src/components/extended-fab/extended-fab.ts +125 -0
- package/src/components/extended-fab/index.ts +9 -0
- package/src/components/extended-fab/types.ts +304 -0
- package/src/components/fab/api.ts +97 -0
- package/src/components/fab/config.ts +93 -0
- package/src/components/fab/fab.ts +67 -0
- package/src/components/fab/index.ts +9 -0
- package/src/components/fab/types.ts +251 -0
- package/src/components/list/config.ts +4 -5
- package/src/components/list/features.ts +6 -7
- package/src/components/list/index.ts +7 -9
- package/src/components/list/list-item.ts +12 -13
- package/src/components/list/types.ts +50 -5
- package/src/components/list/utils.ts +30 -3
- package/src/components/menu/features/items-manager.ts +9 -9
- package/src/components/menu/features/positioning.ts +7 -7
- package/src/components/menu/features/visibility.ts +7 -7
- package/src/components/menu/index.ts +7 -9
- package/src/components/menu/menu-item.ts +6 -6
- package/src/components/menu/menu.ts +22 -0
- package/src/components/menu/types.ts +29 -10
- package/src/components/menu/utils.ts +67 -0
- package/src/components/navigation/api.ts +78 -50
- package/src/components/navigation/config.ts +22 -10
- package/src/components/navigation/features/items.ts +284 -0
- package/src/components/navigation/index.ts +0 -6
- package/src/components/navigation/nav-item.ts +70 -33
- package/src/components/navigation/navigation.ts +53 -3
- package/src/components/navigation/types.ts +117 -70
- package/src/components/progress/api.ts +2 -3
- package/src/components/progress/config.ts +2 -3
- package/src/components/progress/index.ts +0 -1
- package/src/components/progress/progress.ts +1 -2
- package/src/components/progress/types.ts +186 -33
- package/src/components/radios/config.ts +1 -1
- package/src/components/radios/index.ts +0 -1
- package/src/components/radios/types.ts +0 -7
- package/src/components/search/api.ts +203 -0
- package/src/components/search/config.ts +86 -0
- package/src/components/search/features/index.ts +4 -0
- package/src/components/search/features/search.ts +717 -0
- package/src/components/search/features/states.ts +169 -0
- package/src/components/search/features/structure.ts +197 -0
- package/src/components/search/index.ts +7 -0
- package/src/components/search/search.ts +52 -0
- package/src/components/search/types.ts +175 -0
- package/src/components/segmented-button/config.ts +80 -0
- package/src/components/segmented-button/index.ts +4 -0
- package/src/components/segmented-button/segment.ts +154 -0
- package/src/components/segmented-button/segmented-button.ts +249 -0
- package/src/components/segmented-button/types.ts +254 -0
- package/src/components/slider/accessibility.md +5 -5
- package/src/components/slider/api.ts +41 -120
- package/src/components/slider/config.ts +51 -47
- package/src/components/slider/features/handlers.ts +495 -0
- package/src/components/slider/features/index.ts +1 -2
- package/src/components/slider/features/slider.ts +66 -84
- package/src/components/slider/features/states.ts +195 -0
- package/src/components/slider/features/structure.ts +136 -206
- package/src/components/slider/features/ui.ts +145 -206
- package/src/components/slider/index.ts +2 -11
- package/src/components/slider/slider.ts +9 -12
- package/src/components/slider/types.ts +67 -26
- package/src/components/snackbar/config.ts +2 -3
- package/src/components/snackbar/constants.ts +0 -32
- package/src/components/snackbar/index.ts +0 -1
- package/src/components/snackbar/position.ts +9 -1
- package/src/components/snackbar/types.ts +122 -46
- package/src/components/switch/config.ts +2 -3
- package/src/components/switch/index.ts +0 -1
- package/src/components/switch/types.ts +3 -2
- package/src/components/tabs/config.ts +3 -4
- package/src/components/tabs/features.ts +4 -2
- package/src/components/tabs/index.ts +0 -15
- package/src/components/tabs/indicator.ts +73 -13
- package/src/components/tabs/tab-api.ts +12 -4
- package/src/components/tabs/tab.ts +18 -6
- package/src/components/tabs/types.ts +23 -5
- package/src/components/textfield/config.ts +2 -3
- package/src/components/textfield/index.ts +0 -1
- package/src/components/textfield/types.ts +17 -3
- package/src/components/timepicker/README.md +277 -0
- package/src/components/timepicker/api.ts +632 -0
- package/src/components/timepicker/clockdial.ts +482 -0
- package/src/components/timepicker/config.ts +228 -0
- package/src/components/timepicker/index.ts +3 -0
- package/src/components/timepicker/render.ts +613 -0
- package/src/components/timepicker/timepicker.ts +117 -0
- package/src/components/timepicker/types.ts +336 -0
- package/src/components/timepicker/utils.ts +241 -0
- package/src/components/tooltip/api.ts +1 -1
- package/src/components/tooltip/config.ts +27 -6
- package/src/components/tooltip/index.ts +0 -1
- package/src/components/tooltip/types.ts +13 -3
- package/src/components/top-app-bar/config.ts +83 -0
- package/src/components/top-app-bar/index.ts +11 -0
- package/src/components/top-app-bar/top-app-bar.ts +316 -0
- package/src/components/top-app-bar/types.ts +140 -0
- package/src/core/build/_ripple.scss +6 -6
- package/src/core/build/ripple.ts +72 -95
- package/src/core/compose/features/icon.ts +3 -1
- package/src/core/compose/features/ripple.ts +4 -1
- package/src/core/compose/features/textlabel.ts +23 -2
- package/src/core/dom/create.ts +5 -0
- package/src/index.ts +9 -0
- package/src/styles/abstract/_theme.scss +9 -1
- package/src/styles/components/_badge.scss +182 -0
- package/src/styles/components/_bottom-app-bar.scss +103 -0
- package/src/{components/button/_styles.scss → styles/components/_button.scss} +0 -10
- package/src/{components/checkbox/_styles.scss → styles/components/_checkbox.scss} +0 -2
- package/src/styles/components/_datepicker.scss +358 -0
- package/src/styles/components/_dialog.scss +259 -0
- package/src/styles/components/_divider.scss +57 -0
- package/src/styles/components/_extended-fab.scss +267 -0
- package/src/styles/components/_fab.scss +225 -0
- package/src/{components/navigation/_styles.scss → styles/components/_navigation.scss} +1 -0
- package/src/styles/components/_search.scss +306 -0
- package/src/styles/components/_segmented-button.scss +117 -0
- package/src/{components/slider/_styles.scss → styles/components/_slider.scss} +83 -24
- package/src/{components/switch/_styles.scss → styles/components/_switch.scss} +0 -2
- package/src/{components/tabs/_styles.scss → styles/components/_tabs.scss} +95 -33
- package/src/{components/textfield/_styles.scss → styles/components/_textfield.scss} +70 -67
- package/src/styles/components/_timepicker.scss +451 -0
- package/src/styles/components/_top-app-bar.scss +225 -0
- package/src/styles/main.scss +98 -49
- package/src/styles/themes/_autumn.scss +21 -0
- package/src/styles/themes/_base-theme.scss +61 -0
- package/src/styles/themes/_baseline.scss +58 -0
- package/src/styles/themes/_bluekhaki.scss +125 -0
- package/src/styles/themes/_brownbeige.scss +125 -0
- package/src/styles/themes/_browngreen.scss +125 -0
- package/src/styles/themes/_forest.scss +6 -0
- package/src/styles/themes/_greenbeige.scss +125 -0
- package/src/styles/themes/_material.scss +125 -0
- package/src/styles/themes/_ocean.scss +6 -0
- package/src/styles/themes/_sageivory.scss +125 -0
- package/src/styles/themes/_spring.scss +6 -0
- package/src/styles/themes/_summer.scss +5 -0
- package/src/styles/themes/_sunset.scss +5 -0
- package/src/styles/themes/_tealcaramel.scss +125 -0
- package/src/styles/themes/_winter.scss +6 -0
- package/src/components/badge/_styles.scss +0 -174
- package/src/components/badge/constants.ts +0 -30
- package/src/components/button/constants.ts +0 -11
- package/src/components/card/constants.ts +0 -84
- package/src/components/dialog/_styles.scss +0 -213
- package/src/components/dialog/constants.ts +0 -32
- package/src/components/menu/constants.ts +0 -154
- package/src/components/navigation/constants.ts +0 -200
- package/src/components/navigation/features/items.js +0 -192
- package/src/components/progress/constants.ts +0 -29
- package/src/components/slider/features/appearance.ts +0 -94
- package/src/components/slider/features/disabled.ts +0 -68
- package/src/components/slider/features/events.ts +0 -164
- package/src/components/slider/features/interactions.ts +0 -396
- package/src/components/slider/features/keyboard.ts +0 -233
- package/src/components/switch/constants.ts +0 -80
- package/src/components/tabs/constants.ts +0 -89
- package/src/core/collection/adapters/mongodb.js +0 -232
- /package/src/{components/card/_styles.scss → styles/components/_card.scss} +0 -0
- /package/src/{components/carousel/_styles.scss → styles/components/_carousel.scss} +0 -0
- /package/src/{components/chip/_styles.scss → styles/components/_chip.scss} +0 -0
- /package/src/{components/list/_styles.scss → styles/components/_list.scss} +0 -0
- /package/src/{components/menu/_styles.scss → styles/components/_menu.scss} +0 -0
- /package/src/{components/progress/_styles.scss → styles/components/_progress.scss} +0 -0
- /package/src/{components/radios/_styles.scss → styles/components/_radios.scss} +0 -0
- /package/src/{components/sheet/_styles.scss → styles/components/_sheet.scss} +0 -0
- /package/src/{components/snackbar/_styles.scss → styles/components/_snackbar.scss} +0 -0
- /package/src/{components/tooltip/_styles.scss → styles/components/_tooltip.scss} +0 -0
- /package/src/styles/utilities/{_color.scss → _colors.scss} +0 -0
|
@@ -0,0 +1,306 @@
|
|
|
1
|
+
// src/components/search/_styles.scss
|
|
2
|
+
@use '../../styles/abstract/base' as base;
|
|
3
|
+
@use '../../styles/abstract/variables' as v;
|
|
4
|
+
@use '../../styles/abstract/functions' as f;
|
|
5
|
+
@use '../../styles/abstract/mixins' as m;
|
|
6
|
+
@use '../../styles/abstract/theme' as t;
|
|
7
|
+
|
|
8
|
+
$component: '#{base.$prefix}-search';
|
|
9
|
+
|
|
10
|
+
.#{$component} {
|
|
11
|
+
// Base styles
|
|
12
|
+
position: relative;
|
|
13
|
+
display: flex;
|
|
14
|
+
flex-direction: column;
|
|
15
|
+
width: 100%;
|
|
16
|
+
max-width: 720px;
|
|
17
|
+
min-width: 360px;
|
|
18
|
+
background-color: transparent;
|
|
19
|
+
transition: background-color 0.2s ease;
|
|
20
|
+
z-index: 1;
|
|
21
|
+
|
|
22
|
+
// Container
|
|
23
|
+
&-container {
|
|
24
|
+
position: relative;
|
|
25
|
+
display: flex;
|
|
26
|
+
align-items: center;
|
|
27
|
+
height: 56px;
|
|
28
|
+
padding: 0 16px;
|
|
29
|
+
border-radius: v.shape('pill');
|
|
30
|
+
background-color: t.color('surface-container-high');
|
|
31
|
+
transition: background-color 0.2s ease;
|
|
32
|
+
overflow: hidden;
|
|
33
|
+
|
|
34
|
+
.#{$component}--disabled & {
|
|
35
|
+
opacity: 0.38;
|
|
36
|
+
pointer-events: none;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// Leading Icon
|
|
41
|
+
&-leading-icon {
|
|
42
|
+
display: flex;
|
|
43
|
+
align-items: center;
|
|
44
|
+
justify-content: center;
|
|
45
|
+
min-width: 24px;
|
|
46
|
+
height: 24px;
|
|
47
|
+
margin-right: 16px;
|
|
48
|
+
color: t.color('on-surface');
|
|
49
|
+
cursor: pointer;
|
|
50
|
+
flex-shrink: 0;
|
|
51
|
+
|
|
52
|
+
svg {
|
|
53
|
+
width: 24px;
|
|
54
|
+
height: 24px;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
&:focus {
|
|
58
|
+
outline: none;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
&:focus-visible {
|
|
62
|
+
outline: 2px solid t.color('outline');
|
|
63
|
+
border-radius: 50%;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// Input wrapper
|
|
68
|
+
&-input-wrapper {
|
|
69
|
+
flex: 1;
|
|
70
|
+
min-width: 0;
|
|
71
|
+
height: 100%;
|
|
72
|
+
display: flex;
|
|
73
|
+
align-items: center;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
// Input field
|
|
77
|
+
&-input {
|
|
78
|
+
width: 100%;
|
|
79
|
+
height: 100%;
|
|
80
|
+
min-height: 36px;
|
|
81
|
+
border: none;
|
|
82
|
+
background: transparent;
|
|
83
|
+
font-size: 16px;
|
|
84
|
+
color: t.color('on-surface');
|
|
85
|
+
padding: 8px 0;
|
|
86
|
+
box-sizing: border-box;
|
|
87
|
+
outline: none;
|
|
88
|
+
|
|
89
|
+
&::placeholder {
|
|
90
|
+
color: t.color('on-surface-variant');
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.#{$component}--disabled & {
|
|
94
|
+
cursor: not-allowed;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
// Clear button
|
|
99
|
+
&-clear-button {
|
|
100
|
+
display: flex;
|
|
101
|
+
align-items: center;
|
|
102
|
+
justify-content: center;
|
|
103
|
+
min-width: 24px;
|
|
104
|
+
height: 24px;
|
|
105
|
+
margin-left: 16px;
|
|
106
|
+
color: t.color('on-surface-variant');
|
|
107
|
+
cursor: pointer;
|
|
108
|
+
flex-shrink: 0;
|
|
109
|
+
opacity: 1;
|
|
110
|
+
visibility: visible;
|
|
111
|
+
transition: opacity 0.2s ease, visibility 0s;
|
|
112
|
+
|
|
113
|
+
svg {
|
|
114
|
+
width: 20px;
|
|
115
|
+
height: 20px;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
&--hidden {
|
|
119
|
+
opacity: 0;
|
|
120
|
+
visibility: hidden;
|
|
121
|
+
transition: opacity 0.2s ease, visibility 0s 0.2s;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
&:focus {
|
|
125
|
+
outline: none;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
&:focus-visible {
|
|
129
|
+
outline: 2px solid t.color('outline');
|
|
130
|
+
border-radius: 50%;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
// Trailing icons
|
|
135
|
+
&-trailing-icon {
|
|
136
|
+
display: flex;
|
|
137
|
+
align-items: center;
|
|
138
|
+
justify-content: center;
|
|
139
|
+
min-width: 24px;
|
|
140
|
+
height: 24px;
|
|
141
|
+
margin-left: 16px;
|
|
142
|
+
color: t.color('on-surface-variant');
|
|
143
|
+
cursor: pointer;
|
|
144
|
+
flex-shrink: 0;
|
|
145
|
+
|
|
146
|
+
svg {
|
|
147
|
+
width: 24px;
|
|
148
|
+
height: 24px;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
&:focus {
|
|
152
|
+
outline: none;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
&:focus-visible {
|
|
156
|
+
outline: 2px solid t.color('outline');
|
|
157
|
+
border-radius: 50%;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
// Avatar
|
|
162
|
+
&-avatar {
|
|
163
|
+
display: flex;
|
|
164
|
+
align-items: center;
|
|
165
|
+
justify-content: center;
|
|
166
|
+
margin-left: 16px;
|
|
167
|
+
min-width: 30px;
|
|
168
|
+
height: 30px;
|
|
169
|
+
flex-shrink: 0;
|
|
170
|
+
border-radius: 50%;
|
|
171
|
+
overflow: hidden;
|
|
172
|
+
|
|
173
|
+
img {
|
|
174
|
+
width: 100%;
|
|
175
|
+
height: 100%;
|
|
176
|
+
object-fit: cover;
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
// Search variants
|
|
181
|
+
&--bar {
|
|
182
|
+
border-radius: v.shape('pill');
|
|
183
|
+
overflow: hidden;
|
|
184
|
+
transition: max-width 0.3s ease, width 0.3s ease;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
&--view {
|
|
188
|
+
border-radius: 0;
|
|
189
|
+
max-width: 100%;
|
|
190
|
+
width: 100%;
|
|
191
|
+
|
|
192
|
+
.#{$component}-container {
|
|
193
|
+
border-radius: 0;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
// For docked view mode
|
|
197
|
+
@include m.breakpoint-up('md') {
|
|
198
|
+
border-radius: v.shape('extra-large');
|
|
199
|
+
|
|
200
|
+
.#{$component}-container {
|
|
201
|
+
border-radius: v.shape('extra-large') v.shape('extra-large') 0 0;
|
|
202
|
+
height: 56px;
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
// Divider
|
|
208
|
+
&-divider {
|
|
209
|
+
display: block;
|
|
210
|
+
width: 100%;
|
|
211
|
+
height: 1px;
|
|
212
|
+
background-color: t.color('outline');
|
|
213
|
+
opacity: 0.5;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
// Suggestions container
|
|
217
|
+
&-suggestions-container {
|
|
218
|
+
display: none;
|
|
219
|
+
background-color: t.color('surface-container-high');
|
|
220
|
+
max-height: 400px;
|
|
221
|
+
overflow-y: auto;
|
|
222
|
+
border-bottom-left-radius: v.shape('medium');
|
|
223
|
+
border-bottom-right-radius: v.shape('medium');
|
|
224
|
+
|
|
225
|
+
&--visible {
|
|
226
|
+
display: block;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
// For docked view mode
|
|
230
|
+
@include m.breakpoint-up('md') {
|
|
231
|
+
border-radius: 0 0 v.shape('extra-large') v.shape('extra-large');
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
// Suggestions list
|
|
236
|
+
&-suggestions-list {
|
|
237
|
+
list-style: none;
|
|
238
|
+
padding: 8px 0;
|
|
239
|
+
margin: 0;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
// Suggestion item
|
|
243
|
+
&-suggestion-item {
|
|
244
|
+
display: flex;
|
|
245
|
+
align-items: center;
|
|
246
|
+
padding: 12px 16px;
|
|
247
|
+
min-height: 48px;
|
|
248
|
+
font-size: 16px;
|
|
249
|
+
color: t.color('on-surface');
|
|
250
|
+
cursor: pointer;
|
|
251
|
+
transition: background-color 0.15s ease;
|
|
252
|
+
|
|
253
|
+
&:hover, &:focus {
|
|
254
|
+
background-color: t.alpha('on-surface', 0.05);
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
&:focus {
|
|
258
|
+
outline: none;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
// Highlight matched text
|
|
262
|
+
strong {
|
|
263
|
+
font-weight: 600;
|
|
264
|
+
color: t.color('on-surface');
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
// Suggestion item icon
|
|
269
|
+
&-suggestion-icon {
|
|
270
|
+
display: flex;
|
|
271
|
+
align-items: center;
|
|
272
|
+
justify-content: center;
|
|
273
|
+
width: 24px;
|
|
274
|
+
height: 24px;
|
|
275
|
+
margin-right: 16px;
|
|
276
|
+
color: t.color('on-surface-variant');
|
|
277
|
+
|
|
278
|
+
svg {
|
|
279
|
+
width: 20px;
|
|
280
|
+
height: 20px;
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
// Suggestion item text
|
|
285
|
+
&-suggestion-text {
|
|
286
|
+
flex: 1;
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
// Focus state
|
|
290
|
+
&--focused {
|
|
291
|
+
.#{$component}-container {
|
|
292
|
+
// No additional styles needed for focus in MD3
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
// Full width
|
|
297
|
+
&--fullwidth {
|
|
298
|
+
max-width: 100%;
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
// Expanded state (transitioning from bar to view)
|
|
302
|
+
&--expanded {
|
|
303
|
+
max-width: 100%;
|
|
304
|
+
width: 100%;
|
|
305
|
+
}
|
|
306
|
+
}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
// src/components/segmented-button/_styles.scss
|
|
2
|
+
@use '../../styles/abstract/base' as base;
|
|
3
|
+
@use '../../styles/abstract/variables' as v;
|
|
4
|
+
@use '../../styles/abstract/functions' as f;
|
|
5
|
+
@use '../../styles/abstract/mixins' as m;
|
|
6
|
+
@use '../../styles/abstract/theme' as t;
|
|
7
|
+
|
|
8
|
+
$component: '#{base.$prefix}-segmented-button';
|
|
9
|
+
|
|
10
|
+
.#{$component} {
|
|
11
|
+
// Base styles
|
|
12
|
+
position: relative;
|
|
13
|
+
display: inline-flex;
|
|
14
|
+
align-items: center;
|
|
15
|
+
justify-content: center;
|
|
16
|
+
height: 40px;
|
|
17
|
+
border-radius: v.shape('full');
|
|
18
|
+
border: 1px solid t.color('outline');
|
|
19
|
+
background-color: transparent;
|
|
20
|
+
overflow: hidden;
|
|
21
|
+
|
|
22
|
+
// Disabled state
|
|
23
|
+
&--disabled {
|
|
24
|
+
opacity: 0.38;
|
|
25
|
+
pointer-events: none;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
// Segment container
|
|
29
|
+
&-segment {
|
|
30
|
+
// Base styles
|
|
31
|
+
position: relative;
|
|
32
|
+
display: flex;
|
|
33
|
+
align-items: center;
|
|
34
|
+
justify-content: center;
|
|
35
|
+
height: 100%;
|
|
36
|
+
min-width: 48px;
|
|
37
|
+
padding: 0 12px;
|
|
38
|
+
border: none;
|
|
39
|
+
background-color: transparent;
|
|
40
|
+
color: t.color('on-surface');
|
|
41
|
+
cursor: pointer;
|
|
42
|
+
user-select: none;
|
|
43
|
+
|
|
44
|
+
// Fix segmented borders
|
|
45
|
+
&:not(:first-child) {
|
|
46
|
+
border-left: 1px solid t.color('outline');
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// Typography
|
|
50
|
+
@include m.typography('label-large');
|
|
51
|
+
|
|
52
|
+
// Transition
|
|
53
|
+
@include m.motion-transition(
|
|
54
|
+
background-color,
|
|
55
|
+
color
|
|
56
|
+
);
|
|
57
|
+
|
|
58
|
+
// States
|
|
59
|
+
&:focus {
|
|
60
|
+
outline: none;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
&:focus-visible {
|
|
64
|
+
outline: 2px solid t.color('outline');
|
|
65
|
+
outline-offset: -2px;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
&:hover:not(.#{$component}-segment--disabled) {
|
|
69
|
+
background-color: t.alpha('on-surface', 0.08);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
// Selected state
|
|
73
|
+
&--selected {
|
|
74
|
+
background-color: t.color('secondary-container');
|
|
75
|
+
color: t.color('on-secondary-container');
|
|
76
|
+
|
|
77
|
+
&:hover:not(.#{$component}-segment--disabled) {
|
|
78
|
+
background-color: t.alpha('secondary-container', 0.8);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
// Disabled state
|
|
83
|
+
&--disabled {
|
|
84
|
+
opacity: 0.38;
|
|
85
|
+
cursor: not-allowed;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
// Text element
|
|
89
|
+
&-text {
|
|
90
|
+
// For when both icon and text are present
|
|
91
|
+
margin: 0 auto;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
// Icon styles
|
|
95
|
+
&-icon, &-checkmark {
|
|
96
|
+
display: inline-flex;
|
|
97
|
+
align-items: center;
|
|
98
|
+
justify-content: center;
|
|
99
|
+
width: 18px;
|
|
100
|
+
height: 18px;
|
|
101
|
+
|
|
102
|
+
svg {
|
|
103
|
+
width: 18px;
|
|
104
|
+
height: 18px;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
+ .#{$component}-segment-text {
|
|
108
|
+
margin-left: 8px;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
// Space the checkmark icon
|
|
113
|
+
&-checkmark + .#{$component}-segment-text {
|
|
114
|
+
margin-left: 8px;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
@@ -5,8 +5,11 @@
|
|
|
5
5
|
@use '../../styles/abstract/mixins' as m;
|
|
6
6
|
@use '../../styles/abstract/theme' as t;
|
|
7
7
|
|
|
8
|
-
//
|
|
9
|
-
$
|
|
8
|
+
// Define the transition properties for smoother animations with absolute positioning
|
|
9
|
+
$track-transition: left 0.2s ease, right 0.2s ease;
|
|
10
|
+
$handle-transition: left 0.2s ease, transform 0.2s ease;
|
|
11
|
+
$bubble-transition: left 0.2s ease, opacity 0.2s ease, visibility 0s linear 0.2s;
|
|
12
|
+
$bubble-transition-visible: left 0.2s ease, opacity 0.2s ease, visibility 0s;
|
|
10
13
|
|
|
11
14
|
$component: '#{base.$prefix}-slider';
|
|
12
15
|
|
|
@@ -14,17 +17,62 @@ $component: '#{base.$prefix}-slider';
|
|
|
14
17
|
// Base styles
|
|
15
18
|
position: relative;
|
|
16
19
|
width: 100%;
|
|
17
|
-
height: 40px;
|
|
18
20
|
display: flex;
|
|
19
|
-
|
|
21
|
+
flex-direction: column;
|
|
20
22
|
user-select: none;
|
|
21
23
|
touch-action: none;
|
|
24
|
+
padding: 8px 0;
|
|
22
25
|
|
|
23
26
|
// Container should not have a focus outline
|
|
24
27
|
&:focus {
|
|
25
28
|
outline: none;
|
|
26
29
|
}
|
|
27
30
|
|
|
31
|
+
// Label styles
|
|
32
|
+
&-label {
|
|
33
|
+
display: block;
|
|
34
|
+
font-size: 18px;
|
|
35
|
+
font-weight: 400;
|
|
36
|
+
color: t.color('on-surface');
|
|
37
|
+
margin-bottom: 4px;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// Icon positioning
|
|
41
|
+
&-icon {
|
|
42
|
+
display: flex;
|
|
43
|
+
align-items: center;
|
|
44
|
+
justify-content: center;
|
|
45
|
+
color: t.color('on-surface-variant');
|
|
46
|
+
position: absolute;
|
|
47
|
+
width: 40px;
|
|
48
|
+
height: 40px;
|
|
49
|
+
top: 16px;
|
|
50
|
+
|
|
51
|
+
svg {
|
|
52
|
+
width: 24px;
|
|
53
|
+
height: 24px;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// When slider has icon at end position
|
|
58
|
+
&--icon {
|
|
59
|
+
.#{$component}-label {
|
|
60
|
+
margin-left: 48px;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.#{$component}-container {
|
|
64
|
+
margin-left: 48px;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// Slider container - holds all the slider elements
|
|
69
|
+
&-container {
|
|
70
|
+
position: relative;
|
|
71
|
+
height: 40px;
|
|
72
|
+
display: flex;
|
|
73
|
+
align-items: center;
|
|
74
|
+
}
|
|
75
|
+
|
|
28
76
|
&-track {
|
|
29
77
|
position: relative;
|
|
30
78
|
width: 100%;
|
|
@@ -42,15 +90,15 @@ $component: '#{base.$prefix}-slider';
|
|
|
42
90
|
}
|
|
43
91
|
}
|
|
44
92
|
|
|
45
|
-
//
|
|
46
|
-
&-
|
|
93
|
+
// Handle - updated with T-shape and proper focus styles
|
|
94
|
+
&-handle {
|
|
47
95
|
position: absolute;
|
|
48
96
|
top: 50%;
|
|
49
97
|
transform: translate(-50%, -50%);
|
|
50
98
|
cursor: pointer;
|
|
51
99
|
z-index: 4;
|
|
52
100
|
padding: 4px 0;
|
|
53
|
-
transition: $
|
|
101
|
+
transition: $handle-transition;
|
|
54
102
|
width: 16px;
|
|
55
103
|
height: 50px;
|
|
56
104
|
border-radius: 16px;
|
|
@@ -66,7 +114,7 @@ $component: '#{base.$prefix}-slider';
|
|
|
66
114
|
// Additional styling when focused
|
|
67
115
|
}
|
|
68
116
|
|
|
69
|
-
// Create a T-shaped
|
|
117
|
+
// Create a T-shaped handle using pseudo-elements
|
|
70
118
|
&::before {
|
|
71
119
|
pointer-events: none;
|
|
72
120
|
content: '';
|
|
@@ -103,7 +151,7 @@ $component: '#{base.$prefix}-slider';
|
|
|
103
151
|
pointer-events: auto;
|
|
104
152
|
}
|
|
105
153
|
|
|
106
|
-
// Make
|
|
154
|
+
// Make handle line slimmer during dragging (feedback)
|
|
107
155
|
.#{$component}--dragging & {
|
|
108
156
|
&::before {
|
|
109
157
|
width: 3px;
|
|
@@ -169,7 +217,7 @@ $component: '#{base.$prefix}-slider';
|
|
|
169
217
|
height: 100%;
|
|
170
218
|
background-color: t.color('primary');
|
|
171
219
|
transform-origin: left center;
|
|
172
|
-
transition: $
|
|
220
|
+
transition: $track-transition;
|
|
173
221
|
border-radius: 2px;
|
|
174
222
|
opacity: 0.24;
|
|
175
223
|
z-index: 1;
|
|
@@ -198,7 +246,7 @@ $component: '#{base.$prefix}-slider';
|
|
|
198
246
|
height: 100%;
|
|
199
247
|
background-color: t.color('primary');
|
|
200
248
|
transform-origin: left center;
|
|
201
|
-
transition: $
|
|
249
|
+
transition: $track-transition;
|
|
202
250
|
border-radius: 2px;
|
|
203
251
|
z-index: 1;
|
|
204
252
|
|
|
@@ -223,9 +271,8 @@ $component: '#{base.$prefix}-slider';
|
|
|
223
271
|
height: 100%;
|
|
224
272
|
background-color: t.color('primary');
|
|
225
273
|
transform-origin: left center;
|
|
226
|
-
transition: $
|
|
274
|
+
transition: $track-transition;
|
|
227
275
|
border-radius: 2px;
|
|
228
|
-
width: 100%;
|
|
229
276
|
z-index: 0;
|
|
230
277
|
|
|
231
278
|
.#{$component}--secondary & {
|
|
@@ -304,14 +351,14 @@ $component: '#{base.$prefix}-slider';
|
|
|
304
351
|
// Tick marks
|
|
305
352
|
&-tick {
|
|
306
353
|
position: absolute;
|
|
307
|
-
width:
|
|
308
|
-
height:
|
|
354
|
+
width: 4px;
|
|
355
|
+
height: 4px;
|
|
309
356
|
background-color: t.color('outline');
|
|
310
357
|
border-radius: 50%;
|
|
311
358
|
top: 50%;
|
|
312
359
|
transform: translate(-50%, -50%);
|
|
313
360
|
pointer-events: none;
|
|
314
|
-
opacity:
|
|
361
|
+
opacity: 0.8;
|
|
315
362
|
|
|
316
363
|
&:last-child, &:first-child {
|
|
317
364
|
display: none
|
|
@@ -333,6 +380,7 @@ $component: '#{base.$prefix}-slider';
|
|
|
333
380
|
// Inactive tick (unfilled)
|
|
334
381
|
&--inactive {
|
|
335
382
|
background-color: t.color('primary');
|
|
383
|
+
opacity: 0.5;
|
|
336
384
|
|
|
337
385
|
.#{$component}--secondary & {
|
|
338
386
|
background-color: t.color('secondary');
|
|
@@ -351,7 +399,7 @@ $component: '#{base.$prefix}-slider';
|
|
|
351
399
|
|
|
352
400
|
// Range slider styles
|
|
353
401
|
&--range {
|
|
354
|
-
.#{$component}-
|
|
402
|
+
.#{$component}-handle {
|
|
355
403
|
&:nth-of-type(1) {
|
|
356
404
|
z-index: 3;
|
|
357
405
|
}
|
|
@@ -377,14 +425,14 @@ $component: '#{base.$prefix}-slider';
|
|
|
377
425
|
transform: translateX(-50%);
|
|
378
426
|
visibility: hidden;
|
|
379
427
|
opacity: 0;
|
|
380
|
-
transition:
|
|
428
|
+
transition: $bubble-transition;
|
|
381
429
|
pointer-events: none;
|
|
382
430
|
|
|
383
431
|
// Show value when interacting
|
|
384
432
|
&--visible {
|
|
385
433
|
visibility: visible;
|
|
386
434
|
opacity: 1;
|
|
387
|
-
transition:
|
|
435
|
+
transition: $bubble-transition-visible;
|
|
388
436
|
}
|
|
389
437
|
}
|
|
390
438
|
|
|
@@ -398,19 +446,29 @@ $component: '#{base.$prefix}-slider';
|
|
|
398
446
|
|
|
399
447
|
// Sizes
|
|
400
448
|
&--small {
|
|
401
|
-
|
|
449
|
+
.#{$component}-container {
|
|
450
|
+
height: 32px;
|
|
451
|
+
}
|
|
402
452
|
|
|
403
|
-
.#{$component}-
|
|
453
|
+
.#{$component}-handle {
|
|
404
454
|
&::before {
|
|
405
455
|
height: 34px;
|
|
406
456
|
}
|
|
407
457
|
}
|
|
408
458
|
}
|
|
409
459
|
|
|
460
|
+
&--medium {
|
|
461
|
+
.#{$component}-container {
|
|
462
|
+
height: 40px;
|
|
463
|
+
}
|
|
464
|
+
}
|
|
465
|
+
|
|
410
466
|
&--large {
|
|
411
|
-
|
|
467
|
+
.#{$component}-container {
|
|
468
|
+
height: 48px;
|
|
469
|
+
}
|
|
412
470
|
|
|
413
|
-
.#{$component}-
|
|
471
|
+
.#{$component}-handle {
|
|
414
472
|
&::before {
|
|
415
473
|
height: 48px;
|
|
416
474
|
}
|
|
@@ -423,7 +481,8 @@ $component: '#{base.$prefix}-slider';
|
|
|
423
481
|
.#{$component}-start-track,
|
|
424
482
|
.#{$component}-active-track,
|
|
425
483
|
.#{$component}-remaining-track,
|
|
426
|
-
.#{$component}-
|
|
484
|
+
.#{$component}-handle,
|
|
485
|
+
.#{$component}-value {
|
|
427
486
|
transition: none;
|
|
428
487
|
}
|
|
429
488
|
}
|