@opengovsg/oui 0.0.0-snapshot-20250326084237 → 0.0.0-snapshot-20250327091959

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 (64) hide show
  1. package/dist/cjs/banner/banner.cjs +1 -1
  2. package/dist/cjs/button/button.cjs +1 -1
  3. package/dist/cjs/calendar/calendar-month-day-selector.cjs +2 -2
  4. package/dist/cjs/combo-box/combo-box-fuzzy.cjs +3 -3
  5. package/dist/cjs/combo-box/combo-box-item.cjs +2 -2
  6. package/dist/cjs/combo-box/combo-box.cjs +4 -3
  7. package/dist/cjs/index.cjs +20 -9
  8. package/dist/cjs/menu/index.cjs +15 -0
  9. package/dist/cjs/menu/menu.cjs +229 -0
  10. 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
  11. package/dist/cjs/popover/index.cjs +8 -0
  12. package/dist/cjs/popover/popover.cjs +46 -0
  13. package/dist/cjs/range-calendar/range-calendar.cjs +1 -1
  14. package/dist/cjs/select/select.cjs +4 -3
  15. package/dist/cjs/system/react-utils/context.cjs +3 -2
  16. package/dist/cjs/tag-field/tag-field-item.cjs +8 -3
  17. package/dist/cjs/tag-field/tag-field.cjs +4 -3
  18. package/dist/cjs/text-area-field/text-area-field.cjs +1 -1
  19. package/dist/cjs/text-field/text-field.cjs +1 -1
  20. package/dist/esm/banner/banner.js +1 -1
  21. package/dist/esm/button/button.js +1 -1
  22. package/dist/esm/calendar/calendar-month-day-selector.js +2 -2
  23. package/dist/esm/combo-box/combo-box-fuzzy.js +4 -4
  24. package/dist/esm/combo-box/combo-box-item.js +3 -3
  25. package/dist/esm/combo-box/combo-box.js +5 -4
  26. package/dist/esm/index.js +5 -3
  27. package/dist/esm/menu/index.js +2 -0
  28. package/dist/esm/menu/menu.js +220 -0
  29. 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
  30. package/dist/esm/popover/index.js +2 -0
  31. package/dist/esm/popover/popover.js +44 -0
  32. package/dist/esm/range-calendar/range-calendar.js +1 -1
  33. package/dist/esm/select/select.js +4 -3
  34. package/dist/esm/system/react-utils/context.js +3 -2
  35. package/dist/esm/tag-field/tag-field-item.js +9 -4
  36. package/dist/esm/tag-field/tag-field.js +5 -4
  37. package/dist/esm/text-area-field/text-area-field.js +1 -1
  38. package/dist/esm/text-field/text-field.js +1 -1
  39. package/dist/types/combo-box/combo-box-fuzzy.d.ts +2 -2
  40. package/dist/types/combo-box/combo-box-fuzzy.d.ts.map +1 -1
  41. package/dist/types/combo-box/combo-box-item.d.ts +3 -3
  42. package/dist/types/combo-box/combo-box-item.d.ts.map +1 -1
  43. package/dist/types/combo-box/combo-box.d.ts.map +1 -1
  44. package/dist/types/index.d.mts +2 -0
  45. package/dist/types/index.d.ts +2 -0
  46. package/dist/types/index.d.ts.map +1 -1
  47. package/dist/types/menu/index.d.ts +2 -0
  48. package/dist/types/menu/index.d.ts.map +1 -0
  49. package/dist/types/menu/menu.d.ts +38 -0
  50. package/dist/types/menu/menu.d.ts.map +1 -0
  51. package/dist/types/popover/index.d.ts +2 -0
  52. package/dist/types/popover/index.d.ts.map +1 -0
  53. package/dist/types/popover/popover.d.ts +21 -0
  54. package/dist/types/popover/popover.d.ts.map +1 -0
  55. package/dist/types/range-calendar/range-calendar.d.ts.map +1 -1
  56. package/dist/types/select/select.d.ts.map +1 -1
  57. package/dist/types/system/react-utils/context.d.ts +3 -2
  58. package/dist/types/system/react-utils/context.d.ts.map +1 -1
  59. package/dist/types/tag-field/tag-field-item.d.ts +2 -2
  60. package/dist/types/tag-field/tag-field-item.d.ts.map +1 -1
  61. package/dist/types/tag-field/tag-field.d.ts.map +1 -1
  62. package/dist/types/tag-field/types.d.ts +3 -3
  63. package/dist/types/tag-field/types.d.ts.map +1 -1
  64. package/package.json +5 -5
