@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
@@ -2,33 +2,22 @@
2
2
  import { defineMeta } from '@storybook/addon-svelte-csf';
3
3
  import Button from './Button.svelte';
4
4
 
5
+ const variants = ['elevated', 'filled', 'tonal', 'outlined', 'text'] as const;
6
+ const sizes = ['xs', 'sm', 'md', 'lg', 'xl'] as const;
7
+
5
8
  const { Story } = defineMeta({
6
9
  title: 'Buttons/Button',
7
10
  component: Button,
8
11
  argTypes: {
9
- variant: {
10
- control: 'select',
11
- options: ['elevated', 'filled', 'tonal', 'outlined', 'text', 'bare']
12
- },
13
- color: {
14
- control: 'select',
15
- options: ['default', 'primary', 'secondary', 'tertiary', 'error']
16
- },
17
- size: {
18
- control: 'select',
19
- options: ['xs', 'sm', 'md', 'lg', 'xl']
20
- },
21
- shape: {
22
- control: 'select',
23
- options: ['round', 'square']
24
- },
12
+ variant: { control: 'select', options: variants },
13
+ size: { control: 'select', options: sizes },
14
+ shape: { control: 'inline-radio', options: ['round', 'square'] },
25
15
  disabled: { control: 'boolean' },
26
16
  loading: { control: 'boolean' }
27
17
  },
28
18
  args: {
29
19
  variant: 'filled',
30
- color: 'primary',
31
- size: 'md',
20
+ size: 'sm',
32
21
  shape: 'round',
33
22
  disabled: false,
34
23
  loading: false
@@ -36,15 +25,61 @@
36
25
  });
37
26
  </script>
38
27
 
39
- <Story name="Playground">Label</Story>
28
+ <Story name="Playground">
29
+ {#snippet template(args)}
30
+ <Button {...args}>Label</Button>
31
+ {/snippet}
32
+ </Story>
33
+
34
+ <Story name="Colour styles" asChild>
35
+ <div class="gap-spacing-200 p-spacing-300 flex flex-wrap items-center">
36
+ {#each variants as variant (variant)}
37
+ <Button {variant}>{variant[0].toUpperCase() + variant.slice(1)}</Button>
38
+ {/each}
39
+ </div>
40
+ </Story>
41
+
42
+ <Story name="With icon" asChild>
43
+ <div class="gap-spacing-200 p-spacing-300 flex flex-wrap items-center">
44
+ {#each variants as variant (variant)}
45
+ <Button {variant} iconProps={{ name: 'add' }}>Create</Button>
46
+ {/each}
47
+ </div>
48
+ </Story>
49
+
50
+ <Story name="Sizes" asChild>
51
+ <div class="gap-spacing-200 p-spacing-300 flex flex-col items-start">
52
+ {#each sizes as size (size)}
53
+ <div class="gap-spacing-200 flex items-center">
54
+ <Button {size} iconProps={{ name: 'send' }}>Send</Button>
55
+ <Button {size} shape="square" variant="tonal" iconProps={{ name: 'send' }}>Send</Button>
56
+ <Button {size} variant="outlined">Cancel</Button>
57
+ </div>
58
+ {/each}
59
+ </div>
60
+ </Story>
61
+
62
+ <Story name="Round and square" asChild>
63
+ <div class="gap-spacing-200 p-spacing-300 flex flex-wrap items-center">
64
+ <Button size="md">Round</Button>
65
+ <Button size="md" shape="square">Square</Button>
66
+ <p class="md-sys-typescale-body-medium text-md-sys-color-on-surface-variant w-full">
67
+ Press and hold: both morph to the same smaller corner.
68
+ </p>
69
+ </div>
70
+ </Story>
71
+
72
+ <Story name="Disabled" asChild>
73
+ <div class="gap-spacing-200 p-spacing-300 flex flex-wrap items-center">
74
+ {#each variants as variant (variant)}
75
+ <Button {variant} disabled>{variant}</Button>
76
+ {/each}
77
+ </div>
78
+ </Story>
40
79
 
41
- <Story name="Variants" asChild>
42
- <div class="flex flex-wrap items-center gap-4 p-6">
43
- <Button variant="elevated" color="primary">Elevated</Button>
44
- <Button variant="filled" color="primary">Filled</Button>
45
- <Button variant="tonal" color="primary">Tonal</Button>
46
- <Button variant="outlined" color="primary">Outlined</Button>
47
- <Button variant="text" color="primary">Text</Button>
48
- <Button variant="bare" color="primary">Bare</Button>
80
+ <Story name="Link" asChild>
81
+ <div class="gap-spacing-200 p-spacing-300 flex">
82
+ <Button href="#" variant="text">Learn more</Button>
83
+ <Button href="#" variant="outlined" disabled>Disabled link</Button>
49
84
  </div>
50
85
  </Story>
@@ -1,58 +1,62 @@
1
1
  <!--
2
2
  @component
3
- Buttons help people take actions, such as sending an email, sharing a document, or liking a comment.
3
+ Buttons prompt most actions in a UI.
4
4
 
5
- - Filled: High emphasis
6
- - Tonal: Medium-high emphasis
7
- - Outlined: Medium emphasis
8
- - Text: Low emphasis
9
- - Elevated: High emphasis
5
+ - Filled: final or unblocking actions (default)
6
+ - Tonal: important actions a step below filled
7
+ - Elevated: only to stand apart from a patterned background
8
+ - Outlined: attention without being primary, or a way out of a flow
9
+ - Text: optional actions
10
10
 
11
- @see https://m3.material.io/components/all-buttons
11
+ For a two-state button use `Toggle`.
12
+
13
+ @see https://m3.material.io/components/buttons/specs
12
14
  -->
13
15
  <script lang="ts">
14
- import type { ButtonMDProps } from './types.js';
16
+ import type { ButtonProps } from './types.js';
15
17
  import { Icon, LoadingIndicator, Layer } from '../../utils/index.js';
16
- import { button } from './theme.js';
18
+ import { button, buttonColor } from './theme.js';
17
19
  import clsx from 'clsx';
20
+ import { buttonCorners, shapeMorph } from './shapeMorph.js';
18
21
  import { Button, type ButtonRootProps } from 'bits-ui';
19
22
 
20
23
  let {
21
24
  children,
22
25
  iconProps,
23
26
  variant = 'filled',
24
- color = 'default',
25
- size = 'md',
27
+ size = 'sm',
26
28
  shape = 'round',
27
29
  disabled,
28
- selected,
29
30
  formaction,
30
31
  loading,
31
32
  class: className,
32
33
  ...restProps
33
- }: ButtonMDProps = $props();
34
+ }: ButtonProps = $props();
35
+
36
+ let ref = $state<HTMLElement | null>(null);
37
+ $effect(() => (ref ? shapeMorph(ref, buttonCorners) : undefined));
34
38
 
35
- const { base, icon } = $derived(button({ variant, color, shape, size, selected }));
36
- const btnCls = $derived(base({ class: clsx(className) }));
39
+ const cls = $derived(button({ variant, size, shape }));
40
+ const btnCls = $derived(
41
+ cls.base({ class: clsx(buttonColor({ variant, state: 'default' }), className) })
42
+ );
37
43
  </script>
38
44
 
39
45
  <Button.Root
46
+ bind:ref
40
47
  {disabled}
41
48
  {formaction}
42
49
  class={btnCls}
50
+ aria-busy={loading || undefined}
43
51
  data-cy="m3-button"
44
52
  {...restProps as ButtonRootProps}
45
53
  >
46
- {#if iconProps}
47
- {#if loading}
48
- <LoadingIndicator container={variant === 'filled'} class={icon()} />
49
- {:else}
50
- <Icon class={icon()} {...iconProps} />
51
- {@render children?.()}
52
- {/if}
53
- {:else if loading}
54
- <LoadingIndicator container={variant === 'filled'} />
55
- {:else}
54
+ {#if loading}
55
+ <LoadingIndicator center={false} class={cls.icon({ class: 'text-current' })} />
56
+ {:else if iconProps}
57
+ <Icon {...iconProps} class={cls.icon({ class: clsx(iconProps.class) })} />
58
+ {/if}
59
+ {#if !loading || iconProps}
56
60
  {@render children?.()}
57
61
  {/if}
58
62
  <Layer />
@@ -1,16 +1,18 @@
1
- import type { ButtonMDProps } from './types.js';
1
+ import type { ButtonProps } from './types.js';
2
2
  import { Button } from 'bits-ui';
3
3
  /**
4
- * Buttons help people take actions, such as sending an email, sharing a document, or liking a comment.
4
+ * Buttons prompt most actions in a UI.
5
5
  *
6
- * - Filled: High emphasis
7
- * - Tonal: Medium-high emphasis
8
- * - Outlined: Medium emphasis
9
- * - Text: Low emphasis
10
- * - Elevated: High emphasis
6
+ * - Filled: final or unblocking actions (default)
7
+ * - Tonal: important actions a step below filled
8
+ * - Elevated: only to stand apart from a patterned background
9
+ * - Outlined: attention without being primary, or a way out of a flow
10
+ * - Text: optional actions
11
11
  *
12
- * @see https://m3.material.io/components/all-buttons
12
+ * For a two-state button use `Toggle`.
13
+ *
14
+ * @see https://m3.material.io/components/buttons/specs
13
15
  */
14
- declare const Button: import("svelte").Component<ButtonMDProps, {}, "">;
16
+ declare const Button: import("svelte").Component<ButtonProps, {}, "">;
15
17
  type Button = ReturnType<typeof Button>;
16
18
  export default Button;
@@ -0,0 +1,52 @@
1
+ import { Meta, Title, Subtitle, Canvas, Controls } from '@storybook/addon-docs/blocks';
2
+ import * as IconStories from './ButtonIcon.stories.svelte';
3
+
4
+ <Meta of={IconStories} />
5
+
6
+ <Title />
7
+
8
+ <Subtitle>Icon buttons help people take minor actions with one tap.</Subtitle>
9
+
10
+ [M3 spec](https://m3.material.io/components/icon-buttons/specs) ·
11
+ `import { ButtonIcon } from '@noxlovette/material';`
12
+
13
+ <Canvas of={IconStories.Playground} />
14
+
15
+ <Controls of={IconStories.Playground} />
16
+
17
+ ## Colour styles
18
+
19
+ `filled` (default), `tonal`, `outlined` and `standard`. `standard` has no container until it is
20
+ hovered, focused or pressed; use it in app bars, text fields, sheets and other dense places.
21
+
22
+ With `variation="toggle"`, the button has a selected state (`aria-pressed`, bindable `pressed`).
23
+ Unselected, a filled toggle uses surface container; selected, each style takes its strong colour
24
+ (primary, secondary, inverse surface, or a primary icon for standard). The icon fills while
25
+ selected, and the resting shape swaps (round ↔ square).
26
+
27
+ <Canvas of={IconStories.ColourStyles} />
28
+
29
+ ## Sizes and widths
30
+
31
+ | `size` | Height | Icon | Narrow | Default | Wide |
32
+ | ------ | ------ | ---- | ------ | ------- | ----- |
33
+ | `xs` | 32dp | 20dp | 28dp | 32dp | 40dp |
34
+ | `sm` | 40dp | 24dp | 32dp | 40dp | 52dp |
35
+ | `md` | 56dp | 24dp | 48dp | 56dp | 72dp |
36
+ | `lg` | 96dp | 32dp | 64dp | 96dp | 128dp |
37
+ | `xl` | 136dp | 40dp | 104dp | 136dp | 184dp |
38
+
39
+ `sm` is the default. XS and S keep a 48dp target area. Square corners are 12, 12, 16, 28 and
40
+ 28dp; pressed, both shapes tighten to 8, 8, 12, 16 and 16dp.
41
+
42
+ <Canvas of={IconStories.SizesAndWidths} />
43
+
44
+ ## Accessibility
45
+
46
+ An icon has no text, so give every icon button a name: `aria-label`, or `tooltipContent`, which
47
+ shows on hover and focus and becomes the name when there is no `aria-label`.
48
+
49
+ ## Migrating
50
+
51
+ `variant="text"` is now `variant="standard"`, the spec's name, and the default is now `filled`
52
+ (it was `text`). `elevated`, `bare` and `color` are gone.
@@ -2,73 +2,97 @@
2
2
  import { defineMeta } from '@storybook/addon-svelte-csf';
3
3
  import ButtonIcon from './ButtonIcon.svelte';
4
4
 
5
+ const variants = ['filled', 'tonal', 'outlined', 'standard'] as const;
6
+ const sizes = ['xs', 'sm', 'md', 'lg', 'xl'] as const;
7
+ const widths = ['narrow', 'default', 'wide'] as const;
8
+
5
9
  const { Story } = defineMeta({
6
10
  title: 'Buttons/Button Icon',
7
11
  component: ButtonIcon,
8
12
  argTypes: {
9
- variant: {
10
- control: 'select',
11
- options: ['elevated', 'filled', 'tonal', 'outlined', 'text', 'bare']
12
- },
13
- color: {
14
- control: 'select',
15
- options: ['default', 'primary', 'secondary', 'tertiary', 'error']
16
- },
17
- size: {
18
- control: 'select',
19
- options: ['xs', 'sm', 'md', 'lg', 'xl']
20
- },
21
- width: {
22
- control: 'select',
23
- options: ['default', 'narrow', 'wide']
24
- },
25
- shape: {
26
- control: 'select',
27
- options: ['round', 'square']
28
- },
29
- variation: {
30
- control: 'select',
31
- options: ['default', 'toggle']
32
- },
13
+ variant: { control: 'select', options: variants },
14
+ size: { control: 'select', options: sizes },
15
+ width: { control: 'inline-radio', options: widths },
16
+ shape: { control: 'inline-radio', options: ['round', 'square'] },
17
+ variation: { control: 'inline-radio', options: ['default', 'toggle'] },
33
18
  disabled: { control: 'boolean' },
34
- loading: { control: 'boolean' },
35
- tooltipContent: { control: 'text' }
19
+ loading: { control: 'boolean' }
36
20
  },
37
21
  args: {
38
- variant: 'text',
39
- color: 'primary',
40
- size: 'md',
22
+ variant: 'filled',
23
+ size: 'sm',
41
24
  width: 'default',
42
25
  shape: 'round',
43
26
  variation: 'default',
44
27
  disabled: false,
45
28
  loading: false,
46
- iconProps: { name: 'favorite' },
47
- tooltipContent: 'Favorite'
29
+ tooltipContent: 'Favourite',
30
+ iconProps: { name: 'favorite' }
48
31
  }
49
32
  });
50
33
  </script>
51
34
 
52
- <Story name="Playground" />
35
+ <Story name="Playground">
36
+ {#snippet template(args)}
37
+ <ButtonIcon {...args} iconProps={{ name: 'favorite' }} />
38
+ {/snippet}
39
+ </Story>
40
+
41
+ <Story name="Colour styles" asChild>
42
+ <div
43
+ class="gap-spacing-200 p-spacing-300 grid grid-cols-[repeat(3,auto)] items-center justify-start"
44
+ >
45
+ {#each variants as variant (variant)}
46
+ <ButtonIcon {variant} tooltipContent={variant} iconProps={{ name: 'settings' }} />
47
+ <ButtonIcon
48
+ {variant}
49
+ variation="toggle"
50
+ tooltipContent="{variant} toggle, unselected"
51
+ iconProps={{ name: 'bookmark' }}
52
+ />
53
+ <ButtonIcon
54
+ {variant}
55
+ variation="toggle"
56
+ pressed
57
+ tooltipContent="{variant} toggle, selected"
58
+ iconProps={{ name: 'bookmark' }}
59
+ />
60
+ {/each}
61
+ </div>
62
+ </Story>
53
63
 
54
- <Story name="Variants" asChild>
55
- <div class="flex flex-wrap items-center gap-4 p-6">
56
- <ButtonIcon variant="elevated" color="primary" iconProps={{ name: 'favorite' }} />
57
- <ButtonIcon variant="filled" color="primary" iconProps={{ name: 'favorite' }} />
58
- <ButtonIcon variant="tonal" color="primary" iconProps={{ name: 'favorite' }} />
59
- <ButtonIcon variant="outlined" color="primary" iconProps={{ name: 'favorite' }} />
60
- <ButtonIcon variant="text" color="primary" iconProps={{ name: 'favorite' }} />
61
- <ButtonIcon variant="bare" color="primary" iconProps={{ name: 'favorite' }} />
64
+ <Story name="Sizes and widths" asChild>
65
+ <div class="gap-spacing-200 p-spacing-300 flex flex-col items-start">
66
+ <p class="md-sys-typescale-body-medium text-md-sys-color-on-surface-variant max-w-lg">
67
+ Per size: narrow, default and wide round buttons (fully round on their short side, so narrow
68
+ is a vertical pill and wide a horizontal one), then a filled square button.
69
+ </p>
70
+ {#each sizes as size (size)}
71
+ <div class="gap-spacing-200 flex items-center">
72
+ {#each widths as width (width)}
73
+ <ButtonIcon
74
+ {size}
75
+ {width}
76
+ variant="tonal"
77
+ tooltipContent="{size} {width}"
78
+ iconProps={{ name: 'edit' }}
79
+ />
80
+ {/each}
81
+ <ButtonIcon
82
+ {size}
83
+ shape="square"
84
+ tooltipContent="{size} square"
85
+ iconProps={{ name: 'edit' }}
86
+ />
87
+ </div>
88
+ {/each}
62
89
  </div>
63
90
  </Story>
64
91
 
65
- <Story name="Toggle" asChild>
66
- <div class="flex flex-wrap items-center gap-4 p-6">
67
- <ButtonIcon
68
- variation="toggle"
69
- variant="tonal"
70
- iconProps={{ name: 'star' }}
71
- tooltipContent="Star"
72
- />
92
+ <Story name="Disabled" asChild>
93
+ <div class="gap-spacing-200 p-spacing-300 flex">
94
+ {#each variants as variant (variant)}
95
+ <ButtonIcon {variant} disabled aria-label={variant} iconProps={{ name: 'delete' }} />
96
+ {/each}
73
97
  </div>
74
98
  </Story>
@@ -1,29 +1,31 @@
1
1
  <!--
2
2
  @component
3
- Icon buttons help people take minor actions and are often used in app bars.
3
+ Icon buttons help people take minor actions with one tap.
4
4
 
5
- - Standard: Low emphasis
6
- - Filled: High emphasis
7
- - Filled Tonal: Medium-high emphasis
8
- - Outlined: Medium emphasis
5
+ - Filled: high emphasis (default)
6
+ - Tonal: medium-high emphasis
7
+ - Outlined: medium emphasis
8
+ - Standard: low emphasis, no container at rest; for app bars, fields and dense layouts
9
9
 
10
- @see https://m3.material.io/components/icon-buttons/overview
10
+ `variation="toggle"` makes a two-state icon button.
11
+
12
+ @see https://m3.material.io/components/icon-buttons/specs
11
13
  -->
12
14
  <script lang="ts">
13
15
  import type { ButtonIconProps } from './types.js';
14
16
  import { Icon, LoadingIndicator, Layer } from '../../utils/index.js';
15
- import { buttonIcon } from './theme.js';
17
+ import { buttonColor, buttonIcon } from './theme.js';
16
18
  import clsx from 'clsx';
19
+ import { buttonCorners, shapeMorph } from './shapeMorph.js';
17
20
  import Tooltip from '../forms/tooltip/Tooltip.svelte';
18
- import { Button, Toggle, type ButtonRootProps } from 'bits-ui';
19
- import type { ToggleRootProps } from 'bits-ui';
21
+ import { Button, Toggle, type ButtonRootProps, type ToggleRootProps } from 'bits-ui';
20
22
 
21
23
  let {
22
24
  iconProps,
23
- variant = 'text',
24
- color = 'default',
25
- size = 'md',
25
+ variant = 'filled',
26
+ size = 'sm',
26
27
  shape = 'round',
28
+ width = 'default',
27
29
  variation = 'default',
28
30
  triggerClass = '',
29
31
  triggerSide = 'top',
@@ -32,61 +34,81 @@ Icon buttons help people take minor actions and are often used in app bars.
32
34
  formaction,
33
35
  tooltipContent,
34
36
  loading,
35
- width = 'default',
36
- pressed = false,
37
+ pressed = $bindable(false),
37
38
  onPressedChange,
38
39
  class: className,
39
40
  ...restProps
40
41
  }: ButtonIconProps = $props();
41
42
 
42
- const selected = $derived(variation === 'toggle' ? pressed : undefined);
43
+ let ref = $state<HTMLElement | null>(null);
44
+ $effect(() => (ref ? shapeMorph(ref, buttonCorners) : undefined));
43
45
 
44
- const { base, icon } = $derived(
45
- buttonIcon({ variant, color, shape, variation, size, width, selected })
46
+ const toggle = $derived(variation === 'toggle');
47
+ const cls = $derived(buttonIcon({ variant, size, width, shape, selected: toggle && pressed }));
48
+ const colorCls = $derived(
49
+ buttonColor({
50
+ variant,
51
+ state: toggle ? (pressed ? 'selected' : 'unselected') : 'default'
52
+ })
46
53
  );
47
-
48
- const btnCls = $derived(base({ class: clsx(className) }));
54
+ const label = $derived(restProps['aria-label'] ?? tooltipContent);
49
55
  </script>
50
56
 
51
- <Tooltip {triggerClass} variant="snack" supportingText={tooltipContent}>
57
+ {#snippet content()}
58
+ {#if loading}
59
+ <LoadingIndicator center={false} class={cls.icon({ class: 'text-current' })} />
60
+ {:else}
61
+ <Icon
62
+ fill={toggle && pressed ? 1 : 0}
63
+ {...iconProps}
64
+ class={cls.icon({ class: clsx(iconProps.class) })}
65
+ />
66
+ {/if}
67
+ <Layer />
68
+ {/snippet}
69
+
70
+ <Tooltip
71
+ {triggerClass}
72
+ supportingText={tooltipContent}
73
+ contentProps={{ side: triggerSide, align: triggerAlign }}
74
+ >
52
75
  {#snippet trigger({
53
- class: triggerClass_,
76
+ class: tooltipTriggerClass,
54
77
  type: _tooltipType,
55
78
  onclick: _tooltipOnclick,
56
79
  ...triggerAttrs
57
80
  })}
58
- {#if variation === 'toggle'}
81
+ {@const btnCls = cls.base({
82
+ class: clsx(colorCls, className, tooltipTriggerClass as string)
83
+ })}
84
+ {#if toggle}
59
85
  <Toggle.Root
86
+ bind:ref
60
87
  bind:pressed
61
88
  {onPressedChange}
62
89
  {disabled}
63
- class={clsx(btnCls, triggerClass_ as string)}
90
+ class={btnCls}
91
+ aria-busy={loading || undefined}
64
92
  data-cy="m3-button-icon"
65
93
  {...restProps as ToggleRootProps}
66
94
  {...triggerAttrs}
95
+ aria-label={label}
67
96
  >
68
- {#if loading}
69
- <LoadingIndicator />
70
- {:else}
71
- <Icon class={icon()} {...iconProps} />
72
- <Layer />
73
- {/if}
97
+ {@render content()}
74
98
  </Toggle.Root>
75
99
  {:else}
76
100
  <Button.Root
101
+ bind:ref
77
102
  {disabled}
78
103
  {formaction}
79
- class={clsx(btnCls, triggerClass_ as string)}
104
+ class={btnCls}
105
+ aria-busy={loading || undefined}
80
106
  data-cy="m3-button-icon"
81
107
  {...restProps as ButtonRootProps}
82
108
  {...triggerAttrs}
109
+ aria-label={label}
83
110
  >
84
- {#if loading}
85
- <LoadingIndicator />
86
- {:else}
87
- <Icon class={icon()} {...iconProps} />
88
- <Layer />
89
- {/if}
111
+ {@render content()}
90
112
  </Button.Root>
91
113
  {/if}
92
114
  {/snippet}
@@ -1,14 +1,16 @@
1
1
  import type { ButtonIconProps } from './types.js';
2
2
  /**
3
- * Icon buttons help people take minor actions and are often used in app bars.
3
+ * Icon buttons help people take minor actions with one tap.
4
4
  *
5
- * - Standard: Low emphasis
6
- * - Filled: High emphasis
7
- * - Filled Tonal: Medium-high emphasis
8
- * - Outlined: Medium emphasis
5
+ * - Filled: high emphasis (default)
6
+ * - Tonal: medium-high emphasis
7
+ * - Outlined: medium emphasis
8
+ * - Standard: low emphasis, no container at rest; for app bars, fields and dense layouts
9
9
  *
10
- * @see https://m3.material.io/components/icon-buttons/overview
10
+ * `variation="toggle"` makes a two-state icon button.
11
+ *
12
+ * @see https://m3.material.io/components/icon-buttons/specs
11
13
  */
12
- declare const ButtonIcon: import("svelte").Component<ButtonIconProps, {}, "">;
14
+ declare const ButtonIcon: import("svelte").Component<ButtonIconProps, {}, "pressed">;
13
15
  type ButtonIcon = ReturnType<typeof ButtonIcon>;
14
16
  export default ButtonIcon;