@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
@@ -0,0 +1,65 @@
1
+ "use strict";
2
+ "use client";
3
+ 'use strict';
4
+
5
+ var jsxRuntime = require('react/jsx-runtime');
6
+ var $670gB$react = require('react');
7
+ var reactAriaComponents = require('react-aria-components');
8
+ var ouiTheme = require('@opengovsg/oui-theme');
9
+ var utils = require('../system/utils.cjs');
10
+
11
+ const ListBoxItem = utils.forwardRef(function ListBoxItem2(originalProps, ref) {
12
+ const [
13
+ { className, description, children, classNames, ...props },
14
+ variantProps
15
+ ] = utils.mapPropsVariants(originalProps, ouiTheme.listBoxItemStyles.variantKeys);
16
+ const styles = ouiTheme.listBoxItemStyles(variantProps);
17
+ const defaultTextValue = $670gB$react.useMemo(() => {
18
+ if (props.textValue) {
19
+ return props.textValue;
20
+ }
21
+ if (typeof children === "string") {
22
+ return children;
23
+ }
24
+ return void 0;
25
+ }, [children, props.textValue]);
26
+ return /* @__PURE__ */ jsxRuntime.jsx(
27
+ reactAriaComponents.ListBoxItem,
28
+ {
29
+ ref,
30
+ textValue: defaultTextValue,
31
+ ...props,
32
+ className: reactAriaComponents.composeRenderProps(
33
+ className ?? classNames?.container,
34
+ (className2, renderProps) => styles.container({ ...renderProps, className: className2 })
35
+ ),
36
+ children: (renderProps) => {
37
+ if (typeof children === "function") {
38
+ return children(renderProps);
39
+ }
40
+ return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
41
+ /* @__PURE__ */ jsxRuntime.jsx(
42
+ reactAriaComponents.Text,
43
+ {
44
+ className: styles.label({ className: classNames?.label }),
45
+ slot: "label",
46
+ children
47
+ }
48
+ ),
49
+ description && /* @__PURE__ */ jsxRuntime.jsx(
50
+ reactAriaComponents.Text,
51
+ {
52
+ className: styles.description({
53
+ className: classNames?.description
54
+ }),
55
+ slot: "description",
56
+ children: description
57
+ }
58
+ )
59
+ ] });
60
+ }
61
+ }
62
+ );
63
+ });
64
+
65
+ exports.ListBoxItem = ListBoxItem;
@@ -4,9 +4,9 @@
4
4
  var navbar = require('./navbar.cjs');
5
5
  var navbarBrand = require('./navbar-brand.cjs');
6
6
  var navbarContent = require('./navbar-content.cjs');
7
- var menu = require('./navbar-menu/menu.cjs');
8
- var item = require('./navbar-menu/item.cjs');
9
- var toggle = require('./navbar-menu/toggle.cjs');
7
+ var navbarMenu = require('./navbar-menu.cjs');
8
+ var navbarMenuItem = require('./navbar-menu-item.cjs');
9
+ var navbarMenuToggle = require('./navbar-menu-toggle.cjs');
10
10
  var navbarItem = require('./navbar-item.cjs');
11
11
  var useNavbar = require('./use-navbar.cjs');
12
12
  var navbarContext = require('./navbar-context.cjs');
@@ -16,9 +16,9 @@ var navbarContext = require('./navbar-context.cjs');
16
16
  exports.Navbar = navbar.Navbar;
17
17
  exports.NavbarBrand = navbarBrand.NavbarBrand;
18
18
  exports.NavbarContent = navbarContent.NavbarContent;
19
- exports.NavbarMenu = menu.NavbarMenu;
20
- exports.NavbarMenuItem = item.NavbarMenuItem;
21
- exports.NavbarMenuToggle = toggle.NavbarMenuToggle;
19
+ exports.NavbarMenu = navbarMenu.NavbarMenu;
20
+ exports.NavbarMenuItem = navbarMenuItem.NavbarMenuItem;
21
+ exports.NavbarMenuToggle = navbarMenuToggle.NavbarMenuToggle;
22
22
  exports.NavbarItem = navbarItem.NavbarItem;
