@opengovsg/oui 0.0.54 → 0.0.56

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 (111) hide show
  1. package/AGENTS.md +63 -0
  2. package/dist/cjs/avatar/avatar.cjs +1 -1
  3. package/dist/cjs/button/button.cjs +8 -3
  4. package/dist/cjs/calendar/calendar-month-day-selector.cjs +1 -1
  5. package/dist/cjs/calendar/index.cjs +9 -0
  6. package/dist/cjs/calendar/{hooks/use-calendar-selectors.cjs → use-calendar-selectors.cjs} +1 -1
  7. package/dist/cjs/combo-box/combo-box-item.cjs +2 -52
  8. package/dist/cjs/file-dropzone/file-dropzone.cjs +14 -3
  9. package/dist/cjs/govt-banner/govt-banner.cjs +63 -143
  10. package/dist/cjs/hooks/use-scroll-position.cjs +6 -6
  11. package/dist/cjs/index.cjs +21 -10
  12. package/dist/cjs/list-box/index.cjs +8 -0
  13. package/dist/cjs/list-box/list-box.cjs +65 -0
  14. package/dist/cjs/navbar/index.cjs +6 -6
  15. package/dist/cjs/navbar/{navbar-menu/item.cjs → navbar-menu-item.cjs} +3 -3
  16. package/dist/cjs/navbar/{navbar-menu/toggle.cjs → navbar-menu-toggle.cjs} +3 -3
  17. package/dist/cjs/navbar/{navbar-menu/menu.cjs → navbar-menu.cjs} +4 -4
  18. package/dist/cjs/navbar/navbar.cjs +3 -3
  19. package/dist/cjs/navbar/use-navbar.cjs +5 -1
  20. package/dist/cjs/pagination/index.cjs +2 -2
  21. package/dist/cjs/pagination/pagination.cjs +18 -18
  22. package/dist/cjs/pagination/use-pagination.cjs +5 -5
  23. package/dist/cjs/range-calendar/range-calendar.cjs +1 -1
  24. package/dist/cjs/tag-field/tag-field-list.cjs +1 -8
  25. package/dist/esm/avatar/avatar.js +1 -1
  26. package/dist/esm/button/button.js +8 -3
  27. package/dist/esm/calendar/calendar-month-day-selector.js +1 -1
  28. package/dist/esm/calendar/index.js +4 -0
  29. package/dist/esm/calendar/{hooks/use-calendar-selectors.js → use-calendar-selectors.js} +1 -1
  30. package/dist/esm/combo-box/combo-box-item.js +5 -55
  31. package/dist/esm/file-dropzone/file-dropzone.js +14 -3
  32. package/dist/esm/govt-banner/govt-banner.js +64 -144
  33. package/dist/esm/hooks/use-scroll-position.js +6 -6
  34. package/dist/esm/index.js +9 -4
  35. package/dist/esm/list-box/index.js +2 -0
  36. package/dist/esm/list-box/list-box.js +63 -0
  37. package/dist/esm/navbar/index.js +3 -3
  38. package/dist/esm/navbar/{navbar-menu/item.js → navbar-menu-item.js} +3 -3
  39. package/dist/esm/navbar/{navbar-menu/toggle.js → navbar-menu-toggle.js} +2 -2
  40. package/dist/esm/navbar/{navbar-menu/menu.js → navbar-menu.js} +4 -4
  41. package/dist/esm/navbar/navbar.js +1 -1
  42. package/dist/esm/navbar/use-navbar.js +6 -2
  43. package/dist/esm/pagination/index.js +1 -1
  44. package/dist/esm/pagination/pagination.js +1 -1
  45. package/dist/esm/pagination/use-pagination.js +1 -1
  46. package/dist/esm/range-calendar/range-calendar.js +1 -1
  47. package/dist/esm/tag-field/tag-field-list.js +1 -8
  48. package/dist/types/avatar/avatar-context.d.ts +1 -1
  49. package/dist/types/avatar/avatar-context.d.ts.map +1 -1
  50. package/dist/types/avatar/use-img-loading-status.d.ts.map +1 -0
  51. package/dist/types/button/button.d.ts +10 -0
  52. package/dist/types/button/button.d.ts.map +1 -1
  53. package/dist/types/calendar/index.d.ts +4 -0
  54. package/dist/types/calendar/index.d.ts.map +1 -1
  55. package/dist/types/calendar/use-calendar-selectors.d.ts.map +1 -0
  56. package/dist/types/combo-box/combo-box-item.d.ts +3 -10
  57. package/dist/types/combo-box/combo-box-item.d.ts.map +1 -1
  58. package/dist/types/file-dropzone/file-dropzone.d.ts.map +1 -1
  59. package/dist/types/file-dropzone/utils.d.ts.map +1 -1
  60. package/dist/types/govt-banner/govt-banner.d.ts +5 -14
  61. package/dist/types/govt-banner/govt-banner.d.ts.map +1 -1
  62. package/dist/types/hooks/use-scroll-position.d.ts +4 -2
  63. package/dist/types/hooks/use-scroll-position.d.ts.map +1 -1
  64. package/dist/types/index.d.mts +1 -0
  65. package/dist/types/index.d.ts +1 -0
  66. package/dist/types/index.d.ts.map +1 -1
  67. package/dist/types/list-box/index.d.ts +3 -0
  68. package/dist/types/list-box/index.d.ts.map +1 -0
  69. package/dist/types/list-box/list-box.d.ts +11 -0
  70. package/dist/types/list-box/list-box.d.ts.map +1 -0
  71. package/dist/types/navbar/index.d.ts +6 -6
  72. package/dist/types/navbar/index.d.ts.map +1 -1
  73. package/dist/types/navbar/{navbar-menu/i18n.d.ts → navbar-menu-i18n.d.ts} +1 -1
  74. package/dist/types/navbar/navbar-menu-i18n.d.ts.map +1 -0
  75. package/dist/types/navbar/{navbar-menu/item.d.ts → navbar-menu-item.d.ts} +3 -3
  76. package/dist/types/navbar/navbar-menu-item.d.ts.map +1 -0
  77. package/dist/types/navbar/{navbar-menu/toggle.d.ts → navbar-menu-toggle.d.ts} +1 -1
  78. package/dist/types/navbar/navbar-menu-toggle.d.ts.map +1 -0
  79. package/dist/types/navbar/{navbar-menu/menu.d.ts → navbar-menu.d.ts} +3 -3
  80. package/dist/types/navbar/navbar-menu.d.ts.map +1 -0
  81. package/dist/types/navbar/use-navbar.d.ts.map +1 -1
  82. package/dist/types/pagination/index.d.ts +2 -2
  83. package/dist/types/pagination/index.d.ts.map +1 -1
  84. package/dist/types/pagination/pagination.d.ts.map +1 -1
  85. package/dist/types/pagination/{hooks/use-pagination.d.ts → use-pagination-base.d.ts} +1 -1
  86. package/dist/types/pagination/use-pagination-base.d.ts.map +1 -0
  87. package/dist/types/pagination/use-pagination-item.d.ts +1 -1
  88. package/dist/types/pagination/use-pagination-item.d.ts.map +1 -1
  89. package/dist/types/pagination/use-pagination.d.ts +1 -1
  90. package/dist/types/pagination/use-pagination.d.ts.map +1 -1
  91. package/dist/types/tag-field/tag-field-list.d.ts.map +1 -1
  92. package/package.json +8 -7
  93. package/dist/cjs/calendar/hooks/index.cjs +0 -8
  94. package/dist/esm/calendar/hooks/index.js +0 -2
  95. package/dist/types/avatar/hooks/use-img-loading-status.d.ts.map +0 -1
  96. package/dist/types/calendar/hooks/index.d.ts +0 -2
  97. package/dist/types/calendar/hooks/index.d.ts.map +0 -1
  98. package/dist/types/calendar/hooks/use-calendar-selectors.d.ts.map +0 -1
  99. package/dist/types/navbar/navbar-menu/i18n.d.ts.map +0 -1
  100. package/dist/types/navbar/navbar-menu/item.d.ts.map +0 -1
  101. package/dist/types/navbar/navbar-menu/menu.d.ts.map +0 -1
  102. package/dist/types/navbar/navbar-menu/toggle.d.ts.map +0 -1
  103. package/dist/types/pagination/hooks/use-pagination.d.ts.map +0 -1
  104. /package/dist/cjs/avatar/{hooks/use-img-loading-status.cjs → use-img-loading-status.cjs} +0 -0
  105. /package/dist/cjs/navbar/{navbar-menu/i18n.cjs → navbar-menu-i18n.cjs} +0 -0
  106. /package/dist/cjs/pagination/{hooks/use-pagination.cjs → use-pagination-base.cjs} +0 -0
  107. /package/dist/esm/avatar/{hooks/use-img-loading-status.js → use-img-loading-status.js} +0 -0
  108. /package/dist/esm/navbar/{navbar-menu/i18n.js → navbar-menu-i18n.js} +0 -0
  109. /package/dist/esm/pagination/{hooks/use-pagination.js → use-pagination-base.js} +0 -0
  110. /package/dist/types/avatar/{hooks/use-img-loading-status.d.ts → use-img-loading-status.d.ts} +0 -0
  111. /package/dist/types/calendar/{hooks/use-calendar-selectors.d.ts → use-calendar-selectors.d.ts} +0 -0
