@opengovsg/oui 0.0.40 → 0.0.41

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 (72) hide show
  1. package/dist/cjs/badge/i18n.cjs +19 -0
  2. package/dist/cjs/badge/use-badge.cjs +4 -17
  3. package/dist/cjs/banner/banner.cjs +3 -16
  4. package/dist/cjs/banner/i18n.cjs +19 -0
  5. package/dist/cjs/calendar/calendar-bottom-content.cjs +4 -3
  6. package/dist/cjs/calendar/calendar-month-day-selector.cjs +5 -4
  7. package/dist/cjs/calendar/hooks/index.cjs +0 -3
  8. package/dist/cjs/calendar/i18n.cjs +27 -0
  9. package/dist/cjs/combo-box/combo-box.cjs +5 -22
  10. package/dist/cjs/combo-box/i18n.cjs +23 -0
  11. package/dist/cjs/index.cjs +2 -0
  12. package/dist/cjs/modal/i18n.cjs +4 -4
  13. package/dist/cjs/modal/modal-content.cjs +2 -2
  14. package/dist/cjs/navbar/navbar-menu/i18n.cjs +8 -8
  15. package/dist/cjs/navbar/navbar-menu/toggle.cjs +2 -2
  16. package/dist/cjs/node_modules/.pnpm/lucide-react@0.475.0_react@19.2.3/node_modules/lucide-react/dist/esm/icons/search.cjs +22 -0
  17. package/dist/cjs/search-field/i18n.cjs +19 -0
  18. package/dist/cjs/search-field/index.cjs +8 -0
  19. package/dist/cjs/search-field/search-field.cjs +91 -0
  20. package/dist/esm/badge/i18n.js +17 -0
  21. package/dist/esm/badge/use-badge.js +5 -18
  22. package/dist/esm/banner/banner.js +4 -17
  23. package/dist/esm/banner/i18n.js +17 -0
  24. package/dist/esm/calendar/calendar-bottom-content.js +4 -3
  25. package/dist/esm/calendar/calendar-month-day-selector.js +5 -4
  26. package/dist/esm/calendar/hooks/index.js +0 -1
  27. package/dist/esm/calendar/i18n.js +25 -0
  28. package/dist/esm/combo-box/combo-box.js +6 -23
  29. package/dist/esm/combo-box/i18n.js +21 -0
  30. package/dist/esm/index.js +1 -0
  31. package/dist/esm/modal/i18n.js +4 -4
  32. package/dist/esm/modal/modal-content.js +3 -3
  33. package/dist/esm/navbar/navbar-menu/i18n.js +8 -8
  34. package/dist/esm/navbar/navbar-menu/toggle.js +3 -3
  35. package/dist/esm/node_modules/.pnpm/lucide-react@0.475.0_react@19.2.3/node_modules/lucide-react/dist/esm/icons/search.js +17 -0
  36. package/dist/esm/search-field/i18n.js +17 -0
  37. package/dist/esm/search-field/index.js +2 -0
  38. package/dist/esm/search-field/search-field.js +89 -0
  39. package/dist/types/badge/i18n.d.ts +15 -0
  40. package/dist/types/badge/i18n.d.ts.map +1 -0
  41. package/dist/types/badge/use-badge.d.ts.map +1 -1
  42. package/dist/types/banner/banner.d.ts.map +1 -1
  43. package/dist/types/banner/i18n.d.ts +15 -0
  44. package/dist/types/banner/i18n.d.ts.map +1 -0
  45. package/dist/types/calendar/calendar-bottom-content.d.ts.map +1 -1
  46. package/dist/types/calendar/calendar-month-day-selector.d.ts.map +1 -1
  47. package/dist/types/calendar/hooks/index.d.ts +0 -1
  48. package/dist/types/calendar/hooks/index.d.ts.map +1 -1
  49. package/dist/types/calendar/i18n.d.ts +23 -0
  50. package/dist/types/calendar/i18n.d.ts.map +1 -0
  51. package/dist/types/combo-box/combo-box.d.ts.map +1 -1
  52. package/dist/types/combo-box/i18n.d.ts +19 -0
  53. package/dist/types/combo-box/i18n.d.ts.map +1 -0
  54. package/dist/types/index.d.mts +1 -0
  55. package/dist/types/index.d.ts +1 -0
  56. package/dist/types/index.d.ts.map +1 -1
  57. package/dist/types/modal/i18n.d.ts +14 -2
  58. package/dist/types/modal/i18n.d.ts.map +1 -1
  59. package/dist/types/navbar/navbar-menu/i18n.d.ts +18 -2
  60. package/dist/types/navbar/navbar-menu/i18n.d.ts.map +1 -1
  61. package/dist/types/navbar/navbar-menu/toggle.d.ts.map +1 -1
  62. package/dist/types/search-field/i18n.d.ts +15 -0
  63. package/dist/types/search-field/i18n.d.ts.map +1 -0
  64. package/dist/types/search-field/index.d.ts +2 -0
  65. package/dist/types/search-field/index.d.ts.map +1 -0
  66. package/dist/types/search-field/search-field.d.ts +15 -0
  67. package/dist/types/search-field/search-field.d.ts.map +1 -0
  68. package/package.json +3 -3
  69. package/dist/cjs/calendar/hooks/use-calendar-i18n.cjs +0 -33
  70. package/dist/esm/calendar/hooks/use-calendar-i18n.js +0 -30
  71. package/dist/types/calendar/hooks/use-calendar-i18n.d.ts +0 -4
  72. package/dist/types/calendar/hooks/use-calendar-i18n.d.ts.map +0 -1
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ 'use strict';
3
+
4
+ const i18nStrings = {
5
+ "en-SG": {
6
+ "Close badge": "Close badge"
7
+ },
8
+ "zh-SG": {
9
+ "Close badge": "\u5173\u95ED\u5FBD\u7AE0"
10
+ },
11
+ "ms-SG": {
12
+ "Close badge": "Tutup lencana"
13
+ },
14
+ "ta-SG": {
15
+ "Close badge": "\u0BAA\u0BC7\u0B9F\u0BCD\u0B9C\u0BC8 \u0BAE\u0BC2\u0B9F\u0BC1"
16
+ }
17
+ };
18
+
19
+ exports.i18nStrings = i18nStrings;
@@ -7,22 +7,9 @@ var reactAria = require('react-aria');
7
7
  var useDeepCompare = require('use-deep-compare');
