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
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { dataExpandedState } from "../utils/dataContract.js";
|
|
3
4
|
import { useMotionConfig } from "../utils/motionConfigContext.js";
|
|
4
5
|
import { isReducedModalMotion, applyReducedPortalMotion } from "../utils/modalSurfaceMotion.js";
|
|
5
6
|
import { prefersReducedMotion } from "../utils/reducedMotion.js";
|
|
@@ -10,8 +11,8 @@ import { toastScrimToken, TOAST_SCRIM_CSS_VAR } from "../../../tokens/toastScrim
|
|
|
10
11
|
import { useBurneLabel } from "../../../theme/BurneLabelsProvider.js";
|
|
11
12
|
import { isKitVariant } from "../../../skins/resolveVariantVisual.js";
|
|
12
13
|
import { useApplySkinPortal, useSkinVariant, useSkinRegistryRevision } from "../../../skins/skinContext.js";
|
|
13
|
-
import { useRef,
|
|
14
|
-
import {
|
|
14
|
+
import { useState, useRef, useEffect, useCallback, useMemo, useLayoutEffect } from "react";
|
|
15
|
+
import { resolveToastStackLayout, TOAST_ENTRY_OFFSET_PX, TOAST_STACK_SCALE_STEP, TOAST_STACK_PEEK_PX, TOAST_MAX_VISIBLE } from "./toastAPI.js";
|
|
15
16
|
import { toastViewportAriaLabel } from "./toastA11y.js";
|
|
16
17
|
import { ToastMotionProvider, useToastMotionScope, ToastClassNamesProvider } from "./toastContext.js";
|
|
17
18
|
import { ToastRoot } from "./Toast.js";
|
|
@@ -34,6 +35,8 @@ function ToastItemMotionHost({
|
|
|
34
35
|
total,
|
|
35
36
|
isTop,
|
|
36
37
|
isDismissing,
|
|
38
|
+
paused = false,
|
|
39
|
+
stackLayout,
|
|
37
40
|
onDismiss,
|
|
38
41
|
onRemoveFinal,
|
|
39
42
|
onHeightChange,
|
|
@@ -71,12 +74,15 @@ function ToastItemMotionHost({
|
|
|
71
74
|
[setRootPartRef]
|
|
72
75
|
);
|
|
73
76
|
const capped = Math.min(reverseIdx, TOAST_MAX_VISIBLE - 1);
|
|
74
|
-
const stackScale = 1 - capped * TOAST_STACK_SCALE_STEP;
|
|
75
|
-
const peekY = isTop ? capped * TOAST_STACK_PEEK_PX : -capped * TOAST_STACK_PEEK_PX;
|
|
76
|
-
const stackOpacity = reverseIdx >= TOAST_MAX_VISIBLE ? 0 : 1;
|
|
77
|
+
const stackScale = stackLayout?.scale ?? 1 - capped * TOAST_STACK_SCALE_STEP;
|
|
78
|
+
const peekY = stackLayout?.peekY ?? (isTop ? capped * TOAST_STACK_PEEK_PX : -capped * TOAST_STACK_PEEK_PX);
|
|
79
|
+
const stackOpacity = stackLayout?.opacity ?? (reverseIdx >= TOAST_MAX_VISIBLE ? 0 : 1);
|
|
80
|
+
const isHiddenInStack = stackLayout?.hidden ?? reverseIdx >= TOAST_MAX_VISIBLE;
|
|
81
|
+
const interactive = stackLayout?.interactive ?? reverseIdx === 0;
|
|
77
82
|
useLayoutEffect(() => {
|
|
78
83
|
const el = stackRef.current;
|
|
79
84
|
if (!el) return;
|
|
85
|
+
if (isDismissing && isMountedRef.current) return;
|
|
80
86
|
const stack = { peekY, scale: stackScale, opacity: stackOpacity };
|
|
81
87
|
const isFirstMount = !isMountedRef.current;
|
|
82
88
|
isMountedRef.current = true;
|
|
@@ -87,17 +93,19 @@ function ToastItemMotionHost({
|
|
|
87
93
|
return;
|
|
88
94
|
}
|
|
89
95
|
scope.play("stackItem", phase, { el, params: { toastStack: stack } });
|
|
90
|
-
}, [entry.variant, peekY, scope, stackOpacity, stackScale]);
|
|
96
|
+
}, [entry.variant, isDismissing, peekY, scope, stackOpacity, stackScale]);
|
|
91
97
|
useLayoutEffect(() => {
|
|
92
98
|
const el = cardRef.current;
|
|
93
99
|
if (!el) return;
|
|
94
100
|
onHeightChange(entry.id, el.offsetHeight);
|
|
95
|
-
|
|
96
|
-
const ro = new ResizeObserver(() => {
|
|
101
|
+
const ro = typeof ResizeObserver !== "undefined" ? new ResizeObserver(() => {
|
|
97
102
|
onHeightChange(entry.id, el.offsetHeight);
|
|
98
|
-
});
|
|
99
|
-
ro
|
|
100
|
-
return () =>
|
|
103
|
+
}) : void 0;
|
|
104
|
+
ro?.observe(el);
|
|
105
|
+
return () => {
|
|
106
|
+
ro?.disconnect();
|
|
107
|
+
onHeightChange(entry.id, 0);
|
|
108
|
+
};
|
|
101
109
|
}, [entry.id, onHeightChange]);
|
|
102
110
|
useLayoutEffect(() => {
|
|
103
111
|
const el = animRef.current;
|
|
@@ -140,75 +148,42 @@ function ToastItemMotionHost({
|
|
|
140
148
|
leaveWait.kill();
|
|
141
149
|
};
|
|
142
150
|
}, [config, entry.id, isDismissing, onRemoveFinal, scope, slideDir]);
|
|
151
|
+
const remainingRef = useRef(entry.duration);
|
|
152
|
+
const timerKeyRef = useRef("");
|
|
153
|
+
const timerKey = `${entry.id}:${entry.duration}:${entry.loading}`;
|
|
154
|
+
if (timerKeyRef.current !== timerKey) {
|
|
155
|
+
timerKeyRef.current = timerKey;
|
|
156
|
+
remainingRef.current = entry.duration;
|
|
157
|
+
}
|
|
143
158
|
useEffect(() => {
|
|
144
|
-
if (entry.duration === 0 || isDismissing || entry.loading) return;
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
const
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
};
|
|
155
|
-
const arm = () => {
|
|
156
|
-
clear();
|
|
157
|
-
startedAt = Date.now();
|
|
158
|
-
timerId = window.setTimeout(() => onDismiss(entry.id), remaining);
|
|
159
|
-
};
|
|
160
|
-
const pause = () => {
|
|
161
|
-
if (paused || startedAt == null) return;
|
|
162
|
-
paused = true;
|
|
163
|
-
remaining = Math.max(0, remaining - (Date.now() - startedAt));
|
|
164
|
-
startedAt = null;
|
|
165
|
-
clear();
|
|
166
|
-
};
|
|
167
|
-
const resume = () => {
|
|
168
|
-
if (!paused) return;
|
|
169
|
-
paused = false;
|
|
170
|
-
if (remaining <= 0) {
|
|
171
|
-
onDismiss(entry.id);
|
|
172
|
-
return;
|
|
173
|
-
}
|
|
174
|
-
arm();
|
|
175
|
-
};
|
|
176
|
-
arm();
|
|
177
|
-
const node = stackRef.current;
|
|
178
|
-
const onPointerEnter = () => pause();
|
|
179
|
-
const onPointerLeave = () => resume();
|
|
180
|
-
const onFocusIn = () => pause();
|
|
181
|
-
const onFocusOut = (e) => {
|
|
182
|
-
if (node && e.relatedTarget instanceof Node && node.contains(e.relatedTarget)) {
|
|
183
|
-
return;
|
|
184
|
-
}
|
|
185
|
-
resume();
|
|
186
|
-
};
|
|
187
|
-
node?.addEventListener("pointerenter", onPointerEnter);
|
|
188
|
-
node?.addEventListener("pointerleave", onPointerLeave);
|
|
189
|
-
node?.addEventListener("focusin", onFocusIn);
|
|
190
|
-
node?.addEventListener("focusout", onFocusOut);
|
|
159
|
+
if (entry.duration === 0 || isDismissing || entry.loading || paused) return;
|
|
160
|
+
if (remainingRef.current <= 0) {
|
|
161
|
+
onDismiss(entry.id);
|
|
162
|
+
return;
|
|
163
|
+
}
|
|
164
|
+
const startedAt = Date.now();
|
|
165
|
+
const timerId = window.setTimeout(() => {
|
|
166
|
+
remainingRef.current = 0;
|
|
167
|
+
onDismiss(entry.id);
|
|
168
|
+
}, remainingRef.current);
|
|
191
169
|
return () => {
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
node?.removeEventListener("pointerleave", onPointerLeave);
|
|
195
|
-
node?.removeEventListener("focusin", onFocusIn);
|
|
196
|
-
node?.removeEventListener("focusout", onFocusOut);
|
|
170
|
+
window.clearTimeout(timerId);
|
|
171
|
+
remainingRef.current = Math.max(0, remainingRef.current - (Date.now() - startedAt));
|
|
197
172
|
};
|
|
198
|
-
}, [entry.id, entry.duration, isDismissing, entry.loading, onDismiss]);
|
|
173
|
+
}, [entry.id, entry.duration, isDismissing, entry.loading, onDismiss, paused]);
|
|
199
174
|
const dismiss = useCallback(() => onDismiss(entry.id), [entry.id, onDismiss]);
|
|
200
|
-
const isVisible = reverseIdx < total;
|
|
201
175
|
const mergedClassNames = { ...providerClassNames, ...entry.classNames };
|
|
202
176
|
return /* @__PURE__ */ jsx(
|
|
203
177
|
"div",
|
|
204
178
|
{
|
|
205
179
|
ref: setStackRef,
|
|
206
|
-
"aria-hidden":
|
|
180
|
+
"aria-hidden": isHiddenInStack || void 0,
|
|
181
|
+
inert: isHiddenInStack ? true : void 0,
|
|
207
182
|
className: toastStackItemClass(mergedClassNames.stackItem),
|
|
208
183
|
style: toastStackItemStyle({
|
|
209
184
|
origin: isTop ? "top center" : "bottom center",
|
|
210
|
-
zIndex: TOAST_MAX_VISIBLE + 1 - reverseIdx,
|
|
211
|
-
pointerEvents:
|
|
185
|
+
zIndex: Math.max(total, TOAST_MAX_VISIBLE) + 1 - reverseIdx,
|
|
186
|
+
pointerEvents: !isDismissing && interactive ? "auto" : "none"
|
|
212
187
|
}),
|
|
213
188
|
children: /* @__PURE__ */ jsx("div", { ref: setAnimRef, children: /* @__PURE__ */ jsx(ToastClassNamesProvider, { classNames: mergedClassNames, children: /* @__PURE__ */ jsx(
|
|
214
189
|
ToastRoot,
|
|
@@ -233,6 +208,8 @@ function ToastItemWrapper({
|
|
|
233
208
|
total,
|
|
234
209
|
isTop,
|
|
235
210
|
isDismissing,
|
|
211
|
+
paused,
|
|
212
|
+
stackLayout,
|
|
236
213
|
onDismiss,
|
|
237
214
|
onRemoveFinal,
|
|
238
215
|
onHeightChange,
|
|
@@ -271,6 +248,8 @@ function ToastItemWrapper({
|
|
|
271
248
|
total,
|
|
272
249
|
isTop,
|
|
273
250
|
isDismissing,
|
|
251
|
+
paused,
|
|
252
|
+
stackLayout,
|
|
274
253
|
onDismiss,
|
|
275
254
|
onRemoveFinal,
|
|
276
255
|
onHeightChange,
|
|
@@ -342,43 +321,48 @@ function ToastViewport({
|
|
|
342
321
|
}) {
|
|
343
322
|
const isTop = placement.startsWith("top");
|
|
344
323
|
const toastNotificationsLabel = useBurneLabel("toastNotifications");
|
|
345
|
-
const
|
|
346
|
-
if (!heightsRef.current) heightsRef.current = /* @__PURE__ */ new Map();
|
|
324
|
+
const [heights, setHeights] = useState({});
|
|
347
325
|
const containerRef = useRef(null);
|
|
326
|
+
const hoveredRef = useRef(false);
|
|
327
|
+
const focusedRef = useRef(false);
|
|
328
|
+
const [stackPaused, setStackPaused] = useState(false);
|
|
348
329
|
useApplySkinPortal(containerRef);
|
|
349
330
|
const prevContainerHRef = useRef(0);
|
|
350
|
-
const
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
331
|
+
const effectivePaused = sorted.length > 0 && stackPaused;
|
|
332
|
+
useEffect(() => {
|
|
333
|
+
if (sorted.length === 0) {
|
|
334
|
+
hoveredRef.current = false;
|
|
335
|
+
focusedRef.current = false;
|
|
336
|
+
}
|
|
337
|
+
}, [sorted.length]);
|
|
338
|
+
const onHeightChange = useCallback((id, h) => {
|
|
339
|
+
setHeights((prev) => {
|
|
340
|
+
if (h <= 0) {
|
|
341
|
+
if (!(id in prev)) return prev;
|
|
342
|
+
const { [id]: _removed, ...rest } = prev;
|
|
343
|
+
return rest;
|
|
344
|
+
}
|
|
345
|
+
return prev[id] === h ? prev : { ...prev, [id]: h };
|
|
346
|
+
});
|
|
347
|
+
}, []);
|
|
348
|
+
const stackLayout = useMemo(
|
|
349
|
+
() => resolveToastStackLayout({
|
|
350
|
+
sorted,
|
|
351
|
+
dismissingIds,
|
|
352
|
+
heights,
|
|
353
|
+
isTop,
|
|
354
|
+
paused: effectivePaused
|
|
355
|
+
}),
|
|
356
|
+
[dismissingIds, effectivePaused, heights, isTop, sorted]
|
|
357
|
+
);
|
|
358
|
+
useLayoutEffect(() => {
|
|
356
359
|
const el = containerRef.current;
|
|
357
360
|
if (!el) return;
|
|
358
|
-
const
|
|
359
|
-
const frontHeight = frontId != null ? heightsRef.current.get(frontId) ?? 0 : 0;
|
|
360
|
-
const raw = resolveToastStackContainerHeight(frontHeight, count);
|
|
361
|
+
const raw = stackLayout.containerHeight;
|
|
361
362
|
const containerH = raw > 0 ? raw : prevContainerHRef.current;
|
|
362
363
|
if (raw > 0) prevContainerHRef.current = raw;
|
|
363
364
|
applyToastStackContainerHeight(el, containerH);
|
|
364
|
-
}, []);
|
|
365
|
-
const onHeightChange = useCallback(
|
|
366
|
-
(id, h) => {
|
|
367
|
-
if (heightsRef.current.get(id) === h) return;
|
|
368
|
-
heightsRef.current.set(id, h);
|
|
369
|
-
if (id === stackMetaRef.current.frontId) {
|
|
370
|
-
syncContainerHeight();
|
|
371
|
-
}
|
|
372
|
-
},
|
|
373
|
-
[syncContainerHeight]
|
|
374
|
-
);
|
|
375
|
-
useLayoutEffect(() => {
|
|
376
|
-
const liveIds = new Set(sorted.map((entry) => entry.id));
|
|
377
|
-
for (const id of heightsRef.current.keys()) {
|
|
378
|
-
if (!liveIds.has(id)) heightsRef.current.delete(id);
|
|
379
|
-
}
|
|
380
|
-
syncContainerHeight();
|
|
381
|
-
}, [sorted, syncContainerHeight]);
|
|
365
|
+
}, [stackLayout.containerHeight]);
|
|
382
366
|
return /* @__PURE__ */ jsx(ToastMotionProvider, { motion, defaults: TOAST_VIEWPORT_MOTION_DEFAULTS, children: /* @__PURE__ */ jsxs(
|
|
383
367
|
"div",
|
|
384
368
|
{
|
|
@@ -386,6 +370,27 @@ function ToastViewport({
|
|
|
386
370
|
"aria-label": toastViewportAriaLabel(placement, toastNotificationsLabel),
|
|
387
371
|
className: toastViewportClass({ placement, slotClass: classNames?.viewport }),
|
|
388
372
|
style: toastViewportWidthStyle(toastViewportWidthPx(sorted, defaultSize)),
|
|
373
|
+
onPointerEnter: (e) => {
|
|
374
|
+
if (e.pointerType === "touch") return;
|
|
375
|
+
hoveredRef.current = true;
|
|
376
|
+
setStackPaused(true);
|
|
377
|
+
},
|
|
378
|
+
onPointerLeave: (e) => {
|
|
379
|
+
if (e.pointerType === "touch") return;
|
|
380
|
+
hoveredRef.current = false;
|
|
381
|
+
if (!focusedRef.current) setStackPaused(false);
|
|
382
|
+
},
|
|
383
|
+
onFocus: () => {
|
|
384
|
+
focusedRef.current = true;
|
|
385
|
+
setStackPaused(true);
|
|
386
|
+
},
|
|
387
|
+
onBlur: (e) => {
|
|
388
|
+
if (e.relatedTarget instanceof Node && e.currentTarget.contains(e.relatedTarget)) {
|
|
389
|
+
return;
|
|
390
|
+
}
|
|
391
|
+
focusedRef.current = false;
|
|
392
|
+
if (!hoveredRef.current) setStackPaused(false);
|
|
393
|
+
},
|
|
389
394
|
children: [
|
|
390
395
|
/* @__PURE__ */ jsx(
|
|
391
396
|
ToastScrim,
|
|
@@ -400,10 +405,11 @@ function ToastViewport({
|
|
|
400
405
|
"div",
|
|
401
406
|
{
|
|
402
407
|
ref: containerRef,
|
|
403
|
-
className: toastStackClass(classNames?.stack),
|
|
408
|
+
className: toastStackClass(classNames?.stack, stackLayout.expanded),
|
|
404
409
|
style: {
|
|
405
410
|
alignItems: isTop ? "start" : "end"
|
|
406
411
|
},
|
|
412
|
+
"data-state": dataExpandedState(stackLayout.expanded),
|
|
407
413
|
children: sorted.map((entry, reverseIdx) => /* @__PURE__ */ jsx(
|
|
408
414
|
ToastItemWrapper,
|
|
409
415
|
{
|
|
@@ -412,6 +418,8 @@ function ToastViewport({
|
|
|
412
418
|
total: sorted.length,
|
|
413
419
|
isTop,
|
|
414
420
|
isDismissing: dismissingIds.has(entry.id),
|
|
421
|
+
paused: effectivePaused,
|
|
422
|
+
stackLayout: stackLayout.items.get(entry.id),
|
|
415
423
|
onDismiss,
|
|
416
424
|
onRemoveFinal,
|
|
417
425
|
onHeightChange,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsxs, jsx, Fragment } from "react/jsx-runtime";
|
|
3
3
|
import { createPortal } from "react-dom";
|
|
4
|
-
import { useEffect } from "react";
|
|
5
|
-
import { resolvePortalContainer } from "../utils/portalContainer.js";
|
|
4
|
+
import { useEffect, useState } from "react";
|
|
5
|
+
import { getTopmostOpenModalDialog, resolvePortalContainer } from "../utils/portalContainer.js";
|
|
6
6
|
import { TOAST_LIVE_REGION_CLASS } from "./toastStyles.js";
|
|
7
7
|
import { ToastViewport } from "./toastAnimations.js";
|
|
8
8
|
import { ToastContext } from "./toastContext.js";
|
|
@@ -59,11 +59,33 @@ function ToastProviderRoot({
|
|
|
59
59
|
error: toastError
|
|
60
60
|
});
|
|
61
61
|
}, [loadingStatus, state.ctx, toastError]);
|
|
62
|
+
const hasToasts = state.toasts.length > 0;
|
|
63
|
+
const [topModalDialog, setTopModalDialog] = useState(null);
|
|
64
|
+
useEffect(() => {
|
|
65
|
+
if (portalContainer || !hasToasts || typeof document === "undefined") {
|
|
66
|
+
setTopModalDialog(null);
|
|
67
|
+
return void 0;
|
|
68
|
+
}
|
|
69
|
+
const sync = () => {
|
|
70
|
+
const next = getTopmostOpenModalDialog();
|
|
71
|
+
setTopModalDialog((prev) => prev === next ? prev : next);
|
|
72
|
+
};
|
|
73
|
+
sync();
|
|
74
|
+
const observer = new MutationObserver(sync);
|
|
75
|
+
observer.observe(document.body, {
|
|
76
|
+
childList: true,
|
|
77
|
+
subtree: true,
|
|
78
|
+
attributes: true,
|
|
79
|
+
attributeFilter: ["open", "class"]
|
|
80
|
+
});
|
|
81
|
+
return () => observer.disconnect();
|
|
82
|
+
}, [hasToasts, portalContainer]);
|
|
83
|
+
const activeModalDialog = !portalContainer && hasToasts ? topModalDialog && topModalDialog.isConnected && topModalDialog.open ? topModalDialog : getTopmostOpenModalDialog() : null;
|
|
62
84
|
return /* @__PURE__ */ jsxs(ToastContext.Provider, { value: state.ctx, children: [
|
|
63
85
|
children,
|
|
64
86
|
/* @__PURE__ */ jsx(ToastLiveRegion, { announcement: state.liveAnnouncement }),
|
|
65
87
|
typeof document !== "undefined" && state.placements.map((placement) => {
|
|
66
|
-
const portalHost = resolvePortalContainer(portalContainer);
|
|
88
|
+
const portalHost = portalContainer ? resolvePortalContainer(portalContainer) : activeModalDialog ?? resolvePortalContainer(null);
|
|
67
89
|
if (!portalHost) return null;
|
|
68
90
|
return createPortal(
|
|
69
91
|
/* @__PURE__ */ jsx(
|
|
@@ -11,14 +11,16 @@ export declare const TOAST_ICON_CLASS: Record<ToastStatus, string>;
|
|
|
11
11
|
export declare const TOAST_COMPOUND_CONTENTS_CLASS = "contents";
|
|
12
12
|
export declare const TOAST_TITLE_CLASS = "font-w-mid";
|
|
13
13
|
export declare function toastTitleClass(status: ToastStatus): string;
|
|
14
|
-
export declare const TOAST_DESCRIPTION_CLASS = "text-muted";
|
|
14
|
+
export declare const TOAST_DESCRIPTION_CLASS = "text-muted-foreground";
|
|
15
15
|
export declare const TOAST_CLOSE_BUTTON_OFFSET_CLASS = "-mx-xsmall";
|
|
16
16
|
export declare const TOAST_INDICATOR_BASE_CLASS = "inline-flex shrink-0 items-center justify-center";
|
|
17
17
|
export declare function toastIndicatorClass(status: ToastStatus, iconSvgClass: string, slotClass?: string): string;
|
|
18
18
|
export declare const TOAST_VIEWPORT_BASE_CLASS = "fixed z-toast pointer-events-none w-[var(--toast-viewport-width)]";
|
|
19
19
|
export declare const TOAST_STACK_ITEM_CLASS = "col-start-1 row-start-1 [z-index:var(--toast-stack-z)] [pointer-events:var(--toast-stack-events)] [transform-origin:var(--toast-stack-origin)]";
|
|
20
|
-
/** Height is `--toast-stack-height` (front card). Not a tween — layout. */
|
|
20
|
+
/** Height is `--toast-stack-height` (front card or expanded stack). Not a tween — layout. */
|
|
21
21
|
export declare const TOAST_STACK_CONTAINER_CLASS = "relative grid h-[var(--toast-stack-height,auto)]";
|
|
22
|
+
/** Bridges gaps between expanded cards so moving the pointer across cards does not collapse hover. */
|
|
23
|
+
export declare const TOAST_STACK_EXPANDED_CLASS = "pointer-events-auto";
|
|
22
24
|
export declare const TOAST_SCRIM_BASE_CLASS = "pointer-events-none absolute";
|
|
23
25
|
export declare function toastPlacementClass(placement: ToastPlacement): string;
|
|
24
26
|
export declare function toastRootClass({ variant, size, gridSlots, slotClass, className, liftClass, }: {
|
|
@@ -34,7 +36,7 @@ export declare function toastViewportClass({ placement, slotClass, }: {
|
|
|
34
36
|
placement: ToastPlacement;
|
|
35
37
|
slotClass?: string;
|
|
36
38
|
}): string;
|
|
37
|
-
export declare function toastStackClass(slotClass?: string): string;
|
|
39
|
+
export declare function toastStackClass(slotClass?: string, expanded?: boolean): string;
|
|
38
40
|
export declare function toastStackItemClass(slotClass?: string): string;
|
|
39
41
|
export declare function toastStackItemStyle({ origin, zIndex, pointerEvents, }: {
|
|
40
42
|
origin: "top center" | "bottom center";
|
|
@@ -25,7 +25,7 @@ function toastTitleClass(status) {
|
|
|
25
25
|
status !== "default" ? TOAST_ICON_CLASS[status] : ""
|
|
26
26
|
);
|
|
27
27
|
}
|
|
28
|
-
const TOAST_DESCRIPTION_CLASS = "text-muted";
|
|
28
|
+
const TOAST_DESCRIPTION_CLASS = "text-muted-foreground";
|
|
29
29
|
const TOAST_CLOSE_BUTTON_OFFSET_CLASS = "-mx-xsmall";
|
|
30
30
|
const TOAST_INDICATOR_BASE_CLASS = "inline-flex shrink-0 items-center justify-center";
|
|
31
31
|
function toastIndicatorClass(status, iconSvgClass, slotClass) {
|
|
@@ -39,6 +39,7 @@ function toastIndicatorClass(status, iconSvgClass, slotClass) {
|
|
|
39
39
|
const TOAST_VIEWPORT_BASE_CLASS = "fixed z-toast pointer-events-none w-[var(--toast-viewport-width)]";
|
|
40
40
|
const TOAST_STACK_ITEM_CLASS = "col-start-1 row-start-1 [z-index:var(--toast-stack-z)] [pointer-events:var(--toast-stack-events)] [transform-origin:var(--toast-stack-origin)]";
|
|
41
41
|
const TOAST_STACK_CONTAINER_CLASS = "relative grid h-[var(--toast-stack-height,auto)]";
|
|
42
|
+
const TOAST_STACK_EXPANDED_CLASS = "pointer-events-auto";
|
|
42
43
|
const TOAST_SCRIM_BASE_CLASS = "pointer-events-none absolute";
|
|
43
44
|
const PLACEMENT_CLASS = {
|
|
44
45
|
"top-left": "top-4 left-4",
|
|
@@ -79,8 +80,8 @@ function toastViewportClass({
|
|
|
79
80
|
slotClass
|
|
80
81
|
);
|
|
81
82
|
}
|
|
82
|
-
function toastStackClass(slotClass) {
|
|
83
|
-
return cn(TOAST_STACK_CONTAINER_CLASS, slotClass);
|
|
83
|
+
function toastStackClass(slotClass, expanded = false) {
|
|
84
|
+
return cn(TOAST_STACK_CONTAINER_CLASS, expanded && TOAST_STACK_EXPANDED_CLASS, slotClass);
|
|
84
85
|
}
|
|
85
86
|
function toastStackItemClass(slotClass) {
|
|
86
87
|
return cn(TOAST_STACK_ITEM_CLASS, slotClass);
|
|
@@ -112,6 +113,7 @@ export {
|
|
|
112
113
|
TOAST_SCRIM_BASE_CLASS,
|
|
113
114
|
TOAST_SHADOW_SIZE,
|
|
114
115
|
TOAST_STACK_CONTAINER_CLASS,
|
|
116
|
+
TOAST_STACK_EXPANDED_CLASS,
|
|
115
117
|
TOAST_STACK_ITEM_CLASS,
|
|
116
118
|
TOAST_TITLE_CLASS,
|
|
117
119
|
TOAST_VARIANT_SURFACE,
|
|
@@ -189,12 +189,21 @@ export type ToastSimpleBodyProps = {
|
|
|
189
189
|
action?: ReactNode;
|
|
190
190
|
onClose?: () => void;
|
|
191
191
|
};
|
|
192
|
+
export type ToastStackItemLayout = {
|
|
193
|
+
peekY: number;
|
|
194
|
+
scale: number;
|
|
195
|
+
opacity: number;
|
|
196
|
+
hidden: boolean;
|
|
197
|
+
interactive: boolean;
|
|
198
|
+
};
|
|
192
199
|
export type ToastItemWrapperProps = {
|
|
193
200
|
entry: ToastEntry;
|
|
194
201
|
reverseIdx: number;
|
|
195
202
|
total: number;
|
|
196
203
|
isTop: boolean;
|
|
197
204
|
isDismissing: boolean;
|
|
205
|
+
paused?: boolean;
|
|
206
|
+
stackLayout?: ToastStackItemLayout;
|
|
198
207
|
onDismiss: (id: string) => void;
|
|
199
208
|
onRemoveFinal: (id: string) => void;
|
|
200
209
|
onHeightChange: (id: string, h: number) => void;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { useState, useRef, useCallback, useMemo } from "react";
|
|
2
|
+
import { useState, useRef, useEffect, useCallback, useMemo } from "react";
|
|
3
3
|
import { createToastId, TOAST_DEFAULT_DURATION_MS } from "./toastAPI.js";
|
|
4
4
|
import { toastAnnouncementText, resolveToastLiveRole } from "./toastA11y.js";
|
|
5
5
|
function useToastProviderState({
|
|
@@ -17,14 +17,28 @@ function useToastProviderState({
|
|
|
17
17
|
});
|
|
18
18
|
const orderRef = useRef(0);
|
|
19
19
|
const announceNonceRef = useRef(0);
|
|
20
|
+
const announceRafRef = useRef(null);
|
|
20
21
|
const toastsRef = useRef(toasts);
|
|
21
22
|
toastsRef.current = toasts;
|
|
23
|
+
useEffect(() => {
|
|
24
|
+
return () => {
|
|
25
|
+
if (announceRafRef.current != null) {
|
|
26
|
+
cancelAnimationFrame(announceRafRef.current);
|
|
27
|
+
announceRafRef.current = null;
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
}, []);
|
|
22
31
|
const announce = useCallback((entry) => {
|
|
23
32
|
const text = toastAnnouncementText(entry.title, entry.description);
|
|
24
33
|
if (!text) return;
|
|
25
34
|
const assertive = resolveToastLiveRole(entry.status) === "alert";
|
|
35
|
+
if (announceRafRef.current != null) {
|
|
36
|
+
cancelAnimationFrame(announceRafRef.current);
|
|
37
|
+
announceRafRef.current = null;
|
|
38
|
+
}
|
|
26
39
|
setLiveAnnouncement({ text: "", assertive, nonce: ++announceNonceRef.current });
|
|
27
|
-
requestAnimationFrame(() => {
|
|
40
|
+
announceRafRef.current = requestAnimationFrame(() => {
|
|
41
|
+
announceRafRef.current = null;
|
|
28
42
|
setLiveAnnouncement({
|
|
29
43
|
text,
|
|
30
44
|
assertive,
|
|
@@ -35,6 +49,39 @@ function useToastProviderState({
|
|
|
35
49
|
const add = useCallback(
|
|
36
50
|
(opts) => {
|
|
37
51
|
const id = opts.id ?? createToastId();
|
|
52
|
+
const existing = opts.id != null ? toastsRef.current.find((t) => t.id === id) : void 0;
|
|
53
|
+
if (existing) {
|
|
54
|
+
const updated = {
|
|
55
|
+
...existing,
|
|
56
|
+
status: opts.status ?? existing.status,
|
|
57
|
+
variant: opts.variant ?? existing.variant,
|
|
58
|
+
size: opts.size ?? existing.size,
|
|
59
|
+
title: opts.title !== void 0 ? opts.title : existing.title,
|
|
60
|
+
description: opts.description !== void 0 ? opts.description : existing.description,
|
|
61
|
+
action: opts.action !== void 0 ? opts.action : existing.action,
|
|
62
|
+
duration: opts.duration ?? existing.duration,
|
|
63
|
+
onClose: opts.onClose ?? existing.onClose,
|
|
64
|
+
placement: opts.placement ?? existing.placement,
|
|
65
|
+
loading: opts.loading ?? false,
|
|
66
|
+
classNames: opts.classNames ? { ...providerClassNames, ...opts.classNames } : existing.classNames,
|
|
67
|
+
motion: opts.motion ?? existing.motion,
|
|
68
|
+
motionController: opts.motionController ?? existing.motionController,
|
|
69
|
+
motionState: opts.motionState ?? existing.motionState,
|
|
70
|
+
motionPayload: opts.motionPayload ?? existing.motionPayload,
|
|
71
|
+
playInitialState: opts.playInitialState ?? existing.playInitialState
|
|
72
|
+
};
|
|
73
|
+
const nextList2 = toastsRef.current.map((t) => t.id === id ? updated : t);
|
|
74
|
+
toastsRef.current = nextList2;
|
|
75
|
+
setToasts(nextList2);
|
|
76
|
+
setDismissingIds((prev) => {
|
|
77
|
+
if (!prev.has(id)) return prev;
|
|
78
|
+
const n = new Set(prev);
|
|
79
|
+
n.delete(id);
|
|
80
|
+
return n;
|
|
81
|
+
});
|
|
82
|
+
announce(updated);
|
|
83
|
+
return id;
|
|
84
|
+
}
|
|
38
85
|
const entry = {
|
|
39
86
|
id,
|
|
40
87
|
status: opts.status ?? "default",
|
|
@@ -55,7 +102,9 @@ function useToastProviderState({
|
|
|
55
102
|
motionPayload: opts.motionPayload,
|
|
56
103
|
playInitialState: opts.playInitialState
|
|
57
104
|
};
|
|
58
|
-
|
|
105
|
+
const nextList = [...toastsRef.current, entry];
|
|
106
|
+
toastsRef.current = nextList;
|
|
107
|
+
setToasts(nextList);
|
|
59
108
|
announce(entry);
|
|
60
109
|
return id;
|
|
61
110
|
},
|
|
@@ -66,7 +115,9 @@ function useToastProviderState({
|
|
|
66
115
|
const current = toastsRef.current.find((t) => t.id === id);
|
|
67
116
|
if (!current) return;
|
|
68
117
|
const updated = { ...current, ...patch };
|
|
69
|
-
|
|
118
|
+
const nextList = toastsRef.current.map((t) => t.id === id ? updated : t);
|
|
119
|
+
toastsRef.current = nextList;
|
|
120
|
+
setToasts(nextList);
|
|
70
121
|
if (patch.title !== void 0 || patch.description !== void 0 || patch.status !== void 0 || patch.loading === false) {
|
|
71
122
|
announce(updated);
|
|
72
123
|
}
|
|
@@ -82,13 +133,17 @@ function useToastProviderState({
|
|
|
82
133
|
setDismissingIds((prev) => /* @__PURE__ */ new Set([...prev, ...ids]));
|
|
83
134
|
}, []);
|
|
84
135
|
const removeFinal = useCallback((id) => {
|
|
85
|
-
toastsRef.current.find((t) => t.id === id)
|
|
86
|
-
|
|
136
|
+
const removed = toastsRef.current.find((t) => t.id === id);
|
|
137
|
+
const nextList = toastsRef.current.filter((t) => t.id !== id);
|
|
138
|
+
toastsRef.current = nextList;
|
|
139
|
+
setToasts(nextList);
|
|
87
140
|
setDismissingIds((prev) => {
|
|
141
|
+
if (!prev.has(id)) return prev;
|
|
88
142
|
const n = new Set(prev);
|
|
89
143
|
n.delete(id);
|
|
90
144
|
return n;
|
|
91
145
|
});
|
|
146
|
+
removed?.onClose?.();
|
|
92
147
|
}, []);
|
|
93
148
|
const placements = useMemo(
|
|
94
149
|
() => [...new Set(toasts.map((t) => t.placement))],
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { forwardRef, useRef, useMemo } from "react";
|
|
4
|
-
import { dataOnState, dataGroupSegment, dataVariantProps } from "../utils/dataContract.js";
|
|
4
|
+
import { dataOnState, dataFlag, dataGroupSegment, dataVariantProps } from "../utils/dataContract.js";
|
|
5
5
|
import { usesKitElevation } from "../../../skins/resolveVariantVisual.js";
|
|
6
6
|
import { useSkinRegistryRevision } from "../../../skins/skinContext.js";
|
|
7
7
|
import { resolveToggleButtonMotionDefaults, useToggleButtonAnimations } from "./toggleButtonAnimations.js";
|
|
@@ -27,11 +27,14 @@ function ToggleButtonSurface({
|
|
|
27
27
|
onReleaseStartRef,
|
|
28
28
|
onPointerDown,
|
|
29
29
|
onPointerUp,
|
|
30
|
+
onPointerCancel,
|
|
30
31
|
onPointerOver,
|
|
31
32
|
onPointerOut,
|
|
32
33
|
onPointerEnter,
|
|
33
34
|
onPointerLeave,
|
|
34
|
-
onKeyDown
|
|
35
|
+
onKeyDown,
|
|
36
|
+
onKeyUp,
|
|
37
|
+
onBlur
|
|
35
38
|
}) {
|
|
36
39
|
const animations = useToggleButtonAnimations({
|
|
37
40
|
disabled: state.disabled,
|
|
@@ -49,7 +52,10 @@ function ToggleButtonSurface({
|
|
|
49
52
|
onPointerOut,
|
|
50
53
|
onPointerDown,
|
|
51
54
|
onPointerUp,
|
|
52
|
-
|
|
55
|
+
onPointerCancel,
|
|
56
|
+
onKeyDown,
|
|
57
|
+
onKeyUp,
|
|
58
|
+
onBlur
|
|
53
59
|
});
|
|
54
60
|
const buttonClass = toggleButtonRootClass({
|
|
55
61
|
variant: state.variant,
|
|
@@ -89,18 +95,22 @@ function ToggleButtonSurface({
|
|
|
89
95
|
tabIndex: state.tabIndex,
|
|
90
96
|
className: buttonClass,
|
|
91
97
|
...rest,
|
|
92
|
-
...dataVariantProps({ size: state.size, variant: state.variant }),
|
|
93
|
-
"data-value": state.itemValue,
|
|
94
|
-
"data-group-segment": dataGroupSegment(state.groupSegment != null),
|
|
95
98
|
onPointerOver: animations.pointerHandlers.onPointerOver,
|
|
96
99
|
onPointerOut: animations.pointerHandlers.onPointerOut,
|
|
97
100
|
onPointerEnter: animations.handlePointerEnter,
|
|
98
101
|
onPointerLeave: animations.handlePointerLeave,
|
|
99
102
|
onPointerDown: animations.handlePointerDown,
|
|
100
103
|
onPointerUp: animations.handlePointerUp,
|
|
104
|
+
onPointerCancel: animations.handlePointerCancel,
|
|
101
105
|
onKeyDown: animations.handleKeyDown,
|
|
102
|
-
|
|
106
|
+
onKeyUp: animations.handleKeyUp,
|
|
107
|
+
onClick: state.handleClick,
|
|
103
108
|
onFocus: state.handleFocus,
|
|
109
|
+
onBlur: animations.handleBlur,
|
|
110
|
+
...dataVariantProps({ size: state.size, variant: state.variant }),
|
|
111
|
+
"data-value": state.itemValue,
|
|
112
|
+
"data-group-segment": dataGroupSegment(state.groupSegment != null),
|
|
113
|
+
"data-disabled": dataFlag(state.disabled),
|
|
104
114
|
"data-state": dataOnState(state.pressed),
|
|
105
115
|
children: [
|
|
106
116
|
!hasCompoundFill ? /* @__PURE__ */ jsx(ToggleButtonFill, {}) : null,
|
|
@@ -134,13 +144,16 @@ const ToggleButtonRoot = forwardRef(
|
|
|
134
144
|
playInitialState,
|
|
135
145
|
onClick,
|
|
136
146
|
onFocus,
|
|
147
|
+
onBlur,
|
|
137
148
|
onPointerDown,
|
|
138
149
|
onPointerUp,
|
|
150
|
+
onPointerCancel,
|
|
139
151
|
onPointerOver,
|
|
140
152
|
onPointerOut,
|
|
141
153
|
onPointerEnter,
|
|
142
154
|
onPointerLeave,
|
|
143
155
|
onKeyDown,
|
|
156
|
+
onKeyUp,
|
|
144
157
|
...rest
|
|
145
158
|
}, ref) {
|
|
146
159
|
const state = useToggleButtonRootState({
|
|
@@ -198,11 +211,14 @@ const ToggleButtonRoot = forwardRef(
|
|
|
198
211
|
onReleaseStartRef,
|
|
199
212
|
onPointerDown,
|
|
200
213
|
onPointerUp,
|
|
214
|
+
onPointerCancel,
|
|
201
215
|
onPointerOver,
|
|
202
216
|
onPointerOut,
|
|
203
217
|
onPointerEnter,
|
|
204
218
|
onPointerLeave,
|
|
205
219
|
onKeyDown,
|
|
220
|
+
onKeyUp,
|
|
221
|
+
onBlur,
|
|
206
222
|
children
|
|
207
223
|
}
|
|
208
224
|
)
|