@@ -4,7 +4,7 @@ import { jsxs, jsx } from 'react/jsx-runtime';
4
4
  import { useRef } from 'react';
5
5
  import { useDisclosure, useButton, useFocusRing, mergeProps } from 'react-aria';
6
6
  import { useDisclosureState } from 'react-stately';
7
- import { govtBannerStyles, dataAttr, twMerge } from '@opengovsg/oui-theme';
7
+ import { govtBannerStyles, dataAttr } from '@opengovsg/oui-theme';
8
8
  import ChevronDown from '../node_modules/.pnpm/lucide-react@0.475.0_react@19.2.3/node_modules/lucide-react/dist/esm/icons/chevron-down.js';
9
9
  import Landmark from '../node_modules/.pnpm/lucide-react@0.475.0_react@19.2.3/node_modules/lucide-react/dist/esm/icons/landmark.js';
10
10
  import ExternalLink from '../node_modules/.pnpm/lucide-react@0.475.0_react@19.2.3/node_modules/lucide-react/dist/esm/icons/external-link.js';
@@ -44,7 +44,7 @@ function GovtBanner({
44
44
  /* @__PURE__ */ jsxs(
45
45
  "svg",
46
46
  {
47
- className: slots.crest({ className: classNames?.crest }),
47
+ className: slots.crest(),
48
48
  version: "1.1",
49
49
  viewBox: "0 0 32 32",
50
50
  xmlns: "http://www.w3.org/2000/svg",
@@ -58,163 +58,83 @@ function GovtBanner({
58
58
  ]
59
59
  }
60
60
  ),
61
- /* @__PURE__ */ jsxs(
62
- "div",
63
- {
64
- className: slots.mainContent({ className: classNames?.mainContent }),
65
- children: [
66
- /* @__PURE__ */ jsx("span", { children: "A Singapore Government Agency Website" }),
67
- environment ? /* @__PURE__ */ jsxs("b", { children: [
68
- "[NOTE: THIS IS A ",
69
- environment.toUpperCase(),
70
- " WEBSITE]"
71
- ] }) : null,
72
- /* @__PURE__ */ jsxs(
73
- "button",
74
- {
75
- className: slots.identifyButton({
76
- className: classNames?.identifyButton
77
- }),
78
- "data-focus-visible": dataAttr(isFocusVisible),
79
- ref: triggerRef,
80
- type: "button",
81
- ...mergeProps(buttonProps, focusProps),
82
- children: [
83
- /* @__PURE__ */ jsx("span", { className: slots.link({ className: classNames?.link }), children: "How to identify" }),
84
- /* @__PURE__ */ jsx(
85
- ChevronDown,
86
- {
87
- className: slots.chevron({ className: classNames?.chevron })
88
- }
89
- )
90
- ]
91
- }
92
- )
93
- ]
94
- }
95
- )
96
- ]
97
- }
98
- ),
99
- /* @__PURE__ */ jsx("div", { ref: panelRef, ...panelProps, children: /* @__PURE__ */ jsxs("div", { className: slots.panel({ className: classNames?.panel }), children: [
100
- /* @__PURE__ */ jsxs(
101
- "div",
102
- {
103
- className: slots.panelGroup({
104
- className: classNames?.panelGroup
105
- }),
106
- children: [
107
- /* @__PURE__ */ jsx(
108
- Landmark,
109
- {
110
- className: slots.panelIcon({ className: classNames?.panelIcon })
111
- }
112
- ),
61
+ /* @__PURE__ */ jsxs("div", { className: slots.mainContent(), children: [
62
+ /* @__PURE__ */ jsx("span", { children: "A Singapore Government Agency Website" }),
63
+ environment ? /* @__PURE__ */ jsxs("b", { children: [
64
+ "[NOTE: THIS IS A ",
65
+ environment.toUpperCase(),
66
+ " WEBSITE]"
67
+ ] }) : null,
113
68
  /* @__PURE__ */ jsxs(
114
- "div",
69
+ "button",
115
70
  {
116
- className: slots.panelSection({
117
- className: classNames?.panelSection
118
- }),
71
+ className: slots.identifyButton(),
72
+ "data-focus-visible": dataAttr(isFocusVisible),
73
+ ref: triggerRef,
74
+ type: "button",
75
+ ...mergeProps(buttonProps, focusProps),
119
76
  children: [
120
- /* @__PURE__ */ jsx(
121
- "div",
122
- {
123
- className: slots.panelHeader({
124
- className: classNames?.panelHeader
125
- }),
126
- children: "Official website links end with .gov.sg"
127
- }
128
- ),
129
- /* @__PURE__ */ jsxs("article", { children: [
130
- "Government agencies communicate via ",
131
- /* @__PURE__ */ jsx("b", { children: ".gov.sg" }),
132
- " websites (e.g. go.gov.sg/open).",
133
- " ",
134
- /* @__PURE__ */ jsxs(
135
- "a",
136
- {
137
- className: slots.link({ className: classNames?.link }),
138
- href: "https://www.gov.sg/trusted-sites#govsites",
139
- rel: "noreferrer",
140
- target: "_blank",
141
- children: [
142
- "Trusted websites",
143
- /* @__PURE__ */ jsx(
144
- ExternalLink,
145
- {
146
- "aria-hidden": true,
147
- className: slots.inlineIcon({
148
- className: twMerge("ml-0.5", classNames?.inlineIcon)
149
- })
150
- }
151
- )
152
- ]
153
- }
154
- )
155
- ] })
77
+ /* @__PURE__ */ jsx("span", { className: slots.link(), children: "How to identify" }),
78
+ /* @__PURE__ */ jsx(ChevronDown, { className: slots.chevron() })
156
79
  ]
157
80
  }
158
81
  )
159
- ]
160
- }
161
- ),
162
- /* @__PURE__ */ jsxs(
163
- "div",
164
- {
165
- className: slots.panelGroup({
166
- className: classNames?.panelGroup
167
- }),
168
- children: [
169
- /* @__PURE__ */ jsx(
170
- Lock,
171
- {
172
- className: slots.panelIcon({ className: classNames?.panelIcon })
173
- }
174
- ),
82
+ ] })
83
+ ]
84
+ }
85
+ ),
86
+ /* @__PURE__ */ jsx("div", { ref: panelRef, ...panelProps, children: /* @__PURE__ */ jsxs("div", { className: slots.panel(), children: [
87
+ /* @__PURE__ */ jsxs("div", { className: slots.panelGroup(), children: [
88
+ /* @__PURE__ */ jsx(Landmark, { className: slots.panelIcon() }),
89
+ /* @__PURE__ */ jsxs("div", { className: slots.panelSection(), children: [
90
+ /* @__PURE__ */ jsx("div", { className: slots.panelHeader(), children: "Official website links end with .gov.sg" }),
91
+ /* @__PURE__ */ jsxs("article", { children: [
92
+ "Government agencies communicate via ",
93
+ /* @__PURE__ */ jsx("b", { children: ".gov.sg" }),
94
+ " websites (e.g. go.gov.sg/open).",
95
+ " ",
175
96
  /* @__PURE__ */ jsxs(
176
- "div",
97
+ "a",
177
98
  {
178
- className: slots.panelSection({
179
- className: classNames?.panelSection
180
- }),
99
+ className: slots.link(),
100
+ href: "https://www.gov.sg/trusted-sites#govsites",
101
+ rel: "noreferrer",
102
+ target: "_blank",
181
103
  children: [
104
+ "Trusted websites",
182
105
  /* @__PURE__ */ jsx(
183
- "p",
106
+ ExternalLink,
184
107
  {
185
- className: slots.panelHeader({
186
- className: classNames?.panelHeader
187
- }),
188
- children: "Secure websites use HTTPS"
108
+ "aria-hidden": true,
109
+ className: slots.inlineIcon({ className: "ml-0.5" })
189
110
  }
190
- ),
191
- /* @__PURE__ */ jsxs("article", { children: [
192
- "Look for a ",
193
- /* @__PURE__ */ jsx("b", { children: "lock" }),
194
- " ",
195
- /* @__PURE__ */ jsxs("span", { "aria-hidden": true, children: [
196
- "(",
197
- /* @__PURE__ */ jsx(
198
- Lock,
199
- {
200
- className: slots.inlineIcon({
201
- className: classNames?.inlineIcon
202
- })
203
- }
204
- ),
205
- ")"
206
- ] }),
207
- " ",
208
- "or ",
209
- /* @__PURE__ */ jsx("b", { children: "https://" }),
210
- " as an added precaution. Share sensitive information only on official, secure websites."
211
- ] })
111
+ )
212
112
  ]
213
113
  }
214
114
  )
215
- ]
216
- }
217
- )
115
+ ] })
116
+ ] })
117
+ ] }),
118
+ /* @__PURE__ */ jsxs("div", { className: slots.panelGroup(), children: [
119
+ /* @__PURE__ */ jsx(Lock, { className: slots.panelIcon() }),
120
+ /* @__PURE__ */ jsxs("div", { className: slots.panelSection(), children: [
121
+ /* @__PURE__ */ jsx("p", { className: slots.panelHeader(), children: "Secure websites use HTTPS" }),
122
+ /* @__PURE__ */ jsxs("article", { children: [
123
+ "Look for a ",
124
+ /* @__PURE__ */ jsx("b", { children: "lock" }),
125
+ " ",
126
+ /* @__PURE__ */ jsxs("span", { "aria-hidden": true, children: [
127
+ "(",
128
+ /* @__PURE__ */ jsx(Lock, { className: slots.inlineIcon() }),
129
+ ")"
130
+ ] }),
131
+ " ",
132
+ "or ",
133
+ /* @__PURE__ */ jsx("b", { children: "https://" }),
134
+ " as an added precaution. Share sensitive information only on official, secure websites."
135
+ ] })
136
+ ] })
137
+ ] })
218
138
  ] }) })
219
139
  ]
