@noxlovette/material 0.5.1 → 0.6.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 (329) hide show
  1. package/bin/material-claude-skill.js +31 -0
  2. package/claude-skill/material-design/SKILL.md +68 -0
  3. package/claude-skill/material-design/references/accessibility-checklist.md +29 -0
  4. package/claude-skill/material-design/references/component-patterns.md +55 -0
  5. package/claude-skill/material-design/references/motion-guide.md +163 -0
  6. package/claude-skill/material-design/references/tokens-and-styles.md +68 -0
  7. package/dist/animation/Shapes.stories.svelte +10 -6
  8. package/dist/animation/TransitionPatterns.stories.svelte +30 -20
  9. package/dist/animation/containerTransform.d.ts +4 -2
  10. package/dist/animation/containerTransform.js +4 -2
  11. package/dist/animation/enterExit.js +5 -2
  12. package/dist/animation/skeleton.d.ts +1 -1
  13. package/dist/animation/skeleton.js +1 -1
  14. package/dist/components/badge/Badge.mdx +70 -0
  15. package/dist/components/badge/Badge.stories.svelte +38 -20
  16. package/dist/components/badge/Badge.svelte +12 -5
  17. package/dist/components/badge/theme.d.ts +30 -7
  18. package/dist/components/badge/theme.js +25 -5
  19. package/dist/components/badge/types.d.ts +18 -4
  20. package/dist/components/buttons/Button.mdx +85 -0
  21. package/dist/components/buttons/Button.stories.svelte +62 -27
  22. package/dist/components/buttons/Button.svelte +29 -25
  23. package/dist/components/buttons/Button.svelte.d.ts +11 -9
  24. package/dist/components/buttons/ButtonIcon.mdx +52 -0
  25. package/dist/components/buttons/ButtonIcon.stories.svelte +72 -48
  26. package/dist/components/buttons/ButtonIcon.svelte +58 -36
  27. package/dist/components/buttons/ButtonIcon.svelte.d.ts +9 -7
  28. package/dist/components/buttons/FAB.mdx +84 -0
  29. package/dist/components/buttons/FAB.stories.svelte +103 -24
  30. package/dist/components/buttons/FAB.stories.svelte.d.ts +2 -17
  31. package/dist/components/buttons/FAB.svelte +353 -29
  32. package/dist/components/buttons/FAB.svelte.d.ts +11 -6
  33. package/dist/components/buttons/FABMenu.svelte +27 -8
  34. package/dist/components/buttons/FABMenu.svelte.d.ts +7 -3
  35. package/dist/components/buttons/FABMenuItem.svelte +20 -16
  36. package/dist/components/buttons/FABMenuItem.svelte.d.ts +3 -3
  37. package/dist/components/buttons/Toggle.stories.svelte +31 -23
  38. package/dist/components/buttons/Toggle.stories.svelte.d.ts +2 -17
  39. package/dist/components/buttons/Toggle.svelte +28 -25
  40. package/dist/components/buttons/Toggle.svelte.d.ts +5 -5
  41. package/dist/components/buttons/button-group/ButtonGroup.mdx +39 -0
  42. package/dist/components/buttons/button-group/ButtonGroup.stories.svelte +62 -43
  43. package/dist/components/buttons/button-group/ButtonGroup.stories.svelte.d.ts +2 -17
  44. package/dist/components/buttons/button-group/ButtonGroup.svelte +102 -8
  45. package/dist/components/buttons/button-group/ButtonGroup.svelte.d.ts +6 -7
  46. package/dist/components/buttons/button-group/theme.d.ts +46 -16
  47. package/dist/components/buttons/button-group/theme.js +14 -9
  48. package/dist/components/buttons/button-group/types.d.ts +13 -7
  49. package/dist/components/buttons/connected/ConnectedButtonGroup.mdx +43 -0
  50. package/dist/components/buttons/connected/ConnectedButtonGroup.stories.svelte +56 -74
  51. package/dist/components/buttons/connected/ConnectedButtonGroup.stories.svelte.d.ts +2 -17
  52. package/dist/components/buttons/connected/ConnectedButtonGroup.svelte +16 -4
  53. package/dist/components/buttons/connected/ConnectedButtonGroup.svelte.d.ts +4 -4
  54. package/dist/components/buttons/connected/ConnectedButtonGroupItem.svelte +35 -8
  55. package/dist/components/buttons/connected/ConnectedButtonGroupItem.svelte.d.ts +2 -3
  56. package/dist/components/buttons/connected/theme.d.ts +34 -19
  57. package/dist/components/buttons/connected/theme.js +33 -10
  58. package/dist/components/buttons/connected/types.d.ts +36 -9
  59. package/dist/components/buttons/shapeMorph.d.ts +26 -0
  60. package/dist/components/buttons/shapeMorph.js +142 -0
  61. package/dist/components/buttons/split-button/SplitButton.mdx +48 -0
  62. package/dist/components/buttons/split-button/SplitButton.stories.svelte +9 -14
  63. package/dist/components/buttons/split-button/SplitButton.svelte +66 -49
  64. package/dist/components/buttons/split-button/SplitButton.svelte.d.ts +6 -11
  65. package/dist/components/buttons/split-button/theme.d.ts +111 -18
  66. package/dist/components/buttons/split-button/theme.js +75 -17
  67. package/dist/components/buttons/split-button/types.d.ts +24 -18
  68. package/dist/components/buttons/theme.d.ts +423 -231
  69. package/dist/components/buttons/theme.js +287 -381
  70. package/dist/components/buttons/types.d.ts +130 -125
  71. package/dist/components/cards/Card.mdx +44 -0
  72. package/dist/components/cards/Card.stories.svelte +11 -11
  73. package/dist/components/cards/theme.js +6 -6
  74. package/dist/components/chips/Chip.mdx +68 -0
  75. package/dist/components/chips/Chip.stories.svelte +4 -4
  76. package/dist/components/chips/theme.d.ts +1 -1
  77. package/dist/components/chips/theme.js +4 -4
  78. package/dist/components/containers/action-rail/ActionRail.stories.svelte +1 -0
  79. package/dist/components/containers/action-rail/theme.d.ts +1 -1
  80. package/dist/components/containers/action-rail/theme.js +2 -2
  81. package/dist/components/containers/app/theme.d.ts +1 -1
  82. package/dist/components/containers/app/theme.js +1 -1
  83. package/dist/components/containers/bottom-sheet/BottomSheet.mdx +64 -0
  84. package/dist/components/containers/bottom-sheet/BottomSheet.stories.svelte +108 -12
  85. package/dist/components/containers/bottom-sheet/BottomSheet.svelte +179 -109
  86. package/dist/components/containers/bottom-sheet/BottomSheet.svelte.d.ts +10 -5
  87. package/dist/components/containers/bottom-sheet/index.d.ts +1 -0
  88. package/dist/components/containers/bottom-sheet/index.js +1 -0
  89. package/dist/components/containers/bottom-sheet/theme.d.ts +45 -0
  90. package/dist/components/containers/bottom-sheet/theme.js +42 -0
  91. package/dist/components/containers/bottom-sheet/types.d.ts +37 -5
  92. package/dist/components/containers/carousel/Carousel.mdx +80 -0
  93. package/dist/components/containers/carousel/Carousel.stories.svelte +131 -0
  94. package/dist/components/containers/carousel/Carousel.stories.svelte.d.ts +4 -0
  95. package/dist/components/containers/carousel/Carousel.svelte +194 -0
  96. package/dist/components/containers/carousel/Carousel.svelte.d.ts +25 -0
  97. package/dist/components/containers/carousel/index.d.ts +3 -0
  98. package/dist/components/containers/{stack → carousel}/index.js +1 -2
  99. package/dist/components/containers/carousel/keylines.d.ts +32 -0
  100. package/dist/components/containers/carousel/keylines.js +88 -0
  101. package/dist/components/containers/carousel/theme.d.ts +162 -0
  102. package/dist/components/containers/carousel/theme.js +67 -0
  103. package/dist/components/containers/carousel/types.d.ts +52 -0
  104. package/dist/components/containers/context-menu/ContextMenu.stories.svelte +1 -0
  105. package/dist/components/containers/context-menu/ContextMenu.svelte +2 -2
  106. package/dist/components/containers/context-menu/ContextMenu.svelte.d.ts +1 -1
  107. package/dist/components/containers/context-menu/theme.d.ts +1 -1
  108. package/dist/components/containers/context-menu/theme.js +11 -11
  109. package/dist/components/containers/dialogue/Dialogue.mdx +65 -0
  110. package/dist/components/containers/dialogue/Dialogue.stories.svelte +4 -4
  111. package/dist/components/containers/dialogue/Dialogue.svelte +2 -2
  112. package/dist/components/containers/dialogue/theme.d.ts +1 -1
  113. package/dist/components/containers/dialogue/theme.js +4 -4
  114. package/dist/components/containers/dialogue/types.d.ts +1 -1
  115. package/dist/components/containers/divider/Divider.stories.svelte +2 -1
  116. package/dist/components/containers/divider/Divider.svelte +2 -2
  117. package/dist/components/containers/divider/theme.d.ts +7 -7
  118. package/dist/components/containers/divider/theme.js +3 -3
  119. package/dist/components/containers/index.d.ts +1 -1
  120. package/dist/components/containers/index.js +1 -1
  121. package/dist/components/containers/link-preview/theme.d.ts +1 -1
  122. package/dist/components/containers/link-preview/theme.js +3 -3
  123. package/dist/components/containers/list/List.svelte +18 -0
  124. package/dist/components/containers/list/List.svelte.d.ts +4 -0
  125. package/dist/components/containers/list/ListItem.mdx +100 -0
  126. package/dist/components/containers/list/ListItem.stories.svelte +177 -42
  127. package/dist/components/containers/list/ListItem.stories.svelte.d.ts +2 -17
  128. package/dist/components/containers/list/ListItem.svelte +92 -37
  129. package/dist/components/containers/list/ListItem.svelte.d.ts +1 -1
  130. package/dist/components/containers/list/context.d.ts +6 -0
  131. package/dist/components/containers/list/context.js +4 -0
  132. package/dist/components/containers/list/index.d.ts +1 -0
  133. package/dist/components/containers/list/index.js +1 -0
  134. package/dist/components/containers/list/theme.d.ts +487 -12
  135. package/dist/components/containers/list/theme.js +141 -14
  136. package/dist/components/containers/list/types.d.ts +39 -5
  137. package/dist/components/containers/menu/Menu.mdx +52 -0
  138. package/dist/components/containers/menu/Menu.stories.svelte +14 -14
  139. package/dist/components/containers/menu/Menu.svelte +2 -2
  140. package/dist/components/containers/menu/MenuGroup.svelte +1 -1
  141. package/dist/components/containers/menu/MenuGroup.svelte.d.ts +1 -1
  142. package/dist/components/containers/menu/MenuSub.svelte +1 -1
  143. package/dist/components/containers/menu/menu-item/MenuItem.svelte +1 -1
  144. package/dist/components/containers/menu/theme.d.ts +1 -1
  145. package/dist/components/containers/menu/theme.js +9 -9
  146. package/dist/components/containers/pane/DraggablePane.stories.svelte +4 -3
  147. package/dist/components/containers/pane/DraggablePane.svelte +2 -2
  148. package/dist/components/containers/pane/Pane.stories.svelte +11 -10
  149. package/dist/components/containers/pane/Pane.svelte +24 -2
  150. package/dist/components/containers/pane/PaneGrid.stories.svelte +19 -18
  151. package/dist/components/containers/pane/PaneGrid.svelte +3 -2
  152. package/dist/components/containers/pane/PaneGrid.svelte.d.ts +2 -1
  153. package/dist/components/containers/pane/PaneHandle.svelte +48 -2
  154. package/dist/components/containers/pane/PaneHandle.svelte.d.ts +4 -0
  155. package/dist/components/containers/pane/resizeStore.svelte.d.ts +10 -1
  156. package/dist/components/containers/pane/resizeStore.svelte.js +13 -2
  157. package/dist/components/containers/pane/theme.d.ts +1 -1
  158. package/dist/components/containers/pane/theme.js +131 -47
  159. package/dist/components/containers/pane/types.d.ts +3 -2
  160. package/dist/components/containers/popover/Popover.mdx +45 -0
  161. package/dist/components/containers/popover/Popover.stories.svelte +1 -1
  162. package/dist/components/containers/popover/Popover.svelte +1 -1
  163. package/dist/components/containers/popover/theme.d.ts +1 -1
  164. package/dist/components/containers/popover/theme.js +4 -4
  165. package/dist/components/containers/scroll-area/theme.js +3 -3
  166. package/dist/components/containers/side-sheet/SideSheet.mdx +71 -0
  167. package/dist/components/containers/side-sheet/SideSheet.stories.svelte +113 -17
  168. package/dist/components/containers/side-sheet/SideSheet.svelte +113 -66
  169. package/dist/components/containers/side-sheet/SideSheet.svelte.d.ts +8 -7
  170. package/dist/components/containers/side-sheet/index.d.ts +1 -0
  171. package/dist/components/containers/side-sheet/index.js +1 -0
  172. package/dist/components/containers/side-sheet/theme.d.ts +108 -0
  173. package/dist/components/containers/side-sheet/theme.js +72 -0
  174. package/dist/components/containers/side-sheet/types.d.ts +35 -7
  175. package/dist/components/date/DateField.stories.svelte +4 -3
  176. package/dist/components/date/DateField.svelte +11 -2
  177. package/dist/components/date/DateRangeField.stories.svelte +4 -3
  178. package/dist/components/date/DateRangeField.svelte +12 -3
  179. package/dist/components/date/theme.d.ts +8 -8
  180. package/dist/components/date/theme.js +32 -32
  181. package/dist/components/forms/checkbox/Checkbox.mdx +35 -0
  182. package/dist/components/forms/checkbox/Checkbox.stories.svelte +2 -2
  183. package/dist/components/forms/checkbox/Checkbox.svelte +1 -1
  184. package/dist/components/forms/checkbox/theme.d.ts +1 -1
  185. package/dist/components/forms/checkbox/theme.js +4 -4
  186. package/dist/components/forms/command/Command.stories.svelte +1 -0
  187. package/dist/components/forms/command/theme.d.ts +1 -1
  188. package/dist/components/forms/command/theme.js +10 -10
  189. package/dist/components/forms/pin/theme.d.ts +1 -1
  190. package/dist/components/forms/pin/theme.js +5 -5
  191. package/dist/components/forms/radio-group/RadioGroup.svelte +1 -1
  192. package/dist/components/forms/radio-group/theme.d.ts +1 -1
  193. package/dist/components/forms/radio-group/theme.js +6 -6
  194. package/dist/components/forms/search/Search.mdx +38 -0
  195. package/dist/components/forms/search/Search.stories.svelte +19 -9
  196. package/dist/components/forms/search/Search.svelte +40 -17
  197. package/dist/components/forms/search/Search.svelte.d.ts +2 -2
  198. package/dist/components/forms/search/theme.d.ts +46 -13
  199. package/dist/components/forms/search/theme.js +14 -9
  200. package/dist/components/forms/search/types.d.ts +18 -12
  201. package/dist/components/forms/select/Select.mdx +53 -0
  202. package/dist/components/forms/select/Select.stories.svelte +4 -4
  203. package/dist/components/forms/select/Select.svelte +12 -4
  204. package/dist/components/forms/select/SelectItem.svelte +1 -1
  205. package/dist/components/forms/select/theme.d.ts +1 -1
  206. package/dist/components/forms/select/theme.js +14 -14
  207. package/dist/components/forms/slider/Slider.mdx +85 -0
  208. package/dist/components/forms/slider/Slider.stories.svelte +7 -7
  209. package/dist/components/forms/slider/Slider.svelte +46 -28
  210. package/dist/components/forms/slider/theme.d.ts +15 -1
  211. package/dist/components/forms/slider/theme.js +29 -18
  212. package/dist/components/forms/slider/types.d.ts +3 -2
  213. package/dist/components/forms/switch/Switch.mdx +38 -0
  214. package/dist/components/forms/switch/Switch.stories.svelte +3 -3
  215. package/dist/components/forms/switch/theme.d.ts +1 -1
  216. package/dist/components/forms/switch/theme.js +7 -7
  217. package/dist/components/forms/textfield/Textfield.mdx +53 -0
  218. package/dist/components/forms/textfield/Textfield.stories.svelte +6 -6
  219. package/dist/components/forms/textfield/Textfield.svelte +1 -0
  220. package/dist/components/forms/textfield/theme.d.ts +1 -1
  221. package/dist/components/forms/textfield/theme.js +20 -20
  222. package/dist/components/forms/toggle-group/theme.d.ts +1 -1
  223. package/dist/components/forms/toggle-group/theme.js +3 -3
  224. package/dist/components/forms/tooltip/Tooltip.stories.svelte +1 -0
  225. package/dist/components/forms/tooltip/theme.d.ts +1 -1
  226. package/dist/components/forms/tooltip/theme.js +4 -4
  227. package/dist/components/misc/Avatar.stories.svelte +5 -4
  228. package/dist/components/misc/ThemeSettings.svelte +9 -9
  229. package/dist/components/misc/ThemeSwitcher.svelte +3 -3
  230. package/dist/components/misc/theme.js +5 -5
  231. package/dist/components/nav/appbar/AppBar.mdx +71 -0
  232. package/dist/components/nav/appbar/AppBar.stories.svelte +93 -3
  233. package/dist/components/nav/appbar/AppBar.stories.svelte.d.ts +2 -17
  234. package/dist/components/nav/appbar/AppBar.svelte +90 -37
  235. package/dist/components/nav/appbar/AppBar.svelte.d.ts +9 -2
  236. package/dist/components/nav/appbar/theme.d.ts +86 -19
  237. package/dist/components/nav/appbar/theme.js +160 -24
  238. package/dist/components/nav/appbar/types.d.ts +46 -9
  239. package/dist/components/nav/breadcrumb/Breadcrumb.stories.svelte +1 -0
  240. package/dist/components/nav/breadcrumb/theme.d.ts +1 -1
  241. package/dist/components/nav/breadcrumb/theme.js +6 -6
  242. package/dist/components/nav/navbar/Navbar.mdx +38 -0
  243. package/dist/components/nav/navbar/Navbar.svelte +1 -1
  244. package/dist/components/nav/navbar/NavbarItem.svelte +12 -9
  245. package/dist/components/nav/navbar/theme.d.ts +3 -3
  246. package/dist/components/nav/navbar/theme.js +7 -7
  247. package/dist/components/nav/rail/Rail.mdx +73 -0
  248. package/dist/components/nav/rail/Rail.stories.svelte +3 -7
  249. package/dist/components/nav/rail/Rail.svelte +5 -2
  250. package/dist/components/nav/rail/RailItem.svelte +12 -9
  251. package/dist/components/nav/rail/theme.d.ts +1 -1
  252. package/dist/components/nav/rail/theme.js +14 -14
  253. package/dist/components/nav/rail/types.d.ts +8 -1
  254. package/dist/components/nav/tabs/Tabs.mdx +62 -0
  255. package/dist/components/nav/tabs/Tabs.stories.svelte +1 -1
  256. package/dist/components/nav/tabs/theme.d.ts +1 -1
  257. package/dist/components/nav/tabs/theme.js +5 -5
  258. package/dist/components/pill/Pill.mdx +32 -0
  259. package/dist/components/pill/Pill.stories.svelte +1 -1
  260. package/dist/components/pill/theme.d.ts +2 -2
  261. package/dist/components/pill/theme.js +2 -2
  262. package/dist/components/progress/LinearProgress.svelte +2 -2
  263. package/dist/components/progress/Progress.mdx +50 -0
  264. package/dist/components/progress/Progress.stories.svelte +6 -6
  265. package/dist/components/snackbar/Snackbar.mdx +52 -0
  266. package/dist/components/snackbar/Snackbar.stories.svelte +5 -5
  267. package/dist/components/snackbar/Snackbar.svelte +1 -1
  268. package/dist/components/snackbar/theme.d.ts +4 -4
  269. package/dist/components/snackbar/theme.js +5 -5
  270. package/dist/components/table/Table.stories.svelte +1 -0
  271. package/dist/components/table/TableHeader.svelte +1 -1
  272. package/dist/components/table/theme.d.ts +1 -1
  273. package/dist/components/table/theme.js +4 -4
  274. package/dist/components/time/TimeField.stories.svelte +3 -2
  275. package/dist/components/time/TimeField.svelte +2 -2
  276. package/dist/components/time/TimepickerInput.svelte +1 -1
  277. package/dist/components/time/theme.d.ts +1 -1
  278. package/dist/components/time/theme.js +6 -6
  279. package/dist/components/toolbar/Toolbar.stories.svelte +1 -0
  280. package/dist/components/toolbar/Toolbar.svelte +1 -1
  281. package/dist/components/toolbar/Toolbar.svelte.d.ts +1 -1
  282. package/dist/components/toolbar/theme.d.ts +1 -1
  283. package/dist/components/toolbar/theme.js +15 -15
  284. package/dist/components/typography/Typography.mdx +67 -0
  285. package/dist/components/typography/body/Body.stories.svelte +2 -1
  286. package/dist/components/typography/body/theme.d.ts +16 -13
  287. package/dist/components/typography/body/theme.js +20 -5
  288. package/dist/components/typography/body/types.d.ts +2 -1
  289. package/dist/components/typography/display/Display.stories.svelte +2 -1
  290. package/dist/components/typography/display/theme.d.ts +16 -13
  291. package/dist/components/typography/display/theme.js +20 -5
  292. package/dist/components/typography/display/types.d.ts +2 -1
  293. package/dist/components/typography/headline/Headline.stories.svelte +2 -1
  294. package/dist/components/typography/headline/theme.d.ts +16 -13
  295. package/dist/components/typography/headline/theme.js +20 -5
  296. package/dist/components/typography/headline/types.d.ts +2 -1
  297. package/dist/components/typography/kbd/Kbd.stories.svelte +2 -1
  298. package/dist/components/typography/kbd/theme.d.ts +5 -5
  299. package/dist/components/typography/kbd/theme.js +3 -3
  300. package/dist/components/typography/label/Label.stories.svelte +2 -1
  301. package/dist/components/typography/label/theme.d.ts +15 -12
  302. package/dist/components/typography/label/theme.js +20 -5
  303. package/dist/components/typography/label/types.d.ts +2 -1
  304. package/dist/components/typography/title/Title.stories.svelte +2 -1
  305. package/dist/components/typography/title/theme.d.ts +16 -13
  306. package/dist/components/typography/title/theme.js +20 -5
  307. package/dist/components/typography/title/types.d.ts +2 -1
  308. package/dist/index.css +2 -0
  309. package/dist/styles/component.css +78 -175
  310. package/dist/styles/elevation.css +9 -0
  311. package/dist/styles/layers.css +33 -0
  312. package/dist/styles/spacing.css +29 -0
  313. package/dist/styles/typescale.css +635 -20
  314. package/dist/utils/Layer.svelte +1 -1
  315. package/dist/utils/icon/Icon.svelte +8 -6
  316. package/dist/utils/icon/theme.d.ts +1 -1
  317. package/dist/utils/icon/theme.js +1 -1
  318. package/dist/utils/tv.d.ts +6 -0
  319. package/dist/utils/tv.js +12 -0
  320. package/package.json +19 -15
  321. package/dist/components/containers/stack/HStack.svelte +0 -23
  322. package/dist/components/containers/stack/HStack.svelte.d.ts +0 -5
  323. package/dist/components/containers/stack/VStack.svelte +0 -23
  324. package/dist/components/containers/stack/VStack.svelte.d.ts +0 -5
  325. package/dist/components/containers/stack/index.d.ts +0 -4
  326. package/dist/components/containers/stack/theme.d.ts +0 -66
  327. package/dist/components/containers/stack/theme.js +0 -26
  328. package/dist/components/containers/stack/types.d.ts +0 -12
  329. /package/dist/components/containers/{stack → carousel}/types.js +0 -0
