@seed-design/react 2.5.1 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/components/Accordion/Accordion.cjs +2 -1
- package/lib/components/Accordion/Accordion.d.ts.map +1 -1
- package/lib/components/Accordion/Accordion.js +2 -1
- package/lib/components/ActionButton/ActionButton.cjs +1 -1
- package/lib/components/ActionButton/ActionButton.js +1 -1
- package/lib/components/AlertDialog/AlertDialog.cjs +34 -0
- package/lib/components/AlertDialog/AlertDialog.d.ts +51 -0
- package/lib/components/AlertDialog/AlertDialog.d.ts.map +1 -0
- package/lib/components/AlertDialog/AlertDialog.js +24 -0
- package/lib/components/AlertDialog/AlertDialog.namespace.cjs +22 -0
- package/lib/components/AlertDialog/AlertDialog.namespace.d.ts +2 -0
- package/lib/components/AlertDialog/AlertDialog.namespace.d.ts.map +1 -0
- package/lib/components/AlertDialog/AlertDialog.namespace.js +17 -0
- package/lib/components/AlertDialog/AlertDialog.test.d.ts +2 -0
- package/lib/components/AlertDialog/AlertDialog.test.d.ts.map +1 -0
- package/lib/components/AlertDialog/index.cjs +19 -0
- package/lib/components/AlertDialog/index.d.ts +3 -0
- package/lib/components/AlertDialog/index.d.ts.map +1 -0
- package/lib/components/AlertDialog/index.js +3 -0
- package/lib/components/AttachmentDisplay/AttachmentDisplay.cjs +1 -1
- package/lib/components/AttachmentDisplay/AttachmentDisplay.js +1 -1
- package/lib/components/AttachmentDisplay/AttachmentDisplayItem.cjs +1 -1
- package/lib/components/AttachmentDisplay/AttachmentDisplayItem.d.ts.map +1 -1
- package/lib/components/AttachmentDisplay/AttachmentDisplayItem.js +1 -1
- package/lib/components/AttachmentDisplay/AttachmentDisplayTrigger.cjs +1 -1
- package/lib/components/AttachmentDisplay/AttachmentDisplayTrigger.js +1 -1
- package/lib/components/AttachmentDisplay/index.cjs +8 -0
- package/lib/components/AttachmentDisplay/index.d.ts +2 -0
- package/lib/components/AttachmentDisplay/index.d.ts.map +1 -1
- package/lib/components/AttachmentDisplay/index.js +2 -1
- package/lib/components/AttachmentInput/AttachmentInput.cjs +1 -1
- package/lib/components/AttachmentInput/AttachmentInput.js +1 -1
- package/lib/components/AttachmentInput/AttachmentInputDropzone.cjs +1 -1
- package/lib/components/AttachmentInput/AttachmentInputDropzone.js +1 -1
- package/lib/components/AttachmentInput/AttachmentInputItem.cjs +2 -2
- package/lib/components/AttachmentInput/AttachmentInputItem.d.ts.map +1 -1
- package/lib/components/AttachmentInput/AttachmentInputItem.js +2 -2
- package/lib/components/AttachmentInput/AttachmentInputTrigger.cjs +1 -1
- package/lib/components/AttachmentInput/AttachmentInputTrigger.js +1 -1
- package/lib/components/AttachmentInput/index.cjs +8 -0
- package/lib/components/AttachmentInput/index.d.ts +2 -0
- package/lib/components/AttachmentInput/index.d.ts.map +1 -1
- package/lib/components/AttachmentInput/index.js +2 -1
- package/lib/components/Badge/Badge.cjs +52 -10
- package/lib/components/Badge/Badge.d.ts +13 -4
- package/lib/components/Badge/Badge.d.ts.map +1 -1
- package/lib/components/Badge/Badge.js +49 -11
- package/lib/components/Badge/Badge.namespace.cjs +16 -0
- package/lib/components/Badge/Badge.namespace.d.ts +2 -0
- package/lib/components/Badge/Badge.namespace.d.ts.map +1 -0
- package/lib/components/Badge/Badge.namespace.js +11 -0
- package/lib/components/Badge/Badge.test.d.ts +2 -0
- package/lib/components/Badge/Badge.test.d.ts.map +1 -0
- package/lib/components/Badge/index.cjs +11 -1
- package/lib/components/Badge/index.d.ts +2 -1
- package/lib/components/Badge/index.d.ts.map +1 -1
- package/lib/components/Badge/index.js +3 -2
- package/lib/components/Box/Box.test.d.ts +2 -0
- package/lib/components/Box/Box.test.d.ts.map +1 -0
- package/lib/components/Checkbox/Checkbox.cjs +2 -2
- package/lib/components/Checkbox/Checkbox.d.ts +3 -1
- package/lib/components/Checkbox/Checkbox.d.ts.map +1 -1
- package/lib/components/Checkbox/Checkbox.js +2 -2
- package/lib/components/Checkbox/Checkbox.namespace.d.ts +1 -1
- package/lib/components/Checkbox/Checkbox.namespace.d.ts.map +1 -1
- package/lib/components/Checkbox/index.d.ts +1 -1
- package/lib/components/Checkbox/index.d.ts.map +1 -1
- package/lib/components/Chip/Chip.cjs +13 -5
- package/lib/components/Chip/Chip.d.ts +13 -2
- package/lib/components/Chip/Chip.d.ts.map +1 -1
- package/lib/components/Chip/Chip.js +10 -5
- package/lib/components/Chip/Chip.namespace.cjs +5 -2
- package/lib/components/Chip/Chip.namespace.d.ts +1 -1
- package/lib/components/Chip/Chip.namespace.d.ts.map +1 -1
- package/lib/components/Chip/Chip.namespace.js +6 -3
- package/lib/components/Chip/index.cjs +4 -1
- package/lib/components/Chip/index.d.ts +1 -1
- package/lib/components/Chip/index.d.ts.map +1 -1
- package/lib/components/Chip/index.js +2 -2
- package/lib/components/ChipTabs/ChipTabs.cjs +1 -1
- package/lib/components/ChipTabs/ChipTabs.js +1 -1
- package/lib/components/DatePicker/DatePicker.cjs +192 -190
- package/lib/components/DatePicker/DatePicker.d.ts +50 -21
- package/lib/components/DatePicker/DatePicker.d.ts.map +1 -1
- package/lib/components/DatePicker/DatePicker.js +189 -187
- package/lib/components/DatePicker/DatePicker.namespace.cjs +16 -0
- package/lib/components/DatePicker/DatePicker.namespace.d.ts +2 -0
- package/lib/components/DatePicker/DatePicker.namespace.d.ts.map +1 -0
- package/lib/components/DatePicker/DatePicker.namespace.js +11 -0
- package/lib/components/DatePicker/index.cjs +11 -4
- package/lib/components/DatePicker/index.d.ts +3 -2
- package/lib/components/DatePicker/index.d.ts.map +1 -1
- package/lib/components/DatePicker/index.js +3 -2
- package/lib/components/Dialog/Dialog.cjs +84 -9
- package/lib/components/Dialog/Dialog.d.ts +21 -14
- package/lib/components/Dialog/Dialog.d.ts.map +1 -1
- package/lib/components/Dialog/Dialog.js +80 -9
- package/lib/components/Dialog/Dialog.namespace.cjs +2 -0
- package/lib/components/Dialog/Dialog.namespace.d.ts +1 -1
- package/lib/components/Dialog/Dialog.namespace.d.ts.map +1 -1
- package/lib/components/Dialog/Dialog.namespace.js +3 -1
- package/lib/components/Dialog/index.cjs +2 -0
- package/lib/components/Dialog/index.d.ts +1 -1
- package/lib/components/Dialog/index.d.ts.map +1 -1
- package/lib/components/Dialog/index.js +2 -2
- package/lib/components/HelpBubble/HelpBubble.cjs +18 -5
- package/lib/components/HelpBubble/HelpBubble.d.ts +5 -0
- package/lib/components/HelpBubble/HelpBubble.d.ts.map +1 -1
- package/lib/components/HelpBubble/HelpBubble.js +18 -5
- package/lib/components/HelpBubble/HelpBubble.test.d.ts +2 -0
- package/lib/components/HelpBubble/HelpBubble.test.d.ts.map +1 -0
- package/lib/components/ImageFrame/ImageFrame.cjs +5 -4
- package/lib/components/ImageFrame/ImageFrame.d.ts +2 -2
- package/lib/components/ImageFrame/ImageFrame.d.ts.map +1 -1
- package/lib/components/ImageFrame/ImageFrame.js +6 -5
- package/lib/components/List/List.cjs +14 -3
- package/lib/components/List/List.d.ts +15 -0
- package/lib/components/List/List.d.ts.map +1 -1
- package/lib/components/List/List.js +11 -4
- package/lib/components/List/List.namespace.cjs +4 -0
- package/lib/components/List/List.namespace.d.ts +1 -1
- package/lib/components/List/List.namespace.d.ts.map +1 -1
- package/lib/components/List/List.namespace.js +5 -1
- package/lib/components/List/index.cjs +4 -0
- package/lib/components/List/index.d.ts +1 -1
- package/lib/components/List/index.d.ts.map +1 -1
- package/lib/components/List/index.js +2 -2
- package/lib/components/Menu/Menu.cjs +3 -2
- package/lib/components/Menu/Menu.d.ts.map +1 -1
- package/lib/components/Menu/Menu.js +3 -2
- package/lib/components/MenuSheet/MenuSheet.cjs +4 -3
- package/lib/components/MenuSheet/MenuSheet.d.ts.map +1 -1
- package/lib/components/MenuSheet/MenuSheet.js +4 -3
- package/lib/components/NavigationMenu/NavigationMenu.cjs +4 -3
- package/lib/components/NavigationMenu/NavigationMenu.d.ts.map +1 -1
- package/lib/components/NavigationMenu/NavigationMenu.js +4 -3
- package/lib/components/PageBanner/PageBanner.cjs +3 -2
- package/lib/components/PageBanner/PageBanner.d.ts.map +1 -1
- package/lib/components/PageBanner/PageBanner.js +3 -2
- package/lib/components/{ContentDialog/ContentDialog.cjs → Popover/Popover.cjs} +61 -40
- package/lib/components/Popover/Popover.d.ts +69 -0
- package/lib/components/Popover/Popover.d.ts.map +1 -0
- package/lib/components/{ContentDialog/ContentDialog.js → Popover/Popover.js} +49 -29
- package/lib/components/Popover/Popover.namespace.cjs +26 -0
- package/lib/components/Popover/Popover.namespace.d.ts +2 -0
- package/lib/components/Popover/Popover.namespace.d.ts.map +1 -0
- package/lib/components/Popover/Popover.namespace.js +21 -0
- package/lib/components/Popover/Popover.test.d.ts +2 -0
- package/lib/components/Popover/Popover.test.d.ts.map +1 -0
- package/lib/components/Popover/index.cjs +23 -0
- package/lib/components/Popover/index.d.ts +3 -0
- package/lib/components/Popover/index.d.ts.map +1 -0
- package/lib/components/Popover/index.js +3 -0
- package/lib/components/QuantityPicker/QuantityPicker.d.ts.map +1 -1
- package/lib/components/RadioGroup/RadioGroup.cjs +2 -2
- package/lib/components/RadioGroup/RadioGroup.d.ts +2 -0
- package/lib/components/RadioGroup/RadioGroup.d.ts.map +1 -1
- package/lib/components/RadioGroup/RadioGroup.js +2 -2
- package/lib/components/RadioGroup/RadioGroup.namespace.d.ts +1 -1
- package/lib/components/RadioGroup/RadioGroup.namespace.d.ts.map +1 -1
- package/lib/components/RadioGroup/index.d.ts +1 -1
- package/lib/components/RadioGroup/index.d.ts.map +1 -1
- package/lib/components/RadioGroupField/RadioGroupField.cjs +2 -2
- package/lib/components/RadioGroupField/RadioGroupField.d.ts +5 -1
- package/lib/components/RadioGroupField/RadioGroupField.d.ts.map +1 -1
- package/lib/components/RadioGroupField/RadioGroupField.js +2 -2
- package/lib/components/RadioGroupField/RadioGroupField.namespace.d.ts +1 -1
- package/lib/components/RadioGroupField/RadioGroupField.namespace.d.ts.map +1 -1
- package/lib/components/ReactionButton/ReactionButton.cjs +1 -1
- package/lib/components/ReactionButton/ReactionButton.js +1 -1
- package/lib/components/ResponsiveDialog/ResponsiveDialog.cjs +13 -13
- package/lib/components/ResponsiveDialog/ResponsiveDialog.d.ts +15 -15
- package/lib/components/ResponsiveDialog/ResponsiveDialog.d.ts.map +1 -1
- package/lib/components/ResponsiveDialog/ResponsiveDialog.js +13 -13
- package/lib/components/SegmentedControl/SegmentedControl.cjs +2 -1
- package/lib/components/SegmentedControl/SegmentedControl.d.ts.map +1 -1
- package/lib/components/SegmentedControl/SegmentedControl.js +2 -1
- package/lib/components/Select/Select.cjs +5 -4
- package/lib/components/Select/Select.d.ts.map +1 -1
- package/lib/components/Select/Select.js +5 -4
- package/lib/components/SelectBox/CheckSelectBox.cjs +20 -6
- package/lib/components/SelectBox/CheckSelectBox.d.ts +7 -0
- package/lib/components/SelectBox/CheckSelectBox.d.ts.map +1 -1
- package/lib/components/SelectBox/CheckSelectBox.js +21 -7
- package/lib/components/SelectBox/RadioSelectBox.cjs +20 -6
- package/lib/components/SelectBox/RadioSelectBox.d.ts +7 -0
- package/lib/components/SelectBox/RadioSelectBox.d.ts.map +1 -1
- package/lib/components/SelectBox/RadioSelectBox.js +21 -7
- package/lib/components/SelectBox/SelectBox.test.d.ts +2 -0
- package/lib/components/SelectBox/SelectBox.test.d.ts.map +1 -0
- package/lib/components/SideNavigation/SideNavigation.cjs +2 -2
- package/lib/components/SideNavigation/SideNavigation.js +2 -2
- package/lib/components/SideNavigation/index.cjs +8 -0
- package/lib/components/SideNavigation/index.d.ts +1 -0
- package/lib/components/SideNavigation/index.d.ts.map +1 -1
- package/lib/components/SideNavigation/index.js +2 -1
- package/lib/components/SidePanel/SidePanel.d.ts +0 -12
- package/lib/components/SidePanel/SidePanel.d.ts.map +1 -1
- package/lib/components/Slider/Slider.cjs +1 -1
- package/lib/components/Slider/Slider.js +1 -1
- package/lib/components/Snackbar/Snackbar.cjs +2 -2
- package/lib/components/Snackbar/Snackbar.js +2 -2
- package/lib/components/Snackbar/useSnackbarAdapter.cjs +1 -1
- package/lib/components/Snackbar/useSnackbarAdapter.js +1 -1
- package/lib/components/Stack/Stack.cjs +0 -12
- package/lib/components/Stack/Stack.d.ts +0 -8
- package/lib/components/Stack/Stack.d.ts.map +1 -1
- package/lib/components/Stack/Stack.js +1 -12
- package/lib/components/Stack/index.cjs +0 -1
- package/lib/components/Stack/index.d.ts +1 -1
- package/lib/components/Stack/index.d.ts.map +1 -1
- package/lib/components/Stack/index.js +2 -2
- package/lib/components/SwipeableMenuSheet/SwipeableMenuSheet.cjs +3 -2
- package/lib/components/SwipeableMenuSheet/SwipeableMenuSheet.d.ts.map +1 -1
- package/lib/components/SwipeableMenuSheet/SwipeableMenuSheet.js +3 -2
- package/lib/components/Switch/Switch.cjs +3 -3
- package/lib/components/Switch/Switch.d.ts +5 -1
- package/lib/components/Switch/Switch.d.ts.map +1 -1
- package/lib/components/Switch/Switch.js +3 -3
- package/lib/components/Switch/Switch.namespace.d.ts +1 -1
- package/lib/components/Switch/Switch.namespace.d.ts.map +1 -1
- package/lib/components/Switch/index.d.ts +1 -1
- package/lib/components/Switch/index.d.ts.map +1 -1
- package/lib/components/TagGroup/TagGroup.d.ts.map +1 -1
- package/lib/components/ToggleButton/ToggleButton.cjs +1 -1
- package/lib/components/ToggleButton/ToggleButton.js +1 -1
- package/lib/components/WheelPicker/WheelPicker.cjs +11 -12
- package/lib/components/WheelPicker/WheelPicker.d.ts +7 -2
- package/lib/components/WheelPicker/WheelPicker.d.ts.map +1 -1
- package/lib/components/WheelPicker/WheelPicker.js +11 -12
- package/lib/components/index.cjs +90 -94
- package/lib/components/index.d.ts +2 -12
- package/lib/components/index.d.ts.map +1 -1
- package/lib/components/index.js +17 -24
- package/lib/index.cjs +116 -94
- package/lib/index.d.ts +4 -2
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +20 -25
- package/lib/utils/styled.cjs +3 -2
- package/lib/utils/styled.d.ts +18 -11
- package/lib/utils/styled.d.ts.map +1 -1
- package/lib/utils/styled.js +3 -2
- package/lib/utils/withContentScale.cjs +30 -0
- package/lib/utils/withContentScale.d.ts +12 -0
- package/lib/utils/withContentScale.d.ts.map +1 -0
- package/lib/utils/withContentScale.js +27 -0
- package/lib/utils/withContentScale.test.d.ts +2 -0
- package/lib/utils/withContentScale.test.d.ts.map +1 -0
- package/package.json +9 -14
- package/src/components/Accordion/Accordion.tsx +3 -3
- package/src/components/AlertDialog/AlertDialog.namespace.ts +22 -0
- package/src/components/AlertDialog/AlertDialog.test.tsx +61 -0
- package/src/components/AlertDialog/AlertDialog.tsx +115 -0
- package/src/components/AlertDialog/index.ts +24 -0
- package/src/components/AttachmentDisplay/AttachmentDisplayItem.tsx +2 -0
- package/src/components/AttachmentDisplay/index.ts +10 -0
- package/src/components/AttachmentInput/AttachmentInputItem.tsx +2 -0
- package/src/components/AttachmentInput/index.ts +10 -0
- package/src/components/Badge/Badge.namespace.ts +10 -0
- package/src/components/Badge/Badge.test.tsx +56 -0
- package/src/components/Badge/Badge.tsx +82 -11
- package/src/components/Badge/index.ts +12 -1
- package/src/components/Box/Box.test.tsx +88 -0
- package/src/components/Checkbox/Checkbox.namespace.ts +1 -0
- package/src/components/Checkbox/Checkbox.tsx +3 -1
- package/src/components/Checkbox/index.ts +1 -0
- package/src/components/Chip/Chip.namespace.ts +8 -2
- package/src/components/Chip/Chip.tsx +34 -7
- package/src/components/Chip/index.ts +8 -2
- package/src/components/DatePicker/DatePicker.namespace.ts +14 -0
- package/src/components/DatePicker/DatePicker.test.tsx +85 -276
- package/src/components/DatePicker/DatePicker.tsx +327 -284
- package/src/components/DatePicker/index.ts +25 -21
- package/src/components/Dialog/Dialog.namespace.ts +4 -0
- package/src/components/Dialog/Dialog.tsx +128 -10
- package/src/components/Dialog/index.ts +4 -5
- package/src/components/HelpBubble/HelpBubble.test.tsx +111 -0
- package/src/components/HelpBubble/HelpBubble.tsx +19 -3
- package/src/components/ImageFrame/ImageFrame.tsx +12 -4
- package/src/components/List/List.namespace.ts +8 -0
- package/src/components/List/List.tsx +43 -3
- package/src/components/List/index.ts +8 -0
- package/src/components/Menu/Menu.tsx +4 -3
- package/src/components/MenuSheet/MenuSheet.tsx +20 -17
- package/src/components/NavigationMenu/NavigationMenu.tsx +20 -17
- package/src/components/PageBanner/PageBanner.tsx +6 -3
- package/src/components/Popover/Popover.namespace.ts +30 -0
- package/src/components/Popover/Popover.test.tsx +222 -0
- package/src/components/Popover/Popover.tsx +282 -0
- package/src/components/Popover/index.ts +32 -0
- package/src/components/QuantityPicker/QuantityPicker.tsx +2 -0
- package/src/components/RadioGroup/RadioGroup.namespace.ts +1 -0
- package/src/components/RadioGroup/RadioGroup.tsx +2 -0
- package/src/components/RadioGroup/index.ts +1 -0
- package/src/components/RadioGroupField/RadioGroupField.namespace.ts +1 -0
- package/src/components/RadioGroupField/RadioGroupField.tsx +5 -3
- package/src/components/ResponsiveDialog/ResponsiveDialog.tsx +45 -48
- package/src/components/SegmentedControl/SegmentedControl.tsx +3 -3
- package/src/components/Select/Select.tsx +7 -6
- package/src/components/SelectBox/CheckSelectBox.tsx +28 -10
- package/src/components/SelectBox/RadioSelectBox.tsx +28 -10
- package/src/components/SelectBox/SelectBox.test.tsx +138 -0
- package/src/components/SideNavigation/index.ts +5 -0
- package/src/components/SidePanel/SidePanel.tsx +1 -16
- package/src/components/Stack/Stack.tsx +0 -12
- package/src/components/Stack/index.ts +1 -8
- package/src/components/SwipeableMenuSheet/SwipeableMenuSheet.tsx +20 -18
- package/src/components/Switch/Switch.namespace.ts +1 -0
- package/src/components/Switch/Switch.tsx +6 -3
- package/src/components/Switch/index.ts +1 -0
- package/src/components/TagGroup/TagGroup.tsx +2 -0
- package/src/components/WheelPicker/WheelPicker.test.tsx +53 -44
- package/src/components/WheelPicker/WheelPicker.tsx +24 -21
- package/src/components/index.ts +2 -12
- package/src/index.ts +25 -2
- package/src/utils/styled.tsx +72 -15
- package/src/utils/withContentScale.test.tsx +88 -0
- package/src/utils/withContentScale.tsx +48 -0
- package/lib/components/ActionChip/ActionChip.cjs +0 -15
- package/lib/components/ActionChip/ActionChip.d.ts +0 -23
- package/lib/components/ActionChip/ActionChip.d.ts.map +0 -1
- package/lib/components/ActionChip/ActionChip.js +0 -14
- package/lib/components/ActionChip/index.cjs +0 -3
- package/lib/components/ActionChip/index.d.ts +0 -2
- package/lib/components/ActionChip/index.d.ts.map +0 -1
- package/lib/components/ActionChip/index.js +0 -2
- package/lib/components/ActionSheet/ActionSheet.cjs +0 -72
- package/lib/components/ActionSheet/ActionSheet.d.ts +0 -113
- package/lib/components/ActionSheet/ActionSheet.d.ts.map +0 -1
- package/lib/components/ActionSheet/ActionSheet.js +0 -61
- package/lib/components/ActionSheet/ActionSheet.namespace.cjs +0 -23
- package/lib/components/ActionSheet/ActionSheet.namespace.d.ts +0 -2
- package/lib/components/ActionSheet/ActionSheet.namespace.d.ts.map +0 -1
- package/lib/components/ActionSheet/ActionSheet.namespace.js +0 -18
- package/lib/components/ActionSheet/index.cjs +0 -20
- package/lib/components/ActionSheet/index.d.ts +0 -3
- package/lib/components/ActionSheet/index.d.ts.map +0 -1
- package/lib/components/ActionSheet/index.js +0 -3
- package/lib/components/Columns/Columns.cjs +0 -38
- package/lib/components/Columns/Columns.d.ts +0 -22
- package/lib/components/Columns/Columns.d.ts.map +0 -1
- package/lib/components/Columns/Columns.js +0 -35
- package/lib/components/Columns/index.cjs +0 -4
- package/lib/components/Columns/index.d.ts +0 -2
- package/lib/components/Columns/index.d.ts.map +0 -1
- package/lib/components/Columns/index.js +0 -2
- package/lib/components/ContentDialog/ContentDialog.d.ts +0 -50
- package/lib/components/ContentDialog/ContentDialog.d.ts.map +0 -1
- package/lib/components/ContentDialog/ContentDialog.namespace.cjs +0 -24
- package/lib/components/ContentDialog/ContentDialog.namespace.d.ts +0 -2
- package/lib/components/ContentDialog/ContentDialog.namespace.d.ts.map +0 -1
- package/lib/components/ContentDialog/ContentDialog.namespace.js +0 -19
- package/lib/components/ContentDialog/index.cjs +0 -21
- package/lib/components/ContentDialog/index.d.ts +0 -3
- package/lib/components/ContentDialog/index.d.ts.map +0 -1
- package/lib/components/ContentDialog/index.js +0 -3
- package/lib/components/ControlChip/ControlChip.cjs +0 -15
- package/lib/components/ControlChip/ControlChip.d.ts +0 -28
- package/lib/components/ControlChip/ControlChip.d.ts.map +0 -1
- package/lib/components/ControlChip/ControlChip.js +0 -14
- package/lib/components/ControlChip/index.cjs +0 -3
- package/lib/components/ControlChip/index.d.ts +0 -2
- package/lib/components/ControlChip/index.d.ts.map +0 -1
- package/lib/components/ControlChip/index.js +0 -2
- package/lib/components/ExtendedActionSheet/ExtendedActionSheet.cjs +0 -77
- package/lib/components/ExtendedActionSheet/ExtendedActionSheet.d.ts +0 -122
- package/lib/components/ExtendedActionSheet/ExtendedActionSheet.d.ts.map +0 -1
- package/lib/components/ExtendedActionSheet/ExtendedActionSheet.js +0 -65
- package/lib/components/ExtendedActionSheet/ExtendedActionSheet.namespace.cjs +0 -24
- package/lib/components/ExtendedActionSheet/ExtendedActionSheet.namespace.d.ts +0 -2
- package/lib/components/ExtendedActionSheet/ExtendedActionSheet.namespace.d.ts.map +0 -1
- package/lib/components/ExtendedActionSheet/ExtendedActionSheet.namespace.js +0 -19
- package/lib/components/ExtendedActionSheet/index.cjs +0 -21
- package/lib/components/ExtendedActionSheet/index.d.ts +0 -3
- package/lib/components/ExtendedActionSheet/index.d.ts.map +0 -1
- package/lib/components/ExtendedActionSheet/index.js +0 -3
- package/lib/components/ExtendedFab/ExtendedFab.cjs +0 -16
- package/lib/components/ExtendedFab/ExtendedFab.d.ts +0 -13
- package/lib/components/ExtendedFab/ExtendedFab.d.ts.map +0 -1
- package/lib/components/ExtendedFab/ExtendedFab.js +0 -15
- package/lib/components/ExtendedFab/index.cjs +0 -3
- package/lib/components/ExtendedFab/index.d.ts +0 -2
- package/lib/components/ExtendedFab/index.d.ts.map +0 -1
- package/lib/components/ExtendedFab/index.js +0 -2
- package/lib/components/Fab/Fab.cjs +0 -13
- package/lib/components/Fab/Fab.d.ts +0 -13
- package/lib/components/Fab/Fab.d.ts.map +0 -1
- package/lib/components/Fab/Fab.js +0 -12
- package/lib/components/Fab/index.cjs +0 -3
- package/lib/components/Fab/index.d.ts +0 -2
- package/lib/components/Fab/index.d.ts.map +0 -1
- package/lib/components/Fab/index.js +0 -2
- package/lib/components/Inline/Inline.cjs +0 -23
- package/lib/components/Inline/Inline.d.ts +0 -12
- package/lib/components/Inline/Inline.d.ts.map +0 -1
- package/lib/components/Inline/Inline.js +0 -21
- package/lib/components/Inline/index.cjs +0 -3
- package/lib/components/Inline/index.d.ts +0 -2
- package/lib/components/Inline/index.d.ts.map +0 -1
- package/lib/components/Inline/index.js +0 -2
- package/lib/components/InlineBanner/InlineBanner.cjs +0 -39
- package/lib/components/InlineBanner/InlineBanner.d.ts +0 -59
- package/lib/components/InlineBanner/InlineBanner.d.ts.map +0 -1
- package/lib/components/InlineBanner/InlineBanner.js +0 -33
- package/lib/components/InlineBanner/InlineBanner.namespace.cjs +0 -18
- package/lib/components/InlineBanner/InlineBanner.namespace.d.ts +0 -2
- package/lib/components/InlineBanner/InlineBanner.namespace.d.ts.map +0 -1
- package/lib/components/InlineBanner/InlineBanner.namespace.js +0 -13
- package/lib/components/InlineBanner/index.cjs +0 -15
- package/lib/components/InlineBanner/index.d.ts +0 -3
- package/lib/components/InlineBanner/index.d.ts.map +0 -1
- package/lib/components/InlineBanner/index.js +0 -3
- package/lib/components/LinkContent/LinkContent.cjs +0 -14
- package/lib/components/LinkContent/LinkContent.d.ts +0 -14
- package/lib/components/LinkContent/LinkContent.d.ts.map +0 -1
- package/lib/components/LinkContent/LinkContent.js +0 -13
- package/lib/components/LinkContent/index.cjs +0 -3
- package/lib/components/LinkContent/index.d.ts +0 -2
- package/lib/components/LinkContent/index.d.ts.map +0 -1
- package/lib/components/LinkContent/index.js +0 -2
- package/lib/components/TimePicker/TimePicker.cjs +0 -97
- package/lib/components/TimePicker/TimePicker.d.ts +0 -28
- package/lib/components/TimePicker/TimePicker.d.ts.map +0 -1
- package/lib/components/TimePicker/TimePicker.js +0 -94
- package/lib/components/TimePicker/TimePicker.test.d.ts +0 -2
- package/lib/components/TimePicker/TimePicker.test.d.ts.map +0 -1
- package/lib/components/TimePicker/index.cjs +0 -3
- package/lib/components/TimePicker/index.d.ts +0 -2
- package/lib/components/TimePicker/index.d.ts.map +0 -1
- package/lib/components/TimePicker/index.js +0 -2
- package/lib/components/private/WheelPicker.cjs +0 -63
- package/lib/components/private/WheelPicker.d.ts +0 -16
- package/lib/components/private/WheelPicker.d.ts.map +0 -1
- package/lib/components/private/WheelPicker.js +0 -59
- package/lib/components/private/WheelPicker.test.d.ts +0 -2
- package/lib/components/private/WheelPicker.test.d.ts.map +0 -1
- package/lib/primitive.cjs +0 -154
- package/lib/primitive.d.ts +0 -18
- package/lib/primitive.d.ts.map +0 -1
- package/lib/primitive.js +0 -17
- package/src/components/ActionChip/ActionChip.tsx +0 -34
- package/src/components/ActionChip/index.ts +0 -4
- package/src/components/ActionSheet/ActionSheet.namespace.ts +0 -24
- package/src/components/ActionSheet/ActionSheet.tsx +0 -192
- package/src/components/ActionSheet/index.ts +0 -26
- package/src/components/Columns/Columns.tsx +0 -50
- package/src/components/Columns/index.ts +0 -1
- package/src/components/ContentDialog/ContentDialog.namespace.ts +0 -26
- package/src/components/ContentDialog/ContentDialog.tsx +0 -224
- package/src/components/ContentDialog/index.ts +0 -33
- package/src/components/ControlChip/ControlChip.tsx +0 -38
- package/src/components/ControlChip/index.ts +0 -5
- package/src/components/ExtendedActionSheet/ExtendedActionSheet.namespace.ts +0 -26
- package/src/components/ExtendedActionSheet/ExtendedActionSheet.tsx +0 -220
- package/src/components/ExtendedActionSheet/index.ts +0 -28
- package/src/components/ExtendedFab/ExtendedFab.tsx +0 -25
- package/src/components/ExtendedFab/index.ts +0 -4
- package/src/components/Fab/Fab.tsx +0 -21
- package/src/components/Fab/index.ts +0 -4
- package/src/components/Inline/Inline.tsx +0 -25
- package/src/components/Inline/index.ts +0 -1
- package/src/components/InlineBanner/InlineBanner.namespace.ts +0 -14
- package/src/components/InlineBanner/InlineBanner.tsx +0 -103
- package/src/components/InlineBanner/index.ts +0 -16
- package/src/components/LinkContent/LinkContent.tsx +0 -23
- package/src/components/LinkContent/index.ts +0 -4
- package/src/components/TimePicker/TimePicker.test.tsx +0 -166
- package/src/components/TimePicker/TimePicker.tsx +0 -163
- package/src/components/TimePicker/index.ts +0 -6
- package/src/components/private/WheelPicker.test.tsx +0 -55
- package/src/components/private/WheelPicker.tsx +0 -110
- package/src/primitive.ts +0 -17
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
} from "@seed-design/css/recipes/menu-sheet-item";
|
|
8
8
|
import * as React from "react";
|
|
9
9
|
import { createSlotRecipeContext } from "../../utils/createSlotRecipeContext";
|
|
10
|
+
import { withContentScale } from "../../utils/withContentScale";
|
|
10
11
|
import { withScaleFeedback } from "../../utils/withScaleFeedback";
|
|
11
12
|
import { createWithStateProps } from "../../utils/createWithStateProps";
|
|
12
13
|
import clsx from "clsx";
|
|
@@ -227,25 +228,27 @@ export interface MenuSheetItemProps
|
|
|
227
228
|
/**
|
|
228
229
|
* @deprecated Use `SwipeableMenuSheet` instead.
|
|
229
230
|
*/
|
|
230
|
-
export const MenuSheetItem =
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
231
|
+
export const MenuSheetItem = withContentScale(
|
|
232
|
+
React.forwardRef<HTMLButtonElement, MenuSheetItemProps>(
|
|
233
|
+
({ className: propClassName, ...props }, ref) => {
|
|
234
|
+
const [variantProps, otherProps] = menuSheetItem.splitVariantProps(props);
|
|
235
|
+
const parentProps = useItemProps();
|
|
234
236
|
|
|
235
|
-
|
|
236
|
-
|
|
237
|
+
const classNames = menuSheetItem({ ...parentProps, ...variantProps });
|
|
238
|
+
const { stateProps } = useDialogContext();
|
|
237
239
|
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
240
|
+
return (
|
|
241
|
+
<ItemClassNamesProvider value={classNames}>
|
|
242
|
+
<Primitive.button
|
|
243
|
+
ref={ref}
|
|
244
|
+
className={clsx(classNames.root, propClassName)}
|
|
245
|
+
{...stateProps}
|
|
246
|
+
{...otherProps}
|
|
247
|
+
/>
|
|
248
|
+
</ItemClassNamesProvider>
|
|
249
|
+
);
|
|
250
|
+
},
|
|
251
|
+
),
|
|
249
252
|
);
|
|
250
253
|
|
|
251
254
|
/**
|
|
@@ -12,6 +12,7 @@ import clsx from "clsx";
|
|
|
12
12
|
import * as React from "react";
|
|
13
13
|
import { createSlotRecipeContext } from "../../utils/createSlotRecipeContext";
|
|
14
14
|
import { createWithStateProps } from "../../utils/createWithStateProps";
|
|
15
|
+
import { withContentScale } from "../../utils/withContentScale";
|
|
15
16
|
|
|
16
17
|
const { ClassNamesProvider, withContext, useClassNames } = createSlotRecipeContext(menu);
|
|
17
18
|
const {
|
|
@@ -118,23 +119,25 @@ export interface NavigationMenuItemProps
|
|
|
118
119
|
extends MenuItemVariantProps,
|
|
119
120
|
NavigationMenuPrimitive.ItemProps {}
|
|
120
121
|
|
|
121
|
-
export const NavigationMenuItem =
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
<
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
122
|
+
export const NavigationMenuItem = withContentScale(
|
|
123
|
+
React.forwardRef<HTMLButtonElement, NavigationMenuItemProps>(
|
|
124
|
+
({ className: propClassName, ...props }, ref) => {
|
|
125
|
+
const [variantProps, otherProps] = menuItem.splitVariantProps(props);
|
|
126
|
+
const parentProps = useItemProps();
|
|
127
|
+
|
|
128
|
+
const classNames = menuItem({ ...parentProps, ...variantProps });
|
|
129
|
+
|
|
130
|
+
return (
|
|
131
|
+
<ItemClassNamesProvider value={classNames}>
|
|
132
|
+
<NavigationMenuPrimitive.Item
|
|
133
|
+
ref={ref}
|
|
134
|
+
className={clsx(classNames.root, propClassName)}
|
|
135
|
+
{...otherProps}
|
|
136
|
+
/>
|
|
137
|
+
</ItemClassNamesProvider>
|
|
138
|
+
);
|
|
139
|
+
},
|
|
140
|
+
),
|
|
138
141
|
);
|
|
139
142
|
NavigationMenuItem.displayName = "NavigationMenuItem";
|
|
140
143
|
|
|
@@ -4,6 +4,7 @@ import { forwardRef } from "react";
|
|
|
4
4
|
import { pageBanner, type PageBannerVariantProps } from "@seed-design/css/recipes/page-banner";
|
|
5
5
|
import { Primitive, type PrimitiveProps } from "@seed-design/react-primitive";
|
|
6
6
|
import { createSlotRecipeContext } from "../../utils/createSlotRecipeContext";
|
|
7
|
+
import { withContentScale } from "../../utils/withContentScale";
|
|
7
8
|
import { withScaleFeedback } from "../../utils/withScaleFeedback";
|
|
8
9
|
import {
|
|
9
10
|
DismissibleCloseButton,
|
|
@@ -16,8 +17,10 @@ const { withContext, ClassNamesProvider } = createSlotRecipeContext(pageBanner);
|
|
|
16
17
|
|
|
17
18
|
export interface PageBannerRootProps extends PageBannerVariantProps, DismissibleRootProps {}
|
|
18
19
|
|
|
19
|
-
|
|
20
|
-
|
|
20
|
+
// Every banner renders the content scale box, but only a `button` root publishes the
|
|
21
|
+
// ratio (see the page-banner recipe), so a static or dismissible banner never shrinks.
|
|
22
|
+
export const PageBannerRoot = withContentScale(
|
|
23
|
+
forwardRef<HTMLDivElement, PageBannerRootProps>(({ className, ...props }, ref) => {
|
|
21
24
|
if (props.variant === "solid" && props.tone === "magic") {
|
|
22
25
|
console.error(
|
|
23
26
|
`\`${props.tone}\` tone is not available for \`${props.variant}\` variant in PageBanner components. Please use variant="weak" or a different tone instead.`,
|
|
@@ -32,7 +35,7 @@ export const PageBannerRoot = forwardRef<HTMLDivElement, PageBannerRootProps>(
|
|
|
32
35
|
<DismissibleRoot className={clsx(classNames.root, className)} ref={ref} {...otherProps} />
|
|
33
36
|
</ClassNamesProvider>
|
|
34
37
|
);
|
|
35
|
-
},
|
|
38
|
+
}),
|
|
36
39
|
);
|
|
37
40
|
|
|
38
41
|
// Use these instead when ts implements this:
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export {
|
|
2
|
+
PopoverAction as Action,
|
|
3
|
+
PopoverAnchor as Anchor,
|
|
4
|
+
PopoverArrow as Arrow,
|
|
5
|
+
PopoverArrowTip as ArrowTip,
|
|
6
|
+
PopoverBody as Body,
|
|
7
|
+
PopoverCloseButton as CloseButton,
|
|
8
|
+
PopoverContent as Content,
|
|
9
|
+
PopoverDescription as Description,
|
|
10
|
+
PopoverFooter as Footer,
|
|
11
|
+
PopoverHeader as Header,
|
|
12
|
+
PopoverPositioner as Positioner,
|
|
13
|
+
PopoverRoot as Root,
|
|
14
|
+
PopoverTitle as Title,
|
|
15
|
+
PopoverTrigger as Trigger,
|
|
16
|
+
type PopoverActionProps as ActionProps,
|
|
17
|
+
type PopoverAnchorProps as AnchorProps,
|
|
18
|
+
type PopoverArrowProps as ArrowProps,
|
|
19
|
+
type PopoverArrowTipProps as ArrowTipProps,
|
|
20
|
+
type PopoverBodyProps as BodyProps,
|
|
21
|
+
type PopoverCloseButtonProps as CloseButtonProps,
|
|
22
|
+
type PopoverContentProps as ContentProps,
|
|
23
|
+
type PopoverDescriptionProps as DescriptionProps,
|
|
24
|
+
type PopoverFooterProps as FooterProps,
|
|
25
|
+
type PopoverHeaderProps as HeaderProps,
|
|
26
|
+
type PopoverPositionerProps as PositionerProps,
|
|
27
|
+
type PopoverRootProps as RootProps,
|
|
28
|
+
type PopoverTitleProps as TitleProps,
|
|
29
|
+
type PopoverTriggerProps as TriggerProps,
|
|
30
|
+
} from "./Popover";
|
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
import { act, fireEvent, render } from "@testing-library/react";
|
|
2
|
+
import userEvent from "@testing-library/user-event";
|
|
3
|
+
import { describe, expect, it } from "bun:test";
|
|
4
|
+
|
|
5
|
+
import {
|
|
6
|
+
PopoverAction,
|
|
7
|
+
PopoverArrow,
|
|
8
|
+
PopoverArrowTip,
|
|
9
|
+
PopoverBody,
|
|
10
|
+
PopoverCloseButton,
|
|
11
|
+
PopoverContent,
|
|
12
|
+
PopoverFooter,
|
|
13
|
+
PopoverHeader,
|
|
14
|
+
PopoverPositioner,
|
|
15
|
+
PopoverRoot,
|
|
16
|
+
PopoverTitle,
|
|
17
|
+
PopoverTrigger,
|
|
18
|
+
type PopoverRootProps,
|
|
19
|
+
} from "./Popover";
|
|
20
|
+
|
|
21
|
+
// Flush microtasks so Floating UI position state settles.
|
|
22
|
+
// See: https://floating-ui.com/docs/react#testing
|
|
23
|
+
const waitForPositioning = () => act(async () => {});
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* happy-dom reports 0 for every layout metric, so a scroll box has to be faked. The scroll
|
|
27
|
+
* event is what makes PopoverBody re-measure — ResizeObserver never fires here because no
|
|
28
|
+
* box ever changes size.
|
|
29
|
+
*/
|
|
30
|
+
function setScrollMetrics(
|
|
31
|
+
element: HTMLElement,
|
|
32
|
+
metrics: { scrollTop?: number; scrollHeight: number; clientHeight: number },
|
|
33
|
+
) {
|
|
34
|
+
Object.defineProperty(element, "scrollTop", {
|
|
35
|
+
value: metrics.scrollTop ?? 0,
|
|
36
|
+
configurable: true,
|
|
37
|
+
});
|
|
38
|
+
Object.defineProperty(element, "scrollHeight", {
|
|
39
|
+
value: metrics.scrollHeight,
|
|
40
|
+
configurable: true,
|
|
41
|
+
});
|
|
42
|
+
Object.defineProperty(element, "clientHeight", {
|
|
43
|
+
value: metrics.clientHeight,
|
|
44
|
+
configurable: true,
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
fireEvent.scroll(element);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function BasicPopover(props: Omit<PopoverRootProps, "children">) {
|
|
51
|
+
return (
|
|
52
|
+
<PopoverRoot {...props}>
|
|
53
|
+
<PopoverTrigger>Open Popover</PopoverTrigger>
|
|
54
|
+
<PopoverPositioner>
|
|
55
|
+
<PopoverContent aria-label="Popover">
|
|
56
|
+
<PopoverBody data-testid="body">Body</PopoverBody>
|
|
57
|
+
<PopoverArrow>
|
|
58
|
+
<PopoverArrowTip />
|
|
59
|
+
</PopoverArrow>
|
|
60
|
+
</PopoverContent>
|
|
61
|
+
</PopoverPositioner>
|
|
62
|
+
</PopoverRoot>
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
describe("PopoverRoot", () => {
|
|
67
|
+
// The px values behind `gutter`/`overflowPadding` are mirrored by hand from `popover.yaml`
|
|
68
|
+
// (`$dimension.x2` / `$dimension.x4`), so nothing else would catch the two drifting apart.
|
|
69
|
+
// Only `gutter` is observable here — `overflowPadding` feeds the size middleware, which
|
|
70
|
+
// clamps to 0 against happy-dom's zero-sized viewport.
|
|
71
|
+
it("offsets the positioner by the spec gutter", async () => {
|
|
72
|
+
const { getByLabelText } = render(<BasicPopover defaultOpen />);
|
|
73
|
+
await waitForPositioning();
|
|
74
|
+
|
|
75
|
+
expect(getByLabelText("Popover").parentElement).toHaveStyle({
|
|
76
|
+
transform: "translate(0px, 8px)",
|
|
77
|
+
});
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
it("lets a caller override the seeded gutter", async () => {
|
|
81
|
+
const { getByLabelText } = render(<BasicPopover defaultOpen gutter={0} />);
|
|
82
|
+
await waitForPositioning();
|
|
83
|
+
|
|
84
|
+
expect(getByLabelText("Popover").parentElement).toHaveStyle({
|
|
85
|
+
transform: "translate(0px, 0px)",
|
|
86
|
+
});
|
|
87
|
+
});
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
describe("PopoverBody", () => {
|
|
91
|
+
// The bottom fade and the padding it needs hang off data-overflow, so a body that fits
|
|
92
|
+
// must not carry the attribute — otherwise short content fades into the surface with no
|
|
93
|
+
// scroll available to clear it.
|
|
94
|
+
it("leaves a body that fits unflagged", async () => {
|
|
95
|
+
const { getByTestId } = render(<BasicPopover defaultOpen />);
|
|
96
|
+
await waitForPositioning();
|
|
97
|
+
|
|
98
|
+
expect(getByTestId("body")).not.toHaveAttribute("data-overflow");
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
// `lazyMount` keeps the content subtree out of the DOM until the first open, so the body
|
|
102
|
+
// node attaches after PopoverBody's own mount would have run. Measurement has to start
|
|
103
|
+
// from the node, not from a mount effect that already came and went.
|
|
104
|
+
it("measures a body that mounts only on the first open", async () => {
|
|
105
|
+
const user = userEvent.setup();
|
|
106
|
+
const { getByText, getByTestId, queryByTestId } = render(<BasicPopover />);
|
|
107
|
+
await waitForPositioning();
|
|
108
|
+
|
|
109
|
+
expect(queryByTestId("body")).toBeNull();
|
|
110
|
+
|
|
111
|
+
await user.click(getByText("Open Popover"));
|
|
112
|
+
|
|
113
|
+
const body = getByTestId("body");
|
|
114
|
+
setScrollMetrics(body, { scrollHeight: 400, clientHeight: 200 });
|
|
115
|
+
|
|
116
|
+
expect(body).toHaveAttribute("data-overflow");
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
it("drops the flag once the body fits again", async () => {
|
|
120
|
+
const { getByTestId } = render(<BasicPopover defaultOpen />);
|
|
121
|
+
await waitForPositioning();
|
|
122
|
+
|
|
123
|
+
const body = getByTestId("body");
|
|
124
|
+
setScrollMetrics(body, { scrollHeight: 400, clientHeight: 200 });
|
|
125
|
+
expect(body).toHaveAttribute("data-overflow");
|
|
126
|
+
|
|
127
|
+
setScrollMetrics(body, { scrollHeight: 200, clientHeight: 200 });
|
|
128
|
+
expect(body).not.toHaveAttribute("data-overflow");
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
it("flags the body as scrolled once it leaves the top", async () => {
|
|
132
|
+
const { getByTestId } = render(<BasicPopover defaultOpen />);
|
|
133
|
+
await waitForPositioning();
|
|
134
|
+
|
|
135
|
+
const body = getByTestId("body");
|
|
136
|
+
expect(body).not.toHaveAttribute("data-scrolled");
|
|
137
|
+
|
|
138
|
+
setScrollMetrics(body, { scrollTop: 40, scrollHeight: 400, clientHeight: 200 });
|
|
139
|
+
expect(body).toHaveAttribute("data-scrolled");
|
|
140
|
+
});
|
|
141
|
+
|
|
142
|
+
// The bottom padding the recipe applies off data-overflow is itself part of scrollHeight,
|
|
143
|
+
// so counting it as overflow would keep the flag latched on a body that already fits.
|
|
144
|
+
it("discounts the body's own bottom padding when measuring overflow", async () => {
|
|
145
|
+
const { getByTestId } = render(<BasicPopover defaultOpen />);
|
|
146
|
+
await waitForPositioning();
|
|
147
|
+
|
|
148
|
+
const body = getByTestId("body");
|
|
149
|
+
body.style.paddingBottom = "24px";
|
|
150
|
+
setScrollMetrics(body, { scrollHeight: 220, clientHeight: 200 });
|
|
151
|
+
expect(body).not.toHaveAttribute("data-overflow");
|
|
152
|
+
|
|
153
|
+
// Same box, less padding: the 20px the content actually overflows by is now uncovered.
|
|
154
|
+
body.style.paddingBottom = "10px";
|
|
155
|
+
setScrollMetrics(body, { scrollHeight: 220, clientHeight: 200 });
|
|
156
|
+
expect(body).toHaveAttribute("data-overflow");
|
|
157
|
+
});
|
|
158
|
+
});
|
|
159
|
+
|
|
160
|
+
describe("PopoverHeader", () => {
|
|
161
|
+
// The close button owns the header's trailing space, and it is optional — the header only
|
|
162
|
+
// reserves that space when one is actually rendered.
|
|
163
|
+
it("flags the header while a close button renders", async () => {
|
|
164
|
+
const { getByTestId } = render(
|
|
165
|
+
<PopoverRoot defaultOpen>
|
|
166
|
+
<PopoverTrigger>Open Popover</PopoverTrigger>
|
|
167
|
+
<PopoverPositioner>
|
|
168
|
+
<PopoverContent aria-label="Popover">
|
|
169
|
+
<PopoverHeader data-testid="header">
|
|
170
|
+
<PopoverTitle>Title</PopoverTitle>
|
|
171
|
+
<PopoverCloseButton>Close</PopoverCloseButton>
|
|
172
|
+
</PopoverHeader>
|
|
173
|
+
</PopoverContent>
|
|
174
|
+
</PopoverPositioner>
|
|
175
|
+
</PopoverRoot>,
|
|
176
|
+
);
|
|
177
|
+
await waitForPositioning();
|
|
178
|
+
|
|
179
|
+
expect(getByTestId("header")).toHaveAttribute("data-show-close-button");
|
|
180
|
+
});
|
|
181
|
+
|
|
182
|
+
it("leaves the header unflagged without a close button", async () => {
|
|
183
|
+
const { getByTestId } = render(
|
|
184
|
+
<PopoverRoot defaultOpen>
|
|
185
|
+
<PopoverTrigger>Open Popover</PopoverTrigger>
|
|
186
|
+
<PopoverPositioner>
|
|
187
|
+
<PopoverContent aria-label="Popover">
|
|
188
|
+
<PopoverHeader data-testid="header">
|
|
189
|
+
<PopoverTitle>Title</PopoverTitle>
|
|
190
|
+
</PopoverHeader>
|
|
191
|
+
</PopoverContent>
|
|
192
|
+
</PopoverPositioner>
|
|
193
|
+
</PopoverRoot>,
|
|
194
|
+
);
|
|
195
|
+
await waitForPositioning();
|
|
196
|
+
|
|
197
|
+
expect(getByTestId("header")).not.toHaveAttribute("data-show-close-button");
|
|
198
|
+
});
|
|
199
|
+
|
|
200
|
+
// PopoverAction shares the close button's headless props but not its render tracking, so a
|
|
201
|
+
// footer action must not claim the header's trailing space.
|
|
202
|
+
it("leaves the header unflagged with only a footer action", async () => {
|
|
203
|
+
const { getByTestId } = render(
|
|
204
|
+
<PopoverRoot defaultOpen>
|
|
205
|
+
<PopoverTrigger>Open Popover</PopoverTrigger>
|
|
206
|
+
<PopoverPositioner>
|
|
207
|
+
<PopoverContent aria-label="Popover">
|
|
208
|
+
<PopoverHeader data-testid="header">
|
|
209
|
+
<PopoverTitle>Title</PopoverTitle>
|
|
210
|
+
</PopoverHeader>
|
|
211
|
+
<PopoverFooter>
|
|
212
|
+
<PopoverAction>Confirm</PopoverAction>
|
|
213
|
+
</PopoverFooter>
|
|
214
|
+
</PopoverContent>
|
|
215
|
+
</PopoverPositioner>
|
|
216
|
+
</PopoverRoot>,
|
|
217
|
+
);
|
|
218
|
+
await waitForPositioning();
|
|
219
|
+
|
|
220
|
+
expect(getByTestId("header")).not.toHaveAttribute("data-show-close-button");
|
|
221
|
+
});
|
|
222
|
+
});
|
|
@@ -0,0 +1,282 @@
|
|
|
1
|
+
import { popover, type PopoverVariantProps } from "@seed-design/css/recipes/popover";
|
|
2
|
+
import { Popover as PopoverPrimitive, usePopoverContext } from "@seed-design/react-popover";
|
|
3
|
+
import { Primitive, type PrimitiveProps } from "@seed-design/react-primitive";
|
|
4
|
+
import { composeRefs, useComposedRefs } from "@radix-ui/react-compose-refs";
|
|
5
|
+
import { dataAttr } from "@seed-design/dom-utils";
|
|
6
|
+
import clsx from "clsx";
|
|
7
|
+
import * as React from "react";
|
|
8
|
+
import { forwardRef } from "react";
|
|
9
|
+
import { useScaleFeedback } from "@seed-design/react-scale-feedback";
|
|
10
|
+
import { createRenderTrackingContext } from "../../utils/createRenderTrackingContext";
|
|
11
|
+
import { createSlotRecipeContext } from "../../utils/createSlotRecipeContext";
|
|
12
|
+
import { createWithStateProps } from "../../utils/createWithStateProps";
|
|
13
|
+
import { useStyleProps, withStyleProps, type StyleProps } from "../../utils/styled";
|
|
14
|
+
|
|
15
|
+
const { withContext, useClassNames, ClassNamesProvider } = createSlotRecipeContext(popover);
|
|
16
|
+
const withStateProps = createWithStateProps([usePopoverContext]);
|
|
17
|
+
|
|
18
|
+
const closeButtonTracker = createRenderTrackingContext("PopoverCloseButton");
|
|
19
|
+
|
|
20
|
+
////////////////////////////////////////////////////////////////////////////////////
|
|
21
|
+
|
|
22
|
+
export interface PopoverRootProps extends PopoverVariantProps, PopoverPrimitive.RootProps {
|
|
23
|
+
/**
|
|
24
|
+
* @default "bottom"
|
|
25
|
+
*/
|
|
26
|
+
placement?: PopoverPrimitive.RootProps["placement"];
|
|
27
|
+
/**
|
|
28
|
+
* @default 8
|
|
29
|
+
*/
|
|
30
|
+
gutter?: PopoverPrimitive.RootProps["gutter"];
|
|
31
|
+
/**
|
|
32
|
+
* @default 16
|
|
33
|
+
*/
|
|
34
|
+
overflowPadding?: PopoverPrimitive.RootProps["overflowPadding"];
|
|
35
|
+
/**
|
|
36
|
+
* @default true
|
|
37
|
+
*/
|
|
38
|
+
lazyMount?: PopoverPrimitive.RootProps["lazyMount"];
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// NOTE: `gutter` and `overflowPadding` are specified in Rootage (`popover.yaml`,
|
|
42
|
+
// `$dimension.x2` / `$dimension.x4`) and generated into `@seed-design/css`, but nothing
|
|
43
|
+
// reads them: floating-ui's `offset`/`shift` take numbers, not CSS custom properties,
|
|
44
|
+
// so the headless layer falls back to its own `0` / `8`. Those defaults stay
|
|
45
|
+
// design-system-agnostic on purpose — this layer is the one that owns the
|
|
46
|
+
// Rootage binding, so seed the spec values through destructuring defaults here,
|
|
47
|
+
// the way `HelpBubbleRoot` passes `gutter` through `defaultProps`.
|
|
48
|
+
export function PopoverRoot({
|
|
49
|
+
placement = "bottom",
|
|
50
|
+
gutter = 8,
|
|
51
|
+
overflowPadding = 16,
|
|
52
|
+
lazyMount = true,
|
|
53
|
+
...props
|
|
54
|
+
}: PopoverRootProps) {
|
|
55
|
+
const [variantProps, otherProps] = popover.splitVariantProps(props);
|
|
56
|
+
const classNames = popover(variantProps);
|
|
57
|
+
|
|
58
|
+
return (
|
|
59
|
+
<ClassNamesProvider value={classNames}>
|
|
60
|
+
<closeButtonTracker.Provider>
|
|
61
|
+
<PopoverPrimitive.Root
|
|
62
|
+
placement={placement}
|
|
63
|
+
gutter={gutter}
|
|
64
|
+
overflowPadding={overflowPadding}
|
|
65
|
+
lazyMount={lazyMount}
|
|
66
|
+
{...otherProps}
|
|
67
|
+
/>
|
|
68
|
+
</closeButtonTracker.Provider>
|
|
69
|
+
</ClassNamesProvider>
|
|
70
|
+
);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
////////////////////////////////////////////////////////////////////////////////////
|
|
74
|
+
|
|
75
|
+
export interface PopoverTriggerProps extends PopoverPrimitive.TriggerProps {}
|
|
76
|
+
|
|
77
|
+
export const PopoverTrigger = PopoverPrimitive.Trigger;
|
|
78
|
+
|
|
79
|
+
////////////////////////////////////////////////////////////////////////////////////
|
|
80
|
+
|
|
81
|
+
export interface PopoverAnchorProps extends PopoverPrimitive.AnchorProps {}
|
|
82
|
+
|
|
83
|
+
export const PopoverAnchor = PopoverPrimitive.Anchor;
|
|
84
|
+
|
|
85
|
+
////////////////////////////////////////////////////////////////////////////////////
|
|
86
|
+
|
|
87
|
+
// Portals into a `container` ref and keeps FloatingPortal's other props out of reach, matching Menu and Select.
|
|
88
|
+
export interface PopoverPositionerProps extends Omit<PopoverPrimitive.PositionerProps, "id"> {
|
|
89
|
+
/**
|
|
90
|
+
* The container element to render the portal into.
|
|
91
|
+
* @default document.body
|
|
92
|
+
*/
|
|
93
|
+
container?: React.RefObject<HTMLElement | null>;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
export const PopoverPositioner = forwardRef<HTMLDivElement, PopoverPositionerProps>(
|
|
97
|
+
({ container, className, ...props }, ref) => {
|
|
98
|
+
const classNames = useClassNames();
|
|
99
|
+
|
|
100
|
+
return (
|
|
101
|
+
<PopoverPrimitive.PositionerPortal
|
|
102
|
+
ref={ref}
|
|
103
|
+
root={container ?? undefined}
|
|
104
|
+
className={clsx(classNames.positioner, className)}
|
|
105
|
+
{...props}
|
|
106
|
+
/>
|
|
107
|
+
);
|
|
108
|
+
},
|
|
109
|
+
);
|
|
110
|
+
PopoverPositioner.displayName = "PopoverPositioner";
|
|
111
|
+
|
|
112
|
+
////////////////////////////////////////////////////////////////////////////////////
|
|
113
|
+
|
|
114
|
+
export interface PopoverContentProps
|
|
115
|
+
extends PrimitiveProps,
|
|
116
|
+
Pick<StyleProps, "width" | "maxWidth">,
|
|
117
|
+
React.HTMLAttributes<HTMLDivElement> {}
|
|
118
|
+
|
|
119
|
+
export const PopoverContent = withContext<HTMLDivElement, PopoverContentProps>(
|
|
120
|
+
withStyleProps(withStateProps(PopoverPrimitive.Content)),
|
|
121
|
+
"content",
|
|
122
|
+
);
|
|
123
|
+
|
|
124
|
+
////////////////////////////////////////////////////////////////////////////////////
|
|
125
|
+
|
|
126
|
+
export interface PopoverHeaderProps extends PrimitiveProps, React.HTMLAttributes<HTMLDivElement> {}
|
|
127
|
+
|
|
128
|
+
export const PopoverHeader = forwardRef<HTMLDivElement, PopoverHeaderProps>(
|
|
129
|
+
({ className, ...props }, ref) => {
|
|
130
|
+
const classNames = useClassNames();
|
|
131
|
+
const { isRendered } = closeButtonTracker.useRenderTracking();
|
|
132
|
+
|
|
133
|
+
return (
|
|
134
|
+
<Primitive.div
|
|
135
|
+
ref={ref}
|
|
136
|
+
data-show-close-button={dataAttr(isRendered)}
|
|
137
|
+
className={clsx(classNames.header, className)}
|
|
138
|
+
{...props}
|
|
139
|
+
/>
|
|
140
|
+
);
|
|
141
|
+
},
|
|
142
|
+
);
|
|
143
|
+
|
|
144
|
+
PopoverHeader.displayName = "PopoverHeader";
|
|
145
|
+
|
|
146
|
+
////////////////////////////////////////////////////////////////////////////////////
|
|
147
|
+
|
|
148
|
+
export interface PopoverTitleProps
|
|
149
|
+
extends PrimitiveProps,
|
|
150
|
+
React.HTMLAttributes<HTMLHeadingElement> {}
|
|
151
|
+
|
|
152
|
+
export const PopoverTitle = withContext<HTMLHeadingElement, PopoverTitleProps>(
|
|
153
|
+
PopoverPrimitive.Title,
|
|
154
|
+
"title",
|
|
155
|
+
);
|
|
156
|
+
|
|
157
|
+
PopoverTitle.displayName = "PopoverTitle";
|
|
158
|
+
|
|
159
|
+
////////////////////////////////////////////////////////////////////////////////////
|
|
160
|
+
|
|
161
|
+
export interface PopoverDescriptionProps
|
|
162
|
+
extends PrimitiveProps,
|
|
163
|
+
React.HTMLAttributes<HTMLParagraphElement> {}
|
|
164
|
+
|
|
165
|
+
export const PopoverDescription = withContext<HTMLParagraphElement, PopoverDescriptionProps>(
|
|
166
|
+
PopoverPrimitive.Description,
|
|
167
|
+
"description",
|
|
168
|
+
);
|
|
169
|
+
|
|
170
|
+
PopoverDescription.displayName = "PopoverDescription";
|
|
171
|
+
|
|
172
|
+
////////////////////////////////////////////////////////////////////////////////////
|
|
173
|
+
|
|
174
|
+
export interface PopoverBodyProps
|
|
175
|
+
extends PrimitiveProps,
|
|
176
|
+
Pick<
|
|
177
|
+
StyleProps,
|
|
178
|
+
"paddingX" | "height" | "maxHeight" | "minHeight" | "justifyContent" | "alignItems"
|
|
179
|
+
>,
|
|
180
|
+
React.HTMLAttributes<HTMLDivElement> {}
|
|
181
|
+
|
|
182
|
+
export const PopoverBody = forwardRef<HTMLDivElement, PopoverBodyProps>((props, forwardedRef) => {
|
|
183
|
+
const classNames = useClassNames();
|
|
184
|
+
const { style, restProps } = useStyleProps(props);
|
|
185
|
+
const { className, ...otherProps } = restProps;
|
|
186
|
+
|
|
187
|
+
const ref = React.useRef<HTMLDivElement>(null);
|
|
188
|
+
const [scrolled, setScrolled] = React.useState(false);
|
|
189
|
+
const [overflowing, setOverflowing] = React.useState(false);
|
|
190
|
+
|
|
191
|
+
React.useEffect(() => {
|
|
192
|
+
const element = ref.current;
|
|
193
|
+
if (!element) return;
|
|
194
|
+
|
|
195
|
+
const check = () => {
|
|
196
|
+
setScrolled(element.scrollTop > 0);
|
|
197
|
+
// Subtract the current bottom padding so overflow detection stays independent
|
|
198
|
+
// of the padding we conditionally apply — otherwise that padding would count as
|
|
199
|
+
// overflow and the state would never settle (padding -> overflow -> padding...).
|
|
200
|
+
const paddingBottom = Number.parseFloat(getComputedStyle(element).paddingBottom) || 0;
|
|
201
|
+
setOverflowing(element.scrollHeight - paddingBottom > element.clientHeight);
|
|
202
|
+
};
|
|
203
|
+
check();
|
|
204
|
+
|
|
205
|
+
element.addEventListener("scroll", check);
|
|
206
|
+
|
|
207
|
+
const observer = new ResizeObserver(check);
|
|
208
|
+
observer.observe(element);
|
|
209
|
+
|
|
210
|
+
return () => {
|
|
211
|
+
element.removeEventListener("scroll", check);
|
|
212
|
+
observer.disconnect();
|
|
213
|
+
};
|
|
214
|
+
}, []);
|
|
215
|
+
|
|
216
|
+
return (
|
|
217
|
+
<Primitive.div
|
|
218
|
+
ref={composeRefs(ref, forwardedRef)}
|
|
219
|
+
data-scrolled={dataAttr(scrolled)}
|
|
220
|
+
data-overflow={dataAttr(overflowing)}
|
|
221
|
+
className={clsx(classNames.body, className)}
|
|
222
|
+
style={style}
|
|
223
|
+
{...otherProps}
|
|
224
|
+
/>
|
|
225
|
+
);
|
|
226
|
+
});
|
|
227
|
+
|
|
228
|
+
PopoverBody.displayName = "PopoverBody";
|
|
229
|
+
|
|
230
|
+
////////////////////////////////////////////////////////////////////////////////////
|
|
231
|
+
|
|
232
|
+
export interface PopoverFooterProps extends PrimitiveProps, React.HTMLAttributes<HTMLDivElement> {}
|
|
233
|
+
|
|
234
|
+
export const PopoverFooter = withContext<HTMLDivElement, PopoverFooterProps>(
|
|
235
|
+
Primitive.div,
|
|
236
|
+
"footer",
|
|
237
|
+
);
|
|
238
|
+
|
|
239
|
+
////////////////////////////////////////////////////////////////////////////////////
|
|
240
|
+
|
|
241
|
+
export interface PopoverActionProps extends PopoverPrimitive.CloseButtonProps {}
|
|
242
|
+
|
|
243
|
+
export const PopoverAction = PopoverPrimitive.CloseButton;
|
|
244
|
+
|
|
245
|
+
////////////////////////////////////////////////////////////////////////////////////
|
|
246
|
+
|
|
247
|
+
export interface PopoverCloseButtonProps extends PopoverPrimitive.CloseButtonProps {}
|
|
248
|
+
|
|
249
|
+
export const PopoverCloseButton = forwardRef<HTMLButtonElement, PopoverCloseButtonProps>(
|
|
250
|
+
({ className, ...props }, ref) => {
|
|
251
|
+
const classNames = useClassNames();
|
|
252
|
+
const { trackRef } = closeButtonTracker.useRenderTracking();
|
|
253
|
+
const { scaleFeedbackRef, scaleFeedbackClassName } = useScaleFeedback();
|
|
254
|
+
|
|
255
|
+
return (
|
|
256
|
+
<PopoverPrimitive.CloseButton
|
|
257
|
+
ref={useComposedRefs(scaleFeedbackRef, ref, trackRef)}
|
|
258
|
+
className={clsx(classNames.closeButton, scaleFeedbackClassName, className)}
|
|
259
|
+
{...props}
|
|
260
|
+
/>
|
|
261
|
+
);
|
|
262
|
+
},
|
|
263
|
+
);
|
|
264
|
+
|
|
265
|
+
PopoverCloseButton.displayName = "PopoverCloseButton";
|
|
266
|
+
|
|
267
|
+
////////////////////////////////////////////////////////////////////////////////////
|
|
268
|
+
|
|
269
|
+
export interface PopoverArrowProps extends PopoverPrimitive.ArrowProps {}
|
|
270
|
+
|
|
271
|
+
// Arrow and ArrowTip are placeholders so future arrow support does not require snippet updates.
|
|
272
|
+
export const PopoverArrow = forwardRef<HTMLDivElement, PopoverArrowProps>(() => null);
|
|
273
|
+
|
|
274
|
+
PopoverArrow.displayName = "PopoverArrow";
|
|
275
|
+
|
|
276
|
+
////////////////////////////////////////////////////////////////////////////////////
|
|
277
|
+
|
|
278
|
+
export interface PopoverArrowTipProps extends React.SVGProps<SVGSVGElement> {}
|
|
279
|
+
|
|
280
|
+
export const PopoverArrowTip = forwardRef<SVGSVGElement, PopoverArrowTipProps>(() => null);
|
|
281
|
+
|
|
282
|
+
PopoverArrowTip.displayName = "PopoverArrowTip";
|