@opengovsg/oui 0.0.0-snapshot-20250313081440 → 0.0.0-snapshot-20250314033948
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/button/button.cjs +1 -1
- package/dist/cjs/index.cjs +13 -13
- package/dist/cjs/select/select-item.cjs +37 -26
- package/dist/cjs/select/select-variant-context.cjs +12 -0
- package/dist/cjs/select/select.cjs +4 -17
- package/dist/cjs/system/react-utils/context.cjs +1 -5
- package/dist/cjs/tag-field/tag-field.cjs +1 -1
- package/dist/esm/button/button.js +1 -1
- package/dist/esm/index.js +6 -6
- package/dist/esm/select/select-item.js +39 -28
- package/dist/esm/select/select-variant-context.js +9 -0
- package/dist/esm/select/select.js +6 -19
- package/dist/esm/system/react-utils/context.js +1 -5
- package/dist/esm/tag-field/tag-field.js +1 -1
- package/dist/types/combo-box/combo-box.d.ts +0 -1
- package/dist/types/combo-box/combo-box.d.ts.map +1 -1
- package/dist/types/select/select-item.d.ts +3 -3
- package/dist/types/select/select-item.d.ts.map +1 -1
- package/dist/types/select/select-variant-context.d.ts +4 -0
- package/dist/types/select/select-variant-context.d.ts.map +1 -0
- package/dist/types/select/select.d.ts +3 -10
- package/dist/types/select/select.d.ts.map +1 -1
- package/dist/types/system/react-utils/context.d.ts +1 -5
- package/dist/types/system/react-utils/context.d.ts.map +1 -1
- package/package.json +3 -3
|
@@ -7,9 +7,9 @@ var react = require('react');
|
|
|
7
7
|
var utils = require('@react-aria/utils');
|
|
8
8
|
var reactAriaComponents = require('react-aria-components');
|
|
9
9
|
var ouiTheme = require('@opengovsg/oui-theme');
|
|
10
|
-
var ripple = require('../ripple/ripple.cjs');
|
|
11
10
|
var useRipple = require('../ripple/use-ripple.cjs');
|
|
12
11
|
var spinner = require('../spinner/spinner.cjs');
|
|
12
|
+
var ripple = require('../ripple/ripple.cjs');
|
|
13
13
|
|
|
14
14
|
const Button = react.forwardRef(
|
|
15
15
|
({
|
package/dist/cjs/index.cjs
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
|
+
var useControllableState = require('./hooks/use-controllable-state.cjs');
|
|
5
|
+
var button = require('./button/button.cjs');
|
|
6
|
+
var govtBanner = require('./govt-banner/govt-banner.cjs');
|
|
4
7
|
var ripple = require('./ripple/ripple.cjs');
|
|
5
8
|
var useRipple = require('./ripple/use-ripple.cjs');
|
|
6
9
|
var spinner = require('./spinner/spinner.cjs');
|
|
@@ -9,20 +12,20 @@ var toggle = require('./toggle/toggle.cjs');
|
|
|
9
12
|
var skipNavLink = require('./skip-nav-link/skip-nav-link.cjs');
|
|
10
13
|
var input = require('./input/input.cjs');
|
|
11
14
|
var textField = require('./text-field/text-field.cjs');
|
|
15
|
+
var field = require('./field/field.cjs');
|
|
12
16
|
var textArea = require('./text-area/text-area.cjs');
|
|
13
17
|
var textAreaField = require('./text-area-field/text-area-field.cjs');
|
|
14
|
-
var tagField = require('./tag-field/tag-field.cjs');
|
|
15
|
-
var select = require('./select/select.cjs');
|
|
16
|
-
var useControllableState = require('./hooks/use-controllable-state.cjs');
|
|
17
|
-
var button = require('./button/button.cjs');
|
|
18
|
-
var govtBanner = require('./govt-banner/govt-banner.cjs');
|
|
19
|
-
var field = require('./field/field.cjs');
|
|
20
18
|
var comboBox = require('./combo-box/combo-box.cjs');
|
|
21
19
|
var comboBoxFuzzy = require('./combo-box/combo-box-fuzzy.cjs');
|
|
22
20
|
var banner = require('./banner/banner.cjs');
|
|
21
|
+
var tagField = require('./tag-field/tag-field.cjs');
|
|
22
|
+
var select = require('./select/select.cjs');
|
|
23
23
|
|
|
24
24
|
|
|
25
25
|
|
|
26
|
+
exports.useControllableState = useControllableState.useControllableState;
|
|
27
|
+
exports.Button = button.Button;
|
|
28
|
+
exports.GovtBanner = govtBanner.GovtBanner;
|
|
26
29
|
exports.Ripple = ripple.Ripple;
|
|
27
30
|
exports.useRipple = useRipple.useRipple;
|
|
28
31
|
exports.Spinner = spinner.Spinner;
|
|
@@ -31,19 +34,16 @@ exports.Toggle = toggle.Toggle;
|
|
|
31
34
|
exports.SkipNavLink = skipNavLink.SkipNavLink;
|
|
32
35
|
exports.Input = input.Input;
|
|
33
36
|
exports.TextField = textField.TextField;
|
|
34
|
-
exports.TextArea = textArea.TextArea;
|
|
35
|
-
exports.TextAreaField = textAreaField.TextAreaField;
|
|
36
|
-
exports.TagField = tagField.TagField;
|
|
37
|
-
exports.Select = select.Select;
|
|
38
|
-
exports.useControllableState = useControllableState.useControllableState;
|
|
39
|
-
exports.Button = button.Button;
|
|
40
|
-
exports.GovtBanner = govtBanner.GovtBanner;
|
|
41
37
|
exports.Description = field.Description;
|
|
42
38
|
exports.FieldError = field.FieldError;
|
|
43
39
|
exports.FieldGroup = field.FieldGroup;
|
|
44
40
|
exports.Label = field.Label;
|
|
41
|
+
exports.TextArea = textArea.TextArea;
|
|
42
|
+
exports.TextAreaField = textAreaField.TextAreaField;
|
|
45
43
|
exports.ComboBox = comboBox.ComboBox;
|
|
46
44
|
exports.ComboBoxEmptyState = comboBox.ComboBoxEmptyState;
|
|
47
45
|
exports.ComboBoxItem = comboBox.ComboBoxItem;
|
|
48
46
|
exports.ComboBoxFuzzy = comboBoxFuzzy.ComboBoxFuzzy;
|
|
49
47
|
exports.Banner = banner.Banner;
|
|
48
|
+
exports.TagField = tagField.TagField;
|
|
49
|
+
exports.Select = select.Select;
|
|
@@ -5,9 +5,15 @@ var jsxRuntime = require('react/jsx-runtime');
|
|
|
5
5
|
var reactAriaComponents = require('react-aria-components');
|
|
6
6
|
var ouiTheme = require('@opengovsg/oui-theme');
|
|
7
7
|
var utils = require('../system/utils.cjs');
|
|
8
|
+
var selectVariantContext = require('./select-variant-context.cjs');
|
|
8
9
|
var check = require('../node_modules/.pnpm/lucide-react@0.475.0_react@19.0.0/node_modules/lucide-react/dist/esm/icons/check.cjs');
|
|
9
10
|
|
|
10
|
-
|
|
11
|
+
const SelectItem = utils.forwardRef(function SelectItem2({ classNames, ...originalProps }, ref) {
|
|
12
|
+
[originalProps, ref] = reactAriaComponents.useContextProps(
|
|
13
|
+
originalProps,
|
|
14
|
+
ref,
|
|
15
|
+
selectVariantContext.SelectVariantContext
|
|
16
|
+
);
|
|
11
17
|
const [props, variantProps] = utils.mapPropsVariants(
|
|
12
18
|
originalProps,
|
|
13
19
|
ouiTheme.selectItemStyles.variantKeys
|
|
@@ -17,36 +23,41 @@ function SelectItem({ classNames, ...originalProps }) {
|
|
|
17
23
|
reactAriaComponents.ListBoxItem,
|
|
18
24
|
{
|
|
19
25
|
...props,
|
|
20
|
-
|
|
26
|
+
ref,
|
|
21
27
|
className: ouiTheme.composeRenderProps(
|
|
22
28
|
props.className ?? classNames?.base,
|
|
23
29
|
(className, renderProps) => styles.base({ className, ...renderProps })
|
|
24
30
|
),
|
|
25
|
-
children: (renderProps) =>
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
31
|
+
children: (renderProps) => {
|
|
32
|
+
if (typeof props.children === "function") {
|
|
33
|
+
return props.children(renderProps);
|
|
34
|
+
}
|
|
35
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
36
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
37
|
+
"span",
|
|
38
|
+
{
|
|
39
|
+
className: styles.text({
|
|
40
|
+
className: classNames?.text,
|
|
41
|
+
...renderProps
|
|
42
|
+
}),
|
|
43
|
+
children: props.children
|
|
44
|
+
}
|
|
45
|
+
),
|
|
46
|
+
renderProps.isSelected && /* @__PURE__ */ jsxRuntime.jsx(
|
|
47
|
+
"span",
|
|
48
|
+
{
|
|
49
|
+
"aria-hidden": true,
|
|
50
|
+
className: styles.icon({
|
|
51
|
+
className: classNames?.icon,
|
|
52
|
+
...renderProps
|
|
53
|
+
}),
|
|
54
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(check.default, {})
|
|
55
|
+
}
|
|
56
|
+
)
|
|
57
|
+
] });
|
|
58
|
+
}
|
|
48
59
|
}
|
|
49
60
|
);
|
|
50
|
-
}
|
|
61
|
+
});
|
|
51
62
|
|
|
52
63
|
exports.SelectItem = SelectItem;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
var context = require('../system/react-utils/context.cjs');
|
|
5
|
+
|
|
6
|
+
const [SelectVariantContext, useSelectVariantContext] = context.createContext({
|
|
7
|
+
name: "SelectVariantContext",
|
|
8
|
+
strict: true
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
exports.SelectVariantContext = SelectVariantContext;
|
|
12
|
+
exports.useSelectVariantContext = useSelectVariantContext;
|
|
@@ -7,7 +7,7 @@ var react = require('react');
|
|
|
7
7
|
var reactAriaComponents = require('react-aria-components');
|
|
8
8
|
var ouiTheme = require('@opengovsg/oui-theme');
|
|
9
9
|
var utils = require('../system/utils.cjs');
|
|
10
|
-
var
|
|
10
|
+
var selectVariantContext = require('./select-variant-context.cjs');
|
|
11
11
|
var chevronsUpDown = require('../node_modules/.pnpm/lucide-react@0.475.0_react@19.0.0/node_modules/lucide-react/dist/esm/icons/chevrons-up-down.cjs');
|
|
12
12
|
var field = require('../field/field.cjs');
|
|
13
13
|
var button = require('../button/button.cjs');
|
|
@@ -26,7 +26,6 @@ function Select({
|
|
|
26
26
|
label,
|
|
27
27
|
description,
|
|
28
28
|
classNames,
|
|
29
|
-
itemClassNames,
|
|
30
29
|
...originalProps
|
|
31
30
|
}) {
|
|
32
31
|
const [_props, variantProps] = utils.mapPropsVariants(
|
|
@@ -43,7 +42,7 @@ function Select({
|
|
|
43
42
|
...listLayoutOptions
|
|
44
43
|
});
|
|
45
44
|
}, [listLayoutOptions, variantProps.size]);
|
|
46
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
45
|
+
return /* @__PURE__ */ jsxRuntime.jsx(reactAriaComponents.Provider, { values: [[selectVariantContext.SelectVariantContext, variantProps]], children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
47
46
|
reactAriaComponents.Select,
|
|
48
47
|
{
|
|
49
48
|
className: ouiTheme.composeRenderProps(
|
|
@@ -93,24 +92,12 @@ function Select({
|
|
|
93
92
|
classNames?.list,
|
|
94
93
|
(className, renderProps) => styles.list({ className, ...renderProps })
|
|
95
94
|
),
|
|
96
|
-
children
|
|
97
|
-
if (typeof children === "function") {
|
|
98
|
-
return children(item);
|
|
99
|
-
}
|
|
100
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
101
|
-
selectItem.SelectItem,
|
|
102
|
-
{
|
|
103
|
-
classNames: itemClassNames,
|
|
104
|
-
size: variantProps.size,
|
|
105
|
-
children: item.textValue
|
|
106
|
-
}
|
|
107
|
-
);
|
|
108
|
-
}
|
|
95
|
+
children
|
|
109
96
|
}
|
|
110
97
|
) }) })
|
|
111
98
|
]
|
|
112
99
|
}
|
|
113
|
-
);
|
|
100
|
+
) });
|
|
114
101
|
}
|
|
115
102
|
|
|
116
103
|
exports.Select = Select;
|
|
@@ -6,13 +6,13 @@ 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 input = require('../input/input.cjs');
|
|
10
9
|
var tagFieldList = require('./tag-field-list.cjs');
|
|
11
10
|
var tagFieldRoot = require('./tag-field-root.cjs');
|
|
12
11
|
var tagFieldTagList = require('./tag-field-tag-list.cjs');
|
|
13
12
|
var tagFieldTrigger = require('./tag-field-trigger.cjs');
|
|
14
13
|
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');
|
|
15
14
|
var field = require('../field/field.cjs');
|
|
15
|
+
var input = require('../input/input.cjs');
|
|
16
16
|
|
|
17
17
|
function TagField({
|
|
18
18
|
classNames,
|
|
@@ -5,9 +5,9 @@ import { forwardRef, useMemo } from 'react';
|
|
|
5
5
|
import { chain } from '@react-aria/utils';
|
|
6
6
|
import { Button as Button$1, composeRenderProps } from 'react-aria-components';
|
|
7
7
|
import { buttonStyles } from '@opengovsg/oui-theme';
|
|
8
|
-
import { Ripple } from '../ripple/ripple.js';
|
|
9
8
|
import { useRipple } from '../ripple/use-ripple.js';
|
|
10
9
|
import { Spinner } from '../spinner/spinner.js';
|
|
10
|
+
import { Ripple } from '../ripple/ripple.js';
|
|
11
11
|
|
|
12
12
|
const Button = forwardRef(
|
|
13
13
|
({
|
package/dist/esm/index.js
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
export { useControllableState } from './hooks/use-controllable-state.js';
|
|
3
|
+
export { Button } from './button/button.js';
|
|
4
|
+
export { GovtBanner } from './govt-banner/govt-banner.js';
|
|
2
5
|
export { Ripple } from './ripple/ripple.js';
|
|
3
6
|
export { useRipple } from './ripple/use-ripple.js';
|
|
4
7
|
export { Spinner } from './spinner/spinner.js';
|
|
@@ -7,14 +10,11 @@ export { Toggle } from './toggle/toggle.js';
|
|
|
7
10
|
export { SkipNavLink } from './skip-nav-link/skip-nav-link.js';
|
|
8
11
|
export { Input } from './input/input.js';
|
|
9
12
|
export { TextField } from './text-field/text-field.js';
|
|
13
|
+
export { Description, FieldError, FieldGroup, Label } from './field/field.js';
|
|
10
14
|
export { TextArea } from './text-area/text-area.js';
|
|
11
15
|
export { TextAreaField } from './text-area-field/text-area-field.js';
|
|
12
|
-
export { TagField } from './tag-field/tag-field.js';
|
|
13
|
-
export { Select } from './select/select.js';
|
|
14
|
-
export { useControllableState } from './hooks/use-controllable-state.js';
|
|
15
|
-
export { Button } from './button/button.js';
|
|
16
|
-
export { GovtBanner } from './govt-banner/govt-banner.js';
|
|
17
|
-
export { Description, FieldError, FieldGroup, Label } from './field/field.js';
|
|
18
16
|
export { ComboBox, ComboBoxEmptyState, ComboBoxItem } from './combo-box/combo-box.js';
|
|
19
17
|
export { ComboBoxFuzzy } from './combo-box/combo-box-fuzzy.js';
|
|
20
18
|
export { Banner } from './banner/banner.js';
|
|
19
|
+
export { TagField } from './tag-field/tag-field.js';
|
|
20
|
+
export { Select } from './select/select.js';
|
|
@@ -1,11 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
3
|
-
import { ListBoxItem } from 'react-aria-components';
|
|
3
|
+
import { useContextProps, ListBoxItem } from 'react-aria-components';
|
|
4
4
|
import { selectItemStyles, composeRenderProps } from '@opengovsg/oui-theme';
|
|
5
|
-
import { mapPropsVariants } from '../system/utils.js';
|
|
5
|
+
import { forwardRef, mapPropsVariants } from '../system/utils.js';
|
|
6
|
+
import { SelectVariantContext } from './select-variant-context.js';
|
|
6
7
|
import Check from '../node_modules/.pnpm/lucide-react@0.475.0_react@19.0.0/node_modules/lucide-react/dist/esm/icons/check.js';
|
|
7
8
|
|
|
8
|
-
|
|
9
|
+
const SelectItem = forwardRef(function SelectItem2({ classNames, ...originalProps }, ref) {
|
|
10
|
+
[originalProps, ref] = useContextProps(
|
|
11
|
+
originalProps,
|
|
12
|
+
ref,
|
|
13
|
+
SelectVariantContext
|
|
14
|
+
);
|
|
9
15
|
const [props, variantProps] = mapPropsVariants(
|
|
10
16
|
originalProps,
|
|
11
17
|
selectItemStyles.variantKeys
|
|
@@ -15,36 +21,41 @@ function SelectItem({ classNames, ...originalProps }) {
|
|
|
15
21
|
ListBoxItem,
|
|
16
22
|
{
|
|
17
23
|
...props,
|
|
18
|
-
|
|
24
|
+
ref,
|
|
19
25
|
className: composeRenderProps(
|
|
20
26
|
props.className ?? classNames?.base,
|
|
21
27
|
(className, renderProps) => styles.base({ className, ...renderProps })
|
|
22
28
|
),
|
|
23
|
-
children: (renderProps) =>
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
29
|
+
children: (renderProps) => {
|
|
30
|
+
if (typeof props.children === "function") {
|
|
31
|
+
return props.children(renderProps);
|
|
32
|
+
}
|
|
33
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
34
|
+
/* @__PURE__ */ jsx(
|
|
35
|
+
"span",
|
|
36
|
+
{
|
|
37
|
+
className: styles.text({
|
|
38
|
+
className: classNames?.text,
|
|
39
|
+
...renderProps
|
|
40
|
+
}),
|
|
41
|
+
children: props.children
|
|
42
|
+
}
|
|
43
|
+
),
|
|
44
|
+
renderProps.isSelected && /* @__PURE__ */ jsx(
|
|
45
|
+
"span",
|
|
46
|
+
{
|
|
47
|
+
"aria-hidden": true,
|
|
48
|
+
className: styles.icon({
|
|
49
|
+
className: classNames?.icon,
|
|
50
|
+
...renderProps
|
|
51
|
+
}),
|
|
52
|
+
children: /* @__PURE__ */ jsx(Check, {})
|
|
53
|
+
}
|
|
54
|
+
)
|
|
55
|
+
] });
|
|
56
|
+
}
|
|
46
57
|
}
|
|
47
58
|
);
|
|
48
|
-
}
|
|
59
|
+
});
|
|
49
60
|
|
|
50
61
|
export { SelectItem };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
import { createContext } from '../system/react-utils/context.js';
|
|
3
|
+
|
|
4
|
+
const [SelectVariantContext, useSelectVariantContext] = createContext({
|
|
5
|
+
name: "SelectVariantContext",
|
|
6
|
+
strict: true
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
export { SelectVariantContext, useSelectVariantContext };
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
"use client";
|
|
3
|
-
import {
|
|
3
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
4
4
|
import { useMemo } from 'react';
|
|
5
|
-
import { ListLayout, Select as Select$1, SelectValue, Popover, Virtualizer, ListBox } from 'react-aria-components';
|
|
5
|
+
import { ListLayout, Provider, Select as Select$1, SelectValue, Popover, Virtualizer, ListBox } from 'react-aria-components';
|
|
6
6
|
import { selectStyles, composeRenderProps } from '@opengovsg/oui-theme';
|
|
7
7
|
import { mapPropsVariants } from '../system/utils.js';
|
|
8
|
-
import {
|
|
8
|
+
import { SelectVariantContext } from './select-variant-context.js';
|
|
9
9
|
import ChevronsUpDown from '../node_modules/.pnpm/lucide-react@0.475.0_react@19.0.0/node_modules/lucide-react/dist/esm/icons/chevrons-up-down.js';
|
|
10
10
|
import { Label, Description } from '../field/field.js';
|
|
11
11
|
import { Button } from '../button/button.js';
|
|
@@ -24,7 +24,6 @@ function Select({
|
|
|
24
24
|
label,
|
|
25
25
|
description,
|
|
26
26
|
classNames,
|
|
27
|
-
itemClassNames,
|
|
28
27
|
...originalProps
|
|
29
28
|
}) {
|
|
30
29
|
const [_props, variantProps] = mapPropsVariants(
|
|
@@ -41,7 +40,7 @@ function Select({
|
|
|
41
40
|
...listLayoutOptions
|
|
42
41
|
});
|
|
43
42
|
}, [listLayoutOptions, variantProps.size]);
|
|
44
|
-
return /* @__PURE__ */ jsxs(
|
|
43
|
+
return /* @__PURE__ */ jsx(Provider, { values: [[SelectVariantContext, variantProps]], children: /* @__PURE__ */ jsxs(
|
|
45
44
|
Select$1,
|
|
46
45
|
{
|
|
47
46
|
className: composeRenderProps(
|
|
@@ -91,24 +90,12 @@ function Select({
|
|
|
91
90
|
classNames?.list,
|
|
92
91
|
(className, renderProps) => styles.list({ className, ...renderProps })
|
|
93
92
|
),
|
|
94
|
-
children
|
|
95
|
-
if (typeof children === "function") {
|
|
96
|
-
return children(item);
|
|
97
|
-
}
|
|
98
|
-
return /* @__PURE__ */ jsx(
|
|
99
|
-
SelectItem,
|
|
100
|
-
{
|
|
101
|
-
classNames: itemClassNames,
|
|
102
|
-
size: variantProps.size,
|
|
103
|
-
children: item.textValue
|
|
104
|
-
}
|
|
105
|
-
);
|
|
106
|
-
}
|
|
93
|
+
children
|
|
107
94
|
}
|
|
108
95
|
) }) })
|
|
109
96
|
]
|
|
110
97
|
}
|
|
111
|
-
);
|
|
98
|
+
) });
|
|
112
99
|
}
|
|
113
100
|
|
|
114
101
|
export { Select };
|
|
@@ -4,13 +4,13 @@ import { jsxs, jsx } from 'react/jsx-runtime';
|
|
|
4
4
|
import { createElement } from 'react';
|
|
5
5
|
import { composeRenderProps, Popover } from 'react-aria-components';
|
|
6
6
|
import { tagFieldStyles } from '@opengovsg/oui-theme';
|
|
7
|
-
import { Input } from '../input/input.js';
|
|
8
7
|
import { TagFieldList, TagFieldListItem } from './tag-field-list.js';
|
|
9
8
|
import { TagFieldRoot } from './tag-field-root.js';
|
|
10
9
|
import { TagFieldTagList } from './tag-field-tag-list.js';
|
|
11
10
|
import { TagFieldTrigger } from './tag-field-trigger.js';
|
|
12
11
|
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
12
|
import { Label, FieldGroup, Description, FieldError } from '../field/field.js';
|
|
13
|
+
import { Input } from '../input/input.js';
|
|
14
14
|
|
|
15
15
|
function TagField({
|
|
16
16
|
classNames,
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { JSX } from "react";
|
|
2
2
|
import type { ComboBoxProps as AriaComboBoxProps, ListBoxItemProps, ListBoxItemRenderProps, ListBoxProps, ListLayoutOptions, ValidationResult } from "react-aria-components";
|
|
3
|
-
import React from "react";
|
|
4
3
|
import type { ComboBoxItemSlots, ComboBoxItemVariantProps, ComboBoxSlots, ComboBoxVariantProps, SlotsToClasses } from "@opengovsg/oui-theme";
|
|
5
4
|
export type ComboBoxItem = {
|
|
6
5
|
value: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"combo-box.d.ts","sourceRoot":"","sources":["../../../src/combo-box/combo-box.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,OAAO,CAAA;AAEhC,OAAO,KAAK,EACV,aAAa,IAAI,iBAAiB,EAClC,gBAAgB,EAChB,sBAAsB,EACtB,YAAY,EAEZ,iBAAiB,EACjB,gBAAgB,EACjB,MAAM,uBAAuB,CAAA;
|
|
1
|
+
{"version":3,"file":"combo-box.d.ts","sourceRoot":"","sources":["../../../src/combo-box/combo-box.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,OAAO,CAAA;AAEhC,OAAO,KAAK,EACV,aAAa,IAAI,iBAAiB,EAClC,gBAAgB,EAChB,sBAAsB,EACtB,YAAY,EAEZ,iBAAiB,EACjB,gBAAgB,EACjB,MAAM,uBAAuB,CAAA;AAgB9B,OAAO,KAAK,EACV,iBAAiB,EACjB,wBAAwB,EACxB,aAAa,EACb,oBAAoB,EACpB,cAAc,EACf,MAAM,sBAAsB,CAAA;AAY7B,MAAM,MAAM,YAAY,GAAG;IACzB,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB,CAAA;AAED,MAAM,WAAW,aAAa,CAAC,CAAC,SAAS,YAAY,GAAG,YAAY,CAClE,SAAQ,oBAAoB,EAC1B,IAAI,CAAC,iBAAiB,CAAC,CAAC,CAAC,EAAE,UAAU,CAAC;IACxC,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,iDAAiD;IACjD,YAAY,CAAC,EAAE,CAAC,EAAE,CAAA;IAClB,+CAA+C;IAC/C,KAAK,CAAC,EAAE,CAAC,EAAE,CAAA;IACX,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAC3B,YAAY,CAAC,EAAE,MAAM,GAAG,CAAC,CAAC,UAAU,EAAE,gBAAgB,KAAK,MAAM,CAAC,CAAA;IAClE,UAAU,CAAC,EAAE,cAAc,CAAC,aAAa,CAAC,GACxC,cAAc,CAAC,aAAa,GAAG,YAAY,CAAC,CAAA;IAC9C,cAAc,CAAC,EAAE,cAAc,CAAC,iBAAiB,CAAC,CAAA;IAClD;;OAEG;IACH,iBAAiB,CAAC,EAAE,iBAAiB,CAAA;IAErC,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,GAAG,CAAC,OAAO,CAAA;IAEnC,mFAAmF;IACnF,YAAY,CAAC,EAAE,YAAY,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC,CAAA;IAE9C;;;;;;;OAOG;IACH,OAAO,CAAC,EAAE,MAAM,IAAI,CAAA;IAEpB,gBAAgB,CAAC,EAAE,YAAY,CAAC,CAAC,CAAC,CAAC,kBAAkB,CAAC,CAAA;CACvD;AAkCD,wBAAgB,kBAAkB,CAAC,EACjC,IAAI,EACJ,SAAS,GACV,EAAE,IAAI,CAAC,oBAAoB,EAAE,MAAM,CAAC,GAAG;IAAE,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,2CAY7D;AAED,wBAAgB,QAAQ,CAAC,CAAC,SAAS,YAAY,EAAE,EAC/C,KAAK,EACL,WAAW,EACX,YAAY,EACZ,UAAU,EACV,cAAc,EACd,IAAI,EACJ,iBAAiB,EACjB,QAAQ,EACR,YAAY,EACZ,OAAO,EACP,gBAAgB,EAAE,oBAAoB,EACtC,GAAG,KAAK,EACT,EAAE,aAAa,CAAC,CAAC,CAAC,2CAwJlB;AAED,MAAM,WAAW,iBACf,SAAQ,gBAAgB,EACtB,wBAAwB;IAC1B,KAAK,EAAE,KAAK,CAAC,SAAS,GAAG,CAAC,CAAC,KAAK,EAAE,sBAAsB,KAAK,KAAK,CAAC,SAAS,CAAC,CAAA;IAC7E;;OAEG;IACH,WAAW,CAAC,EACR,KAAK,CAAC,SAAS,GACf,CAAC,CAAC,KAAK,EAAE,sBAAsB,KAAK,KAAK,CAAC,SAAS,CAAC,CAAA;IACxD,UAAU,CAAC,EAAE,cAAc,CAAC,iBAAiB,CAAC,CAAA;CAC/C;AAED,wBAAgB,YAAY,CAAC,EAC3B,SAAS,EACT,IAAI,EACJ,WAAW,EACX,KAAK,EACL,UAAU,EACV,GAAG,KAAK,EACT,EAAE,iBAAiB,2CAqCnB"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
import type { ReactElement } from "react";
|
|
1
2
|
import type { ListBoxItemProps } from "react-aria-components";
|
|
2
3
|
import type { SelectItemVariantProps, SelectItemVariantSlots, SlotsToClasses } from "@opengovsg/oui-theme";
|
|
3
|
-
interface SelectItemProps extends ListBoxItemProps
|
|
4
|
+
interface SelectItemProps<T extends object> extends ListBoxItemProps<T>, SelectItemVariantProps {
|
|
4
5
|
classNames?: SlotsToClasses<SelectItemVariantSlots>;
|
|
5
|
-
children: string;
|
|
6
6
|
}
|
|
7
|
-
export declare
|
|
7
|
+
export declare const SelectItem: <T extends object>(props: SelectItemProps<T>) => ReactElement;
|
|
8
8
|
export {};
|
|
9
9
|
//# sourceMappingURL=select-item.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"select-item.d.ts","sourceRoot":"","sources":["../../../src/select/select-item.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AAI7D,OAAO,KAAK,EACV,sBAAsB,EACtB,sBAAsB,EACtB,cAAc,EACf,MAAM,sBAAsB,CAAA;
|
|
1
|
+
{"version":3,"file":"select-item.d.ts","sourceRoot":"","sources":["../../../src/select/select-item.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAgB,YAAY,EAAE,MAAM,OAAO,CAAA;AACvD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AAI7D,OAAO,KAAK,EACV,sBAAsB,EACtB,sBAAsB,EACtB,cAAc,EACf,MAAM,sBAAsB,CAAA;AAM7B,UAAU,eAAe,CAAC,CAAC,SAAS,MAAM,CACxC,SAAQ,gBAAgB,CAAC,CAAC,CAAC,EACzB,sBAAsB;IACxB,UAAU,CAAC,EAAE,cAAc,CAAC,sBAAsB,CAAC,CAAA;CACpD;AAED,eAAO,MAAM,UAAU,EAwDjB,CAAC,CAAC,SAAS,MAAM,EAAE,KAAK,EAAE,eAAe,CAAC,CAAC,CAAC,KAAK,YAAY,CAAA"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { ContextValue } from "react-aria-components";
|
|
2
|
+
import type { SelectVariantProps } from "@opengovsg/oui-theme";
|
|
3
|
+
export declare const SelectVariantContext: import("react").Context<ContextValue<SelectVariantProps, any>>, useSelectVariantContext: () => ContextValue<SelectVariantProps, any>;
|
|
4
|
+
//# sourceMappingURL=select-variant-context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"select-variant-context.d.ts","sourceRoot":"","sources":["../../../src/select/select-variant-context.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAA;AAEzD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAA;AAI9D,eAAO,MAAO,oBAAoB,kEAAE,uBAAuB,6CAMzD,CAAA"}
|
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
import type { Key } from "react-aria";
|
|
2
1
|
import type { SelectProps as AriaSelectProps, ListBoxProps, ListLayoutOptions } from "react-aria-components";
|
|
3
|
-
import type {
|
|
2
|
+
import type { SelectVariantSlots, SlotsToClasses, VariantProps } from "@opengovsg/oui-theme";
|
|
4
3
|
import { selectStyles } from "@opengovsg/oui-theme";
|
|
5
|
-
export interface SelectProps<T
|
|
4
|
+
export interface SelectProps<T> extends Omit<AriaSelectProps, "children">, VariantProps<typeof selectStyles> {
|
|
6
5
|
classNames?: SlotsToClasses<SelectVariantSlots>;
|
|
7
|
-
itemClassNames?: SlotsToClasses<SelectItemVariantSlots>;
|
|
8
6
|
/**
|
|
9
7
|
* Any additional props to be spread to the list layout.
|
|
10
8
|
*/
|
|
@@ -15,10 +13,5 @@ export interface SelectProps<T extends SelectItemType = SelectItemType> extends
|
|
|
15
13
|
items: NonNullable<ListBoxProps<T>["items"]>;
|
|
16
14
|
children?: ListBoxProps<T>["children"];
|
|
17
15
|
}
|
|
18
|
-
|
|
19
|
-
textValue: string;
|
|
20
|
-
id: Key;
|
|
21
|
-
};
|
|
22
|
-
export declare function Select<T extends SelectItemType>({ label, description, classNames, itemClassNames, ...originalProps }: SelectProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
23
|
-
export {};
|
|
16
|
+
export declare function Select<T extends object>({ label, description, classNames, ...originalProps }: SelectProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
24
17
|
//# sourceMappingURL=select.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"select.d.ts","sourceRoot":"","sources":["../../../src/select/select.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"select.d.ts","sourceRoot":"","sources":["../../../src/select/select.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,WAAW,IAAI,eAAe,EAC9B,YAAY,EACZ,iBAAiB,EAClB,MAAM,uBAAuB,CAAA;AAa9B,OAAO,KAAK,EAEV,kBAAkB,EAClB,cAAc,EACd,YAAY,EACb,MAAM,sBAAsB,CAAA;AAC7B,OAAO,EAAsB,YAAY,EAAE,MAAM,sBAAsB,CAAA;AAOvE,MAAM,WAAW,WAAW,CAAC,CAAC,CAC5B,SAAQ,IAAI,CAAC,eAAe,EAAE,UAAU,CAAC,EACvC,YAAY,CAAC,OAAO,YAAY,CAAC;IACnC,UAAU,CAAC,EAAE,cAAc,CAAC,kBAAkB,CAAC,CAAA;IAE/C;;OAEG;IACH,iBAAiB,CAAC,EAAE,iBAAiB,CAAA;IAErC,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAE3B,2CAA2C;IAC3C,KAAK,EAAE,WAAW,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAA;IAE5C,QAAQ,CAAC,EAAE,YAAY,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAA;CACvC;AAeD,wBAAgB,MAAM,CAAC,CAAC,SAAS,MAAM,EAAE,EACvC,KAAK,EACL,WAAW,EACX,UAAU,EACV,GAAG,aAAa,EACjB,EAAE,WAAW,CAAC,CAAC,CAAC,2CA4EhB"}
|
|
@@ -13,11 +13,7 @@ export interface CreateContextOptions {
|
|
|
13
13
|
*/
|
|
14
14
|
name?: string;
|
|
15
15
|
}
|
|
16
|
-
export type CreateContextReturn<T> = [
|
|
17
|
-
React.Provider<T>,
|
|
18
|
-
() => T,
|
|
19
|
-
React.Context<T>
|
|
20
|
-
];
|
|
16
|
+
export type CreateContextReturn<T> = [React.Context<T>, () => T];
|
|
21
17
|
/**
|
|
22
18
|
* Creates a named context, provider, and hook.
|
|
23
19
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../../src/system/react-utils/context.ts"],"names":[],"mappings":"AAKA,MAAM,WAAW,oBAAoB;IACnC;;;OAGG;IACH,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAA;CACd;AAED,MAAM,MAAM,mBAAmB,CAAC,CAAC,IAAI
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../../src/system/react-utils/context.ts"],"names":[],"mappings":"AAKA,MAAM,WAAW,oBAAoB;IACnC;;;OAGG;IACH,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAA;CACd;AAED,MAAM,MAAM,mBAAmB,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAA;AAEhE;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,WAAW,EACvC,OAAO,GAAE,oBAAyB,GACjC,mBAAmB,CAAC,WAAW,CAAC,CA0BlC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opengovsg/oui",
|
|
3
|
-
"version": "0.0.0-snapshot-
|
|
3
|
+
"version": "0.0.0-snapshot-20250314033948",
|
|
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.0-snapshot-
|
|
50
|
+
"@opengovsg/oui-theme": "0.0.0-snapshot-20250314033948",
|
|
51
51
|
"@oui/chromatic": "0.0.0",
|
|
52
52
|
"@oui/eslint-config": "0.0.0",
|
|
53
53
|
"@oui/prettier-config": "0.0.0",
|
|
@@ -78,7 +78,7 @@
|
|
|
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.0-snapshot-
|
|
81
|
+
"@opengovsg/oui-theme": "0.0.0-snapshot-20250314033948"
|
|
82
82
|
},
|
|
83
83
|
"prettier": "@oui/prettier-config",
|
|
84
84
|
"scripts": {
|