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
|
@@ -59,7 +59,12 @@ function usePinInputShellMotion({
|
|
|
59
59
|
useOptionalEnterOnMount(scope, "shell", part.targetRef);
|
|
60
60
|
return part;
|
|
61
61
|
}
|
|
62
|
-
function usePinInputControlMotion(
|
|
62
|
+
function usePinInputControlMotion({
|
|
63
|
+
onPointerOver,
|
|
64
|
+
onPointerOut,
|
|
65
|
+
onPointerDown,
|
|
66
|
+
onPointerUp
|
|
67
|
+
} = {}) {
|
|
63
68
|
const scope = useOptionalPinInputMotionScope();
|
|
64
69
|
const { disabled, variant } = usePinInputContext();
|
|
65
70
|
const kitSurface = usesKitElevation(variant, KIT_INPUT_VARIANTS);
|
|
@@ -75,12 +80,16 @@ function usePinInputControlMotion() {
|
|
|
75
80
|
scope,
|
|
76
81
|
slot: "control",
|
|
77
82
|
pointerPhases: !disabled,
|
|
78
|
-
onPointerOver: () => {
|
|
83
|
+
onPointerOver: (event) => {
|
|
79
84
|
pointerInsideRef.current = true;
|
|
85
|
+
onPointerOver?.(event);
|
|
80
86
|
},
|
|
81
|
-
onPointerOut: () => {
|
|
87
|
+
onPointerOut: (event) => {
|
|
82
88
|
pointerInsideRef.current = false;
|
|
83
|
-
|
|
89
|
+
onPointerOut?.(event);
|
|
90
|
+
},
|
|
91
|
+
onPointerDown,
|
|
92
|
+
onPointerUp
|
|
84
93
|
});
|
|
85
94
|
useOptionalEnterOnMount(scope, "control", part.targetRef);
|
|
86
95
|
const setRef = (node) => {
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx, jsxs, Fragment as Fragment$1 } from "react/jsx-runtime";
|
|
3
|
-
import { forwardRef, useContext, useRef, useState, useCallback, useMemo,
|
|
3
|
+
import { forwardRef, useContext, useRef, useState, useEffect, useCallback, useMemo, Fragment, createContext, Children, cloneElement, isValidElement } from "react";
|
|
4
4
|
import { Field } from "../Field/index.js";
|
|
5
|
+
import { dataFlag } from "../utils/dataContract.js";
|
|
6
|
+
import { isImeComposingEvent } from "../utils/fieldFormDom.js";
|
|
5
7
|
import { mergeRefs } from "../utils/mergeRefs.js";
|
|
6
|
-
import { ariaInvalidValue, fieldPaintStatus } from "../utils/fieldInvalid.js";
|
|
8
|
+
import { dataInvalidValue, ariaInvalidValue, fieldPaintStatus } from "../utils/fieldInvalid.js";
|
|
7
9
|
import { cn } from "../../../utils/cn.js";
|
|
8
10
|
import { pinInputCellLabel } from "./pinInputA11y.js";
|
|
9
11
|
import { pinInputChars, pinInputKeyAction, pinInputChar, pinInputSeparatorIndex } from "./pinInputAPI.js";
|
|
@@ -14,11 +16,29 @@ const PinFieldHostContext = createContext(null);
|
|
|
14
16
|
function isPinInputControl(child) {
|
|
15
17
|
return isValidElement(child) && child.type === PinInputControl;
|
|
16
18
|
}
|
|
17
|
-
const PinInputControl = forwardRef(function PinInputControl2({
|
|
19
|
+
const PinInputControl = forwardRef(function PinInputControl2({
|
|
20
|
+
index: indexProp = 0,
|
|
21
|
+
className,
|
|
22
|
+
id: idProp,
|
|
23
|
+
autoComplete,
|
|
24
|
+
onFocus,
|
|
25
|
+
onPaste,
|
|
26
|
+
onKeyDown,
|
|
27
|
+
onPointerOver,
|
|
28
|
+
onPointerOut,
|
|
29
|
+
onPointerDown,
|
|
30
|
+
onPointerUp,
|
|
31
|
+
...rest
|
|
32
|
+
}, ref) {
|
|
18
33
|
const field = usePinInputContext();
|
|
19
34
|
const host = useContext(PinFieldHostContext);
|
|
20
35
|
const slotClassNames = usePinInputClassNames();
|
|
21
|
-
const motion = usePinInputControlMotion(
|
|
36
|
+
const motion = usePinInputControlMotion({
|
|
37
|
+
onPointerOver,
|
|
38
|
+
onPointerOut,
|
|
39
|
+
onPointerDown,
|
|
40
|
+
onPointerUp
|
|
41
|
+
});
|
|
22
42
|
const index = indexProp;
|
|
23
43
|
const chars = pinInputChars(field.value, field.length);
|
|
24
44
|
const value = chars[index] ?? "";
|
|
@@ -28,8 +48,9 @@ const PinInputControl = forwardRef(function PinInputControl2({ index: indexProp
|
|
|
28
48
|
{
|
|
29
49
|
ref: mergeRefs(ref, motion.setRef, (node) => {
|
|
30
50
|
host?.register(index, node);
|
|
51
|
+
if (index === 0) field.setFirstCellRef?.(node);
|
|
31
52
|
}),
|
|
32
|
-
|
|
53
|
+
id: idProp ?? (index === 0 ? field.inputId : void 0),
|
|
33
54
|
className: pinInputFieldClass({
|
|
34
55
|
size: field.size,
|
|
35
56
|
variant: field.variant,
|
|
@@ -46,23 +67,41 @@ const PinInputControl = forwardRef(function PinInputControl2({ index: indexProp
|
|
|
46
67
|
readOnly: field.readOnly,
|
|
47
68
|
required: field.required && index === 0,
|
|
48
69
|
inputMode: field.type === "number" ? "numeric" : "text",
|
|
49
|
-
autoComplete: index === 0 ? "one-time-code" : "off",
|
|
50
|
-
type: "text",
|
|
70
|
+
autoComplete: index === 0 ? autoComplete ?? "one-time-code" : "off",
|
|
71
|
+
type: field.mask ? "password" : "text",
|
|
51
72
|
tabIndex: focused ? 0 : -1,
|
|
52
73
|
"aria-label": pinInputCellLabel(index, field.length, field.type),
|
|
53
|
-
"aria-invalid": ariaInvalidValue(field.isInvalid),
|
|
54
74
|
"aria-describedby": field.describedBy,
|
|
55
|
-
onFocus: () => {
|
|
56
|
-
|
|
57
|
-
if (
|
|
58
|
-
host.move(field.value.length);
|
|
59
|
-
return;
|
|
60
|
-
}
|
|
75
|
+
onFocus: (event) => {
|
|
76
|
+
onFocus?.(event);
|
|
77
|
+
if (event.defaultPrevented || host == null) return;
|
|
61
78
|
host.setFocusedIndex(index);
|
|
62
79
|
},
|
|
63
80
|
onChange: (event) => {
|
|
64
|
-
if (host == null) return;
|
|
65
|
-
const
|
|
81
|
+
if (host == null || field.disabled || field.readOnly) return;
|
|
82
|
+
const raw = event.target.value;
|
|
83
|
+
if (raw === "") {
|
|
84
|
+
if (value !== "") {
|
|
85
|
+
host.move(field.remove(index));
|
|
86
|
+
}
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
const rawChars = [...raw];
|
|
90
|
+
if (value !== "" && rawChars.length === 2) {
|
|
91
|
+
let typedChar;
|
|
92
|
+
if (rawChars[0] === value) {
|
|
93
|
+
typedChar = rawChars[1];
|
|
94
|
+
} else if (rawChars[1] === value) {
|
|
95
|
+
typedChar = rawChars[0];
|
|
96
|
+
}
|
|
97
|
+
if (typedChar !== void 0) {
|
|
98
|
+
const valid = pinInputChar(typedChar, field.type);
|
|
99
|
+
if (!valid) return;
|
|
100
|
+
host.move(field.write(index, valid));
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
const incoming = rawChars.map((char) => pinInputChar(char, field.type)).filter(Boolean);
|
|
66
105
|
if (incoming.length === 0) return;
|
|
67
106
|
if (incoming.length === 1) {
|
|
68
107
|
host.move(field.write(index, incoming[0] ?? ""));
|
|
@@ -71,19 +110,29 @@ const PinInputControl = forwardRef(function PinInputControl2({ index: indexProp
|
|
|
71
110
|
host.move(field.paste(index, incoming.join("")));
|
|
72
111
|
},
|
|
73
112
|
onPaste: (event) => {
|
|
74
|
-
|
|
113
|
+
onPaste?.(event);
|
|
114
|
+
if (event.defaultPrevented || host == null || field.disabled || field.readOnly) return;
|
|
75
115
|
event.preventDefault();
|
|
76
116
|
host.move(field.paste(index, event.clipboardData.getData("text")));
|
|
77
117
|
},
|
|
78
118
|
onKeyDown: (event) => {
|
|
79
|
-
|
|
119
|
+
onKeyDown?.(event);
|
|
120
|
+
if (event.defaultPrevented || isImeComposingEvent(event) || host == null || field.disabled || field.readOnly) {
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
80
123
|
const action = pinInputKeyAction(event.key, index, field.length, field.value);
|
|
81
124
|
if (action.type === "none") return;
|
|
82
125
|
event.preventDefault();
|
|
83
126
|
if (action.type === "move") host.move(action.index);
|
|
84
127
|
if (action.type === "delete") host.move(field.remove(index));
|
|
85
128
|
},
|
|
86
|
-
...
|
|
129
|
+
...rest,
|
|
130
|
+
...motion.pointerHandlers,
|
|
131
|
+
"aria-invalid": ariaInvalidValue(field.isInvalid),
|
|
132
|
+
"data-invalid": dataInvalidValue(field.isInvalid),
|
|
133
|
+
"data-disabled": dataFlag(field.disabled),
|
|
134
|
+
"data-readonly": dataFlag(field.readOnly),
|
|
135
|
+
"data-required": dataFlag(field.required && index === 0)
|
|
87
136
|
}
|
|
88
137
|
);
|
|
89
138
|
});
|
|
@@ -99,6 +148,7 @@ const PinInputShell = forwardRef(function PinInputShell2({
|
|
|
99
148
|
children,
|
|
100
149
|
className,
|
|
101
150
|
motion,
|
|
151
|
+
onBlur,
|
|
102
152
|
onPointerOver,
|
|
103
153
|
onPointerOut,
|
|
104
154
|
onPointerDown,
|
|
@@ -119,6 +169,11 @@ const PinInputShell = forwardRef(function PinInputShell2({
|
|
|
119
169
|
const [focusIndex, setFocusIndex] = useState(0);
|
|
120
170
|
const separatorAt = field.separator != null ? pinInputSeparatorIndex(field.length) : -1;
|
|
121
171
|
const fieldCount = pinInputFieldCount(children);
|
|
172
|
+
useEffect(() => {
|
|
173
|
+
if (field.resetVersion) {
|
|
174
|
+
setFocusIndex(0);
|
|
175
|
+
}
|
|
176
|
+
}, [field.resetVersion]);
|
|
122
177
|
const register = useCallback((index, node) => {
|
|
123
178
|
cells.current[index] = node;
|
|
124
179
|
}, []);
|
|
@@ -171,10 +226,19 @@ const PinInputShell = forwardRef(function PinInputShell2({
|
|
|
171
226
|
return /* @__PURE__ */ jsx(PinFieldHostContext.Provider, { value: host, children: /* @__PURE__ */ jsxs(
|
|
172
227
|
"div",
|
|
173
228
|
{
|
|
174
|
-
ref:
|
|
229
|
+
ref: (node) => {
|
|
230
|
+
part.setRef(node);
|
|
231
|
+
field.registerShellRef?.(node);
|
|
232
|
+
},
|
|
175
233
|
role: "group",
|
|
176
234
|
"aria-labelledby": field.labelled ? field.labelId : void 0,
|
|
177
235
|
className: pinInputGroupClass({ slotClass: slotClassNames.shell, className }),
|
|
236
|
+
onBlur: (event) => {
|
|
237
|
+
onBlur?.(event);
|
|
238
|
+
if (!event.currentTarget.contains(event.relatedTarget)) {
|
|
239
|
+
field.notifyBlur?.();
|
|
240
|
+
}
|
|
241
|
+
},
|
|
178
242
|
...rest,
|
|
179
243
|
...part.pointerHandlers,
|
|
180
244
|
children: [
|
|
@@ -2,7 +2,7 @@ import { FieldShellStatus } from '../utils/fieldShellVariant.js';
|
|
|
2
2
|
import { InputSize, InputVariant } from '../Input/inputTypes.js';
|
|
3
3
|
export declare const PIN_INPUT_ROOT_CLASS = "w-fit max-w-full min-w-0";
|
|
4
4
|
export declare const PIN_INPUT_GROUP_CLASS = "flex items-center gap-small";
|
|
5
|
-
export declare const PIN_INPUT_SEPARATOR_CLASS = "select-none text-muted";
|
|
5
|
+
export declare const PIN_INPUT_SEPARATOR_CLASS = "select-none text-muted-foreground";
|
|
6
6
|
export declare const PIN_INPUT_DISABLED_CLASS = "cursor-not-allowed opacity-55";
|
|
7
7
|
/** Dots without `type="password"`, so the browser does not offer a saved password. */
|
|
8
8
|
export declare const PIN_INPUT_MASK_CLASS = "[-webkit-text-security:disc] [text-security:disc]";
|
|
@@ -7,7 +7,7 @@ import { cn } from "../../../utils/cn.js";
|
|
|
7
7
|
import { CONTROL_SIZE_LAYOUT } from "../utils/sizeLayout/control.js";
|
|
8
8
|
const PIN_INPUT_ROOT_CLASS = "w-fit max-w-full min-w-0";
|
|
9
9
|
const PIN_INPUT_GROUP_CLASS = "flex items-center gap-small";
|
|
10
|
-
const PIN_INPUT_SEPARATOR_CLASS = "select-none text-muted";
|
|
10
|
+
const PIN_INPUT_SEPARATOR_CLASS = "select-none text-muted-foreground";
|
|
11
11
|
const PIN_INPUT_CELL_BOX = {
|
|
12
12
|
small: "w-control-small min-h-control-small",
|
|
13
13
|
base: "w-control-base min-h-control-base",
|
|
@@ -44,7 +44,7 @@ function pinInputFieldClass({
|
|
|
44
44
|
}) {
|
|
45
45
|
const kitSurface = usesKitElevation(variant, KIT_INPUT_VARIANTS);
|
|
46
46
|
return cn(
|
|
47
|
-
"box-border shrink-0 border-1 text-center text-foreground outline-none tabular-nums placeholder:text-muted",
|
|
47
|
+
"box-border shrink-0 border-1 text-center text-foreground outline-none tabular-nums placeholder:text-muted-foreground",
|
|
48
48
|
PIN_INPUT_CELL_BOX[size],
|
|
49
49
|
CONTROL_SIZE_LAYOUT[size].rounded,
|
|
50
50
|
PIN_INPUT_CELL_TEXT[size],
|
|
@@ -114,4 +114,8 @@ export type PinInputContextValue = {
|
|
|
114
114
|
required: boolean;
|
|
115
115
|
isInvalid: boolean;
|
|
116
116
|
describedBy?: string;
|
|
117
|
+
setFirstCellRef?: (node: HTMLInputElement | null) => void;
|
|
118
|
+
registerShellRef?: (node: HTMLDivElement | null) => void;
|
|
119
|
+
notifyBlur?: () => void;
|
|
120
|
+
resetVersion?: number;
|
|
117
121
|
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { useId, useCallback, useMemo } from "react";
|
|
3
|
-
import {
|
|
2
|
+
import { useId, useState, useRef, useCallback, useMemo } from "react";
|
|
3
|
+
import { useFormFieldBinding } from "../../composite/Form/useFormFieldBinding.js";
|
|
4
|
+
import { useNativeFormReset } from "../utils/fieldFormDom.js";
|
|
4
5
|
import { hasCompoundChild } from "../utils/hasCompoundChild.js";
|
|
5
6
|
import { hasCompoundChildren } from "../utils/hasCompoundChildren.js";
|
|
6
|
-
import { useControllableState } from "../utils/useControllableState.js";
|
|
7
7
|
import { useResolvedFieldInvalid } from "../utils/fieldInvalid.js";
|
|
8
8
|
import { pinInputDescribedBy, pinInputFieldIds } from "./pinInputA11y.js";
|
|
9
9
|
import { pinInputInsert, pinInputPaste, pinInputDelete, pinInputLength } from "./pinInputAPI.js";
|
|
@@ -30,63 +30,92 @@ function usePinInputRootState({
|
|
|
30
30
|
mask = false,
|
|
31
31
|
separator
|
|
32
32
|
}) {
|
|
33
|
-
const
|
|
33
|
+
const formBinding = useFormFieldBinding({
|
|
34
|
+
name,
|
|
35
|
+
value: valueProp,
|
|
36
|
+
disabled,
|
|
37
|
+
readOnly
|
|
38
|
+
});
|
|
34
39
|
const reactId = useId();
|
|
35
40
|
const inputId = id ?? `pin-input-${reactId}`;
|
|
36
41
|
const ids = pinInputFieldIds(inputId);
|
|
37
42
|
const isCompound = hasCompoundChildren(children);
|
|
38
43
|
const length = pinInputLength(lengthProp);
|
|
39
44
|
const explicit = valueProp !== void 0;
|
|
40
|
-
const bound =
|
|
41
|
-
const
|
|
42
|
-
const
|
|
43
|
-
const [
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
45
|
+
const bound = formBinding.bound;
|
|
46
|
+
const controlled = explicit ? valueProp : bound ? String(formBinding.value ?? "") : void 0;
|
|
47
|
+
const isControlled = controlled !== void 0;
|
|
48
|
+
const [internalValue, setInternalValue] = useState(defaultValue);
|
|
49
|
+
const [resetVersion, setResetVersion] = useState(0);
|
|
50
|
+
const shellNodeRef = useRef(null);
|
|
51
|
+
const value = isControlled ? controlled : internalValue;
|
|
52
|
+
const onValueChangeRef = useRef(onValueChange);
|
|
53
|
+
onValueChangeRef.current = onValueChange;
|
|
54
|
+
const setValue = useCallback(
|
|
55
|
+
(next) => {
|
|
56
|
+
if (!isControlled) setInternalValue(next);
|
|
57
|
+
onValueChangeRef.current?.(next);
|
|
58
|
+
if (bound) {
|
|
59
|
+
formBinding.setValue(next);
|
|
50
60
|
}
|
|
51
|
-
}
|
|
52
|
-
|
|
61
|
+
},
|
|
62
|
+
[bound, formBinding, isControlled]
|
|
63
|
+
);
|
|
64
|
+
useNativeFormReset(
|
|
65
|
+
shellNodeRef,
|
|
66
|
+
() => {
|
|
67
|
+
setInternalValue(defaultValue);
|
|
68
|
+
setResetVersion((n) => n + 1);
|
|
69
|
+
},
|
|
70
|
+
!isControlled
|
|
71
|
+
);
|
|
72
|
+
const registerShellRef = useCallback((node) => {
|
|
73
|
+
shellNodeRef.current = node;
|
|
74
|
+
}, []);
|
|
53
75
|
const code = value.slice(0, length);
|
|
54
|
-
const
|
|
76
|
+
const resolvedDisabled = Boolean(formBinding.disabled);
|
|
77
|
+
const resolvedReadOnly = Boolean(formBinding.readOnly);
|
|
78
|
+
const resolvedError = error ?? formBinding.error;
|
|
79
|
+
const blocked = resolvedDisabled;
|
|
55
80
|
const write = useCallback(
|
|
56
81
|
(index, char) => {
|
|
57
|
-
if (blocked ||
|
|
82
|
+
if (blocked || resolvedReadOnly) return index;
|
|
83
|
+
const at = Math.min(Math.max(0, index), code.length, length - 1);
|
|
58
84
|
const next = pinInputInsert(code, index, char, length);
|
|
59
85
|
setValue(next);
|
|
60
86
|
if (next.length === length && code.length < length) onComplete?.(next);
|
|
61
|
-
return Math.min(
|
|
87
|
+
return Math.min(at + 1, length - 1);
|
|
62
88
|
},
|
|
63
|
-
[blocked, code, length, onComplete,
|
|
89
|
+
[blocked, code, length, onComplete, resolvedReadOnly, setValue]
|
|
64
90
|
);
|
|
65
91
|
const paste = useCallback(
|
|
66
92
|
(index, text) => {
|
|
67
|
-
if (blocked ||
|
|
93
|
+
if (blocked || resolvedReadOnly) return index;
|
|
68
94
|
const next = pinInputPaste(code, index, text, type, length);
|
|
69
95
|
setValue(next.value);
|
|
70
96
|
if (next.value.length === length && code.length < length) onComplete?.(next.value);
|
|
71
97
|
return next.focus;
|
|
72
98
|
},
|
|
73
|
-
[blocked, code, length, onComplete,
|
|
99
|
+
[blocked, code, length, onComplete, resolvedReadOnly, setValue, type]
|
|
74
100
|
);
|
|
75
101
|
const remove = useCallback(
|
|
76
102
|
(index) => {
|
|
77
|
-
if (blocked ||
|
|
103
|
+
if (blocked || resolvedReadOnly) return index;
|
|
78
104
|
const next = pinInputDelete(code, index);
|
|
79
105
|
setValue(next.value);
|
|
80
106
|
return next.focus;
|
|
81
107
|
},
|
|
82
|
-
[blocked, code,
|
|
108
|
+
[blocked, code, resolvedReadOnly, setValue]
|
|
83
109
|
);
|
|
84
|
-
const
|
|
110
|
+
const setFirstCellRef = formBinding.ref;
|
|
111
|
+
const notifyBlur = formBinding.onBlur;
|
|
112
|
+
const labelConnected = isCompound ? hasCompoundChild(children, "PinInputLabel") || hasCompoundChild(children, "Label") : label != null;
|
|
85
113
|
const hintConnected = isCompound ? hasCompoundChild(children, "PinInputHint") : hint != null;
|
|
86
|
-
const errorConnected = isCompound ? hasCompoundChild(children, "PinInputError") :
|
|
114
|
+
const errorConnected = isCompound ? hasCompoundChild(children, "PinInputError") : resolvedError != null;
|
|
87
115
|
const isInvalid = useResolvedFieldInvalid({
|
|
88
116
|
invalid,
|
|
89
|
-
errorConnected:
|
|
117
|
+
errorConnected: resolvedError != null || errorConnected,
|
|
118
|
+
formInvalid: formBinding["aria-invalid"] === true
|
|
90
119
|
});
|
|
91
120
|
const contextValue = useMemo(
|
|
92
121
|
() => ({
|
|
@@ -100,7 +129,7 @@ function usePinInputRootState({
|
|
|
100
129
|
paste,
|
|
101
130
|
remove,
|
|
102
131
|
disabled: blocked,
|
|
103
|
-
readOnly,
|
|
132
|
+
readOnly: resolvedReadOnly,
|
|
104
133
|
size,
|
|
105
134
|
variant,
|
|
106
135
|
inputId,
|
|
@@ -109,8 +138,8 @@ function usePinInputRootState({
|
|
|
109
138
|
errorId: ids.errorId,
|
|
110
139
|
label,
|
|
111
140
|
hint,
|
|
112
|
-
error,
|
|
113
|
-
name,
|
|
141
|
+
error: resolvedError,
|
|
142
|
+
name: formBinding.name ?? name,
|
|
114
143
|
labelled: labelConnected,
|
|
115
144
|
required,
|
|
116
145
|
isInvalid,
|
|
@@ -119,13 +148,17 @@ function usePinInputRootState({
|
|
|
119
148
|
errorConnected,
|
|
120
149
|
hintId: ids.hintId,
|
|
121
150
|
errorId: ids.errorId
|
|
122
|
-
})
|
|
151
|
+
}),
|
|
152
|
+
setFirstCellRef,
|
|
153
|
+
registerShellRef,
|
|
154
|
+
notifyBlur,
|
|
155
|
+
resetVersion
|
|
123
156
|
}),
|
|
124
157
|
[
|
|
125
158
|
blocked,
|
|
126
159
|
code,
|
|
127
|
-
error,
|
|
128
160
|
errorConnected,
|
|
161
|
+
formBinding.name,
|
|
129
162
|
hint,
|
|
130
163
|
hintConnected,
|
|
131
164
|
ids.errorId,
|
|
@@ -138,12 +171,17 @@ function usePinInputRootState({
|
|
|
138
171
|
labelConnected,
|
|
139
172
|
mask,
|
|
140
173
|
name,
|
|
174
|
+
notifyBlur,
|
|
141
175
|
paste,
|
|
142
176
|
placeholder,
|
|
143
|
-
|
|
177
|
+
registerShellRef,
|
|
144
178
|
remove,
|
|
145
179
|
required,
|
|
180
|
+
resetVersion,
|
|
181
|
+
resolvedError,
|
|
182
|
+
resolvedReadOnly,
|
|
146
183
|
separator,
|
|
184
|
+
setFirstCellRef,
|
|
147
185
|
size,
|
|
148
186
|
type,
|
|
149
187
|
variant,
|
|
@@ -10,6 +10,7 @@ export declare function usePopoverContentLifecycle({ open, side, offset, align,
|
|
|
10
10
|
panelRef: import('react').RefObject<HTMLDivElement | null>;
|
|
11
11
|
setPanelRef: (node: HTMLDivElement | null) => void;
|
|
12
12
|
portalMounted: boolean;
|
|
13
|
+
portalHost: HTMLElement | null;
|
|
13
14
|
resolvedSide: import('../Tooltip/tooltipPosition.js').TooltipSide;
|
|
14
15
|
};
|
|
15
16
|
export declare function resolvePopoverContentAlign({ alignProp, matchAnchorWidth, }: {
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { useRef, useState, useCallback, useLayoutEffect } from "react";
|
|
2
|
+
import { useRef, useState, useCallback, useLayoutEffect, useEffect } from "react";
|
|
3
3
|
import { isFocusVisibleElement, focusPanelOnOpen } from "../utils/focusElement.js";
|
|
4
4
|
import { killMotion } from "../utils/gsapMotion.js";
|
|
5
5
|
import { isReducedModalMotion, applyReducedPortalMotion } from "../utils/modalSurfaceMotion.js";
|
|
6
6
|
import { prefersReducedMotion } from "../utils/reducedMotion.js";
|
|
7
7
|
import { useMotionConfig } from "../utils/motionConfigContext.js";
|
|
8
8
|
import { bindOverlayReflow } from "../utils/bindOverlayReflow.js";
|
|
9
|
-
import {
|
|
9
|
+
import { resolveFloatingPortalContainer, applyFloatingPortalPosition } from "../utils/portalContainer.js";
|
|
10
10
|
import { computeTooltipPlacement } from "../Tooltip/tooltipPosition.js";
|
|
11
11
|
import { overlaySkinMotion } from "../../../skins/resolveVariantVisual.js";
|
|
12
12
|
import { KIT_POPOVER_VARIANTS } from "./popoverTypes.js";
|
|
@@ -23,6 +23,12 @@ const POPOVER_MOTION_DEFAULTS = {
|
|
|
23
23
|
function resolvePopoverMotionDefaults(variant) {
|
|
24
24
|
return overlaySkinMotion(POPOVER_MOTION_DEFAULTS, variant, KIT_POPOVER_VARIANTS, "popover");
|
|
25
25
|
}
|
|
26
|
+
function pickPopoverDialogAnchor(trigger, anchor) {
|
|
27
|
+
if (anchor && typeof anchor.closest === "function" && anchor.closest("dialog[open]:not(.portal-contained)")) {
|
|
28
|
+
return anchor;
|
|
29
|
+
}
|
|
30
|
+
return trigger ?? anchor ?? null;
|
|
31
|
+
}
|
|
26
32
|
function usePopoverContentLifecycle({
|
|
27
33
|
open,
|
|
28
34
|
side,
|
|
@@ -42,11 +48,30 @@ function usePopoverContentLifecycle({
|
|
|
42
48
|
const panelRef = useRef(null);
|
|
43
49
|
const [portalMounted, setPortalMounted] = useState(false);
|
|
44
50
|
const [resolvedSide, setResolvedSide] = useState(side);
|
|
51
|
+
const [portalHost, setPortalHost] = useState(
|
|
52
|
+
() => resolveFloatingPortalContainer(portalContainer, null)
|
|
53
|
+
);
|
|
45
54
|
const enterFrameRef = useRef(0);
|
|
46
55
|
const enterGenRef = useRef(0);
|
|
47
56
|
if (open && !portalMounted) {
|
|
48
57
|
setPortalMounted(true);
|
|
49
58
|
}
|
|
59
|
+
const syncPortalHost = useCallback(() => {
|
|
60
|
+
const nextHost = resolveFloatingPortalContainer(
|
|
61
|
+
portalContainer,
|
|
62
|
+
pickPopoverDialogAnchor(triggerRef.current, anchorRef?.current)
|
|
63
|
+
);
|
|
64
|
+
setPortalHost((prev) => prev === nextHost ? prev : nextHost);
|
|
65
|
+
return nextHost;
|
|
66
|
+
}, [anchorRef, portalContainer, triggerRef]);
|
|
67
|
+
useLayoutEffect(() => {
|
|
68
|
+
if (!open && !portalMounted) return;
|
|
69
|
+
syncPortalHost();
|
|
70
|
+
}, [open, portalMounted, syncPortalHost]);
|
|
71
|
+
useEffect(() => {
|
|
72
|
+
if (!open) return;
|
|
73
|
+
syncPortalHost();
|
|
74
|
+
}, [open, syncPortalHost]);
|
|
50
75
|
const setPanelRef = useCallback(
|
|
51
76
|
(node) => {
|
|
52
77
|
panelRef.current = node;
|
|
@@ -71,26 +96,26 @@ function usePopoverContentLifecycle({
|
|
|
71
96
|
offset,
|
|
72
97
|
{ align, collisionPadding, avoidCollisions }
|
|
73
98
|
);
|
|
99
|
+
const activeHost = syncPortalHost() ?? portalHost;
|
|
74
100
|
setResolvedSide(placement.resolvedSide);
|
|
75
|
-
applyFloatingPortalPosition(panel, placement,
|
|
101
|
+
applyFloatingPortalPosition(panel, placement, activeHost);
|
|
76
102
|
panel.style.transform = "";
|
|
77
|
-
}, [align, anchorRef, avoidCollisions, collisionPadding, matchAnchorWidth, offset,
|
|
103
|
+
}, [align, anchorRef, avoidCollisions, collisionPadding, matchAnchorWidth, offset, portalHost, side, syncPortalHost, triggerRef]);
|
|
78
104
|
useLayoutEffect(() => {
|
|
79
105
|
if (!open || !portalMounted) return;
|
|
80
106
|
reposition();
|
|
81
107
|
const raf = window.requestAnimationFrame(() => reposition());
|
|
82
108
|
const unbindReflow = bindOverlayReflow(reposition);
|
|
83
109
|
const panel = panelRef.current;
|
|
84
|
-
const host = typeof document !== "undefined" ? resolvePortalContainer(portalContainer) : null;
|
|
85
110
|
const ro = typeof ResizeObserver !== "undefined" ? new ResizeObserver(() => reposition()) : null;
|
|
86
111
|
if (panel && ro) ro.observe(panel);
|
|
87
|
-
if (
|
|
112
|
+
if (portalHost && portalHost !== document.body && ro) ro.observe(portalHost);
|
|
88
113
|
return () => {
|
|
89
114
|
window.cancelAnimationFrame(raf);
|
|
90
115
|
unbindReflow();
|
|
91
116
|
ro?.disconnect();
|
|
92
117
|
};
|
|
93
|
-
}, [open, portalMounted,
|
|
118
|
+
}, [open, portalMounted, portalHost, reposition, showArrow, offset, align, matchAnchorWidth]);
|
|
94
119
|
useLayoutEffect(() => {
|
|
95
120
|
if (!open || !portalMounted) return;
|
|
96
121
|
const panel = panelRef.current;
|
|
@@ -161,6 +186,7 @@ function usePopoverContentLifecycle({
|
|
|
161
186
|
panelRef,
|
|
162
187
|
setPanelRef,
|
|
163
188
|
portalMounted,
|
|
189
|
+
portalHost,
|
|
164
190
|
resolvedSide
|
|
165
191
|
};
|
|
166
192
|
}
|