220
140
  }
@@ -10,19 +10,19 @@ function getScrollPosition(element) {
10
10
  return { x: element.scrollLeft, y: element.scrollTop };
11
11
  }
12
12
  const useScrollPosition = (props) => {
13
- const { elementRef, delay = 30, callback, isEnabled } = props;
13
+ const { element, delay = 30, callback, isEnabled } = props;
14
14
  const position = useRef(
15
- isEnabled ? getScrollPosition(elementRef?.current) : { x: 0, y: 0 }
15
+ isEnabled ? getScrollPosition(element) : { x: 0, y: 0 }
16
16
  );
17
17
  const throttleTimeout = useRef(null);
18
18
  const handler = useCallback(() => {
19
- const currPos = getScrollPosition(elementRef?.current);
19
+ const currPos = getScrollPosition(element);
20
20
  if (typeof callback === "function") {
21
21
  callback({ prevPos: position.current, currPos });
22
22
  }
23
23
  position.current = currPos;
24
24
  throttleTimeout.current = null;
25
- }, [callback, elementRef]);
25
+ }, [callback, element]);
26
26
  useEffect(() => {
27
27
  if (!isEnabled) return;
28
28
  const handleScroll = () => {
@@ -35,7 +35,7 @@ const useScrollPosition = (props) => {
35
35
  handler();
36
36
  }
37
37
  };
38
- const target = elementRef?.current || window;
38
+ const target = element || window;
39
39
  target.addEventListener("scroll", handleScroll);
40
40
  return () => {
41
41
  target.removeEventListener("scroll", handleScroll);
@@ -44,7 +44,7 @@ const useScrollPosition = (props) => {
44
44
  throttleTimeout.current = null;
45
45
  }
46
46
  };
47
- }, [elementRef?.current, delay, handler, isEnabled]);
47
+ }, [element, delay, handler, isEnabled]);
48
48
  return position.current;
