@opengovsg/oui 0.0.0-snapshot-20251203100754 → 0.0.0-snapshot-20251216073051
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.
- package/dist/cjs/badge/badge.cjs +5 -5
- package/dist/cjs/badge/use-badge.cjs +6 -6
- package/dist/cjs/banner/banner.cjs +6 -6
- package/dist/cjs/button/button.cjs +4 -4
- package/dist/cjs/calendar/calendar-bottom-content.cjs +3 -3
- package/dist/cjs/calendar/calendar-header.cjs +4 -4
- package/dist/cjs/calendar/calendar-month-day-selector.cjs +4 -4
- package/dist/cjs/calendar/calendar.cjs +4 -4
- package/dist/cjs/calendar/hooks/use-calendar-selectors.cjs +4 -4
- package/dist/cjs/calendar/utils.cjs +3 -3
- package/dist/cjs/checkbox/checkbox.cjs +3 -3
- package/dist/cjs/combo-box/combo-box-fuzzy.cjs +6 -6
- package/dist/cjs/combo-box/combo-box-item.cjs +2 -2
- package/dist/cjs/combo-box/combo-box.cjs +8 -8
- package/dist/cjs/date-field/date-field.cjs +4 -4
- package/dist/cjs/date-picker/date-picker.cjs +6 -6
- package/dist/cjs/date-range-picker/date-range-picker.cjs +8 -8
- package/dist/cjs/field/field.cjs +3 -3
- package/dist/cjs/file-dropzone/file-dropzone.cjs +13 -13
- package/dist/cjs/file-dropzone/file-info.cjs +4 -4
- package/dist/cjs/govt-banner/govt-banner.cjs +7 -7
- package/dist/cjs/hooks/use-callback-ref.cjs +4 -4
- package/dist/cjs/hooks/use-controllable-state.cjs +2 -2
- package/dist/cjs/hooks/use-draggable.cjs +8 -8
- package/dist/cjs/hooks/use-scroll-position.cjs +53 -0
- package/dist/cjs/index.cjs +48 -22
- package/dist/cjs/input/input.cjs +2 -2
- package/dist/cjs/menu/menu.cjs +9 -9
- package/dist/cjs/modal/modal-body.cjs +2 -2
- package/dist/cjs/modal/modal-content.cjs +4 -4
- package/dist/cjs/modal/modal-footer.cjs +2 -2
- package/dist/cjs/modal/modal-header.cjs +2 -2
- package/dist/cjs/modal/modal.cjs +3 -3
- package/dist/cjs/navbar/index.cjs +25 -0
- package/dist/cjs/navbar/navbar-brand.cjs +28 -0
- package/dist/cjs/navbar/navbar-content.cjs +33 -0
- package/dist/cjs/navbar/navbar-context.cjs +14 -0
- package/dist/cjs/navbar/navbar-item.cjs +29 -0
- package/dist/cjs/navbar/navbar-menu/i18n.cjs +23 -0
- package/dist/cjs/navbar/navbar-menu/item.cjs +44 -0
- package/dist/cjs/navbar/navbar-menu/menu.cjs +62 -0
- package/dist/cjs/navbar/navbar-menu/toggle.cjs +95 -0
- package/dist/cjs/navbar/navbar.cjs +50 -0
- package/dist/cjs/navbar/use-navbar.cjs +126 -0
- package/dist/cjs/node_modules/.pnpm/@react-aria_overlays@3.30.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@react-aria/overlays/dist/Overlay.cjs +55 -0
- package/dist/cjs/node_modules/.pnpm/@react-aria_overlays@3.30.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@react-aria/overlays/dist/PortalProvider.cjs +23 -0
- package/dist/cjs/node_modules/.pnpm/@react-aria_overlays@3.30.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@react-aria/overlays/dist/usePreventScroll.cjs +208 -0
- package/dist/cjs/node_modules/.pnpm/@react-aria_ssr@3.9.10_react@19.2.3/node_modules/@react-aria/ssr/dist/SSRProvider.cjs +104 -0
- package/dist/cjs/node_modules/.pnpm/{lucide-react@0.475.0_react@19.0.0 → lucide-react@0.475.0_react@19.2.3}/node_modules/lucide-react/dist/esm/Icon.cjs +4 -4
- package/dist/cjs/node_modules/.pnpm/{lucide-react@0.475.0_react@19.0.0 → lucide-react@0.475.0_react@19.2.3}/node_modules/lucide-react/dist/esm/createLucideIcon.cjs +3 -3
- package/dist/cjs/number-field/number-field.cjs +3 -3
- package/dist/cjs/pagination/hooks/use-pagination.cjs +7 -7
- package/dist/cjs/pagination/pagination.cjs +9 -9
- package/dist/cjs/pagination/use-pagination-item.cjs +3 -3
- package/dist/cjs/pagination/use-pagination.cjs +8 -8
- package/dist/cjs/range-calendar/range-calendar.cjs +6 -6
- package/dist/cjs/ripple/use-ripple.cjs +4 -4
- package/dist/cjs/select/select.cjs +5 -5
- package/dist/cjs/spinner/use-spinner.cjs +3 -3
- package/dist/cjs/system/react-utils/children.cjs +26 -0
- package/dist/cjs/system/react-utils/context.cjs +3 -3
- package/dist/cjs/system/react-utils/refs.cjs +3 -3
- package/dist/cjs/system/utils.cjs +2 -50
- package/dist/cjs/tabs/tabs.cjs +2 -2
- package/dist/cjs/tag-field/tag-field-item.cjs +2 -2
- package/dist/cjs/tag-field/tag-field-list.cjs +4 -4
- package/dist/cjs/tag-field/tag-field-root.cjs +14 -14
- package/dist/cjs/tag-field/tag-field-state-context.cjs +2 -2
- package/dist/cjs/tag-field/tag-field-tag-list.cjs +4 -4
- package/dist/cjs/tag-field/tag-field-trigger.cjs +2 -2
- package/dist/cjs/tag-field/tag-field.cjs +6 -6
- package/dist/cjs/tag-field/use-tag-field-state.cjs +6 -6
- package/dist/cjs/tag-field/use-tag-field.cjs +4 -4
- package/dist/cjs/text-area/text-area.cjs +2 -2
- package/dist/cjs/text-area-field/text-area-field.cjs +1 -1
- package/dist/cjs/text-field/text-field.cjs +1 -1
- package/dist/cjs/toast/index.cjs +13 -0
- package/dist/cjs/toast/toast.cjs +91 -0
- package/dist/cjs/toggle/toggle.cjs +3 -3
- package/dist/esm/badge/badge.js +1 -1
- package/dist/esm/banner/banner.js +3 -3
- package/dist/esm/button/button.js +1 -1
- package/dist/esm/calendar/calendar-header.js +2 -2
- package/dist/esm/calendar/calendar-month-day-selector.js +2 -2
- package/dist/esm/checkbox/checkbox.js +3 -3
- package/dist/esm/combo-box/combo-box.js +5 -5
- package/dist/esm/date-field/date-field.js +1 -1
- package/dist/esm/date-picker/date-picker.js +4 -4
- package/dist/esm/date-range-picker/date-range-picker.js +5 -5
- package/dist/esm/field/field.js +1 -1
- package/dist/esm/file-dropzone/file-dropzone.js +3 -3
- package/dist/esm/file-dropzone/file-info.js +1 -1
- package/dist/esm/govt-banner/govt-banner.js +4 -4
- package/dist/esm/hooks/use-scroll-position.js +51 -0
- package/dist/esm/index.js +19 -8
- package/dist/esm/menu/menu.js +3 -3
- package/dist/esm/modal/modal-content.js +1 -1
- package/dist/esm/navbar/index.js +10 -0
- package/dist/esm/navbar/navbar-brand.js +26 -0
- package/dist/esm/navbar/navbar-content.js +31 -0
- package/dist/esm/navbar/navbar-context.js +11 -0
- package/dist/esm/navbar/navbar-item.js +27 -0
- package/dist/esm/navbar/navbar-menu/i18n.js +21 -0
- package/dist/esm/navbar/navbar-menu/item.js +42 -0
- package/dist/esm/navbar/navbar-menu/menu.js +60 -0
- package/dist/esm/navbar/navbar-menu/toggle.js +93 -0
- package/dist/esm/navbar/navbar.js +48 -0
- package/dist/esm/navbar/use-navbar.js +124 -0
- package/dist/esm/node_modules/.pnpm/@react-aria_overlays@3.30.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@react-aria/overlays/dist/Overlay.js +52 -0
- package/dist/esm/node_modules/.pnpm/@react-aria_overlays@3.30.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@react-aria/overlays/dist/PortalProvider.js +20 -0
- package/dist/esm/node_modules/.pnpm/@react-aria_overlays@3.30.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@react-aria/overlays/dist/usePreventScroll.js +206 -0
- package/dist/esm/node_modules/.pnpm/@react-aria_ssr@3.9.10_react@19.2.3/node_modules/@react-aria/ssr/dist/SSRProvider.js +102 -0
- package/dist/esm/number-field/number-field.js +3 -3
- package/dist/esm/pagination/pagination.js +3 -3
- package/dist/esm/pagination/use-pagination-item.js +1 -1
- package/dist/esm/select/select.js +3 -3
- package/dist/esm/system/react-utils/children.js +23 -0
- package/dist/esm/system/utils.js +2 -49
- package/dist/esm/tag-field/tag-field-tag-list.js +1 -1
- package/dist/esm/tag-field/tag-field.js +4 -4
- package/dist/esm/text-area-field/text-area-field.js +1 -1
- package/dist/esm/text-field/text-field.js +1 -1
- package/dist/esm/toast/index.js +3 -0
- package/dist/esm/toast/toast.js +86 -0
- package/dist/types/hooks/use-scroll-position.d.ts +29 -0
- package/dist/types/hooks/use-scroll-position.d.ts.map +1 -0
- package/dist/types/index.d.mts +2 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/navbar/index.d.ts +17 -0
- package/dist/types/navbar/index.d.ts.map +1 -0
- package/dist/types/navbar/navbar-brand.d.ts +6 -0
- package/dist/types/navbar/navbar-brand.d.ts.map +1 -0
- package/dist/types/navbar/navbar-content.d.ts +14 -0
- package/dist/types/navbar/navbar-content.d.ts.map +1 -0
- package/dist/types/navbar/navbar-context.d.ts +182 -0
- package/dist/types/navbar/navbar-context.d.ts.map +1 -0
- package/dist/types/navbar/navbar-item.d.ts +11 -0
- package/dist/types/navbar/navbar-item.d.ts.map +1 -0
- package/dist/types/navbar/navbar-menu/i18n.d.ts +3 -0
- package/dist/types/navbar/navbar-menu/i18n.d.ts.map +1 -0
- package/dist/types/navbar/navbar-menu/item.d.ts +16 -0
- package/dist/types/navbar/navbar-menu/item.d.ts.map +1 -0
- package/dist/types/navbar/navbar-menu/menu.d.ts +11 -0
- package/dist/types/navbar/navbar-menu/menu.d.ts.map +1 -0
- package/dist/types/navbar/navbar-menu/toggle.d.ts +12 -0
- package/dist/types/navbar/navbar-menu/toggle.d.ts.map +1 -0
- package/dist/types/navbar/navbar.d.ts +6 -0
- package/dist/types/navbar/navbar.d.ts.map +1 -0
- package/dist/types/navbar/use-navbar.d.ts +163 -0
- package/dist/types/navbar/use-navbar.d.ts.map +1 -0
- package/dist/types/spinner/use-spinner.d.ts +8 -8
- package/dist/types/system/react-utils/children.d.ts +10 -0
- package/dist/types/system/react-utils/children.d.ts.map +1 -0
- package/dist/types/system/react-utils/index.d.ts +5 -3
- package/dist/types/system/react-utils/index.d.ts.map +1 -1
- package/dist/types/system/utils.d.ts +1 -833
- package/dist/types/system/utils.d.ts.map +1 -1
- package/dist/types/toast/index.d.ts +3 -0
- package/dist/types/toast/index.d.ts.map +1 -0
- package/dist/types/toast/toast.d.ts +9 -0
- package/dist/types/toast/toast.d.ts.map +1 -0
- package/package.json +8 -7
- /package/dist/cjs/node_modules/.pnpm/{lucide-react@0.475.0_react@19.0.0 → lucide-react@0.475.0_react@19.2.3}/node_modules/lucide-react/dist/esm/defaultAttributes.cjs +0 -0
- /package/dist/cjs/node_modules/.pnpm/{lucide-react@0.475.0_react@19.0.0 → lucide-react@0.475.0_react@19.2.3}/node_modules/lucide-react/dist/esm/icons/calendar.cjs +0 -0
- /package/dist/cjs/node_modules/.pnpm/{lucide-react@0.475.0_react@19.0.0 → lucide-react@0.475.0_react@19.2.3}/node_modules/lucide-react/dist/esm/icons/check.cjs +0 -0
- /package/dist/cjs/node_modules/.pnpm/{lucide-react@0.475.0_react@19.0.0 → lucide-react@0.475.0_react@19.2.3}/node_modules/lucide-react/dist/esm/icons/chevron-down.cjs +0 -0
- /package/dist/cjs/node_modules/.pnpm/{lucide-react@0.475.0_react@19.0.0 → lucide-react@0.475.0_react@19.2.3}/node_modules/lucide-react/dist/esm/icons/chevron-left.cjs +0 -0
- /package/dist/cjs/node_modules/.pnpm/{lucide-react@0.475.0_react@19.0.0 → lucide-react@0.475.0_react@19.2.3}/node_modules/lucide-react/dist/esm/icons/chevron-right.cjs +0 -0
- /package/dist/cjs/node_modules/.pnpm/{lucide-react@0.475.0_react@19.0.0 → lucide-react@0.475.0_react@19.2.3}/node_modules/lucide-react/dist/esm/icons/chevron-up.cjs +0 -0
- /package/dist/cjs/node_modules/.pnpm/{lucide-react@0.475.0_react@19.0.0 → lucide-react@0.475.0_react@19.2.3}/node_modules/lucide-react/dist/esm/icons/chevrons-right.cjs +0 -0
- /package/dist/cjs/node_modules/.pnpm/{lucide-react@0.475.0_react@19.0.0 → lucide-react@0.475.0_react@19.2.3}/node_modules/lucide-react/dist/esm/icons/circle-alert.cjs +0 -0
- /package/dist/cjs/node_modules/.pnpm/{lucide-react@0.475.0_react@19.0.0 → lucide-react@0.475.0_react@19.2.3}/node_modules/lucide-react/dist/esm/icons/ellipsis.cjs +0 -0
- /package/dist/cjs/node_modules/.pnpm/{lucide-react@0.475.0_react@19.0.0 → lucide-react@0.475.0_react@19.2.3}/node_modules/lucide-react/dist/esm/icons/external-link.cjs +0 -0
- /package/dist/cjs/node_modules/.pnpm/{lucide-react@0.475.0_react@19.0.0 → lucide-react@0.475.0_react@19.2.3}/node_modules/lucide-react/dist/esm/icons/info.cjs +0 -0
- /package/dist/cjs/node_modules/.pnpm/{lucide-react@0.475.0_react@19.0.0 → lucide-react@0.475.0_react@19.2.3}/node_modules/lucide-react/dist/esm/icons/landmark.cjs +0 -0
- /package/dist/cjs/node_modules/.pnpm/{lucide-react@0.475.0_react@19.0.0 → lucide-react@0.475.0_react@19.2.3}/node_modules/lucide-react/dist/esm/icons/lock.cjs +0 -0
- /package/dist/cjs/node_modules/.pnpm/{lucide-react@0.475.0_react@19.0.0 → lucide-react@0.475.0_react@19.2.3}/node_modules/lucide-react/dist/esm/icons/minus.cjs +0 -0
- /package/dist/cjs/node_modules/.pnpm/{lucide-react@0.475.0_react@19.0.0 → lucide-react@0.475.0_react@19.2.3}/node_modules/lucide-react/dist/esm/icons/plus.cjs +0 -0
- /package/dist/cjs/node_modules/.pnpm/{lucide-react@0.475.0_react@19.0.0 → lucide-react@0.475.0_react@19.2.3}/node_modules/lucide-react/dist/esm/icons/trash-2.cjs +0 -0
- /package/dist/cjs/node_modules/.pnpm/{lucide-react@0.475.0_react@19.0.0 → lucide-react@0.475.0_react@19.2.3}/node_modules/lucide-react/dist/esm/icons/upload.cjs +0 -0
- /package/dist/cjs/node_modules/.pnpm/{lucide-react@0.475.0_react@19.0.0 → lucide-react@0.475.0_react@19.2.3}/node_modules/lucide-react/dist/esm/icons/x.cjs +0 -0
- /package/dist/cjs/node_modules/.pnpm/{lucide-react@0.475.0_react@19.0.0 → lucide-react@0.475.0_react@19.2.3}/node_modules/lucide-react/dist/esm/shared/src/utils.cjs +0 -0
- /package/dist/esm/node_modules/.pnpm/{lucide-react@0.475.0_react@19.0.0 → lucide-react@0.475.0_react@19.2.3}/node_modules/lucide-react/dist/esm/Icon.js +0 -0
- /package/dist/esm/node_modules/.pnpm/{lucide-react@0.475.0_react@19.0.0 → lucide-react@0.475.0_react@19.2.3}/node_modules/lucide-react/dist/esm/createLucideIcon.js +0 -0
- /package/dist/esm/node_modules/.pnpm/{lucide-react@0.475.0_react@19.0.0 → lucide-react@0.475.0_react@19.2.3}/node_modules/lucide-react/dist/esm/defaultAttributes.js +0 -0
- /package/dist/esm/node_modules/.pnpm/{lucide-react@0.475.0_react@19.0.0 → lucide-react@0.475.0_react@19.2.3}/node_modules/lucide-react/dist/esm/icons/calendar.js +0 -0
- /package/dist/esm/node_modules/.pnpm/{lucide-react@0.475.0_react@19.0.0 → lucide-react@0.475.0_react@19.2.3}/node_modules/lucide-react/dist/esm/icons/check.js +0 -0
- /package/dist/esm/node_modules/.pnpm/{lucide-react@0.475.0_react@19.0.0 → lucide-react@0.475.0_react@19.2.3}/node_modules/lucide-react/dist/esm/icons/chevron-down.js +0 -0
- /package/dist/esm/node_modules/.pnpm/{lucide-react@0.475.0_react@19.0.0 → lucide-react@0.475.0_react@19.2.3}/node_modules/lucide-react/dist/esm/icons/chevron-left.js +0 -0
- /package/dist/esm/node_modules/.pnpm/{lucide-react@0.475.0_react@19.0.0 → lucide-react@0.475.0_react@19.2.3}/node_modules/lucide-react/dist/esm/icons/chevron-right.js +0 -0
- /package/dist/esm/node_modules/.pnpm/{lucide-react@0.475.0_react@19.0.0 → lucide-react@0.475.0_react@19.2.3}/node_modules/lucide-react/dist/esm/icons/chevron-up.js +0 -0
- /package/dist/esm/node_modules/.pnpm/{lucide-react@0.475.0_react@19.0.0 → lucide-react@0.475.0_react@19.2.3}/node_modules/lucide-react/dist/esm/icons/chevrons-right.js +0 -0
- /package/dist/esm/node_modules/.pnpm/{lucide-react@0.475.0_react@19.0.0 → lucide-react@0.475.0_react@19.2.3}/node_modules/lucide-react/dist/esm/icons/circle-alert.js +0 -0
- /package/dist/esm/node_modules/.pnpm/{lucide-react@0.475.0_react@19.0.0 → lucide-react@0.475.0_react@19.2.3}/node_modules/lucide-react/dist/esm/icons/ellipsis.js +0 -0
- /package/dist/esm/node_modules/.pnpm/{lucide-react@0.475.0_react@19.0.0 → lucide-react@0.475.0_react@19.2.3}/node_modules/lucide-react/dist/esm/icons/external-link.js +0 -0
- /package/dist/esm/node_modules/.pnpm/{lucide-react@0.475.0_react@19.0.0 → lucide-react@0.475.0_react@19.2.3}/node_modules/lucide-react/dist/esm/icons/info.js +0 -0
- /package/dist/esm/node_modules/.pnpm/{lucide-react@0.475.0_react@19.0.0 → lucide-react@0.475.0_react@19.2.3}/node_modules/lucide-react/dist/esm/icons/landmark.js +0 -0
- /package/dist/esm/node_modules/.pnpm/{lucide-react@0.475.0_react@19.0.0 → lucide-react@0.475.0_react@19.2.3}/node_modules/lucide-react/dist/esm/icons/lock.js +0 -0
- /package/dist/esm/node_modules/.pnpm/{lucide-react@0.475.0_react@19.0.0 → lucide-react@0.475.0_react@19.2.3}/node_modules/lucide-react/dist/esm/icons/minus.js +0 -0
- /package/dist/esm/node_modules/.pnpm/{lucide-react@0.475.0_react@19.0.0 → lucide-react@0.475.0_react@19.2.3}/node_modules/lucide-react/dist/esm/icons/plus.js +0 -0
- /package/dist/esm/node_modules/.pnpm/{lucide-react@0.475.0_react@19.0.0 → lucide-react@0.475.0_react@19.2.3}/node_modules/lucide-react/dist/esm/icons/trash-2.js +0 -0
- /package/dist/esm/node_modules/.pnpm/{lucide-react@0.475.0_react@19.0.0 → lucide-react@0.475.0_react@19.2.3}/node_modules/lucide-react/dist/esm/icons/upload.js +0 -0
- /package/dist/esm/node_modules/.pnpm/{lucide-react@0.475.0_react@19.0.0 → lucide-react@0.475.0_react@19.2.3}/node_modules/lucide-react/dist/esm/icons/x.js +0 -0
- /package/dist/esm/node_modules/.pnpm/{lucide-react@0.475.0_react@19.0.0 → lucide-react@0.475.0_react@19.2.3}/node_modules/lucide-react/dist/esm/shared/src/utils.js +0 -0
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
'use strict';
|
|
4
4
|
|
|
5
5
|
var jsxRuntime = require('react/jsx-runtime');
|
|
6
|
-
var react = require('react');
|
|
6
|
+
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');
|
|
@@ -21,12 +21,12 @@ const Toggle = ({
|
|
|
21
21
|
ouiTheme.toggleStyles.variantKeys
|
|
22
22
|
);
|
|
23
23
|
const slots = ouiTheme.toggleStyles(variantProps);
|
|
24
|
-
const clonedThumbIcon = react.useCallback(
|
|
24
|
+
const clonedThumbIcon = $670gB$react.useCallback(
|
|
25
25
|
(renderProps) => {
|
|
26
26
|
const baseProps = {
|
|
27
27
|
className: slots.thumbIcon({ className: classNames?.thumbIcon })
|
|
28
28
|
};
|
|
29
|
-
return typeof thumbIcon === "function" ? thumbIcon(reactAria.mergeProps(baseProps, renderProps)) : thumbIcon && react.cloneElement(thumbIcon, baseProps);
|
|
29
|
+
return typeof thumbIcon === "function" ? thumbIcon(reactAria.mergeProps(baseProps, renderProps)) : thumbIcon && $670gB$react.cloneElement(thumbIcon, baseProps);
|
|
30
30
|
},
|
|
31
31
|
[classNames?.thumbIcon, slots, thumbIcon]
|
|
32
32
|
);
|
package/dist/esm/badge/badge.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
4
4
|
import { forwardRef, useMemo } from 'react';
|
|
5
5
|
import { useBadge } from './use-badge.js';
|
|
6
|
-
import X from '../node_modules/.pnpm/lucide-react@0.475.0_react@19.
|
|
6
|
+
import X from '../node_modules/.pnpm/lucide-react@0.475.0_react@19.2.3/node_modules/lucide-react/dist/esm/icons/x.js';
|
|
7
7
|
|
|
8
8
|
const Badge = forwardRef((props, ref) => {
|
|
9
9
|
const {
|
|
@@ -5,10 +5,10 @@ import { useMemo, useRef } from 'react';
|
|
|
5
5
|
import { useMessageFormatter, useDisclosure } from 'react-aria';
|
|
6
6
|
import { useDisclosureState } from 'react-stately';
|
|
7
7
|
import { bannerStyles } from '@opengovsg/oui-theme';
|
|
8
|
-
import CircleAlert from '../node_modules/.pnpm/lucide-react@0.475.0_react@19.
|
|
9
|
-
import Info from '../node_modules/.pnpm/lucide-react@0.475.0_react@19.
|
|
8
|
+
import CircleAlert from '../node_modules/.pnpm/lucide-react@0.475.0_react@19.2.3/node_modules/lucide-react/dist/esm/icons/circle-alert.js';
|
|
9
|
+
import Info from '../node_modules/.pnpm/lucide-react@0.475.0_react@19.2.3/node_modules/lucide-react/dist/esm/icons/info.js';
|
|
10
10
|
import { Button } from '../button/button.js';
|
|
11
|
-
import X from '../node_modules/.pnpm/lucide-react@0.475.0_react@19.
|
|
11
|
+
import X from '../node_modules/.pnpm/lucide-react@0.475.0_react@19.2.3/node_modules/lucide-react/dist/esm/icons/x.js';
|
|
12
12
|
|
|
13
13
|
const i18nStrings = {
|
|
14
14
|
"en-SG": {
|
|
@@ -5,9 +5,9 @@ import { forwardRef, useMemo } from 'react';
|
|
|
5
5
|
import { chain } from '@react-aria/utils';
|
|
6
6
|
import { Button as Button$1, composeRenderProps } from 'react-aria-components';
|
|
7
7
|
import { buttonStyles } from '@opengovsg/oui-theme';
|
|
8
|
-
import { Ripple } from '../ripple/ripple.js';
|
|
9
8
|
import { useRipple } from '../ripple/use-ripple.js';
|
|
10
9
|
import { Spinner } from '../spinner/spinner.js';
|
|
10
|
+
import { Ripple } from '../ripple/ripple.js';
|
|
11
11
|
|
|
12
12
|
const Button = forwardRef(
|
|
13
13
|
({
|
|
@@ -8,8 +8,8 @@ import { AgnosticCalendarStateContext } from './agnostic-calendar-state-context.
|
|
|
8
8
|
import { CalendarMonthDaySelector } from './calendar-month-day-selector.js';
|
|
9
9
|
import { useCalendarStyleContext } from './calendar-style-context.js';
|
|
10
10
|
import { useLocalizedMonthYear } from './utils.js';
|
|
11
|
-
import ChevronRight from '../node_modules/.pnpm/lucide-react@0.475.0_react@19.
|
|
12
|
-
import ChevronLeft from '../node_modules/.pnpm/lucide-react@0.475.0_react@19.
|
|
11
|
+
import ChevronRight from '../node_modules/.pnpm/lucide-react@0.475.0_react@19.2.3/node_modules/lucide-react/dist/esm/icons/chevron-right.js';
|
|
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
|
|
|
14
14
|
function CalendarHeader({ offsetMonths = 0 }) {
|
|
15
15
|
const { direction } = useLocale();
|
|
@@ -4,11 +4,11 @@ import { jsx } from 'react/jsx-runtime';
|
|
|
4
4
|
import { useContext } from 'react';
|
|
5
5
|
import { CalendarDate } from '@internationalized/date';
|
|
6
6
|
import { Group } from 'react-aria-components';
|
|
7
|
-
import { Select } from '../select/select.js';
|
|
8
|
-
import { SelectItem } from '../select/select-item.js';
|
|
9
7
|
import { AgnosticCalendarStateContext } from './agnostic-calendar-state-context.js';
|
|
10
8
|
import { useCalendarStyleContext } from './calendar-style-context.js';
|
|
11
9
|
import { useCalendarSelectors } from './hooks/use-calendar-selectors.js';
|
|
10
|
+
import { Select } from '../select/select.js';
|
|
11
|
+
import { SelectItem } from '../select/select-item.js';
|
|
12
12
|
import { useCalendarI18n } from './hooks/use-calendar-i18n.js';
|
|
13
13
|
|
|
14
14
|
const CalendarMonthDaySelector = () => {
|
|
@@ -3,11 +3,11 @@
|
|
|
3
3
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
4
4
|
import { Checkbox as Checkbox$1, composeRenderProps, Provider, CheckboxGroup as CheckboxGroup$1 } from 'react-aria-components';
|
|
5
5
|
import { checkboxStyles, checkboxGroupStyles } from '@opengovsg/oui-theme';
|
|
6
|
-
import { Label, Description, FieldError } from '../field/field.js';
|
|
7
6
|
import { mapPropsVariants } from '../system/utils.js';
|
|
8
7
|
import { useCheckboxGroupStyleContext, CheckboxGroupStyleContext } from './checkbox-group-style-context.js';
|
|
9
|
-
import Minus from '../node_modules/.pnpm/lucide-react@0.475.0_react@19.
|
|
10
|
-
import Check from '../node_modules/.pnpm/lucide-react@0.475.0_react@19.
|
|
8
|
+
import Minus from '../node_modules/.pnpm/lucide-react@0.475.0_react@19.2.3/node_modules/lucide-react/dist/esm/icons/minus.js';
|
|
9
|
+
import Check from '../node_modules/.pnpm/lucide-react@0.475.0_react@19.2.3/node_modules/lucide-react/dist/esm/icons/check.js';
|
|
10
|
+
import { Label, Description, FieldError } from '../field/field.js';
|
|
11
11
|
|
|
12
12
|
const Checkbox = ({
|
|
13
13
|
classNames,
|
|
@@ -5,13 +5,13 @@ import { useMemo, useCallback } from 'react';
|
|
|
5
5
|
import { useMessageFormatter } from 'react-aria';
|
|
6
6
|
import { ListLayout, Provider, ComboBox as ComboBox$1, Input, Button, Virtualizer, ListBox } from 'react-aria-components';
|
|
7
7
|
import { listBoxItemStyles, cn, comboBoxStyles, composeTailwindRenderProps, composeRenderProps, comboBoxClearButtonStyles } from '@opengovsg/oui-theme';
|
|
8
|
-
import { Label, FieldGroup, Description, FieldError } from '../field/field.js';
|
|
9
|
-
import { Popover } from '../popover/popover.js';
|
|
10
8
|
import { mapPropsVariants } from '../system/utils.js';
|
|
11
9
|
import { ComboBoxVariantContext } from './combo-box-variant-context.js';
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import
|
|
10
|
+
import { Label, FieldGroup, Description, FieldError } from '../field/field.js';
|
|
11
|
+
import ChevronUp from '../node_modules/.pnpm/lucide-react@0.475.0_react@19.2.3/node_modules/lucide-react/dist/esm/icons/chevron-up.js';
|
|
12
|
+
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';
|
|
13
|
+
import X from '../node_modules/.pnpm/lucide-react@0.475.0_react@19.2.3/node_modules/lucide-react/dist/esm/icons/x.js';
|
|
14
|
+
import { Popover } from '../popover/popover.js';
|
|
15
15
|
|
|
16
16
|
const calculateEstimatedRowHeight = (size) => {
|
|
17
17
|
switch (size) {
|
|
@@ -4,8 +4,8 @@ import { jsxs, jsx } from 'react/jsx-runtime';
|
|
|
4
4
|
import { useMemo } from 'react';
|
|
5
5
|
import { DateField as DateField$1, DateInput as DateInput$1, DateSegment } from 'react-aria-components';
|
|
6
6
|
import { dateFieldStyles, composeTailwindRenderProps, dateInputStyles, composeRenderProps } from '@opengovsg/oui-theme';
|
|
7
|
-
import { Label, Description, FieldError } from '../field/field.js';
|
|
8
7
|
import { mapPropsVariants } from '../system/utils.js';
|
|
8
|
+
import { Label, Description, FieldError } from '../field/field.js';
|
|
9
9
|
|
|
10
10
|
function DateField(originalProps) {
|
|
11
11
|
const [
|
|
@@ -4,13 +4,13 @@ import { jsxs, jsx } from 'react/jsx-runtime';
|
|
|
4
4
|
import { useMemo } from 'react';
|
|
5
5
|
import { DatePicker as DatePicker$1, Dialog } from 'react-aria-components';
|
|
6
6
|
import { datePickerStyles, composeTailwindRenderProps } from '@opengovsg/oui-theme';
|
|
7
|
-
import { DateInput } from '../date-field/date-field.js';
|
|
8
|
-
import { Label, FieldGroup, Description, FieldError } from '../field/field.js';
|
|
9
|
-
import { Popover } from '../popover/popover.js';
|
|
10
7
|
import { mapPropsVariants } from '../system/utils.js';
|
|
11
|
-
import
|
|
8
|
+
import { DateInput } from '../date-field/date-field.js';
|
|
9
|
+
import Calendar from '../node_modules/.pnpm/lucide-react@0.475.0_react@19.2.3/node_modules/lucide-react/dist/esm/icons/calendar.js';
|
|
12
10
|
import { Calendar as Calendar$1 } from '../calendar/calendar.js';
|
|
11
|
+
import { Label, FieldGroup, Description, FieldError } from '../field/field.js';
|
|
13
12
|
import { Button } from '../button/button.js';
|
|
13
|
+
import { Popover } from '../popover/popover.js';
|
|
14
14
|
|
|
15
15
|
function DatePicker(originalProps) {
|
|
16
16
|
const [
|
|
@@ -5,13 +5,13 @@ import { useMemo } from 'react';
|
|
|
5
5
|
import { CalendarDate } from '@internationalized/date';
|
|
6
6
|
import { DateRangePicker as DateRangePicker$1, Dialog } from 'react-aria-components';
|
|
7
7
|
import { dateRangePickerStyles, composeTailwindRenderProps } from '@opengovsg/oui-theme';
|
|
8
|
-
import { DateInput } from '../date-field/date-field.js';
|
|
9
|
-
import { Label, FieldGroup, Description, FieldError } from '../field/field.js';
|
|
10
|
-
import { Popover } from '../popover/popover.js';
|
|
11
|
-
import { RangeCalendar } from '../range-calendar/range-calendar.js';
|
|
12
8
|
import { mapPropsVariants } from '../system/utils.js';
|
|
13
|
-
import Calendar from '../node_modules/.pnpm/lucide-react@0.475.0_react@19.
|
|
9
|
+
import Calendar from '../node_modules/.pnpm/lucide-react@0.475.0_react@19.2.3/node_modules/lucide-react/dist/esm/icons/calendar.js';
|
|
10
|
+
import { RangeCalendar } from '../range-calendar/range-calendar.js';
|
|
11
|
+
import { Label, FieldGroup, Description, FieldError } from '../field/field.js';
|
|
12
|
+
import { DateInput } from '../date-field/date-field.js';
|
|
14
13
|
import { Button } from '../button/button.js';
|
|
14
|
+
import { Popover } from '../popover/popover.js';
|
|
15
15
|
|
|
16
16
|
function DateRangePicker(originalProps) {
|
|
17
17
|
const [
|
package/dist/esm/field/field.js
CHANGED
|
@@ -4,7 +4,7 @@ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
|
4
4
|
import { useMemo } from 'react';
|
|
5
5
|
import { Label as Label$1, Text, FieldError as FieldError$1, Group } from 'react-aria-components';
|
|
6
6
|
import { labelStyles, descriptionStyles, fieldErrorStyles, composeRenderProps, fieldGroupStyles } from '@opengovsg/oui-theme';
|
|
7
|
-
import CircleAlert from '../node_modules/.pnpm/lucide-react@0.475.0_react@19.
|
|
7
|
+
import CircleAlert from '../node_modules/.pnpm/lucide-react@0.475.0_react@19.2.3/node_modules/lucide-react/dist/esm/icons/circle-alert.js';
|
|
8
8
|
|
|
9
9
|
function Label({ size, className, ...props }) {
|
|
10
10
|
return /* @__PURE__ */ jsx(Label$1, { ...props, className: labelStyles({ className, size }) });
|
|
@@ -7,13 +7,13 @@ import { useField, useId } from 'react-aria';
|
|
|
7
7
|
import { Provider, LabelContext, GroupContext, TextContext, FieldErrorContext, Group } from 'react-aria-components';
|
|
8
8
|
import { useDropzone } from 'react-dropzone';
|
|
9
9
|
import { fileDropzoneStyles, dataAttr } from '@opengovsg/oui-theme';
|
|
10
|
-
import { Label, Description, FieldError } from '../field/field.js';
|
|
11
|
-
import { useControllableState } from '../hooks/use-controllable-state.js';
|
|
12
10
|
import { mapPropsVariants } from '../system/utils.js';
|
|
13
11
|
import { FileDropzoneStyleContext, FileDropzoneStateContext, useFileDropzoneStateContext, useFileDropzoneStyleContext } from './contexts.js';
|
|
14
12
|
import { FileInfo } from './file-info.js';
|
|
15
13
|
import { formatErrorMessage, formatBytes } from './utils.js';
|
|
16
|
-
import
|
|
14
|
+
import { useControllableState } from '../hooks/use-controllable-state.js';
|
|
15
|
+
import Upload from '../node_modules/.pnpm/lucide-react@0.475.0_react@19.2.3/node_modules/lucide-react/dist/esm/icons/upload.js';
|
|
16
|
+
import { Label, Description, FieldError } from '../field/field.js';
|
|
17
17
|
|
|
18
18
|
const FileDropzone = (originalProps) => {
|
|
19
19
|
const [props, variantProps] = mapPropsVariants(
|
|
@@ -5,7 +5,7 @@ import { useState, useEffect } from 'react';
|
|
|
5
5
|
import { fileInfoDropzoneStyles, cn } from '@opengovsg/oui-theme';
|
|
6
6
|
import { useFileDropzoneStateContext, useFileDropzoneStyleContext } from './contexts.js';
|
|
7
7
|
import { formatBytes } from './utils.js';
|
|
8
|
-
import Trash2 from '../node_modules/.pnpm/lucide-react@0.475.0_react@19.
|
|
8
|
+
import Trash2 from '../node_modules/.pnpm/lucide-react@0.475.0_react@19.2.3/node_modules/lucide-react/dist/esm/icons/trash-2.js';
|
|
9
9
|
import { Button } from '../button/button.js';
|
|
10
10
|
|
|
11
11
|
const FileInfo = ({ file, imagePreview, classNames }) => {
|
|
@@ -5,10 +5,10 @@ import { useRef } from 'react';
|
|
|
5
5
|
import { useDisclosure, useButton, useFocusRing, mergeProps } from 'react-aria';
|
|
6
6
|
import { useDisclosureState } from 'react-stately';
|
|
7
7
|
import { govtBannerStyles, dataAttr, twMerge } from '@opengovsg/oui-theme';
|
|
8
|
-
import ChevronDown from '../node_modules/.pnpm/lucide-react@0.475.0_react@19.
|
|
9
|
-
import Landmark from '../node_modules/.pnpm/lucide-react@0.475.0_react@19.
|
|
10
|
-
import ExternalLink from '../node_modules/.pnpm/lucide-react@0.475.0_react@19.
|
|
11
|
-
import Lock from '../node_modules/.pnpm/lucide-react@0.475.0_react@19.
|
|
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
|
+
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
|
+
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';
|
|
11
|
+
import Lock from '../node_modules/.pnpm/lucide-react@0.475.0_react@19.2.3/node_modules/lucide-react/dist/esm/icons/lock.js';
|
|
12
12
|
|
|
13
13
|
function GovtBanner({
|
|
14
14
|
environment,
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
import { useRef, useCallback, useEffect } from 'react';
|
|
3
|
+
|
|
4
|
+
const isBrowser = typeof window !== "undefined";
|
|
5
|
+
function getScrollPosition(element) {
|
|
6
|
+
if (!isBrowser) return { x: 0, y: 0 };
|
|
7
|
+
if (!element) {
|
|
8
|
+
return { x: window.scrollX, y: window.scrollY };
|
|
9
|
+
}
|
|
10
|
+
return { x: element.scrollLeft, y: element.scrollTop };
|
|
11
|
+
}
|
|
12
|
+
const useScrollPosition = (props) => {
|
|
13
|
+
const { elementRef, delay = 30, callback, isEnabled } = props;
|
|
14
|
+
const position = useRef(
|
|
15
|
+
isEnabled ? getScrollPosition(elementRef?.current) : { x: 0, y: 0 }
|
|
16
|
+
);
|
|
17
|
+
const throttleTimeout = useRef(null);
|
|
18
|
+
const handler = useCallback(() => {
|
|
19
|
+
const currPos = getScrollPosition(elementRef?.current);
|
|
20
|
+
if (typeof callback === "function") {
|
|
21
|
+
callback({ prevPos: position.current, currPos });
|
|
22
|
+
}
|
|
23
|
+
position.current = currPos;
|
|
24
|
+
throttleTimeout.current = null;
|
|
25
|
+
}, [callback, elementRef]);
|
|
26
|
+
useEffect(() => {
|
|
27
|
+
if (!isEnabled) return;
|
|
28
|
+
const handleScroll = () => {
|
|
29
|
+
if (delay) {
|
|
30
|
+
if (throttleTimeout.current) {
|
|
31
|
+
clearTimeout(throttleTimeout.current);
|
|
32
|
+
}
|
|
33
|
+
throttleTimeout.current = setTimeout(handler, delay);
|
|
34
|
+
} else {
|
|
35
|
+
handler();
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
const target = elementRef?.current || window;
|
|
39
|
+
target.addEventListener("scroll", handleScroll);
|
|
40
|
+
return () => {
|
|
41
|
+
target.removeEventListener("scroll", handleScroll);
|
|
42
|
+
if (throttleTimeout.current) {
|
|
43
|
+
clearTimeout(throttleTimeout.current);
|
|
44
|
+
throttleTimeout.current = null;
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
}, [elementRef?.current, delay, handler, isEnabled]);
|
|
48
|
+
return position.current;
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
export { useScrollPosition };
|
package/dist/esm/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
export { useControllableState } from './hooks/use-controllable-state.js';
|
|
3
3
|
export { useDraggable } from './hooks/use-draggable.js';
|
|
4
|
+
export { Button } from './button/button.js';
|
|
4
5
|
export { GovtBanner } from './govt-banner/govt-banner.js';
|
|
5
6
|
export { Ripple } from './ripple/ripple.js';
|
|
6
7
|
export { useRipple } from './ripple/use-ripple.js';
|
|
@@ -17,11 +18,17 @@ export { ComboBox, ComboBoxEmptyState } from './combo-box/combo-box.js';
|
|
|
17
18
|
export { ComboBoxFuzzy } from './combo-box/combo-box-fuzzy.js';
|
|
18
19
|
export { ComboBoxItem } from './combo-box/combo-box-item.js';
|
|
19
20
|
export { ComboBoxVariantContext, useComboBoxVariantContext } from './combo-box/combo-box-variant-context.js';
|
|
21
|
+
export { Banner } from './banner/banner.js';
|
|
20
22
|
export { TagField } from './tag-field/tag-field.js';
|
|
21
23
|
export { TagFieldItem } from './tag-field/tag-field-item.js';
|
|
22
24
|
export { Select } from './select/select.js';
|
|
23
25
|
export { SelectItem } from './select/select-item.js';
|
|
24
26
|
export { SelectVariantContext, useSelectVariantContext } from './select/select-variant-context.js';
|
|
27
|
+
export { Badge } from './badge/badge.js';
|
|
28
|
+
export { CalendarDate } from '@internationalized/date';
|
|
29
|
+
export { Calendar, CalendarStateWrapper } from './calendar/calendar.js';
|
|
30
|
+
export { CalendarStyleContext, useCalendarStyleContext } from './calendar/calendar-style-context.js';
|
|
31
|
+
export { getEraFormat, useGenerateLocalizedMonths, useGenerateLocalizedYears, useLocalizedMonthYear } from './calendar/utils.js';
|
|
25
32
|
export { RangeCalendar, RangeCalendarCell, RangeCalendarStateWrapper } from './range-calendar/range-calendar.js';
|
|
26
33
|
export { Menu, MenuItem, MenuSection, MenuSeparator, MenuTrigger, MenuVariantContext, SubmenuTrigger, useMenuVariantContext } from './menu/menu.js';
|
|
27
34
|
export { Popover } from './popover/popover.js';
|
|
@@ -31,10 +38,10 @@ export { DatePicker } from './date-picker/date-picker.js';
|
|
|
31
38
|
export { DateRangePicker } from './date-range-picker/date-range-picker.js';
|
|
32
39
|
export { Checkbox, CheckboxGroup } from './checkbox/checkbox.js';
|
|
33
40
|
export { CheckboxGroupStyleContext, useCheckboxGroupStyleContext } from './checkbox/checkbox-group-style-context.js';
|
|
41
|
+
export { PaginationItemType } from './pagination/hooks/use-pagination.js';
|
|
34
42
|
export { Pagination } from './pagination/pagination.js';
|
|
35
43
|
export { PaginationCursor } from './pagination/pagination-cursor.js';
|
|
36
44
|
export { PaginationItem } from './pagination/pagination-item.js';
|
|
37
|
-
export { PaginationItemType } from './pagination/hooks/use-pagination.js';
|
|
38
45
|
export { CURSOR_TRANSITION_TIMEOUT, usePagination } from './pagination/use-pagination.js';
|
|
39
46
|
export { FileDropzone } from './file-dropzone/file-dropzone.js';
|
|
40
47
|
export { FileInfo } from './file-dropzone/file-info.js';
|
|
@@ -46,10 +53,14 @@ export { ModalFooter } from './modal/modal-footer.js';
|
|
|
46
53
|
export { ModalBody } from './modal/modal-body.js';
|
|
47
54
|
export { ModalHeader } from './modal/modal-header.js';
|
|
48
55
|
export { ModalVariantContext, useModalVariantContext } from './modal/modal-variant-context.js';
|
|
49
|
-
export {
|
|
50
|
-
export {
|
|
51
|
-
export {
|
|
52
|
-
export {
|
|
53
|
-
export {
|
|
54
|
-
export {
|
|
55
|
-
export {
|
|
56
|
+
export { Toaster } from './toast/toast.js';
|
|
57
|
+
export { toast } from 'sonner';
|
|
58
|
+
export { Navbar } from './navbar/navbar.js';
|
|
59
|
+
export { NavbarBrand } from './navbar/navbar-brand.js';
|
|
60
|
+
export { NavbarContent } from './navbar/navbar-content.js';
|
|
61
|
+
export { NavbarMenu } from './navbar/navbar-menu/menu.js';
|
|
62
|
+
export { NavbarMenuItem } from './navbar/navbar-menu/item.js';
|
|
63
|
+
export { NavbarMenuToggle } from './navbar/navbar-menu/toggle.js';
|
|
64
|
+
export { NavbarItem } from './navbar/navbar-item.js';
|
|
65
|
+
export { useNavbar } from './navbar/use-navbar.js';
|
|
66
|
+
export { NavbarProvider, useNavbarContext } from './navbar/navbar-context.js';
|
package/dist/esm/menu/menu.js
CHANGED
|
@@ -4,11 +4,11 @@ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
|
4
4
|
import { forwardRef, useMemo, useCallback } from 'react';
|
|
5
5
|
import { useContextProps, MenuItem as MenuItem$1, composeRenderProps, Provider, Menu as Menu$1, MenuSection as MenuSection$1, Header, Collection, MenuTrigger as MenuTrigger$1, SubmenuTrigger as SubmenuTrigger$1, Separator } from 'react-aria-components';
|
|
6
6
|
import { listBoxItemStyles, menuItemStyles, menuStyles, menuSectionStyles, menuDividerStyles } from '@opengovsg/oui-theme';
|
|
7
|
-
import { Popover } from '../popover/popover.js';
|
|
8
7
|
import { forwardRefGeneric, mapPropsVariants } from '../system/utils.js';
|
|
9
|
-
import Check from '../node_modules/.pnpm/lucide-react@0.475.0_react@19.0.0/node_modules/lucide-react/dist/esm/icons/check.js';
|
|
10
|
-
import ChevronRight from '../node_modules/.pnpm/lucide-react@0.475.0_react@19.0.0/node_modules/lucide-react/dist/esm/icons/chevron-right.js';
|
|
11
8
|
import { createContext } from '../system/react-utils/context.js';
|
|
9
|
+
import Check from '../node_modules/.pnpm/lucide-react@0.475.0_react@19.2.3/node_modules/lucide-react/dist/esm/icons/check.js';
|
|
10
|
+
import ChevronRight from '../node_modules/.pnpm/lucide-react@0.475.0_react@19.2.3/node_modules/lucide-react/dist/esm/icons/chevron-right.js';
|
|
11
|
+
import { Popover } from '../popover/popover.js';
|
|
12
12
|
|
|
13
13
|
const [MenuVariantContext, useMenuVariantContext] = createContext({
|
|
14
14
|
name: "MenuVariantContext",
|
|
@@ -7,7 +7,7 @@ import { Dialog } from 'react-aria-components';
|
|
|
7
7
|
import { cn } from '@opengovsg/oui-theme';
|
|
8
8
|
import { i18nStrings } from './i18n.js';
|
|
9
9
|
import { ModalVariantContext } from './modal-variant-context.js';
|
|
10
|
-
import X from '../node_modules/.pnpm/lucide-react@0.475.0_react@19.
|
|
10
|
+
import X from '../node_modules/.pnpm/lucide-react@0.475.0_react@19.2.3/node_modules/lucide-react/dist/esm/icons/x.js';
|
|
11
11
|
import { Button } from '../button/button.js';
|
|
12
12
|
|
|
13
13
|
function ModalContent({
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
export { Navbar } from './navbar.js';
|
|
3
|
+
export { NavbarBrand } from './navbar-brand.js';
|
|
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';
|
|
8
|
+
export { NavbarItem } from './navbar-item.js';
|
|
9
|
+
export { useNavbar } from './use-navbar.js';
|
|
10
|
+
export { NavbarProvider, useNavbarContext } from './navbar-context.js';
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
"use client";
|
|
3
|
+
import { jsx } from 'react/jsx-runtime';
|
|
4
|
+
import { cn } from '@opengovsg/oui-theme';
|
|
5
|
+
import { forwardRef } from '../system/utils.js';
|
|
6
|
+
import { useNavbarContext } from './navbar-context.js';
|
|
7
|
+
import { useDomRef } from '../system/react-utils/refs.js';
|
|
8
|
+
|
|
9
|
+
const NavbarBrand = forwardRef((props, ref) => {
|
|
10
|
+
const { as, className, children, ...otherProps } = props;
|
|
11
|
+
const Component = as || "div";
|
|
12
|
+
const domRef = useDomRef(ref);
|
|
13
|
+
const { slots, classNames } = useNavbarContext();
|
|
14
|
+
return /* @__PURE__ */ jsx(
|
|
15
|
+
Component,
|
|
16
|
+
{
|
|
17
|
+
ref: domRef,
|
|
18
|
+
className: slots.brand?.({ className: cn(classNames?.brand, className) }),
|
|
19
|
+
...otherProps,
|
|
20
|
+
children
|
|
21
|
+
}
|
|
22
|
+
);
|
|
23
|
+
});
|
|
24
|
+
NavbarBrand.displayName = "NavbarBrand";
|
|
25
|
+
|
|
26
|
+
export { NavbarBrand };
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
"use client";
|
|
3
|
+
import { jsx } from 'react/jsx-runtime';
|
|
4
|
+
import { cn } from '@opengovsg/oui-theme';
|
|
5
|
+
import { forwardRef } from '../system/utils.js';
|
|
6
|
+
import { useNavbarContext } from './navbar-context.js';
|
|
7
|
+
import { useDomRef } from '../system/react-utils/refs.js';
|
|
8
|
+
|
|
9
|
+
const NavbarContent = forwardRef(
|
|
10
|
+
(props, ref) => {
|
|
11
|
+
const { as, className, children, justify = "start", ...otherProps } = props;
|
|
12
|
+
const Component = as || "div";
|
|
13
|
+
const domRef = useDomRef(ref);
|
|
14
|
+
const { slots, classNames } = useNavbarContext();
|
|
15
|
+
return /* @__PURE__ */ jsx(
|
|
16
|
+
Component,
|
|
17
|
+
{
|
|
18
|
+
ref: domRef,
|
|
19
|
+
className: slots.content?.({
|
|
20
|
+
className: cn(classNames?.content, className)
|
|
21
|
+
}),
|
|
22
|
+
"data-justify": justify,
|
|
23
|
+
...otherProps,
|
|
24
|
+
children
|
|
25
|
+
}
|
|
26
|
+
);
|
|
27
|
+
}
|
|
28
|
+
);
|
|
29
|
+
NavbarContent.displayName = "NavbarContent";
|
|
30
|
+
|
|
31
|
+
export { NavbarContent };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
"use client";
|
|
3
|
+
import { createContext } from '../system/react-utils/context.js';
|
|
4
|
+
|
|
5
|
+
const [NavbarProvider, useNavbarContext] = createContext({
|
|
6
|
+
name: "NavbarContext",
|
|
7
|
+
strict: true,
|
|
8
|
+
errorMessage: "useNavbarContext: `context` is undefined. Seems you forgot to wrap component within <Navbar />"
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
export { NavbarProvider, useNavbarContext };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
"use client";
|
|
3
|
+
import { jsx } from 'react/jsx-runtime';
|
|
4
|
+
import { dataAttr, cn } from '@opengovsg/oui-theme';
|
|
5
|
+
import { forwardRef } from '../system/utils.js';
|
|
6
|
+
import { useNavbarContext } from './navbar-context.js';
|
|
7
|
+
import { useDomRef } from '../system/react-utils/refs.js';
|
|
8
|
+
|
|
9
|
+
const NavbarItem = forwardRef((props, ref) => {
|
|
10
|
+
const { as, className, children, isActive, ...otherProps } = props;
|
|
11
|
+
const Component = as || "div";
|
|
12
|
+
const domRef = useDomRef(ref);
|
|
13
|
+
const { slots, classNames } = useNavbarContext();
|
|
14
|
+
return /* @__PURE__ */ jsx(
|
|
15
|
+
Component,
|
|
16
|
+
{
|
|
17
|
+
ref: domRef,
|
|
18
|
+
className: slots.item({ className: cn(classNames?.item, className) }),
|
|
19
|
+
"data-active": dataAttr(isActive),
|
|
20
|
+
...otherProps,
|
|
21
|
+
children
|
|
22
|
+
}
|
|
23
|
+
);
|
|
24
|
+
});
|
|
25
|
+
NavbarItem.displayName = "NavbarItem";
|
|
26
|
+
|
|
27
|
+
export { NavbarItem };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const i18nStrings = {
|
|
3
|
+
"en-SG": {
|
|
4
|
+
openMenu: "Open navigation menu",
|
|
5
|
+
closeMenu: "Close navigation menu"
|
|
6
|
+
},
|
|
7
|
+
"zh-SG": {
|
|
8
|
+
openMenu: "\u6253\u5F00\u5BFC\u822A\u83DC\u5355",
|
|
9
|
+
closeMenu: "\u5173\u95ED\u5BFC\u822A\u83DC\u5355"
|
|
10
|
+
},
|
|
11
|
+
"ms-SG": {
|
|
12
|
+
openMenu: "Buka menu navigasi",
|
|
13
|
+
closeMenu: "Tutup menu navigasi"
|
|
14
|
+
},
|
|
15
|
+
"ta-SG": {
|
|
16
|
+
openMenu: "\u0BA8\u0BC7\u0BB5\u0BBF\u0B95\u0BC7\u0BB7\u0BA9\u0BCD \u0BAE\u0BC6\u0BA9\u0BC1\u0BB5\u0BC8\u0BA4\u0BCD \u0BA4\u0BBF\u0BB1",
|
|
17
|
+
closeMenu: "\u0BA8\u0BC7\u0BB5\u0BBF\u0B95\u0BC7\u0BB7\u0BA9\u0BCD \u0BAE\u0BC6\u0BA9\u0BC1\u0BB5\u0BC8 \u0BAE\u0BC2\u0B9F\u0BC1"
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export { i18nStrings };
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
"use client";
|
|
3
|
+
import { jsx } from 'react/jsx-runtime';
|
|
4
|
+
import { useRenderProps, composeRenderProps } from 'react-aria-components';
|
|
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';
|
|
9
|
+
|
|
10
|
+
const NavbarMenuItem = forwardRef(
|
|
11
|
+
(props, ref) => {
|
|
12
|
+
const { className, children, isActive, ...otherProps } = props;
|
|
13
|
+
const domRef = useDomRef(ref);
|
|
14
|
+
const { isMenuOpen, classNames } = useNavbarContext();
|
|
15
|
+
const renderProps = useRenderProps({
|
|
16
|
+
className: composeRenderProps(
|
|
17
|
+
className,
|
|
18
|
+
(className2, renderProps2) => navbarMenuItemStyles({
|
|
19
|
+
className: cn(classNames?.menuItem, className2),
|
|
20
|
+
...renderProps2
|
|
21
|
+
})
|
|
22
|
+
),
|
|
23
|
+
values: {
|
|
24
|
+
isActive: !!isActive
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
return /* @__PURE__ */ jsx(
|
|
28
|
+
"li",
|
|
29
|
+
{
|
|
30
|
+
ref: domRef,
|
|
31
|
+
className: renderProps.className,
|
|
32
|
+
"data-active": dataAttr(isActive),
|
|
33
|
+
"data-open": dataAttr(isMenuOpen),
|
|
34
|
+
...otherProps,
|
|
35
|
+
children
|
|
36
|
+
}
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
);
|
|
40
|
+
NavbarMenuItem.displayName = "NavbarMenuItem";
|
|
41
|
+
|
|
42
|
+
export { NavbarMenuItem };
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
"use client";
|
|
3
|
+
import { jsx } from 'react/jsx-runtime';
|
|
4
|
+
import { Overlay as $337b884510726a0d$export$c6fdb837b070b4ff } from '../../node_modules/.pnpm/@react-aria_overlays@3.30.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/@react-aria/overlays/dist/Overlay.js';
|
|
5
|
+
import { chain } from 'react-aria';
|
|
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';
|
|
10
|
+
|
|
11
|
+
const NavbarMenu = forwardRef(
|
|
12
|
+
({ className, children, portalContainer, style, onKeyDown, ...props }, ref) => {
|
|
13
|
+
const domRef = useDomRef(ref);
|
|
14
|
+
const {
|
|
15
|
+
slots,
|
|
16
|
+
isMenuOpen,
|
|
17
|
+
menuTopOffsetPx,
|
|
18
|
+
classNames,
|
|
19
|
+
setIsMenuOpen,
|
|
20
|
+
domRef: parentRef,
|
|
21
|
+
menuRef
|
|
22
|
+
} = useNavbarContext();
|
|
23
|
+
const handleKeyDown = (e) => {
|
|
24
|
+
if (e.key === "Escape") {
|
|
25
|
+
e.stopPropagation();
|
|
26
|
+
setIsMenuOpen(false);
|
|
27
|
+
menuRef.current?.focus();
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
if (!isMenuOpen) return null;
|
|
31
|
+
return /* @__PURE__ */ jsx(
|
|
32
|
+
$337b884510726a0d$export$c6fdb837b070b4ff,
|
|
33
|
+
{
|
|
34
|
+
disableFocusManagement: true,
|
|
35
|
+
portalContainer: portalContainer ?? parentRef.current ?? void 0,
|
|
36
|
+
children: /* @__PURE__ */ jsx(
|
|
37
|
+
"ul",
|
|
38
|
+
{
|
|
39
|
+
ref: domRef,
|
|
40
|
+
className: slots.menu?.({
|
|
41
|
+
className: cn(classNames?.menu, className)
|
|
42
|
+
}),
|
|
43
|
+
"data-open": dataAttr(isMenuOpen),
|
|
44
|
+
style: {
|
|
45
|
+
...style,
|
|
46
|
+
// @ts-expect-error due to not having any type declaration for CSS variables in React style prop
|
|
47
|
+
"--menu-offset": menuTopOffsetPx
|
|
48
|
+
},
|
|
49
|
+
onKeyDown: chain(handleKeyDown, onKeyDown),
|
|
50
|
+
...props,
|
|
51
|
+
children
|
|
52
|
+
}
|
|
53
|
+
)
|
|
54
|
+
}
|
|
55
|
+
);
|
|
56
|
+
}
|
|
57
|
+
);
|
|
58
|
+
NavbarMenu.displayName = "NavbarMenu";
|
|
59
|
+
|
|
60
|
+
export { NavbarMenu };
|