@opengovsg/oui 0.0.0-snapshot-20250318065939 → 0.0.0-snapshot-20250319030133

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 (36) 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/index.cjs +10 -8
  5. package/dist/cjs/system/react-utils/index.cjs +2 -0
  6. package/dist/cjs/system/react-utils/refs.cjs +12 -0
  7. package/dist/esm/badge/badge.js +40 -0
  8. package/dist/esm/badge/index.js +2 -0
  9. package/dist/esm/badge/use-badge.js +109 -0
  10. package/dist/esm/index.js +5 -4
  11. package/dist/esm/system/react-utils/index.js +1 -0
  12. package/dist/esm/system/react-utils/refs.js +10 -0
  13. package/dist/types/badge/badge.d.ts +3 -0
  14. package/dist/types/badge/badge.d.ts.map +1 -0
  15. package/dist/types/badge/index.d.ts +2 -0
  16. package/dist/types/badge/index.d.ts.map +1 -0
  17. package/dist/types/badge/use-badge.d.ts +166 -0
  18. package/dist/types/badge/use-badge.d.ts.map +1 -0
  19. package/dist/types/index.d.mts +1 -0
  20. package/dist/types/index.d.ts +1 -0
  21. package/dist/types/index.d.ts.map +1 -1
  22. package/dist/types/system/react-utils/index.d.ts +1 -0
  23. package/dist/types/system/react-utils/index.d.ts.map +1 -1
  24. package/dist/types/system/react-utils/refs.d.ts +4 -0
  25. package/dist/types/system/react-utils/refs.d.ts.map +1 -0
  26. package/dist/types/tag-field/tag-field-list.d.ts +5 -5
  27. package/dist/types/tag-field/tag-field-list.d.ts.map +1 -1
  28. package/dist/types/tag-field/tag-field-root.d.ts +4 -4
  29. package/dist/types/tag-field/tag-field-root.d.ts.map +1 -1
  30. package/dist/types/tag-field/tag-field-tag-list.d.ts +2 -3
  31. package/dist/types/tag-field/tag-field-tag-list.d.ts.map +1 -1
  32. package/dist/types/tag-field/tag-field.d.ts +2 -2
  33. package/dist/types/tag-field/tag-field.d.ts.map +1 -1
  34. package/dist/types/tag-field/types.d.ts +0 -5
  35. package/dist/types/tag-field/types.d.ts.map +1 -1
  36. package/package.json +4 -3
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+ "use client";
3
+ 'use strict';
4
+
5
+ var jsxRuntime = require('react/jsx-runtime');
6
+ var react = require('react');
7
+ var useBadge = require('./use-badge.cjs');
8
+ var x = require('../node_modules/.pnpm/lucide-react@0.475.0_react@19.0.0/node_modules/lucide-react/dist/esm/icons/x.cjs');
9
+
10
+ const Badge = react.forwardRef((props, ref) => {
11
+ const {
12
+ Component,
13
+ children,
14
+ slots,
15
+ classNames,
16
+ getChipProps,
17
+ getCloseButtonProps,
18
+ startContent,
19
+ endContent,
20
+ isCloseable
21
+ } = useBadge.useBadge({ ...props, ref });
22
+ const start = react.useMemo(() => {
23
+ if (props.variant === "dot" && !startContent) {
24
+ return /* @__PURE__ */ jsxRuntime.jsx("span", { className: slots.dot({ className: classNames?.dot }) });
25
+ }
26
+ return startContent;
27
+ }, [props.variant, startContent, slots, classNames?.dot]);
28
+ const end = react.useMemo(() => {
29
+ if (isCloseable) {
30
+ return /* @__PURE__ */ jsxRuntime.jsx("span", { ...getCloseButtonProps(), children: endContent ?? /* @__PURE__ */ jsxRuntime.jsx(x.default, { className: "size-full" }) });
31
+ }
32
+ return endContent;
33
+ }, [endContent, getCloseButtonProps, isCloseable]);
34
+ return /* @__PURE__ */ jsxRuntime.jsxs(Component, { ...getChipProps(), children: [
35
+ start,
36
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: slots.content({ className: classNames?.content }), children }),
37
+ end
38
+ ] });
39
+ });
40
+ Badge.displayName = "Badge";
41
+
42
+ exports.Badge = Badge;
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ 'use strict';
3
+
4
+ var badge = require('./badge.cjs');
5
+
6
+
7
+
8
+ exports.Badge = badge.Badge;
@@ -0,0 +1,111 @@
1
+ "use strict";
2
+ 'use strict';
3
+
4
+ var react = require('react');
5
+ var utils$1 = require('@react-aria/utils');
6
+ var reactAria = require('react-aria');
7
+ var useDeepCompare = require('use-deep-compare');
8
+ var ouiTheme = require('@opengovsg/oui-theme');
9
+ var utils = require('../system/utils.cjs');
10
+ var refs = require('../system/react-utils/refs.cjs');
11
+
12
+ const i18nStrings = {
13
+ "en-SG": {
14
+ close: "Close badge"
15
+ },
16
+ "zh-SG": {
17
+ close: "\u5173\u95ED\u5FBD\u7AE0"
18
+ },
19
+ "ms-SG": {
20
+ close: "Tutup lencana"
21
+ },
22
+ "ta-SG": {
23
+ close: "\u0BAA\u0BC7\u0B9F\u0BCD\u0B9C\u0BC8 \u0BAE\u0BC2\u0B9F\u0BC1"
24
+ }
25
+ };
26
+ function useBadge(originalProps) {
27
+ const [_props, variantProps] = utils.mapPropsVariants(
28
+ originalProps,
29
+ ouiTheme.badgeStyles.variantKeys
30
+ );
31
+ const {
32
+ ref,
33
+ as,
34
+ children,
35
+ startContent,
36
+ endContent,
37
+ onClose,
38
+ classNames,
39
+ className,
40
+ ...props
41
+ } = _props;
42
+ const domRef = refs.useDomRef(ref);
43
+ const Component = react.useMemo(() => as || "div", [as]);
44
+ const baseClassName = ouiTheme.cn(classNames?.base, className);
45
+ const formatMessage = reactAria.useMessageFormatter(i18nStrings);
46
+ const isCloseable = variantProps.isCloseable || !!onClose;
47
+ const {
48
+ focusProps: closeFocusProps,
49
+ isFocusVisible: isCloseButtonFocusVisible
50
+ } = reactAria.useFocusRing();
51
+ const slots = useDeepCompare.useDeepCompareMemo(
52
+ () => ({
53
+ ...ouiTheme.badgeStyles({ isCloseable, ...variantProps }),
54
+ closeButton: ouiTheme.badgeCloseButtonStyles
55
+ }),
56
+ [variantProps, isCloseable, ouiTheme.badgeStyles, ouiTheme.badgeCloseButtonStyles]
57
+ );
58
+ const { pressProps: closePressProps } = reactAria.usePress({
59
+ isDisabled: !!variantProps?.isDisabled,
60
+ onPress: onClose
61
+ });
62
+ const getContentClone = react.useCallback(
63
+ (content) => react.isValidElement(content) ? react.cloneElement(content, {
64
+ // @ts-expect-error types are not full
65
+ className: content.props?.className
66
+ }) : null,
67
+ []
68
+ );
69
+ const getChipProps = react.useCallback(() => {
70
+ return {
71
+ ref: domRef,
72
+ className: slots.base({ className: baseClassName }),
73
+ "aria-disabled": variantProps?.isDisabled,
74
+ ...props
75
+ };
76
+ }, [baseClassName, domRef, props, slots, variantProps?.isDisabled]);
77
+ const getCloseButtonProps = react.useCallback(() => {
78
+ return {
79
+ role: "button",
80
+ tabIndex: 0,
81
+ className: slots.closeButton({
82
+ size: variantProps?.size,
83
+ className: classNames?.closeButton,
84
+ isFocusVisible: isCloseButtonFocusVisible
85
+ }),
86
+ "aria-label": formatMessage("close"),
87
+ ...utils$1.mergeProps(closePressProps, closeFocusProps)
88
+ };
89
+ }, [
90
+ classNames?.closeButton,
91
+ closeFocusProps,
92
+ closePressProps,
93
+ formatMessage,
94
+ isCloseButtonFocusVisible,
95
+ slots,
96
+ variantProps?.size
97
+ ]);
98
+ return {
99
+ Component,
100
+ children,
101
+ slots,
102
+ classNames,
103
+ isCloseable,
104
+ startContent: getContentClone(startContent),
105
+ endContent: getContentClone(endContent),
106
+ getCloseButtonProps,
107
+ getChipProps
108
+ };
109
+ }
110
+
111
+ exports.useBadge = useBadge;
@@ -1,10 +1,6 @@
1
1
  "use strict";
