@opengovsg/oui 0.0.6 → 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 (142) 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/banner/banner.cjs +1 -1
  5. package/dist/cjs/button/button.cjs +1 -1
  6. package/dist/cjs/combo-box/combo-box-fuzzy.cjs +53 -31
  7. package/dist/cjs/combo-box/combo-box-item.cjs +70 -0
  8. package/dist/cjs/combo-box/combo-box-variant-context.cjs +13 -0
  9. package/dist/cjs/combo-box/combo-box.cjs +47 -101
  10. package/dist/cjs/combo-box/index.cjs +5 -1
  11. package/dist/cjs/field/field.cjs +1 -1
  12. package/dist/cjs/govt-banner/govt-banner.cjs +1 -1
  13. package/dist/cjs/index.cjs +16 -3
  14. package/dist/cjs/input/input.cjs +1 -1
  15. package/dist/cjs/node_modules/.pnpm/lucide-react@0.475.0_react@19.0.0/node_modules/lucide-react/dist/esm/icons/check.cjs +19 -0
  16. package/dist/cjs/node_modules/.pnpm/lucide-react@0.475.0_react@19.0.0/node_modules/lucide-react/dist/esm/icons/chevrons-up-down.cjs +22 -0
  17. package/dist/cjs/select/index.cjs +13 -0
  18. package/dist/cjs/select/select-item.cjs +64 -0
  19. package/dist/cjs/select/select-variant-context.cjs +13 -0
  20. package/dist/cjs/select/select.cjs +103 -0
  21. package/dist/cjs/spinner/use-spinner.cjs +1 -1
  22. package/dist/cjs/system/react-utils/context.cjs +1 -5
  23. package/dist/cjs/system/react-utils/index.cjs +2 -0
  24. package/dist/cjs/system/react-utils/refs.cjs +12 -0
  25. package/dist/cjs/tag-field/tag-field-list.cjs +4 -3
  26. package/dist/cjs/tag-field/tag-field-trigger.cjs +1 -0
  27. package/dist/cjs/tag-field/tag-field.cjs +2 -2
  28. package/dist/cjs/tag-field/use-tag-field.cjs +1 -0
  29. package/dist/cjs/text-area/text-area.cjs +1 -1
  30. package/dist/cjs/text-area-field/text-area-field.cjs +1 -1
  31. package/dist/cjs/text-field/text-field.cjs +1 -1
  32. package/dist/cjs/toggle/toggle.cjs +1 -1
  33. package/dist/esm/badge/badge.js +40 -0
  34. package/dist/esm/badge/index.js +2 -0
  35. package/dist/esm/badge/use-badge.js +109 -0
  36. package/dist/esm/banner/banner.js +1 -1
  37. package/dist/esm/button/button.js +1 -1
  38. package/dist/esm/combo-box/combo-box-fuzzy.js +55 -33
  39. package/dist/esm/combo-box/combo-box-item.js +68 -0
  40. package/dist/esm/combo-box/combo-box-variant-context.js +10 -0
  41. package/dist/esm/combo-box/combo-box.js +49 -102
  42. package/dist/esm/combo-box/index.js +3 -1
  43. package/dist/esm/field/field.js +1 -1
  44. package/dist/esm/govt-banner/govt-banner.js +1 -1
  45. package/dist/esm/index.js +8 -2
  46. package/dist/esm/input/input.js +1 -1
  47. package/dist/esm/node_modules/.pnpm/lucide-react@0.475.0_react@19.0.0/node_modules/lucide-react/dist/esm/icons/check.js +14 -0
  48. package/dist/esm/node_modules/.pnpm/lucide-react@0.475.0_react@19.0.0/node_modules/lucide-react/dist/esm/icons/chevrons-up-down.js +17 -0
  49. package/dist/esm/select/index.js +4 -0
  50. package/dist/esm/select/select-item.js +62 -0
  51. package/dist/esm/select/select-variant-context.js +10 -0
  52. package/dist/esm/select/select.js +101 -0
  53. package/dist/esm/spinner/use-spinner.js +1 -1
  54. package/dist/esm/system/react-utils/context.js +1 -5
  55. package/dist/esm/system/react-utils/index.js +1 -0
  56. package/dist/esm/system/react-utils/refs.js +10 -0
  57. package/dist/esm/tag-field/tag-field-list.js +4 -3
  58. package/dist/esm/tag-field/tag-field-trigger.js +1 -0
  59. package/dist/esm/tag-field/tag-field.js +2 -2
  60. package/dist/esm/tag-field/use-tag-field.js +1 -0
  61. package/dist/esm/text-area/text-area.js +1 -1
  62. package/dist/esm/text-area-field/text-area-field.js +1 -1
  63. package/dist/esm/text-field/text-field.js +1 -1
  64. package/dist/esm/toggle/toggle.js +1 -1
  65. package/dist/types/badge/badge.d.ts +3 -0
  66. package/dist/types/badge/badge.d.ts.map +1 -0
  67. package/dist/types/badge/index.d.ts +2 -0
  68. package/dist/types/badge/index.d.ts.map +1 -0
  69. package/dist/types/badge/use-badge.d.ts +166 -0
  70. package/dist/types/badge/use-badge.d.ts.map +1 -0
  71. package/dist/types/banner/banner.d.ts +4 -3
  72. package/dist/types/banner/banner.d.ts.map +1 -1
  73. package/dist/types/button/button.d.ts +2 -11
  74. package/dist/types/button/button.d.ts.map +1 -1
  75. package/dist/types/combo-box/combo-box-fuzzy.d.ts +14 -5
  76. package/dist/types/combo-box/combo-box-fuzzy.d.ts.map +1 -1
  77. package/dist/types/combo-box/combo-box-item.d.ts +11 -0
  78. package/dist/types/combo-box/combo-box-item.d.ts.map +1 -0
  79. package/dist/types/combo-box/combo-box-variant-context.d.ts +4 -0
  80. package/dist/types/combo-box/combo-box-variant-context.d.ts.map +1 -0
  81. package/dist/types/combo-box/combo-box.d.ts +5 -21
  82. package/dist/types/combo-box/combo-box.d.ts.map +1 -1
  83. package/dist/types/combo-box/index.d.ts +2 -0
  84. package/dist/types/combo-box/index.d.ts.map +1 -1
  85. package/dist/types/field/field.d.ts +2 -2
  86. package/dist/types/field/field.d.ts.map +1 -1
  87. package/dist/types/govt-banner/govt-banner.d.ts +1 -1
  88. package/dist/types/govt-banner/govt-banner.d.ts.map +1 -1
  89. package/dist/types/index.d.mts +2 -0
  90. package/dist/types/index.d.ts +2 -0
  91. package/dist/types/index.d.ts.map +1 -1
  92. package/dist/types/input/input.d.ts +3 -2
  93. package/dist/types/input/input.d.ts.map +1 -1
  94. package/dist/types/select/index.d.ts +4 -0
  95. package/dist/types/select/index.d.ts.map +1 -0
  96. package/dist/types/select/select-item.d.ts +9 -0
  97. package/dist/types/select/select-item.d.ts.map +1 -0
  98. package/dist/types/select/select-variant-context.d.ts +4 -0
  99. package/dist/types/select/select-variant-context.d.ts.map +1 -0
  100. package/dist/types/select/select.d.ts +17 -0
  101. package/dist/types/select/select.d.ts.map +1 -0
  102. package/dist/types/skip-nav-link/skip-nav-link.d.ts +3 -2
  103. package/dist/types/skip-nav-link/skip-nav-link.d.ts.map +1 -1
  104. package/dist/types/spinner/use-spinner.d.ts +1 -1
  105. package/dist/types/spinner/use-spinner.d.ts.map +1 -1
  106. package/dist/types/system/react-utils/context.d.ts +1 -5
  107. package/dist/types/system/react-utils/context.d.ts.map +1 -1
  108. package/dist/types/system/react-utils/index.d.ts +1 -0
  109. package/dist/types/system/react-utils/index.d.ts.map +1 -1
  110. package/dist/types/system/react-utils/refs.d.ts +4 -0
  111. package/dist/types/system/react-utils/refs.d.ts.map +1 -0
  112. package/dist/types/system/types.d.ts +1 -1
  113. package/dist/types/system/types.d.ts.map +1 -1
  114. package/dist/types/system/utils.d.ts +2 -2
  115. package/dist/types/system/utils.d.ts.map +1 -1
  116. package/dist/types/tag-field/tag-field-list.d.ts +10 -10
  117. package/dist/types/tag-field/tag-field-list.d.ts.map +1 -1
  118. package/dist/types/tag-field/tag-field-root.d.ts +6 -6
  119. package/dist/types/tag-field/tag-field-root.d.ts.map +1 -1
  120. package/dist/types/tag-field/tag-field-state-context.d.ts +2 -2
  121. package/dist/types/tag-field/tag-field-state-context.d.ts.map +1 -1
  122. package/dist/types/tag-field/tag-field-tag-list.d.ts +4 -5
  123. package/dist/types/tag-field/tag-field-tag-list.d.ts.map +1 -1
  124. package/dist/types/tag-field/tag-field-trigger.d.ts +2 -2
  125. package/dist/types/tag-field/tag-field-trigger.d.ts.map +1 -1
  126. package/dist/types/tag-field/tag-field.d.ts +2 -2
  127. package/dist/types/tag-field/tag-field.d.ts.map +1 -1
  128. package/dist/types/tag-field/types.d.ts +2 -7
  129. package/dist/types/tag-field/types.d.ts.map +1 -1
  130. package/dist/types/tag-field/use-tag-field-state.d.ts +4 -4
  131. package/dist/types/tag-field/use-tag-field-state.d.ts.map +1 -1
  132. package/dist/types/tag-field/use-tag-field.d.ts +7 -7
  133. package/dist/types/tag-field/use-tag-field.d.ts.map +1 -1
  134. package/dist/types/text-area/text-area.d.ts +3 -2
  135. package/dist/types/text-area/text-area.d.ts.map +1 -1
  136. package/dist/types/text-area-field/text-area-field.d.ts +3 -3
  137. package/dist/types/text-area-field/text-area-field.d.ts.map +1 -1
  138. package/dist/types/text-field/text-field.d.ts +3 -3
  139. package/dist/types/text-field/text-field.d.ts.map +1 -1
  140. package/dist/types/toggle/toggle.d.ts +3 -2
  141. package/dist/types/toggle/toggle.d.ts.map +1 -1
  142. package/package.json +6 -5
