@opengovsg/oui 0.0.11 → 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.
Files changed (61) hide show
  1. package/dist/cjs/button/button.cjs +3 -1
  2. package/dist/cjs/calendar/calendar-month-day-selector.cjs +2 -2
  3. package/dist/cjs/calendar/calendar.cjs +1 -1
  4. package/dist/cjs/combo-box/combo-box.cjs +2 -2
  5. package/dist/cjs/date-field/date-field.cjs +81 -0
  6. package/dist/cjs/date-field/index.cjs +9 -0
  7. package/dist/cjs/date-picker/date-picker.cjs +85 -0
  8. package/dist/cjs/date-picker/index.cjs +8 -0
  9. package/dist/cjs/date-range-picker/date-range-picker.cjs +128 -0
  10. package/dist/cjs/date-range-picker/index.cjs +8 -0
  11. package/dist/cjs/index.cjs +40 -33
  12. package/dist/cjs/menu/menu.cjs +1 -1
  13. 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
  14. package/dist/cjs/range-calendar/range-calendar.cjs +1 -1
  15. package/dist/cjs/select/select.cjs +2 -2
  16. package/dist/cjs/tag-field/tag-field.cjs +3 -3
  17. package/dist/cjs/text-area-field/text-area-field.cjs +1 -1
  18. package/dist/cjs/text-field/text-field.cjs +1 -1
  19. package/dist/esm/button/button.js +3 -1
  20. package/dist/esm/calendar/calendar-month-day-selector.js +2 -2
  21. package/dist/esm/calendar/calendar.js +2 -2
  22. package/dist/esm/combo-box/combo-box.js +2 -2
  23. package/dist/esm/date-field/date-field.js +78 -0
  24. package/dist/esm/date-field/index.js +2 -0
  25. package/dist/esm/date-picker/date-picker.js +83 -0
  26. package/dist/esm/date-picker/index.js +2 -0
  27. package/dist/esm/date-range-picker/date-range-picker.js +126 -0
  28. package/dist/esm/date-range-picker/index.js +2 -0
  29. package/dist/esm/index.js +13 -10
  30. package/dist/esm/menu/menu.js +1 -1
  31. 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
  32. package/dist/esm/range-calendar/range-calendar.js +3 -3
  33. package/dist/esm/select/select.js +2 -2
  34. package/dist/esm/tag-field/tag-field.js +3 -3
  35. package/dist/esm/text-area-field/text-area-field.js +1 -1
  36. package/dist/esm/text-field/text-field.js +1 -1
  37. package/dist/types/button/button.d.ts.map +1 -1
  38. package/dist/types/calendar/calendar.d.ts +2 -3
  39. package/dist/types/calendar/calendar.d.ts.map +1 -1
  40. package/dist/types/calendar/types.d.ts +2 -13
  41. package/dist/types/calendar/types.d.ts.map +1 -1
  42. package/dist/types/date-field/date-field.d.ts +19 -0
  43. package/dist/types/date-field/date-field.d.ts.map +1 -0
  44. package/dist/types/date-field/index.d.ts +2 -0
  45. package/dist/types/date-field/index.d.ts.map +1 -0
  46. package/dist/types/date-picker/date-picker.d.ts +20 -0
  47. package/dist/types/date-picker/date-picker.d.ts.map +1 -0
  48. package/dist/types/date-picker/index.d.ts +2 -0
  49. package/dist/types/date-picker/index.d.ts.map +1 -0
  50. package/dist/types/date-range-picker/date-range-picker.d.ts +19 -0
  51. package/dist/types/date-range-picker/date-range-picker.d.ts.map +1 -0
  52. package/dist/types/date-range-picker/index.d.ts +2 -0
  53. package/dist/types/date-range-picker/index.d.ts.map +1 -0
  54. package/dist/types/index.d.mts +3 -0
  55. package/dist/types/index.d.ts +3 -0
  56. package/dist/types/index.d.ts.map +1 -1
  57. package/dist/types/menu/menu.d.ts +1 -1
  58. package/dist/types/menu/menu.d.ts.map +1 -1
  59. package/dist/types/range-calendar/range-calendar.d.ts +2 -13
  60. package/dist/types/range-calendar/range-calendar.d.ts.map +1 -1
  61. package/package.json +26 -26
