@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,39 +1,40 @@
|
|
|
1
|
-
import { extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
|
2
1
|
import { isFunction } from 'lodash';
|
|
3
|
-
import PropTypes from 'prop-types';
|
|
4
2
|
import React__default, { useState, useEffect, useCallback } from 'react';
|
|
5
3
|
import { ReactComponent as SvgWarningCircle } from '../../icons/warning-circle.svg.js';
|
|
6
4
|
import CompactAutocompleteSelect from '../../inputs/CompactAutocompleteSelect/CompactAutocompleteSelect.js';
|
|
7
5
|
import TextArea from '../../inputs/TextArea/TextArea.js';
|
|
8
6
|
import { Instructions as Instructions$1, TopBarContainer, SelectContainer, InstructionsArea } from './Instructions.styled.js';
|
|
7
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
9
8
|
|
|
9
|
+
const NOOP = () => {};
|
|
10
10
|
const Instructions = React__default.forwardRef(function Instructions({
|
|
11
|
-
clickToAdd,
|
|
11
|
+
clickToAdd = false,
|
|
12
12
|
customAddMessage,
|
|
13
13
|
selectedOption,
|
|
14
14
|
loadOptions,
|
|
15
|
-
readOnly,
|
|
16
|
-
disabled,
|
|
17
|
-
hidden,
|
|
15
|
+
readOnly = false,
|
|
16
|
+
disabled = false,
|
|
17
|
+
hidden = false,
|
|
18
18
|
name,
|
|
19
|
-
lightBackground,
|
|
20
|
-
autoSelect,
|
|
19
|
+
lightBackground = false,
|
|
20
|
+
autoSelect = true,
|
|
21
21
|
subscribeCurrentValue: subscribeCurrentValueProp,
|
|
22
22
|
onChange: onChangeProp,
|
|
23
23
|
onFocus: onFocusProp,
|
|
24
24
|
onBlur: onBlurProp,
|
|
25
|
-
onUpdateCallback,
|
|
25
|
+
onUpdateCallback = NOOP,
|
|
26
26
|
availableOptions,
|
|
27
27
|
loadingMessageFunc,
|
|
28
28
|
placeholder,
|
|
29
|
-
type,
|
|
30
|
-
selectType,
|
|
31
|
-
edit,
|
|
29
|
+
type = '',
|
|
30
|
+
selectType = '',
|
|
31
|
+
edit = false,
|
|
32
32
|
rows,
|
|
33
33
|
isExpanded,
|
|
34
34
|
loadingIcon,
|
|
35
35
|
successIcon,
|
|
36
|
-
padding,
|
|
36
|
+
padding = 'medium',
|
|
37
|
+
options,
|
|
37
38
|
...props
|
|
38
39
|
}, forwardedRef) {
|
|
39
40
|
const [isHovered, setIsHovered] = useState(false);
|
|
@@ -61,7 +62,7 @@ const Instructions = React__default.forwardRef(function Instructions({
|
|
|
61
62
|
setCurrentValue(customMessage);
|
|
62
63
|
setInitialHover(true);
|
|
63
64
|
}
|
|
64
|
-
}, [addInstructions,
|
|
65
|
+
}, [addInstructions, customMessage]);
|
|
65
66
|
const onChange = useCallback(event => {
|
|
66
67
|
setCurrentValue(event.target.value);
|
|
67
68
|
if (isFunction(onChangeProp)) {
|
|
@@ -90,11 +91,6 @@ const Instructions = React__default.forwardRef(function Instructions({
|
|
|
90
91
|
const handleMouseLeave = () => {
|
|
91
92
|
setIsHovered(false);
|
|
92
93
|
};
|
|
93
|
-
const handleOnFocus = () => {
|
|
94
|
-
if (customMessage === currentValue) {
|
|
95
|
-
setCurrentValue('');
|
|
96
|
-
}
|
|
97
|
-
};
|
|
98
94
|
const handleChange = selected => {
|
|
99
95
|
if (selected === null) {
|
|
100
96
|
setSelected({});
|
|
@@ -112,90 +108,52 @@ const Instructions = React__default.forwardRef(function Instructions({
|
|
|
112
108
|
}
|
|
113
109
|
};
|
|
114
110
|
const sharedSelectProps = {
|
|
115
|
-
options: loadOptions ? undefined : availableOptions,
|
|
111
|
+
options: loadOptions ? undefined : options ?? availableOptions,
|
|
116
112
|
loadOptions: loadOptions,
|
|
117
113
|
loadingMessage: loadingMessageFunc,
|
|
118
114
|
placeholder: placeholder
|
|
119
115
|
};
|
|
120
116
|
if (hidden) return null;
|
|
121
|
-
return
|
|
117
|
+
return jsxs(Instructions$1, {
|
|
122
118
|
ref: forwardedRef,
|
|
123
|
-
initialHover: initialHover,
|
|
124
119
|
onMouseDown: handleMouseOver,
|
|
125
|
-
onMouseLeave: handleMouseLeave
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
120
|
+
onMouseLeave: handleMouseLeave,
|
|
121
|
+
...props,
|
|
122
|
+
children: [!readOnly && !disabled && jsx(TopBarContainer, {
|
|
123
|
+
$initialHover: initialHover,
|
|
124
|
+
className: isHovered && !readOnly && !disabled && 'slide-in',
|
|
125
|
+
children: jsx(SelectContainer, {
|
|
126
|
+
children: jsx(CompactAutocompleteSelect, {
|
|
127
|
+
type: selectType,
|
|
128
|
+
value: selectedOption,
|
|
129
|
+
creatable: false,
|
|
130
|
+
onChange: handleChange,
|
|
131
|
+
...sharedSelectProps
|
|
132
|
+
})
|
|
133
|
+
})
|
|
134
|
+
}), jsx(InstructionsArea, {
|
|
135
|
+
children: jsx(TextArea, {
|
|
136
|
+
noBorder: true,
|
|
137
|
+
type: type,
|
|
138
|
+
$lightBackground: background,
|
|
139
|
+
readOnly: readOnly,
|
|
140
|
+
disabled: disabled,
|
|
141
|
+
name: name,
|
|
142
|
+
isExpanded: isExpanded,
|
|
143
|
+
edit: edit,
|
|
144
|
+
value: currentValue === null ? '' : currentValue,
|
|
145
|
+
onFocus: onFocus,
|
|
146
|
+
onChange: onChange,
|
|
147
|
+
onBlur: onBlur,
|
|
148
|
+
rows: rows,
|
|
149
|
+
icon: jsx(SvgWarningCircle, {}),
|
|
150
|
+
loadingIcon: loadingIcon,
|
|
151
|
+
successIcon: successIcon,
|
|
152
|
+
padding: padding
|
|
153
|
+
})
|
|
154
|
+
})]
|
|
155
|
+
});
|
|
156
156
|
});
|
|
157
|
-
Instructions.defaultProps = {
|
|
158
|
-
clickToAdd: false,
|
|
159
|
-
lightBackground: false,
|
|
160
|
-
autoSelect: true,
|
|
161
|
-
hidden: false,
|
|
162
|
-
edit: false,
|
|
163
|
-
disabled: false,
|
|
164
|
-
readOnly: false,
|
|
165
|
-
type: '',
|
|
166
|
-
selectType: '',
|
|
167
|
-
padding: 'medium',
|
|
168
|
-
onUpdateCallback: () => {}
|
|
169
|
-
};
|
|
170
|
-
Instructions.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
171
|
-
name: PropTypes.string,
|
|
172
|
-
placeholder: PropTypes.string,
|
|
173
|
-
rows: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
174
|
-
selectedOption: PropTypes.any,
|
|
175
|
-
loadOptions: PropTypes.func,
|
|
176
|
-
loadingMessageFunc: PropTypes.func,
|
|
177
|
-
clickToAdd: PropTypes.bool,
|
|
178
|
-
customAddMessage: PropTypes.string,
|
|
179
|
-
autoSelect: PropTypes.bool,
|
|
180
|
-
readOnly: PropTypes.bool,
|
|
181
|
-
disabled: PropTypes.bool,
|
|
182
|
-
hidden: PropTypes.bool,
|
|
183
|
-
availableOptions: PropTypes.arrayOf(PropTypes.object),
|
|
184
|
-
lightBackground: PropTypes.bool,
|
|
185
|
-
edit: PropTypes.bool,
|
|
186
|
-
options: PropTypes.array,
|
|
187
|
-
subscribeCurrentValue: PropTypes.func,
|
|
188
|
-
onChange: PropTypes.func,
|
|
189
|
-
onFocus: PropTypes.func,
|
|
190
|
-
onBlur: PropTypes.func,
|
|
191
|
-
onUpdateCallback: PropTypes.func,
|
|
192
|
-
type: PropTypes.oneOf(['', 'error', 'error-border', 'warning', 'instructions-warning', 'loading', 'success']),
|
|
193
|
-
selectType: PropTypes.oneOf(['', 'error', 'warning', 'instructions-warning', 'loading', 'success']),
|
|
194
|
-
isExpanded: PropTypes.func,
|
|
195
|
-
loadingIcon: PropTypes.element,
|
|
196
|
-
successIcon: PropTypes.element,
|
|
197
|
-
padding: PropTypes.oneOf(['', 'small', 'medium', 'large'])
|
|
198
|
-
} : {};
|
|
199
157
|
|
|
200
158
|
export { Instructions as default };
|
|
201
159
|
//# sourceMappingURL=Instructions.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Instructions.js","sources":["../../../src/components/widgets/Instructions/Instructions.js"],"sourcesContent":["import { isFunction } from 'lodash';\nimport PropTypes from 'prop-types';\nimport React, { useCallback, useEffect, useState } from 'react';\nimport { ReactComponent as AlertIcon } from '../../../icons/warning-circle.svg';\nimport AutocompleteSelect from '../../inputs/CompactAutocompleteSelect/CompactAutocompleteSelect';\nimport TextArea from '../../inputs/TextArea/TextArea';\nimport * as S from './Instructions.styled';\n\n/**\n * Instructions that let you display Terms & Conditions\n *\n *\n * ### Import\n *\n * ``` js\n * import { Instructions } from '@ntbjs/react-components/widgets/Instructions'\n * // or\n * import Instructions from '@ntbjs/react-components/widgets/Instructions'\n * ```\n *\n * ### AutocompleteSelect\n * `AutocompleteSelect` is integrated within Instructions in order to implement the Drop-down Menu (check out the `Autocomplete` component documentation).\n *\n *\n * <br /> ## Options `object` format\n * Options are represented by an `Array` of `objects` with the following format:\n *\n * ``` js\n * {\n * value: \"Example\",\n * label: \"Example\"\n * }\n * ```\n *\n */\n\nconst Instructions = React.forwardRef(function Instructions(\n {\n clickToAdd,\n customAddMessage,\n selectedOption,\n loadOptions,\n readOnly,\n disabled,\n hidden,\n name,\n lightBackground,\n autoSelect,\n subscribeCurrentValue: subscribeCurrentValueProp,\n onChange: onChangeProp,\n onFocus: onFocusProp,\n onBlur: onBlurProp,\n onUpdateCallback,\n availableOptions,\n loadingMessageFunc,\n placeholder,\n type,\n selectType,\n edit,\n rows,\n isExpanded,\n loadingIcon,\n successIcon,\n padding,\n ...props\n },\n forwardedRef\n) {\n const [isHovered, setIsHovered] = useState(false);\n const [selected, setSelected] = useState({});\n const [addInstructions, setAddInstructions] = useState(clickToAdd);\n const [customMessage, setCustomMessage] = useState(customAddMessage);\n const [background, setBackground] = useState(lightBackground);\n const [initialHover, setInitialHover] = useState(true);\n const [currentValue, setCurrentValue] = useState();\n\n useEffect(() => {\n if (isFunction(subscribeCurrentValueProp)) {\n subscribeCurrentValueProp(currentValue);\n }\n }, [currentValue]);\n\n useEffect(() => {\n handleChange(selected);\n }, [selected]);\n //Selected option to be displayed on first render\n useEffect(() => {\n if (selectedOption) {\n setCurrentValue(selectedOption.value);\n }\n }, [selectedOption]);\n //Custom instructions added by consumer\n useEffect(() => {\n if (addInstructions) {\n setCurrentValue(customMessage);\n setInitialHover(true);\n }\n }, [addInstructions, handleOnFocus]);\n\n const onChange = useCallback(\n event => {\n setCurrentValue(event.target.value);\n if (isFunction(onChangeProp)) {\n onChangeProp(event);\n }\n },\n [onChangeProp]\n );\n const onFocus = useCallback(\n event => {\n if (autoSelect) {\n event.target.select();\n }\n if (isFunction(onFocusProp)) {\n onFocusProp(event);\n }\n if (event.target.value === customMessage) {\n setCurrentValue('');\n }\n },\n [autoSelect, readOnly, onFocusProp]\n );\n const onBlur = useCallback(\n event => {\n if (isFunction(onBlurProp)) {\n onBlurProp(event);\n }\n },\n [onBlurProp]\n );\n\n const handleMouseOver = () => {\n setIsHovered(true);\n };\n const handleMouseLeave = () => {\n setIsHovered(false);\n };\n\n const handleOnFocus = () => {\n if (customMessage === currentValue) {\n setCurrentValue('');\n }\n };\n\n const handleChange = selected => {\n if (selected === null) {\n setSelected({});\n setAddInstructions(true);\n setBackground(true);\n setInitialHover(true);\n setCustomMessage(customAddMessage);\n } else {\n setSelected(selected);\n setCurrentValue(selected.value);\n setAddInstructions(false);\n setBackground(false);\n setInitialHover(false);\n onUpdateCallback(selected);\n }\n };\n\n const sharedSelectProps = {\n options: loadOptions ? undefined : availableOptions,\n loadOptions: loadOptions,\n loadingMessage: loadingMessageFunc,\n placeholder: placeholder\n };\n\n if (hidden) return null;\n\n return (\n <S.Instructions\n ref={forwardedRef}\n initialHover={initialHover}\n onMouseDown={handleMouseOver}\n onMouseLeave={handleMouseLeave}\n {...props}\n >\n {!readOnly && !disabled && (\n <S.TopBarContainer\n initialHover={initialHover}\n className={isHovered && !readOnly && !disabled && 'slide-in'}\n >\n <S.SelectContainer>\n <AutocompleteSelect\n type={selectType}\n value={selectedOption}\n creatable={false}\n onChange={handleChange}\n {...sharedSelectProps}\n />\n </S.SelectContainer>\n </S.TopBarContainer>\n )}\n\n <S.InstructionsArea type={type}>\n <TextArea\n noBorder\n instructionsTextArea={true}\n type={type}\n lightBackground={background}\n readOnly={readOnly}\n disabled={disabled}\n name={name}\n isExpanded={isExpanded}\n edit={edit}\n value={currentValue === null ? '' : currentValue}\n onFocus={onFocus}\n onChange={onChange}\n onBlur={onBlur}\n rows={rows}\n icon={<AlertIcon />}\n loadingIcon={loadingIcon}\n successIcon={successIcon}\n padding={padding}\n />\n </S.InstructionsArea>\n </S.Instructions>\n );\n});\n\nInstructions.defaultProps = {\n clickToAdd: false,\n lightBackground: false,\n autoSelect: true,\n hidden: false,\n edit: false,\n disabled: false,\n readOnly: false,\n type: '',\n selectType: '',\n padding: 'medium',\n onUpdateCallback: () => {}\n};\n\nInstructions.propTypes = {\n /**\n * Name of the text area (used when sending form data)\n */\n name: PropTypes.string,\n /**\n * The placeholder of the input. Text to be displayed on the input element when the component is enabled and not focused – e.g. \"Search categories...\"\n */\n placeholder: PropTypes.string,\n /**\n * How many rows/lines of text to be displayed by default\n */\n rows: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),\n /**\n * Selected option\n */\n selectedOption: PropTypes.any,\n /**\n * Function with a `Promise` returning filtered options.\n *\n * See [Asynchronous fetching/filtering with pagination](#asynchronous-fetchingfiltering-with-pagination)\n * for details.\n *\n * **Note:**\n * <br />This will override the `availableOptions` prop if both props are set.\n */\n loadOptions: PropTypes.func,\n /**\n * Function for custom \"Loading...\" message while waiting for the first page\n * from `loadOptions` to resolve. Defaults to \"Loading...\" if no function is provided.\n */\n loadingMessageFunc: PropTypes.func,\n /**\n /**\n * Whether the components displays an initial custom message.\n */\n clickToAdd: PropTypes.bool,\n /**\n * Add initial custom message. i.e: `No instructions (click to add)`.\n */\n customAddMessage: PropTypes.string,\n /**\n * Whether to auto select the entire value when the input is focused – does also work when the field is in read-only mode\n */\n autoSelect: PropTypes.bool,\n /**\n * Whether the instruction is read only\n */\n readOnly: PropTypes.bool,\n /**\n * Whether the intruction is disabled\n */\n disabled: PropTypes.bool,\n /**\n * Whether the component is hidden or visible.\n */\n hidden: PropTypes.bool,\n /**\n * `Array` of `objects` that populate the select menu. This is only needed\n * when asynchronous option fetching with the `loadOptions` prop is not used.\n *\n * **Note:**\n * <br />This will be overridden by the `loadOptions` prop if both props are set.\n */\n availableOptions: PropTypes.arrayOf(PropTypes.object),\n /**\n * `LightBackground color\n */\n lightBackground: PropTypes.bool,\n /**\n * Displays a light-yellow background to show that instruction value is editable\n */\n edit: PropTypes.bool,\n /**\n * Function with a `Promise` returning filtered options.\n *\n * See [Asynchronous fetching/filtering with pagination](#asynchronous-fetchingfiltering-with-pagination)\n * for details.\n *\n * **Note:**\n * <br /> `options`should be passed as an `array`of `objects`\n * <br />This will override the `availableOptions` prop if both props are set.\n */\n options: PropTypes.array,\n /**\n * Callback for `onChange`\n */\n subscribeCurrentValue: PropTypes.func,\n /**\n * Callback for `onChange`\n */\n onChange: PropTypes.func,\n /**\n * Callback for `onFocus`\n */\n onFocus: PropTypes.func,\n /**\n * Callback for `onBlur`\n */\n onBlur: PropTypes.func,\n /**\n * Callback for `onUpdateCallback`: register to AutocompleteSelect label and value\n */\n onUpdateCallback: PropTypes.func,\n /**\n * Define the type based on error,error-border , warning, loading and success.\n */\n type: PropTypes.oneOf([\n '',\n 'error',\n 'error-border',\n 'warning',\n 'instructions-warning',\n 'loading',\n 'success'\n ]),\n /**\n * Define the type AutoCompleteSelect based on error,error-border , warning, loading and success.\n */\n selectType: PropTypes.oneOf([\n '',\n 'error',\n 'warning',\n 'instructions-warning',\n 'loading',\n 'success'\n ]),\n isExpanded: PropTypes.func,\n /**\n * Icon element – E.g: `icon={<Spinner />}`\n */\n loadingIcon: PropTypes.element,\n /**\n * Icon element – E.g: `icon={<Check />}`\n */\n successIcon: PropTypes.element,\n /**\n * Add padding (small-medium-large)\n */\n padding: PropTypes.oneOf(['', 'small', 'medium', 'large'])\n};\n\nexport default Instructions;\n"],"names":["Instructions","React","forwardRef","clickToAdd","customAddMessage","selectedOption","loadOptions","readOnly","disabled","hidden","name","lightBackground","autoSelect","subscribeCurrentValue","subscribeCurrentValueProp","onChange","onChangeProp","onFocus","onFocusProp","onBlur","onBlurProp","onUpdateCallback","availableOptions","loadingMessageFunc","placeholder","type","selectType","edit","rows","isExpanded","loadingIcon","successIcon","padding","props","forwardedRef","isHovered","setIsHovered","useState","selected","setSelected","addInstructions","setAddInstructions","customMessage","setCustomMessage","background","setBackground","initialHover","setInitialHover","currentValue","setCurrentValue","useEffect","isFunction","handleChange","value","handleOnFocus","useCallback","event","target","select","handleMouseOver","handleMouseLeave","sharedSelectProps","options","undefined","loadingMessage","createElement","S","_extends","ref","onMouseDown","onMouseLeave","className","AutocompleteSelect","creatable","TextArea","noBorder","instructionsTextArea","icon","AlertIcon","defaultProps","propTypes","process","env","NODE_ENV","PropTypes","string","oneOfType","number","any","func","bool","arrayOf","object","array","oneOf","element"],"mappings":";;;;;;;;;AAoCMA,MAAAA,YAAY,GAAGC,cAAK,CAACC,UAAU,CAAC,SAASF,YAAYA,CACzD;EACEG,UAAU;EACVC,gBAAgB;EAChBC,cAAc;EACdC,WAAW;EACXC,QAAQ;EACRC,QAAQ;EACRC,MAAM;EACNC,I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AC3D,CAAC,GAAA,EAAA;;;;"}
|
|
1
|
+
{"version":3,"file":"Instructions.js","sources":["../../../src/components/widgets/Instructions/Instructions.tsx"],"sourcesContent":["import { isFunction } from 'lodash';\nimport React, { useCallback, useEffect, useState } from 'react';\nimport { ReactComponent as AlertIcon } from '../../../icons/warning-circle.svg';\nimport AutocompleteSelect from '../../inputs/CompactAutocompleteSelect/CompactAutocompleteSelect';\nimport TextArea from '../../inputs/TextArea/TextArea';\nimport * as S from './Instructions.styled';\n\nconst NOOP = () => {};\n\ntype InstructionsOwnProps = {\n /**\n * Name of the text area (used when sending form data)\n */\n name?: string;\n /**\n * The placeholder of the input. Text to be displayed on the input element when the component is enabled and not focused – e.g. \"Search categories...\"\n */\n placeholder?: string;\n /**\n * How many rows/lines of text to be displayed by default\n */\n rows?: number | string;\n /**\n * Selected option\n */\n selectedOption?: any;\n /**\n * Function with a `Promise` returning filtered options.\n *\n * See [Asynchronous fetching/filtering with pagination](#asynchronous-fetchingfiltering-with-pagination)\n * for details.\n *\n * **Note:**\n * <br />This will override the `availableOptions` prop if both props are set.\n */\n loadOptions?: (...args: any[]) => any;\n /**\n * Function for custom \"Loading...\" message while waiting for the first page\n * from `loadOptions` to resolve. Defaults to \"Loading...\" if no function is provided.\n */\n loadingMessageFunc?: (...args: any[]) => any;\n /**\n /**\n * Whether the components displays an initial custom message.\n */\n clickToAdd?: boolean;\n /**\n * Add initial custom message. i.e: `No instructions (click to add)`.\n */\n customAddMessage?: string;\n /**\n * Whether to auto select the entire value when the input is focused – does also work when the field is in read-only mode\n */\n autoSelect?: boolean;\n /**\n * Whether the instruction is read only\n */\n readOnly?: boolean;\n /**\n * Whether the intruction is disabled\n */\n disabled?: boolean;\n /**\n * Whether the component is hidden or visible.\n */\n hidden?: boolean;\n /**\n * `Array` of `objects` that populate the select menu. This is only needed\n * when asynchronous option fetching with the `loadOptions` prop is not used.\n *\n * **Note:**\n * <br />This will be overridden by the `loadOptions` prop if both props are set.\n */\n availableOptions?: any[];\n /**\n * `LightBackground color\n */\n lightBackground?: boolean;\n /**\n * Displays a light-yellow background to show that instruction value is editable\n */\n edit?: boolean;\n /**\n * Function with a `Promise` returning filtered options.\n *\n * See [Asynchronous fetching/filtering with pagination](#asynchronous-fetchingfiltering-with-pagination)\n * for details.\n *\n * **Note:**\n * <br /> `options`should be passed as an `array`of `objects`\n * <br />This will override the `availableOptions` prop if both props are set.\n */\n options?: any[];\n /**\n * Callback for `onChange`\n */\n subscribeCurrentValue?: (...args: any[]) => any;\n /**\n * Callback for `onChange`\n */\n onChange?: (...args: any[]) => any;\n /**\n * Callback for `onFocus`\n */\n onFocus?: (...args: any[]) => any;\n /**\n * Callback for `onBlur`\n */\n onBlur?: (...args: any[]) => any;\n /**\n * Callback for `onUpdateCallback`: register to AutocompleteSelect label and value\n */\n onUpdateCallback?: (...args: any[]) => any;\n /**\n * Define the type based on error,error-border , warning, loading and success.\n */\n type?: '' | 'error' | 'error-border' | 'warning' | 'instructions-warning' | 'loading' | 'success';\n /**\n * Define the type AutoCompleteSelect based on error,error-border , warning, loading and success.\n */\n selectType?: '' | 'error' | 'warning' | 'instructions-warning' | 'loading' | 'success';\n isExpanded?: (...args: any[]) => any;\n /**\n * Icon element – E.g: `icon={<Spinner />}`\n */\n loadingIcon?: React.ReactElement<any>;\n /**\n * Icon element – E.g: `icon={<Check />}`\n */\n successIcon?: React.ReactElement<any>;\n /**\n * Add padding (small-medium-large)\n */\n padding?: '' | 'small' | 'medium' | 'large';\n};\n\n// Omit before & — a bare intersection narrows colliding props instead of overriding them.\ntype InstructionsProps = Omit<\n React.ComponentPropsWithoutRef<typeof S.Instructions>,\n keyof InstructionsOwnProps\n> &\n InstructionsOwnProps;\n\n/**\n * Instructions that let you display Terms & Conditions\n *\n *\n * ### Import\n *\n * ``` js\n * import { Instructions } from '@ntbjs/react-components/widgets/Instructions'\n * // or\n * import Instructions from '@ntbjs/react-components/widgets/Instructions'\n * ```\n *\n * ### AutocompleteSelect\n * `AutocompleteSelect` is integrated within Instructions in order to implement the Drop-down Menu (check out the `Autocomplete` component documentation).\n *\n *\n * <br /> ## Options `object` format\n * Options are represented by an `Array` of `objects` with the following format:\n *\n * ``` js\n * {\n * value: \"Example\",\n * label: \"Example\"\n * }\n * ```\n *\n */\n\nconst Instructions = React.forwardRef<any, InstructionsProps>(function Instructions(\n {\n clickToAdd = false,\n customAddMessage,\n selectedOption,\n loadOptions,\n readOnly = false,\n disabled = false,\n hidden = false,\n name,\n lightBackground = false,\n autoSelect = true,\n subscribeCurrentValue: subscribeCurrentValueProp,\n onChange: onChangeProp,\n onFocus: onFocusProp,\n onBlur: onBlurProp,\n onUpdateCallback = NOOP,\n availableOptions,\n loadingMessageFunc,\n placeholder,\n type = '',\n selectType = '',\n edit = false,\n rows,\n isExpanded,\n loadingIcon,\n successIcon,\n padding = 'medium',\n // DOM LEAK: options was never destructured, so it leaked to the DOM as a stringified array.\n options,\n ...props\n },\n forwardedRef\n) {\n const [isHovered, setIsHovered] = useState(false);\n const [selected, setSelected] = useState({});\n const [addInstructions, setAddInstructions] = useState(clickToAdd);\n const [customMessage, setCustomMessage] = useState(customAddMessage);\n const [background, setBackground] = useState(lightBackground);\n const [initialHover, setInitialHover] = useState(true);\n // Bare useState() infers undefined; explicit <string | undefined> allows all writes without argument.\n const [currentValue, setCurrentValue] = useState<string | undefined>();\n\n useEffect(() => {\n if (isFunction(subscribeCurrentValueProp)) {\n subscribeCurrentValueProp(currentValue);\n }\n }, [currentValue]);\n\n useEffect(() => {\n handleChange(selected);\n }, [selected]);\n //Selected option to be displayed on first render\n useEffect(() => {\n if (selectedOption) {\n setCurrentValue(selectedOption.value);\n }\n }, [selectedOption]);\n //Custom instructions added by consumer\n useEffect(() => {\n if (addInstructions) {\n setCurrentValue(customMessage);\n setInitialHover(true);\n }\n }, [addInstructions, customMessage]);\n\n const onChange = useCallback(\n event => {\n setCurrentValue(event.target.value);\n if (isFunction(onChangeProp)) {\n onChangeProp(event);\n }\n },\n [onChangeProp]\n );\n const onFocus = useCallback(\n event => {\n if (autoSelect) {\n event.target.select();\n }\n if (isFunction(onFocusProp)) {\n onFocusProp(event);\n }\n if (event.target.value === customMessage) {\n setCurrentValue('');\n }\n },\n [autoSelect, readOnly, onFocusProp]\n );\n const onBlur = useCallback(\n event => {\n if (isFunction(onBlurProp)) {\n onBlurProp(event);\n }\n },\n [onBlurProp]\n );\n\n const handleMouseOver = () => {\n setIsHovered(true);\n };\n const handleMouseLeave = () => {\n setIsHovered(false);\n };\n\n const handleChange = selected => {\n if (selected === null) {\n setSelected({});\n setAddInstructions(true);\n setBackground(true);\n setInitialHover(true);\n setCustomMessage(customAddMessage);\n } else {\n setSelected(selected);\n setCurrentValue(selected.value);\n setAddInstructions(false);\n setBackground(false);\n setInitialHover(false);\n onUpdateCallback(selected);\n }\n };\n\n const sharedSelectProps = {\n // `options` wins over `availableOptions` when both are set — its documented contract.\n options: loadOptions ? undefined : (options ?? availableOptions),\n loadOptions: loadOptions,\n loadingMessage: loadingMessageFunc,\n placeholder: placeholder\n };\n\n if (hidden) return null;\n\n return (\n <S.Instructions\n ref={forwardedRef}\n onMouseDown={handleMouseOver}\n onMouseLeave={handleMouseLeave}\n {...props}\n >\n {!readOnly && !disabled && (\n <S.TopBarContainer\n $initialHover={initialHover}\n className={isHovered && !readOnly && !disabled && 'slide-in'}\n >\n <S.SelectContainer>\n <AutocompleteSelect\n type={selectType}\n value={selectedOption}\n creatable={false}\n onChange={handleChange}\n {...sharedSelectProps}\n />\n </S.SelectContainer>\n </S.TopBarContainer>\n )}\n\n {/* DOM LEAK fixed: type is passed only to TextArea, not to InstructionsArea. */}\n <S.InstructionsArea>\n <TextArea\n noBorder\n type={type}\n // lightBackground prop is inert (TextArea no longer consumes it); kept transient to prevent other regressions.\n $lightBackground={background}\n readOnly={readOnly}\n disabled={disabled}\n name={name}\n isExpanded={isExpanded}\n edit={edit}\n value={currentValue === null ? '' : currentValue}\n onFocus={onFocus}\n onChange={onChange}\n onBlur={onBlur}\n rows={rows}\n icon={<AlertIcon />}\n loadingIcon={loadingIcon}\n successIcon={successIcon}\n padding={padding}\n />\n </S.InstructionsArea>\n </S.Instructions>\n );\n});\n\nexport default Instructions;\n"],"names":["NOOP","Instructions","React","forwardRef","clickToAdd","customAddMessage","selectedOption","loadOptions","readOnly","disabled","hidden","name","lightBackground","autoSelect","subscribeCurrentValue","subscribeCurrentValueProp","onChange","onChangeProp","onFocus","onFocusProp","onBlur","onBlurProp","onUpdateCallback","availableOptions","loadingMessageFunc","placeholder","type","selectType","edit","rows","isExpanded","loadingIcon","successIcon","padding","options","props","forwardedRef","isHovered","setIsHovered","useState","selected","setSelected","addInstructions","setAddInstructions","customMessage","setCustomMessage","background","setBackground","initialHover","setInitialHover","currentValue","setCurrentValue","useEffect","isFunction","handleChange","value","useCallback","event","target","select","handleMouseOver","handleMouseLeave","sharedSelectProps","undefined","loadingMessage","_jsxs","S","ref","onMouseDown","onMouseLeave","children","_jsx","$initialHover","className","AutocompleteSelect","creatable","TextArea","noBorder","$lightBackground","icon","AlertIcon"],"mappings":";;;;;;;;AAOA,MAAMA,IAAI,GAAGA,MAAM,CAAC,CAAC;AAoKrB,MAAMC,YAAY,GAAGC,cAAK,CAACC,UAAU,CAAyB,SAASF,YAAYA,CACjF;AACEG,EAAAA,UAAU,GAAG,KAAK;EAClBC,gBAAgB;EAChBC,cAAc;EACdC,WAAW;AACXC,EAAAA,QAAQ,GAAG,KAAK;AAChBC,EAAAA,QAAQ,GAAG,KAAK;AAChBC,EAAAA,MAAM,GAAG,KAAK;EACdC,IAAI;AACJC,EAAAA,eAAe,GAAG,KAAK;AACvBC,EAAAA,UAAU,GAAG,IAAI;AACjBC,EAAAA,qBAAqB,EAAEC,yBAAyB;AAChDC,EAAAA,QAAQ,EAAEC,YAAY;AACtBC,EAAAA,OAAO,EAAEC,WAAW;AACpBC,EAAAA,MAAM,EAAEC,UAAU;AAClBC,EAAAA,gBAAgB,GAAGtB,IAAI;EACvBuB,gBAAgB;E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
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
4
|
+
const shouldForwardProp = prop => {
|
|
5
|
+
return prop !== 'theme' && !prop.startsWith('$');
|
|
6
|
+
};
|
|
7
|
+
const Instructions = styled.div.withConfig({
|
|
8
|
+
shouldForwardProp
|
|
9
|
+
}).attrs(applyDefaultTheme).withConfig({
|
|
10
|
+
displayName: "Instructionsstyled__Instructions",
|
|
11
|
+
componentId: "sc-lasand-0"
|
|
12
|
+
})(["display:flex;position:relative;flex-direction:column;", ";"], props => props.theme.themeProp('background', '#634E01', props.theme.getColor('signal-yellow-400')));
|
|
13
|
+
const TopBarContainer = styled.div.withConfig({
|
|
14
|
+
shouldForwardProp
|
|
15
|
+
}).attrs(applyDefaultTheme).withConfig({
|
|
16
|
+
displayName: "Instructionsstyled__TopBarContainer",
|
|
17
|
+
componentId: "sc-lasand-1"
|
|
18
|
+
})(["position:absolute;display:flex;width:100%;margin-top:0;transition:margin-top 120ms;&&.slide-in{margin-top:-24px;}", ";", ";"], props => props.theme.themeProp('background', '#634E01', props.theme.getColor('signal-yellow-400')), props => props.$initialHover && props.theme.themeProp('background', '#634E01', props.theme.getColor('signal-yellow-400')));
|
|
19
|
+
const SelectContainer = styled.div.withConfig({
|
|
20
|
+
shouldForwardProp
|
|
21
|
+
}).attrs(applyDefaultTheme).withConfig({
|
|
22
|
+
displayName: "Instructionsstyled__SelectContainer",
|
|
23
|
+
componentId: "sc-lasand-2"
|
|
24
|
+
})(["width:100%;margin:0 2px;"]);
|
|
25
|
+
const InstructionsArea = styled.div.withConfig({
|
|
26
|
+
shouldForwardProp
|
|
27
|
+
}).attrs(applyDefaultTheme).withConfig({
|
|
28
|
+
displayName: "Instructionsstyled__InstructionsArea",
|
|
29
|
+
componentId: "sc-lasand-3"
|
|
30
|
+
})(["margin:2px 2px -2px 2px;"]);
|
|
30
31
|
|
|
31
32
|
export { Instructions, InstructionsArea, SelectContainer, TopBarContainer };
|
|
32
33
|
//# sourceMappingURL=Instructions.styled.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Instructions.styled.js","sources":["../../../src/components/widgets/Instructions/Instructions.styled.
|
|
1
|
+
{"version":3,"file":"Instructions.styled.js","sources":["../../../src/components/widgets/Instructions/Instructions.styled.ts"],"sourcesContent":["// $-prefixed props are transient and never reach the DOM.\nimport styled from 'styled-components';\nimport { applyDefaultTheme } from '../../../utils/defaultTheme';\n\n/**\n * TopBarContainer — the only component in this file that reads a prop.\n */\ninterface InstructionsTopBarStyleProps {\n /**\n * `$initialHover` is inert: its conditional rule duplicates the unconditional one above it.\n */\n $initialHover?: boolean;\n}\n\n// Single-argument (styled-components 5 compat); DOM leaks fixed upstream in Instructions.tsx.\nconst shouldForwardProp = (prop: string): boolean => {\n return prop !== 'theme' && !prop.startsWith('$');\n};\n\nexport const Instructions = styled.div\n .withConfig({\n shouldForwardProp\n })\n .attrs(applyDefaultTheme)`\n display: flex;\n position: relative;\n flex-direction: column;\n ${props =>\n props.theme.themeProp('background', '#634E01', props.theme.getColor('signal-yellow-400'))};\n`;\n\nexport const TopBarContainer = styled.div\n .withConfig({\n shouldForwardProp\n })\n .attrs<InstructionsTopBarStyleProps>(applyDefaultTheme)`\n position: absolute;\n display: flex;\n width: 100%;\n margin-top: 0;\n transition: margin-top 120ms;\n &&.slide-in {\n margin-top: -24px;\n }\n ${props =>\n props.theme.themeProp('background', '#634E01', props.theme.getColor('signal-yellow-400'))};\n\n ${props =>\n props.$initialHover &&\n props.theme.themeProp('background', '#634E01', props.theme.getColor('signal-yellow-400'))};\n`;\n\nexport const SelectContainer = styled.div\n .withConfig({\n shouldForwardProp\n })\n .attrs(applyDefaultTheme)`\n width: 100%;\n margin: 0 2px;\n`;\n\nexport const InstructionsArea = styled.div\n .withConfig({\n shouldForwardProp\n })\n .attrs(applyDefaultTheme)`\n margin: 2px 2px -2px 2px;\n`;\n"],"names":["shouldForwardProp","prop","startsWith","Instructions","styled","div","withConfig","attrs","applyDefaultTheme","displayName","componentId","props","theme","themeProp","getColor","TopBarContainer","$initialHover","SelectContainer","InstructionsArea"],"mappings":";;;AAeA,MAAMA,iBAAiB,GAAIC,IAAY,IAAc;EACnD,OAAOA,IAAI,KAAK,OAAO,IAAI,CAACA,IAAI,CAACC,UAAU,CAAC,GAAG,CAAC;AAClD,CAAC;AAEM,MAAMC,YAAY,GAAGC,MAAM,CAACC,GAAG,CACnCC,UAAU,CAAC;AACVN,EAAAA;AACF,CAAC,CAAC,CACDO,KAAK,CAACC,iBAAiB,CAAC,CAAAF,UAAA,CAAA;EAAAG,WAAA,EAAA,kCAAA;EAAAC,WAAA,EAAA;AAAA,CAAA,CAAA,CAAA,CAAA,uDAAA,EAAA,GAAA,CAAA,EAIvBC,KAAK,IACLA,KAAK,CAACC,KAAK,CAACC,SAAS,CAAC,YAAY,EAAE,SAAS,EAAEF,KAAK,CAACC,KAAK,CAACE,QAAQ,CAAC,mBAAmB,CAAC,CAAC;AAGtF,MAAMC,eAAe,GAAGX,MAAM,CAACC,GAAG,CACtCC,UAAU,CAAC;AACVN,EAAAA;AACF,CAAC,CAAC,CACDO,KAAK,CAA+BC,iBAAiB,CAAC,CAAAF,UAAA,CAAA;EAAAG,WAAA,EAAA,qCAAA;EAAAC,WAAA,EAAA;AAAA,CAAA,CAAA,CAAA,CAAA,mHAAA,EAAA,GAAA,EAAA,GAAA,CAAA,EASrDC,KAAK,IACLA,KAAK,CAACC,KAAK,CAACC,SAAS,CAAC,YAAY,EAAE,SAAS,EAAEF,KAAK,CAACC,KAAK,CAACE,QAAQ,CAAC,mBAAmB,CAAC,CAAC,EAEzFH,KAAK,IACLA,KAAK,CAACK,aAAa,IACnBL,KAAK,CAACC,KAAK,CAACC,SAAS,CAAC,YAAY,EAAE,SAAS,EAAEF,KAAK,CAACC,KAAK,CAACE,QAAQ,CAAC,mBAAmB,CAAC,CAAC;AAGtF,MAAMG,eAAe,GAAGb,MAAM,CAACC,GAAG,CACtCC,UAAU,CAAC;AACVN,EAAAA;AACF,CAAC,CAAC,CACDO,KAAK,CAACC,iBAAiB,CAAC,CAAAF,UAAA,CAAA;EAAAG,WAAA,EAAA,qCAAA;EAAAC,WAAA,EAAA;AAAA,CAAA,CAAA,CAAA,CAAA,0BAAA,CAAA;AAKpB,MAAMQ,gBAAgB,GAAGd,MAAM,CAACC,GAAG,CACvCC,UAAU,CAAC;AACVN,EAAAA;AACF,CAAC,CAAC,CACDO,KAAK,CAACC,iBAAiB,CAAC,CAAAF,UAAA,CAAA;EAAAG,WAAA,EAAA,sCAAA;EAAAC,WAAA,EAAA;AAAA,CAAA,CAAA,CAAA,CAAA,0BAAA,CAAA;;;;"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import React__default, { useState } from 'react';
|
|
3
|
-
import PropTypes from 'prop-types';
|
|
1
|
+
import { useState } from 'react';
|
|
4
2
|
import { Container, Label, InnerContainer, Completed, ProgressBarTrack, MetricsContainer, ProgressBarFill, PercentageIndicator, ExternalPercentageIndicator, Link, ButtonLink, StyledArrowIcon } from './ProgressBar.styled.js';
|
|
3
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
5
4
|
|
|
6
5
|
const ProgressBar = ({
|
|
7
6
|
totalAssets,
|
|
@@ -32,41 +31,44 @@ const ProgressBar = ({
|
|
|
32
31
|
return shortNum.toFixed(shortNum < 10 ? 1 : 0) + units[unit];
|
|
33
32
|
}
|
|
34
33
|
};
|
|
35
|
-
return
|
|
36
|
-
height: height
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
34
|
+
return jsxs(Container, {
|
|
35
|
+
height: height,
|
|
36
|
+
...props,
|
|
37
|
+
children: [jsx(Label, {
|
|
38
|
+
children: label
|
|
39
|
+
}), jsxs(InnerContainer, {
|
|
40
|
+
type: type,
|
|
41
|
+
children: [jsx(Completed, {
|
|
42
|
+
type: type,
|
|
43
|
+
children: formatNumberNew(completedAssets)
|
|
44
|
+
}), jsxs(ProgressBarTrack, {
|
|
45
|
+
children: [jsxs(MetricsContainer, {
|
|
46
|
+
$hasLink: Boolean(linkText),
|
|
47
|
+
children: [jsx(ProgressBarFill, {
|
|
48
|
+
type: type,
|
|
49
|
+
$percentage: percentage,
|
|
50
|
+
barColor: barColor,
|
|
51
|
+
children: !isLowPercentage && jsx(PercentageIndicator, {
|
|
52
|
+
children: percentageText || formattedPercentage
|
|
53
|
+
})
|
|
54
|
+
}), isLowPercentage && jsx(ExternalPercentageIndicator, {
|
|
55
|
+
children: percentageText || formattedPercentage
|
|
56
|
+
})]
|
|
57
|
+
}), linkText && jsxs(Link, {
|
|
58
|
+
onClick: handleLinkClick,
|
|
59
|
+
onMouseEnter: () => setIsLinkHovered(true),
|
|
60
|
+
onMouseLeave: () => setIsLinkHovered(false),
|
|
61
|
+
children: [jsx(ButtonLink, {
|
|
62
|
+
$isHovered: isLinkHovered,
|
|
63
|
+
children: linkText
|
|
64
|
+
}), jsx(StyledArrowIcon, {
|
|
65
|
+
$isHovered: isLinkHovered
|
|
66
|
+
})]
|
|
67
|
+
})]
|
|
68
|
+
})]
|
|
69
|
+
})]
|
|
70
|
+
});
|
|
58
71
|
};
|
|
59
|
-
ProgressBar.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
60
|
-
totalAssets: PropTypes.number.isRequired,
|
|
61
|
-
completedAssets: PropTypes.number.isRequired,
|
|
62
|
-
percentageText: PropTypes.string,
|
|
63
|
-
barColor: PropTypes.string,
|
|
64
|
-
height: PropTypes.number,
|
|
65
|
-
label: PropTypes.string,
|
|
66
|
-
type: PropTypes.string,
|
|
67
|
-
linkText: PropTypes.string,
|
|
68
|
-
onClick: PropTypes.func
|
|
69
|
-
} : {};
|
|
70
72
|
|
|
71
73
|
export { ProgressBar as default };
|
|
72
74
|
//# sourceMappingURL=ProgressBar.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProgressBar.js","sources":["../../../src/components/widgets/ProgressBar/ProgressBar.
|
|
1
|
+
{"version":3,"file":"ProgressBar.js","sources":["../../../src/components/widgets/ProgressBar/ProgressBar.tsx"],"sourcesContent":["import React, { useState } from 'react';\nimport * as S from './ProgressBar.styled';\n\ntype ProgressBarOwnProps = {\n totalAssets: number;\n completedAssets: number;\n percentageText?: string;\n barColor?: string;\n height?: number;\n label?: string;\n type?: string;\n linkText?: string;\n onClick?: (...args: any[]) => any;\n};\n\n// Props spread onto styled component; use Omit+intersection to widen, not narrow, colliding props.\ntype Props = Omit<React.ComponentPropsWithoutRef<typeof S.Container>, keyof ProgressBarOwnProps> &\n ProgressBarOwnProps;\n\n/**\n * ProgressBar that let you progress through a task.\n *\n *\n * ### Import\n *\n * ``` js\n * import { ProgressBar } from '@ntbjs/react-components/widgets/ProgressBar'\n * // or\n * import ProgressBar from '@ntbjs/react-components/widgets/ProgressBar'\n * ```\n *\n *\n */\n\nconst ProgressBar = ({\n totalAssets,\n completedAssets,\n percentageText,\n barColor,\n height,\n label,\n type,\n linkText,\n onClick,\n ...props\n}: Props) => {\n const [isLinkHovered, setIsLinkHovered] = useState(false);\n\n const safeCompletedAssets = Math.max(0, completedAssets);\n const safeTotalAssets = Math.max(1, totalAssets);\n const percentage = (safeCompletedAssets / safeTotalAssets) * 100;\n const formattedPercentage = `${Math.round(percentage)}%`;\n\n const isLowPercentage = percentage <= 5;\n\n const handleLinkClick = e => onClick(e);\n\n const formatNumberNew = num => {\n if (num < 1000000) {\n return num.toString().replace(/\\B(?=(\\d{3})+(?!\\d))/g, ' ');\n } else {\n const units = ['K', 'M', 'B', 'T'];\n const unit = Math.floor((num.toString().length - 1) / 3) - 1;\n const shortNum = num / Math.pow(1000, unit + 1);\n return shortNum.toFixed(shortNum < 10 ? 1 : 0) + units[unit];\n }\n };\n\n return (\n <S.Container height={height} {...props}>\n <S.Label>{label}</S.Label>\n <S.InnerContainer type={type}>\n <S.Completed type={type}>{formatNumberNew(completedAssets)}</S.Completed>\n <S.ProgressBarTrack>\n <S.MetricsContainer $hasLink={Boolean(linkText)}>\n <S.ProgressBarFill type={type} $percentage={percentage} barColor={barColor}>\n {!isLowPercentage && (\n // `$hasLink` removed; PercentageIndicator never reads it.\n <S.PercentageIndicator>\n {percentageText || formattedPercentage}\n </S.PercentageIndicator>\n )}\n </S.ProgressBarFill>\n {isLowPercentage && (\n <S.ExternalPercentageIndicator>\n {percentageText || formattedPercentage}\n </S.ExternalPercentageIndicator>\n )}\n </S.MetricsContainer>\n {linkText && (\n <S.Link\n onClick={handleLinkClick}\n onMouseEnter={() => setIsLinkHovered(true)}\n onMouseLeave={() => setIsLinkHovered(false)}\n >\n <S.ButtonLink $isHovered={isLinkHovered}>{linkText}</S.ButtonLink>\n <S.StyledArrowIcon $isHovered={isLinkHovered} />\n </S.Link>\n )}\n </S.ProgressBarTrack>\n </S.InnerContainer>\n </S.Container>\n );\n};\n\nexport default ProgressBar;\n"],"names":["ProgressBar","totalAssets","completedAssets","percentageText","barColor","height","label","type","linkText","onClick","props","isLinkHovered","setIsLinkHovered","useState","safeCompletedAssets","Math","max","safeTotalAssets","percentage","formattedPercentage","round","isLowPercentage","handleLinkClick","e","formatNumberNew","num","toString","replace","units","unit","floor","length","shortNum","pow","toFixed","_jsxs","S","children","_jsx","$hasLink","Boolean","$percentage","onMouseEnter","onMouseLeave","$isHovered"],"mappings":";;;;AAkCA,MAAMA,WAAW,GAA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