gooee 0.51.1 → 1.0.0

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 (269) hide show
  1. package/README.md +10 -3
  2. package/package.json +6 -2
  3. package/scripts/add.js +181 -42
  4. package/src/base.css +3 -1
  5. package/src/components/Accordion/Accordion.module.css +7 -5
  6. package/src/components/Accordion/Accordion.tsx +13 -11
  7. package/src/components/Accordion/Accordion.vue +16 -15
  8. package/src/components/Accordion/AccordionItem.vue +8 -7
  9. package/src/components/Alert/Alert.module.css +9 -7
  10. package/src/components/Alert/Alert.tsx +25 -16
  11. package/src/components/Alert/Alert.vue +31 -27
  12. package/src/components/AlertDialog/AlertDialog.module.css +2 -0
  13. package/src/components/AlertDialog/AlertDialog.tsx +8 -7
  14. package/src/components/AlertDialog/AlertDialog.vue +25 -23
  15. package/src/components/AnimatedNumber/AnimatedNumber.module.css +5 -3
  16. package/src/components/AnimatedNumber/AnimatedNumber.tsx +6 -6
  17. package/src/components/AnimatedNumber/AnimatedNumber.vue +5 -5
  18. package/src/components/AspectRatio/AspectRatio.module.css +2 -0
  19. package/src/components/AspectRatio/AspectRatio.tsx +3 -3
  20. package/src/components/AspectRatio/AspectRatio.vue +5 -8
  21. package/src/components/Avatar/Avatar.module.css +10 -8
  22. package/src/components/Avatar/Avatar.tsx +4 -3
  23. package/src/components/Avatar/Avatar.vue +17 -19
  24. package/src/components/Avatar/index.ts +0 -2
  25. package/src/components/AvatarGroup/AvatarGroup.module.css +11 -9
  26. package/src/components/AvatarGroup/AvatarGroup.tsx +4 -4
  27. package/src/components/AvatarGroup/AvatarGroup.vue +13 -16
  28. package/src/components/Badge/Badge.module.css +6 -4
  29. package/src/components/Badge/Badge.tsx +3 -3
  30. package/src/components/Badge/Badge.vue +15 -14
  31. package/src/components/Breadcrumb/Breadcrumb.module.css +5 -3
  32. package/src/components/Breadcrumb/Breadcrumb.tsx +20 -12
  33. package/src/components/Breadcrumb/Breadcrumb.vue +33 -25
  34. package/src/components/Button/Button.module.css +16 -14
  35. package/src/components/Button/Button.tsx +6 -4
  36. package/src/components/Button/Button.vue +42 -33
  37. package/src/components/ButtonGroup/ButtonGroup.module.css +2 -0
  38. package/src/components/ButtonGroup/ButtonGroup.tsx +1 -1
  39. package/src/components/ButtonGroup/ButtonGroup.vue +9 -12
  40. package/src/components/Card/Card.module.css +6 -4
  41. package/src/components/Card/Card.tsx +6 -6
  42. package/src/components/Card/Card.vue +18 -21
  43. package/src/components/Center/Center.module.css +2 -0
  44. package/src/components/Center/Center.tsx +1 -1
  45. package/src/components/Center/Center.vue +18 -15
  46. package/src/components/Checkbox/Checkbox.module.css +10 -8
  47. package/src/components/Checkbox/Checkbox.tsx +7 -5
  48. package/src/components/Checkbox/Checkbox.vue +29 -31
  49. package/src/components/CheckboxGroup/CheckboxGroup.module.css +3 -1
  50. package/src/components/CheckboxGroup/CheckboxGroup.tsx +4 -4
  51. package/src/components/CheckboxGroup/CheckboxGroup.vue +33 -30
  52. package/src/components/Cluster/Cluster.module.css +2 -0
  53. package/src/components/Cluster/Cluster.tsx +1 -1
  54. package/src/components/Cluster/Cluster.vue +21 -17
  55. package/src/components/CodeBlock/CodeBlock.module.css +12 -10
  56. package/src/components/CodeBlock/CodeBlock.tsx +18 -10
  57. package/src/components/CodeBlock/CodeBlock.vue +30 -27
  58. package/src/components/CodeBlock/highlight.ts +1 -1
  59. package/src/components/Collapsible/Collapsible.module.css +7 -5
  60. package/src/components/Collapsible/Collapsible.tsx +7 -6
  61. package/src/components/Collapsible/Collapsible.vue +30 -26
  62. package/src/components/Container/Container.module.css +2 -0
  63. package/src/components/Container/Container.tsx +1 -1
  64. package/src/components/Container/Container.vue +13 -12
  65. package/src/components/CopyButton/CopyButton.module.css +20 -18
  66. package/src/components/CopyButton/CopyButton.tsx +21 -14
  67. package/src/components/CopyButton/CopyButton.vue +41 -31
  68. package/src/components/Dial/Dial.module.css +26 -11
  69. package/src/components/Dial/Dial.tsx +18 -18
  70. package/src/components/Dial/Dial.vue +57 -60
  71. package/src/components/Dialog/Dialog.module.css +4 -2
  72. package/src/components/Dialog/Dialog.tsx +22 -13
  73. package/src/components/Dialog/Dialog.vue +34 -30
  74. package/src/components/Divider/Divider.module.css +5 -3
  75. package/src/components/Divider/Divider.tsx +6 -4
  76. package/src/components/Divider/Divider.vue +13 -16
  77. package/src/components/DropdownMenu/DropdownMenu.module.css +8 -6
  78. package/src/components/DropdownMenu/DropdownMenu.tsx +11 -8
  79. package/src/components/DropdownMenu/DropdownMenu.vue +24 -27
  80. package/src/components/EmptyState/EmptyState.module.css +6 -4
  81. package/src/components/EmptyState/EmptyState.tsx +6 -6
  82. package/src/components/EmptyState/EmptyState.vue +14 -17
  83. package/src/components/Fab/Fab.module.css +19 -17
  84. package/src/components/Fab/Fab.tsx +11 -9
  85. package/src/components/Fab/Fab.vue +29 -26
  86. package/src/components/Fieldset/Fieldset.module.css +2 -0
  87. package/src/components/Fieldset/Fieldset.tsx +4 -3
  88. package/src/components/Fieldset/Fieldset.vue +4 -4
  89. package/src/components/FormField/FormField.module.css +5 -3
  90. package/src/components/FormField/FormField.tsx +7 -7
  91. package/src/components/FormField/FormField.vue +4 -4
  92. package/src/components/Grid/Grid.module.css +2 -0
  93. package/src/components/Grid/Grid.tsx +1 -1
  94. package/src/components/Grid/Grid.vue +25 -22
  95. package/src/components/HoldToConfirm/HoldToConfirm.module.css +13 -11
  96. package/src/components/HoldToConfirm/HoldToConfirm.tsx +11 -9
  97. package/src/components/HoldToConfirm/HoldToConfirm.vue +37 -32
  98. package/src/components/IconButton/IconButton.module.css +7 -5
  99. package/src/components/IconButton/IconButton.tsx +2 -1
  100. package/src/components/IconButton/IconButton.vue +15 -14
  101. package/src/components/Input/Input.module.css +12 -10
  102. package/src/components/Input/Input.tsx +9 -7
  103. package/src/components/Input/Input.vue +45 -35
  104. package/src/components/InputGroup/InputGroup.module.css +8 -6
  105. package/src/components/InputGroup/InputGroup.tsx +5 -4
  106. package/src/components/InputGroup/InputGroup.vue +41 -36
  107. package/src/components/Kbd/Kbd.module.css +9 -7
  108. package/src/components/Kbd/Kbd.tsx +1 -1
  109. package/src/components/Kbd/Kbd.vue +1 -1
  110. package/src/components/Link/Link.module.css +4 -2
  111. package/src/components/Link/Link.tsx +4 -3
  112. package/src/components/Link/Link.vue +13 -16
  113. package/src/components/LivePill/LivePill.module.css +39 -37
  114. package/src/components/LivePill/LivePill.tsx +11 -10
  115. package/src/components/LivePill/LivePill.vue +38 -40
  116. package/src/components/Meter/Meter.module.css +5 -3
  117. package/src/components/Meter/Meter.tsx +9 -8
  118. package/src/components/Meter/Meter.vue +52 -43
  119. package/src/components/MorphButton/MorphButton.module.css +11 -9
  120. package/src/components/MorphButton/MorphButton.tsx +20 -10
  121. package/src/components/MorphButton/MorphButton.vue +29 -25
  122. package/src/components/NumberInput/NumberInput.module.css +7 -5
  123. package/src/components/NumberInput/NumberInput.tsx +11 -8
  124. package/src/components/NumberInput/NumberInput.vue +69 -57
  125. package/src/components/Pagination/Pagination.module.css +147 -5
  126. package/src/components/Pagination/Pagination.tsx +216 -41
  127. package/src/components/Pagination/Pagination.vue +201 -36
  128. package/src/components/Pagination/labels.ts +38 -0
  129. package/src/components/PasswordInput/PasswordInput.module.css +10 -8
  130. package/src/components/PasswordInput/PasswordInput.tsx +15 -7
  131. package/src/components/PasswordInput/PasswordInput.vue +20 -16
  132. package/src/components/PasswordInput/index.ts +1 -1
  133. package/src/components/PickerWheel/DateWheel.vue +20 -12
  134. package/src/components/PickerWheel/PickerWheel.module.css +15 -6
  135. package/src/components/PickerWheel/PickerWheel.tsx +70 -44
  136. package/src/components/PickerWheel/PickerWheel.vue +39 -38
  137. package/src/components/PickerWheel/TimeWheel.vue +23 -21
  138. package/src/components/PickerWheel/WheelColumn.vue +7 -5
  139. package/src/components/Popover/Popover.module.css +5 -3
  140. package/src/components/Popover/Popover.tsx +17 -8
  141. package/src/components/Popover/Popover.vue +26 -25
  142. package/src/components/ProgressBar/ProgressBar.module.css +4 -2
  143. package/src/components/ProgressBar/ProgressBar.tsx +6 -5
  144. package/src/components/ProgressBar/ProgressBar.vue +28 -25
  145. package/src/components/Prose/Prose.module.css +5 -3
  146. package/src/components/Prose/Prose.tsx +1 -1
  147. package/src/components/Prose/Prose.vue +5 -8
  148. package/src/components/Radio/Radio.module.css +10 -8
  149. package/src/components/Radio/Radio.tsx +10 -8
  150. package/src/components/Radio/Radio.vue +8 -8
  151. package/src/components/Radio/RadioGroup.vue +33 -35
  152. package/src/components/Radio/radioContext.ts +12 -0
  153. package/src/components/Retime/Retime.vue +25 -22
  154. package/src/components/RulerScrubber/RulerScrubber.module.css +11 -2
  155. package/src/components/RulerScrubber/RulerScrubber.tsx +19 -18
  156. package/src/components/RulerScrubber/RulerScrubber.vue +50 -54
  157. package/src/components/ScrollArea/ScrollArea.module.css +17 -15
  158. package/src/components/ScrollArea/ScrollArea.tsx +5 -4
  159. package/src/components/ScrollArea/ScrollArea.vue +15 -17
  160. package/src/components/SearchInput/SearchInput.module.css +6 -4
  161. package/src/components/SearchInput/SearchInput.tsx +15 -8
  162. package/src/components/SearchInput/SearchInput.vue +20 -17
  163. package/src/components/SearchInput/index.ts +1 -1
  164. package/src/components/SegmentedControl/SegmentedControl.module.css +7 -5
  165. package/src/components/SegmentedControl/SegmentedControl.tsx +9 -5
  166. package/src/components/SegmentedControl/SegmentedControl.vue +25 -29
  167. package/src/components/Select/Select.module.css +19 -17
  168. package/src/components/Select/Select.tsx +30 -17
  169. package/src/components/Select/Select.vue +62 -57
  170. package/src/components/Sheet/Sheet.module.css +6 -4
  171. package/src/components/Sheet/Sheet.tsx +39 -29
  172. package/src/components/Sheet/Sheet.vue +46 -40
  173. package/src/components/Skeleton/Skeleton.module.css +4 -2
  174. package/src/components/Skeleton/Skeleton.tsx +3 -2
  175. package/src/components/Skeleton/Skeleton.vue +16 -18
  176. package/src/components/Slider/Slider.module.css +14 -12
  177. package/src/components/Slider/Slider.tsx +20 -9
  178. package/src/components/Slider/Slider.vue +47 -37
  179. package/src/components/Spinner/Spinner.module.css +2 -0
  180. package/src/components/Spinner/Spinner.tsx +3 -3
  181. package/src/components/Spinner/Spinner.vue +9 -12
  182. package/src/components/Split/Split.module.css +2 -0
  183. package/src/components/Split/Split.tsx +3 -3
  184. package/src/components/Split/Split.vue +19 -17
  185. package/src/components/SplitFlap/SplitFlap.module.css +9 -7
  186. package/src/components/SplitFlap/SplitFlap.tsx +2 -2
  187. package/src/components/SplitFlap/SplitFlap.vue +24 -21
  188. package/src/components/Stack/Stack.module.css +2 -0
  189. package/src/components/Stack/Stack.tsx +1 -1
  190. package/src/components/Stack/Stack.vue +13 -12
  191. package/src/components/SwipeDeck/SwipeDeck.module.css +13 -11
  192. package/src/components/SwipeDeck/SwipeDeck.tsx +23 -28
  193. package/src/components/SwipeDeck/SwipeDeck.vue +32 -38
  194. package/src/components/Switch/Switch.module.css +10 -8
  195. package/src/components/Switch/Switch.tsx +6 -5
  196. package/src/components/Switch/Switch.vue +22 -24
  197. package/src/components/Table/Table.module.css +24 -22
  198. package/src/components/Table/Table.tsx +27 -30
  199. package/src/components/Table/Table.vue +93 -79
  200. package/src/components/TableOfContents/TableOfContents.module.css +9 -7
  201. package/src/components/TableOfContents/TableOfContents.tsx +8 -8
  202. package/src/components/TableOfContents/TableOfContents.vue +20 -23
  203. package/src/components/Tabs/Tab.vue +3 -0
  204. package/src/components/Tabs/TabList.vue +2 -2
  205. package/src/components/Tabs/TabPanel.vue +2 -0
  206. package/src/components/Tabs/Tabs.module.css +4 -2
  207. package/src/components/Tabs/Tabs.tsx +10 -5
  208. package/src/components/Tabs/Tabs.vue +1 -1
  209. package/src/components/Tag/Tag.module.css +12 -10
  210. package/src/components/Tag/Tag.tsx +13 -15
  211. package/src/components/Tag/Tag.vue +12 -14
  212. package/src/components/Textarea/Textarea.module.css +8 -6
  213. package/src/components/Textarea/Textarea.tsx +4 -3
  214. package/src/components/Textarea/Textarea.vue +32 -34
  215. package/src/components/ThemeToggle/ThemeToggle.module.css +2 -0
  216. package/src/components/ThemeToggle/ThemeToggle.tsx +7 -7
  217. package/src/components/ThemeToggle/ThemeToggle.vue +24 -22
  218. package/src/components/Toast/Toast.module.css +17 -15
  219. package/src/components/Toast/Toast.tsx +51 -34
  220. package/src/components/Toast/Toast.vue +35 -24
  221. package/src/components/Toast/ToastItem.vue +17 -16
  222. package/src/components/Toggle/Toggle.module.css +11 -9
  223. package/src/components/Toggle/Toggle.tsx +3 -2
  224. package/src/components/Toggle/Toggle.vue +13 -15
  225. package/src/components/Tooltip/Tooltip.module.css +5 -3
  226. package/src/components/Tooltip/Tooltip.tsx +1 -0
  227. package/src/components/Tooltip/Tooltip.vue +13 -18
  228. package/src/components/VisuallyHidden/VisuallyHidden.module.css +2 -0
  229. package/src/components/VisuallyHidden/VisuallyHidden.tsx +1 -1
  230. package/src/components/VisuallyHidden/VisuallyHidden.vue +5 -8
  231. package/src/{internal → icons}/icons.module.css +4 -2
  232. package/src/{internal → icons}/icons.tsx +15 -16
  233. package/src/internal/FieldMessage.module.css +5 -3
  234. package/src/internal/FieldMessage.tsx +2 -2
  235. package/src/internal/FieldMessage.vue +2 -2
  236. package/src/internal/Roll.module.css +5 -3
  237. package/src/internal/feel.ts +12 -10
  238. package/src/internal/fling.ts +3 -3
  239. package/src/internal/liquid.ts +12 -10
  240. package/src/internal/liquidMatter.ts +1 -1
  241. package/src/internal/liquidMore.ts +7 -7
  242. package/src/internal/motion/checkbox.ts +4 -4
  243. package/src/internal/motion/fling.ts +19 -9
  244. package/src/internal/motion/holdToConfirm.ts +3 -3
  245. package/src/internal/motion/index.ts +8 -6
  246. package/src/internal/motion/liquid.ts +16 -4
  247. package/src/internal/motion/liquidMatter.ts +8 -6
  248. package/src/internal/motion/liquidMore.ts +44 -25
  249. package/src/internal/motion/livePill.ts +1 -1
  250. package/src/internal/motion/numberInput.ts +2 -2
  251. package/src/internal/motion/pickerWheel.ts +7 -4
  252. package/src/internal/motion/ruler.ts +1 -1
  253. package/src/internal/motion/scrollArea.ts +3 -3
  254. package/src/internal/motion/scrollFrame.ts +9 -7
  255. package/src/internal/motion/scrubber.ts +39 -20
  256. package/src/internal/motion/slider.ts +38 -4
  257. package/src/internal/motion/softPress.ts +10 -9
  258. package/src/internal/motion/splitFlap.ts +4 -4
  259. package/src/internal/motion/swipeDeck.ts +38 -7
  260. package/src/internal/motion/table.ts +3 -6
  261. package/src/internal/motion/themeIcon.ts +1 -1
  262. package/src/internal/motion/themeReveal.ts +1 -1
  263. package/src/internal/motion/toast.ts +3 -3
  264. package/src/internal/motion.ts +7 -8
  265. package/src/internal/scrollFrame.ts +3 -3
  266. package/src/internal/useScrub.ts +1 -15
  267. package/src/internal/vue/useScrub.ts +2 -6
  268. package/src/tokens.css +81 -421
  269. package/src/{internal/vueIcons.ts → icons/vue.ts} +5 -5
