@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,11 +1,12 @@
|
|
|
1
1
|
import React__default, { useState, useEffect, useMemo } from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
2
|
import { nanoid } from 'nanoid';
|
|
4
3
|
import { components } from 'react-select';
|
|
5
4
|
import { colors } from '../../styles/utils/colors-export.js';
|
|
6
|
-
import { AsyncCreatableMultiSelect, AsyncMultiSelect, CreatableMultiSelect, MultiSelect as MultiSelect$1, MultiSelectWrapper, Label, InnerWrapper, ShowMoreWrapper, ShowMoreOverlay, ShowMoreText, ErrorMessage,
|
|
5
|
+
import { AsyncCreatableMultiSelect, AsyncMultiSelect, CreatableMultiSelect, MultiSelect as MultiSelect$1, MultiSelectWrapper, Label, InnerWrapper, ShowMoreWrapper, ShowMoreOverlay, ShowMoreText, ErrorMessage, MultiValueWrapper, DropdownOptionDeleteIcon } from './MultiSelect.styled.js';
|
|
6
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
7
7
|
|
|
8
8
|
const showMoreHeight = 114;
|
|
9
|
+
const defaultNoOptionsMessage = inputValue => inputValue ? `No matches for "${inputValue}"` : 'No available options';
|
|
9
10
|
const MultiSelect = React__default.forwardRef((props, forwardedRef) => {
|
|
10
11
|
const {
|
|
11
12
|
label,
|
|
@@ -14,16 +15,17 @@ const MultiSelect = React__default.forwardRef((props, forwardedRef) => {
|
|
|
14
15
|
loadOptions,
|
|
15
16
|
onUpdateCallback,
|
|
16
17
|
editText,
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
18
|
+
noOptionsMessageFunc = defaultNoOptionsMessage,
|
|
19
|
+
creatable = false,
|
|
20
|
+
readOnly = false,
|
|
21
|
+
disabled = false,
|
|
22
|
+
error = false,
|
|
23
|
+
warning = false,
|
|
22
24
|
onMultiValueClick,
|
|
23
|
-
showMore,
|
|
25
|
+
showMore = false,
|
|
24
26
|
showMoreText = 'Show more',
|
|
25
27
|
displayTotalOnShowMore = true,
|
|
26
|
-
hidden,
|
|
28
|
+
hidden = false,
|
|
27
29
|
...rest
|
|
28
30
|
} = props;
|
|
29
31
|
const [uniqueId] = useState(nanoid());
|
|
@@ -170,25 +172,53 @@ const MultiSelect = React__default.forwardRef((props, forwardedRef) => {
|
|
|
170
172
|
};
|
|
171
173
|
}, [error, warning, displayShowMore, disabled, readOnly, editText, focused, isDarkMode, onMultiValueClick]);
|
|
172
174
|
const innerComponents = {
|
|
173
|
-
Option: optProps =>
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
175
|
+
Option: optProps => jsx(components.Option, {
|
|
176
|
+
...optProps,
|
|
177
|
+
children: jsxs("div", {
|
|
178
|
+
style: {
|
|
179
|
+
display: 'flex',
|
|
180
|
+
justifyContent: 'space-between',
|
|
181
|
+
width: '100%',
|
|
182
|
+
alignItems: 'center'
|
|
183
|
+
},
|
|
184
|
+
children: [jsx("span", {
|
|
185
|
+
children: optProps.label
|
|
186
|
+
}), optProps.isSelected && jsx(DropdownOptionDeleteIcon, {})]
|
|
187
|
+
})
|
|
188
|
+
}),
|
|
189
|
+
MultiValue: mvProps => jsx(MultiValueWrapper, {
|
|
182
190
|
onMouseDown: e => {
|
|
183
191
|
if (onMultiValueClick && !readOnly && !disabled && !e.target.closest('.multi-select__multi-value__remove')) {
|
|
184
192
|
e.stopPropagation();
|
|
185
193
|
onMultiValueClick(mvProps.data);
|
|
186
194
|
}
|
|
187
|
-
}
|
|
188
|
-
|
|
195
|
+
},
|
|
196
|
+
children: jsx(components.MultiValue, {
|
|
197
|
+
...mvProps
|
|
198
|
+
})
|
|
199
|
+
})
|
|
189
200
|
};
|
|
190
201
|
const sharedSelectProps = {
|
|
191
202
|
...rest,
|
|
203
|
+
onFocus: event => {
|
|
204
|
+
setFocused(true);
|
|
205
|
+
rest.onFocus?.(event);
|
|
206
|
+
},
|
|
207
|
+
onBlur: event => {
|
|
208
|
+
setFocused(false);
|
|
209
|
+
rest.onBlur?.(event);
|
|
210
|
+
},
|
|
211
|
+
onChange: (newValue, actionMeta) => {
|
|
212
|
+
setSelected(newValue);
|
|
213
|
+
if (onUpdateCallback) {
|
|
214
|
+
const item = actionMeta.option || actionMeta.removedValue;
|
|
215
|
+
onUpdateCallback(actionMeta.action, item);
|
|
216
|
+
}
|
|
217
|
+
if (actionMeta.action === 'create-option' && loadOptions) {
|
|
218
|
+
setCacheUnique(c => c + 1);
|
|
219
|
+
}
|
|
220
|
+
rest.onChange?.(newValue, actionMeta);
|
|
221
|
+
},
|
|
192
222
|
ref: forwardedRef,
|
|
193
223
|
id: uniqueId,
|
|
194
224
|
classNamePrefix: 'multi-select',
|
|
@@ -202,18 +232,6 @@ const MultiSelect = React__default.forwardRef((props, forwardedRef) => {
|
|
|
202
232
|
closeMenuOnSelect: false,
|
|
203
233
|
hideSelectedOptions: false,
|
|
204
234
|
openMenuOnClick: true,
|
|
205
|
-
onFocus: () => setFocused(true),
|
|
206
|
-
onBlur: () => setFocused(false),
|
|
207
|
-
onChange: (newValue, actionMeta) => {
|
|
208
|
-
setSelected(newValue);
|
|
209
|
-
if (onUpdateCallback) {
|
|
210
|
-
const item = actionMeta.option || actionMeta.removedValue;
|
|
211
|
-
onUpdateCallback(actionMeta.action, item);
|
|
212
|
-
}
|
|
213
|
-
if (actionMeta.action === 'create-option' && loadOptions) {
|
|
214
|
-
setCacheUnique(c => c + 1);
|
|
215
|
-
}
|
|
216
|
-
},
|
|
217
235
|
cacheUniqs: loadOptions ? [cacheUnique] : undefined
|
|
218
236
|
};
|
|
219
237
|
const SelectComponent = useMemo(() => {
|
|
@@ -221,55 +239,27 @@ const MultiSelect = React__default.forwardRef((props, forwardedRef) => {
|
|
|
221
239
|
return creatable ? CreatableMultiSelect : MultiSelect$1;
|
|
222
240
|
}, [loadOptions, creatable]);
|
|
223
241
|
if (hidden) return null;
|
|
224
|
-
return
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
242
|
+
return jsxs(MultiSelectWrapper, {
|
|
243
|
+
children: [label && jsx(Label, {
|
|
244
|
+
htmlFor: uniqueId,
|
|
245
|
+
children: label
|
|
246
|
+
}), jsx(InnerWrapper, {
|
|
247
|
+
children: jsx(SelectComponent, {
|
|
248
|
+
...sharedSelectProps
|
|
249
|
+
})
|
|
250
|
+
}), displayShowMore && jsxs(ShowMoreWrapper, {
|
|
251
|
+
onClick: () => setDisplayShowMore(false),
|
|
252
|
+
children: [jsx(ShowMoreOverlay, {}), jsxs(ShowMoreText, {
|
|
253
|
+
children: [showMoreText, " ", displayTotalOnShowMore && `(${selected.length})`]
|
|
254
|
+
})]
|
|
255
|
+
}), (error || warning) && jsx(ErrorMessage, {
|
|
256
|
+
$error: !!error,
|
|
257
|
+
$warning: !!warning,
|
|
258
|
+
children: error || warning
|
|
259
|
+
})]
|
|
260
|
+
});
|
|
232
261
|
});
|
|
233
262
|
MultiSelect.displayName = 'MultiSelect';
|
|
234
|
-
MultiSelect.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
235
|
-
label: PropTypes.string,
|
|
236
|
-
availableOptions: PropTypes.arrayOf(PropTypes.object),
|
|
237
|
-
selectedOptions: PropTypes.arrayOf(PropTypes.object),
|
|
238
|
-
loadOptions: PropTypes.func,
|
|
239
|
-
loadingMessageFunc: PropTypes.func,
|
|
240
|
-
onUpdateCallback: PropTypes.func,
|
|
241
|
-
editText: PropTypes.string.isRequired,
|
|
242
|
-
creatable: PropTypes.bool,
|
|
243
|
-
createNewOptionMessageFunc: PropTypes.func,
|
|
244
|
-
noOptionsMessageFunc: PropTypes.func,
|
|
245
|
-
onMultiValueClick: PropTypes.func,
|
|
246
|
-
showMore: PropTypes.bool,
|
|
247
|
-
showMoreText: PropTypes.string,
|
|
248
|
-
displayTotalOnShowMore: PropTypes.bool,
|
|
249
|
-
readOnly: PropTypes.bool,
|
|
250
|
-
hidden: PropTypes.bool,
|
|
251
|
-
disabled: PropTypes.bool,
|
|
252
|
-
error: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]),
|
|
253
|
-
warning: PropTypes.oneOfType([PropTypes.bool, PropTypes.string])
|
|
254
|
-
} : {};
|
|
255
|
-
MultiSelect.defaultProps = {
|
|
256
|
-
noOptionsMessageFunc: inputValue => {
|
|
257
|
-
if (inputValue) {
|
|
258
|
-
return `No matches for "${inputValue}"`;
|
|
259
|
-
} else {
|
|
260
|
-
return 'No available options';
|
|
261
|
-
}
|
|
262
|
-
},
|
|
263
|
-
showMore: false,
|
|
264
|
-
displayTotalOnShowMore: true,
|
|
265
|
-
readOnly: false,
|
|
266
|
-
disabled: false,
|
|
267
|
-
creatable: false,
|
|
268
|
-
error: false,
|
|
269
|
-
warning: false,
|
|
270
|
-
showMoreText: 'Show more',
|
|
271
|
-
hidden: false
|
|
272
|
-
};
|
|
273
263
|
|
|
274
264
|
export { MultiSelect as default };
|
|
275
265
|
//# sourceMappingURL=MultiSelect.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MultiSelect.js","sources":["../../../src/components/inputs/MultiSelect/MultiSelect.js"],"sourcesContent":["import React, { useState, useEffect, useMemo } from 'react';\nimport PropTypes from 'prop-types';\n\nimport { nanoid } from 'nanoid';\nimport { components } from 'react-select';\nimport { colors } from '../../../styles/utils/colors-export';\nimport * as S from './MultiSelect.styled';\n\n/**\n * Multi-select with autocomplete and support for asynchronous fetching/filtering of\n * available options with pagination, update handling with callback,\n * and the ability for the end-user to create new options.\n *\n * The component uses [react-select](https://react-select.com/) for the main select functionality,\n * with [react-select-async-paginate](https://www.npmjs.com/package/react-select-async-paginate) for pagination.\n *\n *\n * <br />### Import\n *\n * ``` js\n * import { MultiSelect } from '@ntbjs/react-components/inputs'\n * // or\n * import MultiSelect from '@ntbjs/react-components/inputs/MultiSelect'\n * ```\n *\n * <br />## Option `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 * The `label` is what will visible to the end-user. Whether `value` and `label`\n * should be different will depend on your use-case, but they are not required to.\n *\n *\n * <br />## Update handling\n * Changes from the end-user to the selected/available options can be handled with a callback function\n * passed through the `onUpdateCallback` prop, which is triggered any time the selected values change.\n *\n * The callback function will be passed two arguments:\n * * `action: string`\n * * `updatedOption: object`\n *\n * <br />#### `action`\n * A `string` indicating what kind of update was made.\n *\n * The possible values of `action` are:\n * * `create-option`: an option that didn't exist in the original list of available options were added\n * * `select-option`: an option was selected\n * * `deselect-option`: an option was de-selected by clicking the X in the dropdown menu\n * * `remove-value`: an option was de-selected by clicking the X on the option label/box\n * * `pop-value`: an option was de-selected with backspace\n * * `clear`: all options were de-selected by clicking the clear indicator (not currently in use)\n *\n * <br />#### `updatedOption`\n * Option `object`of the updated option:\n *\n * In addition to the default `value` and `label` keys, an `__isNew__` flag will be present if the option was\n * not part of the original list of available options, i.e. created by the user in the current \"session\".\n * This is the case regardless of whether the list is provided through `availableOptions` or\n * asynchronously through `loadOptions`.\n *\n *\n * <br />## Asynchronous fetching/filtering with pagination\n * The list of available options can be fetched and filtered asynchronously with a `Promise`\n * passed through the `loadOptions` prop.\n *\n * It will be passed two arguments:\n *\n * * `inputValue: string`: current input value/search\n * * `prevOptions: Array`: previously loaded options for the current search\n *\n * The function is triggered and the first page is fetched when the dropdown menu opens.\n * Whenever the user scrolls down to the bottom of the list, `loadOptions` will\n * be triggered again to fetch the next page.\n *\n * The `Promise` should return an `object` with the following keys:\n *\n * ``` js\n * {\n * options: Array,\n * hasMore: boolean\n * }\n * ```\n *\n * `options` should contain the current page of options. It will be concatenated to the previous\n * set of options automatically. The `hasMore` flag indicates whether there is another page to be fetched.\n *\n * **Example:**\n *\n * ``` js\n *\n * const availableOptions = [\n * { value: \"Example 1\", label: \"Example 1\" },\n * ...\n * { value: \"Example N\", label: \"Example N\" }\n * ];\n *\n * const filterOptions = inputValue => {\n * return availableOptions.filter(option => {\n * return option.label.toLowerCase().includes(inputValue.toLowerCase());\n * });\n * };\n *\n * const loadOptionsFunc = (inputValue, prevOptions) => {\n * const currentLength = prevOptions.length;\n * const pageLength = 10;\n *\n * let filteredOptions;\n *\n * if (inputValue) {\n * filteredOptions = filterOptions(inputValue);\n * } else {\n * filteredOptions = availableOptions;\n * }\n *\n * const hasMore = filteredOptions.length > currentLength + pageLength;\n * const slicedOptions = filteredOptions.slice(currentLength, currentLength + pageLength);\n *\n * return {\n * options: slicedOptions,\n * hasMore\n * };\n * };\n *\n * const loadOptions = (inputValue, prevOptions) => {\n * return new Promise(resolve => {\n * resolve(loadOptionsFunc(inputValue, prevOptions));\n * });\n * };\n * ```\n *\n * While waiting for the `Promise` to resolve, the component will be in a loading state.\n * The loading state is showcased in the \"Primary With Fetching Timeout\" Story.\n *\n * <br />#### Without asynchronous fetching/filtering\n * If you wish to not use asynchronous fetching/filtering, leave the `loadOptions` prop undefined\n * and pass the `Array` of all available options to the `availableOptions` prop instead.\n * The component will use the built-in filtering on `label` from `react-select`, and the options\n * will not be paginated.\n *\n *\n * <br />## \"Show more\" overlay\n * The \"Show more\" overlay must be set manually with the `showMore` prop.\n *\n * By default, the total number\n * of selected options will be displayed in parenthesis after the \"Show more\" text. This can be\n * disabled with the `displayTotalOnShowMore` prop.\n *\n * **Note:**\n * <br />The component has been given a max-width in these Stories.\n * This is because the \"Show more\" overlay does not work well visually when there are\n * fewer than three rows of selected options. The component itself does not have\n * a max-width, so keep this in mind when using it.\n *\n * <br />\n */\n\nconst showMoreHeight = 114;\n\nconst MultiSelect = React.forwardRef((props, forwardedRef) => {\n const {\n label,\n selectedOptions = [],\n availableOptions,\n loadOptions,\n onUpdateCallback,\n editText,\n creatable,\n readOnly,\n disabled,\n error,\n warning,\n onMultiValueClick,\n showMore,\n showMoreText = 'Show more',\n displayTotalOnShowMore = true,\n hidden,\n ...rest\n } = props;\n\n const [uniqueId] = useState(nanoid());\n const [selected, setSelected] = useState(selectedOptions);\n const [cacheUnique, setCacheUnique] = useState(0);\n const [displayShowMore, setDisplayShowMore] = useState(showMore && !error && !warning);\n const [focused, setFocused] = useState(false);\n\n // Track theme changes by checking the DOM\n const [isDarkMode, setIsDarkMode] = useState(() =>\n document.body.classList.contains('dark-theme')\n );\n\n useEffect(() => setSelected(selectedOptions), [selectedOptions]);\n\n useEffect(() => {\n const observer = new MutationObserver(() => {\n setIsDarkMode(document.body.classList.contains('dark-theme'));\n });\n\n observer.observe(document.body, {\n attributes: true,\n attributeFilter: ['class']\n });\n\n return () => observer.disconnect();\n }, []);\n\n /**\n * Custom styles for react-select components using the Styles API.\n *\n * Note: We use inline styles via the `styles` prop instead of styled-components\n * because styled-components clash with the latest react-select version.\n * See: https://react-select.com/styles\n *\n * Theme handling:\n * - Colors are imported from colors-export.js (single source of truth)\n * - Theme detection uses MutationObserver to watch body class changes\n * - Supports both explicit themes (dark-theme/light-theme classes) and\n * system preference (prefers-color-scheme media query)\n *\n * The getThemeColor helper function returns actual hex color values based on\n * the current theme mode (dark/light), ensuring proper theme switching without\n * requiring a styled-components ThemeProvider context.\n */\n\n const selectStyles = useMemo(() => {\n const getThemeColor = (darkKey, lightKey) => {\n const prefersDark =\n !document.body.classList.contains('light-theme') &&\n !document.body.classList.contains('dark-theme') &&\n window.matchMedia('(prefers-color-scheme: dark)').matches;\n\n const key = isDarkMode || prefersDark ? darkKey : lightKey;\n return colors[key] || colors['gray-500']; // Return actual hex color\n };\n\n const errorColor = colors['red-500'];\n const warningColor = colors['orange-500'];\n\n const menuBg = getThemeColor('gray-600', 'white');\n const textColor = getThemeColor('gray-100', 'gray-900');\n const placeholderColor = getThemeColor('gray-400', 'gray-500');\n const multiValueBg = getThemeColor('gray-600', 'gray-800');\n\n return {\n control: base => ({\n ...base,\n alignItems: 'center',\n background: 'transparent',\n border: error ? `1px solid ${errorColor}` : warning ? `1px solid ${warningColor}` : 'none',\n borderRadius: '3px',\n boxShadow: 'none',\n minHeight: '38px',\n opacity: disabled ? 0.5 : 1,\n pointerEvents: 'auto',\n '&:hover': {\n border: error ? `1px solid ${errorColor}` : warning ? `1px solid ${warningColor}` : 'none'\n }\n }),\n valueContainer: base => ({\n ...base,\n alignItems: 'center',\n gap: '8px',\n padding: '0 8px',\n maxHeight: displayShowMore\n ? error || warning\n ? '100%'\n : `${showMoreHeight + 16}px`\n : '100%',\n overflow: 'hidden'\n }),\n multiValue: base => ({\n ...base,\n backgroundColor: multiValueBg,\n borderRadius: '3px',\n margin: '0',\n display: 'flex',\n alignItems: 'stretch',\n minHeight: '26px',\n overflow: 'hidden',\n opacity: disabled ? 0.7 : 1\n }),\n multiValueLabel: base => ({\n ...base,\n color: colors['white'],\n fontSize: '12px',\n padding: disabled || readOnly ? '0 8px' : '0 3px 0 8px',\n display: 'flex',\n alignItems: 'center',\n cursor: disabled ? 'not-allowed' : readOnly ? 'default' : 'pointer'\n }),\n multiValueRemove: base => ({\n ...base,\n color: 'white',\n padding: '0 8px 0 5px',\n display: disabled || readOnly ? 'none' : 'flex',\n alignItems: 'center',\n alignSelf: 'stretch',\n borderRadius: '0',\n cursor: 'pointer',\n '&:hover': {\n backgroundColor: errorColor,\n color: 'white'\n }\n }),\n menu: base => ({\n ...base,\n backgroundColor: menuBg,\n boxShadow: '0 4px 12px rgba(0,0,0,0.5)',\n zIndex: 999,\n marginTop: '4px',\n border: `1px solid ${getThemeColor('gray-500', 'gray-300')}`\n }),\n menuList: base => ({\n ...base,\n backgroundColor: 'transparent',\n padding: 0\n }),\n option: (base, state) => ({\n ...base,\n backgroundColor: state.isFocused ? getThemeColor('gray-500', 'gray-100') : 'transparent',\n color: textColor,\n cursor: 'pointer',\n fontSize: '14px',\n padding: '8px 12px',\n ':active': {\n backgroundColor: getThemeColor('gray-400', 'gray-200')\n }\n }),\n input: (base, state) => ({\n ...base,\n display: 'inline-grid',\n whiteSpace: 'nowrap',\n color: textColor,\n margin: 0,\n padding: 0,\n ':before':\n !focused && editText && !state.value\n ? {\n content: `\"${editText}\"`,\n color: placeholderColor,\n marginRight: '8px',\n lineHeight: '26px',\n gridArea: '1 / 1'\n }\n : {}\n }),\n noOptionsMessage: base => ({ ...base, color: textColor, backgroundColor: 'transparent' }),\n loadingMessage: base => ({ ...base, color: textColor, backgroundColor: 'transparent' }),\n placeholder: () => ({ display: 'none' }),\n indicatorsContainer: () => ({ display: 'none' })\n };\n }, [\n error,\n warning,\n displayShowMore,\n disabled,\n readOnly,\n editText,\n focused,\n isDarkMode,\n onMultiValueClick\n ]);\n\n const innerComponents = {\n Option: optProps => (\n <components.Option {...optProps}>\n <div\n style={{\n display: 'flex',\n justifyContent: 'space-between',\n width: '100%',\n alignItems: 'center'\n }}\n >\n <span>{optProps.label}</span>\n {optProps.isSelected && <S.DropdownOptionDeleteIcon />}\n </div>\n </components.Option>\n ),\n MultiValue: mvProps => (\n <S.MultiValueWrapper\n onMouseDown={e => {\n if (\n onMultiValueClick &&\n !readOnly &&\n !disabled &&\n !e.target.closest('.multi-select__multi-value__remove')\n ) {\n e.stopPropagation();\n onMultiValueClick(mvProps.data);\n }\n }}\n >\n <components.MultiValue {...mvProps} />\n </S.MultiValueWrapper>\n )\n };\n\n const sharedSelectProps = {\n ...rest,\n ref: forwardedRef,\n id: uniqueId,\n classNamePrefix: 'multi-select',\n styles: selectStyles,\n components: innerComponents,\n value: selected,\n options: loadOptions ? undefined : availableOptions,\n loadOptions,\n isMulti: true,\n isDisabled: disabled || readOnly,\n closeMenuOnSelect: false,\n hideSelectedOptions: false,\n openMenuOnClick: true,\n onFocus: () => setFocused(true),\n onBlur: () => setFocused(false),\n onChange: (newValue, actionMeta) => {\n setSelected(newValue);\n if (onUpdateCallback) {\n const item = actionMeta.option || actionMeta.removedValue;\n onUpdateCallback(actionMeta.action, item);\n }\n if (actionMeta.action === 'create-option' && loadOptions) {\n setCacheUnique(c => c + 1);\n }\n },\n cacheUniqs: loadOptions ? [cacheUnique] : undefined\n };\n\n const SelectComponent = useMemo(() => {\n if (loadOptions) return creatable ? S.AsyncCreatableMultiSelect : S.AsyncMultiSelect;\n return creatable ? S.CreatableMultiSelect : S.MultiSelect;\n }, [loadOptions, creatable]);\n\n if (hidden) return null;\n\n return (\n <S.MultiSelectWrapper>\n {label && <S.Label htmlFor={uniqueId}>{label}</S.Label>}\n <S.InnerWrapper>\n <SelectComponent {...sharedSelectProps} />\n </S.InnerWrapper>\n {displayShowMore && (\n <S.ShowMoreWrapper onClick={() => setDisplayShowMore(false)}>\n <S.ShowMoreOverlay />\n <S.ShowMoreText>\n {showMoreText} {displayTotalOnShowMore && `(${selected.length})`}\n </S.ShowMoreText>\n </S.ShowMoreWrapper>\n )}\n {(error || warning) && (\n <S.ErrorMessage $error={!!error} $warning={!!warning}>\n {error || warning}\n </S.ErrorMessage>\n )}\n </S.MultiSelectWrapper>\n );\n});\n\nMultiSelect.displayName = 'MultiSelect';\n\nMultiSelect.propTypes = {\n /**\n *\n * The label of the input field – leave `undefined` to hide the label\n */\n label: PropTypes.string,\n /**\n * `Array` of `objects` containing the default options. 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 /**\n * `Array` of `objects` containing the selected options.\n */\n selectedOptions: PropTypes.arrayOf(PropTypes.object),\n\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 /**\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 * Callback function for sending updates to the backend whenever the selected values are updated.\n * See [Update handling](#update-handling) for details.\n */\n onUpdateCallback: PropTypes.func,\n\n /**\n * Text to be displayed on the input element when the component\n * is enabled and not focused – e.g. \"Add a keyword...\"\n */\n editText: PropTypes.string.isRequired,\n\n /**\n * Whether the user can create new options.\n */\n creatable: PropTypes.bool,\n\n /**\n * Callback function for formatting the message displayed in the dropdown when there\n * are no matching options, and the user has permission to create new options.\n * The callback function will be given the current input value as an argument.\n */\n createNewOptionMessageFunc: PropTypes.func,\n\n /**\n * If the list of options is empty, or if the current input value doesn't match\n * any of the available options and the user doesn't have permission to add options,\n * this function will be called and passed the current input value as an argument.\n */\n noOptionsMessageFunc: PropTypes.func,\n\n /**\n * Optional callback function to be trigger when clicking a selected option's label – e.g. opening\n * a search filtered on the given multi-value's `label`.\n *\n * The callback function will be passed the option `object` as an argument.\n */\n onMultiValueClick: PropTypes.func,\n\n /**\n * Display an overlay which the user needs to click in order to\n * show the selected options list in its entirety and edit it.\n */\n showMore: PropTypes.bool,\n\n /**\n * Text displayed on the \"Show more\" overlay.\n */\n showMoreText: PropTypes.string,\n\n /**\n * Whether to display the total number of selected options after the show more text.\n */\n displayTotalOnShowMore: PropTypes.bool,\n\n /**\n * Whether the multi-select should be displayed in read-only mode.\n * The user can still click the selected options to trigger their on-click effect.\n */\n readOnly: PropTypes.bool,\n /**\n * Whether the component is hidden or visible.\n */\n hidden: PropTypes.bool,\n\n /**\n * Whether the multi-select should be disabled.\n * The user will not be able to trigger the on-click effect of the selected options.\n */\n disabled: PropTypes.bool,\n\n /**\n * Set to `true` to display a red border indicating an error.\n * Pass in a `string` instead to also show the string underneath the input field.\n *\n * **Note:**\n * <br />This overrides the \"Show more\" overlay. Errors will be prioritized over warnings.\n */\n error: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]),\n\n /**\n * Set to `true` to display an orange border.\n * Pass in a `string` instead to also show the string underneath the input field.\n *\n * **Note:**\n * <br />This overrides the \"Show more\" overlay. Errors will be prioritized over warnings.\n */\n warning: PropTypes.oneOfType([PropTypes.bool, PropTypes.string])\n};\n\nMultiSelect.defaultProps = {\n noOptionsMessageFunc: inputValue => {\n if (inputValue) {\n return `No matches for \"${inputValue}\"`;\n } else {\n return 'No available options';\n }\n },\n showMore: false,\n displayTotalOnShowMore: true,\n readOnly: false,\n disabled: false,\n creatable: false,\n error: false,\n warning: false,\n showMoreText: 'Show more',\n hidden: false\n};\n\nexport default MultiSelect;\n"],"names":["showMoreHeight","MultiSelect","React","forwardRef","props","forwardedRef","label","selectedOptions","availableOptions","loadOptions","onUpdateCallback","editText","creatable","readOnly","disabled","error","warning","onMultiValueClick","showMore","showMoreText","displayTotalOnShowMore","hidden","rest","uniqueId","useState","nanoid","selected","setSelected","cacheUnique","setCacheUnique","displayShowMore","setDisplayShowMore","focused","setFocused","isDarkMode","setIsDarkMode","document","body","classList","contains","useEffect","observer","MutationObserver","observe","attributes","attributeFilter","disconnect","selectStyles","useMemo","getThemeColor","darkKey","lightKey","prefersDark","window","matchMedia","matches","key","colors","errorColor","warningColor","menuBg","textColor","placeholderColor","multiValueBg","control","base","alignItems","background","border","borderRadius","boxShadow","minHeight","opacity","pointerEvents","valueContainer","gap","padding","maxHeight","overflow","multiValue","backgroundColor","margin","display","multiValueLabel","color","fontSize","cursor","multiValueRemove","alignSelf","menu","zIndex","marginTop","menuList","option","state","isFocused","input","whiteSpace","value","content","marginRight","lineHeight","gridArea","noOptionsMessage","loadingMessage","placeholder","indicatorsContainer","innerComponents","Option","optProps","createElement","components","style","justifyContent","width","isSelected","S","MultiValue","mvProps","onMouseDown","e","target","closest","stopPropagation","data","sharedSelectProps","ref","id","classNamePrefix","styles","options","undefined","isMulti","isDisabled","closeMenuOnSelect","hideSelectedOptions","openMenuOnClick","onFocus","onBlur","onChange","newValue","actionMeta","item","removedValue","action","c","cacheUniqs","SelectComponent","htmlFor","onClick","length","$error","$warning","displayName","propTypes","process","env","NODE_ENV","PropTypes","string","arrayOf","object","func","loadingMessageFunc","isRequired","bool","createNewOptionMessageFunc","noOptionsMessageFunc","oneOfType","defaultProps","inputValue"],"mappings":";;;;;;;AAkKA,MAAMA,cAAc,GAAG,GAAG,CAAA;AAEpBC,MAAAA,WAAW,GAAGC,cAAK,CAACC,UAAU,CAAC,CAACC,KAAK,EAAEC,YAAY,KAAK;EAC5D,MAAM;IACJC,KAAK;AACLC,IAAAA,eAAe,GAAG,EAAE;IACpBC,gBAAgB;IAChBC,WAAW;IACXC,gBAAgB;IAChBC,QAAQ;IACRC,SAAS;IACTC,QAAQ;IACRC,QAAQ;IACRC,KAAK;IACLC,OAAO;IACPC,iBAAiB;IACjBC,QAAQ;AACRC,IAAAA,YAAY,GAAG,WAAW;AAC1BC,IAAAA,sBAAsB,GAAG,IAAI;IAC7BC,MAAM;IACN,GAAGC,IAAAA;AACL,GAAC,GAAGlB,KAAK,CAAA;EAET,MAAM,CAACmB,QAAQ,CAAC,GAAGC,QAAQ,CAACC,MAAM,EAAE,CAAC,CAAA;EACrC,MAAM,CAACC,QAAQ,EAAEC,WAAW,CAAC,GAAGH,QAAQ,CAACjB,eAAe,CAAC,CAAA;EACzD,MAAM,CAACqB,WAAW,EAAEC,cAAc,CAAC,GAAGL,QAAQ,CAAC,CAAC,CAAC,CAAA;AACjD,EAAA,MAAM,CAACM,eAAe,EAAEC,kBAAkB,CAAC,GAAGP,QAAQ,CAACN,QAAQ,IAAI,CAACH,KAAK,IAAI,CAACC,OAAO,CAAC,CAAA;EACtF,MAAM,CAACgB,OAAO,EAAEC,UAAU,CAAC,GAAGT,QAAQ,CAAC,KAAK,CAAC,CAAA;AAG7C,EAAA,MAAM,CAACU,UAAU,EAAEC,aAAa,CAAC,GAAGX,QAAQ,CAAC,MAC3CY,QAAQ,CAACC,IAAI,CAACC,SAAS,CAACC,QAAQ,CAAC,YAAY,CAC/C,CAAC,CAAA;EAEDC,SAAS,CAAC,MAAMb,WAAW,CAAC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BAAiB,EAAE6I,SAAS,CAACI,IAAI;EAMjChJ,QAAQ,EAAE4I,SAAS,CAACO,IAAI;EAKxBlJ,YAAY,EAAE2I,SAAS,CAACC,MAAM;EAK9B3I,sBAAsB,EAAE0I,SAAS,CAACO,IAAI;EAMtCxJ,QAAQ,EAAEiJ,SAAS,CAACO,IAAI;EAIxBhJ,MAAM,EAAEyI,SAAS,CAACO,IAAI;EAMtBvJ,QAAQ,EAAEgJ,SAAS,CAACO,IAAI;AASxBtJ,EAAAA,KAAK,EAAE+I,SAAS,CAACU,SAAS,CAAC,CAACV,SAAS,CAACO,IAAI,EAAEP,SAAS,CAACC,MAAM,CAAC,CAAC;AAS9D/I,EAAAA,OAAO,EAAE8I,SAAS,CAACU,SAAS,CAAC,CAACV,SAAS,CAACO,IAAI,EAAEP,SAAS,CAACC,MAAM,CAAC,CAAA;AACjE,CAAC,GAAA,EAAA,CAAA;AAED9J,WAAW,CAACwK,YAAY,GAAG;EACzBF,oBAAoB,EAAEG,UAAU,IAAI;AAClC,IAAA,IAAIA,UAAU,EAAE;MACd,OAAO,CAAA,gBAAA,EAAmBA,UAAU,CAAG,CAAA,CAAA,CAAA;AACzC,KAAC,MAAM;AACL,MAAA,OAAO,sBAAsB,CAAA;AAC/B,KAAA;GACD;AACDxJ,EAAAA,QAAQ,EAAE,KAAK;AACfE,EAAAA,sBAAsB,EAAE,IAAI;AAC5BP,EAAAA,QAAQ,EAAE,KAAK;AACfC,EAAAA,QAAQ,EAAE,KAAK;AACfF,EAAAA,SAAS,EAAE,KAAK;AAChBG,EAAAA,KAAK,EAAE,KAAK;AACZC,EAAAA,OAAO,EAAE,KAAK;AACdG,EAAAA,YAAY,EAAE,WAAW;AACzBE,EAAAA,MAAM,EAAE,KAAA;AACV,CAAC;;;;"}
|
|
1
|
+
{"version":3,"file":"MultiSelect.js","sources":["../../../src/components/inputs/MultiSelect/MultiSelect.tsx"],"sourcesContent":["import React, { useState, useEffect, useMemo } from 'react';\n\nimport { nanoid } from 'nanoid';\nimport { components } from 'react-select';\nimport { colors } from '../../../styles/utils/colors-export';\nimport * as S from './MultiSelect.styled';\n\n/**\n * Multi-select with autocomplete and support for asynchronous fetching/filtering of\n * available options with pagination, update handling with callback,\n * and the ability for the end-user to create new options.\n *\n * The component uses [react-select](https://react-select.com/) for the main select functionality,\n * with [react-select-async-paginate](https://www.npmjs.com/package/react-select-async-paginate) for pagination.\n *\n *\n * <br />### Import\n *\n * ``` js\n * import { MultiSelect } from '@ntbjs/react-components/inputs'\n * // or\n * import MultiSelect from '@ntbjs/react-components/inputs/MultiSelect'\n * ```\n *\n * <br />## Option `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 * The `label` is what will visible to the end-user. Whether `value` and `label`\n * should be different will depend on your use-case, but they are not required to.\n *\n *\n * <br />## Update handling\n * Changes from the end-user to the selected/available options can be handled with a callback function\n * passed through the `onUpdateCallback` prop, which is triggered any time the selected values change.\n *\n * The callback function will be passed two arguments:\n * * `action: string`\n * * `updatedOption: object`\n *\n * <br />#### `action`\n * A `string` indicating what kind of update was made.\n *\n * The possible values of `action` are:\n * * `create-option`: an option that didn't exist in the original list of available options were added\n * * `select-option`: an option was selected\n * * `deselect-option`: an option was de-selected by clicking the X in the dropdown menu\n * * `remove-value`: an option was de-selected by clicking the X on the option label/box\n * * `pop-value`: an option was de-selected with backspace\n * * `clear`: all options were de-selected by clicking the clear indicator (not currently in use)\n *\n * <br />#### `updatedOption`\n * Option `object`of the updated option:\n *\n * In addition to the default `value` and `label` keys, an `__isNew__` flag will be present if the option was\n * not part of the original list of available options, i.e. created by the user in the current \"session\".\n * This is the case regardless of whether the list is provided through `availableOptions` or\n * asynchronously through `loadOptions`.\n *\n *\n * <br />## Asynchronous fetching/filtering with pagination\n * The list of available options can be fetched and filtered asynchronously with a `Promise`\n * passed through the `loadOptions` prop.\n *\n * It will be passed two arguments:\n *\n * * `inputValue: string`: current input value/search\n * * `prevOptions: Array`: previously loaded options for the current search\n *\n * The function is triggered and the first page is fetched when the dropdown menu opens.\n * Whenever the user scrolls down to the bottom of the list, `loadOptions` will\n * be triggered again to fetch the next page.\n *\n * The `Promise` should return an `object` with the following keys:\n *\n * ``` js\n * {\n * options: Array,\n * hasMore: boolean\n * }\n * ```\n *\n * `options` should contain the current page of options. It will be concatenated to the previous\n * set of options automatically. The `hasMore` flag indicates whether there is another page to be fetched.\n *\n * **Example:**\n *\n * ``` js\n *\n * const availableOptions = [\n * { value: \"Example 1\", label: \"Example 1\" },\n * ...\n * { value: \"Example N\", label: \"Example N\" }\n * ];\n *\n * const filterOptions = inputValue => {\n * return availableOptions.filter(option => {\n * return option.label.toLowerCase().includes(inputValue.toLowerCase());\n * });\n * };\n *\n * const loadOptionsFunc = (inputValue, prevOptions) => {\n * const currentLength = prevOptions.length;\n * const pageLength = 10;\n *\n * let filteredOptions;\n *\n * if (inputValue) {\n * filteredOptions = filterOptions(inputValue);\n * } else {\n * filteredOptions = availableOptions;\n * }\n *\n * const hasMore = filteredOptions.length > currentLength + pageLength;\n * const slicedOptions = filteredOptions.slice(currentLength, currentLength + pageLength);\n *\n * return {\n * options: slicedOptions,\n * hasMore\n * };\n * };\n *\n * const loadOptions = (inputValue, prevOptions) => {\n * return new Promise(resolve => {\n * resolve(loadOptionsFunc(inputValue, prevOptions));\n * });\n * };\n * ```\n *\n * While waiting for the `Promise` to resolve, the component will be in a loading state.\n * The loading state is showcased in the \"Primary With Fetching Timeout\" Story.\n *\n * <br />#### Without asynchronous fetching/filtering\n * If you wish to not use asynchronous fetching/filtering, leave the `loadOptions` prop undefined\n * and pass the `Array` of all available options to the `availableOptions` prop instead.\n * The component will use the built-in filtering on `label` from `react-select`, and the options\n * will not be paginated.\n *\n *\n * <br />## \"Show more\" overlay\n * The \"Show more\" overlay must be set manually with the `showMore` prop.\n *\n * By default, the total number\n * of selected options will be displayed in parenthesis after the \"Show more\" text. This can be\n * disabled with the `displayTotalOnShowMore` prop.\n *\n * **Note:**\n * <br />The component has been given a max-width in these Stories.\n * This is because the \"Show more\" overlay does not work well visually when there are\n * fewer than three rows of selected options. The component itself does not have\n * a max-width, so keep this in mind when using it.\n *\n * <br />\n */\n\nconst showMoreHeight = 114;\n\nconst defaultNoOptionsMessage = inputValue =>\n inputValue ? `No matches for \"${inputValue}\"` : 'No available options';\n\n/**\n * MultiSelect's OWN props — the 19 members that were the entirety of this component's\n * declared surface until NMB-3998, unchanged. They stay authoritative: `MultiSelectProps`\n * below `Omit`s these keys out of the base before intersecting, so nothing here is\n * narrowed by a colliding member of react-select's props.\n */\nexport type MultiSelectOwnProps = {\n /**\n *\n * The label of the input field – leave `undefined` to hide the label\n */\n label?: string;\n /**\n * `Array` of `objects` containing the default options. 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 * `Array` of `objects` containing the selected options.\n */\n selectedOptions?: 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 * Callback function for sending updates to the backend whenever the selected values are updated.\n * See [Update handling](#update-handling) for details.\n */\n onUpdateCallback?: (...args: any[]) => any;\n /**\n * Text to be displayed on the input element when the component\n * is enabled and not focused – e.g. \"Add a keyword...\"\n */\n editText: string;\n /**\n * Whether the user can create new options.\n */\n creatable?: boolean;\n /**\n * Callback function for formatting the message displayed in the dropdown when there\n * are no matching options, and the user has permission to create new options.\n * The callback function will be given the current input value as an argument.\n */\n createNewOptionMessageFunc?: (...args: any[]) => any;\n /**\n * If the list of options is empty, or if the current input value doesn't match\n * any of the available options and the user doesn't have permission to add options,\n * this function will be called and passed the current input value as an argument.\n */\n noOptionsMessageFunc?: (...args: any[]) => any;\n /**\n * Optional callback function to be trigger when clicking a selected option's label – e.g. opening\n * a search filtered on the given multi-value's `label`.\n *\n * The callback function will be passed the option `object` as an argument.\n */\n onMultiValueClick?: (...args: any[]) => any;\n /**\n * Display an overlay which the user needs to click in order to\n * show the selected options list in its entirety and edit it.\n */\n showMore?: boolean;\n /**\n * Text displayed on the \"Show more\" overlay.\n */\n showMoreText?: string;\n /**\n * Whether to display the total number of selected options after the show more text.\n */\n displayTotalOnShowMore?: boolean;\n /**\n * Whether the multi-select should be displayed in read-only mode.\n * The user can still click the selected options to trigger their on-click effect.\n */\n readOnly?: boolean;\n /**\n * Whether the component is hidden or visible.\n */\n hidden?: boolean;\n /**\n * Whether the multi-select should be disabled.\n * The user will not be able to trigger the on-click effect of the selected options.\n */\n disabled?: boolean;\n /**\n * Set to `true` to display a red border indicating an error.\n * Pass in a `string` instead to also show the string underneath the input field.\n *\n * **Note:**\n * <br />This overrides the \"Show more\" overlay. Errors will be prioritized over warnings.\n */\n error?: boolean | string;\n /**\n * Set to `true` to display an orange border.\n * Pass in a `string` instead to also show the string underneath the input field.\n *\n * **Note:**\n * <br />This overrides the \"Show more\" overlay. Errors will be prioritized over warnings.\n */\n warning?: boolean | string;\n};\n\n/**\n * THE PUBLISHED PROPS TYPE. It has a base, and that is playbook §C.2, not a convenience.\n *\n * This component destructures `...rest` (below) and spreads it into react-select —\n * `sharedSelectProps = { ...rest, … }`, handed to `<SelectComponent {...sharedSelectProps} />`.\n * A closed 19-member type therefore REJECTED props that this component forwards and that\n * work at runtime: measured against mb-main-client, `className`, `name`, `onBlur` and\n * `required` are all real react-select props being passed today and all four were a hard\n * TS2322 the moment the library started shipping `.d.ts`. That is the library lying about\n * its own contract, which is the exact class §C.2 exists to prevent — and it is NOT the\n * same finding as the other 22 rejected consumer attributes, which are props no component\n * here spreads anywhere and which stay rejected on purpose.\n *\n * THE BASE IS READ OFF WHAT `rest` IS ACTUALLY SPREAD ONTO, never assumed. That target is\n * one of the four `styled(<react-select …>)` wrappers, chosen at runtime by `loadOptions`\n * and `creatable`. `S.MultiSelect` — `styled(Select)` — is the deliberate choice among the\n * four: `CreatableSelect`/`AsyncPaginate` add props on top of the plain select's surface,\n * so plain `Select` is the set that is valid in ALL FOUR configurations. Basing this on the\n * async-creatable wrapper instead would admit `debounceTimeout` and friends in the default\n * configuration, where they do nothing — the same mistake in the other direction.\n *\n * `Omit<Base, keyof Own> & Own`, NOT `Base & Own`. An intersection intersects a colliding\n * MEMBER rather than replacing it; measured on `TextArea`, `rows?: number | string` met\n * `styled.textarea`'s `rows?: number` and `rows=\"4\"` became an error — half a published\n * prop silently deleted by the pass meant to widen it. Disjoint pairs collapse to `never`.\n *\n * `ComponentPropsWithoutRef`, NOT `…WithRef`. `React.forwardRef` below supplies `ref`\n * itself; `WithRef` was measured to let `<MultiSelect ref={…} />` compile with the ref\n * silently dropped.\n *\n * BOTH ALIASES ARE `export`ed AND THE `const` BELOW IS ANNOTATED, for declaration emit\n * only — same mechanism and same audit as `CompactAutocompleteSelect` (577fc8d, §G.4.1).\n * tsc prints an exported alias from its source text and EXPANDS an unexported one, and the\n * expansion here reaches react-select's `PublicBaseSelectProps` /\n * `StateManagerAdditionalProps`, which `react-select`'s `exports` map does not serve:\n * TS2883, and with `noEmitOnError: false` that means the `.d.ts` is silently not written.\n * The annotation on the `const` is needed for the same reason — `forwardRef` infers\n * `ForwardRefExoticComponent<PropsWithoutRef<P> & RefAttributes<any>>` and tsc computes\n * `PropsWithoutRef<P>` eagerly, which re-expands what the exported alias just avoided.\n *\n * THE SWALLOW THIS PARAGRAPH USED TO RECORD AS OPEN IS FIXED. `sharedSelectProps` still\n * lists 14 keys after `...rest` and they still win — deliberately, and the reasoning is\n * written out at the literal itself — but `onFocus`, `onBlur` and `onChange` are no longer\n * among them: they now run the component's own logic and then call the caller's handler.\n * So `onBlur`, the one a consumer passes today, is both admitted by this type and actually\n * forwarded. Do not narrow this type to \"reflect\" the remaining 14: they are the runtime\n * form of props this component already declares (`selectedOptions`, `availableOptions`,\n * `disabled`/`readOnly`, `loadOptions`) plus its own rendering and CSS contract, and\n * `Omit`ting them would only stop react-select's own names from being accepted while\n * changing nothing about which value wins.\n */\nexport type MultiSelectProps = Omit<\n React.ComponentPropsWithoutRef<typeof S.MultiSelect>,\n keyof MultiSelectOwnProps\n> &\n MultiSelectOwnProps;\n\nconst MultiSelect: React.ForwardRefExoticComponent<MultiSelectProps & React.RefAttributes<any>> =\n React.forwardRef<any, MultiSelectProps>((props, forwardedRef) => {\n const {\n label,\n selectedOptions = [],\n availableOptions,\n loadOptions,\n onUpdateCallback,\n editText,\n /*\n * DEAD PUBLIC PROP, and this is the narrow directive that records it rather than the\n * file-scope `eslint-disable no-unused-vars` block comment that used to hide it, on\n * line 2, above the imports.\n *\n * `noOptionsMessageFunc` is documented, defaulted, destructured — and then never read.\n * It is NOT the same thing as the `noOptionsMessage` key at ~line 467, which is a\n * react-select STYLE function, not this callback. Compare\n * `CompactAutocompleteSelect`, which has the same prop and genuinely wires it into\n * react-select's `noOptionsMessage`. So this component silently ignores it.\n *\n * Deleting it is an API break and needs its own decision; wiring it up is a behaviour\n * change that the visual gate would have to re-record. Recorded here so that the next\n * reader sees a known finding instead of an unexplained suppression.\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n noOptionsMessageFunc = defaultNoOptionsMessage,\n creatable = false,\n readOnly = false,\n disabled = false,\n error = false,\n warning = false,\n onMultiValueClick,\n showMore = false,\n showMoreText = 'Show more',\n displayTotalOnShowMore = true,\n hidden = false,\n ...rest\n } = props;\n\n const [uniqueId] = useState(nanoid());\n const [selected, setSelected] = useState(selectedOptions);\n const [cacheUnique, setCacheUnique] = useState(0);\n const [displayShowMore, setDisplayShowMore] = useState(showMore && !error && !warning);\n const [focused, setFocused] = useState(false);\n\n // Track theme changes by checking the DOM\n const [isDarkMode, setIsDarkMode] = useState(() =>\n document.body.classList.contains('dark-theme')\n );\n\n useEffect(() => setSelected(selectedOptions), [selectedOptions]);\n\n useEffect(() => {\n const observer = new MutationObserver(() => {\n setIsDarkMode(document.body.classList.contains('dark-theme'));\n });\n\n observer.observe(document.body, {\n attributes: true,\n attributeFilter: ['class']\n });\n\n return () => observer.disconnect();\n }, []);\n\n /**\n * Custom styles for react-select components using the Styles API.\n *\n * Note: We use inline styles via the `styles` prop instead of styled-components\n * because styled-components clash with the latest react-select version.\n * See: https://react-select.com/styles\n *\n * Theme handling:\n * - Colors are imported from colors-export.js (single source of truth)\n * - Theme detection uses MutationObserver to watch body class changes\n * - Supports both explicit themes (dark-theme/light-theme classes) and\n * system preference (prefers-color-scheme media query)\n *\n * The getThemeColor helper function returns actual hex color values based on\n * the current theme mode (dark/light), ensuring proper theme switching without\n * requiring a styled-components ThemeProvider context.\n */\n\n const selectStyles = useMemo(() => {\n const getThemeColor = (darkKey, lightKey) => {\n const prefersDark =\n !document.body.classList.contains('light-theme') &&\n !document.body.classList.contains('dark-theme') &&\n window.matchMedia('(prefers-color-scheme: dark)').matches;\n\n const key = isDarkMode || prefersDark ? darkKey : lightKey;\n return colors[key] || colors['gray-500']; // Return actual hex color\n };\n\n const errorColor = colors['red-500'];\n const warningColor = colors['orange-500'];\n\n const menuBg = getThemeColor('gray-600', 'white');\n const textColor = getThemeColor('gray-100', 'gray-900');\n const placeholderColor = getThemeColor('gray-400', 'gray-500');\n const multiValueBg = getThemeColor('gray-600', 'gray-800');\n\n return {\n control: base => ({\n ...base,\n alignItems: 'center',\n background: 'transparent',\n border: error\n ? `1px solid ${errorColor}`\n : warning\n ? `1px solid ${warningColor}`\n : 'none',\n borderRadius: '3px',\n boxShadow: 'none',\n minHeight: '38px',\n opacity: disabled ? 0.5 : 1,\n pointerEvents: 'auto',\n '&:hover': {\n border: error\n ? `1px solid ${errorColor}`\n : warning\n ? `1px solid ${warningColor}`\n : 'none'\n }\n }),\n valueContainer: base => ({\n ...base,\n alignItems: 'center',\n gap: '8px',\n padding: '0 8px',\n maxHeight: displayShowMore\n ? error || warning\n ? '100%'\n : `${showMoreHeight + 16}px`\n : '100%',\n overflow: 'hidden'\n }),\n multiValue: base => ({\n ...base,\n backgroundColor: multiValueBg,\n borderRadius: '3px',\n margin: '0',\n display: 'flex',\n alignItems: 'stretch',\n minHeight: '26px',\n overflow: 'hidden',\n opacity: disabled ? 0.7 : 1\n }),\n multiValueLabel: base => ({\n ...base,\n color: colors['white'],\n fontSize: '12px',\n padding: disabled || readOnly ? '0 8px' : '0 3px 0 8px',\n display: 'flex',\n alignItems: 'center',\n cursor: disabled ? 'not-allowed' : readOnly ? 'default' : 'pointer'\n }),\n multiValueRemove: base => ({\n ...base,\n color: 'white',\n padding: '0 8px 0 5px',\n display: disabled || readOnly ? 'none' : 'flex',\n alignItems: 'center',\n alignSelf: 'stretch',\n borderRadius: '0',\n cursor: 'pointer',\n '&:hover': {\n backgroundColor: errorColor,\n color: 'white'\n }\n }),\n menu: base => ({\n ...base,\n backgroundColor: menuBg,\n boxShadow: '0 4px 12px rgba(0,0,0,0.5)',\n zIndex: 999,\n marginTop: '4px',\n border: `1px solid ${getThemeColor('gray-500', 'gray-300')}`\n }),\n menuList: base => ({\n ...base,\n backgroundColor: 'transparent',\n padding: 0\n }),\n option: (base, state) => ({\n ...base,\n backgroundColor: state.isFocused ? getThemeColor('gray-500', 'gray-100') : 'transparent',\n color: textColor,\n cursor: 'pointer',\n fontSize: '14px',\n padding: '8px 12px',\n ':active': {\n backgroundColor: getThemeColor('gray-400', 'gray-200')\n }\n }),\n input: (base, state) => ({\n ...base,\n display: 'inline-grid',\n whiteSpace: 'nowrap',\n color: textColor,\n margin: 0,\n padding: 0,\n ':before':\n !focused && editText && !state.value\n ? {\n content: `\"${editText}\"`,\n color: placeholderColor,\n marginRight: '8px',\n lineHeight: '26px',\n gridArea: '1 / 1'\n }\n : {}\n }),\n noOptionsMessage: base => ({ ...base, color: textColor, backgroundColor: 'transparent' }),\n loadingMessage: base => ({ ...base, color: textColor, backgroundColor: 'transparent' }),\n placeholder: () => ({ display: 'none' }),\n indicatorsContainer: () => ({ display: 'none' })\n };\n }, [\n error,\n warning,\n displayShowMore,\n disabled,\n readOnly,\n editText,\n focused,\n isDarkMode,\n onMultiValueClick\n ]);\n\n const innerComponents = {\n Option: optProps => (\n <components.Option {...optProps}>\n <div\n style={{\n display: 'flex',\n justifyContent: 'space-between',\n width: '100%',\n alignItems: 'center'\n }}\n >\n <span>{optProps.label}</span>\n {optProps.isSelected && <S.DropdownOptionDeleteIcon />}\n </div>\n </components.Option>\n ),\n MultiValue: mvProps => (\n <S.MultiValueWrapper\n onMouseDown={e => {\n if (\n onMultiValueClick &&\n !readOnly &&\n !disabled &&\n /*\n * NMB-3998: `e.target` is `EventTarget`, which has no `closest` — TS2339. In a\n * DOM mouse event the target is always an Element, so the narrowing is a fact\n * about the event, not a guess. Type-only assertion; erases to the same call.\n */\n !(e.target as Element).closest('.multi-select__multi-value__remove')\n ) {\n e.stopPropagation();\n onMultiValueClick(mvProps.data);\n }\n }}\n >\n <components.MultiValue {...mvProps} />\n </S.MultiValueWrapper>\n )\n };\n\n /*\n * `...rest` IS SPREAD FIRST, SO EVERY KEY BELOW IT WINS OVER THE CALLER. That was a\n * silent swallow for `onFocus`/`onBlur`/`onChange` until NMB-3998, and the three\n * groups below are ordered deliberately. Do not flatten this back into one list.\n *\n * GROUP 1 — COMPOSED. The component has internal behaviour on all three (focus state,\n * selection state), so it can neither defer to the caller nor drop them: each key\n * runs the component's own logic and THEN calls the caller's handler, with the\n * arguments react-select passed. Measured on the pre-fix literal with a TS AST walk,\n * not eyeballed: `...rest` was element 1 of 18 and `onBlur` element 16, so\n * `mb-main-client/src/components/misc_settings/search_settings.tsx:86` — an `onBlur`\n * out of a react-hook-form `Controller` render prop — had never fired, which\n * silently disabled `mode: 'onBlur'` validation and `touched` at that call site.\n * The handlers are read off `rest` rather than destructured so that the props type\n * keeps describing them as forwarded, which they now genuinely are.\n *\n * GROUP 2 — COMPONENT-OWNED, AND THEY MUST STAY LAST. A caller value for any of\n * these breaks the component's own rendering or its CSS contract, so being overwritten\n * is the correct behaviour and NOT the bug that was fixed here:\n * ref/id `id` is a `nanoid()` and `S.Label`'s `htmlFor` points at it\n * classNamePrefix 'multi-select' is what `MultiSelect.styled.ts`'s selectors and\n * `MultiValueWrapper`'s `.multi-select__multi-value__remove` test target\n * styles the whole themed Styles API object built above\n * components `innerComponents`, which is what wires `onMultiValueClick`\n * isMulti the component IS the multi variant; `false` would strip the chips\n * value/options/isDisabled/cacheUniqs and the three menu booleans are derived from\n * the declared props above (`selectedOptions`, `availableOptions`,\n * `disabled || readOnly`, `loadOptions`) and are named differently\n * from them, so a caller CAN put them in `rest` — verified, they are\n * not destructured — and the component still has to win: they are\n * the runtime form of props it already declares. Only `loadOptions`\n * is structurally safe here, because it is destructured by that name.\n */\n const sharedSelectProps = {\n ...rest,\n\n /* Group 1 — composed: component first, then the caller's handler. */\n onFocus: event => {\n setFocused(true);\n rest.onFocus?.(event);\n },\n onBlur: event => {\n setFocused(false);\n rest.onBlur?.(event);\n },\n onChange: (newValue, actionMeta) => {\n setSelected(newValue);\n if (onUpdateCallback) {\n const item = actionMeta.option || actionMeta.removedValue;\n onUpdateCallback(actionMeta.action, item);\n }\n if (actionMeta.action === 'create-option' && loadOptions) {\n setCacheUnique(c => c + 1);\n }\n rest.onChange?.(newValue, actionMeta);\n },\n\n /* Group 2 — component-owned. Keep last; see the comment above. */\n ref: forwardedRef,\n id: uniqueId,\n classNamePrefix: 'multi-select',\n styles: selectStyles,\n components: innerComponents,\n value: selected,\n options: loadOptions ? undefined : availableOptions,\n loadOptions,\n isMulti: true,\n isDisabled: disabled || readOnly,\n closeMenuOnSelect: false,\n hideSelectedOptions: false,\n openMenuOnClick: true,\n cacheUniqs: loadOptions ? [cacheUnique] : undefined\n };\n\n const SelectComponent = useMemo(() => {\n if (loadOptions) return creatable ? S.AsyncCreatableMultiSelect : S.AsyncMultiSelect;\n return creatable ? S.CreatableMultiSelect : S.MultiSelect;\n }, [loadOptions, creatable]);\n\n if (hidden) return null;\n\n return (\n <S.MultiSelectWrapper>\n {label && <S.Label htmlFor={uniqueId}>{label}</S.Label>}\n <S.InnerWrapper>\n <SelectComponent {...sharedSelectProps} />\n </S.InnerWrapper>\n {displayShowMore && (\n <S.ShowMoreWrapper onClick={() => setDisplayShowMore(false)}>\n <S.ShowMoreOverlay />\n <S.ShowMoreText>\n {showMoreText} {displayTotalOnShowMore && `(${selected.length})`}\n </S.ShowMoreText>\n </S.ShowMoreWrapper>\n )}\n {(error || warning) && (\n <S.ErrorMessage $error={!!error} $warning={!!warning}>\n {error || warning}\n </S.ErrorMessage>\n )}\n </S.MultiSelectWrapper>\n );\n });\n\nMultiSelect.displayName = 'MultiSelect';\n\nexport default MultiSelect;\n"],"names":["showMoreHeight","defaultNoOptionsMessage","inputValue","MultiSelect","React","forwardRef","props","forwardedRef","label","selectedOptions","availableOptions","loadOptions","onUpdateCallback","editText","noOptionsMessageFunc","creatable","readOnly","disabled","error","warning","onMultiValueClick","showMore","showMoreText","displayTotalOnShowMore","hidden","rest","uniqueId","useState","nanoid","selected","setSelected","cacheUnique","setCacheUnique","displayShowMore","setDisplayShowMore","focused","setFocused","isDarkMode","setIsDarkMode","document","body","classList","contains","useEffect","observer","MutationObserver","observe","attributes","attributeFilter","disconnect","selectStyles","useMemo","getThemeColor","darkKey","lightKey","prefersDark","window","matchMedia","matches","key","colors","errorColor","warningColor","menuBg","textColor","placeholderColor","multiValueBg","control","base","alignItems","background","border","borderRadius","boxShadow","minHeight","opacity","pointerEvents","valueContainer","gap","padding","maxHeight","overflow","multiValue","backgroundColor","margin","display","multiValueLabel","color","fontSize","cursor","multiValueRemove","alignSelf","menu","zIndex","marginTop","menuList","option","state","isFocused","input","whiteSpace","value","content","marginRight","lineHeight","gridArea","noOptionsMessage","loadingMessage","placeholder","indicatorsContainer","innerComponents","Option","optProps","_jsx","components","children","_jsxs","style","justifyContent","width","isSelected","S","MultiValue","mvProps","onMouseDown","e","target","closest","stopPropagation","data","sharedSelectProps","onFocus","event","onBlur","onChange","newValue","actionMeta","item","removedValue","action","c","ref","id","classNamePrefix","styles","options","undefined","isMulti","isDisabled","closeMenuOnSelect","hideSelectedOptions","openMenuOnClick","cacheUniqs","SelectComponent","htmlFor","onClick","length","$error","$warning","displayName"],"mappings":";;;;;;;AAiKA,MAAMA,cAAc,GAAG,GAAG;AAE1B,MAAMC,uBAAuB,GAAGC,UAAU,IACxCA,UAAU,GAAG,CAAA,gBAAA,EAAmBA,UAAU,CAAA,CAAA,CAAG,GAAG,sBAAsB;AAgLxE,MAAMC,WAAyF,GAC7FC,cAAK,CAACC,UAAU,CAAwB,CAACC,KAAK,EAAEC,YAAY,KAAK;EAC/D,MAAM;IACJC,KAAK;AACLC,IAAAA,eAAe,GAAG,EAAE;IACpBC,gBAAgB;IAChBC,WAAW;IACXC,gBAAgB;IAChBC,QAAQ;AAiBRC,IAAAA,oBAAoB,GAAGb,uBAAuB;AAC9Cc,IAAAA,SAAS,GAAG,KAAK;AACjBC,IAAAA,QAAQ,GAAG,KAAK;AAChBC,IAAAA,QAAQ,GAAG,KAAK;AAChBC,IAAAA,KAAK,GAAG,KAAK;AACbC,IAAAA,OAAO,GAAG,KAAK;IACfC,iBAAiB;AACjBC,IAAAA,QAAQ,GAAG,KAAK;AAChBC,IAAAA,YAAY,GAAG,WAAW;AAC1BC,IAAAA,sBAAsB,GAAG,IAAI;AAC7BC,IAAAA,MAAM,GAAG,KAAK;IACd,GAAGC;AACL,GAAC,GAAGnB,KAAK;EAET,MAAM,CAACoB,QAAQ,CAAC,GAAGC,QAAQ,CAACC,MAAM,EAAE,CAAC;EACrC,MAAM,CAACC,QAAQ,EAAEC,WAAW,CAAC,GAAGH,QAAQ,CAAClB,eAAe,CAAC;EACzD,MAAM,CAACsB,WAAW,EAAEC,cAAc,CAAC,GAAGL,Q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IAAI;AAEvB,EAAA,OACE4F,IAAA,CAACK,kBAAoB,EAAA;AAAAN,IAAAA,QAAA,GAClB3G,KAAK,IAAIyG,GAAA,CAACQ,KAAO,EAAA;AAACiC,MAAAA,OAAO,EAAEhI,QAAS;AAAAyF,MAAAA,QAAA,EAAE3G;AAAK,KAAU,CAAC,EACvDyG,GAAA,CAACQ,YAAc,EAAA;MAAAN,QAAA,EACbF,GAAA,CAACwC,eAAe,EAAA;QAAA,GAAKvB;OAAoB;KAC3B,CAAC,EAChBjG,eAAe,IACdmF,IAAA,CAACK,eAAiB,EAAA;AAACkC,MAAAA,OAAO,EAAEA,MAAMzH,kBAAkB,CAAC,KAAK,CAAE;AAAAiF,MAAAA,QAAA,EAAA,CAC1DF,GAAA,CAACQ,eAAiB,EAAA,EAAE,CAAC,EACrBL,IAAA,CAACK,YAAc,EAAA;QAAAN,QAAA,EAAA,CACZ7F,YAAY,EAAC,GAAC,EAACC,sBAAsB,IAAI,CAAA,CAAA,EAAIM,QAAQ,CAAC+H,MAAM,CAAA,CAAA,CAAG;AAAA,OAClD,CAAC;KACA,CACpB,EACA,CAAC1I,KAAK,IAAIC,OAAO,KAChB8F,GAAA,CAACQ,YAAc,EAAA;MAACoC,MAAM,EAAE,CAAC,CAAC3I,KAAM;MAAC4I,QAAQ,EAAE,CAAC,CAAC3I,OAAQ;MAAAgG,QAAA,EAClDjG,KAAK,IAAIC;AAAO,KACH,CACjB;AAAA,GACmB,CAAC;AAE3B,CAAC;AAEHhB,WAAW,CAAC4J,WAAW,GAAG,aAAa;;;;"}
|
|
@@ -5,83 +5,77 @@ import { withAsyncPaginate, AsyncPaginate } from 'react-select-async-paginate';
|
|
|
5
5
|
import { applyDefaultTheme } from '../../utils/defaultTheme.js';
|
|
6
6
|
import { ReactComponent as SvgClose } from '../../icons/close.svg.js';
|
|
7
7
|
|
|
8
|
+
const shouldForwardProp = prop => {
|
|
9
|
+
return prop !== 'theme' && !prop.startsWith('$');
|
|
10
|
+
};
|
|
8
11
|
const AsyncCreatableSelectPaginate = withAsyncPaginate(CreatableSelect);
|
|
9
|
-
const sharedStyle = css
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
const CreatableMultiSelect = styled(CreatableSelect).attrs(applyDefaultTheme)
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
const
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
width: 100%;
|
|
77
|
-
${props => props.theme.themeProp('background-color', '#121212', '#fefefe')}
|
|
78
|
-
`;
|
|
79
|
-
const ErrorMessage = styled.div.attrs(applyDefaultTheme)`
|
|
80
|
-
color: ${props => props.$error ? props.theme.getColor('red-500') : props.$warning ? props.theme.getColor('orange-500') : 'inherit'};
|
|
81
|
-
font-size: 0.75rem;
|
|
82
|
-
margin-top: 8px;
|
|
83
|
-
padding: 0 12px;
|
|
84
|
-
`;
|
|
12
|
+
const sharedStyle = css(["font-family:", ";font-size:12px;position:relative;"], props => props.theme.primaryFontFamily);
|
|
13
|
+
const MultiSelectWrapper = styled.div.withConfig({
|
|
14
|
+
shouldForwardProp
|
|
15
|
+
}).attrs(applyDefaultTheme).withConfig({
|
|
16
|
+
displayName: "MultiSelectstyled__MultiSelectWrapper",
|
|
17
|
+
componentId: "sc-6g3cex-0"
|
|
18
|
+
})(["position:relative;"]);
|
|
19
|
+
const InnerWrapper = styled.div.withConfig({
|
|
20
|
+
displayName: "MultiSelectstyled__InnerWrapper",
|
|
21
|
+
componentId: "sc-6g3cex-1"
|
|
22
|
+
})(["position:relative;width:100%;"]);
|
|
23
|
+
const Label = styled.label.withConfig({
|
|
24
|
+
shouldForwardProp
|
|
25
|
+
}).attrs(applyDefaultTheme).withConfig({
|
|
26
|
+
displayName: "MultiSelectstyled__Label",
|
|
27
|
+
componentId: "sc-6g3cex-2"
|
|
28
|
+
})(["color:", ";font-size:0.875rem;margin-bottom:4px;display:block;"], props => props.theme.themeProp('color', props.theme.getColor('white'), props.theme.getColor('gray-700')));
|
|
29
|
+
const MultiSelect = styled(Select).attrs(applyDefaultTheme).withConfig({
|
|
30
|
+
displayName: "MultiSelectstyled__MultiSelect",
|
|
31
|
+
componentId: "sc-6g3cex-3"
|
|
32
|
+
})(["", ""], sharedStyle);
|
|
33
|
+
const CreatableMultiSelect = styled(CreatableSelect).attrs(applyDefaultTheme).withConfig({
|
|
34
|
+
displayName: "MultiSelectstyled__CreatableMultiSelect",
|
|
35
|
+
componentId: "sc-6g3cex-4"
|
|
36
|
+
})(["", ""], sharedStyle);
|
|
37
|
+
const AsyncMultiSelect = styled(AsyncPaginate).attrs(applyDefaultTheme).withConfig({
|
|
38
|
+
displayName: "MultiSelectstyled__AsyncMultiSelect",
|
|
39
|
+
componentId: "sc-6g3cex-5"
|
|
40
|
+
})(["", ""], sharedStyle);
|
|
41
|
+
const AsyncCreatableMultiSelect = styled(AsyncCreatableSelectPaginate).attrs(applyDefaultTheme).withConfig({
|
|
42
|
+
displayName: "MultiSelectstyled__AsyncCreatableMultiSelect",
|
|
43
|
+
componentId: "sc-6g3cex-6"
|
|
44
|
+
})(["", ""], sharedStyle);
|
|
45
|
+
const MultiValueWrapper = styled.div.withConfig({
|
|
46
|
+
displayName: "MultiSelectstyled__MultiValueWrapper",
|
|
47
|
+
componentId: "sc-6g3cex-7"
|
|
48
|
+
})(["border-radius:3px;display:flex;"]);
|
|
49
|
+
const DropdownOptionDeleteIcon = styled(SvgClose).withConfig({
|
|
50
|
+
shouldForwardProp
|
|
51
|
+
}).attrs(applyDefaultTheme).withConfig({
|
|
52
|
+
displayName: "MultiSelectstyled__DropdownOptionDeleteIcon",
|
|
53
|
+
componentId: "sc-6g3cex-8"
|
|
54
|
+
})(["width:10px;stroke:", ";"], props => props.theme.themeProp('stroke', props.theme.getColor('gray-100'), props.theme.getColor('gray-900')));
|
|
55
|
+
const ShowMoreWrapper = styled.div.withConfig({
|
|
56
|
+
shouldForwardProp
|
|
57
|
+
}).attrs(applyDefaultTheme).withConfig({
|
|
58
|
+
displayName: "MultiSelectstyled__ShowMoreWrapper",
|
|
59
|
+
componentId: "sc-6g3cex-9"
|
|
60
|
+
})(["align-items:end;display:flex;flex-direction:column;height:100%;left:0;position:absolute;top:0;width:100%;", " :hover{cursor:pointer;text-decoration:underline;}"], props => props.theme.themeProp('color', props.theme.getColor('gray-100'), props.theme.getColor('emerald-500')));
|
|
61
|
+
const ShowMoreOverlay = styled.div.withConfig({
|
|
62
|
+
shouldForwardProp
|
|
63
|
+
}).attrs(applyDefaultTheme).withConfig({
|
|
64
|
+
displayName: "MultiSelectstyled__ShowMoreOverlay",
|
|
65
|
+
componentId: "sc-6g3cex-10"
|
|
66
|
+
})(["align-items:end;display:block;height:100%;left:0;top:0;width:100%;", ""], props => props.theme.themeProp('background', 'transparent linear-gradient(180deg, #12121200 0%, #12121230 40%, #12121279 70%, #121212 95%, #121212 100%) 0% 0% no-repeat padding-box', 'transparent linear-gradient(180deg, #fefefe00 0%, #fefefe30 40%, #fefefe79 70%, #fefefe 95%, #fefefe 100%) 0% 0% no-repeat padding-box'));
|
|
67
|
+
const ShowMoreText = styled.div.withConfig({
|
|
68
|
+
shouldForwardProp
|
|
69
|
+
}).attrs(applyDefaultTheme).withConfig({
|
|
70
|
+
displayName: "MultiSelectstyled__ShowMoreText",
|
|
71
|
+
componentId: "sc-6g3cex-11"
|
|
72
|
+
})(["font-size:0.875rem;width:100%;", ""], props => props.theme.themeProp('background-color', '#121212', '#fefefe'));
|
|
73
|
+
const ErrorMessage = styled.div.withConfig({
|
|
74
|
+
shouldForwardProp
|
|
75
|
+
}).attrs(applyDefaultTheme).withConfig({
|
|
76
|
+
displayName: "MultiSelectstyled__ErrorMessage",
|
|
77
|
+
componentId: "sc-6g3cex-12"
|
|
78
|
+
})(["color:", ";font-size:0.75rem;margin-top:8px;padding:0 12px;"], props => props.$error ? props.theme.getColor('red-500') : props.$warning ? props.theme.getColor('orange-500') : 'inherit');
|
|
85
79
|
|
|
86
80
|
export { AsyncCreatableMultiSelect, AsyncMultiSelect, CreatableMultiSelect, DropdownOptionDeleteIcon, ErrorMessage, InnerWrapper, Label, MultiSelect, MultiSelectWrapper, MultiValueWrapper, ShowMoreOverlay, ShowMoreText, ShowMoreWrapper };
|
|
87
81
|
//# sourceMappingURL=MultiSelect.styled.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MultiSelect.styled.js","sources":["../../../src/components/inputs/MultiSelect/MultiSelect.styled.js"],"sourcesContent":["import styled, { css } from 'styled-components';\nimport Select from 'react-select';\nimport CreatableSelect from 'react-select/creatable';\nimport { AsyncPaginate, withAsyncPaginate } from 'react-select-async-paginate';\nimport { applyDefaultTheme } from '../../../utils/defaultTheme';\nimport { ReactComponent as CloseIcon } from '../../../icons/close.svg';\n\nconst AsyncCreatableSelectPaginate = withAsyncPaginate(CreatableSelect);\n\nconst sharedStyle = css`\n font-family: ${props => props.theme.primaryFontFamily};\n font-size: 12px;\n position: relative;\n`;\n\nexport const MultiSelectWrapper = styled.div.attrs(applyDefaultTheme)`\n position: relative;\n`;\n\nexport const InnerWrapper = styled.div`\n position: relative;\n width: 100%;\n`;\n\nexport const Label = styled.label.attrs(applyDefaultTheme)`\n color: ${props =>\n props.theme.themeProp(\n 'color',\n props.theme.getColor('white'),\n props.theme.getColor('gray-700')\n )};\n font-size: 0.875rem;\n margin-bottom: 4px;\n display: block;\n`;\n\nexport const MultiSelect = styled(Select).attrs(applyDefaultTheme)`\n ${sharedStyle}\n`;\nexport const CreatableMultiSelect = styled(CreatableSelect).attrs(applyDefaultTheme)`\n ${sharedStyle}\n`;\nexport const AsyncMultiSelect = styled(AsyncPaginate).attrs(applyDefaultTheme)`\n ${sharedStyle}\n`;\nexport const AsyncCreatableMultiSelect = styled(AsyncCreatableSelectPaginate).attrs(\n applyDefaultTheme\n)`\n ${sharedStyle}\n`;\n\nexport const MultiValueWrapper = styled.div`\n border-radius: 3px;\n display: flex;\n`;\n\nexport const DropdownOptionDeleteIcon = styled(CloseIcon).attrs(applyDefaultTheme)`\n width: 10px;\n stroke: ${props =>\n props.theme.themeProp(\n 'stroke',\n props.theme.getColor('gray-100'),\n props.theme.getColor('gray-900')\n )};\n`;\n\nexport const ShowMoreWrapper = styled.div.attrs(applyDefaultTheme)`\n align-items: end;\n display: flex;\n flex-direction: column;\n height: 100%;\n left: 0;\n position: absolute;\n top: 0;\n width: 100%;\n\n ${props =>\n props.theme.themeProp(\n 'color',\n props.theme.getColor('gray-100'),\n props.theme.getColor('emerald-500')\n )}\n\n :hover {\n cursor: pointer;\n text-decoration: underline;\n }\n`;\n\nexport const ShowMoreOverlay = styled.div.attrs(applyDefaultTheme)`\n align-items: end;\n display: block;\n height: 100%;\n left: 0;\n top: 0;\n width: 100%;\n\n ${props =>\n props.theme.themeProp(\n 'background',\n 'transparent linear-gradient(180deg, #12121200 0%, #12121230 40%, #12121279 70%, #121212 95%, #121212 100%) 0% 0% no-repeat padding-box',\n 'transparent linear-gradient(180deg, #fefefe00 0%, #fefefe30 40%, #fefefe79 70%, #fefefe 95%, #fefefe 100%) 0% 0% no-repeat padding-box'\n )}\n`;\n\nexport const ShowMoreText = styled.div.attrs(applyDefaultTheme)`\n font-size: 0.875rem;\n width: 100%;\n ${props => props.theme.themeProp('background-color', '#121212', '#fefefe')}\n`;\n\nexport const ErrorMessage = styled.div.attrs(applyDefaultTheme)`\n color: ${props =>\n props.$error\n ? props.theme.getColor('red-500')\n : props.$warning\n ? props.theme.getColor('orange-500')\n : 'inherit'};\n font-size: 0.75rem;\n margin-top: 8px;\n padding: 0 12px;\n`;\n"],"names":["AsyncCreatableSelectPaginate","withAsyncPaginate","CreatableSelect","sharedStyle","css","props","theme","primaryFontFamily","MultiSelectWrapper","styled","div","attrs","applyDefaultTheme","InnerWrapper","Label","label","themeProp","getColor","MultiSelect","Select","CreatableMultiSelect","AsyncMultiSelect","AsyncPaginate","AsyncCreatableMultiSelect","MultiValueWrapper","DropdownOptionDeleteIcon","CloseIcon","ShowMoreWrapper","ShowMoreOverlay","ShowMoreText","ErrorMessage","$error","$warning"],"mappings":";;;;;;;AAOA,MAAMA,4BAA4B,GAAGC,iBAAiB,CAACC,eAAe,CAAC,CAAA;AAEvE,MAAMC,WAAW,GAAGC,GAAG,CAAA;AACvB,eAAA,EAAiBC,KAAK,IAAIA,KAAK,CAACC,KAAK,CAACC,iBAAiB,CAAA;AACvD;AACA;AACA,CAAC,CAAA;AAEM,MAAMC,kBAAkB,GAAGC,MAAM,CAACC,GAAG,CAACC,KAAK,CAACC,iBAAiB,CAAC,CAAA;AACrE;AACA,EAAC;AAEYC,MAAAA,YAAY,GAAGJ,MAAM,CAACC,GAAG,CAAA;AACtC;AACA;AACA,EAAC;AAEM,MAAMI,KAAK,GAAGL,MAAM,CAACM,KAAK,CAACJ,KAAK,CAACC,iBAAiB,CAAC,CAAA;AAC1D,SAAWP,EAAAA,KAAK,IACZA,KAAK,CAACC,KAAK,CAAC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IP,EAAAA,KAAK,IACLA,KAAK,CAACC,KAAK,CAACU,SAAS,CACnB,OAAO,EACPX,KAAK,CAACC,KAAK,CAACW,QAAQ,CAAC,UAAU,CAAC,EAChCZ,KAAK,CAACC,KAAK,CAACW,QAAQ,CAAC,aAAa,CACpC,CAAC,CAAA;AACL;AACA;AACA;AACA;AACA;AACA,EAAC;AAEM,MAAMW,eAAe,GAAGnB,MAAM,CAACC,GAAG,CAACC,KAAK,CAACC,iBAAiB,CAAC,CAAA;AAClE;AACA;AACA;AACA;AACA;AACA;AACA;AACA,EAAA,EAAIP,KAAK,IACLA,KAAK,CAACC,KAAK,CAACU,SAAS,CACnB,YAAY,EACZ,wIAAwI,EACxI,wIACF,CAAC,CAAA;AACL,EAAC;AAEM,MAAMa,YAAY,GAAGpB,MAAM,CAACC,GAAG,CAACC,KAAK,CAACC,iBAAiB,CAAC,CAAA;AAC/D;AACA;AACA,EAAA,EAAIP,KAAK,IAAIA,KAAK,CAACC,KAAK,CAACU,SAAS,CAAC,kBAAkB,EAAE,SAAS,EAAE,SAAS,CAAC,CAAA;AAC5E,EAAC;AAEM,MAAMc,YAAY,GAAGrB,MAAM,CAACC,GAAG,CAACC,KAAK,CAACC,iBAAiB,CAAC,CAAA;AAC/D,SAAA,EAAWP,KAAK,IACZA,KAAK,CAAC0B,MAAM,GACR1B,KAAK,CAACC,KAAK,CAACW,QAAQ,CAAC,SAAS,CAAC,GAC/BZ,KAAK,CAAC2B,QAAQ,GACZ3B,KAAK,CAACC,KAAK,CAACW,QAAQ,CAAC,YAAY,CAAC,GAClC,SAAS,CAAA;AACnB;AACA;AACA;AACA;;;;"}
|
|
1
|
+
{"version":3,"file":"MultiSelect.styled.js","sources":["../../../src/components/inputs/MultiSelect/MultiSelect.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 *\n * THE DISTINCTIVE CASE HERE IS `styled(<third-party component that has its own `theme`\n * prop>)`. Four of this file's six errors are TS2345 on `.attrs(applyDefaultTheme)` and\n * none of them is about a transient prop — see `SelectThemeProp` below. §J.3 measured\n * that introducing a `P` adds no `.attrs()` assignability errors; this file is the\n * converse, where the `.attrs()` error is already there and a `P` is what REMOVES it.\n *\n * THE SECOND DISTINCTIVE CASE, and it only appears under `--declaration`: an INFERRED\n * `styled(<react-select component>)` type is unprintable, so this file's `.d.ts` was\n * silently skipped. See `SelectWrapper` below. §G.4.\n */\nimport type React from 'react';\nimport styled, { css } from 'styled-components';\nimport Select from 'react-select';\nimport CreatableSelect from 'react-select/creatable';\nimport { AsyncPaginate, withAsyncPaginate } from 'react-select-async-paginate';\nimport { applyDefaultTheme } from '../../../utils/defaultTheme';\nimport { ReactComponent as CloseIcon } from '../../../icons/close.svg';\n\nimport type { PartialNtbTheme } from '../../../utils/defaultTheme';\n\n/**\n * The `theme` prop of the four react-select wrappers below, restated as OUR theme.\n *\n * WHY THIS EXISTS. `theme` is the one prop name that both styled-components and\n * react-select claim. react-select declares it `ThemeConfig = Theme | ((t: Theme) => Theme)`\n * and its `Theme` requires `borderRadius`, which `NtbTheme` does not have — so\n * `.attrs(applyDefaultTheme)`, whose return type is `{ theme: NtbTheme }`, was\n * unassignable to `Attrs<SelectProps>` and each wrapper reported:\n *\n * TS2345 … Types of property 'theme' are incompatible.\n * Type 'NtbTheme' is not assignable to type 'ThemeConfig'.\n * Property 'borderRadius' is missing in type 'NtbTheme' but required in type 'Theme'.\n *\n * `.attrs<{ theme?: PartialNtbTheme }>` fixes it because `attrs`' generic is applied as\n * `Substitute<OuterProps, P> = FastOmit<OuterProps, keyof P> & P` — i.e. declaring\n * `theme` REPLACES react-select's declaration of it rather than intersecting with it.\n *\n * AND THAT IS THE TRUTH ABOUT THIS BOUNDARY, not a workaround. At runtime `.attrs()`\n * hands react-select the merged `NtbTheme`, and react-select's `getTheme()` does\n * `{ ...its defaultTheme, ...this.props.theme }`: our `colors` and `spacing` win — which\n * is why `ThemeColors`/`ThemeSpacing` in `utils/defaultTheme.ts` carry react-select's\n * member names and not design-token names — and `borderRadius` falls through to\n * react-select's own `4`. `NtbTheme` is deliberately a PARTIAL override of react-select's\n * theme, so `ThemeConfig` was never the right type for this prop here.\n *\n * `PartialNtbTheme` and not `NtbTheme` because this is the INPUT side: a caller may pass\n * any subset and `applyDefaultTheme` fills the rest in, exactly as `ThemedProps` states\n * for every other file. Do NOT \"fix\" this by adding `borderRadius` to `NtbTheme`: that\n * would hand react-select a border radius it does not get today and is a render change.\n */\ninterface SelectThemeProp {\n /** A partial override merged over `defaultTheme` by `applyDefaultTheme`. */\n theme?: PartialNtbTheme;\n}\n\n/**\n * The WRITTEN type of the four `styled(<react-select component>)` exports below, and the\n * reason they are annotated at all when nothing else in this repo is.\n *\n * `styled(Select).attrs<SelectThemeProp>(…)` INFERS a correct type. It is not a\n * WRITEABLE one: `tsc --declaration` has to print it into `MultiSelect.styled.d.ts`, the\n * printed form expands to react-select's `PublicBaseSelectProps` and\n * `StateManagerAdditionalProps`, and neither is re-exported from `react-select`'s public\n * entry — react-select has an `exports` map with no wildcard, so\n * `react-select/dist/declarations/src/Select` does not resolve for a consumer at all.\n * The result was 11 x TS2883 in this file, and the consequence was worse than the\n * message: `noEmitOnError` is false, so the build \"succeeded\" while this file's `.d.ts`\n * was SILENTLY NOT WRITTEN.\n *\n * A generic alias fixes it because tsc prints an alias APPLICATION by reference —\n * `SelectWrapper<typeof Select>` — instead of expanding it, and `typeof Select` is\n * `typeof import('react-select').default`, which is nameable. Nothing here is widened or\n * narrowed for the sake of the declaration: `Omit<ComponentProps<C>, keyof P> & P` is\n * exactly styled-components' own `Substitute<OuterProps, P>`, which is the rule\n * `SelectThemeProp` above relies on.\n *\n * What IS given up is the styled-components-specific surface of these four bindings —\n * `.withConfig()`, `.attrs()` and re-wrapping with `styled(S.MultiSelect)`. Audited:\n * nothing in this repo does any of the three to them. Adding one means annotating with\n * `IStyledComponent` instead, which puts the same non-portable expansion back.\n */\ntype SelectWrapper<C extends React.ComponentType<any>> = React.ComponentType<\n Omit<React.ComponentProps<C>, keyof SelectThemeProp> & SelectThemeProp\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 */\nconst shouldForwardProp = (prop: string): boolean => {\n return prop !== 'theme' && !prop.startsWith('$');\n};\n\nconst AsyncCreatableSelectPaginate = withAsyncPaginate(CreatableSelect);\n\nconst sharedStyle = css`\n font-family: ${props => props.theme.primaryFontFamily};\n font-size: 12px;\n position: relative;\n`;\n\nexport const MultiSelectWrapper = styled.div\n .withConfig({\n shouldForwardProp\n })\n .attrs(applyDefaultTheme)`\n position: relative;\n`;\n\nexport const InnerWrapper = styled.div`\n position: relative;\n width: 100%;\n`;\n\nexport const Label = styled.label\n .withConfig({\n shouldForwardProp\n })\n .attrs(applyDefaultTheme)`\n color: ${props =>\n props.theme.themeProp(\n 'color',\n props.theme.getColor('white'),\n props.theme.getColor('gray-700')\n )};\n font-size: 0.875rem;\n margin-bottom: 4px;\n display: block;\n`;\n\n/*\n * All four carry `SelectThemeProp` for the reason documented at that interface. They have\n * no `withConfig`/`shouldForwardProp` — react-select is a component, not a DOM element, so\n * there is nothing to filter — and no transient prop of their own.\n */\nexport const MultiSelect: SelectWrapper<typeof Select> = styled(Select).attrs<SelectThemeProp>(\n applyDefaultTheme\n)`\n ${sharedStyle}\n`;\nexport const CreatableMultiSelect: SelectWrapper<typeof CreatableSelect> = styled(\n CreatableSelect\n).attrs<SelectThemeProp>(applyDefaultTheme)`\n ${sharedStyle}\n`;\nexport const AsyncMultiSelect: SelectWrapper<typeof AsyncPaginate> = styled(\n AsyncPaginate\n).attrs<SelectThemeProp>(applyDefaultTheme)`\n ${sharedStyle}\n`;\nexport const AsyncCreatableMultiSelect: SelectWrapper<typeof AsyncCreatableSelectPaginate> = styled(\n AsyncCreatableSelectPaginate\n).attrs<SelectThemeProp>(applyDefaultTheme)`\n ${sharedStyle}\n`;\n\nexport const MultiValueWrapper = styled.div`\n border-radius: 3px;\n display: flex;\n`;\n\nexport const DropdownOptionDeleteIcon = styled(CloseIcon)\n .withConfig({\n shouldForwardProp\n })\n .attrs(applyDefaultTheme)`\n width: 10px;\n stroke: ${props =>\n props.theme.themeProp(\n 'stroke',\n props.theme.getColor('gray-100'),\n props.theme.getColor('gray-900')\n )};\n`;\n\nexport const ShowMoreWrapper = styled.div\n .withConfig({\n shouldForwardProp\n })\n .attrs(applyDefaultTheme)`\n align-items: end;\n display: flex;\n flex-direction: column;\n height: 100%;\n left: 0;\n position: absolute;\n top: 0;\n width: 100%;\n\n ${props =>\n props.theme.themeProp(\n 'color',\n props.theme.getColor('gray-100'),\n props.theme.getColor('emerald-500')\n )}\n\n :hover {\n cursor: pointer;\n text-decoration: underline;\n }\n`;\n\nexport const ShowMoreOverlay = styled.div\n .withConfig({\n shouldForwardProp\n })\n .attrs(applyDefaultTheme)`\n align-items: end;\n display: block;\n height: 100%;\n left: 0;\n top: 0;\n width: 100%;\n\n ${props =>\n props.theme.themeProp(\n 'background',\n 'transparent linear-gradient(180deg, #12121200 0%, #12121230 40%, #12121279 70%, #121212 95%, #121212 100%) 0% 0% no-repeat padding-box',\n 'transparent linear-gradient(180deg, #fefefe00 0%, #fefefe30 40%, #fefefe79 70%, #fefefe 95%, #fefefe 100%) 0% 0% no-repeat padding-box'\n )}\n`;\n\nexport const ShowMoreText = styled.div\n .withConfig({\n shouldForwardProp\n })\n .attrs(applyDefaultTheme)`\n font-size: 0.875rem;\n width: 100%;\n ${props => props.theme.themeProp('background-color', '#121212', '#fefefe')}\n`;\n\n/**\n * `MultiSelect.tsx` renders `<S.ErrorMessage $error={!!error} $warning={!!warning}>`\n * (line 461), so both are `boolean` — the `!!` is in the JSX, not here. Optional per\n * §J.5; the template's own ternary chain already ends in `'inherit'` for the\n * neither-set case.\n */\ninterface ErrorMessageStyleProps {\n /** `!!error` — red. Wins over `$warning` when both are set. */\n $error?: boolean;\n /** `!!warning` — orange. */\n $warning?: boolean;\n}\n\nexport const ErrorMessage = styled.div\n .withConfig({\n shouldForwardProp\n })\n .attrs<ErrorMessageStyleProps>(applyDefaultTheme)`\n color: ${props =>\n props.$error\n ? props.theme.getColor('red-500')\n : props.$warning\n ? props.theme.getColor('orange-500')\n : 'inherit'};\n font-size: 0.75rem;\n margin-top: 8px;\n padding: 0 12px;\n`;\n"],"names":["shouldForwardProp","prop","startsWith","AsyncCreatableSelectPaginate","withAsyncPaginate","CreatableSelect","sharedStyle","css","props","theme","primaryFontFamily","MultiSelectWrapper","styled","div","withConfig","attrs","applyDefaultTheme","displayName","componentId","InnerWrapper","Label","label","themeProp","getColor","MultiSelect","Select","CreatableMultiSelect","AsyncMultiSelect","AsyncPaginate","AsyncCreatableMultiSelect","MultiValueWrapper","DropdownOptionDeleteIcon","CloseIcon","ShowMoreWrapper","ShowMoreOverlay","ShowMoreText","ErrorMessage","$error","$warning"],"mappings":";;;;;;;AA+FA,MAAMA,iBAAiB,GAAIC,IAAY,IAAc;EACnD,OAAOA,IAAI,KAAK,OAAO,IAAI,CAACA,IAAI,CAACC,UAAU,CAAC,GAAG,CAAC;AAClD,CAAC;AAED,MAAMC,4BAA4B,GAAGC,iBAAiB,CAACC,eAAe,CAAC;AAEvE,MAAMC,WAAW,GAAGC,GAAG,CAAA,CAAA,cAAA,EAAA,oCAAA,CAAA,EACNC,KAAK,IAAIA,KAAK,CAACC,KAAK,CAACC,iBAAiB,CAGtD;AAEM,MAAMC,kBAAkB,GAAGC,MAAM,CAACC,GAAG,CACzCC,UAAU,CAAC;AACVd,EAAAA;AACF,CAAC,CAAC,CACDe,KAAK,CAACC,iBAAiB,CAAC,CAAAF,UAAA,CAAA;EAAAG,WAAA,EAAA,uCAAA;EAAAC,WAAA,EAAA;AAAA,CAAA,CAAA,CAAA,CAAA,oBAAA,CAAA;MA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