@@ -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 { forwardRef, mapPropsVariants } from '../system/utils.js';
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 = forwardRef(function Calendar2(originalProps, ref) {
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,2 @@
1
+ "use strict";
2
+ export { DateField, DateInput } from './date-field.js';
@@ -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,2 @@
1
+ "use strict";
2
+ export { DatePicker } from './date-picker.js';
@@ -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 };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ export { DateRangePicker } from './date-range-picker.js';
package/dist/esm/index.js CHANGED
@@ -1,34 +1,37 @@
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';
12
16
  export { TagFieldItem } from './tag-field/tag-field-item.js';
17
+ export { Select } from './select/select.js';
18
+ export { SelectItem } from './select/select-item.js';
19
+ export { SelectVariantContext, useSelectVariantContext } from './select/select-variant-context.js';
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';
13
23
  export { Tab, TabList, TabPanel, Tabs, TabsVariantContext, useTabsVariantContext } from './tabs/tabs.js';
14
- export { useControllableState } from './hooks/use-controllable-state.js';
24
+ export { DatePicker } from './date-picker/date-picker.js';
25
+ export { DateRangePicker } from './date-range-picker/date-range-picker.js';
15
26
  export { Button } from './button/button.js';
16
- export { GovtBanner } from './govt-banner/govt-banner.js';
17
- export { Input } from './input/input.js';
18
- export { Description, FieldError, FieldGroup, Label } from './field/field.js';
19
27
  export { ComboBox, ComboBoxEmptyState } from './combo-box/combo-box.js';
20
28
  export { ComboBoxFuzzy } from './combo-box/combo-box-fuzzy.js';
21
29
  export { ComboBoxItem } from './combo-box/combo-box-item.js';
22
30
  export { ComboBoxVariantContext, useComboBoxVariantContext } from './combo-box/combo-box-variant-context.js';
23
31
  export { Banner } from './banner/banner.js';
24
- export { Select } from './select/select.js';
25
- export { SelectItem } from './select/select-item.js';
26
- export { SelectVariantContext, useSelectVariantContext } from './select/select-variant-context.js';
27
32
  export { Badge } from './badge/badge.js';
28
33
  export { CalendarDate } from '@internationalized/date';
29
34
  export { Calendar, CalendarStateWrapper } from './calendar/calendar.js';
30
35
  export { CalendarStyleContext, useCalendarStyleContext } from './calendar/calendar-style-context.js';
31
36
  export { getEraFormat, useGenerateLocalizedMonths, useGenerateLocalizedYears, useLocalizedMonthYear } from './calendar/utils.js';
32
- export { RangeCalendar, RangeCalendarCell, RangeCalendarStateWrapper } from './range-calendar/range-calendar.js';
33
- export { Menu, MenuItem, MenuSection, MenuSeparator, MenuTrigger, MenuVariantContext, SubmenuTrigger, useMenuVariantContext } from './menu/menu.js';
34
- export { Popover } from './popover/popover.js';
37
+ export { DateField, DateInput } from './date-field/date-field.js';
@@ -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 { forwardRef, useMemo, useContext } from 'react';
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 = forwardRef(function RangeCalendar2(originalProps, ref) {
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) => {
@@ -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,2GAwElB,CAAA"}
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"}
@@ -1,7 +1,6 @@
1
- import type { ReactElement } from "react";
2
- import { CalendarDate } from "@internationalized/date";
1
+ import type { DateValue } from "react-aria-components";
3
2
  import type { CalendarProps } from "./types";
4
- export declare const Calendar: <T extends CalendarDate>(props: CalendarProps<T>) => ReactElement;
3
+ export declare const Calendar: <T extends DateValue>(props: CalendarProps<T> & import("react").RefAttributes<HTMLDivElement>) => React.ReactNode;
5
4
  export declare const CalendarStateWrapper: ({ children, }: {
6
5
  children: React.ReactNode;
7
6
  }) => import("react/jsx-runtime").JSX.Element;
@@ -1 +1 @@
1
- {"version":3,"file":"calendar.d.ts","sourceRoot":"","sources":["../../../src/calendar/calendar.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAgB,YAAY,EAAE,MAAM,OAAO,CAAA;AAEvD,OAAO,EAAE,YAAY,EAA2B,MAAM,yBAAyB,CAAA;AAe/E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAQ5C,eAAO,MAAM,QAAQ,EA8Hf,CAAC,CAAC,SAAS,YAAY,EAAE,KAAK,EAAE,aAAa,CAAC,CAAC,CAAC,KAAK,YAAY,CAAA;AAEvE,eAAO,MAAM,oBAAoB,kBAE9B;IACD,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAC1B,4CAQA,CAAA"}
1
+ {"version":3,"file":"calendar.d.ts","sourceRoot":"","sources":["../../../src/calendar/calendar.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAA;AAiBtD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAQ5C,eAAO,MAAM,QAAQ,GACnB,CAAC,SAAS,SAAS,8EAqCJ,MAAO,SAuFtB,CAAA;AAEF,eAAO,MAAM,oBAAoB,kBAE9B;IACD,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAC1B,4CAQA,CAAA"}
@@ -1,8 +1,7 @@
1
- import type { CalendarDate } from "@internationalized/date";
2
1
  import type { ReactNode } from "react";
3
- import type { CalendarProps as AriaCalendarProps, CalendarGridProps } from "react-aria-components";
2
+ import type { CalendarProps as AriaCalendarProps, CalendarGridProps, DateValue } from "react-aria-components";
4
3
  import type { CalendarSlots, CalendarVariantProps, SlotsToClasses } from "@opengovsg/oui-theme";
5
- export interface CalendarProps<T extends CalendarDate> extends AriaCalendarProps<T>, CalendarVariantProps, Pick<CalendarGridProps, "weekdayStyle"> {
4
+ export interface CalendarProps<T extends DateValue> extends AriaCalendarProps<T>, CalendarVariantProps, Pick<CalendarGridProps, "weekdayStyle"> {
6
5
  errorMessage?: string;
7
6
  /**
8
7
  * List of classes to change the classNames of the element.
@@ -38,16 +37,6 @@ export interface CalendarProps<T extends CalendarDate> extends AriaCalendarProps
38
37
  * ```
39
38
  */
40
39
  classNames?: SlotsToClasses<CalendarSlots>;
41
- /**
42
- * The minimum allowed date that a user may select.
43
- * @defaultValue `new CalendarDate(1900, 0, 1)`
44
- */
45
- minValue?: T;
46
- /**
47
- * The maximum allowed date that a user may select.
48
- * @defaultValue `new CalendarDate(2100, 12, 31)`
49
- */
50
- maxValue?: T;
51
40
  /**
52
41
  * If provided, there will be a button below the calendar for users to jump to today's date.
53
42
  * @defaultValue `true`
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/calendar/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAA;AAC3D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AACtC,OAAO,KAAK,EACV,aAAa,IAAI,iBAAiB,EAClC,iBAAiB,EAClB,MAAM,uBAAuB,CAAA;AAE9B,OAAO,KAAK,EACV,aAAa,EACb,oBAAoB,EACpB,cAAc,EACf,MAAM,sBAAsB,CAAA;AAE7B,MAAM,WAAW,aAAa,CAAC,CAAC,SAAS,YAAY,CACnD,SAAQ,iBAAiB,CAAC,CAAC,CAAC,EAC1B,oBAAoB,EACpB,IAAI,CAAC,iBAAiB,EAAE,cAAc,CAAC;IACzC,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAgCG;IACH,UAAU,CAAC,EAAE,cAAc,CAAC,aAAa,CAAC,CAAA;IAE1C;;;OAGG;IACH,QAAQ,CAAC,EAAE,CAAC,CAAA;IACZ;;;OAGG;IACH,QAAQ,CAAC,EAAE,CAAC,CAAA;IAEZ;;;;OAIG;IACH,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB,aAAa,CAAC,EAAE,SAAS,CAAA;CAC1B"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/calendar/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AACtC,OAAO,KAAK,EACV,aAAa,IAAI,iBAAiB,EAClC,iBAAiB,EACjB,SAAS,EACV,MAAM,uBAAuB,CAAA;AAE9B,OAAO,KAAK,EACV,aAAa,EACb,oBAAoB,EACpB,cAAc,EACf,MAAM,sBAAsB,CAAA;AAE7B,MAAM,WAAW,aAAa,CAAC,CAAC,SAAS,SAAS,CAChD,SAAQ,iBAAiB,CAAC,CAAC,CAAC,EAC1B,oBAAoB,EACpB,IAAI,CAAC,iBAAiB,EAAE,cAAc,CAAC;IACzC,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAgCG;IACH,UAAU,CAAC,EAAE,cAAc,CAAC,aAAa,CAAC,CAAA;IAE1C;;;;OAIG;IACH,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB,aAAa,CAAC,EAAE,SAAS,CAAA;CAC1B"}
@@ -0,0 +1,19 @@
1
+ import type { DateFieldProps as AriaDateFieldProps, DateInputProps as AriaDateInputProps, DateValue, ValidationResult } from "react-aria-components";
2
+ import type { DateInputSlots, SlotsToClasses, VariantProps } from "@opengovsg/oui-theme";
3
+ import { dateFieldStyles, dateInputStyles } from "@opengovsg/oui-theme";
4
+ interface DateFieldProps<T extends DateValue> extends AriaDateFieldProps<T>, VariantProps<typeof dateFieldStyles> {
5
+ label?: string;
6
+ description?: string;
7
+ errorMessage?: string | ((validation: ValidationResult) => string);
8
+ classNames?: SlotsToClasses<"base" | "label" | "input" | "description" | "error">;
9
+ }
10
+ export declare function DateField<T extends DateValue>(originalProps: DateFieldProps<T>): import("react/jsx-runtime").JSX.Element;
11
+ interface DateInputProps extends Omit<AriaDateInputProps, "children">, VariantProps<typeof dateInputStyles> {
12
+ label?: string;
13
+ description?: string;
14
+ errorMessage?: string | ((validation: ValidationResult) => string);
15
+ classNames?: SlotsToClasses<DateInputSlots>;
16
+ }
17
+ export declare function DateInput(originalProps: DateInputProps): import("react/jsx-runtime").JSX.Element;
18
+ export {};
19
+ //# sourceMappingURL=date-field.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"date-field.d.ts","sourceRoot":"","sources":["../../../src/date-field/date-field.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,cAAc,IAAI,kBAAkB,EACpC,cAAc,IAAI,kBAAkB,EACpC,SAAS,EACT,gBAAgB,EACjB,MAAM,uBAAuB,CAAA;AAQ9B,OAAO,KAAK,EACV,cAAc,EACd,cAAc,EACd,YAAY,EACb,MAAM,sBAAsB,CAAA;AAC7B,OAAO,EAGL,eAAe,EACf,eAAe,EAChB,MAAM,sBAAsB,CAAA;AAK7B,UAAU,cAAc,CAAC,CAAC,SAAS,SAAS,CAC1C,SAAQ,kBAAkB,CAAC,CAAC,CAAC,EAC3B,YAAY,CAAC,OAAO,eAAe,CAAC;IACtC,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,YAAY,CAAC,EAAE,MAAM,GAAG,CAAC,CAAC,UAAU,EAAE,gBAAgB,KAAK,MAAM,CAAC,CAAA;IAClE,UAAU,CAAC,EAAE,cAAc,CACzB,MAAM,GAAG,OAAO,GAAG,OAAO,GAAG,aAAa,GAAG,OAAO,CACrD,CAAA;CACF;AAED,wBAAgB,SAAS,CAAC,CAAC,SAAS,SAAS,EAC3C,aAAa,EAAE,cAAc,CAAC,CAAC,CAAC,2CA2CjC;AAED,UAAU,cACR,SAAQ,IAAI,CAAC,kBAAkB,EAAE,UAAU,CAAC,EAC1C,YAAY,CAAC,OAAO,eAAe,CAAC;IACtC,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,YAAY,CAAC,EAAE,MAAM,GAAG,CAAC,CAAC,UAAU,EAAE,gBAAgB,KAAK,MAAM,CAAC,CAAA;IAClE,UAAU,CAAC,EAAE,cAAc,CAAC,cAAc,CAAC,CAAA;CAC5C;AAED,wBAAgB,SAAS,CAAC,aAAa,EAAE,cAAc,2CA8BtD"}
@@ -0,0 +1,2 @@
1
+ export * from "./date-field";
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/date-field/index.tsx"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAA"}
@@ -0,0 +1,20 @@
1
+ import type { DatePickerProps as AriaDatePickerProps, DateValue, ValidationResult } from "react-aria-components";
2
+ import type { CalendarSlots, DatePickerSlots, SlotsToClasses, VariantProps } from "@opengovsg/oui-theme";
3
+ import { datePickerStyles } from "@opengovsg/oui-theme";
4
+ import type { ButtonProps } from "../button";
5
+ import type { CalendarProps } from "../calendar";
6
+ import type { PopoverProps } from "../popover";
7
+ interface DatePickerProps<T extends DateValue> extends VariantProps<typeof datePickerStyles>, AriaDatePickerProps<T> {
8
+ label?: string;
9
+ description?: string;
10
+ errorMessage?: string | ((validation: ValidationResult) => string);
11
+ calendarProps?: CalendarProps<T>;
12
+ popoverProps?: PopoverProps;
13
+ calendarButtonProps?: ButtonProps;
14
+ classNames?: SlotsToClasses<DatePickerSlots> & {
15
+ calendar?: SlotsToClasses<CalendarSlots>;
16
+ };
17
+ }
18
+ export declare function DatePicker<T extends DateValue>(originalProps: DatePickerProps<T>): import("react/jsx-runtime").JSX.Element;
19
+ export {};
20
+ //# sourceMappingURL=date-picker.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"date-picker.d.ts","sourceRoot":"","sources":["../../../src/date-picker/date-picker.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,eAAe,IAAI,mBAAmB,EACtC,SAAS,EACT,gBAAgB,EACjB,MAAM,uBAAuB,CAAA;AAK9B,OAAO,KAAK,EACV,aAAa,EACb,eAAe,EACf,cAAc,EACd,YAAY,EACb,MAAM,sBAAsB,CAAA;AAC7B,OAAO,EAEL,gBAAgB,EACjB,MAAM,sBAAsB,CAAA;AAE7B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAA;AAC5C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAChD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AAQ9C,UAAU,eAAe,CAAC,CAAC,SAAS,SAAS,CAC3C,SAAQ,YAAY,CAAC,OAAO,gBAAgB,CAAC,EAC3C,mBAAmB,CAAC,CAAC,CAAC;IACxB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,YAAY,CAAC,EAAE,MAAM,GAAG,CAAC,CAAC,UAAU,EAAE,gBAAgB,KAAK,MAAM,CAAC,CAAA;IAClE,aAAa,CAAC,EAAE,aAAa,CAAC,CAAC,CAAC,CAAA;IAChC,YAAY,CAAC,EAAE,YAAY,CAAA;IAC3B,mBAAmB,CAAC,EAAE,WAAW,CAAA;IACjC,UAAU,CAAC,EAAE,cAAc,CAAC,eAAe,CAAC,GAAG;QAC7C,QAAQ,CAAC,EAAE,cAAc,CAAC,aAAa,CAAC,CAAA;KACzC,CAAA;CACF;AAED,wBAAgB,UAAU,CAAC,CAAC,SAAS,SAAS,EAC5C,aAAa,EAAE,eAAe,CAAC,CAAC,CAAC,2CAgElC"}
@@ -0,0 +1,2 @@
1
+ export * from "./date-picker";
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/date-picker/index.tsx"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAA"}