@opengovsg/oui 0.0.44 → 0.0.45
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 +1 -1
- package/dist/cjs/combo-box/combo-box.cjs +1 -1
- package/dist/cjs/date-field/date-field.cjs +1 -1
- package/dist/cjs/date-picker/date-picker.cjs +4 -5
- package/dist/cjs/date-range-picker/date-range-picker.cjs +3 -3
- package/dist/cjs/file-dropzone/file-dropzone.cjs +2 -2
- package/dist/cjs/file-dropzone/file-info.cjs +1 -1
- package/dist/cjs/index.cjs +88 -74
- package/dist/cjs/modal/modal-content.cjs +1 -1
- package/dist/cjs/number-field/number-field.cjs +2 -2
- package/dist/cjs/range-calendar/range-calendar.cjs +1 -1
- package/dist/cjs/search-field/search-field.cjs +2 -2
- package/dist/cjs/select/select.cjs +2 -2
- package/dist/cjs/sidebar/context.cjs +24 -0
- package/dist/cjs/sidebar/i18n.cjs +23 -0
- package/dist/cjs/sidebar/index.cjs +17 -0
- package/dist/cjs/sidebar/sidebar-header.cjs +40 -0
- package/dist/cjs/sidebar/sidebar-item.cjs +61 -0
- package/dist/cjs/sidebar/sidebar-list.cjs +213 -0
- package/dist/cjs/sidebar/sidebar-root.cjs +63 -0
- package/dist/cjs/sidebar/sidebar.cjs +31 -0
- package/dist/cjs/sidebar/types.cjs +3 -0
- package/dist/cjs/sidebar/utils.cjs +12 -0
- package/dist/cjs/tag-field/tag-field.cjs +1 -1
- package/dist/cjs/text-area-field/text-area-field.cjs +1 -1
- package/dist/cjs/text-field/text-field.cjs +1 -1
- package/dist/cjs/time-field/time-field.cjs +2 -2
- package/dist/cjs/tooltip/index.cjs +9 -0
- package/dist/cjs/tooltip/tooltip.cjs +54 -0
- package/dist/esm/banner/banner.js +1 -1
- package/dist/esm/checkbox/checkbox.js +1 -1
- package/dist/esm/combo-box/combo-box.js +1 -1
- package/dist/esm/date-field/date-field.js +1 -1
- package/dist/esm/date-picker/date-picker.js +4 -5
- package/dist/esm/date-range-picker/date-range-picker.js +3 -3
- package/dist/esm/file-dropzone/file-dropzone.js +2 -2
- package/dist/esm/file-dropzone/file-info.js +1 -1
- package/dist/esm/index.js +31 -25
- package/dist/esm/modal/modal-content.js +1 -1
- package/dist/esm/number-field/number-field.js +2 -2
- package/dist/esm/range-calendar/range-calendar.js +1 -1
- package/dist/esm/search-field/search-field.js +2 -2
- package/dist/esm/select/select.js +2 -2
- package/dist/esm/sidebar/context.js +17 -0
- package/dist/esm/sidebar/i18n.js +21 -0
- package/dist/esm/sidebar/index.js +6 -0
- package/dist/esm/sidebar/sidebar-header.js +38 -0
- package/dist/esm/sidebar/sidebar-item.js +59 -0
- package/dist/esm/sidebar/sidebar-list.js +211 -0
- package/dist/esm/sidebar/sidebar-root.js +61 -0
- package/dist/esm/sidebar/sidebar.js +28 -0
- package/dist/esm/sidebar/types.js +1 -0
- package/dist/esm/sidebar/utils.js +9 -0
- package/dist/esm/tag-field/tag-field.js +1 -1
- package/dist/esm/text-area-field/text-area-field.js +1 -1
- package/dist/esm/text-field/text-field.js +1 -1
- package/dist/esm/time-field/time-field.js +2 -2
- package/dist/esm/tooltip/index.js +2 -0
- package/dist/esm/tooltip/tooltip.js +51 -0
- 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/sidebar/context.d.ts +22 -0
- package/dist/types/sidebar/context.d.ts.map +1 -0
- package/dist/types/sidebar/i18n.d.ts +19 -0
- package/dist/types/sidebar/i18n.d.ts.map +1 -0
- package/dist/types/sidebar/index.d.ts +7 -0
- package/dist/types/sidebar/index.d.ts.map +1 -0
- package/dist/types/sidebar/sidebar-header.d.ts +6 -0
- package/dist/types/sidebar/sidebar-header.d.ts.map +1 -0
- package/dist/types/sidebar/sidebar-item.d.ts +3 -0
- package/dist/types/sidebar/sidebar-item.d.ts.map +1 -0
- package/dist/types/sidebar/sidebar-list.d.ts +3 -0
- package/dist/types/sidebar/sidebar-list.d.ts.map +1 -0
- package/dist/types/sidebar/sidebar-root.d.ts +17 -0
- package/dist/types/sidebar/sidebar-root.d.ts.map +1 -0
- package/dist/types/sidebar/sidebar.d.ts +8 -0
- package/dist/types/sidebar/sidebar.d.ts.map +1 -0
- package/dist/types/sidebar/types.d.ts +48 -0
- package/dist/types/sidebar/types.d.ts.map +1 -0
- package/dist/types/sidebar/utils.d.ts +4 -0
- package/dist/types/sidebar/utils.d.ts.map +1 -0
- package/dist/types/system/react-utils/children.d.ts +1 -2
- package/dist/types/system/react-utils/children.d.ts.map +1 -1
- package/dist/types/tooltip/index.d.ts +2 -0
- package/dist/types/tooltip/index.d.ts.map +1 -0
- package/dist/types/tooltip/tooltip.d.ts +16 -0
- package/dist/types/tooltip/tooltip.d.ts.map +1 -0
- package/package.json +5 -5
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
"use client";
|
|
3
|
+
'use strict';
|
|
4
|
+
|
|
5
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
6
|
+
var $670gB$react = require('react');
|
|
7
|
+
var reactAria = require('react-aria');
|
|
8
|
+
var reactAriaComponents = require('react-aria-components');
|
|
9
|
+
var reactStately = require('react-stately');
|
|
10
|
+
var ouiTheme = require('@opengovsg/oui-theme');
|
|
11
|
+
var utils = require('../system/utils.cjs');
|
|
12
|
+
var context = require('./context.cjs');
|
|
13
|
+
var i18n = require('./i18n.cjs');
|
|
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
|
+
|
|
17
|
+
const SidebarListSection = ({
|
|
18
|
+
onlyCaretToggle,
|
|
19
|
+
isExpanded,
|
|
20
|
+
isSelected,
|
|
21
|
+
children,
|
|
22
|
+
linkProps
|
|
23
|
+
}) => {
|
|
24
|
+
const { slots, classNames } = context.useSidebarStyleContext();
|
|
25
|
+
const { isNested } = context.useSidebarNestContext() ?? {};
|
|
26
|
+
const stringFormatter = reactAria.useLocalizedStringFormatter(i18n.i18nStrings);
|
|
27
|
+
if (onlyCaretToggle) {
|
|
28
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
29
|
+
"div",
|
|
30
|
+
{
|
|
31
|
+
"data-expanded": ouiTheme.dataAttr(isExpanded),
|
|
32
|
+
"data-selected": ouiTheme.dataAttr(isSelected),
|
|
33
|
+
className: slots.item({
|
|
34
|
+
className: classNames?.item,
|
|
35
|
+
isExpanded,
|
|
36
|
+
isNested
|
|
37
|
+
}),
|
|
38
|
+
children: [
|
|
39
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
40
|
+
reactAriaComponents.Link,
|
|
41
|
+
{
|
|
42
|
+
className: slots.label({
|
|
43
|
+
className: classNames?.label,
|
|
44
|
+
isNested,
|
|
45
|
+
isExpanded
|
|
46
|
+
}),
|
|
47
|
+
...linkProps,
|
|
48
|
+
children
|
|
49
|
+
}
|
|
50
|
+
),
|
|
51
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
52
|
+
button.Button,
|
|
53
|
+
{
|
|
54
|
+
variant: "clear",
|
|
55
|
+
color: "none",
|
|
56
|
+
slot: "trigger",
|
|
57
|
+
"aria-label": stringFormatter.format(
|
|
58
|
+
isExpanded ? "Collapse sidebar section" : "Expand sidebar section"
|
|
59
|
+
),
|
|
60
|
+
className: slots.chevronContainer({
|
|
61
|
+
className: classNames?.chevronContainer
|
|
62
|
+
}),
|
|
63
|
+
children: ({ isDisabled }) => /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
64
|
+
chevronDown.default,
|
|
65
|
+
{
|
|
66
|
+
"aria-hidden": true,
|
|
67
|
+
className: slots.chevron({ isExpanded, isDisabled })
|
|
68
|
+
}
|
|
69
|
+
) })
|
|
70
|
+
}
|
|
71
|
+
)
|
|
72
|
+
]
|
|
73
|
+
}
|
|
74
|
+
);
|
|
75
|
+
}
|
|
76
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
77
|
+
reactAriaComponents.Button,
|
|
78
|
+
{
|
|
79
|
+
"data-expanded": ouiTheme.dataAttr(isExpanded),
|
|
80
|
+
"data-selected": ouiTheme.dataAttr(isSelected),
|
|
81
|
+
slot: "trigger",
|
|
82
|
+
className: slots.item({
|
|
83
|
+
className: classNames?.item,
|
|
84
|
+
isExpanded,
|
|
85
|
+
isNested
|
|
86
|
+
}),
|
|
87
|
+
children: ({ isDisabled }) => /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
88
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
89
|
+
"span",
|
|
90
|
+
{
|
|
91
|
+
className: slots.label({
|
|
92
|
+
className: classNames?.label,
|
|
93
|
+
isNested,
|
|
94
|
+
isExpanded
|
|
95
|
+
}),
|
|
96
|
+
children
|
|
97
|
+
}
|
|
98
|
+
),
|
|
99
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
100
|
+
"span",
|
|
101
|
+
{
|
|
102
|
+
className: slots.chevronContainer({
|
|
103
|
+
className: classNames?.chevronContainer
|
|
104
|
+
}),
|
|
105
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
106
|
+
chevronDown.default,
|
|
107
|
+
{
|
|
108
|
+
"aria-hidden": true,
|
|
109
|
+
className: slots.chevron({ isExpanded, isDisabled })
|
|
110
|
+
}
|
|
111
|
+
)
|
|
112
|
+
}
|
|
113
|
+
)
|
|
114
|
+
] })
|
|
115
|
+
}
|
|
116
|
+
);
|
|
117
|
+
};
|
|
118
|
+
const SidebarList = utils.forwardRef(
|
|
119
|
+
({
|
|
120
|
+
label,
|
|
121
|
+
children,
|
|
122
|
+
startContent,
|
|
123
|
+
endContent,
|
|
124
|
+
isSelected,
|
|
125
|
+
defaultIsExpanded,
|
|
126
|
+
isExpanded: isExpandedProp,
|
|
127
|
+
onExpand: onExpandProp,
|
|
128
|
+
onlyCaretToggle = false,
|
|
129
|
+
...props
|
|
130
|
+
}, ref) => {
|
|
131
|
+
const { slots, classNames } = context.useSidebarStyleContext();
|
|
132
|
+
const { isCollapsed } = context.useSidebarCollapseContext() ?? {};
|
|
133
|
+
const { isExpanded, setExpanded } = reactStately.useDisclosureState({
|
|
134
|
+
defaultExpanded: defaultIsExpanded,
|
|
135
|
+
isExpanded: isExpandedProp,
|
|
136
|
+
onExpandedChange: onExpandProp
|
|
137
|
+
});
|
|
138
|
+
const dataSelected = $670gB$react.useMemo(() => {
|
|
139
|
+
if (typeof isSelected === "function") {
|
|
140
|
+
return isSelected();
|
|
141
|
+
}
|
|
142
|
+
return isSelected;
|
|
143
|
+
}, [isSelected]);
|
|
144
|
+
if (isCollapsed) {
|
|
145
|
+
return children;
|
|
146
|
+
}
|
|
147
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
148
|
+
"li",
|
|
149
|
+
{
|
|
150
|
+
"data-selected": ouiTheme.dataAttr(dataSelected),
|
|
151
|
+
className: slots.list({
|
|
152
|
+
className: classNames?.list
|
|
153
|
+
}),
|
|
154
|
+
ref,
|
|
155
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
156
|
+
reactAriaComponents.Disclosure,
|
|
157
|
+
{
|
|
158
|
+
className: slots.section({
|
|
159
|
+
className: classNames?.section,
|
|
160
|
+
isExpanded
|
|
161
|
+
}),
|
|
162
|
+
isExpanded,
|
|
163
|
+
onExpandedChange: setExpanded,
|
|
164
|
+
children: [
|
|
165
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
166
|
+
SidebarListSection,
|
|
167
|
+
{
|
|
168
|
+
onlyCaretToggle,
|
|
169
|
+
isSelected,
|
|
170
|
+
isExpanded,
|
|
171
|
+
linkProps: props,
|
|
172
|
+
children: [
|
|
173
|
+
startContent,
|
|
174
|
+
label,
|
|
175
|
+
endContent
|
|
176
|
+
]
|
|
177
|
+
}
|
|
178
|
+
),
|
|
179
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
180
|
+
reactAriaComponents.DisclosurePanel,
|
|
181
|
+
{
|
|
182
|
+
className: slots.nestedPanel({
|
|
183
|
+
className: classNames?.nestedPanel
|
|
184
|
+
}),
|
|
185
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
186
|
+
reactAriaComponents.Provider,
|
|
187
|
+
{
|
|
188
|
+
values: [[context.SidebarNestContext, { isNested: true, isExpanded }]],
|
|
189
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
190
|
+
"ul",
|
|
191
|
+
{
|
|
192
|
+
className: slots.ul({
|
|
193
|
+
className: classNames?.ul,
|
|
194
|
+
isNested: true,
|
|
195
|
+
isExpanded
|
|
196
|
+
}),
|
|
197
|
+
children
|
|
198
|
+
}
|
|
199
|
+
)
|
|
200
|
+
}
|
|
201
|
+
)
|
|
202
|
+
}
|
|
203
|
+
)
|
|
204
|
+
]
|
|
205
|
+
}
|
|
206
|
+
)
|
|
207
|
+
}
|
|
208
|
+
);
|
|
209
|
+
}
|
|
210
|
+
);
|
|
211
|
+
SidebarList.displayName = "SidebarList";
|
|
212
|
+
|
|
213
|
+
exports.SidebarList = SidebarList;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
"use client";
|
|
3
|
+
'use strict';
|
|
4
|
+
|
|
5
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
6
|
+
var utils$1 = require('@react-stately/utils');
|
|
7
|
+
var reactAriaComponents = require('react-aria-components');
|
|
8
|
+
var ouiTheme = require('@opengovsg/oui-theme');
|
|
9
|
+
var utils = require('../system/utils.cjs');
|
|
10
|
+
var context = require('./context.cjs');
|
|
11
|
+
|
|
12
|
+
const SidebarRoot = ({
|
|
13
|
+
className,
|
|
14
|
+
classNames,
|
|
15
|
+
defaultCollapsed,
|
|
16
|
+
onCollapsedChange,
|
|
17
|
+
tooltipProps,
|
|
18
|
+
tooltipTriggerProps,
|
|
19
|
+
...originalProps
|
|
20
|
+
}) => {
|
|
21
|
+
const [props, variantProps] = utils.mapPropsVariants(
|
|
22
|
+
originalProps,
|
|
23
|
+
ouiTheme.sidebarStyles.variantKeys
|
|
24
|
+
);
|
|
25
|
+
const [isCollapsed, setCollapsed] = utils$1.useControlledState(
|
|
26
|
+
variantProps.isCollapsed,
|
|
27
|
+
defaultCollapsed ?? false,
|
|
28
|
+
onCollapsedChange
|
|
29
|
+
);
|
|
30
|
+
const slots = ouiTheme.sidebarStyles({ ...variantProps, isCollapsed });
|
|
31
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
32
|
+
reactAriaComponents.Provider,
|
|
33
|
+
{
|
|
34
|
+
values: [
|
|
35
|
+
[context.SidebarStyleContext, { slots, classNames }],
|
|
36
|
+
[
|
|
37
|
+
context.SidebarCollapseContext,
|
|
38
|
+
{ isCollapsed, setCollapsed, tooltipProps, tooltipTriggerProps }
|
|
39
|
+
]
|
|
40
|
+
],
|
|
41
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
42
|
+
"nav",
|
|
43
|
+
{
|
|
44
|
+
"data-collapsed": ouiTheme.dataAttr(isCollapsed),
|
|
45
|
+
className: slots.base({
|
|
46
|
+
className: className ?? classNames?.base
|
|
47
|
+
}),
|
|
48
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
49
|
+
"ul",
|
|
50
|
+
{
|
|
51
|
+
className: slots.ul({
|
|
52
|
+
className: classNames?.ul
|
|
53
|
+
}),
|
|
54
|
+
...props
|
|
55
|
+
}
|
|
56
|
+
)
|
|
57
|
+
}
|
|
58
|
+
)
|
|
59
|
+
}
|
|
60
|
+
);
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
exports.SidebarRoot = SidebarRoot;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
"use client";
|
|
3
|
+
'use strict';
|
|
4
|
+
|
|
5
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
6
|
+
var $670gB$react = require('react');
|
|
7
|
+
var sidebarHeader = require('./sidebar-header.cjs');
|
|
8
|
+
var sidebarItem = require('./sidebar-item.cjs');
|
|
9
|
+
var sidebarList = require('./sidebar-list.cjs');
|
|
10
|
+
var sidebarRoot = require('./sidebar-root.cjs');
|
|
11
|
+
var utils = require('./utils.cjs');
|
|
12
|
+
|
|
13
|
+
const generateSidebarItems = (items) => {
|
|
14
|
+
return items.map((item, index) => {
|
|
15
|
+
if (utils.isNestableItem(item)) {
|
|
16
|
+
const { label, subItems, ...rest } = item;
|
|
17
|
+
return /* @__PURE__ */ jsxRuntime.jsx(sidebarList.SidebarList, { label, ...rest, children: generateSidebarItems(subItems) }, index);
|
|
18
|
+
}
|
|
19
|
+
if (utils.isHeaderItem(item)) {
|
|
20
|
+
return /* @__PURE__ */ jsxRuntime.jsx(sidebarHeader.SidebarHeader, { ...item }, index);
|
|
21
|
+
}
|
|
22
|
+
return /* @__PURE__ */ jsxRuntime.jsx(sidebarItem.SidebarItem, { ...item }, index);
|
|
23
|
+
});
|
|
24
|
+
};
|
|
25
|
+
const Sidebar = ({ items, ...props }) => {
|
|
26
|
+
const sidebarItems = $670gB$react.useMemo(() => generateSidebarItems(items), [items]);
|
|
27
|
+
return /* @__PURE__ */ jsxRuntime.jsx(sidebarRoot.SidebarRoot, { ...props, children: sidebarItems });
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
exports.Sidebar = Sidebar;
|
|
31
|
+
exports.generateSidebarItems = generateSidebarItems;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
const isNestableItem = (item) => {
|
|
5
|
+
return "subItems" in item;
|
|
6
|
+
};
|
|
7
|
+
const isHeaderItem = (item) => {
|
|
8
|
+
return "type" in item && item.type === "header";
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
exports.isHeaderItem = isHeaderItem;
|
|
12
|
+
exports.isNestableItem = isNestableItem;
|
|
@@ -6,7 +6,6 @@ var jsxRuntime = require('react/jsx-runtime');
|
|
|
6
6
|
var $670gB$react = require('react');
|
|
7
7
|
var reactAriaComponents = require('react-aria-components');
|
|
8
8
|
var ouiTheme = require('@opengovsg/oui-theme');
|
|
9
|
-
var field = require('../field/field.cjs');
|
|
10
9
|
var input = require('../input/input.cjs');
|
|
11
10
|
var popover = require('../popover/popover.cjs');
|
|
12
11
|
var tagFieldItem = require('./tag-field-item.cjs');
|
|
@@ -15,6 +14,7 @@ var tagFieldRoot = require('./tag-field-root.cjs');
|
|
|
15
14
|
var tagFieldTagList = require('./tag-field-tag-list.cjs');
|
|
16
15
|
var tagFieldTrigger = require('./tag-field-trigger.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 field = require('../field/field.cjs');
|
|
18
18
|
|
|
19
19
|
function TagField({
|
|
20
20
|
classNames,
|
|
@@ -5,8 +5,8 @@
|
|
|
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 field = require('../field/field.cjs');
|
|
9
8
|
var textArea = require('../text-area/text-area.cjs');
|
|
9
|
+
var field = require('../field/field.cjs');
|
|
10
10
|
|
|
11
11
|
function TextAreaField({
|
|
12
12
|
label,
|
|
@@ -5,8 +5,8 @@
|
|
|
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 field = require('../field/field.cjs');
|
|
9
8
|
var input = require('../input/input.cjs');
|
|
9
|
+
var field = require('../field/field.cjs');
|
|
10
10
|
|
|
11
11
|
function TextField({
|
|
12
12
|
label,
|
|
@@ -5,9 +5,9 @@ var jsxRuntime = require('react/jsx-runtime');
|
|
|
5
5
|
var $670gB$react = require('react');
|
|
6
6
|
var reactAriaComponents = require('react-aria-components');
|
|
7
7
|
var ouiTheme = require('@opengovsg/oui-theme');
|
|
8
|
-
var dateField = require('../date-field/date-field.cjs');
|
|
9
|
-
var field = require('../field/field.cjs');
|
|
10
8
|
var utils = require('../system/utils.cjs');
|
|
9
|
+
var field = require('../field/field.cjs');
|
|
10
|
+
var dateField = require('../date-field/date-field.cjs');
|
|
11
11
|
|
|
12
12
|
function TimeField(originalProps) {
|
|
13
13
|
const [
|
|
@@ -0,0 +1,54 @@
|
|
|
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 utils = require('../system/utils.cjs');
|
|
9
|
+
|
|
10
|
+
function Tooltip(originalProps) {
|
|
11
|
+
const [{ children, showArrow = true, classNames, ...props }, variantProps] = utils.mapPropsVariants(originalProps, ouiTheme.tooltipStyles.variantKeys);
|
|
12
|
+
const styles = ouiTheme.tooltipStyles(variantProps);
|
|
13
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
14
|
+
reactAriaComponents.Tooltip,
|
|
15
|
+
{
|
|
16
|
+
isEntering: variantProps.isEntering,
|
|
17
|
+
isExiting: variantProps.isExiting,
|
|
18
|
+
offset: 10,
|
|
19
|
+
...props,
|
|
20
|
+
className: ouiTheme.composeRenderProps(
|
|
21
|
+
props.className ?? classNames?.base,
|
|
22
|
+
(className, renderProps) => styles.base({
|
|
23
|
+
...renderProps,
|
|
24
|
+
className
|
|
25
|
+
})
|
|
26
|
+
),
|
|
27
|
+
children: (renderProps) => /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
28
|
+
showArrow && /* @__PURE__ */ jsxRuntime.jsx(reactAriaComponents.OverlayArrow, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
29
|
+
"svg",
|
|
30
|
+
{
|
|
31
|
+
width: 8,
|
|
32
|
+
height: 8,
|
|
33
|
+
viewBox: "0 0 8 8",
|
|
34
|
+
className: ouiTheme.composeRenderProps(
|
|
35
|
+
classNames?.arrow,
|
|
36
|
+
(className, renderProps2) => styles.arrow({
|
|
37
|
+
className,
|
|
38
|
+
...renderProps2
|
|
39
|
+
})
|
|
40
|
+
)(renderProps),
|
|
41
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M0 0 L4 4 L8 0" })
|
|
42
|
+
}
|
|
43
|
+
) }),
|
|
44
|
+
children
|
|
45
|
+
] })
|
|
46
|
+
}
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
function TooltipTrigger(props) {
|
|
50
|
+
return /* @__PURE__ */ jsxRuntime.jsx(reactAriaComponents.TooltipTrigger, { delay: 300, ...props });
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
exports.Tooltip = Tooltip;
|
|
54
|
+
exports.TooltipTrigger = TooltipTrigger;
|
|
@@ -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,11 +3,11 @@
|
|
|
3
3
|
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
|
-
import { Label, Description, FieldError } from '../field/field.js';
|
|
7
6
|
import { mapPropsVariants } from '../system/utils.js';
|
|
8
7
|
import { useCheckboxGroupStyleContext, CheckboxGroupStyleContext } from './checkbox-group-style-context.js';
|
|
9
8
|
import Minus from '../node_modules/.pnpm/lucide-react@0.475.0_react@19.2.3/node_modules/lucide-react/dist/esm/icons/minus.js';
|
|
10
9
|
import Check from '../node_modules/.pnpm/lucide-react@0.475.0_react@19.2.3/node_modules/lucide-react/dist/esm/icons/check.js';
|
|
10
|
+
import { Label, Description, FieldError } from '../field/field.js';
|
|
11
11
|
|
|
12
12
|
const Checkbox = ({
|
|
13
13
|
classNames,
|
|
@@ -5,11 +5,11 @@ 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
7
|
import { listBoxItemStyles, cn, comboBoxStyles, composeTailwindRenderProps, composeRenderProps, comboBoxClearButtonStyles } from '@opengovsg/oui-theme';
|
|
8
|
-
import { Label, FieldGroup, Description, FieldError } from '../field/field.js';
|
|
9
8
|
import { Popover } from '../popover/popover.js';
|
|
10
9
|
import { mapPropsVariants } from '../system/utils.js';
|
|
11
10
|
import { ComboBoxVariantContext } from './combo-box-variant-context.js';
|
|
12
11
|
import { i18nStrings } from './i18n.js';
|
|
12
|
+
import { Label, FieldGroup, Description, FieldError } from '../field/field.js';
|
|
13
13
|
import ChevronUp from '../node_modules/.pnpm/lucide-react@0.475.0_react@19.2.3/node_modules/lucide-react/dist/esm/icons/chevron-up.js';
|
|
14
14
|
import ChevronDown from '../node_modules/.pnpm/lucide-react@0.475.0_react@19.2.3/node_modules/lucide-react/dist/esm/icons/chevron-down.js';
|
|
15
15
|
import X from '../node_modules/.pnpm/lucide-react@0.475.0_react@19.2.3/node_modules/lucide-react/dist/esm/icons/x.js';
|
|
@@ -4,8 +4,8 @@ import { jsxs, jsx } from 'react/jsx-runtime';
|
|
|
4
4
|
import { useMemo } from 'react';
|
|
5
5
|
import { DateField as DateField$1, DateInput as DateInput$1, DateSegment } from 'react-aria-components';
|
|
6
6
|
import { dateInputStyles, composeTailwindRenderProps, composeRenderProps, dateSegmentStyles } from '@opengovsg/oui-theme';
|
|
7
|
-
import { Label, Description, FieldError } from '../field/field.js';
|
|
8
7
|
import { mapPropsVariants } from '../system/utils.js';
|
|
8
|
+
import { Label, Description, FieldError } from '../field/field.js';
|
|
9
9
|
|
|
10
10
|
function DateField(originalProps) {
|
|
11
11
|
const [
|
|
@@ -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
|
-
import { DateInput } from '../date-field/date-field.js';
|
|
11
|
-
import { Label, FieldGroup, Description, FieldError } from '../field/field.js';
|
|
12
7
|
import { Popover } from '../popover/popover.js';
|
|
13
8
|
import { mapPropsVariants } from '../system/utils.js';
|
|
9
|
+
import { DateInput } from '../date-field/date-field.js';
|
|
14
10
|
import Calendar from '../node_modules/.pnpm/lucide-react@0.475.0_react@19.2.3/node_modules/lucide-react/dist/esm/icons/calendar.js';
|
|
11
|
+
import { Calendar as Calendar$1 } from '../calendar/calendar.js';
|
|
12
|
+
import { Label, FieldGroup, Description, FieldError } from '../field/field.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
|
-
import { DateInput } from '../date-field/date-field.js';
|
|
10
|
-
import { Label, FieldGroup, Description, FieldError } from '../field/field.js';
|
|
11
8
|
import { Popover } from '../popover/popover.js';
|
|
12
9
|
import { RangeCalendar } from '../range-calendar/range-calendar.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 { Label, FieldGroup, Description, FieldError } from '../field/field.js';
|
|
13
|
+
import { DateInput } from '../date-field/date-field.js';
|
|
14
|
+
import { Button } from '../button/button.js';
|
|
15
15
|
|
|
16
16
|
function DateRangePicker(originalProps) {
|
|
17
17
|
const [
|
|
@@ -7,13 +7,13 @@ import { useField, useId } from 'react-aria';
|
|
|
7
7
|
import { Provider, LabelContext, GroupContext, TextContext, FieldErrorContext, Group } from 'react-aria-components';
|
|
8
8
|
import { useDropzone } from 'react-dropzone';
|
|
9
9
|
import { fileDropzoneStyles, dataAttr } from '@opengovsg/oui-theme';
|
|
10
|
-
import { Label, Description, FieldError } from '../field/field.js';
|
|
11
|
-
import { useControllableState } from '../hooks/use-controllable-state.js';
|
|
12
10
|
import { mapPropsVariants } from '../system/utils.js';
|
|
13
11
|
import { FileDropzoneStyleContext, FileDropzoneStateContext, useFileDropzoneStateContext, useFileDropzoneStyleContext } from './contexts.js';
|
|
14
12
|
import { FileInfo } from './file-info.js';
|
|
15
13
|
import { formatErrorMessage, formatBytes } from './utils.js';
|
|
14
|
+
import { useControllableState } from '../hooks/use-controllable-state.js';
|
|
16
15
|
import Upload from '../node_modules/.pnpm/lucide-react@0.475.0_react@19.2.3/node_modules/lucide-react/dist/esm/icons/upload.js';
|
|
16
|
+
import { Label, Description, FieldError } from '../field/field.js';
|
|
17
17
|
|
|
18
18
|
const FileDropzone = (originalProps) => {
|
|
19
19
|
const [props, variantProps] = mapPropsVariants(
|
|
@@ -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,8 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
export { useControllableState } from './hooks/use-controllable-state.js';
|
|
3
|
-
export { useDraggable } from './hooks/use-draggable.js';
|
|
4
|
-
export { Button } from './button/button.js';
|
|
5
|
-
export { GovtBanner } from './govt-banner/govt-banner.js';
|
|
6
2
|
export { Ripple } from './ripple/ripple.js';
|
|
7
3
|
export { useRipple } from './ripple/use-ripple.js';
|
|
8
4
|
export { Spinner } from './spinner/spinner.js';
|
|
@@ -11,41 +7,22 @@ export { Toggle } from './toggle/toggle.js';
|
|
|
11
7
|
export { SkipNavLink } from './skip-nav-link/skip-nav-link.js';
|
|
12
8
|
export { Input } from './input/input.js';
|
|
13
9
|
export { TextField } from './text-field/text-field.js';
|
|
14
|
-
export { Description, FieldError, FieldErrorIcon, FieldGroup, Label } from './field/field.js';
|
|
15
10
|
export { TextArea } from './text-area/text-area.js';
|
|
16
11
|
export { TextAreaField } from './text-area-field/text-area-field.js';
|
|
17
|
-
export { ComboBox, ComboBoxEmptyState } from './combo-box/combo-box.js';
|
|
18
|
-
export { ComboBoxFuzzy } from './combo-box/combo-box-fuzzy.js';
|
|
19
|
-
export { ComboBoxItem } from './combo-box/combo-box-item.js';
|
|
20
|
-
export { ComboBoxVariantContext, useComboBoxVariantContext } from './combo-box/combo-box-variant-context.js';
|
|
21
|
-
export { Banner } from './banner/banner.js';
|
|
22
12
|
export { TagField } from './tag-field/tag-field.js';
|
|
23
13
|
export { TagFieldItem } from './tag-field/tag-field-item.js';
|
|
24
14
|
export { Select } from './select/select.js';
|
|
25
15
|
export { SelectItem } from './select/select-item.js';
|
|
26
16
|
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
17
|
export { RangeCalendar, RangeCalendarCell, RangeCalendarStateWrapper } from './range-calendar/range-calendar.js';
|
|
33
18
|
export { Menu, MenuItem, MenuSection, MenuSeparator, MenuTrigger, MenuVariantContext, SubmenuTrigger, useMenuVariantContext } from './menu/menu.js';
|
|
34
19
|
export { Popover } from './popover/popover.js';
|
|
35
20
|
export { Tab, TabList, TabPanel, Tabs, TabsVariantContext, useTabsVariantContext } from './tabs/tabs.js';
|
|
36
|
-
export { DateField, DateInput } from './date-field/date-field.js';
|
|
37
|
-
export { DatePicker } from './date-picker/date-picker.js';
|
|
38
|
-
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
21
|
export { Pagination } from './pagination/pagination.js';
|
|
42
22
|
export { PaginationCursor } from './pagination/pagination-cursor.js';
|
|
43
23
|
export { PaginationItem } from './pagination/pagination-item.js';
|
|
44
24
|
export { PaginationItemType } from './pagination/hooks/use-pagination.js';
|
|
45
25
|
export { CURSOR_TRANSITION_TIMEOUT, usePagination } from './pagination/use-pagination.js';
|
|
46
|
-
export { FileDropzone } from './file-dropzone/file-dropzone.js';
|
|
47
|
-
export { FileInfo } from './file-dropzone/file-info.js';
|
|
48
|
-
export { formatBytes, formatErrorMessage } from './file-dropzone/utils.js';
|
|
49
26
|
export { NumberField } from './number-field/number-field.js';
|
|
50
27
|
export { Modal } from './modal/modal.js';
|
|
51
28
|
export { ModalContent } from './modal/modal-content.js';
|
|
@@ -64,13 +41,42 @@ export { NavbarItem } from './navbar/navbar-item.js';
|
|
|
64
41
|
export { useNavbar } from './navbar/use-navbar.js';
|
|
65
42
|
export { NavbarProvider, useNavbarContext } from './navbar/navbar-context.js';
|
|
66
43
|
export { Avatar } from './avatar/index.js';
|
|
67
|
-
export { Accordion, AccordionContent, AccordionHeader, AccordionItem, AccordionStyleContext, useAccordionStyleContext } from './accordion/accordion.js';
|
|
68
44
|
export { TimeField } from './time-field/time-field.js';
|
|
69
45
|
export { SearchField } from './search-field/search-field.js';
|
|
70
46
|
export { Link } from './link/link.js';
|
|
71
|
-
export {
|
|
47
|
+
export { Sidebar, generateSidebarItems } from './sidebar/sidebar.js';
|
|
48
|
+
export { SidebarRoot } from './sidebar/sidebar-root.js';
|
|
49
|
+
export { SidebarItem } from './sidebar/sidebar-item.js';
|
|
50
|
+
export { SidebarList } from './sidebar/sidebar-list.js';
|
|
51
|
+
export { SidebarHeader } from './sidebar/sidebar-header.js';
|
|
52
|
+
export { Tooltip, TooltipTrigger } from './tooltip/tooltip.js';
|
|
53
|
+
export { useControllableState } from './hooks/use-controllable-state.js';
|
|
54
|
+
export { useDraggable } from './hooks/use-draggable.js';
|
|
55
|
+
export { Button } from './button/button.js';
|
|
56
|
+
export { GovtBanner } from './govt-banner/govt-banner.js';
|
|
57
|
+
export { Description, FieldError, FieldErrorIcon, FieldGroup, Label } from './field/field.js';
|
|
58
|
+
export { ComboBox, ComboBoxEmptyState } from './combo-box/combo-box.js';
|
|
59
|
+
export { ComboBoxFuzzy } from './combo-box/combo-box-fuzzy.js';
|
|
60
|
+
export { ComboBoxItem } from './combo-box/combo-box-item.js';
|
|
61
|
+
export { ComboBoxVariantContext, useComboBoxVariantContext } from './combo-box/combo-box-variant-context.js';
|
|
62
|
+
export { Banner } from './banner/banner.js';
|
|
63
|
+
export { Badge } from './badge/badge.js';
|
|
64
|
+
export { CalendarDate } from '@internationalized/date';
|
|
65
|
+
export { Calendar, CalendarStateWrapper } from './calendar/calendar.js';
|
|
66
|
+
export { CalendarStyleContext, useCalendarStyleContext } from './calendar/calendar-style-context.js';
|
|
67
|
+
export { getEraFormat, useGenerateLocalizedMonths, useGenerateLocalizedYears, useLocalizedMonthYear } from './calendar/utils.js';
|
|
68
|
+
export { DateField, DateInput } from './date-field/date-field.js';
|
|
69
|
+
export { DatePicker } from './date-picker/date-picker.js';
|
|
70
|
+
export { DateRangePicker } from './date-range-picker/date-range-picker.js';
|
|
71
|
+
export { Checkbox, CheckboxGroup } from './checkbox/checkbox.js';
|
|
72
|
+
export { CheckboxGroupStyleContext, useCheckboxGroupStyleContext } from './checkbox/checkbox-group-style-context.js';
|
|
73
|
+
export { FileDropzone } from './file-dropzone/file-dropzone.js';
|
|
74
|
+
export { FileInfo } from './file-dropzone/file-info.js';
|
|
75
|
+
export { formatBytes, formatErrorMessage } from './file-dropzone/utils.js';
|
|
72
76
|
export { toast } from 'sonner';
|
|
73
77
|
export { AvatarContext, useAvatarContext } from './avatar/avatar-context.js';
|
|
74
78
|
export { AvatarGroup } from './avatar/avatar-group.js';
|
|
75
79
|
export { AvatarGroupProvider, useAvatarGroup } from './avatar/avatar-group-context.js';
|
|
76
80
|
export { AvatarFallback, AvatarImage, AvatarRoot } from './avatar/avatar.js';
|
|
81
|
+
export { Accordion, AccordionContent, AccordionHeader, AccordionItem, AccordionStyleContext, useAccordionStyleContext } from './accordion/accordion.js';
|
|
82
|
+
export { Breadcrumb, Breadcrumbs } from './breadcrumbs/breadcrumbs.js';
|