@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,19 +1,18 @@
|
|
|
1
|
-
import { extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
|
2
1
|
import React__default from 'react';
|
|
3
|
-
import PropTypes from 'prop-types';
|
|
4
2
|
import { Alert as Alert$1, AlertRender } from './Alert.styled.js';
|
|
5
3
|
import { isEmpty } from 'lodash';
|
|
4
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
6
5
|
|
|
7
6
|
const Alert = React__default.forwardRef(function Alert({
|
|
8
7
|
type,
|
|
9
|
-
alertMessage,
|
|
10
|
-
align,
|
|
8
|
+
alertMessage = 'Use subject to restrictions. Editorial use only, no commercial use without prior consent from rights holder.',
|
|
9
|
+
align = 'left',
|
|
11
10
|
icon,
|
|
12
11
|
fontSize,
|
|
13
12
|
lineHeight,
|
|
14
|
-
lineClamp,
|
|
15
|
-
verticalPadding,
|
|
16
|
-
horizontalPadding,
|
|
13
|
+
lineClamp = 0,
|
|
14
|
+
verticalPadding = 17,
|
|
15
|
+
horizontalPadding = 30,
|
|
17
16
|
width,
|
|
18
17
|
...props
|
|
19
18
|
}, forwardedRef) {
|
|
@@ -33,7 +32,7 @@ const Alert = React__default.forwardRef(function Alert({
|
|
|
33
32
|
isInfo = false;
|
|
34
33
|
}
|
|
35
34
|
}
|
|
36
|
-
return
|
|
35
|
+
return jsx(Alert$1, {
|
|
37
36
|
ref: forwardedRef,
|
|
38
37
|
$alertMessage: alertMessage,
|
|
39
38
|
$warning: isWarning,
|
|
@@ -42,32 +41,18 @@ const Alert = React__default.forwardRef(function Alert({
|
|
|
42
41
|
$align: align,
|
|
43
42
|
$verticalPadding: verticalPadding,
|
|
44
43
|
$horizontalPadding: horizontalPadding,
|
|
45
|
-
width: width
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
44
|
+
width: width,
|
|
45
|
+
...props,
|
|
46
|
+
children: jsxs(AlertRender, {
|
|
47
|
+
fontSize: fontSize,
|
|
48
|
+
$lineHeight: lineHeight,
|
|
49
|
+
$lineClamp: lineClamp,
|
|
50
|
+
children: [icon, " ", jsx("span", {
|
|
51
|
+
children: alertMessage
|
|
52
|
+
})]
|
|
53
|
+
})
|
|
54
|
+
});
|
|
51
55
|
});
|
|
52
|
-
Alert.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
53
|
-
type: PropTypes.oneOf(['warning', 'error', 'info']),
|
|
54
|
-
icon: PropTypes.element,
|
|
55
|
-
align: PropTypes.oneOf(['left', 'center']),
|
|
56
|
-
alertMessage: PropTypes.string,
|
|
57
|
-
fontSize: PropTypes.number,
|
|
58
|
-
lineHeight: PropTypes.number,
|
|
59
|
-
lineClamp: PropTypes.number,
|
|
60
|
-
verticalPadding: PropTypes.number,
|
|
61
|
-
horizontalPadding: PropTypes.number,
|
|
62
|
-
width: PropTypes.number
|
|
63
|
-
} : {};
|
|
64
|
-
Alert.defaultProps = {
|
|
65
|
-
align: 'left',
|
|
66
|
-
alertMessage: 'Use subject to restrictions. Editorial use only, no commercial use without prior consent from rights holder.',
|
|
67
|
-
lineClamp: 0,
|
|
68
|
-
horizontalPadding: 30,
|
|
69
|
-
verticalPadding: 17
|
|
70
|
-
};
|
|
71
56
|
|
|
72
57
|
export { Alert as default };
|
|
73
58
|
//# sourceMappingURL=Alert.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Alert.js","sources":["../../../src/components/data/Alert/Alert.
|
|
1
|
+
{"version":3,"file":"Alert.js","sources":["../../../src/components/data/Alert/Alert.tsx"],"sourcesContent":["import React from 'react';\nimport * as S from './Alert.styled';\nimport { isEmpty } from 'lodash';\n\ntype AlertOwnProps = {\n /**\n * Type of alert that will be reflected by the background color of it.\n */\n type?: 'warning' | 'error' | 'info';\n /**\n * Icon that will be displayed on the left of the alert message.\n */\n icon?: React.ReactElement<any>;\n /**\n * Alignment of the alert message.\n */\n align?: 'left' | 'center';\n /**\n * Message that will be displayed on the alert.\n */\n alertMessage?: string;\n /**\n * Font size of the alert message in pixel.\n */\n fontSize?: number;\n /**\n * Line height of the alert message in pixel.\n */\n lineHeight?: number;\n /**\n * Number of lines that will be displayed before the message will be truncated and replaced with ellipsis.\n */\n lineClamp?: number;\n /**\n * The top and bottom padding of the alert in pixel.\n */\n verticalPadding?: number;\n /**\n * The left and right padding of the alert in pixel.\n */\n horizontalPadding?: number;\n /**\n * Custom width of the alert in pixel.\n */\n width?: number;\n};\n\n/*\n * NMB-3998 §C.2: `props` is spread onto `S.Alert`, so the published type\n * has to admit that target's props too — a closed type here is worse than `any` for the\n * 125 consumer files. Declared members win over the base (`Omit` by `keyof AlertOwnProps`);\n * a bare `&` would INTERSECT a colliding member instead of overriding it, which narrows\n * it (measured: `rows?: number | string` & `rows?: number`) or empties it to `never`.\n */\ntype Props = Omit<React.ComponentPropsWithoutRef<typeof S.Alert>, keyof AlertOwnProps> &\n AlertOwnProps;\n\n/**\n * Alert display warnings or errors.\n *\n * ### Import\n *\n * ``` js\n * import { Alert } from '@ntbjs/react-components/data'\n * // or\n * import Alert from '@ntbjs/react-components/data/Alert'\n * ```\n * ## Props\n * ```\n * Pass one of `warning`, `error` or `info` to the `type` prop to render the right Alert.\n * Pass `align={left}`or `align={center}` to align content.\n * Pass `icon={<svg></svg>}` to display an icon.\n * Pass `alertMessage={'message'} to display the message\n * Pass `fontSize={number}` to set the font size of the message in pixel\n * Pass `lineHeight={number}` to set the line height of the message in pixel\n * Pass `lineClamp={number}` to set the number of lines before the message will be truncated\n * Pass `verticalPadding={number}` to set the top and bottom padding of the alert in pixel\n * Pass `horizontalPadding={number}` to set the left and right padding of the alert in pixel\n * Pass `width={number}` to set the width of the alert in pixel\n * ```\n * ### Warning / Error / Info\n * ```\n * <Alert type={\"warning\"} />\n * <Alert type={\"error\"} />\n * <Alert type={\"info\"} />\n * ```\n */\n\nconst Alert = React.forwardRef<any, Props>(function Alert(\n {\n type,\n alertMessage = 'Use subject to restrictions. Editorial use only, no commercial use without prior consent from rights holder.',\n align = 'left',\n icon,\n fontSize,\n lineHeight,\n lineClamp = 0,\n verticalPadding = 17,\n horizontalPadding = 30,\n width,\n ...props\n },\n forwardedRef\n) {\n let isWarning = false;\n let isError = false;\n let isInfo = true;\n\n if (!isEmpty(type)) {\n if (type === 'warning') {\n isWarning = true;\n } else if (type === 'error') {\n isError = true;\n } else {\n isInfo = true;\n }\n } else {\n if (isWarning || isError) {\n isInfo = false;\n }\n }\n\n return (\n <S.Alert\n ref={forwardedRef}\n $alertMessage={alertMessage}\n $warning={isWarning}\n $error={isError}\n $info={isInfo}\n $align={align}\n $verticalPadding={verticalPadding}\n $horizontalPadding={horizontalPadding}\n width={width}\n {...props}\n >\n <S.AlertRender fontSize={fontSize} $lineHeight={lineHeight} $lineClamp={lineClamp}>\n {icon} <span>{alertMessage}</span>\n </S.AlertRender>\n </S.Alert>\n );\n});\n\nexport default Alert;\n"],"names":["Alert","React","forwardRef","type","alertMessage","align","icon","fontSize","lineHeight","lineClamp","verticalPadding","horizontalPadding","width","props","forwardedRef","isWarning","isError","isInfo","isEmpty","_jsx","S","ref","$alertMessage","$warning","$error","$info","$align","$verticalPadding","$horizontalPadding","children","_jsxs","$lineHeight","$lineClamp"],"mappings":";;;;;AAwFA,MAAMA,KAAK,GAAGC,cAAK,CAACC,UAAU,CAAa,SAASF,KAAKA,CACvD;EACEG,IAAI;AACJC,EAAAA,YAAY,GAAG,8GAA8G;AAC7HC,EAAAA,KAAK,GAAG,MAAM;EACdC,IAAI;EACJC,QAAQ;EACRC,UAAU;AACVC,EAAAA,SAAS,GAAG,CAAC;AACbC,EAAAA,eAAe,GAAG,EAAE;AACpBC,EAAAA,iBAAiB,GAAG,EAAE;EACtBC,KAAK;EACL,GAAG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}
|
|
@@ -6,58 +6,20 @@ const shouldForwardProp = prop => {
|
|
|
6
6
|
};
|
|
7
7
|
const Alert = styled.div.withConfig({
|
|
8
8
|
shouldForwardProp
|
|
9
|
-
}).attrs(applyDefaultTheme)
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
}).attrs(applyDefaultTheme).withConfig({
|
|
10
|
+
displayName: "Alertstyled__Alert",
|
|
11
|
+
componentId: "sc-8n1qjj-0"
|
|
12
|
+
})(["display:flex;flex-direction:column;padding:", ";width:", ";box-sizing:border-box;", " ", " ", " text-align:", ";"], props => {
|
|
13
13
|
const verticalPadding = props.$verticalPadding ?? 17;
|
|
14
14
|
const horizontalPadding = props.$horizontalPadding ?? 30;
|
|
15
15
|
return `${verticalPadding}px ${horizontalPadding}px`;
|
|
16
|
-
}};
|
|
17
|
-
width: ${props => props.width ? `${props.width}px` : '100%'};
|
|
18
|
-
box-sizing: border-box;
|
|
19
|
-
|
|
20
|
-
${props => props.$warning && css`
|
|
21
|
-
${props.theme.themeProp('background', '#634E01', props.theme.getColor('signal-yellow-400'))}
|
|
22
|
-
`}
|
|
23
|
-
|
|
24
|
-
${props => props.$error && css`
|
|
25
|
-
${props.theme.themeProp('background', '#7F1B1B', props.theme.getColor('red-200'))}
|
|
26
|
-
`}
|
|
27
|
-
|
|
28
|
-
${props => props.$info && css`
|
|
29
|
-
background: transparent;
|
|
30
|
-
`}
|
|
31
|
-
|
|
32
|
-
text-align: ${props => props.align === 'center' ? 'center' : 'left'};
|
|
33
|
-
`;
|
|
16
|
+
}, props => props.width ? `${props.width}px` : '100%', props => props.$warning && css(["", ""], props.theme.themeProp('background', '#634E01', props.theme.getColor('signal-yellow-400'))), props => props.$error && css(["", ""], props.theme.themeProp('background', '#7F1B1B', props.theme.getColor('red-200'))), props => props.$info && css(["background:transparent;"]), props => props.align === 'center' ? 'center' : 'left');
|
|
34
17
|
const AlertRender = styled.div.withConfig({
|
|
35
18
|
shouldForwardProp
|
|
36
|
-
}).attrs(applyDefaultTheme)
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
${props => props.$lineHeight ? `line-height: ${props.$lineHeight}px;` : null}
|
|
41
|
-
${props => props.fontSize ? `font-size: ${props.fontSize}px;` : null}
|
|
42
|
-
${props => props.theme.themeProp('color', props.theme.getColor('white'), props.theme.getColor('gray-700'))};
|
|
43
|
-
|
|
44
|
-
svg {
|
|
45
|
-
width: 12px;
|
|
46
|
-
height: 12px;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
span {
|
|
50
|
-
flex: 1;
|
|
51
|
-
padding-left: 5px;
|
|
52
|
-
${props => props.$lineClamp ? css`
|
|
53
|
-
display: -webkit-box;
|
|
54
|
-
-webkit-line-clamp: ${props.$lineClamp};
|
|
55
|
-
-webkit-box-orient: vertical;
|
|
56
|
-
overflow: hidden;
|
|
57
|
-
text-overflow: ellipsis;
|
|
58
|
-
` : null};
|
|
59
|
-
}
|
|
60
|
-
`;
|
|
19
|
+
}).attrs(applyDefaultTheme).withConfig({
|
|
20
|
+
displayName: "Alertstyled__AlertRender",
|
|
21
|
+
componentId: "sc-8n1qjj-1"
|
|
22
|
+
})(["display:flex;align-items:center;word-break:break-word;", " ", " ", ";svg{width:12px;height:12px;}span{flex:1;padding-left:5px;", ";}"], props => props.$lineHeight ? `line-height: ${props.$lineHeight}px;` : null, props => props.fontSize ? `font-size: ${props.fontSize}px;` : null, props => props.theme.themeProp('color', props.theme.getColor('white'), props.theme.getColor('gray-700')), props => props.$lineClamp ? css(["display:-webkit-box;-webkit-line-clamp:", ";-webkit-box-orient:vertical;overflow:hidden;text-overflow:ellipsis;"], props.$lineClamp) : null);
|
|
61
23
|
|
|
62
24
|
export { Alert, AlertRender };
|
|
63
25
|
//# sourceMappingURL=Alert.styled.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Alert.styled.js","sources":["../../../src/components/data/Alert/Alert.styled.
|
|
1
|
+
{"version":3,"file":"Alert.styled.js","sources":["../../../src/components/data/Alert/Alert.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 * THREE DEFERRED DEFECTS ARE DECLARED HERE AND NOT FIXED HERE, because each fix changes\n * the rendered DOM or the rendered CSS and so belongs to C10 with its baseline\n * re-record. Each is named at its declaration: `width` and `fontSize` are non-`$` reads\n * that leak to the DOM, and `align` is read but never passed — a dead branch, while the\n * `$align` the component DOES pass is never read.\n */\nimport styled, { css } from 'styled-components';\nimport { applyDefaultTheme } from '../../../utils/defaultTheme';\n\n/**\n * Props of the `Alert` root, i.e. what `Alert.tsx` passes to `S.Alert`. Value types come\n * from that file's propTypes; all optional per §J.5.\n */\nexport interface AlertStyleProps {\n /** `isWarning` — derived in the component from `type === 'warning'`, so `boolean`. */\n $warning?: boolean;\n /** `isError` — derived from `type === 'error'`. */\n $error?: boolean;\n /** `isInfo` — derived; the component initialises it `true`. */\n $info?: boolean;\n /**\n * `verticalPadding` — `PropTypes.number`, px. `number` and not `number | string`: the\n * template interpolates `${…}px`, so a string would already emit `padding: 17pxpx`.\n */\n $verticalPadding?: number;\n /** `horizontalPadding` — `PropTypes.number`, px, interpolated the same way. */\n $horizontalPadding?: number;\n /**\n * `alertMessage` — `PropTypes.string`.\n *\n * DECLARED BECAUSE THE COMPONENT PASSES IT, NOT BECAUSE ANYTHING READS IT. No\n * interpolation below mentions `$alertMessage`; the message is rendered as the\n * `<span>` child of `AlertRender` instead. `shouldForwardProp` filters it, so it\n * reaches neither the CSS nor the DOM — a dead prop, harmless, and dropping it from\n * `Alert.tsx` is a separate cleanup.\n */\n $alertMessage?: string;\n /**\n * `align` — `PropTypes.oneOf(['left', 'center'])`.\n *\n * DEFECT, DECLARED NOT FIXED: this is the prop the component passes, and NOTHING READS\n * IT. The `text-align` rule at the bottom of this template reads the non-`$` `align`\n * (declared below) instead, and that is never passed — so `align=\"center\"` has never\n * had any effect and every Alert renders `text-align: left`.\n *\n * The fix is to repoint that read from `props.align` to `props.$align`, which ACTIVATES\n * A BRANCH THAT HAS NEVER FIRED and so changes rendered CSS. §J.8 lists that as C10\n * work with a baseline re-record; it must not ride along in a type-only commit.\n */\n $align?: 'left' | 'center';\n /**\n * `width` — `PropTypes.number`, px.\n *\n * DEFECT, DECLARED NOT FIXED: no `$`. `Alert.tsx` passes `width={width}` and\n * `shouldForwardProp` forwards every non-`$` prop, so whenever a caller sets `width` it\n * also lands on the rendered `<div>`, which is not a valid attribute on a `<div>`.\n * CONFIRMED, not inferred: `scripts/r19-harness/baseline.json` records\n * `<div width=\"480\" …>` for `data/Alert`. The fix is to rename it `$width` at both ends,\n * which REMOVES a DOM attribute and so needs C10's re-record. §E.4's third case.\n */\n width?: number;\n /**\n * `align` again, in its non-`$` form — the key this template actually reads. Same\n * defect as `$align` above, stated from the reading end: nothing passes this, so the\n * `=== 'center'` comparison is always `false`.\n */\n align?: 'left' | 'center';\n}\n\n/** Props of `AlertRender`, i.e. what `Alert.tsx` passes to `S.AlertRender`. */\ninterface AlertRenderStyleProps {\n /** `lineHeight` — `PropTypes.number`, px, interpolated as `${…}px`. */\n $lineHeight?: number;\n /**\n * `lineClamp` — `PropTypes.number`, the `-webkit-line-clamp` count. The component\n * defaults it to `0`, which is falsy, so the clamp block is opt-in.\n */\n $lineClamp?: number;\n /**\n * `fontSize` — `PropTypes.number`, px.\n *\n * DEFECT, DECLARED NOT FIXED: no `$`. `Alert.tsx` passes `fontSize={fontSize}`, so\n * whenever a caller sets it, it also leaks onto the rendered `<div>` — AS\n * `font-size=\"12\"`, NOT `fontSize=\"12\"`: React maps this particular camelCase name to\n * its hyphenated attribute form. CONFIRMED, not inferred:\n * `scripts/r19-harness/baseline.json` records `<div font-size=\"12\" …>` for every\n * `data/Alert` entry. The fix is `$fontSize` at both ends — a DOM change, so C10. §E.4.\n */\n fontSize?: number;\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\nexport const Alert = styled.div\n .withConfig({\n shouldForwardProp\n })\n .attrs<AlertStyleProps>(applyDefaultTheme)`\n display: flex;\n flex-direction: column;\n padding: ${props => {\n const verticalPadding = props.$verticalPadding ?? 17;\n const horizontalPadding = props.$horizontalPadding ?? 30;\n return `${verticalPadding}px ${horizontalPadding}px`;\n }};\n width: ${props => (props.width ? `${props.width}px` : '100%')};\n box-sizing: border-box;\n\n ${props =>\n props.$warning &&\n css`\n ${props.theme.themeProp('background', '#634E01', props.theme.getColor('signal-yellow-400'))}\n `}\n\n ${props =>\n props.$error &&\n css`\n ${props.theme.themeProp('background', '#7F1B1B', props.theme.getColor('red-200'))}\n `}\n \n ${props =>\n props.$info &&\n css`\n background: transparent;\n `}\n \n text-align: ${props => (props.align === 'center' ? 'center' : 'left')};\n`;\n\nexport const AlertRender = styled.div\n .withConfig({\n shouldForwardProp\n })\n .attrs<AlertRenderStyleProps>(applyDefaultTheme)`\n display: flex;\n align-items: center;\n word-break: break-word;\n ${props => (props.$lineHeight ? `line-height: ${props.$lineHeight}px;` : null)}\n ${props => (props.fontSize ? `font-size: ${props.fontSize}px;` : null)}\n ${props =>\n props.theme.themeProp(\n 'color',\n props.theme.getColor('white'),\n props.theme.getColor('gray-700')\n )};\n\n svg {\n width: 12px;\n height: 12px;\n }\n\n span {\n flex: 1;\n padding-left: 5px;\n ${props =>\n props.$lineClamp\n ? css`\n display: -webkit-box;\n -webkit-line-clamp: ${props.$lineClamp};\n -webkit-box-orient: vertical;\n overflow: hidden;\n text-overflow: ellipsis;\n `\n : null};\n }\n`;\n"],"names":["shouldForwardProp","prop","startsWith","Alert","styled","div","withConfig","attrs","applyDefaultTheme","displayName","componentId","props","verticalPadding","$verticalPadding","horizontalPadding","$horizontalPadding","width","$warning","css","theme","themeProp","getColor","$error","$info","align","AlertRender","$lineHeight","fontSize","$lineClamp"],"mappings":";;;AAqGA,MAAMA,iBAAiB,GAAIC,IAAY,IAAc;EACnD,OAAOA,IAAI,KAAK,OAAO,IAAI,CAACA,IAAI,CAACC,UAAU,CAAC,GAAG,CAAC;AAClD,CAAC;AAEM,MAAMC,KAAK,GAAGC,MAAM,CAACC,GAAG,CAC5BC,UAAU,CAAC;AACVN,EAAAA;AACF,CAAC,CAAC,CACDO,KAAK,CAAkBC,iBAAiB,CAAC,CAAAF,UAAA,CAAA;EAAAG,WAAA,EAAA,oBAAA;EAAAC,WAAA,EAAA;AAAA,CAAA,CAAA,CAAA,CAAA,6CAAA,EAAA,SAAA,EAAA,yBAAA,EAAA,GAAA,EAAA,GAAA,EAAA,cAAA,EAAA,GAAA,CAAA,EAG/BC,KAAK,IAAI;AAClB,EAAA,MAAMC,eAAe,GAAGD,KAAK,CAACE,gBAAgB,IAAI,EAAE;AACpD,EAAA,MAAMC,iBAAiB,GAAGH,KAAK,CAACI,kBAAkB,IAAI,EAAE;AACxD,EAAA,OAAO,CAAA,EAAGH,eAAe,CAAA,GAAA,EAAME,iBAAiB,CAAA,EAAA,CAAI;AACtD,CAAC,EACQH,KAAK,IAAKA,KAAK,CAACK,KAAK,GAAG,GAAGL,KAAK,CAACK,KAAK,CAAA,EAAA,CAAI,GAAG,MAAO,EAG3DL,KAAK,IACLA,KAAK,CAACM,QAAQ,IACdC,GAAG,WACCP,KAAK,CAACQ,KAAK,CAACC,SAAS,CAAC,YAAY,EAAE,SAAS,EAAET,KAAK,CAACQ,KAAK,CAACE,QAAQ,CAAC,mBAAmB,CAAC,CAAC,CAC5F,EAEDV,KAAK,IACLA,KAAK,CAACW,MAAM,IACZJ,GAAG,CAAA,CAAA,EAAA,EAAA,EAAA,CAAA,EACCP,KAAK,CAACQ,KAAK,CAACC,SAAS,CAAC,YAAY,EAAE,SAAS,EAAET,KAAK,CAACQ,KAAK,CAACE,QAAQ,CAAC,SAAS,CAAC,CAAC,CAClF,EAEDV,KAAK,IACLA,KAAK,CAACY,KAAK,IACXL,GAAG,CAAA,CAAA,yBAAA,CAAA,CAEF,EAEWP,KAAK,IAAKA,KAAK,CAACa,KAAK,KAAK,QAAQ,GAAG,QAAQ,GAAG,MAAO;AAGhE,MAAMC,WAAW,GAAGrB,MAAM,CAACC,GAAG,CAClCC,UAAU,CAAC;AACVN,EAAAA;AACF,CAAC,CAAC,CACDO,KAAK,CAAwBC,iBAAiB,CAAC,CAAAF,UAAA,CAAA;EAAAG,WAAA,EAAA,0BAAA;EAAAC,WAAA,EAAA;AAAA,CAAA,CAAA,CAAA,CAAA,wDAAA,EAAA,GAAA,EAAA,GAAA,EAAA,4DAAA,EAAA,IAAA,CAAA,EAI9CC,KAAK,IAAKA,KAAK,CAACe,WAAW,GAAG,CAAA,aAAA,EAAgBf,KAAK,CAACe,WAAW,CAAA,GAAA,CAAK,GAAG,IAAK,EAC5Ef,KAAK,IAAKA,KAAK,CAACgB,QAAQ,GAAG,CAAA,WAAA,EAAchB,KAAK,CAACgB,QAAQ,CAAA,GAAA,CAAK,GAAG,IAAK,EACpEhB,KAAK,IACLA,KAAK,CAACQ,KAAK,CAACC,SAAS,CACnB,OAAO,EACPT,KAAK,CAACQ,KAAK,CAACE,QAAQ,CAAC,OAAO,CAAC,EAC7BV,KAAK,CAACQ,KAAK,CAACE,QAAQ,CAAC,UAAU,CACjC,CAAC,EAUCV,KAAK,IACLA,KAAK,CAACiB,UAAU,GACZV,GAAG,sHAEqBP,KAAK,CAACiB,UAAU,CAAA,GAKxC,IAAI;;;;"}
|
|
@@ -1,19 +1,18 @@
|
|
|
1
|
-
import { extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
1
|
import React__default from 'react';
|
|
4
2
|
import { Badge as Badge$1, BadgeChildrenContainer, BadgeLabel, BadgeIcon } from './Badge.styled.js';
|
|
3
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
5
4
|
|
|
6
5
|
const Badge = React__default.forwardRef(function Badge({
|
|
7
6
|
badgeContent,
|
|
8
|
-
badgeIcon,
|
|
7
|
+
badgeIcon = null,
|
|
9
8
|
children,
|
|
10
|
-
elevated,
|
|
9
|
+
elevated = false,
|
|
11
10
|
fontSize,
|
|
12
|
-
fontWeight,
|
|
13
|
-
lineHeight,
|
|
14
|
-
active,
|
|
15
|
-
error,
|
|
16
|
-
warning,
|
|
11
|
+
fontWeight = 'normal',
|
|
12
|
+
lineHeight = 'normal',
|
|
13
|
+
active = false,
|
|
14
|
+
error = false,
|
|
15
|
+
warning = false,
|
|
17
16
|
backgroundColors,
|
|
18
17
|
colors,
|
|
19
18
|
verticalPadding,
|
|
@@ -30,61 +29,37 @@ const Badge = React__default.forwardRef(function Badge({
|
|
|
30
29
|
notation: 'compact'
|
|
31
30
|
}).format(badgeContent);
|
|
32
31
|
}
|
|
33
|
-
return
|
|
32
|
+
return jsxs(Badge$1, {
|
|
34
33
|
ref: forwardedRef,
|
|
35
34
|
$elevated: elevated,
|
|
36
|
-
$hasChildren: Boolean(children)
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
35
|
+
$hasChildren: Boolean(children),
|
|
36
|
+
...props,
|
|
37
|
+
children: [children && jsx(BadgeChildrenContainer, {
|
|
38
|
+
children: children
|
|
39
|
+
}), (badgeIcon || badgeContent) && jsxs(BadgeLabel, {
|
|
40
|
+
$backgroundColors: backgroundColors,
|
|
41
|
+
$colors: colors,
|
|
42
|
+
$elevated: elevated,
|
|
43
|
+
fontSize: fontSize,
|
|
44
|
+
fontWeight: fontWeight,
|
|
45
|
+
$lineHeight: lineHeight,
|
|
46
|
+
$active: active,
|
|
47
|
+
$error: error,
|
|
48
|
+
$warning: warning,
|
|
49
|
+
$elevatedverticalPadding: verticalPadding,
|
|
50
|
+
$horizontalPadding: horizontalPadding,
|
|
51
|
+
height: height,
|
|
52
|
+
$minHeight: minHeight,
|
|
53
|
+
width: width,
|
|
54
|
+
$minWidth: minWidth,
|
|
55
|
+
$borderColors: borderColors,
|
|
56
|
+
children: [badgeIcon && jsx(BadgeIcon, {
|
|
57
|
+
$useGutter: !!badgeContent,
|
|
58
|
+
children: badgeIcon
|
|
59
|
+
}), badgeContent]
|
|
60
|
+
})]
|
|
61
|
+
});
|
|
57
62
|
});
|
|
58
|
-
Badge.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
59
|
-
badgeIcon: PropTypes.node,
|
|
60
|
-
badgeContent: PropTypes.oneOfType([PropTypes.string, PropTypes.number, PropTypes.func, PropTypes.element]),
|
|
61
|
-
children: PropTypes.oneOfType([PropTypes.node, PropTypes.string]),
|
|
62
|
-
elevated: PropTypes.bool,
|
|
63
|
-
active: PropTypes.bool,
|
|
64
|
-
error: PropTypes.bool,
|
|
65
|
-
warning: PropTypes.bool,
|
|
66
|
-
fontSize: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
67
|
-
fontWeight: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
68
|
-
lineHeight: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
69
|
-
colors: PropTypes.arrayOf(PropTypes.string),
|
|
70
|
-
backgroundColors: PropTypes.arrayOf(PropTypes.string),
|
|
71
|
-
verticalPadding: PropTypes.number,
|
|
72
|
-
horizontalPadding: PropTypes.number,
|
|
73
|
-
height: PropTypes.number,
|
|
74
|
-
minHeight: PropTypes.number,
|
|
75
|
-
width: PropTypes.number,
|
|
76
|
-
minWidth: PropTypes.number,
|
|
77
|
-
borderColors: PropTypes.arrayOf(PropTypes.string)
|
|
78
|
-
} : {};
|
|
79
|
-
Badge.defaultProps = {
|
|
80
|
-
elevated: false,
|
|
81
|
-
active: false,
|
|
82
|
-
error: false,
|
|
83
|
-
warning: false,
|
|
84
|
-
badgeIcon: null,
|
|
85
|
-
fontWeight: 'normal',
|
|
86
|
-
lineHeight: 'normal'
|
|
87
|
-
};
|
|
88
63
|
|
|
89
64
|
export { Badge as default };
|
|
90
65
|
//# sourceMappingURL=Badge.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Badge.js","sources":["../../../src/components/data/Badge/Badge.js"],"sourcesContent":["import PropTypes from 'prop-types';\nimport React from 'react';\nimport * as S from './Badge.styled';\n\n/**\n * Badges show a bubble containing a `number` or a `string`. It may be used by itself or with children passed as props\n * (to display a badge on top of an icon, for example, pass the icon as the child).\n *\n * If the badge content is passed as a `float`, it will be rounded up to the nearest `integer`,\n * and if the number is higher than 1 000 or 1 000 000 it will be abbreviated to for example \"1.4K\" or \"1.4M\" respectively.\n * If you need to display a `float` instead of a rounded `integer`, pass it as a `string` instead (e.g. \"1,4\").\n *\n * ### Import\n *\n * ``` js\n * import { Badge } from '@ntbjs/react-components/data'\n * // or\n * import Badge from '@ntbjs/react-components/data/Badge'\n * ```\n * ## Props\n * ```\n * Pass `badgeIcon={<svg></svg>}` to display an icon.\n * Pass a number or string to the badgeContent to display it alongside the icon.\n * Pass `align={\"left\"}`or `align={\"center\"}` to align content.\n * Pass `elevated={true}` to display the badge on top of the children\n * Pass `active={true}` to reflect the active status of the badge\n * Pass `error={true}` to reflect the error status of the badge\n * Pass `warning={true}` to reflect the warning status of the badge\n * Pass `fontSize={15}` to set the font size of the badge in pixel\n * Pass `fontWeight={500}` to set the font weight of the badge\n * Pass `lineHeight={12}` to set the line height of the badge in pixel\n * Pass `colors={[#ffffff, #000000]}` to set the font color of the badge\n * Pass `backgroundColors={[#ffffff, #000000]}` to set the background color of the badge\n * Pass `verticalPadding={15}` to set the bottom and top padding of the badge in pixel\n * Pass `horizontalPadding={20}` to set the left and right padding of the badge in pixel\n * Pass `height={24}` to set the height of the badge in pixel\n * Pass `minHeight={24}` to set the minimum height of the badge in pixel\n * Pass `width={50}` to set the width of the badge in pixel\n * Pass `minWidth={32}` to set the minimum width of the badge in pixel\n * ```\n */\nconst Badge = React.forwardRef(function Badge(\n {\n badgeContent,\n badgeIcon,\n children,\n elevated,\n fontSize,\n fontWeight,\n lineHeight,\n active,\n error,\n warning,\n backgroundColors,\n colors,\n verticalPadding,\n horizontalPadding,\n height,\n minHeight,\n width,\n minWidth,\n borderColors,\n ...props\n },\n forwardedRef\n) {\n if (typeof badgeContent === 'number') {\n badgeContent = Intl.NumberFormat('en', { notation: 'compact' }).format(badgeContent);\n }\n\n return (\n <S.Badge ref={forwardedRef} $elevated={elevated} $hasChildren={Boolean(children)} {...props}>\n {children && <S.BadgeChildrenContainer>{children}</S.BadgeChildrenContainer>}\n {(badgeIcon || badgeContent) && (\n <S.BadgeLabel\n $backgroundColors={backgroundColors}\n $colors={colors}\n $elevated={elevated}\n fontSize={fontSize}\n fontWeight={fontWeight}\n $lineHeight={lineHeight}\n $active={active}\n $error={error}\n $warning={warning}\n $elevatedverticalPadding={verticalPadding}\n $horizontalPadding={horizontalPadding}\n height={height}\n $minHeight={minHeight}\n width={width}\n $minWidth={minWidth}\n $borderColors={borderColors}\n >\n {badgeIcon && <S.BadgeIcon $useGutter={!!badgeContent}>{badgeIcon}</S.BadgeIcon>}\n {badgeContent}\n </S.BadgeLabel>\n )}\n </S.Badge>\n );\n});\n\nBadge.propTypes = {\n /**\n * An Icon to show in the badge alongside with a text\n */\n badgeIcon: PropTypes.node,\n\n /**\n * Content to be showed in the badge – e.g. number of results.\n */\n badgeContent: PropTypes.oneOfType([\n PropTypes.string,\n PropTypes.number,\n PropTypes.func,\n PropTypes.element\n ]),\n\n /**\n * The element(s) for which the badge will be displayed – e.g. an icon or a text.\n */\n children: PropTypes.oneOfType([PropTypes.node, PropTypes.string]),\n\n /**\n * Whether the badge should be displayed in an elevated position on top of the child element(s) or not.\n */\n elevated: PropTypes.bool,\n\n /**\n * Whether the element is active or not (e.g. the currently selected menu item). This changes the color of the badge.\n */\n active: PropTypes.bool,\n\n /**\n * There is an error present – 'error be prioritized over warnings if both are set to `true`.\n */\n error: PropTypes.bool,\n\n /**\n * There is a warning present.\n */\n warning: PropTypes.bool,\n /**\n * Font size for the badge\n */\n fontSize: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),\n /**\n * Font weight for the badge\n */\n fontWeight: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),\n /**\n * Line weight for the badge\n */\n lineHeight: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),\n /**\n * Colors of the font in the manner of [darkThemeColor, lightThemeColor]\n */\n colors: PropTypes.arrayOf(PropTypes.string),\n /**\n * Background colors for the badge in the manner of [darkThemeColor, lightThemeColor]\n */\n backgroundColors: PropTypes.arrayOf(PropTypes.string),\n /**\n * Top and bottom padding for the badge\n */\n verticalPadding: PropTypes.number,\n /**\n * Left and right padding for the badge\n */\n horizontalPadding: PropTypes.number,\n /**\n * Height of the badge\n */\n height: PropTypes.number,\n /**\n * Minimum height of the badge\n */\n minHeight: PropTypes.number,\n /**\n * Width of the badge\n */\n width: PropTypes.number,\n /**\n * Minimum width of the badge\n */\n minWidth: PropTypes.number,\n /**\n * Border colors in the manner of [darkThemeColor, lightThemeColor]. When provided, a 1px solid border is applied.\n */\n borderColors: PropTypes.arrayOf(PropTypes.string)\n};\n\nBadge.defaultProps = {\n elevated: false,\n active: false,\n error: false,\n warning: false,\n badgeIcon: null,\n fontWeight: 'normal',\n lineHeight: 'normal'\n};\n\nexport default Badge;\n"],"names":["Badge","React","forwardRef","badgeContent","badgeIcon","children","elevated","fontSize","fontWeight","lineHeight","active","error","warning","backgroundColors","colors","verticalPadding","horizontalPadding","height","minHeight","width","minWidth","borderColors","props","forwardedRef","Intl","NumberFormat","notation","format","createElement","S","_extends","ref","$elevated","$hasChildren","Boolean","$backgroundColors","$colors","$lineHeight","$active","$error","$warning","$elevatedverticalPadding","$horizontalPadding","$minHeight","$minWidth","$borderColors","$useGutter","propTypes","process","env","NODE_ENV","PropTypes","node","oneOfType","string","number","func","element","bool","arrayOf","defaultProps"],"mappings":";;;;;AAyCMA,MAAAA,KAAK,GAAGC,cAAK,CAACC,UAAU,CAAC,SAASF,KAAKA,CAC3C;EACEG,YAAY;EACZC,SAAS;EACTC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,UAAU;EACVC,UAAU;EACVC,MAAM;EACNC,KAAK;EACLC,OAAO;EACPC,gBAAgB;EAChBC,MAAM;EACNC,eAAe;EACfC,iBAAiB;EACjBC,MAAM;EACNC,SAAS;EACTC,KAAK;EACLC,QAAQ;EACRC,YAAY;EACZ,GAAGC,KAAAA;AACL,CAAC,EACDC,YAAY,EACZ;AACA,EAAA,IAAI,OAAOpB,YAAY,KAAK,QAAQ,EAAE;AACpCA,IAAAA,YAAY,GAAGqB,IAAI,CAACC,YAAY,CAAC,IAAI,EAAE;AAAEC,MAAAA,QAAQ,EAAE,SAAA;AAAU,KAAC,CAAC,CAACC,MAAM,CAACxB,YAAY,CAAC,CAAA;AACtF,GAAA;EAEA,OACEF,cAAA,CAAA2B,aAAA,CAACC,OAAO,EAAAC,QAAA,CAAA;AAACC,IAAAA,GAAG,EAAER,YAAa;AAACS,IAAAA,SAAS,EAAE1B,QAAS;IAAC2B,YAAY,EAAEC,OAAO,CAAC7B,QAAQ,CAAA;GAAOiB,EAAAA,KAAK,CACxFjB,EAAAA,QAAQ,IAAIJ,cAAA,CAAA2B,aAAA,CAACC,sBAAwB,EAAExB,IAAAA,EAAAA,QAAmC,CAAC,EAC3E,CAACD,SAAS,IAAID,YAAY,KACzBF,cAAA,CAAA2B,aAAA,CAACC,UAAY,EAAA;AACXM,IAAAA,iBAAiB,EAAEtB,gBAAiB;AACpCuB,IAAAA,OAAO,EAAEtB,MAAO;AAChBkB,IAAAA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esContent":["import React from 'react';\nimport * as S from './Badge.styled';\n\ntype BadgeOwnProps = {\n /**\n * An Icon to show in the badge alongside with a text\n */\n badgeIcon?: React.ReactNode;\n /**\n * Content to be showed in the badge – e.g. number of results.\n *\n * NMB-3998: this is `React.ReactNode` and NOT the four-way union the propTypes\n * codemod produced from `oneOfType([string, number, func, element])`. The `func`\n * member was never a legal value: line 182 renders `{badgeContent}` as a child, and\n * React THROWS \"Functions are not valid as a React child\" for a function. So the\n * propTypes documented a value that cannot work, and transcribing them faithfully\n * published that mistake as a type — which is what TS2769 on line 182 was reporting.\n * The union was also missing `null`, used by `Badge badgeContent={null}` in\n * Tabs.stories; that only compiled because `strictNullChecks` is off.\n */\n badgeContent?: React.ReactNode;\n /**\n * The element(s) for which the badge will be displayed – e.g. an icon or a text.\n */\n children?: React.ReactNode | string;\n /**\n * Whether the badge should be displayed in an elevated position on top of the child element(s) or not.\n */\n elevated?: boolean;\n /**\n * Whether the element is active or not (e.g. the currently selected menu item). This changes the color of the badge.\n */\n active?: boolean;\n /**\n * There is an error present – 'error be prioritized over warnings if both are set to `true`.\n */\n error?: boolean;\n /**\n * There is a warning present.\n */\n warning?: boolean;\n /**\n * Font size for the badge\n */\n fontSize?: number | string;\n /**\n * Font weight for the badge\n */\n fontWeight?: number | string;\n /**\n * Line weight for the badge\n */\n lineHeight?: number | string;\n /**\n * Colors of the font in the manner of [darkThemeColor, lightThemeColor]\n */\n colors?: string[];\n /**\n * Background colors for the badge in the manner of [darkThemeColor, lightThemeColor]\n */\n backgroundColors?: string[];\n /**\n * Top and bottom padding for the badge\n */\n verticalPadding?: number;\n /**\n * Left and right padding for the badge\n */\n horizontalPadding?: number;\n /**\n * Height of the badge\n */\n height?: number;\n /**\n * Minimum height of the badge\n */\n minHeight?: number;\n /**\n * Width of the badge\n */\n width?: number;\n /**\n * Minimum width of the badge\n */\n minWidth?: number;\n /**\n * Border colors in the manner of [darkThemeColor, lightThemeColor]. When provided, a 1px solid border is applied.\n */\n borderColors?: string[];\n};\n\n/*\n * NMB-3998 §C.2: `props` is spread onto `S.Badge`, so the published type\n * has to admit that target's props too — a closed type here is worse than `any` for the\n * 125 consumer files. Declared members win over the base (`Omit` by `keyof BadgeOwnProps`);\n * a bare `&` would INTERSECT a colliding member instead of overriding it, which narrows\n * it (measured: `rows?: number | string` & `rows?: number`) or empties it to `never`.\n */\ntype Props = Omit<React.ComponentPropsWithoutRef<typeof S.Badge>, keyof BadgeOwnProps> &\n BadgeOwnProps;\n\n/**\n * Badges show a bubble containing a `number` or a `string`. It may be used by itself or with children passed as props\n * (to display a badge on top of an icon, for example, pass the icon as the child).\n *\n * If the badge content is passed as a `float`, it will be rounded up to the nearest `integer`,\n * and if the number is higher than 1 000 or 1 000 000 it will be abbreviated to for example \"1.4K\" or \"1.4M\" respectively.\n * If you need to display a `float` instead of a rounded `integer`, pass it as a `string` instead (e.g. \"1,4\").\n *\n * ### Import\n *\n * ``` js\n * import { Badge } from '@ntbjs/react-components/data'\n * // or\n * import Badge from '@ntbjs/react-components/data/Badge'\n * ```\n * ## Props\n * ```\n * Pass `badgeIcon={<svg></svg>}` to display an icon.\n * Pass a number or string to the badgeContent to display it alongside the icon.\n * Pass `align={\"left\"}`or `align={\"center\"}` to align content.\n * Pass `elevated={true}` to display the badge on top of the children\n * Pass `active={true}` to reflect the active status of the badge\n * Pass `error={true}` to reflect the error status of the badge\n * Pass `warning={true}` to reflect the warning status of the badge\n * Pass `fontSize={15}` to set the font size of the badge in pixel\n * Pass `fontWeight={500}` to set the font weight of the badge\n * Pass `lineHeight={12}` to set the line height of the badge in pixel\n * Pass `colors={[#ffffff, #000000]}` to set the font color of the badge\n * Pass `backgroundColors={[#ffffff, #000000]}` to set the background color of the badge\n * Pass `verticalPadding={15}` to set the bottom and top padding of the badge in pixel\n * Pass `horizontalPadding={20}` to set the left and right padding of the badge in pixel\n * Pass `height={24}` to set the height of the badge in pixel\n * Pass `minHeight={24}` to set the minimum height of the badge in pixel\n * Pass `width={50}` to set the width of the badge in pixel\n * Pass `minWidth={32}` to set the minimum width of the badge in pixel\n * ```\n */\nconst Badge = React.forwardRef<any, Props>(function Badge(\n {\n badgeContent,\n badgeIcon = null,\n children,\n elevated = false,\n fontSize,\n fontWeight = 'normal',\n lineHeight = 'normal',\n active = false,\n error = false,\n warning = false,\n backgroundColors,\n colors,\n verticalPadding,\n horizontalPadding,\n height,\n minHeight,\n width,\n minWidth,\n borderColors,\n ...props\n },\n forwardedRef\n) {\n if (typeof badgeContent === 'number') {\n badgeContent = Intl.NumberFormat('en', { notation: 'compact' }).format(badgeContent);\n }\n\n return (\n <S.Badge ref={forwardedRef} $elevated={elevated} $hasChildren={Boolean(children)} {...props}>\n {children && <S.BadgeChildrenContainer>{children}</S.BadgeChildrenContainer>}\n {(badgeIcon || badgeContent) && (\n <S.BadgeLabel\n $backgroundColors={backgroundColors}\n $colors={colors}\n $elevated={elevated}\n fontSize={fontSize}\n fontWeight={fontWeight}\n $lineHeight={lineHeight}\n $active={active}\n $error={error}\n $warning={warning}\n $elevatedverticalPadding={verticalPadding}\n $horizontalPadding={horizontalPadding}\n height={height}\n $minHeight={minHeight}\n width={width}\n $minWidth={minWidth}\n $borderColors={borderColors}\n >\n {badgeIcon && <S.BadgeIcon $useGutter={!!badgeContent}>{badgeIcon}</S.BadgeIcon>}\n {badgeContent}\n </S.BadgeLabel>\n )}\n </S.Badge>\n );\n});\n\nexport default Badge;\n"],"names":["Badge","React","forwardRef","badgeContent","badgeIcon","children","elevated","fontSize","fontWeight","lineHeight","active","error","warning","backgroundColors","colors","verticalPadding","horizontalPadding","height","minHeight","width","minWidth","borderColors","props","forwardedRef","Intl","NumberFormat","notation","format","_jsxs","S","ref","$elevated","$hasChildren","Boolean","_jsx","$backgroundColors","$colors","$lineHeight","$active","$error","$warning","$elevatedverticalPadding","$horizontalPadding","$minHeight","$minWidth","$borderColors","$useGutter"],"mappings":";;;;AA0IA,MAAMA,KAAK,GAAGC,cAAK,CAACC,UAAU,CAAa,SAAS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xB6B,MAAAA,OAAO,EAAE5B,MAAO;AAChB6B,MAAAA,MAAM,EAAE5B,KAAM;AACd6B,MAAAA,QAAQ,EAAE5B,OAAQ;AAClB6B,MAAAA,wBAAwB,EAAE1B,eAAgB;AAC1C2B,MAAAA,kBAAkB,EAAE1B,iBAAkB;AACtCC,MAAAA,MAAM,EAAEA,MAAO;AACf0B,MAAAA,UAAU,EAAEzB,SAAU;AACtBC,MAAAA,KAAK,EAAEA,KAAM;AACbyB,MAAAA,SAAS,EAAExB,QAAS;AACpByB,MAAAA,aAAa,EAAExB,YAAa;AAAAhB,MAAAA,QAAA,GAE3BD,SAAS,IAAI8B,GAAA,CAACL,SAAW,EAAA;QAACiB,UAAU,EAAE,CAAC,CAAC3C,YAAa;AAAAE,QAAAA,QAAA,EAAED;OAAuB,CAAC,EAC/ED,YAAY;AAAA,KACD,CACf;AAAA,GACM,CAAC;AAEd,CAAC;;;;"}
|
|
@@ -6,69 +6,32 @@ const shouldForwardProp = prop => {
|
|
|
6
6
|
};
|
|
7
7
|
const Badge = styled.span.withConfig({
|
|
8
8
|
shouldForwardProp
|
|
9
|
-
}).attrs(applyDefaultTheme)
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
font-size: 1rem;
|
|
14
|
-
font-weight: 500;
|
|
15
|
-
min-height: 24px;
|
|
16
|
-
position: relative;
|
|
17
|
-
width: ${props => props.$elevated ? 'fit-content' : 'initial'};
|
|
18
|
-
`;
|
|
9
|
+
}).attrs(applyDefaultTheme).withConfig({
|
|
10
|
+
displayName: "Badgestyled__Badge",
|
|
11
|
+
componentId: "sc-1h3t54-0"
|
|
12
|
+
})(["align-content:center;display:", ";font-family:", ";font-size:1rem;font-weight:500;min-height:24px;position:relative;width:", ";"], props => props.$elevated || !props.$hasChildren ? 'inline-flex' : 'flex', props => props.theme.primaryFontFamily, props => props.$elevated ? 'fit-content' : 'initial');
|
|
19
13
|
const BadgeChildrenContainer = styled.span.withConfig({
|
|
20
14
|
shouldForwardProp
|
|
21
|
-
}).attrs(applyDefaultTheme)
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
`;
|
|
15
|
+
}).attrs(applyDefaultTheme).withConfig({
|
|
16
|
+
displayName: "Badgestyled__BadgeChildrenContainer",
|
|
17
|
+
componentId: "sc-1h3t54-1"
|
|
18
|
+
})(["align-self:center;height:fit-content;margin-right:8px;"]);
|
|
26
19
|
const BadgeLabel = styled.span.withConfig({
|
|
27
20
|
shouldForwardProp
|
|
28
|
-
}).attrs(applyDefaultTheme)
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
justify-content: center;
|
|
33
|
-
box-sizing: border-box;
|
|
34
|
-
|
|
35
|
-
font-size: ${props => {
|
|
21
|
+
}).attrs(applyDefaultTheme).withConfig({
|
|
22
|
+
displayName: "Badgestyled__BadgeLabel",
|
|
23
|
+
componentId: "sc-1h3t54-2"
|
|
24
|
+
})(["border-radius:", ";display:flex;align-items:center;justify-content:center;box-sizing:border-box;font-size:", ";font-weight:", ";line-height:", ";height:", ";letter-spacing:0.32px;margin-left:", ";position:", ";right:0;transform:", ";", " ", " ", " ", " ", " ", " ", ""], props => props.$elevated ? '12px' : '14px', props => {
|
|
36
25
|
if (props.fontSize) {
|
|
37
26
|
return `${props.fontSize}px`;
|
|
38
27
|
} else {
|
|
39
28
|
return props.elevated ? '0.625rem' : '0.750rem';
|
|
40
29
|
}
|
|
41
|
-
}};
|
|
42
|
-
font-weight: ${props => props.fontWeight ? props.fontWeight : 'normal'};
|
|
43
|
-
line-height: ${props => props.$lineHeight ? `${props.$lineHeight}px` : 'normal'};
|
|
44
|
-
height: ${props => props.height ? `${props.height}px` : 'fit-content'};
|
|
45
|
-
letter-spacing: 0.32px;
|
|
46
|
-
margin-left: ${props => props.$elevated ? '15px' : 'auto'};
|
|
47
|
-
position: ${props => props.$elevated ? 'absolute' : 'initial'};
|
|
48
|
-
right: 0;
|
|
49
|
-
transform: ${props => props.$elevated ? 'translate(33%, -8px)' : 'initial'};
|
|
50
|
-
|
|
51
|
-
${props => props.width ? css`
|
|
52
|
-
width: ${props.width}px;
|
|
53
|
-
` : null}
|
|
54
|
-
|
|
55
|
-
${props => props.$minWidth ? css`
|
|
56
|
-
min-width: ${props.$minWidth}px;
|
|
57
|
-
` : null}
|
|
58
|
-
|
|
59
|
-
${props => props.$minHeight ? css`
|
|
60
|
-
min-height: ${props.$minHeight}px;
|
|
61
|
-
` : null}
|
|
62
|
-
|
|
63
|
-
${props => {
|
|
30
|
+
}, props => props.fontWeight ? props.fontWeight : 'normal', props => props.$lineHeight ? `${props.$lineHeight}px` : 'normal', props => props.height ? `${props.height}px` : 'fit-content', props => props.$elevated ? '15px' : 'auto', props => props.$elevated ? 'absolute' : 'initial', props => props.$elevated ? 'translate(33%, -8px)' : 'initial', props => props.width ? css(["width:", "px;"], props.width) : null, props => props.$minWidth ? css(["min-width:", "px;"], props.$minWidth) : null, props => props.$minHeight ? css(["min-height:", "px;"], props.$minHeight) : null, props => {
|
|
64
31
|
const verticalPadding = props.verticalPadding ? `${props.verticalPadding}px` : props.$elevated ? '4px' : '6px';
|
|
65
32
|
const horizontalPadding = props.$horizontalPadding ? `${props.$horizontalPadding}px` : props.$elevated ? '7px' : '10px';
|
|
66
|
-
return css
|
|
67
|
-
|
|
68
|
-
`;
|
|
69
|
-
}}
|
|
70
|
-
|
|
71
|
-
${props => props.theme.themeProp('background', () => {
|
|
33
|
+
return css(["padding:", " ", ";"], verticalPadding, horizontalPadding);
|
|
34
|
+
}, props => props.theme.themeProp('background', () => {
|
|
72
35
|
const active = props.$active;
|
|
73
36
|
const error = props.$error;
|
|
74
37
|
const warning = props.$warning;
|
|
@@ -110,9 +73,7 @@ const BadgeLabel = styled.span.withConfig({
|
|
|
110
73
|
default:
|
|
111
74
|
return props.theme.getColor('gray-200');
|
|
112
75
|
}
|
|
113
|
-
})
|
|
114
|
-
|
|
115
|
-
${props => props.theme.themeProp('color', () => {
|
|
76
|
+
}), props => props.theme.themeProp('color', () => {
|
|
116
77
|
const defaultColor = props?.$colors?.[0] ?? props.theme.getColor('white');
|
|
117
78
|
if (props.$warning && !props.$error || props.error && !props.$active) {
|
|
118
79
|
return props.theme.getColor('gray-900');
|
|
@@ -126,23 +87,13 @@ const BadgeLabel = styled.span.withConfig({
|
|
|
126
87
|
} else {
|
|
127
88
|
return defaultColor;
|
|
128
89
|
}
|
|
129
|
-
})
|
|
130
|
-
|
|
131
|
-
${props => props.$borderColors && css`
|
|
132
|
-
border: 1px solid;
|
|
133
|
-
${props.theme.themeProp('border-color', props.$borderColors[0], props.$borderColors[1])}
|
|
134
|
-
`}
|
|
135
|
-
`;
|
|
90
|
+
}), props => props.$borderColors && css(["border:1px solid;", ""], props.theme.themeProp('border-color', props.$borderColors[0], props.$borderColors[1])));
|
|
136
91
|
const BadgeIcon = styled.span.withConfig({
|
|
137
92
|
shouldForwardProp
|
|
138
|
-
}).attrs(applyDefaultTheme)
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
svg {
|
|
143
|
-
height: 12px;
|
|
144
|
-
}
|
|
145
|
-
`;
|
|
93
|
+
}).attrs(applyDefaultTheme).withConfig({
|
|
94
|
+
displayName: "Badgestyled__BadgeIcon",
|
|
95
|
+
componentId: "sc-1h3t54-3"
|
|
96
|
+
})(["display:flex;align-items:center;margin-right:", ";svg{height:12px;}"], props => props.$useGutter ? '4px' : 0);
|
|
146
97
|
|
|
147
98
|
export { Badge, BadgeChildrenContainer, BadgeIcon, BadgeLabel };
|
|
148
99
|
//# sourceMappingURL=Badge.styled.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Badge.styled.js","sources":["../../../src/components/data/Badge/Badge.styled.js"],"sourcesContent":["import styled, { css } from 'styled-components';\nimport { applyDefaultTheme } from '../../../utils/defaultTheme';\n\nconst shouldForwardProp = prop => {\n return prop !== 'theme' && !prop.startsWith('$');\n};\n\nexport const Badge = styled.span\n .withConfig({\n shouldForwardProp\n })\n .attrs(applyDefaultTheme)`\n align-content: center;\n display: ${props => (props.$elevated || !props.$hasChildren ? 'inline-flex' : 'flex')};\n font-family: ${props => props.theme.primaryFontFamily};\n font-size: 1rem;\n font-weight: 500;\n min-height: 24px;\n position: relative;\n width: ${props => (props.$elevated ? 'fit-content' : 'initial')};\n`;\n\nexport const BadgeChildrenContainer = styled.span\n .withConfig({\n shouldForwardProp\n })\n .attrs(applyDefaultTheme)`\n align-self: center;\n height: fit-content;\n margin-right: 8px;\n`;\n\nexport const BadgeLabel = styled.span\n .withConfig({\n shouldForwardProp\n })\n .attrs(applyDefaultTheme)`\n border-radius: ${props => (props.$elevated ? '12px' : '14px')};\n display: flex;\n align-items: center;\n justify-content: center;\n box-sizing: border-box;\n\n font-size: ${props => {\n if (props.fontSize) {\n return `${props.fontSize}px`;\n } else {\n return props.elevated ? '0.625rem' : '0.750rem';\n }\n }};\n font-weight: ${props => (props.fontWeight ? props.fontWeight : 'normal')};\n line-height: ${props => (props.$lineHeight ? `${props.$lineHeight}px` : 'normal')};\n height: ${props => (props.height ? `${props.height}px` : 'fit-content')};\n letter-spacing: 0.32px;\n margin-left: ${props => (props.$elevated ? '15px' : 'auto')};\n position: ${props => (props.$elevated ? 'absolute' : 'initial')};\n right: 0;\n transform: ${props => (props.$elevated ? 'translate(33%, -8px)' : 'initial')};\n\n ${props =>\n props.width\n ? css`\n width: ${props.width}px;\n `\n : null}\n\n ${props =>\n props.$minWidth\n ? css`\n min-width: ${props.$minWidth}px;\n `\n : null}\n\n ${props =>\n props.$minHeight\n ? css`\n min-height: ${props.$minHeight}px;\n `\n : null}\n\n ${props => {\n const verticalPadding = props.verticalPadding\n ? `${props.verticalPadding}px`\n : props.$elevated\n ? '4px'\n : '6px';\n const horizontalPadding = props.$horizontalPadding\n ? `${props.$horizontalPadding}px`\n : props.$elevated\n ? '7px'\n : '10px';\n return css`\n padding: ${verticalPadding} ${horizontalPadding};\n `;\n }}\n\n ${props =>\n props.theme.themeProp(\n 'background',\n () => {\n const active = props.$active;\n const error = props.$error;\n const warning = props.$warning;\n\n const defaultBgColor = props?.$backgroundColors?.[0] ?? props.theme.getColor('gray-600');\n\n switch (true) {\n case !error && !warning && !active:\n return defaultBgColor;\n\n case !error && !warning && active:\n return props.theme.getColor('gray-700');\n\n case error && active:\n return props.theme.getColor('red-500');\n\n case error:\n return props.theme.getColor('red-200');\n\n case warning && active:\n return props.theme.getColor('signal-yellow-500');\n\n case warning:\n return props.theme.getColor('signal-yellow-400');\n\n default:\n return props.theme.getColor('gray-600');\n }\n },\n () => {\n const active = props.$active;\n const error = props.$error;\n const warning = props.$warning;\n\n const defaultBgColor = props?.$backgroundColors?.[1] ?? props.theme.getColor('gray-200');\n\n switch (true) {\n case !error && !warning && !active:\n return defaultBgColor;\n\n case !error && !warning && active:\n return props.theme.getColor('white');\n\n case error && active:\n return props.theme.getColor('red-500');\n\n case error:\n return props.theme.getColor('red-200');\n\n case warning && active:\n return props.theme.getColor('signal-yellow-500');\n\n case warning:\n return props.theme.getColor('signal-yellow-400');\n\n default:\n return props.theme.getColor('gray-200');\n }\n }\n )}\n\n ${props =>\n props.theme.themeProp(\n 'color',\n () => {\n const defaultColor = props?.$colors?.[0] ?? props.theme.getColor('white');\n if ((props.$warning && !props.$error) || (props.error && !props.$active)) {\n return props.theme.getColor('gray-900');\n } else {\n return defaultColor;\n }\n },\n () => {\n const defaultColor = props?.$colors?.[1] ?? props.theme.getColor('gray-900');\n if (props.$error && props.$active) {\n return props.theme.getColor('white');\n } else {\n return defaultColor;\n }\n }\n )}\n\n ${props =>\n props.$borderColors &&\n css`\n border: 1px solid;\n ${props.theme.themeProp('border-color', props.$borderColors[0], props.$borderColors[1])}\n `}\n`;\n\nexport const BadgeIcon = styled.span\n .withConfig({\n shouldForwardProp\n })\n .attrs(applyDefaultTheme)`\n display: flex;\n align-items: center;\n margin-right: ${props => (props.$useGutter ? '4px' : 0)};\n svg {\n height: 12px;\n }\n`;\n"],"names":["shouldForwardProp","prop","startsWith","Badge","styled","span","withConfig","attrs","applyDefaultTheme","props","$elevated","$hasChildren","theme","primaryFontFamily","BadgeChildrenContainer","BadgeLabel","fontSize","elevated","fontWeight","$lineHeight","height","width","css","$minWidth","$minHeight","verticalPadding","horizontalPadding","$horizontalPadding","themeProp","active","$active","error","$error","warning","$warning","defaultBgColor","$backgroundColors","getColor","defaultColor","$colors","$borderColors","BadgeIcon","$useGutter"],"mappings":";;;AAGA,MAAMA,iBAAiB,GAAGC,IAAI,IAAI;EAChC,OAAOA,IAAI,KAAK,OAAO,IAAI,CAACA,IAAI,CAACC,UAAU,CAAC,GAAG,CAAC,CAAA;AAClD,CAAC,CAAA;AAEM,MAAMC,KAAK,GAAGC,MAAM,CAACC,IAAI,CAC7BC,UAAU,CAAC;AACVN,EAAAA,iBAAAA;AACF,CAAC,CAAC,CACDO,KAAK,CAACC,iBAAiB,CAAC,CAAA;AAC3B;AACA,WAAA,EAAaC,KAAK,IAAKA,KAAK,CAACC,SAAS,IAAI,CAACD,KAAK,CAACE,YAAY,GAAG,aAAa,GAAG,MAAO,CAAA;AACvF,eAAA,EAAiBF,KAAK,IAAIA,KAAK,CAACG,KAAK,CAACC,iBAAiB,CAAA;AACvD;AACA;AACA;AACA;AACA,SAAWJ,EAAAA,KAAK,IAAKA,KAAK,CAACC,SAAS,GAAG,aAAa,GAAG,SAAU,CAAA;AACjE,EAAC;AAEM,MAAMI,sBAAsB,GAAGV,MAAM,CAACC,IAAI,CAC9CC,UAAU,CAAC;AACVN,EAAAA,iBAAAA;AACF,CAAC,CAAC,CACDO,KAAK,CAACC,iBAAiB,CAAC,CAAA;AAC3B;AACA;AACA;AACA,EAAC;AAEM,MAAMO,UAAU,GAAGX,MAAM,CAACC,IAAI,CAClCC,UAAU,CAAC;AACVN,EAAAA,iBAAAA;AACF,CAAC,CAAC,CACDO,KAAK,CAACC,iBAAiB,CAAC,CAAA;AAC3B,iBAAmBC,EAAAA,KAAK,IAAKA,KAAK,CAACC,SAAS,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B,KAAK,CAACuB,MAAM,IAAIvB,KAAK,CAACqB,OAAO,EAAE;AACjC,IAAA,OAAOrB,KAAK,CAACG,KAAK,CAACyB,QAAQ,CAAC,OAAO,CAAC,CAAA;AACtC,GAAC,MAAM;AACL,IAAA,OAAOC,YAAY,CAAA;AACrB,GAAA;AACF,CACF,CAAC,CAAA;AACP;AACA,IAAA,EAAM7B,KAAK,IACLA,KAAK,CAAC+B,aAAa,IACnBlB,GAAG,CAAA;AACT;AACA,QAAUb,EAAAA,KAAK,CAACG,KAAK,CAACgB,SAAS,CAAC,cAAc,EAAEnB,KAAK,CAAC+B,aAAa,CAAC,CAAC,CAAC,EAAE/B,KAAK,CAAC+B,aAAa,CAAC,CAAC,CAAC,CAAC,CAAA;AAC/F,MAAO,CAAA,CAAA;AACP,EAAC;AAEM,MAAMC,SAAS,GAAGrC,MAAM,CAACC,IAAI,CACjCC,UAAU,CAAC;AACVN,EAAAA,iBAAAA;AACF,CAAC,CAAC,CACDO,KAAK,CAACC,iBAAiB,CAAC,CAAA;AAC3B;AACA;AACA,gBAAkBC,EAAAA,KAAK,IAAKA,KAAK,CAACiC,UAAU,GAAG,KAAK,GAAG,CAAE,CAAA;AACzD;AACA;AACA;AACA;;;;"}
|
|
1
|
+
{"version":3,"file":"Badge.styled.js","sources":["../../../src/components/data/Badge/Badge.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 * THIS IS THE MOST DEFECT-DENSE FILE OF THE `data/` BATCH: `BadgeLabel` reads eight keys\n * that are not what the component passes. Four are non-`$` reads of props the component\n * DOES pass, so they also leak to the DOM (`fontSize`, `fontWeight`, `height`, `width`);\n * three are reads of keys nothing passes at all, so the branch is dead (`elevated`,\n * `verticalPadding`, `error`); and one is the mirror image — `$elevatedverticalPadding`,\n * a run-together name of the §E.3 family, is passed and never read.\n *\n * ALL OF THEM ARE DECLARED HERE AND NONE IS FIXED HERE. Repointing a dead read or\n * dropping a `$`-less one changes rendered CSS or rendered DOM, which is C10 work with a\n * baseline re-record (§J.8). Each declaration below names its own fix.\n *\n * WHOEVER DOES THAT C10 WORK: THE BLAST RADIUS IS LARGER THAN THIS COMPONENT.\n * `data/SeverityBadge` wraps `Badge`, so it carries the same three leaked attributes in the\n * recorded baseline (`font-size`, `font-weight`, `height` on its label `<span>`) and its\n * entries move too.\n */\nimport styled, { css } from 'styled-components';\nimport { applyDefaultTheme } from '../../../utils/defaultTheme';\n\n/** Props of the `Badge` root, i.e. what `Badge.tsx` passes to `S.Badge`. */\nexport interface BadgeStyleProps {\n /** `elevated` — `PropTypes.bool`; positions the label on top of the children. */\n $elevated?: boolean;\n /** `Boolean(children)`, derived in the component, so genuinely `boolean`. */\n $hasChildren?: boolean;\n}\n\n/**\n * Props of `BadgeLabel`. Value types from `Badge.tsx`'s propTypes; all optional per §J.5.\n *\n * Read the file header before adding to this list: eight of these members exist because\n * the template and the component disagree about the key, not because they are wanted.\n */\ninterface BadgeLabelStyleProps {\n /** `elevated` — drives border-radius, margin, position and transform below. */\n $elevated?: boolean;\n /** `active` — `PropTypes.bool`. */\n $active?: boolean;\n /** `error` — `PropTypes.bool`. Takes priority over `$warning`. */\n $error?: boolean;\n /** `warning` — `PropTypes.bool`. */\n $warning?: boolean;\n /**\n * `lineHeight` — `PropTypes.oneOfType([number, string])`.\n *\n * DEFECT, DECLARED NOT FIXED: `Badge.tsx` DEFAULTS `lineHeight` TO THE STRING\n * `'normal'`, and the template emits `${props.$lineHeight}px` whenever the value is\n * truthy — so every Badge that does not override it renders the invalid declaration\n * `line-height: normalpx`, which browsers drop. The effect happens to match the\n * intended `normal`, which is why it has gone unnoticed. Fixing it (default `undefined`,\n * or a unit-aware interpolation) changes the emitted CSS text, so it is C10 work.\n */\n $lineHeight?: number | string;\n /** `horizontalPadding` — `PropTypes.number`, px. The one padding key that matches. */\n $horizontalPadding?: number;\n /** `minHeight` — `PropTypes.number`, px. */\n $minHeight?: number;\n /** `minWidth` — `PropTypes.number`, px. */\n $minWidth?: number;\n /** `backgroundColors` — `[darkThemeColor, lightThemeColor]`, read by index. */\n $backgroundColors?: string[];\n /** `colors` — font colour as `[darkThemeColor, lightThemeColor]`, read by index. */\n $colors?: string[];\n /** `borderColors` — `[dark, light]`; when set, a 1px solid border is applied. */\n $borderColors?: string[];\n /**\n * `verticalPadding` — `PropTypes.number`, px.\n *\n * DEFECT, DECLARED NOT FIXED, AND IT IS THE §E.3 RUN-TOGETHER-NAME FAMILY.\n * `Badge.tsx:85` passes `$elevatedverticalPadding={verticalPadding}` — `$elevated` and\n * `verticalPadding` run together — while the template below reads the plain\n * `verticalPadding`. Neither name is the other's, so BOTH sides are dead: nothing ever\n * supplies the key this reads, and nothing ever reads the key the component supplies.\n * `verticalPadding` has therefore never had any effect; every Badge falls through to\n * the `$elevated ? '4px' : '6px'` default.\n *\n * The fix is to make both ends `$verticalPadding`, which ACTIVATES A BRANCH THAT HAS\n * NEVER FIRED and so changes rendered padding. C10, with a re-record.\n */\n verticalPadding?: number;\n /**\n * `$elevatedverticalPadding` — the key `Badge.tsx:85` actually passes. DECLARED BECAUSE\n * THE COMPONENT PASSES IT, NOT BECAUSE ANYTHING READS IT; see `verticalPadding` above.\n * Harmless in the DOM (the `$` prefix means `shouldForwardProp` still filters it), so\n * unlike the four leaks below this one is invisible rather than wrong.\n */\n $elevatedverticalPadding?: number;\n /**\n * `elevated` in its non-`$` form — read at the `font-size` block below, and NEVER\n * PASSED (the component passes `$elevated`).\n *\n * DEFECT, DECLARED NOT FIXED: the ternary always takes the false arm, so an elevated\n * Badge renders `font-size: 0.750rem` instead of the intended `0.625rem`. Fix: read\n * `props.$elevated`, which is already declared above — a CSS change, so C10.\n */\n elevated?: boolean;\n /**\n * `error` in its non-`$` form — read inside the dark-mode `color` callback, and NEVER\n * PASSED.\n *\n * DEFECT, DECLARED NOT FIXED: it makes the second disjunct of\n * `(props.$warning && !props.$error) || (props.error && !props.$active)` permanently\n * `false`, so an inactive error Badge never gets the `gray-900` text colour in dark\n * mode. Fix: `props.$error` — a colour change, so C10.\n */\n error?: boolean;\n /**\n * `fontSize` — `PropTypes.oneOfType([number, string])`.\n *\n * DEFECT, DECLARED NOT FIXED: no `$`. `Badge.tsx:79` passes it and\n * `shouldForwardProp` forwards every non-`$` prop, so a caller-supplied `fontSize` also\n * lands on the rendered `<span>` — AS `font-size=\"15\"`, NOT `fontSize=\"15\"`: React maps\n * this particular camelCase name to its hyphenated attribute form. CONFIRMED, not\n * inferred: `scripts/r19-harness/baseline.json` records `<span font-size=\"12\" …>` for\n * every `data/Badge` entry. Note the `string` half of the propTypes union is also a\n * trap: the template emits `${props.fontSize}px`, so `fontSize=\"15px\"` would render\n * `15pxpx`. Fix: `$fontSize` at both ends — removes a DOM attribute, so C10. §E.4's\n * third case.\n */\n fontSize?: number | string;\n /**\n * `fontWeight` — `PropTypes.oneOfType([number, string])`, interpolated raw so both\n * halves are safe. Same non-`$` DOM leak as `fontSize`, hyphenated the same way, and\n * this is the UNCONDITIONAL one: `Badge.tsx:80` passes it and `Badge.tsx:49` defaults it\n * to `'normal'`, so `font-weight=\"normal\"` is on EVERY rendered label whether the caller\n * sets anything or not. Verified by rendering `<Badge badgeContent={5} />` with no other\n * prop. Fix: `$fontWeight` at both ends — C10.\n */\n fontWeight?: number | string;\n /**\n * `height` — `PropTypes.number`, px. Same non-`$` DOM leak; `Badge.tsx:87` passes it.\n * `height` is not a valid attribute on a `<span>`. CONFIRMED: the baseline records\n * `<span … height=\"24\" …>` for every `data/Badge` entry. Fix: `$height` — C10.\n */\n height?: number;\n /**\n * `width` — `PropTypes.number`, px. Same non-`$` DOM leak; `Badge.tsx:89` passes it. No\n * baseline fixture sets it, so it is absent there, but rendering the built `Badge` with\n * `width={50}` puts `width=\"50\"` on the `<span>`. Fix: `$width` — C10.\n */\n width?: number;\n}\n\n/** Props of `BadgeIcon`. */\ninterface BadgeIconStyleProps {\n /** `!!badgeContent`, derived in the component — adds the gutter between icon and text. */\n $useGutter?: boolean;\n}\n\n/*\n * Single-argument, and it stays that way — peer floor `styled-components: >=5.1.0`, and\n * the two majors disagree on the second parameter. §J.4. `prop` needs the annotation\n * because `withConfig` takes this by reference, so it gets no contextual typing.\n */\nconst shouldForwardProp = (prop: string): boolean => {\n return prop !== 'theme' && !prop.startsWith('$');\n};\n\nexport const Badge = styled.span\n .withConfig({\n shouldForwardProp\n })\n .attrs<BadgeStyleProps>(applyDefaultTheme)`\n align-content: center;\n display: ${props => (props.$elevated || !props.$hasChildren ? 'inline-flex' : 'flex')};\n font-family: ${props => props.theme.primaryFontFamily};\n font-size: 1rem;\n font-weight: 500;\n min-height: 24px;\n position: relative;\n width: ${props => (props.$elevated ? 'fit-content' : 'initial')};\n`;\n\nexport const BadgeChildrenContainer = styled.span\n .withConfig({\n shouldForwardProp\n })\n .attrs(applyDefaultTheme)`\n align-self: center;\n height: fit-content;\n margin-right: 8px;\n`;\n\nexport const BadgeLabel = styled.span\n .withConfig({\n shouldForwardProp\n })\n .attrs<BadgeLabelStyleProps>(applyDefaultTheme)`\n border-radius: ${props => (props.$elevated ? '12px' : '14px')};\n display: flex;\n align-items: center;\n justify-content: center;\n box-sizing: border-box;\n\n font-size: ${props => {\n if (props.fontSize) {\n return `${props.fontSize}px`;\n } else {\n return props.elevated ? '0.625rem' : '0.750rem';\n }\n }};\n font-weight: ${props => (props.fontWeight ? props.fontWeight : 'normal')};\n line-height: ${props => (props.$lineHeight ? `${props.$lineHeight}px` : 'normal')};\n height: ${props => (props.height ? `${props.height}px` : 'fit-content')};\n letter-spacing: 0.32px;\n margin-left: ${props => (props.$elevated ? '15px' : 'auto')};\n position: ${props => (props.$elevated ? 'absolute' : 'initial')};\n right: 0;\n transform: ${props => (props.$elevated ? 'translate(33%, -8px)' : 'initial')};\n\n ${props =>\n props.width\n ? css`\n width: ${props.width}px;\n `\n : null}\n\n ${props =>\n props.$minWidth\n ? css`\n min-width: ${props.$minWidth}px;\n `\n : null}\n\n ${props =>\n props.$minHeight\n ? css`\n min-height: ${props.$minHeight}px;\n `\n : null}\n\n ${props => {\n const verticalPadding = props.verticalPadding\n ? `${props.verticalPadding}px`\n : props.$elevated\n ? '4px'\n : '6px';\n const horizontalPadding = props.$horizontalPadding\n ? `${props.$horizontalPadding}px`\n : props.$elevated\n ? '7px'\n : '10px';\n return css`\n padding: ${verticalPadding} ${horizontalPadding};\n `;\n }}\n\n ${props =>\n props.theme.themeProp(\n 'background',\n () => {\n const active = props.$active;\n const error = props.$error;\n const warning = props.$warning;\n\n const defaultBgColor = props?.$backgroundColors?.[0] ?? props.theme.getColor('gray-600');\n\n switch (true) {\n case !error && !warning && !active:\n return defaultBgColor;\n\n case !error && !warning && active:\n return props.theme.getColor('gray-700');\n\n case error && active:\n return props.theme.getColor('red-500');\n\n case error:\n return props.theme.getColor('red-200');\n\n case warning && active:\n return props.theme.getColor('signal-yellow-500');\n\n case warning:\n return props.theme.getColor('signal-yellow-400');\n\n default:\n return props.theme.getColor('gray-600');\n }\n },\n () => {\n const active = props.$active;\n const error = props.$error;\n const warning = props.$warning;\n\n const defaultBgColor = props?.$backgroundColors?.[1] ?? props.theme.getColor('gray-200');\n\n switch (true) {\n case !error && !warning && !active:\n return defaultBgColor;\n\n case !error && !warning && active:\n return props.theme.getColor('white');\n\n case error && active:\n return props.theme.getColor('red-500');\n\n case error:\n return props.theme.getColor('red-200');\n\n case warning && active:\n return props.theme.getColor('signal-yellow-500');\n\n case warning:\n return props.theme.getColor('signal-yellow-400');\n\n default:\n return props.theme.getColor('gray-200');\n }\n }\n )}\n\n ${props =>\n props.theme.themeProp(\n 'color',\n () => {\n const defaultColor = props?.$colors?.[0] ?? props.theme.getColor('white');\n if ((props.$warning && !props.$error) || (props.error && !props.$active)) {\n return props.theme.getColor('gray-900');\n } else {\n return defaultColor;\n }\n },\n () => {\n const defaultColor = props?.$colors?.[1] ?? props.theme.getColor('gray-900');\n if (props.$error && props.$active) {\n return props.theme.getColor('white');\n } else {\n return defaultColor;\n }\n }\n )}\n\n ${props =>\n props.$borderColors &&\n css`\n border: 1px solid;\n ${props.theme.themeProp('border-color', props.$borderColors[0], props.$borderColors[1])}\n `}\n`;\n\nexport const BadgeIcon = styled.span\n .withConfig({\n shouldForwardProp\n })\n .attrs<BadgeIconStyleProps>(applyDefaultTheme)`\n display: flex;\n align-items: center;\n margin-right: ${props => (props.$useGutter ? '4px' : 0)};\n svg {\n height: 12px;\n }\n`;\n"],"names":["shouldForwardProp","prop","startsWith","Badge","styled","span","withConfig","attrs","applyDefaultTheme","displayName","componentId","props","$elevated","$hasChildren","theme","primaryFontFamily","BadgeChildrenContainer","BadgeLabel","fontSize","elevated","fontWeight","$lineHeight","height","width","css","$minWidth","$minHeight","verticalPadding","horizontalPadding","$horizontalPadding","themeProp","active","$active","error","$error","warning","$warning","defaultBgColor","$backgroundColors","getColor","defaultColor","$colors","$borderColors","BadgeIcon","$useGutter"],"mappings":";;;AA+JA,MAAMA,iBAAiB,GAAIC,IAAY,IAAc;EACnD,OAAOA,IAAI,KAAK,OAAO,IAAI,CAACA,IAAI,CAACC,UAAU,CAAC,GAAG,CAAC;AAClD,CAAC;AAEM,MAAMC,KAAK,GAAGC,MAAM,CAACC,IAAI,CAC7BC,UAAU,CAAC;AACVN,EAAAA;AACF,CAAC,CAAC,CACDO,KAAK,CAAkBC,iBAAiB,CAAC,CAAAF,UAAA,CAAA;EAAAG,WAAA,EAAA,oBAAA;EAAAC,WAAA,EAAA;AAAA,CAAA,CAAA,CAAA,CAAA,+BAAA,EAAA,eAAA,EAAA,0EAAA,EAAA,GAAA,CAAA,EAE/BC,KAAK,IAAKA,KAAK,CAACC,SAAS,IAAI,CAACD,KAAK,CAACE,YAAY,GAAG,aAAa,GAAG,MAAO,EACtEF,KAAK,IAAIA,KAAK,CAACG,KAAK,CAACC,iBAAiB,EAK5CJ,KAAK,IAAKA,KAAK,CAACC,SAAS,GAAG,aAA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