@abuzareal/contour-ui 0.4.0 → 0.6.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 (186) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/COMBOBOX.md +87 -0
  3. package/CONTRACTS.md +23 -17
  4. package/DOCS.md +80 -0
  5. package/FOUNDATION.md +35 -0
  6. package/GETTING-STARTED.md +63 -0
  7. package/NEXTJS.md +5 -1
  8. package/OVERLAYS.md +52 -0
  9. package/PUBLIC-API.md +189 -162
  10. package/README.md +44 -28
  11. package/RECIPES.md +43 -0
  12. package/RELEASING.md +2 -2
  13. package/SIZE.md +51 -0
  14. package/STYLING.md +68 -0
  15. package/dist/actions.css +7 -0
  16. package/dist/components/hero/Sculpture.js +2 -1
  17. package/dist/components/three/ObjectStudy.js +2 -1
  18. package/dist/components/ui/Alert.d.ts +2 -1
  19. package/dist/components/ui/Alert.js +3 -3
  20. package/dist/components/ui/Avatar.d.ts +3 -1
  21. package/dist/components/ui/Avatar.js +3 -3
  22. package/dist/components/ui/Badge.js +2 -2
  23. package/dist/components/ui/BrandMark.js +2 -1
  24. package/dist/components/ui/Breadcrumbs.d.ts +2 -1
  25. package/dist/components/ui/Breadcrumbs.js +3 -2
  26. package/dist/components/ui/Button.d.ts +2 -0
  27. package/dist/components/ui/Button.js +3 -2
  28. package/dist/components/ui/Card.js +2 -2
  29. package/dist/components/ui/Checkbox.js +3 -3
  30. package/dist/components/ui/Combobox.d.ts +325 -0
  31. package/dist/components/ui/Combobox.js +120 -0
  32. package/dist/components/ui/Combobox.types.d.ts +46 -0
  33. package/dist/components/ui/Combobox.types.js +1 -0
  34. package/dist/components/ui/CountUp.d.ts +2 -1
  35. package/dist/components/ui/CountUp.js +6 -3
  36. package/dist/components/ui/DataTable.d.ts +1 -0
  37. package/dist/components/ui/DataTable.js +15 -10
  38. package/dist/components/ui/DepthButton.js +2 -2
  39. package/dist/components/ui/Dialog.d.ts +5 -1
  40. package/dist/components/ui/Dialog.js +49 -18
  41. package/dist/components/ui/Disclosure.js +2 -1
  42. package/dist/components/ui/Divider.js +3 -2
  43. package/dist/components/ui/DropdownMenu.d.ts +11 -4
  44. package/dist/components/ui/DropdownMenu.js +109 -66
  45. package/dist/components/ui/EmptyState.js +2 -1
  46. package/dist/components/ui/Field.js +2 -2
  47. package/dist/components/ui/FlipCard.js +2 -2
  48. package/dist/components/ui/FloatingPortal.d.ts +10 -0
  49. package/dist/components/ui/FloatingPortal.js +13 -0
  50. package/dist/components/ui/FloatingScope.d.ts +9 -0
  51. package/dist/components/ui/FloatingScope.js +43 -0
  52. package/dist/components/ui/IconButton.js +2 -2
  53. package/dist/components/ui/Kbd.js +2 -1
  54. package/dist/components/ui/Magnetic.js +2 -1
  55. package/dist/components/ui/Marquee.js +3 -2
  56. package/dist/components/ui/OverlayTrigger.d.ts +11 -0
  57. package/dist/components/ui/OverlayTrigger.js +5 -0
  58. package/dist/components/ui/Pagination.d.ts +5 -1
  59. package/dist/components/ui/Pagination.js +3 -2
  60. package/dist/components/ui/Popover.d.ts +18 -8
  61. package/dist/components/ui/Popover.js +58 -17
  62. package/dist/components/ui/ProgressBar.js +2 -2
  63. package/dist/components/ui/RadioGroup.js +5 -5
  64. package/dist/components/ui/Reveal.d.ts +0 -1
  65. package/dist/components/ui/Reveal.js +4 -3
  66. package/dist/components/ui/RevealHeading.js +2 -1
  67. package/dist/components/ui/ScrollProgress.js +2 -1
  68. package/dist/components/ui/SectionLabel.js +2 -1
  69. package/dist/components/ui/SegmentedControl.js +6 -3
  70. package/dist/components/ui/SelectField.js +3 -2
  71. package/dist/components/ui/Skeleton.js +2 -2
  72. package/dist/components/ui/Slider.js +3 -3
  73. package/dist/components/ui/Spinner.js +2 -2
  74. package/dist/components/ui/Stat.js +2 -1
  75. package/dist/components/ui/Stepper.js +3 -3
  76. package/dist/components/ui/Switch.d.ts +2 -0
  77. package/dist/components/ui/Switch.js +6 -7
  78. package/dist/components/ui/Table.d.ts +20 -0
  79. package/dist/components/ui/Table.js +9 -0
  80. package/dist/components/ui/Tabs.js +7 -5
  81. package/dist/components/ui/Tag.d.ts +2 -1
  82. package/dist/components/ui/Tag.js +4 -3
  83. package/dist/components/ui/TextArea.js +2 -1
  84. package/dist/components/ui/TextField.js +3 -2
  85. package/dist/components/ui/ThemeScope.d.ts +13 -0
  86. package/dist/components/ui/ThemeScope.js +10 -0
  87. package/dist/components/ui/ThemeToggle.d.ts +3 -0
  88. package/dist/components/ui/ThemeToggle.js +4 -3
  89. package/dist/components/ui/TiltCard.js +3 -2
  90. package/dist/components/ui/Timeline.js +2 -2
  91. package/dist/components/ui/ToastProvider.d.ts +5 -2
  92. package/dist/components/ui/ToastProvider.js +5 -5
  93. package/dist/components/ui/Tooltip.d.ts +4 -4
  94. package/dist/components/ui/Tooltip.js +70 -10
  95. package/dist/data-display.css +5 -0
  96. package/dist/effects.css +6 -0
  97. package/dist/feedback.css +5 -0
  98. package/dist/fonts-latin.css +10 -4
  99. package/dist/fonts.css +8 -0
  100. package/dist/forms.css +5 -0
  101. package/dist/hooks/useComboboxAnchor.d.ts +17 -0
  102. package/dist/hooks/useComboboxAnchor.js +61 -0
  103. package/dist/hooks/useDismiss.d.ts +12 -3
  104. package/dist/hooks/useDismiss.js +5 -21
  105. package/dist/hooks/useFloatingPanel.d.ts +14 -0
  106. package/dist/hooks/useFloatingPanel.js +157 -0
  107. package/dist/hooks/useLayerDismiss.d.ts +4 -0
  108. package/dist/hooks/useLayerDismiss.js +48 -0
  109. package/dist/hooks/useMobileMenu.d.ts +0 -1
  110. package/dist/hooks/useMobileMenu.js +11 -16
  111. package/dist/hooks/usePanelFocus.d.ts +10 -0
  112. package/dist/hooks/usePanelFocus.js +60 -0
  113. package/dist/hooks/useTheme.d.ts +1 -0
  114. package/dist/hooks/useTheme.js +18 -5
  115. package/dist/index.d.ts +7 -0
  116. package/dist/index.js +3 -0
  117. package/dist/kit/data-display.css +6 -0
  118. package/dist/kit/forms.css +45 -2
  119. package/dist/kit/navigation.css +4 -0
  120. package/dist/kit/overlays.css +8 -4
  121. package/dist/lib/classNames.d.ts +2 -0
  122. package/dist/lib/classNames.js +16 -1
  123. package/dist/lib/componentClasses.d.ts +1 -0
  124. package/dist/lib/componentClasses.js +2 -0
  125. package/dist/lib/keyboard.d.ts +1 -1
  126. package/dist/lib/keyboard.js +5 -2
  127. package/dist/lib/layers.d.ts +18 -0
  128. package/dist/lib/layers.js +128 -0
  129. package/dist/lib/themeScope.d.ts +5 -0
  130. package/dist/lib/themeScope.js +3 -0
  131. package/dist/minimal-reset.css +6 -0
  132. package/dist/navigation.css +5 -0
  133. package/dist/overlays.css +5 -0
  134. package/dist/scoped/base.css +183 -0
  135. package/dist/scoped/kit/actions.css +209 -0
  136. package/dist/scoped/kit/data-display.css +498 -0
  137. package/dist/scoped/kit/effects.css +140 -0
  138. package/dist/scoped/kit/feedback.css +309 -0
  139. package/dist/scoped/kit/forms.css +404 -0
  140. package/dist/scoped/kit/navigation.css +266 -0
  141. package/dist/scoped/kit/overlays.css +299 -0
  142. package/dist/scoped/marquee.css +58 -0
  143. package/dist/scoped/spinner.css +20 -0
  144. package/dist/scoped/theme-toggle.css +38 -0
  145. package/dist/scoped/tokens.css +119 -0
  146. package/dist/scoped/ui.css +127 -0
  147. package/dist/scoped/utilities.css +17 -0
  148. package/dist/scoped-tokens.css +1 -0
  149. package/dist/scoped.css +12 -0
  150. package/dist/theme-toggle.css +2 -2
  151. package/dist/tokens.json +710 -0
  152. package/examples/optional/LazyScene.tsx +78 -0
  153. package/examples/optional/OptionalSmoothScroll.tsx +25 -0
  154. package/examples/optional/SmoothScrollOwner.tsx +7 -0
  155. package/examples/optional/optional.css +25 -0
  156. package/examples/recipes/AsyncProjectPicker.tsx +82 -0
  157. package/examples/recipes/DeleteProjectConfirmation.tsx +97 -0
  158. package/examples/recipes/InputCompositions.tsx +49 -0
  159. package/examples/recipes/RemoteRecordsTable.tsx +256 -0
  160. package/examples/recipes/useRemoteResource.ts +81 -0
  161. package/examples/reproduction/README.md +9 -0
  162. package/examples/reproduction/index.html +14 -0
  163. package/examples/reproduction/package.json +27 -0
  164. package/examples/reproduction/src/main.tsx +33 -0
  165. package/examples/reproduction/src/style.css +19 -0
  166. package/examples/reproduction/tsconfig.json +18 -0
  167. package/examples/reproduction/vite.config.ts +19 -0
  168. package/examples/starters/next/README.md +18 -0
  169. package/examples/starters/next/app/Demo.tsx +65 -0
  170. package/examples/starters/next/app/layout.tsx +25 -0
  171. package/examples/starters/next/app/next-page/page.tsx +9 -0
  172. package/examples/starters/next/app/page.tsx +11 -0
  173. package/examples/starters/next/app/style.css +19 -0
  174. package/examples/starters/next/next-env.d.ts +2 -0
  175. package/examples/starters/next/next.config.mjs +1 -0
  176. package/examples/starters/next/package.json +27 -0
  177. package/examples/starters/next/proxy.ts +16 -0
  178. package/examples/starters/next/tsconfig.json +30 -0
  179. package/examples/starters/vite/README.md +16 -0
  180. package/examples/starters/vite/index.html +14 -0
  181. package/examples/starters/vite/package.json +27 -0
  182. package/examples/starters/vite/src/main.tsx +81 -0
  183. package/examples/starters/vite/src/style.css +19 -0
  184. package/examples/starters/vite/tsconfig.json +18 -0
  185. package/examples/starters/vite/vite.config.ts +19 -0
  186. package/package.json +41 -5