@@ -8,31 +8,34 @@ import styles from './CheckboxGroup.module.css'
8
8
 
9
9
  export type CheckboxOption = { value: string; label: string; description?: string; disabled?: boolean }
10
10
 
11
- const props = withDefaults(
12
- defineProps<{
13
- /** Visible name of the group, rendered as the legend. */
14
- label: string
15
- /** The boxes, in order. */
16
- options: CheckboxOption[]
17
- /** Starting value when there is no v-model. */
18
- defaultValue?: string[]
19
- /** Muted text under the label, read with the group. */
20
- description?: string
21
- /** Error under the boxes. Marks every box invalid and is read with the group. */
22
- error?: string
23
- /** Form field name shared by every box. Each ticked box sends its value. */
24
- name?: string
25
- /** Turns off every box in the group. */
26
- disabled?: boolean
27
- /** Stacks the boxes or puts them in a row that wraps. */
28
- orientation?: 'vertical' | 'horizontal'
29
- }>(),
30
- { orientation: 'vertical' },
31
- )
11
+ const {
12
+ options,
13
+ defaultValue,
14
+ description,
15
+ error,
16
+ orientation = 'vertical',
17
+ } = defineProps<{
18
+ /** Visible name of the group, rendered as the legend. */
19
+ label: string
20
+ /** The boxes, in order. */
21
+ options: CheckboxOption[]
22
+ /** Starting value when there is no v-model. */
23
+ defaultValue?: string[]
24
+ /** Muted text under the label, read with the group. */
25
+ description?: string
26
+ /** Error under the boxes. Marks every box invalid and is read with the group. */
27
+ error?: string
28
+ /** Form field name shared by every box. Each ticked box sends its value. */
29
+ name?: string
30
+ /** Turns off every box in the group. */
31
+ disabled?: boolean
32
+ /** Stacks the boxes or puts them in a row that wraps. */
33
+ orientation?: 'vertical' | 'horizontal'
34
+ }>()
32
35
 
