@opengovsg/oui 0.0.0-snapshot-20250326085831 → 0.0.0-snapshot-20250401072718
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.
- package/dist/cjs/banner/banner.cjs +1 -1
- package/dist/cjs/combo-box/combo-box-fuzzy.cjs +3 -3
- package/dist/cjs/combo-box/combo-box-item.cjs +2 -2
- package/dist/cjs/combo-box/combo-box.cjs +3 -2
- package/dist/cjs/index.cjs +24 -13
- package/dist/cjs/menu/index.cjs +15 -0
- package/dist/cjs/menu/menu.cjs +229 -0
- 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
- package/dist/cjs/popover/index.cjs +8 -0
- package/dist/cjs/popover/popover.cjs +46 -0
- package/dist/cjs/range-calendar/range-calendar.cjs +1 -1
- package/dist/cjs/select/select.cjs +5 -2
- package/dist/cjs/system/react-utils/context.cjs +3 -2
- package/dist/cjs/tag-field/tag-field-item.cjs +8 -3
- package/dist/cjs/tag-field/tag-field.cjs +2 -1
- package/dist/esm/banner/banner.js +1 -1
- package/dist/esm/combo-box/combo-box-fuzzy.js +4 -4
- package/dist/esm/combo-box/combo-box-item.js +3 -3
- package/dist/esm/combo-box/combo-box.js +4 -3
- package/dist/esm/index.js +6 -4
- package/dist/esm/menu/index.js +2 -0
- package/dist/esm/menu/menu.js +220 -0
- 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
- package/dist/esm/popover/index.js +2 -0
- package/dist/esm/popover/popover.js +44 -0
- package/dist/esm/range-calendar/range-calendar.js +1 -1
- package/dist/esm/select/select.js +6 -3
- package/dist/esm/system/react-utils/context.js +3 -2
- package/dist/esm/tag-field/tag-field-item.js +9 -4
- package/dist/esm/tag-field/tag-field.js +3 -2
- package/dist/types/combo-box/combo-box-fuzzy.d.ts +2 -2
- package/dist/types/combo-box/combo-box-fuzzy.d.ts.map +1 -1
- package/dist/types/combo-box/combo-box-item.d.ts +3 -3
- package/dist/types/combo-box/combo-box-item.d.ts.map +1 -1
- package/dist/types/combo-box/combo-box.d.ts.map +1 -1
- package/dist/types/index.d.mts +2 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/menu/index.d.ts +2 -0
- package/dist/types/menu/index.d.ts.map +1 -0
- package/dist/types/menu/menu.d.ts +38 -0
- package/dist/types/menu/menu.d.ts.map +1 -0
- package/dist/types/popover/index.d.ts +2 -0
- package/dist/types/popover/index.d.ts.map +1 -0
- package/dist/types/popover/popover.d.ts +21 -0
- package/dist/types/popover/popover.d.ts.map +1 -0
- package/dist/types/range-calendar/range-calendar.d.ts.map +1 -1
- package/dist/types/select/select.d.ts +4 -3
- package/dist/types/select/select.d.ts.map +1 -1
- package/dist/types/system/react-utils/context.d.ts +3 -2
- package/dist/types/system/react-utils/context.d.ts.map +1 -1
- package/dist/types/tag-field/tag-field-item.d.ts +2 -2
- package/dist/types/tag-field/tag-field-item.d.ts.map +1 -1
- package/dist/types/tag-field/tag-field.d.ts.map +1 -1
- package/dist/types/tag-field/types.d.ts +3 -3
- package/dist/types/tag-field/types.d.ts.map +1 -1
- package/package.json +5 -5
|
@@ -7,9 +7,9 @@ var react = require('react');
|
|
|
7
7
|
var reactAria = require('react-aria');
|
|
8
8
|
var reactStately = require('react-stately');
|
|
9
9
|
var ouiTheme = require('@opengovsg/oui-theme');
|
|
10
|
+
var button = require('../button/button.cjs');
|
|
10
11
|
var circleAlert = require('../node_modules/.pnpm/lucide-react@0.475.0_react@19.0.0/node_modules/lucide-react/dist/esm/icons/circle-alert.cjs');
|
|
11
12
|
var info = require('../node_modules/.pnpm/lucide-react@0.475.0_react@19.0.0/node_modules/lucide-react/dist/esm/icons/info.cjs');
|
|
12
|
-
var button = require('../button/button.cjs');
|
|
13
13
|
var x = require('../node_modules/.pnpm/lucide-react@0.475.0_react@19.0.0/node_modules/lucide-react/dist/esm/icons/x.cjs');
|
|
14
14
|
|
|
15
15
|
const i18nStrings = {
|
|
@@ -81,7 +81,7 @@ function ComboBoxFuzzy(originalProps) {
|
|
|
81
81
|
},
|
|
82
82
|
[onInputChangeProp, preparedItems]
|
|
83
83
|
);
|
|
84
|
-
const
|
|
84
|
+
const itemStyles = ouiTheme.listBoxItemStyles(variantProps);
|
|
85
85
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
86
86
|
comboBox.ComboBox,
|
|
87
87
|
{
|
|
@@ -95,7 +95,7 @@ function ComboBoxFuzzy(originalProps) {
|
|
|
95
95
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
96
96
|
reactAriaComponents.Text,
|
|
97
97
|
{
|
|
98
|
-
className:
|
|
98
|
+
className: itemStyles.label({
|
|
99
99
|
className: itemClassNames?.label
|
|
100
100
|
}),
|
|
101
101
|
slot: "label",
|
|
@@ -114,7 +114,7 @@ function ComboBoxFuzzy(originalProps) {
|
|
|
114
114
|
item.description && /* @__PURE__ */ jsxRuntime.jsx(
|
|
115
115
|
reactAriaComponents.Text,
|
|
116
116
|
{
|
|
117
|
-
className:
|
|
117
|
+
className: itemStyles.description({
|
|
118
118
|
className: itemClassNames?.description
|
|
119
119
|
}),
|
|
120
120
|
slot: "description",
|
|
@@ -18,8 +18,8 @@ const ComboBoxItem = utils.forwardRef(function ComboBoxItem2(originalProps, ref)
|
|
|
18
18
|
const [
|
|
19
19
|
{ className, description, children, classNames, ...props },
|
|
20
20
|
variantProps
|
|
21
|
-
] = utils.mapPropsVariants(originalProps, ouiTheme.
|
|
22
|
-
const styles = ouiTheme.
|
|
21
|
+
] = utils.mapPropsVariants(originalProps, ouiTheme.listBoxItemStyles.variantKeys);
|
|
22
|
+
const styles = ouiTheme.listBoxItemStyles(variantProps);
|
|
23
23
|
const defaultTextValue = react.useMemo(() => {
|
|
24
24
|
if (props.textValue) {
|
|
25
25
|
return props.textValue;
|
|
@@ -8,6 +8,7 @@ var reactAria = require('react-aria');
|
|
|
8
8
|
var reactAriaComponents = require('react-aria-components');
|
|
9
9
|
var ouiTheme = require('@opengovsg/oui-theme');
|
|
10
10
|
var field = require('../field/field.cjs');
|
|
11
|
+
var popover = require('../popover/popover.cjs');
|
|
11
12
|
var utils = require('../system/utils.cjs');
|
|
12
13
|
var comboBoxVariantContext = require('./combo-box-variant-context.cjs');
|
|
13
14
|
var chevronUp = require('../node_modules/.pnpm/lucide-react@0.475.0_react@19.0.0/node_modules/lucide-react/dist/esm/icons/chevron-up.cjs');
|
|
@@ -46,7 +47,7 @@ function ComboBoxEmptyState({
|
|
|
46
47
|
size,
|
|
47
48
|
className
|
|
48
49
|
}) {
|
|
49
|
-
const styles = ouiTheme.
|
|
50
|
+
const styles = ouiTheme.listBoxItemStyles({ size });
|
|
50
51
|
const formatMessage = reactAria.useMessageFormatter(i18nStrings);
|
|
51
52
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
52
53
|
"span",
|
|
@@ -194,7 +195,7 @@ function ComboBox(originalProps) {
|
|
|
194
195
|
description && /* @__PURE__ */ jsxRuntime.jsx(field.Description, { size: variantProps.size, children: description }),
|
|
195
196
|
/* @__PURE__ */ jsxRuntime.jsx(field.FieldError, { size: variantProps.size, children: errorMessage }),
|
|
196
197
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
197
|
-
|
|
198
|
+
popover.Popover,
|
|
198
199
|
{
|
|
199
200
|
className: ouiTheme.composeRenderProps(
|
|
200
201
|
classNames?.popover,
|
package/dist/cjs/index.cjs
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
4
|
var useControllableState = require('./hooks/use-controllable-state.cjs');
|
|
5
|
+
var button = require('./button/button.cjs');
|
|
5
6
|
var govtBanner = require('./govt-banner/govt-banner.cjs');
|
|
6
7
|
var ripple = require('./ripple/ripple.cjs');
|
|
7
8
|
var useRipple = require('./ripple/use-ripple.cjs');
|
|
@@ -18,23 +19,25 @@ var comboBox = require('./combo-box/combo-box.cjs');
|
|
|
18
19
|
var comboBoxFuzzy = require('./combo-box/combo-box-fuzzy.cjs');
|
|
19
20
|
var comboBoxItem = require('./combo-box/combo-box-item.cjs');
|
|
20
21
|
var comboBoxVariantContext = require('./combo-box/combo-box-variant-context.cjs');
|
|
22
|
+
var banner = require('./banner/banner.cjs');
|
|
21
23
|
var tagField = require('./tag-field/tag-field.cjs');
|
|
22
24
|
var tagFieldItem = require('./tag-field/tag-field-item.cjs');
|
|
23
25
|
var select = require('./select/select.cjs');
|
|
24
26
|
var selectItem = require('./select/select-item.cjs');
|
|
25
27
|
var selectVariantContext = require('./select/select-variant-context.cjs');
|
|
26
|
-
var rangeCalendar = require('./range-calendar/range-calendar.cjs');
|
|
27
|
-
var button = require('./button/button.cjs');
|
|
28
|
-
var banner = require('./banner/banner.cjs');
|
|
29
28
|
var badge = require('./badge/badge.cjs');
|
|
30
|
-
var date = require('@internationalized/date');
|
|
31
29
|
var calendar = require('./calendar/calendar.cjs');
|
|
32
30
|
var calendarStyleContext = require('./calendar/calendar-style-context.cjs');
|
|
33
31
|
var utils = require('./calendar/utils.cjs');
|
|
32
|
+
var date = require('@internationalized/date');
|
|
33
|
+
var rangeCalendar = require('./range-calendar/range-calendar.cjs');
|
|
34
|
+
var menu = require('./menu/menu.cjs');
|
|
35
|
+
var popover = require('./popover/popover.cjs');
|
|
34
36
|
|
|
35
37
|
|
|
36
38
|
|
|
37
39
|
exports.useControllableState = useControllableState.useControllableState;
|
|
40
|
+
exports.Button = button.Button;
|
|
38
41
|
exports.GovtBanner = govtBanner.GovtBanner;
|
|
39
42
|
exports.Ripple = ripple.Ripple;
|
|
40
43
|
exports.useRipple = useRipple.useRipple;
|
|
@@ -56,22 +59,14 @@ exports.ComboBoxFuzzy = comboBoxFuzzy.ComboBoxFuzzy;
|
|
|
56
59
|
exports.ComboBoxItem = comboBoxItem.ComboBoxItem;
|
|
57
60
|
exports.ComboBoxVariantContext = comboBoxVariantContext.ComboBoxVariantContext;
|
|
58
61
|
exports.useComboBoxVariantContext = comboBoxVariantContext.useComboBoxVariantContext;
|
|
62
|
+
exports.Banner = banner.Banner;
|
|
59
63
|
exports.TagField = tagField.TagField;
|
|
60
64
|
exports.TagFieldItem = tagFieldItem.TagFieldItem;
|
|
61
65
|
exports.Select = select.Select;
|
|
62
66
|
exports.SelectItem = selectItem.SelectItem;
|
|
63
67
|
exports.SelectVariantContext = selectVariantContext.SelectVariantContext;
|
|
64
68
|
exports.useSelectVariantContext = selectVariantContext.useSelectVariantContext;
|
|
65
|
-
exports.RangeCalendar = rangeCalendar.RangeCalendar;
|
|
66
|
-
exports.RangeCalendarCell = rangeCalendar.RangeCalendarCell;
|
|
67
|
-
exports.RangeCalendarStateWrapper = rangeCalendar.RangeCalendarStateWrapper;
|
|
68
|
-
exports.Button = button.Button;
|
|
69
|
-
exports.Banner = banner.Banner;
|
|
70
69
|
exports.Badge = badge.Badge;
|
|
71
|
-
Object.defineProperty(exports, "CalendarDate", {
|
|
72
|
-
enumerable: true,
|
|
73
|
-
get: function () { return date.CalendarDate; }
|
|
74
|
-
});
|
|
75
70
|
exports.Calendar = calendar.Calendar;
|
|
76
71
|
exports.CalendarStateWrapper = calendar.CalendarStateWrapper;
|
|
77
72
|
exports.CalendarStyleContext = calendarStyleContext.CalendarStyleContext;
|
|
@@ -80,3 +75,19 @@ exports.getEraFormat = utils.getEraFormat;
|
|
|
80
75
|
exports.useGenerateLocalizedMonths = utils.useGenerateLocalizedMonths;
|
|
81
76
|
exports.useGenerateLocalizedYears = utils.useGenerateLocalizedYears;
|
|
82
77
|
exports.useLocalizedMonthYear = utils.useLocalizedMonthYear;
|
|
78
|
+
Object.defineProperty(exports, "CalendarDate", {
|
|
79
|
+
enumerable: true,
|
|
80
|
+
get: function () { return date.CalendarDate; }
|
|
81
|
+
});
|
|
82
|
+
exports.RangeCalendar = rangeCalendar.RangeCalendar;
|
|
83
|
+
exports.RangeCalendarCell = rangeCalendar.RangeCalendarCell;
|
|
84
|
+
exports.RangeCalendarStateWrapper = rangeCalendar.RangeCalendarStateWrapper;
|
|
85
|
+
exports.Menu = menu.Menu;
|
|
86
|
+
exports.MenuItem = menu.MenuItem;
|
|
87
|
+
exports.MenuSection = menu.MenuSection;
|
|
88
|
+
exports.MenuSeparator = menu.MenuSeparator;
|
|
89
|
+
exports.MenuTrigger = menu.MenuTrigger;
|
|
90
|
+
exports.MenuVariantContext = menu.MenuVariantContext;
|
|
91
|
+
exports.SubmenuTrigger = menu.SubmenuTrigger;
|
|
92
|
+
exports.useMenuVariantContext = menu.useMenuVariantContext;
|
|
93
|
+
exports.Popover = popover.Popover;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
var menu = require('./menu.cjs');
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
exports.Menu = menu.Menu;
|
|
9
|
+
exports.MenuItem = menu.MenuItem;
|
|
10
|
+
exports.MenuSection = menu.MenuSection;
|
|
11
|
+
exports.MenuSeparator = menu.MenuSeparator;
|
|
12
|
+
exports.MenuTrigger = menu.MenuTrigger;
|
|
13
|
+
exports.MenuVariantContext = menu.MenuVariantContext;
|
|
14
|
+
exports.SubmenuTrigger = menu.SubmenuTrigger;
|
|
15
|
+
exports.useMenuVariantContext = menu.useMenuVariantContext;
|
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
"use client";
|
|
3
|
+
'use strict';
|
|
4
|
+
|
|
5
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
6
|
+
var react = require('react');
|
|
7
|
+
var reactAriaComponents = require('react-aria-components');
|
|
8
|
+
var ouiTheme = require('@opengovsg/oui-theme');
|
|
9
|
+
var popover = require('../popover/popover.cjs');
|
|
10
|
+
var utils = require('../system/utils.cjs');
|
|
11
|
+
var check = require('../node_modules/.pnpm/lucide-react@0.475.0_react@19.0.0/node_modules/lucide-react/dist/esm/icons/check.cjs');
|
|
12
|
+
var chevronRight = require('../node_modules/.pnpm/lucide-react@0.475.0_react@19.0.0/node_modules/lucide-react/dist/esm/icons/chevron-right.cjs');
|
|
13
|
+
var context = require('../system/react-utils/context.cjs');
|
|
14
|
+
|
|
15
|
+
const [MenuVariantContext, useMenuVariantContext] = context.createContext({
|
|
16
|
+
name: "MenuVariantContext",
|
|
17
|
+
strict: false
|
|
18
|
+
});
|
|
19
|
+
function MenuInner(originalProps, ref) {
|
|
20
|
+
[originalProps, ref] = reactAriaComponents.useContextProps(
|
|
21
|
+
originalProps,
|
|
22
|
+
ref,
|
|
23
|
+
MenuVariantContext
|
|
24
|
+
);
|
|
25
|
+
const [props, variantProps] = utils.mapPropsVariants(
|
|
26
|
+
originalProps,
|
|
27
|
+
ouiTheme.menuStyles.variantKeys
|
|
28
|
+
);
|
|
29
|
+
const { className, classNames, placement, ...rest } = props;
|
|
30
|
+
const styles = ouiTheme.menuStyles(variantProps);
|
|
31
|
+
return /* @__PURE__ */ jsxRuntime.jsx(reactAriaComponents.Provider, { values: [[MenuVariantContext, variantProps]], children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
32
|
+
popover.Popover,
|
|
33
|
+
{
|
|
34
|
+
placement,
|
|
35
|
+
className: styles.popover({ className: classNames?.popover }),
|
|
36
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
37
|
+
reactAriaComponents.Menu,
|
|
38
|
+
{
|
|
39
|
+
...rest,
|
|
40
|
+
ref,
|
|
41
|
+
className: reactAriaComponents.composeRenderProps(
|
|
42
|
+
className ?? classNames?.base,
|
|
43
|
+
(className2, renderProps) => styles.base({
|
|
44
|
+
className: className2,
|
|
45
|
+
...renderProps
|
|
46
|
+
})
|
|
47
|
+
)
|
|
48
|
+
}
|
|
49
|
+
)
|
|
50
|
+
}
|
|
51
|
+
) });
|
|
52
|
+
}
|
|
53
|
+
const Menu = utils.forwardRefGeneric(MenuInner);
|
|
54
|
+
const MenuItem = react.forwardRef(function MenuItem2(originalProps, ref) {
|
|
55
|
+
[originalProps, ref] = reactAriaComponents.useContextProps(
|
|
56
|
+
originalProps,
|
|
57
|
+
ref,
|
|
58
|
+
MenuVariantContext
|
|
59
|
+
);
|
|
60
|
+
const [
|
|
61
|
+
{
|
|
62
|
+
classNames,
|
|
63
|
+
className,
|
|
64
|
+
multipleSelectionIcon: multipleSelectionIconProp,
|
|
65
|
+
singleSelectionIcon: singleSelectionIconProp,
|
|
66
|
+
startContent,
|
|
67
|
+
endContent,
|
|
68
|
+
...props
|
|
69
|
+
},
|
|
70
|
+
variantProps
|
|
71
|
+
] = utils.mapPropsVariants(originalProps, ouiTheme.listBoxItemStyles.variantKeys);
|
|
72
|
+
const styles = ouiTheme.menuItemStyles(variantProps);
|
|
73
|
+
const multipleSelectionIcon = react.useMemo(() => {
|
|
74
|
+
if (multipleSelectionIconProp !== void 0) {
|
|
75
|
+
return multipleSelectionIconProp;
|
|
76
|
+
}
|
|
77
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
78
|
+
check.default,
|
|
79
|
+
{
|
|
80
|
+
"aria-hidden": true,
|
|
81
|
+
className: styles.icon({ className: classNames?.icon })
|
|
82
|
+
}
|
|
83
|
+
);
|
|
84
|
+
}, [classNames?.icon, multipleSelectionIconProp, styles]);
|
|
85
|
+
const singleSelectionIcon = react.useMemo(() => {
|
|
86
|
+
if (singleSelectionIconProp !== void 0) {
|
|
87
|
+
return singleSelectionIconProp;
|
|
88
|
+
}
|
|
89
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
90
|
+
check.default,
|
|
91
|
+
{
|
|
92
|
+
"aria-hidden": true,
|
|
93
|
+
className: styles.icon({ className: classNames?.icon })
|
|
94
|
+
}
|
|
95
|
+
);
|
|
96
|
+
}, [classNames?.icon, singleSelectionIconProp, styles]);
|
|
97
|
+
const showIconContainer = react.useCallback(
|
|
98
|
+
(selectionMode) => {
|
|
99
|
+
switch (selectionMode) {
|
|
100
|
+
case "none":
|
|
101
|
+
return false;
|
|
102
|
+
case "multiple":
|
|
103
|
+
return !!multipleSelectionIcon;
|
|
104
|
+
case "single":
|
|
105
|
+
return !!singleSelectionIcon;
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
|
+
[multipleSelectionIcon, singleSelectionIcon]
|
|
109
|
+
);
|
|
110
|
+
const defaultTextValue = react.useMemo(() => {
|
|
111
|
+
if (props.textValue) {
|
|
112
|
+
return props.textValue;
|
|
113
|
+
}
|
|
114
|
+
if (typeof props.children === "string") {
|
|
115
|
+
return props.children;
|
|
116
|
+
}
|
|
117
|
+
return void 0;
|
|
118
|
+
}, [props.children, props.textValue]);
|
|
119
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
120
|
+
reactAriaComponents.MenuItem,
|
|
121
|
+
{
|
|
122
|
+
ref,
|
|
123
|
+
textValue: defaultTextValue,
|
|
124
|
+
...props,
|
|
125
|
+
isDisabled: variantProps.isDisabled,
|
|
126
|
+
className: reactAriaComponents.composeRenderProps(
|
|
127
|
+
className ?? classNames?.container,
|
|
128
|
+
(className2, renderProps) => styles.container({
|
|
129
|
+
className: className2,
|
|
130
|
+
...renderProps
|
|
131
|
+
})
|
|
132
|
+
),
|
|
133
|
+
children: reactAriaComponents.composeRenderProps(
|
|
134
|
+
props.children,
|
|
135
|
+
(children, { selectionMode, isSelected, hasSubmenu }) => /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
136
|
+
startContent,
|
|
137
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
138
|
+
"span",
|
|
139
|
+
{
|
|
140
|
+
className: styles.label({
|
|
141
|
+
className: classNames?.label
|
|
142
|
+
}),
|
|
143
|
+
children
|
|
144
|
+
}
|
|
145
|
+
),
|
|
146
|
+
showIconContainer(selectionMode) && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
147
|
+
"span",
|
|
148
|
+
{
|
|
149
|
+
className: styles.iconContainer({
|
|
150
|
+
className: classNames?.iconContainer
|
|
151
|
+
}),
|
|
152
|
+
children: [
|
|
153
|
+
isSelected && selectionMode === "multiple" && multipleSelectionIcon,
|
|
154
|
+
isSelected && selectionMode === "single" && singleSelectionIcon
|
|
155
|
+
]
|
|
156
|
+
}
|
|
157
|
+
),
|
|
158
|
+
endContent,
|
|
159
|
+
hasSubmenu && /* @__PURE__ */ jsxRuntime.jsx(
|
|
160
|
+
chevronRight.default,
|
|
161
|
+
{
|
|
162
|
+
"aria-hidden": true,
|
|
163
|
+
className: styles.icon({
|
|
164
|
+
className: classNames?.icon
|
|
165
|
+
})
|
|
166
|
+
}
|
|
167
|
+
)
|
|
168
|
+
] })
|
|
169
|
+
)
|
|
170
|
+
}
|
|
171
|
+
);
|
|
172
|
+
});
|
|
173
|
+
function MenuSeparator(props) {
|
|
174
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
175
|
+
reactAriaComponents.Separator,
|
|
176
|
+
{
|
|
177
|
+
...props,
|
|
178
|
+
className: ouiTheme.menuDividerStyles({
|
|
179
|
+
className: props.className
|
|
180
|
+
})
|
|
181
|
+
}
|
|
182
|
+
);
|
|
183
|
+
}
|
|
184
|
+
function MenuSectionInner(originalProps, ref) {
|
|
185
|
+
[originalProps, ref] = reactAriaComponents.useContextProps(
|
|
186
|
+
originalProps,
|
|
187
|
+
ref,
|
|
188
|
+
MenuVariantContext
|
|
189
|
+
);
|
|
190
|
+
const [{ title, classNames, ...props }, variantProps] = utils.mapPropsVariants(
|
|
191
|
+
originalProps,
|
|
192
|
+
ouiTheme.menuSectionStyles.variantKeys
|
|
193
|
+
);
|
|
194
|
+
const styles = ouiTheme.menuSectionStyles(variantProps);
|
|
195
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
196
|
+
reactAriaComponents.MenuSection,
|
|
197
|
+
{
|
|
198
|
+
ref,
|
|
199
|
+
className: styles.base({
|
|
200
|
+
className: props.className ?? classNames?.base
|
|
201
|
+
}),
|
|
202
|
+
...props,
|
|
203
|
+
children: [
|
|
204
|
+
title && /* @__PURE__ */ jsxRuntime.jsx(
|
|
205
|
+
reactAriaComponents.Header,
|
|
206
|
+
{
|
|
207
|
+
className: styles.header({
|
|
208
|
+
className: classNames?.header
|
|
209
|
+
}),
|
|
210
|
+
children: title
|
|
211
|
+
}
|
|
212
|
+
),
|
|
213
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactAriaComponents.Collection, { items: props.items, children: props.children })
|
|
214
|
+
]
|
|
215
|
+
}
|
|
216
|
+
);
|
|
217
|
+
}
|
|
218
|
+
const MenuSection = utils.forwardRefGeneric(MenuSectionInner);
|
|
219
|
+
const MenuTrigger = reactAriaComponents.MenuTrigger;
|
|
220
|
+
const SubmenuTrigger = reactAriaComponents.SubmenuTrigger;
|
|
221
|
+
|
|
222
|
+
exports.Menu = Menu;
|
|
223
|
+
exports.MenuItem = MenuItem;
|
|
224
|
+
exports.MenuSection = MenuSection;
|
|
225
|
+
exports.MenuSeparator = MenuSeparator;
|
|
226
|
+
exports.MenuTrigger = MenuTrigger;
|
|
227
|
+
exports.MenuVariantContext = MenuVariantContext;
|
|
228
|
+
exports.SubmenuTrigger = SubmenuTrigger;
|
|
229
|
+
exports.useMenuVariantContext = useMenuVariantContext;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var createLucideIcon = require('../createLucideIcon.cjs');
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* @license lucide-react v0.475.0 - ISC
|
|
9
|
+
*
|
|
10
|
+
* This source code is licensed under the ISC license.
|
|
11
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
const __iconNode = [["path", { d: "M20 6 9 17l-5-5", key: "1gmf2c" }]];
|
|
16
|
+
const Check = createLucideIcon.default("Check", __iconNode);
|
|
17
|
+
|
|
18
|
+
exports.__iconNode = __iconNode;
|
|
19
|
+
exports.default = Check;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
"use client";
|
|
3
|
+
'use strict';
|
|
4
|
+
|
|
5
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
6
|
+
var reactAriaComponents = require('react-aria-components');
|
|
7
|
+
var ouiTheme = require('@opengovsg/oui-theme');
|
|
8
|
+
|
|
9
|
+
const Popover = ({
|
|
10
|
+
children,
|
|
11
|
+
showArrow,
|
|
12
|
+
className,
|
|
13
|
+
classNames,
|
|
14
|
+
...props
|
|
15
|
+
}) => {
|
|
16
|
+
const popoverContext = reactAriaComponents.useSlottedContext(reactAriaComponents.PopoverContext);
|
|
17
|
+
const isSubmenu = popoverContext?.trigger === "SubmenuTrigger";
|
|
18
|
+
let offset = showArrow ? 12 : 8;
|
|
19
|
+
offset = isSubmenu ? offset - 6 : offset;
|
|
20
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
21
|
+
reactAriaComponents.Popover,
|
|
22
|
+
{
|
|
23
|
+
offset,
|
|
24
|
+
...props,
|
|
25
|
+
className: reactAriaComponents.composeRenderProps(
|
|
26
|
+
className ?? classNames?.base,
|
|
27
|
+
(className2, renderProps) => ouiTheme.popoverStyles({ ...renderProps, className: className2 })
|
|
28
|
+
),
|
|
29
|
+
children: [
|
|
30
|
+
showArrow && /* @__PURE__ */ jsxRuntime.jsx(reactAriaComponents.OverlayArrow, { className: "group", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
31
|
+
"svg",
|
|
32
|
+
{
|
|
33
|
+
width: 12,
|
|
34
|
+
height: 12,
|
|
35
|
+
viewBox: "0 0 12 12",
|
|
36
|
+
className: ouiTheme.popoverArrowStyles({ className: classNames?.arrow }),
|
|
37
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M0 0 L6 6 L12 0" })
|
|
38
|
+
}
|
|
39
|
+
) }),
|
|
40
|
+
children
|
|
41
|
+
]
|
|
42
|
+
}
|
|
43
|
+
);
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
exports.Popover = Popover;
|
|
@@ -8,12 +8,12 @@ var date = require('@internationalized/date');
|
|
|
8
8
|
var reactAriaComponents = require('react-aria-components');
|
|
9
9
|
var useDeepCompare = require('use-deep-compare');
|
|
10
10
|
var ouiTheme = require('@opengovsg/oui-theme');
|
|
11
|
+
var calendarStyleContext = require('../calendar/calendar-style-context.cjs');
|
|
11
12
|
var agnosticCalendarStateContext = require('../calendar/agnostic-calendar-state-context.cjs');
|
|
12
13
|
var calendarBottomContent = require('../calendar/calendar-bottom-content.cjs');
|
|
13
14
|
var calendarGridHeader = require('../calendar/calendar-grid-header.cjs');
|
|
14
15
|
var calendarHeader = require('../calendar/calendar-header.cjs');
|
|
15
16
|
var utils = require('../system/utils.cjs');
|
|
16
|
-
var calendarStyleContext = require('../calendar/calendar-style-context.cjs');
|
|
17
17
|
|
|
18
18
|
const RangeCalendar = react.forwardRef(function RangeCalendar2(originalProps, ref) {
|
|
19
19
|
const [props, variantProps] = utils.mapPropsVariants(
|
|
@@ -6,11 +6,12 @@ var jsxRuntime = require('react/jsx-runtime');
|
|
|
6
6
|
var react = require('react');
|
|
7
7
|
var reactAriaComponents = require('react-aria-components');
|
|
8
8
|
var ouiTheme = require('@opengovsg/oui-theme');
|
|
9
|
+
var button = require('../button/button.cjs');
|
|
9
10
|
var field = require('../field/field.cjs');
|
|
11
|
+
var popover = require('../popover/popover.cjs');
|
|
10
12
|
var utils = require('../system/utils.cjs');
|
|
11
13
|
var selectVariantContext = require('./select-variant-context.cjs');
|
|
12
14
|
var chevronDown = require('../node_modules/.pnpm/lucide-react@0.475.0_react@19.0.0/node_modules/lucide-react/dist/esm/icons/chevron-down.cjs');
|
|
13
|
-
var button = require('../button/button.cjs');
|
|
14
15
|
|
|
15
16
|
const calculateEstimatedRowHeight = (size) => {
|
|
16
17
|
switch (size) {
|
|
@@ -26,6 +27,7 @@ function Select({
|
|
|
26
27
|
label,
|
|
27
28
|
description,
|
|
28
29
|
classNames,
|
|
30
|
+
errorMessage,
|
|
29
31
|
...originalProps
|
|
30
32
|
}) {
|
|
31
33
|
const [_props, variantProps] = utils.mapPropsVariants(
|
|
@@ -90,7 +92,8 @@ function Select({
|
|
|
90
92
|
children: description
|
|
91
93
|
}
|
|
92
94
|
),
|
|
93
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
95
|
+
/* @__PURE__ */ jsxRuntime.jsx(field.FieldError, { size: variantProps.size, className: classNames?.error, children: errorMessage }),
|
|
96
|
+
/* @__PURE__ */ jsxRuntime.jsx(popover.Popover, { className: styles.popover({ className: classNames?.popover }), children: /* @__PURE__ */ jsxRuntime.jsx(reactAriaComponents.Virtualizer, { layout: reactAriaComponents.ListLayout, layoutOptions, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
94
97
|
reactAriaComponents.ListBox,
|
|
95
98
|
{
|
|
96
99
|
autoFocus: true,
|
|
@@ -7,9 +7,10 @@ function createContext(options = {}) {
|
|
|
7
7
|
const {
|
|
8
8
|
strict = true,
|
|
9
9
|
errorMessage = "useContext: `context` is undefined. Seems you forgot to wrap component within the Provider",
|
|
10
|
-
name
|
|
10
|
+
name,
|
|
11
|
+
defaultValue
|
|
11
12
|
} = options;
|
|
12
|
-
const Context = react.createContext(
|
|
13
|
+
const Context = react.createContext(defaultValue);
|
|
13
14
|
Context.displayName = name;
|
|
14
15
|
function useContext() {
|
|
15
16
|
const context = react.useContext(Context);
|
|
@@ -10,15 +10,20 @@ var tagFieldStateContext = require('./tag-field-state-context.cjs');
|
|
|
10
10
|
|
|
11
11
|
const TagFieldItemInner = ({ item, isHighlighted, classNames, ...itemProps }, ref) => {
|
|
12
12
|
const { itemToText, size } = react.useContext(tagFieldStateContext.TagFieldStateContext);
|
|
13
|
-
const styles = ouiTheme.
|
|
13
|
+
const styles = ouiTheme.listBoxItemStyles({ size });
|
|
14
14
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
15
15
|
"li",
|
|
16
16
|
{
|
|
17
17
|
ref,
|
|
18
18
|
...itemProps,
|
|
19
|
-
className: styles.container({
|
|
19
|
+
className: styles.container({
|
|
20
|
+
className: classNames?.container,
|
|
21
|
+
isFocused: isHighlighted,
|
|
22
|
+
isDisabled: itemProps["aria-disabled"]
|
|
23
|
+
}),
|
|
20
24
|
"data-rac": true,
|
|
21
|
-
"data-
|
|
25
|
+
"data-focused": ouiTheme.dataAttr(isHighlighted),
|
|
26
|
+
"data-disabled": ouiTheme.dataAttr(itemProps["aria-disabled"]),
|
|
22
27
|
children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: styles.label({ className: classNames?.label }), children: itemToText(item) })
|
|
23
28
|
}
|
|
24
29
|
);
|
|
@@ -8,6 +8,7 @@ var reactAriaComponents = require('react-aria-components');
|
|
|
8
8
|
var ouiTheme = require('@opengovsg/oui-theme');
|
|
9
9
|
var field = require('../field/field.cjs');
|
|
10
10
|
var input = require('../input/input.cjs');
|
|
11
|
+
var popover = require('../popover/popover.cjs');
|
|
11
12
|
var tagFieldItem = require('./tag-field-item.cjs');
|
|
12
13
|
var tagFieldList = require('./tag-field-list.cjs');
|
|
13
14
|
var tagFieldRoot = require('./tag-field-root.cjs');
|
|
@@ -93,7 +94,7 @@ function TagField({
|
|
|
93
94
|
}
|
|
94
95
|
)
|
|
95
96
|
] }),
|
|
96
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
97
|
+
/* @__PURE__ */ jsxRuntime.jsx(popover.Popover, { className: styles.popover({ className: classNames?.popover }), children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
97
98
|
tagFieldList.TagFieldList,
|
|
98
99
|
{
|
|
99
100
|
className: styles.list({ className: classNames?.list }),
|
|
@@ -5,9 +5,9 @@ import { useMemo, useRef } from 'react';
|
|
|
5
5
|
import { useMessageFormatter, useDisclosure } from 'react-aria';
|
|
6
6
|
import { useDisclosureState } from 'react-stately';
|
|
7
7
|
import { bannerStyles } from '@opengovsg/oui-theme';
|
|
8
|
+
import { Button } from '../button/button.js';
|
|
8
9
|
import CircleAlert from '../node_modules/.pnpm/lucide-react@0.475.0_react@19.0.0/node_modules/lucide-react/dist/esm/icons/circle-alert.js';
|
|
9
10
|
import Info from '../node_modules/.pnpm/lucide-react@0.475.0_react@19.0.0/node_modules/lucide-react/dist/esm/icons/info.js';
|
|
10
|
-
import { Button } from '../button/button.js';
|
|
11
11
|
import X from '../node_modules/.pnpm/lucide-react@0.475.0_react@19.0.0/node_modules/lucide-react/dist/esm/icons/x.js';
|
|
12
12
|
|
|
13
13
|
const i18nStrings = {
|
|
@@ -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,
|
|
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
|
|
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:
|
|
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:
|
|
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 {
|
|
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,
|
|
20
|
-
const styles =
|
|
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;
|