2
2
  'use strict';
3
3
 
4
- var toggle = require('./toggle/toggle.cjs');
5
- var textField = require('./text-field/text-field.cjs');
6
- var textArea = require('./text-area/text-area.cjs');
7
- var textAreaField = require('./text-area-field/text-area-field.cjs');
8
4
  var useControllableState = require('./hooks/use-controllable-state.cjs');
9
5
  var button = require('./button/button.cjs');
10
6
  var govtBanner = require('./govt-banner/govt-banner.cjs');
@@ -12,9 +8,13 @@ var ripple = require('./ripple/ripple.cjs');
12
8
  var useRipple = require('./ripple/use-ripple.cjs');
13
9
  var spinner = require('./spinner/spinner.cjs');
14
10
  var useSpinner = require('./spinner/use-spinner.cjs');
11
+ var toggle = require('./toggle/toggle.cjs');
15
12
  var skipNavLink = require('./skip-nav-link/skip-nav-link.cjs');
16
13
  var input = require('./input/input.cjs');
14
+ var textField = require('./text-field/text-field.cjs');
17
15
  var field = require('./field/field.cjs');
16
+ var textArea = require('./text-area/text-area.cjs');
17
+ var textAreaField = require('./text-area-field/text-area-field.cjs');
18
18
  var comboBox = require('./combo-box/combo-box.cjs');
19
19
  var comboBoxFuzzy = require('./combo-box/combo-box-fuzzy.cjs');
20
20
  var comboBoxItem = require('./combo-box/combo-box-item.cjs');
@@ -24,13 +24,10 @@ var tagField = require('./tag-field/tag-field.cjs');
24
24
  var select = require('./select/select.cjs');
25
25
  var selectItem = require('./select/select-item.cjs');
26
26
  var selectVariantContext = require('./select/select-variant-context.cjs');
