@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.
Files changed (144) hide show
  1. package/dist/animation/Shapes.stories.svelte +56 -0
  2. package/dist/animation/Shapes.stories.svelte.d.ts +3 -0
  3. package/dist/animation/TransitionPatterns.stories.svelte +359 -0
  4. package/dist/animation/TransitionPatterns.stories.svelte.d.ts +3 -0
  5. package/dist/animation/containerTransform.d.ts +35 -12
  6. package/dist/animation/containerTransform.js +31 -138
  7. package/dist/animation/enterExit.d.ts +30 -3
  8. package/dist/animation/enterExit.js +69 -22
  9. package/dist/animation/index.d.ts +2 -1
  10. package/dist/animation/index.js +2 -1
  11. package/dist/animation/presence.svelte.d.ts +47 -0
  12. package/dist/animation/presence.svelte.js +84 -0
  13. package/dist/animation/shapeMorph.svelte.d.ts +52 -0
  14. package/dist/animation/shapeMorph.svelte.js +112 -0
  15. package/dist/animation/shapesAnimatableSmall.d.ts +28 -22
  16. package/dist/animation/shapesAnimatableSmall.js +32 -23
  17. package/dist/animation/sharedAxisTransition.d.ts +57 -37
  18. package/dist/animation/sharedAxisTransition.js +74 -22
  19. package/dist/animation/skeleton.d.ts +16 -0
  20. package/dist/animation/skeleton.js +28 -0
  21. package/dist/animation/spring.d.ts +61 -0
  22. package/dist/animation/spring.js +53 -0
  23. package/dist/animation/springValue.svelte.d.ts +22 -0
  24. package/dist/animation/springValue.svelte.js +42 -0
  25. package/dist/animation/transition.d.ts +3 -1
  26. package/dist/animation/transition.js +3 -1
  27. package/dist/attachments/clickOutside.d.ts +13 -0
  28. package/dist/attachments/clickOutside.js +18 -0
  29. package/dist/attachments/index.d.ts +1 -0
  30. package/dist/attachments/index.js +1 -0
  31. package/dist/components/buttons/FAB.svelte +23 -16
  32. package/dist/components/buttons/FABMenu.svelte +24 -29
  33. package/dist/components/buttons/FABMenu.svelte.d.ts +2 -1
  34. package/dist/components/buttons/FABMenuItem.svelte +23 -20
  35. package/dist/components/buttons/FABMenuItem.svelte.d.ts +5 -1
  36. package/dist/components/buttons/split-button/SplitButton.svelte +10 -17
  37. package/dist/components/buttons/split-button/theme.js +1 -1
  38. package/dist/components/buttons/types.d.ts +3 -3
  39. package/dist/components/cards/theme.js +1 -1
  40. package/dist/components/containers/bottom-sheet/BottomSheet.stories.svelte +8 -12
  41. package/dist/components/containers/bottom-sheet/BottomSheet.svelte +67 -55
  42. package/dist/components/containers/bottom-sheet/BottomSheet.svelte.d.ts +1 -1
  43. package/dist/components/containers/bottom-sheet/types.d.ts +8 -2
  44. package/dist/components/containers/context-menu/ContextMenu.svelte +23 -36
  45. package/dist/components/containers/context-menu/theme.js +2 -2
  46. package/dist/components/containers/dialogue/Dialogue.svelte +49 -65
  47. package/dist/components/containers/link-preview/LinkPreview.svelte +12 -23
  48. package/dist/components/containers/link-preview/theme.d.ts +3 -3
  49. package/dist/components/containers/menu/Menu.svelte +14 -21
  50. package/dist/components/containers/menu/MenuSub.svelte +10 -17
  51. package/dist/components/containers/pane/DraggablePane.svelte +90 -5
  52. package/dist/components/containers/pane/DraggablePane.svelte.d.ts +1 -1
  53. package/dist/components/containers/pane/theme.js +2 -2
  54. package/dist/components/containers/popover/Popover.svelte +31 -42
  55. package/dist/components/containers/popover/theme.d.ts +3 -3
  56. package/dist/components/containers/scroll-area/theme.js +2 -2
  57. package/dist/components/containers/side-sheet/SideSheet.stories.svelte +10 -15
  58. package/dist/components/containers/side-sheet/SideSheet.svelte +44 -44
  59. package/dist/components/containers/side-sheet/SideSheet.svelte.d.ts +4 -3
  60. package/dist/components/containers/side-sheet/types.d.ts +8 -2
  61. package/dist/components/date/DateField.svelte +99 -92
  62. package/dist/components/date/DateField.svelte.d.ts +4 -5
  63. package/dist/components/date/DateRangeField.svelte +127 -155
  64. package/dist/components/date/DateRangeField.svelte.d.ts +4 -5
  65. package/dist/components/date/calendarMotion.d.ts +9 -0
  66. package/dist/components/date/calendarMotion.js +23 -0
  67. package/dist/components/date/theme.d.ts +95 -0
  68. package/dist/components/date/theme.js +103 -14
  69. package/dist/components/date/types.d.ts +13 -0
  70. package/dist/components/forms/checkbox/theme.js +2 -2
  71. package/dist/components/forms/command/theme.d.ts +3 -3
  72. package/dist/components/forms/command/theme.js +1 -1
  73. package/dist/components/forms/pin/theme.js +2 -2
  74. package/dist/components/forms/radio-group/theme.js +2 -2
  75. package/dist/components/forms/select/Select.svelte +42 -54
  76. package/dist/components/forms/select/theme.js +4 -4
  77. package/dist/components/forms/slider/Slider.svelte +144 -126
  78. package/dist/components/forms/slider/Slider.svelte.d.ts +3 -0
  79. package/dist/components/forms/slider/theme.d.ts +154 -48
  80. package/dist/components/forms/slider/theme.js +60 -20
  81. package/dist/components/forms/slider/types.d.ts +1 -1
  82. package/dist/components/forms/switch/theme.js +4 -4
  83. package/dist/components/forms/textfield/Textfield.svelte +1 -1
  84. package/dist/components/forms/textfield/theme.d.ts +12 -0
  85. package/dist/components/forms/textfield/theme.js +30 -10
  86. package/dist/components/forms/toggle-group/theme.js +1 -1
  87. package/dist/components/forms/tooltip/Tooltip.svelte +24 -35
  88. package/dist/components/nav/breadcrumb/theme.js +1 -1
  89. package/dist/components/nav/navbar/theme.js +2 -2
  90. package/dist/components/nav/rail/Rail.svelte +4 -5
  91. package/dist/components/nav/rail/theme.js +7 -7
  92. package/dist/components/nav/tabs/TabHolder.svelte +29 -3
  93. package/dist/components/nav/tabs/TabHolder.svelte.d.ts +3 -1
  94. package/dist/components/nav/tabs/theme.js +1 -1
  95. package/dist/components/progress/CircularProgress.svelte +78 -4
  96. package/dist/components/progress/CircularProgress.svelte.d.ts +5 -0
  97. package/dist/components/progress/LinearProgress.svelte +70 -7
  98. package/dist/components/progress/LinearProgress.svelte.d.ts +5 -0
  99. package/dist/components/progress/WavyLinearProgress.svelte +27 -3
  100. package/dist/components/progress/WavyLinearProgress.svelte.d.ts +3 -0
  101. package/dist/components/progress/_wavy.d.ts +2 -0
  102. package/dist/components/progress/_wavy.js +3 -1
  103. package/dist/components/snackbar/Snackbar.svelte +13 -17
  104. package/dist/components/table/TableBody.svelte +3 -16
  105. package/dist/components/table/TableBody.svelte.d.ts +1 -5
  106. package/dist/components/table/TableHeader.svelte +1 -1
  107. package/dist/components/table/theme.js +1 -1
  108. package/dist/components/table/types.d.ts +0 -7
  109. package/dist/components/time/TimeField.stories.svelte +41 -0
  110. package/dist/components/time/TimeField.stories.svelte.d.ts +19 -0
  111. package/dist/components/time/TimeField.svelte +69 -62
  112. package/dist/components/time/TimeField.svelte.d.ts +6 -0
  113. package/dist/components/time/TimepickerInput.svelte +8 -4
  114. package/dist/components/time/types.d.ts +11 -1
  115. package/dist/components/toolbar/theme.js +2 -2
  116. package/dist/index.d.ts +1 -1
  117. package/dist/index.js +1 -1
  118. package/dist/styles/component.css +21 -22
  119. package/dist/styles/motion.css +317 -38
  120. package/dist/utils/Layer.svelte +16 -29
  121. package/dist/utils/icon/LoadingIndicator.svelte +61 -22
  122. package/dist/utils/icon/loadingShapes.d.ts +1 -0
  123. package/dist/utils/icon/loadingShapes.js +16 -0
  124. package/package.json +5 -2
  125. package/dist/actions/clickOutside.d.ts +0 -3
  126. package/dist/actions/clickOutside.js +0 -13
  127. package/dist/actions/floating.d.ts +0 -20
  128. package/dist/actions/floating.js +0 -87
  129. package/dist/actions/index.d.ts +0 -6
  130. package/dist/actions/index.js +0 -6
  131. package/dist/actions/keyboard.d.ts +0 -3
  132. package/dist/actions/keyboard.js +0 -14
  133. package/dist/actions/portal.d.ts +0 -3
  134. package/dist/actions/portal.js +0 -8
  135. package/dist/actions/positionFloating.d.ts +0 -10
  136. package/dist/actions/positionFloating.js +0 -59
  137. package/dist/actions/rovingFocusGroup.d.ts +0 -20
  138. package/dist/actions/rovingFocusGroup.js +0 -82
  139. package/dist/animation/easing.d.ts +0 -6
  140. package/dist/animation/easing.js +0 -78
  141. package/dist/animation/outroClass.d.ts +0 -3
  142. package/dist/animation/outroClass.js +0 -20
  143. package/dist/animation/transitionTypes.d.ts +0 -8
  144. 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 size-6
