@opengovsg/oui 0.0.11 → 0.0.13

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 (67) 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/govt-banner/govt-banner.cjs +24 -59
  12. package/dist/cjs/index.cjs +40 -33
  13. package/dist/cjs/menu/menu.cjs +1 -1
  14. 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
  15. package/dist/cjs/range-calendar/range-calendar.cjs +1 -1
  16. package/dist/cjs/select/select.cjs +2 -2
  17. package/dist/cjs/tag-field/tag-field.cjs +3 -3
  18. package/dist/cjs/text-area-field/text-area-field.cjs +1 -1
  19. package/dist/cjs/text-field/text-field.cjs +1 -1
  20. package/dist/esm/button/button.js +3 -1
  21. package/dist/esm/calendar/calendar-month-day-selector.js +2 -2
  22. package/dist/esm/calendar/calendar.js +2 -2
  23. package/dist/esm/combo-box/combo-box.js +2 -2
  24. package/dist/esm/date-field/date-field.js +78 -0
  25. package/dist/esm/date-field/index.js +2 -0
  26. package/dist/esm/date-picker/date-picker.js +83 -0
  27. package/dist/esm/date-picker/index.js +2 -0
  28. package/dist/esm/date-range-picker/date-range-picker.js +126 -0
  29. package/dist/esm/date-range-picker/index.js +2 -0
  30. package/dist/esm/govt-banner/govt-banner.js +25 -60
  31. package/dist/esm/index.js +13 -10
  32. package/dist/esm/menu/menu.js +1 -1
  33. 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
  34. package/dist/esm/range-calendar/range-calendar.js +3 -3
  35. package/dist/esm/select/select.js +2 -2
  36. package/dist/esm/tag-field/tag-field.js +3 -3
  37. package/dist/esm/text-area-field/text-area-field.js +1 -1
  38. package/dist/esm/text-field/text-field.js +1 -1
  39. package/dist/types/badge/use-badge.d.ts +7 -48
  40. package/dist/types/badge/use-badge.d.ts.map +1 -1
  41. package/dist/types/button/button.d.ts.map +1 -1
  42. package/dist/types/calendar/calendar.d.ts +2 -3
  43. package/dist/types/calendar/calendar.d.ts.map +1 -1
  44. package/dist/types/calendar/types.d.ts +2 -13
  45. package/dist/types/calendar/types.d.ts.map +1 -1
  46. package/dist/types/date-field/date-field.d.ts +19 -0
  47. package/dist/types/date-field/date-field.d.ts.map +1 -0
  48. package/dist/types/date-field/index.d.ts +2 -0
  49. package/dist/types/date-field/index.d.ts.map +1 -0
  50. package/dist/types/date-picker/date-picker.d.ts +20 -0
  51. package/dist/types/date-picker/date-picker.d.ts.map +1 -0
  52. package/dist/types/date-picker/index.d.ts +2 -0
  53. package/dist/types/date-picker/index.d.ts.map +1 -0
  54. package/dist/types/date-range-picker/date-range-picker.d.ts +19 -0
  55. package/dist/types/date-range-picker/date-range-picker.d.ts.map +1 -0
  56. package/dist/types/date-range-picker/index.d.ts +2 -0
  57. package/dist/types/date-range-picker/index.d.ts.map +1 -0
  58. package/dist/types/govt-banner/govt-banner.d.ts.map +1 -1
  59. package/dist/types/index.d.mts +3 -0
  60. package/dist/types/index.d.ts +3 -0
  61. package/dist/types/index.d.ts.map +1 -1
  62. package/dist/types/menu/menu.d.ts +1 -1
  63. package/dist/types/menu/menu.d.ts.map +1 -1
  64. package/dist/types/range-calendar/range-calendar.d.ts +2 -13
  65. package/dist/types/range-calendar/range-calendar.d.ts.map +1 -1
  66. package/dist/types/spinner/use-spinner.d.ts +8 -8
  67. package/package.json +28 -28
@@ -6,11 +6,11 @@ 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 popover = require('../popover/popover.cjs');
9
10
  var utils = require('../system/utils.cjs');
10
11
  var check = require('../node_modules/.pnpm/lucide-react@0.475.0_react@19.0.0/node_modules/lucide-react/dist/esm/icons/check.cjs');
11
12
  var chevronRight = require('../node_modules/.pnpm/lucide-react@0.475.0_react@19.0.0/node_modules/lucide-react/dist/esm/icons/chevron-right.cjs');
12
13
  var context = require('../system/react-utils/context.cjs');
13
- var popover = require('../popover/popover.cjs');
14
14
 
