@ntbjs/react-components 2.0.14 → 3.0.0-rc.2
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 +34 -0
- package/build/data/Alert/Alert.js +18 -33
- package/build/data/Alert/Alert.js.map +1 -1
- package/build/data/Alert/Alert.styled.js +9 -47
- package/build/data/Alert/Alert.styled.js.map +1 -1
- package/build/data/Badge/Badge.js +36 -61
- package/build/data/Badge/Badge.js.map +1 -1
- package/build/data/Badge/Badge.styled.js +21 -70
- package/build/data/Badge/Badge.styled.js.map +1 -1
- package/build/data/Popover/Popover.js +125 -71
- package/build/data/Popover/Popover.js.map +1 -1
- package/build/data/Popover/Popover.styled.js +10 -140
- package/build/data/Popover/Popover.styled.js.map +1 -1
- package/build/data/SeverityBadge/SeverityBadge.js +13 -22
- package/build/data/SeverityBadge/SeverityBadge.js.map +1 -1
- package/build/data/SeverityBadge/index.js +2 -0
- package/build/data/SeverityBadge/index.js.map +1 -0
- package/build/data/Tab/Tab.js +7 -13
- package/build/data/Tab/Tab.js.map +1 -1
- package/build/data/Tab/Tab.styled.js +4 -7
- package/build/data/Tab/Tab.styled.js.map +1 -1
- package/build/data/Tabs/Tabs.js +30 -32
- package/build/data/Tabs/Tabs.js.map +1 -1
- package/build/data/Tabs/Tabs.styled.js +21 -57
- package/build/data/Tabs/Tabs.styled.js.map +1 -1
- package/build/data/Tooltip/Tooltip.js +102 -33
- package/build/data/Tooltip/Tooltip.js.map +1 -1
- package/build/data/Tooltip/Tooltip.styled.js +9 -22
- package/build/data/Tooltip/Tooltip.styled.js.map +1 -1
- package/build/data/VerificationStatusIcon/VerificationStatusIcon.js +16 -23
- package/build/data/VerificationStatusIcon/VerificationStatusIcon.js.map +1 -1
- package/build/data/VerificationStatusIcon/VerificationStatusIcon.styled.js +13 -31
- package/build/data/VerificationStatusIcon/VerificationStatusIcon.styled.js.map +1 -1
- package/build/data/VerificationStatusIcon/index.js +2 -0
- package/build/data/VerificationStatusIcon/index.js.map +1 -0
- package/build/data/_shared/FloatingArrow.styled.js +30 -0
- package/build/data/_shared/FloatingArrow.styled.js.map +1 -0
- package/build/hooks/useEventListner.js.map +1 -1
- package/build/hooks/useFloatingPopover.js +187 -0
- package/build/hooks/useFloatingPopover.js.map +1 -0
- package/build/hooks/useIsomorphicLayoutEffect.js.map +1 -1
- package/build/hooks/useOnClickOutside.js.map +1 -1
- package/build/hooks/useTooltipAutoShow.js.map +1 -1
- package/build/icons/arrow-back.svg.js +3 -3
- package/build/icons/arrow-back.svg.js.map +1 -1
- package/build/icons/arrow-forward.svg.js +4 -4
- package/build/icons/arrow-forward.svg.js.map +1 -1
- package/build/icons/check-rectangle-filled.svg.js +3 -3
- package/build/icons/check-rectangle-filled.svg.js.map +1 -1
- package/build/icons/close.svg.js +3 -3
- package/build/icons/close.svg.js.map +1 -1
- package/build/icons/edit-note.svg.js +3 -3
- package/build/icons/edit-note.svg.js.map +1 -1
- package/build/icons/expand-more.svg.js +3 -3
- package/build/icons/expand-more.svg.js.map +1 -1
- package/build/icons/headset.svg.js +3 -3
- package/build/icons/headset.svg.js.map +1 -1
- package/build/icons/layers.svg.js +3 -3
- package/build/icons/layers.svg.js.map +1 -1
- package/build/icons/link.svg.js +3 -3
- package/build/icons/link.svg.js.map +1 -1
- package/build/icons/play.svg.js +3 -3
- package/build/icons/play.svg.js.map +1 -1
- package/build/icons/search.svg.js +3 -3
- package/build/icons/search.svg.js.map +1 -1
- package/build/icons/star-filled.svg.js +3 -3
- package/build/icons/star-filled.svg.js.map +1 -1
- package/build/icons/star.svg.js +3 -3
- package/build/icons/star.svg.js.map +1 -1
- package/build/icons/triangle-right.svg.js +3 -3
- package/build/icons/triangle-right.svg.js.map +1 -1
- package/build/icons/verification.svg.js +3 -3
- package/build/icons/verification.svg.js.map +1 -1
- package/build/icons/warning-circle.svg.js +3 -3
- package/build/icons/warning-circle.svg.js.map +1 -1
- package/build/inputs/ActionButton/ActionButton.js +11 -22
- package/build/inputs/ActionButton/ActionButton.js.map +1 -1
- package/build/inputs/ActionButton/ActionButton.styled.js +5 -54
- package/build/inputs/ActionButton/ActionButton.styled.js.map +1 -1
- package/build/inputs/Button/Button.js +125 -121
- package/build/inputs/Button/Button.js.map +1 -1
- package/build/inputs/Button/Button.styled.js +42 -260
- package/build/inputs/Button/Button.styled.js.map +1 -1
- package/build/inputs/Checkbox/Checkbox.js +45 -61
- package/build/inputs/Checkbox/Checkbox.js.map +1 -1
- package/build/inputs/Checkbox/Checkbox.styled.js +24 -153
- package/build/inputs/Checkbox/Checkbox.styled.js.map +1 -1
- package/build/inputs/CompactAutocompleteSelect/CompactAutocompleteSelect.js +106 -111
- package/build/inputs/CompactAutocompleteSelect/CompactAutocompleteSelect.js.map +1 -1
- package/build/inputs/CompactAutocompleteSelect/CompactAutocompleteSelect.styled.js +88 -273
- package/build/inputs/CompactAutocompleteSelect/CompactAutocompleteSelect.styled.js.map +1 -1
- package/build/inputs/CompactStarRating/CompactStarRating.js +56 -77
- package/build/inputs/CompactStarRating/CompactStarRating.js.map +1 -1
- package/build/inputs/CompactStarRating/CompactStarRating.styled.js +32 -211
- package/build/inputs/CompactStarRating/CompactStarRating.styled.js.map +1 -1
- package/build/inputs/CompactTextInput/CompactTextInput.js +86 -105
- package/build/inputs/CompactTextInput/CompactTextInput.js.map +1 -1
- package/build/inputs/CompactTextInput/CompactTextInput.styled.js +55 -258
- package/build/inputs/CompactTextInput/CompactTextInput.styled.js.map +1 -1
- package/build/inputs/MultiLevelCheckbox/MultiLevelCheckbox.js +70 -77
- package/build/inputs/MultiLevelCheckbox/MultiLevelCheckbox.js.map +1 -1
- package/build/inputs/MultiLevelCheckbox/MultiLevelCheckbox.styled.js +28 -60
- package/build/inputs/MultiLevelCheckbox/MultiLevelCheckbox.styled.js.map +1 -1
- package/build/inputs/MultiLevelCheckbox/types.js +12 -12
- package/build/inputs/MultiLevelCheckbox/types.js.map +1 -1
- package/build/inputs/MultiLevelCheckboxSelect/MultiLevelCheckboxSelect.js +69 -73
- package/build/inputs/MultiLevelCheckboxSelect/MultiLevelCheckboxSelect.js.map +1 -1
- package/build/inputs/MultiLevelCheckboxSelect/MultiLevelCheckboxSelect.styled.js +44 -87
- package/build/inputs/MultiLevelCheckboxSelect/MultiLevelCheckboxSelect.styled.js.map +1 -1
- package/build/inputs/MultiSelect/MultiSelect.js +69 -79
- package/build/inputs/MultiSelect/MultiSelect.js.map +1 -1
- package/build/inputs/MultiSelect/MultiSelect.styled.js +70 -76
- package/build/inputs/MultiSelect/MultiSelect.styled.js.map +1 -1
- package/build/inputs/Radio/Radio.js +20 -33
- package/build/inputs/Radio/Radio.js.map +1 -1
- package/build/inputs/Radio/Radio.styled.js +15 -96
- package/build/inputs/Radio/Radio.styled.js.map +1 -1
- package/build/inputs/Switch/Switch.js +28 -40
- package/build/inputs/Switch/Switch.js.map +1 -1
- package/build/inputs/Switch/Switch.styled.js +24 -94
- package/build/inputs/Switch/Switch.styled.js.map +1 -1
- package/build/inputs/TextArea/TextArea.js +98 -123
- package/build/inputs/TextArea/TextArea.js.map +1 -1
- package/build/inputs/TextArea/TextArea.styled.js +64 -379
- package/build/inputs/TextArea/TextArea.styled.js.map +1 -1
- package/build/inputs/TextInput/TextInput.js +59 -79
- package/build/inputs/TextInput/TextInput.js.map +1 -1
- package/build/inputs/TextInput/TextInput.styled.js +33 -224
- package/build/inputs/TextInput/TextInput.styled.js.map +1 -1
- package/build/layout/InputGroup/InputGroup.js +6 -9
- package/build/layout/InputGroup/InputGroup.js.map +1 -1
- package/build/layout/InputGroup/InputGroup.styled.js +4 -3
- package/build/layout/InputGroup/InputGroup.styled.js.map +1 -1
- package/build/layout/InputGroup/index.js +2 -0
- package/build/layout/InputGroup/index.js.map +1 -0
- package/build/layout/SectionSeparator/SectionSeparator.js +5 -9
- package/build/layout/SectionSeparator/SectionSeparator.js.map +1 -1
- package/build/layout/SectionSeparator/SectionSeparator.styled.js +4 -8
- package/build/layout/SectionSeparator/SectionSeparator.styled.js.map +1 -1
- package/build/styles/utils/colors-export.d.ts +54 -0
- package/build/styles/utils/colors-export.js.map +1 -1
- package/build/utils/dateTime.js.map +1 -1
- package/build/utils/defaultTheme.js +14 -28
- package/build/utils/defaultTheme.js.map +1 -1
- package/build/utils/getElementRef.js +14 -0
- package/build/utils/getElementRef.js.map +1 -0
- package/build/utils/parseTrigger.js +16 -0
- package/build/utils/parseTrigger.js.map +1 -0
- package/build/widgets/AssetAction/AssetAction.js +26 -33
- package/build/widgets/AssetAction/AssetAction.js.map +1 -1
- package/build/widgets/AssetAction/AssetAction.styled.js +20 -34
- package/build/widgets/AssetAction/AssetAction.styled.js.map +1 -1
- package/build/widgets/AssetActionsBase/AssetActionsBase.js +8 -13
- package/build/widgets/AssetActionsBase/AssetActionsBase.js.map +1 -1
- package/build/widgets/AssetActionsBase/AssetActionsBase.styled.js +4 -9
- package/build/widgets/AssetActionsBase/AssetActionsBase.styled.js.map +1 -1
- package/build/widgets/AssetGallery/AssetGallery.js +15 -40
- package/build/widgets/AssetGallery/AssetGallery.js.map +1 -1
- package/build/widgets/AssetGallery/AssetGalleryBase/AssetGalleryBase.js +55 -70
- package/build/widgets/AssetGallery/AssetGalleryBase/AssetGalleryBase.js.map +1 -1
- package/build/widgets/AssetGallery/AssetGalleryBase/AssetGalleryBase.styled.js +12 -24
- package/build/widgets/AssetGallery/AssetGalleryBase/AssetGalleryBase.styled.js.map +1 -1
- package/build/widgets/AssetGallery/AssetGalleryBase/AssetGalleryCompactCard/AssetGalleryCompactCard.js +146 -122
- package/build/widgets/AssetGallery/AssetGalleryBase/AssetGalleryCompactCard/AssetGalleryCompactCard.js.map +1 -1
- package/build/widgets/AssetGallery/AssetGalleryBase/AssetGalleryCompactCard/AssetGalleryCompactCard.styled.js +99 -286
- package/build/widgets/AssetGallery/AssetGalleryBase/AssetGalleryCompactCard/AssetGalleryCompactCard.styled.js.map +1 -1
- package/build/widgets/AssetGallery/AssetGalleryBase/AssetGalleryGridCard/AssetGalleryGridCard.js +170 -125
- package/build/widgets/AssetGallery/AssetGalleryBase/AssetGalleryGridCard/AssetGalleryGridCard.js.map +1 -1
- package/build/widgets/AssetGallery/AssetGalleryBase/AssetGalleryGridCard/AssetGalleryGridCard.styled.js +135 -364
- package/build/widgets/AssetGallery/AssetGalleryBase/AssetGalleryGridCard/AssetGalleryGridCard.styled.js.map +1 -1
- package/build/widgets/AssetPreview/AssetPreviewTopBar/AssetPreviewTopBar.js +20 -21
- package/build/widgets/AssetPreview/AssetPreviewTopBar/AssetPreviewTopBar.js.map +1 -1
- package/build/widgets/AssetPreview/AssetPreviewTopBar/AssetPreviewTopBar.styled.js +20 -71
- package/build/widgets/AssetPreview/AssetPreviewTopBar/AssetPreviewTopBar.styled.js.map +1 -1
- package/build/widgets/ContextMenu/ContextMenu.js +12 -11
- package/build/widgets/ContextMenu/ContextMenu.js.map +1 -1
- package/build/widgets/ContextMenu/ContextMenu.styled.js +4 -4
- package/build/widgets/ContextMenu/ContextMenu.styled.js.map +1 -1
- package/build/widgets/ContextMenu/ContextMenuItem/ContextMenuItem.js +17 -25
- package/build/widgets/ContextMenu/ContextMenuItem/ContextMenuItem.js.map +1 -1
- package/build/widgets/ContextMenu/ContextMenuItem/ContextMenuItem.styled.js +16 -71
- package/build/widgets/ContextMenu/ContextMenuItem/ContextMenuItem.styled.js.map +1 -1
- package/build/widgets/ContextMenu/ContextMenuItemsGroup/ContextMenuItemsGroup.js +7 -11
- package/build/widgets/ContextMenu/ContextMenuItemsGroup/ContextMenuItemsGroup.js.map +1 -1
- package/build/widgets/ContextMenu/ContextMenuItemsGroup/ContextMenuItemsGroup.styled.js +4 -11
- package/build/widgets/ContextMenu/ContextMenuItemsGroup/ContextMenuItemsGroup.styled.js.map +1 -1
- package/build/widgets/InfoCard/InfoCard.js +26 -21
- package/build/widgets/InfoCard/InfoCard.js.map +1 -1
- package/build/widgets/InfoCard/InfoCard.styled.js +36 -84
- package/build/widgets/InfoCard/InfoCard.styled.js.map +1 -1
- package/build/widgets/InstructionSeverityDisplay/InstructionSeverityDisplay.js +28 -34
- package/build/widgets/InstructionSeverityDisplay/InstructionSeverityDisplay.js.map +1 -1
- package/build/widgets/InstructionSeverityDisplay/InstructionSeverityDisplay.styled.js +21 -57
- package/build/widgets/InstructionSeverityDisplay/InstructionSeverityDisplay.styled.js.map +1 -1
- package/build/widgets/InstructionSeverityDisplay/index.js +2 -0
- package/build/widgets/InstructionSeverityDisplay/index.js.map +1 -0
- package/build/widgets/Instructions/Instructions.js +53 -95
- package/build/widgets/Instructions/Instructions.js.map +1 -1
- package/build/widgets/Instructions/Instructions.styled.js +27 -26
- package/build/widgets/Instructions/Instructions.styled.js.map +1 -1
- package/build/widgets/ProgressBar/ProgressBar.js +39 -37
- package/build/widgets/ProgressBar/ProgressBar.js.map +1 -1
- package/build/widgets/ProgressBar/ProgressBar.styled.js +56 -125
- package/build/widgets/ProgressBar/ProgressBar.styled.js.map +1 -1
- package/build/widgets/SummaryCard/SummaryCard.js +55 -64
- package/build/widgets/SummaryCard/SummaryCard.js.map +1 -1
- package/build/widgets/SummaryCard/SummaryCard.styled.js +51 -106
- package/build/widgets/SummaryCard/SummaryCard.styled.js.map +1 -1
- package/package.json +84 -36
- package/styles/utils/colors-export.d.ts +54 -0
- package/types/components/data/Alert/Alert.d.ts +76 -0
- package/types/components/data/Alert/Alert.styled.d.ts +52 -0
- package/types/components/data/Alert/index.d.ts +1 -0
- package/types/components/data/Badge/Badge.d.ts +120 -0
- package/types/components/data/Badge/Badge.styled.d.ts +33 -0
- package/types/components/data/Badge/index.d.ts +1 -0
- package/types/components/data/Popover/Popover.d.ts +116 -0
- package/types/components/data/Popover/Popover.styled.d.ts +15 -0
- package/types/components/data/Popover/index.d.ts +1 -0
- package/types/components/data/SeverityBadge/SeverityBadge.d.ts +72 -0
- package/types/components/data/SeverityBadge/index.d.ts +1 -0
- package/types/components/data/Tab/Tab.d.ts +14 -0
- package/types/components/data/Tab/Tab.styled.d.ts +1 -0
- package/types/components/data/Tab/index.d.ts +1 -0
- package/types/components/data/Tabs/Tabs.d.ts +111 -0
- package/types/components/data/Tabs/Tabs.styled.d.ts +26 -0
- package/types/components/data/Tabs/index.d.ts +1 -0
- package/types/components/data/Tooltip/Tooltip.d.ts +88 -0
- package/types/components/data/Tooltip/Tooltip.styled.d.ts +8 -0
- package/types/components/data/Tooltip/index.d.ts +1 -0
- package/types/components/data/VerificationStatusIcon/VerificationStatusIcon.d.ts +35 -0
- package/types/components/data/VerificationStatusIcon/VerificationStatusIcon.styled.d.ts +27 -0
- package/types/components/data/VerificationStatusIcon/index.d.ts +1 -0
- package/types/components/data/_shared/FloatingArrow.styled.d.ts +29 -0
- package/types/components/data/index.d.ts +8 -0
- package/types/components/index.d.ts +3 -0
- package/types/components/inputs/ActionButton/ActionButton.d.ts +55 -0
- package/types/components/inputs/ActionButton/ActionButton.styled.d.ts +16 -0
- package/types/components/inputs/ActionButton/index.d.ts +1 -0
- package/types/components/inputs/Button/Button.d.ts +82 -0
- package/types/components/inputs/Button/Button.styled.d.ts +60 -0
- package/types/components/inputs/Button/index.d.ts +1 -0
- package/types/components/inputs/Checkbox/Checkbox.d.ts +83 -0
- package/types/components/inputs/Checkbox/Checkbox.styled.d.ts +29 -0
- package/types/components/inputs/Checkbox/index.d.ts +1 -0
- package/types/components/inputs/CompactAutocompleteSelect/CompactAutocompleteSelect.d.ts +242 -0
- package/types/components/inputs/CompactAutocompleteSelect/CompactAutocompleteSelect.styled.d.ts +104 -0
- package/types/components/inputs/CompactAutocompleteSelect/index.d.ts +1 -0
- package/types/components/inputs/CompactStarRating/CompactStarRating.d.ts +96 -0
- package/types/components/inputs/CompactStarRating/CompactStarRating.styled.d.ts +34 -0
- package/types/components/inputs/CompactStarRating/index.d.ts +1 -0
- package/types/components/inputs/CompactTextInput/CompactTextInput.d.ts +116 -0
- package/types/components/inputs/CompactTextInput/CompactTextInput.styled.d.ts +42 -0
- package/types/components/inputs/CompactTextInput/index.d.ts +1 -0
- package/types/components/inputs/MultiLevelCheckbox/MultiLevelCheckbox.d.ts +41 -0
- package/types/components/inputs/MultiLevelCheckbox/MultiLevelCheckbox.styled.d.ts +13 -0
- package/types/components/inputs/MultiLevelCheckbox/index.d.ts +2 -0
- package/types/components/inputs/MultiLevelCheckbox/types.d.ts +29 -0
- package/types/components/inputs/MultiLevelCheckboxSelect/MultiLevelCheckboxSelect.d.ts +44 -0
- package/types/components/inputs/MultiLevelCheckboxSelect/MultiLevelCheckboxSelect.styled.d.ts +11 -0
- package/types/components/inputs/MultiLevelCheckboxSelect/index.d.ts +1 -0
- package/types/components/inputs/MultiSelect/MultiSelect.d.ts +115 -0
- package/types/components/inputs/MultiSelect/MultiSelect.styled.d.ts +34 -0
- package/types/components/inputs/MultiSelect/index.d.ts +1 -0
- package/types/components/inputs/Radio/Radio.d.ts +65 -0
- package/types/components/inputs/Radio/Radio.styled.d.ts +11 -0
- package/types/components/inputs/Radio/index.d.ts +1 -0
- package/types/components/inputs/Switch/Switch.d.ts +62 -0
- package/types/components/inputs/Switch/Switch.styled.d.ts +16 -0
- package/types/components/inputs/Switch/index.d.ts +1 -0
- package/types/components/inputs/TextArea/TextArea.d.ts +120 -0
- package/types/components/inputs/TextArea/TextArea.styled.d.ts +93 -0
- package/types/components/inputs/TextArea/index.d.ts +1 -0
- package/types/components/inputs/TextInput/TextInput.d.ts +109 -0
- package/types/components/inputs/TextInput/TextInput.styled.d.ts +43 -0
- package/types/components/inputs/TextInput/index.d.ts +1 -0
- package/types/components/inputs/index.d.ts +13 -0
- package/types/components/layout/InputGroup/InputGroup.d.ts +31 -0
- package/types/components/layout/InputGroup/InputGroup.styled.d.ts +1 -0
- package/types/components/layout/InputGroup/index.d.ts +1 -0
- package/types/components/layout/SectionSeparator/SectionSeparator.d.ts +28 -0
- package/types/components/layout/SectionSeparator/SectionSeparator.styled.d.ts +7 -0
- package/types/components/layout/SectionSeparator/index.d.ts +1 -0
- package/types/components/layout/index.d.ts +2 -0
- package/types/components/widgets/AssetAction/AssetAction.d.ts +16 -0
- package/types/components/widgets/AssetAction/AssetAction.styled.d.ts +15 -0
- package/types/components/widgets/AssetAction/index.d.ts +1 -0
- package/types/components/widgets/AssetActionsBase/AssetActionsBase.d.ts +25 -0
- package/types/components/widgets/AssetActionsBase/AssetActionsBase.styled.d.ts +1 -0
- package/types/components/widgets/AssetActionsBase/index.d.ts +1 -0
- package/types/components/widgets/AssetGallery/AssetGallery.d.ts +170 -0
- package/types/components/widgets/AssetGallery/AssetGalleryBase/AssetGalleryBase.d.ts +76 -0
- package/types/components/widgets/AssetGallery/AssetGalleryBase/AssetGalleryBase.styled.d.ts +3 -0
- package/types/components/widgets/AssetGallery/AssetGalleryBase/AssetGalleryCompactCard/AssetGalleryCompactCard.d.ts +3 -0
- package/types/components/widgets/AssetGallery/AssetGalleryBase/AssetGalleryCompactCard/AssetGalleryCompactCard.styled.d.ts +52 -0
- package/types/components/widgets/AssetGallery/AssetGalleryBase/AssetGalleryGridCard/AssetGalleryGridCard.d.ts +2 -0
- package/types/components/widgets/AssetGallery/AssetGalleryBase/AssetGalleryGridCard/AssetGalleryGridCard.styled.d.ts +49 -0
- package/types/components/widgets/AssetGallery/asset.types.d.ts +329 -0
- package/types/components/widgets/AssetGallery/index.d.ts +1 -0
- package/types/components/widgets/AssetPreview/AssetPreviewTopBar/AssetPreviewTopBar.d.ts +60 -0
- package/types/components/widgets/AssetPreview/AssetPreviewTopBar/AssetPreviewTopBar.styled.d.ts +21 -0
- package/types/components/widgets/AssetPreview/AssetPreviewTopBar/index.d.ts +1 -0
- package/types/components/widgets/ContextMenu/ContextMenu.d.ts +118 -0
- package/types/components/widgets/ContextMenu/ContextMenu.styled.d.ts +1 -0
- package/types/components/widgets/ContextMenu/ContextMenuItem/ContextMenuItem.d.ts +45 -0
- package/types/components/widgets/ContextMenu/ContextMenuItem/ContextMenuItem.styled.d.ts +18 -0
- package/types/components/widgets/ContextMenu/ContextMenuItem/index.d.ts +1 -0
- package/types/components/widgets/ContextMenu/ContextMenuItemsGroup/ContextMenuItemsGroup.d.ts +23 -0
- package/types/components/widgets/ContextMenu/ContextMenuItemsGroup/ContextMenuItemsGroup.styled.d.ts +1 -0
- package/types/components/widgets/ContextMenu/ContextMenuItemsGroup/index.d.ts +1 -0
- package/types/components/widgets/ContextMenu/index.d.ts +1 -0
- package/types/components/widgets/InfoCard/InfoCard.d.ts +33 -0
- package/types/components/widgets/InfoCard/InfoCard.styled.d.ts +28 -0
- package/types/components/widgets/InfoCard/index.d.ts +1 -0
- package/types/components/widgets/InstructionSeverityDisplay/InstructionSeverityDisplay.d.ts +46 -0
- package/types/components/widgets/InstructionSeverityDisplay/InstructionSeverityDisplay.styled.d.ts +30 -0
- package/types/components/widgets/InstructionSeverityDisplay/index.d.ts +1 -0
- package/types/components/widgets/Instructions/Instructions.d.ts +156 -0
- package/types/components/widgets/Instructions/Instructions.styled.d.ts +14 -0
- package/types/components/widgets/Instructions/index.d.ts +1 -0
- package/types/components/widgets/ProgressBar/ProgressBar.d.ts +30 -0
- package/types/components/widgets/ProgressBar/ProgressBar.styled.d.ts +41 -0
- package/types/components/widgets/ProgressBar/index.d.ts +1 -0
- package/types/components/widgets/SummaryCard/SummaryCard.d.ts +83 -0
- package/types/components/widgets/SummaryCard/SummaryCard.styled.d.ts +29 -0
- package/types/components/widgets/SummaryCard/index.d.ts +1 -0
- package/types/components/widgets/index.d.ts +11 -0
- package/types/hooks/useElementSize.d.ts +14 -0
- package/types/hooks/useEventListner.d.ts +14 -0
- package/types/hooks/useFloatingPopover.d.ts +161 -0
- package/types/hooks/useIsomorphicLayoutEffect.d.ts +3 -0
- package/types/hooks/useOnClickOutside.d.ts +13 -0
- package/types/hooks/useTooltipAutoShow.d.ts +31 -0
- package/types/icons/index.d.ts +41 -0
- package/types/ssr/index.d.ts +1 -0
- package/types/styles/utils/colors-export.d.ts +54 -0
- package/types/utils/dateTime.d.ts +8 -0
- package/types/utils/defaultTheme.d.ts +95 -0
- package/types/utils/getElementRef.d.ts +2 -0
- package/types/utils/parseTrigger.d.ts +22 -0
- package/build/_virtual/_rollupPluginBabelHelpers.js +0 -12
- package/build/_virtual/_rollupPluginBabelHelpers.js.map +0 -1
- package/build/widgets/AssetGallery/asset.propType.js +0 -56
- package/build/widgets/AssetGallery/asset.propType.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tab.js","sources":["../../../src/components/data/Tab/Tab.
|
|
1
|
+
{"version":3,"file":"Tab.js","sources":["../../../src/components/data/Tab/Tab.tsx"],"sourcesContent":["import React from 'react';\nimport * as S from './Tab.styled';\n\ntype TabOwnProps = {\n children?: any;\n hidden?: boolean;\n /**\n * The tab's clickable header, conventionally a `Badge`. Not read by Tab itself; Tabs extracts it.\n */\n trigger?: React.ReactElement<any>;\n};\n\n// Omit before & — a bare intersection narrows colliding props instead of overriding them.\ntype Props = Omit<React.ComponentPropsWithoutRef<typeof S.Tab>, keyof TabOwnProps> & TabOwnProps;\n\n/**\n * This is a component to help you get started with development.\n */\nconst Tab = React.forwardRef<any, Props>(function Tab(\n { children, hidden = false, ...props },\n forwardedRef\n) {\n if (hidden) return null;\n\n return (\n <S.Tab ref={forwardedRef} {...props}>\n {children}\n </S.Tab>\n );\n});\n\nexport default Tab;\n"],"names":["Tab","React","forwardRef","children","hidden","props","forwardedRef","_jsx","S","ref"],"mappings":";;;;AAkBA,MAAMA,GAAG,GAAGC,cAAK,CAACC,UAAU,CAAa,SAASF,GAAGA,CACnD;EAAEG,QAAQ;AAAEC,EAAAA,MAAM,GAAG,KAAK;EAAE,GAAGC;AAAM,CAAC,EACtCC,YAAY,EACZ;EACA,IAAIF,MAAM,EAAE,OAAO,IAAI;AAEvB,EAAA,OACEG,GAAA,CAACC,KAAK,EAAA;AAACC,IAAAA,GAAG,EAAEH,YAAa;AAAA,IAAA,GAAKD,KAAK;AAAAF,IAAAA,QAAA,EAChCA;AAAQ,GACJ,CAAC;AAEZ,CAAC;;;;"}
|
|
@@ -6,13 +6,10 @@ const shouldForwardProp = prop => {
|
|
|
6
6
|
};
|
|
7
7
|
const Tab = styled.p.withConfig({
|
|
8
8
|
shouldForwardProp
|
|
9
|
-
}).attrs(applyDefaultTheme)
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
border-bottom: 1px solid;
|
|
14
|
-
min-height: 35px;
|
|
15
|
-
`;
|
|
9
|
+
}).attrs(applyDefaultTheme).withConfig({
|
|
10
|
+
displayName: "Tabstyled__Tab",
|
|
11
|
+
componentId: "sc-omy3gs-0"
|
|
12
|
+
})(["font-family:", ";font-size:1rem;font-weight:500;border-bottom:1px solid;min-height:35px;"], props => props.theme.primaryFontFamily);
|
|
16
13
|
|
|
17
14
|
export { Tab };
|
|
18
15
|
//# sourceMappingURL=Tab.styled.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tab.styled.js","sources":["../../../src/components/data/Tab/Tab.styled.
|
|
1
|
+
{"version":3,"file":"Tab.styled.js","sources":["../../../src/components/data/Tab/Tab.styled.ts"],"sourcesContent":["/*\n * No generic needed; Tab reads only theme. Tab and Tabs are coupled.\n */\nimport styled from 'styled-components';\nimport { applyDefaultTheme } from '../../../utils/defaultTheme';\n\n// `prop` needs annotation because withConfig takes it by reference; no contextual typing otherwise.\nconst shouldForwardProp = (prop: string): boolean => {\n return prop !== 'theme' && !prop.startsWith('$');\n};\n\nexport const Tab = styled.p\n .withConfig({\n shouldForwardProp\n })\n .attrs(applyDefaultTheme)`\n font-family: ${props => props.theme.primaryFontFamily};\n font-size: 1rem;\n font-weight: 500;\n border-bottom: 1px solid;\n min-height: 35px;\n`;\n"],"names":["shouldForwardProp","prop","startsWith","Tab","styled","p","withConfig","attrs","applyDefaultTheme","displayName","componentId","props","theme","primaryFontFamily"],"mappings":";;;AAOA,MAAMA,iBAAiB,GAAIC,IAAY,IAAc;EACnD,OAAOA,IAAI,KAAK,OAAO,IAAI,CAACA,IAAI,CAACC,UAAU,CAAC,GAAG,CAAC;AAClD,CAAC;AAEM,MAAMC,GAAG,GAAGC,MAAM,CAACC,CAAC,CACxBC,UAAU,CAAC;AACVN,EAAAA;AACF,CAAC,CAAC,CACDO,KAAK,CAACC,iBAAiB,CAAC,CAAAF,UAAA,CAAA;EAAAG,WAAA,EAAA,gBAAA;EAAAC,WAAA,EAAA;AAAA,CAAA,CAAA,CAAA,CAAA,cAAA,EAAA,0EAAA,CAAA,EACVC,KAAK,IAAIA,KAAK,CAACC,KAAK,CAACC,iBAAiB;;;;"}
|
package/build/data/Tabs/Tabs.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
|
2
1
|
import { isEmpty, isNil } from 'lodash';
|
|
3
|
-
import PropTypes from 'prop-types';
|
|
4
2
|
import React__default, { useState, useRef, useMemo, Children, Fragment } from 'react';
|
|
5
3
|
import Tab from '../Tab/Tab.js';
|
|
6
4
|
import { Tabs as Tabs$1, TabHeaders, TabHeader, TabHeaderBorder, TabContent } from './Tabs.styled.js';
|
|
5
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
7
6
|
|
|
8
7
|
const Tabs = React__default.forwardRef(function Tabs({
|
|
9
8
|
children,
|
|
10
9
|
defaultMinHeight = '',
|
|
11
10
|
customPadding = 0,
|
|
11
|
+
backgroundColor,
|
|
12
12
|
onTabClick = () => {},
|
|
13
13
|
...props
|
|
14
14
|
}, forwardedRef) {
|
|
@@ -55,37 +55,35 @@ const Tabs = React__default.forwardRef(function Tabs({
|
|
|
55
55
|
});
|
|
56
56
|
}
|
|
57
57
|
};
|
|
58
|
-
return
|
|
59
|
-
ref: forwardedRef
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
58
|
+
return jsxs(Tabs$1, {
|
|
59
|
+
ref: forwardedRef,
|
|
60
|
+
$backgroundColor: backgroundColor,
|
|
61
|
+
...props,
|
|
62
|
+
role: "tablist",
|
|
63
|
+
children: [jsx(TabHeaders, {
|
|
64
|
+
custompadding: customPadding,
|
|
65
|
+
children: tabs.map(tab => jsx(TabHeader, {
|
|
66
|
+
hidden: tab.hidden,
|
|
67
|
+
$active: tab.key === activeTab,
|
|
68
|
+
onClick: () => handleTabClick(tab),
|
|
69
|
+
role: "tab",
|
|
70
|
+
children: tab.trigger
|
|
71
|
+
}, tab.key))
|
|
72
|
+
}), jsx(TabHeaderBorder, {
|
|
73
|
+
custompadding: customPadding
|
|
74
|
+
}), jsx(TabContent, {
|
|
75
|
+
children: tabs.map(tab => jsx("div", {
|
|
76
|
+
ref: tab.key === activeTab?.key ? contentRef : null,
|
|
77
|
+
role: "tabpanel",
|
|
78
|
+
hidden: tab.key !== activeTab,
|
|
79
|
+
style: {
|
|
80
|
+
minHeight: !isEmpty(defaultMinHeight) ? defaultMinHeight : ''
|
|
81
|
+
},
|
|
82
|
+
children: tab.content
|
|
83
|
+
}, tab.key))
|
|
84
|
+
})]
|
|
85
|
+
});
|
|
81
86
|
});
|
|
82
|
-
Tabs.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
83
|
-
children: PropTypes.oneOfType([PropTypes.array, PropTypes.object]),
|
|
84
|
-
backgroundColor: PropTypes.string,
|
|
85
|
-
defaultMinHeight: PropTypes.string,
|
|
86
|
-
customPadding: PropTypes.string,
|
|
87
|
-
onTabClick: PropTypes.func
|
|
88
|
-
} : {};
|
|
89
87
|
|
|
90
88
|
export { Tabs as default };
|
|
91
89
|
//# sourceMappingURL=Tabs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tabs.js","sources":["../../../src/components/data/Tabs/Tabs.js"],"sourcesContent":["import { isEmpty, isNil } from 'lodash';\nimport PropTypes from 'prop-types';\nimport React, { Children, Fragment, useMemo, useRef, useState } from 'react';\nimport Tab from '../Tab';\nimport * as S from './Tabs.styled';\n\n/**\n * Tabs that let you group content\n *\n * ### Import\n *\n * ``` js\n * import { Tabs, Tab } from '@ntbjs/react-components/data'\n * // or\n * import Tabs from '@ntbjs/react-components/data/Tabs'\n * import Tab from '@ntbjs/react-components/data/Tab'\n * ```\n * ### Tab - Tabs - Badge\n * `Tab`, `Tabs` and `Badge` must be used in order to implement the component.\n * ```\n * <Tabs>\n * <Tab trigger={<Badge>Tab title</Badge>}>\n * Tab content\n * </Tab>\n * </Tabs>\n * ```\n * ## Wrapping\n * Content (data displayed inside the `Tab`) is wrapped by `Tab`:\n * ```\n * <Tab>\n * Tab content\n * </Tab>\n * ```\n * ### Badge\n * The tab title is wrapped by `Badge` (which is passed as the trigger prop inside `Tab`):\n *\n *Props that can be passed inside the `Badge` component are: `badgeContent`, `active`, `error`, `warning` (check out the `Badge` component documentation for props options).\n * ```\n * <Tab trigger={<Badge>Tab title</Badge>}>\n * Tab content\n * </Tab>\n * ```\n * All tabs are wrapped by `Tabs`:\n * ```\n * <Tabs>\n * <Tab trigger={<Badge>Tab title 1</Badge>}>Tab content 1</Tab>\n * <Tab trigger={<Badge>Tab title 2</Badge>}>Tab content 2</Tab>\n * <Tab trigger={<Badge>Tab title 3</Badge>}>Tab content 3</Tab>\n * <Tab trigger={<Badge>Tab title 4</Badge>}>Tab content 4</Tab>\n * <Tab trigger={<Badge>Tab title 5</Badge>}>Tab content 5</Tab>\n * </Tabs>\n * ```\n * ## Props\n * A `backgroundColor` prop can be passed as a string to set the `Tabs` component background color.\n * ```\n * <Tabs backgroundColor={'#bfe0d5'}>\n * <Tab trigger={<Badge>Tab title 1</Badge>}>Tab content 1</Tab>\n * <Tab trigger={<Badge>Tab title 2</Badge>}>Tab content 2</Tab>\n * </Tabs>\n * ```\n * ### hidden\n * A single Tab can be hidden by using the `hidden={true||false}` prop (this is useful when the tab has empty content):\n * ```\n * <Tabs>\n * <Tab hidden={true} trigger={<Badge>Tab title 1</Badge>}></Tab>\n * <Tab trigger={<Badge>Tab title 2</Badge>}>Tab content 2</Tab>\n * <Tab hidden={true} trigger={<Badge>Tab title 3</Badge>}></Tab>\n * <Tab trigger={<Badge>Tab title 4</Badge>}>Tab content 4</Tab>\n * <Tab hidden={true} trigger={<Badge>Tab title 5</Badge>}></Tab>\n * </Tabs>\n * ```\n * ### Default minHeight\n * A `defaultMinHeight` prop can be passed to the Tabs component to set a predefined min-height.\n *\n * Pass `defaultMinHeight={'value px'}` on the `Tabs` component to use this feature.\n * ```\n * <Tabs defaultMinHeight={'500px'}>\n * <Tab trigger={<Badge>Tab title 1</Badge>}>Tab content 1</Tab>\n * <Tab trigger={<Badge>Tab title 2</Badge>}>Tab content 2</Tab>\n * </Tabs>\n * ```\n *\n * ### Custom padding\n * A `customPadding` prop can be passed to the Tabs component to set a custom padding on the tabs. The custom padding is applied the the Tabs options,\n * not to the content within the Tabs.\n *\n * Pass `customPadding={'value px'}` on the `Tabs` component to use this feature.\n * ```\n * <Tabs customPadding={'40px'}>\n * <Tab trigger={<Badge>Tab title 1</Badge>}>Tab content 1</Tab>\n * <Tab trigger={<Badge>Tab title 2</Badge>}>Tab content 2</Tab>\n * </Tabs>\n * ```\n */\nconst Tabs = React.forwardRef(function Tabs(\n { children, defaultMinHeight = '', customPadding = 0, onTabClick = () => {}, ...props },\n forwardedRef\n) {\n const [activeTab, setActiveTab] = useState(0);\n const contentRef = useRef(null);\n\n const tabs = useMemo(() => {\n const tabs = [];\n function extractChildren(children) {\n Children.forEach(children, (child, index) => {\n if (isNil(child)) {\n return null;\n }\n\n if (child.type === Fragment) {\n extractChildren(child.props?.children);\n }\n\n if (child.props?.hidden) {\n return null;\n }\n\n if (child.type === Tab) {\n tabs.push({\n key: index,\n trigger: child.props?.trigger,\n content: child.props?.children\n });\n }\n });\n }\n\n extractChildren(children);\n\n if (!tabs.some(tab => tab?.key === activeTab)) {\n setActiveTab(tabs[0]?.key);\n }\n\n return tabs;\n }, [children]);\n\n const handleTabClick = tab => {\n setActiveTab(tab.key);\n let triggerText = '';\n\n if (tab.trigger && tab.trigger.props && tab.trigger.props.children) {\n triggerText = tab.trigger.props.children;\n }\n if (onTabClick) {\n onTabClick({\n ...tab,\n triggerText: triggerText\n });\n }\n };\n\n return (\n <S.Tabs ref={forwardedRef} {...props} role=\"tablist\">\n <S.TabHeaders custompadding={customPadding}>\n {tabs.map(tab => (\n <S.TabHeader\n key={tab.key}\n hidden={tab.hidden}\n $active={tab.key === activeTab}\n onClick={() => handleTabClick(tab)}\n role=\"tab\"\n >\n {tab.trigger}\n </S.TabHeader>\n ))}\n </S.TabHeaders>\n <S.TabHeaderBorder custompadding={customPadding}></S.TabHeaderBorder>\n <S.TabContent>\n {tabs.map(tab => (\n <div\n ref={tab.key === activeTab?.key ? contentRef : null}\n key={tab.key}\n role=\"tabpanel\"\n hidden={tab.key !== activeTab}\n style={{\n minHeight: !isEmpty(defaultMinHeight) ? defaultMinHeight : ''\n }}\n >\n {tab.content}\n </div>\n ))}\n </S.TabContent>\n </S.Tabs>\n );\n});\n\nTabs.propTypes = {\n children: PropTypes.oneOfType([PropTypes.array, PropTypes.object]),\n /**\n * Whether `Tabs` component has a background color\n */\n backgroundColor: PropTypes.string,\n /**\n * Whether `tabs` will have a predefined min-height.\n */\n defaultMinHeight: PropTypes.string,\n /**\n * Custom padding.\n */\n customPadding: PropTypes.string,\n /**\n * Callback for clicked tab\n */\n onTabClick: PropTypes.func\n};\n\nexport default Tabs;\n"],"names":["Tabs","React","forwardRef","children","defaultMinHeight","customPadding","onTabClick","props","forwardedRef","activeTab","setActiveTab","useState","contentRef","useRef","tabs","useMemo","extractChildren","Children","forEach","child","index","isNil","type","Fragment","hidden","Tab","push","key","trigger","content","some","tab","handleTabClick","triggerText","createElement","S","_extends","ref","role","custompadding","map","$active","onClick","style","minHeight","isEmpty","propTypes","process","env","NOD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MAAM;EAIjCnD,gBAAgB,EAAE8C,SAAS,CAACK,MAAM;EAIlClD,aAAa,EAAE6C,SAAS,CAACK,MAAM;EAI/BjD,UAAU,EAAE4C,SAAS,CAACM,IAAAA;AACxB,CAAC,GAAA,EAAA;;;;"}
|
|
1
|
+
{"version":3,"file":"Tabs.js","sources":["../../../src/components/data/Tabs/Tabs.tsx"],"sourcesContent":["import { isEmpty, isNil } from 'lodash';\nimport React, { Children, Fragment, useMemo, useRef, useState } from 'react';\nimport Tab from '../Tab';\nimport * as S from './Tabs.styled';\n\ntype TabsOwnProps = {\n children?: any[] | any;\n /**\n * Whether `Tabs` component has a background color\n */\n backgroundColor?: string;\n /**\n * Whether `tabs` will have a predefined min-height.\n */\n defaultMinHeight?: string;\n /**\n * Custom padding.\n */\n customPadding?: string;\n /**\n * Callback for clicked tab\n */\n onTabClick?: (...args: any[]) => any;\n};\n\n// Omit before & — a bare intersection narrows colliding props instead of overriding them.\ntype Props = Omit<React.ComponentPropsWithoutRef<typeof S.Tabs>, keyof TabsOwnProps> & TabsOwnProps;\n\n/**\n * Tabs that let you group content\n *\n * ### Import\n *\n * ``` js\n * import { Tabs, Tab } from '@ntbjs/react-components/data'\n * // or\n * import Tabs from '@ntbjs/react-components/data/Tabs'\n * import Tab from '@ntbjs/react-components/data/Tab'\n * ```\n * ### Tab - Tabs - Badge\n * `Tab`, `Tabs` and `Badge` must be used in order to implement the component.\n * ```\n * <Tabs>\n * <Tab trigger={<Badge>Tab title</Badge>}>\n * Tab content\n * </Tab>\n * </Tabs>\n * ```\n * ## Wrapping\n * Content (data displayed inside the `Tab`) is wrapped by `Tab`:\n * ```\n * <Tab>\n * Tab content\n * </Tab>\n * ```\n * ### Badge\n * The tab title is wrapped by `Badge` (which is passed as the trigger prop inside `Tab`):\n *\n *Props that can be passed inside the `Badge` component are: `badgeContent`, `active`, `error`, `warning` (check out the `Badge` component documentation for props options).\n * ```\n * <Tab trigger={<Badge>Tab title</Badge>}>\n * Tab content\n * </Tab>\n * ```\n * All tabs are wrapped by `Tabs`:\n * ```\n * <Tabs>\n * <Tab trigger={<Badge>Tab title 1</Badge>}>Tab content 1</Tab>\n * <Tab trigger={<Badge>Tab title 2</Badge>}>Tab content 2</Tab>\n * <Tab trigger={<Badge>Tab title 3</Badge>}>Tab content 3</Tab>\n * <Tab trigger={<Badge>Tab title 4</Badge>}>Tab content 4</Tab>\n * <Tab trigger={<Badge>Tab title 5</Badge>}>Tab content 5</Tab>\n * </Tabs>\n * ```\n * ## Props\n * A `backgroundColor` prop can be passed as a string to set the `Tabs` component background color.\n * ```\n * <Tabs backgroundColor={'#bfe0d5'}>\n * <Tab trigger={<Badge>Tab title 1</Badge>}>Tab content 1</Tab>\n * <Tab trigger={<Badge>Tab title 2</Badge>}>Tab content 2</Tab>\n * </Tabs>\n * ```\n * ### hidden\n * A single Tab can be hidden by using the `hidden={true||false}` prop (this is useful when the tab has empty content):\n * ```\n * <Tabs>\n * <Tab hidden={true} trigger={<Badge>Tab title 1</Badge>}></Tab>\n * <Tab trigger={<Badge>Tab title 2</Badge>}>Tab content 2</Tab>\n * <Tab hidden={true} trigger={<Badge>Tab title 3</Badge>}></Tab>\n * <Tab trigger={<Badge>Tab title 4</Badge>}>Tab content 4</Tab>\n * <Tab hidden={true} trigger={<Badge>Tab title 5</Badge>}></Tab>\n * </Tabs>\n * ```\n * ### Default minHeight\n * A `defaultMinHeight` prop can be passed to the Tabs component to set a predefined min-height.\n *\n * Pass `defaultMinHeight={'value px'}` on the `Tabs` component to use this feature.\n * ```\n * <Tabs defaultMinHeight={'500px'}>\n * <Tab trigger={<Badge>Tab title 1</Badge>}>Tab content 1</Tab>\n * <Tab trigger={<Badge>Tab title 2</Badge>}>Tab content 2</Tab>\n * </Tabs>\n * ```\n *\n * ### Custom padding\n * A `customPadding` prop can be passed to the Tabs component to set a custom padding on the tabs. The custom padding is applied the the Tabs options,\n * not to the content within the Tabs.\n *\n * Pass `customPadding={'value px'}` on the `Tabs` component to use this feature.\n * ```\n * <Tabs customPadding={'40px'}>\n * <Tab trigger={<Badge>Tab title 1</Badge>}>Tab content 1</Tab>\n * <Tab trigger={<Badge>Tab title 2</Badge>}>Tab content 2</Tab>\n * </Tabs>\n * ```\n */\nconst Tabs = React.forwardRef<any, Props>(function Tabs(\n {\n children,\n defaultMinHeight = '',\n customPadding = 0,\n backgroundColor,\n onTabClick = () => {},\n ...props\n },\n forwardedRef\n) {\n const [activeTab, setActiveTab] = useState(0);\n const contentRef = useRef(null);\n\n const tabs = useMemo(() => {\n const tabs = [];\n function extractChildren(children) {\n Children.forEach(children, (child, index) => {\n if (isNil(child)) {\n return null;\n }\n\n if (child.type === Fragment) {\n extractChildren(child.props?.children);\n }\n\n if (child.props?.hidden) {\n return null;\n }\n\n if (child.type === Tab) {\n tabs.push({\n key: index,\n trigger: child.props?.trigger,\n content: child.props?.children\n });\n }\n });\n }\n\n extractChildren(children);\n\n if (!tabs.some(tab => tab?.key === activeTab)) {\n setActiveTab(tabs[0]?.key);\n }\n\n return tabs;\n }, [children]);\n\n const handleTabClick = tab => {\n setActiveTab(tab.key);\n let triggerText = '';\n\n if (tab.trigger && tab.trigger.props && tab.trigger.props.children) {\n triggerText = tab.trigger.props.children;\n }\n if (onTabClick) {\n onTabClick({\n ...tab,\n triggerText: triggerText\n });\n }\n };\n\n return (\n <S.Tabs ref={forwardedRef} $backgroundColor={backgroundColor} {...props} role=\"tablist\">\n <S.TabHeaders custompadding={customPadding}>\n {tabs.map(tab => (\n <S.TabHeader\n key={tab.key}\n hidden={tab.hidden}\n $active={tab.key === activeTab}\n onClick={() => handleTabClick(tab)}\n role=\"tab\"\n >\n {tab.trigger}\n </S.TabHeader>\n ))}\n </S.TabHeaders>\n <S.TabHeaderBorder custompadding={customPadding}></S.TabHeaderBorder>\n <S.TabContent>\n {tabs.map(tab => (\n <div\n ref={tab.key === activeTab?.key ? contentRef : null}\n key={tab.key}\n role=\"tabpanel\"\n hidden={tab.key !== activeTab}\n style={{\n minHeight: !isEmpty(defaultMinHeight) ? defaultMinHeight : ''\n }}\n >\n {tab.content}\n </div>\n ))}\n </S.TabContent>\n </S.Tabs>\n );\n});\n\nexport default Tabs;\n"],"names":["Tabs","React","forwardRef","children","defaultMinHeight","customPadding","backgroundColor","onTabClick","props","forwardedRef","activeTab","setActiveTab","useState","contentRef","useRef","tabs","useMemo","extractChildren","Children","forEach","child","index","isNil","type","Fragment","hidden","Tab","push","key","trigger","content","some","tab","handleTabClick","triggerText","_jsxs","S","ref","$backgroundColor","role","_jsx","custompadding","map","$active","onClick","style","minHeight","isEmpty"],"mappings":";;;;;;AAoHA,MAAMA,IAAI,GAAGC,cAAK,CAACC,UAAU,CAAa,SAASF,IAAIA,CACrD;EACEG,QAAQ;AACRC,EAAAA,gBAAgB,GAAG,EAAE;AACrBC,EAAAA,aAAa,GAAG,CAAC;EACjBC,eAAe;AACfC,EAAAA,UAAU,GAAGA,MAAM,CAAC,CAAC;EACrB,GAAGC;AACL,CAAC,EACDC,YAAY,EACZ;EACA,MAAM,CAACC,SAAS,EAAEC,YAAY,CAAC,GAAGC,QAAQ,CAAC,CAAC,CAAC;AAC7C,EAAA,MAAMC,UAAU,GAAGC,MAAM,CAAC,IAAI,CAAC;AAE/B,EAAA,MAAMC,IAAI,GAAGC,OAAO,CAAC,MAAM;IACzB,MAAMD,IAAI,GAAG,EAAE;IACf,SAASE,eAAeA,CAACd,QAAQ,EAAE;MACjCe,QAAQ,CAACC,OAAO,CAAChB,QAAQ,EAAE,CAACiB,KAAK,EAAEC,KAAK,KAAK;AAC3C,QAAA,IAAIC,KAAK,CAACF,KAAK,CAAC,EAAE;AAChB,UAAA,OAAO,IAAI;AACb,QAAA;AAEA,QAAA,IAAIA,KAAK,CAACG,IAAI,KAAKC,QAAQ,EAAE;AAC3BP,UAAAA,eAAe,CAACG,KAAK,CAACZ,KAAK,EAAEL,QAAQ,CAAC;AACxC,QAAA;AAEA,QAAA,IAAIiB,KAAK,CAACZ,KAAK,EAAEiB,MAAM,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
|
const Tabs = styled.div.withConfig({
|
|
8
8
|
shouldForwardProp
|
|
9
|
-
}).attrs(applyDefaultTheme)
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
background-color: ${props.backgroundColor};
|
|
14
|
-
`};
|
|
15
|
-
`;
|
|
9
|
+
}).attrs(applyDefaultTheme).withConfig({
|
|
10
|
+
displayName: "Tabsstyled__Tabs",
|
|
11
|
+
componentId: "sc-1mbopdp-0"
|
|
12
|
+
})(["display:block;position:relative;", ";"], props => props.$backgroundColor && css(["background-color:", ";"], props.$backgroundColor));
|
|
16
13
|
const TabHeaders = styled.ul.withConfig({
|
|
17
14
|
shouldForwardProp
|
|
18
|
-
}).attrs(applyDefaultTheme)
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
white-space: nowrap;
|
|
23
|
-
gap: 24px;
|
|
24
|
-
|
|
25
|
-
margin: 0;
|
|
26
|
-
${props => !props.custompadding && css`
|
|
27
|
-
padding: 0;
|
|
28
|
-
`};
|
|
29
|
-
${props => props.custompadding && css`
|
|
30
|
-
padding: 0 ${props.custompadding};
|
|
31
|
-
`};
|
|
32
|
-
`;
|
|
15
|
+
}).attrs(applyDefaultTheme).withConfig({
|
|
16
|
+
displayName: "Tabsstyled__TabHeaders",
|
|
17
|
+
componentId: "sc-1mbopdp-1"
|
|
18
|
+
})(["display:flex;overflow-x:auto;overflow-y:hidden;white-space:nowrap;gap:24px;margin:0;", ";", ";"], props => !props.custompadding && css(["padding:0;"]), props => props.custompadding && css(["padding:0 ", ";"], props.custompadding));
|
|
33
19
|
const TabHeader = styled.li.withConfig({
|
|
34
20
|
shouldForwardProp
|
|
35
|
-
}).attrs(applyDefaultTheme)
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
font-size: 0.875rem;
|
|
40
|
-
display: flex;
|
|
41
|
-
padding-bottom: 8px;
|
|
42
|
-
letter-spacing: 0.6px;
|
|
43
|
-
cursor: pointer;
|
|
44
|
-
border-bottom: 1px solid;
|
|
45
|
-
border-color: transparent;
|
|
46
|
-
margin-bottom: 1px;
|
|
47
|
-
|
|
48
|
-
${props => props.$active && css`
|
|
49
|
-
${props => props.theme.themeProp('border-color', props.theme.getColor('gray-400'), props.theme.getColor('gray-700'))}
|
|
50
|
-
`};
|
|
51
|
-
&&:hover:not(:focus) {
|
|
52
|
-
${props => props.theme.themeProp('border-color', () => {
|
|
21
|
+
}).attrs(applyDefaultTheme).withConfig({
|
|
22
|
+
displayName: "Tabsstyled__TabHeader",
|
|
23
|
+
componentId: "sc-1mbopdp-2"
|
|
24
|
+
})(["font-family:", ";text-transform:uppercase;font-weight:600;font-size:0.875rem;display:flex;padding-bottom:8px;letter-spacing:0.6px;cursor:pointer;border-bottom:1px solid;border-color:transparent;margin-bottom:1px;", ";&&:hover:not(:focus){", ";}"], props => props.theme.secondaryFontFamily, props => props.$active && css(["", ""], props => props.theme.themeProp('border-color', props.theme.getColor('gray-400'), props.theme.getColor('gray-700'))), props => props.theme.themeProp('border-color', () => {
|
|
53
25
|
if (props.$active) {
|
|
54
26
|
return props.theme.getColor('gray-400');
|
|
55
27
|
} else {
|
|
@@ -61,27 +33,19 @@ const TabHeader = styled.li.withConfig({
|
|
|
61
33
|
} else {
|
|
62
34
|
return props.theme.getColor('gray-700');
|
|
63
35
|
}
|
|
64
|
-
})
|
|
65
|
-
}
|
|
66
|
-
`;
|
|
36
|
+
}));
|
|
67
37
|
const TabContent = styled.div.withConfig({
|
|
68
38
|
shouldForwardProp
|
|
69
|
-
}).attrs(applyDefaultTheme)
|
|
70
|
-
|
|
71
|
-
|
|
39
|
+
}).attrs(applyDefaultTheme).withConfig({
|
|
40
|
+
displayName: "Tabsstyled__TabContent",
|
|
41
|
+
componentId: "sc-1mbopdp-3"
|
|
42
|
+
})(["display:block;"]);
|
|
72
43
|
const TabHeaderBorder = styled.div.withConfig({
|
|
73
44
|
shouldForwardProp
|
|
74
|
-
}).attrs(applyDefaultTheme)
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
${props => !props.custompadding && css`
|
|
79
|
-
margin: -2px 0;
|
|
80
|
-
`};
|
|
81
|
-
${props => props.custompadding && css`
|
|
82
|
-
margin: -2px ${props.custompadding};
|
|
83
|
-
`};
|
|
84
|
-
`;
|
|
45
|
+
}).attrs(applyDefaultTheme).withConfig({
|
|
46
|
+
displayName: "Tabsstyled__TabHeaderBorder",
|
|
47
|
+
componentId: "sc-1mbopdp-4"
|
|
48
|
+
})(["border-top:1px solid;", ";", ";", ";"], props => props.theme.themeProp('border-color', props.theme.getColor('gray-600'), '#F0F2F5'), props => !props.custompadding && css(["margin:-2px 0;"]), props => props.custompadding && css(["margin:-2px ", ";"], props.custompadding));
|
|
85
49
|
|
|
86
50
|
export { TabContent, TabHeader, TabHeaderBorder, TabHeaders, Tabs };
|
|
87
51
|
//# sourceMappingURL=Tabs.styled.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tabs.styled.js","sources":["../../../src/components/data/Tabs/Tabs.styled.
|
|
1
|
+
{"version":3,"file":"Tabs.styled.js","sources":["../../../src/components/data/Tabs/Tabs.styled.ts"],"sourcesContent":["/*\n * One deferred defect: `custompadding` has no `$`, so it leaks to rendered HTML. Tabs and Tab are coupled.\n */\nimport styled, { css } from 'styled-components';\nimport { applyDefaultTheme } from '../../../utils/defaultTheme';\n\n/** Props of the `Tabs` root, i.e. what `Tabs.tsx` passes to `S.Tabs`. */\nexport interface TabsStyleProps {\n /** `backgroundColor` — `PropTypes.string`, a CSS colour, interpolated raw. */\n $backgroundColor?: string;\n}\n\n/**\n * Shared by `TabHeaders` and `TabHeaderBorder`. Defect: `custompadding` has no `$`, leaks to DOM. Typed as `number | string` to match component default of 0.\n */\ninterface TabPaddingStyleProps {\n /** `customPadding` — see the interface JSDoc; both the leak and the union are there. */\n custompadding?: number | string;\n}\n\n/** Props of `TabHeader`, one `<li>` per tab. */\ninterface TabHeaderStyleProps {\n /**\n * `tab.key === activeTab`, derived in the component, so genuinely `boolean`. Read both\n * in the `$active &&` block and inside the two `themeProp()` callbacks below.\n */\n $active?: boolean;\n}\n\n/*\n * Single-argument, and it stays that way — peer floor `styled-components: >=5.1.0`, and\n * the two majors disagree on the second parameter. `prop` needs the annotation because\n * `withConfig` takes this by reference, so it gets no contextual typing.\n */\nconst shouldForwardProp = (prop: string): boolean => {\n return prop !== 'theme' && !prop.startsWith('$');\n};\n\nexport const Tabs = styled.div\n .withConfig({\n shouldForwardProp\n })\n .attrs<TabsStyleProps>(applyDefaultTheme)`\n display: block;\n position: relative;\n ${props =>\n props.$backgroundColor &&\n css`\n background-color: ${props.$backgroundColor};\n `};\n`;\n\nexport const TabHeaders = styled.ul\n .withConfig({\n shouldForwardProp\n })\n .attrs<TabPaddingStyleProps>(applyDefaultTheme)`\n display: flex;\n overflow-x: auto;\n overflow-y: hidden;\n white-space: nowrap;\n gap: 24px;\n\n margin: 0;\n ${props =>\n !props.custompadding &&\n css`\n padding: 0;\n `};\n ${props =>\n props.custompadding &&\n css`\n padding: 0 ${props.custompadding};\n `};\n`;\n\nexport const TabHeader = styled.li\n .withConfig({\n shouldForwardProp\n })\n .attrs<TabHeaderStyleProps>(applyDefaultTheme)`\n font-family: ${props => props.theme.secondaryFontFamily};\n text-transform: uppercase;\n font-weight: 600;\n font-size: 0.875rem;\n display: flex;\n padding-bottom: 8px;\n letter-spacing: 0.6px;\n cursor: pointer;\n border-bottom: 1px solid;\n border-color: transparent;\n margin-bottom: 1px;\n\n ${props =>\n props.$active &&\n css`\n ${props =>\n props.theme.themeProp(\n 'border-color',\n props.theme.getColor('gray-400'),\n props.theme.getColor('gray-700')\n )}\n `};\n &&:hover:not(:focus) {\n ${props =>\n props.theme.themeProp(\n 'border-color',\n () => {\n if (props.$active) {\n return props.theme.getColor('gray-400');\n } else {\n return props.theme.getColor('gray-400');\n }\n },\n () => {\n if (props.$active) {\n return props.theme.getColor('gray-700');\n } else {\n return props.theme.getColor('gray-700');\n }\n }\n )};\n }\n`;\n\nexport const TabContent = styled.div\n .withConfig({\n shouldForwardProp\n })\n .attrs(applyDefaultTheme)`\n display: block;\n`;\n\nexport const TabHeaderBorder = styled.div\n .withConfig({\n shouldForwardProp\n })\n .attrs<TabPaddingStyleProps>(applyDefaultTheme)`\n border-top: 1px solid;\n\n ${props => props.theme.themeProp('border-color', props.theme.getColor('gray-600'), '#F0F2F5')};\n ${props =>\n !props.custompadding &&\n css`\n margin: -2px 0;\n `};\n ${props =>\n props.custompadding &&\n css`\n margin: -2px ${props.custompadding};\n `};\n`;\n"],"names":["shouldForwardProp","prop","startsWith","Tabs","styled","div","withConfig","attrs","applyDefaultTheme","displayName","componentId","props","$backgroundColor","css","TabHeaders","ul","custompadding","TabHeader","li","theme","secondaryFontFamily","$active","themeProp","getColor","TabContent","TabHeaderBorder"],"mappings":";;;AAkCA,MAAMA,iBAAiB,GAAIC,IAAY,IAAc;EACnD,OAAOA,IAAI,KAAK,OAAO,IAAI,CAACA,IAAI,CAACC,UAAU,CAAC,GAAG,CAAC;AAClD,CAAC;AAEM,MAAMC,IAAI,GAAGC,MAAM,CAACC,GAAG,CAC3BC,UAAU,CAAC;AACVN,EAAAA;AACF,CAAC,CAAC,CACDO,KAAK,CAAiBC,iBAAiB,CAAC,CAAAF,UAAA,CAAA;EAAAG,WAAA,EAAA,kBAAA;EAAAC,WAAA,EAAA;AAAA,CAAA,CAAA,CAAA,CAAA,kCAAA,EAAA,GAAA,CAAA,EAGvCC,KAAK,IACLA,KAAK,CAACC,gBAAgB,IACtBC,GAAG,CAAA,CAAA,mBAAA,EAAA,GAAA,CAAA,EACmBF,KAAK,CAACC,gBAAgB,CAC3C;AAGE,MAAME,UAAU,GAAGV,MAAM,CAACW,EAAE,CAChCT,UAAU,CAAC;AACVN,EAAAA;AACF,CAAC,CAAC,CACDO,KAAK,CAAuBC,iBAAiB,CAAC,CAAAF,UAAA,CAAA;EAAAG,WAAA,EAAA,wBAAA;EAAAC,WAAA,EAAA;A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,QAAQ,CAAC,UAAU,CAAC;AACzC,EAAA,CAAC,MAAM;AACL,IAAA,OAAOZ,KAAK,CAACQ,KAAK,CAACI,QAAQ,CAAC,UAAU,CAAC;AACzC,EAAA;AACF,CACF,CAAC;AAIA,MAAMC,UAAU,GAAGpB,MAAM,CAACC,GAAG,CACjCC,UAAU,CAAC;AACVN,EAAAA;AACF,CAAC,CAAC,CACDO,KAAK,CAACC,iBAAiB,CAAC,CAAAF,UAAA,CAAA;EAAAG,WAAA,EAAA,wBAAA;EAAAC,WAAA,EAAA;AAAA,CAAA,CAAA,CAAA,CAAA,gBAAA,CAAA;AAIpB,MAAMe,eAAe,GAAGrB,MAAM,CAACC,GAAG,CACtCC,UAAU,CAAC;AACVN,EAAAA;AACF,CAAC,CAAC,CACDO,KAAK,CAAuBC,iBAAiB,CAAC,CAAAF,UAAA,CAAA;EAAAG,WAAA,EAAA,6BAAA;EAAAC,WAAA,EAAA;AAAA,CAAA,CAAA,CAAA,CAAA,uBAAA,EAAA,GAAA,EAAA,GAAA,EAAA,GAAA,CAAA,EAG7CC,KAAK,IAAIA,KAAK,CAACQ,KAAK,CAACG,SAAS,CAAC,cAAc,EAAEX,KAAK,CAACQ,KAAK,CAACI,QAAQ,CAAC,UAAU,CAAC,EAAE,SAAS,CAAC,EAC3FZ,KAAK,IACL,CAACA,KAAK,CAACK,aAAa,IACpBH,GAAG,CAAA,CAAA,gBAAA,CAAA,CAEF,EACDF,KAAK,IACLA,KAAK,CAACK,aAAa,IACnBH,GAAG,CAAA,CAAA,cAAA,EAAA,GAAA,CAAA,EACcF,KAAK,CAACK,aAAa,CACnC;;;;"}
|
|
@@ -1,46 +1,115 @@
|
|
|
1
|
-
import { extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
1
|
import React__default from 'react';
|
|
2
|
+
import { useMergeRefs, FloatingPortal } from '@floating-ui/react';
|
|
3
|
+
import useFloatingPopover from '../../hooks/useFloatingPopover.js';
|
|
4
|
+
import { getElementRef } from '../../utils/getElementRef.js';
|
|
5
|
+
import { SharedFloatingArrow, TOOLTIP_ARROW } from '../_shared/FloatingArrow.styled.js';
|
|
4
6
|
import { Tooltip as Tooltip$1 } from './Tooltip.styled.js';
|
|
7
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
5
8
|
|
|
9
|
+
const TIPPY_DEFAULT_ARROW = true;
|
|
10
|
+
const TIPPY_DEFAULT_MAX_WIDTH = 350;
|
|
11
|
+
const TIPPY_DEFAULT_Z_INDEX = 9999;
|
|
12
|
+
const TOOLTIP_OFFSET = [0, 10];
|
|
13
|
+
const TOOLTIP_ARROW_HEIGHT_IS_IN_THE_OFFSET_ALREADY = 0;
|
|
14
|
+
const POSITIONER_MAX_WIDTH = 'calc(100vw - 10px)';
|
|
15
|
+
const PROPS_NEVER_FORWARDED = ['onClick', 'onChange', 'onSubmit', 'modifiers', 'popperOptions'];
|
|
6
16
|
const Tooltip = React__default.forwardRef(function Tooltip({
|
|
7
|
-
content,
|
|
8
|
-
interactive,
|
|
9
|
-
placement,
|
|
10
|
-
duration,
|
|
17
|
+
content = 'Tooltip',
|
|
18
|
+
interactive = false,
|
|
19
|
+
placement = 'top',
|
|
20
|
+
duration = 350,
|
|
11
21
|
trigger,
|
|
12
22
|
visible,
|
|
13
23
|
children,
|
|
24
|
+
arrow: hasArrow = TIPPY_DEFAULT_ARROW,
|
|
25
|
+
zIndex = TIPPY_DEFAULT_Z_INDEX,
|
|
26
|
+
disabled = false,
|
|
27
|
+
offset = TOOLTIP_OFFSET,
|
|
28
|
+
maxWidth = TIPPY_DEFAULT_MAX_WIDTH,
|
|
29
|
+
appendTo,
|
|
30
|
+
onClickOutside,
|
|
14
31
|
...props
|
|
15
32
|
}, ref) {
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
33
|
+
const onOpenChange = React__default.useCallback((open, event, reason) => {
|
|
34
|
+
if (!open && reason === 'outside-press') {
|
|
35
|
+
onClickOutside?.(event);
|
|
36
|
+
}
|
|
37
|
+
}, [onClickOutside]);
|
|
38
|
+
const {
|
|
39
|
+
refs,
|
|
40
|
+
floatingStyles,
|
|
41
|
+
context,
|
|
42
|
+
getReferenceProps,
|
|
43
|
+
getFloatingProps,
|
|
44
|
+
isMounted,
|
|
45
|
+
transitionStyles,
|
|
46
|
+
arrowRef,
|
|
47
|
+
placement: resolvedPlacement,
|
|
48
|
+
pointerEvents
|
|
49
|
+
} = useFloatingPopover({
|
|
50
|
+
placement,
|
|
51
|
+
open: visible,
|
|
52
|
+
onOpenChange,
|
|
53
|
+
trigger,
|
|
54
|
+
offset,
|
|
55
|
+
arrow: hasArrow,
|
|
56
|
+
arrowHeight: TOOLTIP_ARROW_HEIGHT_IS_IN_THE_OFFSET_ALREADY,
|
|
57
|
+
interactive,
|
|
58
|
+
disabled,
|
|
59
|
+
duration
|
|
60
|
+
});
|
|
61
|
+
const childRef = React__default.isValidElement(children) ? getElementRef(children) : null;
|
|
62
|
+
const referenceRef = useMergeRefs([ref, childRef, refs.setReference]);
|
|
63
|
+
const filteredProps = Object.fromEntries(Object.entries(props).filter(([key]) => !PROPS_NEVER_FORWARDED.includes(key)));
|
|
64
|
+
const reference = React__default.isValidElement(children) ? React__default.cloneElement(children, {
|
|
65
|
+
...getReferenceProps(children.props),
|
|
66
|
+
ref: referenceRef
|
|
67
|
+
}) : children;
|
|
68
|
+
const renderInline = appendTo === 'parent' || interactive && appendTo === undefined;
|
|
69
|
+
const resolvePortalRoot = () => {
|
|
70
|
+
if (renderInline || appendTo === undefined) return undefined;
|
|
71
|
+
if (typeof appendTo === 'function') {
|
|
72
|
+
const node = refs.reference.current;
|
|
73
|
+
return node instanceof Element ? appendTo(node) : null;
|
|
74
|
+
}
|
|
75
|
+
return appendTo;
|
|
76
|
+
};
|
|
77
|
+
const floating = isMounted ? jsx("div", {
|
|
78
|
+
ref: refs.setFloating,
|
|
79
|
+
style: {
|
|
80
|
+
...floatingStyles,
|
|
81
|
+
zIndex,
|
|
82
|
+
pointerEvents,
|
|
83
|
+
maxWidth: POSITIONER_MAX_WIDTH
|
|
84
|
+
},
|
|
85
|
+
...getFloatingProps(),
|
|
86
|
+
children: jsxs(Tooltip$1, {
|
|
87
|
+
...filteredProps,
|
|
88
|
+
"data-placement": resolvedPlacement,
|
|
89
|
+
role: "tooltip",
|
|
90
|
+
tabIndex: -1,
|
|
91
|
+
style: {
|
|
92
|
+
...transitionStyles,
|
|
93
|
+
maxWidth
|
|
94
|
+
},
|
|
95
|
+
children: [jsx("div", {
|
|
96
|
+
className: "tippy-content",
|
|
97
|
+
children: content
|
|
98
|
+
}), hasArrow && jsx(SharedFloatingArrow, {
|
|
99
|
+
ref: arrowRef,
|
|
100
|
+
context: context,
|
|
101
|
+
"data-arrow-surface": "tooltip",
|
|
102
|
+
...TOOLTIP_ARROW
|
|
103
|
+
})]
|
|
104
|
+
})
|
|
105
|
+
}) : null;
|
|
106
|
+
return jsxs("div", {
|
|
107
|
+
children: [reference, renderInline ? floating : jsx(FloatingPortal, {
|
|
108
|
+
root: resolvePortalRoot(),
|
|
109
|
+
children: floating
|
|
110
|
+
})]
|
|
111
|
+
});
|
|
28
112
|
});
|
|
29
|
-
Tooltip.defaultProps = {
|
|
30
|
-
content: 'Tooltip',
|
|
31
|
-
interactive: false,
|
|
32
|
-
placement: 'top',
|
|
33
|
-
duration: 350
|
|
34
|
-
};
|
|
35
|
-
Tooltip.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
36
|
-
content: PropTypes.oneOfType([PropTypes.string, PropTypes.element]).isRequired,
|
|
37
|
-
interactive: PropTypes.bool,
|
|
38
|
-
placement: PropTypes.oneOf(['top', 'top-start', 'top-end', 'right', 'right-start', 'right-end', 'bottom', 'bottom-start', 'bottom-end', 'left', 'left-start', 'left-end', 'auto', 'auto-start', 'auto-end']),
|
|
39
|
-
duration: PropTypes.number,
|
|
40
|
-
trigger: PropTypes.oneOf(['mouseenter', 'mouseenter focus', 'click', 'focusin', 'mouseenter click', '']),
|
|
41
|
-
visible: PropTypes.bool,
|
|
42
|
-
children: PropTypes.node
|
|
43
|
-
} : {};
|
|
44
113
|
|
|
45
114
|
export { Tooltip as default };
|
|
46
115
|
//# sourceMappingURL=Tooltip.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tooltip.js","sources":["../../../src/components/data/Tooltip/Tooltip.js"],"sourcesContent":["import PropTypes from 'prop-types';\nimport React from 'react';\nimport * as S from './Tooltip.styled';\n\n/**\n * Tooltips display informative text when users hover over, focus on, or tap an element.\n *\n * ### Import\n *\n * ``` js\n * import { Tooltip } from '@ntbjs/react-components/data'\n * // or\n * import Tooltip from '@ntbjs/react-components/data/Tooltip'\n * ```\n */\n\nconst Tooltip = React.forwardRef(function Tooltip(\n { content, interactive, placement, duration, trigger, visible, children, ...props },\n ref\n) {\n const eventHandlerProps = ['onClick', 'onChange', 'onSubmit'];\n\n const filteredProps = Object.fromEntries(\n Object.entries(props).filter(([key]) => !eventHandlerProps.includes(key))\n );\n\n return (\n <div>\n <S.Tooltip\n ref={ref}\n content={content}\n interactive={interactive}\n placement={placement}\n duration={duration}\n trigger={trigger}\n visible={visible}\n animation={'shift-away-subtle'}\n {...filteredProps}\n >\n {children}\n </S.Tooltip>\n </div>\n );\n});\n\nTooltip.defaultProps = {\n content: 'Tooltip',\n interactive: false,\n placement: 'top',\n duration: 350\n};\n\n/**\n * https://atomiks.github.io/tippyjs/v6/all-props/\n * @type {{content: Validator<NonNullable<string>>}}\n */\nTooltip.propTypes = {\n /**\n * The content of the `Tooltip`.\n *\n * **NB!** If the content is a `string`, it should be [wrapped in a tag](https://github.com/atomiks/tippyjs-react/issues/283#issuecomment-1268986001), e.g.:\n *\n * `<span>{content}</span>`.\n */\n content: PropTypes.oneOfType([PropTypes.string, PropTypes.element]).isRequired,\n\n /**\n * Determines if the tippy has interactive content inside of it, so that it can be\n * hovered over and clicked inside without hiding.\n */\n interactive: PropTypes.bool,\n\n /**\n * The preferred placement of the tippy. Note that Popper's flip modifier can change\n * this to the opposite placement if it has more space.\n */\n placement: PropTypes.oneOf([\n 'top',\n 'top-start',\n 'top-end',\n 'right',\n 'right-start',\n 'right-end',\n 'bottom',\n 'bottom-start',\n 'bottom-end',\n 'left',\n 'left-start',\n 'left-end',\n 'auto',\n 'auto-start',\n 'auto-end'\n ]),\n /**\n * Duration in ms of the transition animation.\n */\n duration: PropTypes.number,\n\n /**\n * Determines the events that cause the tippy to show. Multiple event names are separated by\n * spaces.\n *\n * *Example events:*\n *\n * `trigger: 'click'`\n *\n * `trigger: 'focusin'`\n *\n * `trigger: 'mouseenter click'`\n *\n * `trigger: 'mouseenter'`\n *\n * --\n */\n trigger: PropTypes.oneOf([\n 'mouseenter',\n 'mouseenter focus',\n 'click',\n 'focusin',\n 'mouseenter click',\n ''\n ]),\n /**\n * Determines if the tippy is visible without trigger\n */\n visible: PropTypes.bool,\n\n children: PropTypes.node\n};\n\nexport default Tooltip;\n"],"names":["Tooltip","React","forwardRef","content","interactive","placement","duration","trigger","visible","children","props","ref","eventHandlerProps","filteredProps","Object","fromEntries","entries","filter","key","includes","createElement","S","_extends","animation","defaultProps","propTypes","process","env","NODE_ENV","PropTypes","oneOfType","string","element","isRequired","bool","oneOf","number","node"],"mappings":";;;;;AAgBMA,MAAAA,OAAO,GAAGC,cAAK,CAACC,UAAU,CAAC,SAASF,OAAOA,CAC/C;EAAEG,OAAO;EAAEC,WAAW;EAAEC,SAAS;EAAEC,QAAQ;EAAEC,OAAO;EAAEC,OAAO;EAAEC,QAAQ;EAAE,GAAGC,KAAAA;AAAM,CAAC,EACnFC,GAAG,EACH;EACA,MAAMC,iBAAiB,GAAG,CAAC,SAAS,EAAE,UAAU,EAAE,UAAU,CAAC,CAAA;AAE7D,EAAA,MAAMC,aAAa,G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R,cAAc,EACd,YAAY,EACZ,MAAM,EACN,YAAY,EACZ,UAAU,EACV,MAAM,EACN,YAAY,EACZ,UAAU,CACX,CAAC;EAIF7B,QAAQ,EAAEuB,SAAS,CAACO,MAAM;AAkB1B7B,EAAAA,OAAO,EAAEsB,SAAS,CAACM,KAAK,CAAC,CACvB,YAAY,EACZ,kBAAkB,EAClB,OAAO,EACP,SAAS,EACT,kBAAkB,EAClB,EAAE,CACH,CAAC;EAIF3B,OAAO,EAAEqB,SAAS,CAACK,IAAI;EAEvBzB,QAAQ,EAAEoB,SAAS,CAACQ,IAAAA;AACtB,CAAC,GAAA,EAAA;;;;"}
|
|
1
|
+
{"version":3,"file":"Tooltip.js","sources":["../../../src/components/data/Tooltip/Tooltip.tsx"],"sourcesContent":["import React from 'react';\n\nimport { FloatingPortal, useMergeRefs } from '@floating-ui/react';\n\nimport useFloatingPopover from '../../../hooks/useFloatingPopover';\nimport { getElementRef } from '../../../utils/getElementRef';\nimport { SharedFloatingArrow, TOOLTIP_ARROW } from '../_shared/FloatingArrow.styled';\nimport * as S from './Tooltip.styled';\n\nimport type { OpenChangeReason } from '@floating-ui/react';\nimport type { PopoverPlacement, PopperOffset } from '../../../hooks/useFloatingPopover';\n\n// tippy's observable defaults: arrow=true, maxWidth=350 (decides wrap), zIndex=9999. All reproduced, not dropped.\nconst TIPPY_DEFAULT_ARROW = true;\nconst TIPPY_DEFAULT_MAX_WIDTH = 350;\nconst TIPPY_DEFAULT_Z_INDEX = 9999;\n\n// Tooltip offset is box distance (not tip gap like Popover); arrowHeight: 0 keeps hook's axis equal to offset[1] exactly.\nconst TOOLTIP_OFFSET: PopperOffset = [0, 10];\nconst TOOLTIP_ARROW_HEIGHT_IS_IN_THE_OFFSET_ALREADY = 0;\n\n// tippy.css applied this viewport cap through [data-tippy-root] (the positioner), carried over.\nconst POSITIONER_MAX_WIDTH = 'calc(100vw - 10px)';\n\n// tippy's three-way appendTo: given value portals, absent+interactive=true renders INLINE, absent+interactive=false portals to body. Safe for Tooltip (interactive defaults false).\nexport type TooltipAppendTo = 'parent' | Element | ((reference: Element) => Element);\n\ntype TooltipOwnProps = {\n /**\n * The content of the `Tooltip`.\n *\n * **NB!** If the content is a `string`, it should be wrapped in a tag, e.g.\n * `<span>{content}</span>`. The requirement outlived its original cause — it was a\n * `@tippyjs/react` quirk — but it is kept because consumers have written to it.\n */\n content: string | React.ReactElement<any>;\n /**\n * Determines if the tooltip has interactive content inside of it, so that it can be\n * hovered over and clicked inside without hiding.\n */\n interactive?: boolean;\n /**\n * The preferred placement of the tooltip. Note that the flip middleware can change this\n * to the opposite placement if it has more space.\n */\n placement?: PopoverPlacement;\n /**\n * Duration in ms of the transition animation.\n */\n duration?: number;\n /**\n * Events that cause the tooltip to show (space-separated). Defaults to `'mouseenter focus'`, `''` means no triggers.\n */\n trigger?: 'mouseenter' | 'mouseenter focus' | 'click' | 'focusin' | 'mouseenter click' | '';\n /**\n * Pass a boolean to control visibility; both `true` and `false` disable native triggers. `undefined` leaves uncontrolled.\n */\n visible?: boolean;\n /**\n * Whether the arrow is rendered. Defaults to `true`, which is tippy's default and was\n * therefore already the behaviour; 6 consumer call sites pass `false`.\n */\n arrow?: boolean;\n /**\n * `z-index` of the positioned element (default: 9999, tippy's default).\n */\n zIndex?: number;\n /**\n * Disabled tooltip can never open, even under controlled `visible={true}` (tippy semantics).\n */\n disabled?: boolean;\n /**\n * `[skidding, distance]`, Popper's convention, where `distance` is the gap between the\n * reference and the tooltip BOX. Defaults to tippy's `[0, 10]`.\n */\n offset?: PopperOffset;\n /**\n * Cap on the box's width, in px. Defaults to 350 — tippy's default, and applied to every\n * tooltip today, so it decides where text wraps.\n */\n maxWidth?: number;\n /**\n * Where the tooltip is rendered. Defaults to `document.body`. See `TooltipAppendTo`.\n */\n appendTo?: TooltipAppendTo;\n /** Fired when a press lands outside both the reference and the tooltip. */\n onClickOutside?: (event?: Event) => void;\n /**\n * @deprecated Accepted and IGNORED. This was a Popper `modifiers` array; Floating UI has\n * middleware instead and the two are not translatable prop-for-prop. Kept so that no\n * existing call site throws — plan C6.\n */\n modifiers?: unknown;\n /**\n * @deprecated Accepted and IGNORED, for the same reason as `modifiers`.\n */\n popperOptions?: unknown;\n children?: React.ReactNode;\n};\n\n// Props spreads onto S.Tooltip, so published type must admit its props. Base moved from styled(Tippy) to styled.div, requiring explicit declaration of zIndex, arrow, disabled, maxWidth.\ntype Props = Omit<React.ComponentPropsWithoutRef<typeof S.Tooltip>, keyof TooltipOwnProps> &\n TooltipOwnProps;\n\n// Props accepted-but-ignored: onClick/onChange/onSubmit filter is load-bearing (would activate dead handlers); modifiers/popperOptions are plan C6 deprecations.\nconst PROPS_NEVER_FORWARDED = ['onClick', 'onChange', 'onSubmit', 'modifiers', 'popperOptions'];\n\n/**\n * Tooltips display informative text when users hover over, focus on, or tap an element.\n *\n * ### Import\n *\n * ``` js\n * import { Tooltip } from '@ntbjs/react-components/data'\n * // or\n * import Tooltip from '@ntbjs/react-components/data/Tooltip'\n * ```\n */\nconst Tooltip = React.forwardRef<any, Props>(function Tooltip(\n {\n content = 'Tooltip',\n interactive = false,\n placement = 'top',\n duration = 350,\n trigger,\n visible,\n children,\n arrow: hasArrow = TIPPY_DEFAULT_ARROW,\n zIndex = TIPPY_DEFAULT_Z_INDEX,\n disabled = false,\n offset = TOOLTIP_OFFSET,\n maxWidth = TIPPY_DEFAULT_MAX_WIDTH,\n appendTo,\n onClickOutside,\n ...props\n },\n ref\n) {\n const onOpenChange = React.useCallback(\n (open: boolean, event?: Event, reason?: OpenChangeReason) => {\n if (!open && reason === 'outside-press') {\n onClickOutside?.(event);\n }\n },\n [onClickOutside]\n );\n\n const {\n refs,\n floatingStyles,\n context,\n getReferenceProps,\n getFloatingProps,\n isMounted,\n transitionStyles,\n arrowRef,\n placement: resolvedPlacement,\n pointerEvents\n } = useFloatingPopover({\n placement,\n open: visible,\n onOpenChange,\n trigger,\n offset,\n arrow: hasArrow,\n arrowHeight: TOOLTIP_ARROW_HEIGHT_IS_IN_THE_OFFSET_ALREADY,\n interactive,\n disabled,\n duration\n });\n\n // Reference is the CHILD (not wrapper) for positioning compat; ref merges forwarded ref, child's ref, and setReference.\n const childRef = React.isValidElement(children) ? getElementRef(children) : null;\n const referenceRef = useMergeRefs([ref, childRef, refs.setReference]);\n\n const filteredProps = Object.fromEntries(\n Object.entries(props).filter(([key]) => !PROPS_NEVER_FORWARDED.includes(key))\n );\n\n // Floating UI composes handlers with existing ones, so child's own handlers still work.\n const reference = React.isValidElement(children)\n ? React.cloneElement(\n children as React.ReactElement<Record<string, unknown>>,\n {\n ...getReferenceProps((children as React.ReactElement<Record<string, unknown>>).props),\n ref: referenceRef\n } as never\n )\n : children;\n\n // Inline rendering: 'parent' or (interactive && no explicit appendTo).\n const renderInline = appendTo === 'parent' || (interactive && appendTo === undefined);\n\n // null/undefined NOT interchangeable: undefined→document.body default, null→defer until reference exists.\n const resolvePortalRoot = (): HTMLElement | null | undefined => {\n if (renderInline || appendTo === undefined) return undefined;\n if (typeof appendTo === 'function') {\n const node = refs.reference.current;\n return node instanceof Element ? (appendTo(node) as HTMLElement) : null;\n }\n return appendTo as HTMLElement;\n };\n\n const floating = isMounted ? (\n <div\n ref={refs.setFloating}\n style={{ ...floatingStyles, zIndex, pointerEvents, maxWidth: POSITIONER_MAX_WIDTH }}\n {...getFloatingProps()}\n >\n {/*\n * filteredProps first so explicit attrs can't override transition/placement styles.\n */}\n <S.Tooltip\n {...filteredProps}\n data-placement={resolvedPlacement}\n role=\"tooltip\"\n tabIndex={-1}\n style={{ ...transitionStyles, maxWidth }}\n >\n <div className=\"tippy-content\">{content}</div>\n {hasArrow && (\n <SharedFloatingArrow\n ref={arrowRef}\n context={context}\n data-arrow-surface=\"tooltip\"\n {...TOOLTIP_ARROW}\n />\n )}\n </S.Tooltip>\n </div>\n ) : null;\n\n // Bare wrapper preserved for compat; load-bearing for TextArea/CompactTextInput onMouseLeave.\n return (\n <div>\n {reference}\n {renderInline ? (\n floating\n ) : (\n <FloatingPortal root={resolvePortalRoot()}>{floating}</FloatingPortal>\n )}\n </div>\n );\n});\n\nexport default Tooltip;\n"],"names":["TIPPY_DEFAULT_ARROW","TIPPY_DEFAULT_MAX_WIDTH","TIPPY_DEFAULT_Z_INDEX","TOOLTIP_OFFSET","TOOLTIP_ARROW_HEIGHT_IS_IN_THE_OFFSET_ALREADY","POSITIONER_MAX_WIDTH","PROPS_NEVER_FORWARDED","Tooltip","React","forwardRef","content","interactive","placement","duration","trigger","visible","children","arrow","hasArrow","zIndex","disabled","offset","maxWidth","appendTo","onClickOutside","props","ref","onOpenChange","useCallback","open","event","reason","refs","floatingStyles","context","getReferenceProps","getFloatingProps","isMounted","transitionStyles","arrowRef","resolvedPlacement","pointerEvents","useFloatingPopover","arrowHeight","childRef","isValidElement","getElementRef","referenceRef","useMergeRefs","setReference","filteredProps","Object","fromEntries","entries","filter","key","includes","reference","cloneElement","renderInline","undefined","resolvePortalRoot","node","current","Element","floating","_jsx","setFloating","style","_jsxs","S","role","tabIndex","className","SharedFloatingArrow","TOOLTIP_ARROW","FloatingPortal","root"],"mappings":";;;;;;;;AAaA,MAAMA,mBAAmB,GAAG,IAAI;AAChC,MAAMC,uBAAuB,GAAG,GAAG;AACnC,MAAMC,qBAAqB,GAAG,IAAI;AAGlC,MAAMC,cAA4B,GAAG,CAAC,CAAC,EAAE,EAAE,CAAC;AAC5C,MAAMC,6CAA6C,GAAG,CAAC;AAGvD,MAAMC,oBAAoB,GAAG,oBAAoB;AAmFjD,MAAMC,qBAAqB,GAAG,CAAC,SAAS,EAAE,UAAU,EAAE,UAAU,EAAE,WAAW,EAAE,eAAe,CAAC;AAa/F,MAAMC,OAAO,GAAGC,cAAK,CAACC,UAAU,CAAa,SAASF,OAAOA,CAC3D;AACEG,EAAAA,OAAO,GAAG,SAAS;AACnBC,EAAAA,WAAW,GAAG,KAAK;AACnBC,EAAAA,SAAS,GAAG,KAAK;AACjBC,EAAAA,QAAQ,GAAG,GAAG;EACdC,OA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AgBV,iBAAkB;AAClC+B,MAAAA,IAAI,EAAC,SAAS;MACdC,QAAQ,EAAE,EAAG;AACbJ,MAAAA,KAAK,EAAE;AAAE,QAAA,GAAG9B,gBAAgB;AAAEhB,QAAAA;OAAW;AAAAN,MAAAA,QAAA,GAEzCkD,GAAA,CAAA,KAAA,EAAA;AAAKO,QAAAA,SAAS,EAAC,eAAe;AAAAzD,QAAAA,QAAA,EAAEN;AAAO,OAAM,CAAC,EAC7CQ,QAAQ,IACPgD,GAAA,CAACQ,mBAAmB,EAAA;AAClBhD,QAAAA,GAAG,EAAEa,QAAS;AACdL,QAAAA,OAAO,EAAEA,OAAQ;AACjB,QAAA,oBAAA,EAAmB,SAAS;QAAA,GACxByC;AAAa,OAClB,CACF;KACQ;GACR,CAAC,GACJ,IAAI;AAGR,EAAA,OACEN,IAAA,CAAA,KAAA,EAAA;IAAArD,QAAA,EAAA,CACGyC,SAAS,EACTE,YAAY,GACXM,QAAQ,GAERC,GAAA,CAACU,cAAc,EAAA;MAACC,IAAI,EAAEhB,iBAAiB,EAAG;AAAA7C,MAAAA,QAAA,EAAEiD;AAAQ,KAAiB,CACtE;AAAA,GACE,CAAC;AAEV,CAAC;;;;"}
|
|
@@ -1,28 +1,15 @@
|
|
|
1
1
|
import styled from 'styled-components';
|
|
2
2
|
import { applyDefaultTheme } from '../../utils/defaultTheme.js';
|
|
3
|
-
import TippyTooltip from '@tippyjs/react';
|
|
4
|
-
import 'tippy.js/animations/shift-away-subtle.css';
|
|
5
|
-
import 'tippy.js/dist/tippy.css';
|
|
6
3
|
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
.tippy-arrow {
|
|
19
|
-
color: ${props => props.theme.getColor('gray-700')};
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
a {
|
|
23
|
-
color: inherit;
|
|
24
|
-
}
|
|
25
|
-
`;
|
|
4
|
+
const shouldForwardProp = prop => {
|
|
5
|
+
return prop !== 'theme' && !prop.startsWith('$');
|
|
6
|
+
};
|
|
7
|
+
const Tooltip = styled.div.withConfig({
|
|
8
|
+
shouldForwardProp
|
|
9
|
+
}).attrs(applyDefaultTheme).withConfig({
|
|
10
|
+
displayName: "Tooltipstyled__Tooltip",
|
|
11
|
+
componentId: "sc-vg943j-0"
|
|
12
|
+
})(["position:relative;outline:0;white-space:normal;line-height:1.4;color:", ";font-family:", ";font-size:1rem;font-weight:400;background:", ";border-radius:3px;.tippy-content{position:relative;z-index:1;padding:9px 12px;}a{color:inherit;}"], props => props.theme.getColor('white'), props => props.theme.primaryFontFamily, props => props.theme.getColor('gray-700'));
|
|
26
13
|
|
|
27
14
|
export { Tooltip };
|
|
28
15
|
//# sourceMappingURL=Tooltip.styled.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tooltip.styled.js","sources":["../../../src/components/data/Tooltip/Tooltip.styled.
|
|
1
|
+
{"version":3,"file":"Tooltip.styled.js","sources":["../../../src/components/data/Tooltip/Tooltip.styled.ts"],"sourcesContent":["// Carries two load-bearing styles from tippy.css: color:white and position:relative (arrow container). Also line-height, white-space, outline. Arrow CSS replaced by SVG (FloatingArrow.styled.ts).\n\nimport styled from 'styled-components';\nimport { applyDefaultTheme } from '../../../utils/defaultTheme';\n\n// Mandatory (not optional) to filter theme object from DOM; fixes declared defect where theme was written as `data-theme=\"[object Object]\"`.\n\nconst shouldForwardProp = (prop: string): boolean => {\n return prop !== 'theme' && !prop.startsWith('$');\n};\n\n/**\n * The tooltip box — what `.tippy-box` was.\n *\n * `Tooltip.tsx` puts the transition styles and the `max-width` on this element inline and\n * the POSITION on its parent, matching the split tippy used (animated box inside a\n * Popper-positioned root) and the one the three existing Floating UI sites use.\n */\nexport const Tooltip = styled.div\n .withConfig({\n shouldForwardProp\n })\n .attrs(applyDefaultTheme)`\n position: relative;\n outline: 0;\n white-space: normal;\n line-height: 1.4;\n color: ${props => props.theme.getColor('white')};\n font-family: ${props => props.theme.primaryFontFamily};\n font-size: 1rem;\n font-weight: 400;\n background: ${props => props.theme.getColor('gray-700')};\n border-radius: 3px;\n\n .tippy-content {\n position: relative;\n z-index: 1;\n padding: 9px 12px;\n }\n\n a {\n color: inherit;\n }\n`;\n"],"names":["shouldForwardProp","prop","startsWith","Tooltip","styled","div","withConfig","attrs","applyDefaultTheme","displayName","componentId","props","theme","getColor","primaryFontFamily"],"mappings":";;;AAOA,MAAMA,iBAAiB,GAAIC,IAAY,IAAc;EACnD,OAAOA,IAAI,KAAK,OAAO,IAAI,CAACA,IAAI,CAACC,UAAU,CAAC,GAAG,CAAC;AAClD,CAAC;AASM,MAAMC,OAAO,GAAGC,MAAM,CAACC,GAAG,CAC9BC,UAAU,CAAC;AACVN,EAAAA;AACF,CAAC,CAAC,CACDO,KAAK,CAACC,iBAAiB,CAAC,CAAAF,UAAA,CAAA;EAAAG,WAAA,EAAA,wBAAA;EAAAC,WAAA,EAAA;AAAA,CAAA,CAAA,CAAA,CAAA,uEAAA,EAAA,eAAA,EAAA,6CAAA,EAAA,mGAAA,CAAA,EAKhBC,KAAK,IAAIA,KAAK,CAACC,KAAK,CAACC,QAAQ,CAAC,OAAO,CAAC,EAChCF,KAAK,IAAIA,KAAK,CAACC,KAAK,CAACE,iBAAiB,EAGvCH,KAAK,IAAIA,KAAK,CAACC,KAAK,CAACC,QAAQ,CAAC,UAAU,CAAC;;;;"}
|
|
@@ -1,36 +1,29 @@
|
|
|
1
|
-
import { extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
|
2
1
|
import React__default from 'react';
|
|
3
|
-
import PropTypes from 'prop-types';
|
|
4
2
|
import { VerificationIconWrapper, VerificationStatusIcon as VerificationStatusIcon$1, VerificationStatusColor } from './VerificationStatusIcon.styled.js';
|
|
5
3
|
import { ReactComponent as SvgVerification } from '../../icons/verification.svg.js';
|
|
4
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
6
5
|
|
|
7
6
|
const VerificationStatusIcon = React__default.forwardRef(function VerificationStatusIcon({
|
|
8
7
|
status,
|
|
9
|
-
iconHeight,
|
|
10
|
-
background,
|
|
8
|
+
iconHeight = 15,
|
|
9
|
+
background = false,
|
|
11
10
|
...props
|
|
12
11
|
}, forwardedRef) {
|
|
13
|
-
return
|
|
14
|
-
$background: background
|
|
15
|
-
}, React__default.createElement(VerificationStatusIcon$1, _extends({
|
|
16
|
-
$iconHeight: iconHeight,
|
|
12
|
+
return jsx(VerificationIconWrapper, {
|
|
17
13
|
$background: background,
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
14
|
+
children: jsxs(VerificationStatusIcon$1, {
|
|
15
|
+
$iconHeight: iconHeight,
|
|
16
|
+
$background: background,
|
|
17
|
+
ref: forwardedRef,
|
|
18
|
+
...props,
|
|
19
|
+
children: [jsx(SvgVerification, {}), jsx(VerificationStatusColor, {
|
|
20
|
+
$iconHeight: iconHeight,
|
|
21
|
+
$status: status,
|
|
22
|
+
$background: background
|
|
23
|
+
})]
|
|
24
|
+
})
|
|
25
|
+
});
|
|
24
26
|
});
|
|
25
|
-
VerificationStatusIcon.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
26
|
-
status: PropTypes.oneOf(['verified', 'pending', 'rejected', 'mixed']).isRequired,
|
|
27
|
-
iconHeight: PropTypes.number,
|
|
28
|
-
background: PropTypes.bool
|
|
29
|
-
} : {};
|
|
30
|
-
VerificationStatusIcon.defaultProps = {
|
|
31
|
-
iconHeight: 15,
|
|
32
|
-
background: false
|
|
33
|
-
};
|
|
34
27
|
|
|
35
28
|
export { VerificationStatusIcon as default };
|
|
36
29
|
//# sourceMappingURL=VerificationStatusIcon.js.map
|