@opengovsg/oui 0.0.17 → 0.0.19

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.
@@ -12,11 +12,19 @@ var useCalendarI18n = require('./hooks/use-calendar-i18n.cjs');
12
12
 
13
13
  const CalendarBottomContent = ({
14
14
  bottomContent,
15
- showTodayButton
15
+ showTodayButton,
16
+ shouldSetDateOnTodayButtonClick
16
17
  }) => {
17
18
  const state = $670gB$react.useContext(agnosticCalendarStateContext.AgnosticCalendarStateContext);
18
19
  const { slots, classNames, size } = calendarStyleContext.useCalendarStyleContext();
19
20
  const formatMessage = useCalendarI18n.useCalendarI18n();
21
+ const handleTodayClick = $670gB$react.useCallback(() => {
22
+ const todayDate = date.today(date.getLocalTimeZone());
23
+ state.setFocusedDate(todayDate);
24
+ if (shouldSetDateOnTodayButtonClick) {
25
+ state.selectDate(todayDate);
26
+ }
27
+ }, [shouldSetDateOnTodayButtonClick, state]);
20
28
  if (bottomContent) {
21
29
  return bottomContent;
22
30
  }
@@ -38,9 +46,7 @@ const CalendarBottomContent = ({
38
46
  size,
39
47
  slot: null,
40
48
  className: slots.todayButton({ className: classNames?.todayButton }),
41
- onPress: () => {
42
- state.setFocusedDate(date.today(date.getLocalTimeZone()));
43
- },
49
+ onPress: handleTodayClick,
44
50
  children: formatMessage("today")
45
51
  }
46
52
  )
@@ -28,6 +28,7 @@ const Calendar = utils.forwardRefGeneric(function Calendar2(originalProps, ref)
28
28
  maxValue = new date.CalendarDate(2100, 12, 31),
29
29
  bottomContent,
30
30
  showTodayButton = true,
31
+ shouldSetDateOnTodayButtonClick,
31
32
  errorMessage,
32
33
  ...restProps
33
34
  } = props;
@@ -126,7 +127,8 @@ const Calendar = utils.forwardRefGeneric(function Calendar2(originalProps, ref)
126
127
  calendarBottomContent.CalendarBottomContent,
127
128
  {
128
129
  bottomContent,
129
- showTodayButton
130
+ showTodayButton,
131
+ shouldSetDateOnTodayButtonClick
130
132
  }
131
133
  )
132
134
  ] }) }),
@@ -75,6 +75,7 @@ function ComboBox(originalProps) {
75
75
  dependencies,
76
76
  onClear,
77
77
  renderEmptyState: renderEmptyStateProp,
78
+ inputProps,
78
79
  ...props
79
80
  } = _props;
80
81
  const styles = ouiTheme.comboBoxStyles(variantProps);
@@ -135,7 +136,8 @@ function ComboBox(originalProps) {
135
136
  className: ouiTheme.composeRenderProps(
136
137
  classNames?.field,
137
138
  (className, renderProps) => styles.field({ ...renderProps, className })
138
- )
139
+ ),
140
+ ...inputProps
139
141
  }
140
142
  ),
141
143
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -28,6 +28,7 @@ const RangeCalendar = utils.forwardRefGeneric(function RangeCalendar2(originalPr
28
28
  maxValue = new date.CalendarDate(2100, 12, 31),
29
29
  bottomContent,
30
30
  showTodayButton = true,
31
+ shouldSetDateOnTodayButtonClick,
31
32
  errorMessage,
32
33
  ...restProps
33
34
  } = props;
@@ -117,7 +118,8 @@ const RangeCalendar = utils.forwardRefGeneric(function RangeCalendar2(originalPr
117
118
  calendarBottomContent.CalendarBottomContent,
118
119
  {
119
120
  bottomContent,
120
- showTodayButton
121
+ showTodayButton,
122
+ shouldSetDateOnTodayButtonClick
121
123
  }
122
124
  )
123
125
  ] }) }),