@@ -0,0 +1,101 @@
1
+ "use strict";
2
+ "use client";
3
+ import { jsx, jsxs } from 'react/jsx-runtime';
4
+ import { useMemo } from 'react';
5
+ import { ListLayout, Provider, Select as Select$1, SelectValue, Popover, Virtualizer, ListBox } from 'react-aria-components';
6
+ import { selectStyles, composeRenderProps } from '@opengovsg/oui-theme';
7
+ import { mapPropsVariants } from '../system/utils.js';
8
+ import { SelectVariantContext } from './select-variant-context.js';
9
+ import ChevronsUpDown from '../node_modules/.pnpm/lucide-react@0.475.0_react@19.0.0/node_modules/lucide-react/dist/esm/icons/chevrons-up-down.js';
10
+ import { Label, Description } from '../field/field.js';
11
+ import { Button } from '../button/button.js';
12
+
13
+ const calculateEstimatedRowHeight = (size) => {
14
+ switch (size) {
15
+ case "xs":
16
+ return 44;
17
+ case "sm":
18
+ return 44;
19
+ case "md":
20
+ return 48;
21
+ }
22
+ };
23
+ function Select({
24
+ label,
25
+ description,
26
+ classNames,
27
+ ...originalProps
28
+ }) {
29
+ const [_props, variantProps] = mapPropsVariants(
30
+ originalProps,
31
+ selectStyles.variantKeys
32
+ );
33
+ const { items, children, listLayoutOptions, ...props } = _props;
34
+ const styles = selectStyles(variantProps);
35
+ const layout = useMemo(() => {
36
+ return new ListLayout({
37
+ estimatedRowHeight: calculateEstimatedRowHeight(
38
+ variantProps.size ?? "md"
39
+ ),
40
+ ...listLayoutOptions
41
+ });
42
+ }, [listLayoutOptions, variantProps.size]);
43
+ return /* @__PURE__ */ jsx(Provider, { values: [[SelectVariantContext, variantProps]], children: /* @__PURE__ */ jsxs(
44
+ Select$1,
45
+ {
46
+ className: composeRenderProps(
47
+ props.className,
48
+ (className, renderProps) => styles.base({ className, ...renderProps })
49
+ ),
50
+ ...props,
51
+ children: [
52
+ label && /* @__PURE__ */ jsx(Label, { size: variantProps.size, className: classNames?.label, children: label }),
53
+ /* @__PURE__ */ jsxs(
54
+ Button,
55
+ {
56
+ size: variantProps.size,
57
+ variant: variantProps.variant ?? selectStyles.defaultVariants.variant,
58
+ color: variantProps.color ?? selectStyles.defaultVariants.color,
59
+ className: composeRenderProps(
60
+ classNames?.trigger,
61
+ (className, renderProps) => styles.trigger({ className, ...renderProps })
62
+ ),
63
+ children: [
64
+ /* @__PURE__ */ jsx(
65
+ SelectValue,
66
+ {
67
+ className: styles.selectedText({
68
+ className: classNames?.selectedText
69
+ })
70
+ }
71
+ ),
72
+ /* @__PURE__ */ jsx(ChevronsUpDown, { className: "h-4 w-4" })
73
+ ]
74
+ }
75
+ ),
76
+ description && /* @__PURE__ */ jsx(
77
+ Description,
78
+ {
79
+ size: variantProps.size,
80
+ className: classNames?.description,
81
+ children: description
82
+ }
83
+ ),
84
+ /* @__PURE__ */ jsx(Popover, { className: styles.popover({ className: classNames?.popover }), children: /* @__PURE__ */ jsx(Virtualizer, { layout, children: /* @__PURE__ */ jsx(
85
+ ListBox,
86
+ {
87
+ items,
88
+ shouldFocusWrap: true,
89
+ className: composeRenderProps(
90
+ classNames?.list,
91
+ (className, renderProps) => styles.list({ className, ...renderProps })
92
+ ),
93
+ children
94
+ }
95
+ ) }) })
96
+ ]
97
+ }
98
+ ) });
99
+ }
100
+
101
+ export { Select };
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  "use client";
3
3
  import { useMemo, useCallback } from 'react';