@@ -0,0 +1,325 @@
1
+ export type { ComboboxOption, ComboboxProps } from "./Combobox.types.js";
2
+ import type { ComboboxOption } from "./Combobox.types.js";
3
+ /** Searchable allowed-value selection. The forwarded ref targets the visible input. */
4
+ declare const Combobox: import("react").ForwardRefExoticComponent<import("../../hooks/useFloatingPanel.js").FloatingOptions & {
5
+ label: string;
6
+ options: readonly ComboboxOption[];
7
+ filteredOptions?: readonly ComboboxOption[];
8
+ value?: string | null;
9
+ defaultValue?: string | null;
10
+ onValueChange?: (value: string | null) => void;
11
+ inputValue?: string;
12
+ defaultInputValue?: string;
13
+ onInputValueChange?: (query: string) => void;
14
+ open?: boolean;
15
+ defaultOpen?: boolean;
16
+ onOpenChange?: (open: boolean) => void;
17
+ id?: string;
18
+ name?: string;
19
+ form?: string;
20
+ required?: boolean;
21
+ disabled?: boolean;
22
+ readOnly?: boolean;
23
+ hint?: string;
24
+ error?: string;
25
+ hideLabel?: boolean;
26
+ loading?: boolean;
27
+ searchError?: string;
28
+ onRetry?: () => void;
29
+ loadingText?: string;
30
+ emptyText?: string;
31
+ retryLabel?: string;
32
+ triggerLabel?: string;
33
+ missingValueText?: string;
34
+ inputProps?: {
35
+ [x: `data-${string}`]: string | number | boolean | undefined;
36
+ title?: string | undefined | undefined;
37
+ ref?: ((instance: HTMLInputElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<HTMLInputElement> | null | undefined;
38
+ suppressHydrationWarning?: boolean | undefined | undefined;
39
+ className?: string | undefined | undefined;
40
+ color?: string | undefined | undefined;
41
+ height?: number | string | undefined | undefined;
42
+ lang?: string | undefined | undefined;
43
+ max?: number | string | undefined | undefined;
44
+ min?: number | string | undefined | undefined;
45
+ style?: import("react").CSSProperties | undefined;
46
+ width?: number | string | undefined | undefined;
47
+ role?: import("react").AriaRole | undefined;
48
+ tabIndex?: number | undefined | undefined;
49
+ "aria-activedescendant"?: string | undefined | undefined;
50
+ "aria-atomic"?: (boolean | "true" | "false") | undefined;
51
+ "aria-autocomplete"?: "none" | "inline" | "list" | "both" | undefined | undefined;
52
+ "aria-braillelabel"?: string | undefined | undefined;
53
+ "aria-brailleroledescription"?: string | undefined | undefined;
54
+ "aria-busy"?: (boolean | "true" | "false") | undefined;
55
+ "aria-checked"?: boolean | "false" | "mixed" | "true" | undefined | undefined;
56
+ "aria-colcount"?: number | undefined | undefined;
57
+ "aria-colindex"?: number | undefined | undefined;
58
+ "aria-colindextext"?: string | undefined | undefined;
59
+ "aria-colspan"?: number | undefined | undefined;
60
+ "aria-controls"?: string | undefined | undefined;
61
+ "aria-current"?: boolean | "false" | "true" | "page" | "step" | "location" | "date" | "time" | undefined | undefined;
62
+ "aria-describedby"?: string | undefined | undefined;
63
+ "aria-description"?: string | undefined | undefined;
64
+ "aria-details"?: string | undefined | undefined;
65
+ "aria-disabled"?: (boolean | "true" | "false") | undefined;
66
+ "aria-dropeffect"?: "none" | "copy" | "execute" | "link" | "move" | "popup" | undefined | undefined;
67
+ "aria-errormessage"?: string | undefined | undefined;
68
+ "aria-expanded"?: (boolean | "true" | "false") | undefined;
69
+ "aria-flowto"?: string | undefined | undefined;
70
+ "aria-grabbed"?: (boolean | "true" | "false") | undefined;
71
+ "aria-haspopup"?: boolean | "false" | "true" | "menu" | "listbox" | "tree" | "grid" | "dialog" | undefined | undefined;
72
+ "aria-hidden"?: (boolean | "true" | "false") | undefined;
73
+ "aria-invalid"?: boolean | "false" | "true" | "grammar" | "spelling" | undefined | undefined;
74
+ "aria-keyshortcuts"?: string | undefined | undefined;
75
+ "aria-label"?: string | undefined | undefined;
76
+ "aria-labelledby"?: string | undefined | undefined;
77
+ "aria-level"?: number | undefined | undefined;
78
+ "aria-live"?: "off" | "assertive" | "polite" | undefined | undefined;
79
+ "aria-modal"?: (boolean | "true" | "false") | undefined;
80
+ "aria-multiline"?: (boolean | "true" | "false") | undefined;
81
+ "aria-multiselectable"?: (boolean | "true" | "false") | undefined;
82
+ "aria-orientation"?: "horizontal" | "vertical" | undefined | undefined;
83
+ "aria-owns"?: string | undefined | undefined;
84
+ "aria-placeholder"?: string | undefined | undefined;
85
+ "aria-posinset"?: number | undefined | undefined;
86
+ "aria-pressed"?: boolean | "false" | "mixed" | "true" | undefined | undefined;
87
+ "aria-readonly"?: (boolean | "true" | "false") | undefined;
88
+ "aria-relevant"?: "additions" | "additions removals" | "additions text" | "all" | "removals" | "removals additions" | "removals text" | "text" | "text additions" | "text removals" | undefined | undefined;
89
+ "aria-required"?: (boolean | "true" | "false") | undefined;
90
+ "aria-roledescription"?: string | undefined | undefined;
91
+ "aria-rowcount"?: number | undefined | undefined;
92
+ "aria-rowindex"?: number | undefined | undefined;
93
+ "aria-rowindextext"?: string | undefined | undefined;
94
+ "aria-rowspan"?: number | undefined | undefined;
95
+ "aria-selected"?: (boolean | "true" | "false") | undefined;
96
+ "aria-setsize"?: number | undefined | undefined;
97
+ "aria-sort"?: "none" | "ascending" | "descending" | "other" | undefined | undefined;
98
+ "aria-valuemax"?: number | undefined | undefined;
99
+ "aria-valuemin"?: number | undefined | undefined;
100
+ "aria-valuenow"?: number | undefined | undefined;
101
+ "aria-valuetext"?: string | undefined | undefined;
102
+ onCopy?: import("react").ClipboardEventHandler<HTMLInputElement> | undefined;
103
+ onCopyCapture?: import("react").ClipboardEventHandler<HTMLInputElement> | undefined;
104
+ onCut?: import("react").ClipboardEventHandler<HTMLInputElement> | undefined;
105
+ onCutCapture?: import("react").ClipboardEventHandler<HTMLInputElement> | undefined;
106
+ onPaste?: import("react").ClipboardEventHandler<HTMLInputElement> | undefined;
107
+ onPasteCapture?: import("react").ClipboardEventHandler<HTMLInputElement> | undefined;
108
+ onCompositionEnd?: import("react").CompositionEventHandler<HTMLInputElement> | undefined;
109
+ onCompositionEndCapture?: import("react").CompositionEventHandler<HTMLInputElement> | undefined;
110
+ onCompositionStart?: import("react").CompositionEventHandler<HTMLInputElement> | undefined;
111
+ onCompositionStartCapture?: import("react").CompositionEventHandler<HTMLInputElement> | undefined;
112
+ onCompositionUpdate?: import("react").CompositionEventHandler<HTMLInputElement> | undefined;
113
+ onCompositionUpdateCapture?: import("react").CompositionEventHandler<HTMLInputElement> | undefined;
114
+ onFocus?: import("react").FocusEventHandler<HTMLInputElement> | undefined;
115
+ onFocusCapture?: import("react").FocusEventHandler<HTMLInputElement> | undefined;
116
+ onBlur?: import("react").FocusEventHandler<HTMLInputElement> | undefined;
117
+ onBlurCapture?: import("react").FocusEventHandler<HTMLInputElement> | undefined;
118
+ onChange?: import("react").ChangeEventHandler<HTMLInputElement> | undefined;
119
+ onChangeCapture?: import("react").FormEventHandler<HTMLInputElement> | undefined;
120
+ onBeforeInput?: import("react").InputEventHandler<HTMLInputElement> | undefined;
121
+ onBeforeInputCapture?: import("react").FormEventHandler<HTMLInputElement> | undefined;
122
+ onInput?: import("react").FormEventHandler<HTMLInputElement> | undefined;
123
+ onInputCapture?: import("react").FormEventHandler<HTMLInputElement> | undefined;
124
+ onReset?: import("react").FormEventHandler<HTMLInputElement> | undefined;
125
+ onResetCapture?: import("react").FormEventHandler<HTMLInputElement> | undefined;
126
+ onSubmit?: import("react").FormEventHandler<HTMLInputElement> | undefined;
127
+ onSubmitCapture?: import("react").FormEventHandler<HTMLInputElement> | undefined;
128
+ onInvalid?: import("react").FormEventHandler<HTMLInputElement> | undefined;
129
+ onInvalidCapture?: import("react").FormEventHandler<HTMLInputElement> | undefined;
130
+ onLoad?: import("react").ReactEventHandler<HTMLInputElement> | undefined;
131
+ onLoadCapture?: import("react").ReactEventHandler<HTMLInputElement> | undefined;
132
+ onError?: import("react").ReactEventHandler<HTMLInputElement> | undefined;
133
+ onErrorCapture?: import("react").ReactEventHandler<HTMLInputElement> | undefined;
134
+ onKeyDown?: import("react").KeyboardEventHandler<HTMLInputElement> | undefined;
135
+ onKeyDownCapture?: import("react").KeyboardEventHandler<HTMLInputElement> | undefined;
136
+ onKeyPress?: import("react").KeyboardEventHandler<HTMLInputElement> | undefined;
137
+ onKeyPressCapture?: import("react").KeyboardEventHandler<HTMLInputElement> | undefined;
138
+ onKeyUp?: import("react").KeyboardEventHandler<HTMLInputElement> | undefined;
139
+ onKeyUpCapture?: import("react").KeyboardEventHandler<HTMLInputElement> | undefined;
140
+ onAbort?: import("react").ReactEventHandler<HTMLInputElement> | undefined;
141
+ onAbortCapture?: import("react").ReactEventHandler<HTMLInputElement> | undefined;
142
+ onCanPlay?: import("react").ReactEventHandler<HTMLInputElement> | undefined;
143
+ onCanPlayCapture?: import("react").ReactEventHandler<HTMLInputElement> | undefined;
144
+ onCanPlayThrough?: import("react").ReactEventHandler<HTMLInputElement> | undefined;
145
+ onCanPlayThroughCapture?: import("react").ReactEventHandler<HTMLInputElement> | undefined;
146
+ onDurationChange?: import("react").ReactEventHandler<HTMLInputElement> | undefined;
147
+ onDurationChangeCapture?: import("react").ReactEventHandler<HTMLInputElement> | undefined;
148
+ onEmptied?: import("react").ReactEventHandler<HTMLInputElement> | undefined;
149
+ onEmptiedCapture?: import("react").ReactEventHandler<HTMLInputElement> | undefined;
150
+ onEncrypted?: import("react").ReactEventHandler<HTMLInputElement> | undefined;
151
+ onEncryptedCapture?: import("react").ReactEventHandler<HTMLInputElement> | undefined;
152
+ onEnded?: import("react").ReactEventHandler<HTMLInputElement> | undefined;
153
+ onEndedCapture?: import("react").ReactEventHandler<HTMLInputElement> | undefined;
154
+ onLoadedData?: import("react").ReactEventHandler<HTMLInputElement> | undefined;
155
+ onLoadedDataCapture?: import("react").ReactEventHandler<HTMLInputElement> | undefined;
156
+ onLoadedMetadata?: import("react").ReactEventHandler<HTMLInputElement> | undefined;
157
+ onLoadedMetadataCapture?: import("react").ReactEventHandler<HTMLInputElement> | undefined;
158
+ onLoadStart?: import("react").ReactEventHandler<HTMLInputElement> | undefined;
159
+ onLoadStartCapture?: import("react").ReactEventHandler<HTMLInputElement> | undefined;
160
+ onPause?: import("react").ReactEventHandler<HTMLInputElement> | undefined;
161
+ onPauseCapture?: import("react").ReactEventHandler<HTMLInputElement> | undefined;
162
+ onPlay?: import("react").ReactEventHandler<HTMLInputElement> | undefined;
163
+ onPlayCapture?: import("react").ReactEventHandler<HTMLInputElement> | undefined;
164
+ onPlaying?: import("react").ReactEventHandler<HTMLInputElement> | undefined;
165
+ onPlayingCapture?: import("react").ReactEventHandler<HTMLInputElement> | undefined;
166
+ onProgress?: import("react").ReactEventHandler<HTMLInputElement> | undefined;
167
+ onProgressCapture?: import("react").ReactEventHandler<HTMLInputElement> | undefined;
168
+ onRateChange?: import("react").ReactEventHandler<HTMLInputElement> | undefined;
169
+ onRateChangeCapture?: import("react").ReactEventHandler<HTMLInputElement> | undefined;
170
+ onSeeked?: import("react").ReactEventHandler<HTMLInputElement> | undefined;
171
+ onSeekedCapture?: import("react").ReactEventHandler<HTMLInputElement> | undefined;
172
+ onSeeking?: import("react").ReactEventHandler<HTMLInputElement> | undefined;
173
+ onSeekingCapture?: import("react").ReactEventHandler<HTMLInputElement> | undefined;
174
+ onStalled?: import("react").ReactEventHandler<HTMLInputElement> | undefined;
175
+ onStalledCapture?: import("react").ReactEventHandler<HTMLInputElement> | undefined;
176
+ onSuspend?: import("react").ReactEventHandler<HTMLInputElement> | undefined;
177
+ onSuspendCapture?: import("react").ReactEventHandler<HTMLInputElement> | undefined;
178
+ onTimeUpdate?: import("react").ReactEventHandler<HTMLInputElement> | undefined;
179
+ onTimeUpdateCapture?: import("react").ReactEventHandler<HTMLInputElement> | undefined;
180
+ onVolumeChange?: import("react").ReactEventHandler<HTMLInputElement> | undefined;
181
+ onVolumeChangeCapture?: import("react").ReactEventHandler<HTMLInputElement> | undefined;
182
+ onWaiting?: import("react").ReactEventHandler<HTMLInputElement> | undefined;
183
+ onWaitingCapture?: import("react").ReactEventHandler<HTMLInputElement> | undefined;
184
+ onAuxClick?: import("react").MouseEventHandler<HTMLInputElement> | undefined;
185
+ onAuxClickCapture?: import("react").MouseEventHandler<HTMLInputElement> | undefined;
186
+ onClick?: import("react").MouseEventHandler<HTMLInputElement> | undefined;
187
+ onClickCapture?: import("react").MouseEventHandler<HTMLInputElement> | undefined;
188
+ onContextMenu?: import("react").MouseEventHandler<HTMLInputElement> | undefined;
189
+ onContextMenuCapture?: import("react").MouseEventHandler<HTMLInputElement> | undefined;
190
+ onDoubleClick?: import("react").MouseEventHandler<HTMLInputElement> | undefined;
191
+ onDoubleClickCapture?: import("react").MouseEventHandler<HTMLInputElement> | undefined;
192
+ onDrag?: import("react").DragEventHandler<HTMLInputElement> | undefined;
193
+ onDragCapture?: import("react").DragEventHandler<HTMLInputElement> | undefined;
194
+ onDragEnd?: import("react").DragEventHandler<HTMLInputElement> | undefined;
195
+ onDragEndCapture?: import("react").DragEventHandler<HTMLInputElement> | undefined;
196
+ onDragEnter?: import("react").DragEventHandler<HTMLInputElement> | undefined;
197
+ onDragEnterCapture?: import("react").DragEventHandler<HTMLInputElement> | undefined;
198
+ onDragExit?: import("react").DragEventHandler<HTMLInputElement> | undefined;
199
+ onDragExitCapture?: import("react").DragEventHandler<HTMLInputElement> | undefined;
200
+ onDragLeave?: import("react").DragEventHandler<HTMLInputElement> | undefined;
201
+ onDragLeaveCapture?: import("react").DragEventHandler<HTMLInputElement> | undefined;
202
+ onDragOver?: import("react").DragEventHandler<HTMLInputElement> | undefined;
203
+ onDragOverCapture?: import("react").DragEventHandler<HTMLInputElement> | undefined;
204
+ onDragStart?: import("react").DragEventHandler<HTMLInputElement> | undefined;
205
+ onDragStartCapture?: import("react").DragEventHandler<HTMLInputElement> | undefined;
206
+ onDrop?: import("react").DragEventHandler<HTMLInputElement> | undefined;
207
+ onDropCapture?: import("react").DragEventHandler<HTMLInputElement> | undefined;
208
+ onMouseDown?: import("react").MouseEventHandler<HTMLInputElement> | undefined;
209
+ onMouseDownCapture?: import("react").MouseEventHandler<HTMLInputElement> | undefined;
210
+ onMouseEnter?: import("react").MouseEventHandler<HTMLInputElement> | undefined;
211
+ onMouseLeave?: import("react").MouseEventHandler<HTMLInputElement> | undefined;
212
+ onMouseMove?: import("react").MouseEventHandler<HTMLInputElement> | undefined;
213
+ onMouseMoveCapture?: import("react").MouseEventHandler<HTMLInputElement> | undefined;
214
+ onMouseOut?: import("react").MouseEventHandler<HTMLInputElement> | undefined;
215
+ onMouseOutCapture?: import("react").MouseEventHandler<HTMLInputElement> | undefined;
216
+ onMouseOver?: import("react").MouseEventHandler<HTMLInputElement> | undefined;
217
+ onMouseOverCapture?: import("react").MouseEventHandler<HTMLInputElement> | undefined;
218
+ onMouseUp?: import("react").MouseEventHandler<HTMLInputElement> | undefined;
219
+ onMouseUpCapture?: import("react").MouseEventHandler<HTMLInputElement> | undefined;
220
+ onSelect?: import("react").ReactEventHandler<HTMLInputElement> | undefined;
221
+ onSelectCapture?: import("react").ReactEventHandler<HTMLInputElement> | undefined;
222
+ onTouchCancel?: import("react").TouchEventHandler<HTMLInputElement> | undefined;
223
+ onTouchCancelCapture?: import("react").TouchEventHandler<HTMLInputElement> | undefined;
224
+ onTouchEnd?: import("react").TouchEventHandler<HTMLInputElement> | undefined;
225
+ onTouchEndCapture?: import("react").TouchEventHandler<HTMLInputElement> | undefined;
226
+ onTouchMove?: import("react").TouchEventHandler<HTMLInputElement> | undefined;
227
+ onTouchMoveCapture?: import("react").TouchEventHandler<HTMLInputElement> | undefined;
228
+ onTouchStart?: import("react").TouchEventHandler<HTMLInputElement> | undefined;
229
+ onTouchStartCapture?: import("react").TouchEventHandler<HTMLInputElement> | undefined;
230
+ onPointerDown?: import("react").PointerEventHandler<HTMLInputElement> | undefined;
231
+ onPointerDownCapture?: import("react").PointerEventHandler<HTMLInputElement> | undefined;
232
+ onPointerMove?: import("react").PointerEventHandler<HTMLInputElement> | undefined;
233
+ onPointerMoveCapture?: import("react").PointerEventHandler<HTMLInputElement> | undefined;
234
+ onPointerUp?: import("react").PointerEventHandler<HTMLInputElement> | undefined;
235
+ onPointerUpCapture?: import("react").PointerEventHandler<HTMLInputElement> | undefined;
236
+ onPointerCancel?: import("react").PointerEventHandler<HTMLInputElement> | undefined;
237
+ onPointerCancelCapture?: import("react").PointerEventHandler<HTMLInputElement> | undefined;
238
+ onPointerEnter?: import("react").PointerEventHandler<HTMLInputElement> | undefined;
239
+ onPointerLeave?: import("react").PointerEventHandler<HTMLInputElement> | undefined;
240
+ onPointerOver?: import("react").PointerEventHandler<HTMLInputElement> | undefined;
241
+ onPointerOverCapture?: import("react").PointerEventHandler<HTMLInputElement> | undefined;
242
+ onPointerOut?: import("react").PointerEventHandler<HTMLInputElement> | undefined;
243
+ onPointerOutCapture?: import("react").PointerEventHandler<HTMLInputElement> | undefined;
244
+ onGotPointerCapture?: import("react").PointerEventHandler<HTMLInputElement> | undefined;
245
+ onGotPointerCaptureCapture?: import("react").PointerEventHandler<HTMLInputElement> | undefined;
246
+ onLostPointerCapture?: import("react").PointerEventHandler<HTMLInputElement> | undefined;
247
+ onLostPointerCaptureCapture?: import("react").PointerEventHandler<HTMLInputElement> | undefined;
248
+ onScroll?: import("react").UIEventHandler<HTMLInputElement> | undefined;
249
+ onScrollCapture?: import("react").UIEventHandler<HTMLInputElement> | undefined;
250
+ onWheel?: import("react").WheelEventHandler<HTMLInputElement> | undefined;
251
+ onWheelCapture?: import("react").WheelEventHandler<HTMLInputElement> | undefined;
252
+ onAnimationStart?: import("react").AnimationEventHandler<HTMLInputElement> | undefined;
253
+ onAnimationStartCapture?: import("react").AnimationEventHandler<HTMLInputElement> | undefined;
254
+ onAnimationEnd?: import("react").AnimationEventHandler<HTMLInputElement> | undefined;
255
+ onAnimationEndCapture?: import("react").AnimationEventHandler<HTMLInputElement> | undefined;
256
+ onAnimationIteration?: import("react").AnimationEventHandler<HTMLInputElement> | undefined;
257
+ onAnimationIterationCapture?: import("react").AnimationEventHandler<HTMLInputElement> | undefined;
258
+ onTransitionEnd?: import("react").TransitionEventHandler<HTMLInputElement> | undefined;
259
+ onTransitionEndCapture?: import("react").TransitionEventHandler<HTMLInputElement> | undefined;
260
+ key?: import("react").Key | null | undefined;
261
+ size?: number | undefined | undefined;
262
+ list?: string | undefined | undefined;
263
+ src?: string | undefined | undefined;
264
+ alt?: string | undefined | undefined;
265
+ step?: number | string | undefined | undefined;
266
+ formAction?: string | undefined;
267
+ formEncType?: string | undefined | undefined;
268
+ formMethod?: string | undefined | undefined;
269
+ formNoValidate?: boolean | undefined | undefined;
270
+ formTarget?: string | undefined | undefined;
271
+ defaultChecked?: boolean | undefined | undefined;
272
+ suppressContentEditableWarning?: boolean | undefined | undefined;
273
+ accessKey?: string | undefined | undefined;
274
+ autoCapitalize?: "off" | "none" | "on" | "sentences" | "words" | "characters" | undefined | (string & {}) | undefined;
275
+ autoFocus?: boolean | undefined | undefined;
276
+ contentEditable?: (boolean | "true" | "false") | "inherit" | "plaintext-only" | undefined;
277
+ contextMenu?: string | undefined | undefined;
278
+ dir?: string | undefined | undefined;
279
+ draggable?: (boolean | "true" | "false") | undefined;
280
+ enterKeyHint?: "enter" | "done" | "go" | "next" | "previous" | "search" | "send" | undefined | undefined;
281
+ hidden?: boolean | undefined | undefined;
282
+ nonce?: string | undefined | undefined;
283
+ slot?: string | undefined | undefined;
284
+ spellCheck?: (boolean | "true" | "false") | undefined;
285
+ translate?: "yes" | "no" | undefined | undefined;
286
+ radioGroup?: string | undefined | undefined;
287
+ about?: string | undefined | undefined;
288
+ content?: string | undefined | undefined;
289
+ datatype?: string | undefined | undefined;
290
+ inlist?: any;
291
+ prefix?: string | undefined | undefined;
292
+ property?: string | undefined | undefined;
293
+ rel?: string | undefined | undefined;
294
+ resource?: string | undefined | undefined;
295
+ rev?: string | undefined | undefined;
296
+ typeof?: string | undefined | undefined;
297
+ vocab?: string | undefined | undefined;
298
+ autoCorrect?: string | undefined | undefined;
299
+ autoSave?: string | undefined | undefined;
300
+ itemProp?: string | undefined | undefined;
301
+ itemScope?: boolean | undefined | undefined;
302
+ itemType?: string | undefined | undefined;
303
+ itemID?: string | undefined | undefined;
304
+ itemRef?: string | undefined | undefined;
305
+ results?: number | undefined | undefined;
306
+ security?: string | undefined | undefined;
307
+ unselectable?: "on" | "off" | undefined | undefined;
308
+ inputMode?: "none" | "text" | "tel" | "url" | "email" | "numeric" | "decimal" | "search" | undefined | undefined;
309
+ is?: string | undefined | undefined;
310
+ exportparts?: string | undefined | undefined;
311
+ part?: string | undefined | undefined;
312
+ accept?: string | undefined | undefined;
313
+ autoComplete?: import("react").HTMLInputAutoCompleteAttribute | undefined;
314
+ capture?: boolean | "user" | "environment" | undefined | undefined;
315
+ checked?: boolean | undefined | undefined;
316
+ maxLength?: number | undefined | undefined;
317
+ minLength?: number | undefined | undefined;
318
+ multiple?: boolean | undefined | undefined;
319
+ pattern?: string | undefined | undefined;
320
+ placeholder?: string | undefined | undefined;
321
+ };
322
+ popupProps?: import("../../lib/componentProps.js").NativePartProps<"div">;
323
+ rootProps?: import("../../lib/componentProps.js").NativePartProps<"div">;
324
+ } & import("react").RefAttributes<HTMLInputElement>>;
325
+ export default Combobox;
@@ -0,0 +1,120 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { forwardRef, useContext, useId, useLayoutEffect, useMemo, useRef, useState, } from "react";
4
+ import { Combobox as BaseCombobox } from "@base-ui/react/combobox";
5
+ import { DirectionProvider } from "@base-ui/react/direction-provider";
6
+ import { Check, ChevronDown } from "lucide-react";
7
+ import { ccx } from "../../lib/classNames.js";
8
+ import { fieldDescribedBy } from "../../lib/a11y.js";
9
+ import { composeRefs } from "../../lib/composeRefs.js";
10
+ import { LayerVisibility } from "../../lib/layers.js";
11
+ import { floatingContainer } from "../../hooks/useFloatingPanel.js";
12
+ import useControlRef from "../../hooks/useControlRef.js";
13
+ import useFormReset from "../../hooks/useFormReset.js";
14
+ import useLayerDismiss from "../../hooks/useLayerDismiss.js";
15
+ import useOpenState from "../../hooks/useOpenState.js";
16
+ import useComboboxAnchor from "../../hooks/useComboboxAnchor.js";
17
+ import FloatingScope from "./FloatingScope.js";
18
+ import Field from "./Field.js";
19
+ /** Searchable allowed-value selection. The forwarded ref targets the visible input. */
20
+ const Combobox = forwardRef(function Combobox({ label, options, filteredOptions, value: controlledValue, defaultValue = null, onValueChange, inputValue, defaultInputValue, onInputValueChange, open: controlledOpen, defaultOpen = false, onOpenChange, id: providedId, name, form, required, disabled, readOnly, hint, error, hideLabel, loading = false, searchError, onRetry, loadingText = "Loading choices…", emptyText = "No matching choices.", retryLabel = "Retry search", triggerLabel = "Show choices", missingValueText = "Selected option is unavailable. Choose another.", side = "bottom", align = "start", sideOffset = 8, collisionPadding = 8, portal = true, container, inputProps, popupProps, rootProps, }, forwardedRef) {
21
+ const generatedId = useId();
22
+ const id = providedId ?? generatedId;
23
+ const [internalValue, setInternalValue] = useState(defaultValue);
24
+ const value = controlledValue === undefined ? internalValue : controlledValue;
25
+ const selected = options.find((option) => option.value === value);
26
+ const missing = value !== null && !selected;
27
+ const [query, setQuery] = useState(defaultInputValue ?? null);
28
+ const [open, changeOpen] = useOpenState(controlledOpen, defaultOpen, onOpenChange);
29
+ const available = useContext(LayerVisibility) && !disabled && !readOnly;
30
+ const visible = available && open;
31
+ const { ref: input, attach } = useControlRef(forwardedRef);
32
+ const [anchor, setAnchor] = useState(null);
33
+ const attachInput = useMemo(() => composeRefs(attach, inputProps?.ref, setAnchor), [attach, inputProps?.ref]);
34
+ const root = useRef(null);
35
+ const attachRoot = useMemo(() => composeRefs(root, rootProps?.ref), [rootProps?.ref]);
36
+ const positioner = useRef(null);
37
+ const [, mountedPositioner] = useState(null);
38
+ const attachPositioner = useMemo(() => composeRefs(positioner, mountedPositioner), []);
39
+ const [direction, setDirection] = useState("ltr");
40
+ const target = anchor && portal ? floatingContainer(anchor, { container }) : null;
41
+ const collection = useMemo(() => BaseCombobox.createItems(options, {
42
+ getValue: (option) => option.value,
43
+ getLabel: (option) => option.label,
44
+ }), [options]);
45
+ const close = () => {
46
+ changeOpen(false);
47
+ setQuery(null);
48
+ };
49
+ useLayerDismiss(root, visible, close, {
50
+ branches: [positioner, input],
51
+ layerElement: positioner,
52
+ });
53
+ useFormReset(input, () => {
54
+ if (controlledValue === undefined)
55
+ setInternalValue(defaultValue);
56
+ setQuery(null);
57
+ changeOpen(false);
58
+ });
59
+ useLayoutEffect(() => {
60
+ const element = input.current;
61
+ element?.setCustomValidity(missing ? missingValueText : "");
62
+ return () => element?.setCustomValidity("");
63
+ }, [input, missing, missingValueText]);
64
+ const fieldError = error ?? (missing ? missingValueText : undefined);
65
+ const results = loading || searchError ? [] : filteredOptions;
66
+ const statusId = `${id}-search-status`;
67
+ const positioning = useComboboxAnchor(anchor, positioner);
68
+ const popup = (_jsx(FloatingScope, { anchor: anchor, open: visible, target: target, onDirectionChange: setDirection, children: _jsx(BaseCombobox.Positioner, { ...positioning, ref: attachPositioner, className: ccx("combobox-positioner"), positionMethod: "fixed", side: side, align: align, sideOffset: Number.isFinite(sideOffset) ? sideOffset : 8, collisionPadding: Number.isFinite(collisionPadding) ? Math.max(0, collisionPadding) : 8, children: _jsxs(BaseCombobox.Popup, { ...popupProps, className: ccx("combobox-popup", popupProps?.className), children: [_jsx(BaseCombobox.Empty, { className: ccx("combobox-status"), children: loading ? loadingText : (searchError ?? emptyText) }), searchError && onRetry && (_jsx("button", { type: "button", className: ccx("combobox-retry"), onClick: onRetry, children: retryLabel })), _jsx(BaseCombobox.List, { className: ccx("combobox-list"), children: (option) => (_jsxs(BaseCombobox.Item, { className: ccx("combobox-option"), value: option.value, disabled: option.disabled, children: [_jsx("span", { children: option.label }), _jsx(BaseCombobox.ItemIndicator, { children: _jsx(Check, { size: 14, "aria-hidden": "true" }) })] }, option.value)) })] }) }) }));
69
+ return (_jsx(DirectionProvider, { direction: direction, children: _jsx("div", { ...rootProps, ref: attachRoot, className: ccx("combobox", rootProps?.className), children: _jsxs(BaseCombobox.Root, { items: collection, filteredItems: results, value: missing ? null : value, onValueChange: (next) => {
70
+ if (controlledValue === undefined)
71
+ setInternalValue(next);
72
+ setQuery(null);
73
+ onValueChange?.(next);
74
+ }, inputValue: inputValue ?? query ?? selected?.label ?? "", onInputValueChange: (next, details) => {
75
+ setQuery(details.reason === "input-change" ||
76
+ details.reason === "input-clear"
77
+ ? next
78
+ : null);
79
+ onInputValueChange?.(next);
80
+ }, open: visible, onOpenChange: (next, details) => {
81
+ // Keep native observers informed; a prevented Escape must not dismiss the host layer.
82
+ details.allowPropagation();
83
+ if ((next && !available) ||
84
+ (details.reason === "escape-key" &&
85
+ details.event.defaultPrevented)) {
86
+ details.cancel();
87
+ return;
88
+ }
89
+ if (!next)
90
+ setQuery(null);
91
+ changeOpen(next);
92
+ }, name: name, form: form, required: required, disabled: disabled, readOnly: readOnly, children: [_jsx(Field, { id: id, label: label, hint: hint, error: fieldError, required: required, disabled: disabled, hideLabel: hideLabel, children: _jsxs(BaseCombobox.InputGroup, { className: ccx("field-control combobox-control"), children: [_jsx(BaseCombobox.Input, { ...inputProps, onMouseDown: (event) => {
93
+ inputProps?.onMouseDown?.(event);
94
+ // Own activation on click; leave native focus/caret behavior intact and avoid stale touch timers.
95
+ event.preventBaseUIHandler();
96
+ }, onClick: (event) => {
97
+ inputProps?.onClick?.(event);
98
+ if (!event.defaultPrevented && available)
99
+ changeOpen(true);
100
+ }, onKeyDown: (event) => {
101
+ inputProps?.onKeyDown?.(event);
102
+ // Contour preserves a closed selection and lets the enclosing layer own Escape.
103
+ // Cancelling only Base UI's handler leaves the native document event intact.
104
+ if (event.defaultPrevented ||
105
+ (event.key === "Escape" && !visible))
106
+ event.preventBaseUIHandler();
107
+ }, ref: attachInput, id: id, form: form, "aria-labelledby": [
108
+ `${id}-label`,
109
+ inputProps?.["aria-labelledby"],
110
+ ]
111
+ .filter(Boolean)
112
+ .join(" "), "aria-invalid": fieldError ? true : inputProps?.["aria-invalid"], "aria-busy": loading || undefined, "aria-describedby": [
113
+ inputProps?.["aria-describedby"],
114
+ fieldDescribedBy(id, hint, fieldError),
115
+ statusId,
116
+ ]
117
+ .filter(Boolean)
118
+ .join(" ") }), _jsx(BaseCombobox.Trigger, { disabled: disabled || readOnly, className: ccx("combobox-trigger"), "aria-label": triggerLabel, children: _jsx(ChevronDown, { size: 16, "aria-hidden": "true" }) })] }) }), _jsx("span", { id: statusId, role: "status", className: ccx("visually-hidden"), children: loading ? loadingText : (searchError ?? "") }), _jsx(BaseCombobox.Portal, { container: portal ? (target ?? undefined) : root, children: popup })] }) }) }));
119
+ });
120
+ export default Combobox;
@@ -0,0 +1,46 @@
1
+ import type { NativePartProps } from "../../lib/componentProps.js";
2
+ import type { FloatingOptions } from "../../hooks/useFloatingPanel.js";
3
+ export type ComboboxOption = {
4
+ /** Unique, nonempty form value. Labels are presentation, never identity. */
5
+ value: string;
6
+ label: string;
7
+ disabled?: boolean;
8
+ };
9
+ type InputPart = Omit<NativePartProps<"input">, "value" | "defaultValue" | "name" | "form" | "id" | "disabled" | "required" | "readOnly" | "type">;
10
+ export type ComboboxProps = FloatingOptions & {
11
+ label: string;
12
+ options: readonly ComboboxOption[];
13
+ /** Application-filtered results. Retain the selected option in options for async searches. */
14
+ filteredOptions?: readonly ComboboxOption[];
15
+ value?: string | null;
16
+ defaultValue?: string | null;
17
+ onValueChange?: (value: string | null) => void;
18
+ inputValue?: string;
19
+ defaultInputValue?: string;
20
+ onInputValueChange?: (query: string) => void;
21
+ open?: boolean;
22
+ defaultOpen?: boolean;
23
+ onOpenChange?: (open: boolean) => void;
24
+ id?: string;
25
+ name?: string;
26
+ form?: string;
27
+ required?: boolean;
28
+ disabled?: boolean;
29
+ readOnly?: boolean;
30
+ hint?: string;
31
+ error?: string;
32
+ hideLabel?: boolean;
33
+ loading?: boolean;
34
+ /** Search/service failure, distinct from field validation. Results are hidden until retry succeeds. */
35
+ searchError?: string;
36
+ onRetry?: () => void;
37
+ loadingText?: string;
38
+ emptyText?: string;
39
+ retryLabel?: string;
40
+ triggerLabel?: string;
41
+ missingValueText?: string;
42
+ inputProps?: InputPart;
43
+ popupProps?: NativePartProps<"div">;
44
+ rootProps?: NativePartProps<"div">;
45
+ };
46
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -5,5 +5,6 @@ export type CountUpProps = {
5
5
  /** Pads to this many digits, e.g. 2 renders 05. */
6
6
  digits?: number;
7
7
  suffix?: string;
8
+ formatValue?: (value: number) => string;
8
9
  };
9
- export default function CountUp({ to, duration, digits, suffix, }: CountUpProps): import("react").JSX.Element;
10
+ export default function CountUp({ to, duration, digits, suffix, formatValue, }: CountUpProps): import("react").JSX.Element;
@@ -1,10 +1,11 @@
1
1
  "use client";
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { ccx } from "../../lib/classNames.js";
3
4
  /** Number that counts up the first time it scrolls into view; screen readers get the final value. */
4
5
  import { useEffect, useRef, useState } from "react";
5
6
  import { motionDisabledFor } from "../../lib/motion.js";
6
7
  const easeOutCubic = (progress) => 1 - (1 - progress) ** 3;
7
- export default function CountUp({ to, duration = 1400, digits = 0, suffix = "", }) {
8
+ export default function CountUp({ to, duration = 1400, digits = 0, suffix = "", formatValue, }) {
8
9
  const ref = useRef(null);
9
10
  const [current, setCurrent] = useState(0);
10
11
  useEffect(() => {
@@ -46,6 +47,8 @@ export default function CountUp({ to, duration = 1400, digits = 0, suffix = "",
46
47
  cancelAnimationFrame(frame);
47
48
  };
48
49
  }, [to, duration]);
49
- const format = (value) => `${String(value).padStart(digits, "0")}${suffix}`;
50
- return (_jsxs("span", { ref: ref, className: "count-up", children: [_jsx("span", { "aria-hidden": "true", children: format(current) }), _jsx("span", { className: "visually-hidden", children: format(to) })] }));
50
+ const format = (value) => formatValue
51
+ ? formatValue(value)
52
+ : `${String(value).padStart(digits, "0")}${suffix}`;
53
+ return (_jsxs("span", { ref: ref, className: ccx("count-up"), children: [_jsx("span", { "aria-hidden": "true", children: format(current) }), _jsx("span", { className: ccx("visually-hidden"), children: format(to) })] }));
51
54
  }
@@ -5,6 +5,7 @@ export type TableColumn<Row> = {
5
5
  header: string;
6
6
  align?: "start" | "end";
7
7
  sortable?: boolean;
8
+ compare?: (a: Row, b: Row) => number;
8
9
  render?: (row: Row) => ReactNode;
9
10
  };
10
11
  export type DataTableProps<Row> = {
@@ -1,25 +1,30 @@
1
1
  "use client";
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { ccx } from "../../lib/classNames.js";
3
4
  /** Editorial data table with mono headers, optional column sorting, and horizontal scroll on small screens. */
4
5
  import { useMemo, useState } from "react";
6
+ import Table from "./Table.js";
5
7
  import { ArrowDown, ArrowUp } from "lucide-react";
6
8
  export default function DataTable({ caption, columns, rows, rowKey, }) {
7
9
  const [sort, setSort] = useState(null);
8
10
  const sortedRows = useMemo(() => {
9
11
  if (!sort)
10
12
  return rows;
13
+ const compare = columns.find((column) => column.key === sort.key)?.compare;
11
14
  const factor = sort.direction === "ascending" ? 1 : -1;
12
- return [...rows].sort((a, b) => a[sort.key] > b[sort.key]
13
- ? factor
14
- : a[sort.key] < b[sort.key]
15
- ? -factor
16
- : 0);
17
- }, [rows, sort]);
15
+ return [...rows].sort((a, b) => compare
16
+ ? factor * compare(a, b)
17
+ : a[sort.key] > b[sort.key]
18
+ ? factor
19
+ : a[sort.key] < b[sort.key]
20
+ ? -factor
21
+ : 0);
22
+ }, [rows, sort, columns]);
18
23
  const toggleSort = (key) => setSort((current) => current?.key === key && current.direction === "ascending"
19
24
  ? { key, direction: "descending" }
20
25
  : { key, direction: "ascending" });
21
- return (_jsx("div", { className: "table-scroll", tabIndex: 0, role: "region", "aria-label": caption, children: _jsxs("table", { className: "data-table", children: [_jsx("caption", { className: "visually-hidden", children: caption }), _jsx("thead", { className: "mono", children: _jsx("tr", { children: columns.map((column) => {
22
- const direction = sort?.key === column.key ? sort.direction : undefined;
23
- return (_jsx("th", { scope: "col", "aria-sort": column.sortable ? (direction ?? "none") : undefined, "data-align": column.align, children: column.sortable ? (_jsxs("button", { type: "button", onClick: () => toggleSort(column.key), children: [column.header, direction === "descending" ? (_jsx(ArrowDown, { size: 12, "aria-hidden": "true" })) : (_jsx(ArrowUp, { size: 12, "aria-hidden": "true", className: direction ? undefined : "data-table-idle" }))] })) : (column.header) }, column.key));
24
- }) }) }), _jsx("tbody", { children: sortedRows.map((row) => (_jsx("tr", { children: columns.map((column) => (_jsx("td", { "data-align": column.align, children: column.render ? column.render(row) : row[column.key] }, column.key))) }, String(row[rowKey])))) })] }) }));
26
+ return (_jsxs(Table, { caption: caption, children: [_jsx("thead", { className: ccx("mono"), children: _jsx("tr", { children: columns.map((column) => {
27
+ const direction = sort?.key === column.key ? sort.direction : undefined;
28
+ return (_jsx("th", { scope: "col", "aria-sort": column.sortable ? (direction ?? "none") : undefined, "data-align": column.align, children: column.sortable ? (_jsxs("button", { type: "button", onClick: () => toggleSort(column.key), children: [column.header, direction === "descending" ? (_jsx(ArrowDown, { size: 12, "aria-hidden": "true" })) : (_jsx(ArrowUp, { size: 12, "aria-hidden": "true", className: ccx(direction ? undefined : "data-table-idle") }))] })) : (column.header) }, column.key));
29
+ }) }) }), _jsx("tbody", { children: sortedRows.map((row) => (_jsx("tr", { children: columns.map((column) => (_jsx("td", { "data-align": column.align, children: column.render ? column.render(row) : row[column.key] }, column.key))) }, String(row[rowKey])))) })] }));
25
30
  }
@@ -2,8 +2,8 @@
2
2
  import { jsx as _jsx } from "react/jsx-runtime";
3
3
  /** Physical, layered button that presses down into its base (CSS 3D depth). */
4
4
  import { forwardRef } from "react";
5
- import { cx } from "../../lib/classNames.js";
5
+ import { ccx } from "../../lib/classNames.js";
6
6
  const DepthButton = forwardRef(function DepthButton({ children, className, type = "button", ...rest }, ref) {
7
- return (_jsx("button", { ref: ref, ...rest, type: type, className: cx("depth-button", className), children: _jsx("span", { className: "depth-button-face", children: children }) }));
7
+ return (_jsx("button", { ref: ref, ...rest, type: type, className: ccx("depth-button", className), children: _jsx("span", { className: ccx("depth-button-face"), children: children }) }));
8
8
  });
9
9
  export default DepthButton;
@@ -1,5 +1,5 @@
1
1
  /** Native controlled modal, with refs and props for its existing DOM parts. */
2
- import { type ReactNode } from "react";
2
+ import { type RefObject, type ReactNode } from "react";
3
3
  import type { NativePartProps } from "../../lib/componentProps.js";
4
4
  export type DialogProps = Omit<NativePartProps<"dialog">, "ref" | "open" | "onClose" | "title"> & {
5
5
  open: boolean;
@@ -9,6 +9,8 @@ export type DialogProps = Omit<NativePartProps<"dialog">, "ref" | "open" | "onCl
9
9
  description?: string;
10
10
  footer?: ReactNode;
11
11
  placement?: "center" | "left" | "right";
12
+ initialFocus?: RefObject<HTMLElement | null>;
13
+ onOpenAutoFocus?: (event: Event) => void;
12
14
  panelProps?: NativePartProps<"div">;
13
15
  bodyProps?: NativePartProps<"div">;
14
16
  footerProps?: NativePartProps<"footer">;
@@ -22,6 +24,8 @@ declare const Dialog: import("react").ForwardRefExoticComponent<Omit<NativePartP
22
24
  description?: string;
23
25
  footer?: ReactNode;
24
26
  placement?: "center" | "left" | "right";
27
+ initialFocus?: RefObject<HTMLElement | null>;
28
+ onOpenAutoFocus?: (event: Event) => void;
25
29
  panelProps?: NativePartProps<"div">;
26
30
  bodyProps?: NativePartProps<"div">;
27
31
  footerProps?: NativePartProps<"footer">;