22
- group-focus-within:text-md-sys-color-primary
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] duration-200 ease-in-out
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 duration-200
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:duration-200
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 duration-150
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 size-6
132
- group-focus-within:text-md-sys-color-primary
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] duration-200 ease-in-out
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 duration-200
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 duration-150
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:duration-200
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 duration-[var(--md-sys-motion-duration-fast)] ease-[var(--md-sys-motion-timing-function)]',
7
- box: 'absolute inset-[11px] rounded-[4px] border-2 border-current bg-md-sys-color-surface transition-colors duration-[var(--md-sys-motion-duration-fast)] ease-[var(--md-sys-motion-timing-function)]',
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-all duration-200
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:duration-200
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 duration-[350ms] [transition-timing-function:var(--md-sys-motion-timing-function-fast-spatial)]',
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
- {#if open}
78
- <div
79
- {...props}
80
- class={clsx('relative flex flex-col outline-none', props.class as any)}
81
- transition:enterExit={{
82
- duration: 200,
83
- easing: easeEmphasized,
84
- mode: 'scale'
85
- }}
86
- style:width="var(--bits-select-anchor-width)"
87
- style:max-width="min(calc(100vw - 32px), 560px)"
88
- >
89
- <Select.Viewport class="w-full">
90
- {#each options as item, i (i)}
91
- {#if item.type === 'group'}
92
- <Select.Group>
93
- {#if item.heading}
94
- <Select.GroupHeading class={cls.groupLabel()}>
95
- {item.heading}
96
- </Select.GroupHeading>
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
- {#each item.items as innerItem, j (j)}
99
- {#if innerItem.type !== 'group'}
100
- <Select.Item {...innerItem} class={cls.item()}>
101
- {#snippet children({ selected })}
102
- <span class="flex-1 truncate">{innerItem.label}</span>
103
- {#if selected}
104
- <Icon
105
- aria-hidden="true"
106
- name="check"
107
- class="size-5 shrink-0"
108
- />
109
- {/if}
110
- {/snippet}
111
- </Select.Item>
112
- {/if}
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 duration-200
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 duration-150
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:duration-200
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 duration-150
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
  `