@opengovsg/oui 0.0.0-snapshot-20250327091959 → 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.
|
@@ -27,6 +27,7 @@ function Select({
|
|
|
27
27
|
label,
|
|
28
28
|
description,
|
|
29
29
|
classNames,
|
|
30
|
+
errorMessage,
|
|
30
31
|
...originalProps
|
|
31
32
|
}) {
|
|
32
33
|
const [_props, variantProps] = utils.mapPropsVariants(
|
|
@@ -91,6 +92,7 @@ function Select({
|
|
|
91
92
|
children: description
|
|
92
93
|
}
|
|
93
94
|
),
|
|
95
|
+
/* @__PURE__ */ jsxRuntime.jsx(field.FieldError, { size: variantProps.size, className: classNames?.error, children: errorMessage }),
|
|
94
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(
|
|
95
97
|
reactAriaComponents.ListBox,
|
|
96
98
|
{
|
|
@@ -5,7 +5,7 @@ import { useMemo } from 'react';
|
|
|
5
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
7
|
import { Button } from '../button/button.js';
|
|
8
|
-
import { Label, Description } from '../field/field.js';
|
|
8
|
+
import { Label, Description, FieldError } from '../field/field.js';
|
|
9
9
|
import { Popover } from '../popover/popover.js';
|
|
10
10
|
import { mapPropsVariants } from '../system/utils.js';
|
|
11
11
|
import { SelectVariantContext } from './select-variant-context.js';
|
|
@@ -25,6 +25,7 @@ function Select({
|
|
|
25
25
|
label,
|
|
26
26
|
description,
|
|
27
27
|
classNames,
|
|
28
|
+
errorMessage,
|
|
28
29
|
...originalProps
|
|
29
30
|
}) {
|
|
30
31
|
const [_props, variantProps] = mapPropsVariants(
|
|
@@ -89,6 +90,7 @@ function Select({
|
|
|
89
90
|
children: description
|
|
90
91
|
}
|
|
91
92
|
),
|
|
93
|
+
/* @__PURE__ */ jsx(FieldError, { size: variantProps.size, className: classNames?.error, children: errorMessage }),
|
|
92
94
|
/* @__PURE__ */ jsx(Popover, { className: styles.popover({ className: classNames?.popover }), children: /* @__PURE__ */ jsx(Virtualizer, { layout: ListLayout, layoutOptions, children: /* @__PURE__ */ jsx(
|
|
93
95
|
ListBox,
|
|
94
96
|
{
|
|
@@ -1,17 +1,18 @@
|
|
|
1
|
-
import type { SelectProps as AriaSelectProps, ListBoxProps, ListLayoutOptions } from "react-aria-components";
|
|
1
|
+
import type { SelectProps as AriaSelectProps, ListBoxProps, ListLayoutOptions, ValidationResult } from "react-aria-components";
|
|
2
2
|
import type { SelectVariantSlots, SlotsToClasses, VariantProps } from "@opengovsg/oui-theme";
|
|
3
3
|
import { selectStyles } from "@opengovsg/oui-theme";
|
|
4
4
|
export interface SelectProps<T> extends Omit<AriaSelectProps, "children">, VariantProps<typeof selectStyles> {
|
|
5
|
-
classNames?: SlotsToClasses<SelectVariantSlots>;
|
|
5
|
+
classNames?: SlotsToClasses<SelectVariantSlots | "error">;
|
|
6
6
|
/**
|
|
7
7
|
* Any additional props to be spread to the list layout.
|
|
8
8
|
*/
|
|
9
9
|
listLayoutOptions?: ListLayoutOptions;
|
|
10
10
|
label?: string;
|
|
11
11
|
description?: string | null;
|
|
12
|
+
errorMessage?: string | ((validation: ValidationResult) => string);
|
|
12
13
|
/** The list of Select options to render */
|
|
13
14
|
items: NonNullable<ListBoxProps<T>["items"]>;
|
|
14
15
|
children?: ListBoxProps<T>["children"];
|
|
15
16
|
}
|
|
16
|
-
export declare function Select<T extends object>({ label, description, classNames, ...originalProps }: SelectProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
export declare function Select<T extends object>({ label, description, classNames, errorMessage, ...originalProps }: SelectProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
17
18
|
//# 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,EACV,WAAW,IAAI,eAAe,EAC9B,YAAY,EACZ,iBAAiB,
|
|
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,EACjB,gBAAgB,EACjB,MAAM,uBAAuB,CAAA;AAY9B,OAAO,KAAK,EAEV,kBAAkB,EAClB,cAAc,EACd,YAAY,EACb,MAAM,sBAAsB,CAAA;AAC7B,OAAO,EAAsB,YAAY,EAAE,MAAM,sBAAsB,CAAA;AAQvE,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,GAAG,OAAO,CAAC,CAAA;IAEzD;;OAEG;IACH,iBAAiB,CAAC,EAAE,iBAAiB,CAAA;IAErC,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAE3B,YAAY,CAAC,EAAE,MAAM,GAAG,CAAC,CAAC,UAAU,EAAE,gBAAgB,KAAK,MAAM,CAAC,CAAA;IAElE,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,YAAY,EACZ,GAAG,aAAa,EACjB,EAAE,WAAW,CAAC,CAAC,CAAC,2CAqFhB"}
|
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-20250401072718",
|
|
4
4
|
"sideEffects": false,
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
6
6
|
"type": "module",
|
|
@@ -47,11 +47,11 @@
|
|
|
47
47
|
"prettier": "^3.5.0",
|
|
48
48
|
"tsx": "^4.19.2",
|
|
49
49
|
"typescript": "5.7.3",
|
|
50
|
-
"@oui
|
|
50
|
+
"@opengovsg/oui-theme": "0.0.0-snapshot-20250401072718",
|
|
51
51
|
"@oui/chromatic": "0.0.0",
|
|
52
|
-
"@opengovsg/oui-theme": "0.0.0-snapshot-20250327091959",
|
|
53
52
|
"@oui/prettier-config": "0.0.0",
|
|
54
|
-
"@oui/typescript-config": "0.0.0"
|
|
53
|
+
"@oui/typescript-config": "0.0.0",
|
|
54
|
+
"@oui/eslint-config": "0.0.0"
|
|
55
55
|
},
|
|
56
56
|
"dependencies": {
|
|
57
57
|
"@internationalized/date": "^3.7.0",
|
|
@@ -79,7 +79,7 @@
|
|
|
79
79
|
"peerDependencies": {
|
|
80
80
|
"motion": ">=11.12.0 || >=12.0.0-alpha.1",
|
|
81
81
|
"react-aria-components": "^1.7.1",
|
|
82
|
-
"@opengovsg/oui-theme": "0.0.0-snapshot-
|
|
82
|
+
"@opengovsg/oui-theme": "0.0.0-snapshot-20250401072718"
|
|
83
83
|
},
|
|
84
84
|
"prettier": "@oui/prettier-config",
|
|
85
85
|
"scripts": {
|