27
+ var badge = require('./badge/badge.cjs');
27
28
 
28
29
 
29
30
 
30
- exports.Toggle = toggle.Toggle;
31
- exports.TextField = textField.TextField;
32
- exports.TextArea = textArea.TextArea;
33
- exports.TextAreaField = textAreaField.TextAreaField;
34
31
  exports.useControllableState = useControllableState.useControllableState;
35
32
  exports.Button = button.Button;
36
33
  exports.GovtBanner = govtBanner.GovtBanner;
@@ -38,12 +35,16 @@ exports.Ripple = ripple.Ripple;
38
35
  exports.useRipple = useRipple.useRipple;
39
36
  exports.Spinner = spinner.Spinner;
40
37
  exports.useSpinner = useSpinner.useSpinner;
38
+ exports.Toggle = toggle.Toggle;
41
39
  exports.SkipNavLink = skipNavLink.SkipNavLink;
42
40
  exports.Input = input.Input;
41
+ exports.TextField = textField.TextField;
43
42
  exports.Description = field.Description;
44
43
  exports.FieldError = field.FieldError;
45
44
  exports.FieldGroup = field.FieldGroup;
46
45
  exports.Label = field.Label;
46
+ exports.TextArea = textArea.TextArea;
47
+ exports.TextAreaField = textAreaField.TextAreaField;
47
48
  exports.ComboBox = comboBox.ComboBox;
48
49
  exports.ComboBoxEmptyState = comboBox.ComboBoxEmptyState;
49
50
  exports.ComboBoxFuzzy = comboBoxFuzzy.ComboBoxFuzzy;
@@ -56,3 +57,4 @@ exports.Select = select.Select;
56
57
  exports.SelectItem = selectItem.SelectItem;
57
58
  exports.SelectVariantContext = selectVariantContext.SelectVariantContext;
58
59
  exports.useSelectVariantContext = selectVariantContext.useSelectVariantContext;
60
+ exports.Badge = badge.Badge;
@@ -2,7 +2,9 @@
2
2
  'use strict';
3
3
 
4
4
  var context = require('./context.cjs');
5
+ var refs = require('./refs.cjs');
5
6
 
6
7
 
7
8
 
8
9
  exports.createContext = context.createContext;