@@ -4,11 +4,11 @@ import { jsx } from 'react/jsx-runtime';
4
4
  import { useContext } from 'react';
5
5
  import { CalendarDate } from '@internationalized/date';
6
6
  import { Group } from 'react-aria-components';
7
+ import { Select } from '../select/select.js';
8
+ import { SelectItem } from '../select/select-item.js';
7
9
  import { AgnosticCalendarStateContext } from './agnostic-calendar-state-context.js';
8
10
  import { useCalendarStyleContext } from './calendar-style-context.js';
9
11
  import { useCalendarSelectors } from './hooks/use-calendar-selectors.js';
10
- import { Select } from '../select/select.js';
11
- import { SelectItem } from '../select/select-item.js';
12
12
  import { useCalendarI18n } from './hooks/use-calendar-i18n.js';
13
13
 
14
14
  const CalendarMonthDaySelector = () => {
@@ -4,7 +4,7 @@ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
4
4
  import { useDeferredValue, useMemo, useState, useCallback } from 'react';
5
5
  import fuzzysort from 'fuzzysort';
6
6
  import { Text } from 'react-aria-components';
7
- import { comboBoxStyles, comboBoxItemStyles, comboBoxFuzzyHighlightedTextStyles } from '@opengovsg/oui-theme';
7
+ import { comboBoxStyles, listBoxItemStyles, comboBoxFuzzyHighlightedTextStyles } from '@opengovsg/oui-theme';
8
8
  import { mapPropsVariants } from '../system/utils.js';
9
9
  import { ComboBox } from './combo-box.js';
10
10
  import { ComboBoxItem } from './combo-box-item.js';
@@ -79,7 +79,7 @@ function ComboBoxFuzzy(originalProps) {
79
79
  },
80
80
  [onInputChangeProp, preparedItems]
81
81
  );
