@noxlovette/material 0.4.8 → 0.5.1
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/dist/animation/Shapes.stories.svelte +56 -0
- package/dist/animation/Shapes.stories.svelte.d.ts +3 -0
- package/dist/animation/TransitionPatterns.stories.svelte +359 -0
- package/dist/animation/TransitionPatterns.stories.svelte.d.ts +3 -0
- package/dist/animation/containerTransform.d.ts +35 -12
- package/dist/animation/containerTransform.js +31 -138
- package/dist/animation/enterExit.d.ts +30 -3
- package/dist/animation/enterExit.js +69 -22
- package/dist/animation/index.d.ts +2 -1
- package/dist/animation/index.js +2 -1
- package/dist/animation/presence.svelte.d.ts +47 -0
- package/dist/animation/presence.svelte.js +84 -0
- package/dist/animation/shapeMorph.svelte.d.ts +52 -0
- package/dist/animation/shapeMorph.svelte.js +112 -0
- package/dist/animation/shapesAnimatableSmall.d.ts +28 -22
- package/dist/animation/shapesAnimatableSmall.js +32 -23
- package/dist/animation/sharedAxisTransition.d.ts +57 -37
- package/dist/animation/sharedAxisTransition.js +74 -22
- package/dist/animation/skeleton.d.ts +16 -0
- package/dist/animation/skeleton.js +28 -0
- package/dist/animation/spring.d.ts +61 -0
- package/dist/animation/spring.js +53 -0
- package/dist/animation/springValue.svelte.d.ts +22 -0
- package/dist/animation/springValue.svelte.js +42 -0
- package/dist/animation/transition.d.ts +3 -1
- package/dist/animation/transition.js +3 -1
- package/dist/attachments/clickOutside.d.ts +13 -0
- package/dist/attachments/clickOutside.js +18 -0
- package/dist/attachments/index.d.ts +1 -0
- package/dist/attachments/index.js +1 -0
- package/dist/components/buttons/FAB.svelte +23 -16
- package/dist/components/buttons/FABMenu.svelte +24 -29
- package/dist/components/buttons/FABMenu.svelte.d.ts +2 -1
- package/dist/components/buttons/FABMenuItem.svelte +23 -20
- package/dist/components/buttons/FABMenuItem.svelte.d.ts +5 -1
- package/dist/components/buttons/split-button/SplitButton.svelte +10 -17
- package/dist/components/buttons/split-button/theme.js +1 -1
- package/dist/components/buttons/types.d.ts +3 -3
- package/dist/components/cards/theme.js +1 -1
- package/dist/components/containers/bottom-sheet/BottomSheet.stories.svelte +8 -12
- package/dist/components/containers/bottom-sheet/BottomSheet.svelte +67 -55
- package/dist/components/containers/bottom-sheet/BottomSheet.svelte.d.ts +1 -1
- package/dist/components/containers/bottom-sheet/types.d.ts +8 -2
- package/dist/components/containers/context-menu/ContextMenu.svelte +23 -36
- package/dist/components/containers/context-menu/theme.js +2 -2
- package/dist/components/containers/dialogue/Dialogue.svelte +49 -65
- package/dist/components/containers/link-preview/LinkPreview.svelte +12 -23
- package/dist/components/containers/link-preview/theme.d.ts +3 -3
- package/dist/components/containers/menu/Menu.svelte +14 -21
- package/dist/components/containers/menu/MenuSub.svelte +10 -17
- package/dist/components/containers/pane/DraggablePane.svelte +90 -5
- package/dist/components/containers/pane/DraggablePane.svelte.d.ts +1 -1
- package/dist/components/containers/pane/theme.js +2 -2
- package/dist/components/containers/popover/Popover.svelte +31 -42
- package/dist/components/containers/popover/theme.d.ts +3 -3
- package/dist/components/containers/scroll-area/theme.js +2 -2
- package/dist/components/containers/side-sheet/SideSheet.stories.svelte +10 -15
- package/dist/components/containers/side-sheet/SideSheet.svelte +44 -44
- package/dist/components/containers/side-sheet/SideSheet.svelte.d.ts +4 -3
- package/dist/components/containers/side-sheet/types.d.ts +8 -2
- package/dist/components/date/DateField.svelte +99 -92
- package/dist/components/date/DateField.svelte.d.ts +4 -5
- package/dist/components/date/DateRangeField.svelte +127 -155
- package/dist/components/date/DateRangeField.svelte.d.ts +4 -5
- package/dist/components/date/calendarMotion.d.ts +9 -0
- package/dist/components/date/calendarMotion.js +23 -0
- package/dist/components/date/theme.d.ts +95 -0
- package/dist/components/date/theme.js +103 -14
- package/dist/components/date/types.d.ts +13 -0
- package/dist/components/forms/checkbox/theme.js +2 -2
- package/dist/components/forms/command/theme.d.ts +3 -3
- package/dist/components/forms/command/theme.js +1 -1
- package/dist/components/forms/pin/theme.js +2 -2
- package/dist/components/forms/radio-group/theme.js +2 -2
- package/dist/components/forms/select/Select.svelte +42 -54
- package/dist/components/forms/select/theme.js +4 -4
- package/dist/components/forms/slider/Slider.svelte +144 -126
- package/dist/components/forms/slider/Slider.svelte.d.ts +3 -0
- package/dist/components/forms/slider/theme.d.ts +154 -48
- package/dist/components/forms/slider/theme.js +60 -20
- package/dist/components/forms/slider/types.d.ts +1 -1
- package/dist/components/forms/switch/theme.js +4 -4
- package/dist/components/forms/textfield/Textfield.svelte +1 -1
- package/dist/components/forms/textfield/theme.d.ts +12 -0
- package/dist/components/forms/textfield/theme.js +30 -10
- package/dist/components/forms/toggle-group/theme.js +1 -1
- package/dist/components/forms/tooltip/Tooltip.svelte +24 -35
- package/dist/components/nav/breadcrumb/theme.js +1 -1
- package/dist/components/nav/navbar/theme.js +2 -2
- package/dist/components/nav/rail/Rail.svelte +4 -5
- package/dist/components/nav/rail/theme.js +7 -7
- package/dist/components/nav/tabs/TabHolder.svelte +29 -3
- package/dist/components/nav/tabs/TabHolder.svelte.d.ts +3 -1
- package/dist/components/nav/tabs/theme.js +1 -1
- package/dist/components/progress/CircularProgress.svelte +78 -4
- package/dist/components/progress/CircularProgress.svelte.d.ts +5 -0
- package/dist/components/progress/LinearProgress.svelte +70 -7
- package/dist/components/progress/LinearProgress.svelte.d.ts +5 -0
- package/dist/components/progress/WavyLinearProgress.svelte +27 -3
- package/dist/components/progress/WavyLinearProgress.svelte.d.ts +3 -0
- package/dist/components/progress/_wavy.d.ts +2 -0
- package/dist/components/progress/_wavy.js +3 -1
- package/dist/components/snackbar/Snackbar.svelte +13 -17
- package/dist/components/table/TableBody.svelte +3 -16
- package/dist/components/table/TableBody.svelte.d.ts +1 -5
- package/dist/components/table/TableHeader.svelte +1 -1
- package/dist/components/table/theme.js +1 -1
- package/dist/components/table/types.d.ts +0 -7
- package/dist/components/time/TimeField.stories.svelte +41 -0
- package/dist/components/time/TimeField.stories.svelte.d.ts +19 -0
- package/dist/components/time/TimeField.svelte +69 -62
- package/dist/components/time/TimeField.svelte.d.ts +6 -0
- package/dist/components/time/TimepickerInput.svelte +8 -4
- package/dist/components/time/types.d.ts +11 -1
- package/dist/components/toolbar/theme.js +2 -2
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/styles/component.css +21 -22
- package/dist/styles/motion.css +317 -38
- package/dist/utils/Layer.svelte +16 -29
- package/dist/utils/icon/LoadingIndicator.svelte +61 -22
- package/dist/utils/icon/loadingShapes.d.ts +1 -0
- package/dist/utils/icon/loadingShapes.js +16 -0
- package/package.json +5 -2
- package/dist/actions/clickOutside.d.ts +0 -3
- package/dist/actions/clickOutside.js +0 -13
- package/dist/actions/floating.d.ts +0 -20
- package/dist/actions/floating.js +0 -87
- package/dist/actions/index.d.ts +0 -6
- package/dist/actions/index.js +0 -6
- package/dist/actions/keyboard.d.ts +0 -3
- package/dist/actions/keyboard.js +0 -14
- package/dist/actions/portal.d.ts +0 -3
- package/dist/actions/portal.js +0 -8
- package/dist/actions/positionFloating.d.ts +0 -10
- package/dist/actions/positionFloating.js +0 -59
- package/dist/actions/rovingFocusGroup.d.ts +0 -20
- package/dist/actions/rovingFocusGroup.js +0 -82
- package/dist/animation/easing.d.ts +0 -6
- package/dist/animation/easing.js +0 -78
- package/dist/animation/outroClass.d.ts +0 -3
- package/dist/animation/outroClass.js +0 -20
- package/dist/animation/transitionTypes.d.ts +0 -8
- package/dist/animation/transitionTypes.js +0 -1
|
@@ -18,9 +18,8 @@ export const dateRangeField = tv({
|
|
|
18
18
|
group-data-[invalid]:text-md-sys-color-error ml-3 text-[24px]
|
|
19
19
|
`,
|
|
20
20
|
trailingIcon: `
|
|
21
|
-
text-md-sys-color-on-surface-variant
|
|
22
|
-
group-
|
|
23
|
-
group-data-[invalid]:text-md-sys-color-error mr-3 text-[24px]
|
|
21
|
+
mr-1 shrink-0 text-md-sys-color-on-surface-variant
|
|
22
|
+
group-data-[invalid]:text-md-sys-color-error
|
|
24
23
|
`,
|
|
25
24
|
separator: `
|
|
26
25
|
text-md-sys-color-on-surface-variant select-none shrink-0
|
|
@@ -30,7 +29,7 @@ export const dateRangeField = tv({
|
|
|
30
29
|
md-sys-typescale-body-small
|
|
31
30
|
text-md-sys-color-on-surface-variant
|
|
32
31
|
pointer-events-none
|
|
33
|
-
transition-[top,font-size,line-height,color,transform]
|
|
32
|
+
transition-[top,font-size,line-height,color,transform] md-sys-motion-fast-spatial
|
|
34
33
|
group-focus-within:text-md-sys-color-primary
|
|
35
34
|
z-20
|
|
36
35
|
`,
|
|
@@ -38,7 +37,7 @@ export const dateRangeField = tv({
|
|
|
38
37
|
ml-0.5
|
|
39
38
|
text-md-sys-color-error
|
|
40
39
|
group-focus-within:text-md-sys-color-primary
|
|
41
|
-
transition-colors
|
|
40
|
+
transition-colors md-sys-motion-effects
|
|
42
41
|
`,
|
|
43
42
|
supportingText: `
|
|
44
43
|
px-4 pt-1 flex justify-between
|
|
@@ -54,7 +53,7 @@ export const dateRangeField = tv({
|
|
|
54
53
|
after:absolute after:bottom-0 after:left-0 after:right-0
|
|
55
54
|
state-layer before:rounded-xs hover:before:bg-md-sys-color-on-surface/8
|
|
56
55
|
after:h-px after:bg-md-sys-color-on-surface-variant
|
|
57
|
-
after:transition-[height,background-color] after:
|
|
56
|
+
after:transition-[height,background-color] after:md-sys-motion-fast-spatial
|
|
58
57
|
hover:after:bg-md-sys-color-on-surface
|
|
59
58
|
focus-within:after:bg-md-sys-color-primary focus-within:after:h-[2px]
|
|
60
59
|
disabled:bg-md-sys-color-on-surface/4
|
|
@@ -64,7 +63,7 @@ export const dateRangeField = tv({
|
|
|
64
63
|
outlined: {
|
|
65
64
|
base: `
|
|
66
65
|
rounded-xs border border-md-sys-color-outline
|
|
67
|
-
transition-colors
|
|
66
|
+
transition-colors md-sys-motion-fast-effects
|
|
68
67
|
hover:border-md-sys-color-on-surface
|
|
69
68
|
focus-within:border-2 focus-within:border-md-sys-color-primary
|
|
70
69
|
`
|
|
@@ -128,16 +127,15 @@ export const dateField = tv({
|
|
|
128
127
|
group-data-[invalid]:text-md-sys-color-error ml-3 text-[24px]
|
|
129
128
|
`,
|
|
130
129
|
trailingIcon: `
|
|
131
|
-
text-md-sys-color-on-surface-variant
|
|
132
|
-
group-
|
|
133
|
-
group-data-[invalid]:text-md-sys-color-error mr-3 text-[24px]
|
|
130
|
+
mr-1 shrink-0 text-md-sys-color-on-surface-variant
|
|
131
|
+
group-data-[invalid]:text-md-sys-color-error
|
|
134
132
|
`,
|
|
135
133
|
label: `
|
|
136
134
|
absolute left-4 top-1.5
|
|
137
135
|
md-sys-typescale-body-small
|
|
138
136
|
text-md-sys-color-on-surface-variant
|
|
139
137
|
pointer-events-none
|
|
140
|
-
transition-[top,font-size,line-height,color,transform]
|
|
138
|
+
transition-[top,font-size,line-height,color,transform] md-sys-motion-fast-spatial
|
|
141
139
|
group-focus-within:text-md-sys-color-primary
|
|
142
140
|
z-20
|
|
143
141
|
`,
|
|
@@ -145,7 +143,7 @@ export const dateField = tv({
|
|
|
145
143
|
ml-0.5
|
|
146
144
|
text-md-sys-color-error
|
|
147
145
|
group-focus-within:text-md-sys-color-primary
|
|
148
|
-
transition-colors
|
|
146
|
+
transition-colors md-sys-motion-effects
|
|
149
147
|
`,
|
|
150
148
|
supportingText: `
|
|
151
149
|
px-4 pt-1 flex justify-between
|
|
@@ -155,7 +153,7 @@ export const dateField = tv({
|
|
|
155
153
|
fieldset: `
|
|
156
154
|
absolute -top-[5px] left-0 right-0 bottom-0 m-0 px-2
|
|
157
155
|
pointer-events-none rounded-xs border border-md-sys-color-outline
|
|
158
|
-
transition-colors
|
|
156
|
+
transition-colors md-sys-motion-fast-effects
|
|
159
157
|
|
|
160
158
|
group-hover:border-md-sys-color-on-surface
|
|
161
159
|
group-focus-within:border-2 group-focus-within:border-md-sys-color-primary
|
|
@@ -176,7 +174,7 @@ export const dateField = tv({
|
|
|
176
174
|
after:absolute after:bottom-0 after:left-0 after:right-0
|
|
177
175
|
state-layer before:rounded-xs hover:before:bg-md-sys-color-on-surface/8
|
|
178
176
|
after:h-px after:bg-md-sys-color-on-surface-variant
|
|
179
|
-
after:transition-[height,background-color] after:
|
|
177
|
+
after:transition-[height,background-color] after:md-sys-motion-fast-spatial
|
|
180
178
|
hover:after:bg-md-sys-color-on-surface
|
|
181
179
|
focus-within:after:bg-md-sys-color-primary focus-within:after:h-[2px]
|
|
182
180
|
disabled:bg-md-sys-color-on-surface/4
|
|
@@ -216,3 +214,94 @@ export const dateField = tv({
|
|
|
216
214
|
variant: 'outlined'
|
|
217
215
|
}
|
|
218
216
|
});
|
|
217
|
+
/** Segments of the typed date (`DatePicker.Segment` / `DateRangePicker.Segment`). */
|
|
218
|
+
export const dateSegment = tv({
|
|
219
|
+
base: `
|
|
220
|
+
rounded-xs px-0.5 py-0.5 select-none cursor-default outline-none
|
|
221
|
+
transition-colors md-sys-motion-fast-effects
|
|
222
|
+
`,
|
|
223
|
+
variants: {
|
|
224
|
+
part: {
|
|
225
|
+
literal: 'text-md-sys-color-on-surface-variant px-0',
|
|
226
|
+
value: `
|
|
227
|
+
text-md-sys-color-on-surface
|
|
228
|
+
aria-[valuetext=Empty]:text-md-sys-color-on-surface-variant
|
|
229
|
+
hover:bg-md-sys-color-on-surface/8
|
|
230
|
+
focus:bg-md-sys-color-primary-container focus:text-md-sys-color-on-primary-container
|
|
231
|
+
`
|
|
232
|
+
}
|
|
233
|
+
},
|
|
234
|
+
defaultVariants: {
|
|
235
|
+
part: 'value'
|
|
236
|
+
}
|
|
237
|
+
});
|
|
238
|
+
/**
|
|
239
|
+
* Docked date picker surface, shared by DateField and DateRangeField.
|
|
240
|
+
* @see https://m3.material.io/components/date-pickers/specs#docked-date-picker
|
|
241
|
+
* 360dp wide = 12dp padding + 7 × 48dp targets; each day is a 40dp circle inside its target.
|
|
242
|
+
*/
|
|
243
|
+
export const dateCalendar = tv({
|
|
244
|
+
slots: {
|
|
245
|
+
surface: `
|
|
246
|
+
w-90 rounded-lg px-3 pb-3
|
|
247
|
+
bg-md-sys-color-surface-container-high shadow-elevation-3
|
|
248
|
+
text-md-sys-color-on-surface
|
|
249
|
+
`,
|
|
250
|
+
header: `
|
|
251
|
+
flex h-14 items-center justify-between pl-4 pr-1
|
|
252
|
+
`,
|
|
253
|
+
heading: `
|
|
254
|
+
md-sys-typescale-label-large text-md-sys-color-on-surface-variant
|
|
255
|
+
`,
|
|
256
|
+
nav: `
|
|
257
|
+
flex items-center text-md-sys-color-on-surface-variant
|
|
258
|
+
`,
|
|
259
|
+
grid: `
|
|
260
|
+
w-full border-collapse select-none
|
|
261
|
+
`,
|
|
262
|
+
row: `
|
|
263
|
+
flex w-full
|
|
264
|
+
`,
|
|
265
|
+
weekday: `
|
|
266
|
+
flex size-12 items-center justify-center
|
|
267
|
+
md-sys-typescale-body-large font-normal text-md-sys-color-on-surface
|
|
268
|
+
`,
|
|
269
|
+
/* The range band runs behind every day in the range. On the endpoints it covers only the inner
|
|
270
|
+
half, so it meets the selected circle instead of sticking out past it. A one-day range has
|
|
271
|
+
no band. */
|
|
272
|
+
cell: `
|
|
273
|
+
relative flex size-12 items-center justify-center p-0
|
|
274
|
+
before:absolute before:inset-x-0 before:h-10 before:bg-md-sys-color-secondary-container
|
|
275
|
+
before:opacity-0 before:transition-opacity before:md-sys-motion-fast-effects
|
|
276
|
+
data-range-middle:before:opacity-100
|
|
277
|
+
data-highlighted:before:opacity-100
|
|
278
|
+
data-range-start:before:opacity-100 data-range-end:before:opacity-100
|
|
279
|
+
data-range-start:before:left-1/2 data-range-end:before:right-1/2
|
|
280
|
+
data-range-start:data-range-end:before:opacity-0
|
|
281
|
+
data-outside-month:before:opacity-0
|
|
282
|
+
`,
|
|
283
|
+
day: `
|
|
284
|
+
relative flex size-10 items-center justify-center rounded-full
|
|
285
|
+
md-sys-typescale-body-large text-md-sys-color-on-surface
|
|
286
|
+
cursor-pointer outline-none
|
|
287
|
+
transition-colors md-sys-motion-fast-effects
|
|
288
|
+
|
|
289
|
+
focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-md-sys-color-secondary
|
|
290
|
+
|
|
291
|
+
data-today:border data-today:border-md-sys-color-primary data-today:text-md-sys-color-primary
|
|
292
|
+
|
|
293
|
+
data-range-middle:text-md-sys-color-on-secondary-container
|
|
294
|
+
data-highlighted:text-md-sys-color-on-secondary-container
|
|
295
|
+
|
|
296
|
+
data-selected:not-data-range-middle:border-transparent
|
|
297
|
+
data-selected:not-data-range-middle:bg-md-sys-color-primary
|
|
298
|
+
data-selected:not-data-range-middle:text-md-sys-color-on-primary
|
|
299
|
+
|
|
300
|
+
data-disabled:cursor-not-allowed data-disabled:text-md-sys-color-on-surface/38
|
|
301
|
+
data-unavailable:cursor-not-allowed data-unavailable:text-md-sys-color-on-surface/38
|
|
302
|
+
data-unavailable:line-through
|
|
303
|
+
|
|
304
|
+
data-outside-month:invisible
|
|
305
|
+
`
|
|
306
|
+
}
|
|
307
|
+
});
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { IconProps } from '../../utils/index.js';
|
|
1
2
|
import type { DateValue } from '@internationalized/date';
|
|
2
3
|
import type { Snippet } from 'svelte';
|
|
3
4
|
import type { HTMLAttributes } from 'svelte/elements';
|
|
@@ -37,6 +38,18 @@ export interface BaseDateProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
37
38
|
* @default 'outlined'
|
|
38
39
|
*/
|
|
39
40
|
variant?: 'filled' | 'outlined';
|
|
41
|
+
/**
|
|
42
|
+
* BCP 47 locale for segment order, month names and weekday labels.
|
|
43
|
+
* @default 'en'
|
|
44
|
+
*/
|
|
45
|
+
locale?: string;
|
|
46
|
+
/**
|
|
47
|
+
* First day of the week in the calendar, 0 = Sunday.
|
|
48
|
+
* @default 0
|
|
49
|
+
*/
|
|
50
|
+
weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6;
|
|
51
|
+
/** Optional icon before the date segments. */
|
|
52
|
+
leadingIconProps?: IconProps;
|
|
40
53
|
}
|
|
41
54
|
export interface DateFieldProps extends BaseDateProps {
|
|
42
55
|
/**
|
|
@@ -3,8 +3,8 @@ export const checkbox = tv({
|
|
|
3
3
|
slots: {
|
|
4
4
|
root: 'group inline-flex min-h-10 select-none items-start gap-3 text-md-sys-color-on-surface min-h-4.5 cursor-pointer',
|
|
5
5
|
container: 'relative inline-flex size-[18px] shrink-0',
|
|
6
|
-
control: 'layer-container absolute -inset-[11px] rounded-full text-md-sys-color-on-surface-variant state-layer before:rounded-full group-focus-visible:outline group-focus-visible:outline-3 group-focus-visible:outline-offset-2 group-focus-visible:outline-md-sys-color-secondary transition-colors
|
|
7
|
-
box: 'absolute inset-[11px] rounded-[4px] border-2 border-current bg-md-sys-color-surface transition-colors
|
|
6
|
+
control: 'layer-container absolute -inset-[11px] rounded-full text-md-sys-color-on-surface-variant state-layer before:rounded-full group-focus-visible:outline group-focus-visible:outline-3 group-focus-visible:outline-offset-2 group-focus-visible:outline-md-sys-color-secondary transition-colors md-sys-motion-fast-effects',
|
|
7
|
+
box: 'absolute inset-[11px] rounded-[4px] border-2 border-current bg-md-sys-color-surface transition-colors md-sys-motion-fast-effects',
|
|
8
8
|
checkIcon: 'pointer-events-none absolute inset-0 m-auto size-3.5 text-md-sys-color-on-primary opacity-0 scale-75',
|
|
9
9
|
indeterminateIcon: 'pointer-events-none absolute inset-0 m-auto block h-0.5 w-3 rounded-full bg-md-sys-color-on-primary opacity-0 scale-75',
|
|
10
10
|
label: 'md-sys-typescale-body-large leading-5 text-md-sys-color-on-surface cursor-pointer'
|
|
@@ -3,12 +3,12 @@ export type CommandVariants = VariantProps<typeof command>;
|
|
|
3
3
|
export declare const command: import("tailwind-variants").TVReturnType<{
|
|
4
4
|
[key: string]: {
|
|
5
5
|
[key: string]: import("tailwind-variants").ClassValue | {
|
|
6
|
+
item?: import("tailwind-variants").ClassValue;
|
|
6
7
|
input?: import("tailwind-variants").ClassValue;
|
|
7
8
|
base?: import("tailwind-variants").ClassValue;
|
|
8
9
|
group?: import("tailwind-variants").ClassValue;
|
|
9
10
|
list?: import("tailwind-variants").ClassValue;
|
|
10
11
|
separator?: import("tailwind-variants").ClassValue;
|
|
11
|
-
item?: import("tailwind-variants").ClassValue;
|
|
12
12
|
inputWrapper?: import("tailwind-variants").ClassValue;
|
|
13
13
|
inputIcon?: import("tailwind-variants").ClassValue;
|
|
14
14
|
empty?: import("tailwind-variants").ClassValue;
|
|
@@ -18,12 +18,12 @@ export declare const command: import("tailwind-variants").TVReturnType<{
|
|
|
18
18
|
} | {
|
|
19
19
|
[x: string]: {
|
|
20
20
|
[x: string]: import("tailwind-variants").ClassValue | {
|
|
21
|
+
item?: import("tailwind-variants").ClassValue;
|
|
21
22
|
input?: import("tailwind-variants").ClassValue;
|
|
22
23
|
base?: import("tailwind-variants").ClassValue;
|
|
23
24
|
group?: import("tailwind-variants").ClassValue;
|
|
24
25
|
list?: import("tailwind-variants").ClassValue;
|
|
25
26
|
separator?: import("tailwind-variants").ClassValue;
|
|
26
|
-
item?: import("tailwind-variants").ClassValue;
|
|
27
27
|
inputWrapper?: import("tailwind-variants").ClassValue;
|
|
28
28
|
inputIcon?: import("tailwind-variants").ClassValue;
|
|
29
29
|
empty?: import("tailwind-variants").ClassValue;
|
|
@@ -44,12 +44,12 @@ export declare const command: import("tailwind-variants").TVReturnType<{
|
|
|
44
44
|
}, undefined, {
|
|
45
45
|
[key: string]: {
|
|
46
46
|
[key: string]: import("tailwind-variants").ClassValue | {
|
|
47
|
+
item?: import("tailwind-variants").ClassValue;
|
|
47
48
|
input?: import("tailwind-variants").ClassValue;
|
|
48
49
|
base?: import("tailwind-variants").ClassValue;
|
|
49
50
|
group?: import("tailwind-variants").ClassValue;
|
|
50
51
|
list?: import("tailwind-variants").ClassValue;
|
|
51
52
|
separator?: import("tailwind-variants").ClassValue;
|
|
52
|
-
item?: import("tailwind-variants").ClassValue;
|
|
53
53
|
inputWrapper?: import("tailwind-variants").ClassValue;
|
|
54
54
|
inputIcon?: import("tailwind-variants").ClassValue;
|
|
55
55
|
empty?: import("tailwind-variants").ClassValue;
|
|
@@ -9,7 +9,7 @@ export const command = tv({
|
|
|
9
9
|
empty: 'py-6 text-center md-sys-typescale-body-medium text-md-sys-color-on-surface-variant',
|
|
10
10
|
group: 'overflow-hidden p-1 text-md-sys-color-on-surface-variant [&_[data-command-group-heading]]:px-3 [&_[data-command-group-heading]]:py-2 [&_[data-command-group-heading]]:md-sys-typescale-label-medium [&_[data-command-group-heading]]:text-md-sys-color-on-surface-variant',
|
|
11
11
|
separator: '-mx-1 h-px bg-md-sys-color-outline-variant',
|
|
12
|
-
item: 'relative flex cursor-default select-none items-center rounded-lg px-3 py-3 md-sys-typescale-body-medium outline-none data-[selected=true]:bg-md-sys-color-secondary-container data-[selected=true]:text-md-sys-color-on-secondary-container data-[disabled=true]:cursor-not-allowed data-[disabled=true]:opacity-50 transition-colors',
|
|
12
|
+
item: 'relative flex cursor-default select-none items-center rounded-lg px-3 py-3 md-sys-typescale-body-medium outline-none data-[selected=true]:bg-md-sys-color-secondary-container data-[selected=true]:text-md-sys-color-on-secondary-container data-[disabled=true]:cursor-not-allowed data-[disabled=true]:opacity-50 transition-colors md-sys-motion-fast-effects',
|
|
13
13
|
itemIcon: 'mr-3 h-5 w-5 shrink-0'
|
|
14
14
|
}
|
|
15
15
|
});
|
|
@@ -8,9 +8,9 @@ export const pinInput = tv({
|
|
|
8
8
|
relative flex h-14 w-12 items-center justify-center
|
|
9
9
|
bg-md-sys-color-surface-container-highest rounded-t-xs
|
|
10
10
|
md-sys-typescale-headline-small text-md-sys-color-on-surface
|
|
11
|
-
transition-
|
|
11
|
+
transition-colors md-sys-motion-fast-effects
|
|
12
12
|
after:absolute after:bottom-0 after:left-0 after:right-0 after:h-px after:bg-md-sys-color-on-surface-variant
|
|
13
|
-
after:transition-[height,background-color] after:
|
|
13
|
+
after:transition-[height,background-color] after:md-sys-motion-fast-spatial
|
|
14
14
|
data-[focus]:after:bg-md-sys-color-primary data-[focus]:after:h-[2px]
|
|
15
15
|
data-[placeholder]:text-md-sys-color-on-surface-variant/38
|
|
16
16
|
`,
|
|
@@ -5,8 +5,8 @@ export const radioGroup = tv({
|
|
|
5
5
|
item: 'inline-flex min-h-10 cursor-pointer select-none items-center gap-3 text-md-sys-color-on-surface',
|
|
6
6
|
indicator: 'relative inline-flex size-[20px] shrink-0',
|
|
7
7
|
control: 'relative layer-container absolute -inset-[10px] rounded-full text-md-sys-color-on-surface-variant state-layer before:rounded-full',
|
|
8
|
-
outerRing: 'absolute inset-0 rounded-full border-2 border-md-sys-color-outline transition-colors',
|
|
9
|
-
innerDot: 'absolute inset-0 m-auto size-2.5 scale-0 rounded-full bg-md-sys-color-on-primary-container transition-transform
|
|
8
|
+
outerRing: 'absolute inset-0 rounded-full border-2 border-md-sys-color-outline transition-colors md-sys-motion-fast-effects',
|
|
9
|
+
innerDot: 'absolute inset-0 m-auto size-2.5 scale-0 rounded-full bg-md-sys-color-on-primary-container transition-transform md-sys-motion-fast-spatial',
|
|
10
10
|
label: 'md-sys-typescale-body-large text-md-sys-color-on-surface',
|
|
11
11
|
supporting: 'md-sys-typescale-body-medium text-md-sys-color-on-surface-variant'
|
|
12
12
|
},
|
|
@@ -8,13 +8,12 @@ Powered by bits-ui for accessibility and behavior.
|
|
|
8
8
|
@see https://m3.material.io/components/menus/overview
|
|
9
9
|
-->
|
|
10
10
|
<script lang="ts">
|
|
11
|
+
import { enterExit, presence } from '../../../animation/index.js';
|
|
11
12
|
import { Select } from 'bits-ui';
|
|
12
13
|
import { select as selectCls } from './theme.js';
|
|
13
14
|
import { Icon } from '../../../utils/index.js';
|
|
14
15
|
import type { SelectProps } from './types.js';
|
|
15
16
|
import clsx from 'clsx';
|
|
16
|
-
import { enterExit } from '../../../animation/enterExit.js';
|
|
17
|
-
import { easeEmphasized } from '../../../animation/easing.js';
|
|
18
17
|
|
|
19
18
|
let {
|
|
20
19
|
value = $bindable(),
|
|
@@ -66,7 +65,6 @@ Powered by bits-ui for accessibility and behavior.
|
|
|
66
65
|
|
|
67
66
|
<Select.Portal disabled={portalDisabled}>
|
|
68
67
|
<Select.Content
|
|
69
|
-
forceMount
|
|
70
68
|
class={cls.content({ class: clsx('z-[100]', contentProps?.class) })}
|
|
71
69
|
sideOffset={4}
|
|
72
70
|
align="start"
|
|
@@ -74,58 +72,48 @@ Powered by bits-ui for accessibility and behavior.
|
|
|
74
72
|
>
|
|
75
73
|
{#snippet child({ wrapperProps, props, open })}
|
|
76
74
|
<div {...wrapperProps} class={clsx('z-[100]', wrapperProps.class as any)}>
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
75
|
+
<div
|
|
76
|
+
{...props}
|
|
77
|
+
class={clsx('relative flex flex-col outline-none', props.class as any)}
|
|
78
|
+
{@attach presence(() => open, enterExit.scale)}
|
|
79
|
+
style:width="var(--bits-select-anchor-width)"
|
|
80
|
+
style:max-width="min(calc(100vw - 32px), 560px)"
|
|
81
|
+
>
|
|
82
|
+
<Select.Viewport class="w-full">
|
|
83
|
+
{#each options as item, i (i)}
|
|
84
|
+
{#if item.type === 'group'}
|
|
85
|
+
<Select.Group>
|
|
86
|
+
{#if item.heading}
|
|
87
|
+
<Select.GroupHeading class={cls.groupLabel()}>
|
|
88
|
+
{item.heading}
|
|
89
|
+
</Select.GroupHeading>
|
|
90
|
+
{/if}
|
|
91
|
+
{#each item.items as innerItem, j (j)}
|
|
92
|
+
{#if innerItem.type !== 'group'}
|
|
93
|
+
<Select.Item {...innerItem} class={cls.item()}>
|
|
94
|
+
{#snippet children({ selected })}
|
|
95
|
+
<span class="flex-1 truncate">{innerItem.label}</span>
|
|
96
|
+
{#if selected}
|
|
97
|
+
<Icon aria-hidden="true" name="check" class="size-5 shrink-0" />
|
|
98
|
+
{/if}
|
|
99
|
+
{/snippet}
|
|
100
|
+
</Select.Item>
|
|
97
101
|
{/if}
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
{/each}
|
|
114
|
-
</Select.Group>
|
|
115
|
-
{:else}
|
|
116
|
-
<Select.Item {...item} class={cls.item()}>
|
|
117
|
-
{#snippet children({ selected })}
|
|
118
|
-
<span class="flex-1 truncate">{item.label}</span>
|
|
119
|
-
{#if selected}
|
|
120
|
-
<Icon aria-hidden="true" name="check" class="size-5 shrink-0" />
|
|
121
|
-
{/if}
|
|
122
|
-
{/snippet}
|
|
123
|
-
</Select.Item>
|
|
124
|
-
{/if}
|
|
125
|
-
{/each}
|
|
126
|
-
</Select.Viewport>
|
|
127
|
-
</div>
|
|
128
|
-
{/if}
|
|
102
|
+
{/each}
|
|
103
|
+
</Select.Group>
|
|
104
|
+
{:else}
|
|
105
|
+
<Select.Item {...item} class={cls.item()}>
|
|
106
|
+
{#snippet children({ selected })}
|
|
107
|
+
<span class="flex-1 truncate">{item.label}</span>
|
|
108
|
+
{#if selected}
|
|
109
|
+
<Icon aria-hidden="true" name="check" class="size-5 shrink-0" />
|
|
110
|
+
{/if}
|
|
111
|
+
{/snippet}
|
|
112
|
+
</Select.Item>
|
|
113
|
+
{/if}
|
|
114
|
+
{/each}
|
|
115
|
+
</Select.Viewport>
|
|
116
|
+
</div>
|
|
129
117
|
</div>
|
|
130
118
|
{/snippet}
|
|
131
119
|
</Select.Content>
|
|
@@ -28,7 +28,7 @@ export const select = tv({
|
|
|
28
28
|
mr-3 text-md-sys-color-on-surface-variant size-6
|
|
29
29
|
group-data-[state=open]:text-md-sys-color-primary
|
|
30
30
|
group-data-[invalid]:text-md-sys-color-error z-20 text-[24px]
|
|
31
|
-
transition-transform
|
|
31
|
+
transition-transform md-sys-motion-fast-spatial
|
|
32
32
|
group-data-[state=open]:rotate-180
|
|
33
33
|
`,
|
|
34
34
|
content: `
|
|
@@ -45,7 +45,7 @@ export const select = tv({
|
|
|
45
45
|
data-[selected]:bg-md-sys-color-secondary-container
|
|
46
46
|
data-[selected]:text-md-sys-color-on-secondary-container
|
|
47
47
|
data-[disabled]:cursor-not-allowed data-[disabled]:opacity-38
|
|
48
|
-
transition-colors
|
|
48
|
+
transition-colors md-sys-motion-fast-effects
|
|
49
49
|
`,
|
|
50
50
|
groupLabel: `
|
|
51
51
|
px-3 pt-2 pb-1 md-sys-typescale-label-medium
|
|
@@ -68,7 +68,7 @@ export const select = tv({
|
|
|
68
68
|
bg-md-sys-color-surface-container-highest
|
|
69
69
|
rounded-t-xs state-layer before:rounded-xs hover:before:bg-md-sys-color-on-surface/8
|
|
70
70
|
after:absolute after:bottom-0 after:left-0 after:right-0 after:h-px after:bg-md-sys-color-on-surface-variant
|
|
71
|
-
after:transition-[height,background-color] after:
|
|
71
|
+
after:transition-[height,background-color] after:md-sys-motion-fast-spatial
|
|
72
72
|
hover:after:bg-md-sys-color-on-surface
|
|
73
73
|
has-[[data-state=open]]:after:bg-md-sys-color-primary
|
|
74
74
|
has-[[data-state=open]]:after:h-[2px]
|
|
@@ -79,7 +79,7 @@ export const select = tv({
|
|
|
79
79
|
outlined: {
|
|
80
80
|
base: `
|
|
81
81
|
rounded-xs border border-md-sys-color-outline
|
|
82
|
-
transition-colors
|
|
82
|
+
transition-colors md-sys-motion-fast-effects
|
|
83
83
|
hover:border-md-sys-color-on-surface
|
|
84
84
|
has-[[data-state=open]]:border-2 has-[[data-state=open]]:border-md-sys-color-primary
|
|
85
85
|
`
|