10
+ exports.useDomRef = refs.useDomRef;
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ 'use strict';
3
+
4
+ var react = require('react');
5
+
6
+ function useDomRef(ref) {
7
+ const domRef = react.useRef(null);
8
+ react.useImperativeHandle(ref, () => domRef.current);
9
+ return domRef;
10
+ }
11
+
12
+ exports.useDomRef = useDomRef;
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ "use client";
3
+ import { jsx, jsxs } from 'react/jsx-runtime';
4
+ import { forwardRef, useMemo } from 'react';
5
+ import { useBadge } from './use-badge.js';
6
+ import X from '../node_modules/.pnpm/lucide-react@0.475.0_react@19.0.0/node_modules/lucide-react/dist/esm/icons/x.js';
7
+
8
+ const Badge = forwardRef((props, ref) => {
9
+ const {
10
+ Component,
11
+ children,
12
+ slots,
13
+ classNames,
14
+ getChipProps,
15
+ getCloseButtonProps,
16
+ startContent,
17
+ endContent,
18
+ isCloseable
19
+ } = useBadge({ ...props, ref });
20
+ const start = useMemo(() => {
21
+ if (props.variant === "dot" && !startContent) {
22
+ return /* @__PURE__ */ jsx("span", { className: slots.dot({ className: classNames?.dot }) });
23
+ }
24
+ return startContent;
25
+ }, [props.variant, startContent, slots, classNames?.dot]);
26
+ const end = useMemo(() => {
27
+ if (isCloseable) {
28
+ return /* @__PURE__ */ jsx("span", { ...getCloseButtonProps(), children: endContent ?? /* @__PURE__ */ jsx(X, { className: "size-full" }) });
29
+ }
30
+ return endContent;
31
+ }, [endContent, getCloseButtonProps, isCloseable]);
32
+ return /* @__PURE__ */ jsxs(Component, { ...getChipProps(), children: [
33
+ start,
34
+ /* @__PURE__ */ jsx("span", { className: slots.content({ className: classNames?.content }), children }),
35
+ end
36
+ ] });
37
+ });
38
+ Badge.displayName = "Badge";
39
+
40
+ export { Badge };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ export { Badge } from './badge.js';
@@ -0,0 +1,109 @@
1
+ "use strict";
2
+ import { useMemo, useCallback, cloneElement, isValidElement } from 'react';
3
+ import { mergeProps } from '@react-aria/utils';
4
+ import { useMessageFormatter, useFocusRing, usePress } from 'react-aria';
5
+ import { useDeepCompareMemo } from 'use-deep-compare';
6
+ import { badgeStyles, cn, badgeCloseButtonStyles } from '@opengovsg/oui-theme';
7
+ import { mapPropsVariants } from '../system/utils.js';
8
+ import { useDomRef } from '../system/react-utils/refs.js';
9
+
10
+ const i18nStrings = {
11
+ "en-SG": {
12
+ close: "Close badge"
13
+ },
14
+ "zh-SG": {
15
+ close: "\u5173\u95ED\u5FBD\u7AE0"
16
+ },
17
+ "ms-SG": {
18
+ close: "Tutup lencana"
19
+ },
20
+ "ta-SG": {
21
+ close: "\u0BAA\u0BC7\u0B9F\u0BCD\u0B9C\u0BC8 \u0BAE\u0BC2\u0B9F\u0BC1"
22
+ }
23
+ };
24
+ function useBadge(originalProps) {
25
+ const [_props, variantProps] = mapPropsVariants(
26
+ originalProps,
27
+ badgeStyles.variantKeys
28
+ );
29
+ const {
30
+ ref,
31
+ as,
32
+ children,
33
+ startContent,
34
+ endContent,
35
+ onClose,
36
+ classNames,
37
+ className,
38
+ ...props
39
+ } = _props;
40
+ const domRef = useDomRef(ref);
41
+ const Component = useMemo(() => as || "div", [as]);
42
+ const baseClassName = cn(classNames?.base, className);
43
+ const formatMessage = useMessageFormatter(i18nStrings);
44
+ const isCloseable = variantProps.isCloseable || !!onClose;
45
+ const {
46
+ focusProps: closeFocusProps,
47
+ isFocusVisible: isCloseButtonFocusVisible
48
+ } = useFocusRing();
49
+ const slots = useDeepCompareMemo(
50
+ () => ({
51
+ ...badgeStyles({ isCloseable, ...variantProps }),
52
+ closeButton: badgeCloseButtonStyles
53
+ }),
54
+ [variantProps, isCloseable, badgeStyles, badgeCloseButtonStyles]
55
+ );
56
+ const { pressProps: closePressProps } = usePress({
57
+ isDisabled: !!variantProps?.isDisabled,
58
+ onPress: onClose
59
+ });
60
+ const getContentClone = useCallback(
61
+ (content) => isValidElement(content) ? cloneElement(content, {
62
+ // @ts-expect-error types are not full
63
+ className: content.props?.className
64
+ }) : null,
65
+ []
66
+ );
67
+ const getChipProps = useCallback(() => {
68
+ return {
69
+ ref: domRef,
70
+ className: slots.base({ className: baseClassName }),
71
+ "aria-disabled": variantProps?.isDisabled,
72
+ ...props
73
+ };
74
+ }, [baseClassName, domRef, props, slots, variantProps?.isDisabled]);
75
+ const getCloseButtonProps = useCallback(() => {
76
+ return {
77
+ role: "button",
78
+ tabIndex: 0,
79
+ className: slots.closeButton({
80
+ size: variantProps?.size,
81
+ className: classNames?.closeButton,
82
+ isFocusVisible: isCloseButtonFocusVisible
83
+ }),
84
+ "aria-label": formatMessage("close"),
85
+ ...mergeProps(closePressProps, closeFocusProps)
86
+ };
87
+ }, [
88
+ classNames?.closeButton,
89
+ closeFocusProps,
90
+ closePressProps,
91
+ formatMessage,
92
+ isCloseButtonFocusVisible,
93
+ slots,
94
+ variantProps?.size
95
+ ]);
96
+ return {
97
+ Component,
98
+ children,
99
+ slots,
100
+ classNames,
101
+ isCloseable,
102
+ startContent: getContentClone(startContent),
103
+ endContent: getContentClone(endContent),
104
+ getCloseButtonProps,
105
+ getChipProps
106
+ };
107
+ }
108
+
109
+ export { useBadge };
package/dist/esm/index.js CHANGED
@@ -1,8 +1,4 @@
1
1
  "use strict";
2
- export { Toggle } from './toggle/toggle.js';
3
- export { TextField } from './text-field/text-field.js';
4
- export { TextArea } from './text-area/text-area.js';
5
- export { TextAreaField } from './text-area-field/text-area-field.js';
6
2
  export { useControllableState } from './hooks/use-controllable-state.js';
7
3
  export { Button } from './button/button.js';
8
4
  export { GovtBanner } from './govt-banner/govt-banner.js';
@@ -10,9 +6,13 @@ export { Ripple } from './ripple/ripple.js';
10
6
  export { useRipple } from './ripple/use-ripple.js';
11
7
  export { Spinner } from './spinner/spinner.js';
12
8
  export { useSpinner } from './spinner/use-spinner.js';
9
+ export { Toggle } from './toggle/toggle.js';
13
10
  export { SkipNavLink } from './skip-nav-link/skip-nav-link.js';
14
11
  export { Input } from './input/input.js';
12
+ export { TextField } from './text-field/text-field.js';
15
13
  export { Description, FieldError, FieldGroup, Label } from './field/field.js';
14
+ export { TextArea } from './text-area/text-area.js';
15
+ export { TextAreaField } from './text-area-field/text-area-field.js';
16
16
  export { ComboBox, ComboBoxEmptyState } from './combo-box/combo-box.js';
17
17
  export { ComboBoxFuzzy } from './combo-box/combo-box-fuzzy.js';
18
18
  export { ComboBoxItem } from './combo-box/combo-box-item.js';
@@ -22,3 +22,4 @@ export { TagField } from './tag-field/tag-field.js';
22
22
  export { Select } from './select/select.js';
23
23
  export { SelectItem } from './select/select-item.js';
24
24
  export { SelectVariantContext, useSelectVariantContext } from './select/select-variant-context.js';
