@zj-dynamics/components 0.0.0-stage → 0.2.0
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/LICENSE +21 -0
- package/NOTICE.react-is +21 -0
- package/NOTICE.tabbable +22 -0
- package/README.md +31 -2
- package/compatibility.css +2 -0
- package/dist/Button.d.ts +90 -0
- package/dist/Button.js +58 -0
- package/dist/ButtonDismiss.d.ts +6 -0
- package/dist/ButtonDismiss.js +5 -0
- package/dist/Dialog.d.ts +75 -0
- package/dist/Dialog.js +59 -0
- package/dist/Icon.d.ts +20 -0
- package/dist/Icon.js +11 -0
- package/dist/InputText.d.ts +26 -0
- package/dist/InputText.js +63 -0
- package/dist/Switch.d.ts +8 -0
- package/dist/Switch.js +19 -0
- package/dist/Toast.d.ts +21 -0
- package/dist/Toast.js +58 -0
- package/dist/browserFocus.d.ts +11 -0
- package/dist/browserFocus.js +85 -0
- package/dist/browserHooks.d.ts +5 -0
- package/dist/browserHooks.js +4 -0
- package/dist/index.d.ts +100 -0
- package/dist/index.js +91 -0
- package/dist/legacyModalPortal.d.ts +1 -0
- package/dist/legacyModalPortal.js +2 -0
- package/dist/mockViewportWidth.d.ts +5 -0
- package/dist/mockViewportWidth.js +58 -0
- package/dist/slotChildren.d.ts +2 -0
- package/dist/slotChildren.js +6 -0
- package/dist/theme.d.ts +26 -0
- package/dist/theme.js +65 -0
- package/dist/unstyledPrimitives.d.ts +12 -0
- package/dist/unstyledPrimitives.js +12 -0
- package/dist/useBreakpoints.d.ts +3 -0
- package/dist/useBreakpoints.js +2 -0
- package/dist/useFocusTrap.d.ts +1 -0
- package/dist/useFocusTrap.js +1 -0
- package/dist/useInView.d.ts +1 -0
- package/dist/useInView.js +1 -0
- package/dist/useIsSmallScreen.d.ts +1 -0
- package/dist/useIsSmallScreen.js +1 -0
- package/dist/useLiveAnnounce.d.ts +1 -0
- package/dist/useLiveAnnounce.js +1 -0
- package/dist/useOnKeyDown.d.ts +1 -0
- package/dist/useOnKeyDown.js +1 -0
- package/dist/useRefocusOnActivator.d.ts +1 -0
- package/dist/useRefocusOnActivator.js +1 -0
- package/dist/useResizeObserver.d.ts +22 -0
- package/dist/useResizeObserver.js +47 -0
- package/dist/useWindowDimensions.d.ts +2 -0
- package/dist/useWindowDimensions.js +1 -0
- package/dist/viewport.d.ts +46 -0
- package/dist/viewport.js +141 -0
- package/foundation/ActivityIndicator/ActivityIndicator.d.ts +38 -0
- package/foundation/ActivityIndicator/index.d.mts +2 -0
- package/foundation/ActivityIndicator/index.mjs +6 -0
- package/foundation/ActivityIndicator-es.js +30 -0
- package/foundation/Autocomplete/Autocomplete.d.ts +8 -0
- package/foundation/Autocomplete/Autocomplete.types.d.ts +401 -0
- package/foundation/Autocomplete/hooks/useAutocompleteListNav.d.ts +30 -0
- package/foundation/Autocomplete/index.d.mts +3 -0
- package/foundation/Autocomplete/index.mjs +39 -0
- package/foundation/Autocomplete/utils/interactionUtils.d.ts +14 -0
- package/foundation/Autocomplete-es.js +1322 -0
- package/foundation/Avatar/Avatar.d.ts +77 -0
- package/foundation/Avatar/index.d.mts +1 -0
- package/foundation/Avatar/index.mjs +6 -0
- package/foundation/Avatar-es.js +80 -0
- package/foundation/Banner/Banner.d.ts +10 -0
- package/foundation/Banner/Banner.types.d.ts +165 -0
- package/foundation/Banner/index.d.mts +2 -0
- package/foundation/Banner/index.mjs +14 -0
- package/foundation/Banner-es.js +134 -0
- package/foundation/Body-es.js +45 -0
- package/foundation/BottomSheet-es.js +110 -0
- package/foundation/Box/Box.d.ts +3 -0
- package/foundation/Box/Box.types.d.ts +40 -0
- package/foundation/Box/index.d.mts +1 -0
- package/foundation/Box/index.mjs +4 -0
- package/foundation/Box-es.js +130 -0
- package/foundation/Button/Button.d.ts +17 -0
- package/foundation/Button/Button.types.d.ts +112 -0
- package/foundation/Button/ButtonInternals.d.ts +11 -0
- package/foundation/Button/ButtonProvider.d.ts +11 -0
- package/foundation/Button/index.d.mts +4 -0
- package/foundation/Button/useButtonStyles.d.ts +17 -0
- package/foundation/Button-es.js +122 -0
- package/foundation/ButtonDismiss/ButtonDismiss.d.ts +6 -0
- package/foundation/ButtonDismiss/index.d.mts +1 -0
- package/foundation/ButtonDismiss-es.js +9 -0
- package/foundation/Card/Card.d.ts +78 -0
- package/foundation/Card/cardcolors.module.d.ts +90 -0
- package/foundation/Card/index.d.mts +1 -0
- package/foundation/Card/index.mjs +37 -0
- package/foundation/Card/types.d.ts +63 -0
- package/foundation/Card-es.js +138 -0
- package/foundation/Checkbox/Checkbox.d.ts +7 -0
- package/foundation/Checkbox/Checkbox.types.d.ts +51 -0
- package/foundation/Checkbox/index.d.mts +2 -0
- package/foundation/Checkbox/index.mjs +8 -0
- package/foundation/Checkbox-es.js +57 -0
- package/foundation/Chip/Chip.d.ts +14 -0
- package/foundation/Chip/Chip.types.d.ts +70 -0
- package/foundation/Chip/components/ChipDismissible/ChipDismissible.d.ts +3 -0
- package/foundation/Chip/components/ChipPrefix/Chip.Prefix.d.ts +3 -0
- package/foundation/Chip/components/ChipSelectable/ChipSelectable.d.ts +3 -0
- package/foundation/Chip/components/ChipSuffix/Chip.Suffix.d.ts +9 -0
- package/foundation/Chip/index.d.mts +4 -0
- package/foundation/Chip/index.mjs +19 -0
- package/foundation/Chip-es.js +165 -0
- package/foundation/ChipDismissible-es.js +19 -0
- package/foundation/Chips/Chip.d.ts +9 -0
- package/foundation/Chips/ChipDismissible.d.ts +11 -0
- package/foundation/Chips/ChipTypes.d.ts +59 -0
- package/foundation/Chips/Chips.d.ts +8 -0
- package/foundation/Chips/ChipsTypes.d.ts +106 -0
- package/foundation/Chips/InternalChipButton.d.ts +11 -0
- package/foundation/Chips/index.d.mts +3 -0
- package/foundation/Chips/index.mjs +56 -0
- package/foundation/Chips-es.js +114 -0
- package/foundation/Cluster/Cluster.d.ts +3 -0
- package/foundation/Cluster/index.d.mts +2 -0
- package/foundation/Cluster/index.mjs +4 -0
- package/foundation/Cluster/types.d.ts +47 -0
- package/foundation/Cluster-es.js +12 -0
- package/foundation/Combobox/Combobox.d.ts +71 -0
- package/foundation/Combobox/Combobox.footer.d.ts +7 -0
- package/foundation/Combobox/Combobox.items.d.ts +25 -0
- package/foundation/Combobox/Combobox.selectAll.d.ts +4 -0
- package/foundation/Combobox/Combobox.slotFactory.d.ts +7 -0
- package/foundation/Combobox/Combobox.types.d.ts +168 -0
- package/foundation/Combobox/index.d.mts +2 -0
- package/foundation/Combobox/index.mjs +28 -0
- package/foundation/Combobox-es.js +782 -0
- package/foundation/ComboboxPrimitive-es.js +187 -0
- package/foundation/ComboboxSeparator-es.js +3541 -0
- package/foundation/ComponentSettingsContext/ComponentSettingsContext.d.ts +41 -0
- package/foundation/ComponentSettingsContext/index.d.mts +4 -0
- package/foundation/ComponentSettingsContext/index.mjs +5 -0
- package/foundation/ComponentSettingsContext-es.js +18 -0
- package/foundation/ConfirmationModal/ConfirmationModal.d.ts +79 -0
- package/foundation/ConfirmationModal/index.d.mts +1 -0
- package/foundation/ConfirmationModal/index.mjs +37 -0
- package/foundation/ConfirmationModal-es.js +111 -0
- package/foundation/Container/Container.d.ts +6 -0
- package/foundation/Container/index.d.mts +1 -0
- package/foundation/Container/index.mjs +3 -0
- package/foundation/Container/types.d.ts +22 -0
- package/foundation/Container-es.js +16 -0
- package/foundation/Content/Content.d.ts +22 -0
- package/foundation/Content/Spacing.module.d.ts +14 -0
- package/foundation/Content/index.d.mts +1 -0
- package/foundation/Content/index.mjs +3 -0
- package/foundation/Content-es.js +13 -0
- package/foundation/ContentBlock/ContentBlock.d.ts +3 -0
- package/foundation/ContentBlock/index.d.mts +2 -0
- package/foundation/ContentBlock/index.mjs +4 -0
- package/foundation/ContentBlock/types.d.ts +37 -0
- package/foundation/ContentBlock-es.js +29 -0
- package/foundation/Countdown/Countdown.d.ts +30 -0
- package/foundation/Countdown/index.d.mts +1 -0
- package/foundation/Countdown/index.mjs +4 -0
- package/foundation/Countdown-es.js +649 -0
- package/foundation/Cover/Cover.d.ts +6 -0
- package/foundation/Cover/index.d.mts +2 -0
- package/foundation/Cover/index.mjs +4 -0
- package/foundation/Cover/types.d.ts +34 -0
- package/foundation/Cover-es.js +14 -0
- package/foundation/DataDump/DataDump.d.ts +21 -0
- package/foundation/DataDump/index.d.mts +1 -0
- package/foundation/DataDump/index.mjs +40 -0
- package/foundation/DataDump-es.js +26 -0
- package/foundation/DataList/DataList.const.d.ts +22 -0
- package/foundation/DataList/DataList.d.ts +28 -0
- package/foundation/DataList/DataList.types.d.ts +323 -0
- package/foundation/DataList/components/DataListAction/DataListAction.d.ts +3 -0
- package/foundation/DataList/components/DataListAction/index.d.mts +1 -0
- package/foundation/DataList/components/DataListBulkActions/DataListBulkActions.d.ts +4 -0
- package/foundation/DataList/components/DataListBulkActions/index.d.mts +1 -0
- package/foundation/DataList/components/DataListEmptyState/DataListEmptyState.d.ts +4 -0
- package/foundation/DataList/components/DataListEmptyState/index.d.mts +1 -0
- package/foundation/DataList/components/DataListFilters/DataListFilters.d.ts +11 -0
- package/foundation/DataList/components/DataListFilters/index.d.mts +1 -0
- package/foundation/DataList/components/DataListItemActions/DataListItemActions.d.ts +9 -0
- package/foundation/DataList/components/DataListItemActions/index.d.mts +1 -0
- package/foundation/DataList/components/DataListLayout/DataListLayout.d.ts +3 -0
- package/foundation/DataList/components/DataListLayout/index.d.mts +1 -0
- package/foundation/DataList/components/DataListLayoutActions/DataListLayoutActions.d.ts +2 -0
- package/foundation/DataList/components/DataListLayoutActions/index.d.mts +1 -0
- package/foundation/DataList/components/DataListSearch/DataListSearch.d.ts +8 -0
- package/foundation/DataList/components/DataListSearch/index.d.mts +1 -0
- package/foundation/DataList/components/DataListStatusBar/DataListStatusBar.d.ts +11 -0
- package/foundation/DataList/components/DataListStatusBar/index.d.mts +1 -0
- package/foundation/DataList/index.d.mts +2 -0
- package/foundation/DataList/index.mjs +96 -0
- package/foundation/DataList-es.js +141 -0
- package/foundation/DataList.const-es.js +26 -0
- package/foundation/DataList.module-es.js +3 -0
- package/foundation/DataList.utils-es.js +167 -0
- package/foundation/DataListAction-es.js +43 -0
- package/foundation/DataListActions-es.js +53 -0
- package/foundation/DataListActionsMenu-es.js +52 -0
- package/foundation/DataListBulkActions-es.js +28 -0
- package/foundation/DataListContext-es.js +26 -0
- package/foundation/DataListEmptyState-es.js +54 -0
- package/foundation/DataListFilters-es.js +43 -0
- package/foundation/DataListHeader-es.js +130 -0
- package/foundation/DataListHeaderTile-es.js +86 -0
- package/foundation/DataListItem-es.js +118 -0
- package/foundation/DataListItemActions-es.js +29 -0
- package/foundation/DataListItemActionsOverflow-es.js +34 -0
- package/foundation/DataListItemClickable-es.js +45 -0
- package/foundation/DataListItems-es.js +19 -0
- package/foundation/DataListLayout-es.js +19 -0
- package/foundation/DataListLayoutActions-es.js +36 -0
- package/foundation/DataListLayoutContext-es.js +14 -0
- package/foundation/DataListLayoutContext-es2.js +8 -0
- package/foundation/DataListLoadMore-es.js +32 -0
- package/foundation/DataListLoadingState-es.js +22 -0
- package/foundation/DataListOverflowFade-es.js +22 -0
- package/foundation/DataListSearch-es.js +84 -0
- package/foundation/DataListSort-es.js +74 -0
- package/foundation/DataListSortingOptions-es.js +34 -0
- package/foundation/DataListStatusBar-es.js +22 -0
- package/foundation/DataListStickyHeader-es.js +23 -0
- package/foundation/DataListTags-es.js +62 -0
- package/foundation/DataListTotalCount-es.js +38 -0
- package/foundation/DataTable/DataTable.d.ts +74 -0
- package/foundation/DataTable/SortIcon.d.ts +11 -0
- package/foundation/DataTable/components/DataTableActions.d.ts +2 -0
- package/foundation/DataTable/components/DataTableBody.d.ts +2 -0
- package/foundation/DataTable/components/DataTableCell.d.ts +2 -0
- package/foundation/DataTable/components/DataTableContainer.d.ts +2 -0
- package/foundation/DataTable/components/DataTableFooter.d.ts +5 -0
- package/foundation/DataTable/components/DataTableHeader.d.ts +2 -0
- package/foundation/DataTable/components/DataTableHeaderCell.d.ts +5 -0
- package/foundation/DataTable/components/DataTablePagination.d.ts +5 -0
- package/foundation/DataTable/components/DataTablePaginationButton.d.ts +21 -0
- package/foundation/DataTable/components/DataTableRow.d.ts +2 -0
- package/foundation/DataTable/components/DataTableRowActions.d.ts +4 -0
- package/foundation/DataTable/components/DataTableSortableHeader.d.ts +24 -0
- package/foundation/DataTable/components/DataTableTable.d.ts +11 -0
- package/foundation/DataTable/components/index.d.mts +13 -0
- package/foundation/DataTable/index.d.mts +6 -0
- package/foundation/DataTable/index.mjs +29 -0
- package/foundation/DataTable/test-utilities/helpers.d.ts +1 -0
- package/foundation/DataTable/types.d.ts +83 -0
- package/foundation/DataTable-es.js +262 -0
- package/foundation/DataTableTable-es.js +117 -0
- package/foundation/DatePicker/DatePicker.d.ts +74 -0
- package/foundation/DatePicker/DatePickerActivator.d.ts +18 -0
- package/foundation/DatePicker/index.d.mts +1 -0
- package/foundation/DatePicker/index.mjs +26 -0
- package/foundation/DatePicker-es.js +13627 -0
- package/foundation/Dialog/dialogReturnFocus.d.ts +43 -0
- package/foundation/Disclosure/Disclosure.d.ts +68 -0
- package/foundation/Disclosure/index.d.mts +1 -0
- package/foundation/Disclosure/index.mjs +7 -0
- package/foundation/Disclosure-es.js +46 -0
- package/foundation/Divider/Divider.d.ts +39 -0
- package/foundation/Divider/DividerDirections.module.d.ts +6 -0
- package/foundation/Divider/DividerSizes.module.d.ts +8 -0
- package/foundation/Divider/index.d.mts +1 -0
- package/foundation/Divider/index.mjs +3 -0
- package/foundation/Divider-es.js +15 -0
- package/foundation/Drawer/Drawer.d.ts +14 -0
- package/foundation/Drawer/DrawerGrid.d.ts +7 -0
- package/foundation/Drawer/index.d.mts +2 -0
- package/foundation/Drawer/index.mjs +13 -0
- package/foundation/DrawerGrid-es.js +39 -0
- package/foundation/DrawerTitle-es.js +90 -0
- package/foundation/Emphasis/Emphasis.d.ts +12 -0
- package/foundation/Emphasis/index.d.mts +1 -0
- package/foundation/Emphasis/index.mjs +4 -0
- package/foundation/Emphasis-es.js +13 -0
- package/foundation/FeatureSwitch/FeatureSwitch.d.ts +52 -0
- package/foundation/FeatureSwitch/index.d.mts +1 -0
- package/foundation/FeatureSwitch/index.mjs +20 -0
- package/foundation/FeatureSwitch-es.js +66 -0
- package/foundation/FieldDescription-es.js +859 -0
- package/foundation/FilterPicker/FilterPicker.d.ts +11 -0
- package/foundation/FilterPicker/FilterPicker.types.d.ts +282 -0
- package/foundation/FilterPicker/FilterPickerProvider.d.ts +18 -0
- package/foundation/FilterPicker/components/FilterPickerAction/FilterPickerAction.d.ts +3 -0
- package/foundation/FilterPicker/components/FilterPickerAction/index.d.mts +1 -0
- package/foundation/FilterPicker/components/FilterPickerActivator/FilterPickerActivator.d.ts +3 -0
- package/foundation/FilterPicker/components/FilterPickerActivator/index.d.mts +1 -0
- package/foundation/FilterPicker/components/FilterPickerOption/FilterPickerOption.d.ts +3 -0
- package/foundation/FilterPicker/index.d.mts +3 -0
- package/foundation/FilterPicker/index.mjs +49 -0
- package/foundation/FilterPicker-es.js +110 -0
- package/foundation/FilterPicker.messages-es.js +56 -0
- package/foundation/FilterPickerAction-es.js +30 -0
- package/foundation/FilterPickerActivator-es.js +36 -0
- package/foundation/FilterPickerContent-es.js +180 -0
- package/foundation/FilterPickerContentHeader-es.js +23 -0
- package/foundation/FilterPickerContentList-es.js +74 -0
- package/foundation/FilterPickerContentSearch-es.js +35 -0
- package/foundation/FilterPickerLoadMore-es.js +14 -0
- package/foundation/FilterPickerOption-es.js +29 -0
- package/foundation/FilterPickerProvider-es.js +10 -0
- package/foundation/FilterPickerTrigger-es.js +19 -0
- package/foundation/Flex/Flex.d.ts +33 -0
- package/foundation/Flex/Flex.types.d.ts +6 -0
- package/foundation/Flex/index.d.mts +1 -0
- package/foundation/Flex/index.mjs +3 -0
- package/foundation/Flex-es.js +28 -0
- package/foundation/FormField/FormFieldAffix.d.ts +19 -0
- package/foundation/FormField/FormFieldTypes.d.ts +185 -0
- package/foundation/FormField/FormFieldWrapper.d.ts +57 -0
- package/foundation/FormField/hooks/useFormFieldName.d.ts +6 -0
- package/foundation/FormField/hooks/useFormFieldWrapperStyles.d.ts +35 -0
- package/foundation/FormField/index.d.mts +5 -0
- package/foundation/FormField/index.mjs +17 -0
- package/foundation/FormFieldPostFix-es.js +13 -0
- package/foundation/FormFieldWrapper-es.js +233 -0
- package/foundation/FormatFile/FormatFile.d.ts +42 -0
- package/foundation/FormatFile/index.d.mts +4 -0
- package/foundation/FormatFile/index.mjs +42 -0
- package/foundation/FormatFile/types.d.ts +27 -0
- package/foundation/FormatFile/useFormatFile.d.ts +5 -0
- package/foundation/FormatFile/useFormatFileStyles.d.ts +10 -0
- package/foundation/FormatFile-es.js +137 -0
- package/foundation/Frame/Frame.d.ts +3 -0
- package/foundation/Frame/index.d.mts +2 -0
- package/foundation/Frame/index.mjs +3 -0
- package/foundation/Frame/types.d.ts +24 -0
- package/foundation/Frame-es.js +10 -0
- package/foundation/Gallery/Gallery.d.ts +3 -0
- package/foundation/Gallery/GalleryTypes.d.ts +36 -0
- package/foundation/Gallery/index.d.mts +3 -0
- package/foundation/Gallery/index.mjs +64 -0
- package/foundation/Gallery-es.js +88 -0
- package/foundation/Glimmer/Glimmer.d.ts +71 -0
- package/foundation/Glimmer/index.d.mts +1 -0
- package/foundation/Glimmer/index.mjs +5 -0
- package/foundation/Glimmer/style/Shape.module.d.ts +9 -0
- package/foundation/Glimmer/style/Sizes.module.d.ts +10 -0
- package/foundation/Glimmer/style/Timing.module.d.ts +6 -0
- package/foundation/Glimmer-es.js +53 -0
- package/foundation/Grid/Grid.d.ts +32 -0
- package/foundation/Grid/GridAlign.module.d.ts +8 -0
- package/foundation/Grid/GridCell/GridCell.d.ts +23 -0
- package/foundation/Grid/GridCell/index.d.mts +1 -0
- package/foundation/Grid/index.d.mts +1 -0
- package/foundation/Grid/index.mjs +5 -0
- package/foundation/Grid-es.js +30 -0
- package/foundation/GridCell-es.js +34 -0
- package/foundation/Heading/Heading.d.ts +41 -0
- package/foundation/Heading/index.d.mts +2 -0
- package/foundation/Heading/index.mjs +4 -0
- package/foundation/Heading-es.js +55 -0
- package/foundation/HelperText-es.js +19 -0
- package/foundation/Icon/Icon.d.ts +47 -0
- package/foundation/Icon/index.d.mts +1 -0
- package/foundation/Icon-es.js +22 -0
- package/foundation/InlineLabel/InlineLabel.d.ts +18 -0
- package/foundation/InlineLabel/index.d.mts +1 -0
- package/foundation/InlineLabel/index.mjs +4 -0
- package/foundation/InlineLabel-es.js +19 -0
- package/foundation/InputAvatar/InputAvatar.d.ts +23 -0
- package/foundation/InputAvatar/index.d.mts +1 -0
- package/foundation/InputAvatar/index.mjs +22 -0
- package/foundation/InputAvatar-es.js +64 -0
- package/foundation/InputDate/InputDate.d.ts +3 -0
- package/foundation/InputDate/InputDate.types.d.ts +36 -0
- package/foundation/InputDate/index.d.mts +2 -0
- package/foundation/InputDate/index.mjs +39 -0
- package/foundation/InputDate-es.js +104 -0
- package/foundation/InputEmail/InputEmail.d.ts +3 -0
- package/foundation/InputEmail/InputEmail.types.d.ts +16 -0
- package/foundation/InputEmail/index.d.mts +2 -0
- package/foundation/InputEmail/index.mjs +22 -0
- package/foundation/InputEmail-es.js +105 -0
- package/foundation/InputFile/FileTypes.d.ts +17 -0
- package/foundation/InputFile/InputFile.d.ts +187 -0
- package/foundation/InputFile/InputFileButton.d.ts +6 -0
- package/foundation/InputFile/InputFileContentContext.d.ts +12 -0
- package/foundation/InputFile/InputFileDescription.d.ts +4 -0
- package/foundation/InputFile/InputFileDropzoneWrapper.d.ts +4 -0
- package/foundation/InputFile/InputFileHintText.d.ts +4 -0
- package/foundation/InputFile/index.d.mts +3 -0
- package/foundation/InputFile/index.mjs +16 -0
- package/foundation/InputFile-es.js +1780 -0
- package/foundation/InputGroup/InputGroup.d.ts +12 -0
- package/foundation/InputGroup/index.d.mts +1 -0
- package/foundation/InputGroup/index.mjs +3 -0
- package/foundation/InputGroup-es.js +26 -0
- package/foundation/InputNumber/InputNumber.d.ts +77 -0
- package/foundation/InputNumber/index.d.mts +2 -0
- package/foundation/InputNumber/index.mjs +33 -0
- package/foundation/InputNumber/types.d.ts +197 -0
- package/foundation/InputNumber-es.js +348 -0
- package/foundation/InputPhoneNumber/InputPhoneNumber.d.ts +3 -0
- package/foundation/InputPhoneNumber/InputPhoneNumber.types.d.ts +24 -0
- package/foundation/InputPhoneNumber/index.d.mts +2 -0
- package/foundation/InputPhoneNumber/index.mjs +22 -0
- package/foundation/InputPhoneNumber-es.js +188 -0
- package/foundation/InputText/InputText.d.ts +3 -0
- package/foundation/InputText/InputText.types.d.ts +58 -0
- package/foundation/InputText/index.d.mts +2 -0
- package/foundation/InputText/index.mjs +23 -0
- package/foundation/InputText-es.js +196 -0
- package/foundation/InputTime/InputTime.d.ts +3 -0
- package/foundation/InputTime/InputTime.types.d.ts +34 -0
- package/foundation/InputTime/index.d.mts +2 -0
- package/foundation/InputTime/index.mjs +23 -0
- package/foundation/InputTime-es.js +297 -0
- package/foundation/InputValidation/InputValidation.d.ts +10 -0
- package/foundation/InputValidation/index.d.mts +1 -0
- package/foundation/InputValidation/index.mjs +8 -0
- package/foundation/InputValidation-es.js +22 -0
- package/foundation/InternalChipDismissible-es.js +68 -0
- package/foundation/LICENSE +21 -0
- package/foundation/LegacySelect/LegacySelect.d.ts +7 -0
- package/foundation/LegacySelect/LegacySelect.types.d.ts +18 -0
- package/foundation/LegacySelect/Option.d.ts +18 -0
- package/foundation/LegacySelect/OptionGroup.d.ts +29 -0
- package/foundation/LegacySelect/index.d.mts +3 -0
- package/foundation/LegacySelect/index.mjs +23 -0
- package/foundation/LegacySelect-es.js +76 -0
- package/foundation/LegacyThemeContext/LegacyThemeContext.d.ts +5 -0
- package/foundation/LegacyThemeContext/index.d.mts +3 -0
- package/foundation/LegacyThemeContext/index.mjs +12 -0
- package/foundation/LegacyThemeContext/types.d.ts +59 -0
- package/foundation/LegacyThemeContext/updateTheme.d.ts +7 -0
- package/foundation/LegacyThemeContext-es.js +457 -0
- package/foundation/LightBox/LightBox.d.ts +165 -0
- package/foundation/LightBox/LightBox.types.d.ts +153 -0
- package/foundation/LightBox/LightBoxContext.d.ts +5 -0
- package/foundation/LightBox/index.d.mts +3 -0
- package/foundation/LightBox/index.mjs +50 -0
- package/foundation/LightBox-es.js +454 -0
- package/foundation/Link/Link.d.ts +9 -0
- package/foundation/Link/index.d.mts +2 -0
- package/foundation/Link/index.mjs +2 -0
- package/foundation/Link-es.js +12 -0
- package/foundation/List/List.d.ts +41 -0
- package/foundation/List/ListItem.d.ts +59 -0
- package/foundation/List/index.d.mts +2 -0
- package/foundation/List/index.mjs +22 -0
- package/foundation/List-es.js +199 -0
- package/foundation/Markdown/Markdown.d.ts +24 -0
- package/foundation/Markdown/index.d.mts +1 -0
- package/foundation/Markdown/index.mjs +10 -0
- package/foundation/Markdown-es.js +20558 -0
- package/foundation/Menu/Menu.d.ts +89 -0
- package/foundation/Menu/Menu.types.d.ts +105 -0
- package/foundation/Menu/index.d.mts +2 -0
- package/foundation/Menu/index.mjs +35 -0
- package/foundation/Menu/menuComposableTypes.d.ts +103 -0
- package/foundation/Menu-es.js +1033 -0
- package/foundation/MenuSubmenuTrigger-es.js +3088 -0
- package/foundation/Modal/Modal.rebuilt.d.ts +16 -0
- package/foundation/Modal/Modal.types.d.ts +138 -0
- package/foundation/Modal/ModalContext.rebuilt.d.ts +19 -0
- package/foundation/Modal/ModalSizes.module.d.ts +7 -0
- package/foundation/Modal/index.d.mts +17 -0
- package/foundation/Modal/index.mjs +302 -0
- package/foundation/Modal/useModalStyles.d.ts +12 -0
- package/foundation/MultiSelect/MultiSelect.d.ts +30 -0
- package/foundation/MultiSelect/index.d.mts +1 -0
- package/foundation/MultiSelect/index.mjs +9 -0
- package/foundation/MultiSelect/types.d.ts +13 -0
- package/foundation/MultiSelect-es.js +172 -0
- package/foundation/OverlaySeparator-es.js +13 -0
- package/foundation/Page/Page.d.ts +74 -0
- package/foundation/Page/index.d.mts +2 -0
- package/foundation/Page/index.mjs +42 -0
- package/foundation/Page/types.d.ts +123 -0
- package/foundation/Page-es.js +196 -0
- package/foundation/Popover/Popover.d.ts +9 -0
- package/foundation/Popover/Popover.types.d.ts +109 -0
- package/foundation/Popover/PopoverContext.d.ts +18 -0
- package/foundation/Popover/index.d.mts +4 -0
- package/foundation/Popover/index.mjs +27 -0
- package/foundation/Popover/usePopoverStyles.d.ts +5 -0
- package/foundation/Popover-es.js +166 -0
- package/foundation/ProgressBar/ProgressBar.d.ts +41 -0
- package/foundation/ProgressBar/ProgressBarSizes.module.d.ts +7 -0
- package/foundation/ProgressBar/index.d.mts +1 -0
- package/foundation/ProgressBar/index.mjs +5 -0
- package/foundation/ProgressBar-es.js +48 -0
- package/foundation/ProgressIndicator/ProgressIndicator.d.ts +60 -0
- package/foundation/ProgressIndicator/index.d.mts +1 -0
- package/foundation/ProgressIndicator/index.mjs +3 -0
- package/foundation/ProgressIndicator-es.js +41 -0
- package/foundation/RadioGroup/RadioGroup.d.ts +33 -0
- package/foundation/RadioGroup/RadioOption.d.ts +48 -0
- package/foundation/RadioGroup/index.d.mts +2 -0
- package/foundation/RadioGroup/index.mjs +5 -0
- package/foundation/RadioGroup-es.js +42 -0
- package/foundation/ResponsiveSwitcher/ResponsiveSwitcher.d.ts +3 -0
- package/foundation/ResponsiveSwitcher/index.d.mts +2 -0
- package/foundation/ResponsiveSwitcher/index.mjs +4 -0
- package/foundation/ResponsiveSwitcher/types.d.ts +26 -0
- package/foundation/ResponsiveSwitcher-es.js +11 -0
- package/foundation/RulnarPortalContent-es.js +1 -0
- package/foundation/ScrollAreaViewport-es.js +3959 -0
- package/foundation/SegmentedControl/SegmentedControl.d.ts +39 -0
- package/foundation/SegmentedControl/SegmentedControlBase.d.ts +7 -0
- package/foundation/SegmentedControl/SegmentedControlOption.d.ts +15 -0
- package/foundation/SegmentedControl/SegmentedControlProvider.d.ts +17 -0
- package/foundation/SegmentedControl/index.d.mts +2 -0
- package/foundation/SegmentedControl/index.mjs +3 -0
- package/foundation/SegmentedControl-es.js +64 -0
- package/foundation/Select/Select.d.ts +31 -0
- package/foundation/Select/Select.types.d.ts +145 -0
- package/foundation/Select/index.d.mts +2 -0
- package/foundation/Select/index.mjs +29 -0
- package/foundation/Select-es.js +227 -0
- package/foundation/SelectGroupLabel-es.js +1763 -0
- package/foundation/SelectPrimitive-es.js +126 -0
- package/foundation/Separator-es.js +33 -0
- package/foundation/SideDrawer/SideDrawer.d.ts +56 -0
- package/foundation/SideDrawer/SideDrawerActions.d.ts +3 -0
- package/foundation/SideDrawer/SideDrawerBackButton.d.ts +3 -0
- package/foundation/SideDrawer/SideDrawerFooter.d.ts +3 -0
- package/foundation/SideDrawer/SideDrawerTitle.d.ts +3 -0
- package/foundation/SideDrawer/SideDrawerToolbar.d.ts +2 -0
- package/foundation/SideDrawer/index.d.mts +1 -0
- package/foundation/SideDrawer/index.mjs +16 -0
- package/foundation/SideDrawer-es.js +198 -0
- package/foundation/SideKick/SideKick.d.ts +3 -0
- package/foundation/SideKick/index.d.mts +2 -0
- package/foundation/SideKick/index.mjs +4 -0
- package/foundation/SideKick/types.d.ts +35 -0
- package/foundation/SideKick-es.js +15 -0
- package/foundation/Spinner/Spinner.d.ts +22 -0
- package/foundation/Spinner/index.d.mts +1 -0
- package/foundation/Spinner/index.mjs +6 -0
- package/foundation/Spinner-es.js +21 -0
- package/foundation/Stack/Stack.d.ts +3 -0
- package/foundation/Stack/index.d.mts +2 -0
- package/foundation/Stack/index.mjs +4 -0
- package/foundation/Stack/types.d.ts +32 -0
- package/foundation/Stack-es.js +13 -0
- package/foundation/StatusIndicator/StatusIndicator.d.ts +7 -0
- package/foundation/StatusIndicator/StatusIndicator.type.d.ts +1 -0
- package/foundation/StatusIndicator/index.d.mts +2 -0
- package/foundation/StatusIndicator/index.mjs +2 -0
- package/foundation/StatusIndicator-es.js +9 -0
- package/foundation/StatusLabel/StatusLabel.d.ts +26 -0
- package/foundation/StatusLabel/index.d.mts +1 -0
- package/foundation/StatusLabel/index.mjs +5 -0
- package/foundation/StatusLabel-es.js +16 -0
- package/foundation/Table/Body.d.ts +7 -0
- package/foundation/Table/Cells/Cell.d.ts +8 -0
- package/foundation/Table/Cells/CellCurrency.d.ts +9 -0
- package/foundation/Table/Cells/CellNumeric.d.ts +5 -0
- package/foundation/Table/Footer.d.ts +7 -0
- package/foundation/Table/Header.d.ts +7 -0
- package/foundation/Table/Row.d.ts +7 -0
- package/foundation/Table/Table.d.ts +7 -0
- package/foundation/Table/index.d.mts +8 -0
- package/foundation/Table/index.mjs +4 -0
- package/foundation/Tabs/Tabs.d.ts +38 -0
- package/foundation/Tabs/index.d.mts +1 -0
- package/foundation/Tabs/index.mjs +8 -0
- package/foundation/Tabs-es.js +227 -0
- package/foundation/Text/Text.d.ts +29 -0
- package/foundation/Text/index.d.mts +2 -0
- package/foundation/Text/index.mjs +4 -0
- package/foundation/Text-es.js +25 -0
- package/foundation/Thumbnail/Thumbnail.d.ts +25 -0
- package/foundation/Thumbnail/index.d.mts +1 -0
- package/foundation/Thumbnail/index.mjs +9 -0
- package/foundation/Thumbnail-es.js +119 -0
- package/foundation/Tiles/Tiles.d.ts +3 -0
- package/foundation/Tiles/index.d.mts +2 -0
- package/foundation/Tiles/index.mjs +4 -0
- package/foundation/Tiles/types.d.ts +34 -0
- package/foundation/Tiles-es.js +11 -0
- package/foundation/Tooltip/Tooltip.d.ts +18 -0
- package/foundation/Tooltip/Tooltip.types.d.ts +1 -0
- package/foundation/Tooltip/index.d.mts +1 -0
- package/foundation/Tooltip/index.mjs +8 -0
- package/foundation/Tooltip-es.js +137 -0
- package/foundation/Typography/Typography.d.ts +64 -0
- package/foundation/Typography/css/Emphasis.module.d.ts +6 -0
- package/foundation/Typography/css/FontFamilies.module.d.ts +6 -0
- package/foundation/Typography/css/FontSizes.module.d.ts +12 -0
- package/foundation/Typography/css/FontWeights.module.d.ts +10 -0
- package/foundation/Typography/css/TextAlignment.module.d.ts +7 -0
- package/foundation/Typography/css/TextCases.module.d.ts +8 -0
- package/foundation/Typography/css/TextColors.module.d.ts +69 -0
- package/foundation/Typography/index.d.mts +1 -0
- package/foundation/Typography/index.mjs +3 -0
- package/foundation/Typography/types.d.ts +7 -0
- package/foundation/Typography-es.js +53 -0
- package/foundation/_baseAssignValue-es.js +29 -0
- package/foundation/_baseEach-es.js +1028 -0
- package/foundation/_baseFlatten-es.js +65 -0
- package/foundation/_baseFor-es.js +45 -0
- package/foundation/_commonjsHelpers-es.js +7 -0
- package/foundation/_getAllKeys-es.js +506 -0
- package/foundation/_getTag-es.js +133 -0
- package/foundation/_isIterateeCall-es.js +55 -0
- package/foundation/_setToString-es.js +168 -0
- package/foundation/buttonRenderAdapter-es.js +52 -0
- package/foundation/buttonStyles.d.mts +1 -0
- package/foundation/buttonStyles.mjs +1 -0
- package/foundation/clearable.d.ts +1 -0
- package/foundation/common.messages-es.js +18 -0
- package/foundation/compatHooks.mjs +2 -0
- package/foundation/constants-es.js +3 -0
- package/foundation/dateLocale-es.js +1142 -0
- package/foundation/debounce-es.js +329 -0
- package/foundation/dialogFocus.d.mts +1 -0
- package/foundation/dialogFocus.mjs +66 -0
- package/foundation/filterDataAttributes-es.js +24 -0
- package/foundation/floating-ui.react-es.js +6174 -0
- package/foundation/getMappedSpaceToken-es.js +18 -0
- package/foundation/helpers-es.js +15 -0
- package/foundation/identity-es.js +809 -0
- package/foundation/imageTypes.d.mts +1 -0
- package/foundation/imageTypes.mjs +1 -0
- package/foundation/index-es.js +1186 -0
- package/foundation/isObjectLike-es.js +190 -0
- package/foundation/isSymbol-es.js +33 -0
- package/foundation/isTypedArray-es.js +589 -0
- package/foundation/keysIn-es.js +385 -0
- package/foundation/linkEvents.d.mts +1 -0
- package/foundation/linkEvents.mjs +9 -0
- package/foundation/maxHeight-es.js +22 -0
- package/foundation/mergeClassName-es.js +10 -0
- package/foundation/mergeRefs-es.js +18 -0
- package/foundation/nestedEscape-es.js +91 -0
- package/foundation/noop-es.js +24 -0
- package/foundation/primitives/BottomSheet/BottomSheet.d.ts +37 -0
- package/foundation/primitives/BottomSheet/BottomSheet.types.d.ts +36 -0
- package/foundation/primitives/BottomSheet/index.d.mts +2 -0
- package/foundation/primitives/ComboboxPrimitive/ComboboxPrimitive.d.ts +32 -0
- package/foundation/primitives/ComboboxPrimitive/ComboboxPrimitive.types.d.ts +30 -0
- package/foundation/primitives/ComboboxPrimitive/index.d.mts +2 -0
- package/foundation/primitives/HelperText/HelperText.d.ts +25 -0
- package/foundation/primitives/HelperText/index.d.mts +1 -0
- package/foundation/primitives/OverlaySeparator/OverlaySeparator.d.ts +6 -0
- package/foundation/primitives/OverlaySeparator/index.d.mts +1 -0
- package/foundation/primitives/SelectPrimitive/SelectPrimitive.d.ts +74 -0
- package/foundation/primitives/SelectPrimitive/index.d.mts +2 -0
- package/foundation/primitives/SelectPrimitive/types.d.ts +31 -0
- package/foundation/primitives/index.d.mts +12 -0
- package/foundation/primitives/index.mjs +29 -0
- package/foundation/routerLink.d.mts +3 -0
- package/foundation/routerLink.mjs +1 -0
- package/foundation/scrollEdges-es.js +64 -0
- package/foundation/scrollable-es.js +54 -0
- package/foundation/sharedHelpers/getMappedBreakpointWidth.d.ts +8 -0
- package/foundation/sharedHelpers/types.d.ts +254 -0
- package/foundation/stringifyLocale-es.js +11 -0
- package/foundation/styles.css +16646 -0
- package/foundation/tslib.es6-es.js +97 -0
- package/foundation/unstyledPrimitives/index.d.mts +22 -0
- package/foundation/useActiveLayout-es.js +14 -0
- package/foundation/useBatchSelect-es.js +36 -0
- package/foundation/useChildComponent-es.js +15 -0
- package/foundation/useComponentMessages-es.js +86 -0
- package/foundation/useCompositeListItem-es.js +3955 -0
- package/foundation/useFormFieldFocus-es.js +37 -0
- package/foundation/useFormFieldName-es.js +11 -0
- package/foundation/useLabel-es.js +81 -0
- package/foundation/useRenderElement-es.js +628 -0
- package/foundation/useResponsiveSizing-es.js +8 -0
- package/foundation/useScrollLock-es.js +5746 -0
- package/foundation/useScrollToActive-es.js +581 -0
- package/foundation/utils/isNormalClick.d.ts +6 -0
- package/foundation/utils/isPreviewableImage.d.ts +1 -0
- package/foundation/utils/meta/meta.json +298 -0
- package/foundation.css +67 -0
- package/package.json +540 -4
- package/src/styles.css +181 -0
|
@@ -0,0 +1,1033 @@
|
|
|
1
|
+
import { ThemeBoundary } from "../dist/theme.js";
|
|
2
|
+
import React__default, { useState, useRef, useId, useMemo } from 'react';
|
|
3
|
+
import { useWindowDimensions, useRefocusOnActivator, useIsSmallScreen } from './compatHooks.mjs';
|
|
4
|
+
import classnames from 'classnames';
|
|
5
|
+
import { AnimatePresence, motion } from 'framer-motion';
|
|
6
|
+
import { o as offset, f as flip, m as size, u as useFloating, b as autoUpdate, e as useDismiss, n as useListNavigation, g as useInteractions, F as FloatingPortal } from './floating-ui.react-es.js';
|
|
7
|
+
import { d as defineMessages, u as useComponentMessages } from './useComponentMessages-es.js';
|
|
8
|
+
import './ComponentSettingsContext-es.js';
|
|
9
|
+
import { B as Button } from './Button-es.js';
|
|
10
|
+
import { T as Typography } from './Typography-es.js';
|
|
11
|
+
import { I as Icon } from './Icon-es.js';
|
|
12
|
+
import { f as formFieldFocusAttribute } from './useFormFieldFocus-es.js';
|
|
13
|
+
import { c as calculateMaxHeight } from './maxHeight-es.js';
|
|
14
|
+
import { m as mergeProps } from './useRenderElement-es.js';
|
|
15
|
+
import { n as normalizeBaseUiButtonProps, i as isRulnarButtonRenderTarget, s as stripNativeTypeFromButtonRenderTarget, r as renderRulnarButtonTarget } from './buttonRenderAdapter-es.js';
|
|
16
|
+
import { O as OverlaySeparator } from './OverlaySeparator-es.js';
|
|
17
|
+
import { a as BottomSheet } from './BottomSheet-es.js';
|
|
18
|
+
import './HelperText-es.js';
|
|
19
|
+
import './tslib.es6-es.js';
|
|
20
|
+
import './SelectPrimitive-es.js';
|
|
21
|
+
import { D as DrawerTrigger } from './ScrollAreaViewport-es.js';
|
|
22
|
+
import { D as DrawerTitle, a as DrawerClose } from './DrawerTitle-es.js';
|
|
23
|
+
import { M as MenuTrigger$1, a as MenuLinkItem, b as MenuItem$1, c as MenuRadioItem$1, d as MenuRadioItemIndicator, e as MenuSubmenuTrigger$1, f as MenuRoot, g as MenuPortal$1, h as MenuBackdrop, i as MenuPositioner, j as MenuPopup, k as MenuRadioGroup$1, l as MenuGroup$1, m as MenuSubmenuRoot, n as MenuGroupLabel$1 } from './MenuSubmenuTrigger-es.js';
|
|
24
|
+
|
|
25
|
+
var styles$2 = {"wrapper":"h-nk89U2n6Q-","floatingContainer":"krpkWzoaVcc-","menu":"_7sU7mp1w0jM-","legacySection":"_4x-vvEmn4gM-","separator":"i0QNcs4S-wk-","triggerWrapper":"_7CsejipGrzM-","ariaMenu":"bO7lGVQC42c-","ariaItem":"u6fDgbWmPck-","ariaSection":"-TSNrZBKZJI-","ariaSectionHeader":"zs7dS2pKjEw-","sectionHeader":"MZJgunQcmdQ-","legacyAction":"_-1GOlrzd098-","action":"NYXV5w4pd0c-","destructive":"baYK2zQ6-GA-","overlay":"A7T14ALVEKg-","fullWidth":"Lgbn9IRPI5Y-","screenReaderOnly":"o-ps580KdWI-","spinning":"f1oTdSTeUOM-"};
|
|
26
|
+
|
|
27
|
+
const SMALL_SCREEN_BREAKPOINT = 490;
|
|
28
|
+
const MENU_OFFSET = 6;
|
|
29
|
+
const MENU_MAX_HEIGHT_PERCENTAGE = 72;
|
|
30
|
+
const Y_TRANSLATION_DESKTOP = 10;
|
|
31
|
+
const Y_TRANSLATION_MOBILE = 150;
|
|
32
|
+
const MENU_ANIMATION_DURATION = 0.25;
|
|
33
|
+
const OVERLAY_ANIMATION_DURATION = 0.15;
|
|
34
|
+
const MENU_ANIMATION_CONFIG = {
|
|
35
|
+
duration: MENU_ANIMATION_DURATION,
|
|
36
|
+
type: "tween",
|
|
37
|
+
};
|
|
38
|
+
const OVERLAY_ANIMATION_CONFIG = {
|
|
39
|
+
duration: OVERLAY_ANIMATION_DURATION,
|
|
40
|
+
type: "tween",
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
const menuMessages = defineMessages({
|
|
44
|
+
moreActions: {
|
|
45
|
+
en: "More Actions",
|
|
46
|
+
es: "Más acciones",
|
|
47
|
+
},
|
|
48
|
+
back: {
|
|
49
|
+
en: "Back",
|
|
50
|
+
es: "Atrás",
|
|
51
|
+
},
|
|
52
|
+
"Back to {title}": {
|
|
53
|
+
en: "Back to {title}",
|
|
54
|
+
es: "Volver a {title}",
|
|
55
|
+
},
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
function isMobileDevice() {
|
|
59
|
+
if (typeof window === "undefined") {
|
|
60
|
+
return false;
|
|
61
|
+
}
|
|
62
|
+
return window.innerWidth <= SMALL_SCREEN_BREAKPOINT;
|
|
63
|
+
}
|
|
64
|
+
const animationVariation = {
|
|
65
|
+
overlayStartStop: { opacity: 0 },
|
|
66
|
+
startOrStop: (placement) => {
|
|
67
|
+
let y = Y_TRANSLATION_DESKTOP;
|
|
68
|
+
if (placement === null || placement === void 0 ? void 0 : placement.includes("bottom"))
|
|
69
|
+
y *= -1;
|
|
70
|
+
if (isMobileDevice())
|
|
71
|
+
y = Y_TRANSLATION_MOBILE;
|
|
72
|
+
return { opacity: 0, y };
|
|
73
|
+
},
|
|
74
|
+
done: { opacity: 1, y: 0 },
|
|
75
|
+
};
|
|
76
|
+
// eslint-disable-next-line max-statements
|
|
77
|
+
function MenuLegacy({ activator, items, UNSAFE_className, UNSAFE_style, }) {
|
|
78
|
+
var _a;
|
|
79
|
+
const { t } = useComponentMessages(menuMessages);
|
|
80
|
+
const [visible, setVisible] = useState(false);
|
|
81
|
+
const [referenceElement, setReferenceElement] = useState(null);
|
|
82
|
+
const [activeIndex, setActiveIndex] = useState(null);
|
|
83
|
+
const listRef = useRef([]);
|
|
84
|
+
const { width } = useWindowDimensions();
|
|
85
|
+
const buttonID = useId();
|
|
86
|
+
const menuID = useId();
|
|
87
|
+
const fullWidth = ((_a = activator === null || activator === void 0 ? void 0 : activator.props) === null || _a === void 0 ? void 0 : _a.fullWidth) || false;
|
|
88
|
+
const wrapperClasses = classnames(styles$2.wrapper, {
|
|
89
|
+
[styles$2.fullWidth]: fullWidth,
|
|
90
|
+
});
|
|
91
|
+
useRefocusOnActivator(visible);
|
|
92
|
+
const isLargeScreen = width !== undefined && width >= SMALL_SCREEN_BREAKPOINT;
|
|
93
|
+
const middleware = useMemo(() => {
|
|
94
|
+
if (isLargeScreen) {
|
|
95
|
+
return [
|
|
96
|
+
offset(MENU_OFFSET),
|
|
97
|
+
flip({ fallbackPlacements: ["bottom-end", "top-start", "top-end"] }),
|
|
98
|
+
size({
|
|
99
|
+
apply({ availableHeight, elements }) {
|
|
100
|
+
const menuElement = elements.floating.querySelector('[role="menu"]');
|
|
101
|
+
if (menuElement) {
|
|
102
|
+
const viewportHeight = window.innerHeight;
|
|
103
|
+
const maxHeightVh = (viewportHeight * MENU_MAX_HEIGHT_PERCENTAGE) / 100;
|
|
104
|
+
const maxHeight = calculateMaxHeight(availableHeight, {
|
|
105
|
+
maxHeight: maxHeightVh,
|
|
106
|
+
});
|
|
107
|
+
Object.assign(menuElement.style, {
|
|
108
|
+
maxHeight: `${maxHeight}px`,
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
},
|
|
112
|
+
}),
|
|
113
|
+
];
|
|
114
|
+
}
|
|
115
|
+
return [];
|
|
116
|
+
}, [isLargeScreen]);
|
|
117
|
+
const { refs, floatingStyles, context } = useFloating({
|
|
118
|
+
open: visible,
|
|
119
|
+
onOpenChange: (isOpen) => {
|
|
120
|
+
setVisible(isOpen);
|
|
121
|
+
},
|
|
122
|
+
placement: "bottom-start",
|
|
123
|
+
strategy: "fixed",
|
|
124
|
+
middleware,
|
|
125
|
+
elements: {
|
|
126
|
+
reference: referenceElement,
|
|
127
|
+
},
|
|
128
|
+
whileElementsMounted: autoUpdate,
|
|
129
|
+
});
|
|
130
|
+
const dismiss = useDismiss(context);
|
|
131
|
+
const listNavigation = useListNavigation(context, {
|
|
132
|
+
listRef,
|
|
133
|
+
activeIndex,
|
|
134
|
+
onNavigate: setActiveIndex,
|
|
135
|
+
loop: true,
|
|
136
|
+
});
|
|
137
|
+
const { getReferenceProps, getFloatingProps, getItemProps } = useInteractions([dismiss, listNavigation]);
|
|
138
|
+
const positionAttributes = isLargeScreen
|
|
139
|
+
? {
|
|
140
|
+
style: floatingStyles,
|
|
141
|
+
}
|
|
142
|
+
: {};
|
|
143
|
+
if (!activator) {
|
|
144
|
+
activator = (React__default.createElement(Button, { fullWidth: true, label: t("moreActions"), icon: "more", type: "secondary" }));
|
|
145
|
+
}
|
|
146
|
+
let itemIndexCounter = 0;
|
|
147
|
+
const renderedSections = items === null || items === void 0 ? void 0 : items.map((item, key) => (React__default.createElement("div", { key: key, className: styles$2.legacySection },
|
|
148
|
+
item.header && (React__default.createElement(SectionHeader, { text: item.header, UNSAFE_style: UNSAFE_style === null || UNSAFE_style === void 0 ? void 0 : UNSAFE_style.header, UNSAFE_className: UNSAFE_className === null || UNSAFE_className === void 0 ? void 0 : UNSAFE_className.header })),
|
|
149
|
+
item.actions.map(action => {
|
|
150
|
+
const currentIndex = itemIndexCounter++;
|
|
151
|
+
return (React__default.createElement(Action, Object.assign({ UNSAFE_style: UNSAFE_style === null || UNSAFE_style === void 0 ? void 0 : UNSAFE_style.action, UNSAFE_className: UNSAFE_className === null || UNSAFE_className === void 0 ? void 0 : UNSAFE_className.action, sectionLabel: item.header, key: action.label, tabIndex: activeIndex === currentIndex ? 0 : -1, setItemNode: node => {
|
|
152
|
+
listRef.current[currentIndex] = node;
|
|
153
|
+
}, getItemProps: getItemProps }, action)));
|
|
154
|
+
}))));
|
|
155
|
+
return (React__default.createElement("div", { className: wrapperClasses, onClick: handleParentClick },
|
|
156
|
+
React__default.createElement("div", Object.assign({ ref: setReferenceElement }, getReferenceProps()), React__default.cloneElement(activator, {
|
|
157
|
+
onClick: toggle(activator.props.onClick),
|
|
158
|
+
id: buttonID,
|
|
159
|
+
ariaControls: menuID,
|
|
160
|
+
ariaExpanded: visible,
|
|
161
|
+
ariaHaspopup: true,
|
|
162
|
+
})),
|
|
163
|
+
React__default.createElement(MenuPortal, null,
|
|
164
|
+
React__default.createElement(AnimatePresence, null, visible && (React__default.createElement(React__default.Fragment, null,
|
|
165
|
+
React__default.createElement(motion.div, { className: styles$2.overlay, onClick: toggle(), variants: animationVariation, initial: "overlayStartStop", animate: "done", exit: "overlayStartStop", transition: Object.assign({}, OVERLAY_ANIMATION_CONFIG) }),
|
|
166
|
+
React__default.createElement("div", Object.assign({ ref: refs.setFloating, className: styles$2.floatingContainer }, getFloatingProps({
|
|
167
|
+
onKeyDown: event => {
|
|
168
|
+
if (event.key === "Tab") {
|
|
169
|
+
event.preventDefault();
|
|
170
|
+
}
|
|
171
|
+
},
|
|
172
|
+
}), positionAttributes, formFieldFocusAttribute), items.length > 0 && (React__default.createElement(motion.div, { className: classnames(styles$2.menu, UNSAFE_className === null || UNSAFE_className === void 0 ? void 0 : UNSAFE_className.menu), role: "menu", "data-elevation": "elevated", "aria-labelledby": buttonID, id: menuID, onClick: hide, variants: animationVariation, initial: "startOrStop", animate: "done", exit: "startOrStop", custom: context === null || context === void 0 ? void 0 : context.placement, transition: Object.assign({}, MENU_ANIMATION_CONFIG), style: UNSAFE_style === null || UNSAFE_style === void 0 ? void 0 : UNSAFE_style.menu }, renderedSections)))))))));
|
|
173
|
+
function toggle(callbackPassthrough) {
|
|
174
|
+
return (event) => {
|
|
175
|
+
setVisible(!visible);
|
|
176
|
+
callbackPassthrough && callbackPassthrough(event);
|
|
177
|
+
};
|
|
178
|
+
}
|
|
179
|
+
function hide() {
|
|
180
|
+
setVisible(false);
|
|
181
|
+
setActiveIndex(null);
|
|
182
|
+
}
|
|
183
|
+
function handleParentClick(event) {
|
|
184
|
+
event.stopPropagation();
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
function SectionHeader({ text, UNSAFE_style, UNSAFE_className, }) {
|
|
188
|
+
return (React__default.createElement("div", { className: classnames(styles$2.sectionHeader, UNSAFE_className), "aria-hidden": true, style: UNSAFE_style },
|
|
189
|
+
React__default.createElement(DefaultHeaderContent, null, text)));
|
|
190
|
+
}
|
|
191
|
+
function Action(props) {
|
|
192
|
+
const { label, sectionLabel, icon, iconColor, destructive, UNSAFE_style, UNSAFE_className, onClick, tabIndex, setItemNode, getItemProps, } = props;
|
|
193
|
+
const buttonClasses = classnames(styles$2.action, styles$2.legacyAction, {
|
|
194
|
+
[styles$2.destructive]: destructive,
|
|
195
|
+
});
|
|
196
|
+
return (React__default.createElement("button", Object.assign({ className: classnames(buttonClasses, UNSAFE_className), style: UNSAFE_style, key: label, type: "button" }, getItemProps({
|
|
197
|
+
ref: setItemNode,
|
|
198
|
+
role: "menuitem",
|
|
199
|
+
onClick,
|
|
200
|
+
tabIndex,
|
|
201
|
+
})),
|
|
202
|
+
React__default.createElement(DefaultItemContent, { label: label, icon: icon, iconColor: iconColor, destructive: destructive, sectionLabel: sectionLabel })));
|
|
203
|
+
}
|
|
204
|
+
function DefaultItemContent({ label, icon, iconColor, destructive, sectionLabel, }) {
|
|
205
|
+
return (React__default.createElement(React__default.Fragment, null,
|
|
206
|
+
icon && (React__default.createElement("div", null,
|
|
207
|
+
React__default.createElement(Icon, { color: destructive ? "destructive" : iconColor, name: icon }))),
|
|
208
|
+
React__default.createElement(Typography, { element: "span", fontWeight: "semiBold", textColor: destructive ? "destructive" : "text" },
|
|
209
|
+
sectionLabel && (React__default.createElement("span", { className: styles$2.screenReaderOnly }, sectionLabel)),
|
|
210
|
+
label)));
|
|
211
|
+
}
|
|
212
|
+
function DefaultHeaderContent({ children, }) {
|
|
213
|
+
return (React__default.createElement(Typography, { element: "h6", size: "base", textColor: "textSecondary", fontWeight: "regular", textCase: "none" }, children));
|
|
214
|
+
}
|
|
215
|
+
function MenuPortal({ children }) {
|
|
216
|
+
if (typeof document === "undefined") {
|
|
217
|
+
return null;
|
|
218
|
+
}
|
|
219
|
+
return React__default.createElement(ScopedPortal, null, children);
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
var styles$1 = {"submenuHeader":"Vw9MFreevMU-","submenuTitle":"wpNMcBuNwwY-","spinning":"nOEBQCC4Cos-"};
|
|
223
|
+
|
|
224
|
+
var styles = {"wrapper":"fpi0W91w2ag-","floatingContainer":"ba-Kj6mvQUw-","composableBackdrop":"wqvf3hcDMM0-","menu":"-DayvgvIcVo-","legacySection":"VsRRunpS6Yo-","separator":"jnggqK3YTIU-","triggerWrapper":"oRQQVVq-yxA-","composableMenu":"atokGnmWVls-","composableDropdownPopup":"Uk14qmg-Fqc-","composableDropdownScroller":"CJKnGqldjF0-","bottomSheetMenuContent":"J3CW8IU48RM-","composableItem":"zSMkwrZodBk-","composableItemNoLeadingSlot":"qbDWOwkPouM-","composableSection":"_353OIWGazfE-","composableGroup":"Q0ssxff-Qo4-","composableRadioGroup":"_2VyPM45lQBE-","composableSectionHeader":"efA-ozx9w0w-","composableGroupHeader":"BklkzNPbJ5Q-","composableGroupLabel":"_5-p9DbyRav4-","sectionHeader":"Bq7pLWj3jm4-","legacyAction":"P4Sdaq0-lZs-","action":"M1BgN-oCmKw-","destructive":"U9ihZZavz9w-","overlay":"_7we5hh6kYs8-","bottomSheetSubmenuPopup":"nf47GCAYI-c-","menuHidden":"cuw8ct7rX6s-","bottomSheetSubmenuBody":"a6uZEXgX8sg-","fullWidth":"_5OJ7B6mFcwk-","screenReaderOnly":"Bzvkz60bwWE-","spinning":"_0-VzuzHdi8o-"};
|
|
225
|
+
|
|
226
|
+
function mergeUnsafeProps(props) {
|
|
227
|
+
return mergeProps({
|
|
228
|
+
className: props.UNSAFE_className,
|
|
229
|
+
style: props.UNSAFE_style,
|
|
230
|
+
}, {
|
|
231
|
+
className: props.className,
|
|
232
|
+
style: props.style,
|
|
233
|
+
});
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
// New composable menu pieces prefer standard DOM props, but we still accept the
|
|
237
|
+
// old UNSAFE_* names during the migration window. Base UI's merge semantics let
|
|
238
|
+
// either API path continue to work while standard props still win on conflicts.
|
|
239
|
+
function resolveComposableBaseProps(props) {
|
|
240
|
+
return mergeUnsafeProps(props);
|
|
241
|
+
}
|
|
242
|
+
// Detects whether a composed item already includes a specific slot so each
|
|
243
|
+
// shell can adjust layout without needing to understand every child shape.
|
|
244
|
+
function hasMenuSlot(children, slot) {
|
|
245
|
+
return React__default.Children.toArray(children).some(child => {
|
|
246
|
+
if (!React__default.isValidElement(child)) {
|
|
247
|
+
return false;
|
|
248
|
+
}
|
|
249
|
+
if (typeof child.type === "string" || !("menuSlot" in child.type)) {
|
|
250
|
+
return false;
|
|
251
|
+
}
|
|
252
|
+
return child.type.menuSlot === slot;
|
|
253
|
+
});
|
|
254
|
+
}
|
|
255
|
+
// Falls back to the default Rulnar button trigger when a consumer does not
|
|
256
|
+
// provide a custom render function or element.
|
|
257
|
+
function resolveMenuTriggerRender({ children, render, }) {
|
|
258
|
+
if (render) {
|
|
259
|
+
if (typeof render === "function") {
|
|
260
|
+
return (props) => {
|
|
261
|
+
const renderedElement = render(normalizeBaseUiButtonProps(props));
|
|
262
|
+
return isRulnarButtonRenderTarget(renderedElement)
|
|
263
|
+
? stripNativeTypeFromButtonRenderTarget(renderedElement)
|
|
264
|
+
: renderedElement;
|
|
265
|
+
};
|
|
266
|
+
}
|
|
267
|
+
return isRulnarButtonRenderTarget(render)
|
|
268
|
+
? renderRulnarButtonTarget(render)
|
|
269
|
+
: render;
|
|
270
|
+
}
|
|
271
|
+
if (isRulnarButtonRenderTarget(children)) {
|
|
272
|
+
return renderRulnarButtonTarget(children);
|
|
273
|
+
}
|
|
274
|
+
if (React__default.isValidElement(children)) {
|
|
275
|
+
return children;
|
|
276
|
+
}
|
|
277
|
+
return renderRulnarButtonTarget(React__default.createElement(Button, { type: "secondary" },
|
|
278
|
+
React__default.createElement(Button.Label, null, children)));
|
|
279
|
+
}
|
|
280
|
+
const MenuItemContext = React__default.createContext(null);
|
|
281
|
+
function MenuItemProvider({ children, variation, }) {
|
|
282
|
+
return (React__default.createElement(MenuItemContext.Provider, { value: { variation } }, children));
|
|
283
|
+
}
|
|
284
|
+
function useMenuItemContext() {
|
|
285
|
+
const context = React__default.useContext(MenuItemContext);
|
|
286
|
+
return context !== null && context !== void 0 ? context : {};
|
|
287
|
+
}
|
|
288
|
+
function SharedMenuItemIcon(props) {
|
|
289
|
+
const { variation } = useMenuItemContext();
|
|
290
|
+
return (
|
|
291
|
+
// TODO: Remove this wrapper once Icon can accept the data attributes needed
|
|
292
|
+
// for Menu slot styling directly.
|
|
293
|
+
React__default.createElement("div", { "data-menu-slot": "icon" },
|
|
294
|
+
React__default.createElement(Icon, Object.assign({}, props, { color: variation === "destructive" ? "destructive" : props.color }))));
|
|
295
|
+
}
|
|
296
|
+
function SharedMenuItemLabel(props) {
|
|
297
|
+
const { variation } = useMenuItemContext();
|
|
298
|
+
return (
|
|
299
|
+
// TODO: Remove this wrapper once Typography can accept the data attributes
|
|
300
|
+
// needed for Menu slot styling directly.
|
|
301
|
+
React__default.createElement("div", { "data-menu-slot": "label" },
|
|
302
|
+
React__default.createElement(Typography, { element: "span", size: "base", fontWeight: "semiBold", textColor: variation === "destructive" ? "destructive" : "text" }, props.children)));
|
|
303
|
+
}
|
|
304
|
+
function SharedMenuItemPrefix(props) {
|
|
305
|
+
const { className, style } = resolveComposableBaseProps(props);
|
|
306
|
+
return (React__default.createElement("div", { className: className, "data-menu-slot": "prefix", style: style }, props.children));
|
|
307
|
+
}
|
|
308
|
+
function SharedMenuItemSuffix(props) {
|
|
309
|
+
const { className, style } = resolveComposableBaseProps(props);
|
|
310
|
+
return (React__default.createElement("div", { className: className, "data-menu-slot": "suffix", style: style }, props.children));
|
|
311
|
+
}
|
|
312
|
+
const sharedMenuGroupLabelClassName = `${styles.composableGroupHeader} ${styles.composableGroupLabel}`;
|
|
313
|
+
function DefaultGroupLabelContent({ children, }) {
|
|
314
|
+
return (React__default.createElement(Typography, { element: "span", size: "base", textColor: "textSecondary", fontWeight: "regular", textCase: "none" }, children));
|
|
315
|
+
}
|
|
316
|
+
function SharedMenuGroupLabelContent(props) {
|
|
317
|
+
return React__default.createElement(DefaultGroupLabelContent, null, props.children);
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
const BottomSheetContext = React__default.createContext(null);
|
|
321
|
+
const BottomSheetRadioGroupContext = React__default.createContext(null);
|
|
322
|
+
const BottomSheetGroupContext = React__default.createContext(null);
|
|
323
|
+
const BottomSheetSubmenuContext = React__default.createContext(null);
|
|
324
|
+
const MENU_ITEM_SELECTOR = '[role="menuitem"], [role="menuitemradio"]';
|
|
325
|
+
function useBottomSheetContext() {
|
|
326
|
+
const context = React__default.useContext(BottomSheetContext);
|
|
327
|
+
if (!context) {
|
|
328
|
+
throw new Error("BottomSheetContext used outside provider");
|
|
329
|
+
}
|
|
330
|
+
return context;
|
|
331
|
+
}
|
|
332
|
+
function useBottomSheetRadioGroupContext() {
|
|
333
|
+
return React__default.useContext(BottomSheetRadioGroupContext);
|
|
334
|
+
}
|
|
335
|
+
function useBottomSheetGroupContext() {
|
|
336
|
+
const context = React__default.useContext(BottomSheetGroupContext);
|
|
337
|
+
if (!context) {
|
|
338
|
+
throw new Error("BottomSheetGroupContext used outside provider");
|
|
339
|
+
}
|
|
340
|
+
return context;
|
|
341
|
+
}
|
|
342
|
+
function useBottomSheetSubmenuContext() {
|
|
343
|
+
const context = React__default.useContext(BottomSheetSubmenuContext);
|
|
344
|
+
if (!context) {
|
|
345
|
+
throw new Error("BottomSheetSubmenuContext used outside provider");
|
|
346
|
+
}
|
|
347
|
+
return context;
|
|
348
|
+
}
|
|
349
|
+
function getTextContent(node) {
|
|
350
|
+
if (typeof node === "string" || typeof node === "number") {
|
|
351
|
+
return String(node);
|
|
352
|
+
}
|
|
353
|
+
if (Array.isArray(node)) {
|
|
354
|
+
return node.map(child => getTextContent(child)).join(" ");
|
|
355
|
+
}
|
|
356
|
+
if (!React__default.isValidElement(node)) {
|
|
357
|
+
return "";
|
|
358
|
+
}
|
|
359
|
+
return getTextContent(node.props.children);
|
|
360
|
+
}
|
|
361
|
+
function getBottomSheetContentStyle(style) {
|
|
362
|
+
if (!style) {
|
|
363
|
+
return undefined;
|
|
364
|
+
}
|
|
365
|
+
const safeStyle = Object.assign({}, style);
|
|
366
|
+
delete safeStyle.height;
|
|
367
|
+
delete safeStyle.maxHeight;
|
|
368
|
+
delete safeStyle.minHeight;
|
|
369
|
+
delete safeStyle.width;
|
|
370
|
+
return safeStyle;
|
|
371
|
+
}
|
|
372
|
+
// Bottom sheet menu interaction helpers. These adapt Drawer semantics into the
|
|
373
|
+
// menu-style keyboard and focus behavior we want for the mobile shell.
|
|
374
|
+
function getNavigableMenuItems(target) {
|
|
375
|
+
const menu = target.closest('[role="menu"]');
|
|
376
|
+
if (!menu) {
|
|
377
|
+
return [];
|
|
378
|
+
}
|
|
379
|
+
return Array.from(menu.querySelectorAll(MENU_ITEM_SELECTOR)).filter(item => !item.hasAttribute("disabled"));
|
|
380
|
+
}
|
|
381
|
+
function moveBottomSheetMenuFocus(currentTarget, direction) {
|
|
382
|
+
var _a, _b;
|
|
383
|
+
const items = getNavigableMenuItems(currentTarget);
|
|
384
|
+
if (items.length === 0) {
|
|
385
|
+
return;
|
|
386
|
+
}
|
|
387
|
+
const boundaryIndex = direction === "first" ? 0 : direction === "last" ? items.length - 1 : null;
|
|
388
|
+
if (boundaryIndex !== null) {
|
|
389
|
+
(_a = items[boundaryIndex]) === null || _a === void 0 ? void 0 : _a.focus();
|
|
390
|
+
return;
|
|
391
|
+
}
|
|
392
|
+
const currentIndex = items.indexOf(currentTarget);
|
|
393
|
+
const startIndex = currentIndex === -1 ? 0 : currentIndex;
|
|
394
|
+
const offset = direction === "next" ? 1 : -1;
|
|
395
|
+
const nextIndex = (startIndex + offset + items.length) % items.length;
|
|
396
|
+
(_b = items[nextIndex]) === null || _b === void 0 ? void 0 : _b.focus();
|
|
397
|
+
}
|
|
398
|
+
function handleBottomSheetMenuItemKeyDown(event) {
|
|
399
|
+
switch (event.key) {
|
|
400
|
+
case "ArrowDown":
|
|
401
|
+
event.preventDefault();
|
|
402
|
+
moveBottomSheetMenuFocus(event.currentTarget, "next");
|
|
403
|
+
break;
|
|
404
|
+
case "ArrowUp":
|
|
405
|
+
event.preventDefault();
|
|
406
|
+
moveBottomSheetMenuFocus(event.currentTarget, "previous");
|
|
407
|
+
break;
|
|
408
|
+
case "Home":
|
|
409
|
+
event.preventDefault();
|
|
410
|
+
moveBottomSheetMenuFocus(event.currentTarget, "first");
|
|
411
|
+
break;
|
|
412
|
+
case "End":
|
|
413
|
+
event.preventDefault();
|
|
414
|
+
moveBottomSheetMenuFocus(event.currentTarget, "last");
|
|
415
|
+
break;
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
function updateBottomSheetHighlight(event, focusModalityRef, setHighlighted) {
|
|
419
|
+
setHighlighted(focusModalityRef.current === "keyboard" ||
|
|
420
|
+
event.currentTarget.matches(":focus-visible"));
|
|
421
|
+
}
|
|
422
|
+
function useBottomSheetMenuItemInteractions() {
|
|
423
|
+
const { focusModalityRef } = useBottomSheetContext();
|
|
424
|
+
const [isHighlighted, setIsHighlighted] = React__default.useState(false);
|
|
425
|
+
return {
|
|
426
|
+
isHighlighted,
|
|
427
|
+
interactionProps: {
|
|
428
|
+
onPointerDown: () => {
|
|
429
|
+
focusModalityRef.current = "pointer";
|
|
430
|
+
},
|
|
431
|
+
onFocus: (event) => {
|
|
432
|
+
updateBottomSheetHighlight(event, focusModalityRef, setIsHighlighted);
|
|
433
|
+
},
|
|
434
|
+
onBlur: () => {
|
|
435
|
+
setIsHighlighted(false);
|
|
436
|
+
},
|
|
437
|
+
onKeyDown: (event) => {
|
|
438
|
+
focusModalityRef.current = "keyboard";
|
|
439
|
+
handleBottomSheetMenuItemKeyDown(event);
|
|
440
|
+
},
|
|
441
|
+
},
|
|
442
|
+
};
|
|
443
|
+
}
|
|
444
|
+
function getInitialBottomSheetFocus(menuRef, focusModalityRef) {
|
|
445
|
+
return (openType) => {
|
|
446
|
+
var _a;
|
|
447
|
+
if (openType === "keyboard") {
|
|
448
|
+
focusModalityRef.current = "keyboard";
|
|
449
|
+
return (_a = menuRef.current) === null || _a === void 0 ? void 0 : _a.querySelector(MENU_ITEM_SELECTOR);
|
|
450
|
+
}
|
|
451
|
+
focusModalityRef.current = "pointer";
|
|
452
|
+
return menuRef.current;
|
|
453
|
+
};
|
|
454
|
+
}
|
|
455
|
+
function handleBottomSheetMenuContainerKeyDown(event) {
|
|
456
|
+
if (event.target !== event.currentTarget) {
|
|
457
|
+
return;
|
|
458
|
+
}
|
|
459
|
+
switch (event.key) {
|
|
460
|
+
case "ArrowDown":
|
|
461
|
+
case "Home":
|
|
462
|
+
event.preventDefault();
|
|
463
|
+
moveBottomSheetMenuFocus(event.currentTarget, "first");
|
|
464
|
+
break;
|
|
465
|
+
case "ArrowUp":
|
|
466
|
+
case "End":
|
|
467
|
+
event.preventDefault();
|
|
468
|
+
moveBottomSheetMenuFocus(event.currentTarget, "last");
|
|
469
|
+
break;
|
|
470
|
+
}
|
|
471
|
+
}
|
|
472
|
+
function BottomSheetMenuSurface({ children, className, menuRef, style, }) {
|
|
473
|
+
const { focusModalityRef } = useBottomSheetContext();
|
|
474
|
+
return (React__default.createElement("div", { ref: menuRef, className: classnames(styles.composableMenu, className), role: "menu", tabIndex: -1, onKeyDown: event => {
|
|
475
|
+
focusModalityRef.current = "keyboard";
|
|
476
|
+
handleBottomSheetMenuContainerKeyDown(event);
|
|
477
|
+
}, style: style }, children));
|
|
478
|
+
}
|
|
479
|
+
function BottomSheetRoot({ children, onOpenChange, open, defaultOpen, }) {
|
|
480
|
+
// Mobile submenu drill-downs use their own drawer layer. We track that here
|
|
481
|
+
// so the parent sheet can hide while a nested submenu is open.
|
|
482
|
+
const [submenuOpen, setSubmenuOpen] = React__default.useState(false);
|
|
483
|
+
const focusModalityRef = React__default.useRef("pointer");
|
|
484
|
+
const actionsRef = React__default.useRef(null);
|
|
485
|
+
return (React__default.createElement(BottomSheet.Root, { actionsRef: actionsRef, open: open, defaultOpen: defaultOpen, onOpenChange: nextOpen => {
|
|
486
|
+
if (!nextOpen) {
|
|
487
|
+
setSubmenuOpen(false);
|
|
488
|
+
}
|
|
489
|
+
onOpenChange === null || onOpenChange === void 0 ? void 0 : onOpenChange(nextOpen);
|
|
490
|
+
} },
|
|
491
|
+
React__default.createElement(BottomSheetContext.Provider, { value: {
|
|
492
|
+
close: () => {
|
|
493
|
+
var _a;
|
|
494
|
+
(_a = actionsRef.current) === null || _a === void 0 ? void 0 : _a.close();
|
|
495
|
+
},
|
|
496
|
+
focusModalityRef,
|
|
497
|
+
setSubmenuOpen,
|
|
498
|
+
submenuOpen,
|
|
499
|
+
} }, children)));
|
|
500
|
+
}
|
|
501
|
+
const BottomSheetTrigger = React__default.forwardRef(function BottomSheetTrigger({ ariaLabel, children, style, className, render, UNSAFE_style, UNSAFE_className, }, ref) {
|
|
502
|
+
const resolvedBaseProps = resolveComposableBaseProps({
|
|
503
|
+
className,
|
|
504
|
+
style,
|
|
505
|
+
UNSAFE_className,
|
|
506
|
+
UNSAFE_style,
|
|
507
|
+
});
|
|
508
|
+
return (React__default.createElement(DrawerTrigger, { "aria-label": ariaLabel, className: classnames(styles.triggerWrapper, resolvedBaseProps.className), style: resolvedBaseProps.style, render: resolveMenuTriggerRender({ children, render }), ref: ref }));
|
|
509
|
+
});
|
|
510
|
+
function BottomSheetContent({ children, portalContainer, style, className, UNSAFE_style, UNSAFE_className, }) {
|
|
511
|
+
const { focusModalityRef, submenuOpen } = useBottomSheetContext();
|
|
512
|
+
const menuRef = React__default.useRef(null);
|
|
513
|
+
const resolvedBaseProps = resolveComposableBaseProps({
|
|
514
|
+
className,
|
|
515
|
+
style,
|
|
516
|
+
UNSAFE_className,
|
|
517
|
+
UNSAFE_style,
|
|
518
|
+
});
|
|
519
|
+
const bottomSheetStyle = getBottomSheetContentStyle(resolvedBaseProps.style);
|
|
520
|
+
return (React__default.createElement(BottomSheet.Popup, { portalContainer, "data-elevation": "elevated", initialFocus: getInitialBottomSheetFocus(menuRef, focusModalityRef), className: classnames({
|
|
521
|
+
[styles.menuHidden]: submenuOpen,
|
|
522
|
+
}) },
|
|
523
|
+
React__default.createElement(BottomSheet.Content, null,
|
|
524
|
+
React__default.createElement(BottomSheetMenuSurface, { menuRef: menuRef, className: classnames(styles.bottomSheetMenuContent, resolvedBaseProps.className), style: bottomSheetStyle }, children))));
|
|
525
|
+
}
|
|
526
|
+
function BottomSheetSeparator({ style, className, UNSAFE_style, UNSAFE_className, }) {
|
|
527
|
+
const resolvedBaseProps = resolveComposableBaseProps({
|
|
528
|
+
className,
|
|
529
|
+
style,
|
|
530
|
+
UNSAFE_className,
|
|
531
|
+
UNSAFE_style,
|
|
532
|
+
});
|
|
533
|
+
return (React__default.createElement(OverlaySeparator, { className: classnames(styles.separator, resolvedBaseProps.className), style: resolvedBaseProps.style, "data-testid": "ATL-Menu-Separator" }));
|
|
534
|
+
}
|
|
535
|
+
function BottomSheetRadioGroup({ children, value, defaultValue, onValueChange, className, style, UNSAFE_style, UNSAFE_className, }) {
|
|
536
|
+
const resolvedBaseProps = resolveComposableBaseProps({
|
|
537
|
+
className,
|
|
538
|
+
style,
|
|
539
|
+
UNSAFE_className,
|
|
540
|
+
UNSAFE_style,
|
|
541
|
+
});
|
|
542
|
+
const [internalValue, setInternalValue] = React__default.useState(defaultValue);
|
|
543
|
+
const selectedValue = value !== null && value !== void 0 ? value : internalValue;
|
|
544
|
+
return (React__default.createElement(BottomSheetRadioGroupContext.Provider, { value: {
|
|
545
|
+
value: selectedValue,
|
|
546
|
+
setValue: nextValue => {
|
|
547
|
+
if (value === undefined) {
|
|
548
|
+
setInternalValue(nextValue);
|
|
549
|
+
}
|
|
550
|
+
onValueChange === null || onValueChange === void 0 ? void 0 : onValueChange(nextValue);
|
|
551
|
+
},
|
|
552
|
+
} },
|
|
553
|
+
React__default.createElement("div", { className: classnames(styles.composableRadioGroup, resolvedBaseProps.className), style: resolvedBaseProps.style }, children)));
|
|
554
|
+
}
|
|
555
|
+
function BottomSheetGroup(props) {
|
|
556
|
+
const { className, style } = resolveComposableBaseProps(props);
|
|
557
|
+
const labelId = React__default.useId();
|
|
558
|
+
const [hasLabel, setHasLabel] = React__default.useState(false);
|
|
559
|
+
const registerLabel = React__default.useCallback((nextHasLabel) => {
|
|
560
|
+
setHasLabel(nextHasLabel);
|
|
561
|
+
}, []);
|
|
562
|
+
return (React__default.createElement(BottomSheetGroupContext.Provider, { value: { labelId, registerLabel } },
|
|
563
|
+
React__default.createElement("div", { role: "group", "aria-labelledby": hasLabel ? labelId : undefined, "aria-label": !hasLabel ? props.ariaLabel : undefined, className: classnames(styles.composableGroup, className), style: style }, props.children)));
|
|
564
|
+
}
|
|
565
|
+
const BottomSheetItem = React__default.forwardRef(function BottomSheetItem(props, ref) {
|
|
566
|
+
const { close } = useBottomSheetContext();
|
|
567
|
+
const { isHighlighted, interactionProps } = useBottomSheetMenuItemInteractions();
|
|
568
|
+
const { className: itemClassName, style } = resolveComposableBaseProps(props);
|
|
569
|
+
const hasLeadingContent = hasMenuSlot(props.children, "icon") ||
|
|
570
|
+
hasMenuSlot(props.children, "prefix");
|
|
571
|
+
const className = classnames(styles.action, styles.composableItem, {
|
|
572
|
+
[styles.composableItemNoLeadingSlot]: !hasLeadingContent,
|
|
573
|
+
}, {
|
|
574
|
+
[styles.destructive]: props.variation === "destructive",
|
|
575
|
+
}, itemClassName);
|
|
576
|
+
if (props.href) {
|
|
577
|
+
const { href, target, rel, onClick, closeOnClick = true } = props;
|
|
578
|
+
return (React__default.createElement("a", Object.assign({ ref: ref, className: className, "data-highlighted": isHighlighted ? "" : undefined, style: style, href: href, role: "menuitem", target: target, rel: rel }, interactionProps, { onClick: event => {
|
|
579
|
+
onClick === null || onClick === void 0 ? void 0 : onClick(event);
|
|
580
|
+
if (closeOnClick) {
|
|
581
|
+
close();
|
|
582
|
+
}
|
|
583
|
+
} }),
|
|
584
|
+
React__default.createElement(MenuItemProvider, { variation: props.variation }, props.children)));
|
|
585
|
+
}
|
|
586
|
+
return (React__default.createElement("button", Object.assign({ ref: ref, className: className, "data-highlighted": isHighlighted ? "" : undefined, style: style, type: "button", role: "menuitem" }, interactionProps, { onClick: () => {
|
|
587
|
+
var _a;
|
|
588
|
+
(_a = props.onClick) === null || _a === void 0 ? void 0 : _a.call(props);
|
|
589
|
+
if (props.closeOnClick !== false) {
|
|
590
|
+
close();
|
|
591
|
+
}
|
|
592
|
+
} }),
|
|
593
|
+
React__default.createElement(MenuItemProvider, { variation: props.variation }, props.children)));
|
|
594
|
+
});
|
|
595
|
+
const BottomSheetRadioItem = React__default.forwardRef(function BottomSheetRadioItem(props, ref) {
|
|
596
|
+
const { close } = useBottomSheetContext();
|
|
597
|
+
const radioGroup = useBottomSheetRadioGroupContext();
|
|
598
|
+
const { isHighlighted, interactionProps } = useBottomSheetMenuItemInteractions();
|
|
599
|
+
const { className, style } = resolveComposableBaseProps(props);
|
|
600
|
+
const checked = (radioGroup === null || radioGroup === void 0 ? void 0 : radioGroup.value) === props.value;
|
|
601
|
+
const hasCustomSuffix = hasMenuSlot(props.children, "suffix");
|
|
602
|
+
const hasLeadingContent = hasMenuSlot(props.children, "icon") ||
|
|
603
|
+
hasMenuSlot(props.children, "prefix");
|
|
604
|
+
return (React__default.createElement("button", Object.assign({ ref: ref, className: classnames(styles.action, styles.composableItem, {
|
|
605
|
+
[styles.composableItemNoLeadingSlot]: !hasLeadingContent,
|
|
606
|
+
}, className), "data-highlighted": isHighlighted ? "" : undefined, style: style, type: "button", role: "menuitemradio", "aria-checked": checked }, interactionProps, { onClick: () => {
|
|
607
|
+
radioGroup === null || radioGroup === void 0 ? void 0 : radioGroup.setValue(props.value);
|
|
608
|
+
if (props.closeOnClick) {
|
|
609
|
+
close();
|
|
610
|
+
}
|
|
611
|
+
} }),
|
|
612
|
+
React__default.createElement(MenuItemProvider, null,
|
|
613
|
+
props.children,
|
|
614
|
+
!hasCustomSuffix ? (React__default.createElement("div", { "data-menu-slot": "suffix", "data-checked": checked ? "" : undefined, "data-unchecked": !checked ? "" : undefined },
|
|
615
|
+
React__default.createElement(Icon, { color: "icon", name: "checkmark" }))) : null)));
|
|
616
|
+
});
|
|
617
|
+
function BottomSheetSubmenu({ children, open, defaultOpen, onOpenChange, }) {
|
|
618
|
+
const { setSubmenuOpen } = useBottomSheetContext();
|
|
619
|
+
// The trigger writes its title here during render; the content reads it
|
|
620
|
+
// when the drill-down sheet mounts. No setState, no effect roundtrip.
|
|
621
|
+
const titleRef = React__default.useRef("");
|
|
622
|
+
React__default.useEffect(() => {
|
|
623
|
+
// Safety reset so the parent sheet is never left hidden if this submenu
|
|
624
|
+
// unmounts unexpectedly while it controls the nested-drawer state.
|
|
625
|
+
return () => {
|
|
626
|
+
setSubmenuOpen(false);
|
|
627
|
+
};
|
|
628
|
+
}, [setSubmenuOpen]);
|
|
629
|
+
return (React__default.createElement(BottomSheetSubmenuContext.Provider, { value: { titleRef } },
|
|
630
|
+
React__default.createElement(BottomSheet.Root, { open: open, defaultOpen: defaultOpen, onOpenChange: isOpen => {
|
|
631
|
+
setSubmenuOpen(isOpen);
|
|
632
|
+
onOpenChange === null || onOpenChange === void 0 ? void 0 : onOpenChange(isOpen);
|
|
633
|
+
} }, children)));
|
|
634
|
+
}
|
|
635
|
+
const BottomSheetSubmenuTrigger = React__default.forwardRef(function BottomSheetSubmenuTrigger({ children, className, style, textValue, UNSAFE_style, UNSAFE_className }, ref) {
|
|
636
|
+
const { isHighlighted, interactionProps } = useBottomSheetMenuItemInteractions();
|
|
637
|
+
const resolvedBaseProps = resolveComposableBaseProps({
|
|
638
|
+
className,
|
|
639
|
+
style,
|
|
640
|
+
UNSAFE_className,
|
|
641
|
+
UNSAFE_style,
|
|
642
|
+
});
|
|
643
|
+
const hasCustomSuffix = hasMenuSlot(children, "suffix");
|
|
644
|
+
const hasLeadingContent = hasMenuSlot(children, "icon") || hasMenuSlot(children, "prefix");
|
|
645
|
+
const { titleRef } = useBottomSheetSubmenuContext();
|
|
646
|
+
// Publish the title synchronously during render so the drill-down sheet
|
|
647
|
+
// header can read it the moment it mounts. Prefer the explicit textValue
|
|
648
|
+
// used for type-to-select, and fall back to the rendered text content.
|
|
649
|
+
titleRef.current = textValue !== null && textValue !== void 0 ? textValue : getTextContent(children).trim();
|
|
650
|
+
return (React__default.createElement(DrawerTrigger, Object.assign({ ref: ref, role: "menuitem", "aria-haspopup": "menu", "data-highlighted": isHighlighted ? "" : undefined, className: classnames(styles.action, styles.composableItem, {
|
|
651
|
+
[styles.composableItemNoLeadingSlot]: !hasLeadingContent,
|
|
652
|
+
}, resolvedBaseProps.className), style: resolvedBaseProps.style, nativeButton: true }, interactionProps, { render: React__default.createElement("button", { type: "button" }) }),
|
|
653
|
+
children,
|
|
654
|
+
!hasCustomSuffix ? (React__default.createElement("div", { "data-menu-slot": "suffix" },
|
|
655
|
+
React__default.createElement(Icon, { color: "icon", name: "arrowRight" }))) : null));
|
|
656
|
+
});
|
|
657
|
+
function BottomSheetSubmenuContent({ children, className, style, UNSAFE_style, UNSAFE_className, }) {
|
|
658
|
+
const { t } = useComponentMessages(menuMessages);
|
|
659
|
+
const { titleRef } = useBottomSheetSubmenuContext();
|
|
660
|
+
const title = titleRef.current;
|
|
661
|
+
const { focusModalityRef } = useBottomSheetContext();
|
|
662
|
+
const menuRef = React__default.useRef(null);
|
|
663
|
+
const resolvedBaseProps = resolveComposableBaseProps({
|
|
664
|
+
className,
|
|
665
|
+
style,
|
|
666
|
+
UNSAFE_className,
|
|
667
|
+
UNSAFE_style,
|
|
668
|
+
});
|
|
669
|
+
const bottomSheetStyle = getBottomSheetContentStyle(resolvedBaseProps.style);
|
|
670
|
+
return (React__default.createElement(BottomSheet.Popup, { "data-elevation": "elevated", initialFocus: getInitialBottomSheetFocus(menuRef, focusModalityRef), className: classnames(styles.menu, styles.bottomSheetSubmenuPopup) },
|
|
671
|
+
React__default.createElement(BottomSheet.Content, { style: bottomSheetStyle },
|
|
672
|
+
title ? (React__default.createElement(DrawerTitle, { className: styles.screenReaderOnly }, title)) : null,
|
|
673
|
+
React__default.createElement("div", { className: styles$1.submenuHeader },
|
|
674
|
+
React__default.createElement(DrawerClose, { "aria-label": title ? t("Back to {title}", { title }) : t("back"), render: React__default.createElement(Button, { ariaLabel: title ? t("Back to {title}", { title }) : t("back"), icon: "arrowLeft", type: "tertiary", variation: "subtle" }) }),
|
|
675
|
+
title ? (React__default.createElement("div", { className: styles$1.submenuTitle },
|
|
676
|
+
React__default.createElement(Typography, { element: "span", size: "base", fontWeight: "semiBold", textColor: "text" }, title))) : null),
|
|
677
|
+
React__default.createElement(BottomSheetMenuSurface, { menuRef: menuRef, className: classnames(styles.bottomSheetSubmenuBody, styles.composableSection, resolvedBaseProps.className) }, children))));
|
|
678
|
+
}
|
|
679
|
+
function BottomSheetGroupLabel(props) {
|
|
680
|
+
const { className, style } = resolveComposableBaseProps(props);
|
|
681
|
+
const { labelId, registerLabel } = useBottomSheetGroupContext();
|
|
682
|
+
React__default.useEffect(() => {
|
|
683
|
+
registerLabel(true);
|
|
684
|
+
return () => {
|
|
685
|
+
registerLabel(false);
|
|
686
|
+
};
|
|
687
|
+
}, [registerLabel]);
|
|
688
|
+
return (React__default.createElement("div", { id: labelId, role: "presentation", className: classnames(sharedMenuGroupLabelClassName, className), style: style },
|
|
689
|
+
React__default.createElement(SharedMenuGroupLabelContent, Object.assign({}, props))));
|
|
690
|
+
}
|
|
691
|
+
const MenuBottomSheet = Object.assign(BottomSheetRoot, {
|
|
692
|
+
Trigger: BottomSheetTrigger,
|
|
693
|
+
Content: BottomSheetContent,
|
|
694
|
+
Separator: BottomSheetSeparator,
|
|
695
|
+
RadioGroup: BottomSheetRadioGroup,
|
|
696
|
+
RadioItem: BottomSheetRadioItem,
|
|
697
|
+
Submenu: BottomSheetSubmenu,
|
|
698
|
+
SubmenuTrigger: BottomSheetSubmenuTrigger,
|
|
699
|
+
SubmenuContent: BottomSheetSubmenuContent,
|
|
700
|
+
Group: BottomSheetGroup,
|
|
701
|
+
Item: BottomSheetItem,
|
|
702
|
+
ItemIcon: SharedMenuItemIcon,
|
|
703
|
+
ItemLabel: SharedMenuItemLabel,
|
|
704
|
+
ItemPrefix: SharedMenuItemPrefix,
|
|
705
|
+
ItemSuffix: SharedMenuItemSuffix,
|
|
706
|
+
GroupLabel: BottomSheetGroupLabel,
|
|
707
|
+
});
|
|
708
|
+
|
|
709
|
+
// Desktop/dropdown implementation for Menu. This maps the Rulnar
|
|
710
|
+
// sugar API onto Base UI Menu primitives while sharing the visual slot layer
|
|
711
|
+
// with the mobile BottomSheet implementation.
|
|
712
|
+
const MenuDropdownContext = React__default.createContext(null);
|
|
713
|
+
function useMenuDropdownContext() {
|
|
714
|
+
const context = React__default.useContext(MenuDropdownContext);
|
|
715
|
+
if (!context) {
|
|
716
|
+
throw new Error("MenuDropdownContext used outside provider");
|
|
717
|
+
}
|
|
718
|
+
return context;
|
|
719
|
+
}
|
|
720
|
+
function getFloatingLayerStyle(style) {
|
|
721
|
+
if ((style === null || style === void 0 ? void 0 : style.zIndex) == null)
|
|
722
|
+
return undefined;
|
|
723
|
+
return { zIndex: style.zIndex };
|
|
724
|
+
}
|
|
725
|
+
function getMenuPopupStyle(style) {
|
|
726
|
+
return Object.assign({ maxHeight: `min(${MENU_MAX_HEIGHT_PERCENTAGE}vh, max(0px, calc(var(--available-height) - var(--space-base))))` }, style);
|
|
727
|
+
}
|
|
728
|
+
function MenuDropdownRoot({ children, onOpenChange, open, defaultOpen, }) {
|
|
729
|
+
const actionsRef = React__default.useRef(null);
|
|
730
|
+
return (React__default.createElement(MenuDropdownContext.Provider, { value: {
|
|
731
|
+
close: () => {
|
|
732
|
+
var _a;
|
|
733
|
+
(_a = actionsRef.current) === null || _a === void 0 ? void 0 : _a.close();
|
|
734
|
+
},
|
|
735
|
+
} },
|
|
736
|
+
React__default.createElement(MenuRoot, { actionsRef: actionsRef, open: open, defaultOpen: defaultOpen, onOpenChange: isOpen => {
|
|
737
|
+
onOpenChange === null || onOpenChange === void 0 ? void 0 : onOpenChange(isOpen);
|
|
738
|
+
} }, children)));
|
|
739
|
+
}
|
|
740
|
+
const MenuDropdownTrigger = React__default.forwardRef(function MenuDropdownTrigger({ ariaLabel, children, style, className, render, UNSAFE_style, UNSAFE_className, }, ref) {
|
|
741
|
+
const resolvedBaseProps = resolveComposableBaseProps({
|
|
742
|
+
className,
|
|
743
|
+
style,
|
|
744
|
+
UNSAFE_className,
|
|
745
|
+
UNSAFE_style,
|
|
746
|
+
});
|
|
747
|
+
// ComposableMenu.Trigger is Rulnar sugar over Base UI's trigger render API,
|
|
748
|
+
// letting us provide a default Rulnar trigger while still allowing custom renders.
|
|
749
|
+
return (React__default.createElement(MenuTrigger$1, { "aria-label": ariaLabel, className: classnames(styles.triggerWrapper, resolvedBaseProps.className), style: resolvedBaseProps.style, render: resolveMenuTriggerRender({ children, render }), ref: ref }));
|
|
750
|
+
});
|
|
751
|
+
function MenuDropdownContent({ children, portalContainer, style, className, preferredPlacement, UNSAFE_style, UNSAFE_className, }) {
|
|
752
|
+
var _a;
|
|
753
|
+
const resolvedBaseProps = resolveComposableBaseProps({
|
|
754
|
+
className,
|
|
755
|
+
style,
|
|
756
|
+
UNSAFE_className,
|
|
757
|
+
UNSAFE_style,
|
|
758
|
+
});
|
|
759
|
+
// Safe assertion: MenuPlacement is a bare side or a "side align" pair.
|
|
760
|
+
const [side = "bottom", align = "start"] = ((_a = preferredPlacement === null || preferredPlacement === void 0 ? void 0 : preferredPlacement.split(" ")) !== null && _a !== void 0 ? _a : []);
|
|
761
|
+
const floatingLayerStyle = getFloatingLayerStyle(resolvedBaseProps.style);
|
|
762
|
+
const popupStyle = getMenuPopupStyle(resolvedBaseProps.style);
|
|
763
|
+
return (React__default.createElement(ScopedPortal1, { container: portalContainer },
|
|
764
|
+
React__default.createElement(MenuBackdrop, { className: styles.composableBackdrop }),
|
|
765
|
+
React__default.createElement(MenuPositioner, { className: styles.floatingContainer, style: floatingLayerStyle, align: align, side: side, sideOffset: MENU_OFFSET },
|
|
766
|
+
React__default.createElement(MenuPopup, { "data-elevation": "elevated", className: classnames(styles.menu, styles.composableDropdownPopup, resolvedBaseProps.className), style: popupStyle },
|
|
767
|
+
React__default.createElement("div", { className: classnames(styles.composableMenu, styles.composableDropdownScroller) }, children)))));
|
|
768
|
+
}
|
|
769
|
+
function MenuDropdownRadioGroup({ children, value, defaultValue, onValueChange, className, style, UNSAFE_style, UNSAFE_className, }) {
|
|
770
|
+
const resolvedBaseProps = resolveComposableBaseProps({
|
|
771
|
+
className,
|
|
772
|
+
style,
|
|
773
|
+
UNSAFE_className,
|
|
774
|
+
UNSAFE_style,
|
|
775
|
+
});
|
|
776
|
+
return (React__default.createElement(MenuRadioGroup$1, { value: value, defaultValue: defaultValue, onValueChange: nextValue => {
|
|
777
|
+
onValueChange === null || onValueChange === void 0 ? void 0 : onValueChange(String(nextValue));
|
|
778
|
+
}, className: classnames(styles.composableRadioGroup, resolvedBaseProps.className), style: resolvedBaseProps.style }, children));
|
|
779
|
+
}
|
|
780
|
+
function MenuDropdownSeparator({ style, className, UNSAFE_style, UNSAFE_className, }) {
|
|
781
|
+
const resolvedBaseProps = resolveComposableBaseProps({
|
|
782
|
+
className,
|
|
783
|
+
style,
|
|
784
|
+
UNSAFE_className,
|
|
785
|
+
UNSAFE_style,
|
|
786
|
+
});
|
|
787
|
+
return (React__default.createElement(OverlaySeparator, { className: classnames(styles.separator, resolvedBaseProps.className), style: resolvedBaseProps.style, "data-testid": "ATL-Menu-Separator" }));
|
|
788
|
+
}
|
|
789
|
+
function MenuDropdownGroup(props) {
|
|
790
|
+
const { className, style } = resolveComposableBaseProps(props);
|
|
791
|
+
return (React__default.createElement(MenuGroup$1, { "aria-label": props.ariaLabel, className: classnames(styles.composableGroup, className), style: style }, props.children));
|
|
792
|
+
}
|
|
793
|
+
const MenuDropdownItem = React__default.forwardRef(function MenuDropdownItem(props, ref) {
|
|
794
|
+
const { close } = useMenuDropdownContext();
|
|
795
|
+
const { className: itemClassName, style } = resolveComposableBaseProps(props);
|
|
796
|
+
const { textValue } = props;
|
|
797
|
+
const hasLeadingContent = hasMenuSlot(props.children, "icon") ||
|
|
798
|
+
hasMenuSlot(props.children, "prefix");
|
|
799
|
+
const className = classnames(styles.action, styles.composableItem, {
|
|
800
|
+
[styles.composableItemNoLeadingSlot]: !hasLeadingContent,
|
|
801
|
+
[styles.destructive]: props.variation === "destructive",
|
|
802
|
+
}, itemClassName);
|
|
803
|
+
if (props.href) {
|
|
804
|
+
const { href, target, rel, onClick, closeOnClick = true } = props;
|
|
805
|
+
return (React__default.createElement(MenuLinkItem, { ref: ref, className: className, style: style, label: textValue, href: href, target: target, rel: rel, closeOnClick: closeOnClick, onClick: onClick },
|
|
806
|
+
React__default.createElement(MenuItemProvider, { variation: props.variation }, props.children)));
|
|
807
|
+
}
|
|
808
|
+
return (React__default.createElement(MenuItem$1, { ref: ref, className: className, style: style, label: textValue, closeOnClick: props.closeOnClick, nativeButton: true, render: React__default.createElement("button", { type: "button" }), onClick: () => {
|
|
809
|
+
var _a;
|
|
810
|
+
(_a = props.onClick) === null || _a === void 0 ? void 0 : _a.call(props);
|
|
811
|
+
}, onKeyUp: event => {
|
|
812
|
+
// Preserve the Space fallback for commands that dismiss the menu.
|
|
813
|
+
if (event.key === " " && props.closeOnClick !== false) {
|
|
814
|
+
close();
|
|
815
|
+
}
|
|
816
|
+
} },
|
|
817
|
+
React__default.createElement(MenuItemProvider, { variation: props.variation }, props.children)));
|
|
818
|
+
});
|
|
819
|
+
const MenuDropdownRadioItem = React__default.forwardRef(function MenuDropdownRadioItem(props, ref) {
|
|
820
|
+
const { className, style } = resolveComposableBaseProps(props);
|
|
821
|
+
const hasCustomSuffix = hasMenuSlot(props.children, "suffix");
|
|
822
|
+
const hasLeadingContent = hasMenuSlot(props.children, "icon") ||
|
|
823
|
+
hasMenuSlot(props.children, "prefix");
|
|
824
|
+
return (React__default.createElement(MenuRadioItem$1, { ref: ref, className: classnames(styles.action, styles.composableItem, {
|
|
825
|
+
[styles.composableItemNoLeadingSlot]: !hasLeadingContent,
|
|
826
|
+
}, className), style: style, value: props.value, label: props.textValue, closeOnClick: props.closeOnClick, nativeButton: true, render: React__default.createElement("button", { type: "button" }) },
|
|
827
|
+
React__default.createElement(MenuItemProvider, null,
|
|
828
|
+
props.children,
|
|
829
|
+
!hasCustomSuffix ? (React__default.createElement(MenuRadioItemIndicator, { "data-menu-slot": "suffix", keepMounted: true },
|
|
830
|
+
React__default.createElement(Icon, { color: "icon", name: "checkmark" }))) : null)));
|
|
831
|
+
});
|
|
832
|
+
function MenuDropdownSubmenu({ children, open, defaultOpen, onOpenChange, }) {
|
|
833
|
+
return (React__default.createElement(MenuSubmenuRoot, { open: open, defaultOpen: defaultOpen, onOpenChange: isOpen => {
|
|
834
|
+
onOpenChange === null || onOpenChange === void 0 ? void 0 : onOpenChange(isOpen);
|
|
835
|
+
} }, children));
|
|
836
|
+
}
|
|
837
|
+
const MenuDropdownSubmenuTrigger = React__default.forwardRef(function MenuDropdownSubmenuTrigger(props, ref) {
|
|
838
|
+
const resolvedBaseProps = resolveComposableBaseProps(props);
|
|
839
|
+
const hasCustomSuffix = hasMenuSlot(props.children, "suffix");
|
|
840
|
+
const hasLeadingContent = hasMenuSlot(props.children, "icon") ||
|
|
841
|
+
hasMenuSlot(props.children, "prefix");
|
|
842
|
+
return (React__default.createElement(MenuSubmenuTrigger$1, { ref: ref, className: classnames(styles.action, styles.composableItem, {
|
|
843
|
+
[styles.composableItemNoLeadingSlot]: !hasLeadingContent,
|
|
844
|
+
}, resolvedBaseProps.className), style: resolvedBaseProps.style, label: props.textValue, nativeButton: true, render: React__default.createElement("button", { type: "button" }) },
|
|
845
|
+
props.children,
|
|
846
|
+
!hasCustomSuffix ? (React__default.createElement("div", { "data-menu-slot": "suffix" },
|
|
847
|
+
React__default.createElement(Icon, { color: "icon", name: "arrowRight" }))) : null));
|
|
848
|
+
});
|
|
849
|
+
function MenuDropdownSubmenuContent({ children, className, style, UNSAFE_style, UNSAFE_className, }) {
|
|
850
|
+
const resolvedBaseProps = resolveComposableBaseProps({
|
|
851
|
+
className,
|
|
852
|
+
style,
|
|
853
|
+
UNSAFE_className,
|
|
854
|
+
UNSAFE_style,
|
|
855
|
+
});
|
|
856
|
+
const floatingLayerStyle = getFloatingLayerStyle(resolvedBaseProps.style);
|
|
857
|
+
const popupStyle = getMenuPopupStyle(resolvedBaseProps.style);
|
|
858
|
+
return (React__default.createElement(ScopedPortal1, null,
|
|
859
|
+
React__default.createElement(MenuPositioner, { className: styles.floatingContainer, style: floatingLayerStyle, align: "start", side: "right", sideOffset: MENU_OFFSET },
|
|
860
|
+
React__default.createElement(MenuPopup, { "data-elevation": "elevated", className: classnames(styles.menu, styles.composableDropdownPopup, resolvedBaseProps.className), style: popupStyle },
|
|
861
|
+
React__default.createElement("div", { className: classnames(styles.composableMenu, styles.composableDropdownScroller) }, children)))));
|
|
862
|
+
}
|
|
863
|
+
function MenuDropdownGroupLabel(props) {
|
|
864
|
+
const { className, style } = resolveComposableBaseProps(props);
|
|
865
|
+
return (React__default.createElement(MenuGroupLabel$1, { className: classnames(sharedMenuGroupLabelClassName, className), style: style },
|
|
866
|
+
React__default.createElement(SharedMenuGroupLabelContent, Object.assign({}, props))));
|
|
867
|
+
}
|
|
868
|
+
const MenuDropdown = Object.assign(MenuDropdownRoot, {
|
|
869
|
+
Trigger: MenuDropdownTrigger,
|
|
870
|
+
Content: MenuDropdownContent,
|
|
871
|
+
Separator: MenuDropdownSeparator,
|
|
872
|
+
RadioGroup: MenuDropdownRadioGroup,
|
|
873
|
+
RadioItem: MenuDropdownRadioItem,
|
|
874
|
+
Submenu: MenuDropdownSubmenu,
|
|
875
|
+
SubmenuTrigger: MenuDropdownSubmenuTrigger,
|
|
876
|
+
SubmenuContent: MenuDropdownSubmenuContent,
|
|
877
|
+
Group: MenuDropdownGroup,
|
|
878
|
+
Item: MenuDropdownItem,
|
|
879
|
+
ItemIcon: SharedMenuItemIcon,
|
|
880
|
+
ItemLabel: SharedMenuItemLabel,
|
|
881
|
+
ItemPrefix: SharedMenuItemPrefix,
|
|
882
|
+
ItemSuffix: SharedMenuItemSuffix,
|
|
883
|
+
GroupLabel: MenuDropdownGroupLabel,
|
|
884
|
+
});
|
|
885
|
+
|
|
886
|
+
function isLegacy(props) {
|
|
887
|
+
return "items" in props;
|
|
888
|
+
}
|
|
889
|
+
const MenuContext = React__default.createContext(null);
|
|
890
|
+
function useMenuContext() {
|
|
891
|
+
const context = React__default.useContext(MenuContext);
|
|
892
|
+
if (!context) {
|
|
893
|
+
throw new Error("Menu components must be rendered inside Menu");
|
|
894
|
+
}
|
|
895
|
+
return context;
|
|
896
|
+
}
|
|
897
|
+
function useMenuShell() {
|
|
898
|
+
const { isMobile } = useMenuContext();
|
|
899
|
+
return isMobile ? MenuBottomSheet : MenuDropdown;
|
|
900
|
+
}
|
|
901
|
+
function MenuComposableRoot(props) {
|
|
902
|
+
const isMobile = useIsSmallScreen();
|
|
903
|
+
const RootComponent = isMobile ? MenuBottomSheet : MenuDropdown;
|
|
904
|
+
return (React__default.createElement(MenuContext.Provider, { value: { isMobile } },
|
|
905
|
+
React__default.createElement(RootComponent, { onOpenChange: props.onOpenChange, open: props.open, defaultOpen: props.defaultOpen }, props.children)));
|
|
906
|
+
}
|
|
907
|
+
function Menu(props) {
|
|
908
|
+
if (isLegacy(props)) {
|
|
909
|
+
return React__default.createElement(MenuLegacy, Object.assign({}, props));
|
|
910
|
+
}
|
|
911
|
+
return React__default.createElement(MenuComposableRoot, Object.assign({}, props));
|
|
912
|
+
}
|
|
913
|
+
const MenuTrigger = React__default.forwardRef(function MenuTrigger(props, ref) {
|
|
914
|
+
const Shell = useMenuShell();
|
|
915
|
+
return React__default.createElement(Shell.Trigger, Object.assign({}, props, { ref: ref }));
|
|
916
|
+
});
|
|
917
|
+
function MenuContent(props) {
|
|
918
|
+
const Shell = useMenuShell();
|
|
919
|
+
return React__default.createElement(Shell.Content, Object.assign({}, props));
|
|
920
|
+
}
|
|
921
|
+
function MenuSeparator(props) {
|
|
922
|
+
const Shell = useMenuShell();
|
|
923
|
+
return React__default.createElement(Shell.Separator, Object.assign({}, props));
|
|
924
|
+
}
|
|
925
|
+
function MenuRadioGroup(props) {
|
|
926
|
+
const Shell = useMenuShell();
|
|
927
|
+
return React__default.createElement(Shell.RadioGroup, Object.assign({}, props));
|
|
928
|
+
}
|
|
929
|
+
const MenuRadioItem = React__default.forwardRef(function MenuRadioItem(props, ref) {
|
|
930
|
+
const Shell = useMenuShell();
|
|
931
|
+
return React__default.createElement(Shell.RadioItem, Object.assign({}, props, { ref: ref }));
|
|
932
|
+
});
|
|
933
|
+
function MenuSubmenu(props) {
|
|
934
|
+
const Shell = useMenuShell();
|
|
935
|
+
return React__default.createElement(Shell.Submenu, Object.assign({}, props));
|
|
936
|
+
}
|
|
937
|
+
const MenuSubmenuTrigger = React__default.forwardRef(function MenuSubmenuTrigger(props, ref) {
|
|
938
|
+
const Shell = useMenuShell();
|
|
939
|
+
return React__default.createElement(Shell.SubmenuTrigger, Object.assign({}, props, { ref: ref }));
|
|
940
|
+
});
|
|
941
|
+
function MenuSubmenuContent(props) {
|
|
942
|
+
const Shell = useMenuShell();
|
|
943
|
+
return React__default.createElement(Shell.SubmenuContent, Object.assign({}, props));
|
|
944
|
+
}
|
|
945
|
+
function MenuGroup(props) {
|
|
946
|
+
const Shell = useMenuShell();
|
|
947
|
+
return React__default.createElement(Shell.Group, Object.assign({}, props));
|
|
948
|
+
}
|
|
949
|
+
/**
|
|
950
|
+
* @deprecated Use Menu.Group instead.
|
|
951
|
+
* This wrapper keeps the old composable authoring shape working while the
|
|
952
|
+
* underlying menu structure uses grouped semantics.
|
|
953
|
+
*/
|
|
954
|
+
function MenuSection(props) {
|
|
955
|
+
return React__default.createElement(MenuGroup, Object.assign({}, props));
|
|
956
|
+
}
|
|
957
|
+
const MenuItem = React__default.forwardRef(function MenuItem(props, ref) {
|
|
958
|
+
const Shell = useMenuShell();
|
|
959
|
+
return React__default.createElement(Shell.Item, Object.assign({}, props, { ref: ref }));
|
|
960
|
+
});
|
|
961
|
+
function MenuItemIcon(props) {
|
|
962
|
+
const Shell = useMenuShell();
|
|
963
|
+
return React__default.createElement(Shell.ItemIcon, Object.assign({}, props));
|
|
964
|
+
}
|
|
965
|
+
function MenuItemLabel(props) {
|
|
966
|
+
const Shell = useMenuShell();
|
|
967
|
+
return React__default.createElement(Shell.ItemLabel, Object.assign({}, props));
|
|
968
|
+
}
|
|
969
|
+
function MenuItemPrefix(props) {
|
|
970
|
+
const Shell = useMenuShell();
|
|
971
|
+
return React__default.createElement(Shell.ItemPrefix, Object.assign({}, props));
|
|
972
|
+
}
|
|
973
|
+
function MenuItemSuffix(props) {
|
|
974
|
+
const Shell = useMenuShell();
|
|
975
|
+
return React__default.createElement(Shell.ItemSuffix, Object.assign({}, props));
|
|
976
|
+
}
|
|
977
|
+
MenuItemPrefix.menuSlot =
|
|
978
|
+
"prefix";
|
|
979
|
+
MenuItemSuffix.menuSlot =
|
|
980
|
+
"suffix";
|
|
981
|
+
MenuItemIcon.menuSlot = "icon";
|
|
982
|
+
function MenuGroupLabel(props) {
|
|
983
|
+
const Shell = useMenuShell();
|
|
984
|
+
return React__default.createElement(Shell.GroupLabel, Object.assign({}, props));
|
|
985
|
+
}
|
|
986
|
+
/**
|
|
987
|
+
* @deprecated Use Menu.GroupLabel instead.
|
|
988
|
+
* Header remains as a thin wrapper so older JSX can keep compiling without
|
|
989
|
+
* recreating the old internal DOM structure.
|
|
990
|
+
*/
|
|
991
|
+
function MenuHeader(props) {
|
|
992
|
+
return React__default.createElement(MenuGroupLabel, Object.assign({}, props));
|
|
993
|
+
}
|
|
994
|
+
/**
|
|
995
|
+
* @deprecated Use Menu.GroupLabel content directly instead.
|
|
996
|
+
* HeaderLabel is intentionally a pass-through so the old nested pattern:
|
|
997
|
+
* Menu.Header > Menu.HeaderLabel continues to compose onto the new GroupLabel.
|
|
998
|
+
*/
|
|
999
|
+
function MenuHeaderLabel(props) {
|
|
1000
|
+
return React__default.createElement(React__default.Fragment, null, props.children);
|
|
1001
|
+
}
|
|
1002
|
+
// Menu now routes the legacy items-based API locally and owns the new
|
|
1003
|
+
// Base UI-backed composable implementation directly.
|
|
1004
|
+
Menu.Group = MenuGroup;
|
|
1005
|
+
Menu.GroupLabel = MenuGroupLabel;
|
|
1006
|
+
Menu.Section = MenuSection;
|
|
1007
|
+
Menu.Header = MenuHeader;
|
|
1008
|
+
Menu.HeaderLabel = MenuHeaderLabel;
|
|
1009
|
+
Menu.Item = MenuItem;
|
|
1010
|
+
Menu.Trigger = MenuTrigger;
|
|
1011
|
+
Menu.Content = MenuContent;
|
|
1012
|
+
Menu.Separator = MenuSeparator;
|
|
1013
|
+
Menu.RadioGroup = MenuRadioGroup;
|
|
1014
|
+
Menu.RadioItem = MenuRadioItem;
|
|
1015
|
+
Menu.Submenu = MenuSubmenu;
|
|
1016
|
+
Menu.SubmenuTrigger = MenuSubmenuTrigger;
|
|
1017
|
+
Menu.SubmenuContent = MenuSubmenuContent;
|
|
1018
|
+
Menu.ItemIcon = MenuItemIcon;
|
|
1019
|
+
Menu.ItemLabel = MenuItemLabel;
|
|
1020
|
+
Menu.ItemPrefix = MenuItemPrefix;
|
|
1021
|
+
Menu.ItemSuffix = MenuItemSuffix;
|
|
1022
|
+
|
|
1023
|
+
export { Menu as M, menuMessages as m };
|
|
1024
|
+
|
|
1025
|
+
function ScopedPortal({children}) {
|
|
1026
|
+
return React__default.createElement(FloatingPortal, null,
|
|
1027
|
+
React__default.createElement(ThemeBoundary, null, children));
|
|
1028
|
+
}
|
|
1029
|
+
|
|
1030
|
+
function ScopedPortal1({children, container}) {
|
|
1031
|
+
return React__default.createElement(MenuPortal$1, { container },
|
|
1032
|
+
React__default.createElement(ThemeBoundary, null, children));
|
|
1033
|
+
}
|