@mezzanine-ui/react 1.0.0-canary.9 → 1.0.0-rc.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/Accordion/Accordion.d.ts +23 -1
- package/Accordion/Accordion.js +59 -11
- package/Accordion/AccordionActions.d.ts +13 -0
- package/Accordion/AccordionActions.js +24 -0
- package/Accordion/AccordionContent.d.ts +9 -0
- package/Accordion/{AccordionDetails.js → AccordionContent.js} +4 -6
- package/Accordion/AccordionControlContext.d.ts +2 -2
- package/Accordion/AccordionGroup.d.ts +10 -0
- package/Accordion/AccordionGroup.js +26 -0
- package/Accordion/AccordionTitle.d.ts +14 -0
- package/Accordion/AccordionTitle.js +56 -0
- package/Accordion/index.d.ts +8 -4
- package/Accordion/index.js +4 -2
- package/Anchor/Anchor.d.ts +51 -18
- package/Anchor/Anchor.js +15 -15
- package/Anchor/AnchorGroup.d.ts +34 -0
- package/Anchor/AnchorGroup.js +37 -0
- package/Anchor/AnchorItem.d.ts +30 -0
- package/Anchor/AnchorItem.js +65 -0
- package/Anchor/index.d.ts +2 -0
- package/Anchor/index.js +1 -0
- package/Anchor/utils.d.ts +13 -0
- package/Anchor/utils.js +95 -0
- package/AutoComplete/AutoComplete.d.ts +236 -0
- package/AutoComplete/AutoComplete.js +579 -0
- package/AutoComplete/index.d.ts +2 -0
- package/AutoComplete/index.js +1 -0
- package/AutoComplete/useAutoCompleteCreation.d.ts +33 -0
- package/AutoComplete/useAutoCompleteCreation.js +201 -0
- package/AutoComplete/useAutoCompleteKeyboard.d.ts +31 -0
- package/AutoComplete/useAutoCompleteKeyboard.js +149 -0
- package/AutoComplete/useAutoCompleteSearch.d.ts +16 -0
- package/AutoComplete/useAutoCompleteSearch.js +69 -0
- package/AutoComplete/useCreationTracker.d.ts +17 -0
- package/AutoComplete/useCreationTracker.js +47 -0
- package/Backdrop/Backdrop.js +15 -19
- package/Badge/Badge.d.ts +6 -0
- package/Badge/Badge.js +2 -2
- package/Badge/typings.d.ts +9 -2
- package/Breadcrumb/Breadcrumb.js +16 -21
- package/Breadcrumb/BreadcrumbDropdown.d.ts +11 -0
- package/Breadcrumb/BreadcrumbDropdown.js +22 -0
- package/Breadcrumb/BreadcrumbItem.d.ts +2 -3
- package/Breadcrumb/BreadcrumbItem.js +13 -31
- package/Breadcrumb/BreadcrumbOverflowMenu.d.ts +7 -0
- package/Breadcrumb/BreadcrumbOverflowMenu.js +77 -0
- package/Breadcrumb/BreadcrumbOverflowMenuDropdown.d.ts +11 -0
- package/Breadcrumb/BreadcrumbOverflowMenuDropdown.js +21 -0
- package/Breadcrumb/BreadcrumbOverflowMenuItem.d.ts +3 -0
- package/Breadcrumb/BreadcrumbOverflowMenuItem.js +27 -0
- package/Breadcrumb/typings.d.ts +21 -39
- package/Button/Button.js +13 -11
- package/Button/index.d.ts +1 -1
- package/Button/typings.d.ts +27 -4
- package/Calendar/Calendar.js +2 -6
- package/Calendar/CalendarCell.d.ts +22 -0
- package/Calendar/CalendarCell.js +6 -2
- package/Calendar/CalendarControls.js +1 -1
- package/Calendar/CalendarDayOfWeek.js +3 -2
- package/Calendar/CalendarDays.js +6 -2
- package/Calendar/CalendarHalfYears.js +13 -7
- package/Calendar/CalendarMonths.js +13 -6
- package/Calendar/CalendarQuarters.js +13 -7
- package/Calendar/CalendarWeeks.js +87 -34
- package/Calendar/CalendarYears.js +13 -12
- package/Calendar/useCalendarControlModifiers.d.ts +1 -1
- package/Calendar/useCalendarControlModifiers.js +12 -12
- package/Calendar/useCalendarControls.d.ts +4 -4
- package/Calendar/useCalendarControls.js +33 -19
- package/Calendar/useRangeCalendarControls.d.ts +8 -8
- package/Calendar/useRangeCalendarControls.js +42 -31
- package/Card/BaseCard.d.ts +11 -0
- package/Card/BaseCard.js +48 -0
- package/Card/BaseCardSkeleton.d.ts +14 -0
- package/Card/BaseCardSkeleton.js +18 -0
- package/Card/CardGroup.d.ts +47 -0
- package/Card/CardGroup.js +147 -0
- package/Card/FourThumbnailCard.d.ts +14 -0
- package/Card/FourThumbnailCard.js +73 -0
- package/Card/FourThumbnailCardSkeleton.d.ts +14 -0
- package/Card/FourThumbnailCardSkeleton.js +20 -0
- package/Card/QuickActionCard.d.ts +12 -0
- package/Card/QuickActionCard.js +23 -0
- package/Card/QuickActionCardSkeleton.d.ts +14 -0
- package/Card/QuickActionCardSkeleton.js +18 -0
- package/Card/SingleThumbnailCard.d.ts +13 -0
- package/Card/SingleThumbnailCard.js +44 -0
- package/Card/SingleThumbnailCardSkeleton.d.ts +19 -0
- package/Card/SingleThumbnailCardSkeleton.js +18 -0
- package/Card/Thumbnail.d.ts +12 -0
- package/Card/Thumbnail.js +18 -0
- package/Card/ThumbnailCardInfo.d.ts +34 -0
- package/Card/ThumbnailCardInfo.js +43 -0
- package/Card/index.d.ts +43 -4
- package/Card/index.js +19 -2
- package/Card/typings.d.ts +442 -0
- package/Checkbox/Checkbox.d.ts +8 -0
- package/Checkbox/Checkbox.js +3 -2
- package/Checkbox/CheckboxGroup.js +1 -1
- package/Checkbox/index.d.ts +4 -5
- package/Checkbox/index.js +1 -5
- package/ContentHeader/ContentHeader.d.ts +112 -0
- package/ContentHeader/ContentHeader.js +54 -0
- package/ContentHeader/ContentHeaderResponsive.d.ts +9 -0
- package/ContentHeader/ContentHeaderResponsive.js +7 -0
- package/ContentHeader/index.d.ts +2 -0
- package/ContentHeader/index.js +1 -0
- package/ContentHeader/utils.d.ts +23 -0
- package/ContentHeader/utils.js +261 -0
- package/Cropper/Cropper.d.ts +66 -0
- package/Cropper/Cropper.js +115 -0
- package/Cropper/CropperElement.d.ts +10 -0
- package/Cropper/CropperElement.js +892 -0
- package/Cropper/index.d.ts +18 -0
- package/Cropper/index.js +8 -0
- package/Cropper/tools.d.ts +90 -0
- package/Cropper/tools.js +143 -0
- package/Cropper/typings.d.ts +69 -0
- package/Cropper/utils/cropper-calculations.d.ts +39 -0
- package/Cropper/utils/cropper-calculations.js +95 -0
- package/DateRangePicker/useDateRangeCalendarControls.js +8 -2
- package/DateTimePicker/DateTimePicker.d.ts +1 -1
- package/DateTimePicker/DateTimePicker.js +22 -5
- package/DateTimeRangePicker/DateTimeRangePicker.d.ts +34 -0
- package/DateTimeRangePicker/DateTimeRangePicker.js +118 -0
- package/DateTimeRangePicker/index.d.ts +2 -0
- package/DateTimeRangePicker/index.js +1 -0
- package/Description/Description.d.ts +30 -0
- package/Description/Description.js +13 -0
- package/Description/DescriptionContent.d.ts +41 -0
- package/Description/DescriptionContent.js +14 -0
- package/Description/DescriptionGroup.d.ts +13 -0
- package/Description/DescriptionGroup.js +12 -0
- package/Description/DescriptionTitle.d.ts +45 -0
- package/Description/DescriptionTitle.js +17 -0
- package/Description/index.d.ts +8 -0
- package/Description/index.js +4 -0
- package/Drawer/Drawer.d.ts +143 -1
- package/Drawer/Drawer.js +56 -4
- package/Dropdown/Dropdown.d.ts +215 -15
- package/Dropdown/Dropdown.js +365 -32
- package/Dropdown/DropdownAction.d.ts +50 -0
- package/Dropdown/DropdownAction.js +23 -0
- package/Dropdown/DropdownItem.d.ts +131 -0
- package/Dropdown/DropdownItem.js +485 -0
- package/Dropdown/DropdownItemCard.d.ts +107 -0
- package/Dropdown/DropdownItemCard.js +125 -0
- package/Dropdown/DropdownStatus.d.ts +22 -0
- package/Dropdown/DropdownStatus.js +29 -0
- package/Dropdown/dropdownKeydownHandler.d.ts +16 -0
- package/Dropdown/dropdownKeydownHandler.js +73 -0
- package/Dropdown/highlightText.d.ts +9 -0
- package/Dropdown/highlightText.js +36 -0
- package/Dropdown/index.d.ts +1 -1
- package/Dropdown/shortcutTextHandler.d.ts +24 -0
- package/Dropdown/shortcutTextHandler.js +171 -0
- package/Empty/Empty.js +2 -1
- package/Empty/icons/EmptyMainNotificationIcon.d.ts +4 -0
- package/Empty/icons/EmptyMainNotificationIcon.js +9 -0
- package/Empty/typings.d.ts +2 -2
- package/FilterArea/Filter.d.ts +32 -0
- package/FilterArea/Filter.js +23 -0
- package/FilterArea/FilterArea.d.ts +58 -0
- package/FilterArea/FilterArea.js +31 -0
- package/FilterArea/FilterLine.d.ts +11 -0
- package/FilterArea/FilterLine.js +13 -0
- package/FilterArea/index.d.ts +6 -0
- package/FilterArea/index.js +3 -0
- package/FloatingButton/FloatingButton.d.ts +21 -0
- package/FloatingButton/FloatingButton.js +18 -0
- package/FloatingButton/index.d.ts +2 -0
- package/FloatingButton/index.js +1 -0
- package/Form/FormControlContext.d.ts +2 -2
- package/Form/FormField.d.ts +79 -4
- package/Form/FormField.js +18 -6
- package/Form/FormGroup.d.ts +16 -0
- package/Form/FormGroup.js +15 -0
- package/Form/FormHintText.d.ts +24 -1
- package/Form/FormHintText.js +4 -4
- package/Form/FormLabel.d.ts +6 -3
- package/Form/FormLabel.js +5 -3
- package/Form/index.d.ts +2 -0
- package/Form/index.js +1 -0
- package/Form/useSelectValueControl.d.ts +3 -4
- package/Form/useSelectValueControl.js +51 -39
- package/Input/Input.d.ts +35 -7
- package/Input/Input.js +49 -16
- package/Input/PasswordStrengthIndicator/PasswordStrengthIndicator.js +1 -1
- package/Input/SelectButton/SelectButton.d.ts +25 -4
- package/Input/SelectButton/SelectButton.js +21 -9
- package/Input/index.d.ts +1 -1
- package/Layout/Layout.d.ts +16 -0
- package/Layout/Layout.js +37 -0
- package/Layout/LayoutContext.d.ts +7 -0
- package/Layout/LayoutContext.js +6 -0
- package/Layout/LayoutHost.d.ts +10 -0
- package/Layout/LayoutHost.js +24 -0
- package/Layout/LayoutMain.d.ts +8 -0
- package/Layout/LayoutMain.js +8 -0
- package/Layout/LayoutSidePanel.d.ts +14 -0
- package/Layout/LayoutSidePanel.js +90 -0
- package/Layout/index.d.ts +3 -0
- package/Layout/index.js +3 -0
- package/Message/Message.js +1 -1
- package/Modal/MediaPreviewModal.d.ts +65 -0
- package/Modal/MediaPreviewModal.js +175 -0
- package/Modal/Modal.d.ts +103 -11
- package/Modal/Modal.js +14 -9
- package/Modal/ModalBodyForVerification.d.ts +59 -0
- package/Modal/ModalBodyForVerification.js +99 -0
- package/Modal/ModalControl.d.ts +2 -2
- package/Modal/ModalControl.js +1 -1
- package/Modal/ModalFooter.d.ts +119 -1
- package/Modal/ModalFooter.js +15 -3
- package/Modal/ModalHeader.d.ts +26 -7
- package/Modal/ModalHeader.js +33 -7
- package/Modal/index.d.ts +6 -5
- package/Modal/index.js +2 -2
- package/Modal/useModalContainer.d.ts +12 -3
- package/Modal/useModalContainer.js +32 -6
- package/MultipleDatePicker/MultipleDatePicker.d.ts +62 -0
- package/MultipleDatePicker/MultipleDatePicker.js +176 -0
- package/MultipleDatePicker/MultipleDatePickerTrigger.d.ts +56 -0
- package/MultipleDatePicker/MultipleDatePickerTrigger.js +92 -0
- package/MultipleDatePicker/index.d.ts +6 -0
- package/MultipleDatePicker/index.js +3 -0
- package/MultipleDatePicker/useMultipleDatePickerValue.d.ts +55 -0
- package/MultipleDatePicker/useMultipleDatePickerValue.js +68 -0
- package/Navigation/Navigation.d.ts +22 -14
- package/Navigation/Navigation.js +76 -43
- package/Navigation/NavigationFooter.d.ts +10 -0
- package/Navigation/NavigationFooter.js +28 -0
- package/Navigation/NavigationHeader.d.ts +18 -0
- package/Navigation/NavigationHeader.js +16 -0
- package/Navigation/NavigationIconButton.d.ts +15 -0
- package/Navigation/NavigationIconButton.js +12 -0
- package/Navigation/NavigationOption.d.ts +40 -0
- package/Navigation/NavigationOption.js +89 -0
- package/Navigation/NavigationOptionCategory.d.ts +6 -0
- package/Navigation/NavigationOptionCategory.js +30 -0
- package/Navigation/NavigationOverflowMenu.d.ts +6 -0
- package/Navigation/NavigationOverflowMenu.js +90 -0
- package/Navigation/NavigationOverflowMenuOption.d.ts +7 -0
- package/Navigation/NavigationOverflowMenuOption.js +68 -0
- package/Navigation/NavigationUserMenu.d.ts +10 -0
- package/Navigation/NavigationUserMenu.js +26 -0
- package/Navigation/context.d.ts +16 -0
- package/Navigation/context.js +7 -0
- package/Navigation/index.d.ts +12 -6
- package/Navigation/index.js +6 -3
- package/Navigation/useCurrentPathname.d.ts +1 -0
- package/Navigation/useCurrentPathname.js +14 -0
- package/Navigation/useVisibleItems.d.ts +5 -0
- package/Navigation/useVisibleItems.js +54 -0
- package/NotificationCenter/NotificationCenter.d.ts +124 -0
- package/NotificationCenter/NotificationCenter.js +279 -0
- package/NotificationCenter/NotificationCenterDrawer.d.ts +67 -0
- package/NotificationCenter/NotificationCenterDrawer.js +128 -0
- package/NotificationCenter/index.d.ts +5 -0
- package/NotificationCenter/index.js +2 -0
- package/OverflowTooltip/index.d.ts +2 -2
- package/PageFooter/PageFooter.d.ts +19 -9
- package/PageFooter/PageFooter.js +10 -10
- package/PageHeader/PageHeader.d.ts +32 -25
- package/PageHeader/PageHeader.js +49 -43
- package/Pagination/Pagination.js +1 -1
- package/Pagination/PaginationPageSize.js +12 -2
- package/Picker/FormattedInput.d.ts +1 -1
- package/Picker/FormattedInput.js +2 -1
- package/Picker/PickerTriggerWithSeparator.d.ts +10 -0
- package/Picker/PickerTriggerWithSeparator.js +2 -2
- package/Picker/RangePickerTrigger.js +1 -1
- package/Picker/useDateInputFormatter.d.ts +6 -0
- package/Picker/useDateInputFormatter.js +4 -1
- package/Popper/Popper.js +2 -1
- package/ResultState/ResultState.d.ts +9 -0
- package/ResultState/ResultState.js +36 -4
- package/Scrollbar/Scrollbar.d.ts +9 -0
- package/Scrollbar/Scrollbar.js +79 -0
- package/Scrollbar/index.d.ts +2 -0
- package/Scrollbar/index.js +1 -0
- package/Scrollbar/typings.d.ts +47 -0
- package/Section/Section.d.ts +32 -0
- package/Section/Section.js +62 -0
- package/Section/index.d.ts +2 -0
- package/Select/Select.d.ts +36 -18
- package/Select/Select.js +155 -52
- package/Select/SelectTrigger.js +27 -11
- package/Select/index.d.ts +3 -12
- package/Select/index.js +1 -5
- package/Select/typings.d.ts +6 -5
- package/Select/useSelectTriggerTags.d.ts +1 -1
- package/Select/useSelectTriggerTags.js +9 -6
- package/Selection/Selection.js +1 -1
- package/Selection/SelectionGroup.d.ts +28 -0
- package/Separator/Separator.d.ts +14 -0
- package/Separator/Separator.js +17 -0
- package/Separator/index.d.ts +2 -0
- package/Separator/index.js +1 -0
- package/Table/Table.d.ts +2 -82
- package/Table/Table.js +293 -102
- package/Table/TableContext.d.ts +27 -52
- package/Table/components/TableActionsCell.d.ts +26 -0
- package/Table/components/TableActionsCell.js +86 -0
- package/Table/components/TableBody.d.ts +2 -5
- package/Table/components/TableBody.js +17 -19
- package/Table/components/TableBulkActions.d.ts +15 -0
- package/Table/components/TableBulkActions.js +26 -0
- package/Table/components/TableCell.d.ts +2 -0
- package/Table/components/TableCell.js +42 -10
- package/Table/components/TableColGroup.d.ts +1 -4
- package/Table/components/TableColGroup.js +24 -127
- package/Table/components/TableCollectableCell.d.ts +17 -0
- package/Table/components/TableCollectableCell.js +54 -0
- package/Table/components/TableColumnTitleMenu.d.ts +6 -0
- package/Table/components/TableColumnTitleMenu.js +20 -0
- package/Table/components/TableDragOrPinHandleCell.d.ts +20 -0
- package/Table/components/TableDragOrPinHandleCell.js +58 -0
- package/Table/components/TableExpandCell.d.ts +2 -0
- package/Table/components/TableExpandCell.js +8 -1
- package/Table/components/TableExpandedRow.js +13 -3
- package/Table/components/TableHeader.d.ts +2 -4
- package/Table/components/TableHeader.js +21 -22
- package/Table/components/TableResizeHandle.js +3 -7
- package/Table/components/TableRow.js +86 -27
- package/Table/components/TableSelectionCell.d.ts +5 -0
- package/Table/components/TableSelectionCell.js +13 -2
- package/Table/components/TableToggleableCell.d.ts +16 -0
- package/Table/components/TableToggleableCell.js +51 -0
- package/Table/components/index.d.ts +5 -1
- package/Table/components/index.js +4 -0
- package/Table/hooks/index.d.ts +1 -1
- package/Table/hooks/index.js +1 -1
- package/Table/hooks/typings.d.ts +18 -4
- package/Table/hooks/useTableDataSource.d.ts +2 -2
- package/Table/hooks/useTableExpansion.d.ts +2 -2
- package/Table/hooks/useTableExpansion.js +5 -11
- package/Table/hooks/useTableFixedOffsets.d.ts +7 -3
- package/Table/hooks/useTableFixedOffsets.js +71 -39
- package/Table/hooks/useTableResizedColumns.d.ts +2 -0
- package/Table/hooks/useTableResizedColumns.js +22 -0
- package/Table/hooks/useTableScroll.d.ts +10 -2
- package/Table/hooks/useTableScroll.js +56 -23
- package/Table/hooks/useTableSelection.js +32 -8
- package/Table/hooks/useTableVirtualization.d.ts +3 -2
- package/Table/hooks/useTableVirtualization.js +2 -8
- package/Table/index.d.ts +5 -4
- package/Table/index.js +8 -3
- package/Table/typings.d.ts +172 -0
- package/Table/utils/calculateColumnWidths.d.ts +28 -0
- package/Table/utils/calculateColumnWidths.js +80 -0
- package/Table/utils/index.d.ts +2 -0
- package/Table/utils/index.js +1 -0
- package/Table/utils/useTableRowSelection.d.ts +5 -5
- package/Table/utils/useTableRowSelection.js +20 -6
- package/Tag/TagGroup.d.ts +7 -2
- package/Tag/TagGroup.js +7 -4
- package/Tag/index.d.ts +2 -0
- package/Tag/index.js +1 -0
- package/TextField/TextField.d.ts +6 -1
- package/TextField/TextField.js +64 -10
- package/TimePanel/TimePanelColumn.js +30 -21
- package/TimeRangePicker/TimeRangePicker.d.ts +29 -0
- package/TimeRangePicker/TimeRangePicker.js +96 -0
- package/TimeRangePicker/index.d.ts +3 -0
- package/TimeRangePicker/index.js +2 -0
- package/TimeRangePicker/useTimeRangePickerValue.d.ts +30 -0
- package/TimeRangePicker/useTimeRangePickerValue.js +92 -0
- package/Transition/Rotate.js +2 -5
- package/Transition/Slide.d.ts +9 -2
- package/Transition/Slide.js +7 -4
- package/Transition/index.d.ts +0 -2
- package/Transition/index.js +0 -1
- package/Upload/UploadPictureCard.js +1 -1
- package/hooks/useElementHeight.d.ts +8 -0
- package/hooks/useElementHeight.js +41 -0
- package/index.d.ts +67 -49
- package/index.js +57 -42
- package/package.json +8 -6
- package/utils/format-number-with-commas.d.ts +4 -0
- package/utils/format-number-with-commas.js +27 -0
- package/utils/parse-number-with-commas.d.ts +4 -0
- package/utils/parse-number-with-commas.js +22 -0
- package/Accordion/AccordionDetails.d.ts +0 -9
- package/Accordion/AccordionSummary.d.ts +0 -18
- package/Accordion/AccordionSummary.js +0 -51
- package/Alert/Alert.d.ts +0 -20
- package/Alert/Alert.js +0 -18
- package/Alert/index.d.ts +0 -3
- package/Alert/index.js +0 -1
- package/AppBar/AppBar.d.ts +0 -14
- package/AppBar/AppBar.js +0 -33
- package/AppBar/AppBarBrand.d.ts +0 -4
- package/AppBar/AppBarBrand.js +0 -11
- package/AppBar/AppBarMain.d.ts +0 -4
- package/AppBar/AppBarMain.js +0 -11
- package/AppBar/AppBarSupport.d.ts +0 -4
- package/AppBar/AppBarSupport.js +0 -11
- package/AppBar/index.d.ts +0 -8
- package/AppBar/index.js +0 -4
- package/Card/Card.d.ts +0 -51
- package/Card/Card.js +0 -20
- package/Card/CardActions.d.ts +0 -34
- package/Card/CardActions.js +0 -15
- package/ConfirmActions/ConfirmActions.d.ts +0 -46
- package/ConfirmActions/ConfirmActions.js +0 -15
- package/ConfirmActions/index.d.ts +0 -2
- package/ConfirmActions/index.js +0 -1
- package/Menu/Menu.d.ts +0 -28
- package/Menu/Menu.js +0 -25
- package/Menu/MenuDivider.d.ts +0 -7
- package/Menu/MenuDivider.js +0 -14
- package/Menu/MenuItem.d.ts +0 -23
- package/Menu/MenuItem.js +0 -25
- package/Menu/MenuItemGroup.d.ts +0 -13
- package/Menu/MenuItemGroup.js +0 -14
- package/Menu/index.d.ts +0 -9
- package/Menu/index.js +0 -4
- package/Modal/ModalActions.d.ts +0 -9
- package/Modal/ModalActions.js +0 -20
- package/Modal/ModalBody.d.ts +0 -7
- package/Modal/ModalBody.js +0 -14
- package/Navigation/NavigationContext.d.ts +0 -5
- package/Navigation/NavigationContext.js +0 -8
- package/Navigation/NavigationItem.d.ts +0 -31
- package/Navigation/NavigationItem.js +0 -23
- package/Navigation/NavigationSubMenu.d.ts +0 -22
- package/Navigation/NavigationSubMenu.js +0 -50
- package/Notification/Notification.d.ts +0 -54
- package/Notification/Notification.js +0 -76
- package/Notification/index.d.ts +0 -3
- package/Notification/index.js +0 -1
- package/PageToolbar/PageToolbar.d.ts +0 -114
- package/PageToolbar/PageToolbar.js +0 -23
- package/PageToolbar/index.d.ts +0 -2
- package/PageToolbar/index.js +0 -1
- package/PageToolbar/utils.d.ts +0 -23
- package/PageToolbar/utils.js +0 -165
- package/Popconfirm/Popconfirm.d.ts +0 -16
- package/Popconfirm/Popconfirm.js +0 -15
- package/Popconfirm/index.d.ts +0 -2
- package/Popconfirm/index.js +0 -1
- package/Popover/Popover.d.ts +0 -23
- package/Popover/Popover.js +0 -35
- package/Popover/index.d.ts +0 -2
- package/Popover/index.js +0 -1
- package/Provider/ConfigProvider.d.ts +0 -9
- package/Provider/ConfigProvider.js +0 -14
- package/Provider/context.d.ts +0 -5
- package/Provider/context.js +0 -8
- package/Provider/index.d.ts +0 -4
- package/Provider/index.js +0 -2
- package/Select/AutoComplete.d.ts +0 -107
- package/Select/AutoComplete.js +0 -114
- package/Select/Option.d.ts +0 -18
- package/Select/Option.js +0 -45
- package/Select/TreeSelect.d.ts +0 -67
- package/Select/TreeSelect.js +0 -198
- package/Table/components/TableDragHandleCell.d.ts +0 -9
- package/Table/components/TableDragHandleCell.js +0 -37
- package/Table/hooks/useTableColumns.d.ts +0 -8
- package/Table/hooks/useTableColumns.js +0 -91
- package/Transition/SlideFade.d.ts +0 -17
- package/Transition/SlideFade.js +0 -95
- package/Tree/Tree.d.ts +0 -70
- package/Tree/Tree.js +0 -139
- package/Tree/TreeNode.d.ts +0 -40
- package/Tree/TreeNode.js +0 -50
- package/Tree/TreeNodeList.d.ts +0 -24
- package/Tree/TreeNodeList.js +0 -28
- package/Tree/getTreeNodeEntities.d.ts +0 -11
- package/Tree/getTreeNodeEntities.js +0 -92
- package/Tree/index.d.ts +0 -13
- package/Tree/index.js +0 -7
- package/Tree/toggleValue.d.ts +0 -4
- package/Tree/toggleValue.js +0 -19
- package/Tree/traverseTree.d.ts +0 -2
- package/Tree/traverseTree.js +0 -11
- package/Tree/typings.d.ts +0 -16
- package/Tree/useTreeExpandedValue.d.ts +0 -14
- package/Tree/useTreeExpandedValue.js +0 -33
- package/_internal/SlideFadeOverlay/SlideFadeOverlay.d.ts +0 -20
- package/_internal/SlideFadeOverlay/SlideFadeOverlay.js +0 -37
- package/_internal/SlideFadeOverlay/index.d.ts +0 -2
- package/_internal/SlideFadeOverlay/index.js +0 -1
- /package/{_internal/SlideFadeOverlay → hooks}/useTopStack.d.ts +0 -0
- /package/{_internal/SlideFadeOverlay → hooks}/useTopStack.js +0 -0
package/Accordion/Accordion.d.ts
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
|
+
import React from 'react';
|
|
1
2
|
import { NativeElementPropsWithoutKeyAndRef } from '../utils/jsx-types';
|
|
3
|
+
import { AccordionTitleProps } from './AccordionTitle';
|
|
2
4
|
export interface AccordionProps extends Omit<NativeElementPropsWithoutKeyAndRef<'div'>, 'onChange'> {
|
|
5
|
+
/**
|
|
6
|
+
* The content of the component. <br />
|
|
7
|
+
* The first child will be treated as the title of the accordion, and the rest will be treated as the content of the accordion.
|
|
8
|
+
* You can also use `title` prop to set the title of the accordion, then all children will be treated as the content of the accordion.
|
|
9
|
+
*/
|
|
10
|
+
children: React.ReactNode;
|
|
3
11
|
/**
|
|
4
12
|
* If true, expands the accordion by default.
|
|
5
13
|
* @default false
|
|
@@ -18,6 +26,20 @@ export interface AccordionProps extends Omit<NativeElementPropsWithoutKeyAndRef<
|
|
|
18
26
|
* Callback fired when the expand/collapse state is changed.
|
|
19
27
|
*/
|
|
20
28
|
onChange?(e: boolean): void;
|
|
29
|
+
/**
|
|
30
|
+
* The size of accordion.
|
|
31
|
+
* @default 'main'
|
|
32
|
+
*/
|
|
33
|
+
size?: 'main' | 'sub';
|
|
34
|
+
/**
|
|
35
|
+
* The title of accordion.
|
|
36
|
+
*/
|
|
37
|
+
title?: string;
|
|
38
|
+
/**
|
|
39
|
+
* The actions displayed on the right side of the accordion title. <br />
|
|
40
|
+
* Only `Button` or `Dropdown` is allowed.
|
|
41
|
+
*/
|
|
42
|
+
actions?: AccordionTitleProps['actions'];
|
|
21
43
|
}
|
|
22
|
-
declare const Accordion:
|
|
44
|
+
declare const Accordion: React.ForwardRefExoticComponent<AccordionProps & React.RefAttributes<HTMLDivElement>>;
|
|
23
45
|
export default Accordion;
|
package/Accordion/Accordion.js
CHANGED
|
@@ -1,12 +1,54 @@
|
|
|
1
1
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
|
-
import { forwardRef, useState, useCallback,
|
|
2
|
+
import React, { forwardRef, useState, useCallback, useMemo, cloneElement } from 'react';
|
|
3
3
|
import { accordionClasses } from '@mezzanine-ui/core/accordion';
|
|
4
4
|
import { AccordionControlContext } from './AccordionControlContext.js';
|
|
5
|
+
import { MOTION_EASING, MOTION_DURATION } from '@mezzanine-ui/system/motion';
|
|
6
|
+
import AccordionTitle from './AccordionTitle.js';
|
|
7
|
+
import { flattenChildren } from '../utils/flatten-children.js';
|
|
8
|
+
import AccordionContent from './AccordionContent.js';
|
|
9
|
+
import Fade from '../Transition/Fade.js';
|
|
5
10
|
import cx from 'clsx';
|
|
6
11
|
|
|
12
|
+
const resolveChildren = (children) => {
|
|
13
|
+
let title = null;
|
|
14
|
+
let content = null;
|
|
15
|
+
const restContentChildren = [];
|
|
16
|
+
flattenChildren(children).forEach((child) => {
|
|
17
|
+
if (React.isValidElement(child) && child.type === AccordionTitle) {
|
|
18
|
+
if (title) {
|
|
19
|
+
console.warn('[Mezzanine][Accordion] Only one AccordionTitle is allowed as children of Accordion.');
|
|
20
|
+
}
|
|
21
|
+
title = child;
|
|
22
|
+
}
|
|
23
|
+
else if (React.isValidElement(child) && child.type === AccordionContent) {
|
|
24
|
+
if (content) {
|
|
25
|
+
console.warn('[Mezzanine][Accordion] Only one AccordionContent is allowed as children of Accordion.');
|
|
26
|
+
}
|
|
27
|
+
content = child;
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
restContentChildren.push(child);
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
if (restContentChildren.length > 0) {
|
|
34
|
+
if (content || title) {
|
|
35
|
+
console.warn('[Mezzanine][Accordion] When <AccordionTitle> or <AccordionContent> is used as children. Please wrap other children with AccordionContent.');
|
|
36
|
+
}
|
|
37
|
+
if (!content) {
|
|
38
|
+
content = jsx(AccordionContent, {});
|
|
39
|
+
}
|
|
40
|
+
content = cloneElement(content, {
|
|
41
|
+
children: [content.props.children, ...restContentChildren],
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
return {
|
|
45
|
+
title,
|
|
46
|
+
content,
|
|
47
|
+
};
|
|
48
|
+
};
|
|
7
49
|
const Accordion = forwardRef(function Accordion(props, ref) {
|
|
8
|
-
const {
|
|
9
|
-
const [expanded, toggleExpanded] = useState(defaultExpanded
|
|
50
|
+
const { actions, children: childrenProp, className, defaultExpanded = false, disabled = false, expanded: expandedProp, onChange, size = 'main', title, ...rest } = props;
|
|
51
|
+
const [expanded, toggleExpanded] = useState(defaultExpanded !== null && defaultExpanded !== void 0 ? defaultExpanded : false);
|
|
10
52
|
const onToggleExpanded = useCallback((newStatus) => {
|
|
11
53
|
if (typeof onChange === 'function') {
|
|
12
54
|
onChange(newStatus);
|
|
@@ -15,20 +57,26 @@ const Accordion = forwardRef(function Accordion(props, ref) {
|
|
|
15
57
|
toggleExpanded(newStatus);
|
|
16
58
|
}
|
|
17
59
|
}, [onChange]);
|
|
18
|
-
const
|
|
60
|
+
const { title: resolvedTitle, content: resolvedContent } = useMemo(() => resolveChildren(childrenProp), [childrenProp]);
|
|
19
61
|
const contextValue = useMemo(() => {
|
|
20
|
-
var _a, _b;
|
|
62
|
+
var _a, _b, _c;
|
|
21
63
|
return ({
|
|
22
|
-
|
|
23
|
-
? `${
|
|
64
|
+
contentId: resolvedTitle && ((_a = resolvedTitle === null || resolvedTitle === void 0 ? void 0 : resolvedTitle.props) === null || _a === void 0 ? void 0 : _a.id)
|
|
65
|
+
? `${resolvedTitle.props.id}-content`
|
|
24
66
|
: undefined,
|
|
25
67
|
disabled,
|
|
26
|
-
expanded: expandedProp
|
|
27
|
-
|
|
68
|
+
expanded: expandedProp !== null && expandedProp !== void 0 ? expandedProp : expanded,
|
|
69
|
+
titleId: (_c = (resolvedTitle && ((_b = resolvedTitle === null || resolvedTitle === void 0 ? void 0 : resolvedTitle.props) === null || _b === void 0 ? void 0 : _b.id))) !== null && _c !== void 0 ? _c : undefined,
|
|
28
70
|
toggleExpanded: onToggleExpanded,
|
|
29
71
|
});
|
|
30
|
-
}, [disabled, expandedProp, expanded, onToggleExpanded,
|
|
31
|
-
return (jsx("div", { ...rest, ref: ref, className: cx(accordionClasses.host, className), children: jsxs(AccordionControlContext.Provider, { value: contextValue, children: [
|
|
72
|
+
}, [disabled, expandedProp, expanded, onToggleExpanded, resolvedTitle]);
|
|
73
|
+
return (jsx("div", { ...rest, ref: ref, className: cx(accordionClasses.host, accordionClasses.size(size), className), children: jsxs(AccordionControlContext.Provider, { value: contextValue, children: [title ? (jsx(AccordionTitle, { actions: actions, children: title })) : (resolvedTitle), jsx(Fade, { duration: {
|
|
74
|
+
enter: MOTION_DURATION.moderate,
|
|
75
|
+
exit: MOTION_DURATION.moderate,
|
|
76
|
+
}, easing: {
|
|
77
|
+
enter: MOTION_EASING.entrance,
|
|
78
|
+
exit: MOTION_EASING.exit,
|
|
79
|
+
}, in: expandedProp !== null && expandedProp !== void 0 ? expandedProp : expanded, children: jsx("div", { children: resolvedContent }) })] }) }));
|
|
32
80
|
});
|
|
33
81
|
|
|
34
82
|
export { Accordion as default };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ReactElement } from 'react';
|
|
2
|
+
import { ButtonGroupProps, ButtonProps } from '../Button';
|
|
3
|
+
import { DropdownProps } from '../Dropdown';
|
|
4
|
+
type AccordionActionsChild = ReactElement<DropdownProps> | ReactElement<ButtonProps> | null | undefined | false;
|
|
5
|
+
export interface AccordionActionsProps extends Omit<ButtonGroupProps, 'children'> {
|
|
6
|
+
/**
|
|
7
|
+
* The content of the component. <br />
|
|
8
|
+
* Only `Button` or `Dropdown` is allowed.
|
|
9
|
+
*/
|
|
10
|
+
children?: AccordionActionsChild | AccordionActionsChild[];
|
|
11
|
+
}
|
|
12
|
+
declare const AccordionActions: React.FC<AccordionActionsProps>;
|
|
13
|
+
export default AccordionActions;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { isValidElement } from 'react';
|
|
4
|
+
import Button from '../Button/Button.js';
|
|
5
|
+
import ButtonGroup from '../Button/ButtonGroup.js';
|
|
6
|
+
import { flattenChildren } from '../utils/flatten-children.js';
|
|
7
|
+
import { accordionClasses } from '@mezzanine-ui/core/accordion';
|
|
8
|
+
import Dropdown from '../Dropdown/Dropdown.js';
|
|
9
|
+
import cx from 'clsx';
|
|
10
|
+
|
|
11
|
+
const AccordionActions = ({ children, className, ...rest }) => {
|
|
12
|
+
const filteredChildren = flattenChildren(children).map((child) => {
|
|
13
|
+
if (isValidElement(child) &&
|
|
14
|
+
child.type !== Button &&
|
|
15
|
+
child.type !== Dropdown) {
|
|
16
|
+
console.warn('[Mezzanine][Accordion] Only Button or Dropdown is allowed as the child of AccordionActions.');
|
|
17
|
+
return null;
|
|
18
|
+
}
|
|
19
|
+
return child;
|
|
20
|
+
});
|
|
21
|
+
return (jsx(ButtonGroup, { className: cx(accordionClasses.titleActions, className), ...rest, children: filteredChildren }));
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export { AccordionActions as default };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { NativeElementPropsWithoutKeyAndRef } from '../utils/jsx-types';
|
|
2
|
+
export interface AccordionContentProps extends NativeElementPropsWithoutKeyAndRef<'div'> {
|
|
3
|
+
/**
|
|
4
|
+
* If true, expands the content, otherwise collapse it.
|
|
5
|
+
*/
|
|
6
|
+
expanded?: boolean;
|
|
7
|
+
}
|
|
8
|
+
declare const AccordionContent: import("react").ForwardRefExoticComponent<AccordionContentProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
9
|
+
export default AccordionContent;
|
|
@@ -6,9 +6,9 @@ import { AccordionControlContext } from './AccordionControlContext.js';
|
|
|
6
6
|
import Collapse from '../Transition/Collapse.js';
|
|
7
7
|
import cx from 'clsx';
|
|
8
8
|
|
|
9
|
-
const
|
|
9
|
+
const AccordionContent = forwardRef(function AccordionContent(props, ref) {
|
|
10
10
|
const { className, children, expanded: expandedProp, ...rest } = props;
|
|
11
|
-
const { detailsId, expanded, summaryId } = useContext(AccordionControlContext) || {};
|
|
11
|
+
const { contentId: detailsId, expanded, titleId: summaryId, } = useContext(AccordionControlContext) || {};
|
|
12
12
|
const ariaProps = useMemo(() => {
|
|
13
13
|
if (summaryId && detailsId) {
|
|
14
14
|
return {
|
|
@@ -18,9 +18,7 @@ const AccordionDetails = forwardRef(function AccordionDetails(props, ref) {
|
|
|
18
18
|
}
|
|
19
19
|
return {};
|
|
20
20
|
}, [summaryId, detailsId]);
|
|
21
|
-
return (jsx(Collapse, { style: { width: '100%' }, in: expandedProp || expanded, children: jsx("div", { ...rest, ...ariaProps, ref: ref, className: cx(accordionClasses.
|
|
22
|
-
[accordionClasses.detailsExpanded]: expandedProp || expanded,
|
|
23
|
-
}, className), role: "region", children: children }) }));
|
|
21
|
+
return (jsx(Collapse, { style: { width: '100%' }, in: expandedProp || expanded, children: jsx("div", { ...rest, ...ariaProps, ref: ref, className: cx(accordionClasses.content, className), role: "region", children: children }) }));
|
|
24
22
|
});
|
|
25
23
|
|
|
26
|
-
export {
|
|
24
|
+
export { AccordionContent as default };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export interface AccordionControlContextValue {
|
|
2
|
-
|
|
2
|
+
contentId?: string;
|
|
3
3
|
disabled: boolean;
|
|
4
4
|
expanded: boolean;
|
|
5
|
-
|
|
5
|
+
titleId?: string;
|
|
6
6
|
toggleExpanded(e: boolean): void;
|
|
7
7
|
}
|
|
8
8
|
export declare const AccordionControlContext: import("react").Context<AccordionControlContextValue | undefined>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { NativeElementPropsWithoutKeyAndRef } from '../utils/jsx-types';
|
|
2
|
+
export interface AccordionGroupProps extends NativeElementPropsWithoutKeyAndRef<'div'> {
|
|
3
|
+
/**
|
|
4
|
+
* The size of accordion group, which will be passed to each Accordion in the group.
|
|
5
|
+
* @default 'main'
|
|
6
|
+
*/
|
|
7
|
+
size?: 'main' | 'sub';
|
|
8
|
+
}
|
|
9
|
+
declare const AccordionGroup: import("react").ForwardRefExoticComponent<AccordionGroupProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
10
|
+
export default AccordionGroup;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { forwardRef, useMemo, isValidElement } from 'react';
|
|
4
|
+
import { accordionGroupClasses } from '@mezzanine-ui/core/accordion';
|
|
5
|
+
import { flattenChildren } from '../utils/flatten-children.js';
|
|
6
|
+
import Accordion from './Accordion.js';
|
|
7
|
+
import cx from 'clsx';
|
|
8
|
+
|
|
9
|
+
const AccordionGroup = forwardRef(function AccordionGroup(props, ref) {
|
|
10
|
+
const { className, children, size, ...rest } = props;
|
|
11
|
+
const childrenWithSize = useMemo(() => flattenChildren(children).map((child) => {
|
|
12
|
+
if (isValidElement(child) && child.type === Accordion) {
|
|
13
|
+
return {
|
|
14
|
+
...child,
|
|
15
|
+
props: {
|
|
16
|
+
...child.props,
|
|
17
|
+
size,
|
|
18
|
+
},
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
return child;
|
|
22
|
+
}), [children, size]);
|
|
23
|
+
return (jsx("div", { ...rest, ref: ref, className: cx(accordionGroupClasses.host, className), children: childrenWithSize }));
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
export { AccordionGroup as default };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { NativeElementPropsWithoutKeyAndRef } from '../utils/jsx-types';
|
|
2
|
+
import { AccordionActionsProps } from './AccordionActions';
|
|
3
|
+
export interface AccordionTitleProps extends NativeElementPropsWithoutKeyAndRef<'div'> {
|
|
4
|
+
/**
|
|
5
|
+
* Custom ChevronRight icon className.
|
|
6
|
+
*/
|
|
7
|
+
iconClassName?: string;
|
|
8
|
+
/**
|
|
9
|
+
* Custom suffix actions.
|
|
10
|
+
*/
|
|
11
|
+
actions?: AccordionActionsProps;
|
|
12
|
+
}
|
|
13
|
+
declare const AccordionTitle: import("react").ForwardRefExoticComponent<AccordionTitleProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
14
|
+
export default AccordionTitle;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { forwardRef, useContext, useCallback, useMemo, isValidElement } from 'react';
|
|
4
|
+
import { ChevronRightIcon } from '@mezzanine-ui/icons';
|
|
5
|
+
import { accordionClasses } from '@mezzanine-ui/core/accordion';
|
|
6
|
+
import { AccordionControlContext } from './AccordionControlContext.js';
|
|
7
|
+
import { flattenChildren } from '../utils/flatten-children.js';
|
|
8
|
+
import AccordionActions from './AccordionActions.js';
|
|
9
|
+
import Rotate from '../Transition/Rotate.js';
|
|
10
|
+
import Icon from '../Icon/Icon.js';
|
|
11
|
+
import cx from 'clsx';
|
|
12
|
+
|
|
13
|
+
const resolveChildren = (children) => {
|
|
14
|
+
const mainPartChildren = [];
|
|
15
|
+
const actionsChildren = [];
|
|
16
|
+
flattenChildren(children).forEach((child) => {
|
|
17
|
+
if (isValidElement(child) && child.type === AccordionActions) {
|
|
18
|
+
actionsChildren.push(child);
|
|
19
|
+
}
|
|
20
|
+
else {
|
|
21
|
+
mainPartChildren.push(child);
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
return { mainPartChildren, actionsChildren };
|
|
25
|
+
};
|
|
26
|
+
const AccordionTitle = forwardRef(function AccordionTitle(props, ref) {
|
|
27
|
+
const { className, children, iconClassName: iconClassNameProp, actions: suffixActions, ...rest } = props;
|
|
28
|
+
const { contentId, disabled, expanded, toggleExpanded } = useContext(AccordionControlContext) || {};
|
|
29
|
+
const onToggle = useCallback((e) => {
|
|
30
|
+
e.stopPropagation();
|
|
31
|
+
if (typeof toggleExpanded === 'function' && !disabled) {
|
|
32
|
+
toggleExpanded(!expanded);
|
|
33
|
+
}
|
|
34
|
+
}, [disabled, expanded, toggleExpanded]);
|
|
35
|
+
const ariaProps = useMemo(() => {
|
|
36
|
+
let result = {
|
|
37
|
+
'aria-expanded': expanded,
|
|
38
|
+
};
|
|
39
|
+
if (contentId) {
|
|
40
|
+
result = {
|
|
41
|
+
...result,
|
|
42
|
+
'aria-controls': contentId,
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
return result;
|
|
46
|
+
}, [contentId, expanded]);
|
|
47
|
+
const { mainPartChildren, actionsChildren } = useMemo(() => resolveChildren(children), [children]);
|
|
48
|
+
return (jsxs("div", { ...rest, ref: ref, className: cx(accordionClasses.title, {
|
|
49
|
+
[accordionClasses.titleExpanded]: expanded,
|
|
50
|
+
[accordionClasses.titleDisabled]: disabled,
|
|
51
|
+
}, className), children: [jsxs("button", { className: accordionClasses.titleMainPart, disabled: disabled, onClick: onToggle, type: "button", ...ariaProps, children: [jsx(Rotate, { in: expanded, degrees: -90, children: jsx(Icon, { size: 16, className: cx(accordionClasses.titleIcon, {
|
|
52
|
+
[accordionClasses.titleIconDisabled]: disabled,
|
|
53
|
+
}, iconClassNameProp), icon: ChevronRightIcon }) }), mainPartChildren] }), suffixActions ? (jsx(AccordionActions, { ...suffixActions })) : (actionsChildren)] }));
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
export { AccordionTitle as default };
|
package/Accordion/index.d.ts
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
export type { AccordionProps } from './Accordion';
|
|
2
2
|
export { default } from './Accordion';
|
|
3
|
-
export { default as
|
|
4
|
-
export type {
|
|
5
|
-
export { default as
|
|
6
|
-
export type {
|
|
3
|
+
export { default as AccordionTitle } from './AccordionTitle';
|
|
4
|
+
export type { AccordionTitleProps } from './AccordionTitle';
|
|
5
|
+
export { default as AccordionContent } from './AccordionContent';
|
|
6
|
+
export type { AccordionContentProps } from './AccordionContent';
|
|
7
|
+
export { default as AccordionActions } from './AccordionActions';
|
|
8
|
+
export type { AccordionActionsProps } from './AccordionActions';
|
|
9
|
+
export { default as AccordionGroup } from './AccordionGroup';
|
|
10
|
+
export type { AccordionGroupProps } from './AccordionGroup';
|
package/Accordion/index.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
export { default } from './Accordion.js';
|
|
2
|
-
export { default as
|
|
3
|
-
export { default as
|
|
2
|
+
export { default as AccordionTitle } from './AccordionTitle.js';
|
|
3
|
+
export { default as AccordionContent } from './AccordionContent.js';
|
|
4
|
+
export { default as AccordionActions } from './AccordionActions.js';
|
|
5
|
+
export { default as AccordionGroup } from './AccordionGroup.js';
|
package/Anchor/Anchor.d.ts
CHANGED
|
@@ -1,30 +1,63 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
*
|
|
1
|
+
import { ReactElement } from 'react';
|
|
2
|
+
import { AnchorItemData } from './AnchorItem';
|
|
3
|
+
export interface AnchorPropsWithAnchors {
|
|
4
|
+
/**
|
|
5
|
+
* ```tsx
|
|
6
|
+
* interface AnchorItemData {
|
|
7
|
+
* autoScrollTo?: boolean;
|
|
8
|
+
* children?: AnchorItemData[];
|
|
9
|
+
* disabled?: boolean;
|
|
10
|
+
* href: string;
|
|
11
|
+
* id: string;
|
|
12
|
+
* name: string;
|
|
13
|
+
* onClick?: VoidFunction;
|
|
14
|
+
* title?: string;
|
|
15
|
+
* }
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
18
|
+
anchors: AnchorItemData[];
|
|
19
|
+
children?: never;
|
|
20
|
+
}
|
|
21
|
+
export interface AnchorPropsWithChildren {
|
|
22
|
+
anchors?: never;
|
|
23
|
+
/**
|
|
24
|
+
* Whether to enable smooth scrolling to the target element when clicked.
|
|
25
|
+
*/
|
|
26
|
+
autoScrollTo?: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Use nested `<Anchor>` components to create hierarchical navigation. <br />
|
|
29
|
+
* Only accepts `<Anchor>` components and text content as children. <br />
|
|
30
|
+
* ```tsx
|
|
31
|
+
* <AnchorGroup>
|
|
32
|
+
* <Anchor href="#acr1">ACR 1</Anchor>
|
|
33
|
+
* <Anchor href="#acr2">
|
|
34
|
+
* anchor 2
|
|
35
|
+
* <Anchor href="#acr2-1">ACR 2-1</Anchor>
|
|
36
|
+
* <Anchor href="#acr2-2">ACR 2-2</Anchor>
|
|
37
|
+
* </Anchor>
|
|
38
|
+
* </AnchorGroup>
|
|
39
|
+
* ```
|
|
7
40
|
*/
|
|
8
|
-
|
|
41
|
+
children: string | ReactElement<AnchorPropsWithChildren, typeof Anchor> | Array<string | ReactElement<AnchorPropsWithChildren, typeof Anchor>>;
|
|
9
42
|
/**
|
|
10
|
-
*
|
|
43
|
+
* Whether the anchor is disabled.<br>
|
|
44
|
+
* If parent anchor is disabled, all its children will be disabled too. <br />
|
|
11
45
|
*/
|
|
12
|
-
|
|
13
|
-
id: string;
|
|
14
|
-
name: string;
|
|
15
|
-
}[];
|
|
46
|
+
disabled?: boolean;
|
|
16
47
|
/**
|
|
17
|
-
*
|
|
48
|
+
* Required when used as child component.
|
|
18
49
|
*/
|
|
19
|
-
|
|
50
|
+
href?: string;
|
|
20
51
|
/**
|
|
21
52
|
* Trigger when user click on any anchor.
|
|
22
53
|
*/
|
|
23
|
-
onClick?:
|
|
54
|
+
onClick?: VoidFunction;
|
|
55
|
+
title?: string;
|
|
24
56
|
}
|
|
57
|
+
export type AnchorProps = AnchorPropsWithAnchors | AnchorPropsWithChildren;
|
|
25
58
|
/**
|
|
26
|
-
* The
|
|
27
|
-
*
|
|
59
|
+
* The `mezzanine` Anchor component provides navigation menu for page sections with automatic hash tracking.
|
|
60
|
+
* Nested structure supports up to 3 levels; deeper levels will be ignored.
|
|
28
61
|
*/
|
|
29
|
-
declare
|
|
62
|
+
declare function Anchor(props: AnchorProps): import("react/jsx-runtime").JSX.Element;
|
|
30
63
|
export default Anchor;
|
package/Anchor/Anchor.js
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { Fragment } from 'react';
|
|
4
|
+
import AnchorItem from './AnchorItem.js';
|
|
5
|
+
import { parseChildren } from './utils.js';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
|
-
* The
|
|
9
|
-
*
|
|
8
|
+
* The `mezzanine` Anchor component provides navigation menu for page sections with automatic hash tracking.
|
|
9
|
+
* Nested structure supports up to 3 levels; deeper levels will be ignored.
|
|
10
10
|
*/
|
|
11
|
-
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
return (
|
|
18
|
-
}
|
|
11
|
+
function Anchor(props) {
|
|
12
|
+
const anchorItems = 'anchors' in props && props.anchors
|
|
13
|
+
? props.anchors
|
|
14
|
+
: 'children' in props && props.children
|
|
15
|
+
? parseChildren(props.children, Anchor)
|
|
16
|
+
: [];
|
|
17
|
+
return (jsx(Fragment, { children: anchorItems.map((anchorItem) => (jsx(AnchorItem, { autoScrollTo: anchorItem.autoScrollTo, disabled: anchorItem.disabled, href: anchorItem.href, id: anchorItem.id, name: anchorItem.name, onClick: anchorItem.onClick, subAnchors: anchorItem.children, title: anchorItem.title }, anchorItem.id))) }));
|
|
18
|
+
}
|
|
19
19
|
|
|
20
20
|
export { Anchor as default };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { ReactElement } from 'react';
|
|
2
|
+
import Anchor from './Anchor';
|
|
3
|
+
import type { AnchorPropsWithAnchors, AnchorPropsWithChildren } from './Anchor';
|
|
4
|
+
type AnchorElement = ReactElement<AnchorPropsWithChildren, typeof Anchor>;
|
|
5
|
+
type AnchorChildren = AnchorElement | AnchorElement[];
|
|
6
|
+
export type AnchorGroupPropsWithAnchors = AnchorPropsWithAnchors;
|
|
7
|
+
export interface AnchorGroupPropsWithChildren {
|
|
8
|
+
anchors?: never;
|
|
9
|
+
children: AnchorChildren;
|
|
10
|
+
}
|
|
11
|
+
type AnchorGroupBaseProps = AnchorGroupPropsWithAnchors | AnchorGroupPropsWithChildren;
|
|
12
|
+
export type AnchorGroupProps = AnchorGroupBaseProps & {
|
|
13
|
+
className?: string;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* The `mezzanine` AnchorGroup component renders a group of anchor links,
|
|
17
|
+
* configured via an `anchors` prop or parsed from `Anchor` child components.
|
|
18
|
+
*
|
|
19
|
+
* ```tsx
|
|
20
|
+
* <AnchorGroup>
|
|
21
|
+
* <Anchor href="#section1">Section 1</Anchor>
|
|
22
|
+
* <Anchor href="#section2">Section 2</Anchor>
|
|
23
|
+
* </AnchorGroup>
|
|
24
|
+
* ```
|
|
25
|
+
*
|
|
26
|
+
* ```tsx
|
|
27
|
+
* <AnchorGroup anchors={[
|
|
28
|
+
* { id: 'section1', name: 'Section 1', href: '#section1' },
|
|
29
|
+
* { id: 'section2', name: 'Section 2', href: '#section2' }
|
|
30
|
+
* ]} />
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
declare const AnchorGroup: import("react").ForwardRefExoticComponent<AnchorGroupProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
34
|
+
export default AnchorGroup;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { forwardRef } from 'react';
|
|
4
|
+
import { anchorClasses } from '@mezzanine-ui/core/anchor';
|
|
5
|
+
import Anchor from './Anchor.js';
|
|
6
|
+
import { parseChildren } from './utils.js';
|
|
7
|
+
import cx from 'clsx';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* The `mezzanine` AnchorGroup component renders a group of anchor links,
|
|
11
|
+
* configured via an `anchors` prop or parsed from `Anchor` child components.
|
|
12
|
+
*
|
|
13
|
+
* ```tsx
|
|
14
|
+
* <AnchorGroup>
|
|
15
|
+
* <Anchor href="#section1">Section 1</Anchor>
|
|
16
|
+
* <Anchor href="#section2">Section 2</Anchor>
|
|
17
|
+
* </AnchorGroup>
|
|
18
|
+
* ```
|
|
19
|
+
*
|
|
20
|
+
* ```tsx
|
|
21
|
+
* <AnchorGroup anchors={[
|
|
22
|
+
* { id: 'section1', name: 'Section 1', href: '#section1' },
|
|
23
|
+
* { id: 'section2', name: 'Section 2', href: '#section2' }
|
|
24
|
+
* ]} />
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
const AnchorGroup = forwardRef(function AnchorGroup(props, ref) {
|
|
28
|
+
const { className } = props;
|
|
29
|
+
const anchorItems = 'anchors' in props && props.anchors
|
|
30
|
+
? props.anchors
|
|
31
|
+
: 'children' in props && props.children
|
|
32
|
+
? parseChildren(props.children, Anchor)
|
|
33
|
+
: [];
|
|
34
|
+
return (jsx("div", { ref: ref, className: cx(anchorClasses.host, className), children: jsx(Anchor, { anchors: anchorItems }) }));
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
export { AnchorGroup as default };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export interface AnchorItemData {
|
|
2
|
+
autoScrollTo?: boolean;
|
|
3
|
+
children?: AnchorItemData[];
|
|
4
|
+
disabled?: boolean;
|
|
5
|
+
href: string;
|
|
6
|
+
id: string;
|
|
7
|
+
name: string;
|
|
8
|
+
onClick?: VoidFunction;
|
|
9
|
+
title?: string;
|
|
10
|
+
}
|
|
11
|
+
export interface AnchorItemProps {
|
|
12
|
+
autoScrollTo?: boolean;
|
|
13
|
+
className?: string;
|
|
14
|
+
disabled?: boolean;
|
|
15
|
+
href: string;
|
|
16
|
+
id: string;
|
|
17
|
+
level?: number;
|
|
18
|
+
name: string;
|
|
19
|
+
onClick?: VoidFunction;
|
|
20
|
+
parentAutoScrollTo?: boolean;
|
|
21
|
+
parentDisabled?: boolean;
|
|
22
|
+
subAnchors?: AnchorItemData[];
|
|
23
|
+
title?: string;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Individual anchor link with hash tracking and smooth scrolling.
|
|
27
|
+
* Tracks active state from URL hash and inherits disabled state from parent.
|
|
28
|
+
*/
|
|
29
|
+
declare function AnchorItem({ autoScrollTo, className, disabled, href, id: _id, level, name, onClick, parentAutoScrollTo, parentDisabled, subAnchors, title, }: AnchorItemProps): import("react/jsx-runtime").JSX.Element;
|
|
30
|
+
export default AnchorItem;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { useState, useEffect } from 'react';
|
|
4
|
+
import { anchorClasses } from '@mezzanine-ui/core/anchor';
|
|
5
|
+
import Typography from '../Typography/Typography.js';
|
|
6
|
+
import cx from 'clsx';
|
|
7
|
+
|
|
8
|
+
const MAX_CHILDREN_PER_LEVEL = 3;
|
|
9
|
+
/**
|
|
10
|
+
* Custom hook to track window.location.hash changes
|
|
11
|
+
*/
|
|
12
|
+
function useHash() {
|
|
13
|
+
const [hash, setHash] = useState(() => typeof window !== 'undefined' ? window.location.hash : '');
|
|
14
|
+
useEffect(() => {
|
|
15
|
+
const handleHashChange = () => {
|
|
16
|
+
setHash(window.location.hash);
|
|
17
|
+
};
|
|
18
|
+
window.addEventListener('hashchange', handleHashChange);
|
|
19
|
+
return () => {
|
|
20
|
+
window.removeEventListener('hashchange', handleHashChange);
|
|
21
|
+
};
|
|
22
|
+
}, []);
|
|
23
|
+
return hash;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Individual anchor link with hash tracking and smooth scrolling.
|
|
27
|
+
* Tracks active state from URL hash and inherits disabled state from parent.
|
|
28
|
+
*/
|
|
29
|
+
function AnchorItem({ autoScrollTo, className, disabled, href, id: _id, level = 1, name, onClick, parentAutoScrollTo = false, parentDisabled = false, subAnchors, title, }) {
|
|
30
|
+
const renderableChildren = subAnchors && subAnchors.length > 0 && level < MAX_CHILDREN_PER_LEVEL
|
|
31
|
+
? subAnchors.slice(0, MAX_CHILDREN_PER_LEVEL)
|
|
32
|
+
: undefined;
|
|
33
|
+
const currentHash = useHash();
|
|
34
|
+
const hashIndex = href.indexOf('#');
|
|
35
|
+
const itemHash = hashIndex !== -1 ? href.slice(hashIndex) : '';
|
|
36
|
+
const isActive = itemHash && currentHash === itemHash;
|
|
37
|
+
const isAutoScrollTo = parentAutoScrollTo || autoScrollTo;
|
|
38
|
+
const isDisabled = parentDisabled || disabled;
|
|
39
|
+
const handleClick = (event) => {
|
|
40
|
+
if (isDisabled) {
|
|
41
|
+
event.preventDefault();
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
// If href contains a hash, handle navigation manually to ensure hashchange event fires
|
|
45
|
+
if (itemHash && typeof window !== 'undefined') {
|
|
46
|
+
event.preventDefault();
|
|
47
|
+
// Update the hash in the URL only if it's different
|
|
48
|
+
if (window.location.hash !== itemHash) {
|
|
49
|
+
window.history.pushState(null, '', itemHash);
|
|
50
|
+
window.dispatchEvent(new HashChangeEvent('hashchange'));
|
|
51
|
+
}
|
|
52
|
+
// Scroll to the target element if it exists and autoScrollTo is enabled
|
|
53
|
+
if (isAutoScrollTo) {
|
|
54
|
+
const targetElement = document.querySelector(itemHash);
|
|
55
|
+
if (targetElement) {
|
|
56
|
+
targetElement.scrollIntoView({ behavior: 'smooth', block: 'start' });
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
onClick === null || onClick === void 0 ? void 0 : onClick();
|
|
61
|
+
};
|
|
62
|
+
return (jsxs(Fragment, { children: [jsx("a", { "aria-disabled": isDisabled, className: cx(anchorClasses.anchorItem, isActive && anchorClasses.anchorItemActive, isDisabled && anchorClasses.anchorItemDisabled, className), href: href, onClick: handleClick, tabIndex: isDisabled ? -1 : undefined, title: title, children: jsx(Typography, { color: "inherit", variant: "label-primary", children: name }) }), renderableChildren && (jsx("div", { className: anchorClasses.nested, children: renderableChildren.map((child) => (jsx(AnchorItem, { autoScrollTo: child.autoScrollTo, className: cx(level === 1 && anchorClasses.nestedLevel1, level === 2 && anchorClasses.nestedLevel2), disabled: child.disabled, href: child.href, id: child.id, level: level + 1, name: child.name, onClick: child.onClick, parentAutoScrollTo: isAutoScrollTo, parentDisabled: isDisabled, subAnchors: child.children, title: child.title }, child.id))) }))] }));
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export { AnchorItem as default };
|