49
49
  };
50
50
 
package/dist/esm/index.js CHANGED
@@ -25,11 +25,16 @@ export { Select } from './select/select.js';
25
25
  export { SelectItem } from './select/select-item.js';
26
26
  export { SelectVariantContext, useSelectVariantContext } from './select/select-variant-context.js';
27
27
  export { Badge } from './badge/badge.js';
28
+ export { AgnosticCalendarStateContext, useAgnosticCalendarStateContext } from './calendar/agnostic-calendar-state-context.js';
28
29
  export { Calendar, CalendarStateWrapper } from './calendar/calendar.js';
30
+ export { CalendarBottomContent } from './calendar/calendar-bottom-content.js';
31
+ export { CalendarGridHeader } from './calendar/calendar-grid-header.js';
32
+ export { CalendarHeader } from './calendar/calendar-header.js';
29
33
  export { CalendarStyleContext, useCalendarStyleContext } from './calendar/calendar-style-context.js';
30
34
  export { getEraFormat, useGenerateLocalizedMonths, useGenerateLocalizedYears, useLocalizedMonthYear } from './calendar/utils.js';
31
35
  export { CalendarDate } from '@internationalized/date';
32
36
  export { RangeCalendar, RangeCalendarCell, RangeCalendarStateWrapper } from './range-calendar/range-calendar.js';
37
+ export { ListBoxItem } from './list-box/list-box.js';
33
38
  export { Menu, MenuItem, MenuSection, MenuSeparator, MenuTrigger, MenuVariantContext, SubmenuTrigger, useMenuVariantContext } from './menu/menu.js';
34
39
  export { Popover } from './popover/popover.js';
35
40
  export { Tab, TabList, TabPanel, TabPanels, Tabs, TabsVariantContext, useTabsVariantContext } from './tabs/tabs.js';
@@ -41,7 +46,7 @@ export { CheckboxGroupStyleContext, useCheckboxGroupStyleContext } from './check
41
46
  export { Pagination } from './pagination/pagination.js';
42
47
  export { PaginationCursor } from './pagination/pagination-cursor.js';
43
48
  export { PaginationItem } from './pagination/pagination-item.js';
44
- export { PaginationItemType } from './pagination/hooks/use-pagination.js';
49
+ export { PaginationItemType } from './pagination/use-pagination-base.js';
45
50
  export { CURSOR_TRANSITION_TIMEOUT, usePagination } from './pagination/use-pagination.js';
