@ntbjs/react-components 2.0.13 → 3.0.0-rc.1
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/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 +73 -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 -120
- package/build/widgets/AssetGallery/AssetGalleryBase/AssetGalleryCompactCard/AssetGalleryCompactCard.js.map +1 -1
- package/build/widgets/AssetGallery/AssetGalleryBase/AssetGalleryCompactCard/AssetGalleryCompactCard.styled.js +99 -285
- 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 +77 -36
- package/styles/utils/colors-export.d.ts +73 -0
- package/types/components/data/Alert/Alert.d.ts +76 -0
- package/types/components/data/Alert/Alert.styled.d.ts +83 -0
- package/types/components/data/Alert/index.d.ts +1 -0
- package/types/components/data/Badge/Badge.d.ts +128 -0
- package/types/components/data/Badge/Badge.styled.d.ts +132 -0
- package/types/components/data/Badge/index.d.ts +1 -0
- package/types/components/data/Popover/Popover.d.ts +205 -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 +27 -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 +42 -0
- package/types/components/data/Tabs/index.d.ts +1 -0
- package/types/components/data/Tooltip/Tooltip.d.ts +134 -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 +46 -0
- package/types/components/data/VerificationStatusIcon/index.d.ts +1 -0
- package/types/components/data/_shared/FloatingArrow.styled.d.ts +129 -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 +34 -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 +102 -0
- package/types/components/inputs/Button/index.d.ts +1 -0
- package/types/components/inputs/Checkbox/Checkbox.d.ts +92 -0
- package/types/components/inputs/Checkbox/Checkbox.styled.d.ts +33 -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 +157 -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 +86 -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 +70 -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 +21 -0
- package/types/components/inputs/MultiLevelCheckbox/index.d.ts +2 -0
- package/types/components/inputs/MultiLevelCheckbox/types.d.ts +72 -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 +172 -0
- package/types/components/inputs/MultiSelect/MultiSelect.styled.d.ts +99 -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 +20 -0
- package/types/components/inputs/Switch/index.d.ts +1 -0
- package/types/components/inputs/TextArea/TextArea.d.ts +124 -0
- package/types/components/inputs/TextArea/TextArea.styled.d.ts +95 -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 +14 -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 +20 -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 +88 -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 +100 -0
- package/types/components/widgets/AssetGallery/AssetGalleryBase/AssetGalleryGridCard/AssetGalleryGridCard.d.ts +2 -0
- package/types/components/widgets/AssetGallery/AssetGalleryBase/AssetGalleryGridCard/AssetGalleryGridCard.styled.d.ts +85 -0
- package/types/components/widgets/AssetGallery/asset.types.d.ts +446 -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 +35 -0
- package/types/components/widgets/AssetPreview/AssetPreviewTopBar/index.d.ts +1 -0
- package/types/components/widgets/ContextMenu/ContextMenu.d.ts +134 -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 +26 -0
- package/types/components/widgets/ContextMenu/ContextMenuItem/index.d.ts +1 -0
- package/types/components/widgets/ContextMenu/ContextMenuItemsGroup/ContextMenuItemsGroup.d.ts +41 -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 +45 -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 +40 -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 +26 -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 +78 -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 +68 -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 +25 -0
- package/types/hooks/useEventListner.d.ts +46 -0
- package/types/hooks/useFloatingPopover.d.ts +242 -0
- package/types/hooks/useIsomorphicLayoutEffect.d.ts +26 -0
- package/types/hooks/useOnClickOutside.d.ts +31 -0
- package/types/hooks/useTooltipAutoShow.d.ts +80 -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 +73 -0
- package/types/utils/dateTime.d.ts +13 -0
- package/types/utils/defaultTheme.d.ts +174 -0
- package/types/utils/getElementRef.d.ts +21 -0
- package/types/utils/parseTrigger.d.ts +92 -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":"InstructionSeverityDisplay.js","sources":["../../../src/components/widgets/InstructionSeverityDisplay/InstructionSeverityDisplay.
|
|
1
|
+
{"version":3,"file":"InstructionSeverityDisplay.js","sources":["../../../src/components/widgets/InstructionSeverityDisplay/InstructionSeverityDisplay.tsx"],"sourcesContent":["import React from 'react';\nimport SeverityBadge from '../../data/SeverityBadge/SeverityBadge';\nimport * as S from './InstructionSeverityDisplay.styled';\n\nconst defaultLabels = {\n 1: 'Info',\n 2: 'Info',\n 3: 'Limited use',\n 4: 'Limited use',\n 5: 'Highly restricted'\n};\n\ntype InstructionSeverityDisplayOwnProps = {\n /** Severity level (1-5). 1=Info, 3=Limited use, 5=Highly restricted. */\n severity?: 1 | 2 | 3 | 4 | 5;\n /** The instruction text to display. Component returns null if empty. */\n instructionText?: string;\n /** Override the default badge label for the severity level. */\n severityLabel?: string;\n /** Map of severity level to translated label string, e.g. { 1: 'Info', 3: 'Begrenset bruk', 5: 'Svært begrenset' }. */\n labels?: {\n [key: string]: string;\n };\n /** Override the default icon element. */\n icon?: React.ReactElement<any>;\n /** Whether to show card styling (border-radius, shadow, border). Defaults to true. */\n showCard?: boolean;\n /** Custom card padding, e.g. \"8px 6px\" or \"20px\". Defaults to \"14px 10px\". */\n padding?: string;\n /** Custom font size for the badge text, e.g. \"10px\" or \"0.75rem\". Defaults to \"12px\". */\n badgeFontSize?: string;\n /** Custom font size for the details/instruction text, e.g. \"12px\" or \"0.875rem\". Defaults to \"14px\". */\n detailsFontSize?: string;\n /** Override card background color in light mode, e.g. \"#ffffff\" or \"transparent\". */\n bgLight?: string;\n /** Override card background color in dark mode, e.g. \"#1a1a1a\" or \"transparent\". */\n bgDark?: string;\n /** Max number of lines for instruction text before clamping with ellipsis. */\n maxLines?: number;\n /** URL of a thumbnail image to display on the left side of the card. Pass null to show a placeholder. Omit to show no thumbnail. */\n thumbnail?: string;\n};\n\n/*\n * NMB-3998 §C.2: `props` is spread onto `S.Card`, so the published type\n * has to admit that target's props too — a closed type here is worse than `any` for the\n * 125 consumer files. Declared members win over the base (`Omit` by `keyof InstructionSeverityDisplayOwnProps`);\n * a bare `&` would INTERSECT a colliding member instead of overriding it, which narrows\n * it (measured: `rows?: number | string` & `rows?: number`) or empties it to `never`.\n */\ntype Props = Omit<\n React.ComponentPropsWithoutRef<typeof S.Card>,\n keyof InstructionSeverityDisplayOwnProps\n> &\n InstructionSeverityDisplayOwnProps;\n\n/**\n * InstructionSeverityDisplay communicates the usage restrictions or\n * severity levels associated with a specific instruction or asset.\n *\n * ### Import\n *\n * ``` js\n * import { InstructionSeverityDisplay } from '@ntbjs/react-components/widgets'\n * // or\n * import InstructionSeverityDisplay from '@ntbjs/react-components/widgets/InstructionSeverityDisplay'\n * ```\n */\nconst InstructionSeverityDisplay = React.forwardRef<any, Props>(function InstructionSeverityDisplay(\n {\n severity,\n instructionText,\n severityLabel,\n labels,\n icon,\n showCard = true,\n padding,\n badgeFontSize,\n detailsFontSize,\n bgLight,\n bgDark,\n maxLines,\n thumbnail,\n ...props\n },\n forwardedRef\n) {\n if (!instructionText) {\n return null;\n }\n\n const effectiveSeverity = severity ?? 1;\n const displayLabel =\n severityLabel || (labels && labels[effectiveSeverity]) || defaultLabels[effectiveSeverity];\n\n const hasThumbnail = thumbnail !== undefined;\n\n const content = (\n <>\n <SeverityBadge\n severity={severity}\n label={displayLabel}\n icon={icon}\n fontSize={badgeFontSize ? parseFloat(badgeFontSize) : undefined}\n />\n <S.InstructionText $fontSize={detailsFontSize} $maxLines={maxLines}>\n {maxLines ? <span title={instructionText}>{instructionText}</span> : instructionText}\n </S.InstructionText>\n </>\n );\n\n return (\n <S.Card\n ref={forwardedRef}\n $severity={severity}\n $showCard={showCard}\n $padding={padding}\n $bgLight={bgLight}\n $bgDark={bgDark}\n $hasThumbnail={hasThumbnail}\n {...props}\n >\n {hasThumbnail && (\n <S.ThumbnailWrapper>\n {thumbnail && <S.ThumbnailImage src={thumbnail} alt=\"\" />}\n </S.ThumbnailWrapper>\n )}\n {hasThumbnail ? <S.ContentWrapper>{content}</S.ContentWrapper> : content}\n </S.Card>\n );\n});\n\nexport default InstructionSeverityDisplay;\n"],"names":["defaultLabels","InstructionSeverityDisplay","React","forwardRef","severity","instructionText","severityLabel","labels","icon","showCard","padding","badgeFontSize","detailsFontSize","bgLight","bgDark","maxLines","thumbnail","props","forwardedRef","effectiveSeverity","displayLabel","hasThumbnail","undefined","content","_jsxs","_Fragment","children","_jsx","SeverityBadge","label","fontSize","parseFloat","S","$fontSize","$maxLines","title","ref","$severity","$showCard","$padding","$bgLight","$bgDark","$hasThumbnail","src","alt"],"mappings":";;;;;AAIA,MAAMA,aAAa,GAAG;AACpB,EAAA,CAAC,EAAE,MAAM;AACT,EAAA,CAAC,EAAE,MAAM;AACT,EAAA,CAAC,EAAE,aAAa;AAChB,EAAA,CAAC,EAAE,aAAa;AAChB,EAAA,CAAC,EAAE;AACL,CAAC;AA0DD,MAAMC,0BAA0B,GAAGC,cAAK,CAACC,UAAU,CAAa,SAASF,0BAA0BA,CACjG;EACEG,QAAQ;EACRC,eAAe;EACfC,aAAa;EACbC,MAAM;EACNC,IAAI;AACJC,EAAAA,QAAQ,GAAG,IAAI;EACfC,OAAO;EACPC,aAAa;EACbC,eAAe;EACfC,OAAO;EACPC,MAAM;EACNC,QAAQ;EACRC,SAAS;EACT,GAAGC;AACL,CAAC,EACDC,YAAY,EACZ;EACA,IAAI,CAACb,eAAe,EAAE;AACpB,IAAA,OAAO,IAAI;AACb,EAAA;AAEA,EAAA,MAAMc,iBAAiB,GAAGf,QAAQ,IAAI,CAAC;AACvC,EAAA,MAAMgB,YAAY,GAChBd,aAAa,IAAKC,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AAI;KACtC,CACrB,EACAvB,YAAY,GAAGM,GAAA,CAACK,cAAgB,EAAA;AAAAN,MAAAA,QAAA,EAAEH;KAA0B,CAAC,GAAGA,OAAO;AAAA,GAClE,CAAC;AAEb,CAAC;;;;"}
|
|
@@ -6,75 +6,39 @@ const shouldForwardProp = prop => {
|
|
|
6
6
|
};
|
|
7
7
|
const Card = styled.div.withConfig({
|
|
8
8
|
shouldForwardProp
|
|
9
|
-
}).attrs(applyDefaultTheme)
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
align-items: flex-start;
|
|
14
|
-
padding: ${props => props.$padding || '14px 10px'};
|
|
15
|
-
${props => {
|
|
9
|
+
}).attrs(applyDefaultTheme).withConfig({
|
|
10
|
+
displayName: "InstructionSeverityDisplaystyled__Card",
|
|
11
|
+
componentId: "sc-coel0g-0"
|
|
12
|
+
})(["display:flex;flex-direction:", ";gap:", ";align-items:flex-start;padding:", ";", " ", " ", ""], props => props.$hasThumbnail ? 'row' : 'column', props => props.$hasThumbnail ? '12px' : '8px', props => props.$padding || '14px 10px', props => {
|
|
16
13
|
if (props.$bgDark || props.$bgLight) {
|
|
17
14
|
return props.theme.themeProp('background', props.$bgDark || props.theme.getColor('gray-900'), props.$bgLight || props.theme.getColor('gray-200'));
|
|
18
15
|
}
|
|
19
16
|
return props.theme.themeProp('background', props.theme.getColor('gray-900'), props.theme.getColor('gray-200'));
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
${props => props.$showCard && css`
|
|
23
|
-
border-radius: 10px;
|
|
24
|
-
box-shadow: 0px 0px 26px #0000001a;
|
|
25
|
-
`}
|
|
26
|
-
|
|
27
|
-
${props => props.$severity === 5 && props.$showCard && css`
|
|
28
|
-
outline-offset: -1px;
|
|
29
|
-
${props.theme.themeProp('outline', '1px solid #7f1d1d', '1px solid #dc2626')}
|
|
30
|
-
`}
|
|
31
|
-
`;
|
|
17
|
+
}, props => props.$showCard && css(["border-radius:10px;box-shadow:0px 0px 26px #0000001a;"]), props => props.$severity === 5 && props.$showCard && css(["outline-offset:-1px;", ""], props.theme.themeProp('outline', '1px solid #7f1d1d', '1px solid #dc2626')));
|
|
32
18
|
const ThumbnailWrapper = styled.div.withConfig({
|
|
33
19
|
shouldForwardProp
|
|
34
|
-
}).attrs(applyDefaultTheme)
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
border-radius: 6px;
|
|
39
|
-
overflow: hidden;
|
|
40
|
-
${props => props.theme.themeProp('background', props.theme.getColor('gray-700'), props.theme.getColor('gray-200'))}
|
|
41
|
-
`;
|
|
20
|
+
}).attrs(applyDefaultTheme).withConfig({
|
|
21
|
+
displayName: "InstructionSeverityDisplaystyled__ThumbnailWrapper",
|
|
22
|
+
componentId: "sc-coel0g-1"
|
|
23
|
+
})(["flex-shrink:0;width:56px;height:56px;border-radius:6px;overflow:hidden;", ""], props => props.theme.themeProp('background', props.theme.getColor('gray-700'), props.theme.getColor('gray-200')));
|
|
42
24
|
const ThumbnailImage = styled.img.withConfig({
|
|
43
25
|
shouldForwardProp
|
|
44
|
-
})
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
display: block;
|
|
49
|
-
`;
|
|
26
|
+
}).withConfig({
|
|
27
|
+
displayName: "InstructionSeverityDisplaystyled__ThumbnailImage",
|
|
28
|
+
componentId: "sc-coel0g-2"
|
|
29
|
+
})(["width:100%;height:100%;object-fit:cover;display:block;"]);
|
|
50
30
|
const ContentWrapper = styled.div.withConfig({
|
|
51
31
|
shouldForwardProp
|
|
52
|
-
})
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
align-items: flex-start;
|
|
57
|
-
flex: 1;
|
|
58
|
-
min-width: 0;
|
|
59
|
-
`;
|
|
32
|
+
}).withConfig({
|
|
33
|
+
displayName: "InstructionSeverityDisplaystyled__ContentWrapper",
|
|
34
|
+
componentId: "sc-coel0g-3"
|
|
35
|
+
})(["display:flex;flex-direction:column;gap:8px;align-items:flex-start;flex:1;min-width:0;"]);
|
|
60
36
|
const InstructionText = styled.p.withConfig({
|
|
61
37
|
shouldForwardProp
|
|
62
|
-
}).attrs(applyDefaultTheme)
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
margin: 0;
|
|
67
|
-
overflow-wrap: break-word;
|
|
68
|
-
word-break: break-word;
|
|
69
|
-
${props => props.theme.themeProp('color', props.theme.getColor('gray-300'), props.theme.getColor('black'))}
|
|
70
|
-
|
|
71
|
-
${props => props.$maxLines && css`
|
|
72
|
-
display: -webkit-box;
|
|
73
|
-
-webkit-line-clamp: ${props.$maxLines};
|
|
74
|
-
-webkit-box-orient: vertical;
|
|
75
|
-
overflow: hidden;
|
|
76
|
-
`}
|
|
77
|
-
`;
|
|
38
|
+
}).attrs(applyDefaultTheme).withConfig({
|
|
39
|
+
displayName: "InstructionSeverityDisplaystyled__InstructionText",
|
|
40
|
+
componentId: "sc-coel0g-4"
|
|
41
|
+
})(["font-size:", ";font-weight:400;line-height:1.286em;margin:0;overflow-wrap:break-word;word-break:break-word;", " ", ""], props => props.$fontSize || '14px', props => props.theme.themeProp('color', props.theme.getColor('gray-300'), props.theme.getColor('black')), props => props.$maxLines && css(["display:-webkit-box;-webkit-line-clamp:", ";-webkit-box-orient:vertical;overflow:hidden;"], props.$maxLines));
|
|
78
42
|
|
|
79
43
|
export { Card, ContentWrapper, InstructionText, ThumbnailImage, ThumbnailWrapper };
|
|
80
44
|
//# sourceMappingURL=InstructionSeverityDisplay.styled.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InstructionSeverityDisplay.styled.js","sources":["../../../src/components/widgets/InstructionSeverityDisplay/InstructionSeverityDisplay.styled.
|
|
1
|
+
{"version":3,"file":"InstructionSeverityDisplay.styled.js","sources":["../../../src/components/widgets/InstructionSeverityDisplay/InstructionSeverityDisplay.styled.ts"],"sourcesContent":["/*\n * $-transient-prop pattern: rules in\n * `src/components/layout/SectionSeparator/SectionSeparator.styled.ts`, derivation\n * and measurements in `scripts/TS-MIGRATION-PLAYBOOK.md` §J.\n *\n * THIS FILE IS THE WORKED EXAMPLE FOR THE TWO CHAIN SHAPES, because it is the only\n * one of the 36 that has both:\n *\n * Card, ThumbnailWrapper, InstructionText .withConfig({…}).attrs(…)`…`\n * → generic goes on `.attrs<P>()`\n *\n * ThumbnailImage, ContentWrapper .withConfig({…})`…` (NO .attrs)\n * → `.attrs<P>()` does not exist to annotate, and `styled.img<P>.withConfig({…})`\n * is TS1477. The generic goes on the TAGGED-TEMPLATE CALL instead:\n * styled.img.withConfig({ shouldForwardProp })<P>`…`\n * C7 rule 1 says the generic goes on `.attrs()` \"and only there\"; that is\n * wrong for this shape, and §J.1 corrects it with the measurement.\n *\n * Neither of those two reads any prop, so NEITHER IS ANNOTATED HERE — rule 2, declare\n * only what is actually passed. The shape is documented because it is the one the\n * a7bb76d prototype skips with \"chain has no .attrs() and root is not the tag\", and\n * whoever converts a file where such a site DOES read a prop needs to know the slot\n * exists rather than reaching for a suppression.\n */\nimport styled, { css } from 'styled-components';\nimport { applyDefaultTheme } from '../../../utils/defaultTheme';\n\n/**\n * Card's props, i.e. what `InstructionSeverityDisplay.tsx` passes to `S.Card`.\n * Value types from that file's propTypes; all optional per §J.5.\n */\nexport interface CardStyleProps {\n /** `severity` — `PropTypes.oneOf([1, 2, 3, 4, 5])`. Closed on purpose: the template\n * compares `=== 5`, and a comparison against a value outside the union is TS2367\n * rather than a branch that never fires. */\n $severity?: 1 | 2 | 3 | 4 | 5;\n /** `showCard` — component defaults it to `true`, but see §J.5: a default in the\n * COMPONENT is not a default here, so this stays optional. */\n $showCard?: boolean;\n /** `padding` — a whole CSS padding shorthand, e.g. `'8px 6px'`. `string`, not\n * `number`: the template uses it raw (`padding: ${props.$padding}`) with a\n * `'14px 10px'` fallback, so a number would emit a unitless `padding: 8`. */\n $padding?: string;\n /** `bgLight` — CSS colour applied under `body.light-theme`. */\n $bgLight?: string;\n /** `bgDark` — CSS colour applied under `body.dark-theme`. */\n $bgDark?: string;\n /** Derived in the component as `thumbnail !== undefined`, so genuinely `boolean`\n * and not the `string` the `thumbnail` prop is. */\n $hasThumbnail?: boolean;\n}\n\n/** InstructionText's props. */\ninterface InstructionTextStyleProps {\n /** `detailsFontSize` — a font-size with its unit, e.g. `'12px'`, `'0.875rem'`.\n * `string` for the same reason as `$padding`: it is interpolated raw. */\n $fontSize?: string;\n /** `maxLines` — `PropTypes.number`, the `-webkit-line-clamp` count. Read only\n * behind `props.$maxLines &&`, which is what keeps it valid when\n * `strictNullChecks` is eventually turned on. */\n $maxLines?: number;\n}\n\n/*\n * Single-argument, and it stays that way — the peer floor is\n * `styled-components: >=5.1.0` and the two majors disagree on the second parameter.\n * See SectionSeparator.styled.ts and §J.4. `prop` needs the annotation because\n * `withConfig` takes this by reference and so gives it no contextual typing.\n */\nconst shouldForwardProp = (prop: string): boolean => {\n return prop !== 'theme' && !prop.startsWith('$');\n};\n\nexport const Card = styled.div\n .withConfig({\n shouldForwardProp\n })\n .attrs<CardStyleProps>(applyDefaultTheme)`\n display: flex;\n flex-direction: ${props => (props.$hasThumbnail ? 'row' : 'column')};\n gap: ${props => (props.$hasThumbnail ? '12px' : '8px')};\n align-items: flex-start;\n padding: ${props => props.$padding || '14px 10px'};\n ${props => {\n if (props.$bgDark || props.$bgLight) {\n return props.theme.themeProp(\n 'background',\n props.$bgDark || props.theme.getColor('gray-900'),\n props.$bgLight || props.theme.getColor('gray-200')\n );\n }\n return props.theme.themeProp(\n 'background',\n props.theme.getColor('gray-900'),\n props.theme.getColor('gray-200')\n );\n }}\n\n ${props =>\n props.$showCard &&\n css`\n border-radius: 10px;\n box-shadow: 0px 0px 26px #0000001a;\n `}\n\n ${props =>\n props.$severity === 5 &&\n props.$showCard &&\n css`\n outline-offset: -1px;\n ${props.theme.themeProp('outline', '1px solid #7f1d1d', '1px solid #dc2626')}\n `}\n`;\n\nexport const ThumbnailWrapper = styled.div\n .withConfig({ shouldForwardProp })\n .attrs(applyDefaultTheme)`\n flex-shrink: 0;\n width: 56px;\n height: 56px;\n border-radius: 6px;\n overflow: hidden;\n ${props =>\n props.theme.themeProp(\n 'background',\n props.theme.getColor('gray-700'),\n props.theme.getColor('gray-200')\n )}\n`;\n\n/*\n * NO `.attrs()`, and no prop read, so no generic. If a prop read is ever added here,\n * the annotation goes on the TEMPLATE CALL — `styled.img.withConfig({…})<P>`…`` —\n * and NOT on `styled.img<P>.withConfig(…)`, which is TS1477. §J.1.\n */\nexport const ThumbnailImage = styled.img.withConfig({ shouldForwardProp })`\n width: 100%;\n height: 100%;\n object-fit: cover;\n display: block;\n`;\n\nexport const ContentWrapper = styled.div.withConfig({ shouldForwardProp })`\n display: flex;\n flex-direction: column;\n gap: 8px;\n align-items: flex-start;\n flex: 1;\n min-width: 0;\n`;\n\nexport const InstructionText = styled.p\n .withConfig({\n shouldForwardProp\n })\n .attrs<InstructionTextStyleProps>(applyDefaultTheme)`\n font-size: ${props => props.$fontSize || '14px'};\n font-weight: 400;\n line-height: 1.286em;\n margin: 0;\n overflow-wrap: break-word;\n word-break: break-word;\n ${props =>\n props.theme.themeProp('color', props.theme.getColor('gray-300'), props.theme.getColor('black'))}\n\n ${props =>\n props.$maxLines &&\n css`\n display: -webkit-box;\n -webkit-line-clamp: ${props.$maxLines};\n -webkit-box-orient: vertical;\n overflow: hidden;\n `}\n`;\n"],"names":["shouldForwardProp","prop","startsWith","Card","styled","div","withConfig","attrs","applyDefaultTheme","displayName","componentId","props","$hasThumbnail","$padding","$bgDark","$bgLight","theme","themeProp","getColor","$showCard","css","$severity","ThumbnailWrapper","ThumbnailImage","img","ContentWrapper","InstructionText","p","$fontSize","$maxLines"],"mappings":";;;AAqEA,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,CAC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K,CAACK,KAAK,CAACC,SAAS,CAAC,OAAO,EAAEN,KAAK,CAACK,KAAK,CAACE,QAAQ,CAAC,UAAU,CAAC,EAAEP,KAAK,CAACK,KAAK,CAACE,QAAQ,CAAC,OAAO,CAAC,CAAC,EAE/FP,KAAK,IACLA,KAAK,CAACkB,SAAS,IACfT,GAAG,+FAEqBT,KAAK,CAACkB,SAAS,CAGtC;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -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,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hE,WAAW,EAAEqD,SAAS,CAACW,OAAO;AAI9B/D,EAAAA,OAAO,EAAEoD,SAAS,CAACU,KAAK,CAAC,CAAC,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAA;AAC3D,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/*\n * NMB-3998 §C.2: `props` is spread onto `S.Instructions`, so the published type\n * has to admit that target's props too — a closed type here is worse than `any` for the\n * 125 consumer files. Declared members win over the base (`Omit` by `keyof InstructionsOwnProps`);\n * a bare `&` would INTERSECT a colliding member instead of overriding it, which narrows\n * it (measured: `rows?: number | string` & `rows?: number`) or empties it to `never`.\n */\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 /*\n * NMB-3998 DOM LEAK. `options` is declared and documented on `InstructionsOwnProps`\n * but was never destructured, so it fell into the `...props` rest below and was\n * spread onto `<S.Instructions>`. Nothing in `Instructions.styled.ts` reads it and it\n * has no `$` prefix, so `shouldForwardProp` forwarded it to the host `<div>`, where\n * React stringified the array: `<div options=\"[object Object],[object Object],…\">` is\n * in the committed render baseline entry `widgets/Instructions`.\n *\n * Destructuring it here is what stops the leak. It is also consumed for the first\n * time, in `sharedSelectProps` below, which is the behaviour its own JSDoc has always\n * documented (\"will override the `availableOptions` prop if both props are set\") and\n * which nothing implemented. Leaving it destructured-but-unused would have been a\n * knowingly dead binding.\n */\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 /*\n * NMB-3998: same failure as CompactTextInput — bare `useState()` infers `undefined`, so\n * the setter is `(prevState: undefined) => undefined` and rejects every string assigned\n * to it (TS2345 at the `customMessage` and `''` sites). All six writes are strings\n * (`selectedOption.value`, `customMessage`, `event.target.value`, `''`,\n * `selected.value`). The initial value stays `undefined` — type-only, no argument added.\n */\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 {/*\n * NMB-3998 DOM LEAK, fixed by deleting a prop nothing consumed. `S.InstructionsArea`\n * used to be given `type={type}`. It is a `styled.div` whose template reads no props\n * at all, and `type` has no `$` prefix, so `shouldForwardProp` forwarded it straight\n * onto the `<div>` — `<div type=\"warning\" …>` is in the committed render baseline\n * entry `widgets/Instructions`, and `type` is not an attribute of `<div>`. The `type`\n * styling is done by the `TextArea` below, which does consume it.\n */}\n <S.InstructionsArea>\n <TextArea\n noBorder\n type={type}\n /**\n * INERT. TextArea stopped consuming `lightBackground` in f5ff074\n * (Aug 2024), so Instructions' documented `lightBackground` prop has had\n * no visual effect since then — its only remaining behaviour was leaking\n * onto the DOM as an unknown attribute. Kept transient ($-prefixed) so\n * styled-components strips it, rather than deleted, because deleting the\n * pass-down orphans the `background` state and the public prop while\n * fixing nothing a consumer can see. Restoring the feature is a\n * behaviour change and needs its own ticket.\n */\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;AA0KrB,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;AA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
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
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":["/*\n * $-transient-prop pattern: rules in\n * `src/components/layout/SectionSeparator/SectionSeparator.styled.ts`, derivation and\n * measurements in `scripts/TS-MIGRATION-PLAYBOOK.md` §J.\n */\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` — `Instructions.tsx`'s `useState(true)`, so genuinely `boolean` and not\n * derived from any prop. Transient, so it never reaches the DOM.\n *\n * READ, PASSED, AND NEVERTHELESS INERT — recorded, not fixed. The rule it guards is\n * `themeProp('background', '#634E01', getColor('signal-yellow-400'))`, character for\n * character the same declaration as the UNCONDITIONAL one three lines above it. So\n * whichever way `$initialHover` goes, the emitted background is identical and the\n * conditional only ever adds a duplicate of the rule that precedes it.\n *\n * Deleting it is the fix, and it is not a type-only change: removing the block removes a\n * duplicate declaration from the generated CSS and therefore moves the render baseline\n * (§J.8). Whether the intent was a DIFFERENT hover colour is a question for whoever owns\n * the design, not for this commit.\n */\n $initialHover?: 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. §J.4. `prop` needs the annotation\n * because `withConfig` takes this by reference, so it gets no contextual typing.\n *\n * NOTE, for whoever audits DOM leaks here: this predicate is doing its job and both leaks\n * this component had were upstream of it, in `Instructions.tsx`, which is where they were\n * fixed — nothing in this file read either prop, so there was never anything to declare.\n * For the record, since the recorded baseline still shows them until it is re-recorded:\n * `widgets/Instructions` opened `<div options=\"[object Object],[object Object],…\">`\n * (`options` was never destructured, so it rode the `...props` rest onto `S.Instructions`)\n * and `InstructionsArea` rendered `<div type=\"warning\">` (`type={type}` was passed to a\n * component whose template reads no props at all).\n */\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":";;;AA4CA,MAAMA,iBAAiB,GAAIC,IAAY,IAAc;EACnD,OAAOA,IAAI,KAAK,OAAO,IA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