@@ -0,0 +1,72 @@
1
+ import { tv } from '../../../utils/tv.js';
2
+ /*
3
+ M3 side sheet (https://m3.material.io/components/side-sheets/specs). Full height, 256dp wide by
4
+ default and never wider than 400dp. 24dp start/end padding (16dp before a back button), 12dp
5
+ between the header's elements, `title-large` headline in `on-surface-variant`. Bottom actions
6
+ sit 16dp below a divider and 24dp above the bottom edge.
7
+
8
+ - Standard: `surface`, elevation 0, square, an `outline-variant` divider along its inner edge.
9
+ It sits in the layout and the content beside it reflows as it opens.
10
+ - Modal: `surface-container-low`, elevation 1, 16dp corners on its inner side, above a scrim.
11
+ - Detached (either): 16dp from the window edges, 16dp corners all round.
12
+
13
+ The header's icon buttons are 40dp around a 24dp icon; `-m-spacing-100` lines the icons (not the
14
+ buttons) up with the padding, as the spec measures it.
15
+ */
16
+ export const sideSheet = tv({
17
+ slots: {
18
+ base: 'p-spacing-0',
19
+ container: 'flex h-full flex-col overflow-hidden',
20
+ header: 'flex shrink-0 items-center gap-spacing-150 ps-spacing-300 pe-spacing-300 pt-spacing-300',
21
+ iconButton: '-m-spacing-100 shrink-0',
22
+ headline: 'md-sys-typescale-title-large text-md-sys-color-on-surface-variant min-w-spacing-0 flex-1',
23
+ body: 'min-h-spacing-0 flex-1 overflow-y-auto overscroll-contain px-spacing-300 py-spacing-300',
24
+ actions: 'flex min-h-spacing-900 shrink-0 items-center justify-start gap-spacing-100 px-spacing-300 pt-spacing-200 pb-spacing-300'
25
+ },
26
+ variants: {
27
+ variant: {
28
+ modal: {
29
+ base: [
30
+ 'fixed inset-y-spacing-0 start-auto end-spacing-0 m-spacing-0 h-dvh max-h-none w-full overflow-visible bg-transparent outline-none',
31
+ 'backdrop:bg-md-sys-color-scrim/32 backdrop:transition-[background-color] backdrop:md-sys-motion-effects',
32
+ 'starting:backdrop:bg-transparent data-[state=closed]:pointer-events-none data-[state=closed]:backdrop:bg-transparent'
33
+ ],
34
+ container: 'bg-md-sys-color-surface-container-low text-md-sys-color-on-surface shadow-elevation-1 rounded-s-2xl'
35
+ },
36
+ standard: {
37
+ // The wrapper animates its width, so the content beside it reflows; the sheet itself
38
+ // keeps its width and stays pinned to the wrapper's end edge, so it appears to slide in.
39
+ base: 'md-sys-motion-spatial relative h-full shrink-0 overflow-clip transition-[width]',
40
+ container: 'bg-md-sys-color-surface text-md-sys-color-on-surface absolute inset-y-spacing-0 end-spacing-0'
41
+ }
42
+ },
43
+ detached: {
44
+ true: { container: 'rounded-2xl' },
45
+ false: {}
46
+ },
47
+ divider: { true: {}, false: {} },
48
+ back: { true: { header: 'ps-spacing-200' }, false: {} }
49
+ },
50
+ compoundVariants: [
51
+ {
52
+ variant: 'modal',
53
+ detached: true,
54
+ class: {
55
+ base: 'inset-y-spacing-200 end-spacing-200 h-[calc(100dvh-2rem)] max-w-[calc(100%-2rem)]'
56
+ }
57
+ },
58
+ { variant: 'modal', detached: false, class: { base: 'max-w-full' } },
59
+ {
60
+ variant: 'standard',
61
+ detached: true,
62
+ class: { container: 'inset-y-spacing-200 end-spacing-200' }
63
+ },
64
+ {
65
+ variant: 'standard',
66
+ detached: false,
67
+ divider: true,
68
+ class: { container: 'border-md-sys-color-outline-variant border-s' }
69
+ }
70
+ ],
71
+ defaultVariants: { variant: 'modal', detached: false, divider: true, back: false }
72
+ });
@@ -3,22 +3,50 @@ import type { Snippet } from 'svelte';
3
3
  * Props for the SideSheet component.
