@opengovsg/oui 0.0.32 → 0.0.33
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/accordion/accordion.cjs +189 -0
- package/dist/cjs/accordion/index.cjs +13 -0
- package/dist/cjs/banner/banner.cjs +1 -1
- package/dist/cjs/button/button.cjs +13 -10
- package/dist/cjs/calendar/calendar-month-day-selector.cjs +2 -2
- package/dist/cjs/checkbox/checkbox.cjs +1 -1
- package/dist/cjs/combo-box/combo-box.cjs +2 -2
- package/dist/cjs/date-field/date-field.cjs +1 -1
- package/dist/cjs/date-picker/date-picker.cjs +5 -4
- package/dist/cjs/date-range-picker/date-range-picker.cjs +5 -5
- 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 +21 -14
- package/dist/cjs/menu/menu.cjs +1 -1
- package/dist/cjs/modal/modal-content.cjs +1 -1
- package/dist/cjs/number-field/number-field.cjs +3 -3
- package/dist/cjs/range-calendar/range-calendar.cjs +1 -1
- package/dist/cjs/select/select.cjs +3 -3
- package/dist/cjs/system/react-utils/children.cjs +7 -0
- package/dist/cjs/tag-field/tag-field.cjs +3 -3
- 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/toast/toast.cjs +1 -1
- package/dist/esm/accordion/accordion.js +182 -0
- package/dist/esm/accordion/index.js +2 -0
- package/dist/esm/banner/banner.js +1 -1
- package/dist/esm/button/button.js +13 -10
- package/dist/esm/calendar/calendar-month-day-selector.js +2 -2
- package/dist/esm/checkbox/checkbox.js +1 -1
- package/dist/esm/combo-box/combo-box.js +2 -2
- package/dist/esm/date-field/date-field.js +1 -1
- package/dist/esm/date-picker/date-picker.js +5 -4
- package/dist/esm/date-range-picker/date-range-picker.js +5 -5
- 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 +5 -4
- package/dist/esm/menu/menu.js +1 -1
- package/dist/esm/modal/modal-content.js +1 -1
- package/dist/esm/number-field/number-field.js +3 -3
- package/dist/esm/range-calendar/range-calendar.js +1 -1
- package/dist/esm/select/select.js +3 -3
- package/dist/esm/system/react-utils/children.js +7 -1
- package/dist/esm/tag-field/tag-field.js +3 -3
- 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/toast/toast.js +1 -1
- package/dist/types/accordion/accordion.d.ts +50 -0
- package/dist/types/accordion/accordion.d.ts.map +1 -0
- package/dist/types/accordion/index.d.ts +2 -0
- package/dist/types/accordion/index.d.ts.map +1 -0
- package/dist/types/button/button.d.ts +12 -6
- package/dist/types/button/button.d.ts.map +1 -1
- package/dist/types/index.d.mts +1 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/system/react-utils/children.d.ts +3 -0
- package/dist/types/system/react-utils/children.d.ts.map +1 -1
- package/package.json +3 -3
package/dist/cjs/toast/toast.cjs
CHANGED
|
@@ -5,9 +5,9 @@
|
|
|
5
5
|
var jsxRuntime = require('react/jsx-runtime');
|
|
6
6
|
var sonner = require('sonner');
|
|
7
7
|
var ouiTheme = require('@opengovsg/oui-theme');
|
|
8
|
+
var spinner = require('../spinner/spinner.cjs');
|
|
8
9
|
var utils = require('../system/utils.cjs');
|
|
9
10
|
var x = require('../node_modules/.pnpm/lucide-react@0.475.0_react@19.2.3/node_modules/lucide-react/dist/esm/icons/x.cjs');
|
|
10
|
-
var spinner = require('../spinner/spinner.cjs');
|
|
11
11
|
|
|
12
12
|
function Toaster(originalProps) {
|
|
13
13
|
const [{ toastOptions, closeButton = true, ...props }, variantProps] = utils.mapPropsVariants(originalProps, ouiTheme.toastStyles.variantKeys);
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
"use client";
|
|
3
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
4
|
+
import { useContext } from 'react';
|
|
5
|
+
import { Disclosure, composeRenderProps, DisclosureGroup, DisclosureStateContext, Heading, Button, DisclosurePanel } from 'react-aria-components';
|
|
6
|
+
import { cn, accordionStyles, composeTailwindRenderProps } from '@opengovsg/oui-theme';
|
|
7
|
+
import { renderChildren } from '../system/react-utils/children.js';
|
|
8
|
+
import { forwardRef, mapPropsVariants } from '../system/utils.js';
|
|
9
|
+
import { createContext } from '../system/react-utils/context.js';
|
|
10
|
+
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';
|
|
11
|
+
|
|
12
|
+
const [AccordionStyleContext, useAccordionStyleContext] = createContext({
|
|
13
|
+
name: "AccordionStyleContext",
|
|
14
|
+
strict: true
|
|
15
|
+
});
|
|
16
|
+
const AccordionItem = forwardRef(
|
|
17
|
+
({ classNames, className, children, ...props }, ref) => {
|
|
18
|
+
const { slots } = useContext(AccordionStyleContext);
|
|
19
|
+
return /* @__PURE__ */ jsx(
|
|
20
|
+
Disclosure,
|
|
21
|
+
{
|
|
22
|
+
...props,
|
|
23
|
+
ref,
|
|
24
|
+
className: composeRenderProps(
|
|
25
|
+
className,
|
|
26
|
+
(className2, renderProps) => slots.item({
|
|
27
|
+
...renderProps,
|
|
28
|
+
className: cn(classNames?.item, className2)
|
|
29
|
+
})
|
|
30
|
+
),
|
|
31
|
+
children
|
|
32
|
+
}
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
);
|
|
36
|
+
AccordionItem.displayName = "AccordionItem";
|
|
37
|
+
function AccordionHeader({
|
|
38
|
+
children,
|
|
39
|
+
classNames,
|
|
40
|
+
indicator,
|
|
41
|
+
startContent,
|
|
42
|
+
endContent,
|
|
43
|
+
hideIndicator = false
|
|
44
|
+
}) {
|
|
45
|
+
const { slots, classNames: contextClassNames } = useContext(
|
|
46
|
+
AccordionStyleContext
|
|
47
|
+
);
|
|
48
|
+
const { isExpanded } = useContext(DisclosureStateContext);
|
|
49
|
+
return /* @__PURE__ */ jsx(
|
|
50
|
+
Heading,
|
|
51
|
+
{
|
|
52
|
+
className: slots.heading({
|
|
53
|
+
className: cn(contextClassNames?.heading, classNames?.heading)
|
|
54
|
+
}),
|
|
55
|
+
children: /* @__PURE__ */ jsx(
|
|
56
|
+
Button,
|
|
57
|
+
{
|
|
58
|
+
slot: "trigger",
|
|
59
|
+
className: slots.trigger({
|
|
60
|
+
className: cn(contextClassNames?.trigger, classNames?.trigger)
|
|
61
|
+
}),
|
|
62
|
+
children: (buttonRenderProps) => {
|
|
63
|
+
const headerRenderProps = { ...buttonRenderProps, isExpanded };
|
|
64
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
65
|
+
startContent && /* @__PURE__ */ jsx(
|
|
66
|
+
"div",
|
|
67
|
+
{
|
|
68
|
+
className: slots.startContentWrapper({
|
|
69
|
+
className: cn(
|
|
70
|
+
contextClassNames?.startContentWrapper,
|
|
71
|
+
classNames?.startContentWrapper
|
|
72
|
+
)
|
|
73
|
+
}),
|
|
74
|
+
children: renderChildren(headerRenderProps, startContent)
|
|
75
|
+
}
|
|
76
|
+
),
|
|
77
|
+
/* @__PURE__ */ jsx(
|
|
78
|
+
"span",
|
|
79
|
+
{
|
|
80
|
+
className: slots.title({
|
|
81
|
+
className: cn(contextClassNames?.title, classNames?.title)
|
|
82
|
+
}),
|
|
83
|
+
children: renderChildren(headerRenderProps, children)
|
|
84
|
+
}
|
|
85
|
+
),
|
|
86
|
+
!hideIndicator && /* @__PURE__ */ jsx(
|
|
87
|
+
"span",
|
|
88
|
+
{
|
|
89
|
+
"aria-hidden": true,
|
|
90
|
+
className: slots.indicator({
|
|
91
|
+
className: cn(
|
|
92
|
+
contextClassNames?.indicator,
|
|
93
|
+
classNames?.indicator
|
|
94
|
+
)
|
|
95
|
+
}),
|
|
96
|
+
children: renderChildren(
|
|
97
|
+
headerRenderProps,
|
|
98
|
+
indicator ?? /* @__PURE__ */ jsx(ChevronDown, {})
|
|
99
|
+
)
|
|
100
|
+
}
|
|
101
|
+
),
|
|
102
|
+
startContent && /* @__PURE__ */ jsx(
|
|
103
|
+
"div",
|
|
104
|
+
{
|
|
105
|
+
className: slots.endContentWrapper({
|
|
106
|
+
className: cn(
|
|
107
|
+
contextClassNames?.endContentWrapper,
|
|
108
|
+
classNames?.endContentWrapper
|
|
109
|
+
)
|
|
110
|
+
}),
|
|
111
|
+
children: renderChildren(headerRenderProps, endContent)
|
|
112
|
+
}
|
|
113
|
+
),
|
|
114
|
+
renderChildren(headerRenderProps, endContent)
|
|
115
|
+
] });
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
)
|
|
119
|
+
}
|
|
120
|
+
);
|
|
121
|
+
}
|
|
122
|
+
function AccordionContent({
|
|
123
|
+
children,
|
|
124
|
+
classNames,
|
|
125
|
+
...props
|
|
126
|
+
}) {
|
|
127
|
+
const { slots, classNames: contextClassNames } = useContext(
|
|
128
|
+
AccordionStyleContext
|
|
129
|
+
);
|
|
130
|
+
return /* @__PURE__ */ jsx(
|
|
131
|
+
DisclosurePanel,
|
|
132
|
+
{
|
|
133
|
+
...props,
|
|
134
|
+
className: composeTailwindRenderProps(
|
|
135
|
+
props.className,
|
|
136
|
+
slots.panel({
|
|
137
|
+
className: cn(contextClassNames?.panel, classNames?.panel)
|
|
138
|
+
})
|
|
139
|
+
),
|
|
140
|
+
children: /* @__PURE__ */ jsx(
|
|
141
|
+
"div",
|
|
142
|
+
{
|
|
143
|
+
className: slots.content({
|
|
144
|
+
className: cn(contextClassNames?.content, classNames?.content)
|
|
145
|
+
}),
|
|
146
|
+
children
|
|
147
|
+
}
|
|
148
|
+
)
|
|
149
|
+
}
|
|
150
|
+
);
|
|
151
|
+
}
|
|
152
|
+
const Accordion = forwardRef(
|
|
153
|
+
(originalProps, ref) => {
|
|
154
|
+
const [
|
|
155
|
+
{ classNames, className, ...props },
|
|
156
|
+
{ size = "md", ...variantProps }
|
|
157
|
+
] = mapPropsVariants(originalProps, accordionStyles.variantKeys);
|
|
158
|
+
const slots = accordionStyles({ size, ...variantProps });
|
|
159
|
+
return /* @__PURE__ */ jsx(
|
|
160
|
+
AccordionStyleContext.Provider,
|
|
161
|
+
{
|
|
162
|
+
value: {
|
|
163
|
+
slots,
|
|
164
|
+
classNames
|
|
165
|
+
},
|
|
166
|
+
children: /* @__PURE__ */ jsx(
|
|
167
|
+
DisclosureGroup,
|
|
168
|
+
{
|
|
169
|
+
className: slots.base({
|
|
170
|
+
className: cn(classNames?.base, className)
|
|
171
|
+
}),
|
|
172
|
+
...props,
|
|
173
|
+
ref
|
|
174
|
+
}
|
|
175
|
+
)
|
|
176
|
+
}
|
|
177
|
+
);
|
|
178
|
+
}
|
|
179
|
+
);
|
|
180
|
+
Accordion.displayName = "Accordion";
|
|
181
|
+
|
|
182
|
+
export { Accordion, AccordionContent, AccordionHeader, AccordionItem, AccordionStyleContext, useAccordionStyleContext };
|
|
@@ -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.2.3/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.2.3/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.2.3/node_modules/lucide-react/dist/esm/icons/x.js';
|
|
12
12
|
|
|
13
13
|
const i18nStrings = {
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
"use client";
|
|
3
|
-
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
3
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
4
4
|
import { forwardRef, useMemo } from 'react';
|
|
5
5
|
import { chain } from '@react-aria/utils';
|
|
6
6
|
import { Button as Button$1, composeRenderProps } from 'react-aria-components';
|
|
7
7
|
import { buttonStyles } from '@opengovsg/oui-theme';
|
|
8
|
+
import { Ripple } from '../ripple/ripple.js';
|
|
8
9
|
import { useRipple } from '../ripple/use-ripple.js';
|
|
9
10
|
import { Spinner } from '../spinner/spinner.js';
|
|
10
|
-
import {
|
|
11
|
+
import { renderChildren } from '../system/react-utils/children.js';
|
|
11
12
|
|
|
12
13
|
const Button = forwardRef(
|
|
13
14
|
({
|
|
@@ -21,6 +22,7 @@ const Button = forwardRef(
|
|
|
21
22
|
size = "md",
|
|
22
23
|
spinnerPlacement = "start",
|
|
23
24
|
loadingText,
|
|
25
|
+
pendingElement,
|
|
24
26
|
onPress,
|
|
25
27
|
children,
|
|
26
28
|
disableRipple,
|
|
@@ -47,7 +49,7 @@ const Button = forwardRef(
|
|
|
47
49
|
const spinnerSize = buttonSpinnerSizeMap[size];
|
|
48
50
|
return /* @__PURE__ */ jsx(Spinner, { size: spinnerSize });
|
|
49
51
|
}, [size, spinnerProp]);
|
|
50
|
-
return /* @__PURE__ */
|
|
52
|
+
return /* @__PURE__ */ jsx(
|
|
51
53
|
Button$1,
|
|
52
54
|
{
|
|
53
55
|
...props,
|
|
@@ -68,15 +70,16 @@ const Button = forwardRef(
|
|
|
68
70
|
isPending,
|
|
69
71
|
onPress: chain(onPress, onPressRipple),
|
|
70
72
|
ref,
|
|
71
|
-
children: [
|
|
72
|
-
startContent,
|
|
73
|
-
isPending && spinnerPlacement === "start" ? spinner : null,
|
|
74
|
-
isPending ? null : children,
|
|
73
|
+
children: (renderProps) => /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
74
|
+
renderChildren(renderProps, startContent),
|
|
75
|
+
isPending && spinnerPlacement === "start" ? renderChildren(renderProps, spinner) : null,
|
|
76
|
+
isPending ? null : renderChildren(renderProps, children),
|
|
75
77
|
isPending && loadingText ? loadingText : null,
|
|
76
|
-
isPending &&
|
|
77
|
-
|
|
78
|
+
isPending && pendingElement ? renderChildren(renderProps, pendingElement) : null,
|
|
79
|
+
isPending && spinnerPlacement === "end" ? renderChildren(renderProps, spinner) : null,
|
|
80
|
+
renderChildren(renderProps, endContent),
|
|
78
81
|
!disableRipple && /* @__PURE__ */ jsx(Ripple, { onClear: onClearRipple, ripples })
|
|
79
|
-
]
|
|
82
|
+
] })
|
|
80
83
|
}
|
|
81
84
|
);
|
|
82
85
|
}
|
|
@@ -4,11 +4,11 @@ import { jsx } from 'react/jsx-runtime';
|
|
|
4
4
|
import { useContext } from 'react';
|
|
5
5
|
import { CalendarDate } from '@internationalized/date';
|
|
6
6
|
import { Group } from 'react-aria-components';
|
|
7
|
+
import { Select } from '../select/select.js';
|
|
8
|
+
import { SelectItem } from '../select/select-item.js';
|
|
7
9
|
import { AgnosticCalendarStateContext } from './agnostic-calendar-state-context.js';
|
|
8
10
|
import { useCalendarStyleContext } from './calendar-style-context.js';
|
|
9
11
|
import { useCalendarSelectors } from './hooks/use-calendar-selectors.js';
|
|
10
|
-
import { Select } from '../select/select.js';
|
|
11
|
-
import { SelectItem } from '../select/select-item.js';
|
|
12
12
|
import { useCalendarI18n } from './hooks/use-calendar-i18n.js';
|
|
13
13
|
|
|
14
14
|
const CalendarMonthDaySelector = () => {
|
|
@@ -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';
|
|
6
7
|
import { mapPropsVariants } from '../system/utils.js';
|
|
7
8
|
import { useCheckboxGroupStyleContext, CheckboxGroupStyleContext } from './checkbox-group-style-context.js';
|
|
8
9
|
import Minus from '../node_modules/.pnpm/lucide-react@0.475.0_react@19.2.3/node_modules/lucide-react/dist/esm/icons/minus.js';
|
|
9
10
|
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,13 +5,13 @@ import { useMemo, useCallback } from 'react';
|
|
|
5
5
|
import { useMessageFormatter } 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
|
+
import { Popover } from '../popover/popover.js';
|
|
8
10
|
import { mapPropsVariants } from '../system/utils.js';
|
|
9
11
|
import { ComboBoxVariantContext } from './combo-box-variant-context.js';
|
|
10
|
-
import { Label, FieldGroup, Description, FieldError } from '../field/field.js';
|
|
11
12
|
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';
|
|
12
13
|
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';
|
|
13
14
|
import X from '../node_modules/.pnpm/lucide-react@0.475.0_react@19.2.3/node_modules/lucide-react/dist/esm/icons/x.js';
|
|
14
|
-
import { Popover } from '../popover/popover.js';
|
|
15
15
|
|
|
16
16
|
const calculateEstimatedRowHeight = (size) => {
|
|
17
17
|
switch (size) {
|
|
@@ -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 { dateFieldStyles, composeTailwindRenderProps, dateInputStyles, composeRenderProps } from '@opengovsg/oui-theme';
|
|
7
|
-
import { mapPropsVariants } from '../system/utils.js';
|
|
8
7
|
import { Label, Description, FieldError } from '../field/field.js';
|
|
8
|
+
import { mapPropsVariants } from '../system/utils.js';
|
|
9
9
|
|
|
10
10
|
function DateField(originalProps) {
|
|
11
11
|
const [
|
|
@@ -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 {
|
|
8
|
-
import { DateInput } from '../date-field/date-field.js';
|
|
9
|
-
import Calendar from '../node_modules/.pnpm/lucide-react@0.475.0_react@19.2.3/node_modules/lucide-react/dist/esm/icons/calendar.js';
|
|
7
|
+
import { Button } from '../button/button.js';
|
|
10
8
|
import { Calendar as Calendar$1 } from '../calendar/calendar.js';
|
|
9
|
+
import '@internationalized/date';
|
|
10
|
+
import { DateInput } from '../date-field/date-field.js';
|
|
11
11
|
import { Label, FieldGroup, Description, FieldError } from '../field/field.js';
|
|
12
|
-
import { Button } from '../button/button.js';
|
|
13
12
|
import { Popover } from '../popover/popover.js';
|
|
13
|
+
import { mapPropsVariants } from '../system/utils.js';
|
|
14
|
+
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
15
|
|
|
15
16
|
function DatePicker(originalProps) {
|
|
16
17
|
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 { mapPropsVariants } from '../system/utils.js';
|
|
9
|
-
import Calendar from '../node_modules/.pnpm/lucide-react@0.475.0_react@19.2.3/node_modules/lucide-react/dist/esm/icons/calendar.js';
|
|
10
|
-
import { RangeCalendar } from '../range-calendar/range-calendar.js';
|
|
11
|
-
import { Label, FieldGroup, Description, FieldError } from '../field/field.js';
|
|
12
|
-
import { DateInput } from '../date-field/date-field.js';
|
|
13
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';
|
|
14
11
|
import { Popover } from '../popover/popover.js';
|
|
12
|
+
import { RangeCalendar } from '../range-calendar/range-calendar.js';
|
|
13
|
+
import { mapPropsVariants } from '../system/utils.js';
|
|
14
|
+
import Calendar from '../node_modules/.pnpm/lucide-react@0.475.0_react@19.2.3/node_modules/lucide-react/dist/esm/icons/calendar.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';
|
|
10
12
|
import { mapPropsVariants } from '../system/utils.js';
|
|
11
13
|
import { FileDropzoneStyleContext, FileDropzoneStateContext, useFileDropzoneStateContext, useFileDropzoneStyleContext } from './contexts.js';
|
|
12
14
|
import { FileInfo } from './file-info.js';
|
|
13
15
|
import { formatErrorMessage, formatBytes } from './utils.js';
|
|
14
|
-
import { useControllableState } from '../hooks/use-controllable-state.js';
|
|
15
16
|
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';
|
|
6
7
|
import { useFileDropzoneStateContext, useFileDropzoneStyleContext } from './contexts.js';
|
|
7
8
|
import { formatBytes } from './utils.js';
|
|
8
9
|
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,5 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
export { Avatar } from './avatar/index.js';
|
|
3
2
|
export { useControllableState } from './hooks/use-controllable-state.js';
|
|
4
3
|
export { useDraggable } from './hooks/use-draggable.js';
|
|
5
4
|
export { Button } from './button/button.js';
|
|
@@ -26,10 +25,10 @@ export { Select } from './select/select.js';
|
|
|
26
25
|
export { SelectItem } from './select/select-item.js';
|
|
27
26
|
export { SelectVariantContext, useSelectVariantContext } from './select/select-variant-context.js';
|
|
28
27
|
export { Badge } from './badge/badge.js';
|
|
29
|
-
export { CalendarDate } from '@internationalized/date';
|
|
30
28
|
export { Calendar, CalendarStateWrapper } from './calendar/calendar.js';
|
|
31
29
|
export { CalendarStyleContext, useCalendarStyleContext } from './calendar/calendar-style-context.js';
|
|
32
30
|
export { getEraFormat, useGenerateLocalizedMonths, useGenerateLocalizedYears, useLocalizedMonthYear } from './calendar/utils.js';
|
|
31
|
+
export { CalendarDate } from '@internationalized/date';
|
|
33
32
|
export { RangeCalendar, RangeCalendarCell, RangeCalendarStateWrapper } from './range-calendar/range-calendar.js';
|
|
34
33
|
export { Menu, MenuItem, MenuSection, MenuSeparator, MenuTrigger, MenuVariantContext, SubmenuTrigger, useMenuVariantContext } from './menu/menu.js';
|
|
35
34
|
export { Popover } from './popover/popover.js';
|
|
@@ -39,10 +38,10 @@ export { DatePicker } from './date-picker/date-picker.js';
|
|
|
39
38
|
export { DateRangePicker } from './date-range-picker/date-range-picker.js';
|
|
40
39
|
export { Checkbox, CheckboxGroup } from './checkbox/checkbox.js';
|
|
41
40
|
export { CheckboxGroupStyleContext, useCheckboxGroupStyleContext } from './checkbox/checkbox-group-style-context.js';
|
|
42
|
-
export { PaginationItemType } from './pagination/hooks/use-pagination.js';
|
|
43
41
|
export { Pagination } from './pagination/pagination.js';
|
|
44
42
|
export { PaginationCursor } from './pagination/pagination-cursor.js';
|
|
45
43
|
export { PaginationItem } from './pagination/pagination-item.js';
|
|
44
|
+
export { PaginationItemType } from './pagination/hooks/use-pagination.js';
|
|
46
45
|
export { CURSOR_TRANSITION_TIMEOUT, usePagination } from './pagination/use-pagination.js';
|
|
47
46
|
export { FileDropzone } from './file-dropzone/file-dropzone.js';
|
|
48
47
|
export { FileInfo } from './file-dropzone/file-info.js';
|
|
@@ -55,7 +54,6 @@ export { ModalBody } from './modal/modal-body.js';
|
|
|
55
54
|
export { ModalHeader } from './modal/modal-header.js';
|
|
56
55
|
export { ModalVariantContext, useModalVariantContext } from './modal/modal-variant-context.js';
|
|
57
56
|
export { Toaster } from './toast/toast.js';
|
|
58
|
-
export { toast } from 'sonner';
|
|
59
57
|
export { Navbar } from './navbar/navbar.js';
|
|
60
58
|
export { NavbarBrand } from './navbar/navbar-brand.js';
|
|
61
59
|
export { NavbarContent } from './navbar/navbar-content.js';
|
|
@@ -65,6 +63,9 @@ export { NavbarMenuToggle } from './navbar/navbar-menu/toggle.js';
|
|
|
65
63
|
export { NavbarItem } from './navbar/navbar-item.js';
|
|
66
64
|
export { useNavbar } from './navbar/use-navbar.js';
|
|
67
65
|
export { NavbarProvider, useNavbarContext } from './navbar/navbar-context.js';
|
|
66
|
+
export { Avatar } from './avatar/index.js';
|
|
67
|
+
export { Accordion, AccordionContent, AccordionHeader, AccordionItem, AccordionStyleContext, useAccordionStyleContext } from './accordion/accordion.js';
|
|
68
|
+
export { toast } from 'sonner';
|
|
68
69
|
export { AvatarContext, useAvatarContext } from './avatar/avatar-context.js';
|
|
69
70
|
export { AvatarGroup } from './avatar/avatar-group.js';
|
|
70
71
|
export { AvatarGroupProvider, useAvatarGroup } from './avatar/avatar-group-context.js';
|
package/dist/esm/menu/menu.js
CHANGED
|
@@ -4,11 +4,11 @@ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
|
4
4
|
import { forwardRef, useMemo, useCallback } from 'react';
|
|
5
5
|
import { useContextProps, MenuItem as MenuItem$1, composeRenderProps, Provider, Menu as Menu$1, MenuSection as MenuSection$1, Header, Collection, MenuTrigger as MenuTrigger$1, SubmenuTrigger as SubmenuTrigger$1, Separator } from 'react-aria-components';
|
|
6
6
|
import { listBoxItemStyles, menuItemStyles, menuStyles, menuSectionStyles, menuDividerStyles } from '@opengovsg/oui-theme';
|
|
7
|
+
import { Popover } from '../popover/popover.js';
|
|
7
8
|
import { forwardRefGeneric, mapPropsVariants } from '../system/utils.js';
|
|
8
9
|
import { createContext } from '../system/react-utils/context.js';
|
|
9
10
|
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
11
|
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';
|
|
11
|
-
import { Popover } from '../popover/popover.js';
|
|
12
12
|
|
|
13
13
|
const [MenuVariantContext, useMenuVariantContext] = createContext({
|
|
14
14
|
name: "MenuVariantContext",
|
|
@@ -5,10 +5,10 @@ import { useContext, isValidElement } from 'react';
|
|
|
5
5
|
import { useMessageFormatter } from 'react-aria';
|
|
6
6
|
import { Dialog } from 'react-aria-components';
|
|
7
7
|
import { cn } from '@opengovsg/oui-theme';
|
|
8
|
+
import { Button } from '../button/button.js';
|
|
8
9
|
import { i18nStrings } from './i18n.js';
|
|
9
10
|
import { ModalVariantContext } from './modal-variant-context.js';
|
|
10
11
|
import X from '../node_modules/.pnpm/lucide-react@0.475.0_react@19.2.3/node_modules/lucide-react/dist/esm/icons/x.js';
|
|
11
|
-
import { Button } from '../button/button.js';
|
|
12
12
|
|
|
13
13
|
function ModalContent({
|
|
14
14
|
closeButtonContent: closeButtonContentProp,
|
|
@@ -3,12 +3,12 @@
|
|
|
3
3
|
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
4
4
|
import { NumberField as NumberField$1 } from 'react-aria-components';
|
|
5
5
|
import { numberFieldStyles, composeTailwindRenderProps, dataAttr, fieldBorderStyles, cn } from '@opengovsg/oui-theme';
|
|
6
|
+
import { Button } from '../button/button.js';
|
|
7
|
+
import { Label, FieldGroup, Description, FieldError } from '../field/field.js';
|
|
8
|
+
import { Input } from '../input/input.js';
|
|
6
9
|
import { mapPropsVariants } from '../system/utils.js';
|
|
7
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';
|
|
8
11
|
import Plus from '../node_modules/.pnpm/lucide-react@0.475.0_react@19.2.3/node_modules/lucide-react/dist/esm/icons/plus.js';
|
|
9
|
-
import { Label, FieldGroup, Description, FieldError } from '../field/field.js';
|
|
10
|
-
import { Input } from '../input/input.js';
|
|
11
|
-
import { Button } from '../button/button.js';
|
|
12
12
|
|
|
13
13
|
function NumberField(originalProps) {
|
|
14
14
|
const [
|
|
@@ -6,12 +6,12 @@ import { CalendarDate, today, getLocalTimeZone, getDayOfWeek } from '@internatio
|
|
|
6
6
|
import { RangeCalendar as RangeCalendar$1, Provider, CalendarGrid, CalendarGridBody, Text, RangeCalendarStateContext, useLocale, CalendarCell } from 'react-aria-components';
|
|
7
7
|
import { useDeepCompareMemo } from 'use-deep-compare';
|
|
8
8
|
import { calendarStyles, composeRenderProps, cn, dataAttr } from '@opengovsg/oui-theme';
|
|
9
|
+
import { CalendarStyleContext, useCalendarStyleContext } from '../calendar/calendar-style-context.js';
|
|
9
10
|
import { AgnosticCalendarStateContext } from '../calendar/agnostic-calendar-state-context.js';
|
|
10
11
|
import { CalendarBottomContent } from '../calendar/calendar-bottom-content.js';
|
|
11
12
|
import { CalendarGridHeader } from '../calendar/calendar-grid-header.js';
|
|
12
13
|
import { CalendarHeader } from '../calendar/calendar-header.js';
|
|
13
14
|
import { forwardRefGeneric, mapPropsVariants } from '../system/utils.js';
|
|
14
|
-
import { CalendarStyleContext, useCalendarStyleContext } from '../calendar/calendar-style-context.js';
|
|
15
15
|
|
|
16
16
|
const RangeCalendar = forwardRefGeneric(function RangeCalendar2(originalProps, ref) {
|
|
17
17
|
const [props, variantProps] = mapPropsVariants(
|
|
@@ -5,12 +5,12 @@ import { useMemo, isValidElement, cloneElement } from 'react';
|
|
|
5
5
|
import { useLocalizedStringFormatter } from 'react-aria';
|
|
6
6
|
import { useFilter, Virtualizer, ListLayout, ListBox, Provider, Select as Select$1, SelectValue, Autocomplete, SearchField, Input } from 'react-aria-components';
|
|
7
7
|
import { selectStyles, cn, composeRenderProps } from '@opengovsg/oui-theme';
|
|
8
|
+
import { Button } from '../button/button.js';
|
|
9
|
+
import { Label, Description, FieldError } from '../field/field.js';
|
|
10
|
+
import { Popover } from '../popover/popover.js';
|
|
8
11
|
import { mapPropsVariants } from '../system/utils.js';
|
|
9
12
|
import { SelectVariantContext } from './select-variant-context.js';
|
|
10
|
-
import { Label, Description, FieldError } from '../field/field.js';
|
|
11
13
|
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';
|
|
12
|
-
import { Popover } from '../popover/popover.js';
|
|
13
|
-
import { Button } from '../button/button.js';
|
|
14
14
|
|
|
15
15
|
const i18nStrings = {
|
|
16
16
|
"en-SG": {
|
|
@@ -19,5 +19,11 @@ const pickChildren = (children, targetChild) => {
|
|
|
19
19
|
const targetChildren = target.length >= 0 ? target : void 0;
|
|
20
20
|
return [withoutTargetChildren, targetChildren];
|
|
21
21
|
};
|
|
22
|
+
const renderChildren = (renderProps, children) => {
|
|
23
|
+
if (typeof children === "function") {
|
|
24
|
+
return children(renderProps);
|
|
25
|
+
}
|
|
26
|
+
return children;
|
|
27
|
+
};
|
|
22
28
|
|
|
23
|
-
export { getValidChildren, pickChildren };
|
|
29
|
+
export { getValidChildren, pickChildren, renderChildren };
|
|
@@ -4,15 +4,15 @@ import { jsxs, jsx } from 'react/jsx-runtime';
|
|
|
4
4
|
import { createElement } from 'react';
|
|
5
5
|
import { composeRenderProps } from 'react-aria-components';
|
|
6
6
|
import { tagFieldStyles } from '@opengovsg/oui-theme';
|
|
7
|
+
import { Label, FieldGroup, Description, FieldError } from '../field/field.js';
|
|
8
|
+
import { Input } from '../input/input.js';
|
|
9
|
+
import { Popover } from '../popover/popover.js';
|
|
7
10
|
import { TagFieldItem } from './tag-field-item.js';
|
|
8
11
|
import { TagFieldList } from './tag-field-list.js';
|
|
9
12
|
import { TagFieldRoot } from './tag-field-root.js';
|
|
10
13
|
import { TagFieldTagList } from './tag-field-tag-list.js';
|
|
11
14
|
import { TagFieldTrigger } from './tag-field-trigger.js';
|
|
12
15
|
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';
|
|
13
|
-
import { Label, FieldGroup, Description, FieldError } from '../field/field.js';
|
|
14
|
-
import { Input } from '../input/input.js';
|
|
15
|
-
import { Popover } from '../popover/popover.js';
|
|
16
16
|
|
|
17
17
|
function TagField({
|
|
18
18
|
classNames,
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
4
4
|
import { TextField } from 'react-aria-components';
|
|
5
5
|
import { composeTailwindRenderProps } from '@opengovsg/oui-theme';
|
|
6
|
-
import { TextArea } from '../text-area/text-area.js';
|
|
7
6
|
import { Label, Description, FieldError } from '../field/field.js';
|
|
7
|
+
import { TextArea } from '../text-area/text-area.js';
|
|
8
8
|
|
|
9
9
|
function TextAreaField({
|
|
10
10
|
label,
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
4
4
|
import { TextField as TextField$1 } from 'react-aria-components';
|
|
5
5
|
import { composeTailwindRenderProps } from '@opengovsg/oui-theme';
|
|
6
|
-
import { Input } from '../input/input.js';
|
|
7
6
|
import { Label, Description, FieldError } from '../field/field.js';
|
|
7
|
+
import { Input } from '../input/input.js';
|
|
8
8
|
|
|
9
9
|
function TextField({
|
|
10
10
|
label,
|
package/dist/esm/toast/toast.js
CHANGED
|
@@ -4,9 +4,9 @@ import { jsx } from 'react/jsx-runtime';
|
|
|
4
4
|
import { Toaster as Toaster$1 } from 'sonner';
|
|
5
5
|
export { toast } from 'sonner';
|
|
6
6
|
import { toastStyles } from '@opengovsg/oui-theme';
|
|
7
|
+
import { Spinner } from '../spinner/spinner.js';
|
|
7
8
|
import { mapPropsVariants } from '../system/utils.js';
|
|
8
9
|
import X from '../node_modules/.pnpm/lucide-react@0.475.0_react@19.2.3/node_modules/lucide-react/dist/esm/icons/x.js';
|
|
9
|
-
import { Spinner } from '../spinner/spinner.js';
|
|
10
10
|
|
|
11
11
|
function Toaster(originalProps) {
|
|
12
12
|
const [{ toastOptions, closeButton = true, ...props }, variantProps] = mapPropsVariants(originalProps, toastStyles.variantKeys);
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type React from "react";
|
|
2
|
+
import type { DisclosurePanelProps as AriaDisclosurePanelProps, DisclosureProps as AriaDisclosureProps, ButtonRenderProps, DisclosureGroupProps, RenderProps } from "react-aria-components";
|
|
3
|
+
import type { AccordionSlots, AccordionVariantProps, SlotsToClasses } from "@opengovsg/oui-theme";
|
|
4
|
+
import { accordionStyles } from "@opengovsg/oui-theme";
|
|
5
|
+
export interface UseProvideAccordionStylesReturn {
|
|
6
|
+
slots: ReturnType<typeof accordionStyles>;
|
|
7
|
+
classNames?: SlotsToClasses<AccordionSlots>;
|
|
8
|
+
}
|
|
9
|
+
export declare const AccordionStyleContext: React.Context<UseProvideAccordionStylesReturn>, useAccordionStyleContext: () => UseProvideAccordionStylesReturn;
|
|
10
|
+
export interface AccordionItemProps extends Omit<AriaDisclosureProps, "isExpanded" | "defaultExpanded" | "onExpandedChange"> {
|
|
11
|
+
children: React.ReactNode;
|
|
12
|
+
classNames?: SlotsToClasses<AccordionSlots>;
|
|
13
|
+
}
|
|
14
|
+
export declare const AccordionItem: import("../system/utils").InternalForwardRefRenderFunction<"div", AccordionItemProps, never>;
|
|
15
|
+
export interface AccordionHeaderRenderProps extends ButtonRenderProps {
|
|
16
|
+
isExpanded: boolean;
|
|
17
|
+
}
|
|
18
|
+
export interface AccordionHeaderProps extends Pick<RenderProps<AccordionHeaderRenderProps>, "children"> {
|
|
19
|
+
classNames?: SlotsToClasses<Extract<AccordionSlots, "heading" | "title" | "trigger" | "indicator" | "startContentWrapper" | "endContentWrapper">>;
|
|
20
|
+
/**
|
|
21
|
+
* The indicator. Defaults to a chevron icon.
|
|
22
|
+
*/
|
|
23
|
+
indicator?: RenderProps<AccordionHeaderRenderProps>["children"];
|
|
24
|
+
/**
|
|
25
|
+
* Whether to hide the indicator.
|
|
26
|
+
* @default false
|
|
27
|
+
*/
|
|
28
|
+
hideIndicator?: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* The header start content.
|
|
31
|
+
*/
|
|
32
|
+
startContent?: RenderProps<AccordionHeaderRenderProps>["children"];
|
|
33
|
+
/**
|
|
34
|
+
* The header end content.
|
|
35
|
+
*/
|
|
36
|
+
endContent?: RenderProps<AccordionHeaderRenderProps>["children"];
|
|
37
|
+
}
|
|
38
|
+
export declare function AccordionHeader({ children, classNames, indicator, startContent, endContent, hideIndicator, }: AccordionHeaderProps): import("react/jsx-runtime").JSX.Element;
|
|
39
|
+
export interface AccordionContentProps extends AriaDisclosurePanelProps {
|
|
40
|
+
children: React.ReactNode;
|
|
41
|
+
classNames?: SlotsToClasses<"panel" | "content">;
|
|
42
|
+
}
|
|
43
|
+
export declare function AccordionContent({ children, classNames, ...props }: AccordionContentProps): import("react/jsx-runtime").JSX.Element;
|
|
44
|
+
interface AccordionProps extends DisclosureGroupProps, AccordionVariantProps {
|
|
45
|
+
children: React.ReactNode;
|
|
46
|
+
classNames?: SlotsToClasses<AccordionSlots>;
|
|
47
|
+
}
|
|
48
|
+
export declare const Accordion: import("../system/utils").InternalForwardRefRenderFunction<"div", AccordionProps, never>;
|
|
49
|
+
export {};
|
|
50
|
+
//# sourceMappingURL=accordion.d.ts.map
|