@opengovsg/oui 0.0.0-snapshot-20251103063040 → 0.0.0-snapshot-20251203091804
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/badge/badge.cjs +4 -4
- package/dist/cjs/badge/use-badge.cjs +6 -6
- package/dist/cjs/banner/banner.cjs +4 -4
- package/dist/cjs/button/button.cjs +3 -3
- package/dist/cjs/calendar/calendar-bottom-content.cjs +3 -3
- package/dist/cjs/calendar/calendar-header.cjs +2 -2
- package/dist/cjs/calendar/calendar-month-day-selector.cjs +4 -3
- package/dist/cjs/calendar/calendar.cjs +4 -4
- package/dist/cjs/calendar/hooks/use-calendar-selectors.cjs +4 -4
- package/dist/cjs/calendar/utils.cjs +3 -3
- package/dist/cjs/combo-box/combo-box-fuzzy.cjs +6 -6
- package/dist/cjs/combo-box/combo-box-item.cjs +2 -2
- package/dist/cjs/combo-box/combo-box.cjs +3 -3
- package/dist/cjs/date-field/date-field.cjs +15 -6
- package/dist/cjs/date-picker/date-picker.cjs +39 -13
- package/dist/cjs/date-range-picker/date-range-picker.cjs +4 -4
- package/dist/cjs/field/field.cjs +20 -6
- package/dist/cjs/field/index.cjs +1 -0
- package/dist/cjs/file-dropzone/contexts.cjs +18 -0
- package/dist/cjs/file-dropzone/file-dropzone.cjs +311 -0
- package/dist/cjs/file-dropzone/file-info.cjs +146 -0
- package/dist/cjs/file-dropzone/index.cjs +13 -0
- package/dist/cjs/file-dropzone/types.cjs +3 -0
- package/dist/cjs/file-dropzone/utils.cjs +31 -0
- package/dist/cjs/govt-banner/govt-banner.cjs +3 -3
- package/dist/cjs/hooks/index.cjs +2 -0
- package/dist/cjs/hooks/use-callback-ref.cjs +4 -4
- package/dist/cjs/hooks/use-controllable-state.cjs +2 -2
- package/dist/cjs/hooks/use-draggable.cjs +88 -0
- package/dist/cjs/index.cjs +47 -22
- package/dist/cjs/input/input.cjs +2 -2
- package/dist/cjs/menu/menu.cjs +6 -6
- package/dist/cjs/modal/i18n.cjs +19 -0
- package/dist/cjs/modal/index.cjs +19 -0
- package/dist/cjs/modal/modal-body.cjs +26 -0
- package/dist/cjs/modal/modal-content.cjs +54 -0
- package/dist/cjs/modal/modal-footer.cjs +27 -0
- package/dist/cjs/modal/modal-header.cjs +25 -0
- package/dist/cjs/modal/modal-variant-context.cjs +13 -0
- package/dist/cjs/modal/modal.cjs +66 -0
- package/dist/cjs/node_modules/.pnpm/lucide-react@0.475.0_react@19.0.0/node_modules/lucide-react/dist/esm/Icon.cjs +4 -4
- package/dist/cjs/node_modules/.pnpm/lucide-react@0.475.0_react@19.0.0/node_modules/lucide-react/dist/esm/createLucideIcon.cjs +3 -3
- package/dist/cjs/node_modules/.pnpm/lucide-react@0.475.0_react@19.0.0/node_modules/lucide-react/dist/esm/icons/plus.cjs +22 -0
- package/dist/cjs/node_modules/.pnpm/lucide-react@0.475.0_react@19.0.0/node_modules/lucide-react/dist/esm/icons/trash-2.cjs +25 -0
- package/dist/cjs/node_modules/.pnpm/lucide-react@0.475.0_react@19.0.0/node_modules/lucide-react/dist/esm/icons/upload.cjs +23 -0
- package/dist/cjs/number-field/index.cjs +8 -0
- package/dist/cjs/number-field/number-field.cjs +136 -0
- package/dist/cjs/pagination/hooks/use-pagination.cjs +7 -7
- package/dist/cjs/pagination/pagination.cjs +6 -6
- package/dist/cjs/pagination/use-pagination-item.cjs +7 -8
- package/dist/cjs/pagination/use-pagination.cjs +8 -8
- package/dist/cjs/range-calendar/range-calendar.cjs +7 -7
- package/dist/cjs/ripple/use-ripple.cjs +4 -4
- package/dist/cjs/select/select.cjs +3 -3
- package/dist/cjs/spinner/use-spinner.cjs +3 -3
- package/dist/cjs/system/react-utils/context.cjs +3 -3
- package/dist/cjs/system/react-utils/refs.cjs +3 -3
- package/dist/cjs/system/utils.cjs +3 -3
- package/dist/cjs/tabs/tabs.cjs +2 -2
- package/dist/cjs/tag-field/tag-field-item.cjs +2 -2
- package/dist/cjs/tag-field/tag-field-list.cjs +4 -4
- package/dist/cjs/tag-field/tag-field-root.cjs +14 -14
- package/dist/cjs/tag-field/tag-field-state-context.cjs +2 -2
- package/dist/cjs/tag-field/tag-field-tag-list.cjs +3 -3
- package/dist/cjs/tag-field/tag-field-trigger.cjs +2 -2
- package/dist/cjs/tag-field/tag-field.cjs +2 -2
- package/dist/cjs/tag-field/use-tag-field-state.cjs +6 -6
- package/dist/cjs/tag-field/use-tag-field.cjs +4 -4
- package/dist/cjs/text-area/text-area.cjs +2 -2
- package/dist/cjs/toggle/toggle.cjs +3 -3
- package/dist/esm/banner/banner.js +1 -1
- package/dist/esm/calendar/calendar-month-day-selector.js +2 -1
- package/dist/esm/date-field/date-field.js +12 -3
- package/dist/esm/date-picker/date-picker.js +37 -11
- package/dist/esm/date-range-picker/date-range-picker.js +1 -1
- package/dist/esm/field/field.js +20 -7
- package/dist/esm/field/index.js +1 -1
- package/dist/esm/file-dropzone/contexts.js +13 -0
- package/dist/esm/file-dropzone/file-dropzone.js +309 -0
- package/dist/esm/file-dropzone/file-info.js +144 -0
- package/dist/esm/file-dropzone/index.js +4 -0
- package/dist/esm/file-dropzone/types.js +1 -0
- package/dist/esm/file-dropzone/utils.js +28 -0
- package/dist/esm/hooks/index.js +1 -0
- package/dist/esm/hooks/use-draggable.js +86 -0
- package/dist/esm/index.js +19 -8
- package/dist/esm/modal/i18n.js +17 -0
- package/dist/esm/modal/index.js +7 -0
- package/dist/esm/modal/modal-body.js +24 -0
- package/dist/esm/modal/modal-content.js +52 -0
- package/dist/esm/modal/modal-footer.js +25 -0
- package/dist/esm/modal/modal-header.js +23 -0
- package/dist/esm/modal/modal-variant-context.js +10 -0
- package/dist/esm/modal/modal.js +64 -0
- package/dist/esm/node_modules/.pnpm/lucide-react@0.475.0_react@19.0.0/node_modules/lucide-react/dist/esm/icons/plus.js +17 -0
- package/dist/esm/node_modules/.pnpm/lucide-react@0.475.0_react@19.0.0/node_modules/lucide-react/dist/esm/icons/trash-2.js +20 -0
- package/dist/esm/node_modules/.pnpm/lucide-react@0.475.0_react@19.0.0/node_modules/lucide-react/dist/esm/icons/upload.js +18 -0
- package/dist/esm/number-field/index.js +2 -0
- package/dist/esm/number-field/number-field.js +134 -0
- package/dist/esm/pagination/use-pagination-item.js +5 -6
- package/dist/esm/range-calendar/range-calendar.js +1 -1
- package/dist/esm/select/select.js +1 -1
- package/dist/types/badge/use-badge.d.ts +12 -12
- package/dist/types/calendar/calendar-month-day-selector.d.ts.map +1 -1
- package/dist/types/date-field/date-field.d.ts +1 -0
- package/dist/types/date-field/date-field.d.ts.map +1 -1
- package/dist/types/date-picker/date-picker.d.ts +5 -2
- package/dist/types/date-picker/date-picker.d.ts.map +1 -1
- package/dist/types/field/field.d.ts +4 -1
- package/dist/types/field/field.d.ts.map +1 -1
- package/dist/types/file-dropzone/contexts.d.ts +4 -0
- package/dist/types/file-dropzone/contexts.d.ts.map +1 -0
- package/dist/types/file-dropzone/file-dropzone.d.ts +82 -0
- package/dist/types/file-dropzone/file-dropzone.d.ts.map +1 -0
- package/dist/types/file-dropzone/file-info.d.ts +9 -0
- package/dist/types/file-dropzone/file-info.d.ts.map +1 -0
- package/dist/types/file-dropzone/index.d.ts +7 -0
- package/dist/types/file-dropzone/index.d.ts.map +1 -0
- package/dist/types/file-dropzone/types.d.ts +24 -0
- package/dist/types/file-dropzone/types.d.ts.map +1 -0
- package/dist/types/file-dropzone/utils.d.ts +8 -0
- package/dist/types/file-dropzone/utils.d.ts.map +1 -0
- package/dist/types/hooks/index.d.ts +4 -1
- package/dist/types/hooks/index.d.ts.map +1 -1
- package/dist/types/hooks/use-draggable.d.ts +24 -0
- package/dist/types/hooks/use-draggable.d.ts.map +1 -0
- package/dist/types/index.d.mts +3 -0
- package/dist/types/index.d.ts +3 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/menu/menu.d.ts.map +1 -1
- package/dist/types/modal/i18n.d.ts +3 -0
- package/dist/types/modal/i18n.d.ts.map +1 -0
- package/dist/types/modal/index.d.ts +12 -0
- package/dist/types/modal/index.d.ts.map +1 -0
- package/dist/types/modal/modal-body.d.ts +5 -0
- package/dist/types/modal/modal-body.d.ts.map +1 -0
- package/dist/types/modal/modal-content.d.ts +10 -0
- package/dist/types/modal/modal-content.d.ts.map +1 -0
- package/dist/types/modal/modal-footer.d.ts +5 -0
- package/dist/types/modal/modal-footer.d.ts.map +1 -0
- package/dist/types/modal/modal-header.d.ts +5 -0
- package/dist/types/modal/modal-header.d.ts.map +1 -0
- package/dist/types/modal/modal-variant-context.d.ts +8 -0
- package/dist/types/modal/modal-variant-context.d.ts.map +1 -0
- package/dist/types/modal/modal.d.ts +8 -0
- package/dist/types/modal/modal.d.ts.map +1 -0
- package/dist/types/number-field/index.d.ts +3 -0
- package/dist/types/number-field/index.d.ts.map +1 -0
- package/dist/types/number-field/number-field.d.ts +24 -0
- package/dist/types/number-field/number-field.d.ts.map +1 -0
- package/dist/types/pagination/use-pagination.d.ts +36 -36
- package/package.json +14 -10
- package/dist/cjs/node_modules/.pnpm/@react-aria_focus@3.20.5_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@react-aria/focus/dist/useFocusRing.cjs +0 -45
- package/dist/cjs/node_modules/.pnpm/@react-aria_interactions@3.25.3_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@react-aria/interactions/dist/context.cjs +0 -21
- package/dist/cjs/node_modules/.pnpm/@react-aria_interactions@3.25.3_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@react-aria/interactions/dist/textSelection.cjs +0 -72
- package/dist/cjs/node_modules/.pnpm/@react-aria_interactions@3.25.3_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@react-aria/interactions/dist/useFocus.cjs +0 -60
- package/dist/cjs/node_modules/.pnpm/@react-aria_interactions@3.25.3_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@react-aria/interactions/dist/useFocusVisible.cjs +0 -210
- package/dist/cjs/node_modules/.pnpm/@react-aria_interactions@3.25.3_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@react-aria/interactions/dist/useFocusWithin.cjs +0 -100
- package/dist/cjs/node_modules/.pnpm/@react-aria_interactions@3.25.3_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@react-aria/interactions/dist/useHover.cjs +0 -152
- package/dist/cjs/node_modules/.pnpm/@react-aria_interactions@3.25.3_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@react-aria/interactions/dist/usePress.cjs +0 -676
- package/dist/cjs/node_modules/.pnpm/@react-aria_interactions@3.25.3_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@react-aria/interactions/dist/utils.cjs +0 -160
- package/dist/cjs/node_modules/.pnpm/@swc_helpers@0.5.17/node_modules/@swc/helpers/esm/_check_private_redeclaration.cjs +0 -9
- package/dist/cjs/node_modules/.pnpm/@swc_helpers@0.5.17/node_modules/@swc/helpers/esm/_class_apply_descriptor_get.cjs +0 -9
- package/dist/cjs/node_modules/.pnpm/@swc_helpers@0.5.17/node_modules/@swc/helpers/esm/_class_apply_descriptor_set.cjs +0 -16
- package/dist/cjs/node_modules/.pnpm/@swc_helpers@0.5.17/node_modules/@swc/helpers/esm/_class_extract_field_descriptor.cjs +0 -9
- package/dist/cjs/node_modules/.pnpm/@swc_helpers@0.5.17/node_modules/@swc/helpers/esm/_class_private_field_get.cjs +0 -11
- package/dist/cjs/node_modules/.pnpm/@swc_helpers@0.5.17/node_modules/@swc/helpers/esm/_class_private_field_init.cjs +0 -10
- package/dist/cjs/node_modules/.pnpm/@swc_helpers@0.5.17/node_modules/@swc/helpers/esm/_class_private_field_set.cjs +0 -12
- package/dist/esm/node_modules/.pnpm/@react-aria_focus@3.20.5_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@react-aria/focus/dist/useFocusRing.js +0 -43
- package/dist/esm/node_modules/.pnpm/@react-aria_interactions@3.25.3_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@react-aria/interactions/dist/context.js +0 -19
- package/dist/esm/node_modules/.pnpm/@react-aria_interactions@3.25.3_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@react-aria/interactions/dist/textSelection.js +0 -69
- package/dist/esm/node_modules/.pnpm/@react-aria_interactions@3.25.3_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@react-aria/interactions/dist/useFocus.js +0 -58
- package/dist/esm/node_modules/.pnpm/@react-aria_interactions@3.25.3_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@react-aria/interactions/dist/useFocusVisible.js +0 -205
- package/dist/esm/node_modules/.pnpm/@react-aria_interactions@3.25.3_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@react-aria/interactions/dist/useFocusWithin.js +0 -98
- package/dist/esm/node_modules/.pnpm/@react-aria_interactions@3.25.3_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@react-aria/interactions/dist/useHover.js +0 -150
- package/dist/esm/node_modules/.pnpm/@react-aria_interactions@3.25.3_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@react-aria/interactions/dist/usePress.js +0 -674
- package/dist/esm/node_modules/.pnpm/@react-aria_interactions@3.25.3_react-dom@19.0.0_react@19.0.0__react@19.0.0/node_modules/@react-aria/interactions/dist/utils.js +0 -155
- package/dist/esm/node_modules/.pnpm/@swc_helpers@0.5.17/node_modules/@swc/helpers/esm/_check_private_redeclaration.js +0 -7
- package/dist/esm/node_modules/.pnpm/@swc_helpers@0.5.17/node_modules/@swc/helpers/esm/_class_apply_descriptor_get.js +0 -7
- package/dist/esm/node_modules/.pnpm/@swc_helpers@0.5.17/node_modules/@swc/helpers/esm/_class_apply_descriptor_set.js +0 -14
- package/dist/esm/node_modules/.pnpm/@swc_helpers@0.5.17/node_modules/@swc/helpers/esm/_class_extract_field_descriptor.js +0 -7
- package/dist/esm/node_modules/.pnpm/@swc_helpers@0.5.17/node_modules/@swc/helpers/esm/_class_private_field_get.js +0 -9
- package/dist/esm/node_modules/.pnpm/@swc_helpers@0.5.17/node_modules/@swc/helpers/esm/_class_private_field_init.js +0 -8
- package/dist/esm/node_modules/.pnpm/@swc_helpers@0.5.17/node_modules/@swc/helpers/esm/_class_private_field_set.js +0 -10
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var react = require('react');
|
|
5
5
|
|
|
6
6
|
const TagFieldStateContext = (
|
|
7
7
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
8
|
-
|
|
8
|
+
react.createContext(null)
|
|
9
9
|
);
|
|
10
10
|
|
|
11
11
|
exports.TagFieldStateContext = TagFieldStateContext;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
4
|
var jsxRuntime = require('react/jsx-runtime');
|
|
5
|
-
var
|
|
5
|
+
var react = require('react');
|
|
6
6
|
var tagFieldStateContext = require('./tag-field-state-context.cjs');
|
|
7
7
|
var x = require('../node_modules/.pnpm/lucide-react@0.475.0_react@19.0.0/node_modules/lucide-react/dist/esm/icons/x.cjs');
|
|
8
8
|
|
|
@@ -17,8 +17,8 @@ const TagFieldTagList = ({
|
|
|
17
17
|
isDisabled,
|
|
18
18
|
isReadOnly,
|
|
19
19
|
itemToText
|
|
20
|
-
} =
|
|
21
|
-
const handleRemoveSelectedItem =
|
|
20
|
+
} = react.useContext(tagFieldStateContext.TagFieldStateContext);
|
|
21
|
+
const handleRemoveSelectedItem = react.useCallback(
|
|
22
22
|
(item) => () => {
|
|
23
23
|
if (isDisabled || isReadOnly) return;
|
|
24
24
|
removeSelectedItem(item);
|
|
@@ -3,11 +3,11 @@
|
|
|
3
3
|
'use strict';
|
|
4
4
|
|
|
5
5
|
var jsxRuntime = require('react/jsx-runtime');
|
|
6
|
-
var
|
|
6
|
+
var react = require('react');
|
|
7
7
|
var reactAriaComponents = require('react-aria-components');
|
|
8
8
|
var utils = require('../system/utils.cjs');
|
|
9
9
|
|
|
10
|
-
const TagFieldTriggerContext =
|
|
10
|
+
const TagFieldTriggerContext = react.createContext({});
|
|
11
11
|
const TagFieldTrigger = utils.forwardRef(
|
|
12
12
|
(props, ref) => {
|
|
13
13
|
[props, ref] = reactAriaComponents.useContextProps(props, ref, TagFieldTriggerContext);
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
'use strict';
|
|
4
4
|
|
|
5
5
|
var jsxRuntime = require('react/jsx-runtime');
|
|
6
|
-
var
|
|
6
|
+
var react = require('react');
|
|
7
7
|
var reactAriaComponents = require('react-aria-components');
|
|
8
8
|
var ouiTheme = require('@opengovsg/oui-theme');
|
|
9
9
|
var field = require('../field/field.cjs');
|
|
@@ -99,7 +99,7 @@ function TagField({
|
|
|
99
99
|
{
|
|
100
100
|
className: styles.list({ className: classNames?.list }),
|
|
101
101
|
itemClassNames: props.itemClassNames,
|
|
102
|
-
children: ({ key, itemProps, ...props2 }) => children ? children({ key, itemProps, ...props2 }) : /* @__PURE__ */
|
|
102
|
+
children: ({ key, itemProps, ...props2 }) => children ? children({ key, itemProps, ...props2 }) : /* @__PURE__ */ react.createElement(tagFieldItem.TagFieldItem, { ...props2, ...itemProps, key })
|
|
103
103
|
}
|
|
104
104
|
) })
|
|
105
105
|
] });
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var react = require('react');
|
|
5
5
|
var form = require('@react-stately/form');
|
|
6
6
|
var utils = require('@react-stately/utils');
|
|
7
7
|
var useControllableState = require('../hooks/use-controllable-state.cjs');
|
|
8
8
|
|
|
9
9
|
function useTagFieldState(props) {
|
|
10
10
|
const { itemToText, itemToKey, defaultFilter } = props;
|
|
11
|
-
const itemsByKey =
|
|
11
|
+
const itemsByKey = react.useMemo(() => {
|
|
12
12
|
const items = props.items ?? props.defaultItems ?? [];
|
|
13
13
|
return items.reduce(
|
|
14
14
|
(acc, item) => {
|
|
@@ -18,7 +18,7 @@ function useTagFieldState(props) {
|
|
|
18
18
|
{}
|
|
19
19
|
) ?? {};
|
|
20
20
|
}, [itemToKey, props.defaultItems, props.items]);
|
|
21
|
-
const getSelectedItemsByKey =
|
|
21
|
+
const getSelectedItemsByKey = react.useCallback(
|
|
22
22
|
(keys) => {
|
|
23
23
|
if (!keys) return;
|
|
24
24
|
return [...keys].map((key) => itemsByKey[key]);
|
|
@@ -36,13 +36,13 @@ function useTagFieldState(props) {
|
|
|
36
36
|
defaultInputValue,
|
|
37
37
|
props.onInputChange
|
|
38
38
|
);
|
|
39
|
-
const controlledSelectedKeys =
|
|
39
|
+
const controlledSelectedKeys = react.useMemo(
|
|
40
40
|
() => new Set(selectedItems.map(itemToKey)),
|
|
41
41
|
[itemToKey, selectedItems]
|
|
42
42
|
);
|
|
43
43
|
const validation = form.useFormValidationState({
|
|
44
44
|
...props,
|
|
45
|
-
value:
|
|
45
|
+
value: react.useMemo(
|
|
46
46
|
() => ({
|
|
47
47
|
inputValue,
|
|
48
48
|
selectedKeys: controlledSelectedKeys
|
|
@@ -50,7 +50,7 @@ function useTagFieldState(props) {
|
|
|
50
50
|
[controlledSelectedKeys, inputValue]
|
|
51
51
|
)
|
|
52
52
|
});
|
|
53
|
-
const filteredItems =
|
|
53
|
+
const filteredItems = react.useMemo(
|
|
54
54
|
() => (
|
|
55
55
|
// No default filter if items are controlled.
|
|
56
56
|
!!props.items || !defaultFilter ? props.items ?? [] : filterItems({
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var react = require('react');
|
|
5
5
|
var utils = require('@react-aria/utils');
|
|
6
6
|
var reactVirtual = require('@tanstack/react-virtual');
|
|
7
7
|
var downshift = require('downshift');
|
|
@@ -23,7 +23,7 @@ function useTagField(props, state) {
|
|
|
23
23
|
label,
|
|
24
24
|
virtualRowHeight = 40
|
|
25
25
|
} = props;
|
|
26
|
-
const backupBtnRef =
|
|
26
|
+
const backupBtnRef = react.useRef(null);
|
|
27
27
|
buttonRef = buttonRef ?? backupBtnRef;
|
|
28
28
|
const {
|
|
29
29
|
selectedItems,
|
|
@@ -48,14 +48,14 @@ function useTagField(props, state) {
|
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
50
|
});
|
|
51
|
-
const disabledKeysSet =
|
|
51
|
+
const disabledKeysSet = react.useMemo(() => {
|
|
52
52
|
return new Set(disabledKeys);
|
|
53
53
|
}, [disabledKeys]);
|
|
54
54
|
const rowVirtualizer = reactVirtual.useVirtualizer({
|
|
55
55
|
count: items.length,
|
|
56
56
|
getScrollElement: () => listBoxRef.current,
|
|
57
57
|
estimateSize: () => virtualRowHeight,
|
|
58
|
-
getItemKey:
|
|
58
|
+
getItemKey: react.useCallback(
|
|
59
59
|
(index) => itemToKey(items[index]),
|
|
60
60
|
[itemToKey, items]
|
|
61
61
|
),
|
|
@@ -3,11 +3,11 @@
|
|
|
3
3
|
'use strict';
|
|
4
4
|
|
|
5
5
|
var jsxRuntime = require('react/jsx-runtime');
|
|
6
|
-
var
|
|
6
|
+
var react = require('react');
|
|
7
7
|
var reactAriaComponents = require('react-aria-components');
|
|
8
8
|
var ouiTheme = require('@opengovsg/oui-theme');
|
|
9
9
|
|
|
10
|
-
const TextArea =
|
|
10
|
+
const TextArea = react.forwardRef(
|
|
11
11
|
({ size, variant, isDisabled, ...props }, ref) => {
|
|
12
12
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
13
13
|
reactAriaComponents.TextArea,
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
'use strict';
|
|
4
4
|
|
|
5
5
|
var jsxRuntime = require('react/jsx-runtime');
|
|
6
|
-
var
|
|
6
|
+
var react = require('react');
|
|
7
7
|
var reactAria = require('react-aria');
|
|
8
8
|
var reactAriaComponents = require('react-aria-components');
|
|
9
9
|
var ouiTheme = require('@opengovsg/oui-theme');
|
|
@@ -21,12 +21,12 @@ const Toggle = ({
|
|
|
21
21
|
ouiTheme.toggleStyles.variantKeys
|
|
22
22
|
);
|
|
23
23
|
const slots = ouiTheme.toggleStyles(variantProps);
|
|
24
|
-
const clonedThumbIcon =
|
|
24
|
+
const clonedThumbIcon = react.useCallback(
|
|
25
25
|
(renderProps) => {
|
|
26
26
|
const baseProps = {
|
|
27
27
|
className: slots.thumbIcon({ className: classNames?.thumbIcon })
|
|
28
28
|
};
|
|
29
|
-
return typeof thumbIcon === "function" ? thumbIcon(reactAria.mergeProps(baseProps, renderProps)) : thumbIcon &&
|
|
29
|
+
return typeof thumbIcon === "function" ? thumbIcon(reactAria.mergeProps(baseProps, renderProps)) : thumbIcon && react.cloneElement(thumbIcon, baseProps);
|
|
30
30
|
},
|
|
31
31
|
[classNames?.thumbIcon, slots, thumbIcon]
|
|
32
32
|
);
|
|
@@ -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 = {
|
|
@@ -61,7 +61,8 @@ const CalendarMonthDaySelector = () => {
|
|
|
61
61
|
list: slots.yearList({ className: classNames?.yearList }),
|
|
62
62
|
selectedText: slots.selectorText({
|
|
63
63
|
className: classNames?.selectorText
|
|
64
|
-
})
|
|
64
|
+
}),
|
|
65
|
+
popover: "min-w-[8ch]"
|
|
65
66
|
},
|
|
66
67
|
selectedKey: state.visibleRange.start.year,
|
|
67
68
|
"aria-label": formatMessage("selectYear"),
|
|
@@ -9,7 +9,15 @@ import { mapPropsVariants } from '../system/utils.js';
|
|
|
9
9
|
|
|
10
10
|
function DateField(originalProps) {
|
|
11
11
|
const [
|
|
12
|
-
{
|
|
12
|
+
{
|
|
13
|
+
inputProps,
|
|
14
|
+
label,
|
|
15
|
+
description,
|
|
16
|
+
errorMessage,
|
|
17
|
+
className,
|
|
18
|
+
classNames,
|
|
19
|
+
...props
|
|
20
|
+
},
|
|
13
21
|
variantProps
|
|
14
22
|
] = useMemo(
|
|
15
23
|
() => mapPropsVariants(originalProps, dateFieldStyles.variantKeys),
|
|
@@ -26,11 +34,11 @@ function DateField(originalProps) {
|
|
|
26
34
|
isDisabled: variantProps.isDisabled,
|
|
27
35
|
className: composeTailwindRenderProps(
|
|
28
36
|
className ?? classNames?.base,
|
|
29
|
-
"flex flex-col gap-2"
|
|
37
|
+
"flex w-full flex-col gap-2"
|
|
30
38
|
),
|
|
31
39
|
children: [
|
|
32
40
|
label && /* @__PURE__ */ jsx(Label, { size: variantProps.size, className: classNames?.label, children: label }),
|
|
33
|
-
/* @__PURE__ */ jsx(DateInput, { size: variantProps.size, className: styles }),
|
|
41
|
+
/* @__PURE__ */ jsx(DateInput, { size: variantProps.size, className: styles, ...inputProps }),
|
|
34
42
|
description && /* @__PURE__ */ jsx(
|
|
35
43
|
Description,
|
|
36
44
|
{
|
|
@@ -65,6 +73,7 @@ function DateInput(originalProps) {
|
|
|
65
73
|
className: composeRenderProps(
|
|
66
74
|
classNames?.segment,
|
|
67
75
|
(className2, renderProps) => styles.segment({
|
|
76
|
+
isEditable: segment.isEditable,
|
|
68
77
|
...renderProps,
|
|
69
78
|
className: className2
|
|
70
79
|
})
|
|
@@ -4,13 +4,14 @@ import { jsxs, jsx } from 'react/jsx-runtime';
|
|
|
4
4
|
import { useMemo } from 'react';
|
|
5
5
|
import { DatePicker as DatePicker$1, Dialog } from 'react-aria-components';
|
|
6
6
|
import { datePickerStyles, composeTailwindRenderProps } from '@opengovsg/oui-theme';
|
|
7
|
+
import { Button } from '../button/button.js';
|
|
8
|
+
import { Calendar as Calendar$1 } from '../calendar/calendar.js';
|
|
9
|
+
import '@internationalized/date';
|
|
7
10
|
import { DateInput } from '../date-field/date-field.js';
|
|
8
11
|
import { Label, FieldGroup, Description, FieldError } from '../field/field.js';
|
|
9
12
|
import { Popover } from '../popover/popover.js';
|
|
10
13
|
import { mapPropsVariants } from '../system/utils.js';
|
|
11
14
|
import Calendar from '../node_modules/.pnpm/lucide-react@0.475.0_react@19.0.0/node_modules/lucide-react/dist/esm/icons/calendar.js';
|
|
12
|
-
import { Calendar as Calendar$1 } from '../calendar/calendar.js';
|
|
13
|
-
import { Button } from '../button/button.js';
|
|
14
15
|
|
|
15
16
|
function DatePicker(originalProps) {
|
|
16
17
|
const [
|
|
@@ -23,6 +24,7 @@ function DatePicker(originalProps) {
|
|
|
23
24
|
calendarProps,
|
|
24
25
|
popoverProps,
|
|
25
26
|
calendarButtonProps,
|
|
27
|
+
selectorIcon,
|
|
26
28
|
...props
|
|
27
29
|
},
|
|
28
30
|
variantProps
|
|
@@ -61,20 +63,44 @@ function DatePicker(originalProps) {
|
|
|
61
63
|
className: classNames?.calendarButton
|
|
62
64
|
}),
|
|
63
65
|
...calendarButtonProps,
|
|
64
|
-
children: /* @__PURE__ */ jsx(
|
|
66
|
+
children: selectorIcon ?? /* @__PURE__ */ jsx(
|
|
67
|
+
Calendar,
|
|
68
|
+
{
|
|
69
|
+
className: styles.selectorIcon({
|
|
70
|
+
className: classNames?.selectorIcon
|
|
71
|
+
}),
|
|
72
|
+
"aria-hidden": true
|
|
73
|
+
}
|
|
74
|
+
)
|
|
65
75
|
}
|
|
66
76
|
)
|
|
67
77
|
] }),
|
|
68
|
-
/* @__PURE__ */ jsx(
|
|
69
|
-
|
|
78
|
+
/* @__PURE__ */ jsx(
|
|
79
|
+
Popover,
|
|
80
|
+
{
|
|
81
|
+
placement: "bottom end",
|
|
82
|
+
classNames: classNames?.popover,
|
|
83
|
+
...popoverProps,
|
|
84
|
+
children: /* @__PURE__ */ jsx(Dialog, { className: styles.dialog({ className: classNames?.dialog }), children: /* @__PURE__ */ jsx(
|
|
85
|
+
Calendar$1,
|
|
86
|
+
{
|
|
87
|
+
size: variantProps.size === "xs" ? "sm" : variantProps.size,
|
|
88
|
+
classNames: classNames?.calendar,
|
|
89
|
+
pageBehavior: props.pageBehavior,
|
|
90
|
+
...calendarProps
|
|
91
|
+
}
|
|
92
|
+
) })
|
|
93
|
+
}
|
|
94
|
+
),
|
|
95
|
+
description && /* @__PURE__ */ jsx(
|
|
96
|
+
Description,
|
|
70
97
|
{
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
98
|
+
className: classNames?.description,
|
|
99
|
+
size: variantProps.size,
|
|
100
|
+
children: description
|
|
74
101
|
}
|
|
75
|
-
)
|
|
76
|
-
|
|
77
|
-
/* @__PURE__ */ jsx(FieldError, { size: variantProps.size, children: errorMessage })
|
|
102
|
+
),
|
|
103
|
+
/* @__PURE__ */ jsx(FieldError, { classNames: classNames?.error, size: variantProps.size, children: errorMessage })
|
|
78
104
|
]
|
|
79
105
|
}
|
|
80
106
|
);
|
|
@@ -5,13 +5,13 @@ import { useMemo } from 'react';
|
|
|
5
5
|
import { CalendarDate } from '@internationalized/date';
|
|
6
6
|
import { DateRangePicker as DateRangePicker$1, Dialog } from 'react-aria-components';
|
|
7
7
|
import { dateRangePickerStyles, composeTailwindRenderProps } from '@opengovsg/oui-theme';
|
|
8
|
+
import { Button } from '../button/button.js';
|
|
8
9
|
import { DateInput } from '../date-field/date-field.js';
|
|
9
10
|
import { Label, FieldGroup, Description, FieldError } from '../field/field.js';
|
|
10
11
|
import { Popover } from '../popover/popover.js';
|
|
11
12
|
import { RangeCalendar } from '../range-calendar/range-calendar.js';
|
|
12
13
|
import { mapPropsVariants } from '../system/utils.js';
|
|
13
14
|
import Calendar from '../node_modules/.pnpm/lucide-react@0.475.0_react@19.0.0/node_modules/lucide-react/dist/esm/icons/calendar.js';
|
|
14
|
-
import { Button } from '../button/button.js';
|
|
15
15
|
|
|
16
16
|
function DateRangePicker(originalProps) {
|
|
17
17
|
const [
|
package/dist/esm/field/field.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
"use client";
|
|
3
3
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
4
|
+
import { useMemo } from 'react';
|
|
4
5
|
import { Label as Label$1, Text, FieldError as FieldError$1, Group } from 'react-aria-components';
|
|
5
6
|
import { labelStyles, descriptionStyles, fieldErrorStyles, composeRenderProps, fieldGroupStyles } from '@opengovsg/oui-theme';
|
|
6
7
|
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';
|
|
@@ -12,12 +13,19 @@ function Description({ size, className, ...props }) {
|
|
|
12
13
|
return /* @__PURE__ */ jsx(
|
|
13
14
|
Text,
|
|
14
15
|
{
|
|
15
|
-
...props,
|
|
16
16
|
slot: "description",
|
|
17
|
+
...props,
|
|
17
18
|
className: descriptionStyles({ className, size })
|
|
18
19
|
}
|
|
19
20
|
);
|
|
20
21
|
}
|
|
22
|
+
function FieldErrorIcon({
|
|
23
|
+
size,
|
|
24
|
+
className
|
|
25
|
+
}) {
|
|
26
|
+
const styles = fieldErrorStyles({ size });
|
|
27
|
+
return /* @__PURE__ */ jsx(CircleAlert, { className: styles.icon({ className }) });
|
|
28
|
+
}
|
|
21
29
|
function FieldError({
|
|
22
30
|
children,
|
|
23
31
|
className,
|
|
@@ -26,7 +34,15 @@ function FieldError({
|
|
|
26
34
|
...props
|
|
27
35
|
}) {
|
|
28
36
|
const styles = fieldErrorStyles({ size });
|
|
29
|
-
|
|
37
|
+
const childrenFromProps = useMemo(() => {
|
|
38
|
+
if (typeof children === "string") {
|
|
39
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
40
|
+
/* @__PURE__ */ jsx(FieldErrorIcon, { className: classNames?.icon, size }),
|
|
41
|
+
children
|
|
42
|
+
] });
|
|
43
|
+
}
|
|
44
|
+
return children;
|
|
45
|
+
}, [children, classNames?.icon, size]);
|
|
30
46
|
return /* @__PURE__ */ jsx(
|
|
31
47
|
FieldError$1,
|
|
32
48
|
{
|
|
@@ -35,10 +51,7 @@ function FieldError({
|
|
|
35
51
|
className ?? classNames?.text,
|
|
36
52
|
(className2, renderProps) => styles.text({ ...renderProps, className: className2 })
|
|
37
53
|
),
|
|
38
|
-
children:
|
|
39
|
-
/* @__PURE__ */ jsx(CircleAlert, { className: styles.icon({ className: classNames?.icon }) }),
|
|
40
|
-
children
|
|
41
|
-
] })
|
|
54
|
+
children: childrenFromProps
|
|
42
55
|
}
|
|
43
56
|
);
|
|
44
57
|
}
|
|
@@ -55,4 +68,4 @@ function FieldGroup(props) {
|
|
|
55
68
|
);
|
|
56
69
|
}
|
|
57
70
|
|
|
58
|
-
export { Description, FieldError, FieldGroup, Label };
|
|
71
|
+
export { Description, FieldError, FieldErrorIcon, FieldGroup, Label };
|
package/dist/esm/field/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
export { Description, FieldError, FieldGroup, Label } from './field.js';
|
|
2
|
+
export { Description, FieldError, FieldErrorIcon, FieldGroup, Label } from './field.js';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
import { createContext } from '../system/react-utils/context.js';
|
|
3
|
+
|
|
4
|
+
const [FileDropzoneStateContext, useFileDropzoneStateContext] = createContext({
|
|
5
|
+
strict: true,
|
|
6
|
+
name: "FileDropzoneStateContext"
|
|
7
|
+
});
|
|
8
|
+
const [FileDropzoneStyleContext, useFileDropzoneStyleContext] = createContext({
|
|
9
|
+
strict: true,
|
|
10
|
+
name: "FileDropzoneStyleContext"
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
export { FileDropzoneStateContext, FileDropzoneStyleContext, useFileDropzoneStateContext, useFileDropzoneStyleContext };
|