gooee 0.52.0 → 1.0.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 (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 +15 -9
  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 +12 -9
  79. package/src/components/DropdownMenu/DropdownMenu.vue +25 -28
  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 +22 -10
  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 +31 -18
  169. package/src/components/Select/Select.vue +63 -58
  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 +27 -11
  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
@@ -3,9 +3,9 @@
3
3
  import { useEffect, useId, useLayoutEffect, useRef, useState, type ComponentPropsWithRef, type ReactNode } from 'react'
4
4
  import { cx } from '../../internal/cx'
5
5
  import { clamp, pull, wheelSteps, wrap } from '../../internal/feel'
6
- import { columnScrub, columnState, dateWheel, drumRows, timeWheel, today, type ColumnState, type WheelColumn } from '../../internal/motion/pickerWheel'
6
+ import { columnScrub, columnState, dateWheel, drumRows, localeHourCycle, timeWheel, today, type ColumnState, type WheelColumn } from '../../internal/motion/pickerWheel'
7
7
  import { useControllable } from '../../internal/useControllable'
8
- import { ink, tokenNumber, useOnChange, useScrub } from '../../internal/useScrub'
8
+ import { ink, tokenNumber, useScrub } from '../../internal/useScrub'
9
9
  import styles from './PickerWheel.module.css'
10
10
 
11
11
  export type PickerWheelColumn = WheelColumn
@@ -19,10 +19,10 @@ export type PickerWheelProps = Omit<ComponentPropsWithRef<'div'>, 'defaultValue'
19
19
  value?: number[]
20
20
  /** Starting rows when you do not control them. Undefined starts on the first row of each. */
21
21
  defaultValue?: number[]
22
- /** Called once a column comes to rest on a new row, with every column's row. */
22
+ /** Called with every column's row each time a new row comes into the band, while the wheel still turns. */
23
23
  onValueChange?: (value: number[]) => void
24
- /** Called with the rows in the band while the wheel still turns. */
25
- onScrub?: (value: number[]) => void
24
+ /** Called once a column comes to rest on a new row, with every column's row. */
25
+ onValueCommit?: (value: number[]) => void
26
26
  /** Turns the rows into a large readout above the wheel. No readout when left out. */
27
27
  formatValue?: (value: number[]) => string
28
28
  /** A line under the label and readout, such as what the choice means. */
@@ -34,13 +34,13 @@ export type PickerWheelProps = Omit<ComponentPropsWithRef<'div'>, 'defaultValue'
34
34
  type ColumnProps = {
35
35
  column: PickerWheelColumn
36
36
  index: number
37
- onChange: (index: number) => void
37
+ onCommit: (index: number) => void
38
38
  onShown: (index: number) => void
39
39
  haptics: boolean
40
40
  }
41
41
 
42
42
  /** One column: its rows are the marks. A drag follows the hand; a let-go lands on a row. */
43
- function Column({ column, index, onChange, onShown, haptics }: ColumnProps) {
43
+ function Column({ column, index, onCommit, onShown, haptics }: ColumnProps) {
44
44
  const { options, loop = false } = column
45
45
  const n = options.length
46
46
  const strong = new Set(column.strong ?? [])
@@ -52,9 +52,10 @@ function Column({ column, index, onChange, onShown, haptics }: ColumnProps) {
52
52
  // The keys, tap and wheel of one column (motion/pickerWheel.ts) on the shared scrubber.
53
53
  const sc = useScrub({
54
54
  ...columnScrub(column, index, st, wheel.current),
55
- onSettle: (to) => {
55
+ onSettle: (to, from) => {
56
56
  st.rested = to
57
- onChange(wrap(to, n))
57
+ // A loop turned all the way round rests on the row it left: no news.
58
+ if (wrap(to, n) !== wrap(Math.round(from), n)) onCommit(wrap(to, n))
58
59
  },
59
60
  haptics,
60
61
  })
@@ -86,6 +87,7 @@ function Column({ column, index, onChange, onShown, haptics }: ColumnProps) {
86
87
  <div
87
88
  ref={sc.ref}
88
89
  className={styles.column}
90
+ data-slot="picker-wheel-column"
89
91
  role="spinbutton"
90
92
  tabIndex={0}
91
93
  aria-label={column.label}
@@ -97,10 +99,10 @@ function Column({ column, index, onChange, onShown, haptics }: ColumnProps) {
97
99
  data-moving={sc.moving || undefined}
98
100
  {...sc.handlers}
99
101
  >
100
- <span className={styles.band} style={{ ['--grip' as string]: grip.toFixed(3) }} aria-hidden />
102
+ <span className={styles.band} data-slot="picker-wheel-band" style={{ ['--grip' as string]: grip.toFixed(3) }} aria-hidden />
101
103
  <div className={styles.drum} aria-hidden>
102
104
  {rows.map(({ k, d, i }) => (
103
- <span key={k} className={styles.row} data-strong={strong.has(i) || undefined} style={{ ['--d' as string]: d.toFixed(3), color: ink(pull(d, 1)) }}>
105
+ <span key={k} className={styles.row} data-slot="picker-wheel-row" data-strong={strong.has(i) || undefined} style={{ ['--d' as string]: d.toFixed(3), color: ink(pull(d, 1)) }}>
104
106
  {options[i]}
105
107
  </span>
106
108
  ))}
@@ -109,43 +111,55 @@ function Column({ column, index, onChange, onShown, haptics }: ColumnProps) {
109
111
  )
110
112
  }
111
113
 
112
- export function PickerWheel({ label, columns, value: valueProp, defaultValue, onValueChange, onScrub, formatValue, detail, haptics = false, className, ...rest }: PickerWheelProps) {
114
+ export function PickerWheel({ label, columns, value: valueProp, defaultValue, onValueChange, onValueCommit, formatValue, detail, haptics = false, className, ...rest }: PickerWheelProps) {
113
115
  const labelId = useId()
114
116
  const detailId = useId()
115
117
  const [raw, setValue] = useControllable(valueProp, defaultValue ?? columns.map(() => 0), onValueChange)
116
118
  const value = columns.map((c, i) => clamp(raw[i] ?? 0, 0, c.options.length - 1))
117
- const latest = useRef(value)
118
- latest.current = value
119
119
  const [live, setLive] = useState(value)
120
- useOnChange(live, onScrub, live.join(','))
120
+ const liveRef = useRef(value)
121
+ // The rows last told, so a row comes once whether it came while moving or at rest.
122
+ const told = useRef(value.join(','))
123
+ const tell = (rows: number[]) => {
124
+ if (rows.join(',') === told.current) return
125
+ told.current = rows.join(',')
126
+ setValue(rows)
127
+ }
128
+ const tellRef = useRef(tell)
129
+ tellRef.current = tell
130
+ useEffect(() => tellRef.current(live), [live])
121
131
 
122
132
  return (
123
- <div className={cx(styles.root, className)} {...rest}>
133
+ <div className={cx(styles.root, className)} data-slot="picker-wheel" {...rest}>
124
134
  <div className={styles.head}>
125
- <span id={labelId} className={styles.label}>
135
+ <span id={labelId} className={styles.label} data-slot="field-label">
126
136
  {label}
127
137
  </span>
128
- {formatValue && <span className={styles.readout}>{formatValue(live)}</span>}
138
+ {formatValue && <span className={styles.readout} data-slot="picker-wheel-value">{formatValue(live)}</span>}
129
139
  {detail && (
130
- <span id={detailId} className={styles.detail}>
140
+ <span id={detailId} className={styles.detail} data-slot="picker-wheel-detail">
131
141
  {detail}
132
142
  </span>
133
143
  )}
134
144
  </div>
135
- <div className={styles.wheel} role="group" aria-labelledby={labelId} aria-describedby={detail ? detailId : undefined}>
145
+ <div className={styles.wheel} data-slot="picker-wheel-columns" role="group" aria-labelledby={labelId} aria-describedby={detail ? detailId : undefined}>
136
146
  {columns.map((c, i) => (
137
147
  <Column
138
148
  key={i}
139
149
  column={c}
140
150
  index={value[i]}
141
151
  haptics={haptics}
142
- onChange={(row) => {
143
- if (latest.current[i] === row) return
144
- const next = latest.current.map((v, j) => (j === i ? row : v))
145
- latest.current = next
146
- setValue(next)
152
+ onCommit={(row) => {
153
+ const next = liveRef.current.map((v, j) => (j === i ? row : v))
154
+ liveRef.current = next
155
+ tell(next)
156
+ onValueCommit?.(next)
157
+ }}
158
+ onShown={(row) => {
159
+ if (liveRef.current[i] === row) return
160
+ liveRef.current = liveRef.current.map((v, j) => (j === i ? row : v))
161
+ setLive(liveRef.current)
147
162
  }}
148
- onShown={(row) => setLive((l) => (l[i] === row ? l : l.map((v, j) => (j === i ? row : v))))}
149
163
  />
150
164
  ))}
151
165
  </div>
@@ -153,39 +167,39 @@ export function PickerWheel({ label, columns, value: valueProp, defaultValue, on
153
167
  )
154
168
  }
155
169
 
156
- export type TimeWheelProps = Omit<PickerWheelProps, 'columns' | 'value' | 'defaultValue' | 'onValueChange' | 'onScrub' | 'formatValue'> & {
170
+ export type TimeWheelProps = Omit<PickerWheelProps, 'columns' | 'value' | 'defaultValue' | 'onValueChange' | 'onValueCommit' | 'formatValue'> & {
157
171
  /** The time as "HH:mm" in 24 hours, when you control it. */
158
172
  value?: string
159
173
  /** Starting time when you do not control it. */
160
174
  defaultValue?: string
161
- /** Called once the wheel comes to rest on a new time, as "HH:mm". */
175
+ /** Called with the time in the band, as "HH:mm", each time it changes while the wheel still turns. */
162
176
  onValueChange?: (value: string) => void
163
- /** Called with the time in the band while the wheel still turns. */
164
- onScrub?: (value: string) => void
165
- /** 12 shows AM and PM; 24 shows hours 00 to 23. */
177
+ /** Called once the wheel comes to rest on a new time, as "HH:mm". */
178
+ onValueCommit?: (value: string) => void
179
+ /** 12 shows AM and PM; 24 shows hours 00 to 23. Defaults to what the browser's locale uses. */
166
180
  hourCycle?: 12 | 24
167
- /** Minutes between two rows. */
168
- minuteStep?: number
181
+ /** Minutes between two rows, such as 5 or 15. */
182
+ step?: number
169
183
  /** Minutes drawn stronger. Page Up and Page Down jump between them. */
170
184
  strong?: number[]
171
185
  }
172
186
 
173
187
  /** PickerWheel set up for a time: hour, minute and, on a 12 hour clock, AM or PM. */
174
- export function TimeWheel({ value: valueProp, defaultValue = '09:00', onValueChange, onScrub, hourCycle = 12, minuteStep = 1, strong = [0, 30], ...rest }: TimeWheelProps) {
188
+ export function TimeWheel({ value: valueProp, defaultValue = '09:00', onValueChange, onValueCommit, hourCycle, step = 1, strong = [0, 30], ...rest }: TimeWheelProps) {
175
189
  const [value, setValue] = useControllable(valueProp, defaultValue, onValueChange)
176
- const { columns, toRows, toTime, show } = timeWheel(hourCycle, minuteStep, strong)
177
- return <PickerWheel {...rest} columns={columns} value={toRows(value)} onValueChange={(rows) => setValue(toTime(rows))} onScrub={onScrub && ((rows) => onScrub(toTime(rows)))} formatValue={show} />
190
+ const { columns, toRows, toTime, show } = timeWheel(hourCycle ?? localeHourCycle(), step, strong)
191
+ return <PickerWheel {...rest} columns={columns} value={toRows(value)} onValueChange={(rows) => setValue(toTime(rows))} onValueCommit={onValueCommit && ((rows) => onValueCommit(toTime(rows)))} formatValue={show} />
178
192
  }
179
193
 
180
- export type DateWheelProps = Omit<PickerWheelProps, 'columns' | 'value' | 'defaultValue' | 'onValueChange' | 'onScrub' | 'formatValue'> & {
194
+ export type DateWheelProps = Omit<PickerWheelProps, 'columns' | 'value' | 'defaultValue' | 'onValueChange' | 'onValueCommit' | 'formatValue'> & {
181
195
  /** The date as "YYYY-MM-DD", when you control it. */
182
196
  value?: string
183
197
  /** Starting date when you do not control it. Undefined starts today. */
184
198
  defaultValue?: string
185
- /** Called once the wheel comes to rest on a new date, as "YYYY-MM-DD". */
199
+ /** Called with the date in the band, as "YYYY-MM-DD", each time it changes while the wheel still turns. */
186
200
  onValueChange?: (value: string) => void
187
- /** Called with the date in the band while the wheel still turns. */
188
- onScrub?: (value: string) => void
201
+ /** Called once the wheel comes to rest on a new date, as "YYYY-MM-DD". */
202
+ onValueCommit?: (value: string) => void
189
203
  /** The first year on the wheel. Undefined is 100 years ago. */
190
204
  fromYear?: number
191
205
  /** The last year on the wheel. Undefined is 10 years from now. */
@@ -195,17 +209,29 @@ export type DateWheelProps = Omit<PickerWheelProps, 'columns' | 'value' | 'defau
195
209
  }
196
210
 
197
211
  /** PickerWheel set up for a date: day, month and year, with each month's real length. */
198
- export function DateWheel({ value: valueProp, defaultValue, onValueChange, onScrub, fromYear, toYear, strong, ...rest }: DateWheelProps) {
212
+ export function DateWheel({ value: valueProp, defaultValue, onValueChange, onValueCommit, fromYear, toYear, strong, ...rest }: DateWheelProps) {
199
213
  const now = today()
200
214
  const [value, setValue] = useControllable(valueProp, defaultValue ?? now, onValueChange)
201
- const { columns, rows, toDate, show } = dateWheel(value, now, fromYear, toYear, strong)
215
+ // The days follow the month the wheel rests on, not each month that turns past (31 stays 31 on the way
216
+ // through February). A date from outside, not one this wheel told, is a new rest.
217
+ const told = useRef(value)
218
+ const [rested, setRested] = useState(value)
219
+ if (value !== told.current && value !== rested) setRested(value)
220
+ const { columns, rows, toDate, show } = dateWheel(rested, now, fromYear, toYear, strong)
202
221
  return (
203
222
  <PickerWheel
204
223
  {...rest}
205
224
  columns={columns}
206
225
  value={rows}
207
- onValueChange={(rows) => setValue(toDate(rows))}
208
- onScrub={onScrub && ((rows) => onScrub(toDate(rows)))}
226
+ onValueChange={(rows) => {
227
+ told.current = toDate(rows)
228
+ setValue(told.current)
229
+ }}
230
+ onValueCommit={(rows) => {
231
+ told.current = toDate(rows)
232
+ setRested(told.current)
233
+ onValueCommit?.(told.current)
234
+ }}
209
235
  formatValue={show}
210
236
  />
211
237
  )
@@ -9,29 +9,26 @@ import styles from './PickerWheel.module.css'
9
9
 
10
10
  export type { PickerWheelColumn }
11
11
 
12
- const props = withDefaults(
13
- defineProps<{
14
- /** Visible name of the whole wheel, read by screen readers as the group's name. */
15
- label: string
16
- /** The columns, left to right. */
17
- columns: PickerWheelColumn[]
18
- /** Starting rows when there is no v-model. Undefined starts on the first row of each. */
19
- defaultValue?: number[]
20
- /** Turns the rows into a large readout above the wheel. No readout when left out. */
21
- formatValue?: (value: number[]) => string
22
- /** A line under the label and readout, such as what the choice means. The detail slot replaces it. */
23
- detail?: string
24
- /** A short buzz on each row while it turns, on phones that can (Android). */
25
- haptics?: boolean
26
- }>(),
27
- { haptics: false },
28
- )
29
- const emit = defineEmits<{ /** The rows in the band while the wheel still turns. */ scrub: [value: number[]] }>()
12
+ const { columns, defaultValue, detail, haptics = false } = defineProps<{
13
+ /** Visible name of the whole wheel, read by screen readers as the group's name. */
14
+ label: string
15
+ /** The columns, left to right. */
16
+ columns: PickerWheelColumn[]
17
+ /** Starting rows when there is no v-model. Undefined starts on the first row of each. */
18
+ defaultValue?: number[]
19
+ /** Turns the rows into a large readout above the wheel. No readout when left out. */
20
+ formatValue?: (value: number[]) => string
21
+ /** A line under the label and readout, such as what the choice means. The detail slot replaces it. */
22
+ detail?: string
23
+ /** A short buzz on each row while it turns, on phones that can (Android). */
24
+ haptics?: boolean
25
+ }>()
26
+ const emit = defineEmits<{ /** Every column's row, once a column comes to rest on a new row. */ valueCommit: [value: number[]] }>()
30
27
  const slots = useSlots()
31
28
 
32
- /** The chosen row of each column, set once a column comes to rest. Use v-model, or leave it out and the wheel keeps its own rows. */
29
+ /** The row of each column in the band, set each time a new row comes in while the wheel turns. Use v-model, or leave it out and the wheel keeps its own rows. */
33
30
  const model = defineModel<number[]>()
34
- const local = ref(props.defaultValue ?? props.columns.map(() => 0))
31
+ const local = ref(defaultValue ?? columns.map(() => 0))
35
32
  const raw = computed({
36
33
  get: () => model.value ?? local.value,
37
34
  set: (next: number[]) => {
@@ -42,36 +39,40 @@ const raw = computed({
42
39
 
43
40
  const labelId = useId()
44
41
  const detailId = useId()
45
- const value = computed(() => props.columns.map((c, i) => clamp(raw.value[i] ?? 0, 0, c.options.length - 1)))
46
- // The rows as last set, so two columns that settle at once both count.
47
- let latest = value.value
48
- watch(value, (v) => (latest = v), { flush: 'sync' })
49
- const onChange = (i: number, row: number) => {
50
- if (latest[i] === row) return
51
- const next = latest.map((v, j) => (j === i ? row : v))
52
- latest = next
53
- raw.value = next
54
- }
42
+ const value = computed(() => columns.map((c, i) => clamp(raw.value[i] ?? 0, 0, c.options.length - 1)))
55
43
  const live = ref(value.value)
44
+ // The rows last told, so a row comes once whether it came while moving or at rest.
45
+ let told = value.value.join(',')
46
+ const tell = (rows: number[]) => {
47
+ if (rows.join(',') === told) return
48
+ told = rows.join(',')
49
+ raw.value = rows
50
+ }
56
51
  const onShown = (i: number, row: number) => {
57
52
  if (live.value[i] !== row) live.value = live.value.map((v, j) => (j === i ? row : v))
58
53
  }
59
54
  watch(
60
55
  () => live.value.join(','),
61
- () => emit('scrub', live.value),
56
+ () => tell(live.value),
62
57
  )
63
- const hasDetail = computed(() => !!(props.detail || slots.detail))
58
+ const onCommit = (i: number, row: number) => {
59
+ const next = live.value.map((v, j) => (j === i ? row : v))
60
+ live.value = next
61
+ tell(next)
62
+ emit('valueCommit', next)
63
+ }
64
+ const hasDetail = computed(() => !!(detail || slots.detail))
64
65
  </script>
65
66
 
66
67
  <template>
67
- <div :class="styles.root">
68
+ <div :class="styles.root" data-slot="picker-wheel">
68
69
  <div :class="styles.head">
69
- <span :id="labelId" :class="styles.label">{{ label }}</span>
70
- <span v-if="formatValue" :class="styles.readout">{{ formatValue(live) }}</span>
71
- <span v-if="hasDetail" :id="detailId" :class="styles.detail"><slot name="detail">{{ detail }}</slot></span>
70
+ <span :id="labelId" :class="styles.label" data-slot="field-label">{{ label }}</span>
71
+ <span v-if="formatValue" :class="styles.readout" data-slot="picker-wheel-value">{{ formatValue(live) }}</span>
72
+ <span v-if="hasDetail" :id="detailId" :class="styles.detail" data-slot="picker-wheel-detail"><slot name="detail">{{ detail }}</slot></span>
72
73
  </div>
73
- <div :class="styles.wheel" role="group" :aria-labelledby="labelId" :aria-describedby="hasDetail ? detailId : undefined">
74
- <WheelColumn v-for="(c, i) in columns" :key="i" :column="c" :index="value[i]" :haptics="haptics" @change="onChange(i, $event)" @shown="onShown(i, $event)" />
74
+ <div :class="styles.wheel" data-slot="picker-wheel-columns" role="group" :aria-labelledby="labelId" :aria-describedby="hasDetail ? detailId : undefined">
75
+ <WheelColumn v-for="(c, i) in columns" :key="i" :column="c" :index="value[i]" :haptics="haptics" @commit="onCommit(i, $event)" @shown="onShown(i, $event)" />
75
76
  </div>
76
77
  </div>
77
78
  </template>
@@ -1,31 +1,33 @@
1
1
  <script setup lang="ts">
2
2
  import { computed, ref } from 'vue'
3
- import { timeWheel } from '../../internal/motion/pickerWheel'
3
+ import { localeHourCycle, timeWheel } from '../../internal/motion/pickerWheel'
4
4
  import PickerWheel from './PickerWheel.vue'
5
5
 
6
6
  // PickerWheel set up for a time: hour, minute and, on a 12 hour clock, AM or PM (the Vue TimeWheel).
7
7
  // Other props (detail, haptics) go to the PickerWheel.
8
8
 
9
- const props = withDefaults(
10
- defineProps<{
11
- /** Visible name of the whole wheel, read by screen readers as the group's name. */
12
- label: string
13
- /** Starting time when there is no v-model. */
14
- defaultValue?: string
15
- /** 12 shows AM and PM; 24 shows hours 00 to 23. */
16
- hourCycle?: 12 | 24
17
- /** Minutes between two rows. */
18
- minuteStep?: number
19
- /** Minutes drawn stronger. Page Up and Page Down jump between them. */
20
- strong?: number[]
21
- }>(),
22
- { defaultValue: '09:00', hourCycle: 12, minuteStep: 1, strong: () => [0, 30] },
23
- )
24
- const emit = defineEmits<{ /** The time in the band while the wheel still turns, as "HH:mm". */ scrub: [value: string] }>()
9
+ const {
10
+ defaultValue = '09:00',
11
+ hourCycle,
12
+ step = 1,
13
+ strong = [0, 30],
14
+ } = defineProps<{
15
+ /** Visible name of the whole wheel, read by screen readers as the group's name. */
16
+ label: string
17
+ /** Starting time when there is no v-model. */
18
+ defaultValue?: string
19
+ /** 12 shows AM and PM; 24 shows hours 00 to 23. Defaults to what the browser's locale uses. */
20
+ hourCycle?: 12 | 24
21
+ /** Minutes between two rows, such as 5 or 15. */
22
+ step?: number
23
+ /** Minutes drawn stronger. Page Up and Page Down jump between them. */
24
+ strong?: number[]
25
+ }>()
26
+ const emit = defineEmits<{ /** The time, as "HH:mm", once the wheel comes to rest on a new one. */ valueCommit: [value: string] }>()
25
27
 
26
- /** The time as "HH:mm" in 24 hours, set once the wheel comes to rest. Use v-model, or leave it out and the wheel keeps its own time. */
28
+ /** The time in the band as "HH:mm" in 24 hours, set each time it changes while the wheel turns. Use v-model, or leave it out and the wheel keeps its own time. */
27
29
  const model = defineModel<string>()
28
- const local = ref(props.defaultValue)
30
+ const local = ref(defaultValue)
29
31
  const value = computed({
30
32
  get: () => model.value ?? local.value,
31
33
  set: (next: string) => {
@@ -33,7 +35,7 @@ const value = computed({
33
35
  model.value = next
34
36
  },
35
37
  })
36
- const wheel = computed(() => timeWheel(props.hourCycle, props.minuteStep, props.strong))
38
+ const wheel = computed(() => timeWheel(hourCycle ?? localeHourCycle(), step, strong))
37
39
  </script>
38
40
 
39
41
  <template>
@@ -43,7 +45,7 @@ const wheel = computed(() => timeWheel(props.hourCycle, props.minuteStep, props.
43
45
  :model-value="wheel.toRows(value)"
44
46
  :format-value="wheel.show"
45
47
  @update:model-value="(rows) => rows && (value = wheel.toTime(rows))"
46
- @scrub="emit('scrub', wheel.toTime($event))"
48
+ @value-commit="emit('valueCommit', wheel.toTime($event))"
47
49
  >
48
50
  <template v-for="(_, name) in $slots" #[name]><slot :name="name" /></template>
49
51
  </PickerWheel>
@@ -9,7 +9,7 @@ import styles from './PickerWheel.module.css'
9
9
  // One column of the Vue PickerWheel: its rows are the marks. A drag follows the hand; a let-go lands on a row.
10
10
 
11
11
  const props = defineProps<{ column: WheelColumn; index: number; haptics: boolean }>()
12
- const emit = defineEmits<{ change: [index: number]; shown: [index: number] }>()
12
+ const emit = defineEmits<{ commit: [index: number]; shown: [index: number] }>()
13
13
 
14
14
  const n = computed(() => props.column.options.length)
15
15
  const strong = computed(() => new Set(props.column.strong ?? []))
@@ -19,9 +19,10 @@ const wheel = wheelSteps()
19
19
  // The keys, tap and wheel of one column (motion/pickerWheel.ts) on the shared scrubber.
20
20
  const sc = useScrub(() => ({
21
21
  ...columnScrub(props.column, props.index, st, wheel),
22
- onSettle: (to: number) => {
22
+ onSettle: (to: number, from: number) => {
23
23
  st.rested = to
24
- emit('change', wrap(to, n.value))
24
+ // A loop turned all the way round rests on the row it left: no news.
25
+ if (wrap(to, n.value) !== wrap(Math.round(from), n.value)) emit('commit', wrap(to, n.value))
25
26
  },
26
27
  haptics: props.haptics,
27
28
  }))
@@ -51,6 +52,7 @@ const rows = computed(() => drumRows(sc.at.value, n.value, !!props.column.loop))
51
52
  <div
52
53
  ref="scrubEl"
53
54
  :class="styles.column"
55
+ data-slot="picker-wheel-column"
54
56
  role="spinbutton"
55
57
  tabindex="0"
56
58
  :aria-label="column.label"
@@ -62,9 +64,9 @@ const rows = computed(() => drumRows(sc.at.value, n.value, !!props.column.loop))
62
64
  :data-moving="sc.moving.value || undefined"
63
65
  v-on="sc.handlers"
64
66
  >
65
- <span :class="styles.band" :style="{ '--grip': grip.toFixed(3) }" aria-hidden="true" />
67
+ <span :class="styles.band" data-slot="picker-wheel-band" :style="{ '--grip': grip.toFixed(3) }" aria-hidden="true" />
66
68
  <div :class="styles.drum" aria-hidden="true">
67
- <span v-for="r in rows" :key="r.k" :class="styles.row" :data-strong="strong.has(r.i) || undefined" :style="{ '--d': r.d.toFixed(3), color: ink(pull(r.d, 1)) }">{{ column.options[r.i] }}</span>
69
+ <span v-for="r in rows" :key="r.k" :class="styles.row" data-slot="picker-wheel-row" :data-strong="strong.has(r.i) || undefined" :style="{ '--d': r.d.toFixed(3), color: ink(pull(r.d, 1)) }">{{ column.options[r.i] }}</span>
68
70
  </div>
69
71
  </div>
70
72
  </template>
@@ -1,3 +1,4 @@
1
+ @layer gooee.components {
1
2
  .panel {
2
3
  --oy: calc(var(--gooee-shift-md) * -1);
3
4
  z-index: var(--gooee-z-popover);
@@ -12,13 +13,13 @@
12
13
  box-shadow: var(--gooee-shadow-3);
13
14
  outline: none;
14
15
  transform-origin: top left;
15
- animation: popIn var(--gooee-motion-slow) var(--gooee-ease-spring);
16
+ animation: popIn var(--gooee-motion-slow) var(--gooee-ease-morph);
16
17
  }
17
18
 
18
19
  .panel[data-side="top"] { --oy: var(--gooee-shift-md); transform-origin: bottom left; }
19
20
 
20
21
  .panel[data-state="closed"] {
21
- animation: popOut var(--gooee-motion-fast) var(--gooee-ease-in) forwards;
22
+ animation: popOut var(--gooee-motion-fast) var(--gooee-ease-morph) forwards;
22
23
  pointer-events: none;
23
24
  }
24
25
 
@@ -59,7 +60,7 @@
59
60
  color: var(--gooee-color-fg-muted);
60
61
  font-size: var(--gooee-icon-md);
61
62
  cursor: pointer;
62
- transition: background-color var(--gooee-motion-fast) var(--gooee-ease-out), transform var(--gooee-motion-slow) var(--gooee-ease-spring);
63
+ transition: background-color var(--gooee-motion-fast) var(--gooee-ease-morph), transform var(--gooee-motion-slow) var(--gooee-ease-morph);
63
64
  }
64
65
 
65
66
  /* Looks 32px, keeps a 44px touch area. */
@@ -84,3 +85,4 @@
84
85
  @keyframes popOut {
85
86
  to { opacity: 0; transform: scale(var(--gooee-pop-scale)); }
86
87
  }
88
+ }
@@ -12,7 +12,7 @@ import {
12
12
  } from 'react'
13
13
  import { cx } from '../../internal/cx'
14
14
  import { useFocusTrap } from '../../internal/focus'
15
- import { XIcon } from '../../internal/icons'
15
+ import { XIcon } from '../../icons/icons'
16
16
  import { useDismiss } from '../../internal/layers'
17
17
  import { useLiquid } from '../../internal/liquid'
18
18
  import { mergeRefs } from '../../internal/mergeRefs'
@@ -44,12 +44,19 @@ export type PopoverProps = {
44
44
  side?: Side
45
45
  /** How the panel lines up with the trigger along that side. */
46
46
  align?: Align
47
- /** Label for the close button. */
48
- closeLabel?: string
47
+ /** Text for the popover's controls, so you can translate it. Missing keys use the English defaults. */
48
+ labels?: Partial<PopoverLabels>
49
49
  /** Extra class for the panel. */
50
50
  className?: string
51
51
  }
52
52
 
53
+ export type PopoverLabels = {
54
+ /** Screen reader name for the close button. */
55
+ close: string
56
+ }
57
+
58
+ const defaultLabels: PopoverLabels = { close: 'Close' }
59
+
53
60
  export function Popover({
54
61
  trigger,
55
62
  title,
@@ -59,9 +66,10 @@ export function Popover({
59
66
  onOpenChange,
60
67
  side = 'bottom',
61
68
  align = 'start',
62
- closeLabel = 'Close',
69
+ labels: labelsProp,
63
70
  className,
64
71
  }: PopoverProps) {
72
+ const labels = { ...defaultLabels, ...labelsProp }
65
73
  const id = useId()
66
74
  const [open, setOpen] = useControllable(openProp, defaultOpen, onOpenChange)
67
75
  const anchorRef = useRef<HTMLElement>(null)
@@ -98,17 +106,18 @@ export function Popover({
98
106
  aria-labelledby={`${id}-title`}
99
107
  tabIndex={-1}
100
108
  className={cx(styles.panel, className)}
109
+ data-slot="popover-content"
101
110
  data-state={state}
102
111
  data-side={floating.side}
103
112
  style={floating.style}
104
113
  >
105
- <div className={styles.head}>
106
- <h2 id={`${id}-title`} className={styles.title}>{title}</h2>
107
- <button type="button" className={styles.close} aria-label={closeLabel} data-skip-initial-focus onClick={() => setOpen(false)}>
114
+ <div className={styles.head} data-slot="popover-header">
115
+ <h2 id={`${id}-title`} className={styles.title} data-slot="popover-title">{title}</h2>
116
+ <button type="button" className={styles.close} data-slot="popover-close" aria-label={labels.close} data-skip-initial-focus onClick={() => setOpen(false)}>
108
117
  <XIcon />
109
118
  </button>
110
119
  </div>
111
- <div className={styles.body}>{children}</div>
120
+ <div className={styles.body} data-slot="popover-body">{children}</div>
112
121
  </div>
113
122
  </Portal>
114
123
  )}