@opengovsg/oui 0.0.7 → 0.0.8

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 (73) hide show
  1. package/dist/cjs/badge/badge.cjs +42 -0
  2. package/dist/cjs/badge/index.cjs +8 -0
  3. package/dist/cjs/badge/use-badge.cjs +111 -0
  4. package/dist/cjs/combo-box/combo-box-fuzzy.cjs +52 -30
  5. package/dist/cjs/combo-box/combo-box-item.cjs +70 -0
  6. package/dist/cjs/combo-box/combo-box-variant-context.cjs +13 -0
  7. package/dist/cjs/combo-box/combo-box.cjs +46 -100
  8. package/dist/cjs/combo-box/index.cjs +5 -1
  9. package/dist/cjs/index.cjs +14 -3
  10. package/dist/cjs/select/index.cjs +5 -0
  11. package/dist/cjs/select/select-item.cjs +1 -0
  12. package/dist/cjs/select/select-variant-context.cjs +1 -0
  13. package/dist/cjs/system/react-utils/index.cjs +2 -0
  14. package/dist/cjs/system/react-utils/refs.cjs +12 -0
  15. package/dist/cjs/tag-field/tag-field-list.cjs +3 -2
  16. package/dist/cjs/tag-field/tag-field-trigger.cjs +1 -0
  17. package/dist/cjs/tag-field/tag-field.cjs +1 -1
  18. package/dist/esm/badge/badge.js +40 -0
  19. package/dist/esm/badge/index.js +2 -0
  20. package/dist/esm/badge/use-badge.js +109 -0
  21. package/dist/esm/combo-box/combo-box-fuzzy.js +55 -33
  22. package/dist/esm/combo-box/combo-box-item.js +68 -0
  23. package/dist/esm/combo-box/combo-box-variant-context.js +10 -0
  24. package/dist/esm/combo-box/combo-box.js +48 -101
  25. package/dist/esm/combo-box/index.js +3 -1
  26. package/dist/esm/index.js +7 -2
  27. package/dist/esm/select/index.js +2 -0
  28. package/dist/esm/select/select-item.js +1 -0
  29. package/dist/esm/select/select-variant-context.js +1 -0
  30. package/dist/esm/system/react-utils/index.js +1 -0
  31. package/dist/esm/system/react-utils/refs.js +10 -0
  32. package/dist/esm/tag-field/tag-field-list.js +3 -2
  33. package/dist/esm/tag-field/tag-field-trigger.js +1 -0
  34. package/dist/esm/tag-field/tag-field.js +1 -1
  35. package/dist/types/badge/badge.d.ts +3 -0
  36. package/dist/types/badge/badge.d.ts.map +1 -0
  37. package/dist/types/badge/index.d.ts +2 -0
  38. package/dist/types/badge/index.d.ts.map +1 -0
  39. package/dist/types/badge/use-badge.d.ts +166 -0
  40. package/dist/types/badge/use-badge.d.ts.map +1 -0
  41. package/dist/types/combo-box/combo-box-fuzzy.d.ts +12 -4
  42. package/dist/types/combo-box/combo-box-fuzzy.d.ts.map +1 -1
  43. package/dist/types/combo-box/combo-box-item.d.ts +11 -0
  44. package/dist/types/combo-box/combo-box-item.d.ts.map +1 -0
  45. package/dist/types/combo-box/combo-box-variant-context.d.ts +4 -0
  46. package/dist/types/combo-box/combo-box-variant-context.d.ts.map +1 -0
  47. package/dist/types/combo-box/combo-box.d.ts +5 -21
  48. package/dist/types/combo-box/combo-box.d.ts.map +1 -1
  49. package/dist/types/combo-box/index.d.ts +2 -0
  50. package/dist/types/combo-box/index.d.ts.map +1 -1
  51. package/dist/types/index.d.mts +1 -0
  52. package/dist/types/index.d.ts +1 -0
  53. package/dist/types/index.d.ts.map +1 -1
  54. package/dist/types/select/index.d.ts +2 -0
  55. package/dist/types/select/index.d.ts.map +1 -1
  56. package/dist/types/select/select-item.d.ts.map +1 -1
  57. package/dist/types/select/select-variant-context.d.ts.map +1 -1
  58. package/dist/types/system/react-utils/index.d.ts +1 -0
  59. package/dist/types/system/react-utils/index.d.ts.map +1 -1
  60. package/dist/types/system/react-utils/refs.d.ts +4 -0
  61. package/dist/types/system/react-utils/refs.d.ts.map +1 -0
  62. package/dist/types/tag-field/tag-field-list.d.ts +5 -5
  63. package/dist/types/tag-field/tag-field-list.d.ts.map +1 -1
  64. package/dist/types/tag-field/tag-field-root.d.ts +4 -4
  65. package/dist/types/tag-field/tag-field-root.d.ts.map +1 -1
  66. package/dist/types/tag-field/tag-field-tag-list.d.ts +2 -3
  67. package/dist/types/tag-field/tag-field-tag-list.d.ts.map +1 -1
  68. package/dist/types/tag-field/tag-field-trigger.d.ts.map +1 -1
  69. package/dist/types/tag-field/tag-field.d.ts +2 -2
  70. package/dist/types/tag-field/tag-field.d.ts.map +1 -1
  71. package/dist/types/tag-field/types.d.ts +0 -5
  72. package/dist/types/tag-field/types.d.ts.map +1 -1
  73. package/package.json +6 -5