15
15
  const [MenuVariantContext, useMenuVariantContext] = context.createContext({
16
16
  name: "MenuVariantContext",
@@ -0,0 +1,24 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var createLucideIcon = require('../createLucideIcon.cjs');
6
+
7
+ /**
8
+ * @license lucide-react v0.475.0 - ISC
9
+ *
10
+ * This source code is licensed under the ISC license.
11
+ * See the LICENSE file in the root directory of this source tree.
12
+ */
13
+
14
+
15
+ const __iconNode = [
16
+ ["path", { d: "M8 2v4", key: "1cmpym" }],
17
+ ["path", { d: "M16 2v4", key: "4m81vk" }],
18
+ ["rect", { width: "18", height: "18", x: "3", y: "4", rx: "2", key: "1hopcy" }],
19
+ ["path", { d: "M3 10h18", key: "8toen8" }]
20
+ ];
21
+ const Calendar = createLucideIcon.default("Calendar", __iconNode);
22
+
23
+ exports.__iconNode = __iconNode;
24
+ exports.default = Calendar;
@@ -15,7 +15,7 @@ var calendarHeader = require('../calendar/calendar-header.cjs');
15
15
  var utils = require('../system/utils.cjs');
16
16
  var calendarStyleContext = require('../calendar/calendar-style-context.cjs');
17
17
 
18
- const RangeCalendar = react.forwardRef(function RangeCalendar2(originalProps, ref) {
18
+ const RangeCalendar = utils.forwardRefGeneric(function RangeCalendar2(originalProps, ref) {
19
19
  const [props, variantProps] = utils.mapPropsVariants(
20
20
  originalProps,
21
21
  ouiTheme.calendarStyles.variantKeys
@@ -6,11 +6,11 @@ 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 popover = require('../popover/popover.cjs');
9
11
  var utils = require('../system/utils.cjs');
10
12
  var selectVariantContext = require('./select-variant-context.cjs');
11
- var field = require('../field/field.cjs');
12
13
  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');
13
- var popover = require('../popover/popover.cjs');
14
14
  var button = require('../button/button.cjs');
15
15
 
16
16
  const calculateEstimatedRowHeight = (size) => {
@@ -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,
@@ -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 = () => {
@@ -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';
@@ -2,7 +2,7 @@
2
2
  "use client";
3
3
  import { jsxs, jsx } from 'react/jsx-runtime';
4
4
  import { useRef } from 'react';
5
- import { useMessageFormatter, useDisclosure, useButton, useFocusRing, mergeProps } from 'react-aria';
5
+ import { useDisclosure, useButton, useFocusRing, mergeProps } from 'react-aria';
6
6
  import { useDisclosureState } from 'react-stately';
7
7
  import { govtBannerStyles, dataAttr, twMerge } from '@opengovsg/oui-theme';
8
8
  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';
@@ -10,54 +10,11 @@ import Landmark from '../node_modules/.pnpm/lucide-react@0.475.0_react@19.0.0/no
10
10
  import ExternalLink from '../node_modules/.pnpm/lucide-react@0.475.0_react@19.0.0/node_modules/lucide-react/dist/esm/icons/external-link.js';
11
11
  import Lock from '../node_modules/.pnpm/lucide-react@0.475.0_react@19.0.0/node_modules/lucide-react/dist/esm/icons/lock.js';
12
12
 
13
- const i18nStrings = {
14
- "en-SG": {
15
- mainLabel: "A Singapore Government Agency Website",
16
- identifyLabel: "How to identify",
17
- environmentLabel: "[NOTE: THIS IS A {environment} WEBSITE]",
18
- officialLinkHeader: "Official website links end with .gov.sg",
19
- officialLinkContent: "Government agencies communicate via <boldThis>.gov.sg</boldThis> websites (e.g. go.gov.sg/open).",
20
- officialLinkTrusted: "Trusted websites",
21
- secureHeader: "Secure websites use HTTPS",
22
- secureContent: "Look for a <boldThis>lock</boldThis> {icon} or https:// as an added precaution. Share sensitive information only on official, secure websites."
23
- },
24
- "zh-SG": {
25
- mainLabel: "A Singapore Government Agency Website",
26
- identifyLabel: "How to identify",
27
- environmentLabel: "[NOTE: THIS IS A {environment} WEBSITE]",
28
- officialLinkHeader: "Official website links end with .gov.sg",
29
- officialLinkContent: "Government agencies communicate via <boldThis>.gov.sg</boldThis> websites (e.g. go.gov.sg/open).",
30
- officialLinkTrusted: "Trusted websites",
31
- secureHeader: "Secure websites use HTTPS",
32
- secureContent: "Look for a <boldThis>lock</boldThis> {icon} or https:// as an added precaution. Share sensitive information only on official, secure websites."
33
- },
34
- "ms-SG": {
35
- mainLabel: "A Singapore Government Agency Website",
36
- identifyLabel: "How to identify",
37
- environmentLabel: "[NOTE: THIS IS A {environment} WEBSITE]",
38
- officialLinkHeader: "Official website links end with .gov.sg",
39
- officialLinkContent: "Government agencies communicate via <boldThis>.gov.sg</boldThis> websites (e.g. go.gov.sg/open).",
40
- officialLinkTrusted: "Trusted websites",
41
- secureHeader: "Secure websites use HTTPS",
42
- secureContent: "Look for a <boldThis>lock</boldThis> {icon} or https:// as an added precaution. Share sensitive information only on official, secure websites."
43
- },
44
- "ta-SG": {
45
- mainLabel: "A Singapore Government Agency Website",
46
- identifyLabel: "How to identify",
47
- environmentLabel: "[NOTE: THIS IS A {environment} WEBSITE]",
48
- officialLinkHeader: "Official website links end with .gov.sg",
49
- officialLinkContent: "Government agencies communicate via <boldThis>.gov.sg</boldThis> websites (e.g. go.gov.sg/open).",
50
- officialLinkTrusted: "Trusted websites",
51
- secureHeader: "Secure websites use HTTPS",
52
- secureContent: "Look for a <boldThis>lock</boldThis> {icon} or https:// as an added precaution. Share sensitive information only on official, secure websites."
53
- }
54
- };
55
13
  function GovtBanner({
56
14
  environment,
57
15
  classNames,
58
16
  ...props
59
17
  }) {
60
- const formatMessage = useMessageFormatter(i18nStrings);
61
18
  const state = useDisclosureState(props);
62
19
  const panelRef = useRef(null);
63
20
  const triggerRef = useRef(null);
@@ -104,10 +61,12 @@ function GovtBanner({
104
61
  {
105
62
  className: slots.mainContent({ className: classNames?.mainContent }),
106
63
  children: [
107
- /* @__PURE__ */ jsx("span", { children: formatMessage("mainLabel") }),
108
- environment ? /* @__PURE__ */ jsx("b", { children: formatMessage("environmentLabel", {
109
- environment: environment.toUpperCase()
110
- }) }) : null,
64
+ /* @__PURE__ */ jsx("span", { children: "A Singapore Government Agency Website" }),
65
+ environment ? /* @__PURE__ */ jsxs("b", { children: [
66
+ "[NOTE: THIS IS A ",
67
+ environment.toUpperCase(),
68
+ " WEBSITE]"
69
+ ] }) : null,
111
70
  /* @__PURE__ */ jsxs(
112
71
  "button",
113
72
  {
@@ -119,7 +78,7 @@ function GovtBanner({
119
78
  type: "button",
120
79
  ...mergeProps(buttonProps, focusProps),
121
80
  children: [
122
- /* @__PURE__ */ jsx("span", { className: slots.link({ className: classNames?.link }), children: formatMessage("identifyLabel") }),
81
+ /* @__PURE__ */ jsx("span", { className: slots.link({ className: classNames?.link }), children: "How to identify" }),
123
82
  /* @__PURE__ */ jsx(
124
83
  ChevronDown,
125
84
  {
@@ -162,13 +121,13 @@ function GovtBanner({
162
121
  className: slots.panelHeader({
163
122
  className: classNames?.panelHeader
164
123
  }),
165
- children: formatMessage("officialLinkHeader")
124
+ children: "Official website links end with .gov.sg"
166
125
  }
167
126
  ),
168
127
  /* @__PURE__ */ jsxs("article", { children: [
169
- formatMessage("officialLinkContent", {
170
- boldThis: (content) => /* @__PURE__ */ jsx("b", { children: content })
171
- }),
128
+ "Government agencies communicate via ",
129
+ /* @__PURE__ */ jsx("b", { children: ".gov.sg" }),
130
+ " websites (e.g. go.gov.sg/open).",
172
131
  " ",
173
132
  /* @__PURE__ */ jsxs(
174
133
  "a",
@@ -178,7 +137,7 @@ function GovtBanner({
178
137
  rel: "noreferrer",
179
138
  target: "_blank",
180
139
  children: [
181
- formatMessage("officialLinkTrusted", {}),
140
+ "Trusted websites",
182
141
  /* @__PURE__ */ jsx(
183
142
  ExternalLink,
184
143
  {
@@ -224,12 +183,14 @@ function GovtBanner({
224
183
  className: slots.panelHeader({
225
184
  className: classNames?.panelHeader
226
185
  }),
227
- children: formatMessage("secureHeader")
186
+ children: "Secure websites use HTTPS"
228
187
  }
229
188
  ),
230
- /* @__PURE__ */ jsx("article", { children: formatMessage("secureContent", {
231
- boldThis: (content) => /* @__PURE__ */ jsx("b", { children: content }),
232
- icon: /* @__PURE__ */ jsxs("span", { "aria-hidden": true, children: [
189
+ /* @__PURE__ */ jsxs("article", { children: [
190
+ "Look for a ",
191
+ /* @__PURE__ */ jsx("b", { children: "lock" }),
192
+ " ",
193
+ /* @__PURE__ */ jsxs("span", { "aria-hidden": true, children: [
233
194
  "(",
234
195
  /* @__PURE__ */ jsx(
235
196
  Lock,
@@ -240,8 +201,12 @@ function GovtBanner({
240
201
  }
241
202
  ),
242
203
  ")"
243
- ] })
244
- }) })
204
+ ] }),
205
+ " ",
206
+ "or ",
207
+ /* @__PURE__ */ jsx("b", { children: "https://" }),
208
+ " as an added precaution. Share sensitive information only on official, secure websites."
209
+ ] })
245
210
  ]
246
211
  }
247
212
  )