46
51
  export { FileDropzone } from './file-dropzone/file-dropzone.js';
47
52
  export { FileInfo } from './file-dropzone/file-info.js';
@@ -57,9 +62,9 @@ export { Toaster } from './toast/toast.js';
57
62
  export { Navbar } from './navbar/navbar.js';
58
63
  export { NavbarBrand } from './navbar/navbar-brand.js';
59
64
  export { NavbarContent } from './navbar/navbar-content.js';
60
- export { NavbarMenu } from './navbar/navbar-menu/menu.js';
61
- export { NavbarMenuItem } from './navbar/navbar-menu/item.js';
62
- export { NavbarMenuToggle } from './navbar/navbar-menu/toggle.js';
65
+ export { NavbarMenu } from './navbar/navbar-menu.js';
66
+ export { NavbarMenuItem } from './navbar/navbar-menu-item.js';
67
+ export { NavbarMenuToggle } from './navbar/navbar-menu-toggle.js';
63
68
  export { NavbarItem } from './navbar/navbar-item.js';
64
69
  export { useNavbar } from './navbar/use-navbar.js';
65
70
  export { NavbarProvider, useNavbarContext } from './navbar/navbar-context.js';
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ export { ListBoxItem } from './list-box.js';
@@ -0,0 +1,63 @@
1
+ "use strict";
2
+ "use client";
3
+ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
4
+ import { useMemo } from 'react';
5
+ import { ListBoxItem as ListBoxItem$1, Text, composeRenderProps } from 'react-aria-components';
6
+ import { listBoxItemStyles } from '@opengovsg/oui-theme';
7
+ import { forwardRef, mapPropsVariants } from '../system/utils.js';
8
+
9
+ const ListBoxItem = forwardRef(function ListBoxItem2(originalProps, ref) {
10
+ const [
11
+ { className, description, children, classNames, ...props },
12
+ variantProps
13
+ ] = mapPropsVariants(originalProps, listBoxItemStyles.variantKeys);
14
+ const styles = listBoxItemStyles(variantProps);
15
+ const defaultTextValue = useMemo(() => {
16
+ if (props.textValue) {
17
+ return props.textValue;
18
+ }
19
+ if (typeof children === "string") {
20
+ return children;
21
+ }
22
+ return void 0;
23
+ }, [children, props.textValue]);
24
+ return /* @__PURE__ */ jsx(
25
+ ListBoxItem$1,
26
+ {
27
+ ref,
28
+ textValue: defaultTextValue,
29
+ ...props,
30
+ className: composeRenderProps(
31
+ className ?? classNames?.container,
32
+ (className2, renderProps) => styles.container({ ...renderProps, className: className2 })
33
+ ),
34
+ children: (renderProps) => {
35
+ if (typeof children === "function") {
36
+ return children(renderProps);
37
+ }
38
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
39
+ /* @__PURE__ */ jsx(
40
+ Text,
41
+ {
42
+ className: styles.label({ className: classNames?.label }),
43
+ slot: "label",
44
+ children
45
+ }
46
+ ),
47
+ description && /* @__PURE__ */ jsx(
48
+ Text,
49
+ {
50
+ className: styles.description({
51
+ className: classNames?.description
52
+ }),
53
+ slot: "description",
54
+ children: description
55
+ }
56
+ )
57
+ ] });
58
+ }
59
+ }
60
+ );
61
+ });
62
+
63
+ export { ListBoxItem };
@@ -2,9 +2,9 @@
2
2
  export { Navbar } from './navbar.js';
3
3
  export { NavbarBrand } from './navbar-brand.js';
4
4
  export { NavbarContent } from './navbar-content.js';
5
- export { NavbarMenu } from './navbar-menu/menu.js';
6
- export { NavbarMenuItem } from './navbar-menu/item.js';
7
- export { NavbarMenuToggle } from './navbar-menu/toggle.js';
5
+ export { NavbarMenu } from './navbar-menu.js';
6
+ export { NavbarMenuItem } from './navbar-menu-item.js';
7
+ export { NavbarMenuToggle } from './navbar-menu-toggle.js';
8
8
  export { NavbarItem } from './navbar-item.js';
9
9
  export { useNavbar } from './use-navbar.js';
10
10
  export { NavbarProvider, useNavbarContext } from './navbar-context.js';
@@ -3,9 +3,9 @@
3
3
  import { jsx } from 'react/jsx-runtime';
4
4
  import { useRenderProps, composeRenderProps } from 'react-aria-components';
5
5
  import { navbarMenuItemStyles, cn, dataAttr } from '@opengovsg/oui-theme';
6
- import { forwardRef } from '../../system/utils.js';
7
- import { useNavbarContext } from '../navbar-context.js';
8
- import { useDomRef } from '../../system/react-utils/refs.js';
6
+ import { forwardRef } from '../system/utils.js';
7
+ import { useNavbarContext } from './navbar-context.js';
8
+ import { useDomRef } from '../system/react-utils/refs.js';
9
9
 