@@ -13,6 +13,7 @@ const Toggle = ({
13
13
  children,
14
14
  classNames,
15
15
  thumbIcon,
16
+ labelPlacement = "end",
16
17
  ...originalProps
17
18
  }) => {
18
19
  const [props, variantProps] = utils.mapPropsVariants(
@@ -38,8 +39,9 @@ const Toggle = ({
38
39
  slots.base()
39
40
  ),
40
41
  children: (renderProps) => /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
42
+ labelPlacement === "start" ? children : null,
41
43
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: slots.track({ className: classNames?.track }), children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: slots.thumb({ className: classNames?.thumb }), children: thumbIcon && clonedThumbIcon(renderProps) }) }),
42
- children
44
+ labelPlacement === "end" ? children : null
43
45
  ] })
44
46
  }
45
47
  );
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  "use client";
3
3
  import { jsx } from 'react/jsx-runtime';
4
- import { useContext } from 'react';
4
+ import { useContext, useCallback } from 'react';
5
5
  import { today, getLocalTimeZone } from '@internationalized/date';
6
6
  import { Button } from '../button/button.js';
7
7
  import { AgnosticCalendarStateContext } from './agnostic-calendar-state-context.js';
@@ -10,11 +10,19 @@ import { useCalendarI18n } from './hooks/use-calendar-i18n.js';
10
10
 
11
11
  const CalendarBottomContent = ({
12
12
  bottomContent,
13
- showTodayButton
13
+ showTodayButton,
14
+ shouldSetDateOnTodayButtonClick
14
15
  }) => {
15
16
  const state = useContext(AgnosticCalendarStateContext);
16
17
  const { slots, classNames, size } = useCalendarStyleContext();
17
18
  const formatMessage = useCalendarI18n();
19
+ const handleTodayClick = useCallback(() => {
20
+ const todayDate = today(getLocalTimeZone());
21
+ state.setFocusedDate(todayDate);
22
+ if (shouldSetDateOnTodayButtonClick) {
23
+ state.selectDate(todayDate);
24
+ }
25
+ }, [shouldSetDateOnTodayButtonClick, state]);
18
26
  if (bottomContent) {
19
27
  return bottomContent;
20
28
  }
@@ -36,9 +44,7 @@ const CalendarBottomContent = ({
36
44
  size,
37
45
  slot: null,
38
46
  className: slots.todayButton({ className: classNames?.todayButton }),
39
- onPress: () => {
40
- state.setFocusedDate(today(getLocalTimeZone()));
41
- },
47
+ onPress: handleTodayClick,
42
48
  children: formatMessage("today")
43
49
  }
44
50
  )
@@ -26,6 +26,7 @@ const Calendar = forwardRefGeneric(function Calendar2(originalProps, ref) {
26
26
  maxValue = new CalendarDate(2100, 12, 31),
27
27
  bottomContent,
28
28
  showTodayButton = true,
29
+ shouldSetDateOnTodayButtonClick,
29
30
  errorMessage,
30
31
  ...restProps
31
32
  } = props;
@@ -124,7 +125,8 @@ const Calendar = forwardRefGeneric(function Calendar2(originalProps, ref) {
124
125
  CalendarBottomContent,
125
126
  {
126
127
  bottomContent,
127
- showTodayButton
128
+ showTodayButton,
129
+ shouldSetDateOnTodayButtonClick
128
130
  }
129
131
  )
130
132
  ] }) }),
@@ -73,6 +73,7 @@ function ComboBox(originalProps) {
73
73
  dependencies,
74
74
  onClear,
75
75
  renderEmptyState: renderEmptyStateProp,
76
+ inputProps,
76
77
  ...props
77
78
  } = _props;
78
79
  const styles = comboBoxStyles(variantProps);
@@ -133,7 +134,8 @@ function ComboBox(originalProps) {
133
134
  className: composeRenderProps(
134
135
  classNames?.field,
135
136
  (className, renderProps) => styles.field({ ...renderProps, className })
136
- )
137
+ ),
138
+ ...inputProps
137
139
  }
138
140
  ),
139
141
  /* @__PURE__ */ jsx(
@@ -26,6 +26,7 @@ const RangeCalendar = forwardRefGeneric(function RangeCalendar2(originalProps, r
26
26
  maxValue = new CalendarDate(2100, 12, 31),
27
27
  bottomContent,
28
28
  showTodayButton = true,
29
+ shouldSetDateOnTodayButtonClick,
29
30
  errorMessage,
30
31
  ...restProps
31
32
  } = props;
@@ -115,7 +116,8 @@ const RangeCalendar = forwardRefGeneric(function RangeCalendar2(originalProps, r
115
116
  CalendarBottomContent,
116
117
  {
117
118
  bottomContent,
118
- showTodayButton
119
+ showTodayButton,
120
+ shouldSetDateOnTodayButtonClick
119
121
  }
120
122
  )
121
123
  ] }) }),
