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
@@ -88,31 +88,33 @@ export function Input({
88
88
  .join(' ')
89
89
 
90
90
  return (
91
- <div className={cx(styles.root, className)}>
91
+ <div data-slot="input" className={cx(styles.root, className)}>
92
92
  {!floating && (
93
- <label htmlFor={inputId} className={styles.topLabel}>
93
+ <label htmlFor={inputId} data-slot="field-label" className={styles.topLabel}>
94
94
  {label}
95
- {optional && <span className={styles.optional}> {labels.optional}</span>}
95
+ {optional && <span data-slot="input-optional" className={styles.optional}> {labels.optional}</span>}
96
96
  </label>
97
97
  )}
98
98
  <div
99
99
  ref={fieldRef}
100
+ data-slot="input-field"
100
101
  className={cx(styles.field, styles[size], floating && styles.floating)}
101
102
  data-filled={filled || undefined}
102
103
  data-invalid={error ? true : undefined}
103
104
  data-disabled={rest.disabled || undefined}
104
105
  >
105
- {leading && <span className={styles.adorn}>{leading}</span>}
106
+ {leading && <span data-slot="input-leading" className={styles.adorn}>{leading}</span>}
106
107
  <div className={styles.control}>
107
108
  {floating && (
108
- <label htmlFor={inputId} className={styles.floatLabel}>
109
+ <label htmlFor={inputId} data-slot="field-label" className={styles.floatLabel}>
109
110
  {label}
110
- {optional && <span className={styles.optional}> {labels.optional}</span>}
111
+ {optional && <span data-slot="input-optional" className={styles.optional}> {labels.optional}</span>}
111
112
  </label>
112
113
  )}
113
114
  <input
114
115
  id={inputId}
115
116
  ref={mergeRefs(inner, ref)}
117
+ data-slot="input-control"
116
118
  className={styles.input}
117
119
  value={value}
118
120
  defaultValue={defaultValue}
@@ -125,7 +127,7 @@ export function Input({
125
127
  {...rest}
126
128
  />
127
129
  </div>
128
- {trailing && <span className={styles.adorn}>{trailing}</span>}
130
+ {trailing && <span data-slot="input-trailing" className={styles.adorn}>{trailing}</span>}
129
131
  </div>
130
132
  <FieldMessage helpId={helpId} errorId={errorId} help={help} error={error} />
131
133
  </div>
@@ -1,34 +1,42 @@
1
1
  <script setup lang="ts">
2
2
  import { computed, onBeforeUnmount, onMounted, ref, useAttrs, useId } from 'vue'
3
3
  import FieldMessage from '../../internal/FieldMessage.vue'
4
- import { edgeFlow } from '../../internal/motion/liquidMore'
4
+ import { createEdgeFlow } from '../../internal/motion/liquidMore'
5
5
  import styles from './Input.module.css'
6
6
 
7
7
  // The Vue Input: the same look (Input.module.css) and focus edge as the React one.
8
8
  // Other attributes, such as name, type or placeholder, go to the input. class and style go to the root, like React's className.
9
9
  defineOptions({ inheritAttrs: false })
10
10
 
11
- const props = withDefaults(
12
- defineProps<{
13
- /** Always required. A placeholder is only an example, never the label. */
14
- label: string
15
- /** "top" puts the label above the field, "floating" puts it inside and moves it up. */
16
- labelPlacement?: 'top' | 'floating'
17
- /** Hint under the field. Hidden while there is an error. */
18
- help?: string
19
- /** Error message under the field. Marks the field invalid. */
20
- error?: string
21
- /** Height of the field. */
22
- size?: 'sm' | 'md' | 'lg'
23
- /** Adds "(optional)" after the label. */
24
- optional?: boolean
25
- /** Text added to the label, so you can translate it. */
26
- labels?: { optional?: string }
27
- disabled?: boolean
28
- id?: string
29
- }>(),
30
- { labelPlacement: 'top', size: 'md' },
31
- )
11
+ export type InputLabels = {
12
+ optional: string
13
+ }
14
+
15
+ const {
16
+ labelPlacement = 'top',
17
+ help,
18
+ error,
19
+ size = 'md',
20
+ labels,
21
+ id,
22
+ } = defineProps<{
23
+ /** Always required. A placeholder is only an example, never the label. */
24
+ label: string
25
+ /** "top" puts the label above the field, "floating" puts it inside and moves it up. */
26
+ labelPlacement?: 'top' | 'floating'
27
+ /** Hint under the field. Hidden while there is an error. */
28
+ help?: string
29
+ /** Error message under the field. Marks the field invalid. */
30
+ error?: string
31
+ /** Height of the field. */
32
+ size?: 'sm' | 'md' | 'lg'
33
+ /** Adds "(optional)" after the label. */
34
+ optional?: boolean
35
+ /** Text added to the label, so you can translate it. Missing keys use the English defaults. */
36
+ labels?: Partial<InputLabels>
37
+ disabled?: boolean
38
+ id?: string
39
+ }>()
32
40
  /** The text. Use v-model, or leave it out and the input keeps its own value. */
33
41
  const model = defineModel<string>()
34
42
  const slots = defineSlots<{ leading?: () => unknown; trailing?: () => unknown }>()
@@ -38,20 +46,20 @@ const inputAttrs = computed(() => {
38
46
  const { class: _class, style: _style, ...rest } = attrs
39
47
  return rest
40
48
  })
41
- const optionalText = computed(() => props.labels?.optional ?? '(optional)')
49
+ const optionalText = computed(() => labels?.optional ?? '(optional)')
42
50
  const auto = useId()
43
- const inputId = computed(() => props.id ?? auto)
51
+ const inputId = computed(() => id ?? auto)
44
52
  const helpId = computed(() => `${inputId.value}-help`)
45
53
  const errorId = computed(() => `${inputId.value}-error`)
46
- const floating = computed(() => props.labelPlacement === 'floating')
54
+ const floating = computed(() => labelPlacement === 'floating')
47
55
  const typed = ref(String(attrs.value ?? model.value ?? '') !== '')
48
56
  const filled = computed(() => (model.value !== undefined ? model.value !== '' : typed.value))
49
57
  // The caller's ids join ours, so help and error stay linked.
50
- const describedBy = computed(() => [props.help && !props.error ? helpId.value : null, props.error ? errorId.value : null, attrs['aria-describedby']].filter(Boolean).join(' ') || undefined)
58
+ const describedBy = computed(() => [help && !error ? helpId.value : null, error ? errorId.value : null, attrs['aria-describedby']].filter(Boolean).join(' ') || undefined)
51
59
 
52
60
  const input = ref<HTMLInputElement | null>(null)
53
61
  const field = ref<HTMLElement | null>(null)
54
- defineExpose({ input })
62
+ defineExpose({ el: input })
55
63
  const onInput = (e: Event) => {
56
64
  const v = (e.target as HTMLInputElement).value
57
65
  typed.value = v !== ''
@@ -66,7 +74,7 @@ const onReset = () => {
66
74
  frame = requestAnimationFrame(() => (typed.value = input.value?.value !== ''))
67
75
  }
68
76
  onMounted(() => {
69
- if (field.value) stopEdge = edgeFlow(field.value, field.value, ':focus-within', styles.edge)
77
+ if (field.value) stopEdge = createEdgeFlow(field.value, { when: ':focus-within', className: styles.edge }).destroy
70
78
  input.value?.form?.addEventListener('reset', onReset)
71
79
  })
72
80
  onBeforeUnmount(() => {
@@ -77,26 +85,28 @@ onBeforeUnmount(() => {
77
85
  </script>
78
86
 
79
87
  <template>
80
- <div :class="[styles.root, attrs.class]" :style="attrs.style as string | undefined">
81
- <label v-if="!floating" :for="inputId" :class="styles.topLabel">
82
- {{ label }}<span v-if="optional" :class="styles.optional">{{ ` ${optionalText}` }}</span>
88
+ <div data-slot="input" :class="[styles.root, attrs.class]" :style="attrs.style as string | undefined">
89
+ <label v-if="!floating" :for="inputId" data-slot="field-label" :class="styles.topLabel">
90
+ {{ label }}<span v-if="optional" data-slot="input-optional" :class="styles.optional">{{ ` ${optionalText}` }}</span>
83
91
  </label>
84
92
  <div
85
93
  ref="field"
94
+ data-slot="input-field"
86
95
  :class="[styles.field, styles[size], floating && styles.floating]"
87
96
  :data-filled="filled || undefined"
88
97
  :data-invalid="error ? true : undefined"
89
98
  :data-disabled="disabled || undefined"
90
99
  >
91
- <span v-if="slots.leading" :class="styles.adorn"><slot name="leading" /></span>
100
+ <span v-if="slots.leading" data-slot="input-leading" :class="styles.adorn"><slot name="leading" /></span>
92
101
  <div :class="styles.control">
93
- <label v-if="floating" :for="inputId" :class="styles.floatLabel">
94
- {{ label }}<span v-if="optional" :class="styles.optional">{{ ` ${optionalText}` }}</span>
102
+ <label v-if="floating" :for="inputId" data-slot="field-label" :class="styles.floatLabel">
103
+ {{ label }}<span v-if="optional" data-slot="input-optional" :class="styles.optional">{{ ` ${optionalText}` }}</span>
95
104
  </label>
96
105
  <input
97
106
  v-bind="inputAttrs"
98
107
  :id="inputId"
99
108
  ref="input"
109
+ data-slot="input-control"
100
110
  :class="styles.input"
101
111
  :value="model ?? (attrs.value as string | undefined)"
102
112
  :disabled="disabled"
@@ -105,7 +115,7 @@ onBeforeUnmount(() => {
105
115
  @input="onInput"
106
116
  />
107
117
  </div>
108
- <span v-if="slots.trailing" :class="styles.adorn"><slot name="trailing" /></span>
118
+ <span v-if="slots.trailing" data-slot="input-trailing" :class="styles.adorn"><slot name="trailing" /></span>
109
119
  </div>
110
120
  <FieldMessage :help-id="helpId" :error-id="errorId" :help="help" :error="error" />
111
121
  </div>
@@ -1,3 +1,4 @@
1
+ @layer gooee.components {
1
2
  .root {
2
3
  display: flex;
3
4
  flex-direction: column;
@@ -23,8 +24,8 @@
23
24
  border-radius: var(--r);
24
25
  background: var(--gooee-color-surface);
25
26
  transition:
26
- border-color var(--gooee-motion-fast) var(--gooee-ease-out),
27
- box-shadow var(--gooee-motion-base) var(--gooee-ease-out);
27
+ border-color var(--gooee-motion-fast) var(--gooee-ease-morph),
28
+ box-shadow var(--gooee-motion-base) var(--gooee-ease-morph);
28
29
  }
29
30
 
30
31
  .sm { --h: var(--gooee-control-h-sm); }
@@ -97,14 +98,14 @@
97
98
  .addon > svg { flex: none; font-size: var(--gooee-icon-md); }
98
99
 
99
100
  /* The divider takes its width back from the padding on its side, so the words stay on the grid. */
100
- .addon[data-side="prefix"] {
101
+ .addon[data-slot="input-group-prefix"] {
101
102
  padding-inline-end: calc(var(--gooee-space-4) - var(--gooee-line));
102
103
  border-inline-end: var(--gooee-line) solid var(--gooee-color-border);
103
104
  border-start-start-radius: calc(var(--r) - var(--gooee-line));
104
105
  border-end-start-radius: calc(var(--r) - var(--gooee-line));
105
106
  }
106
107
 
107
- .addon[data-side="suffix"] {
108
+ .addon[data-slot="input-group-suffix"] {
108
109
  padding-inline-start: calc(var(--gooee-space-4) - var(--gooee-line));
109
110
  border-inline-start: var(--gooee-line) solid var(--gooee-color-border);
110
111
  border-start-end-radius: calc(var(--r) - var(--gooee-line));
@@ -129,12 +130,12 @@
129
130
 
130
131
  .addon.addon > :is(button, a):focus-visible { box-shadow: var(--gooee-focus-ring); z-index: 1; }
131
132
 
132
- .addon[data-side="prefix"] > :first-child {
133
+ .addon[data-slot="input-group-prefix"] > :first-child {
133
134
  border-start-start-radius: calc(var(--r) - var(--gooee-line));
134
135
  border-end-start-radius: calc(var(--r) - var(--gooee-line));
135
136
  }
136
137
 
137
- .addon[data-side="suffix"] > :last-child {
138
+ .addon[data-slot="input-group-suffix"] > :last-child {
138
139
  border-start-end-radius: calc(var(--r) - var(--gooee-line));
139
140
  border-end-end-radius: calc(var(--r) - var(--gooee-line));
140
141
  }
@@ -147,3 +148,4 @@
147
148
  clip-path: inset(50%);
148
149
  white-space: nowrap;
149
150
  }
151
+ }
@@ -63,20 +63,21 @@ export function InputGroup({
63
63
  }
64
64
 
65
65
  const addon = (node: ReactNode, side: 'prefix' | 'suffix') => (
66
- <span id={text(node) ? `${inputId}-${side}` : undefined} className={styles.addon} data-side={side} onPointerDown={focusField}>
66
+ <span id={text(node) ? `${inputId}-${side}` : undefined} data-slot={`input-group-${side}`} className={styles.addon} onPointerDown={focusField}>
67
67
  {node}
68
68
  </span>
69
69
  )
70
70
 
71
71
  return (
72
- <div className={cx(styles.root, className)}>
73
- <label htmlFor={inputId} className={cx(styles.label, hideLabel && styles.srOnly)}>{label}</label>
74
- <div className={cx(styles.group, styles[size])} data-invalid={error ? true : undefined} data-disabled={disabled || undefined}>
72
+ <div data-slot="input-group" className={cx(styles.root, className)}>
73
+ <label htmlFor={inputId} data-slot="field-label" className={cx(styles.label, hideLabel && styles.srOnly)}>{label}</label>
74
+ <div data-slot="input-group-field" className={cx(styles.group, styles[size])} data-invalid={error ? true : undefined} data-disabled={disabled || undefined}>
75
75
  {prefix !== undefined && prefix !== null && addon(prefix, 'prefix')}
76
76
  <input
77
77
  {...rest}
78
78
  id={inputId}
79
79
  ref={mergeRefs(inner, ref)}
80
+ data-slot="input-group-control"
80
81
  className={styles.input}
81
82
  disabled={disabled}
82
83
  aria-invalid={error ? true : undefined}
@@ -7,29 +7,33 @@ import styles from './InputGroup.module.css'
7
7
  // Other attributes, such as name, type or placeholder, go to the input. class and style go to the root.
8
8
  defineOptions({ inheritAttrs: false })
9
9
 
10
- const props = withDefaults(
11
- defineProps<{
12
- /** Always required. A placeholder is only an example, never the label. */
13
- label: string
14
- /** Hides the label visually but keeps it as the field's name. */
15
- hideLabel?: boolean
16
- /** Text joined before the field, in a shaded cell. For an icon or a button, use the prefix slot. */
17
- prefix?: string
18
- /** Text joined after the field, the same way as prefix. */
19
- suffix?: string
20
- /** Hint under the field. Hidden while there is an error. */
21
- help?: string
22
- /** Error message under the field. Marks the group invalid. */
23
- error?: string
24
- /** Height of the group, matching Input. */
25
- size?: 'sm' | 'md' | 'lg'
26
- /** The starting text when there is no v-model. */
27
- defaultValue?: string
28
- disabled?: boolean
29
- id?: string
30
- }>(),
31
- { size: 'md' },
32
- )
10
+ const {
11
+ prefix,
12
+ suffix,
13
+ help,
14
+ error,
15
+ size = 'md',
16
+ id,
17
+ } = defineProps<{
18
+ /** Always required. A placeholder is only an example, never the label. */
19
+ label: string
20
+ /** Hides the label visually but keeps it as the field's name. */
21
+ hideLabel?: boolean
22
+ /** Text joined before the field, in a shaded cell. For an icon or a button, use the prefix slot. */
23
+ prefix?: string
24
+ /** Text joined after the field, the same way as prefix. */
25
+ suffix?: string
26
+ /** Hint under the field. Hidden while there is an error. */
27
+ help?: string
28
+ /** Error message under the field. Marks the group invalid. */
29
+ error?: string
30
+ /** Height of the group, matching Input. */
31
+ size?: 'sm' | 'md' | 'lg'
32
+ /** The starting text when there is no v-model. */
33
+ defaultValue?: string
34
+ disabled?: boolean
35
+ id?: string
36
+ }>()
33
37
  /** The text. Use v-model, or leave it out and the input keeps its own value. */
34
38
  const model = defineModel<string>()
35
39
  const slots = defineSlots<{ prefix?: () => unknown; suffix?: () => unknown }>()
@@ -40,21 +44,21 @@ const inputAttrs = computed(() => {
40
44
  return rest
41
45
  })
42
46
  const auto = useId()
43
- const inputId = computed(() => props.id ?? auto)
47
+ const inputId = computed(() => id ?? auto)
44
48
  const helpId = computed(() => `${inputId.value}-help`)
45
49
  const errorId = computed(() => `${inputId.value}-error`)
46
- const hasPrefix = computed(() => !!slots.prefix || props.prefix !== undefined)
47
- const hasSuffix = computed(() => !!slots.suffix || props.suffix !== undefined)
50
+ const hasPrefix = computed(() => !!slots.prefix || prefix !== undefined)
51
+ const hasSuffix = computed(() => !!slots.suffix || suffix !== undefined)
48
52
  // Text beside the field, such as a unit or "https://", is read as part of its description.
49
- const textPrefix = computed(() => !slots.prefix && props.prefix !== undefined)
50
- const textSuffix = computed(() => !slots.suffix && props.suffix !== undefined)
53
+ const textPrefix = computed(() => !slots.prefix && prefix !== undefined)
54
+ const textSuffix = computed(() => !slots.suffix && suffix !== undefined)
51
55
  const describedBy = computed(
52
56
  () =>
53
57
  [
54
58
  textPrefix.value ? `${inputId.value}-prefix` : null,
55
59
  textSuffix.value ? `${inputId.value}-suffix` : null,
56
- props.help && !props.error ? helpId.value : null,
57
- props.error ? errorId.value : null,
60
+ help && !error ? helpId.value : null,
61
+ error ? errorId.value : null,
58
62
  attrs['aria-describedby'],
59
63
  ]
60
64
  .filter(Boolean)
@@ -62,7 +66,7 @@ const describedBy = computed(
62
66
  )
63
67
 
64
68
  const inner = ref<HTMLInputElement | null>(null)
65
- defineExpose({ input: inner })
69
+ defineExpose({ el: inner })
66
70
 
67
71
  // A press on a shaded cell puts the caret in the field, as it would on the field itself.
68
72
  const focusField = (e: PointerEvent) => {
@@ -76,16 +80,17 @@ const onInput = (e: Event) => {
76
80
  </script>
77
81
 
78
82
  <template>
79
- <div :class="[styles.root, attrs.class]" :style="attrs.style as string | undefined">
80
- <label :for="inputId" :class="[styles.label, hideLabel && styles.srOnly]">{{ label }}</label>
81
- <div :class="[styles.group, styles[size]]" :data-invalid="error ? true : undefined" :data-disabled="disabled || undefined">
82
- <span v-if="hasPrefix" :id="textPrefix ? `${inputId}-prefix` : undefined" :class="styles.addon" data-side="prefix" @pointerdown="focusField">
83
+ <div data-slot="input-group" :class="[styles.root, attrs.class]" :style="attrs.style as string | undefined">
84
+ <label :for="inputId" data-slot="field-label" :class="[styles.label, hideLabel && styles.srOnly]">{{ label }}</label>
85
+ <div data-slot="input-group-field" :class="[styles.group, styles[size]]" :data-invalid="error ? true : undefined" :data-disabled="disabled || undefined">
86
+ <span v-if="hasPrefix" :id="textPrefix ? `${inputId}-prefix` : undefined" data-slot="input-group-prefix" :class="styles.addon" @pointerdown="focusField">
83
87
  <slot name="prefix">{{ prefix }}</slot>
84
88
  </span>
85
89
  <input
86
90
  v-bind="inputAttrs"
87
91
  :id="inputId"
88
92
  ref="inner"
93
+ data-slot="input-group-control"
89
94
  :class="styles.input"
90
95
  :value="model ?? defaultValue"
91
96
  :disabled="disabled"
@@ -93,7 +98,7 @@ const onInput = (e: Event) => {
93
98
  :aria-describedby="describedBy"
94
99
  @input="onInput"
95
100
  />
96
- <span v-if="hasSuffix" :id="textSuffix ? `${inputId}-suffix` : undefined" :class="styles.addon" data-side="suffix" @pointerdown="focusField">
101
+ <span v-if="hasSuffix" :id="textSuffix ? `${inputId}-suffix` : undefined" data-slot="input-group-suffix" :class="styles.addon" @pointerdown="focusField">
97
102
  <slot name="suffix">{{ suffix }}</slot>
98
103
  </span>
99
104
  </div>
@@ -1,13 +1,14 @@
1
+ @layer gooee.components {
1
2
  .root {
2
3
  display: inline-flex;
3
4
  width: fit-content;
4
5
  align-items: center;
5
6
  justify-content: center;
6
- min-width: var(--gooee-kbd-h);
7
- height: var(--gooee-kbd-h);
7
+ min-width: var(--gooee-kbd-h, 24px);
8
+ height: var(--gooee-kbd-h, 24px);
8
9
  padding: 0 calc(var(--gooee-space-3) - var(--gooee-line));
9
10
  border: var(--gooee-line) solid var(--gooee-color-border-strong);
10
- border-bottom-width: var(--gooee-line-focus);
11
+ border-bottom-width: var(--gooee-focus-width);
11
12
  border-radius: var(--gooee-radius-sm);
12
13
  background: var(--gooee-color-surface);
13
14
  color: var(--gooee-color-fg);
@@ -16,13 +17,14 @@
16
17
  line-height: var(--gooee-leading-none);
17
18
  vertical-align: middle;
18
19
  transition:
19
- transform var(--gooee-motion-instant) var(--gooee-ease-out),
20
- border-bottom-width var(--gooee-motion-instant) var(--gooee-ease-out),
21
- background-color var(--gooee-motion-instant) var(--gooee-ease-out);
20
+ transform var(--gooee-motion-instant) var(--gooee-ease-morph),
21
+ border-bottom-width var(--gooee-motion-instant) var(--gooee-ease-morph),
22
+ background-color var(--gooee-motion-instant) var(--gooee-ease-morph);
22
23
  }
23
24
 
24
- .root[data-down] {
25
+ .root[data-state='on'] {
25
26
  transform: translateY(var(--gooee-line));
26
27
  border-bottom-width: var(--gooee-line);
27
28
  background: var(--gooee-color-surface-active);
28
29
  }
30
+ }
@@ -21,7 +21,7 @@ export function Kbd({ children, listen, className }: KbdProps) {
21
21
  return holdKey(listen, setDown)
22
22
  }, [listen])
23
23
  return (
24
- <kbd className={cx(styles.root, className)} data-down={down || undefined}>
24
+ <kbd data-slot="kbd" className={cx(styles.root, className)} data-state={down ? 'on' : 'off'}>
25
25
  {children}
26
26
  </kbd>
27
27
  )
@@ -17,5 +17,5 @@ watchEffect((stop) => {
17
17
  </script>
18
18
 
19
19
  <template>
20
- <kbd :class="styles.root" :data-down="down || undefined"><slot /></kbd>
20
+ <kbd data-slot="kbd" :class="styles.root" :data-state="down ? 'on' : 'off'"><slot /></kbd>
21
21
  </template>
@@ -1,3 +1,4 @@
1
+ @layer gooee.components {
1
2
  /* Inline, not inline-flex, so a long link wraps with the sentence and each line keeps its underline. */
2
3
  .root {
3
4
  position: relative;
@@ -19,7 +20,7 @@
19
20
  background-position: 0 100%, 0 100%;
20
21
  background-size: 0% var(--gooee-line), 100% var(--gooee-line);
21
22
  padding-bottom: var(--gooee-space-1);
22
- transition: background-size var(--gooee-motion-slow) var(--gooee-ease-out);
23
+ transition: background-size var(--gooee-motion-slow) var(--gooee-ease-morph);
23
24
  }
24
25
 
25
26
  .root:focus-visible .text {
@@ -43,7 +44,7 @@
43
44
  vertical-align: middle;
44
45
  width: 0.85em;
45
46
  height: 0.85em;
46
- transition: transform var(--gooee-motion-base) var(--gooee-ease-spring);
47
+ transition: transform var(--gooee-motion-base) var(--gooee-ease-morph);
47
48
  }
48
49
 
49
50
  @media (hover: hover) {
@@ -63,3 +64,4 @@
63
64
  clip-path: inset(50%);
64
65
  white-space: nowrap;
65
66
  }
67
+ }
@@ -1,6 +1,6 @@
1
1
  import type { ComponentPropsWithRef } from 'react'
2
2
  import { cx } from '../../internal/cx'
3
- import { ArrowUpRightIcon } from '../../internal/icons'
3
+ import { ArrowUpRightIcon } from '../../icons/icons'
4
4
  import styles from './Link.module.css'
5
5
 
6
6
  export type LinkLabels = {
@@ -25,14 +25,15 @@ export function Link({ external, variant = 'inline', labels: labelsProp, classNa
25
25
  const labels = { ...defaultLabels, ...labelsProp }
26
26
  return (
27
27
  <a
28
+ data-slot="link"
28
29
  className={cx(styles.root, styles[variant], className)}
29
30
  {...(external ? { target: '_blank', rel: 'noopener noreferrer' } : null)}
30
31
  {...rest}
31
32
  >
32
- <span className={styles.text}>{children}</span>
33
+ <span data-slot="link-text" className={styles.text}>{children}</span>
33
34
  {external && (
34
35
  <>
35
- <ArrowUpRightIcon className={styles.arrow} />
36
+ <ArrowUpRightIcon data-slot="link-arrow" className={styles.arrow} />
36
37
  <span className={styles.srOnly}> {labels.newTab}</span>
37
38
  </>
38
39
  )}
@@ -1,6 +1,6 @@
1
1
  <script setup lang="ts">
2
2
  import { computed } from 'vue'
3
- import { ArrowUpRightIcon } from '../../internal/vueIcons'
3
+ import { ArrowUpRightIcon } from '../../icons/vue'
4
4
  import styles from './Link.module.css'
5
5
 
6
6
  export type LinkLabels = {
@@ -13,25 +13,22 @@ const defaultLabels: LinkLabels = {
13
13
  }
14
14
 
15
15
  // The Vue Link: the same look (Link.module.css) as the React one. Other attributes, such as href, go to the link.
16
- const props = withDefaults(
17
- defineProps<{
18
- /** Opens in a new tab, adds a safe rel and an arrow, and tells screen readers. */
19
- external?: boolean
20
- /** Inline sits in running text. Standalone gets a full-size touch target. */
21
- variant?: 'inline' | 'standalone'
22
- /** Screen reader text, so you can translate it. Missing keys use the English defaults. */
23
- labels?: Partial<LinkLabels>
24
- }>(),
25
- { variant: 'inline' },
26
- )
27
- const labels = computed(() => ({ ...defaultLabels, ...props.labels }))
16
+ const { variant = 'inline', labels: labelsProp } = defineProps<{
17
+ /** Opens in a new tab, adds a safe rel and an arrow, and tells screen readers. */
18
+ external?: boolean
19
+ /** Inline sits in running text. Standalone gets a full-size touch target. */
20
+ variant?: 'inline' | 'standalone'
21
+ /** Screen reader text, so you can translate it. Missing keys use the English defaults. */
22
+ labels?: Partial<LinkLabels>
23
+ }>()
24
+ const labels = computed(() => ({ ...defaultLabels, ...labelsProp }))
28
25
  </script>
29
26
 
30
27
  <template>
31
- <a :class="[styles.root, styles[variant]]" v-bind="external ? { target: '_blank', rel: 'noopener noreferrer' } : {}">
32
- <span :class="styles.text"><slot /></span>
28
+ <a data-slot="link" :class="[styles.root, styles[variant]]" v-bind="external ? { target: '_blank', rel: 'noopener noreferrer' } : {}">
29
+ <span data-slot="link-text" :class="styles.text"><slot /></span>
33
30
  <template v-if="external">
34
- <ArrowUpRightIcon :class="styles.arrow" />
31
+ <ArrowUpRightIcon data-slot="link-arrow" :class="styles.arrow" />
35
32
  <span :class="styles.srOnly"> {{ labels.newTab }}</span>
36
33
  </template>
37
34
  </a>