4
- import { spinnerStyles, cn } from '@opengovsg/oui-theme';
5
4
  import { useDeepCompareMemo } from 'use-deep-compare';
5
+ import { spinnerStyles, cn } from '@opengovsg/oui-theme';
6
6
  import { mapPropsVariants } from '../system/utils.js';
7
7
 
8
8
  const useSpinner = (originalProps) => {
@@ -19,11 +19,7 @@ function createContext(options = {}) {
19
19
  }
20
20
  return context;
21
21
  }
22
- return [
23
- Context.Provider,
24
- useContext$1,
25
- Context
26
- ];
22
+ return [Context, useContext$1];
27
23
  }
28
24
 
29
25
  export { 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,8 +1,9 @@
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
- import { tagFieldItemStyles, dataAttr } from '@opengovsg/oui-theme';
5
5
  import { useContextProps } from 'react-aria-components';
6
+ import { tagFieldItemStyles, dataAttr } from '@opengovsg/oui-theme';
6
7
  import { forwardRefGeneric } from '../system/utils.js';
7
8
  import { TagFieldStateContext } from './tag-field-state-context.js';
8
9
 
@@ -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';
@@ -2,15 +2,15 @@
2
2
  "use client";
3
3
  import { jsxs, jsx } from 'react/jsx-runtime';
4
4
  import { createElement } from 'react';
5
- import { tagFieldStyles } from '@opengovsg/oui-theme';
6
5
  import { composeRenderProps, Popover } from 'react-aria-components';
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,
@@ -125,6 +125,7 @@ function useTagField(props, state) {
125
125
  });
