@opengovsg/oui 0.0.10 → 0.0.12
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/button/button.cjs +3 -1
- package/dist/cjs/calendar/calendar.cjs +1 -1
- package/dist/cjs/combo-box/combo-box.cjs +2 -2
- package/dist/cjs/date-field/date-field.cjs +81 -0
- package/dist/cjs/date-field/index.cjs +9 -0
- package/dist/cjs/date-picker/date-picker.cjs +85 -0
- package/dist/cjs/date-picker/index.cjs +8 -0
- package/dist/cjs/date-range-picker/date-range-picker.cjs +128 -0
- package/dist/cjs/date-range-picker/index.cjs +8 -0
- package/dist/cjs/index.cjs +40 -26
- package/dist/cjs/menu/menu.cjs +1 -1
- package/dist/cjs/node_modules/.pnpm/lucide-react@0.475.0_react@19.0.0/node_modules/lucide-react/dist/esm/icons/calendar.cjs +24 -0
- package/dist/cjs/range-calendar/range-calendar.cjs +1 -1
- package/dist/cjs/select/select.cjs +2 -2
- package/dist/cjs/tabs/index.cjs +13 -0
- package/dist/cjs/tabs/tabs.cjs +97 -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/esm/button/button.js +3 -1
- package/dist/esm/calendar/calendar.js +2 -2
- package/dist/esm/combo-box/combo-box.js +2 -2
- package/dist/esm/date-field/date-field.js +78 -0
- package/dist/esm/date-field/index.js +2 -0
- package/dist/esm/date-picker/date-picker.js +83 -0
- package/dist/esm/date-picker/index.js +2 -0
- package/dist/esm/date-range-picker/date-range-picker.js +126 -0
- package/dist/esm/date-range-picker/index.js +2 -0
- package/dist/esm/index.js +11 -7
- package/dist/esm/menu/menu.js +1 -1
- package/dist/esm/node_modules/.pnpm/lucide-react@0.475.0_react@19.0.0/node_modules/lucide-react/dist/esm/icons/calendar.js +19 -0
- package/dist/esm/range-calendar/range-calendar.js +3 -3
- package/dist/esm/select/select.js +2 -2
- package/dist/esm/tabs/index.js +2 -0
- package/dist/esm/tabs/tabs.js +90 -0
- 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/types/button/button.d.ts.map +1 -1
- package/dist/types/calendar/calendar.d.ts +2 -3
- package/dist/types/calendar/calendar.d.ts.map +1 -1
- package/dist/types/calendar/types.d.ts +2 -13
- package/dist/types/calendar/types.d.ts.map +1 -1
- package/dist/types/combo-box/combo-box.d.ts +3 -3
- package/dist/types/combo-box/combo-box.d.ts.map +1 -1
- package/dist/types/date-field/date-field.d.ts +19 -0
- package/dist/types/date-field/date-field.d.ts.map +1 -0
- package/dist/types/date-field/index.d.ts +2 -0
- package/dist/types/date-field/index.d.ts.map +1 -0
- package/dist/types/date-picker/date-picker.d.ts +20 -0
- package/dist/types/date-picker/date-picker.d.ts.map +1 -0
- package/dist/types/date-picker/index.d.ts +2 -0
- package/dist/types/date-picker/index.d.ts.map +1 -0
- package/dist/types/date-range-picker/date-range-picker.d.ts +19 -0
- package/dist/types/date-range-picker/date-range-picker.d.ts.map +1 -0
- package/dist/types/date-range-picker/index.d.ts +2 -0
- package/dist/types/date-range-picker/index.d.ts.map +1 -0
- package/dist/types/index.d.mts +4 -0
- package/dist/types/index.d.ts +4 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/menu/menu.d.ts +1 -1
- package/dist/types/menu/menu.d.ts.map +1 -1
- package/dist/types/range-calendar/range-calendar.d.ts +2 -13
- package/dist/types/range-calendar/range-calendar.d.ts.map +1 -1
- package/dist/types/select/select.d.ts +4 -4
- package/dist/types/select/select.d.ts.map +1 -1
- package/dist/types/tabs/index.d.ts +2 -0
- package/dist/types/tabs/index.d.ts.map +1 -0
- package/dist/types/tabs/tabs.d.ts +16 -0
- package/dist/types/tabs/tabs.d.ts.map +1 -0
- package/dist/types/text-area-field/text-area-field.d.ts +3 -3
- package/dist/types/text-area-field/text-area-field.d.ts.map +1 -1
- package/dist/types/text-field/text-field.d.ts +3 -3
- package/dist/types/text-field/text-field.d.ts.map +1 -1
- package/package.json +30 -30
|
@@ -6,15 +6,15 @@ var jsxRuntime = require('react/jsx-runtime');
|
|
|
6
6
|
var 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
|
+
var input = require('../input/input.cjs');
|
|
11
|
+
var popover = require('../popover/popover.cjs');
|
|
9
12
|
var tagFieldItem = require('./tag-field-item.cjs');
|
|
10
13
|
var tagFieldList = require('./tag-field-list.cjs');
|
|
11
14
|
var tagFieldRoot = require('./tag-field-root.cjs');
|
|
12
15
|
var tagFieldTagList = require('./tag-field-tag-list.cjs');
|
|
13
16
|
var tagFieldTrigger = require('./tag-field-trigger.cjs');
|
|
14
17
|
var chevronDown = require('../node_modules/.pnpm/lucide-react@0.475.0_react@19.0.0/node_modules/lucide-react/dist/esm/icons/chevron-down.cjs');
|
|
15
|
-
var field = require('../field/field.cjs');
|
|
16
|
-
var input = require('../input/input.cjs');
|
|
17
|
-
var popover = require('../popover/popover.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 textArea = require('../text-area/text-area.cjs');
|
|
9
8
|
var field = require('../field/field.cjs');
|
|
9
|
+
var textArea = require('../text-area/text-area.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 input = require('../input/input.cjs');
|
|
9
8
|
var field = require('../field/field.cjs');
|
|
9
|
+
var input = require('../input/input.cjs');
|
|
10
10
|
|
|
11
11
|
function TextField({
|
|
12
12
|
label,
|
|
@@ -27,6 +27,7 @@ const Button = forwardRef(
|
|
|
27
27
|
isPending,
|
|
28
28
|
spinner: spinnerProp,
|
|
29
29
|
isIconOnly,
|
|
30
|
+
isAttached,
|
|
30
31
|
...props
|
|
31
32
|
}, ref) => {
|
|
32
33
|
const {
|
|
@@ -60,7 +61,8 @@ const Button = forwardRef(
|
|
|
60
61
|
layout,
|
|
61
62
|
color,
|
|
62
63
|
radius,
|
|
63
|
-
isIconOnly
|
|
64
|
+
isIconOnly,
|
|
65
|
+
isAttached
|
|
64
66
|
})
|
|
65
67
|
),
|
|
66
68
|
isPending,
|
|
@@ -6,14 +6,14 @@ import { CalendarDate, today, getLocalTimeZone } from '@internationalized/date';
|
|
|
6
6
|
import { Calendar as Calendar$1, composeRenderProps, Provider, CalendarGrid, CalendarGridBody, CalendarCell, 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
|
-
import {
|
|
9
|
+
import { forwardRefGeneric, mapPropsVariants } from '../system/utils.js';
|
|
10
10
|
import { AgnosticCalendarStateContext } from './agnostic-calendar-state-context.js';
|
|
11
11
|
import { CalendarBottomContent } from './calendar-bottom-content.js';
|
|
12
12
|
import { CalendarGridHeader } from './calendar-grid-header.js';
|
|
13
13
|
import { CalendarHeader } from './calendar-header.js';
|
|
14
14
|
import { CalendarStyleContext } from './calendar-style-context.js';
|
|
15
15
|
|
|
16
|
-
const Calendar =
|
|
16
|
+
const Calendar = forwardRefGeneric(function Calendar2(originalProps, ref) {
|
|
17
17
|
const [props, variantProps] = mapPropsVariants(
|
|
18
18
|
originalProps,
|
|
19
19
|
calendarStyles.variantKeys
|
|
@@ -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.0.0/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.0.0/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.0.0/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) {
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
"use client";
|
|
3
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
4
|
+
import { useMemo } from 'react';
|
|
5
|
+
import { DateField as DateField$1, DateInput as DateInput$1, DateSegment } from 'react-aria-components';
|
|
6
|
+
import { dateFieldStyles, composeTailwindRenderProps, dateInputStyles, composeRenderProps } from '@opengovsg/oui-theme';
|
|
7
|
+
import { Label, Description, FieldError } from '../field/field.js';
|
|
8
|
+
import { mapPropsVariants } from '../system/utils.js';
|
|
9
|
+
|
|
10
|
+
function DateField(originalProps) {
|
|
11
|
+
const [
|
|
12
|
+
{ label, description, errorMessage, className, classNames, ...props },
|
|
13
|
+
variantProps
|
|
14
|
+
] = useMemo(
|
|
15
|
+
() => mapPropsVariants(originalProps, dateFieldStyles.variantKeys),
|
|
16
|
+
[originalProps]
|
|
17
|
+
);
|
|
18
|
+
const styles = dateFieldStyles({
|
|
19
|
+
className: classNames?.input,
|
|
20
|
+
...variantProps
|
|
21
|
+
});
|
|
22
|
+
return /* @__PURE__ */ jsxs(
|
|
23
|
+
DateField$1,
|
|
24
|
+
{
|
|
25
|
+
...props,
|
|
26
|
+
isDisabled: variantProps.isDisabled,
|
|
27
|
+
className: composeTailwindRenderProps(
|
|
28
|
+
className ?? classNames?.base,
|
|
29
|
+
"flex flex-col gap-2"
|
|
30
|
+
),
|
|
31
|
+
children: [
|
|
32
|
+
label && /* @__PURE__ */ jsx(Label, { size: variantProps.size, className: classNames?.label, children: label }),
|
|
33
|
+
/* @__PURE__ */ jsx(DateInput, { size: variantProps.size, className: styles }),
|
|
34
|
+
description && /* @__PURE__ */ jsx(
|
|
35
|
+
Description,
|
|
36
|
+
{
|
|
37
|
+
size: variantProps.size,
|
|
38
|
+
className: classNames?.description,
|
|
39
|
+
children: description
|
|
40
|
+
}
|
|
41
|
+
),
|
|
42
|
+
/* @__PURE__ */ jsx(FieldError, { size: variantProps.size, className: classNames?.error, children: errorMessage })
|
|
43
|
+
]
|
|
44
|
+
}
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
function DateInput(originalProps) {
|
|
48
|
+
const [{ className, classNames, ...props }, variantProps] = useMemo(
|
|
49
|
+
() => mapPropsVariants(originalProps, dateInputStyles.variantKeys),
|
|
50
|
+
[originalProps]
|
|
51
|
+
);
|
|
52
|
+
const styles = dateInputStyles(variantProps);
|
|
53
|
+
return /* @__PURE__ */ jsx(
|
|
54
|
+
DateInput$1,
|
|
55
|
+
{
|
|
56
|
+
className: composeTailwindRenderProps(
|
|
57
|
+
className ?? classNames?.base,
|
|
58
|
+
styles.base()
|
|
59
|
+
),
|
|
60
|
+
...props,
|
|
61
|
+
children: (segment) => /* @__PURE__ */ jsx(
|
|
62
|
+
DateSegment,
|
|
63
|
+
{
|
|
64
|
+
segment,
|
|
65
|
+
className: composeRenderProps(
|
|
66
|
+
classNames?.segment,
|
|
67
|
+
(className2, renderProps) => styles.segment({
|
|
68
|
+
...renderProps,
|
|
69
|
+
className: className2
|
|
70
|
+
})
|
|
71
|
+
)
|
|
72
|
+
}
|
|
73
|
+
)
|
|
74
|
+
}
|
|
75
|
+
);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export { DateField, DateInput };
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
"use client";
|
|
3
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
4
|
+
import { useMemo } from 'react';
|
|
5
|
+
import { DatePicker as DatePicker$1, Dialog } from 'react-aria-components';
|
|
6
|
+
import { datePickerStyles, composeTailwindRenderProps } from '@opengovsg/oui-theme';
|
|
7
|
+
import { Label, FieldGroup, Description, FieldError } from '../field/field.js';
|
|
8
|
+
import { Popover } from '../popover/popover.js';
|
|
9
|
+
import { mapPropsVariants } from '../system/utils.js';
|
|
10
|
+
import { DateInput } from '../date-field/date-field.js';
|
|
11
|
+
import Calendar from '../node_modules/.pnpm/lucide-react@0.475.0_react@19.0.0/node_modules/lucide-react/dist/esm/icons/calendar.js';
|
|
12
|
+
import { Calendar as Calendar$1 } from '../calendar/calendar.js';
|
|
13
|
+
import { Button } from '../button/button.js';
|
|
14
|
+
|
|
15
|
+
function DatePicker(originalProps) {
|
|
16
|
+
const [
|
|
17
|
+
{
|
|
18
|
+
label,
|
|
19
|
+
description,
|
|
20
|
+
errorMessage,
|
|
21
|
+
classNames,
|
|
22
|
+
className,
|
|
23
|
+
calendarProps,
|
|
24
|
+
popoverProps,
|
|
25
|
+
calendarButtonProps,
|
|
26
|
+
...props
|
|
27
|
+
},
|
|
28
|
+
variantProps
|
|
29
|
+
] = useMemo(
|
|
30
|
+
() => mapPropsVariants(originalProps, datePickerStyles.variantKeys),
|
|
31
|
+
[originalProps]
|
|
32
|
+
);
|
|
33
|
+
const styles = datePickerStyles(variantProps);
|
|
34
|
+
return /* @__PURE__ */ jsxs(
|
|
35
|
+
DatePicker$1,
|
|
36
|
+
{
|
|
37
|
+
...props,
|
|
38
|
+
className: composeTailwindRenderProps(
|
|
39
|
+
className ?? classNames?.base,
|
|
40
|
+
styles.base()
|
|
41
|
+
),
|
|
42
|
+
children: [
|
|
43
|
+
label && /* @__PURE__ */ jsx(Label, { size: variantProps.size, children: label }),
|
|
44
|
+
/* @__PURE__ */ jsxs(FieldGroup, { className: styles.group({ className: classNames?.group }), children: [
|
|
45
|
+
/* @__PURE__ */ jsx(
|
|
46
|
+
DateInput,
|
|
47
|
+
{
|
|
48
|
+
size: variantProps.size,
|
|
49
|
+
className: styles.input({ className: classNames?.input })
|
|
50
|
+
}
|
|
51
|
+
),
|
|
52
|
+
/* @__PURE__ */ jsx(
|
|
53
|
+
Button,
|
|
54
|
+
{
|
|
55
|
+
isIconOnly: true,
|
|
56
|
+
isAttached: true,
|
|
57
|
+
variant: "clear",
|
|
58
|
+
color: "sub",
|
|
59
|
+
size: variantProps.size,
|
|
60
|
+
className: styles.calendarButton({
|
|
61
|
+
className: classNames?.calendarButton
|
|
62
|
+
}),
|
|
63
|
+
...calendarButtonProps,
|
|
64
|
+
children: /* @__PURE__ */ jsx(Calendar, { "aria-hidden": true })
|
|
65
|
+
}
|
|
66
|
+
)
|
|
67
|
+
] }),
|
|
68
|
+
/* @__PURE__ */ jsx(Popover, { placement: "bottom end", ...popoverProps, children: /* @__PURE__ */ jsx(Dialog, { className: styles.dialog({ className: classNames?.dialog }), children: /* @__PURE__ */ jsx(
|
|
69
|
+
Calendar$1,
|
|
70
|
+
{
|
|
71
|
+
size: variantProps.size === "xs" ? "sm" : variantProps.size,
|
|
72
|
+
classNames: classNames?.calendar,
|
|
73
|
+
...calendarProps
|
|
74
|
+
}
|
|
75
|
+
) }) }),
|
|
76
|
+
description && /* @__PURE__ */ jsx(Description, { size: variantProps.size, children: description }),
|
|
77
|
+
/* @__PURE__ */ jsx(FieldError, { size: variantProps.size, children: errorMessage })
|
|
78
|
+
]
|
|
79
|
+
}
|
|
80
|
+
);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export { DatePicker };
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
"use client";
|
|
3
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
4
|
+
import { useMemo } from 'react';
|
|
5
|
+
import { CalendarDate } from '@internationalized/date';
|
|
6
|
+
import { DateRangePicker as DateRangePicker$1, Dialog } from 'react-aria-components';
|
|
7
|
+
import { dateRangePickerStyles, composeTailwindRenderProps } from '@opengovsg/oui-theme';
|
|
8
|
+
import { Label, FieldGroup, Description, FieldError } from '../field/field.js';
|
|
9
|
+
import { Popover } from '../popover/popover.js';
|
|
10
|
+
import { RangeCalendar } from '../range-calendar/range-calendar.js';
|
|
11
|
+
import { mapPropsVariants } from '../system/utils.js';
|
|
12
|
+
import Calendar from '../node_modules/.pnpm/lucide-react@0.475.0_react@19.0.0/node_modules/lucide-react/dist/esm/icons/calendar.js';
|
|
13
|
+
import { DateInput } from '../date-field/date-field.js';
|
|
14
|
+
import { Button } from '../button/button.js';
|
|
15
|
+
|
|
16
|
+
function DateRangePicker(originalProps) {
|
|
17
|
+
const [
|
|
18
|
+
{
|
|
19
|
+
label,
|
|
20
|
+
description,
|
|
21
|
+
errorMessage,
|
|
22
|
+
classNames,
|
|
23
|
+
className,
|
|
24
|
+
calendarProps,
|
|
25
|
+
popoverProps,
|
|
26
|
+
calendarButtonProps,
|
|
27
|
+
minValue: minValueProp,
|
|
28
|
+
maxValue: maxValueProp,
|
|
29
|
+
...props
|
|
30
|
+
},
|
|
31
|
+
variantProps
|
|
32
|
+
] = useMemo(
|
|
33
|
+
() => mapPropsVariants(originalProps, dateRangePickerStyles.variantKeys),
|
|
34
|
+
[originalProps]
|
|
35
|
+
);
|
|
36
|
+
const styles = dateRangePickerStyles(variantProps);
|
|
37
|
+
const { minValue, maxValue } = useMemo(() => {
|
|
38
|
+
return {
|
|
39
|
+
minValue: minValueProp ?? new CalendarDate(1900, 0, 1),
|
|
40
|
+
// Default to 1 Jan 1900
|
|
41
|
+
maxValue: maxValueProp ?? new CalendarDate(2100, 12, 31)
|
|
42
|
+
// Default to 31 Dec 2100
|
|
43
|
+
};
|
|
44
|
+
}, [maxValueProp, minValueProp]);
|
|
45
|
+
return /* @__PURE__ */ jsxs(
|
|
46
|
+
DateRangePicker$1,
|
|
47
|
+
{
|
|
48
|
+
...props,
|
|
49
|
+
minValue,
|
|
50
|
+
maxValue,
|
|
51
|
+
className: composeTailwindRenderProps(
|
|
52
|
+
className ?? classNames?.base,
|
|
53
|
+
styles.base()
|
|
54
|
+
),
|
|
55
|
+
children: [
|
|
56
|
+
label && /* @__PURE__ */ jsx(Label, { children: label }),
|
|
57
|
+
/* @__PURE__ */ jsxs(FieldGroup, { className: styles.group({ className: classNames?.group }), children: [
|
|
58
|
+
/* @__PURE__ */ jsxs(
|
|
59
|
+
"div",
|
|
60
|
+
{
|
|
61
|
+
className: styles.dateWrapper({ className: classNames?.dateWrapper }),
|
|
62
|
+
children: [
|
|
63
|
+
/* @__PURE__ */ jsx(
|
|
64
|
+
DateInput,
|
|
65
|
+
{
|
|
66
|
+
slot: "start",
|
|
67
|
+
size: variantProps.size,
|
|
68
|
+
className: styles.startInput({ className: classNames?.startInput })
|
|
69
|
+
}
|
|
70
|
+
),
|
|
71
|
+
/* @__PURE__ */ jsx(
|
|
72
|
+
"span",
|
|
73
|
+
{
|
|
74
|
+
"aria-hidden": "true",
|
|
75
|
+
className: styles.connector({
|
|
76
|
+
className: classNames?.connector
|
|
77
|
+
}),
|
|
78
|
+
children: "\u2013"
|
|
79
|
+
}
|
|
80
|
+
),
|
|
81
|
+
/* @__PURE__ */ jsx(
|
|
82
|
+
DateInput,
|
|
83
|
+
{
|
|
84
|
+
slot: "end",
|
|
85
|
+
size: variantProps.size,
|
|
86
|
+
className: styles.endInput({ className: classNames?.endInput })
|
|
87
|
+
}
|
|
88
|
+
)
|
|
89
|
+
]
|
|
90
|
+
}
|
|
91
|
+
),
|
|
92
|
+
/* @__PURE__ */ jsx(
|
|
93
|
+
Button,
|
|
94
|
+
{
|
|
95
|
+
isIconOnly: true,
|
|
96
|
+
isAttached: true,
|
|
97
|
+
variant: "clear",
|
|
98
|
+
color: "sub",
|
|
99
|
+
size: variantProps.size,
|
|
100
|
+
className: styles.calendarButton({
|
|
101
|
+
className: classNames?.calendarButton
|
|
102
|
+
}),
|
|
103
|
+
...calendarButtonProps,
|
|
104
|
+
children: /* @__PURE__ */ jsx(Calendar, { "aria-hidden": true })
|
|
105
|
+
}
|
|
106
|
+
)
|
|
107
|
+
] }),
|
|
108
|
+
description && /* @__PURE__ */ jsx(Description, { size: variantProps.size, children: description }),
|
|
109
|
+
/* @__PURE__ */ jsx(FieldError, { size: variantProps.size, children: errorMessage }),
|
|
110
|
+
/* @__PURE__ */ jsx(Popover, { placement: "bottom end", ...popoverProps, children: /* @__PURE__ */ jsx(Dialog, { className: styles.dialog({ className: classNames?.dialog }), children: /* @__PURE__ */ jsx(
|
|
111
|
+
RangeCalendar,
|
|
112
|
+
{
|
|
113
|
+
visibleDuration: { months: 2 },
|
|
114
|
+
size: variantProps.size === "xs" ? "sm" : variantProps.size,
|
|
115
|
+
classNames: classNames?.calendar,
|
|
116
|
+
minValue,
|
|
117
|
+
maxValue,
|
|
118
|
+
...calendarProps
|
|
119
|
+
}
|
|
120
|
+
) }) })
|
|
121
|
+
]
|
|
122
|
+
}
|
|
123
|
+
);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
export { DateRangePicker };
|
package/dist/esm/index.js
CHANGED
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
export { useControllableState } from './hooks/use-controllable-state.js';
|
|
3
|
+
export { GovtBanner } from './govt-banner/govt-banner.js';
|
|
2
4
|
export { Ripple } from './ripple/ripple.js';
|
|
3
5
|
export { useRipple } from './ripple/use-ripple.js';
|
|
4
6
|
export { Spinner } from './spinner/spinner.js';
|
|
5
7
|
export { useSpinner } from './spinner/use-spinner.js';
|
|
6
8
|
export { Toggle } from './toggle/toggle.js';
|
|
7
9
|
export { SkipNavLink } from './skip-nav-link/skip-nav-link.js';
|
|
10
|
+
export { Input } from './input/input.js';
|
|
8
11
|
export { TextField } from './text-field/text-field.js';
|
|
12
|
+
export { Description, FieldError, FieldGroup, Label } from './field/field.js';
|
|
9
13
|
export { TextArea } from './text-area/text-area.js';
|
|
10
14
|
export { TextAreaField } from './text-area-field/text-area-field.js';
|
|
11
15
|
export { TagField } from './tag-field/tag-field.js';
|
|
@@ -13,11 +17,13 @@ export { TagFieldItem } from './tag-field/tag-field-item.js';
|
|
|
13
17
|
export { Select } from './select/select.js';
|
|
14
18
|
export { SelectItem } from './select/select-item.js';
|
|
15
19
|
export { SelectVariantContext, useSelectVariantContext } from './select/select-variant-context.js';
|
|
16
|
-
export {
|
|
20
|
+
export { RangeCalendar, RangeCalendarCell, RangeCalendarStateWrapper } from './range-calendar/range-calendar.js';
|
|
21
|
+
export { Menu, MenuItem, MenuSection, MenuSeparator, MenuTrigger, MenuVariantContext, SubmenuTrigger, useMenuVariantContext } from './menu/menu.js';
|
|
22
|
+
export { Popover } from './popover/popover.js';
|
|
23
|
+
export { Tab, TabList, TabPanel, Tabs, TabsVariantContext, useTabsVariantContext } from './tabs/tabs.js';
|
|
24
|
+
export { DatePicker } from './date-picker/date-picker.js';
|
|
25
|
+
export { DateRangePicker } from './date-range-picker/date-range-picker.js';
|
|
17
26
|
export { Button } from './button/button.js';
|
|
18
|
-
export { GovtBanner } from './govt-banner/govt-banner.js';
|
|
19
|
-
export { Input } from './input/input.js';
|
|
20
|
-
export { Description, FieldError, FieldGroup, Label } from './field/field.js';
|
|
21
27
|
export { ComboBox, ComboBoxEmptyState } from './combo-box/combo-box.js';
|
|
22
28
|
export { ComboBoxFuzzy } from './combo-box/combo-box-fuzzy.js';
|
|
23
29
|
export { ComboBoxItem } from './combo-box/combo-box-item.js';
|
|
@@ -28,6 +34,4 @@ export { CalendarDate } from '@internationalized/date';
|
|
|
28
34
|
export { Calendar, CalendarStateWrapper } from './calendar/calendar.js';
|
|
29
35
|
export { CalendarStyleContext, useCalendarStyleContext } from './calendar/calendar-style-context.js';
|
|
30
36
|
export { getEraFormat, useGenerateLocalizedMonths, useGenerateLocalizedYears, useLocalizedMonthYear } from './calendar/utils.js';
|
|
31
|
-
export {
|
|
32
|
-
export { Menu, MenuItem, MenuSection, MenuSeparator, MenuTrigger, MenuVariantContext, SubmenuTrigger, useMenuVariantContext } from './menu/menu.js';
|
|
33
|
-
export { Popover } from './popover/popover.js';
|
|
37
|
+
export { DateField, DateInput } from './date-field/date-field.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 Check from '../node_modules/.pnpm/lucide-react@0.475.0_react@19.0.0/node_modules/lucide-react/dist/esm/icons/check.js';
|
|
9
10
|
import ChevronRight from '../node_modules/.pnpm/lucide-react@0.475.0_react@19.0.0/node_modules/lucide-react/dist/esm/icons/chevron-right.js';
|
|
10
11
|
import { createContext } from '../system/react-utils/context.js';
|
|
11
|
-
import { Popover } from '../popover/popover.js';
|
|
12
12
|
|
|
13
13
|
const [MenuVariantContext, useMenuVariantContext] = createContext({
|
|
14
14
|
name: "MenuVariantContext",
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import createLucideIcon from '../createLucideIcon.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @license lucide-react v0.475.0 - ISC
|
|
5
|
+
*
|
|
6
|
+
* This source code is licensed under the ISC license.
|
|
7
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
const __iconNode = [
|
|
12
|
+
["path", { d: "M8 2v4", key: "1cmpym" }],
|
|
13
|
+
["path", { d: "M16 2v4", key: "4m81vk" }],
|
|
14
|
+
["rect", { width: "18", height: "18", x: "3", y: "4", rx: "2", key: "1hopcy" }],
|
|
15
|
+
["path", { d: "M3 10h18", key: "8toen8" }]
|
|
16
|
+
];
|
|
17
|
+
const Calendar = createLucideIcon("Calendar", __iconNode);
|
|
18
|
+
|
|
19
|
+
export { __iconNode, Calendar as default };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
"use client";
|
|
3
3
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
4
|
-
import {
|
|
4
|
+
import { useMemo, useContext } from 'react';
|
|
5
5
|
import { CalendarDate, today, getLocalTimeZone, getDayOfWeek } from '@internationalized/date';
|
|
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';
|
|
@@ -10,10 +10,10 @@ import { AgnosticCalendarStateContext } from '../calendar/agnostic-calendar-stat
|
|
|
10
10
|
import { CalendarBottomContent } from '../calendar/calendar-bottom-content.js';
|
|
11
11
|
import { CalendarGridHeader } from '../calendar/calendar-grid-header.js';
|
|
12
12
|
import { CalendarHeader } from '../calendar/calendar-header.js';
|
|
13
|
-
import { mapPropsVariants } from '../system/utils.js';
|
|
13
|
+
import { forwardRefGeneric, mapPropsVariants } from '../system/utils.js';
|
|
14
14
|
import { CalendarStyleContext, useCalendarStyleContext } from '../calendar/calendar-style-context.js';
|
|
15
15
|
|
|
16
|
-
const RangeCalendar =
|
|
16
|
+
const RangeCalendar = forwardRefGeneric(function RangeCalendar2(originalProps, ref) {
|
|
17
17
|
const [props, variantProps] = mapPropsVariants(
|
|
18
18
|
originalProps,
|
|
19
19
|
calendarStyles.variantKeys
|
|
@@ -4,11 +4,11 @@ import { jsx, jsxs } from 'react/jsx-runtime';
|
|
|
4
4
|
import { useMemo } from 'react';
|
|
5
5
|
import { Provider, Select as Select$1, SelectValue, Virtualizer, ListLayout, ListBox } from 'react-aria-components';
|
|
6
6
|
import { selectStyles, composeRenderProps } from '@opengovsg/oui-theme';
|
|
7
|
+
import { Label, Description, FieldError } from '../field/field.js';
|
|
8
|
+
import { Popover } from '../popover/popover.js';
|
|
7
9
|
import { mapPropsVariants } from '../system/utils.js';
|
|
8
10
|
import { SelectVariantContext } from './select-variant-context.js';
|
|
9
|
-
import { Label, Description, FieldError } from '../field/field.js';
|
|
10
11
|
import ChevronDown from '../node_modules/.pnpm/lucide-react@0.475.0_react@19.0.0/node_modules/lucide-react/dist/esm/icons/chevron-down.js';
|
|
11
|
-
import { Popover } from '../popover/popover.js';
|
|
12
12
|
import { Button } from '../button/button.js';
|
|
13
13
|
|
|
14
14
|
const calculateEstimatedRowHeight = (size) => {
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
"use client";
|
|
3
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
4
|
+
import { forwardRef } from 'react';
|
|
5
|
+
import { useContextProps, TabList as TabList$1, composeRenderProps, Tab as Tab$1, Provider, Tabs as Tabs$1, TabPanel as TabPanel$1 } from 'react-aria-components';
|
|
6
|
+
import { tabListStyles, tabStyles, tabsStyles, tabPanelStyles } from '@opengovsg/oui-theme';
|
|
7
|
+
import { forwardRefGeneric, mapPropsVariants } from '../system/utils.js';
|
|
8
|
+
import { createContext } from '../system/react-utils/context.js';
|
|
9
|
+
|
|
10
|
+
const [TabsVariantContext, useTabsVariantContext] = createContext({
|
|
11
|
+
name: "TabsVariantContext",
|
|
12
|
+
strict: true
|
|
13
|
+
});
|
|
14
|
+
function Tabs(originalProps) {
|
|
15
|
+
const [props, variantProps] = mapPropsVariants(
|
|
16
|
+
originalProps,
|
|
17
|
+
tabsStyles.variantKeys
|
|
18
|
+
);
|
|
19
|
+
return /* @__PURE__ */ jsx(Provider, { values: [[TabsVariantContext, variantProps]], children: /* @__PURE__ */ jsx(
|
|
20
|
+
Tabs$1,
|
|
21
|
+
{
|
|
22
|
+
...props,
|
|
23
|
+
className: composeRenderProps(
|
|
24
|
+
props.className,
|
|
25
|
+
(className, renderProps) => tabsStyles({ ...renderProps, ...variantProps, className })
|
|
26
|
+
)
|
|
27
|
+
}
|
|
28
|
+
) });
|
|
29
|
+
}
|
|
30
|
+
const TabList = forwardRefGeneric(function TabList2(originalProps, ref) {
|
|
31
|
+
[originalProps, ref] = useContextProps(
|
|
32
|
+
originalProps,
|
|
33
|
+
ref,
|
|
34
|
+
TabsVariantContext
|
|
35
|
+
);
|
|
36
|
+
const [props, variantProps] = mapPropsVariants(
|
|
37
|
+
originalProps,
|
|
38
|
+
tabListStyles.variantKeys
|
|
39
|
+
);
|
|
40
|
+
return /* @__PURE__ */ jsx(
|
|
41
|
+
TabList$1,
|
|
42
|
+
{
|
|
43
|
+
ref,
|
|
44
|
+
...props,
|
|
45
|
+
className: composeRenderProps(
|
|
46
|
+
props.className,
|
|
47
|
+
(className, renderProps) => tabListStyles({ ...renderProps, ...variantProps, className })
|
|
48
|
+
)
|
|
49
|
+
}
|
|
50
|
+
);
|
|
51
|
+
});
|
|
52
|
+
const Tab = forwardRef(function Tab2(originalProps, ref) {
|
|
53
|
+
[originalProps, ref] = useContextProps(
|
|
54
|
+
originalProps,
|
|
55
|
+
ref,
|
|
56
|
+
TabsVariantContext
|
|
57
|
+
);
|
|
58
|
+
const [{ children, startContent, endContent, ...props }, variantProps] = mapPropsVariants(originalProps, tabStyles.variantKeys);
|
|
59
|
+
return /* @__PURE__ */ jsx(
|
|
60
|
+
Tab$1,
|
|
61
|
+
{
|
|
62
|
+
ref,
|
|
63
|
+
...props,
|
|
64
|
+
isDisabled: originalProps.isDisabled,
|
|
65
|
+
className: composeRenderProps(
|
|
66
|
+
props.className,
|
|
67
|
+
(className, renderProps) => tabStyles({ ...renderProps, ...variantProps, className })
|
|
68
|
+
),
|
|
69
|
+
children: (renderProps) => /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
70
|
+
startContent,
|
|
71
|
+
typeof children === "function" ? children(renderProps) : children,
|
|
72
|
+
endContent
|
|
73
|
+
] })
|
|
74
|
+
}
|
|
75
|
+
);
|
|
76
|
+
});
|
|
77
|
+
function TabPanel(props) {
|
|
78
|
+
return /* @__PURE__ */ jsx(
|
|
79
|
+
TabPanel$1,
|
|
80
|
+
{
|
|
81
|
+
...props,
|
|
82
|
+
className: composeRenderProps(
|
|
83
|
+
props.className,
|
|
84
|
+
(className, renderProps) => tabPanelStyles({ ...renderProps, className })
|
|
85
|
+
)
|
|
86
|
+
}
|
|
87
|
+
);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export { Tab, TabList, TabPanel, Tabs, TabsVariantContext, useTabsVariantContext };
|
|
@@ -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.0.0/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,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button.d.ts","sourceRoot":"","sources":["../../../src/button/button.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,IAAI,eAAe,EAAE,MAAM,uBAAuB,CAAA;AAK3E,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAA;AAO9D,MAAM,WAAW,WACf,SAAQ,IAAI,CAAC,eAAe,EAAE,UAAU,CAAC,EACvC,kBAAkB;IACpB;;;OAGG;IACH,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;IACzB;;OAEG;IACH,YAAY,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAC9B;;OAEG;IACH,UAAU,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAC5B;;;OAGG;IACH,OAAO,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAEzB;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAA;IAEpB;;;OAGG;IACH,gBAAgB,CAAC,EAAE,OAAO,GAAG,KAAK,CAAA;IAElC;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAA;CACrB;AAED;;;GAGG;AACH,eAAO,MAAM,MAAM,
|
|
1
|
+
{"version":3,"file":"button.d.ts","sourceRoot":"","sources":["../../../src/button/button.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,IAAI,eAAe,EAAE,MAAM,uBAAuB,CAAA;AAK3E,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAA;AAO9D,MAAM,WAAW,WACf,SAAQ,IAAI,CAAC,eAAe,EAAE,UAAU,CAAC,EACvC,kBAAkB;IACpB;;;OAGG;IACH,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;IACzB;;OAEG;IACH,YAAY,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAC9B;;OAEG;IACH,UAAU,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAC5B;;;OAGG;IACH,OAAO,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAEzB;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAA;IAEpB;;;OAGG;IACH,gBAAgB,CAAC,EAAE,OAAO,GAAG,KAAK,CAAA;IAElC;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAA;CACrB;AAED;;;GAGG;AACH,eAAO,MAAM,MAAM,2GA0ElB,CAAA"}
|