4
4
  */
5
5
  export interface SideSheetProps {
6
+ /** The title at the top of the sheet. It also names the sheet for assistive technology. */
7
+ headline: string;
8
+ /** The sheet's content. It scrolls inside the sheet, with 24dp padding. */
9
+ children: Snippet;
6
10
  /**
7
- * The title displayed at the top of the side sheet.
11
+ * Buttons pinned to the bottom of the sheet, e.g. Save and Cancel. Left-aligned, most
12
+ * important first.
8
13
  */
9
- headline: string;
14
+ actions?: Snippet;
10
15
  /**
11
- * The content of the side sheet.
16
+ * - `modal`: in front of the app above a scrim, blocking everything else until it's closed
17
+ * (close button, Esc, or a scrim tap). Use it on compact and medium windows, or when the
18
+ * content needs full attention.
19
+ * - `standard`: part of the layout. Place it as the last child of a full-height row; the
20
+ * content beside it reflows as it opens and closes, and stays usable.
21
+ * @default 'modal'
12
22
  */
13
- children: Snippet;
23
+ variant?: 'modal' | 'standard';
14
24
  /**
15
- * Whether the sheet is shown. Bind it (`bind:open`) so the sheet can play its exit animation
16
- * before unmounting.
25
+ * Whether the sheet is shown. Bind it (`bind:open`) so the sheet can close itself and play
26
+ * its exit animation.
17
27
  * @default true
18
28
  */
19
29
  open?: boolean;
20
30
  /**
21
- * Called when the user dismisses the sheet (close button, Esc, backdrop click).
31
+ * Sheet width in px. M3 sizes side sheets at 256dp and never wider than 400dp; wider values
32
+ * are capped at 400.
33
+ * @default 256
34
+ */
35
+ width?: number;
36
+ /** Floats the sheet 16dp from the window edges with 16dp corners all round. */
37
+ detached?: boolean;
38
+ /**
39
+ * Draws the optional dividers: along a docked standard sheet's inner edge, and above the
40
+ * actions.
41
+ * @default true
42
+ */
43
+ divider?: boolean;
44
+ /**
45
+ * Shows a back button before the headline, for sheets that navigate within themselves. Called
46
+ * when it's activated.
22
47
  */
48
+ onback?: () => void;
49
+ /** Called when the user closes the sheet (close button, Esc, or a scrim tap). */
23
50
  close?: () => void;
51
+ class?: string;
24
52
  }