25
+ export { Badge } from './badge/badge.js';
@@ -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 };
@@ -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"}
@@ -14,4 +14,5 @@ export * from "./combo-box";
14
14
  export * from "./banner";
15
15
  export * from "./tag-field";
16
16
  export * from "./select";
17
+ export * from "./badge";
17
18
  //# sourceMappingURL=index.d.ts.map
@@ -14,4 +14,5 @@ export * from "./combo-box";
14
14
  export * from "./banner";
15
15
  export * from "./tag-field";
16
16
  export * from "./select";
17
+ export * from "./badge";
17
18
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAA;AACvB,cAAc,UAAU,CAAA;AACxB,cAAc,eAAe,CAAA;AAC7B,cAAc,UAAU,CAAA;AACxB,cAAc,WAAW,CAAA;AACzB,cAAc,UAAU,CAAA;AACxB,cAAc,iBAAiB,CAAA;AAC/B,cAAc,SAAS,CAAA;AACvB,cAAc,cAAc,CAAA;AAC5B,cAAc,SAAS,CAAA;AACvB,cAAc,aAAa,CAAA;AAC3B,cAAc,mBAAmB,CAAA;AACjC,cAAc,aAAa,CAAA;AAC3B,cAAc,UAAU,CAAA;AACxB,cAAc,aAAa,CAAA;AAC3B,cAAc,UAAU,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAA;AACvB,cAAc,UAAU,CAAA;AACxB,cAAc,eAAe,CAAA;AAC7B,cAAc,UAAU,CAAA;AACxB,cAAc,WAAW,CAAA;AACzB,cAAc,UAAU,CAAA;AACxB,cAAc,iBAAiB,CAAA;AAC/B,cAAc,SAAS,CAAA;AACvB,cAAc,cAAc,CAAA;AAC5B,cAAc,SAAS,CAAA;AACvB,cAAc,aAAa,CAAA;AAC3B,cAAc,mBAAmB,CAAA;AACjC,cAAc,aAAa,CAAA;AAC3B,cAAc,UAAU,CAAA;AACxB,cAAc,aAAa,CAAA;AAC3B,cAAc,UAAU,CAAA;AACxB,cAAc,SAAS,CAAA"}
@@ -1,2 +1,3 @@
1
1
  export * from "./context";
2
+ export * from "./refs";
2
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/system/react-utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/system/react-utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAA;AACzB,cAAc,QAAQ,CAAA"}
@@ -0,0 +1,4 @@
1
+ import type React from "react";
2
+ export type ReactRef<T> = React.RefObject<T> | React.Ref<T>;
3
+ export declare function useDomRef<T extends HTMLElement = HTMLElement>(ref?: ReactRef<T | null>): React.RefObject<T | null>;
4
+ //# sourceMappingURL=refs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"refs.d.ts","sourceRoot":"","sources":["../../../../src/system/react-utils/refs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAG9B,MAAM,MAAM,QAAQ,CAAC,CAAC,IAAI,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAA;AAE3D,wBAAgB,SAAS,CAAC,CAAC,SAAS,WAAW,GAAG,WAAW,EAC3D,GAAG,CAAC,EAAE,QAAQ,CAAC,CAAC,GAAG,IAAI,CAAC,6BAOzB"}
@@ -3,20 +3,20 @@ import type { UseComboboxPropGetters } from "downshift";
3
3
  import type { ReactNode } from "react";
4
4
  import type { ContextValue, SlotProps } from "react-aria-components";
5
5
  import type { SlotsToClasses, TagFieldItemSlots } from "@opengovsg/oui-theme";
6
- import type { TagFieldItem, TagFieldListRenderProps } from "./types";
6
+ import type { TagFieldListRenderProps } from "./types";
7
7
  export interface TagFieldListContextValue extends SlotProps, ReturnType<UseComboboxPropGetters<object>["getMenuProps"]> {
8
8
  rowVirtualizer: Virtualizer<HTMLElement, Element>;
9
9
  }
10
10
  export declare const TagFieldListContext: import("react").Context<ContextValue<TagFieldListContextValue, HTMLUListElement>>;