@@ -3,8 +3,10 @@
3
3
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
4
4
  import { useMemo, useCallback } from 'react';
5
5
  import { useMessageFormatter } from 'react-aria';
6
- import { ListLayout, ComboBox as ComboBox$1, Input, Button, Virtualizer, Popover, ListBox, ListBoxItem, Text } from 'react-aria-components';
6
+ import { ListLayout, Provider, ComboBox as ComboBox$1, Input, Button, Popover, Virtualizer, ListBox } from 'react-aria-components';
7
7
  import { comboBoxItemStyles, cn, comboBoxStyles, composeTailwindRenderProps, composeRenderProps, comboBoxClearButtonStyles } from '@opengovsg/oui-theme';
8
+ import { mapPropsVariants } from '../system/utils.js';
9
+ import { ComboBoxVariantContext } from './combo-box-variant-context.js';
8
10
  import { Label, FieldGroup, Description, FieldError } from '../field/field.js';
9
11
  import ChevronUp from '../node_modules/.pnpm/lucide-react@0.475.0_react@19.0.0/node_modules/lucide-react/dist/esm/icons/chevron-up.js';
10
12
  import ChevronDown from '../node_modules/.pnpm/lucide-react@0.475.0_react@19.0.0/node_modules/lucide-react/dist/esm/icons/chevron-down.js';
@@ -54,38 +56,43 @@ function ComboBoxEmptyState({
54
56
  }
55
57
  );
56
58
  }
57
- function ComboBox({
58
- label,
59
- description,
60
- errorMessage,
61
- classNames,
62
- itemClassNames,
63
- size,
64
- listLayoutOptions,
65
- children,
66
- dependencies,
67
- onClear,
68
- renderEmptyState: renderEmptyStateProp,
69
- ...props
70
- }) {
59
+ function ComboBox(originalProps) {
71
60
  const formatMessage = useMessageFormatter(i18nStrings);
72
- const styles = comboBoxStyles({ size });
61
+ const [_props, variantProps] = mapPropsVariants(
62
+ originalProps,
63
+ comboBoxStyles.variantKeys
64
+ );
65
+ const {
66
+ label,
67
+ description,
68
+ errorMessage,
69
+ classNames,
70
+ listLayoutOptions,
71
+ children,
72
+ dependencies,
73
+ onClear,
74
+ renderEmptyState: renderEmptyStateProp,
75
+ ...props
76
+ } = _props;
77
+ const styles = comboBoxStyles(variantProps);
73
78
  const layout = useMemo(() => {
74
79
  return new ListLayout({
75
- estimatedRowHeight: calculateEstimatedRowHeight(size ?? "md"),
80
+ estimatedRowHeight: calculateEstimatedRowHeight(
81
+ variantProps.size ?? "md"
82
+ ),
76
83
  ...listLayoutOptions
77
84
  });
78
- }, [listLayoutOptions, size]);
85
+ }, [listLayoutOptions, variantProps.size]);
79
86
  const renderEmptyState = useCallback(
80
87
  (props2) => {
81
88
  if (renderEmptyStateProp) {
82
89
  return renderEmptyStateProp(props2);
83
90
  }
84
- return /* @__PURE__ */ jsx(ComboBoxEmptyState, { size, className: classNames?.emptyState });
91
+ return /* @__PURE__ */ jsx(ComboBoxEmptyState, { className: classNames?.emptyState });
85
92
  },
86
- [classNames?.emptyState, renderEmptyStateProp, size]
93
+ [classNames?.emptyState, renderEmptyStateProp]
87
94
  );