8
8
  var ouiTheme = require('@opengovsg/oui-theme');
9
9
  var utils = require('../system/utils.cjs');
10
+ var i18n = require('./i18n.cjs');
10
11
  var refs = require('../system/react-utils/refs.cjs');
11
12
 
12
- const i18nStrings = {
13
- "en-SG": {
14
- close: "Close badge"
15
- },
16
- "zh-SG": {
17
- close: "\u5173\u95ED\u5FBD\u7AE0"
18
- },
19
- "ms-SG": {
20
- close: "Tutup lencana"
21
- },
22
- "ta-SG": {
23
- close: "\u0BAA\u0BC7\u0B9F\u0BCD\u0B9C\u0BC8 \u0BAE\u0BC2\u0B9F\u0BC1"
24
- }
25
- };
26
13
  function useBadge(originalProps) {
27
14
  const [_props, variantProps] = utils.mapPropsVariants(
28
15
  originalProps,
@@ -42,7 +29,7 @@ function useBadge(originalProps) {
42
29
  const domRef = refs.useDomRef(ref);
43
30
  const Component = $670gB$react.useMemo(() => as || "div", [as]);
44
31
  const baseClassName = ouiTheme.cn(classNames?.base, className);
45
- const formatMessage = reactAria.useMessageFormatter(i18nStrings);
32
+ const stringFormatter = reactAria.useLocalizedStringFormatter(i18n.i18nStrings);
46
33
  const isCloseable = variantProps.isCloseable || !!onClose;
47
34
  const {
48
35
  focusProps: closeFocusProps,
@@ -83,16 +70,16 @@ function useBadge(originalProps) {
83
70
  className: classNames?.closeButton,
84
71
  isFocusVisible: isCloseButtonFocusVisible
85
72
  }),
86
- "aria-label": formatMessage("close"),
73
+ "aria-label": stringFormatter.format("Close badge"),
87
74
  ...utils$1.mergeProps(closePressProps, closeFocusProps)
88
75
  };
89
76
  }, [
90
77
  classNames?.closeButton,
91
78
  closeFocusProps,
92
79
  closePressProps,
93
- formatMessage,
94
80
  isCloseButtonFocusVisible,
95
81
  slots,
82
+ stringFormatter,
96
83
  variantProps?.size
97
84
  ]);