11
- interface TagFieldListProps<T extends TagFieldItem> extends Partial<TagFieldListContextValue> {
11
+ interface TagFieldListProps<T extends object> extends Partial<TagFieldListContextValue> {
12
12
  className?: string;
13
13
  itemClassNames?: SlotsToClasses<TagFieldItemSlots>;
14
14
  children?: ReactNode | ((values: TagFieldListRenderProps<T>) => ReactNode);
15
15
  }
16
- interface TagFieldListItemProps<T extends TagFieldItem> extends Omit<TagFieldListRenderProps<T>, "key"> {
16
+ interface TagFieldListItemProps<T extends object> extends Omit<TagFieldListRenderProps<T>, "key"> {
17
17
  classNames?: TagFieldListProps<T>["itemClassNames"];
18
18
  }
19
- export declare const TagFieldListItem: <T extends TagFieldItem>(props: TagFieldListItemProps<T> & import("react").RefAttributes<HTMLLIElement>) => React.ReactNode;
20
- export declare const TagFieldList: <T extends TagFieldItem>(props: TagFieldListProps<T> & import("react").RefAttributes<HTMLUListElement>) => React.ReactNode;
19
+ export declare const TagFieldListItem: <T extends object>(props: TagFieldListItemProps<T> & import("react").RefAttributes<HTMLLIElement>) => React.ReactNode;
20
+ export declare const TagFieldList: <T extends object>(props: TagFieldListProps<T> & import("react").RefAttributes<HTMLUListElement>) => React.ReactNode;
21
21
  export {};
22
22
  //# sourceMappingURL=tag-field-list.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"tag-field-list.d.ts","sourceRoot":"","sources":["../../../src/tag-field/tag-field-list.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAA;AAC1D,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,WAAW,CAAA;AACvD,OAAO,KAAK,EAAgB,SAAS,EAAE,MAAM,OAAO,CAAA;AACpD,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAA;AAIpE,OAAO,KAAK,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAA;AAG7E,OAAO,KAAK,EAAE,YAAY,EAAE,uBAAuB,EAAE,MAAM,SAAS,CAAA;AAIpE,MAAM,WAAW,wBACf,SAAQ,SAAS,EACf,UAAU,CAAC,sBAAsB,CAAC,MAAM,CAAC,CAAC,cAAc,CAAC,CAAC;IAC5D,cAAc,EAAE,WAAW,CAAC,WAAW,EAAE,OAAO,CAAC,CAAA;CAClD;AAED,eAAO,MAAM,mBAAmB,mFAC+C,CAAA;AAE/E,UAAU,iBAAiB,CAAC,CAAC,SAAS,YAAY,CAChD,SAAQ,OAAO,CAAC,wBAAwB,CAAC;IACzC,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,cAAc,CAAC,EAAE,cAAc,CAAC,iBAAiB,CAAC,CAAA;IAClD,QAAQ,CAAC,EAAE,SAAS,GAAG,CAAC,CAAC,MAAM,EAAE,uBAAuB,CAAC,CAAC,CAAC,KAAK,SAAS,CAAC,CAAA;CAC3E;AAED,UAAU,qBAAqB,CAAC,CAAC,SAAS,YAAY,CACpD,SAAQ,IAAI,CAAC,uBAAuB,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC;IAC/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,SAAS,MAAM,CAC9C,SAAQ,IAAI,CAAC,uBAAuB,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC;IAC/C,UAAU,CAAC,EAAE,iBAAiB,CAAC,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAA;CACpD;AAuBD,eAAO,MAAM,gBAAgB,GArBE,CAAC,SAAS,MAAM,qFAgBvB,MAClB,SAIkE,CAAA;AAsDxE,eAAO,MAAM,YAAY,GApDE,CAAC,SAAS,MAAM,oFAPnB,MAClB,SA0D0D,CAAA"}
@@ -1,14 +1,14 @@
1
1
  import type { UseMultipleSelectionReturnValue } from "downshift";
2
2
  import type { ComboBoxRenderProps } from "react-aria-components";
3
3
  import type { RenderProps } from "../system/types";
4
- import type { TagFieldItem, TagFieldProps } from "./types";
5
- interface TagFieldRootRenderProps<T extends TagFieldItem> extends ComboBoxRenderProps, Pick<UseMultipleSelectionReturnValue<T>, "getSelectedItemProps" | "removeSelectedItem"> {
4
+ import type { TagFieldProps } from "./types";
5
+ interface TagFieldRootRenderProps<T extends object> extends ComboBoxRenderProps, Pick<UseMultipleSelectionReturnValue<T>, "getSelectedItemProps" | "removeSelectedItem"> {
6
6
  highlightedIndex?: number;
7
7
  selectedItems: T[];
8
8
  items?: T[];
9
9
  }
10
- export interface TagFieldRootProps<T extends TagFieldItem> extends Omit<TagFieldProps<T>, "children">, RenderProps<TagFieldRootRenderProps<T>> {
10
+ export interface TagFieldRootProps<T extends object> extends Omit<TagFieldProps<T>, "children">, RenderProps<TagFieldRootRenderProps<T>> {
11
11
  }
12
- export declare function TagFieldRoot<T extends TagFieldItem>({ children, virtualRowHeight: _virtualRowHeight, ...props }: TagFieldRootProps<T>): import("react/jsx-runtime").JSX.Element;
12
+ export declare function TagFieldRoot<T extends object>({ children, virtualRowHeight: _virtualRowHeight, ...props }: TagFieldRootProps<T>): import("react/jsx-runtime").JSX.Element;
13
13
  export {};
14
14
  //# sourceMappingURL=tag-field-root.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"tag-field-root.d.ts","sourceRoot":"","sources":["../../../src/tag-field/tag-field-root.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,WAAW,CAAA;AAChE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAA;AAmBhE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAClD,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAQ1D,UAAU,uBAAuB,CAAC,CAAC,SAAS,YAAY,CACtD,SAAQ,mBAAmB,EACzB,IAAI,CACF,+BAA+B,CAAC,CAAC,CAAC,EAClC,sBAAsB,GAAG,oBAAoB,CAC9C;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,aAAa,EAAE,CAAC,EAAE,CAAA;IAClB,KAAK,CAAC,EAAE,CAAC,EAAE,CAAA;CACZ;AAeD,MAAM,WAAW,iBAAiB,CAAC,CAAC,SAAS,YAAY,CACvD,SAAQ,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,EAAE,UAAU,CAAC,EACxC,WAAW,CAAC,uBAAuB,CAAC,CAAC,CAAC,CAAC;CAAG;AAE9C,wBAAgB,YAAY,CAAC,CAAC,SAAS,YAAY,EAAE,EACnD,QAAQ,EACR,gBAAgB,EAAE,iBAAiB,EACnC,GAAG,KAAK,EACT,EAAE,iBAAiB,CAAC,CAAC,CAAC,2CAyKtB"}
1
+ {"version":3,"file":"tag-field-root.d.ts","sourceRoot":"","sources":["../../../src/tag-field/tag-field-root.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,WAAW,CAAA;AAChE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAA;AAmBhE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAClD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAQ5C,UAAU,uBAAuB,CAAC,CAAC,SAAS,MAAM,CAChD,SAAQ,mBAAmB,EACzB,IAAI,CACF,+BAA+B,CAAC,CAAC,CAAC,EAClC,sBAAsB,GAAG,oBAAoB,CAC9C;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,aAAa,EAAE,CAAC,EAAE,CAAA;IAClB,KAAK,CAAC,EAAE,CAAC,EAAE,CAAA;CACZ;AAeD,MAAM,WAAW,iBAAiB,CAAC,CAAC,SAAS,MAAM,CACjD,SAAQ,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,EAAE,UAAU,CAAC,EACxC,WAAW,CAAC,uBAAuB,CAAC,CAAC,CAAC,CAAC;CAAG;AAE9C,wBAAgB,YAAY,CAAC,CAAC,SAAS,MAAM,EAAE,EAC7C,QAAQ,EACR,gBAAgB,EAAE,iBAAiB,EACnC,GAAG,KAAK,EACT,EAAE,iBAAiB,CAAC,CAAC,CAAC,2CAyKtB"}
@@ -1,6 +1,5 @@
1
1
  import type { UseMultipleSelectionReturnValue } from "downshift";
2
2
  import type { SlotsToClasses, TagFieldSlots } from "@opengovsg/oui-theme";
3
- import type { TagFieldItem } from "./types";
4
3
  interface TagFieldTagListRenderProps<T> {
5
4
  item: T;
6
5
  itemProps: ReturnType<UseMultipleSelectionReturnValue<T>["getSelectedItemProps"]>;
@@ -8,10 +7,10 @@ interface TagFieldTagListRenderProps<T> {
8
7
  isDisabled: boolean;
9
8
  isReadOnly: boolean;
10
9
  }
11
- export interface TagFieldTagListProps<T extends TagFieldItem> {
10
+ export interface TagFieldTagListProps<T extends object> {
12
11
  classNames?: Pick<SlotsToClasses<TagFieldSlots>, "tag" | "tagIcon" | "tagText">;
13
12
  children?: React.ReactNode | ((values: TagFieldTagListRenderProps<T>) => React.ReactNode);
14
13
  }
15
- export declare const TagFieldTagList: <T extends TagFieldItem>({ classNames, ...props }: TagFieldTagListProps<T>) => string | number | bigint | boolean | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<import("react").ReactNode> | Promise<string | number | bigint | boolean | import("react").ReactPortal | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<import("react").ReactNode> | null | undefined> | (string | number | bigint | boolean | Iterable<import("react").ReactNode> | Promise<string | number | bigint | boolean | import("react").ReactPortal | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<import("react").ReactNode> | null | undefined> | import("react/jsx-runtime").JSX.Element | null | undefined)[] | null;
14
+ export declare const TagFieldTagList: <T extends object>({ classNames, ...props }: TagFieldTagListProps<T>) => string | number | bigint | boolean | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<import("react").ReactNode> | Promise<string | number | bigint | boolean | import("react").ReactPortal | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<import("react").ReactNode> | null | undefined> | (string | number | bigint | boolean | Iterable<import("react").ReactNode> | Promise<string | number | bigint | boolean | import("react").ReactPortal | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<import("react").ReactNode> | null | undefined> | import("react/jsx-runtime").JSX.Element | null | undefined)[] | null;
16
15
  export {};
17
16
  //# sourceMappingURL=tag-field-tag-list.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"tag-field-tag-list.d.ts","sourceRoot":"","sources":["../../../src/tag-field/tag-field-tag-list.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,WAAW,CAAA;AAIhE,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AAEzE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAG3C,UAAU,0BAA0B,CAAC,CAAC;IACpC,IAAI,EAAE,CAAC,CAAA;IACP,SAAS,EAAE,UAAU,CACnB,+BAA+B,CAAC,CAAC,CAAC,CAAC,sBAAsB,CAAC,CAC3D,CAAA;IACD,kBAAkB,EAAE,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AC,SAAS,CAAC,CAAA;CACjE;AAED,eAAO,MAAM,eAAe,GAAI,CAAC,SAAS,MAAM,4BAG7C,oBAAoB,CAAC,CAAC,CAAC,iwBAwDzB,CAAA"}
@@ -1,3 +1,3 @@
1
- import type { TagFieldItem, TagFieldProps } from "./types";
2
- export declare function TagField<T extends TagFieldItem>({ classNames, children, ...props }: TagFieldProps<T>): import("react/jsx-runtime").JSX.Element;
1
+ import type { TagFieldProps } from "./types";
2
+ export declare function TagField<T extends object>({ classNames, children, ...props }: TagFieldProps<T>): import("react/jsx-runtime").JSX.Element;
3
3
  //# sourceMappingURL=tag-field.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"tag-field.d.ts","sourceRoot":"","sources":["../../../src/tag-field/tag-field.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAQ1D,wBAAgB,QAAQ,CAAC,CAAC,SAAS,YAAY,EAAE,EAC/C,UAAU,EACV,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,aAAa,CAAC,CAAC,CAAC,2CA8ElB"}
1
+ {"version":3,"file":"tag-field.d.ts","sourceRoot":"","sources":["../../../src/tag-field/tag-field.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAQ5C,wBAAgB,QAAQ,CAAC,CAAC,SAAS,MAAM,EAAE,EACzC,UAAU,EACV,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,aAAa,CAAC,CAAC,CAAC,2CA8ElB"}
@@ -19,11 +19,6 @@ export interface TagFieldListRenderProps<T> extends ReturnType<UseComboboxReturn
19
19
  }
20
20
  export interface TagFieldRenderProps<T> extends TagFieldListRenderProps<T> {
21
21
  }
22
- export type TagFieldItem = {
23
- textValue: string;
24
- id: Key;
25
- description?: string;
26
- };
27
22
  export interface TagFieldProps<T> extends Omit<MultipleSelection, "disallowEmptySelection" | "onSelectionChange" | "selectionMode" | "selectedKeys" | "defaultSelectedKeys">, InputBase, TextInputBase, Validation<TagFieldValidationValue>, FocusableProps<HTMLInputElement>, LabelableProps, HelpTextProps, TagFieldVariantProps {
28
23
  classNames?: SlotsToClasses<TagFieldSlots>;
29
24
  itemClassNames?: SlotsToClasses<TagFieldItemSlots>;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/tag-field/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EACd,aAAa,EACb,SAAS,EACT,GAAG,EACH,cAAc,EACd,iBAAiB,EACjB,aAAa,EACb,UAAU,EACX,MAAM,qBAAqB,CAAA;AAC5B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAA;AAC1D,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,WAAW,CAAA;AACvD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAEtC,OAAO,KAAK,EACV,cAAc,EACd,iBAAiB,EACjB,aAAa,EACb,oBAAoB,EACrB,MAAM,sBAAsB,CAAA;AAE7B,MAAM,WAAW,uBAAuB;IACtC,wCAAwC;IACxC,YAAY,EAAE,GAAG,CAAC,GAAG,CAAC,GAAG,IAAI,CAAA;IAC7B,uCAAuC;IACvC,UAAU,EAAE,MAAM,CAAA;CACnB;AAED,MAAM,WAAW,uBAAuB,CAAC,CAAC,CACxC,SAAQ,UAAU,CAAC,sBAAsB,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC;IAC7D,IAAI,EAAE,CAAC,CAAA;IACP,GAAG,EAAE,WAAW,CAAC,KAAK,CAAC,CAAA;IACvB,aAAa,EAAE,OAAO,CAAA;IACtB,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAA;IAC3B,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,cAAc,CAAC,EAAE,cAAc,CAAC,iBAAiB,CAAC,CAAA;CACnD;AAGD,MAAM,WAAW,mBAAmB,CAAC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,CAAC,EAAE,CAAA;IACX,oJAAoJ;IACpJ,YAAY,CAAC,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,IAAI,CAAA;IACxC,yDAAyD;IACzD,iBAAiB,CAAC,EAAE,CAAC,IAAI,EAAE,GAAG,CAAC,GAAG,CAAC,KAAK,IAAI,CAAA;IAC5C,oDAAoD;IACpD,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,8DAA8D;IAC9D,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC1B,oEAAoE;IACpE,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;IAEvC;;OAEG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB;;;OAGG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAA;CAC5B"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opengovsg/oui",
3
- "version": "0.0.0-snapshot-20250318065939",
3
+ "version": "0.0.0-snapshot-20250319030133",
4
4
  "sideEffects": false,
5
5
  "license": "SEE LICENSE IN LICENSE.md",
6
6
  "type": "module",
@@ -47,7 +47,7 @@
47
47
  "prettier": "^3.5.0",
48
48
  "tsx": "^4.19.2",
49
49
  "typescript": "5.7.3",
50
- "@opengovsg/oui-theme": "0.0.5",
50
+ "@opengovsg/oui-theme": "0.0.0-snapshot-20250319030133",
51
51
  "@oui/chromatic": "0.0.0",
52
52
  "@oui/eslint-config": "0.0.0",
53
53
  "@oui/prettier-config": "0.0.0",
@@ -78,11 +78,12 @@
78
78
  "peerDependencies": {
79
79
  "motion": ">=11.12.0 || >=12.0.0-alpha.1",
80
80
  "react-aria-components": "^1.7.1",
81
- "@opengovsg/oui-theme": "0.0.5"
81
+ "@opengovsg/oui-theme": "0.0.0-snapshot-20250319030133"
82
82
  },
83
83
  "prettier": "@oui/prettier-config",
84
84
  "scripts": {
85
85
  "build": "tsx ../../tooling/build-scripts/main.ts --dts --clean",
86
+ "changeset": "cd ../.. && pnpm changeset",
86
87
  "dev": "tsx ../../tooling/build-scripts/main.ts --watch",
87
88
  "lint": "eslint . --max-warnings 0",
88
89
  "lint:fix": "eslint . --fix",