burne-ui 2.1.2 → 2.1.4
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/README.md +8 -4
- package/cli/burne-ui.js +4 -3
- package/cli/init.js +83 -19
- package/cli/skin-live-slots.json +1 -1
- package/cli/skin-slots.json +2 -0
- package/cli/skin-validate.mjs +83 -2
- package/cli/tailwind.css +20 -0
- package/cli/theme-bridge.css +6 -0
- package/dist/authoring.d.ts +2 -0
- package/dist/authoring.js +8 -0
- package/dist/components/composite/Accordion/accordionStyles.js +1 -1
- package/dist/components/composite/Accordion/useAccordionRootState.js +6 -2
- package/dist/components/composite/AlertDialog/AlertDialog.d.ts +1 -1
- package/dist/components/composite/AlertDialog/AlertDialog.js +1 -0
- package/dist/components/composite/AlertDialog/alertDialogAnimations.d.ts +1 -0
- package/dist/components/composite/AlertDialog/alertDialogAnimations.js +1 -0
- package/dist/components/composite/AlertDialog/alertDialogParts.d.ts +5 -7
- package/dist/components/composite/AlertDialog/alertDialogParts.js +92 -37
- package/dist/components/composite/AlertDialog/alertDialogStyles.d.ts +3 -2
- package/dist/components/composite/AlertDialog/alertDialogStyles.js +5 -3
- package/dist/components/composite/AlertDialog/alertDialogTypes.d.ts +8 -8
- package/dist/components/composite/AlertDialog/index.d.ts +4 -6
- package/dist/components/composite/AlertDialog/useAlertDialogRootState.d.ts +1 -1
- package/dist/components/composite/AlertDialog/useAlertDialogRootState.js +13 -1
- package/dist/components/composite/ButtonGroup/ButtonGroup.d.ts +1 -0
- package/dist/components/composite/ButtonGroup/ButtonGroup.js +59 -25
- package/dist/components/composite/ButtonGroup/buttonGroupAPI.d.ts +1 -0
- package/dist/components/composite/ButtonGroup/buttonGroupAPI.js +7 -1
- package/dist/components/composite/ButtonGroup/buttonGroupContext.d.ts +3 -2
- package/dist/components/composite/ButtonGroup/buttonGroupContext.js +4 -3
- package/dist/components/composite/ButtonGroup/buttonGroupStyles.js +1 -1
- package/dist/components/composite/ButtonGroup/buttonGroupTypes.d.ts +3 -1
- package/dist/components/composite/ButtonGroup/index.d.ts +1 -0
- package/dist/components/composite/CheckboxGroup/CheckboxGroup.js +25 -7
- package/dist/components/composite/CheckboxGroup/useCheckboxGroupRootState.d.ts +5 -1
- package/dist/components/composite/CheckboxGroup/useCheckboxGroupRootState.js +74 -23
- package/dist/components/composite/Form/Form.js +6 -0
- package/dist/components/composite/Form/formAPI.d.ts +2 -0
- package/dist/components/composite/Form/formAPI.js +29 -2
- package/dist/components/composite/Form/formContext.js +4 -0
- package/dist/components/composite/Form/formParts.js +20 -6
- package/dist/components/composite/Form/formStyles.js +4 -4
- package/dist/components/composite/Form/useFormControlProps.js +25 -15
- package/dist/components/composite/Form/useFormFieldBinding.js +22 -14
- package/dist/components/composite/Form/useFormRootState.d.ts +2 -1
- package/dist/components/composite/Form/useFormRootState.js +151 -89
- package/dist/components/composite/RadioGroup/RadioGroup.js +30 -10
- package/dist/components/composite/RadioGroup/radioGroupA11y.d.ts +10 -0
- package/dist/components/composite/RadioGroup/radioGroupA11y.js +75 -0
- package/dist/components/composite/RadioGroup/radioGroupTypes.d.ts +2 -2
- package/dist/components/composite/RadioGroup/useRadioGroupRootState.d.ts +7 -1
- package/dist/components/composite/RadioGroup/useRadioGroupRootState.js +105 -34
- package/dist/components/composite/ToggleButtonGroup/ToggleButtonGroup.js +3 -1
- package/dist/components/composite/ToggleButtonGroup/toggleButtonGroupA11y.d.ts +1 -1
- package/dist/components/composite/ToggleButtonGroup/toggleButtonGroupA11y.js +13 -7
- package/dist/components/composite/ToggleButtonGroup/toggleButtonGroupAPI.d.ts +2 -0
- package/dist/components/composite/ToggleButtonGroup/toggleButtonGroupAPI.js +19 -4
- package/dist/components/composite/ToggleButtonGroup/useToggleButtonGroupRootState.js +20 -7
- package/dist/components/composite/utils/optionGroupFieldset.d.ts +1 -1
- package/dist/components/core/Alert/Alert.js +3 -1
- package/dist/components/core/Alert/alertAnimations.js +14 -3
- package/dist/components/core/Alert/alertStyles.d.ts +1 -1
- package/dist/components/core/Alert/alertStyles.js +1 -1
- package/dist/components/core/AppShell/AppShell.js +16 -4
- package/dist/components/core/AppShell/appShellAnimations.js +1 -1
- package/dist/components/core/AppShell/appShellStyles.d.ts +3 -2
- package/dist/components/core/AppShell/appShellStyles.js +8 -2
- package/dist/components/core/AspectRatio/AspectRatio.js +6 -3
- package/dist/components/core/AspectRatio/aspectRatioAnimations.js +1 -1
- package/dist/components/core/AspectRatio/aspectRatioStyles.d.ts +5 -2
- package/dist/components/core/AspectRatio/aspectRatioStyles.js +27 -3
- package/dist/components/core/Avatar/avatarParts.js +26 -6
- package/dist/components/core/Avatar/avatarTypes.d.ts +1 -0
- package/dist/components/core/Avatar/useAvatarRootState.d.ts +1 -0
- package/dist/components/core/Avatar/useAvatarRootState.js +6 -2
- package/dist/components/core/Badge/Badge.js +9 -3
- package/dist/components/core/Badge/badgeA11y.js +6 -0
- package/dist/components/core/Badge/badgeAPI.js +4 -4
- package/dist/components/core/Badge/badgeAnimations.js +18 -3
- package/dist/components/core/Badge/badgeParts.d.ts +1 -1
- package/dist/components/core/Badge/badgeParts.js +6 -3
- package/dist/components/core/Badge/badgeStyles.d.ts +1 -0
- package/dist/components/core/Badge/badgeStyles.js +2 -0
- package/dist/components/core/Badge/badgeTypes.d.ts +2 -0
- package/dist/components/core/Badge/useBadgeRootState.d.ts +1 -0
- package/dist/components/core/Badge/useBadgeRootState.js +2 -1
- package/dist/components/core/Breadcrumbs/breadcrumbsAPI.js +11 -5
- package/dist/components/core/Breadcrumbs/breadcrumbsParts.js +21 -6
- package/dist/components/core/Breadcrumbs/breadcrumbsStyles.js +4 -4
- package/dist/components/core/Button/Button.js +34 -18
- package/dist/components/core/Button/buttonAnimations.d.ts +1 -1
- package/dist/components/core/Button/buttonAnimations.js +18 -7
- package/dist/components/core/Button/buttonParts.js +2 -2
- package/dist/components/core/Button/buttonStyles.d.ts +4 -3
- package/dist/components/core/Button/buttonStyles.js +11 -10
- package/dist/components/core/Button/buttonTypes.d.ts +2 -1
- package/dist/components/core/Button/useButtonRootState.d.ts +2 -1
- package/dist/components/core/Button/useButtonRootState.js +10 -4
- package/dist/components/core/Calendar/Calendar.js +15 -4
- package/dist/components/core/Calendar/calendarAPI.d.ts +10 -6
- package/dist/components/core/Calendar/calendarAPI.js +110 -30
- package/dist/components/core/Calendar/calendarParts.js +173 -72
- package/dist/components/core/Calendar/calendarStyles.d.ts +5 -5
- package/dist/components/core/Calendar/calendarStyles.js +8 -8
- package/dist/components/core/Calendar/calendarTypes.d.ts +8 -0
- package/dist/components/core/Calendar/useCalendarRootState.js +60 -19
- package/dist/components/core/Calendar/useCalendarViewModels.js +6 -6
- package/dist/components/core/Card/Card.d.ts +1 -0
- package/dist/components/core/Card/Card.js +17 -7
- package/dist/components/core/Card/cardAPI.d.ts +1 -0
- package/dist/components/core/Card/cardAPI.js +23 -1
- package/dist/components/core/Card/cardAnimations.d.ts +1 -1
- package/dist/components/core/Card/cardAnimations.js +41 -10
- package/dist/components/core/Card/cardParts.d.ts +1 -1
- package/dist/components/core/Card/cardParts.js +26 -6
- package/dist/components/core/Card/cardStyles.d.ts +5 -4
- package/dist/components/core/Card/cardStyles.js +9 -6
- package/dist/components/core/Card/cardTypes.d.ts +4 -0
- package/dist/components/core/Card/index.d.ts +1 -0
- package/dist/components/core/Checkbox/Checkbox.js +9 -1
- package/dist/components/core/Checkbox/checkboxAPI.d.ts +2 -0
- package/dist/components/core/Checkbox/checkboxAPI.js +36 -0
- package/dist/components/core/Checkbox/checkboxParts.d.ts +5 -4
- package/dist/components/core/Checkbox/checkboxParts.js +74 -48
- package/dist/components/core/Checkbox/checkboxStyles.d.ts +4 -3
- package/dist/components/core/Checkbox/checkboxStyles.js +5 -3
- package/dist/components/core/Checkbox/checkboxTypes.d.ts +2 -0
- package/dist/components/core/Checkbox/index.d.ts +1 -1
- package/dist/components/core/Checkbox/useCheckboxRootState.d.ts +4 -1
- package/dist/components/core/Checkbox/useCheckboxRootState.js +43 -30
- package/dist/components/core/CloseButton/CloseButton.js +2 -1
- package/dist/components/core/CloseButton/closeButtonAnimations.js +38 -9
- package/dist/components/core/CloseButton/closeButtonParts.js +3 -4
- package/dist/components/core/ColorPicker/ColorPicker.js +27 -8
- package/dist/components/core/ColorPicker/ColorSlider.d.ts +2 -0
- package/dist/components/core/ColorPicker/ColorSlider.js +131 -53
- package/dist/components/core/ColorPicker/ColorSwatch.js +22 -4
- package/dist/components/core/ColorPicker/colorPickerAnimations.d.ts +1 -1
- package/dist/components/core/ColorPicker/colorPickerAnimations.js +33 -8
- package/dist/components/core/ColorPicker/colorPickerParts.js +125 -32
- package/dist/components/core/ColorPicker/colorPickerStyles.d.ts +11 -3
- package/dist/components/core/ColorPicker/colorPickerStyles.js +13 -3
- package/dist/components/core/ColorPicker/colorPickerTypes.d.ts +4 -0
- package/dist/components/core/ColorPicker/colorSliderStyles.d.ts +2 -2
- package/dist/components/core/ColorPicker/colorSliderStyles.js +4 -4
- package/dist/components/core/ColorPicker/colorSliderTypes.d.ts +2 -0
- package/dist/components/core/ColorPicker/colorSwatchStyles.d.ts +1 -0
- package/dist/components/core/ColorPicker/colorSwatchStyles.js +4 -0
- package/dist/components/core/ColorPicker/colorUtils.d.ts +2 -1
- package/dist/components/core/ColorPicker/colorUtils.js +33 -10
- package/dist/components/core/ColorPicker/index.d.ts +2 -0
- package/dist/components/core/ColorPicker/useColorPickerRootState.d.ts +3 -1
- package/dist/components/core/ColorPicker/useColorPickerRootState.js +65 -30
- package/dist/components/core/ComboBox/ComboBox.js +13 -1
- package/dist/components/core/ComboBox/comboBoxAnimations.d.ts +3 -2
- package/dist/components/core/ComboBox/comboBoxAnimations.js +5 -2
- package/dist/components/core/ComboBox/comboBoxFieldParts.js +1 -1
- package/dist/components/core/ComboBox/comboBoxParts.d.ts +3 -1
- package/dist/components/core/ComboBox/comboBoxParts.js +114 -28
- package/dist/components/core/ComboBox/comboBoxStyles.d.ts +4 -4
- package/dist/components/core/ComboBox/comboBoxStyles.js +4 -4
- package/dist/components/core/ComboBox/comboBoxTypes.d.ts +5 -0
- package/dist/components/core/ComboBox/useComboBoxInputState.d.ts +3 -2
- package/dist/components/core/ComboBox/useComboBoxInputState.js +130 -62
- package/dist/components/core/ComboBox/useComboBoxRootState.js +44 -18
- package/dist/components/core/Container/Container.js +3 -0
- package/dist/components/core/Container/containerStyles.d.ts +2 -1
- package/dist/components/core/Container/containerStyles.js +2 -1
- package/dist/components/core/ContextMenu/ContextMenu.d.ts +3 -1
- package/dist/components/core/ContextMenu/ContextMenu.js +177 -19
- package/dist/components/core/ContextMenu/contextMenuStyles.d.ts +1 -1
- package/dist/components/core/ContextMenu/contextMenuStyles.js +1 -1
- package/dist/components/core/ContextMenu/index.d.ts +3 -1
- package/dist/components/core/DatePicker/DatePicker.js +8 -3
- package/dist/components/core/DatePicker/datePickerAPI.d.ts +2 -0
- package/dist/components/core/DatePicker/datePickerAPI.js +43 -0
- package/dist/components/core/DatePicker/datePickerAnimations.d.ts +2 -1
- package/dist/components/core/DatePicker/datePickerAnimations.js +9 -5
- package/dist/components/core/DatePicker/datePickerParts.js +29 -5
- package/dist/components/core/DatePicker/datePickerStyles.d.ts +2 -2
- package/dist/components/core/DatePicker/datePickerStyles.js +2 -2
- package/dist/components/core/DatePicker/datePickerTypes.d.ts +2 -0
- package/dist/components/core/DatePicker/useDatePickerRootState.d.ts +2 -0
- package/dist/components/core/DatePicker/useDatePickerRootState.js +63 -24
- package/dist/components/core/Dialog/Dialog.d.ts +1 -1
- package/dist/components/core/Dialog/Dialog.js +2 -0
- package/dist/components/core/Dialog/dialogAnimations.d.ts +1 -0
- package/dist/components/core/Dialog/dialogAnimations.js +1 -0
- package/dist/components/core/Dialog/dialogParts.d.ts +1 -1
- package/dist/components/core/Dialog/dialogParts.js +8 -3
- package/dist/components/core/Dialog/dialogStyles.d.ts +1 -1
- package/dist/components/core/Dialog/dialogStyles.js +2 -2
- package/dist/components/core/Dialog/dialogTypes.d.ts +4 -1
- package/dist/components/core/Dialog/useDialogRootState.d.ts +1 -1
- package/dist/components/core/Dialog/useDialogRootState.js +2 -0
- package/dist/components/core/Disclosure/Disclosure.js +10 -4
- package/dist/components/core/Disclosure/disclosureAnimations.js +7 -5
- package/dist/components/core/Disclosure/disclosureContentPart.js +3 -0
- package/dist/components/core/Disclosure/disclosureParts.js +29 -20
- package/dist/components/core/Disclosure/disclosureStyles.d.ts +1 -1
- package/dist/components/core/Disclosure/disclosureStyles.js +3 -3
- package/dist/components/core/Disclosure/useDisclosureContentDrag.js +3 -1
- package/dist/components/core/Disclosure/useDisclosureGroupRootState.js +17 -7
- package/dist/components/core/Disclosure/useDisclosureRootState.js +12 -12
- package/dist/components/core/Drawer/Drawer.d.ts +1 -1
- package/dist/components/core/Drawer/Drawer.js +2 -0
- package/dist/components/core/Drawer/drawerAnimations.d.ts +1 -0
- package/dist/components/core/Drawer/drawerAnimations.js +1 -0
- package/dist/components/core/Drawer/drawerParts.js +14 -9
- package/dist/components/core/Drawer/drawerStyles.d.ts +1 -1
- package/dist/components/core/Drawer/drawerStyles.js +2 -2
- package/dist/components/core/Drawer/drawerTypes.d.ts +4 -1
- package/dist/components/core/Drawer/useDrawerHandleDrag.d.ts +2 -0
- package/dist/components/core/Drawer/useDrawerHandleDrag.js +117 -35
- package/dist/components/core/Drawer/useDrawerRootState.d.ts +1 -1
- package/dist/components/core/Drawer/useDrawerRootState.js +3 -0
- package/dist/components/core/Dropdown/dropdownA11y.js +4 -1
- package/dist/components/core/Dropdown/dropdownAnimations.d.ts +3 -2
- package/dist/components/core/Dropdown/dropdownAnimations.js +79 -29
- package/dist/components/core/Dropdown/dropdownItemParts.d.ts +3 -1
- package/dist/components/core/Dropdown/dropdownItemParts.js +25 -5
- package/dist/components/core/Dropdown/dropdownParts.js +40 -11
- package/dist/components/core/Dropdown/dropdownStyles.d.ts +3 -3
- package/dist/components/core/Dropdown/dropdownStyles.js +3 -3
- package/dist/components/core/Dropdown/dropdownSubParts.js +47 -16
- package/dist/components/core/Dropdown/dropdownTypes.d.ts +13 -2
- package/dist/components/core/Dropdown/index.d.ts +3 -1
- package/dist/components/core/Dropdown/useDropdownItemState.d.ts +5 -1
- package/dist/components/core/Dropdown/useDropdownItemState.js +3 -1
- package/dist/components/core/Dropdown/useDropdownRootState.js +16 -5
- package/dist/components/core/Expandable/expandableA11y.d.ts +1 -0
- package/dist/components/core/Expandable/expandableA11y.js +5 -0
- package/dist/components/core/Expandable/expandableAPI.d.ts +1 -0
- package/dist/components/core/Expandable/expandableAPI.js +19 -11
- package/dist/components/core/Expandable/expandableAnimations.d.ts +1 -1
- package/dist/components/core/Expandable/expandableAnimations.js +9 -9
- package/dist/components/core/Expandable/expandableParts.js +31 -23
- package/dist/components/core/Expandable/expandableStyles.d.ts +1 -1
- package/dist/components/core/Expandable/expandableStyles.js +1 -1
- package/dist/components/core/Expandable/useExpandableRootState.js +5 -3
- package/dist/components/core/Field/fieldParts.d.ts +2 -2
- package/dist/components/core/Field/fieldParts.js +2 -1
- package/dist/components/core/Field/fieldStyles.js +1 -1
- package/dist/components/core/Grid/Grid.js +3 -0
- package/dist/components/core/Grid/gridStyles.d.ts +2 -1
- package/dist/components/core/Grid/gridStyles.js +2 -1
- package/dist/components/core/Header/Header.js +3 -1
- package/dist/components/core/Header/headerStyles.d.ts +3 -2
- package/dist/components/core/Header/headerStyles.js +9 -2
- package/dist/components/core/HoverCard/hoverCardParts.js +23 -11
- package/dist/components/core/Input/inputAffixParts.js +6 -0
- package/dist/components/core/Input/inputAnimations.js +3 -1
- package/dist/components/core/Input/inputControlParts.js +48 -14
- package/dist/components/core/Input/inputFieldParts.js +1 -1
- package/dist/components/core/Input/inputStyles.d.ts +5 -5
- package/dist/components/core/Input/inputStyles.js +5 -5
- package/dist/components/core/Input/inputTypes.d.ts +1 -0
- package/dist/components/core/Input/useInputRootState.js +2 -1
- package/dist/components/core/Kbd/Kbd.js +3 -1
- package/dist/components/core/Kbd/kbdAnimations.js +16 -4
- package/dist/components/core/Kbd/kbdParts.js +6 -4
- package/dist/components/core/Kbd/kbdStyles.d.ts +1 -1
- package/dist/components/core/Kbd/kbdStyles.js +1 -1
- package/dist/components/core/Kbd/kbdTextPart.js +5 -2
- package/dist/components/core/Kbd/useKbdRootState.js +6 -2
- package/dist/components/core/Label/Label.d.ts +2 -1
- package/dist/components/core/Label/Label.js +8 -1
- package/dist/components/core/Label/labelParts.d.ts +1 -0
- package/dist/components/core/Label/labelTypes.d.ts +3 -1
- package/dist/components/core/Label/useLabelRootState.d.ts +2 -1
- package/dist/components/core/Label/useLabelRootState.js +3 -1
- package/dist/components/core/Link/Link.d.ts +1 -1
- package/dist/components/core/Link/Link.js +38 -25
- package/dist/components/core/Link/linkAPI.d.ts +3 -1
- package/dist/components/core/Link/linkAPI.js +8 -4
- package/dist/components/core/Link/linkAnchorBodyPart.d.ts +2 -2
- package/dist/components/core/Link/linkAnchorBodyPart.js +48 -8
- package/dist/components/core/Link/linkAnimations.d.ts +1 -1
- package/dist/components/core/Link/linkAnimations.js +29 -14
- package/dist/components/core/Link/linkIconSlotPart.d.ts +1 -1
- package/dist/components/core/Link/linkIconSlotPart.js +3 -3
- package/dist/components/core/Link/linkStyles.d.ts +5 -3
- package/dist/components/core/Link/linkStyles.js +6 -3
- package/dist/components/core/Link/linkTypes.d.ts +14 -1
- package/dist/components/core/Link/useLinkRootState.d.ts +2 -0
- package/dist/components/core/ListBox/ListBox.d.ts +1 -0
- package/dist/components/core/ListBox/ListBox.js +2 -0
- package/dist/components/core/ListBox/index.d.ts +1 -0
- package/dist/components/core/ListBox/listBoxAnimations.d.ts +5 -2
- package/dist/components/core/ListBox/listBoxAnimations.js +15 -3
- package/dist/components/core/ListBox/listBoxParts.js +21 -5
- package/dist/components/core/ListBox/listBoxStyles.d.ts +3 -3
- package/dist/components/core/ListBox/listBoxStyles.js +3 -3
- package/dist/components/core/ListBox/listBoxTypes.d.ts +5 -1
- package/dist/components/core/ListBox/useListBoxItemState.d.ts +1 -1
- package/dist/components/core/ListBox/useListBoxRootState.d.ts +1 -1
- package/dist/components/core/ListBox/useListBoxRootState.js +31 -6
- package/dist/components/core/ListBox/useListBoxVirtualWindow.d.ts +1 -0
- package/dist/components/core/ListBox/useListBoxVirtualWindow.js +11 -4
- package/dist/components/core/Loading/Loading.js +1 -1
- package/dist/components/core/Loading/loadingAnimations.d.ts +2 -2
- package/dist/components/core/Loading/loadingAnimations.js +12 -5
- package/dist/components/core/Loading/loadingParts.js +1 -1
- package/dist/components/core/Loading/loadingStyles.js +1 -1
- package/dist/components/core/Meter/Meter.js +21 -3
- package/dist/components/core/Meter/meterAPI.d.ts +4 -0
- package/dist/components/core/Meter/meterAPI.js +13 -2
- package/dist/components/core/Meter/meterParts.js +6 -2
- package/dist/components/core/Meter/meterStyles.d.ts +1 -1
- package/dist/components/core/Meter/meterStyles.js +1 -1
- package/dist/components/core/Meter/meterTypes.d.ts +1 -0
- package/dist/components/core/Meter/useMeterRootState.js +3 -2
- package/dist/components/core/Meter/useMeterTrackState.d.ts +1 -1
- package/dist/components/core/Meter/useMeterTrackState.js +15 -10
- package/dist/components/core/NumberInput/NumberInput.js +13 -2
- package/dist/components/core/NumberInput/numberInputParts.d.ts +4 -1
- package/dist/components/core/NumberInput/numberInputParts.js +30 -4
- package/dist/components/core/NumberInput/numberInputStyles.js +2 -2
- package/dist/components/core/NumberInput/useNumberInputRootState.js +47 -33
- package/dist/components/core/Pagination/paginationAPI.d.ts +4 -1
- package/dist/components/core/Pagination/paginationAPI.js +60 -17
- package/dist/components/core/Pagination/paginationAnimations.js +6 -0
- package/dist/components/core/Pagination/paginationParts.d.ts +1 -1
- package/dist/components/core/Pagination/paginationParts.js +82 -22
- package/dist/components/core/Pagination/paginationStyles.d.ts +7 -6
- package/dist/components/core/Pagination/paginationStyles.js +7 -6
- package/dist/components/core/Pagination/paginationTypes.d.ts +1 -0
- package/dist/components/core/Pagination/usePaginationRootState.js +12 -6
- package/dist/components/core/PinInput/pinInputAnimations.d.ts +6 -1
- package/dist/components/core/PinInput/pinInputAnimations.js +13 -4
- package/dist/components/core/PinInput/pinInputParts.js +84 -20
- package/dist/components/core/PinInput/pinInputStyles.d.ts +1 -1
- package/dist/components/core/PinInput/pinInputStyles.js +2 -2
- package/dist/components/core/PinInput/pinInputTypes.d.ts +4 -0
- package/dist/components/core/PinInput/usePinInputRootState.js +71 -33
- package/dist/components/core/Popover/popoverAnimations.d.ts +1 -0
- package/dist/components/core/Popover/popoverAnimations.js +33 -7
- package/dist/components/core/Popover/popoverParts.js +62 -14
- package/dist/components/core/Popover/popoverStyles.d.ts +1 -1
- package/dist/components/core/Popover/popoverStyles.js +1 -1
- package/dist/components/core/Popover/popoverTypes.d.ts +1 -0
- package/dist/components/core/Popover/usePopoverRootState.js +46 -14
- package/dist/components/core/ProgressBar/ProgressBar.js +21 -3
- package/dist/components/core/ProgressBar/progressBarA11y.d.ts +1 -1
- package/dist/components/core/ProgressBar/progressBarA11y.js +4 -2
- package/dist/components/core/ProgressBar/progressBarAPI.d.ts +4 -0
- package/dist/components/core/ProgressBar/progressBarAPI.js +13 -2
- package/dist/components/core/ProgressBar/progressBarParts.js +6 -2
- package/dist/components/core/ProgressBar/progressBarStyles.d.ts +1 -1
- package/dist/components/core/ProgressBar/progressBarStyles.js +1 -1
- package/dist/components/core/ProgressBar/progressBarTypes.d.ts +3 -0
- package/dist/components/core/ProgressBar/useProgressBarRootState.js +6 -3
- package/dist/components/core/ProgressBar/useProgressBarTrackState.d.ts +1 -1
- package/dist/components/core/ProgressBar/useProgressBarTrackState.js +18 -11
- package/dist/components/core/Radio/Radio.js +6 -1
- package/dist/components/core/Radio/radioParts.js +6 -3
- package/dist/components/core/Radio/radioStyles.d.ts +3 -3
- package/dist/components/core/Radio/radioStyles.js +3 -3
- package/dist/components/core/Radio/radioTypes.d.ts +1 -0
- package/dist/components/core/Radio/useRadioRootState.d.ts +5 -2
- package/dist/components/core/Radio/useRadioRootState.js +80 -36
- package/dist/components/core/Resizable/Resizable.js +185 -20
- package/dist/components/core/Resizable/index.d.ts +1 -0
- package/dist/components/core/Resizable/resizableAnimations.js +1 -1
- package/dist/components/core/Resizable/resizableParts.d.ts +1 -0
- package/dist/components/core/Resizable/resizableParts.js +96 -42
- package/dist/components/core/Resizable/resizableStyles.d.ts +3 -2
- package/dist/components/core/Resizable/resizableStyles.js +3 -2
- package/dist/components/core/Resizable/resizableTypes.d.ts +10 -2
- package/dist/components/core/Ripple/Ripple.js +3 -2
- package/dist/components/core/Ripple/rippleAPI.d.ts +1 -0
- package/dist/components/core/Ripple/rippleAPI.js +7 -0
- package/dist/components/core/Ripple/rippleStyles.d.ts +1 -1
- package/dist/components/core/Ripple/rippleStyles.js +1 -1
- package/dist/components/core/ScrollArea/ScrollArea.js +1 -1
- package/dist/components/core/ScrollArea/scrollAreaAPI.d.ts +11 -2
- package/dist/components/core/ScrollArea/scrollAreaAPI.js +65 -9
- package/dist/components/core/ScrollArea/scrollAreaParts.js +31 -10
- package/dist/components/core/ScrollArea/scrollAreaStyles.d.ts +1 -1
- package/dist/components/core/ScrollArea/scrollAreaStyles.js +1 -1
- package/dist/components/core/ScrollArea/scrollAreaTypes.d.ts +4 -0
- package/dist/components/core/ScrollArea/useScrollAreaRootState.d.ts +1 -1
- package/dist/components/core/ScrollArea/useScrollAreaRootState.js +49 -10
- package/dist/components/core/SearchInput/SearchInput.js +24 -9
- package/dist/components/core/SearchInput/searchInputAnimations.d.ts +7 -6
- package/dist/components/core/SearchInput/searchInputAnimations.js +23 -18
- package/dist/components/core/SearchInput/searchInputParts.d.ts +2 -2
- package/dist/components/core/SearchInput/searchInputParts.js +22 -10
- package/dist/components/core/SearchInput/searchInputStyles.d.ts +5 -3
- package/dist/components/core/SearchInput/searchInputStyles.js +6 -5
- package/dist/components/core/SearchInput/searchInputTypes.d.ts +1 -0
- package/dist/components/core/SearchInput/useSearchInputRootState.d.ts +3 -3
- package/dist/components/core/SearchInput/useSearchInputRootState.js +52 -34
- package/dist/components/core/Select/Select.js +13 -1
- package/dist/components/core/Select/selectAnimations.d.ts +3 -2
- package/dist/components/core/Select/selectAnimations.js +5 -2
- package/dist/components/core/Select/selectParts.d.ts +3 -1
- package/dist/components/core/Select/selectParts.js +2 -1
- package/dist/components/core/Select/selectStyles.d.ts +3 -3
- package/dist/components/core/Select/selectStyles.js +3 -3
- package/dist/components/core/Select/selectTriggerParts.js +79 -28
- package/dist/components/core/Select/selectTypes.d.ts +1 -0
- package/dist/components/core/Select/useSelectRootState.js +33 -16
- package/dist/components/core/SelectionIndicator/selectionIndicatorAnimations.js +23 -3
- package/dist/components/core/SelectionThumb/SelectionThumb.js +1 -1
- package/dist/components/core/Separator/Separator.d.ts +2 -1
- package/dist/components/core/Separator/Separator.js +3 -1
- package/dist/components/core/Separator/index.d.ts +1 -1
- package/dist/components/core/Separator/separatorStyles.d.ts +2 -2
- package/dist/components/core/Separator/separatorStyles.js +2 -2
- package/dist/components/core/Separator/separatorTypes.d.ts +4 -0
- package/dist/components/core/Sidebar/Sidebar.js +15 -2
- package/dist/components/core/Sidebar/sidebarAnimations.d.ts +2 -2
- package/dist/components/core/Sidebar/sidebarAnimations.js +4 -3
- package/dist/components/core/Sidebar/sidebarStyles.d.ts +2 -1
- package/dist/components/core/Sidebar/sidebarStyles.js +2 -1
- package/dist/components/core/Skeleton/skeletonParts.js +8 -5
- package/dist/components/core/Skeleton/skeletonStyles.d.ts +10 -0
- package/dist/components/core/Skeleton/skeletonStyles.js +20 -0
- package/dist/components/core/Slider/Slider.js +9 -3
- package/dist/components/core/Slider/sliderAPI.d.ts +5 -4
- package/dist/components/core/Slider/sliderAPI.js +86 -42
- package/dist/components/core/Slider/sliderAnimations.d.ts +1 -1
- package/dist/components/core/Slider/sliderAnimations.js +2 -2
- package/dist/components/core/Slider/sliderParts.js +11 -2
- package/dist/components/core/Slider/sliderStyles.d.ts +4 -4
- package/dist/components/core/Slider/sliderStyles.js +18 -6
- package/dist/components/core/Slider/sliderThumbParts.d.ts +2 -0
- package/dist/components/core/Slider/sliderThumbParts.js +16 -4
- package/dist/components/core/Slider/sliderTrackParts.js +10 -4
- package/dist/components/core/Slider/sliderTypes.d.ts +9 -1
- package/dist/components/core/Slider/useSliderRootState.d.ts +3 -2
- package/dist/components/core/Slider/useSliderRootState.js +104 -49
- package/dist/components/core/Slider/useSliderTrackState.js +198 -39
- package/dist/components/core/Stack/Stack.js +3 -0
- package/dist/components/core/Stack/stackStyles.d.ts +2 -1
- package/dist/components/core/Stack/stackStyles.js +2 -1
- package/dist/components/core/Stepper/index.d.ts +10 -1
- package/dist/components/core/Stepper/stepperAPI.d.ts +2 -2
- package/dist/components/core/Stepper/stepperAPI.js +4 -3
- package/dist/components/core/Stepper/stepperAnimations.d.ts +1 -0
- package/dist/components/core/Stepper/stepperAnimations.js +28 -2
- package/dist/components/core/Stepper/stepperParts.d.ts +11 -2
- package/dist/components/core/Stepper/stepperParts.js +38 -9
- package/dist/components/core/Stepper/stepperStyles.js +3 -1
- package/dist/components/core/Stepper/stepperTypes.d.ts +3 -2
- package/dist/components/core/Stepper/useStepperRootState.js +10 -3
- package/dist/components/core/Surface/Surface.js +3 -1
- package/dist/components/core/Switch/Switch.js +12 -1
- package/dist/components/core/Switch/switchAPI.d.ts +2 -0
- package/dist/components/core/Switch/switchAPI.js +18 -1
- package/dist/components/core/Switch/switchAnimations.js +29 -9
- package/dist/components/core/Switch/switchControlParts.js +93 -30
- package/dist/components/core/Switch/switchGeometry.js +2 -2
- package/dist/components/core/Switch/switchSimpleParts.d.ts +2 -1
- package/dist/components/core/Switch/switchSimpleParts.js +3 -1
- package/dist/components/core/Switch/switchStyles.d.ts +3 -3
- package/dist/components/core/Switch/switchStyles.js +3 -3
- package/dist/components/core/Switch/switchTypes.d.ts +8 -0
- package/dist/components/core/Switch/useSwitchRootState.js +54 -17
- package/dist/components/core/Table/Table.d.ts +1 -0
- package/dist/components/core/Table/Table.js +2 -0
- package/dist/components/core/Table/index.d.ts +1 -0
- package/dist/components/core/Table/tableAPI.d.ts +6 -1
- package/dist/components/core/Table/tableAPI.js +73 -5
- package/dist/components/core/Table/tableContext.js +6 -1
- package/dist/components/core/Table/tableParts.js +77 -34
- package/dist/components/core/Table/tableStyles.d.ts +13 -2
- package/dist/components/core/Table/tableStyles.js +26 -3
- package/dist/components/core/Table/tableTypes.d.ts +4 -0
- package/dist/components/core/Table/tableVirtualRows.js +140 -27
- package/dist/components/core/Table/useTableContentState.d.ts +2 -1
- package/dist/components/core/Table/useTableContentState.js +32 -6
- package/dist/components/core/Tabs/tabsA11y.d.ts +4 -3
- package/dist/components/core/Tabs/tabsA11y.js +5 -4
- package/dist/components/core/Tabs/tabsContext.d.ts +5 -0
- package/dist/components/core/Tabs/tabsContext.js +12 -0
- package/dist/components/core/Tabs/tabsPanelPart.js +11 -1
- package/dist/components/core/Tabs/tabsParts.js +70 -32
- package/dist/components/core/Tabs/tabsStyles.d.ts +5 -2
- package/dist/components/core/Tabs/tabsStyles.js +13 -4
- package/dist/components/core/Tabs/tabsTabPart.js +55 -50
- package/dist/components/core/Tabs/tabsTypes.d.ts +2 -2
- package/dist/components/core/Tabs/useSlidingTabIndicator.d.ts +1 -1
- package/dist/components/core/Tabs/useSlidingTabIndicator.js +25 -10
- package/dist/components/core/Tabs/useTabsRootState.js +13 -5
- package/dist/components/core/TagsInput/TagsInput.js +13 -2
- package/dist/components/core/TagsInput/index.d.ts +2 -0
- package/dist/components/core/TagsInput/tagsInputParts.d.ts +6 -2
- package/dist/components/core/TagsInput/tagsInputParts.js +81 -14
- package/dist/components/core/TagsInput/tagsInputStyles.js +2 -2
- package/dist/components/core/TagsInput/tagsInputTypes.d.ts +3 -0
- package/dist/components/core/TagsInput/useTagsInputRootState.js +78 -33
- package/dist/components/core/Text/Text.d.ts +2 -1
- package/dist/components/core/Text/Text.js +3 -1
- package/dist/components/core/Text/index.d.ts +1 -1
- package/dist/components/core/Text/textTypes.d.ts +4 -0
- package/dist/components/core/TextArea/textAreaAnimations.js +5 -3
- package/dist/components/core/TextArea/textAreaParts.js +94 -12
- package/dist/components/core/TextArea/textAreaStyles.d.ts +3 -3
- package/dist/components/core/TextArea/textAreaStyles.js +2 -2
- package/dist/components/core/TextArea/textAreaTypes.d.ts +1 -0
- package/dist/components/core/TextArea/useTextAreaRootState.js +2 -1
- package/dist/components/core/TimeField/TimeField.js +6 -1
- package/dist/components/core/TimeField/timeFieldAnimations.d.ts +3 -2
- package/dist/components/core/TimeField/timeFieldAnimations.js +13 -4
- package/dist/components/core/TimeField/timeFieldParts.js +50 -30
- package/dist/components/core/TimeField/timeFieldStyles.d.ts +1 -1
- package/dist/components/core/TimeField/timeFieldStyles.js +1 -1
- package/dist/components/core/TimeField/timeFieldTypes.d.ts +2 -0
- package/dist/components/core/TimeField/useTimeFieldControlState.d.ts +4 -1
- package/dist/components/core/TimeField/useTimeFieldControlState.js +141 -39
- package/dist/components/core/TimeField/useTimeFieldRootState.js +3 -1
- package/dist/components/core/Toast/toastA11y.js +17 -7
- package/dist/components/core/Toast/toastAPI.d.ts +17 -1
- package/dist/components/core/Toast/toastAPI.js +82 -0
- package/dist/components/core/Toast/toastAnimations.d.ts +1 -1
- package/dist/components/core/Toast/toastAnimations.js +106 -98
- package/dist/components/core/Toast/toastProvider.js +25 -3
- package/dist/components/core/Toast/toastStyles.d.ts +5 -3
- package/dist/components/core/Toast/toastStyles.js +5 -3
- package/dist/components/core/Toast/toastTypes.d.ts +9 -0
- package/dist/components/core/Toast/useToastProviderState.js +61 -6
- package/dist/components/core/ToggleButton/ToggleButton.js +23 -7
- package/dist/components/core/ToggleButton/toggleButtonAnimations.d.ts +4 -2
- package/dist/components/core/ToggleButton/toggleButtonAnimations.js +64 -41
- package/dist/components/core/ToggleButton/toggleButtonStyles.d.ts +2 -1
- package/dist/components/core/ToggleButton/toggleButtonStyles.js +21 -2
- package/dist/components/core/ToggleButton/toggleButtonTypes.d.ts +3 -0
- package/dist/components/core/ToggleButton/useToggleButtonRootState.d.ts +1 -1
- package/dist/components/core/ToggleButton/useToggleButtonRootState.js +4 -7
- package/dist/components/core/Tooltip/tooltipAnimations.js +17 -1
- package/dist/components/core/Tooltip/tooltipParts.js +83 -26
- package/dist/components/core/Tooltip/tooltipPosition.js +57 -32
- package/dist/components/core/Tooltip/tooltipStyles.d.ts +2 -2
- package/dist/components/core/Tooltip/tooltipStyles.js +2 -2
- package/dist/components/core/Tooltip/tooltipTypes.d.ts +5 -0
- package/dist/components/core/Tooltip/useTooltipRootState.js +59 -10
- package/dist/components/core/utils/bodyScrollLock.js +12 -3
- package/dist/components/core/utils/clampNumber.d.ts +1 -1
- package/dist/components/core/utils/clampNumber.js +4 -1
- package/dist/components/core/utils/containedEscape.js +12 -0
- package/dist/components/core/utils/fieldFormDom.d.ts +24 -0
- package/dist/components/core/utils/fieldFormDom.js +37 -2
- package/dist/components/core/utils/focusElement.js +2 -2
- package/dist/components/core/utils/hoverInteractiveLift.d.ts +12 -0
- package/dist/components/core/utils/hoverInteractiveLift.js +43 -2
- package/dist/components/core/utils/inputAffixStyles.js +1 -1
- package/dist/components/core/utils/mergeAsChildProps.d.ts +7 -0
- package/dist/components/core/utils/mergeAsChildProps.js +23 -2
- package/dist/components/core/utils/optionListItemStyles.d.ts +2 -2
- package/dist/components/core/utils/optionListItemStyles.js +2 -2
- package/dist/components/core/utils/overlayLayer.d.ts +39 -0
- package/dist/components/core/utils/overlayLayer.js +164 -2
- package/dist/components/core/utils/overlayTriggerSqueeze.js +5 -4
- package/dist/components/core/utils/portalContainer.d.ts +27 -5
- package/dist/components/core/utils/portalContainer.js +38 -4
- package/dist/components/core/utils/pressRipple.js +2 -1
- package/dist/components/core/utils/readingDirection.js +8 -0
- package/dist/components/core/utils/runOpenAfterSqueeze.d.ts +7 -0
- package/dist/components/core/utils/runOpenAfterSqueeze.js +10 -3
- package/dist/components/core/utils/semanticStatusSurface.js +4 -4
- package/dist/components/core/utils/sizeLayout/panel.js +4 -4
- package/dist/components/core/utils/slotMotion/recipes/loadKitRecipe.js +2 -0
- package/dist/components/core/utils/slotMotion/recipes/switchThumb.js +3 -0
- package/dist/components/core/utils/slotMotion/resolveMotionValue.js +1 -1
- package/dist/components/core/utils/slotMotion/slotMount.js +1 -1
- package/dist/components/core/utils/slotMotion/useBarFillMotion.js +8 -3
- package/dist/components/core/utils/useCollapsibleHeight.js +2 -1
- package/dist/components/core/utils/useConvergeRipples.js +4 -1
- package/dist/components/core/utils/useModalMotion.d.ts +2 -0
- package/dist/components/core/utils/useModalMotion.js +19 -3
- package/dist/components/core/utils/usePressableElementTextMotion.js +4 -5
- package/dist/components/core/utils/useShadowMotion.js +28 -7
- package/dist/index.d.ts +3 -3
- package/dist/skins/resolveVariantVisual.d.ts +1 -1
- package/dist/skins/resolveVariantVisual.js +2 -2
- package/dist/skins/skinContext.js +6 -5
- package/dist/skins/skinLiveSlots.generated.d.ts +1 -1
- package/dist/skins/skinLiveSlots.generated.js +1 -1
- package/dist/skins/skinShell.js +9 -4
- package/dist/skins/skinSlots.generated.d.ts +1 -1
- package/dist/skins/skinSlots.generated.js +2 -0
- package/dist/studio/colorPresets.d.ts +1 -1
- package/dist/studio/colorPresets.js +8 -1
- package/dist/studio.d.ts +1 -1
- package/dist/studio.js +13 -1
- package/dist/theme/namedPalettes.d.ts +12 -0
- package/dist/theme/namedPalettes.js +697 -1
- package/dist/theme/themeDefaults.js +6 -3
- package/dist/tokens/config.d.ts +8 -2
- package/dist/tokens/config.js +15 -2
- package/dist/tokens/index.d.ts +1 -1
- package/dist/tokens/index.js +9 -0
- package/dist/ui.css +499 -55
- package/dist/utils/cn.js +89 -2
- package/package.json +1 -1
- package/dist/components/composite/utils/useOptionGroupRequiredAnchor.js +0 -17
- package/dist/components/composite/utils/useOptionGroupSingleValue.js +0 -24
|
@@ -9,6 +9,7 @@ function DrawerRoot({
|
|
|
9
9
|
onOpenChange,
|
|
10
10
|
placement = "right",
|
|
11
11
|
size = "base",
|
|
12
|
+
variant,
|
|
12
13
|
children,
|
|
13
14
|
classNames,
|
|
14
15
|
motion,
|
|
@@ -24,6 +25,7 @@ function DrawerRoot({
|
|
|
24
25
|
onOpenChange,
|
|
25
26
|
placement,
|
|
26
27
|
size,
|
|
28
|
+
variant,
|
|
27
29
|
portalContainer
|
|
28
30
|
});
|
|
29
31
|
return /* @__PURE__ */ jsx(DrawerProvider, { value: state.contextValue, children: /* @__PURE__ */ jsx(DrawerClassNamesProvider, { classNames, children: /* @__PURE__ */ jsx(
|
|
@@ -8,6 +8,7 @@ export declare function useDrawerModalMotion({ open, onOpenChange, placement, cl
|
|
|
8
8
|
}): {
|
|
9
9
|
showPortal: boolean;
|
|
10
10
|
mounted: boolean;
|
|
11
|
+
layerId: symbol;
|
|
11
12
|
dialogRef: import('react').RefObject<HTMLDialogElement | null>;
|
|
12
13
|
overlayRef: import('react').RefObject<HTMLDivElement | null>;
|
|
13
14
|
panelRef: import('react').RefObject<HTMLDivElement | null>;
|
|
@@ -7,6 +7,7 @@ import { dataOpenState, dataVariantProps } from "../utils/dataContract.js";
|
|
|
7
7
|
import { mergeAsChildProps } from "../utils/mergeAsChildProps.js";
|
|
8
8
|
import { mergeRefs } from "../utils/mergeRefs.js";
|
|
9
9
|
import { isContainedPortal, resolvePortalContainer, isOwnNativeDialogEvent } from "../utils/portalContainer.js";
|
|
10
|
+
import { OverlayLayerProvider } from "../utils/overlayLayer.js";
|
|
10
11
|
import { useSkinVariant, useSkinRegistryRevision, useSkinSurfaceStyle, mergeSkinSurfaceStyle, useApplySkinPortal } from "../../../skins/skinContext.js";
|
|
11
12
|
import { SkinShell } from "../../../skins/skinShell.js";
|
|
12
13
|
import { focusElement } from "../utils/focusElement.js";
|
|
@@ -70,17 +71,18 @@ const DrawerHandleInner = forwardRef(function DrawerHandleInner2({
|
|
|
70
71
|
placement,
|
|
71
72
|
overlayRef,
|
|
72
73
|
panelRef,
|
|
73
|
-
skipCloseAnimRef
|
|
74
|
+
skipCloseAnimRef,
|
|
75
|
+
closeOnInteractOutside
|
|
74
76
|
} = useDrawer();
|
|
75
77
|
const slotClassNames = useDrawerClassNames();
|
|
76
78
|
const labels = useBurneLabels();
|
|
77
79
|
const close = () => onOpenChange(false);
|
|
78
|
-
const { onPointerDown: dragPD } = useDrawerHandleDrag(
|
|
80
|
+
const { onPointerDown: dragPD, consumeDragClick } = useDrawerHandleDrag(
|
|
79
81
|
panelRef,
|
|
80
82
|
overlayRef,
|
|
81
83
|
placement,
|
|
82
84
|
close,
|
|
83
|
-
false,
|
|
85
|
+
closeOnInteractOutside === false,
|
|
84
86
|
skipCloseAnimRef
|
|
85
87
|
);
|
|
86
88
|
const { setRef } = useMotionPart({
|
|
@@ -100,7 +102,7 @@ const DrawerHandleInner = forwardRef(function DrawerHandleInner2({
|
|
|
100
102
|
}),
|
|
101
103
|
onPointerDown: (e) => {
|
|
102
104
|
onPointerDown?.(e);
|
|
103
|
-
dragPD(e);
|
|
105
|
+
if (!e.defaultPrevented) dragPD(e);
|
|
104
106
|
},
|
|
105
107
|
...rest,
|
|
106
108
|
children: /* @__PURE__ */ jsx(
|
|
@@ -113,6 +115,7 @@ const DrawerHandleInner = forwardRef(function DrawerHandleInner2({
|
|
|
113
115
|
slotClass: slotClassNames.handleGrip
|
|
114
116
|
}),
|
|
115
117
|
onClick: () => {
|
|
118
|
+
if (consumeDragClick()) return;
|
|
116
119
|
close();
|
|
117
120
|
},
|
|
118
121
|
onKeyDown
|
|
@@ -469,8 +472,8 @@ DrawerTrigger.displayName = "Drawer.Trigger";
|
|
|
469
472
|
const DrawerPanel = forwardRef(
|
|
470
473
|
function DrawerPanel2({ motion, motionController, motionState, motionPayload, playInitialState, variant: variantProp, ...props }, forwardedRef) {
|
|
471
474
|
const parentScope = useOptionalDrawerMotionScope();
|
|
472
|
-
const { placement } = useDrawer();
|
|
473
|
-
const variant = useSkinVariant(variantProp);
|
|
475
|
+
const { placement, variant: rootVariant } = useDrawer();
|
|
476
|
+
const variant = useSkinVariant(variantProp ?? rootVariant);
|
|
474
477
|
const skinRevision = useSkinRegistryRevision();
|
|
475
478
|
const motionDefaults = useMemo(() => {
|
|
476
479
|
return resolveDrawerMotionDefaults(variant);
|
|
@@ -550,15 +553,17 @@ function DrawerPanelHost({
|
|
|
550
553
|
const fullContextValue = useMemo(
|
|
551
554
|
() => ({
|
|
552
555
|
...baseCtx,
|
|
556
|
+
variant,
|
|
557
|
+
closeOnInteractOutside: resolvedCloseOutside,
|
|
553
558
|
overlayRef: motion.overlayRef,
|
|
554
559
|
panelRef: motion.panelRef,
|
|
555
560
|
skipCloseAnimRef: motion.skipCloseAnimRef
|
|
556
561
|
}),
|
|
557
|
-
[baseCtx, motion.overlayRef, motion.panelRef, motion.skipCloseAnimRef]
|
|
562
|
+
[baseCtx, motion.overlayRef, motion.panelRef, motion.skipCloseAnimRef, resolvedCloseOutside, variant]
|
|
558
563
|
);
|
|
559
564
|
if (typeof document === "undefined" || !motion.showPortal || !portalHost) return null;
|
|
560
565
|
return createPortal(
|
|
561
|
-
/* @__PURE__ */ jsx(DrawerProvider, { value: fullContextValue, children: /* @__PURE__ */ jsx(
|
|
566
|
+
/* @__PURE__ */ jsx(OverlayLayerProvider, { layerId: motion.layerId, children: /* @__PURE__ */ jsx(DrawerProvider, { value: fullContextValue, children: /* @__PURE__ */ jsx(
|
|
562
567
|
DrawerPortalShell,
|
|
563
568
|
{
|
|
564
569
|
open,
|
|
@@ -588,7 +593,7 @@ function DrawerPanelHost({
|
|
|
588
593
|
},
|
|
589
594
|
contained
|
|
590
595
|
}
|
|
591
|
-
) }),
|
|
596
|
+
) }) }),
|
|
592
597
|
portalHost
|
|
593
598
|
);
|
|
594
599
|
}
|
|
@@ -3,7 +3,7 @@ import { DrawerExtent, DrawerPlacement, DrawerSize, DrawerSizePreset, DrawerVari
|
|
|
3
3
|
export declare const HANDLE_EDGE_PADDING_CLASS: Record<DrawerPlacement, string>;
|
|
4
4
|
export declare const DRAWER_SIZE: Record<DrawerSize, DrawerSizePreset>;
|
|
5
5
|
export declare const DRAWER_CONTENT_CLASS = "flex min-h-0 flex-1 flex-col text-start";
|
|
6
|
-
export declare const DRAWER_NATIVE_CLASS = "m-0 h-full w-full max-h-none max-w-none border-0 bg-transparent p-0 open:block [&::backdrop]:bg-transparent";
|
|
6
|
+
export declare const DRAWER_NATIVE_CLASS = "m-0 h-full w-full max-h-none max-w-none overflow-hidden border-0 bg-transparent p-0 open:block [&::backdrop]:bg-transparent";
|
|
7
7
|
export declare const DRAWER_NATIVE_POSITION_FIXED_CLASS = "fixed inset-0 z-dialog";
|
|
8
8
|
export declare const DRAWER_NATIVE_POSITION_CONTAINED_CLASS = "absolute inset-0 z-dialog portal-contained";
|
|
9
9
|
export declare function drawerNativeClass(contained: boolean): string;
|
|
@@ -80,7 +80,7 @@ const DRAWER_SIZE = {
|
|
|
80
80
|
large: toDrawerSizePreset("large")
|
|
81
81
|
};
|
|
82
82
|
const DRAWER_CONTENT_CLASS = "flex min-h-0 flex-1 flex-col text-start";
|
|
83
|
-
const DRAWER_NATIVE_CLASS = "m-0 h-full w-full max-h-none max-w-none border-0 bg-transparent p-0 open:block [&::backdrop]:bg-transparent";
|
|
83
|
+
const DRAWER_NATIVE_CLASS = "m-0 h-full w-full max-h-none max-w-none overflow-hidden border-0 bg-transparent p-0 open:block [&::backdrop]:bg-transparent";
|
|
84
84
|
const DRAWER_NATIVE_POSITION_FIXED_CLASS = "fixed inset-0 z-dialog";
|
|
85
85
|
const DRAWER_NATIVE_POSITION_CONTAINED_CLASS = "absolute inset-0 z-dialog portal-contained";
|
|
86
86
|
function drawerNativeClass(contained) {
|
|
@@ -126,7 +126,7 @@ function drawerOverlayClass({
|
|
|
126
126
|
slotClass
|
|
127
127
|
}) {
|
|
128
128
|
return cn(
|
|
129
|
-
"absolute inset-0",
|
|
129
|
+
"absolute inset-0 touch-none",
|
|
130
130
|
lightUi ? DRAWER_OVERLAY_LIGHT_CLASS : DRAWER_OVERLAY_DARK_CLASS,
|
|
131
131
|
dismissable ? "cursor-pointer" : "cursor-default",
|
|
132
132
|
slotClass
|
|
@@ -63,6 +63,7 @@ export type DrawerProps = {
|
|
|
63
63
|
placement?: DrawerPlacement;
|
|
64
64
|
/** Chrome density — padding, type, close/footer button sizes (`PANEL_SIZE_LAYOUT`). */
|
|
65
65
|
size?: DrawerSize;
|
|
66
|
+
variant?: DrawerVariant;
|
|
66
67
|
children?: ReactNode;
|
|
67
68
|
/** DOM node for the portal. Default: `document.body`. */
|
|
68
69
|
portalContainer?: HTMLElement | null;
|
|
@@ -111,6 +112,8 @@ export type DrawerContextValue = {
|
|
|
111
112
|
onOpenChange: (open: boolean) => void;
|
|
112
113
|
placement: DrawerPlacement;
|
|
113
114
|
size: DrawerSize;
|
|
115
|
+
variant?: DrawerVariant;
|
|
116
|
+
closeOnInteractOutside?: boolean;
|
|
114
117
|
sizePreset: DrawerSizePreset;
|
|
115
118
|
footerButtonSize: ButtonSize;
|
|
116
119
|
overlayRef: React.RefObject<HTMLDivElement | null>;
|
|
@@ -160,7 +163,7 @@ export type DrawerPanelSegment = {
|
|
|
160
163
|
kind: "content";
|
|
161
164
|
children: ReactNode[];
|
|
162
165
|
};
|
|
163
|
-
export type UseDrawerRootStateProps = Pick<DrawerProps, "open" | "defaultOpen" | "onOpenChange" | "size" | "portalContainer">;
|
|
166
|
+
export type UseDrawerRootStateProps = Pick<DrawerProps, "open" | "defaultOpen" | "onOpenChange" | "size" | "variant" | "portalContainer">;
|
|
164
167
|
export type UseDrawerPanelStateProps = {
|
|
165
168
|
open: boolean;
|
|
166
169
|
themeAnchor: HTMLElement | null | undefined;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { PointerEvent as ReactPointerEvent, RefObject } from 'react';
|
|
2
2
|
import { DrawerPlacement } from './drawerTypes.js';
|
|
3
|
+
export declare const DRAG_SLOP_PX = 4;
|
|
3
4
|
export declare function useDrawerHandleDrag(panelRef: RefObject<HTMLElement | null>, overlayRef: RefObject<HTMLElement | null>, placement: DrawerPlacement, onClose: () => void, disabled: boolean, skipCloseAnimRef?: RefObject<boolean>): {
|
|
4
5
|
onPointerDown: (e: ReactPointerEvent<HTMLElement>) => void;
|
|
6
|
+
consumeDragClick: () => boolean;
|
|
5
7
|
};
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { useCallback } from "react";
|
|
2
|
+
import { useRef, useEffect, useCallback } from "react";
|
|
3
3
|
import { prefersReducedMotion } from "../utils/reducedMotion.js";
|
|
4
4
|
import { killMotion } from "../utils/gsapMotion.js";
|
|
5
5
|
import { motionInteractiveFor } from "../utils/motionConfig.js";
|
|
6
6
|
import { useMotionConfig } from "../utils/motionConfigContext.js";
|
|
7
7
|
import gsap from "gsap";
|
|
8
|
+
const DRAG_SLOP_PX = 4;
|
|
8
9
|
const DISMISS_RATIO = 0.38;
|
|
9
10
|
const DISMISS_VELOCITY = 0.45;
|
|
10
11
|
function getDismissDelta(placement, panel) {
|
|
@@ -20,56 +21,146 @@ function setTranslate(el, axis, px) {
|
|
|
20
21
|
gsap.set(el, { [axis]: px });
|
|
21
22
|
}
|
|
22
23
|
function overlayOpacityForDrag(clamped, dismissDelta) {
|
|
23
|
-
const
|
|
24
|
+
const denom = Math.abs(dismissDelta);
|
|
25
|
+
if (denom <= 0) return 1;
|
|
26
|
+
const progress = Math.min(Math.abs(clamped) / denom, 1);
|
|
24
27
|
return 1 - progress;
|
|
25
28
|
}
|
|
26
29
|
function useDrawerHandleDrag(panelRef, overlayRef, placement, onClose, disabled, skipCloseAnimRef) {
|
|
27
30
|
const config = useMotionConfig();
|
|
31
|
+
const activeCleanupRef = useRef(null);
|
|
32
|
+
const didDragRef = useRef(false);
|
|
33
|
+
useEffect(() => {
|
|
34
|
+
return () => {
|
|
35
|
+
activeCleanupRef.current?.();
|
|
36
|
+
activeCleanupRef.current = null;
|
|
37
|
+
};
|
|
38
|
+
}, []);
|
|
39
|
+
const consumeDragClick = useCallback(() => {
|
|
40
|
+
if (!didDragRef.current) return false;
|
|
41
|
+
didDragRef.current = false;
|
|
42
|
+
return true;
|
|
43
|
+
}, []);
|
|
28
44
|
const onPointerDown = useCallback(
|
|
29
45
|
(e) => {
|
|
46
|
+
if (disabled) return;
|
|
47
|
+
if ((e.button ?? 0) !== 0) return;
|
|
30
48
|
const panel = panelRef.current;
|
|
31
49
|
const overlay = overlayRef.current;
|
|
32
50
|
if (!panel) return;
|
|
33
51
|
if (prefersReducedMotion()) return;
|
|
52
|
+
activeCleanupRef.current?.();
|
|
53
|
+
didDragRef.current = false;
|
|
34
54
|
const axis = getTranslateAxis(placement);
|
|
35
55
|
const isX = axis === "x";
|
|
56
|
+
const dismissDir = placement === "left" || placement === "top" ? -1 : 1;
|
|
36
57
|
const startClient = isX ? e.clientX : e.clientY;
|
|
58
|
+
const pointerId = e.pointerId;
|
|
59
|
+
const handle = e.currentTarget;
|
|
37
60
|
let lastClient = startClient;
|
|
38
61
|
let lastTime = performance.now();
|
|
39
62
|
let velocity = 0;
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
63
|
+
let maxTravel = 0;
|
|
64
|
+
let dragging = false;
|
|
65
|
+
let captured = false;
|
|
66
|
+
const clampDelta = (delta) => dismissDir > 0 ? Math.max(0, delta) : Math.min(0, delta);
|
|
67
|
+
const cleanupListeners = () => {
|
|
68
|
+
if (captured) {
|
|
69
|
+
captured = false;
|
|
70
|
+
try {
|
|
71
|
+
handle.releasePointerCapture?.(pointerId);
|
|
72
|
+
} catch {
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
window.removeEventListener("pointermove", onMove);
|
|
76
|
+
window.removeEventListener("pointerup", onUp);
|
|
77
|
+
window.removeEventListener("pointercancel", onCancel);
|
|
78
|
+
if (activeCleanupRef.current === cleanupListeners) {
|
|
79
|
+
activeCleanupRef.current = null;
|
|
80
|
+
}
|
|
81
|
+
};
|
|
45
82
|
const onMove = (ev) => {
|
|
46
|
-
if (ev.pointerId !==
|
|
83
|
+
if (ev.pointerId !== pointerId) return;
|
|
47
84
|
const client = isX ? ev.clientX : ev.clientY;
|
|
48
85
|
const delta = client - startClient;
|
|
86
|
+
const absDelta = Math.abs(delta);
|
|
87
|
+
if (absDelta > maxTravel) maxTravel = absDelta;
|
|
49
88
|
const now = performance.now();
|
|
50
89
|
const dt = now - lastTime;
|
|
51
90
|
if (dt > 0) velocity = (client - lastClient) / dt;
|
|
52
91
|
lastClient = client;
|
|
53
92
|
lastTime = now;
|
|
54
|
-
|
|
55
|
-
|
|
93
|
+
if (!dragging) {
|
|
94
|
+
if (maxTravel < DRAG_SLOP_PX) return;
|
|
95
|
+
dragging = true;
|
|
96
|
+
try {
|
|
97
|
+
handle.setPointerCapture?.(pointerId);
|
|
98
|
+
captured = true;
|
|
99
|
+
} catch {
|
|
100
|
+
}
|
|
101
|
+
killMotion(panel, overlay);
|
|
102
|
+
panel.style.willChange = "transform";
|
|
103
|
+
}
|
|
104
|
+
const dismissDelta = getDismissDelta(placement, panel);
|
|
105
|
+
const clamped = clampDelta(delta);
|
|
56
106
|
setTranslate(panel, axis, clamped);
|
|
57
107
|
if (overlay) {
|
|
58
108
|
gsap.set(overlay, { opacity: overlayOpacityForDrag(clamped, dismissDelta) });
|
|
59
109
|
}
|
|
60
110
|
};
|
|
111
|
+
const snapBack = (fromOffset) => {
|
|
112
|
+
killMotion(panel, overlay);
|
|
113
|
+
if (fromOffset === 0) {
|
|
114
|
+
panel.style.willChange = "";
|
|
115
|
+
gsap.set(panel, { clearProps: axis });
|
|
116
|
+
if (overlay) gsap.set(overlay, { opacity: 1 });
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
const vars = { ...motionInteractiveFor(config), overwrite: "auto" };
|
|
120
|
+
const tl = gsap.timeline({
|
|
121
|
+
onComplete: () => {
|
|
122
|
+
panel.style.willChange = "";
|
|
123
|
+
gsap.set(panel, { clearProps: axis });
|
|
124
|
+
if (overlay) gsap.set(overlay, { opacity: 1 });
|
|
125
|
+
}
|
|
126
|
+
});
|
|
127
|
+
tl.fromTo(panel, { [axis]: fromOffset }, { [axis]: 0, ...vars }, 0);
|
|
128
|
+
if (overlay) {
|
|
129
|
+
tl.to(overlay, { opacity: 1, ...vars }, 0);
|
|
130
|
+
}
|
|
131
|
+
};
|
|
132
|
+
const onCancel = (ev) => {
|
|
133
|
+
if (ev.pointerId !== pointerId) return;
|
|
134
|
+
cleanupListeners();
|
|
135
|
+
if (!dragging) return;
|
|
136
|
+
didDragRef.current = true;
|
|
137
|
+
setTimeout(() => {
|
|
138
|
+
didDragRef.current = false;
|
|
139
|
+
}, 0);
|
|
140
|
+
const client = isX ? ev.clientX : ev.clientY;
|
|
141
|
+
snapBack(clampDelta(client - startClient));
|
|
142
|
+
};
|
|
61
143
|
const onUp = (ev) => {
|
|
62
|
-
if (ev.pointerId !==
|
|
63
|
-
handle.releasePointerCapture(e.pointerId);
|
|
64
|
-
handle.removeEventListener("pointermove", onMove);
|
|
65
|
-
handle.removeEventListener("pointerup", onUp);
|
|
66
|
-
handle.removeEventListener("pointercancel", onUp);
|
|
144
|
+
if (ev.pointerId !== pointerId) return;
|
|
67
145
|
const client = isX ? ev.clientX : ev.clientY;
|
|
68
146
|
const delta = client - startClient;
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
147
|
+
if (Math.abs(delta) > maxTravel) maxTravel = Math.abs(delta);
|
|
148
|
+
cleanupListeners();
|
|
149
|
+
if (!dragging && maxTravel < DRAG_SLOP_PX) {
|
|
150
|
+
return;
|
|
151
|
+
}
|
|
152
|
+
didDragRef.current = true;
|
|
153
|
+
setTimeout(() => {
|
|
154
|
+
didDragRef.current = false;
|
|
155
|
+
}, 0);
|
|
156
|
+
const dismissDelta = getDismissDelta(placement, panel);
|
|
157
|
+
const clamped = clampDelta(delta);
|
|
158
|
+
const outward = Math.abs(clamped);
|
|
159
|
+
const absDismiss = Math.abs(dismissDelta);
|
|
160
|
+
const ratio = absDismiss > 0 ? outward / absDismiss : 0;
|
|
161
|
+
const dismissVelMet = outward > 0 && (dismissDir > 0 ? velocity > DISMISS_VELOCITY : velocity < -DISMISS_VELOCITY);
|
|
72
162
|
if (ratio >= DISMISS_RATIO || dismissVelMet) {
|
|
163
|
+
const vars = { ...motionInteractiveFor(config), overwrite: "auto" };
|
|
73
164
|
killMotion(panel, overlay);
|
|
74
165
|
const tl = gsap.timeline({
|
|
75
166
|
onComplete: () => {
|
|
@@ -78,33 +169,24 @@ function useDrawerHandleDrag(panelRef, overlayRef, placement, onClose, disabled,
|
|
|
78
169
|
onClose();
|
|
79
170
|
}
|
|
80
171
|
});
|
|
81
|
-
tl.fromTo(panel, { [axis]:
|
|
172
|
+
tl.fromTo(panel, { [axis]: clamped }, { [axis]: dismissDelta, ...vars }, 0);
|
|
82
173
|
if (overlay) {
|
|
83
174
|
tl.to(overlay, { opacity: 0, ...vars }, 0);
|
|
84
175
|
}
|
|
85
176
|
} else {
|
|
86
|
-
|
|
87
|
-
const tl = gsap.timeline({
|
|
88
|
-
onComplete: () => {
|
|
89
|
-
panel.style.willChange = "";
|
|
90
|
-
gsap.set(panel, { clearProps: axis });
|
|
91
|
-
if (overlay) gsap.set(overlay, { opacity: 1 });
|
|
92
|
-
}
|
|
93
|
-
});
|
|
94
|
-
tl.fromTo(panel, { [axis]: delta }, { [axis]: 0, ...vars }, 0);
|
|
95
|
-
if (overlay) {
|
|
96
|
-
tl.to(overlay, { opacity: 1, ...vars }, 0);
|
|
97
|
-
}
|
|
177
|
+
snapBack(clamped);
|
|
98
178
|
}
|
|
99
179
|
};
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
180
|
+
activeCleanupRef.current = cleanupListeners;
|
|
181
|
+
window.addEventListener("pointermove", onMove);
|
|
182
|
+
window.addEventListener("pointerup", onUp);
|
|
183
|
+
window.addEventListener("pointercancel", onCancel);
|
|
103
184
|
},
|
|
104
185
|
[config, disabled, onClose, overlayRef, panelRef, placement, skipCloseAnimRef]
|
|
105
186
|
);
|
|
106
|
-
return { onPointerDown };
|
|
187
|
+
return { onPointerDown, consumeDragClick };
|
|
107
188
|
}
|
|
108
189
|
export {
|
|
190
|
+
DRAG_SLOP_PX,
|
|
109
191
|
useDrawerHandleDrag
|
|
110
192
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DrawerContextValue, DrawerPlacement, UseDrawerRootStateProps } from './drawerTypes.js';
|
|
2
|
-
export declare function useDrawerRootState({ open: openProp, defaultOpen, onOpenChange, placement, size, portalContainer, }: UseDrawerRootStateProps & {
|
|
2
|
+
export declare function useDrawerRootState({ open: openProp, defaultOpen, onOpenChange, placement, size, variant, portalContainer, }: UseDrawerRootStateProps & {
|
|
3
3
|
placement?: DrawerPlacement;
|
|
4
4
|
}): {
|
|
5
5
|
contextValue: DrawerContextValue;
|
|
@@ -9,6 +9,7 @@ function useDrawerRootState({
|
|
|
9
9
|
onOpenChange,
|
|
10
10
|
placement = DEFAULT_PLACEMENT,
|
|
11
11
|
size = "base",
|
|
12
|
+
variant,
|
|
12
13
|
portalContainer
|
|
13
14
|
}) {
|
|
14
15
|
const [open, setOpen] = useControllableState({
|
|
@@ -41,6 +42,8 @@ function useDrawerRootState({
|
|
|
41
42
|
onOpenChange: setOpen,
|
|
42
43
|
placement,
|
|
43
44
|
size,
|
|
45
|
+
variant,
|
|
46
|
+
closeOnInteractOutside: true,
|
|
44
47
|
sizePreset,
|
|
45
48
|
footerButtonSize: footerButtonSizeForDrawer(size),
|
|
46
49
|
overlayRef: placeholderOverlayRef,
|
|
@@ -6,7 +6,10 @@ function getFocusableDropdownMenuItems(root) {
|
|
|
6
6
|
).filter((el) => !el.hasAttribute("disabled"));
|
|
7
7
|
}
|
|
8
8
|
function focusDropdownMenuItem(items, index) {
|
|
9
|
-
|
|
9
|
+
const el = items[index];
|
|
10
|
+
if (!el) return;
|
|
11
|
+
focusKeyboard(el);
|
|
12
|
+
el.scrollIntoView?.({ block: "nearest" });
|
|
10
13
|
}
|
|
11
14
|
function dropdownMenuItemTypeaheadLabel(el) {
|
|
12
15
|
return (el.textContent ?? "").trim().replace(/\s+/g, " ");
|
|
@@ -37,9 +37,9 @@ export declare function useDropdownMenuSlotMotion<T extends HTMLElement>(slot: D
|
|
|
37
37
|
onPointerUp: (e: ReactPointerEvent<T>) => void;
|
|
38
38
|
};
|
|
39
39
|
};
|
|
40
|
-
export declare function useDropdownPopoverMenu({ open,
|
|
40
|
+
export declare function useDropdownPopoverMenu({ open, contentRef, triggerRef, openInitialFocusRef, }: UseDropdownPopoverMenuProps): void;
|
|
41
41
|
/** Keyboard nav inside an open submenu panel (APG menu). */
|
|
42
|
-
export declare function useDropdownSubmenuKeyboard({ subOpen, portalMounted, panelRef, triggerRef, setOpen, }: UseDropdownSubmenuKeyboardProps): void;
|
|
42
|
+
export declare function useDropdownSubmenuKeyboard({ subOpen, portalMounted, panelRef, triggerRef, setOpen, layerId, }: UseDropdownSubmenuKeyboardProps): void;
|
|
43
43
|
export declare function useDropdownSubPopoverPortal({ subOpen, triggerRef, menuTriggerRef, subPanelRootsRef, popoverVariant, portalContainer, motionScope, }: UseDropdownSubPopoverPortalProps): {
|
|
44
44
|
panelRef: import('react').RefObject<HTMLDivElement | null>;
|
|
45
45
|
pos: {
|
|
@@ -48,6 +48,7 @@ export declare function useDropdownSubPopoverPortal({ subOpen, triggerRef, menuT
|
|
|
48
48
|
minW: number;
|
|
49
49
|
};
|
|
50
50
|
portalMounted: boolean;
|
|
51
|
+
portalHost: HTMLElement | null;
|
|
51
52
|
menuTriggerRef: import('react').RefObject<HTMLElement | null>;
|
|
52
53
|
contained: boolean;
|
|
53
54
|
popoverVariant: import('../Popover/index.js').PopoverVariant;
|
|
@@ -7,7 +7,9 @@ import { isReducedModalMotion, applyReducedPortalMotion } from "../utils/modalSu
|
|
|
7
7
|
import { prefersReducedMotion } from "../utils/reducedMotion.js";
|
|
8
8
|
import { useMotionConfig } from "../utils/motionConfigContext.js";
|
|
9
9
|
import { bindOverlayReflow } from "../utils/bindOverlayReflow.js";
|
|
10
|
-
import {
|
|
10
|
+
import { isTopmostOverlayLayer } from "../utils/overlayLayer.js";
|
|
11
|
+
import { resolveFloatingPortalContainer, isContainedPortal } from "../utils/portalContainer.js";
|
|
12
|
+
import { isRtlElement } from "../utils/readingDirection.js";
|
|
11
13
|
import { useOptionalPopoverMotionScope } from "../Popover/popoverContext.js";
|
|
12
14
|
import { useLayoutEffect, useEffect, useRef, useState, useCallback } from "react";
|
|
13
15
|
import { getFocusableDropdownMenuItems, focusDropdownMenuItem, dropdownMenuItemTypeaheadLabel } from "./dropdownA11y.js";
|
|
@@ -88,9 +90,9 @@ function handleDropdownTypeaheadKey(e, items, buffer) {
|
|
|
88
90
|
}
|
|
89
91
|
function useDropdownPopoverMenu({
|
|
90
92
|
open,
|
|
91
|
-
setOpen,
|
|
92
93
|
contentRef,
|
|
93
|
-
triggerRef
|
|
94
|
+
triggerRef,
|
|
95
|
+
openInitialFocusRef
|
|
94
96
|
}) {
|
|
95
97
|
const typeaheadRef = useLazyRef(createTypeaheadBufferState);
|
|
96
98
|
useLayoutEffect(() => {
|
|
@@ -98,19 +100,18 @@ function useDropdownPopoverMenu({
|
|
|
98
100
|
const panel = contentRef.current;
|
|
99
101
|
if (!panel) return;
|
|
100
102
|
const items = getFocusableDropdownMenuItems(panel);
|
|
101
|
-
|
|
102
|
-
|
|
103
|
+
const edge = openInitialFocusRef?.current ?? "first";
|
|
104
|
+
if (openInitialFocusRef) openInitialFocusRef.current = "first";
|
|
105
|
+
const target = edge === "last" ? items[items.length - 1] : items[0];
|
|
106
|
+
focusOnOpen(target, { from: triggerRef.current });
|
|
107
|
+
target?.scrollIntoView?.({ block: "nearest" });
|
|
108
|
+
}, [contentRef, open, openInitialFocusRef, triggerRef]);
|
|
103
109
|
useEffect(() => {
|
|
104
110
|
if (!open) return;
|
|
105
111
|
const panel = contentRef.current;
|
|
106
112
|
if (!panel) return;
|
|
107
113
|
const buffer = typeaheadRef.current;
|
|
108
114
|
const onKeyDown = (e) => {
|
|
109
|
-
if (e.key === "Escape") {
|
|
110
|
-
e.preventDefault();
|
|
111
|
-
setOpen(false);
|
|
112
|
-
return;
|
|
113
|
-
}
|
|
114
115
|
const items = getFocusableDropdownMenuItems(panel);
|
|
115
116
|
if (items.length === 0) return;
|
|
116
117
|
const active = document.activeElement;
|
|
@@ -139,14 +140,15 @@ function useDropdownPopoverMenu({
|
|
|
139
140
|
};
|
|
140
141
|
panel.addEventListener("keydown", onKeyDown);
|
|
141
142
|
return () => panel.removeEventListener("keydown", onKeyDown);
|
|
142
|
-
}, [contentRef, open,
|
|
143
|
+
}, [contentRef, open, typeaheadRef]);
|
|
143
144
|
}
|
|
144
145
|
function useDropdownSubmenuKeyboard({
|
|
145
146
|
subOpen,
|
|
146
147
|
portalMounted,
|
|
147
148
|
panelRef,
|
|
148
149
|
triggerRef,
|
|
149
|
-
setOpen
|
|
150
|
+
setOpen,
|
|
151
|
+
layerId
|
|
150
152
|
}) {
|
|
151
153
|
const typeaheadRef = useLazyRef(createTypeaheadBufferState);
|
|
152
154
|
useLayoutEffect(() => {
|
|
@@ -157,6 +159,7 @@ function useDropdownSubmenuKeyboard({
|
|
|
157
159
|
if (document.activeElement !== trigger) return;
|
|
158
160
|
const items = getFocusableDropdownMenuItems(panel);
|
|
159
161
|
focusOnOpen(items[0], { from: trigger });
|
|
162
|
+
items[0]?.scrollIntoView?.({ block: "nearest" });
|
|
160
163
|
}, [panelRef, portalMounted, subOpen, triggerRef]);
|
|
161
164
|
useEffect(() => {
|
|
162
165
|
if (!subOpen || !portalMounted) return;
|
|
@@ -164,7 +167,9 @@ function useDropdownSubmenuKeyboard({
|
|
|
164
167
|
if (!panel) return;
|
|
165
168
|
const buffer = typeaheadRef.current;
|
|
166
169
|
const onKeyDown = (e) => {
|
|
167
|
-
|
|
170
|
+
const rtl = isRtlElement(panel);
|
|
171
|
+
const closeKey = rtl ? "ArrowRight" : "ArrowLeft";
|
|
172
|
+
if (e.key === closeKey || e.key === "Escape" && isTopmostOverlayLayer(layerId)) {
|
|
168
173
|
e.preventDefault();
|
|
169
174
|
e.stopPropagation();
|
|
170
175
|
setOpen(false);
|
|
@@ -199,7 +204,7 @@ function useDropdownSubmenuKeyboard({
|
|
|
199
204
|
};
|
|
200
205
|
panel.addEventListener("keydown", onKeyDown);
|
|
201
206
|
return () => panel.removeEventListener("keydown", onKeyDown);
|
|
202
|
-
}, [panelRef, portalMounted, setOpen, subOpen, triggerRef, typeaheadRef]);
|
|
207
|
+
}, [layerId, panelRef, portalMounted, setOpen, subOpen, triggerRef, typeaheadRef]);
|
|
203
208
|
}
|
|
204
209
|
function useDropdownSubPopoverPortal({
|
|
205
210
|
subOpen,
|
|
@@ -214,9 +219,28 @@ function useDropdownSubPopoverPortal({
|
|
|
214
219
|
const panelRef = useRef(null);
|
|
215
220
|
const [pos, setPos] = useState({ top: 0, left: 0, minW: 0 });
|
|
216
221
|
const [portalMounted, setPortalMounted] = useState(false);
|
|
222
|
+
const [portalHost, setPortalHost] = useState(
|
|
223
|
+
() => resolveFloatingPortalContainer(portalContainer, null)
|
|
224
|
+
);
|
|
217
225
|
if (subOpen && !portalMounted) {
|
|
218
226
|
setPortalMounted(true);
|
|
219
227
|
}
|
|
228
|
+
const syncPortalHost = useCallback(() => {
|
|
229
|
+
const next = resolveFloatingPortalContainer(
|
|
230
|
+
portalContainer,
|
|
231
|
+
triggerRef.current ?? menuTriggerRef.current
|
|
232
|
+
);
|
|
233
|
+
setPortalHost((prev) => prev === next ? prev : next);
|
|
234
|
+
return next;
|
|
235
|
+
}, [menuTriggerRef, portalContainer, triggerRef]);
|
|
236
|
+
useLayoutEffect(() => {
|
|
237
|
+
if (!subOpen && !portalMounted) return;
|
|
238
|
+
syncPortalHost();
|
|
239
|
+
}, [portalMounted, subOpen, syncPortalHost]);
|
|
240
|
+
useEffect(() => {
|
|
241
|
+
if (!subOpen) return;
|
|
242
|
+
syncPortalHost();
|
|
243
|
+
}, [subOpen, syncPortalHost]);
|
|
220
244
|
const updatePosition = useCallback(() => {
|
|
221
245
|
const t = triggerRef.current;
|
|
222
246
|
if (!t) return;
|
|
@@ -225,28 +249,49 @@ function useDropdownSubPopoverPortal({
|
|
|
225
249
|
const edge = menu instanceof HTMLElement ? menu.getBoundingClientRect() : r;
|
|
226
250
|
const gap = 0;
|
|
227
251
|
const minW = Math.max(r.width, 10 * 16);
|
|
228
|
-
let left = edge.right + gap;
|
|
229
|
-
let top = r.top;
|
|
230
|
-
const estW = minW;
|
|
231
|
-
if (left + estW > window.innerWidth - 12) {
|
|
232
|
-
left = Math.max(12, edge.left - estW - gap);
|
|
233
|
-
}
|
|
234
252
|
const panel = panelRef.current;
|
|
235
|
-
const
|
|
236
|
-
|
|
237
|
-
|
|
253
|
+
const rawW = panel ? panel.offsetWidth || panel.getBoundingClientRect().width : 0;
|
|
254
|
+
const pw = Math.max(rawW, minW);
|
|
255
|
+
const ph = panel ? panel.offsetHeight || panel.getBoundingClientRect().height : 0;
|
|
256
|
+
const vv = typeof window !== "undefined" ? window.visualViewport : null;
|
|
257
|
+
const vpLeft = vv ? vv.offsetLeft ?? 0 : 0;
|
|
258
|
+
const vpTop = vv ? vv.offsetTop ?? 0 : 0;
|
|
259
|
+
const vpRight = vpLeft + (vv ? vv.width : window.innerWidth);
|
|
260
|
+
const vpBottom = vpTop + (vv ? vv.height : window.innerHeight);
|
|
261
|
+
const rtl = isRtlElement(t);
|
|
262
|
+
let left;
|
|
263
|
+
if (rtl) {
|
|
264
|
+
left = edge.left - pw - gap;
|
|
265
|
+
if (left < vpLeft + 12) {
|
|
266
|
+
left = edge.right + gap;
|
|
267
|
+
}
|
|
268
|
+
} else {
|
|
269
|
+
left = edge.right + gap;
|
|
270
|
+
if (left + pw > vpRight - 12) {
|
|
271
|
+
left = edge.left - pw - gap;
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
const maxLeft = Math.max(vpLeft + 8, vpRight - pw - 8);
|
|
275
|
+
left = Math.max(vpLeft + 8, Math.min(left, maxLeft));
|
|
276
|
+
let top = r.top;
|
|
277
|
+
if (ph > 0) {
|
|
278
|
+
const maxTop = Math.max(vpTop + 8, vpBottom - ph - 8);
|
|
279
|
+
top = Math.max(vpTop + 8, Math.min(top, maxTop));
|
|
280
|
+
} else {
|
|
281
|
+
top = Math.max(vpTop + 8, top);
|
|
238
282
|
}
|
|
239
|
-
|
|
240
|
-
|
|
283
|
+
const activeHost2 = resolveFloatingPortalContainer(portalContainer, t ?? menuTriggerRef.current) ?? portalHost;
|
|
284
|
+
if (isContainedPortal(activeHost2) && activeHost2) {
|
|
285
|
+
const hostRect = activeHost2.getBoundingClientRect();
|
|
241
286
|
setPos({
|
|
242
|
-
top: top - hostRect.top +
|
|
243
|
-
left: left - hostRect.left +
|
|
287
|
+
top: top - hostRect.top - activeHost2.clientTop + activeHost2.scrollTop,
|
|
288
|
+
left: left - hostRect.left - activeHost2.clientLeft + activeHost2.scrollLeft,
|
|
244
289
|
minW
|
|
245
290
|
});
|
|
246
291
|
return;
|
|
247
292
|
}
|
|
248
293
|
setPos({ top, left, minW });
|
|
249
|
-
}, [portalContainer, triggerRef]);
|
|
294
|
+
}, [menuTriggerRef, portalContainer, portalHost, triggerRef]);
|
|
250
295
|
useLayoutEffect(() => {
|
|
251
296
|
if (!subOpen || !portalMounted) return;
|
|
252
297
|
updatePosition();
|
|
@@ -305,12 +350,17 @@ function useDropdownSubPopoverPortal({
|
|
|
305
350
|
leaveWait.kill();
|
|
306
351
|
};
|
|
307
352
|
}, [config, subOpen, portalMounted, motionScope]);
|
|
353
|
+
const activeHost = resolveFloatingPortalContainer(
|
|
354
|
+
portalContainer,
|
|
355
|
+
triggerRef.current ?? menuTriggerRef.current
|
|
356
|
+
) ?? portalHost;
|
|
308
357
|
return {
|
|
309
358
|
panelRef,
|
|
310
359
|
pos,
|
|
311
360
|
portalMounted,
|
|
361
|
+
portalHost: activeHost,
|
|
312
362
|
menuTriggerRef,
|
|
313
|
-
contained: isContainedPortal(
|
|
363
|
+
contained: isContainedPortal(activeHost),
|
|
314
364
|
popoverVariant
|
|
315
365
|
};
|
|
316
366
|
}
|