126
126
  const { isInvalid, validationErrors, validationDetails } = state.displayValidation;
127
127
  const inputProps = getInputProps({
128
+ placeholder: props.placeholder,
128
129
  ref: inputRef,
129
130
  "aria-label": props["aria-label"],
130
131
  "aria-labelledby": props["aria-labelledby"],
@@ -2,8 +2,8 @@
2
2
  "use client";
3
3
  import { jsx } from 'react/jsx-runtime';
4
4
  import { forwardRef } from 'react';
5
- import { composeRenderProps, textAreaStyles } from '@opengovsg/oui-theme';
6
5
  import { TextArea as TextArea$1 } from 'react-aria-components';
6
+ import { composeRenderProps, textAreaStyles } from '@opengovsg/oui-theme';
7
7
 
8
8
  const TextArea = forwardRef(
9
9
  ({ size, variant, isDisabled, ...props }, ref) => {
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  "use client";
3
3
  import { jsxs, jsx } from 'react/jsx-runtime';
4
- import { composeTailwindRenderProps } from '@opengovsg/oui-theme';
5
4
  import { TextField } from 'react-aria-components';
5
+ import { composeTailwindRenderProps } from '@opengovsg/oui-theme';
6
6
  import { TextArea } from '../text-area/text-area.js';
7
7
  import { Label, Description, FieldError } from '../field/field.js';
8
8
 
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  "use client";
3
3
  import { jsxs, jsx } from 'react/jsx-runtime';
4
- import { composeTailwindRenderProps } from '@opengovsg/oui-theme';
5
4
  import { TextField as TextField$1 } from 'react-aria-components';
5
+ import { composeTailwindRenderProps } from '@opengovsg/oui-theme';
6
6
  import { Input } from '../input/input.js';
7
7
  import { Label, Description, FieldError } from '../field/field.js';
8
8
 
@@ -2,9 +2,9 @@
2
2
  "use client";
3
3
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
4
4
  import { useCallback, cloneElement } from 'react';
5
- import { toggleStyles, composeTailwindRenderProps } from '@opengovsg/oui-theme';
6
5
  import { mergeProps } from 'react-aria';
7
6
  import { Switch } from 'react-aria-components';
7
+ import { toggleStyles, composeTailwindRenderProps } from '@opengovsg/oui-theme';
8
8
  import { mapPropsVariants } from '../system/utils.js';
9
9
 
10
10
  const Toggle = ({
@@ -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,6 +1,7 @@
1
- import { ReactNode } from "react";
2
- import { BannerSlots, bannerStyles, SlotsToClasses, VariantProps } from "@opengovsg/oui-theme";
3
- import { AriaDisclosureProps } from "react-aria";
1
+ import type { ReactNode } from "react";
2
+ import type { AriaDisclosureProps } from "react-aria";
3
+ import type { BannerSlots, SlotsToClasses, VariantProps } from "@opengovsg/oui-theme";
4
+ import { bannerStyles } from "@opengovsg/oui-theme";
4
5
  interface BannerProps extends VariantProps<typeof bannerStyles>, AriaDisclosureProps {
5
6
  /**
6
7
  * The banner start content. Will default to the relevant icons based on the `variant` prop.
@@ -1 +1 @@
1
- {"version":3,"file":"banner.d.ts","sourceRoot":"","sources":["../../../src/banner/banner.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAmB,MAAM,OAAO,CAAA;AAClD,OAAO,EACL,WAAW,EACX,YAAY,EACZ,cAAc,EACd,YAAY,EACb,MAAM,sBAAsB,CAAA;AAE7B,OAAO,EACL,mBAAmB,EAIpB,MAAM,YAAY,CAAA;AAKnB,UAAU,WACR,SAAQ,YAAY,CAAC,OAAO,YAAY,CAAC,EACvC,mBAAmB;IACrB;;OAEG;IACH,YAAY,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAC9B,QAAQ,EAAE,SAAS,CAAA;IACnB;;OAEG;IACH,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,UAAU,CAAC,EAAE,cAAc,CAAC,WAAW,CAAC,CAAA;CACzC;AAiBD,eAAO,MAAM,MAAM,2IAUhB,WAAW,mDA6Eb,CAAA"}
1
+ {"version":3,"file":"banner.d.ts","sourceRoot":"","sources":["../../../src/banner/banner.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AACtC,OAAO,KAAK,EAAE,mBAAmB,EAAoB,MAAM,YAAY,CAAA;AAMvE,OAAO,KAAK,EACV,WAAW,EACX,cAAc,EACd,YAAY,EACb,MAAM,sBAAsB,CAAA;AAC7B,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AAInD,UAAU,WACR,SAAQ,YAAY,CAAC,OAAO,YAAY,CAAC,EACvC,mBAAmB;IACrB;;OAEG;IACH,YAAY,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAC9B,QAAQ,EAAE,SAAS,CAAA;IACnB;;OAEG;IACH,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,UAAU,CAAC,EAAE,cAAc,CAAC,WAAW,CAAC,CAAA;CACzC;AAiBD,eAAO,MAAM,MAAM,2IAUhB,WAAW,mDA6Eb,CAAA"}
@@ -1,7 +1,6 @@
1
- import type { VariantProps } from "@opengovsg/oui-theme";
2
1
  import type { ButtonProps as AriaButtonProps } from "react-aria-components";
3
- import { buttonStyles } from "@opengovsg/oui-theme";
4
- interface _ButtonProps extends Omit<AriaButtonProps, "children">, VariantProps<typeof buttonStyles> {
2
+ import type { ButtonVariantProps } from "@opengovsg/oui-theme";
3
+ export interface ButtonProps extends Omit<AriaButtonProps, "children">, ButtonVariantProps {
5
4
  /**
6
5
  * Whether the button should display a ripple effect on press.
7
6
  * @defaultValue false
@@ -32,17 +31,9 @@ interface _ButtonProps extends Omit<AriaButtonProps, "children">, VariantProps<t
32
31
  */
33
32
  spinnerPlacement?: "start" | "end";
34
33
  }
35
- export type ButtonProps = Omit<_ButtonProps, "aria-label"> & ({
36
- isIconOnly: true;
37
- "aria-label": string;
38
- } | {
39
- isIconOnly?: false;
40
- "aria-label"?: string;
41
- });
42
34
  /**
43
35
  * You probably do not want to use this component if you are rendering a link.
44
36
  * Use `LinkButton` component instead.
45
37
  */
46
38
  export declare const Button: import("react").ForwardRefExoticComponent<ButtonProps & import("react").RefAttributes<HTMLButtonElement>>;
47
- export {};
48
39
  //# sourceMappingURL=button.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"button.d.ts","sourceRoot":"","sources":["../../../src/button/button.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AACxD,OAAO,KAAK,EAAE,WAAW,IAAI,eAAe,EAAE,MAAM,uBAAuB,CAAA;AAE3E,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AAQnD,UAAU,YACR,SAAQ,IAAI,CAAC,eAAe,EAAE,UAAU,CAAC,EACvC,YAAY,CAAC,OAAO,YAAY,CAAC;IACnC;;;OAGG;IACH,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;IACzB;;OAEG;IACH,YAAY,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAC9B;;OAEG;IACH,UAAU,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAC5B;;;OAGG;IACH,OAAO,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAEzB;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAA;IAEpB;;;OAGG;IACH,gBAAgB,CAAC,EAAE,OAAO,GAAG,KAAK,CAAA;CACnC;AAED,MAAM,MAAM,WAAW,GAAG,IAAI,CAAC,YAAY,EAAE,YAAY,CAAC,GACxD,CACI;IAAE,UAAU,EAAE,IAAI,CAAC;IAAC,YAAY,EAAE,MAAM,CAAA;CAAE,GAC1C;IAAE,UAAU,CAAC,EAAE,KAAK,CAAC;IAAC,YAAY,CAAC,EAAE,MAAM,CAAA;CAAE,CAChD,CAAA;AAEH;;;GAGG;AACH,eAAO,MAAM,MAAM,2GAwElB,CAAA"}
1
+ {"version":3,"file":"button.d.ts","sourceRoot":"","sources":["../../../src/button/button.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,IAAI,eAAe,EAAE,MAAM,uBAAuB,CAAA;AAK3E,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAA;AAO9D,MAAM,WAAW,WACf,SAAQ,IAAI,CAAC,eAAe,EAAE,UAAU,CAAC,EACvC,kBAAkB;IACpB;;;OAGG;IACH,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;IACzB;;OAEG;IACH,YAAY,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAC9B;;OAEG;IACH,UAAU,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAC5B;;;OAGG;IACH,OAAO,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAEzB;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAA;IAEpB;;;OAGG;IACH,gBAAgB,CAAC,EAAE,OAAO,GAAG,KAAK,CAAA;CACnC;AAED;;;GAGG;AACH,eAAO,MAAM,MAAM,2GAwElB,CAAA"}
@@ -1,11 +1,20 @@
1
- import { SlotsToClasses } from "@opengovsg/oui-theme";
2
- import { SetRequired } from "type-fest";
3
- import { ComboBoxItem, ComboBoxProps } from "./combo-box";
1
+ import type { Key } from "react-aria";
2
+ import type { SetRequired } from "type-fest";
3
+ import type { ComboBoxItemSlots, SlotsToClasses } from "@opengovsg/oui-theme";
4
+ import type { ComboBoxProps } from "./combo-box";
5
+ import { ComboBoxItem } from "./combo-box-item";
6
+ type ComboBoxItem = {
7
+ id: Key;
8
+ textValue: string;
9
+ description?: string;
10
+ };
4
11
  export interface ComboBoxFuzzyProps<T extends ComboBoxItem = ComboBoxItem> extends SetRequired<ComboBoxProps<T>, "inputValue" | "onInputChange" | "onSelectionChange" | "selectedKey" | "items"> {
5
- itemClassNames?: ComboBoxProps<T>["itemClassNames"] & SlotsToClasses<"highlight">;
12
+ itemClassNames?: SlotsToClasses<ComboBoxItemSlots> & SlotsToClasses<"highlight">;
6
13
  }
7
14
  /**
8
15
  * Controlled variant of ComboBox, allows for fuzzy search and item highlight.
16
+ * @deprecated Use ComboBox instead (and bring your own fuzzysearch).
9
17
  */
10
- 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 {};
11
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,EAGL,cAAc,EACf,MAAM,sBAAsB,CAAA;AAG7B,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAA;AAEvC,OAAO,EAAY,YAAY,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AA8BnE,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"}
@@ -1,12 +1,6 @@
1
- import React, { JSX } from "react";
2
- import { ComboBoxItemSlots, ComboBoxItemVariantProps, ComboBoxSlots, ComboBoxVariantProps, SlotsToClasses } from "@opengovsg/oui-theme";
3
- import { ComboBoxProps as AriaComboBoxProps, ListBoxItemProps, ListBoxItemRenderProps, ListBoxProps, ListLayoutOptions, ValidationResult } from "react-aria-components";
4
- export type ComboBoxItem = {
5
- value: string;
6
- name: string;
7
- description?: string;
8
- };
9
- export interface ComboBoxProps<T extends ComboBoxItem = ComboBoxItem> extends ComboBoxVariantProps, Omit<AriaComboBoxProps<T>, "children"> {
1
+ import type { ComboBoxProps as AriaComboBoxProps, ListBoxProps, ListLayoutOptions, ValidationResult } from "react-aria-components";
2
+ import type { ComboBoxSlots, ComboBoxVariantProps, SlotsToClasses } from "@opengovsg/oui-theme";
3
+ export interface ComboBoxProps<T extends object> extends ComboBoxVariantProps, Omit<AriaComboBoxProps<T>, "children"> {
10
4
  label?: string;
11
5
  /** The list of ComboBox items (uncontrolled). */
12
6
  defaultItems?: T[];
@@ -15,12 +9,10 @@ export interface ComboBoxProps<T extends ComboBoxItem = ComboBoxItem> extends Co
15
9
  description?: string | null;
16
10
  errorMessage?: string | ((validation: ValidationResult) => string);
17
11
  classNames?: SlotsToClasses<ComboBoxSlots> & SlotsToClasses<"clearButton" | "emptyState">;
18
- itemClassNames?: SlotsToClasses<ComboBoxItemSlots>;
19
12
  /**
20
13
  * Any additional props to be spread to the list layout.
21
14
  */
22
15
  listLayoutOptions?: ListLayoutOptions;
23
- children?: (item: T) => JSX.Element;
24
16
  /** Values that should invalidate the item cache when using dynamic collections. */
25
17
  dependencies?: ListBoxProps<T>["dependencies"];
26
18
  /**
@@ -33,18 +25,10 @@ export interface ComboBoxProps<T extends ComboBoxItem = ComboBoxItem> extends Co
33
25
  */
34
26
  onClear?: () => void;
35
27
  renderEmptyState?: ListBoxProps<T>["renderEmptyState"];
28
+ children?: ListBoxProps<T>["children"];
36
29
  }
37
30
  export declare function ComboBoxEmptyState({ size, className, }: Pick<ComboBoxVariantProps, "size"> & {
38
31
  className?: string;
39
32
  }): import("react/jsx-runtime").JSX.Element;
40
- export declare function ComboBox<T extends ComboBoxItem>({ label, description, errorMessage, classNames, itemClassNames, size, listLayoutOptions, children, dependencies, onClear, renderEmptyState: renderEmptyStateProp, ...props }: ComboBoxProps<T>): import("react/jsx-runtime").JSX.Element;
41
- export interface ComboBoxItemProps extends ListBoxItemProps, ComboBoxItemVariantProps {
42
- label: React.ReactNode | ((props: ListBoxItemRenderProps) => React.ReactNode);
43
- /**
44
- * Description for the item, if any
45
- */
46
- description?: React.ReactNode | ((props: ListBoxItemRenderProps) => React.ReactNode);
47
- classNames?: SlotsToClasses<ComboBoxItemSlots>;
48
- }
49
- export declare function ComboBoxItem({ className, size, description, label, classNames, ...props }: ComboBoxItemProps): import("react/jsx-runtime").JSX.Element;
33
+ export declare function ComboBox<T extends object>(originalProps: ComboBoxProps<T>): import("react/jsx-runtime").JSX.Element;
50
34
  //# sourceMappingURL=combo-box.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"combo-box.d.ts","sourceRoot":"","sources":["../../../src/combo-box/combo-box.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,EAAE,GAAG,EAAwB,MAAM,OAAO,CAAA;AACxD,OAAO,EAGL,iBAAiB,EAEjB,wBAAwB,EACxB,aAAa,EAEb,oBAAoB,EAGpB,cAAc,EACf,MAAM,sBAAsB,CAAA;AAG7B,OAAO,EAGL,aAAa,IAAI,iBAAiB,EAIlC,gBAAgB,EAChB,sBAAsB,EACtB,YAAY,EAGZ,iBAAiB,EAGjB,gBAAgB,EAEjB,MAAM,uBAAuB,CAAA;AAI9B,MAAM,MAAM,YAAY,GAAG;IACzB,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB,CAAA;AAED,MAAM,WAAW,aAAa,CAAC,CAAC,SAAS,YAAY,GAAG,YAAY,CAClE,SAAQ,oBAAoB,EAC1B,IAAI,CAAC,iBAAiB,CAAC,CAAC,CAAC,EAAE,UAAU,CAAC;IACxC,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,iDAAiD;IACjD,YAAY,CAAC,EAAE,CAAC,EAAE,CAAA;IAClB,+CAA+C;IAC/C,KAAK,CAAC,EAAE,CAAC,EAAE,CAAA;IACX,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAC3B,YAAY,CAAC,EAAE,MAAM,GAAG,CAAC,CAAC,UAAU,EAAE,gBAAgB,KAAK,MAAM,CAAC,CAAA;IAClE,UAAU,CAAC,EAAE,cAAc,CAAC,aAAa,CAAC,GACxC,cAAc,CAAC,aAAa,GAAG,YAAY,CAAC,CAAA;IAC9C,cAAc,CAAC,EAAE,cAAc,CAAC,iBAAiB,CAAC,CAAA;IAClD;;OAEG;IACH,iBAAiB,CAAC,EAAE,iBAAiB,CAAA;IAErC,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,GAAG,CAAC,OAAO,CAAA;IAEnC,mFAAmF;IACnF,YAAY,CAAC,EAAE,YAAY,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC,CAAA;IAE9C;;;;;;;OAOG;IACH,OAAO,CAAC,EAAE,MAAM,IAAI,CAAA;IAEpB,gBAAgB,CAAC,EAAE,YAAY,CAAC,CAAC,CAAC,CAAC,kBAAkB,CAAC,CAAA;CACvD;AAkCD,wBAAgB,kBAAkB,CAAC,EACjC,IAAI,EACJ,SAAS,GACV,EAAE,IAAI,CAAC,oBAAoB,EAAE,MAAM,CAAC,GAAG;IAAE,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,2CAY7D;AAED,wBAAgB,QAAQ,CAAC,CAAC,SAAS,YAAY,EAAE,EAC/C,KAAK,EACL,WAAW,EACX,YAAY,EACZ,UAAU,EACV,cAAc,EACd,IAAI,EACJ,iBAAiB,EACjB,QAAQ,EACR,YAAY,EACZ,OAAO,EACP,gBAAgB,EAAE,oBAAoB,EACtC,GAAG,KAAK,EACT,EAAE,aAAa,CAAC,CAAC,CAAC,2CAwJlB;AAED,MAAM,WAAW,iBACf,SAAQ,gBAAgB,EACtB,wBAAwB;IAC1B,KAAK,EAAE,KAAK,CAAC,SAAS,GAAG,CAAC,CAAC,KAAK,EAAE,sBAAsB,KAAK,KAAK,CAAC,SAAS,CAAC,CAAA;IAC7E;;OAEG;IACH,WAAW,CAAC,EACR,KAAK,CAAC,SAAS,GACf,CAAC,CAAC,KAAK,EAAE,sBAAsB,KAAK,KAAK,CAAC,SAAS,CAAC,CAAA;IACxD,UAAU,CAAC,EAAE,cAAc,CAAC,iBAAiB,CAAC,CAAA;CAC/C;AAED,wBAAgB,YAAY,CAAC,EAC3B,SAAS,EACT,IAAI,EACJ,WAAW,EACX,KAAK,EACL,UAAU,EACV,GAAG,KAAK,EACT,EAAE,iBAAiB,2CAqCnB"}
1
+ {"version":3,"file":"combo-box.d.ts","sourceRoot":"","sources":["../../../src/combo-box/combo-box.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,aAAa,IAAI,iBAAiB,EAClC,YAAY,EAEZ,iBAAiB,EACjB,gBAAgB,EACjB,MAAM,uBAAuB,CAAA;AAe9B,OAAO,KAAK,EACV,aAAa,EACb,oBAAoB,EACpB,cAAc,EACf,MAAM,sBAAsB,CAAA;AAc7B,MAAM,WAAW,aAAa,CAAC,CAAC,SAAS,MAAM,CAC7C,SAAQ,oBAAoB,EAC1B,IAAI,CAAC,iBAAiB,CAAC,CAAC,CAAC,EAAE,UAAU,CAAC;IACxC,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,iDAAiD;IACjD,YAAY,CAAC,EAAE,CAAC,EAAE,CAAA;IAClB,+CAA+C;IAC/C,KAAK,CAAC,EAAE,CAAC,EAAE,CAAA;IACX,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAC3B,YAAY,CAAC,EAAE,MAAM,GAAG,CAAC,CAAC,UAAU,EAAE,gBAAgB,KAAK,MAAM,CAAC,CAAA;IAClE,UAAU,CAAC,EAAE,cAAc,CAAC,aAAa,CAAC,GACxC,cAAc,CAAC,aAAa,GAAG,YAAY,CAAC,CAAA;IAC9C;;OAEG;IACH,iBAAiB,CAAC,EAAE,iBAAiB,CAAA;IAErC,mFAAmF;IACnF,YAAY,CAAC,EAAE,YAAY,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC,CAAA;IAE9C;;;;;;;OAOG;IACH,OAAO,CAAC,EAAE,MAAM,IAAI,CAAA;IAEpB,gBAAgB,CAAC,EAAE,YAAY,CAAC,CAAC,CAAC,CAAC,kBAAkB,CAAC,CAAA;IAEtD,QAAQ,CAAC,EAAE,YAAY,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAA;CACvC;AAkCD,wBAAgB,kBAAkB,CAAC,EACjC,IAAI,EACJ,SAAS,GACV,EAAE,IAAI,CAAC,oBAAoB,EAAE,MAAM,CAAC,GAAG;IAAE,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,2CAY7D;AAED,wBAAgB,QAAQ,CAAC,CAAC,SAAS,MAAM,EAAE,aAAa,EAAE,aAAa,CAAC,CAAC,CAAC,2CA6JzE"}
@@ -1,3 +1,5 @@
1
1
  export * from "./combo-box";
2
2
  export * from "./combo-box-fuzzy";
3
+ export * from "./combo-box-item";
4
+ export * from "./combo-box-variant-context";
3
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/combo-box/index.tsx"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAA;AAC3B,cAAc,mBAAmB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/combo-box/index.tsx"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAA;AAC3B,cAAc,mBAAmB,CAAA;AACjC,cAAc,kBAAkB,CAAA;AAChC,cAAc,6BAA6B,CAAA"}