88
- return /* @__PURE__ */ jsx(
95
+ return /* @__PURE__ */ jsx(Provider, { values: [[ComboBoxVariantContext, variantProps]], children: /* @__PURE__ */ jsx(
89
96
  ComboBox$1,
90
97
  {
91
98
  className: composeTailwindRenderProps(
@@ -94,13 +101,14 @@ function ComboBox({
94
101
  ),
95
102
  shouldFocusWrap: true,
96
103
  allowsEmptyCollection: true,
104
+ isDisabled: variantProps.isDisabled,
97
105
  ...props,
98
106
  children: ({ isOpen, isDisabled: isComboBoxDisabled }) => /* @__PURE__ */ jsxs(Fragment, { children: [
99
107
  /* @__PURE__ */ jsx(
100
108
  Label,
101
109
  {
102
- size,
103
- className: styles.label({ className: classNames?.label, size }),
110
+ size: variantProps.size,
111
+ className: styles.label({ className: classNames?.label }),
104
112
  children: label
105
113
  }
106
114
  ),
@@ -108,12 +116,12 @@ function ComboBox({
108
116
  /* @__PURE__ */ jsxs(
109
117
  FieldGroup,
110
118
  {
119
+ isDisabled: isComboBoxDisabled,
111
120
  className: composeRenderProps(
112
121
  classNames?.group,
113
122
  (className, renderProps) => styles.group({
114
123
  ...renderProps,
115
124
  className,
116
- size,
117
125
  isClearable: !!onClear
118
126
  })
119
127
  ),
@@ -123,7 +131,7 @@ function ComboBox({
123
131
  {
124
132
  className: composeRenderProps(
125
133
  classNames?.field,
126
- (className, renderProps) => styles.field({ ...renderProps, className, size })
134
+ (className, renderProps) => styles.field({ ...renderProps, className })
127
135
  )
128
136
  }
129
137
  ),
@@ -132,22 +140,20 @@ function ComboBox({
132
140
  {
133
141
  className: composeRenderProps(
134
142
  classNames?.expandButton,
135
- (className, renderProps) => styles.expandButton({ ...renderProps, className, size })
143
+ (className, renderProps) => styles.expandButton({ ...renderProps, className })
136
144
  ),
137
145
  children: isOpen ? /* @__PURE__ */ jsx(
138
146
  ChevronUp,
139
147
  {
140
148
  className: styles.icon({
141
- className: classNames?.icon,
142
- size
149
+ className: classNames?.icon
143
150
  })
144
151
  }
145
152
  ) : /* @__PURE__ */ jsx(
146
153
  ChevronDown,
147
154
  {
148
155
  className: styles.icon({
149
- className: classNames?.icon,
150
- size
156
+ className: classNames?.icon
151
157
  })
152
158
  }
153
159
  )
@@ -166,35 +172,33 @@ function ComboBox({
166
172
  className: composeRenderProps(
167
173
  classNames?.clearButton,
168
174
  (className, renderProps) => comboBoxClearButtonStyles({
175
+ ...variantProps,
169
176
  ...renderProps,
170
177
  className,
171
- size,
172
- isInactive: !props.inputValue,
173
- isDisabled: renderProps.isDisabled
178
+ isInactive: !props.inputValue
174
179
  })
175
180
  ),
176
181
  children: /* @__PURE__ */ jsx(
177
182
  X,
178
183
  {
179
184
  className: styles.icon({
180
- className: classNames?.icon,
181
- size
185
+ className: classNames?.icon
182
186
  })
183
187
  }
184
188
  )
185
189
  }
186
190
  )
187
191
  ] }),
188
- description && /* @__PURE__ */ jsx(Description, { size, children: description }),
189
- /* @__PURE__ */ jsx(FieldError, { size, children: errorMessage }),
190
- /* @__PURE__ */ jsx(Virtualizer, { layout, children: /* @__PURE__ */ jsx(
192
+ description && /* @__PURE__ */ jsx(Description, { size: variantProps.size, children: description }),
193
+ /* @__PURE__ */ jsx(FieldError, { size: variantProps.size, children: errorMessage }),
194
+ /* @__PURE__ */ jsx(
191
195
  Popover,
192
196
  {
193
197
  className: composeRenderProps(
194
198
  classNames?.popover,
195
199
  (className, renderProps) => styles.popover({ ...renderProps, className })
196
200
  ),
197
- children: /* @__PURE__ */ jsx(
201
+ children: /* @__PURE__ */ jsx(Virtualizer, { layout, children: /* @__PURE__ */ jsx(
198
202
  ListBox,
199
203
  {
200
204
  className: composeRenderProps(
@@ -203,71 +207,14 @@ function ComboBox({
203
207
  ),
204
208
  dependencies,
205
209
  renderEmptyState,
206
- children: (item) => {
207
- if (children) {
208
- return children(item);
209
- }
210
- return /* @__PURE__ */ jsx(
211
- ComboBoxItem,
212
- {
213
- size,
214
- id: item.value,
215
- label: item.name,
216
- textValue: item.name,
217
- description: item.description,
218
- classNames: itemClassNames
219
- }
220
- );
221
- }
210
+ children
222
211
  }
223
- )
212
+ ) })
224
213
  }
225
- ) })
214
+ )
226
215
  ] })
227
216
  }
228
- );
229
- }
230
- function ComboBoxItem({
231
- className,
232
- size,
233
- description,
234
- label,
235
- classNames,
236
- ...props
237
- }) {
238
- const styles = comboBoxItemStyles({ size });
239
- return /* @__PURE__ */ jsx(
240
- ListBoxItem,
241
- {
242
- ...props,
243
- className: composeRenderProps(
244
- className ?? classNames?.container,
245
- (className2, renderProps) => styles.container({ ...renderProps, className: className2 })
246
- ),
247
- children: (renderProps) => {
248
- return /* @__PURE__ */ jsxs(Fragment, { children: [
249
- /* @__PURE__ */ jsx(
250
- Text,
251
- {
252
- className: styles.label({ className: classNames?.label }),
253
- slot: "label",
254
- children: typeof label === "function" ? label(renderProps) : label
255
- }
256
- ),
257
- description && /* @__PURE__ */ jsx(
258
- Text,
259
- {
260
- className: styles.description({
261
- className: classNames?.description
262
- }),
263
- slot: "description",
264
- children: typeof description === "function" ? description(renderProps) : description
265
- }
266
- )
267
- ] });
268
- }
269
- }
270
- );
217
+ ) });
271
218
  }
272
219
 
273
- export { ComboBox, ComboBoxEmptyState, ComboBoxItem };
220
+ export { ComboBox, ComboBoxEmptyState };
@@ -1,3 +1,5 @@
1
1
  "use strict";
2
- export { ComboBox, ComboBoxEmptyState, ComboBoxItem } from './combo-box.js';
2
+ export { ComboBox, ComboBoxEmptyState } from './combo-box.js';
3
3
  export { ComboBoxFuzzy } from './combo-box-fuzzy.js';
4
+ export { ComboBoxItem } from './combo-box-item.js';
5
+ export { ComboBoxVariantContext, useComboBoxVariantContext } from './combo-box-variant-context.js';
package/dist/esm/index.js CHANGED
@@ -1,4 +1,5 @@
1
1
  "use strict";
2
+ export { Input } from './input/input.js';
2
3
  export { useControllableState } from './hooks/use-controllable-state.js';
3
4
  export { Button } from './button/button.js';
4
5
  export { GovtBanner } from './govt-banner/govt-banner.js';
@@ -8,13 +9,17 @@ export { Spinner } from './spinner/spinner.js';
8
9
  export { useSpinner } from './spinner/use-spinner.js';
9
10
  export { Toggle } from './toggle/toggle.js';
10
11
  export { SkipNavLink } from './skip-nav-link/skip-nav-link.js';
11
- export { Input } from './input/input.js';
12
12
  export { TextField } from './text-field/text-field.js';
13
13
  export { Description, FieldError, FieldGroup, Label } from './field/field.js';
14
14
  export { TextArea } from './text-area/text-area.js';
15
15
  export { TextAreaField } from './text-area-field/text-area-field.js';
16
- export { ComboBox, ComboBoxEmptyState, ComboBoxItem } from './combo-box/combo-box.js';
16
+ export { ComboBox, ComboBoxEmptyState } from './combo-box/combo-box.js';
17
17
  export { ComboBoxFuzzy } from './combo-box/combo-box-fuzzy.js';
18
+ export { ComboBoxItem } from './combo-box/combo-box-item.js';
19
+ export { ComboBoxVariantContext, useComboBoxVariantContext } from './combo-box/combo-box-variant-context.js';
18
20
  export { Banner } from './banner/banner.js';
19
21
  export { TagField } from './tag-field/tag-field.js';
20
22
  export { Select } from './select/select.js';
23
+ export { SelectItem } from './select/select-item.js';
24
+ export { SelectVariantContext, useSelectVariantContext } from './select/select-variant-context.js';
25
+ export { Badge } from './badge/badge.js';
@@ -1,2 +1,4 @@
1
1
  "use strict";
2
2
  export { Select } from './select.js';
3
+ export { SelectItem } from './select-item.js';
4
+ export { SelectVariantContext, useSelectVariantContext } from './select-variant-context.js';
@@ -1,4 +1,5 @@
1
1
  "use strict";
2
+ "use client";
2
3
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
3
4
  import { useContextProps, ListBoxItem } from 'react-aria-components';
4
5
  import { selectItemStyles, composeRenderProps } from '@opengovsg/oui-theme';
@@ -1,4 +1,5 @@
1
1
  "use strict";
2
+ "use client";
2
3
  import { createContext } from '../system/react-utils/context.js';
3
4
 
4
5
  const [SelectVariantContext, useSelectVariantContext] = createContext({
@@ -1,2 +1,3 @@
1
1
  "use strict";
2
2
  export { createContext } from './context.js';
3
+ export { useDomRef } from './refs.js';
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ import { useRef, useImperativeHandle } from 'react';
3
+
4
+ function useDomRef(ref) {
5
+ const domRef = useRef(null);
6
+ useImperativeHandle(ref, () => domRef.current);
7
+ return domRef;
8
+ }
9
+
10
+ export { useDomRef };
@@ -1,4 +1,5 @@
1
1
  "use strict";
2
+ "use client";
2
3
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
3
4
  import { createContext, useContext, createElement } from 'react';
4
5
  import { useContextProps } from 'react-aria-components';
@@ -54,8 +55,8 @@ const TagFieldListInner = (props, ref) => {
54
55
  item,
55
56
  isHighlighted: highlightedIndex === virtualRow.index,
56
57
  key: virtualRow.key,
57
- ...itemProps,
58
- classNames: itemClassNames
58
+ itemClassNames,
59
+ ...itemProps
59
60
  };
60
61
  if (typeof props.children === "function") {
61
62
  return props.children(childProps);
@@ -1,4 +1,5 @@
1
1
  "use strict";
2
+ "use client";
2
3
  import { jsx } from 'react/jsx-runtime';
3
4
  import { createContext } from 'react';
4
5
  import { useContextProps } from 'react-aria-components';
@@ -4,13 +4,13 @@ import { jsxs, jsx } from 'react/jsx-runtime';
4
4
  import { createElement } from 'react';
5
5
  import { composeRenderProps, Popover } from 'react-aria-components';
6
6
  import { tagFieldStyles } from '@opengovsg/oui-theme';
7
+ import { Input } from '../input/input.js';
7
8
  import { TagFieldList, TagFieldListItem } from './tag-field-list.js';
8
9
  import { TagFieldRoot } from './tag-field-root.js';
9
10
  import { TagFieldTagList } from './tag-field-tag-list.js';
10
11
  import { TagFieldTrigger } from './tag-field-trigger.js';
11
12
  import ChevronDown from '../node_modules/.pnpm/lucide-react@0.475.0_react@19.0.0/node_modules/lucide-react/dist/esm/icons/chevron-down.js';
12
13
  import { Label, FieldGroup, Description, FieldError } from '../field/field.js';
13
- import { Input } from '../input/input.js';
14
14
 
15
15
  function TagField({
16
16
  classNames,
@@ -0,0 +1,3 @@
1
+ import type { UseBadgeProps } from "./use-badge";
2
+ export declare const Badge: import("react").ForwardRefExoticComponent<Omit<UseBadgeProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
3
+ //# sourceMappingURL=badge.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"badge.d.ts","sourceRoot":"","sources":["../../../src/badge/badge.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAGhD,eAAO,MAAM,KAAK,uHAwChB,CAAA"}
@@ -0,0 +1,2 @@
1
+ export * from "./badge";
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/badge/index.tsx"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAA"}
@@ -0,0 +1,166 @@
1
+ import type { PressEvent } from "@react-types/shared";
2
+ import type { ReactNode } from "react";
3
+ import type { BadgeSlots, BadgeVariantProps, SlotsToClasses } from "@opengovsg/oui-theme";
4
+ import type { ReactRef } from "../system/react-utils";
5
+ import type { HtmlUiProps, PropGetter } from "../system/types";
6
+ export interface UseBadgeProps extends HtmlUiProps, BadgeVariantProps {
7
+ ref?: ReactRef<HTMLDivElement | null>;
8
+ /**
9
+ * Element to be rendered in the left side of the badge.
10
+ */
11
+ startContent?: React.ReactNode;
12
+ /**
13
+ * Element to be rendered in the right side of the badge.
14
+ * if you pass this prop and the `onClose` prop, the passed element
15
+ * will have the close button props and it will be rendered instead of the
16
+ * default close button.
17
+ */
18
+ endContent?: React.ReactNode;
19
+ /**
20
+ * Classname or List of classes to change the classNames of the element.
21
+ * if `className` is passed, it will be added to the base slot.
22
+ *
23
+ * @example
24
+ * ```ts
25
+ * <Badge classNames={{
26
+ * base:"base-classes",
27
+ * dot: "dot-classes",
28
+ * content: "content-classes",
29
+ * closeButton: "close-button-classes",
30
+ * }} />
31
+ * ```
32
+ */
33
+ classNames?: SlotsToClasses<BadgeSlots | "closeButton">;
34
+ /**
35
+ * Callback fired when the badge is closed. if you pass this prop,
36
+ * the badge will display a close button in the `endContent` slot.
37
+ * @param e PressEvent
38
+ */
39
+ onClose?: (e: PressEvent) => void;
40
+ }
41
+ export declare function useBadge(originalProps: UseBadgeProps): {
42
+ Component: import("../system/types").As<any>;
43
+ children: ReactNode;
44
+ slots: {
45
+ closeButton: import("tailwind-variants").TVReturnType<{
46
+ size: {
47
+ xs: string;
48
+ sm: string;
49
+ md: string;
50
+ };
51
+ }, undefined, string, {
52
+ responsiveVariants?: boolean | (string | number | symbol)[] | {
53
+ size?: boolean | (string | number | symbol)[] | undefined;
54
+ isFocusVisible?: boolean | (string | number | symbol)[] | undefined;
55
+ } | undefined;
56
+ } & import("tailwind-variants/dist/config.js").TWMConfig & {
57
+ twMergeConfig: {
58
+ extend: {
59
+ theme: {};
60
+ classGroups: {
61
+ prose: {
62
+ prose: (() => boolean)[];
63
+ }[];
64
+ };
65
+ };
66
+ };
67
+ }, {
68
+ isFocusVisible: {
69
+ false: string;
70
+ true: string;
71
+ };
72
+ }, undefined, import("tailwind-variants").TVReturnType<{
73
+ isFocusVisible: {
74
+ false: string;
75
+ true: string;
76
+ };
77
+ }, undefined, "outline-offset-2 outline-none", {
78
+ responsiveVariants?: boolean | (string | number | symbol)[] | {
79
+ isFocusVisible?: boolean | (string | number | symbol)[] | undefined;
80
+ } | undefined;
81
+ } & import("tailwind-variants/dist/config.js").TWMConfig & {
82
+ twMergeConfig: {
83
+ extend: {
84
+ theme: {};
85
+ classGroups: {
86
+ prose: {
87
+ prose: (() => boolean)[];
88
+ }[];
89
+ };
90
+ };
91
+ };
92
+ }, {
93
+ isFocusVisible: {
94
+ false: string;
95
+ true: string;
96
+ };
97
+ }, undefined, import("tailwind-variants").TVReturnType<{
98
+ isFocusVisible: {
99
+ false: string;
100
+ true: string;
101
+ };
102
+ }, undefined, "outline-offset-2 outline-none", import("tailwind-variants/dist/config.js").TVConfig<{
103
+ isFocusVisible: {
104
+ false: string;
105
+ true: string;
106
+ };
107
+ }, {
108
+ isFocusVisible: {
109
+ false: string;
110
+ true: string;
111
+ };
112
+ }>, unknown, unknown, undefined>>>;
113
+ base: ((slotProps?: ({
114
+ size?: "md" | "sm" | "xs" | undefined;
115
+ color?: "sub" | "main" | "neutral" | "critical" | "warning" | "success" | undefined;
116
+ radius?: "lg" | "md" | "sm" | "none" | "full" | undefined;
117
+ variant?: "solid" | "outline" | "dot" | "subtle" | undefined;
118
+ isDisabled?: boolean | undefined;
119
+ isCloseable?: boolean | undefined;
120
+ } & import("tailwind-variants").ClassProp<import("tailwind-variants").ClassValue>) | undefined) => string) & ((slotProps?: ({
121
+ size?: "md" | "sm" | "xs" | undefined;
122
+ color?: "sub" | "main" | "neutral" | "critical" | "warning" | "success" | undefined;
123
+ radius?: "lg" | "md" | "sm" | "none" | "full" | undefined;
124
+ variant?: "solid" | "outline" | "dot" | "subtle" | undefined;
125
+ isDisabled?: boolean | undefined;
126
+ isCloseable?: boolean | undefined;
127
+ } & import("tailwind-variants").ClassProp<import("tailwind-variants").ClassValue>) | undefined) => string);
128
+ dot: ((slotProps?: ({
129
+ size?: "md" | "sm" | "xs" | undefined;
130
+ color?: "sub" | "main" | "neutral" | "critical" | "warning" | "success" | undefined;
131
+ radius?: "lg" | "md" | "sm" | "none" | "full" | undefined;
132
+ variant?: "solid" | "outline" | "dot" | "subtle" | undefined;
133
+ isDisabled?: boolean | undefined;
134
+ isCloseable?: boolean | undefined;
135
+ } & import("tailwind-variants").ClassProp<import("tailwind-variants").ClassValue>) | undefined) => string) & ((slotProps?: ({
136
+ size?: "md" | "sm" | "xs" | undefined;
137
+ color?: "sub" | "main" | "neutral" | "critical" | "warning" | "success" | undefined;
138
+ radius?: "lg" | "md" | "sm" | "none" | "full" | undefined;
139
+ variant?: "solid" | "outline" | "dot" | "subtle" | undefined;
140
+ isDisabled?: boolean | undefined;
141
+ isCloseable?: boolean | undefined;
142
+ } & import("tailwind-variants").ClassProp<import("tailwind-variants").ClassValue>) | undefined) => string);
143
+ content: ((slotProps?: ({
144
+ size?: "md" | "sm" | "xs" | undefined;
145
+ color?: "sub" | "main" | "neutral" | "critical" | "warning" | "success" | undefined;
146
+ radius?: "lg" | "md" | "sm" | "none" | "full" | undefined;
147
+ variant?: "solid" | "outline" | "dot" | "subtle" | undefined;
148
+ isDisabled?: boolean | undefined;
149
+ isCloseable?: boolean | undefined;
150
+ } & import("tailwind-variants").ClassProp<import("tailwind-variants").ClassValue>) | undefined) => string) & ((slotProps?: ({
151
+ size?: "md" | "sm" | "xs" | undefined;
152
+ color?: "sub" | "main" | "neutral" | "critical" | "warning" | "success" | undefined;
153
+ radius?: "lg" | "md" | "sm" | "none" | "full" | undefined;
154
+ variant?: "solid" | "outline" | "dot" | "subtle" | undefined;
155
+ isDisabled?: boolean | undefined;
156
+ isCloseable?: boolean | undefined;
157
+ } & import("tailwind-variants").ClassProp<import("tailwind-variants").ClassValue>) | undefined) => string);
158
+ };
159
+ classNames: SlotsToClasses<"content" | "base" | "dot" | "closeButton"> | undefined;
160
+ isCloseable: boolean;
161
+ startContent: import("react").DetailedReactHTMLElement<import("react").HTMLAttributes<HTMLElement>, HTMLElement> | null;
162
+ endContent: import("react").DetailedReactHTMLElement<import("react").HTMLAttributes<HTMLElement>, HTMLElement> | null;
163
+ getCloseButtonProps: PropGetter;
164
+ getChipProps: PropGetter;
165
+ };
166
+ //# sourceMappingURL=use-badge.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-badge.d.ts","sourceRoot":"","sources":["../../../src/badge/use-badge.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAA;AACrD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAOtC,OAAO,KAAK,EACV,UAAU,EACV,iBAAiB,EACjB,cAAc,EACf,MAAM,sBAAsB,CAAA;AAG7B,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AACrD,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAI9D,MAAM,WAAW,aAAc,SAAQ,WAAW,EAAE,iBAAiB;IACnE,GAAG,CAAC,EAAE,QAAQ,CAAC,cAAc,GAAG,IAAI,CAAC,CAAA;IACrC;;OAEG;IACH,YAAY,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAC9B;;;;;OAKG;IACH,UAAU,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAE5B;;;;;;;;;;;;;OAaG;IACH,UAAU,CAAC,EAAE,cAAc,CAAC,UAAU,GAAG,aAAa,CAAC,CAAA;IACvD;;;;OAIG;IACH,OAAO,CAAC,EAAE,CAAC,CAAC,EAAE,UAAU,KAAK,IAAI,CAAA;CAClC;AAiBD,wBAAgB,QAAQ,CAAC,aAAa,EAAE,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAiGpD"}
@@ -1,12 +1,20 @@
1
+ import type { Key } from "react-aria";
1
2
  import type { SetRequired } from "type-fest";
2
- import type { SlotsToClasses } from "@opengovsg/oui-theme";
3
+ import type { ComboBoxItemSlots, SlotsToClasses } from "@opengovsg/oui-theme";
3
4
  import type { ComboBoxProps } from "./combo-box";
4
- import { ComboBoxItem } from "./combo-box";
5
+ import { ComboBoxItem } from "./combo-box-item";
6
+ type ComboBoxItem = {
7
+ id: Key;
8
+ textValue: string;
9
+ description?: string;
10
+ };
5
11
  export interface ComboBoxFuzzyProps<T extends ComboBoxItem = ComboBoxItem> extends SetRequired<ComboBoxProps<T>, "inputValue" | "onInputChange" | "onSelectionChange" | "selectedKey" | "items"> {
6
- itemClassNames?: ComboBoxProps<T>["itemClassNames"] & SlotsToClasses<"highlight">;
12
+ itemClassNames?: SlotsToClasses<ComboBoxItemSlots> & SlotsToClasses<"highlight">;
7
13
  }
8
14
  /**
9
15
  * Controlled variant of ComboBox, allows for fuzzy search and item highlight.
16
+ * @deprecated Use ComboBox instead (and bring your own fuzzysearch).
10
17
  */
11
- export declare function ComboBoxFuzzy<T extends ComboBoxItem = ComboBoxItem>({ items, itemClassNames, onSelectionChange: onSelectionChangeProp, onInputChange: onInputChangeProp, ...props }: ComboBoxFuzzyProps<T>): import("react/jsx-runtime").JSX.Element;
18
+ export declare function ComboBoxFuzzy<T extends ComboBoxItem = ComboBoxItem>(originalProps: ComboBoxFuzzyProps<T>): import("react/jsx-runtime").JSX.Element;
19
+ export {};
12
20
  //# sourceMappingURL=combo-box-fuzzy.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"combo-box-fuzzy.d.ts","sourceRoot":"","sources":["../../../src/combo-box/combo-box-fuzzy.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAA;AAI5C,OAAO,KAAK,EAEV,cAAc,EACf,MAAM,sBAAsB,CAAA;AAG7B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAChD,OAAO,EAAY,YAAY,EAAE,MAAM,aAAa,CAAA;AA8BpD,MAAM,WAAW,kBAAkB,CAAC,CAAC,SAAS,YAAY,GAAG,YAAY,CACvE,SAAQ,WAAW,CACjB,aAAa,CAAC,CAAC,CAAC,EACd,YAAY,GACZ,eAAe,GACf,mBAAmB,GACnB,aAAa,GACb,OAAO,CACV;IACD,cAAc,CAAC,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC,gBAAgB,CAAC,GACjD,cAAc,CAAC,WAAW,CAAC,CAAA;CAC9B;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,CAAC,SAAS,YAAY,GAAG,YAAY,EAAE,EACnE,KAAK,EACL,cAAc,EACd,iBAAiB,EAAE,qBAAqB,EACxC,aAAa,EAAE,iBAAiB,EAChC,GAAG,KAAK,EACT,EAAE,kBAAkB,CAAC,CAAC,CAAC,2CAyEvB"}
1
+ {"version":3,"file":"combo-box-fuzzy.d.ts","sourceRoot":"","sources":["../../../src/combo-box/combo-box-fuzzy.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,YAAY,CAAA;AACrC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAA;AAK5C,OAAO,KAAK,EAEV,iBAAiB,EACjB,cAAc,EACf,MAAM,sBAAsB,CAAA;AAO7B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAGhD,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AAQ/C,KAAK,YAAY,GAAG;IAClB,EAAE,EAAE,GAAG,CAAA;IACP,SAAS,EAAE,MAAM,CAAA;IACjB,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB,CAAA;AAwBD,MAAM,WAAW,kBAAkB,CAAC,CAAC,SAAS,YAAY,GAAG,YAAY,CACvE,SAAQ,WAAW,CACjB,aAAa,CAAC,CAAC,CAAC,EACd,YAAY,GACZ,eAAe,GACf,mBAAmB,GACnB,aAAa,GACb,OAAO,CACV;IACD,cAAc,CAAC,EAAE,cAAc,CAAC,iBAAiB,CAAC,GAChD,cAAc,CAAC,WAAW,CAAC,CAAA;CAC9B;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,CAAC,SAAS,YAAY,GAAG,YAAY,EACjE,aAAa,EAAE,kBAAkB,CAAC,CAAC,CAAC,2CAwGrC"}
@@ -0,0 +1,11 @@
1
+ import type { ListBoxItemProps } from "react-aria-components";
2
+ import type { ComboBoxItemSlots, ComboBoxItemVariantProps, SlotsToClasses } from "@opengovsg/oui-theme";
3
+ export interface ComboBoxItemProps extends ListBoxItemProps, ComboBoxItemVariantProps {
4
+ /**
5
+ * Description for the item, if any
6
+ */
7
+ description?: React.ReactNode;
8
+ classNames?: SlotsToClasses<ComboBoxItemSlots>;
9
+ }
10
+ export declare const ComboBoxItem: import("../system/utils").InternalForwardRefRenderFunction<import("../system/types").As, ComboBoxItemProps, never>;
11
+ //# sourceMappingURL=combo-box-item.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"combo-box-item.d.ts","sourceRoot":"","sources":["../../../src/combo-box/combo-box-item.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AAS7D,OAAO,KAAK,EACV,iBAAiB,EACjB,wBAAwB,EACxB,cAAc,EACf,MAAM,sBAAsB,CAAA;AAM7B,MAAM,WAAW,iBACf,SAAQ,gBAAgB,EACtB,wBAAwB;IAC1B;;OAEG;IACH,WAAW,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAC7B,UAAU,CAAC,EAAE,cAAc,CAAC,iBAAiB,CAAC,CAAA;CAC/C;AAED,eAAO,MAAM,YAAY,oHAgEvB,CAAA"}
@@ -0,0 +1,4 @@
1
+ import type { ContextValue } from "react-aria-components";
2
+ import type { ComboBoxVariantProps } from "@opengovsg/oui-theme";
3
+ export declare const ComboBoxVariantContext: import("react").Context<ContextValue<ComboBoxVariantProps, any>>, useComboBoxVariantContext: () => ContextValue<ComboBoxVariantProps, any>;
4
+ //# sourceMappingURL=combo-box-variant-context.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"combo-box-variant-context.d.ts","sourceRoot":"","sources":["../../../src/combo-box/combo-box-variant-context.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAA;AAEzD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAA;AAIhE,eAAO,MAAO,sBAAsB,oEAAE,yBAAyB,+CAO3D,CAAA"}