10
10
  const NavbarMenuItem = forwardRef(
11
11
  (props, ref) => {
@@ -5,8 +5,8 @@ import { useMemo } from 'react';
5
5
  import { useLocalizedStringFormatter, chain } from 'react-aria';
6
6
  import { ToggleButton } from 'react-aria-components';
7
7
  import { buttonStyles, cn, dataAttr } from '@opengovsg/oui-theme';
8
- import { useNavbarContext } from '../navbar-context.js';
9
- import { i18nStrings } from './i18n.js';
8
+ import { useNavbarContext } from './navbar-context.js';
9
+ import { i18nStrings } from './navbar-menu-i18n.js';
10
10
 
11
11
  const NavbarMenuToggle = ({
12
12
  icon,
@@ -1,12 +1,12 @@
1
1
  "use strict";
2
2
  "use client";
3
3
  import { jsx } from 'react/jsx-runtime';
4
- import { Overlay as $337b884510726a0d$export$c6fdb837b070b4ff } from '../../node_modules/.pnpm/@react-aria_overlays@3.31.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@react-aria/overlays/dist/Overlay.js';
4
+ import { Overlay as $337b884510726a0d$export$c6fdb837b070b4ff } from '../node_modules/.pnpm/@react-aria_overlays@3.31.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@react-aria/overlays/dist/Overlay.js';
5
5
  import { chain } from 'react-aria';
6
6
  import { dataAttr, cn } from '@opengovsg/oui-theme';
7
- import { forwardRef } from '../../system/utils.js';
8
- import { useNavbarContext } from '../navbar-context.js';
9
- import { useDomRef } from '../../system/react-utils/refs.js';
7
+ import { forwardRef } from '../system/utils.js';
8
+ import { useNavbarContext } from './navbar-context.js';
9
+ import { useDomRef } from '../system/react-utils/refs.js';
10
10
 
11
11
  const NavbarMenu = forwardRef(
12
12
  ({ className, children, portalContainer, style, onKeyDown, ...props }, ref) => {
@@ -6,7 +6,7 @@ import { FocusScope, mergeProps } from 'react-aria';
6
6
  import { pickChildren } from '../system/react-utils/children.js';
7
7
  import { forwardRef } from '../system/utils.js';
8
8
  import { NavbarProvider } from './navbar-context.js';
9
- import { NavbarMenu } from './navbar-menu/menu.js';
9
+ import { NavbarMenu } from './navbar-menu.js';
10
10
  import { useNavbar } from './use-navbar.js';
11
11
 
12
12
  const showOnScrollUpVariants = {
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  "use client";
3
- import { useRef, useCallback, useState, useEffect } from 'react';
3
+ import { useRef, useCallback, useState, useEffect, useLayoutEffect } from 'react';
4
4
  import { usePreventScroll as $49c51c25361d4cd2$export$ee0f7cc6afcd1c18 } from '../node_modules/.pnpm/@react-aria_overlays@3.31.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@react-aria/overlays/dist/usePreventScroll.js';
5
5
  import { useResizeObserver, mergeProps } from '@react-aria/utils';
6
6
  import { useControlledState } from '@react-stately/utils';
@@ -68,8 +68,12 @@ function useNavbar(originalProps) {
68
68
  useEffect(() => {
69
69
  navHeight.current = domRef.current?.offsetHeight || 0;
70
70
  }, [domRef]);
71
+ const [scrollElement, setScrollElement] = useState(null);
72
+ useLayoutEffect(() => {
73
+ setScrollElement(parentRef?.current ?? null);
74
+ }, [parentRef]);
71
75
  useScrollPosition({
72
- elementRef: parentRef,
76
+ element: scrollElement,
73
77
  isEnabled: shouldShowOnScrollUp || !disableScrollHandler,
74
78
  callback: ({ prevPos, currPos }) => {
75
79
  onScrollPositionChange?.(currPos.y);
@@ -2,5 +2,5 @@
2
2
  export { Pagination } from './pagination.js';
3
3
  export { PaginationCursor } from './pagination-cursor.js';
4
4
  export { PaginationItem } from './pagination-item.js';
5
- export { PaginationItemType } from './hooks/use-pagination.js';
5
+ export { PaginationItemType } from './use-pagination-base.js';
6
6
  export { CURSOR_TRANSITION_TIMEOUT, usePagination } from './use-pagination.js';
@@ -5,10 +5,10 @@ import { useCallback, createElement } from 'react';
5
5
  import { useLocale } from '@react-aria/i18n';
6
6
  import { cn, dataAttr } from '@opengovsg/oui-theme';
7
7
  import { forwardRef } from '../system/utils.js';
8
- import { PaginationItemType } from './hooks/use-pagination.js';
9
8
  import { PaginationCursor } from './pagination-cursor.js';
10
9
  import { PaginationItem } from './pagination-item.js';
11
10
  import { usePagination } from './use-pagination.js';
11
+ import { PaginationItemType } from './use-pagination-base.js';
12
12
  import ChevronLeft from '../node_modules/.pnpm/lucide-react@0.475.0_react@19.2.3/node_modules/lucide-react/dist/esm/icons/chevron-left.js';
13
13
  import Ellipsis from '../node_modules/.pnpm/lucide-react@0.475.0_react@19.2.3/node_modules/lucide-react/dist/esm/icons/ellipsis.js';
14
14
  import ChevronsRight from '../node_modules/.pnpm/lucide-react@0.475.0_react@19.2.3/node_modules/lucide-react/dist/esm/icons/chevrons-right.js';
@@ -6,7 +6,7 @@ import { useDeepCompareMemo } from 'use-deep-compare';
6
6
  import { useIntersectionObserver } from 'usehooks-ts';
7
7
  import { paginationStyles, cn, dataAttr } from '@opengovsg/oui-theme';
8
8
  import { mapPropsVariants } from '../system/utils.js';
9
- import { usePagination as usePagination$1, PaginationItemType } from './hooks/use-pagination.js';
9
+ import { usePagination as usePagination$1, PaginationItemType } from './use-pagination-base.js';
10
10
  import { useDomRef } from '../system/react-utils/refs.js';
11
11
 
12
12
  const CURSOR_TRANSITION_TIMEOUT = 300;
@@ -6,11 +6,11 @@ import { CalendarDate, today, getLocalTimeZone, getDayOfWeek } from '@internatio
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';
8
8
  import { calendarStyles, composeRenderProps, cn, dataAttr } from '@opengovsg/oui-theme';
9
- import { CalendarStyleContext, useCalendarStyleContext } from '../calendar/calendar-style-context.js';
10
9
  import { AgnosticCalendarStateContext } from '../calendar/agnostic-calendar-state-context.js';
11
10
  import { CalendarBottomContent } from '../calendar/calendar-bottom-content.js';
12
11
  import { CalendarGridHeader } from '../calendar/calendar-grid-header.js';
13
12
  import { CalendarHeader } from '../calendar/calendar-header.js';
13
+ import { CalendarStyleContext, useCalendarStyleContext } from '../calendar/calendar-style-context.js';
14
14
  import { forwardRefGeneric, mapPropsVariants } from '../system/utils.js';
15
15
 
16
16
  const RangeCalendar = forwardRefGeneric(function RangeCalendar2(originalProps, ref) {
@@ -65,14 +65,7 @@ const TagFieldListInner = (props, ref) => {
65
65
  if (typeof props.children === "function") {
66
66
  return props.children({ ...childProps, itemProps });
67
67
  }
68
- return /* @__PURE__ */ createElement(
69
- TagFieldItem,
70
- {
71
- ...childProps,
72
- ...itemProps,
73
- key
74
- }
75
- );
68
+ return /* @__PURE__ */ createElement(TagFieldItem, { ...childProps, ...itemProps, key });
76
69
  }) });
77
70
  };
78
71
  const TagFieldList = forwardRefGeneric(TagFieldListInner);
@@ -1,5 +1,5 @@
1
1
  import type { AvatarSlots, avatarStyles, SlotsToClasses } from "@opengovsg/oui-theme";
2
- import type { ImageLoadingStatus } from "./hooks/use-img-loading-status";
2
+ import type { ImageLoadingStatus } from "./use-img-loading-status";
3
3
  export interface UseAvatarContextReturn {
4
4
  imageLoadingStatus: ImageLoadingStatus;
5
5
  setImageLoadingStatus: React.Dispatch<React.SetStateAction<ImageLoadingStatus>>;
@@ -1 +1 @@
1
- {"version":3,"file":"avatar-context.d.ts","sourceRoot":"","sources":["../../../src/avatar/avatar-context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,WAAW,EACX,YAAY,EACZ,cAAc,EACf,MAAM,sBAAsB,CAAA;AAE7B,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAA;AAGxE,MAAM,WAAW,sBAAsB;IACrC,kBAAkB,EAAE,kBAAkB,CAAA;IACtC,qBAAqB,EAAE,KAAK,CAAC,QAAQ,CACnC,KAAK,CAAC,cAAc,CAAC,kBAAkB,CAAC,CACzC,CAAA;IACD,KAAK,EAAE,UAAU,CAAC,OAAO,YAAY,CAAC,CAAA;IACtC,UAAU,CAAC,EAAE,cAAc,CAAC,WAAW,CAAC,CAAA;IACxC,IAAI,CAAC,EAAE,MAAM,CAAA;IAEb,WAAW,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAAA;CACtC;AACD,eAAO,MAAO,aAAa,mDAAE,gBAAgB,8BAIzC,CAAA"}
1
+ {"version":3,"file":"avatar-context.d.ts","sourceRoot":"","sources":["../../../src/avatar/avatar-context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,WAAW,EACX,YAAY,EACZ,cAAc,EACf,MAAM,sBAAsB,CAAA;AAE7B,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAA;AAGlE,MAAM,WAAW,sBAAsB;IACrC,kBAAkB,EAAE,kBAAkB,CAAA;IACtC,qBAAqB,EAAE,KAAK,CAAC,QAAQ,CACnC,KAAK,CAAC,cAAc,CAAC,kBAAkB,CAAC,CACzC,CAAA;IACD,KAAK,EAAE,UAAU,CAAC,OAAO,YAAY,CAAC,CAAA;IACtC,UAAU,CAAC,EAAE,cAAc,CAAC,WAAW,CAAC,CAAA;IACxC,IAAI,CAAC,EAAE,MAAM,CAAA;IAEb,WAAW,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAAA;CACtC;AACD,eAAO,MAAO,aAAa,mDAAE,gBAAgB,8BAIzC,CAAA"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-img-loading-status.d.ts","sourceRoot":"","sources":["../../../src/avatar/use-img-loading-status.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,OAAO,CAAA;AAGrD,MAAM,MAAM,kBAAkB,GAAG,MAAM,GAAG,SAAS,GAAG,QAAQ,GAAG,OAAO,CAAA;AAiCxE,wBAAgB,qBAAqB,CACnC,GAAG,EAAE,MAAM,GAAG,SAAS,EACvB,EAAE,cAAc,EAAE,WAAW,EAAE,EAAE,wBAAwB,CAAC,KAAK,CAAC,sBA6CjE"}
@@ -41,6 +41,16 @@ export interface ButtonProps extends AriaButtonProps, ButtonVariantProps {
41
41
  * If true, you must provide an `aria-label` for accessibility.
42
42
  */
43
43
  isIconOnly?: boolean;
44
+ /**
45
+ * Whether to preserve the button's width while pending to prevent layout
46
+ * shift. When enabled, the children are kept in the layout (hidden via
47
+ * `opacity-0` and `aria-hidden`) and the spinner is overlaid on top.
48
+ *
49
+ * Only applies when no `loadingText` or `pendingElement` is provided, since
50
+ * those replace the children with content of a different width.
51
+ * @defaultValue false
52
+ */
53
+ preserveWidth?: boolean;
44
54
  }
45
55
  /**
46
56
  * You probably do not want to use this component if you are rendering a link.
@@ -1 +1 @@
1
- {"version":3,"file":"button.d.ts","sourceRoot":"","sources":["../../../src/button/button.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,WAAW,IAAI,eAAe,EAC9B,WAAW,EACZ,MAAM,uBAAuB,CAAA;AAK9B,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAA;AAQ9D,MAAM,WAAW,WAAY,SAAQ,eAAe,EAAE,kBAAkB;IACtE;;;OAGG;IACH,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB;;OAEG;IACH,YAAY,CAAC,EAAE,WAAW,CAAC,WAAW,CAAC,CAAC,UAAU,CAAC,CAAA;IACnD;;OAEG;IACH,UAAU,CAAC,EAAE,WAAW,CAAC,WAAW,CAAC,CAAC,UAAU,CAAC,CAAA;IACjD;;;OAGG;IACH,OAAO,CAAC,EAAE,WAAW,CAAC,WAAW,CAAC,CAAC,UAAU,CAAC,CAAA;IAE9C;;;;;OAKG;IACH,WAAW,CAAC,EAAE,MAAM,CAAA;IAEpB;;;OAGG;IACH,cAAc,CAAC,EAAE,WAAW,CAAC,WAAW,CAAC,CAAC,UAAU,CAAC,CAAA;IAErD;;;OAGG;IACH,gBAAgB,CAAC,EAAE,OAAO,GAAG,KAAK,CAAA;IAElC;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAA;CACrB;AAED;;;GAGG;AACH,eAAO,MAAM,MAAM,2GAyFlB,CAAA"}
1
+ {"version":3,"file":"button.d.ts","sourceRoot":"","sources":["../../../src/button/button.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,WAAW,IAAI,eAAe,EAC9B,WAAW,EACZ,MAAM,uBAAuB,CAAA;AAK9B,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAA;AAQ9D,MAAM,WAAW,WAAY,SAAQ,eAAe,EAAE,kBAAkB;IACtE;;;OAGG;IACH,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB;;OAEG;IACH,YAAY,CAAC,EAAE,WAAW,CAAC,WAAW,CAAC,CAAC,UAAU,CAAC,CAAA;IACnD;;OAEG;IACH,UAAU,CAAC,EAAE,WAAW,CAAC,WAAW,CAAC,CAAC,UAAU,CAAC,CAAA;IACjD;;;OAGG;IACH,OAAO,CAAC,EAAE,WAAW,CAAC,WAAW,CAAC,CAAC,UAAU,CAAC,CAAA;IAE9C;;;;;OAKG;IACH,WAAW,CAAC,EAAE,MAAM,CAAA;IAEpB;;;OAGG;IACH,cAAc,CAAC,EAAE,WAAW,CAAC,WAAW,CAAC,CAAC,UAAU,CAAC,CAAA;IAErD;;;OAGG;IACH,gBAAgB,CAAC,EAAE,OAAO,GAAG,KAAK,CAAA;IAElC;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAA;IAEpB;;;;;;;;OAQG;IACH,aAAa,CAAC,EAAE,OAAO,CAAA;CACxB;AAED;;;GAGG;AACH,eAAO,MAAM,MAAM,2GA2GlB,CAAA"}
@@ -1,4 +1,8 @@
1
+ export * from "./agnostic-calendar-state-context";
1
2
  export * from "./calendar";
3
+ export * from "./calendar-bottom-content";
4
+ export * from "./calendar-grid-header";
5
+ export * from "./calendar-header";
2
6
  export * from "./calendar-style-context";
3
7
  export * from "./utils";
4
8
  export type * from "./types";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/calendar/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAA;AAC1B,cAAc,0BAA0B,CAAA;AACxC,cAAc,SAAS,CAAA;AAEvB,mBAAmB,SAAS,CAAA;AAE5B,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/calendar/index.ts"],"names":[],"mappings":"AAAA,cAAc,mCAAmC,CAAA;AACjD,cAAc,YAAY,CAAA;AAC1B,cAAc,2BAA2B,CAAA;AACzC,cAAc,wBAAwB,CAAA;AACtC,cAAc,mBAAmB,CAAA;AACjC,cAAc,0BAA0B,CAAA;AACxC,cAAc,SAAS,CAAA;AAEvB,mBAAmB,SAAS,CAAA;AAE5B,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAA"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-calendar-selectors.d.ts","sourceRoot":"","sources":["../../../src/calendar/use-calendar-selectors.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAA;AAMtE,eAAO,MAAM,oBAAoB,UACxB,aAAa,GAAG,kBAAkB;;;;;;;;;;CAmC1C,CAAA"}
@@ -1,11 +1,4 @@
1
- import type { ListBoxItemProps } from "react-aria-components";
2
- import type { ListBoxItemSlots, ListBoxItemVariantProps, SlotsToClasses } from "@opengovsg/oui-theme";
3
- export interface ComboBoxItemProps extends ListBoxItemProps, ListBoxItemVariantProps {
4
- /**
5
- * Description for the item, if any
6
- */
7
- description?: React.ReactNode;
8
- classNames?: SlotsToClasses<ListBoxItemSlots>;
9
- }
10
- export declare const ComboBoxItem: import("../system/utils").InternalForwardRefRenderFunction<import("../system/types").As, ComboBoxItemProps, never>;
1
+ import type { ListBoxItemProps } from "../list-box";
2
+ export type ComboBoxItemProps = ListBoxItemProps;
3
+ export declare const ComboBoxItem: import("../system/utils").InternalForwardRefRenderFunction<import("../system/types").As, ListBoxItemProps, never>;
11
4
  //# sourceMappingURL=combo-box-item.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"combo-box-item.d.ts","sourceRoot":"","sources":["../../../src/combo-box/combo-box-item.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AAS7D,OAAO,KAAK,EACV,gBAAgB,EAChB,uBAAuB,EACvB,cAAc,EACf,MAAM,sBAAsB,CAAA;AAM7B,MAAM,WAAW,iBACf,SAAQ,gBAAgB,EACtB,uBAAuB;IACzB;;OAEG;IACH,WAAW,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAC7B,UAAU,CAAC,EAAE,cAAc,CAAC,gBAAgB,CAAC,CAAA;CAC9C;AAED,eAAO,MAAM,YAAY,oHAgEvB,CAAA"}
1
+ {"version":3,"file":"combo-box-item.d.ts","sourceRoot":"","sources":["../../../src/combo-box/combo-box-item.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAA;AAKnD,MAAM,MAAM,iBAAiB,GAAG,gBAAgB,CAAA;AAEhD,eAAO,MAAM,YAAY,mHAWvB,CAAA"}