82
- const comboboxItemStyles = comboBoxItemStyles(variantProps);
82
+ const itemStyles = listBoxItemStyles(variantProps);
83
83
  return /* @__PURE__ */ jsx(
84
84
  ComboBox,
85
85
  {
@@ -93,7 +93,7 @@ function ComboBoxFuzzy(originalProps) {
93
93
  /* @__PURE__ */ jsx(
94
94
  Text,
95
95
  {
96
- className: comboboxItemStyles.label({
96
+ className: itemStyles.label({
97
97
  className: itemClassNames?.label
98
98
  }),
99
99
  slot: "label",
@@ -112,7 +112,7 @@ function ComboBoxFuzzy(originalProps) {
112
112
  item.description && /* @__PURE__ */ jsx(
113
113
  Text,
114
114
  {
115
- className: comboboxItemStyles.description({
115
+ className: itemStyles.description({
116
116
  className: itemClassNames?.description
117
117
  }),
118
118
  slot: "description",
@@ -3,7 +3,7 @@
3
3
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
4
4
  import { useMemo } from 'react';
5
5
  import { useContextProps, ListBoxItem, composeRenderProps, Text } from 'react-aria-components';
6
- import { comboBoxItemStyles } from '@opengovsg/oui-theme';
6
+ import { listBoxItemStyles } from '@opengovsg/oui-theme';
7
7
  import { forwardRef, mapPropsVariants } from '../system/utils.js';
8
8
  import { ComboBoxVariantContext } from './combo-box-variant-context.js';
9
9
 
@@ -16,8 +16,8 @@ const ComboBoxItem = forwardRef(function ComboBoxItem2(originalProps, ref) {
16
16
  const [
17
17
  { className, description, children, classNames, ...props },
18
18
  variantProps
19
- ] = mapPropsVariants(originalProps, comboBoxItemStyles.variantKeys);
20
- const styles = comboBoxItemStyles(variantProps);
19
+ ] = mapPropsVariants(originalProps, listBoxItemStyles.variantKeys);
20
+ const styles = listBoxItemStyles(variantProps);
21
21
  const defaultTextValue = useMemo(() => {
22
22
  if (props.textValue) {
23
23
  return props.textValue;
@@ -3,11 +3,12 @@
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, Provider, ComboBox as ComboBox$1, Input, Button, Popover, Virtualizer, ListBox } from 'react-aria-components';
7
- import { comboBoxItemStyles, cn, comboBoxStyles, composeTailwindRenderProps, composeRenderProps, comboBoxClearButtonStyles } from '@opengovsg/oui-theme';
6
+ import { ListLayout, Provider, ComboBox as ComboBox$1, Input, Button, Virtualizer, ListBox } from 'react-aria-components';
7
+ import { listBoxItemStyles, cn, comboBoxStyles, composeTailwindRenderProps, composeRenderProps, comboBoxClearButtonStyles } from '@opengovsg/oui-theme';
8
+ import { Label, FieldGroup, Description, FieldError } from '../field/field.js';
9
+ import { Popover } from '../popover/popover.js';
8
10
  import { mapPropsVariants } from '../system/utils.js';
9
11
  import { ComboBoxVariantContext } from './combo-box-variant-context.js';
10
- import { Label, FieldGroup, Description, FieldError } from '../field/field.js';
11
12
  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';
12
13
  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';
13
14
  import X from '../node_modules/.pnpm/lucide-react@0.475.0_react@19.0.0/node_modules/lucide-react/dist/esm/icons/x.js';
@@ -44,7 +45,7 @@ function ComboBoxEmptyState({
44
45
  size,
45
46
  className
46
47
  }) {
47
- const styles = comboBoxItemStyles({ size });
48
+ const styles = listBoxItemStyles({ size });
48
49
  const formatMessage = useMessageFormatter(i18nStrings);
49
50
  return /* @__PURE__ */ jsx(
50
51
  "span",
package/dist/esm/index.js CHANGED
@@ -1,6 +1,4 @@
1
1
  "use strict";
2
- export { Toggle } from './toggle/toggle.js';
3
- export { TextField } from './text-field/text-field.js';
4
2
  export { useControllableState } from './hooks/use-controllable-state.js';
5
3
  export { Button } from './button/button.js';
6
4
  export { GovtBanner } from './govt-banner/govt-banner.js';
@@ -8,8 +6,10 @@ export { Ripple } from './ripple/ripple.js';
8
6
  export { useRipple } from './ripple/use-ripple.js';
9
7
  export { Spinner } from './spinner/spinner.js';
10
8
  export { useSpinner } from './spinner/use-spinner.js';
9
+ export { Toggle } from './toggle/toggle.js';
11
10
  export { SkipNavLink } from './skip-nav-link/skip-nav-link.js';
12
11
  export { Input } from './input/input.js';
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';
@@ -24,8 +24,10 @@ export { Select } from './select/select.js';
24
24
  export { SelectItem } from './select/select-item.js';
25
25
  export { SelectVariantContext, useSelectVariantContext } from './select/select-variant-context.js';
26
26
  export { Badge } from './badge/badge.js';
27
- export { CalendarDate } from '@internationalized/date';
28
27
  export { Calendar, CalendarStateWrapper } from './calendar/calendar.js';
29
28
  export { CalendarStyleContext, useCalendarStyleContext } from './calendar/calendar-style-context.js';
30
29
  export { getEraFormat, useGenerateLocalizedMonths, useGenerateLocalizedYears, useLocalizedMonthYear } from './calendar/utils.js';
30
+ export { CalendarDate } from '@internationalized/date';
31
31
  export { RangeCalendar, RangeCalendarCell, RangeCalendarStateWrapper } from './range-calendar/range-calendar.js';
32
+ export { Menu, MenuItem, MenuSection, MenuSeparator, MenuTrigger, MenuVariantContext, SubmenuTrigger, useMenuVariantContext } from './menu/menu.js';
33
+ export { Popover } from './popover/popover.js';
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ export { Menu, MenuItem, MenuSection, MenuSeparator, MenuTrigger, MenuVariantContext, SubmenuTrigger, useMenuVariantContext } from './menu.js';
@@ -0,0 +1,220 @@
1
+ "use strict";
2
+ "use client";
3
+ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
4
+ import { forwardRef, useMemo, useCallback } from 'react';
5
+ import { useContextProps, MenuItem as MenuItem$1, composeRenderProps, Provider, Menu as Menu$1, MenuSection as MenuSection$1, Header, Collection, MenuTrigger as MenuTrigger$1, SubmenuTrigger as SubmenuTrigger$1, Separator } from 'react-aria-components';
6
+ import { listBoxItemStyles, menuItemStyles, menuStyles, menuSectionStyles, menuDividerStyles } from '@opengovsg/oui-theme';
7
+ import { Popover } from '../popover/popover.js';
8
+ import { forwardRefGeneric, mapPropsVariants } from '../system/utils.js';
9
+ import Check from '../node_modules/.pnpm/lucide-react@0.475.0_react@19.0.0/node_modules/lucide-react/dist/esm/icons/check.js';
10
+ import ChevronRight from '../node_modules/.pnpm/lucide-react@0.475.0_react@19.0.0/node_modules/lucide-react/dist/esm/icons/chevron-right.js';
11
+ import { createContext } from '../system/react-utils/context.js';
12
+
13
+ const [MenuVariantContext, useMenuVariantContext] = createContext({
14
+ name: "MenuVariantContext",
15
+ strict: false
16
+ });
17
+ function MenuInner(originalProps, ref) {
18
+ [originalProps, ref] = useContextProps(
19
+ originalProps,
20
+ ref,
21
+ MenuVariantContext
22
+ );
23
+ const [props, variantProps] = mapPropsVariants(
24
+ originalProps,
25
+ menuStyles.variantKeys
26
+ );
27
+ const { className, classNames, placement, ...rest } = props;
28
+ const styles = menuStyles(variantProps);
29
+ return /* @__PURE__ */ jsx(Provider, { values: [[MenuVariantContext, variantProps]], children: /* @__PURE__ */ jsx(
30
+ Popover,
31
+ {
32
+ placement,
33
+ className: styles.popover({ className: classNames?.popover }),
34
+ children: /* @__PURE__ */ jsx(
35
+ Menu$1,
36
+ {
37
+ ...rest,
38
+ ref,
39
+ className: composeRenderProps(
40
+ className ?? classNames?.base,
41
+ (className2, renderProps) => styles.base({
42
+ className: className2,
43
+ ...renderProps
44
+ })
45
+ )
46
+ }
47
+ )
48
+ }
49
+ ) });
50
+ }
51
+ const Menu = forwardRefGeneric(MenuInner);
52
+ const MenuItem = forwardRef(function MenuItem2(originalProps, ref) {
53
+ [originalProps, ref] = useContextProps(
54
+ originalProps,
55
+ ref,
56
+ MenuVariantContext
57
+ );
58
+ const [
59
+ {
60
+ classNames,
61
+ className,
62
+ multipleSelectionIcon: multipleSelectionIconProp,
63
+ singleSelectionIcon: singleSelectionIconProp,
64
+ startContent,
65
+ endContent,
66
+ ...props
67
+ },
68
+ variantProps
69
+ ] = mapPropsVariants(originalProps, listBoxItemStyles.variantKeys);
70
+ const styles = menuItemStyles(variantProps);
71
+ const multipleSelectionIcon = useMemo(() => {
72
+ if (multipleSelectionIconProp !== void 0) {
73
+ return multipleSelectionIconProp;
74
+ }
75
+ return /* @__PURE__ */ jsx(
76
+ Check,
77
+ {
78
+ "aria-hidden": true,
79
+ className: styles.icon({ className: classNames?.icon })
80
+ }
81
+ );
82
+ }, [classNames?.icon, multipleSelectionIconProp, styles]);
83
+ const singleSelectionIcon = useMemo(() => {
84
+ if (singleSelectionIconProp !== void 0) {
85
+ return singleSelectionIconProp;
86
+ }
87
+ return /* @__PURE__ */ jsx(
88
+ Check,
89
+ {
90
+ "aria-hidden": true,
91
+ className: styles.icon({ className: classNames?.icon })
92
+ }
93
+ );
94
+ }, [classNames?.icon, singleSelectionIconProp, styles]);
95
+ const showIconContainer = useCallback(
96
+ (selectionMode) => {
97
+ switch (selectionMode) {
98
+ case "none":
99
+ return false;
100
+ case "multiple":
101
+ return !!multipleSelectionIcon;
102
+ case "single":
103
+ return !!singleSelectionIcon;
104
+ }
105
+ },
106
+ [multipleSelectionIcon, singleSelectionIcon]
107
+ );
108
+ const defaultTextValue = useMemo(() => {
109
+ if (props.textValue) {
110
+ return props.textValue;
111
+ }
112
+ if (typeof props.children === "string") {
113
+ return props.children;
114
+ }
115
+ return void 0;
116
+ }, [props.children, props.textValue]);
117
+ return /* @__PURE__ */ jsx(
118
+ MenuItem$1,
119
+ {
120
+ ref,
121
+ textValue: defaultTextValue,
122
+ ...props,
123
+ isDisabled: variantProps.isDisabled,
124
+ className: composeRenderProps(
125
+ className ?? classNames?.container,
126
+ (className2, renderProps) => styles.container({
127
+ className: className2,
128
+ ...renderProps
129
+ })
130
+ ),
131
+ children: composeRenderProps(
132
+ props.children,
133
+ (children, { selectionMode, isSelected, hasSubmenu }) => /* @__PURE__ */ jsxs(Fragment, { children: [
134
+ startContent,
135
+ /* @__PURE__ */ jsx(
136
+ "span",
137
+ {
138
+ className: styles.label({
139
+ className: classNames?.label
140
+ }),
141
+ children
142
+ }
143
+ ),
144
+ showIconContainer(selectionMode) && /* @__PURE__ */ jsxs(
145
+ "span",
146
+ {
147
+ className: styles.iconContainer({
148
+ className: classNames?.iconContainer
149
+ }),
150
+ children: [
151
+ isSelected && selectionMode === "multiple" && multipleSelectionIcon,
152
+ isSelected && selectionMode === "single" && singleSelectionIcon
153
+ ]
154
+ }
155
+ ),
156
+ endContent,
157
+ hasSubmenu && /* @__PURE__ */ jsx(
158
+ ChevronRight,
159
+ {
160
+ "aria-hidden": true,
161
+ className: styles.icon({
162
+ className: classNames?.icon
163
+ })
164
+ }
165
+ )
166
+ ] })
167
+ )
168
+ }
169
+ );
170
+ });
171
+ function MenuSeparator(props) {
172
+ return /* @__PURE__ */ jsx(
173
+ Separator,
174
+ {
175
+ ...props,
176
+ className: menuDividerStyles({
177
+ className: props.className
178
+ })
179
+ }
180
+ );
181
+ }
182
+ function MenuSectionInner(originalProps, ref) {
183
+ [originalProps, ref] = useContextProps(
184
+ originalProps,
185
+ ref,
186
+ MenuVariantContext
187
+ );
188
+ const [{ title, classNames, ...props }, variantProps] = mapPropsVariants(
189
+ originalProps,
190
+ menuSectionStyles.variantKeys
191
+ );
192
+ const styles = menuSectionStyles(variantProps);
193
+ return /* @__PURE__ */ jsxs(
194
+ MenuSection$1,
195
+ {
196
+ ref,
197
+ className: styles.base({
198
+ className: props.className ?? classNames?.base
199
+ }),
200
+ ...props,
201
+ children: [
202
+ title && /* @__PURE__ */ jsx(
203
+ Header,
204
+ {
205
+ className: styles.header({
206
+ className: classNames?.header
207
+ }),
208
+ children: title
209
+ }
210
+ ),
211
+ /* @__PURE__ */ jsx(Collection, { items: props.items, children: props.children })
212
+ ]
213
+ }
214
+ );
215
+ }
216
+ const MenuSection = forwardRefGeneric(MenuSectionInner);
217
+ const MenuTrigger = MenuTrigger$1;
218
+ const SubmenuTrigger = SubmenuTrigger$1;
219
+
220
+ export { Menu, MenuItem, MenuSection, MenuSeparator, MenuTrigger, MenuVariantContext, SubmenuTrigger, useMenuVariantContext };
@@ -0,0 +1,14 @@
1
+ import createLucideIcon from '../createLucideIcon.js';
2
+
3
+ /**
4
+ * @license lucide-react v0.475.0 - ISC
5
+ *
6
+ * This source code is licensed under the ISC license.
7
+ * See the LICENSE file in the root directory of this source tree.
8
+ */
9
+
10
+
11
+ const __iconNode = [["path", { d: "M20 6 9 17l-5-5", key: "1gmf2c" }]];
12
+ const Check = createLucideIcon("Check", __iconNode);
13
+
14
+ export { __iconNode, Check as default };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ export { Popover } from './popover.js';
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ "use client";
3
+ import { jsxs, jsx } from 'react/jsx-runtime';
4
+ import { useSlottedContext, PopoverContext, Popover as Popover$1, composeRenderProps, OverlayArrow } from 'react-aria-components';
5
+ import { popoverArrowStyles, popoverStyles } from '@opengovsg/oui-theme';
6
+
7
+ const Popover = ({
8
+ children,
9
+ showArrow,
10
+ className,
11
+ classNames,
12
+ ...props
13
+ }) => {
14
+ const popoverContext = useSlottedContext(PopoverContext);
15
+ const isSubmenu = popoverContext?.trigger === "SubmenuTrigger";
16
+ let offset = showArrow ? 12 : 8;
17
+ offset = isSubmenu ? offset - 6 : offset;
18
+ return /* @__PURE__ */ jsxs(
19
+ Popover$1,
20
+ {
21
+ offset,
22
+ ...props,
23
+ className: composeRenderProps(
24
+ className ?? classNames?.base,
25
+ (className2, renderProps) => popoverStyles({ ...renderProps, className: className2 })
26
+ ),
27
+ children: [
28
+ showArrow && /* @__PURE__ */ jsx(OverlayArrow, { className: "group", children: /* @__PURE__ */ jsx(
29
+ "svg",
30
+ {
31
+ width: 12,
32
+ height: 12,
33
+ viewBox: "0 0 12 12",
34
+ className: popoverArrowStyles({ className: classNames?.arrow }),
35
+ children: /* @__PURE__ */ jsx("path", { d: "M0 0 L6 6 L12 0" })
36
+ }
37
+ ) }),
38
+ children
39
+ ]
40
+ }
41
+ );
42
+ };
43
+
44
+ export { Popover };
@@ -6,12 +6,12 @@ import { CalendarDate, today, getLocalTimeZone, getDayOfWeek } from '@internatio
6
6
  import { RangeCalendar as RangeCalendar$1, Provider, CalendarGrid, CalendarGridBody, Text, RangeCalendarStateContext, useLocale, CalendarCell } from 'react-aria-components';
7
7
  import { useDeepCompareMemo } from 'use-deep-compare';
8
8
  import { calendarStyles, composeRenderProps, cn, dataAttr } from '@opengovsg/oui-theme';
9
+ import { CalendarStyleContext, useCalendarStyleContext } from '../calendar/calendar-style-context.js';
9
10
  import { AgnosticCalendarStateContext } from '../calendar/agnostic-calendar-state-context.js';
10
11
  import { CalendarBottomContent } from '../calendar/calendar-bottom-content.js';
11
12
  import { CalendarGridHeader } from '../calendar/calendar-grid-header.js';
12
13
  import { CalendarHeader } from '../calendar/calendar-header.js';
13
14
  import { mapPropsVariants } from '../system/utils.js';
14
- import { CalendarStyleContext, useCalendarStyleContext } from '../calendar/calendar-style-context.js';
15
15
 
16
16
  const RangeCalendar = forwardRef(function RangeCalendar2(originalProps, ref) {
17
17
  const [props, variantProps] = mapPropsVariants(
@@ -2,13 +2,14 @@
2
2
  "use client";
3
3
  import { jsx, jsxs } from 'react/jsx-runtime';
4
4
  import { useMemo } from 'react';
5
- import { Provider, Select as Select$1, SelectValue, Popover, Virtualizer, ListLayout, ListBox } from 'react-aria-components';
5
+ import { Provider, Select as Select$1, SelectValue, Virtualizer, ListLayout, ListBox } from 'react-aria-components';
6
6
  import { selectStyles, composeRenderProps } from '@opengovsg/oui-theme';
7
+ import { Button } from '../button/button.js';
8
+ import { Label, Description } from '../field/field.js';
9
+ import { Popover } from '../popover/popover.js';
7
10
  import { mapPropsVariants } from '../system/utils.js';
8
11
  import { SelectVariantContext } from './select-variant-context.js';
9
- import { Label, Description } from '../field/field.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';
11
- import { Button } from '../button/button.js';
12
13
 
13
14
  const calculateEstimatedRowHeight = (size) => {
14
15
  switch (size) {
@@ -5,9 +5,10 @@ function createContext(options = {}) {
5
5
  const {
6
6
  strict = true,
7
7
  errorMessage = "useContext: `context` is undefined. Seems you forgot to wrap component within the Provider",
8
- name
8
+ name,
9
+ defaultValue
9
10
  } = options;
10
- const Context = createContext$1(void 0);
11
+ const Context = createContext$1(defaultValue);
11
12
  Context.displayName = name;
12
13
  function useContext$1() {
13
14
  const context = useContext(Context);
@@ -2,21 +2,26 @@
2
2
  "use client";
3
3
  import { jsx } from 'react/jsx-runtime';
4
4
  import { useContext } from 'react';
5
- import { tagFieldItemStyles, dataAttr } from '@opengovsg/oui-theme';
5
+ import { listBoxItemStyles, dataAttr } from '@opengovsg/oui-theme';
6
6
  import { forwardRefGeneric } from '../system/utils.js';
7
7
  import { TagFieldStateContext } from './tag-field-state-context.js';
8
8
 
9
9
  const TagFieldItemInner = ({ item, isHighlighted, classNames, ...itemProps }, ref) => {
10
10
  const { itemToText, size } = useContext(TagFieldStateContext);
11
- const styles = tagFieldItemStyles({ size });
11
+ const styles = listBoxItemStyles({ size });
12
12
  return /* @__PURE__ */ jsx(
13
13
  "li",
14
14
  {
15
15
  ref,
16
16
  ...itemProps,
17
- className: styles.container({ className: classNames?.container }),
17
+ className: styles.container({
18
+ className: classNames?.container,
19
+ isFocused: isHighlighted,
20
+ isDisabled: itemProps["aria-disabled"]
21
+ }),
18
22
  "data-rac": true,
19
- "data-hovered": dataAttr(isHighlighted),
23
+ "data-focused": dataAttr(isHighlighted),
24
+ "data-disabled": dataAttr(itemProps["aria-disabled"]),
20
25
  children: /* @__PURE__ */ jsx("span", { className: styles.label({ className: classNames?.label }), children: itemToText(item) })
21
26
  }
22
27
  );
@@ -2,16 +2,17 @@
2
2
  "use client";
3
3
  import { jsxs, jsx } from 'react/jsx-runtime';
4
4
  import { createElement } from 'react';
5
- import { composeRenderProps, Popover } from 'react-aria-components';
5
+ import { composeRenderProps } from 'react-aria-components';
6
6
  import { tagFieldStyles } from '@opengovsg/oui-theme';
7
+ import { Label, FieldGroup, Description, FieldError } from '../field/field.js';
8
+ import { Input } from '../input/input.js';
9
+ import { Popover } from '../popover/popover.js';
7
10
  import { TagFieldItem } from './tag-field-item.js';
8
11
  import { TagFieldList } from './tag-field-list.js';
9
12
  import { TagFieldRoot } from './tag-field-root.js';
10
13
  import { TagFieldTagList } from './tag-field-tag-list.js';
11
14
  import { TagFieldTrigger } from './tag-field-trigger.js';
12
15
  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';
13
- import { Label, FieldGroup, Description, FieldError } from '../field/field.js';
14
- import { Input } from '../input/input.js';
15
16
 
16
17
  function TagField({
17
18
  classNames,
@@ -91,7 +92,7 @@ function TagField({
91
92
  }
92
93
  )
93
94
  ] }),
94
- /* @__PURE__ */ jsx(Popover, { children: /* @__PURE__ */ jsx(
95
+ /* @__PURE__ */ jsx(Popover, { className: styles.popover({ className: classNames?.popover }), children: /* @__PURE__ */ jsx(
95
96
  TagFieldList,
96
97
  {
97
98
  className: styles.list({ className: classNames?.list }),
@@ -3,8 +3,8 @@
3
3
  import { jsxs, jsx } from 'react/jsx-runtime';
4
4
  import { TextField } from 'react-aria-components';
5
5
  import { composeTailwindRenderProps } from '@opengovsg/oui-theme';
6
- import { TextArea } from '../text-area/text-area.js';
7
6
  import { Label, Description, FieldError } from '../field/field.js';
7
+ import { TextArea } from '../text-area/text-area.js';
8
8
 
9
9
  function TextAreaField({
10
10
  label,
@@ -3,8 +3,8 @@
3
3
  import { jsxs, jsx } from 'react/jsx-runtime';
4
4
  import { TextField as TextField$1 } from 'react-aria-components';
5
5
  import { composeTailwindRenderProps } from '@opengovsg/oui-theme';
6
- import { Input } from '../input/input.js';
7
6
  import { Label, Description, FieldError } from '../field/field.js';
7
+ import { Input } from '../input/input.js';
8
8
 
9
9
  function TextField({
10
10
  label,
@@ -1,6 +1,6 @@
1
1
  import type { Key } from "react-aria";
2
2
  import type { SetRequired } from "type-fest";
3
- import type { ComboBoxItemSlots, SlotsToClasses } from "@opengovsg/oui-theme";
3
+ import type { ListBoxItemSlots, SlotsToClasses } from "@opengovsg/oui-theme";
4
4
  import type { ComboBoxProps } from "./combo-box";
5
5
  import { ComboBoxItem } from "./combo-box-item";
6
6
  type ComboBoxItem = {
@@ -9,7 +9,7 @@ type ComboBoxItem = {
9
9
  description?: string;
10
10
  };
11
11
  export interface ComboBoxFuzzyProps<T extends ComboBoxItem = ComboBoxItem> extends SetRequired<ComboBoxProps<T>, "inputValue" | "onInputChange" | "onSelectionChange" | "selectedKey" | "items"> {
12
- itemClassNames?: SlotsToClasses<ComboBoxItemSlots> & SlotsToClasses<"highlight">;
12
+ itemClassNames?: SlotsToClasses<ListBoxItemSlots> & SlotsToClasses<"highlight">;
13
13
  }
14
14
  /**
15
15
  * Controlled variant of ComboBox, allows for fuzzy search and item highlight.
@@ -1 +1 @@
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"}
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,gBAAgB,EAChB,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,gBAAgB,CAAC,GAC/C,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"}
@@ -1,11 +1,11 @@
1
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 {
2
+ import type { ListBoxItemSlots, ListBoxItemVariantProps, SlotsToClasses } from "@opengovsg/oui-theme";
3
+ export interface ComboBoxItemProps extends ListBoxItemProps, ListBoxItemVariantProps {
4
4
  /**
5
5
  * Description for the item, if any
6
6
  */
7
7
  description?: React.ReactNode;
8
- classNames?: SlotsToClasses<ComboBoxItemSlots>;
8
+ classNames?: SlotsToClasses<ListBoxItemSlots>;
9
9
  }
10
10
  export declare const ComboBoxItem: import("../system/utils").InternalForwardRefRenderFunction<import("../system/types").As, ComboBoxItemProps, never>;
11
11
  //# sourceMappingURL=combo-box-item.d.ts.map
@@ -1 +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"}
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,gBAAgB,EAChB,uBAAuB,EACvB,cAAc,EACf,MAAM,sBAAsB,CAAA;AAM7B,MAAM,WAAW,iBACf,SAAQ,gBAAgB,EACtB,uBAAuB;IACzB;;OAEG;IACH,WAAW,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAC7B,UAAU,CAAC,EAAE,cAAc,CAAC,gBAAgB,CAAC,CAAA;CAC9C;AAED,eAAO,MAAM,YAAY,oHAgEvB,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"combo-box.d.ts","sourceRoot":"","sources":["../../../src/combo-box/combo-box.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,aAAa,IA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CD,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"}
@@ -17,4 +17,6 @@ export * from "./select";
17
17
  export * from "./badge";
18
18
  export * from "./calendar";
19
19
  export * from "./range-calendar";
20
+ export * from "./menu";
21
+ export * from "./popover";
20
22
  //# sourceMappingURL=index.d.ts.map
@@ -17,4 +17,6 @@ export * from "./select";
17
17
  export * from "./badge";
18
18
  export * from "./calendar";
19
19
  export * from "./range-calendar";
20
+ export * from "./menu";
21
+ export * from "./popover";
20
22
  //# 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;AACxB,cAAc,SAAS,CAAA;AACvB,cAAc,YAAY,CAAA;AAC1B,cAAc,kBAAkB,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;AACvB,cAAc,YAAY,CAAA;AAC1B,cAAc,kBAAkB,CAAA;AAChC,cAAc,QAAQ,CAAA;AACtB,cAAc,WAAW,CAAA"}
@@ -0,0 +1,2 @@
1
+ export * from "./menu";
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/menu/index.tsx"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAA"}