@opengovsg/oui 0.0.47 → 0.0.49
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/checkbox/checkbox.cjs +34 -26
- package/dist/cjs/date-picker/date-picker.cjs +2 -3
- package/dist/cjs/date-range-picker/date-range-picker.cjs +1 -1
- package/dist/cjs/file-dropzone/file-info.cjs +1 -1
- package/dist/cjs/index.cjs +65 -59
- package/dist/cjs/infobox/index.cjs +8 -0
- package/dist/cjs/infobox/infobox.cjs +39 -0
- package/dist/cjs/infobox/use-infobox.cjs +32 -0
- package/dist/cjs/modal/modal-content.cjs +1 -1
- package/dist/cjs/node_modules/.pnpm/lucide-react@0.475.0_react@19.2.3/node_modules/lucide-react/dist/esm/icons/circle-check.cjs +22 -0
- package/dist/cjs/number-field/number-field.cjs +1 -1
- package/dist/cjs/pagination/index.cjs +5 -5
- package/dist/cjs/radio-group/index.cjs +9 -0
- package/dist/cjs/radio-group/radio-group-variant-context.cjs +15 -0
- package/dist/cjs/radio-group/radio.cjs +99 -0
- package/dist/cjs/range-calendar/range-calendar.cjs +1 -1
- package/dist/cjs/search-field/search-field.cjs +1 -1
- package/dist/cjs/select/select.cjs +1 -1
- package/dist/cjs/sidebar/sidebar-list.cjs +1 -1
- package/dist/cjs/tabs/index.cjs +1 -0
- package/dist/cjs/tabs/tabs.cjs +2 -0
- package/dist/cjs/tag-field/tag-field-list.cjs +25 -5
- package/dist/cjs/tag-field/use-tag-field.cjs +15 -4
- package/dist/cjs/tooltip/tooltip.cjs +7 -9
- package/dist/esm/accordion/accordion.js +1 -1
- package/dist/esm/badge/use-badge.js +1 -1
- package/dist/esm/banner/banner.js +1 -1
- package/dist/esm/breadcrumbs/breadcrumbs.js +2 -2
- package/dist/esm/calendar/calendar.js +1 -1
- package/dist/esm/checkbox/checkbox.js +34 -26
- package/dist/esm/combo-box/combo-box-item.js +1 -1
- package/dist/esm/combo-box/combo-box.js +1 -1
- package/dist/esm/date-picker/date-picker.js +2 -3
- package/dist/esm/date-range-picker/date-range-picker.js +1 -1
- package/dist/esm/file-dropzone/file-info.js +1 -1
- package/dist/esm/index.js +16 -14
- package/dist/esm/infobox/index.js +2 -0
- package/dist/esm/infobox/infobox.js +37 -0
- package/dist/esm/infobox/use-infobox.js +30 -0
- package/dist/esm/modal/modal-content.js +1 -1
- package/dist/esm/node_modules/.pnpm/lucide-react@0.475.0_react@19.2.3/node_modules/lucide-react/dist/esm/icons/circle-check.js +17 -0
- package/dist/esm/number-field/number-field.js +2 -2
- package/dist/esm/pagination/use-pagination-item.js +1 -1
- package/dist/esm/phone-number-field/phone-number-field.js +4 -4
- package/dist/esm/popover/popover.js +1 -1
- package/dist/esm/radio-group/index.js +2 -0
- package/dist/esm/radio-group/radio-group-variant-context.js +12 -0
- package/dist/esm/radio-group/radio.js +96 -0
- package/dist/esm/range-calendar/range-calendar.js +1 -1
- package/dist/esm/search-field/search-field.js +1 -1
- package/dist/esm/select/select.js +1 -1
- package/dist/esm/sidebar/sidebar-list.js +1 -1
- package/dist/esm/tabs/index.js +1 -1
- package/dist/esm/tabs/tabs.js +4 -3
- package/dist/esm/tag-field/tag-field-list.js +25 -5
- package/dist/esm/tag-field/use-tag-field.js +15 -4
- package/dist/esm/tooltip/tooltip.js +5 -7
- package/dist/types/checkbox/checkbox.d.ts +3 -3
- package/dist/types/checkbox/checkbox.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/infobox/index.d.ts +2 -0
- package/dist/types/infobox/index.d.ts.map +1 -0
- package/dist/types/infobox/infobox.d.ts +5 -0
- package/dist/types/infobox/infobox.d.ts.map +1 -0
- package/dist/types/infobox/use-infobox.d.ts +54 -0
- package/dist/types/infobox/use-infobox.d.ts.map +1 -0
- package/dist/types/radio-group/index.d.ts +3 -0
- package/dist/types/radio-group/index.d.ts.map +1 -0
- package/dist/types/radio-group/radio-group-variant-context.d.ts +6 -0
- package/dist/types/radio-group/radio-group-variant-context.d.ts.map +1 -0
- package/dist/types/radio-group/radio.d.ts +39 -0
- package/dist/types/radio-group/radio.d.ts.map +1 -0
- package/dist/types/system/react-utils/children.d.ts +1 -1
- package/dist/types/system/react-utils/children.d.ts.map +1 -1
- package/dist/types/tabs/tabs.d.ts +1 -0
- package/dist/types/tabs/tabs.d.ts.map +1 -1
- package/dist/types/tag-field/tag-field-list.d.ts +1 -1
- package/dist/types/tag-field/tag-field-list.d.ts.map +1 -1
- package/dist/types/tag-field/types.d.ts +7 -0
- package/dist/types/tag-field/types.d.ts.map +1 -1
- package/dist/types/tag-field/use-tag-field.d.ts +1 -1
- package/dist/types/tag-field/use-tag-field.d.ts.map +1 -1
- package/dist/types/tooltip/tooltip.d.ts.map +1 -1
- package/package.json +4 -4
|
@@ -0,0 +1,99 @@
|
|
|
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
|
+
var field = require('../field/field.cjs');
|
|
9
|
+
var children = require('../system/react-utils/children.cjs');
|
|
10
|
+
var utils = require('../system/utils.cjs');
|
|
11
|
+
var radioGroupVariantContext = require('./radio-group-variant-context.cjs');
|
|
12
|
+
|
|
13
|
+
const Radio = ({
|
|
14
|
+
classNames,
|
|
15
|
+
className,
|
|
16
|
+
children: children$1,
|
|
17
|
+
description,
|
|
18
|
+
...originalProps
|
|
19
|
+
}) => {
|
|
20
|
+
const [props, variants] = utils.mapPropsVariants(
|
|
21
|
+
originalProps,
|
|
22
|
+
ouiTheme.radioStyles.variantKeys
|
|
23
|
+
);
|
|
24
|
+
const groupContext = radioGroupVariantContext.useRadioGroupVariantContext();
|
|
25
|
+
const styles = ouiTheme.radioStyles({ size: groupContext?.size, ...variants });
|
|
26
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
27
|
+
reactAriaComponents.Radio,
|
|
28
|
+
{
|
|
29
|
+
...props,
|
|
30
|
+
isDisabled: variants.isDisabled,
|
|
31
|
+
className: reactAriaComponents.composeRenderProps(
|
|
32
|
+
className ?? classNames?.base,
|
|
33
|
+
(className2, renderProps) => styles.base({ ...renderProps, className: className2 })
|
|
34
|
+
),
|
|
35
|
+
children: (renderProps) => {
|
|
36
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
37
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
38
|
+
"span",
|
|
39
|
+
{
|
|
40
|
+
className: styles.circle({
|
|
41
|
+
...renderProps,
|
|
42
|
+
className: classNames?.circle
|
|
43
|
+
}),
|
|
44
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
45
|
+
"span",
|
|
46
|
+
{
|
|
47
|
+
className: styles.icon({
|
|
48
|
+
...renderProps,
|
|
49
|
+
className: classNames?.icon
|
|
50
|
+
})
|
|
51
|
+
}
|
|
52
|
+
)
|
|
53
|
+
}
|
|
54
|
+
),
|
|
55
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: styles.label({ className: classNames?.label }), children: children.renderChildren(renderProps, children$1) }),
|
|
56
|
+
description && /* @__PURE__ */ jsxRuntime.jsx(
|
|
57
|
+
field.Description,
|
|
58
|
+
{
|
|
59
|
+
size: groupContext?.size,
|
|
60
|
+
className: styles.description({
|
|
61
|
+
className: classNames?.description
|
|
62
|
+
}),
|
|
63
|
+
children: description
|
|
64
|
+
}
|
|
65
|
+
)
|
|
66
|
+
] });
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
);
|
|
70
|
+
};
|
|
71
|
+
const RadioGroup = ({
|
|
72
|
+
label,
|
|
73
|
+
description,
|
|
74
|
+
errorMessage,
|
|
75
|
+
classNames,
|
|
76
|
+
size,
|
|
77
|
+
...props
|
|
78
|
+
}) => {
|
|
79
|
+
const context = { size };
|
|
80
|
+
return /* @__PURE__ */ jsxRuntime.jsx(reactAriaComponents.Provider, { values: [[radioGroupVariantContext.RadioGroupVariantContext, context]], children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
81
|
+
reactAriaComponents.RadioGroup,
|
|
82
|
+
{
|
|
83
|
+
...props,
|
|
84
|
+
className: reactAriaComponents.composeRenderProps(
|
|
85
|
+
props.className ?? classNames?.base,
|
|
86
|
+
(className, renderProps) => ouiTheme.radioGroupStyles({ ...renderProps, size, className })
|
|
87
|
+
),
|
|
88
|
+
children: [
|
|
89
|
+
label && /* @__PURE__ */ jsxRuntime.jsx(field.Label, { size, className: classNames?.label, children: label }),
|
|
90
|
+
props.children,
|
|
91
|
+
description && /* @__PURE__ */ jsxRuntime.jsx(field.Description, { size, className: classNames?.description, children: description }),
|
|
92
|
+
/* @__PURE__ */ jsxRuntime.jsx(field.FieldError, { size, classNames: classNames?.error, children: errorMessage })
|
|
93
|
+
]
|
|
94
|
+
}
|
|
95
|
+
) });
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
exports.Radio = Radio;
|
|
99
|
+
exports.RadioGroup = RadioGroup;
|
|
@@ -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');
|
|
12
11
|
var agnosticCalendarStateContext = require('../calendar/agnostic-calendar-state-context.cjs');
|
|
13
12
|
var calendarBottomContent = require('../calendar/calendar-bottom-content.cjs');
|
|
14
13
|
var calendarGridHeader = require('../calendar/calendar-grid-header.cjs');
|
|
15
14
|
var calendarHeader = require('../calendar/calendar-header.cjs');
|
|
16
15
|
var utils = require('../system/utils.cjs');
|
|
16
|
+
var calendarStyleContext = require('../calendar/calendar-style-context.cjs');
|
|
17
17
|
|
|
18
18
|
const RangeCalendar = utils.forwardRefGeneric(function RangeCalendar2(originalProps, ref) {
|
|
19
19
|
const [props, variantProps] = utils.mapPropsVariants(
|
|
@@ -5,13 +5,13 @@ var jsxRuntime = require('react/jsx-runtime');
|
|
|
5
5
|
var reactAria = require('react-aria');
|
|
6
6
|
var reactAriaComponents = require('react-aria-components');
|
|
7
7
|
var ouiTheme = require('@opengovsg/oui-theme');
|
|
8
|
-
var button = require('../button/button.cjs');
|
|
9
8
|
var field = require('../field/field.cjs');
|
|
10
9
|
var input = require('../input/input.cjs');
|
|
11
10
|
var utils = require('../system/utils.cjs');
|
|
12
11
|
var i18n = require('./i18n.cjs');
|
|
13
12
|
var search = require('../node_modules/.pnpm/lucide-react@0.475.0_react@19.2.3/node_modules/lucide-react/dist/esm/icons/search.cjs');
|
|
14
13
|
var x = require('../node_modules/.pnpm/lucide-react@0.475.0_react@19.2.3/node_modules/lucide-react/dist/esm/icons/x.cjs');
|
|
14
|
+
var button = require('../button/button.cjs');
|
|
15
15
|
|
|
16
16
|
function SearchField(originalProps) {
|
|
17
17
|
const [
|
|
@@ -7,7 +7,6 @@ var $670gB$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');
|
|
10
|
-
var button = require('../button/button.cjs');
|
|
11
10
|
var field = require('../field/field.cjs');
|
|
12
11
|
var popover = require('../popover/popover.cjs');
|
|
13
12
|
var sizing = require('../system/react-utils/sizing.cjs');
|
|
@@ -15,6 +14,7 @@ var utils = require('../system/utils.cjs');
|
|
|
15
14
|
var i18n = require('./i18n.cjs');
|
|
16
15
|
var selectVariantContext = require('./select-variant-context.cjs');
|
|
17
16
|
var chevronDown = require('../node_modules/.pnpm/lucide-react@0.475.0_react@19.2.3/node_modules/lucide-react/dist/esm/icons/chevron-down.cjs');
|
|
17
|
+
var button = require('../button/button.cjs');
|
|
18
18
|
|
|
19
19
|
const calculateEstimatedRowHeight = (size) => {
|
|
20
20
|
switch (size) {
|
|
@@ -8,11 +8,11 @@ var reactAria = require('react-aria');
|
|
|
8
8
|
var reactAriaComponents = require('react-aria-components');
|
|
9
9
|
var reactStately = require('react-stately');
|
|
10
10
|
var ouiTheme = require('@opengovsg/oui-theme');
|
|
11
|
-
var button = require('../button/button.cjs');
|
|
12
11
|
var utils = require('../system/utils.cjs');
|
|
13
12
|
var context = require('./context.cjs');
|
|
14
13
|
var i18n = require('./i18n.cjs');
|
|
15
14
|
var chevronDown = require('../node_modules/.pnpm/lucide-react@0.475.0_react@19.2.3/node_modules/lucide-react/dist/esm/icons/chevron-down.cjs');
|
|
15
|
+
var button = require('../button/button.cjs');
|
|
16
16
|
|
|
17
17
|
const SidebarListSection = ({
|
|
18
18
|
onlyCaretToggle,
|
package/dist/cjs/tabs/index.cjs
CHANGED
|
@@ -8,6 +8,7 @@ var tabs = require('./tabs.cjs');
|
|
|
8
8
|
exports.Tab = tabs.Tab;
|
|
9
9
|
exports.TabList = tabs.TabList;
|
|
10
10
|
exports.TabPanel = tabs.TabPanel;
|
|
11
|
+
exports.TabPanels = tabs.TabPanels;
|
|
11
12
|
exports.Tabs = tabs.Tabs;
|
|
12
13
|
exports.TabsVariantContext = tabs.TabsVariantContext;
|
|
13
14
|
exports.useTabsVariantContext = tabs.useTabsVariantContext;
|
package/dist/cjs/tabs/tabs.cjs
CHANGED
|
@@ -88,10 +88,12 @@ function TabPanel(props) {
|
|
|
88
88
|
}
|
|
89
89
|
);
|
|
90
90
|
}
|
|
91
|
+
const TabPanels = reactAriaComponents.TabPanels;
|
|
91
92
|
|
|
92
93
|
exports.Tab = Tab;
|
|
93
94
|
exports.TabList = TabList;
|
|
94
95
|
exports.TabPanel = TabPanel;
|
|
96
|
+
exports.TabPanels = TabPanels;
|
|
95
97
|
exports.Tabs = Tabs;
|
|
96
98
|
exports.TabsVariantContext = TabsVariantContext;
|
|
97
99
|
exports.useTabsVariantContext = useTabsVariantContext;
|
|
@@ -12,18 +12,18 @@ var tagFieldStateContext = require('./tag-field-state-context.cjs');
|
|
|
12
12
|
const TagFieldListContext = $670gB$react.createContext(null);
|
|
13
13
|
const TagFieldListInner = (props, ref) => {
|
|
14
14
|
[props, ref] = reactAriaComponents.useContextProps(props, ref, TagFieldListContext);
|
|
15
|
-
const { items, getItemProps, highlightedIndex } = $670gB$react.useContext(tagFieldStateContext.TagFieldStateContext);
|
|
15
|
+
const { items, getItemProps, highlightedIndex, itemToKey } = $670gB$react.useContext(tagFieldStateContext.TagFieldStateContext);
|
|
16
16
|
const { slot, rowVirtualizer, itemClassNames, ...rest } = props;
|
|
17
|
-
return /* @__PURE__ */ jsxRuntime.jsx("ul", { slot: slot ?? void 0, ref, ...rest, children: props.children !== void 0 && typeof props.children !== "function" ? props.children : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
17
|
+
return /* @__PURE__ */ jsxRuntime.jsx("ul", { slot: slot ?? void 0, ref, ...rest, children: props.children !== void 0 && typeof props.children !== "function" ? props.children : rowVirtualizer ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
18
18
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
19
19
|
"li",
|
|
20
20
|
{
|
|
21
21
|
"aria-hidden": true,
|
|
22
|
-
style: { height: rowVirtualizer
|
|
22
|
+
style: { height: rowVirtualizer.getTotalSize() }
|
|
23
23
|
},
|
|
24
24
|
"total-size"
|
|
25
25
|
),
|
|
26
|
-
rowVirtualizer
|
|
26
|
+
rowVirtualizer.getVirtualItems().map((virtualRow) => {
|
|
27
27
|
const item = items[virtualRow.index];
|
|
28
28
|
const itemProps = getItemProps({
|
|
29
29
|
item,
|
|
@@ -55,7 +55,27 @@ const TagFieldListInner = (props, ref) => {
|
|
|
55
55
|
}
|
|
56
56
|
);
|
|
57
57
|
})
|
|
58
|
-
] })
|
|
58
|
+
] }) : items.map((item, index) => {
|
|
59
|
+
const itemProps = getItemProps({ item, index });
|
|
60
|
+
const key = itemToKey(item);
|
|
61
|
+
const childProps = {
|
|
62
|
+
item,
|
|
63
|
+
isHighlighted: highlightedIndex === index,
|
|
64
|
+
key,
|
|
65
|
+
classNames: itemClassNames
|
|
66
|
+
};
|
|
67
|
+
if (typeof props.children === "function") {
|
|
68
|
+
return props.children({ ...childProps, itemProps });
|
|
69
|
+
}
|
|
70
|
+
return /* @__PURE__ */ $670gB$react.createElement(
|
|
71
|
+
tagFieldItem.TagFieldItem,
|
|
72
|
+
{
|
|
73
|
+
...childProps,
|
|
74
|
+
...itemProps,
|
|
75
|
+
key
|
|
76
|
+
}
|
|
77
|
+
);
|
|
78
|
+
}) });
|
|
59
79
|
};
|
|
60
80
|
const TagFieldList = utils.forwardRefGeneric(TagFieldListInner);
|
|
61
81
|
|
|
@@ -8,6 +8,10 @@ var downshift = require('downshift');
|
|
|
8
8
|
var lodashEs = require('lodash-es');
|
|
9
9
|
var reactAria = require('react-aria');
|
|
10
10
|
|
|
11
|
+
function useOptionalVirtualizer(isVirtualized, options) {
|
|
12
|
+
const virtualizer = reactVirtual.useVirtualizer(options);
|
|
13
|
+
return isVirtualized ? virtualizer : null;
|
|
14
|
+
}
|
|
11
15
|
function useTagField(props, state) {
|
|
12
16
|
let { buttonRef } = props;
|
|
13
17
|
const {
|
|
@@ -21,7 +25,8 @@ function useTagField(props, state) {
|
|
|
21
25
|
itemToKey,
|
|
22
26
|
itemToText,
|
|
23
27
|
label,
|
|
24
|
-
virtualRowHeight = 40
|
|
28
|
+
virtualRowHeight = 40,
|
|
29
|
+
isVirtualized = true
|
|
25
30
|
} = props;
|
|
26
31
|
const backupBtnRef = $670gB$react.useRef(null);
|
|
27
32
|
buttonRef = buttonRef ?? backupBtnRef;
|
|
@@ -51,7 +56,7 @@ function useTagField(props, state) {
|
|
|
51
56
|
const disabledKeysSet = $670gB$react.useMemo(() => {
|
|
52
57
|
return new Set(disabledKeys);
|
|
53
58
|
}, [disabledKeys]);
|
|
54
|
-
const rowVirtualizer =
|
|
59
|
+
const rowVirtualizer = useOptionalVirtualizer(isVirtualized, {
|
|
55
60
|
count: items.length,
|
|
56
61
|
getScrollElement: () => listBoxRef.current,
|
|
57
62
|
estimateSize: () => virtualRowHeight,
|
|
@@ -78,11 +83,17 @@ function useTagField(props, state) {
|
|
|
78
83
|
},
|
|
79
84
|
isItemDisabled: (item) => isDisabled || isReadOnly || disabledKeysSet.has(itemToKey(item)),
|
|
80
85
|
items,
|
|
81
|
-
scrollIntoView
|
|
86
|
+
// Noop for scrollIntoView if virtualized, as we'll handle it in onHighlightedIndexChange
|
|
87
|
+
scrollIntoView: (node) => {
|
|
88
|
+
if (!isVirtualized) {
|
|
89
|
+
node.scrollIntoView({ block: "nearest" });
|
|
90
|
+
}
|
|
82
91
|
},
|
|
83
92
|
onHighlightedIndexChange: ({ highlightedIndex: highlightedIndex2, type }) => {
|
|
84
93
|
if (type !== downshift.useCombobox.stateChangeTypes.MenuMouseLeave && highlightedIndex2 >= 0) {
|
|
85
|
-
rowVirtualizer
|
|
94
|
+
if (rowVirtualizer) {
|
|
95
|
+
rowVirtualizer.scrollToIndex(highlightedIndex2);
|
|
96
|
+
}
|
|
86
97
|
}
|
|
87
98
|
},
|
|
88
99
|
defaultHighlightedIndex: 0,
|
|
@@ -5,10 +5,11 @@
|
|
|
5
5
|
var jsxRuntime = require('react/jsx-runtime');
|
|
6
6
|
var reactAriaComponents = require('react-aria-components');
|
|
7
7
|
var ouiTheme = require('@opengovsg/oui-theme');
|
|
8
|
+
var children = require('../system/react-utils/children.cjs');
|
|
8
9
|
var utils = require('../system/utils.cjs');
|
|
9
10
|
|
|
10
11
|
function Tooltip(originalProps) {
|
|
11
|
-
const [{ children, showArrow = true, classNames, ...props }, variantProps] = utils.mapPropsVariants(originalProps, ouiTheme.tooltipStyles.variantKeys);
|
|
12
|
+
const [{ children: children$1, showArrow = true, classNames, ...props }, variantProps] = utils.mapPropsVariants(originalProps, ouiTheme.tooltipStyles.variantKeys);
|
|
12
13
|
const styles = ouiTheme.tooltipStyles(variantProps);
|
|
13
14
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
14
15
|
reactAriaComponents.Tooltip,
|
|
@@ -31,17 +32,14 @@ function Tooltip(originalProps) {
|
|
|
31
32
|
width: 8,
|
|
32
33
|
height: 8,
|
|
33
34
|
viewBox: "0 0 8 8",
|
|
34
|
-
className:
|
|
35
|
-
|
|
36
|
-
(
|
|
37
|
-
|
|
38
|
-
...renderProps2
|
|
39
|
-
})
|
|
40
|
-
)(renderProps),
|
|
35
|
+
className: styles.arrow({
|
|
36
|
+
...renderProps,
|
|
37
|
+
className: children.renderChildren(renderProps, classNames?.arrow)
|
|
38
|
+
}),
|
|
41
39
|
children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M0 0 L4 4 L8 0" })
|
|
42
40
|
}
|
|
43
41
|
) }),
|
|
44
|
-
children
|
|
42
|
+
children$1
|
|
45
43
|
] })
|
|
46
44
|
}
|
|
47
45
|
);
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"use client";
|
|
3
3
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
4
4
|
import { useContext } from 'react';
|
|
5
|
-
import { Disclosure, composeRenderProps, DisclosureGroup, DisclosureStateContext, Heading, Button
|
|
5
|
+
import { Disclosure, composeRenderProps, DisclosureGroup, DisclosurePanel, DisclosureStateContext, Heading, Button } from 'react-aria-components';
|
|
6
6
|
import { cn, accordionStyles, composeTailwindRenderProps } from '@opengovsg/oui-theme';
|
|
7
7
|
import { renderChildren } from '../system/react-utils/children.js';
|
|
8
8
|
import { forwardRef, mapPropsVariants } from '../system/utils.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
import { useMemo, useCallback,
|
|
2
|
+
import { useMemo, useCallback, isValidElement, cloneElement } from 'react';
|
|
3
3
|
import { mergeProps } from '@react-aria/utils';
|
|
4
4
|
import { useLocalizedStringFormatter, useFocusRing, usePress } from 'react-aria';
|
|
5
5
|
import { useDeepCompareMemo } from 'use-deep-compare';
|
|
@@ -5,10 +5,10 @@ import { useMemo, useRef } from 'react';
|
|
|
5
5
|
import { useLocalizedStringFormatter, 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';
|
|
9
8
|
import { i18nStrings } from './i18n.js';
|
|
10
9
|
import CircleAlert from '../node_modules/.pnpm/lucide-react@0.475.0_react@19.2.3/node_modules/lucide-react/dist/esm/icons/circle-alert.js';
|
|
11
10
|
import Info from '../node_modules/.pnpm/lucide-react@0.475.0_react@19.2.3/node_modules/lucide-react/dist/esm/icons/info.js';
|
|
11
|
+
import { Button } from '../button/button.js';
|
|
12
12
|
import X from '../node_modules/.pnpm/lucide-react@0.475.0_react@19.2.3/node_modules/lucide-react/dist/esm/icons/x.js';
|
|
13
13
|
|
|
14
14
|
const Banner = ({
|
|
@@ -3,12 +3,12 @@
|
|
|
3
3
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
4
4
|
import { useMemo } from 'react';
|
|
5
5
|
import { useLocalizedStringFormatter } from 'react-aria';
|
|
6
|
-
import {
|
|
6
|
+
import { Breadcrumb as Breadcrumb$1, Provider, Breadcrumbs as Breadcrumbs$1, MenuTrigger } from 'react-aria-components';
|
|
7
7
|
import { breadcrumbsStyles, composeRenderProps } from '@opengovsg/oui-theme';
|
|
8
8
|
import { Link } from '../link/link.js';
|
|
9
9
|
import { Menu, MenuItem } from '../menu/menu.js';
|
|
10
10
|
import { getValidChildren } from '../system/react-utils/children.js';
|
|
11
|
-
import {
|
|
11
|
+
import { useBreadcrumbsStyleContext, BreadcrumbsStyleContext } from './context.js';
|
|
12
12
|
import { i18nStrings } from './i18n.js';
|
|
13
13
|
import ChevronRight from '../node_modules/.pnpm/lucide-react@0.475.0_react@19.2.3/node_modules/lucide-react/dist/esm/icons/chevron-right.js';
|
|
14
14
|
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
4
4
|
import { useMemo, useContext } from 'react';
|
|
5
5
|
import { CalendarDate, today, getLocalTimeZone } from '@internationalized/date';
|
|
6
|
-
import { Calendar as Calendar$1,
|
|
6
|
+
import { Calendar as Calendar$1, Provider, CalendarGrid, CalendarGridBody, CalendarCell, composeRenderProps, Text, CalendarStateContext } from 'react-aria-components';
|
|
7
7
|
import { useDeepCompareMemo } from 'use-deep-compare';
|
|
8
8
|
import { calendarStyles, dataAttr, cn } from '@opengovsg/oui-theme';
|
|
9
9
|
import { forwardRefGeneric, mapPropsVariants } from '../system/utils.js';
|
|
@@ -4,6 +4,7 @@ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
|
4
4
|
import { Checkbox as Checkbox$1, composeRenderProps, Provider, CheckboxGroup as CheckboxGroup$1 } from 'react-aria-components';
|
|
5
5
|
import { checkboxStyles, checkboxGroupStyles } from '@opengovsg/oui-theme';
|
|
6
6
|
import { Label, Description, FieldError } from '../field/field.js';
|
|
7
|
+
import { renderChildren } from '../system/react-utils/children.js';
|
|
7
8
|
import { mapPropsVariants } from '../system/utils.js';
|
|
8
9
|
import { useCheckboxGroupStyleContext, CheckboxGroupStyleContext } from './checkbox-group-style-context.js';
|
|
9
10
|
import Minus from '../node_modules/.pnpm/lucide-react@0.475.0_react@19.2.3/node_modules/lucide-react/dist/esm/icons/minus.js';
|
|
@@ -31,32 +32,39 @@ const Checkbox = ({
|
|
|
31
32
|
className ?? classNames?.base,
|
|
32
33
|
(className2, renderProps) => styles.base({ ...renderProps, className: className2 })
|
|
33
34
|
),
|
|
34
|
-
children: (
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
35
|
+
children: (renderProps) => {
|
|
36
|
+
const { isSelected, isIndeterminate, ...restRenderProps } = renderProps;
|
|
37
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
38
|
+
/* @__PURE__ */ jsx(
|
|
39
|
+
"div",
|
|
40
|
+
{
|
|
41
|
+
className: styles.box({
|
|
42
|
+
isSelected: isSelected || isIndeterminate,
|
|
43
|
+
...restRenderProps,
|
|
44
|
+
className: renderChildren(renderProps, classNames?.box)
|
|
45
|
+
}),
|
|
46
|
+
children: isIndeterminate ? /* @__PURE__ */ jsx(
|
|
47
|
+
Minus,
|
|
48
|
+
{
|
|
49
|
+
"aria-hidden": true,
|
|
50
|
+
className: styles.icon({
|
|
51
|
+
className: renderChildren(renderProps, classNames?.icon)
|
|
52
|
+
})
|
|
53
|
+
}
|
|
54
|
+
) : isSelected ? /* @__PURE__ */ jsx(
|
|
55
|
+
Check,
|
|
56
|
+
{
|
|
57
|
+
"aria-hidden": true,
|
|
58
|
+
className: styles.icon({
|
|
59
|
+
className: renderChildren(renderProps, classNames?.icon)
|
|
60
|
+
})
|
|
61
|
+
}
|
|
62
|
+
) : null
|
|
63
|
+
}
|
|
64
|
+
),
|
|
65
|
+
props.children
|
|
66
|
+
] });
|
|
67
|
+
}
|
|
60
68
|
}
|
|
61
69
|
);
|
|
62
70
|
};
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"use client";
|
|
3
3
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
4
4
|
import { useMemo } from 'react';
|
|
5
|
-
import { useContextProps, ListBoxItem,
|
|
5
|
+
import { useContextProps, ListBoxItem, Text, composeRenderProps } from 'react-aria-components';
|
|
6
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';
|
|
@@ -4,7 +4,7 @@ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
|
4
4
|
import { useMemo, useCallback } from 'react';
|
|
5
5
|
import { useLocalizedStringFormatter } from 'react-aria';
|
|
6
6
|
import { ListLayout, Provider, ComboBox as ComboBox$1, Input, Button, Virtualizer, ListBox } from 'react-aria-components';
|
|
7
|
-
import {
|
|
7
|
+
import { comboBoxStyles, composeRenderProps, comboBoxClearButtonStyles, composeTailwindRenderProps, listBoxItemStyles, cn } from '@opengovsg/oui-theme';
|
|
8
8
|
import { Label, FieldGroup, Description, FieldError } from '../field/field.js';
|
|
9
9
|
import { Popover } from '../popover/popover.js';
|
|
10
10
|
import { mapPropsVariants } from '../system/utils.js';
|
|
@@ -4,14 +4,13 @@ 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';
|
|
10
7
|
import { DateInput } from '../date-field/date-field.js';
|
|
11
8
|
import { Label, FieldGroup, Description, FieldError } from '../field/field.js';
|
|
12
9
|
import { Popover } from '../popover/popover.js';
|
|
13
10
|
import { mapPropsVariants } from '../system/utils.js';
|
|
14
11
|
import Calendar from '../node_modules/.pnpm/lucide-react@0.475.0_react@19.2.3/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';
|
|
15
14
|
|
|
16
15
|
function DatePicker(originalProps) {
|
|
17
16
|
const [
|
|
@@ -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';
|
|
9
8
|
import { DateInput } from '../date-field/date-field.js';
|
|
10
9
|
import { Label, FieldGroup, Description, FieldError } from '../field/field.js';
|
|
11
10
|
import { Popover } from '../popover/popover.js';
|
|
12
11
|
import { RangeCalendar } from '../range-calendar/range-calendar.js';
|
|
13
12
|
import { mapPropsVariants } from '../system/utils.js';
|
|
14
13
|
import Calendar from '../node_modules/.pnpm/lucide-react@0.475.0_react@19.2.3/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 [
|
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
4
4
|
import { useState, useEffect } from 'react';
|
|
5
5
|
import { fileInfoDropzoneStyles, cn } from '@opengovsg/oui-theme';
|
|
6
|
-
import { Button } from '../button/button.js';
|
|
7
6
|
import { useFileDropzoneStateContext, useFileDropzoneStyleContext } from './contexts.js';
|
|
8
7
|
import { formatBytes } from './utils.js';
|
|
9
8
|
import Trash2 from '../node_modules/.pnpm/lucide-react@0.475.0_react@19.2.3/node_modules/lucide-react/dist/esm/icons/trash-2.js';
|
|
9
|
+
import { Button } from '../button/button.js';
|
|
10
10
|
|
|
11
11
|
const FileInfo = ({ file, imagePreview, classNames }) => {
|
|
12
12
|
const {
|
package/dist/esm/index.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
export { useControllableState } from './hooks/use-controllable-state.js';
|
|
3
3
|
export { useDraggable } from './hooks/use-draggable.js';
|
|
4
|
-
export { Button } from './button/button.js';
|
|
5
4
|
export { GovtBanner } from './govt-banner/govt-banner.js';
|
|
6
5
|
export { Ripple } from './ripple/ripple.js';
|
|
7
6
|
export { useRipple } from './ripple/use-ripple.js';
|
|
@@ -18,26 +17,18 @@ export { ComboBox, ComboBoxEmptyState } from './combo-box/combo-box.js';
|
|
|
18
17
|
export { ComboBoxFuzzy } from './combo-box/combo-box-fuzzy.js';
|
|
19
18
|
export { ComboBoxItem } from './combo-box/combo-box-item.js';
|
|
20
19
|
export { ComboBoxVariantContext, useComboBoxVariantContext } from './combo-box/combo-box-variant-context.js';
|
|
21
|
-
export { Banner } from './banner/banner.js';
|
|
22
20
|
export { TagField } from './tag-field/tag-field.js';
|
|
23
21
|
export { TagFieldItem } from './tag-field/tag-field-item.js';
|
|
24
22
|
export { Select } from './select/select.js';
|
|
25
23
|
export { SelectItem } from './select/select-item.js';
|
|
26
24
|
export { SelectVariantContext, useSelectVariantContext } from './select/select-variant-context.js';
|
|
27
|
-
export { Badge } from './badge/badge.js';
|
|
28
|
-
export { Calendar, CalendarStateWrapper } from './calendar/calendar.js';
|
|
29
|
-
export { CalendarStyleContext, useCalendarStyleContext } from './calendar/calendar-style-context.js';
|
|
30
|
-
export { getEraFormat, useGenerateLocalizedMonths, useGenerateLocalizedYears, useLocalizedMonthYear } from './calendar/utils.js';
|
|
31
|
-
export { CalendarDate } from '@internationalized/date';
|
|
32
25
|
export { RangeCalendar, RangeCalendarCell, RangeCalendarStateWrapper } from './range-calendar/range-calendar.js';
|
|
33
26
|
export { Menu, MenuItem, MenuSection, MenuSeparator, MenuTrigger, MenuVariantContext, SubmenuTrigger, useMenuVariantContext } from './menu/menu.js';
|
|
34
27
|
export { Popover } from './popover/popover.js';
|
|
35
|
-
export { Tab, TabList, TabPanel, Tabs, TabsVariantContext, useTabsVariantContext } from './tabs/tabs.js';
|
|
28
|
+
export { Tab, TabList, TabPanel, TabPanels, Tabs, TabsVariantContext, useTabsVariantContext } from './tabs/tabs.js';
|
|
36
29
|
export { DateField, DateInput } from './date-field/date-field.js';
|
|
37
30
|
export { DatePicker } from './date-picker/date-picker.js';
|
|
38
31
|
export { DateRangePicker } from './date-range-picker/date-range-picker.js';
|
|
39
|
-
export { Checkbox, CheckboxGroup } from './checkbox/checkbox.js';
|
|
40
|
-
export { CheckboxGroupStyleContext, useCheckboxGroupStyleContext } from './checkbox/checkbox-group-style-context.js';
|
|
41
32
|
export { Pagination } from './pagination/pagination.js';
|
|
42
33
|
export { PaginationCursor } from './pagination/pagination-cursor.js';
|
|
43
34
|
export { PaginationItem } from './pagination/pagination-item.js';
|
|
@@ -64,11 +55,9 @@ export { NavbarItem } from './navbar/navbar-item.js';
|
|
|
64
55
|
export { useNavbar } from './navbar/use-navbar.js';
|
|
65
56
|
export { NavbarProvider, useNavbarContext } from './navbar/navbar-context.js';
|
|
66
57
|
export { Avatar } from './avatar/index.js';
|
|
67
|
-
export { Accordion, AccordionContent, AccordionHeader, AccordionItem, AccordionStyleContext, useAccordionStyleContext } from './accordion/accordion.js';
|
|
68
58
|
export { TimeField } from './time-field/time-field.js';
|
|
69
59
|
export { SearchField } from './search-field/search-field.js';
|
|
70
60
|
export { Link } from './link/link.js';
|
|
71
|
-
export { Breadcrumb, Breadcrumbs } from './breadcrumbs/breadcrumbs.js';
|
|
72
61
|
export { Sidebar, generateSidebarItems } from './sidebar/sidebar.js';
|
|
73
62
|
export { SidebarRoot } from './sidebar/sidebar-root.js';
|
|
74
63
|
export { SidebarItem } from './sidebar/sidebar-item.js';
|
|
@@ -77,8 +66,21 @@ export { SidebarHeader } from './sidebar/sidebar-header.js';
|
|
|
77
66
|
export { Tooltip, TooltipTrigger } from './tooltip/tooltip.js';
|
|
78
67
|
export { CountrySelect, FlagComponent, PhoneInput, PhoneNumberField } from './phone-number-field/phone-number-field.js';
|
|
79
68
|
export { formatPhoneNumber, formatPhoneNumberIntl, isPossiblePhoneNumber, isValidPhoneNumber, parsePhoneNumber } from 'react-phone-number-input';
|
|
80
|
-
export {
|
|
69
|
+
export { Infobox } from './infobox/infobox.js';
|
|
70
|
+
export { Radio, RadioGroup } from './radio-group/radio.js';
|
|
71
|
+
export { Accordion, AccordionContent, AccordionHeader, AccordionItem, AccordionStyleContext, useAccordionStyleContext } from './accordion/accordion.js';
|
|
81
72
|
export { AvatarContext, useAvatarContext } from './avatar/avatar-context.js';
|
|
73
|
+
export { AvatarFallback, AvatarImage, AvatarRoot } from './avatar/avatar.js';
|
|
82
74
|
export { AvatarGroup } from './avatar/avatar-group.js';
|
|
83
75
|
export { AvatarGroupProvider, useAvatarGroup } from './avatar/avatar-group-context.js';
|
|
84
|
-
export {
|
|
76
|
+
export { Badge } from './badge/badge.js';
|
|
77
|
+
export { Banner } from './banner/banner.js';
|
|
78
|
+
export { Breadcrumb, Breadcrumbs } from './breadcrumbs/breadcrumbs.js';
|
|
79
|
+
export { Button } from './button/button.js';
|
|
80
|
+
export { Calendar, CalendarStateWrapper } from './calendar/calendar.js';
|
|
81
|
+
export { CalendarDate } from '@internationalized/date';
|
|
82
|
+
export { CalendarStyleContext, useCalendarStyleContext } from './calendar/calendar-style-context.js';
|
|
83
|
+
export { Checkbox, CheckboxGroup } from './checkbox/checkbox.js';
|
|
84
|
+
export { CheckboxGroupStyleContext, useCheckboxGroupStyleContext } from './checkbox/checkbox-group-style-context.js';
|
|
85
|
+
export { getEraFormat, useGenerateLocalizedMonths, useGenerateLocalizedYears, useLocalizedMonthYear } from './calendar/utils.js';
|
|
86
|
+
export { toast } from 'sonner';
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
"use client";
|
|
3
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
4
|
+
import { useMemo } from 'react';
|
|
5
|
+
import { useInfobox } from './use-infobox.js';
|
|
6
|
+
import Info from '../node_modules/.pnpm/lucide-react@0.475.0_react@19.2.3/node_modules/lucide-react/dist/esm/icons/info.js';
|
|
7
|
+
import CircleCheck from '../node_modules/.pnpm/lucide-react@0.475.0_react@19.2.3/node_modules/lucide-react/dist/esm/icons/circle-check.js';
|
|
8
|
+
import CircleAlert from '../node_modules/.pnpm/lucide-react@0.475.0_react@19.2.3/node_modules/lucide-react/dist/esm/icons/circle-alert.js';
|
|
9
|
+
|
|
10
|
+
const Infobox = (props) => {
|
|
11
|
+
const { Component, children, slots, classNames, icon, variant } = useInfobox(props);
|
|
12
|
+
const displayedIcon = useMemo(() => {
|
|
13
|
+
if (icon) {
|
|
14
|
+
return icon;
|
|
15
|
+
}
|
|
16
|
+
if (icon === null) {
|
|
17
|
+
return null;
|
|
18
|
+
}
|
|
19
|
+
const iconClassName = slots.icon({ className: classNames?.icon });
|
|
20
|
+
switch (variant) {
|
|
21
|
+
case "error":
|
|
22
|
+
return /* @__PURE__ */ jsx(CircleAlert, { className: iconClassName });
|
|
23
|
+
case "success":
|
|
24
|
+
return /* @__PURE__ */ jsx(CircleCheck, { className: iconClassName });
|
|
25
|
+
case "warning":
|
|
26
|
+
case "info":
|
|
27
|
+
default:
|
|
28
|
+
return /* @__PURE__ */ jsx(Info, { className: iconClassName });
|
|
29
|
+
}
|
|
30
|
+
}, [icon, variant, slots, classNames?.icon]);
|
|
31
|
+
return /* @__PURE__ */ jsxs(Component, { className: slots.base({ className: classNames?.base }), children: [
|
|
32
|
+
displayedIcon,
|
|
33
|
+
/* @__PURE__ */ jsx("div", { className: slots.wrapper({ className: classNames?.wrapper }), children })
|
|
34
|
+
] });
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export { Infobox };
|