@@ -11,6 +11,7 @@ const Toggle = ({
11
11
  children,
12
12
  classNames,
13
13
  thumbIcon,
14
+ labelPlacement = "end",
14
15
  ...originalProps
15
16
  }) => {
16
17
  const [props, variantProps] = mapPropsVariants(
@@ -36,8 +37,9 @@ const Toggle = ({
36
37
  slots.base()
37
38
  ),
38
39
  children: (renderProps) => /* @__PURE__ */ jsxs(Fragment, { children: [
40
+ labelPlacement === "start" ? children : null,
39
41
  /* @__PURE__ */ jsx("div", { className: slots.track({ className: classNames?.track }), children: /* @__PURE__ */ jsx("span", { className: slots.thumb({ className: classNames?.thumb }), children: thumbIcon && clonedThumbIcon(renderProps) }) }),
40
- children
42
+ labelPlacement === "end" ? children : null
41
43
  ] })
42
44
  }
43
45
  );
@@ -1,4 +1,6 @@
1
1
  import type { CalendarDate } from "@internationalized/date";
2
2
  import type { CalendarProps } from "./types";
3
- export declare const CalendarBottomContent: <T extends CalendarDate>({ bottomContent, showTodayButton, }: Pick<CalendarProps<T>, "bottomContent" | "showTodayButton">) => string | number | bigint | true | Iterable<import("react").ReactNode> | Promise<string | number | bigint | boolean | import("react").ReactPortal | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<import("react").ReactNode> | null | undefined> | import("react/jsx-runtime").JSX.Element | null;
3
+ type CalendarBottomContentProps<T extends CalendarDate> = Pick<CalendarProps<T>, "bottomContent" | "showTodayButton" | "shouldSetDateOnTodayButtonClick">;
4
+ export declare const CalendarBottomContent: <T extends CalendarDate>({ bottomContent, showTodayButton, shouldSetDateOnTodayButtonClick, }: CalendarBottomContentProps<T>) => string | number | bigint | true | Iterable<import("react").ReactNode> | Promise<string | number | bigint | boolean | import("react").ReactPortal | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<import("react").ReactNode> | null | undefined> | import("react/jsx-runtime").JSX.Element | null;
5
+ export {};
4
6
  //# sourceMappingURL=calendar-bottom-content.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"calendar-bottom-content.d.ts","sourceRoot":"","sources":["../../../src/calendar/calendar-bottom-content.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAA;AAI3D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAM5C,eAAO,MAAM,qBAAqB,GAAI,CAAC,SAAS,YAAY,uCAGzD,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,EAAE,eAAe,GAAG,iBAAiB,CAAC,6VAkC7D,CAAA"}
1
+ {"version":3,"file":"calendar-bottom-content.d.ts","sourceRoot":"","sources":["../../../src/calendar/calendar-bottom-content.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAA;AAI3D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAM5C,KAAK,0BAA0B,CAAC,CAAC,SAAS,YAAY,IAAI,IAAI,CAC5D,aAAa,CAAC,CAAC,CAAC,EAChB,eAAe,GAAG,iBAAiB,GAAG,iCAAiC,CACxE,CAAA;AAED,eAAO,MAAM,qBAAqB,GAAI,CAAC,SAAS,YAAY,wEAIzD,0BAA0B,CAAC,CAAC,CAAC,6VAwC/B,CAAA"}
@@ -1 +1 @@
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
+ {"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,8EAqCC,MAAO,SAyF3B,CAAA;AAEF,eAAO,MAAM,oBAAoB,kBAE9B;IACD,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAC1B,4CAQA,CAAA"}
@@ -43,6 +43,11 @@ export interface CalendarProps<T extends DateValue> extends AriaCalendarProps<T>
43
43
  * If `bottomContent is provided, this will be ignored.
44
44
  */
45
45
  showTodayButton?: boolean;
46
+ /**
47
+ * If `true`, clicking on the "Today" button will set the selected date to today.
48
+ * If `false`, it will only move the focus to today's date without changing the selected date.
49
+ */
50
+ shouldSetDateOnTodayButtonClick?: boolean;
46
51
  bottomContent?: ReactNode;
47
52
  }
48
53
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
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"}
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;;;OAGG;IACH,+BAA+B,CAAC,EAAE,OAAO,CAAA;IACzC,aAAa,CAAC,EAAE,SAAS,CAAA;CAC1B"}
@@ -1,4 +1,4 @@
1
- import type { ComboBoxProps as AriaComboBoxProps, ListBoxProps, ListLayoutOptions, ValidationResult } from "react-aria-components";
1
+ import type { ComboBoxProps as AriaComboBoxProps, InputProps, ListBoxProps, ListLayoutOptions, ValidationResult } from "react-aria-components";
2
2
  import type { ComboBoxSlots, ComboBoxVariantProps, SlotsToClasses } from "@opengovsg/oui-theme";
3
3
  export interface ComboBoxProps<T extends object> extends ComboBoxVariantProps, Omit<AriaComboBoxProps<T>, "children"> {
4
4
  label?: React.ReactNode;
@@ -26,6 +26,7 @@ export interface ComboBoxProps<T extends object> extends ComboBoxVariantProps, O
26
26
  onClear?: () => void;
27
27
  renderEmptyState?: ListBoxProps<T>["renderEmptyState"];
28
28
  children?: ListBoxProps<T>["children"];
29
+ inputProps?: Partial<InputProps>;
29
30
  }
30
31
  export declare function ComboBoxEmptyState({ size, className, }: Pick<ComboBoxVariantProps, "size"> & {
31
32
  className?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"combo-box.d.ts","sourceRoot":"","sources":["../../../src/combo-box/combo-box.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,aAAa,IAAI,iBAAiB,EAClC,YAAY,EAEZ,iBAAiB,EACjB,gBAAgB,EACjB,MAAM,uBAAuB,CAAA;AAc9B,OAAO,KAAK,EACV,aAAa,EACb,oBAAoB,EAC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;CACjC;AAkCD,wBAAgB,kBAAkB,CAAC,EACjC,IAAI,EACJ,SAAS,GACV,EAAE,IAAI,CAAC,oBAAoB,EAAE,MAAM,CAAC,GAAG;IAAE,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,2CAY7D;AAED,wBAAgB,QAAQ,CAAC,CAAC,SAAS,MAAM,EAAE,aAAa,EAAE,aAAa,CAAC,CAAC,CAAC,2CA+JzE"}
@@ -42,6 +42,11 @@ export interface RangeCalendarProps<T extends DateValue> extends CalendarVariant
42
42
  * If `bottomContent is provided, this will be ignored.
43
43
  */
44
44
  showTodayButton?: boolean;
45
+ /**
46
+ * If `true`, clicking on the "Today" button will set the selected date to today.
47
+ * If `false`, it will only move the focus to today's date without changing the selected date.
48
+ */
49
+ shouldSetDateOnTodayButtonClick?: boolean;
45
50
  bottomContent?: React.ReactNode;
46
51
  errorMessage?: string;
47
52
  }
@@ -1 +1 @@
1
- {"version":3,"file":"range-calendar.d.ts","sourceRoot":"","sources":["../../../src/range-calendar/range-calendar.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,kBAAkB,IAAI,sBAAsB,EAC5C,iBAAiB,EACjB,SAAS,EACV,MAAM,uBAAuB,CAAA;AAE9B,OAAO,EACL,YAAY,EAIb,MAAM,yBAAyB,CAAA;AAahC,OAAO,KAAK,EACV,aAAa,EACb,oBAAoB,EACpB,cAAc,EACf,MAAM,sBAAsB,CAAA;AAe7B,MAAM,WAAW,kBAAkB,CAAC,CAAC,SAAS,SAAS,CACrD,SAAQ,oBAAoB,EAC1B,IAAI,CAAC,iBAAiB,EAAE,cAAc,CAAC,EACvC,sBAAsB,CAAC,CAAC,CAAC;IAC3B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAgCG;IACH,UAAU,CAAC,EAAE,cAAc,CAAC,aAAa,CAAC,CAAA;IAE1C;;;;OAIG;IACH,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB,aAAa,CAAC,EAAE,KAAK,CAAC,SAAS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MAAM,CAAA;CACtB;AAED,eAAO,MAAM,aAAa,GACxB,CAAC,SAAS,SAAS,mFAlCE,MAAO,SAoJ5B,CAAA;AAEF,eAAO,MAAM,yBAAyB,kBAEnC;IACD,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAC1B,4CAQA,CAAA;AAED,eAAO,MAAM,iBAAiB,GAAI,CAAC,SAAS,YAAY,gEAKrD;IACD,IAAI,EAAE,YAAY,CAAA;IAClB,gBAAgB,EAAE,OAAO,CAAA;IACzB,eAAe,EAAE,SAAS,GAAG,IAAI,CAAA;IACjC,cAAc,CAAC,EAAE,kBAAkB,CAAC,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAA;CACzD,4CAuDA,CAAA"}
@@ -10,6 +10,11 @@ interface _ToggleProps extends Omit<AriaSwitchProps, "children">, VariantProps<t
10
10
  * The icon to be displayed inside the thumb.
11
11
  */
12
12
  thumbIcon?: React.ReactElement | ((props: ToggleThumbIconProps) => React.ReactNode);
13
+ /**
14
+ * Where to place the children label.
15
+ * @defaultValue "end"
16
+ */
17
+ labelPlacement?: "start" | "end";
13
18
  }
14
19
  export type ToggleProps = _ToggleProps & ({
15
20
  children: React.ReactNode;
@@ -18,6 +23,6 @@ export type ToggleProps = _ToggleProps & ({
18
23
  children?: never;
19
24
  "aria-label": string;
20
25
  });
21
- export declare const Toggle: ({ children, classNames, thumbIcon, ...originalProps }: ToggleProps) => import("react/jsx-runtime").JSX.Element;
26
+ export declare const Toggle: ({ children, classNames, thumbIcon, labelPlacement, ...originalProps }: ToggleProps) => import("react/jsx-runtime").JSX.Element;
22
27
  export {};
23
28
  //# sourceMappingURL=toggle.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"toggle.d.ts","sourceRoot":"","sources":["../../../src/toggle/toggle.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,WAAW,IAAI,eAAe,EAC9B,iBAAiB,EAClB,MAAM,uBAAuB,CAAA;AAK9B,OAAO,KAAK,EACV,cAA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AAc,CAAC,WAAW,CAAC,CAAA;IACxC;;OAEG;IACH,SAAS,CAAC,EACN,KAAK,CAAC,YAAY,GAClB,CAAC,CAAC,KAAK,EAAE,oBAAoB,KAAK,KAAK,CAAC,SAAS,CAAC,CAAA;IACtD;;;OAGG;IACH,cAAc,CAAC,EAAE,OAAO,GAAG,KAAK,CAAA;CACjC;AAED,MAAM,MAAM,WAAW,GAAG,YAAY,GACpC,CACI;IACE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;IACzB,YAAY,CAAC,EAAE,MAAM,CAAA;CACtB,GACD;IACE,QAAQ,CAAC,EAAE,KAAK,CAAA;IAChB,YAAY,EAAE,MAAM,CAAA;CACrB,CACJ,CAAA;AAEH,eAAO,MAAM,MAAM,0EAMhB,WAAW,4CAyCb,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opengovsg/oui",
3
- "version": "0.0.17",
3
+ "version": "0.0.19",
4
4
  "sideEffects": false,
5
5
  "license": "SEE LICENSE IN LICENSE.md",
6
6
  "type": "module",
@@ -49,7 +49,7 @@
49
49
  "storybook": "9.1.6",
50
50
  "tsx": "^4.20.3",
51
51
  "typescript": "5.7.3",
52
- "@opengovsg/oui-theme": "0.0.17",
52
+ "@opengovsg/oui-theme": "0.0.19",
53
53
  "@oui/chromatic": "0.0.0",
54
54
  "@oui/eslint-config": "0.0.0",
55
55
  "@oui/prettier-config": "0.0.0",
@@ -83,7 +83,7 @@
83
83
  "motion": ">=11.12.0 || >=12.0.0-alpha.1",
84
84
  "react": ">= 18",
85
85
  "react-aria-components": "^1.12.2",
86
- "@opengovsg/oui-theme": "0.0.17"
86
+ "@opengovsg/oui-theme": "0.0.19"
87
87
  },
88
88
  "scripts": {
89
89
  "build": "tsx ../../tooling/build-scripts/main.ts --dts --clean",