33
36
  /** Values of the ticked boxes, in option order. Use v-model, or leave it out and the group keeps its own state. */
34
37
  const model = defineModel<string[]>()
35
- const local = ref(props.defaultValue ?? [])
38
+ const local = ref(defaultValue ?? [])
36
39
  const value = computed({
37
40
  get: () => model.value ?? local.value,
38
41
  set: (next: string[]) => {
@@ -44,20 +47,20 @@ const value = computed({
44
47
  const auto = useId()
45
48
  const descId = `${auto}-desc`
46
49
  const errorId = `${auto}-error`
47
- const describedBy = computed(() => [props.description ? descId : null, props.error ? errorId : null].filter(Boolean).join(' ') || undefined)
50
+ const describedBy = computed(() => [description ? descId : null, error ? errorId : null].filter(Boolean).join(' ') || undefined)
48
51
  const toggle = (v: string, on: boolean) => {
49
52
  const next = new Set(value.value)
50
53
  if (on) next.add(v)
51
54
  else next.delete(v)
52
- value.value = props.options.map((o) => o.value).filter((x) => next.has(x))
55
+ value.value = options.map((o) => o.value).filter((x) => next.has(x))
53
56
  }
54
57
  </script>
55
58
 
56
59
  <template>
57
- <fieldset :class="styles.group" :disabled="disabled" :aria-describedby="describedBy" :data-disabled="disabled || undefined" :data-invalid="error ? true : undefined">
58
- <legend :class="styles.legend">{{ label }}</legend>
59
- <p v-if="description" :id="descId" :class="styles.description">{{ description }}</p>
60
- <div :class="[styles.items, styles[orientation]]">
60
+ <fieldset data-slot="checkbox-group" :class="styles.group" :disabled="disabled" :aria-describedby="describedBy" :data-disabled="disabled || undefined" :data-invalid="error ? true : undefined" :data-orientation="orientation">
61
+ <legend data-slot="field-label" :class="styles.legend">{{ label }}</legend>
62
+ <p v-if="description" :id="descId" data-slot="checkbox-group-description" :class="styles.description">{{ description }}</p>
63
+ <div data-slot="checkbox-group-items" :class="[styles.items, styles[orientation]]">
61
64
  <Checkbox
62
65
  v-for="o in options"
63
66
  :key="o.value"
@@ -66,9 +69,9 @@ const toggle = (v: string, on: boolean) => {
66
69
  :name="name"
67
70
  :value="o.value"
68
71
  :disabled="o.disabled"
69
- :checked="value.includes(o.value)"
72
+ :model-value="value.includes(o.value)"
70
73
  :aria-invalid="error ? true : undefined"
71
- @update:checked="(on?: boolean) => toggle(o.value, !!on)"
74
+ @update:model-value="(on?: boolean) => toggle(o.value, !!on)"
72
75
  />
73
76
  </div>
74
77
  <FieldMessage :help-id="`${auto}-help`" :error-id="errorId" :error="error" />
@@ -1,3 +1,4 @@
1
+ @layer gooee.components {
1
2
  .root {
2
3
  display: flex;
3
4
  flex-wrap: wrap;
@@ -23,3 +24,4 @@
23
24
  .justify-center { justify-content: center; }
24
25
  .justify-end { justify-content: flex-end; }
25
26
  .justify-between { justify-content: space-between; }
27
+ }
@@ -22,5 +22,5 @@ export function Cluster({ gap = 3, rowGap, align = 'center', justify = 'start',
22
22
  // One cast keeps the ref and attribute types simple; every option is a block element.
23
23
  const Tag = as as 'div'
24
24
  const vars = { '--cluster-gap': space(gap), '--cluster-row-gap': space(rowGap ?? gap), ...style } as CSSProperties
25
- return <Tag className={cx(styles.root, styles[`align-${align}`], styles[`justify-${justify}`], !wrap && styles.nowrap, className)} style={vars} {...rest} />
25
+ return <Tag data-slot="cluster" className={cx(styles.root, styles[`align-${align}`], styles[`justify-${justify}`], !wrap && styles.nowrap, className)} style={vars} {...rest} />
26
26
  }
@@ -3,29 +3,33 @@ import { space, type Space } from '../../internal/space'
3
3
  import styles from './Cluster.module.css'
4
4
 
5
5
  // The Vue Cluster: the same look (Cluster.module.css) as the React one. Other attributes go to the element.
6
- withDefaults(
7
- defineProps<{
8
- /** Space between items, as a step of the space scale (0 to 12, read as --gooee-space-N). */
9
- gap?: Space
10
- /** Space between wrapped rows. Defaults to the same step as gap. */
11
- rowGap?: Space
12
- /** Lines items up inside a row. "baseline" keeps mixed text sizes on one line. */
13
- align?: 'start' | 'center' | 'end' | 'baseline' | 'stretch'
14
- /** Places items along the row. "between" pushes the first and last item to the edges. */
15
- justify?: 'start' | 'center' | 'end' | 'between'
16
- /** Lets items flow onto the next row when they run out of room. */
17
- wrap?: boolean
18
- /** Element to render, so a row of links can be a nav or a list. */
19
- as?: 'div' | 'section' | 'nav' | 'header' | 'footer' | 'ul' | 'ol'
20
- }>(),
21
- { gap: 3, align: 'center', justify: 'start', wrap: true, as: 'div' },
22
- )
6
+ const {
7
+ gap = 3,
8
+ align = 'center',
9
+ justify = 'start',
10
+ wrap = true,
11
+ as = 'div',
12
+ } = defineProps<{
13
+ /** Space between items, as a step of the space scale (0 to 12, read as --gooee-space-N). */
14
+ gap?: Space
15
+ /** Space between wrapped rows. Defaults to the same step as gap. */
16
+ rowGap?: Space
17
+ /** Lines items up inside a row. "baseline" keeps mixed text sizes on one line. */
18
+ align?: 'start' | 'center' | 'end' | 'baseline' | 'stretch'
19
+ /** Places items along the row. "between" pushes the first and last item to the edges. */
20
+ justify?: 'start' | 'center' | 'end' | 'between'
21
+ /** Lets items flow onto the next row when they run out of room. */
22
+ wrap?: boolean
23
+ /** Element to render, so a row of links can be a nav or a list. */
24
+ as?: 'div' | 'section' | 'nav' | 'header' | 'footer' | 'ul' | 'ol'
25
+ }>()
23
26
  defineSlots<{ default?: () => unknown }>()
24
27
  </script>
25
28
 
26
29
  <template>
27
30
  <component
28
31
  :is="as"
32
+ data-slot="cluster"
29
33
  :class="[styles.root, styles[`align-${align}`], styles[`justify-${justify}`], !wrap && styles.nowrap]"
30
34
  :style="{ '--cluster-gap': space(gap), '--cluster-row-gap': space(rowGap ?? gap) }"
31
35
  >
@@ -1,3 +1,4 @@
1
+ @layer gooee.components {
1
2
  /* One card: a header row (title or tabs, and copy) over the code. */
2
3
  .root {
3
4
  min-width: 0;
@@ -6,8 +7,8 @@
6
7
  outline: var(--gooee-line) solid var(--gooee-color-border);
7
8
  outline-offset: calc(var(--gooee-line) * -1);
8
9
  border-radius: var(--gooee-radius-md);
9
- background: var(--gooee-code-bg);
10
- color: var(--gooee-code-fg);
10
+ background: var(--gooee-code-block-bg, var(--gooee-color-surface-sunken));
11
+ color: var(--gooee-code-block-fg, var(--gooee-color-fg));
11
12
  }
12
13
 
13
14
  .head {
@@ -59,8 +60,8 @@
59
60
  left: 0;
60
61
  padding: 0 calc(var(--gooee-space-4) - var(--gooee-line)) 0 var(--gooee-space-5);
61
62
  border-right: var(--gooee-line) solid var(--gooee-color-border);
62
- background: var(--gooee-code-bg);
63
- color: var(--gooee-code-gutter);
63
+ background: var(--gooee-code-block-bg, var(--gooee-color-surface-sunken));
64
+ color: var(--gooee-code-block-gutter, var(--gooee-color-fg-subtle));
64
65
  text-align: right;
65
66
  font-variant-numeric: tabular-nums;
66
67
  user-select: none;
@@ -68,9 +69,10 @@
68
69
 
69
70
  .code { font: inherit; }
70
71
 
71
- .keyword { color: var(--gooee-code-keyword); font-weight: var(--gooee-weight-semibold); }
72
- .tag { color: var(--gooee-code-tag); font-weight: var(--gooee-weight-semibold); }
73
- .attr { color: var(--gooee-code-attr); }
74
- .string { color: var(--gooee-code-string); }
75
- .number { color: var(--gooee-code-number); }
76
- .comment { color: var(--gooee-code-comment); font-style: italic; }
72
+ .keyword { color: var(--gooee-code-block-keyword, var(--gooee-color-fg)); font-weight: var(--gooee-weight-semibold); }
73
+ .tag { color: var(--gooee-code-block-tag, var(--gooee-color-fg)); font-weight: var(--gooee-weight-semibold); }
74
+ .attr { color: var(--gooee-code-block-attr, var(--gooee-color-fg-subtle)); }
75
+ .string { color: var(--gooee-code-block-string, var(--gooee-color-fg-muted)); }
76
+ .number { color: var(--gooee-code-block-number, var(--gooee-color-fg-muted)); }
77
+ .comment { color: var(--gooee-code-block-comment, var(--gooee-color-fg-subtle)); font-style: italic; }
78
+ }
@@ -6,6 +6,13 @@ import styles from './CodeBlock.module.css'
6
6
 
7
7
  export type { CodeLanguage } from './highlight'
8
8
 
9
+ export type CodeBlockLabels = {
10
+ /** Name of the copy button. */
11
+ copy: string
12
+ }
13
+
14
+ const defaultLabels: CodeBlockLabels = { copy: 'Copy code' }
15
+
9
16
  export type CodeBlockProps = {
10
17
  /** The code to show and copy. */
11
18
  code: string
@@ -19,32 +26,33 @@ export type CodeBlockProps = {
19
26
  lineNumbers?: boolean
20
27
  /** Shows the copy button in the header row. */
21
28
  copyable?: boolean
22
- /** Screen reader name for the copy button. */
23
- copyLabel?: string
24
29
  /** Screen reader name for the scrollable code. Undefined uses the title. */
25
30
  label?: string
31
+ /** Screen reader text, so you can translate it. Missing keys use the English defaults. */
32
+ labels?: Partial<CodeBlockLabels>
26
33
  /** Extra class for the root element. */
27
34
  className?: string
28
35
  }
29
36
 
30
37
  const NAMES: Record<CodeLanguage, string> = { tsx: 'TSX', html: 'HTML', css: 'CSS', shell: 'Terminal' }
31
38
 
32
- export function CodeBlock({ code, language, title, header, lineNumbers = false, copyable = true, copyLabel = 'Copy code', label, className }: CodeBlockProps) {
39
+ export function CodeBlock({ code, language, title, header, lineNumbers = false, copyable = true, label, labels: labelsProp, className }: CodeBlockProps) {
40
+ const labels = { ...defaultLabels, ...labelsProp }
33
41
  const lang = language ?? guessLanguage(code)
34
42
  const lines = code.replace(/\n$/, '').split('\n').length
35
43
  return (
36
- <div className={cx(styles.root, className)}>
37
- <div className={styles.head}>
38
- {header ?? <span className={styles.title}>{title ?? NAMES[lang]}</span>}
39
- {copyable && <CopyButton value={code} label={copyLabel} size="sm" className={styles.copy} />}
44
+ <div data-slot="code-block" className={cx(styles.root, className)}>
45
+ <div data-slot="code-block-header" className={styles.head}>
46
+ {header ?? <span data-slot="code-block-title" className={styles.title}>{title ?? NAMES[lang]}</span>}
47
+ {copyable && <CopyButton value={code} label={labels.copy} size="sm" className={styles.copy} />}
40
48
  </div>
41
- <pre className={styles.pre} tabIndex={0} aria-label={label ?? (title ? `${title} code` : 'Code example')} data-lines={lineNumbers || undefined}>
49
+ <pre data-slot="code-block-pre" className={styles.pre} tabIndex={0} aria-label={label ?? (title ? `${title} code` : 'Code example')} data-lines={lineNumbers || undefined}>
42
50
  {lineNumbers && (
43
- <span className={styles.gutter} aria-hidden="true">
51
+ <span data-slot="code-block-gutter" className={styles.gutter} aria-hidden="true">
44
52
  {Array.from({ length: lines }, (_, i) => i + 1).join('\n')}
45
53
  </span>
46
54
  )}
47
- <code className={styles.code}>
55
+ <code data-slot="code-block-code" className={styles.code}>
48
56
  {tokenize(code, lang).map((t, i) => (t.kind ? <span key={i} className={styles[t.kind]}>{t.text}</span> : t.text))}
49
57
  </code>
50
58
  </pre>
@@ -4,42 +4,45 @@ import CopyButton from '../CopyButton/CopyButton.vue'
4
4
  import { guessLanguage, tokenize, type CodeLanguage } from './highlight'
5
5
  import styles from './CodeBlock.module.css'
6
6
 
7
+ export type CodeBlockLabels = {
8
+ /** Name of the copy button. */
9
+ copy: string
10
+ }
11
+
7
12
  // The Vue CodeBlock: the same look (CodeBlock.module.css) and colouring (highlight.ts) as the React one.
8
- const props = withDefaults(
9
- defineProps<{
10
- /** The code to show and copy. */
11
- code: string
12
- /** Sets the colouring. Undefined guesses from the first line. */
13
- language?: CodeLanguage
14
- /** File name or short title in the header row. Undefined shows the language. */
15
- title?: string
16
- /** Shows a line number before each line. They are never copied or read out. */
17
- lineNumbers?: boolean
18
- /** Shows the copy button in the header row. */
19
- copyable?: boolean
20
- /** Screen reader name for the copy button. */
21
- copyLabel?: string
22
- /** Screen reader name for the scrollable code. Undefined uses the title. */
23
- label?: string
24
- }>(),
25
- { lineNumbers: false, copyable: true, copyLabel: 'Copy code' },
26
- )
13
+ const { code, language, lineNumbers = false, copyable = true, labels } = defineProps<{
14
+ /** The code to show and copy. */
15
+ code: string
16
+ /** Sets the colouring. Undefined guesses from the first line. */
17
+ language?: CodeLanguage
18
+ /** File name or short title in the header row. Undefined shows the language. */
19
+ title?: string
20
+ /** Shows a line number before each line. They are never copied or read out. */
21
+ lineNumbers?: boolean
22
+ /** Shows the copy button in the header row. */
23
+ copyable?: boolean
24
+ /** Screen reader name for the scrollable code. Undefined uses the title. */
25
+ label?: string
26
+ /** Screen reader text, so you can translate it. Missing keys use the English defaults. */
27
+ labels?: Partial<CodeBlockLabels>
28
+ }>()
29
+ const text = computed(() => ({ copy: 'Copy code', ...labels }))
27
30
  /** header: replaces the title in the header row, for example with tabs that switch the code. */
28
31
  defineSlots<{ header?: () => unknown }>()
29
32
 
30
33
  const NAMES: Record<CodeLanguage, string> = { tsx: 'TSX', html: 'HTML', css: 'CSS', shell: 'Terminal' }
31
- const lang = computed(() => props.language ?? guessLanguage(props.code))
32
- const numbers = computed(() => Array.from({ length: props.code.replace(/\n$/, '').split('\n').length }, (_, i) => i + 1).join('\n'))
33
- const tokens = computed(() => tokenize(props.code, lang.value))
34
+ const lang = computed(() => language ?? guessLanguage(code))
35
+ const numbers = computed(() => Array.from({ length: code.replace(/\n$/, '').split('\n').length }, (_, i) => i + 1).join('\n'))
36
+ const tokens = computed(() => tokenize(code, lang.value))
34
37
  </script>
35
38
 
36
39
  <template>
37
- <div :class="styles.root">
38
- <div :class="styles.head">
39
- <slot name="header"><span :class="styles.title">{{ title ?? NAMES[lang] }}</span></slot>
40
- <CopyButton v-if="copyable" :value="code" :label="copyLabel" size="sm" :class="styles.copy" />
40
+ <div data-slot="code-block" :class="styles.root">
41
+ <div data-slot="code-block-header" :class="styles.head">
42
+ <slot name="header"><span data-slot="code-block-title" :class="styles.title">{{ title ?? NAMES[lang] }}</span></slot>
43
+ <CopyButton v-if="copyable" :value="code" :label="text.copy" size="sm" :class="styles.copy" />
41
44
  </div>
42
45
  <!-- Kept on one line: a pre keeps every space and line break in the template. -->
43
- <pre :class="styles.pre" tabindex="0" :aria-label="label ?? (title ? `${title} code` : 'Code example')" :data-lines="lineNumbers || undefined"><span v-if="lineNumbers" :class="styles.gutter" aria-hidden="true">{{ numbers }}</span><code :class="styles.code"><template v-for="(t, i) in tokens" :key="i"><span v-if="t.kind" :class="styles[t.kind]">{{ t.text }}</span><template v-else>{{ t.text }}</template></template></code></pre>
46
+ <pre data-slot="code-block-pre" :class="styles.pre" tabindex="0" :aria-label="label ?? (title ? `${title} code` : 'Code example')" :data-lines="lineNumbers || undefined"><span v-if="lineNumbers" data-slot="code-block-gutter" :class="styles.gutter" aria-hidden="true">{{ numbers }}</span><code data-slot="code-block-code" :class="styles.code"><template v-for="(t, i) in tokens" :key="i"><span v-if="t.kind" :class="styles[t.kind]">{{ t.text }}</span><template v-else>{{ t.text }}</template></template></code></pre>
44
47
  </div>
45
48
  </template>
@@ -1,5 +1,5 @@
1
1
  // A small tokenizer for TSX, HTML, CSS and shell: enough to colour short examples. It only splits the
2
- // text; CodeBlock gives each kind its --gooee-code-* colour.
2
+ // text; CodeBlock gives each kind its --gooee-code-block-* colour.
3
3
 
4
4
  export type CodeLanguage = 'tsx' | 'html' | 'css' | 'shell'
5
5
 
@@ -1,3 +1,4 @@
1
+ @layer gooee.components {
1
2
  .root {
2
3
  display: flex;
3
4
  flex-direction: column;
@@ -21,8 +22,8 @@
21
22
  font-weight: var(--gooee-weight-medium);
22
23
  cursor: pointer;
23
24
  transition:
24
- background-color var(--gooee-motion-fast) var(--gooee-ease-out),
25
- transform var(--gooee-motion-slow) var(--gooee-ease-spring);
25
+ background-color var(--gooee-motion-fast) var(--gooee-ease-morph),
26
+ transform var(--gooee-motion-slow) var(--gooee-ease-morph);
26
27
  }
27
28
 
28
29
  @media (hover: hover) {
@@ -43,10 +44,10 @@
43
44
  width: var(--gooee-icon-md);
44
45
  height: var(--gooee-icon-md);
45
46
  color: var(--gooee-color-fg-muted);
46
- transition: transform var(--gooee-motion-slow) var(--gooee-ease-spring);
47
+ transition: transform var(--gooee-motion-slow) var(--gooee-ease-morph);
47
48
  }
48
49
 
49
- .root[data-open] .chevron { transform: rotate(180deg); }
50
+ .root[data-state='open'] .chevron { transform: rotate(180deg); }
50
51
 
51
52
  .panel {
52
53
  display: grid;
@@ -57,7 +58,7 @@
57
58
  visibility 0s linear var(--gooee-motion-morph);
58
59
  }
59
60
 
60
- .root[data-open] .panel {
61
+ .root[data-state='open'] .panel {
61
62
  grid-template-rows: 1fr;
62
63
  visibility: visible;
63
64
  transition:
@@ -73,3 +74,4 @@
73
74
  .content {
74
75
  padding-top: var(--gooee-space-3);
75
76
  }
77
+ }
@@ -2,7 +2,7 @@
2
2
 
3
3
  import { cloneElement, isValidElement, useId, type MouseEvent, type ReactElement, type ReactNode } from 'react'
4
4
  import { cx } from '../../internal/cx'
5
- import { ChevronDownIcon } from '../../internal/icons'
5
+ import { ChevronDownIcon } from '../../icons/icons'
6
6
  import { useControllable } from '../../internal/useControllable'
7
7
  import styles from './Collapsible.module.css'
8
8
 
@@ -35,7 +35,7 @@ export function Collapsible({ label, trigger, open: openProp, defaultOpen = fals
35
35
  const toggle = () => !disabled && setOpen(!open)
36
36
 
37
37
  return (
38
- <div className={cx(styles.root, className)} data-open={open || undefined}>
38
+ <div data-slot="collapsible" className={cx(styles.root, className)} data-state={open ? 'open' : 'closed'} data-disabled={disabled || undefined}>
39
39
  {trigger && isValidElement(trigger) ? (
40
40
  cloneElement(trigger, {
41
41
  'aria-expanded': open,
@@ -50,20 +50,21 @@ export function Collapsible({ label, trigger, open: openProp, defaultOpen = fals
50
50
  ) : (
51
51
  <button
52
52
  type="button"
53
+ data-slot="collapsible-trigger"
53
54
  className={styles.trigger}
54
55
  aria-expanded={open}
55
56
  aria-controls={`${id}-panel`}
56
57
  disabled={disabled}
57
58
  onClick={toggle}
58
59
  >
59
- <span className={styles.label}>{label}</span>
60
- <ChevronDownIcon className={styles.chevron} />
60
+ <span data-slot="collapsible-label" className={styles.label}>{label}</span>
61
+ <ChevronDownIcon data-slot="collapsible-icon" className={styles.chevron} />
61
62
  </button>
62
63
  )}
63
64
  {/* Grid rows animate from 0fr to 1fr, so the height follows the content without measuring. */}
64
- <div id={`${id}-panel`} className={styles.panel} inert={!open}>
65
+ <div id={`${id}-panel`} data-slot="collapsible-panel" className={styles.panel} inert={!open}>
65
66
  <div className={styles.inner}>
66
- <div className={styles.content}>{children}</div>
67
+ <div data-slot="collapsible-content" className={styles.content}>{children}</div>
67
68
  </div>
68
69
  </div>
69
70
  </div>
@@ -1,34 +1,33 @@
1
1
  <script setup lang="ts">
2
- import { computed, ref, useId } from 'vue'
3
- import { ChevronDownIcon } from '../../internal/vueIcons'
2
+ import { cloneVNode, computed, ref, useId, type VNode } from 'vue'
3
+ import { firstNode } from '../../internal/vue/trigger'
4
+ import { ChevronDownIcon } from '../../icons/vue'
4
5
  import styles from './Collapsible.module.css'
5
6
 
6
- // The Vue Collapsible: the same look (Collapsible.module.css) as the React one. For your own button, use the
7
- // trigger slot and bind what it gives: <template #trigger="t"><Button v-bind="t">Details</Button></template>.
8
- const props = withDefaults(
9
- defineProps<{
10
- /** Text for the built-in toggle button. The label slot replaces it. */
11
- label?: string
12
- /** Starting open state when there is no v-model:open. */
13
- defaultOpen?: boolean
14
- /** Stops the panel from opening or closing. */
15
- disabled?: boolean
16
- }>(),
17
- { defaultOpen: false },
18
- )
7
+ // The Vue Collapsible: the same look (Collapsible.module.css) as the React one. For your own button, put it in
8
+ // the trigger slot: it gets the ARIA and the click, like React's cloneElement. The slot props carry the same, for
9
+ // those who bind them by hand.
10
+ const { defaultOpen = false, disabled } = defineProps<{
11
+ /** Text for the built-in toggle button. The label slot replaces it. */
12
+ label?: string
13
+ /** Starting open state when there is no v-model:open. */
14
+ defaultOpen?: boolean
15
+ /** Stops the panel from opening or closing. */
16
+ disabled?: boolean
17
+ }>()
19
18
  /** Open state. Use v-model:open, or leave it out and the part keeps its own state. */
20
19
  const model = defineModel<boolean | undefined>('open', { default: undefined })
21
20
  const slots = defineSlots<{
22
21
  default?: () => unknown
23
22
  label?: () => unknown
24
- trigger?: (props: { 'aria-expanded': boolean; 'aria-controls': string; disabled?: boolean; 'aria-disabled'?: boolean; onClick: () => void }) => unknown
23
+ trigger?: (props: { 'aria-expanded': boolean; 'aria-controls': string; disabled?: boolean; 'aria-disabled'?: boolean; onClick: () => void }) => VNode[]
25
24
  }>()
26
25
 
27
26
  const id = useId()
28
- const local = ref(props.defaultOpen)
27
+ const local = ref(defaultOpen)
29
28
  const open = computed(() => model.value ?? local.value)
30
29
  const toggle = () => {
31
- if (props.disabled) return
30
+ if (disabled) return
32
31
  const next = !open.value
33
32
  local.value = next
34
33
  model.value = next
@@ -37,22 +36,27 @@ const toggle = () => {
37
36
  const triggerProps = computed(() => ({
38
37
  'aria-expanded': open.value,
39
38
  'aria-controls': `${id}-panel`,
40
- ...(props.disabled ? { disabled: true, 'aria-disabled': true } : null),
39
+ ...(disabled ? { disabled: true, 'aria-disabled': true } : null),
41
40
  onClick: toggle,
42
41
  }))
42
+ // Vue merges two listeners only when they differ, so a trigger that also binds the slot props toggles once.
43
+ const trigger = () => {
44
+ const node = firstNode(slots.trigger?.(triggerProps.value))
45
+ return node ? cloneVNode(node, triggerProps.value, true) : null
46
+ }
43
47
  </script>
44
48
 
45
49
  <template>
46
- <div :class="styles.root" :data-open="open || undefined">
47
- <slot v-if="slots.trigger" name="trigger" v-bind="triggerProps" />
48
- <button v-else type="button" :class="styles.trigger" :aria-expanded="open" :aria-controls="`${id}-panel`" :disabled="disabled" @click="toggle">
49
- <span :class="styles.label"><slot name="label">{{ label }}</slot></span>
50
- <ChevronDownIcon :class="styles.chevron" />
50
+ <div data-slot="collapsible" :class="styles.root" :data-state="open ? 'open' : 'closed'" :data-disabled="disabled || undefined">
51
+ <component :is="trigger()" v-if="slots.trigger" />
52
+ <button v-else type="button" data-slot="collapsible-trigger" :class="styles.trigger" :aria-expanded="open" :aria-controls="`${id}-panel`" :disabled="disabled" @click="toggle">
53
+ <span data-slot="collapsible-label" :class="styles.label"><slot name="label">{{ label }}</slot></span>
54
+ <ChevronDownIcon data-slot="collapsible-icon" :class="styles.chevron" />
51
55
  </button>
52
56
  <!-- Grid rows animate from 0fr to 1fr, so the height follows the content without measuring. -->
53
- <div :id="`${id}-panel`" :class="styles.panel" :inert="!open">
57
+ <div :id="`${id}-panel`" data-slot="collapsible-panel" :class="styles.panel" :inert="!open">
54
58
  <div :class="styles.inner">
55
- <div :class="styles.content"><slot /></div>
59
+ <div data-slot="collapsible-content" :class="styles.content"><slot /></div>
56
60
  </div>
57
61
  </div>
58
62
  </div>
@@ -1,3 +1,4 @@
1
+ @layer gooee.components {
1
2
  /* The max width adds the padding back, so the size token stays the content width. */
2
3
  .root {
3
4
  box-sizing: border-box;
@@ -12,3 +13,4 @@
12
13
  .lg { --container-max: var(--gooee-container-lg); }
13
14
  .xl { --container-max: var(--gooee-container-xl); }
14
15
  .full { max-width: none; }
16
+ }
@@ -15,5 +15,5 @@ export type ContainerProps = ComponentPropsWithRef<'div'> & {
15
15
  export function Container({ size = 'lg', padding = 5, as = 'div', className, style, ...rest }: ContainerProps) {
16
16
  // One cast keeps the ref and attribute types simple; every option is a block element.
17
17
  const Tag = as as 'div'
18
- return <Tag className={cx(styles.root, styles[size], className)} style={{ '--container-pad': space(padding), ...style } as CSSProperties} {...rest} />
18
+ return <Tag data-slot="container" className={cx(styles.root, styles[size], className)} style={{ '--container-pad': space(padding), ...style } as CSSProperties} {...rest} />
19
19
  }
@@ -3,20 +3,21 @@ import { space, type Space } from '../../internal/space'
3
3
  import styles from './Container.module.css'
4
4
 
5
5
  // The Vue Container: the same look (Container.module.css) as the React one. Other attributes go to the element.
6
- withDefaults(
7
- defineProps<{
8
- /** Widest the content gets, from the --gooee-container-* tokens. "full" never stops growing. */
9
- size?: 'sm' | 'md' | 'lg' | 'xl' | 'full'
10
- /** Space on the left and right, as a step of the space scale. The notch area on a phone wins when it is wider. */
11
- padding?: Space
12
- /** Element to render, such as main for the page body. */
13
- as?: 'div' | 'main' | 'section' | 'article' | 'header' | 'footer'
14
- }>(),
15
- { size: 'lg', padding: 5, as: 'div' },
16
- )
6
+ const {
7
+ size = 'lg',
8
+ padding = 5,
9
+ as = 'div',
10
+ } = defineProps<{
11
+ /** Widest the content gets, from the --gooee-container-* tokens. "full" never stops growing. */
12
+ size?: 'sm' | 'md' | 'lg' | 'xl' | 'full'
13
+ /** Space on the left and right, as a step of the space scale. The notch area on a phone wins when it is wider. */
14
+ padding?: Space
15
+ /** Element to render, such as main for the page body. */
16
+ as?: 'div' | 'main' | 'section' | 'article' | 'header' | 'footer'
17
+ }>()
17
18
  defineSlots<{ default?: () => unknown }>()
18
19
  </script>
19
20
 
20
21
  <template>
21
- <component :is="as" :class="[styles.root, styles[size]]" :style="{ '--container-pad': space(padding) }"><slot /></component>
22
+ <component :is="as" data-slot="container" :class="[styles.root, styles[size]]" :style="{ '--container-pad': space(padding) }"><slot /></component>
22
23
  </template>