98
85
  return {
@@ -8,24 +8,11 @@ var reactAria = require('react-aria');
8
8
  var reactStately = require('react-stately');
9
9
  var ouiTheme = require('@opengovsg/oui-theme');
10
10
  var button = require('../button/button.cjs');
11
+ var i18n = require('./i18n.cjs');
11
12
  var circleAlert = require('../node_modules/.pnpm/lucide-react@0.475.0_react@19.2.3/node_modules/lucide-react/dist/esm/icons/circle-alert.cjs');
12
13
  var info = require('../node_modules/.pnpm/lucide-react@0.475.0_react@19.2.3/node_modules/lucide-react/dist/esm/icons/info.cjs');
13
14
  var x = require('../node_modules/.pnpm/lucide-react@0.475.0_react@19.2.3/node_modules/lucide-react/dist/esm/icons/x.cjs');
14
15
 
15
- const i18nStrings = {
16
- "en-SG": {
17
- dismiss: "Close banner"
18
- },
19
- "zh-SG": {
20
- dismiss: "\u5173\u95ED\u6A2A\u5E45"
21
- },
22
- "ms-SG": {
23
- dismiss: "Tutup sepanduk"
24
- },
25
- "ta-SG": {
26
- dismiss: "\u0B89\u0B9F\u0BC8\u0B95\u0BB3\u0BC8 \u0BAE\u0BC2\u0B9F\u0BC1\u0B99\u0BCD\u0B95\u0BB3\u0BCD"
27
- }
28
- };
29
16
  const Banner = ({
30
17
  variant = "info",
31
18
  size,
@@ -37,7 +24,7 @@ const Banner = ({
37
24
  defaultExpanded = true,
38
25
  ...disclosureProps
39
26
  }) => {
40
- const formatMessage = reactAria.useMessageFormatter(i18nStrings);
27
+ const stringFormatter = reactAria.useLocalizedStringFormatter(i18n.i18nStrings);
41
28
  const styles = ouiTheme.bannerStyles({ variant, size });
42
29
  const startContent = $670gB$react.useMemo(() => {
43
30
  if (startContentProp) {
@@ -107,7 +94,7 @@ const Banner = ({
107
94
  variant: "clear",
108
95
  color: "neutral",
109
96
  isIconOnly: true,
110
- "aria-label": formatMessage("dismiss"),
97
+ "aria-label": stringFormatter.format("Close banner"),
111
98
  className: styles.dismissButton({
112
99
  className: classNames?.dismissButton
113
100
  }),
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ 'use strict';
3
+
4
+ const i18nStrings = {
5
+ "en-SG": {
6
+ "Close banner": "Close banner"
7
+ },
8
+ "zh-SG": {
9
+ "Close banner": "\u5173\u95ED\u6A2A\u5E45"
10
+ },
11
+ "ms-SG": {
12
+ "Close banner": "Tutup sepanduk"
13
+ },
14
+ "ta-SG": {
15
+ "Close banner": "\u0B89\u0B9F\u0BC8\u0B95\u0BB3\u0BC8 \u0BAE\u0BC2\u0B9F\u0BC1\u0B99\u0BCD\u0B95\u0BB3\u0BCD"
16
+ }
17
+ };
18
+
19
+ exports.i18nStrings = i18nStrings;
@@ -5,10 +5,11 @@
5
5
  var jsxRuntime = require('react/jsx-runtime');
6
6
  var $670gB$react = require('react');
7
7
  var date = require('@internationalized/date');
8
+ var reactAria = require('react-aria');
8
9
  var button = require('../button/button.cjs');
9
10
  var agnosticCalendarStateContext = require('./agnostic-calendar-state-context.cjs');
10
11
  var calendarStyleContext = require('./calendar-style-context.cjs');
11
- var useCalendarI18n = require('./hooks/use-calendar-i18n.cjs');
12
+ var i18n = require('./i18n.cjs');
12
13
 
13
14
  const CalendarBottomContent = ({
14
15
  bottomContent,
@@ -17,7 +18,7 @@ const CalendarBottomContent = ({
17
18
  }) => {
18
19
  const state = $670gB$react.useContext(agnosticCalendarStateContext.AgnosticCalendarStateContext);
19
20
  const { slots, classNames, size } = calendarStyleContext.useCalendarStyleContext();
20
- const formatMessage = useCalendarI18n.useCalendarI18n();
21
+ const stringFormatter = reactAria.useLocalizedStringFormatter(i18n.i18nStrings);
21
22
  const handleTodayClick = $670gB$react.useCallback(() => {
22
23
  const todayDate = date.today(date.getLocalTimeZone());
23
24
  state.setFocusedDate(todayDate);
@@ -47,7 +48,7 @@ const CalendarBottomContent = ({
47
48
  slot: null,
48
49
  className: slots.todayButton({ className: classNames?.todayButton }),
49
50
  onPress: handleTodayClick,
50
- children: formatMessage("today")
51
+ children: stringFormatter.format("Today")
51
52
  }
52
53
  )
53
54
  }
@@ -5,19 +5,20 @@
5
5
  var jsxRuntime = require('react/jsx-runtime');
6
6
  var $670gB$react = require('react');
7
7
  var date = require('@internationalized/date');
8
+ var reactAria = require('react-aria');
8
9
  var reactAriaComponents = require('react-aria-components');
9
10
  var select = require('../select/select.cjs');
10
11
  var selectItem = require('../select/select-item.cjs');
11
12
  var agnosticCalendarStateContext = require('./agnostic-calendar-state-context.cjs');
12
13
  var calendarStyleContext = require('./calendar-style-context.cjs');
14
+ var i18n = require('./i18n.cjs');
13
15
  var useCalendarSelectors = require('./hooks/use-calendar-selectors.cjs');
14
- var useCalendarI18n = require('./hooks/use-calendar-i18n.cjs');
15
16
 
16
17
  const CalendarMonthDaySelector = () => {
17
18
  const { slots, size, classNames } = calendarStyleContext.useCalendarStyleContext();
18
19
  const state = $670gB$react.useContext(agnosticCalendarStateContext.AgnosticCalendarStateContext);
19
20
  const { months, years, datePartOrder } = useCalendarSelectors.useCalendarSelectors(state);
20
- const formatMessage = useCalendarI18n.useCalendarI18n();
21
+ const stringFormatter = reactAria.useLocalizedStringFormatter(i18n.i18nStrings);
21
22
  return /* @__PURE__ */ jsxRuntime.jsx(reactAriaComponents.Group, { className: slots.selectors({ className: classNames?.selectors }), children: datePartOrder.map((part) => {
22
23
  if (part === "month") {
23
24
  return /* @__PURE__ */ jsxRuntime.jsx(
@@ -38,7 +39,7 @@ const CalendarMonthDaySelector = () => {
38
39
  popover: "min-w-[12ch]"
39
40
  },
40
41
  selectedKey: state.visibleRange.start.month,
41
- "aria-label": formatMessage("selectMonth"),
42
+ "aria-label": stringFormatter.format("Select month"),
42
43
  onSelectionChange: (month) => {
43
44
  state.setFocusedDate(
44
45
  new date.CalendarDate(state.focusedDate.year, Number(month), 1)
@@ -67,7 +68,7 @@ const CalendarMonthDaySelector = () => {
67
68
  popover: "min-w-[8ch]"
68
69
  },
69
70
  selectedKey: state.visibleRange.start.year,
70
- "aria-label": formatMessage("selectYear"),
71
+ "aria-label": stringFormatter.format("Select year"),
71
72
  onSelectionChange: (year) => {
72
73
  state.setFocusedDate(
73
74
  new date.CalendarDate(
@@ -1,11 +1,8 @@
1
1
  "use strict";
2
2
  'use strict';
3
3
 
4
- var useCalendarI18n = require('./use-calendar-i18n.cjs');
5
4
  var useCalendarSelectors = require('./use-calendar-selectors.cjs');
6
5
 
7
6
 
8
7
 
9
- exports.i18nStrings = useCalendarI18n.i18nStrings;
10
- exports.useCalendarI18n = useCalendarI18n.useCalendarI18n;
11
8
  exports.useCalendarSelectors = useCalendarSelectors.useCalendarSelectors;
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ 'use strict';
3
+
4
+ const i18nStrings = {
5
+ "en-SG": {
6
+ "Select month": "Select month",
7
+ "Select year": "Select year",
8
+ Today: "Today"
9
+ },
10
+ "zh-SG": {
11
+ "Select month": "\u9009\u62E9\u6708\u4EFD",
12
+ "Select year": "\u9009\u62E9\u5E74\u4EFD",
13
+ Today: "\u4ECA\u5929"
14
+ },
15
+ "ms-SG": {
16
+ "Select month": "Pilih bulan",
17
+ "Select year": "Pilih tahun",
18
+ Today: "Hari ini"
19
+ },
20
+ "ta-SG": {
21
+ "Select month": "\u0BAE\u0BBE\u0BA4\u0BA4\u0BCD\u0BA4\u0BC8 \u0BA4\u0BC7\u0BB0\u0BCD\u0BA8\u0BCD\u0BA4\u0BC6\u0B9F\u0BC1\u0B95\u0BCD\u0B95\u0BB5\u0BC1\u0BAE\u0BCD",
22
+ "Select year": "\u0B86\u0BA3\u0BCD\u0B9F\u0BC8 \u0BA4\u0BC7\u0BB0\u0BCD\u0BA8\u0BCD\u0BA4\u0BC6\u0B9F\u0BC1\u0B95\u0BCD\u0B95\u0BB5\u0BC1\u0BAE\u0BCD",
23
+ Today: "\u0B87\u0BA9\u0BCD\u0BB1\u0BC1"
24
+ }
25
+ };
26
+
27
+ exports.i18nStrings = i18nStrings;
@@ -11,6 +11,7 @@ var field = require('../field/field.cjs');
11
11
  var popover = require('../popover/popover.cjs');
12
12
  var utils = require('../system/utils.cjs');
13
13
  var comboBoxVariantContext = require('./combo-box-variant-context.cjs');
14
+ var i18n = require('./i18n.cjs');
14
15
  var chevronUp = require('../node_modules/.pnpm/lucide-react@0.475.0_react@19.2.3/node_modules/lucide-react/dist/esm/icons/chevron-up.cjs');
15
16
  var chevronDown = require('../node_modules/.pnpm/lucide-react@0.475.0_react@19.2.3/node_modules/lucide-react/dist/esm/icons/chevron-down.cjs');
16
17
  var x = require('../node_modules/.pnpm/lucide-react@0.475.0_react@19.2.3/node_modules/lucide-react/dist/esm/icons/x.cjs');
@@ -25,42 +26,24 @@ const calculateEstimatedRowHeight = (size) => {
25
26
  return 48;
26
27
  }
27
28
  };
28
- const i18nStrings = {
29
- "en-SG": {
30
- clear: "Clear",
31
- empty: "No matching results"
32
- },
33
- "zh-SG": {
34
- clear: "\u6E05\u9664",
35
- empty: "\u6CA1\u6709\u5339\u914D\u7684\u7ED3\u679C"
36
- },
37
- "ms-SG": {
38
- clear: "Jelas",
39
- empty: "Tiada hasil yang sepadan"
40
- },
41
- "ta-SG": {
42
- clear: "\u0BA4\u0BC6\u0BB3\u0BBF\u0BB5\u0BC1",
43
- empty: "\u0BAA\u0BCA\u0BB0\u0BC1\u0BA8\u0BCD\u0BA4\u0BC1\u0BAE\u0BCD \u0BAE\u0BC1\u0B9F\u0BBF\u0BB5\u0BC1\u0B95\u0BB3\u0BCD \u0B87\u0BB2\u0BCD\u0BB2\u0BC8"
44
- }
45
- };
46
29
  function ComboBoxEmptyState({
47
30
  size,
48
31
  className
49
32
  }) {
50
33
  const styles = ouiTheme.listBoxItemStyles({ size });
51
- const formatMessage = reactAria.useMessageFormatter(i18nStrings);
34
+ const stringFormatter = reactAria.useLocalizedStringFormatter(i18n.i18nStrings);
52
35
  return /* @__PURE__ */ jsxRuntime.jsx(
53
36
  "span",
54
37
  {
55
38
  className: styles.container({
56
39
  className: ouiTheme.cn("cursor-default italic", className)
57
40
  }),
58
- children: formatMessage("empty")
41
+ children: stringFormatter.format("No matching results")
59
42
  }
60
43
  );
61
44
  }
62
45
  function ComboBox(originalProps) {
63
- const formatMessage = reactAria.useMessageFormatter(i18nStrings);
46
+ const stringFormatter = reactAria.useLocalizedStringFormatter(i18n.i18nStrings);
64
47
  const [_props, variantProps] = utils.mapPropsVariants(
65
48
  originalProps,
66
49
  ouiTheme.comboBoxStyles.variantKeys
@@ -173,7 +156,7 @@ function ComboBox(originalProps) {
173
156
  slot: null,
174
157
  onPress: onClear,
175
158
  isDisabled: isComboBoxDisabled,
176
- "aria-label": formatMessage("clear"),
159
+ "aria-label": stringFormatter.format("Clear"),
177
160
  className: ouiTheme.composeRenderProps(
178
161
  classNames?.clearButton,
179
162
  (className, renderProps) => ouiTheme.comboBoxClearButtonStyles({
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ 'use strict';
3
+
4
+ const i18nStrings = {
5
+ "en-SG": {
6
+ Clear: "Clear",
7
+ "No matching results": "No matching results"
8
+ },
9
+ "zh-SG": {
10
+ Clear: "\u6E05\u9664",
11
+ "No matching results": "\u6CA1\u6709\u5339\u914D\u7684\u7ED3\u679C"
12
+ },
13
+ "ms-SG": {
14
+ Clear: "Jelas",
15
+ "No matching results": "Tiada hasil yang sepadan"
16
+ },
17
+ "ta-SG": {
18
+ Clear: "\u0BA4\u0BC6\u0BB3\u0BBF\u0BB5\u0BC1",
19
+ "No matching results": "\u0BAA\u0BCA\u0BB0\u0BC1\u0BA8\u0BCD\u0BA4\u0BC1\u0BAE\u0BCD \u0BAE\u0BC1\u0B9F\u0BBF\u0BB5\u0BC1\u0B95\u0BB3\u0BCD \u0B87\u0BB2\u0BCD\u0BB2\u0BC8"
20
+ }
21
+ };
22
+
23
+ exports.i18nStrings = i18nStrings;
@@ -68,6 +68,7 @@ var navbarContext = require('./navbar/navbar-context.cjs');
68
68
  var index = require('./avatar/index.cjs');
69
69
  var accordion = require('./accordion/accordion.cjs');
70
70
  var timeField = require('./time-field/time-field.cjs');
71
+ var searchField = require('./search-field/search-field.cjs');
71
72
  var sonner = require('sonner');
72
73
  var avatarContext = require('./avatar/avatar-context.cjs');
73
74
  var avatarGroup = require('./avatar/avatar-group.cjs');
@@ -184,6 +185,7 @@ exports.AccordionItem = accordion.AccordionItem;
184
185
  exports.AccordionStyleContext = accordion.AccordionStyleContext;
185
186
  exports.useAccordionStyleContext = accordion.useAccordionStyleContext;
186
187
  exports.TimeField = timeField.TimeField;
188
+ exports.SearchField = searchField.SearchField;
187
189
  Object.defineProperty(exports, "toast", {
188
190
  enumerable: true,
189
191
  get: function () { return sonner.toast; }
@@ -3,16 +3,16 @@
3
3
 
4
4
  const i18nStrings = {
5
5
  "en-SG": {
6
- dismiss: "Dismiss"
6
+ Dismiss: "Dismiss"
7
7
  },
8
8
  "zh-SG": {
9
- dismiss: "\u53D6\u6D88"
9
+ Dismiss: "\u53D6\u6D88"
10
10
  },
11
11
  "ms-SG": {
12
- dismiss: "Tutup"
12
+ Dismiss: "Tutup"
13
13
  },
14
14
  "ta-SG": {
15
- dismiss: "\u0BAE\u0BC2\u0B9F\u0BC1"
15
+ Dismiss: "\u0BAE\u0BC2\u0B9F\u0BC1"
16
16
  }
17
17
  };
18
18
 
@@ -19,7 +19,7 @@ function ModalContent({
19
19
  ...props
20
20
  }) {
21
21
  const { slots, classNames, buttonSize } = $670gB$react.useContext(modalVariantContext.ModalVariantContext);
22
- const formatMessage = reactAria.useMessageFormatter(i18n.i18nStrings);
22
+ const stringFormatter = reactAria.useLocalizedStringFormatter(i18n.i18nStrings);
23
23
  const closeButtonContent = $670gB$react.isValidElement(closeButtonContentProp) ? closeButtonContentProp : /* @__PURE__ */ jsxRuntime.jsx(x.default, {});
24
24
  return /* @__PURE__ */ jsxRuntime.jsx(
25
25
  reactAriaComponents.Dialog,
@@ -34,7 +34,7 @@ function ModalContent({
34
34
  {
35
35
  slot: "close",
36
36
  isIconOnly: true,
37
- "aria-label": formatMessage("dismiss"),
37
+ "aria-label": stringFormatter.format("Dismiss"),
38
38
  size: buttonSize,
39
39
  variant: "clear",
40
40
  color: "neutral",
@@ -3,20 +3,20 @@
3
3
 
4
4
  const i18nStrings = {
5
5
  "en-SG": {
6
- openMenu: "Open navigation menu",
7
- closeMenu: "Close navigation menu"
6
+ "Open navigation menu": "Open navigation menu",
7
+ "Close navigation menu": "Close navigation menu"
8
8
  },
9
9
  "zh-SG": {
10
- openMenu: "\u6253\u5F00\u5BFC\u822A\u83DC\u5355",
11
- closeMenu: "\u5173\u95ED\u5BFC\u822A\u83DC\u5355"
10
+ "Open navigation menu": "\u6253\u5F00\u5BFC\u822A\u83DC\u5355",
11
+ "Close navigation menu": "\u5173\u95ED\u5BFC\u822A\u83DC\u5355"
12
12
  },
13
13
  "ms-SG": {
14
- openMenu: "Buka menu navigasi",
15
- closeMenu: "Tutup menu navigasi"
14
+ "Open navigation menu": "Buka menu navigasi",
15
+ "Close navigation menu": "Tutup menu navigasi"
16
16
  },
17
17
  "ta-SG": {
18
- openMenu: "\u0BA8\u0BC7\u0BB5\u0BBF\u0B95\u0BC7\u0BB7\u0BA9\u0BCD \u0BAE\u0BC6\u0BA9\u0BC1\u0BB5\u0BC8\u0BA4\u0BCD \u0BA4\u0BBF\u0BB1",
19
- closeMenu: "\u0BA8\u0BC7\u0BB5\u0BBF\u0B95\u0BC7\u0BB7\u0BA9\u0BCD \u0BAE\u0BC6\u0BA9\u0BC1\u0BB5\u0BC8 \u0BAE\u0BC2\u0B9F\u0BC1"
18
+ "Open navigation menu": "\u0BA8\u0BC7\u0BB5\u0BBF\u0B95\u0BC7\u0BB7\u0BA9\u0BCD \u0BAE\u0BC6\u0BA9\u0BC1\u0BB5\u0BC8\u0BA4\u0BCD \u0BA4\u0BBF\u0BB1",
19
+ "Close navigation menu": "\u0BA8\u0BC7\u0BB5\u0BBF\u0B95\u0BC7\u0BB7\u0BA9\u0BCD \u0BAE\u0BC6\u0BA9\u0BC1\u0BB5\u0BC8 \u0BAE\u0BC2\u0B9F\u0BC1"
20
20
  }
21
21
  };
22
22
 
@@ -35,7 +35,7 @@ const NavbarMenuToggle = ({
35
35
  }
36
36
  window.scrollTo({ top: menuTopOffset, behavior: "instant" });
37
37
  };
38
- const formatMessage = reactAria.useMessageFormatter(i18n.i18nStrings);
38
+ const stringFormatter = reactAria.useLocalizedStringFormatter(i18n.i18nStrings);
39
39
  const toggleStyles = $670gB$react.useMemo(() => {
40
40
  return ouiTheme.buttonStyles({
41
41
  variant: "unstyled",
@@ -80,7 +80,7 @@ const NavbarMenuToggle = ({
80
80
  return /* @__PURE__ */ jsxRuntime.jsx(
81
81
  reactAriaComponents.ToggleButton,
82
82
  {
83
- "aria-label": isMenuOpen ? formatMessage("closeMenu") : formatMessage("openMenu"),
83
+ "aria-label": isMenuOpen ? stringFormatter.format("Close navigation menu") : stringFormatter.format("Open navigation menu"),
84
84
  ref: menuRef,
85
85
  "data-open": ouiTheme.dataAttr(isMenuOpen),
86
86
  className: toggleStyles,
@@ -0,0 +1,22 @@
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
+ ["circle", { cx: "11", cy: "11", r: "8", key: "4ej97u" }],
17
+ ["path", { d: "m21 21-4.3-4.3", key: "1qie3q" }]
18
+ ];
19
+ const Search = createLucideIcon.default("Search", __iconNode);
20
+
21
+ exports.__iconNode = __iconNode;
22
+ exports.default = Search;
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ 'use strict';
3
+
4
+ const i18nStrings = {
5
+ "en-SG": {
6
+ Search: "Search"
7
+ },
8
+ "zh-SG": {
9
+ Search: "\u641C\u7D22"
10
+ },
11
+ "ms-SG": {
12
+ Search: "Cari"
13
+ },
14
+ "ta-SG": {
15
+ Search: "\u0BA4\u0BC7\u0B9F\u0BC1"
16
+ }
17
+ };
18
+
19
+ exports.i18nStrings = i18nStrings;
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ 'use strict';
3
+
4
+ var searchField = require('./search-field.cjs');
5
+
6
+
7
+
8
+ exports.SearchField = searchField.SearchField;
@@ -0,0 +1,91 @@
1
+ "use strict";
2
+ 'use strict';
3
+
4
+ var jsxRuntime = require('react/jsx-runtime');
5
+ var reactAria = require('react-aria');
6
+ var reactAriaComponents = require('react-aria-components');
7
+ var ouiTheme = require('@opengovsg/oui-theme');
8
+ var button = require('../button/button.cjs');
9
+ var field = require('../field/field.cjs');
10
+ var input = require('../input/input.cjs');
11
+ var utils = require('../system/utils.cjs');
12
+ var i18n = require('./i18n.cjs');
13
+ var search = require('../node_modules/.pnpm/lucide-react@0.475.0_react@19.2.3/node_modules/lucide-react/dist/esm/icons/search.cjs');
14
+ var x = require('../node_modules/.pnpm/lucide-react@0.475.0_react@19.2.3/node_modules/lucide-react/dist/esm/icons/x.cjs');
15
+
16
+ function SearchField(originalProps) {
17
+ const [
18
+ {
19
+ label,
20
+ description,
21
+ errorMessage,
22
+ searchIcon,
23
+ inputProps,
24
+ classNames,
25
+ ...props
26
+ },
27
+ variantProps
28
+ ] = utils.mapPropsVariants(originalProps, ouiTheme.searchFieldStyles.variantKeys);
29
+ const stringFormatter = reactAria.useLocalizedStringFormatter(i18n.i18nStrings);
30
+ const styles = ouiTheme.searchFieldStyles(variantProps);
31
+ return /* @__PURE__ */ jsxRuntime.jsxs(
32
+ reactAriaComponents.SearchField,
33
+ {
34
+ "aria-label": stringFormatter.format("Search"),
35
+ ...props,
36
+ className: ouiTheme.composeRenderProps(
37
+ props.className,
38
+ (className, renderProps) => styles.base({
39
+ className,
40
+ ...renderProps
41
+ })
42
+ ),
43
+ children: [
44
+ label && /* @__PURE__ */ jsxRuntime.jsx(
45
+ field.Label,
46
+ {
47
+ size: variantProps.size,
48
+ className: styles.label({ className: classNames?.label }),
49
+ children: label
50
+ }
51
+ ),
52
+ /* @__PURE__ */ jsxRuntime.jsxs(field.FieldGroup, { className: styles.group({ className: classNames?.group }), children: [
53
+ searchIcon !== null && (searchIcon === void 0 ? /* @__PURE__ */ jsxRuntime.jsx(
54
+ search.default,
55
+ {
56
+ "aria-hidden": true,
57
+ className: styles.searchIcon({
58
+ className: classNames?.searchIcon
59
+ })
60
+ }
61
+ ) : searchIcon),
62
+ /* @__PURE__ */ jsxRuntime.jsx(
63
+ input.Input,
64
+ {
65
+ size: variantProps.size,
66
+ variant: "unstyled",
67
+ className: styles.input({ className: classNames?.input }),
68
+ ...inputProps
69
+ }
70
+ ),
71
+ /* @__PURE__ */ jsxRuntime.jsx(
72
+ button.Button,
73
+ {
74
+ isIconOnly: true,
75
+ isAttached: true,
76
+ variant: "clear",
77
+ color: "sub",
78
+ size: variantProps.size,
79
+ className: styles.clearButton({ className: classNames?.clearButton }),
80
+ children: /* @__PURE__ */ jsxRuntime.jsx(x.default, { "aria-hidden": true })
81
+ }
82
+ )
83
+ ] }),
84
+ description && /* @__PURE__ */ jsxRuntime.jsx(field.Description, { size: variantProps.size, children: description }),
85
+ /* @__PURE__ */ jsxRuntime.jsx(field.FieldError, { size: variantProps.size, children: errorMessage })
86
+ ]
87
+ }
88
+ );
89
+ }
90
+
91
+ exports.SearchField = SearchField;
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ const i18nStrings = {
3
+ "en-SG": {
4
+ "Close badge": "Close badge"
5
+ },
6
+ "zh-SG": {
7
+ "Close badge": "\u5173\u95ED\u5FBD\u7AE0"
8
+ },
9
+ "ms-SG": {
10
+ "Close badge": "Tutup lencana"
11
+ },
12
+ "ta-SG": {
13
+ "Close badge": "\u0BAA\u0BC7\u0B9F\u0BCD\u0B9C\u0BC8 \u0BAE\u0BC2\u0B9F\u0BC1"
14
+ }
15
+ };
16
+
17
+ export { i18nStrings };
@@ -1,26 +1,13 @@
1
1
  "use strict";
2
2
  import { useMemo, useCallback, cloneElement, isValidElement } from 'react';
3
3
  import { mergeProps } from '@react-aria/utils';
4
- import { useMessageFormatter, useFocusRing, usePress } from 'react-aria';
4
+ import { useLocalizedStringFormatter, useFocusRing, usePress } from 'react-aria';
5
5
  import { useDeepCompareMemo } from 'use-deep-compare';
6
6
  import { badgeStyles, cn, badgeCloseButtonStyles } from '@opengovsg/oui-theme';
7
7
  import { mapPropsVariants } from '../system/utils.js';
8
+ import { i18nStrings } from './i18n.js';
8
9
  import { useDomRef } from '../system/react-utils/refs.js';
9
10
 
10
- const i18nStrings = {
11
- "en-SG": {
12
- close: "Close badge"
13
- },
14
- "zh-SG": {
15
- close: "\u5173\u95ED\u5FBD\u7AE0"
16
- },
17
- "ms-SG": {
18
- close: "Tutup lencana"
19
- },
20
- "ta-SG": {
21
- close: "\u0BAA\u0BC7\u0B9F\u0BCD\u0B9C\u0BC8 \u0BAE\u0BC2\u0B9F\u0BC1"
22
- }
23
- };
24
11
  function useBadge(originalProps) {
25
12
  const [_props, variantProps] = mapPropsVariants(
26
13
  originalProps,
@@ -40,7 +27,7 @@ function useBadge(originalProps) {
40
27
  const domRef = useDomRef(ref);
41
28
  const Component = useMemo(() => as || "div", [as]);
42
29
  const baseClassName = cn(classNames?.base, className);
43
- const formatMessage = useMessageFormatter(i18nStrings);
30
+ const stringFormatter = useLocalizedStringFormatter(i18nStrings);
44
31
  const isCloseable = variantProps.isCloseable || !!onClose;
45
32
  const {
46
33
  focusProps: closeFocusProps,
@@ -81,16 +68,16 @@ function useBadge(originalProps) {
81
68
  className: classNames?.closeButton,
82
69
  isFocusVisible: isCloseButtonFocusVisible
83
70
  }),
84
- "aria-label": formatMessage("close"),
71
+ "aria-label": stringFormatter.format("Close badge"),
85
72
  ...mergeProps(closePressProps, closeFocusProps)
86
73
  };
87
74
  }, [
88
75
  classNames?.closeButton,
89
76
  closeFocusProps,
90
77
  closePressProps,
91
- formatMessage,
92
78
  isCloseButtonFocusVisible,
93
79
  slots,
80
+ stringFormatter,
94
81
  variantProps?.size
95
82
  ]);
96
83
  return {