@@ -4,6 +4,7 @@
4
4
 
5
5
  const { Story } = defineMeta({
6
6
  title: 'Date/DateField',
7
+ tags: ['autodocs'],
7
8
  component: DateField,
8
9
  argTypes: {
9
10
  label: { control: 'text' },
@@ -24,14 +25,14 @@
24
25
 
25
26
  <Story name="Playground">
26
27
  {#snippet template(args)}
27
- <div class="max-w-sm p-6">
28
+ <div class="p-spacing-300 max-w-sm">
28
29
  <DateField {...args} />
29
30
  </div>
30
31
  {/snippet}
31
32
  </Story>
32
33
 
33
34
  <Story name="Outlined States" asChild>
34
- <div class="flex max-w-sm flex-col gap-6 p-6">
35
+ <div class="gap-spacing-300 p-spacing-300 flex max-w-sm flex-col">
35
36
  <DateField variant="outlined" label="Default" />
36
37
  <DateField variant="outlined" label="Required" required />
37
38
  <DateField variant="outlined" label="Error" error>
@@ -44,7 +45,7 @@
44
45
  </Story>
45
46
 
46
47
  <Story name="Filled States" asChild>
47
- <div class="flex max-w-sm flex-col gap-6 p-6">
48
+ <div class="gap-spacing-300 p-spacing-300 flex max-w-sm flex-col">
48
49
  <DateField variant="filled" label="Default" />
49
50
  <DateField variant="filled" label="Required" required />
50
51
  <DateField variant="filled" label="Error" error>
@@ -85,6 +85,7 @@ Changing the visible month slides the grid with the M3 lateral transition (see c
85
85
  <DatePicker.Trigger>
86
86
  {#snippet child({ props })}
87
87
  <ButtonIcon
88
+ variant="standard"
88
89
  {...props}
89
90
  {disabled}
90
91
  class={cls.trailingIcon()}
@@ -121,12 +122,20 @@ Changing the visible month slides the grid with the M3 lateral transition (see c
121
122
  <div class={calendar.nav()}>
122
123
  <DatePicker.PrevButton>
123
124
  {#snippet child({ props })}
124
- <ButtonIcon {...props} iconProps={{ name: 'chevron_left' }} />
125
+ <ButtonIcon
126
+ variant="standard"
127
+ {...props}
128
+ iconProps={{ name: 'chevron_left' }}
129
+ />
125
130
  {/snippet}
126
131
  </DatePicker.PrevButton>
127
132
  <DatePicker.NextButton>
128
133
  {#snippet child({ props })}
129
- <ButtonIcon {...props} iconProps={{ name: 'chevron_right' }} />
134
+ <ButtonIcon
135
+ variant="standard"
136
+ {...props}
137
+ iconProps={{ name: 'chevron_right' }}
138
+ />
130
139
  {/snippet}
131
140
  </DatePicker.NextButton>
132
141
  </div>
@@ -4,6 +4,7 @@
4
4
 
5
5
  const { Story } = defineMeta({
6
6
  title: 'Date/DateRangeField',
7
+ tags: ['autodocs'],
7
8
  component: DateRangeField,
8
9
  argTypes: {
9
10
  variant: { control: 'select', options: ['filled', 'outlined'] },
@@ -22,14 +23,14 @@
22
23
 
23
24
  <Story name="Playground">
24
25
  {#snippet template(args)}
25
- <div class="max-w-sm p-6">
26
+ <div class="p-spacing-300 max-w-sm">
26
27
  <DateRangeField {...args} />
27
28
  </div>
28
29
  {/snippet}
29
30
  </Story>
30
31
 
31
32
  <Story name="Outlined States" asChild>
32
- <div class="flex max-w-sm flex-col gap-6 p-6">
33
+ <div class="gap-spacing-300 p-spacing-300 flex max-w-sm flex-col">
33
34
  <DateRangeField variant="outlined" />
34
35
  <DateRangeField variant="outlined" error>
35
36
  {#snippet supportingText()}
@@ -41,7 +42,7 @@
41
42
  </Story>
42
43
 
43
44
  <Story name="Filled States" asChild>
44
- <div class="flex max-w-sm flex-col gap-6 p-6">
45
+ <div class="gap-spacing-300 p-spacing-300 flex max-w-sm flex-col">
45
46
  <DateRangeField variant="filled" />
46
47
  <DateRangeField variant="filled" error>
47
48
  {#snippet supportingText()}
@@ -55,7 +55,7 @@ Changing the visible month slides the grid with the M3 lateral transition (see c
55
55
  id={`${id}-${type}`}
56
56
  >
57
57
  {#snippet children({ segments })}
58
- <div class="flex w-full pt-4 tabular-nums">
58
+ <div class="pt-spacing-200 flex w-full tabular-nums">
59
59
  {#each segments as { part, value: segment }}
60
60
  <DateRangePicker.Segment
61
61
  {part}
@@ -102,6 +102,7 @@ Changing the visible month slides the grid with the M3 lateral transition (see c
102
102
  <DateRangePicker.Trigger>
103
103
  {#snippet child({ props })}
104
104
  <ButtonIcon
105
+ variant="standard"
105
106
  {...props}
106
107
  {disabled}
107
108
  class={cls.trailingIcon()}
@@ -130,12 +131,20 @@ Changing the visible month slides the grid with the M3 lateral transition (see c
130
131
  <div class={calendar.nav()}>
131
132
  <DateRangePicker.PrevButton>
132
133
  {#snippet child({ props })}
133
- <ButtonIcon {...props} iconProps={{ name: 'chevron_left' }} />
134
+ <ButtonIcon
135
+ variant="standard"
136
+ {...props}
137
+ iconProps={{ name: 'chevron_left' }}
138
+ />
134
139
  {/snippet}
135
140
  </DateRangePicker.PrevButton>
136
141
  <DateRangePicker.NextButton>
137
142
  {#snippet child({ props })}
138
- <ButtonIcon {...props} iconProps={{ name: 'chevron_right' }} />
143
+ <ButtonIcon
144
+ variant="standard"
145
+ {...props}
146
+ iconProps={{ name: 'chevron_right' }}
147
+ />
139
148
  {/snippet}
140
149
  </DateRangePicker.NextButton>
141
150
  </div>
@@ -1,4 +1,4 @@
1
- import { type VariantProps } from 'tailwind-variants';
1
+ import { type VariantProps } from '../../utils/tv.js';
2
2
  export type DateFieldVariants = VariantProps<typeof dateField>;
3
3
  export type DateRangeFieldVariants = VariantProps<typeof dateRangeField>;
4
4
  export declare const dateRangeField: import("tailwind-variants").TVReturnType<{
@@ -228,17 +228,17 @@ export declare const dateField: import("tailwind-variants").TVReturnType<{
228
228
  /** Segments of the typed date (`DatePicker.Segment` / `DateRangePicker.Segment`). */
229
229
  export declare const dateSegment: import("tailwind-variants").TVReturnType<{
230
230
  part: {
231
- literal: "text-md-sys-color-on-surface-variant px-0";
231
+ literal: "text-md-sys-color-on-surface-variant px-spacing-0";
232
232
  value: "\n text-md-sys-color-on-surface\n aria-[valuetext=Empty]:text-md-sys-color-on-surface-variant\n hover:bg-md-sys-color-on-surface/8\n focus:bg-md-sys-color-primary-container focus:text-md-sys-color-on-primary-container\n ";
233
233
  };
234
- }, undefined, "\n rounded-xs px-0.5 py-0.5 select-none cursor-default outline-none\n transition-colors md-sys-motion-fast-effects\n ", {
234
+ }, undefined, "\n rounded-xs px-spacing-25 py-spacing-25 select-none cursor-default outline-none\n transition-colors md-sys-motion-fast-effects\n ", {
235
235
  part: {
236
- literal: "text-md-sys-color-on-surface-variant px-0";
236
+ literal: "text-md-sys-color-on-surface-variant px-spacing-0";
237
237
  value: "\n text-md-sys-color-on-surface\n aria-[valuetext=Empty]:text-md-sys-color-on-surface-variant\n hover:bg-md-sys-color-on-surface/8\n focus:bg-md-sys-color-primary-container focus:text-md-sys-color-on-primary-container\n ";
238
238
  };
239
239
  }, undefined, import("tailwind-variants").TVReturnTypeLike<{
240
240
  part: {
241
- literal: "text-md-sys-color-on-surface-variant px-0";
241
+ literal: "text-md-sys-color-on-surface-variant px-spacing-0";
242
242
  value: "\n text-md-sys-color-on-surface\n aria-[valuetext=Empty]:text-md-sys-color-on-surface-variant\n hover:bg-md-sys-color-on-surface/8\n focus:bg-md-sys-color-primary-container focus:text-md-sys-color-on-primary-container\n ";
243
243
  };
244
244
  }, undefined>>;
@@ -251,12 +251,12 @@ export declare const dateCalendar: import("tailwind-variants").TVReturnType<{
251
251
  [key: string]: {
252
252
  [key: string]: import("tailwind-variants").ClassValue | {
253
253
  grid?: import("tailwind-variants").ClassValue;
254
+ row?: import("tailwind-variants").ClassValue;
254
255
  surface?: import("tailwind-variants").ClassValue;
255
256
  header?: import("tailwind-variants").ClassValue;
256
257
  nav?: import("tailwind-variants").ClassValue;
257
258
  cell?: import("tailwind-variants").ClassValue;
258
259
  heading?: import("tailwind-variants").ClassValue;
259
- row?: import("tailwind-variants").ClassValue;
260
260
  weekday?: import("tailwind-variants").ClassValue;
261
261
  day?: import("tailwind-variants").ClassValue;
262
262
  };
@@ -265,12 +265,12 @@ export declare const dateCalendar: import("tailwind-variants").TVReturnType<{
265
265
  [x: string]: {
266
266
  [x: string]: import("tailwind-variants").ClassValue | {
267
267
  grid?: import("tailwind-variants").ClassValue;
268
+ row?: import("tailwind-variants").ClassValue;
268
269
  surface?: import("tailwind-variants").ClassValue;
269
270
  header?: import("tailwind-variants").ClassValue;
270
271
  nav?: import("tailwind-variants").ClassValue;
271
272
  cell?: import("tailwind-variants").ClassValue;
272
273
  heading?: import("tailwind-variants").ClassValue;
273
- row?: import("tailwind-variants").ClassValue;
274
274
  weekday?: import("tailwind-variants").ClassValue;
275
275
  day?: import("tailwind-variants").ClassValue;
276
276
  };
@@ -289,12 +289,12 @@ export declare const dateCalendar: import("tailwind-variants").TVReturnType<{
289
289
  [key: string]: {
290
290
  [key: string]: import("tailwind-variants").ClassValue | {
291
291
  grid?: import("tailwind-variants").ClassValue;
292
+ row?: import("tailwind-variants").ClassValue;
292
293
  surface?: import("tailwind-variants").ClassValue;
293
294
  header?: import("tailwind-variants").ClassValue;
294
295
  nav?: import("tailwind-variants").ClassValue;
295
296
  cell?: import("tailwind-variants").ClassValue;
296
297
  heading?: import("tailwind-variants").ClassValue;
297
- row?: import("tailwind-variants").ClassValue;
298
298
  weekday?: import("tailwind-variants").ClassValue;
299
299
  day?: import("tailwind-variants").ClassValue;
300
300
  };
@@ -1,11 +1,11 @@
1
- import { tv } from 'tailwind-variants';
1
+ import { tv } from '../../utils/tv.js';
2
2
  export const dateRangeField = tv({
3
3
  slots: {
4
4
  base: `
5
- group w-full h-14 relative flex items-center
5
+ group w-full h-spacing-700 relative flex items-center
6
6
  `,
7
7
  inputWrapper: `
8
- relative flex-1 px-4 h-full flex items-center
8
+ relative flex-1 px-spacing-200 h-full flex items-center
9
9
  `,
10
10
  input: `
11
11
  bg-transparent outline-none flex items-center
@@ -13,19 +13,19 @@ export const dateRangeField = tv({
13
13
  disabled:text-md-sys-color-on-surface/38 w-full
14
14
  `,
15
15
  leadingIcon: `
16
- text-md-sys-color-on-surface-variant size-6
16
+ text-md-sys-color-on-surface-variant size-spacing-300
17
17
  group-focus-within:text-md-sys-color-primary
18
- group-data-[invalid]:text-md-sys-color-error ml-3 text-[24px]
18
+ group-data-[invalid]:text-md-sys-color-error ml-spacing-150 text-[24px]
19
19
  `,
20
20
  trailingIcon: `
21
- mr-1 shrink-0 text-md-sys-color-on-surface-variant
21
+ mr-spacing-50 shrink-0 text-md-sys-color-on-surface-variant
22
22
  group-data-[invalid]:text-md-sys-color-error
23
23
  `,
24
24
  separator: `
25
25
  text-md-sys-color-on-surface-variant select-none shrink-0
26
26
  `,
27
27
  label: `
28
- absolute left-4 top-1.5
28
+ absolute left-spacing-200 top-spacing-75
29
29
  md-sys-typescale-body-small
30
30
  text-md-sys-color-on-surface-variant
31
31
  pointer-events-none
@@ -34,13 +34,13 @@ export const dateRangeField = tv({
34
34
  z-20
35
35
  `,
36
36
  requiredAsterisk: `
37
- ml-0.5
37
+ ml-spacing-25
38
38
  text-md-sys-color-error
39
39
  group-focus-within:text-md-sys-color-primary
40
40
  transition-colors md-sys-motion-effects
41
41
  `,
42
42
  supportingText: `
43
- px-4 pt-1 flex justify-between
43
+ px-spacing-200 pt-spacing-50 flex justify-between
44
44
  md-sys-typescale-body-small
45
45
  text-md-sys-color-on-surface-variant
46
46
  `
@@ -50,7 +50,7 @@ export const dateRangeField = tv({
50
50
  filled: {
51
51
  base: `
52
52
  bg-md-sys-color-surface-container-highest rounded-t-xs
53
- after:absolute after:bottom-0 after:left-0 after:right-0
53
+ after:absolute after:bottom-spacing-0 after:left-spacing-0 after:right-spacing-0
54
54
  state-layer before:rounded-xs hover:before:bg-md-sys-color-on-surface/8
55
55
  after:h-px after:bg-md-sys-color-on-surface-variant
56
56
  after:transition-[height,background-color] after:md-sys-motion-fast-spatial
@@ -108,10 +108,10 @@ export const dateRangeField = tv({
108
108
  export const dateField = tv({
109
109
  slots: {
110
110
  base: `
111
- group w-full h-14 relative flex items-center justify-between
111
+ group w-full h-spacing-700 relative flex items-center justify-between
112
112
  `,
113
113
  inputWrapper: `
114
- relative flex-1 px-4 h-full flex items-center
114
+ relative flex-1 px-spacing-200 h-full flex items-center
115
115
  `,
116
116
  input: `
117
117
  w-full bg-transparent outline-none
@@ -122,16 +122,16 @@ export const dateField = tv({
122
122
  flex w-full flex-col tabular-nums
123
123
  `,
124
124
  leadingIcon: `
125
- text-md-sys-color-on-surface-variant size-6
125
+ text-md-sys-color-on-surface-variant size-spacing-300
126
126
  group-focus-within:text-md-sys-color-primary
127
- group-data-[invalid]:text-md-sys-color-error ml-3 text-[24px]
127
+ group-data-[invalid]:text-md-sys-color-error ml-spacing-150 text-[24px]
128
128
  `,
129
129
  trailingIcon: `
130
- mr-1 shrink-0 text-md-sys-color-on-surface-variant
130
+ mr-spacing-50 shrink-0 text-md-sys-color-on-surface-variant
131
131
  group-data-[invalid]:text-md-sys-color-error
132
132
  `,
133
133
  label: `
134
- absolute left-4 top-1.5
134
+ absolute left-spacing-200 top-spacing-75
135
135
  md-sys-typescale-body-small
136
136
  text-md-sys-color-on-surface-variant
137
137
  pointer-events-none
@@ -140,18 +140,18 @@ export const dateField = tv({
140
140
  z-20
141
141
  `,
142
142
  requiredAsterisk: `
143
- ml-0.5
143
+ ml-spacing-25
144
144
  text-md-sys-color-error
145
145
  group-focus-within:text-md-sys-color-primary
146
146
  transition-colors md-sys-motion-effects
147
147
  `,
148
148
  supportingText: `
149
- px-4 pt-1 flex justify-between
149
+ px-spacing-200 pt-spacing-50 flex justify-between
150
150
  md-sys-typescale-body-small
151
151
  text-md-sys-color-on-surface-variant
152
152
  `,
153
153
  fieldset: `
154
- absolute -top-[5px] left-0 right-0 bottom-0 m-0 px-2
154
+ absolute -top-[5px] left-spacing-0 right-spacing-0 bottom-spacing-0 m-spacing-0 px-spacing-100
155
155
  pointer-events-none rounded-xs border border-md-sys-color-outline
156
156
  transition-colors md-sys-motion-fast-effects
157
157
 
@@ -163,7 +163,7 @@ export const dateField = tv({
163
163
  whitespace-nowrap md-sys-typescale-body-small
164
164
  `,
165
165
  legendLabel: `
166
- px-1
166
+ px-spacing-50
167
167
  `
168
168
  },
169
169
  variants: {
@@ -171,7 +171,7 @@ export const dateField = tv({
171
171
  filled: {
172
172
  base: `
173
173
  bg-md-sys-color-surface-container-highest rounded-t-xs
174
- after:absolute after:bottom-0 after:left-0 after:right-0
174
+ after:absolute after:bottom-spacing-0 after:left-spacing-0 after:right-spacing-0
175
175
  state-layer before:rounded-xs hover:before:bg-md-sys-color-on-surface/8
176
176
  after:h-px after:bg-md-sys-color-on-surface-variant
177
177
  after:transition-[height,background-color] after:md-sys-motion-fast-spatial
@@ -180,11 +180,11 @@ export const dateField = tv({
180
180
  disabled:bg-md-sys-color-on-surface/4
181
181
  disabled:after:bg-md-sys-color-on-surface/12
182
182
  `,
183
- segments: 'pt-4'
183
+ segments: 'pt-spacing-200'
184
184
  },
185
185
  outlined: {
186
186
  label: `
187
- top-0 -translate-y-1/2
187
+ top-spacing-0 -translate-y-1/2
188
188
  `
189
189
  }
190
190
  },
@@ -217,12 +217,12 @@ export const dateField = tv({
217
217
  /** Segments of the typed date (`DatePicker.Segment` / `DateRangePicker.Segment`). */
218
218
  export const dateSegment = tv({
219
219
  base: `
220
- rounded-xs px-0.5 py-0.5 select-none cursor-default outline-none
220
+ rounded-xs px-spacing-25 py-spacing-25 select-none cursor-default outline-none
221
221
  transition-colors md-sys-motion-fast-effects
222
222
  `,
223
223
  variants: {
224
224
  part: {
225
- literal: 'text-md-sys-color-on-surface-variant px-0',
225
+ literal: 'text-md-sys-color-on-surface-variant px-spacing-0',
226
226
  value: `
227
227
  text-md-sys-color-on-surface
228
228
  aria-[valuetext=Empty]:text-md-sys-color-on-surface-variant
@@ -243,12 +243,12 @@ export const dateSegment = tv({
243
243
  export const dateCalendar = tv({
244
244
  slots: {
245
245
  surface: `
246
- w-90 rounded-lg px-3 pb-3
246
+ w-90 rounded-lg px-spacing-150 pb-spacing-150
247
247
  bg-md-sys-color-surface-container-high shadow-elevation-3
248
248
  text-md-sys-color-on-surface
249
249
  `,
250
250
  header: `
251
- flex h-14 items-center justify-between pl-4 pr-1
251
+ flex h-spacing-700 items-center justify-between pl-spacing-200 pr-spacing-50
252
252
  `,
253
253
  heading: `
254
254
  md-sys-typescale-label-large text-md-sys-color-on-surface-variant
@@ -263,15 +263,15 @@ export const dateCalendar = tv({
263
263
  flex w-full
264
264
  `,
265
265
  weekday: `
266
- flex size-12 items-center justify-center
267
- md-sys-typescale-body-large font-normal text-md-sys-color-on-surface
266
+ flex size-spacing-600 items-center justify-center
267
+ md-sys-typescale-body-large text-md-sys-color-on-surface
268
268
  `,
269
269
  /* The range band runs behind every day in the range. On the endpoints it covers only the inner
270
270
  half, so it meets the selected circle instead of sticking out past it. A one-day range has
271
271
  no band. */
272
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
273
+ relative flex size-spacing-600 items-center justify-center p-spacing-0
274
+ before:absolute before:inset-x-spacing-0 before:h-spacing-500 before:bg-md-sys-color-secondary-container
275
275
  before:opacity-0 before:transition-opacity before:md-sys-motion-fast-effects
276
276
  data-range-middle:before:opacity-100
277
277
  data-highlighted:before:opacity-100
@@ -281,7 +281,7 @@ export const dateCalendar = tv({
281
281
  data-outside-month:before:opacity-0
282
282
  `,
283
283
  day: `
284
- relative flex size-10 items-center justify-center rounded-full
284
+ relative flex size-spacing-500 items-center justify-center rounded-full
285
285
  md-sys-typescale-body-large text-md-sys-color-on-surface
286
286
  cursor-pointer outline-none
287
287
  transition-colors md-sys-motion-fast-effects
@@ -0,0 +1,35 @@
1
+ import { Meta, Title, Subtitle, Canvas, Controls } from '@storybook/addon-docs/blocks';
2
+ import * as CheckboxStories from './Checkbox.stories.svelte';
3
+
4
+ <Meta of={CheckboxStories} />
5
+
6
+ <Title />
7
+
8
+ <Subtitle>
9
+ Checkboxes let users select one or more items from a list, or turn a single item on or off.
10
+ </Subtitle>
11
+
12
+ [M3 spec](https://m3.material.io/components/checkbox/specs) ·
13
+ `import { Checkbox } from '@noxlovette/material';`
14
+
15
+ <Canvas of={CheckboxStories.Playground} />
16
+
17
+ <Controls of={CheckboxStories.Playground} />
18
+
19
+ ## States
20
+
21
+ Bind `checked` for the value. Bind `indeterminate` for a "select all" checkbox whose list is
22
+ only partly selected; it wins over `checked` while set. `error` marks the control invalid.
23
+
24
+ ```svelte
25
+ <Checkbox labelText="Accept terms and conditions" bind:checked={accepted} />
26
+ ```
27
+
28
+ <Canvas of={CheckboxStories.States} />
29
+
30
+ ## Accessibility
31
+
32
+ - **Label.** `labelText` is required and tied to the control by id, so clicking the text toggles
33
+ the checkbox too.
34
+ - **Target size.** The state layer extends the target well past the 18dp box, to 48dp.
35
+ - **Keyboard.** Space toggles; focus draws the M3 focus indicator.
@@ -24,14 +24,14 @@
24
24
 
25
25
  <Story name="Playground">
26
26
  {#snippet template(args)}
27
- <div class="p-6">
27
+ <div class="p-spacing-300">
28
28
  <Checkbox {...args} />
29
29
  </div>
30
30
  {/snippet}
31
31
  </Story>
32
32
 
33
33
  <Story name="States" asChild>
34
- <div class="flex flex-col gap-4 p-6">
34
+ <div class="gap-spacing-200 p-spacing-300 flex flex-col">
35
35
  <Checkbox labelText="Unchecked" checked={false} />
36
36
  <Checkbox labelText="Checked" checked={true} />
37
37
  <Checkbox labelText="Indeterminate" indeterminate={true} />
@@ -28,7 +28,7 @@ Checkboxes let users select one or more items from a list, or turn an item on or
28
28
  const cls = $derived(checkbox({ state, error, disabled }));
29
29
  </script>
30
30
 
31
- <div class="flex cursor-pointer items-center space-x-3">
31
+ <div class="space-x-spacing-150 flex cursor-pointer items-center">
32
32
  <Checkbox.Root
33
33
  bind:checked
34
34
  bind:indeterminate
@@ -1,4 +1,4 @@
1
- import { type VariantProps } from 'tailwind-variants';
1
+ import { type VariantProps } from '../../../utils/tv.js';
2
2
  export declare const checkbox: import("tailwind-variants").TVReturnType<{
3
3
  state: {
4
4
  unchecked: {};
@@ -1,12 +1,12 @@
1
- import { tv } from 'tailwind-variants';
1
+ import { tv } from '../../../utils/tv.js';
2
2
  export const checkbox = tv({
3
3
  slots: {
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',
4
+ root: 'group inline-flex min-h-spacing-500 select-none items-start gap-spacing-150 text-md-sys-color-on-surface min-h-4.5 cursor-pointer',
5
5
  container: 'relative inline-flex size-[18px] shrink-0',
6
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
7
  box: 'absolute inset-[11px] rounded-[4px] border-2 border-current bg-md-sys-color-surface transition-colors md-sys-motion-fast-effects',
8
- checkIcon: 'pointer-events-none absolute inset-0 m-auto size-3.5 text-md-sys-color-on-primary opacity-0 scale-75',
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',
8
+ checkIcon: 'pointer-events-none absolute inset-spacing-0 m-auto size-spacing-175 text-md-sys-color-on-primary opacity-0 scale-75',
9
+ indeterminateIcon: 'pointer-events-none absolute inset-spacing-0 m-auto block h-spacing-25 w-spacing-150 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'
11
11
  },
12
12
  variants: {
@@ -14,6 +14,7 @@
14
14
 
15
15
  const { Story } = defineMeta({
16
16
  title: 'Forms/Command',
17
+ tags: ['autodocs'],
17
18
  component: Command
18
19
  });
19
20
  </script>
@@ -1,4 +1,4 @@
1
- import { type VariantProps } from 'tailwind-variants';
1
+ import { type VariantProps } from '../../../utils/tv.js';
2
2
  export type CommandVariants = VariantProps<typeof command>;
3
3
  export declare const command: import("tailwind-variants").TVReturnType<{
4
4
  [key: string]: {