23
23
  exports.useNavbar = useNavbar.useNavbar;
24
24
  exports.NavbarProvider = navbarContext.NavbarProvider;
@@ -5,9 +5,9 @@
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 utils = require('../../system/utils.cjs');
9
- var navbarContext = require('../navbar-context.cjs');
10
- var refs = require('../../system/react-utils/refs.cjs');
8
+ var utils = require('../system/utils.cjs');
9
+ var navbarContext = require('./navbar-context.cjs');
10
+ var refs = require('../system/react-utils/refs.cjs');
11
11
 
12
12
  const NavbarMenuItem = utils.forwardRef(
13
13
  (props, ref) => {
@@ -7,8 +7,8 @@ var $670gB$react = require('react');
7
7
  var reactAria = require('react-aria');
8
8
  var reactAriaComponents = require('react-aria-components');
9
9
  var ouiTheme = require('@opengovsg/oui-theme');
10
- var navbarContext = require('../navbar-context.cjs');
11
- var i18n = require('./i18n.cjs');
10
+ var navbarContext = require('./navbar-context.cjs');
11
+ var navbarMenuI18n = require('./navbar-menu-i18n.cjs');
12
12
 
13
13
  const NavbarMenuToggle = ({
14
14
  icon,
@@ -35,7 +35,7 @@ const NavbarMenuToggle = ({
35
35
  }
36
36
  window.scrollTo({ top: menuTopOffset, behavior: "instant" });
37
37
  };
38
- const stringFormatter = reactAria.useLocalizedStringFormatter(i18n.i18nStrings);
38
+ const stringFormatter = reactAria.useLocalizedStringFormatter(navbarMenuI18n.i18nStrings);
39
39
  const toggleStyles = $670gB$react.useMemo(() => {
40
40
  return ouiTheme.buttonStyles({
41
41
  variant: "unstyled",
@@ -3,12 +3,12 @@
3
3
  'use strict';
4
4
 
5
5
  var jsxRuntime = require('react/jsx-runtime');
6
- var Overlay = require('../../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.cjs');
6
+ var Overlay = require('../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.cjs');
7
7
  var reactAria = require('react-aria');
8
8
  var ouiTheme = require('@opengovsg/oui-theme');
9
- var utils = require('../../system/utils.cjs');
10
- var navbarContext = require('../navbar-context.cjs');
11
- var refs = require('../../system/react-utils/refs.cjs');
9
+ var utils = require('../system/utils.cjs');
10
+ var navbarContext = require('./navbar-context.cjs');
11
+ var refs = require('../system/react-utils/refs.cjs');
12
12
 
13
13
  const NavbarMenu = utils.forwardRef(
14
14
  ({ className, children, portalContainer, style, onKeyDown, ...props }, ref) => {
@@ -8,7 +8,7 @@ var reactAria = require('react-aria');
8
8
  var children = require('../system/react-utils/children.cjs');
9
9
  var utils = require('../system/utils.cjs');
10
10
  var navbarContext = require('./navbar-context.cjs');
11
- var menu = require('./navbar-menu/menu.cjs');
11
+ var navbarMenu = require('./navbar-menu.cjs');
12
12
  var useNavbar = require('./use-navbar.cjs');
13
13
 
14
14
  const showOnScrollUpVariants = {
@@ -29,10 +29,10 @@ const Navbar = utils.forwardRef((props, ref) => {
29
29
  const { children: children$1, ...otherProps } = props;
30
30
  const context = useNavbar.useNavbar({ ...otherProps, ref });
31
31
  const Component = context.Component;
32
- const [childrenWithoutMenu, menu$1] = children.pickChildren(children$1, menu.NavbarMenu);
32
+ const [childrenWithoutMenu, menu] = children.pickChildren(children$1, navbarMenu.NavbarMenu);
33
33
  const content = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
34
34
  /* @__PURE__ */ jsxRuntime.jsx("header", { ...context.getWrapperProps(), children: childrenWithoutMenu }),
35
- menu$1
35
+ menu
36
36
  ] });
37
37
  return /* @__PURE__ */ jsxRuntime.jsx(navbarContext.NavbarProvider, { value: context, children: /* @__PURE__ */ jsxRuntime.jsx(reactAria.FocusScope, { contain: context.isMenuOpen, children: context.shouldShowOnScrollUp ? /* @__PURE__ */ jsxRuntime.jsx(react.LazyMotion, { features: react.domAnimation, children: /* @__PURE__ */ jsxRuntime.jsx(
38
38
  react.m.nav,
@@ -70,8 +70,12 @@ function useNavbar(originalProps) {
70
70
  $670gB$react.useEffect(() => {
71
71
  navHeight.current = domRef.current?.offsetHeight || 0;
72
72
  }, [domRef]);
73
+ const [scrollElement, setScrollElement] = $670gB$react.useState(null);
74
+ $670gB$react.useLayoutEffect(() => {
75
+ setScrollElement(parentRef?.current ?? null);
76
+ }, [parentRef]);
73
77
  useScrollPosition.useScrollPosition({
74
- elementRef: parentRef,
78
+ element: scrollElement,
75
79
  isEnabled: shouldShowOnScrollUp || !disableScrollHandler,
76
80
  callback: ({ prevPos, currPos }) => {
77
81
  onScrollPositionChange?.(currPos.y);
@@ -4,7 +4,7 @@
4
4
  var pagination = require('./pagination.cjs');
5
5
  var paginationCursor = require('./pagination-cursor.cjs');
6
6
  var paginationItem = require('./pagination-item.cjs');
7
- var usePagination$1 = require('./hooks/use-pagination.cjs');
7
+ var usePaginationBase = require('./use-pagination-base.cjs');
8
8
  var usePagination = require('./use-pagination.cjs');
9
9
 
10
10
 
@@ -12,6 +12,6 @@ var usePagination = require('./use-pagination.cjs');
12
12
  exports.Pagination = pagination.Pagination;
13
13
  exports.PaginationCursor = paginationCursor.PaginationCursor;
14
14
  exports.PaginationItem = paginationItem.PaginationItem;
15
- exports.PaginationItemType = usePagination$1.PaginationItemType;
15
+ exports.PaginationItemType = usePaginationBase.PaginationItemType;
16
16
  exports.CURSOR_TRANSITION_TIMEOUT = usePagination.CURSOR_TRANSITION_TIMEOUT;
17
17
  exports.usePagination = usePagination.usePagination;
@@ -7,10 +7,10 @@ var $670gB$react = require('react');
7
7
  var i18n = require('@react-aria/i18n');
8
8
  var ouiTheme = require('@opengovsg/oui-theme');
9
9
  var utils = require('../system/utils.cjs');
10
- var usePagination$1 = require('./hooks/use-pagination.cjs');
11
10
  var paginationCursor = require('./pagination-cursor.cjs');
12
11
  var paginationItem = require('./pagination-item.cjs');
13
12
  var usePagination = require('./use-pagination.cjs');
13
+ var usePaginationBase = require('./use-pagination-base.cjs');
14
14
  var chevronLeft = require('../node_modules/.pnpm/lucide-react@0.475.0_react@19.2.3/node_modules/lucide-react/dist/esm/icons/chevron-left.cjs');
15
15
  var ellipsis = require('../node_modules/.pnpm/lucide-react@0.475.0_react@19.2.3/node_modules/lucide-react/dist/esm/icons/ellipsis.cjs');
16
16
  var chevronsRight = require('../node_modules/.pnpm/lucide-react@0.475.0_react@19.2.3/node_modules/lucide-react/dist/esm/icons/chevrons-right.cjs');
@@ -42,7 +42,7 @@ const Pagination = utils.forwardRef((props, ref) => {
42
42
  const isRTL = direction === "rtl";
43
43
  const renderChevronIcon = $670gB$react.useCallback(
44
44
  (key) => {
45
- if (key === usePagination$1.PaginationItemType.PREV && !isRTL || key === usePagination$1.PaginationItemType.NEXT && isRTL) {
45
+ if (key === usePaginationBase.PaginationItemType.PREV && !isRTL || key === usePaginationBase.PaginationItemType.NEXT && isRTL) {
46
46
  return /* @__PURE__ */ jsxRuntime.jsx(chevronLeft.default, {});
47
47
  }
48
48
  return /* @__PURE__ */ jsxRuntime.jsx(
@@ -66,11 +66,11 @@ const Pagination = utils.forwardRef((props, ref) => {
66
66
  "data-slot": "prev",
67
67
  getAriaLabel: getItemAriaLabel,
68
68
  isDisabled: props.isDisabled || !loop && activePage === 1,
69
- value: usePagination$1.PaginationItemType.PREV,
69
+ value: usePaginationBase.PaginationItemType.PREV,
70
70
  onPress: onPrevious,
71
- children: renderChevronIcon(usePagination$1.PaginationItemType.PREV)
71
+ children: renderChevronIcon(usePaginationBase.PaginationItemType.PREV)
72
72
  },
73
- usePagination$1.PaginationItemType.PREV
73
+ usePaginationBase.PaginationItemType.PREV
74
74
  );
75
75
  }, [
76
76
  slots,
@@ -92,11 +92,11 @@ const Pagination = utils.forwardRef((props, ref) => {
92
92
  "data-slot": "next",
93
93
  getAriaLabel: getItemAriaLabel,
94
94
  isDisabled: props.isDisabled || !loop && activePage === total,
95
- value: usePagination$1.PaginationItemType.NEXT,
95
+ value: usePaginationBase.PaginationItemType.NEXT,
96
96
  onPress: onNext,
97
- children: renderChevronIcon(usePagination$1.PaginationItemType.NEXT)
97
+ children: renderChevronIcon(usePaginationBase.PaginationItemType.NEXT)
98
98
  },
99
- usePagination$1.PaginationItemType.NEXT
99
+ usePaginationBase.PaginationItemType.NEXT
100
100
  );
101
101
  }, [
102
102
  slots,
@@ -114,19 +114,19 @@ const Pagination = utils.forwardRef((props, ref) => {
114
114
  const isBefore = index < range.indexOf(activePage);
115
115
  if (renderItemProp && typeof renderItemProp === "function") {
116
116
  let page = typeof value == "number" ? value : index;
117
- if (value === usePagination$1.PaginationItemType.NEXT) {
117
+ if (value === usePaginationBase.PaginationItemType.NEXT) {
118
118
  page = activePage + 1;
119
119
  }
120
- if (value === usePagination$1.PaginationItemType.PREV) {
120
+ if (value === usePaginationBase.PaginationItemType.PREV) {
121
121
  page = activePage - 1;
122
122
  }
123
- if (value === usePagination$1.PaginationItemType.DOTS) {
123
+ if (value === usePaginationBase.PaginationItemType.DOTS) {
124
124
  page = isBefore ? activePage - dotsJump >= 1 ? activePage - dotsJump : 1 : activePage + dotsJump <= total ? activePage + dotsJump : total;
125
125
  }
126
126
  const itemChildren = {
127
- [usePagination$1.PaginationItemType.PREV]: renderChevronIcon(usePagination$1.PaginationItemType.PREV),
128
- [usePagination$1.PaginationItemType.NEXT]: renderChevronIcon(usePagination$1.PaginationItemType.NEXT),
129
- [usePagination$1.PaginationItemType.DOTS]: /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
127
+ [usePaginationBase.PaginationItemType.PREV]: renderChevronIcon(usePaginationBase.PaginationItemType.PREV),
128
+ [usePaginationBase.PaginationItemType.NEXT]: renderChevronIcon(usePaginationBase.PaginationItemType.NEXT),
129
+ [usePaginationBase.PaginationItemType.DOTS]: /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
130
130
  /* @__PURE__ */ jsxRuntime.jsx(
131
131
  ellipsis.default,
132
132
  {
@@ -168,13 +168,13 @@ const Pagination = utils.forwardRef((props, ref) => {
168
168
  getAriaLabel: getItemAriaLabel
169
169
  });
170
170
  }
171
- if (value === usePagination$1.PaginationItemType.PREV) {
171
+ if (value === usePaginationBase.PaginationItemType.PREV) {
172
172
  return renderPrevItem();
173
173
  }
174
- if (value === usePagination$1.PaginationItemType.NEXT) {
174
+ if (value === usePaginationBase.PaginationItemType.NEXT) {
175
175
  return renderNextItem();
176
176
  }
177
- if (value === usePagination$1.PaginationItemType.DOTS) {
177
+ if (value === usePaginationBase.PaginationItemType.DOTS) {
178
178
  return /* @__PURE__ */ jsxRuntime.jsxs(
179
179
  paginationItem.PaginationItem,
180
180
  {
@@ -206,7 +206,7 @@ const Pagination = utils.forwardRef((props, ref) => {
206
206
  )
207
207
  ]
208
208
  },
209
- usePagination$1.PaginationItemType.DOTS + isBefore
209
+ usePaginationBase.PaginationItemType.DOTS + isBefore
210
210
  );
211
211
  }
212
212
  return /* @__PURE__ */ $670gB$react.createElement(
@@ -8,7 +8,7 @@ var useDeepCompare = require('use-deep-compare');
8
8
  var usehooksTs = require('usehooks-ts');
9
9
  var ouiTheme = require('@opengovsg/oui-theme');
10
10
  var utils = require('../system/utils.cjs');
11
- var usePagination$1 = require('./hooks/use-pagination.cjs');
11
+ var usePaginationBase = require('./use-pagination-base.cjs');
12
12
  var refs = require('../system/react-utils/refs.cjs');
13
13
 
14
14
  const CURSOR_TRANSITION_TIMEOUT = 300;
@@ -93,7 +93,7 @@ function usePagination(originalProps) {
93
93
  },
94
94
  [domRef]
95
95
  );
96
- const { range, activePage, setPage, previous, next, first, last } = usePagination$1.usePagination({
96
+ const { range, activePage, setPage, previous, next, first, last } = usePaginationBase.usePagination({
97
97
  page,
98
98
  total,
99
99
  initialPage,
@@ -179,11 +179,11 @@ function usePagination(originalProps) {
179
179
  return getItemAriaLabelProp(page2);
180
180
  }
181
181
  switch (page2) {
182
- case usePagination$1.PaginationItemType.DOTS:
182
+ case usePaginationBase.PaginationItemType.DOTS:
183
183
  return "dots element";
184
- case usePagination$1.PaginationItemType.PREV:
184
+ case usePaginationBase.PaginationItemType.PREV:
185
185
  return "previous page button";
186
- case usePagination$1.PaginationItemType.NEXT:
186
+ case usePaginationBase.PaginationItemType.NEXT:
187
187
  return "next page button";
188
188
  case "first":
189
189
  return "first page button";
@@ -8,11 +8,11 @@ var date = require('@internationalized/date');
8
8
  var reactAriaComponents = require('react-aria-components');
9
9
  var useDeepCompare = require('use-deep-compare');
10
10
  var ouiTheme = require('@opengovsg/oui-theme');
11
- var calendarStyleContext = require('../calendar/calendar-style-context.cjs');
12
11
  var agnosticCalendarStateContext = require('../calendar/agnostic-calendar-state-context.cjs');
13
12
  var calendarBottomContent = require('../calendar/calendar-bottom-content.cjs');
14
13
  var calendarGridHeader = require('../calendar/calendar-grid-header.cjs');
15
14
  var calendarHeader = require('../calendar/calendar-header.cjs');
15
+ var calendarStyleContext = require('../calendar/calendar-style-context.cjs');
16
16
  var utils = require('../system/utils.cjs');
17
17
 
18
18
  const RangeCalendar = utils.forwardRefGeneric(function RangeCalendar2(originalProps, ref) {
@@ -67,14 +67,7 @@ const TagFieldListInner = (props, ref) => {
67
67
  if (typeof props.children === "function") {
68
68
  return props.children({ ...childProps, itemProps });
69
69
  }
70
- return /* @__PURE__ */ $670gB$react.createElement(
71
- tagFieldItem.TagFieldItem,
72
- {
73
- ...childProps,
74
- ...itemProps,
75
- key
76
- }
77
- );
70
+ return /* @__PURE__ */ $670gB$react.createElement(tagFieldItem.TagFieldItem, { ...childProps, ...itemProps, key });
78
71
  }) });
79
72
  };
80
73
  const TagFieldList = utils.forwardRefGeneric(TagFieldListInner);
@@ -7,7 +7,7 @@ import { avatarStyles, dataAttr } from '@opengovsg/oui-theme';
7
7
  import { forwardRef, mapPropsVariants } from '../system/utils.js';
8
8
  import { AvatarContext, useAvatarContext } from './avatar-context.js';
9
9
  import { useAvatarGroupContext } from './avatar-group-context.js';
10
- import { useImageLoadingStatus } from './hooks/use-img-loading-status.js';
10
+ import { useImageLoadingStatus } from './use-img-loading-status.js';
11
11
  import { getInitialsFromText } from './utils.js';
12
12
  import { useDomRef } from '../system/react-utils/refs.js';
13
13
  import User from '../node_modules/.pnpm/lucide-react@0.475.0_react@19.2.3/node_modules/lucide-react/dist/esm/icons/user.js';
@@ -30,6 +30,7 @@ const Button = forwardRef(
30
30
  spinner: spinnerProp,
31
31
  isIconOnly,
32
32
  isAttached,
33
+ preserveWidth,
33
34
  ...props
34
35
  }, ref) => {
35
36
  const {
@@ -50,6 +51,7 @@ const Button = forwardRef(
50
51
  const spinnerSize = buttonSpinnerSizeMap[size];
51
52
  return /* @__PURE__ */ jsx(Spinner, { size: spinnerSize });
52
53
  }, [size, spinnerProp]);
54
+ const shouldPreserveWidth = isPending && preserveWidth && !loadingText && !pendingElement;
53
55
  return /* @__PURE__ */ jsx(
54
56
  Button$1,
55
57
  {
@@ -73,11 +75,14 @@ const Button = forwardRef(
73
75
  ref,
74
76
  children: (renderProps) => /* @__PURE__ */ jsxs(Fragment, { children: [
75
77
  renderChildren(renderProps, startContent),
76
- isPending && spinnerPlacement === "start" ? renderChildren(renderProps, spinner) : null,
77
- isPending ? null : renderChildren(renderProps, children),
78
+ isPending && !shouldPreserveWidth && spinnerPlacement === "start" ? renderChildren(renderProps, spinner) : null,
79
+ !isPending ? renderChildren(renderProps, children) : shouldPreserveWidth ? /* @__PURE__ */ jsxs("span", { className: "relative inline-flex items-center justify-center", children: [
80
+ /* @__PURE__ */ jsx("span", { "aria-hidden": true, className: "opacity-0", children: renderChildren(renderProps, children) }),
81
+ /* @__PURE__ */ jsx("span", { className: "absolute inset-0 flex items-center justify-center", children: renderChildren(renderProps, spinner) })
82
+ ] }) : null,
78
83
  isPending && loadingText ? loadingText : null,
79
84
  isPending && pendingElement ? renderChildren(renderProps, pendingElement) : null,
80
- isPending && spinnerPlacement === "end" ? renderChildren(renderProps, spinner) : null,
85
+ isPending && !shouldPreserveWidth && spinnerPlacement === "end" ? renderChildren(renderProps, spinner) : null,
81
86
  renderChildren(renderProps, endContent),
82
87
  !disableRipple && /* @__PURE__ */ jsx(Ripple, { onClear: onClearRipple, ripples })
83
88
  ] })
@@ -10,7 +10,7 @@ import { SelectItem } from '../select/select-item.js';
10
10
  import { AgnosticCalendarStateContext } from './agnostic-calendar-state-context.js';
11
11
  import { useCalendarStyleContext } from './calendar-style-context.js';
12
12
  import { i18nStrings } from './i18n.js';
13
- import { useCalendarSelectors } from './hooks/use-calendar-selectors.js';
13
+ import { useCalendarSelectors } from './use-calendar-selectors.js';
14
14
 
15
15
  const CalendarMonthDaySelector = () => {
16
16
  const { slots, size, classNames } = useCalendarStyleContext();
@@ -1,5 +1,9 @@
1
1
  "use strict";
2
+ export { AgnosticCalendarStateContext, useAgnosticCalendarStateContext } from './agnostic-calendar-state-context.js';
2
3
  export { Calendar, CalendarStateWrapper } from './calendar.js';
4
+ export { CalendarBottomContent } from './calendar-bottom-content.js';
5
+ export { CalendarGridHeader } from './calendar-grid-header.js';
6
+ export { CalendarHeader } from './calendar-header.js';
3
7
  export { CalendarStyleContext, useCalendarStyleContext } from './calendar-style-context.js';
4
8
  export { getEraFormat, useGenerateLocalizedMonths, useGenerateLocalizedYears, useLocalizedMonthYear } from './utils.js';
5
9
  export { CalendarDate } from '@internationalized/date';
@@ -2,7 +2,7 @@
2
2
  "use client";
3
3
  import { useMemo } from 'react';
4
4
  import { useDateFormatter } from 'react-aria';
5
- import { useGenerateLocalizedMonths, useGenerateLocalizedYears } from '../utils.js';
5
+ import { useGenerateLocalizedMonths, useGenerateLocalizedYears } from './utils.js';
6
6
 
7
7
  const useCalendarSelectors = (state) => {
8
8
  const yearRange = useMemo(() => {
@@ -1,10 +1,9 @@
1
1
  "use strict";
2
2
  "use client";
3
- import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
4
- import { useMemo } from 'react';
5
- import { useContextProps, ListBoxItem, Text, composeRenderProps } from 'react-aria-components';
6
- import { listBoxItemStyles } from '@opengovsg/oui-theme';
7
- import { forwardRef, mapPropsVariants } from '../system/utils.js';
3
+ import { jsx } from 'react/jsx-runtime';
4
+ import { useContextProps } from 'react-aria-components';
5
+ import { ListBoxItem } from '../list-box/list-box.js';
6
+ import { forwardRef } from '../system/utils.js';
8
7
  import { ComboBoxVariantContext } from './combo-box-variant-context.js';
9
8
 
10
9
  const ComboBoxItem = forwardRef(function ComboBoxItem2(originalProps, ref) {
@@ -13,56 +12,7 @@ const ComboBoxItem = forwardRef(function ComboBoxItem2(originalProps, ref) {
13
12
  ref,
14
13
  ComboBoxVariantContext
15
14
  );
16
- const [
17
- { className, description, children, classNames, ...props },
18
- variantProps
19
- ] = mapPropsVariants(originalProps, listBoxItemStyles.variantKeys);
20
- const styles = listBoxItemStyles(variantProps);
21
- const defaultTextValue = useMemo(() => {
22
- if (props.textValue) {
23
- return props.textValue;
24
- }
25
- if (typeof children === "string") {
26
- return children;
27
- }
28
- return void 0;
29
- }, [children, props.textValue]);
30
- return /* @__PURE__ */ jsx(
31
- ListBoxItem,
32
- {
33
- textValue: defaultTextValue,
34
- ...props,
35
- className: composeRenderProps(
36
- className ?? classNames?.container,
37
- (className2, renderProps) => styles.container({ ...renderProps, className: className2 })
38
- ),
39
- children: (renderProps) => {
40
- if (typeof children === "function") {
41
- return children(renderProps);
42
- }
43
- return /* @__PURE__ */ jsxs(Fragment, { children: [
44
- /* @__PURE__ */ jsx(
45
- Text,
46
- {
47
- className: styles.label({ className: classNames?.label }),
48
- slot: "label",
49
- children
50
- }
51
- ),
52
- description && /* @__PURE__ */ jsx(
53
- Text,
54
- {
55
- className: styles.description({
56
- className: classNames?.description
57
- }),
58
- slot: "description",
59
- children: description
60
- }
61
- )
62
- ] });
63
- }
64
- }
65
- );
15
+ return /* @__PURE__ */ jsx(ListBoxItem, { ref, ...originalProps });
66
16
  });
67
17
 
68
18
  export { ComboBoxItem };
@@ -1,11 +1,11 @@
1
1
  "use strict";
2
2
  "use client";
3
3
  import { jsx, jsxs } from 'react/jsx-runtime';
4
- import { ErrorCode, useDropzone } from 'react-dropzone';
5
4
  import { useCallback, useMemo, useEffect } from 'react';
6
5
  import { useFormValidationState } from '@react-stately/form';
7
6
  import { useField, useId } from 'react-aria';
8
7
  import { Provider, LabelContext, GroupContext, TextContext, FieldErrorContext, Group } from 'react-aria-components';
8
+ import { ErrorCode, useDropzone } from 'react-dropzone';
9
9
  import { fileDropzoneStyles, dataAttr } from '@opengovsg/oui-theme';
10
10
  import { Label, Description, FieldError } from '../field/field.js';
11
11
  import { useControllableState } from '../hooks/use-controllable-state.js';
@@ -88,7 +88,11 @@ const FileDropzone = (originalProps) => {
88
88
  (file) => {
89
89
  const errors = [];
90
90
  if (maxFileSizeByType.length > 0) {
91
- const limit = resolveMaxFileSize(file.type, maxFileSizeByType, maxFileSize);
91
+ const limit = resolveMaxFileSize(
92
+ file.type,
93
+ maxFileSizeByType,
94
+ maxFileSize
95
+ );
92
96
  if (limit !== Number.POSITIVE_INFINITY && file.size > limit) {
93
97
  errors.push({
94
98
  code: ErrorCode.FileTooLarge,
@@ -196,7 +200,14 @@ const FileDropzone = (originalProps) => {
196
200
  return `Minimum file size: ${formatBytes(minFileSize, 2, fileSizeBase)}`;
197
201
  }
198
202
  return null;
199
- }, [maxFileSize, maxFileSizeByType, minFileSize, showFileSizeText, fileSizeBase, fileSizeTextOverride]);
203
+ }, [
204
+ maxFileSize,
205
+ maxFileSizeByType,
206
+ minFileSize,
207
+ showFileSizeText,
208
+ fileSizeBase,
209
+ fileSizeTextOverride
210
+ ]);
200
211
  const triggerFileSelector = useCallback(() => {
201
212
  if (isDisabled || isReadOnly) return;
202
213
  dropzoneState.inputRef.current?.click();