@chayns-components/core 5.5.30 → 5.5.34
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/lib/cjs/components/accordion/Accordion.js +10 -0
- package/lib/cjs/components/accordion/Accordion.js.map +1 -1
- package/lib/cjs/components/accordion/Accordion.styles.js +0 -2
- package/lib/cjs/components/accordion/Accordion.styles.js.map +1 -1
- package/lib/cjs/components/amount-control/AmountControl.js +14 -3
- package/lib/cjs/components/amount-control/AmountControl.js.map +1 -1
- package/lib/cjs/components/amount-control/AmountControl.styles.js +0 -17
- package/lib/cjs/components/amount-control/AmountControl.styles.js.map +1 -1
- package/lib/cjs/components/button/Button.js +6 -1
- package/lib/cjs/components/button/Button.js.map +1 -1
- package/lib/cjs/components/button/Button.styles.js +0 -10
- package/lib/cjs/components/button/Button.styles.js.map +1 -1
- package/lib/cjs/components/checkbox/Checkbox.js +8 -1
- package/lib/cjs/components/checkbox/Checkbox.js.map +1 -1
- package/lib/cjs/components/checkbox/Checkbox.styles.js +0 -10
- package/lib/cjs/components/checkbox/Checkbox.styles.js.map +1 -1
- package/lib/cjs/components/combobox/ComboBox.js +7 -1
- package/lib/cjs/components/combobox/ComboBox.js.map +1 -1
- package/lib/cjs/components/combobox/ComboBox.styles.js +3 -10
- package/lib/cjs/components/combobox/ComboBox.styles.js.map +1 -1
- package/lib/cjs/components/context-menu/ContextMenu.js +12 -0
- package/lib/cjs/components/context-menu/ContextMenu.js.map +1 -1
- package/lib/cjs/components/context-menu/ContextMenu.styles.js +7 -35
- package/lib/cjs/components/context-menu/ContextMenu.styles.js.map +1 -1
- package/lib/cjs/components/file-list/file-item/FileItem.js +7 -0
- package/lib/cjs/components/file-list/file-item/FileItem.js.map +1 -1
- package/lib/cjs/components/file-list/file-item/FileItem.styles.js +1 -11
- package/lib/cjs/components/file-list/file-item/FileItem.styles.js.map +1 -1
- package/lib/cjs/components/file-select/FileSelect.js +12 -3
- package/lib/cjs/components/file-select/FileSelect.js.map +1 -1
- package/lib/cjs/components/file-select/FileSelect.styles.js +3 -9
- package/lib/cjs/components/file-select/FileSelect.styles.js.map +1 -1
- package/lib/cjs/components/filter/Filter.js +44 -16
- package/lib/cjs/components/filter/Filter.js.map +1 -1
- package/lib/cjs/components/filter/Filter.styles.js +2 -2
- package/lib/cjs/components/filter/Filter.styles.js.map +1 -1
- package/lib/cjs/components/filter-buttons/filter-button/FilterButton.js +9 -1
- package/lib/cjs/components/filter-buttons/filter-button/FilterButton.js.map +1 -1
- package/lib/cjs/components/filter-buttons/filter-button/FilterButton.styles.js +0 -2
- package/lib/cjs/components/filter-buttons/filter-button/FilterButton.styles.js.map +1 -1
- package/lib/cjs/components/grid-image/GridImage.js +7 -1
- package/lib/cjs/components/grid-image/GridImage.js.map +1 -1
- package/lib/cjs/components/grid-image/GridImage.styles.js +5 -10
- package/lib/cjs/components/grid-image/GridImage.styles.js.map +1 -1
- package/lib/cjs/components/grouped-image/GroupedImage.js +8 -2
- package/lib/cjs/components/grouped-image/GroupedImage.js.map +1 -1
- package/lib/cjs/components/grouped-image/GroupedImage.styles.js +3 -8
- package/lib/cjs/components/grouped-image/GroupedImage.styles.js.map +1 -1
- package/lib/cjs/components/highlight-slider/highlight-slider-item/HighlightSliderItem.js +7 -2
- package/lib/cjs/components/highlight-slider/highlight-slider-item/HighlightSliderItem.js.map +1 -1
- package/lib/cjs/components/highlight-slider/highlight-slider-item/HighlightSliderItem.styles.js +5 -10
- package/lib/cjs/components/highlight-slider/highlight-slider-item/HighlightSliderItem.styles.js.map +1 -1
- package/lib/cjs/components/icon/Icon.js +10 -2
- package/lib/cjs/components/icon/Icon.js.map +1 -1
- package/lib/cjs/components/icon/Icon.styles.js +6 -32
- package/lib/cjs/components/icon/Icon.styles.js.map +1 -1
- package/lib/cjs/components/input/Input.js +14 -2
- package/lib/cjs/components/input/Input.js.map +1 -1
- package/lib/cjs/components/input/Input.styles.js +0 -3
- package/lib/cjs/components/input/Input.styles.js.map +1 -1
- package/lib/cjs/components/list/List.utils.js +3 -9
- package/lib/cjs/components/list/List.utils.js.map +1 -1
- package/lib/cjs/components/list/list-item/ListItem.js +13 -2
- package/lib/cjs/components/list/list-item/ListItem.js.map +1 -1
- package/lib/cjs/components/list/list-item/ListItem.styles.js +9 -2
- package/lib/cjs/components/list/list-item/ListItem.styles.js.map +1 -1
- package/lib/cjs/components/list/list-item/list-item-head/ListItemHead.js +5 -4
- package/lib/cjs/components/list/list-item/list-item-head/ListItemHead.js.map +1 -1
- package/lib/cjs/components/list/list-item/list-item-head/list-item-image/ListItemImage.js +2 -5
- package/lib/cjs/components/list/list-item/list-item-head/list-item-image/ListItemImage.js.map +1 -1
- package/lib/cjs/components/multi-action-button/action-button/ActionButton.js +8 -2
- package/lib/cjs/components/multi-action-button/action-button/ActionButton.js.map +1 -1
- package/lib/cjs/components/multi-action-button/action-button/ActionButton.styles.js +3 -12
- package/lib/cjs/components/multi-action-button/action-button/ActionButton.styles.js.map +1 -1
- package/lib/cjs/components/radio-button/RadioButton.js +7 -1
- package/lib/cjs/components/radio-button/RadioButton.js.map +1 -1
- package/lib/cjs/components/radio-button/RadioButton.styles.js +0 -10
- package/lib/cjs/components/radio-button/RadioButton.styles.js.map +1 -1
- package/lib/cjs/components/search-input/SearchInput.js +9 -10
- package/lib/cjs/components/search-input/SearchInput.js.map +1 -1
- package/lib/cjs/components/search-input/SearchInput.styles.js +5 -15
- package/lib/cjs/components/search-input/SearchInput.styles.js.map +1 -1
- package/lib/cjs/components/sharing-bar/SharingBar.js +13 -0
- package/lib/cjs/components/sharing-bar/SharingBar.js.map +1 -1
- package/lib/cjs/components/sharing-bar/SharingBar.styles.js +1 -5
- package/lib/cjs/components/sharing-bar/SharingBar.styles.js.map +1 -1
- package/lib/cjs/components/slider/Slider.js +13 -6
- package/lib/cjs/components/slider/Slider.js.map +1 -1
- package/lib/cjs/components/slider/Slider.styles.js +2 -9
- package/lib/cjs/components/slider/Slider.styles.js.map +1 -1
- package/lib/cjs/components/slider-button/SliderButton.js +6 -2
- package/lib/cjs/components/slider-button/SliderButton.js.map +1 -1
- package/lib/cjs/components/slider-button/SliderButton.styles.js +2 -15
- package/lib/cjs/components/slider-button/SliderButton.styles.js.map +1 -1
- package/lib/cjs/components/tag-input/TagInput.js +8 -1
- package/lib/cjs/components/tag-input/TagInput.js.map +1 -1
- package/lib/cjs/components/tag-input/TagInput.styles.js +1 -3
- package/lib/cjs/components/tag-input/TagInput.styles.js.map +1 -1
- package/lib/cjs/components/text-area/TextArea.js +68 -56
- package/lib/cjs/components/text-area/TextArea.js.map +1 -1
- package/lib/cjs/components/text-area/TextArea.styles.js +0 -2
- package/lib/cjs/components/text-area/TextArea.styles.js.map +1 -1
- package/lib/cjs/components/truncation/Truncation.js +9 -5
- package/lib/cjs/components/truncation/Truncation.js.map +1 -1
- package/lib/cjs/components/truncation/Truncation.styles.js +0 -11
- package/lib/cjs/components/truncation/Truncation.styles.js.map +1 -1
- package/lib/cjs/hooks/useFocusRingPortal.js +197 -0
- package/lib/cjs/hooks/useFocusRingPortal.js.map +1 -0
- package/lib/cjs/hooks/useKeyboardFocusHighlighting.js +9 -3
- package/lib/cjs/hooks/useKeyboardFocusHighlighting.js.map +1 -1
- package/lib/cjs/index.js +14 -0
- package/lib/cjs/index.js.map +1 -1
- package/lib/esm/components/accordion/Accordion.js +10 -0
- package/lib/esm/components/accordion/Accordion.js.map +1 -1
- package/lib/esm/components/accordion/Accordion.styles.js +0 -2
- package/lib/esm/components/accordion/Accordion.styles.js.map +1 -1
- package/lib/esm/components/amount-control/AmountControl.js +14 -3
- package/lib/esm/components/amount-control/AmountControl.js.map +1 -1
- package/lib/esm/components/amount-control/AmountControl.styles.js +0 -17
- package/lib/esm/components/amount-control/AmountControl.styles.js.map +1 -1
- package/lib/esm/components/button/Button.js +7 -2
- package/lib/esm/components/button/Button.js.map +1 -1
- package/lib/esm/components/button/Button.styles.js +0 -10
- package/lib/esm/components/button/Button.styles.js.map +1 -1
- package/lib/esm/components/checkbox/Checkbox.js +8 -1
- package/lib/esm/components/checkbox/Checkbox.js.map +1 -1
- package/lib/esm/components/checkbox/Checkbox.styles.js +0 -10
- package/lib/esm/components/checkbox/Checkbox.styles.js.map +1 -1
- package/lib/esm/components/combobox/ComboBox.js +7 -1
- package/lib/esm/components/combobox/ComboBox.js.map +1 -1
- package/lib/esm/components/combobox/ComboBox.styles.js +3 -10
- package/lib/esm/components/combobox/ComboBox.styles.js.map +1 -1
- package/lib/esm/components/context-menu/ContextMenu.js +11 -0
- package/lib/esm/components/context-menu/ContextMenu.js.map +1 -1
- package/lib/esm/components/context-menu/ContextMenu.styles.js +7 -35
- package/lib/esm/components/context-menu/ContextMenu.styles.js.map +1 -1
- package/lib/esm/components/file-list/file-item/FileItem.js +8 -1
- package/lib/esm/components/file-list/file-item/FileItem.js.map +1 -1
- package/lib/esm/components/file-list/file-item/FileItem.styles.js +1 -11
- package/lib/esm/components/file-list/file-item/FileItem.styles.js.map +1 -1
- package/lib/esm/components/file-select/FileSelect.js +13 -4
- package/lib/esm/components/file-select/FileSelect.js.map +1 -1
- package/lib/esm/components/file-select/FileSelect.styles.js +3 -9
- package/lib/esm/components/file-select/FileSelect.styles.js.map +1 -1
- package/lib/esm/components/filter/Filter.js +43 -16
- package/lib/esm/components/filter/Filter.js.map +1 -1
- package/lib/esm/components/filter/Filter.styles.js +2 -2
- package/lib/esm/components/filter/Filter.styles.js.map +1 -1
- package/lib/esm/components/filter-buttons/filter-button/FilterButton.js +10 -2
- package/lib/esm/components/filter-buttons/filter-button/FilterButton.js.map +1 -1
- package/lib/esm/components/filter-buttons/filter-button/FilterButton.styles.js +0 -2
- package/lib/esm/components/filter-buttons/filter-button/FilterButton.styles.js.map +1 -1
- package/lib/esm/components/grid-image/GridImage.js +8 -2
- package/lib/esm/components/grid-image/GridImage.js.map +1 -1
- package/lib/esm/components/grid-image/GridImage.styles.js +4 -9
- package/lib/esm/components/grid-image/GridImage.styles.js.map +1 -1
- package/lib/esm/components/grouped-image/GroupedImage.js +9 -3
- package/lib/esm/components/grouped-image/GroupedImage.js.map +1 -1
- package/lib/esm/components/grouped-image/GroupedImage.styles.js +3 -8
- package/lib/esm/components/grouped-image/GroupedImage.styles.js.map +1 -1
- package/lib/esm/components/highlight-slider/highlight-slider-item/HighlightSliderItem.js +8 -3
- package/lib/esm/components/highlight-slider/highlight-slider-item/HighlightSliderItem.js.map +1 -1
- package/lib/esm/components/highlight-slider/highlight-slider-item/HighlightSliderItem.styles.js +4 -9
- package/lib/esm/components/highlight-slider/highlight-slider-item/HighlightSliderItem.styles.js.map +1 -1
- package/lib/esm/components/icon/Icon.js +9 -2
- package/lib/esm/components/icon/Icon.js.map +1 -1
- package/lib/esm/components/icon/Icon.styles.js +5 -31
- package/lib/esm/components/icon/Icon.styles.js.map +1 -1
- package/lib/esm/components/input/Input.js +14 -2
- package/lib/esm/components/input/Input.js.map +1 -1
- package/lib/esm/components/input/Input.styles.js +0 -3
- package/lib/esm/components/input/Input.styles.js.map +1 -1
- package/lib/esm/components/list/List.utils.js +1 -6
- package/lib/esm/components/list/List.utils.js.map +1 -1
- package/lib/esm/components/list/list-item/ListItem.js +13 -2
- package/lib/esm/components/list/list-item/ListItem.js.map +1 -1
- package/lib/esm/components/list/list-item/ListItem.styles.js +9 -2
- package/lib/esm/components/list/list-item/ListItem.styles.js.map +1 -1
- package/lib/esm/components/list/list-item/list-item-head/ListItemHead.js +5 -4
- package/lib/esm/components/list/list-item/list-item-head/ListItemHead.js.map +1 -1
- package/lib/esm/components/list/list-item/list-item-head/list-item-image/ListItemImage.js +2 -5
- package/lib/esm/components/list/list-item/list-item-head/list-item-image/ListItemImage.js.map +1 -1
- package/lib/esm/components/multi-action-button/action-button/ActionButton.js +7 -2
- package/lib/esm/components/multi-action-button/action-button/ActionButton.js.map +1 -1
- package/lib/esm/components/multi-action-button/action-button/ActionButton.styles.js +3 -12
- package/lib/esm/components/multi-action-button/action-button/ActionButton.styles.js.map +1 -1
- package/lib/esm/components/radio-button/RadioButton.js +7 -1
- package/lib/esm/components/radio-button/RadioButton.js.map +1 -1
- package/lib/esm/components/radio-button/RadioButton.styles.js +0 -10
- package/lib/esm/components/radio-button/RadioButton.styles.js.map +1 -1
- package/lib/esm/components/search-input/SearchInput.js +9 -10
- package/lib/esm/components/search-input/SearchInput.js.map +1 -1
- package/lib/esm/components/search-input/SearchInput.styles.js +5 -15
- package/lib/esm/components/search-input/SearchInput.styles.js.map +1 -1
- package/lib/esm/components/sharing-bar/SharingBar.js +12 -0
- package/lib/esm/components/sharing-bar/SharingBar.js.map +1 -1
- package/lib/esm/components/sharing-bar/SharingBar.styles.js +1 -5
- package/lib/esm/components/sharing-bar/SharingBar.styles.js.map +1 -1
- package/lib/esm/components/slider/Slider.js +13 -6
- package/lib/esm/components/slider/Slider.js.map +1 -1
- package/lib/esm/components/slider/Slider.styles.js +1 -8
- package/lib/esm/components/slider/Slider.styles.js.map +1 -1
- package/lib/esm/components/slider-button/SliderButton.js +6 -2
- package/lib/esm/components/slider-button/SliderButton.js.map +1 -1
- package/lib/esm/components/slider-button/SliderButton.styles.js +1 -14
- package/lib/esm/components/slider-button/SliderButton.styles.js.map +1 -1
- package/lib/esm/components/tag-input/TagInput.js +8 -1
- package/lib/esm/components/tag-input/TagInput.js.map +1 -1
- package/lib/esm/components/tag-input/TagInput.styles.js +1 -3
- package/lib/esm/components/tag-input/TagInput.styles.js.map +1 -1
- package/lib/esm/components/text-area/TextArea.js +68 -56
- package/lib/esm/components/text-area/TextArea.js.map +1 -1
- package/lib/esm/components/text-area/TextArea.styles.js +0 -2
- package/lib/esm/components/text-area/TextArea.styles.js.map +1 -1
- package/lib/esm/components/truncation/Truncation.js +9 -5
- package/lib/esm/components/truncation/Truncation.js.map +1 -1
- package/lib/esm/components/truncation/Truncation.styles.js +0 -11
- package/lib/esm/components/truncation/Truncation.styles.js.map +1 -1
- package/lib/esm/hooks/useFocusRingPortal.js +188 -0
- package/lib/esm/hooks/useFocusRingPortal.js.map +1 -0
- package/lib/esm/hooks/useKeyboardFocusHighlighting.js +7 -2
- package/lib/esm/hooks/useKeyboardFocusHighlighting.js.map +1 -1
- package/lib/esm/index.js +2 -0
- package/lib/esm/index.js.map +1 -1
- package/lib/types/components/amount-control/AmountControl.styles.d.ts +4 -8
- package/lib/types/components/button/Button.styles.d.ts +2 -4
- package/lib/types/components/checkbox/Checkbox.styles.d.ts +1 -5
- package/lib/types/components/combobox/ComboBox.styles.d.ts +2 -4
- package/lib/types/components/file-select/FileSelect.styles.d.ts +2 -4
- package/lib/types/components/grid-image/GridImage.styles.d.ts +2 -4
- package/lib/types/components/grouped-image/GroupedImage.styles.d.ts +2 -4
- package/lib/types/components/highlight-slider/highlight-slider-item/HighlightSliderItem.styles.d.ts +1 -5
- package/lib/types/components/icon/Icon.styles.d.ts +0 -1
- package/lib/types/components/input/Input.styles.d.ts +4 -4
- package/lib/types/components/multi-action-button/action-button/ActionButton.styles.d.ts +2 -4
- package/lib/types/components/radio-button/RadioButton.styles.d.ts +2 -4
- package/lib/types/components/search-input/SearchInput.styles.d.ts +6 -13
- package/lib/types/components/slider/Slider.styles.d.ts +8 -12
- package/lib/types/components/slider-button/SliderButton.styles.d.ts +2 -4
- package/lib/types/components/truncation/Truncation.styles.d.ts +1 -5
- package/lib/types/hooks/useFocusRingPortal.d.ts +18 -0
- package/lib/types/hooks/useKeyboardFocusHighlighting.d.ts +1 -0
- package/lib/types/index.d.ts +2 -0
- package/package.json +4 -4
- package/lib/cjs/utils/keyboardFocusHighlighting.styles.js +0 -29
- package/lib/cjs/utils/keyboardFocusHighlighting.styles.js.map +0 -1
- package/lib/esm/utils/keyboardFocusHighlighting.styles.js +0 -24
- package/lib/esm/utils/keyboardFocusHighlighting.styles.js.map +0 -1
- package/lib/types/utils/keyboardFocusHighlighting.styles.d.ts +0 -9
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ActionButton.js","names":["_react","require","_react2","_interopRequireDefault","_Icon","_Tooltip","_ActionButton","_popup","e","__esModule","default","LABEL_GAP","LABEL_TRANSITION","duration","ActionButton","action","actionType","backgroundColor","isCollapsed","isDisabled","isExpanded","isHidden","isShrunk","isSolo","onClick","onMouseEnter","onMouseLeave","onFocus","onBlur","showLabel","shouldUseContentWidth","height","shouldShowKeyboardHighlighting","_action$disabledReaso","_action$status","_action$status2","isPrimary","isSecondary","actionColor","color","isActionDisabled","Boolean","disabledReason","trim","shouldShowDisabledReason","iconSize","actionContent","createElement","StyledActionContent","StyledIconSlot","$height","$isDisabled","icon","icons","size","AnimatePresence","initial","StyledLabelWrapper","animate","opacity","width","marginLeft","exit","transition","StyledSecondaryLabel","style","label","StyledActionButton","disabled","$backgroundColor","$isCollapsed","$isExpanded","undefined","$isInteractionDisabled","$isHidden","$isPrimary","$isSecondary","$isShrunk","$isSolo","$pulseColors","status","pulseColors","$statusType","type","$shouldUseContentWidth","$shouldShowKeyboardHighlighting","alignment","PopupAlignment","BottomRight","item","text","maxItemWidth","displayName","_default","exports"],"sources":["../../../../../src/components/multi-action-button/action-button/ActionButton.tsx"],"sourcesContent":["import { AnimatePresence } from 'motion/react';\nimport React, { FC, FocusEventHandler, MouseEvent } from 'react';\nimport Icon from '../../icon/Icon';\nimport Tooltip from '../../tooltip/Tooltip';\nimport {\n StyledActionButton,\n StyledActionContent,\n StyledIconSlot,\n StyledLabelWrapper,\n StyledSecondaryLabel,\n} from './ActionButton.styles';\nimport type { MultiActionButtonAction } from '../MultiActionButton.types';\nimport { PopupAlignment } from '../../../types/popup';\n\nconst LABEL_GAP = 6;\nconst LABEL_TRANSITION = { duration: 0.3 };\n\nexport type ActionButtonProps = {\n action: MultiActionButtonAction;\n actionType: 'primary' | 'secondary';\n backgroundColor?: string;\n isCollapsed: boolean;\n isDisabled: boolean;\n isExpanded?: boolean;\n isHidden?: boolean;\n isShrunk?: boolean;\n isSolo?: boolean;\n onClick?: (event: MouseEvent<HTMLButtonElement>) => void;\n onMouseEnter?: () => void;\n onMouseLeave?: () => void;\n onFocus?: FocusEventHandler<HTMLButtonElement>;\n onBlur?: FocusEventHandler<HTMLButtonElement>;\n showLabel: boolean;\n shouldUseContentWidth: boolean;\n height: number;\n shouldShowKeyboardHighlighting?: boolean;\n};\n\n/**\n * Shared action button UI used by both primary and secondary actions.\n * Keeps layout and animations consistent while isolating styling details.\n */\nconst ActionButton: FC<ActionButtonProps> = ({\n action,\n actionType,\n backgroundColor,\n isCollapsed,\n isDisabled,\n isExpanded,\n isHidden,\n isShrunk,\n isSolo,\n onClick,\n onMouseEnter,\n onMouseLeave,\n onFocus,\n onBlur,\n showLabel,\n shouldUseContentWidth,\n height,\n shouldShowKeyboardHighlighting = false,\n}) => {\n const isPrimary = actionType === 'primary';\n const isSecondary = actionType === 'secondary';\n const actionColor = action.color ?? '#FFFFFF';\n const isActionDisabled = isDisabled || Boolean(action.isDisabled);\n const disabledReason = action.disabledReason?.trim();\n const shouldShowDisabledReason = Boolean(disabledReason) && isActionDisabled;\n const iconSize = height - 24;\n\n const actionContent = (\n <StyledActionContent>\n <StyledIconSlot $height={height} $isDisabled={isActionDisabled}>\n {typeof action.icon === 'string' ? (\n <Icon icons={[action.icon]} color={actionColor} size={iconSize} />\n ) : (\n action.icon\n )}\n </StyledIconSlot>\n <AnimatePresence initial={false}>\n {/* Animate width and margin to avoid layout jumps when labels mount/unmount. */}\n {showLabel && (\n <StyledLabelWrapper\n animate={{ opacity: 1, width: 'auto', marginLeft: LABEL_GAP }}\n exit={{ opacity: 0, width: 0, marginLeft: 0 }}\n initial={{ opacity: 0, width: 0, marginLeft: 0 }}\n transition={LABEL_TRANSITION}\n >\n <StyledSecondaryLabel style={{ color: actionColor }}>\n {action.label}\n </StyledSecondaryLabel>\n </StyledLabelWrapper>\n )}\n </AnimatePresence>\n </StyledActionContent>\n );\n\n return (\n <StyledActionButton\n aria-disabled={isActionDisabled}\n disabled={isActionDisabled && !shouldShowDisabledReason}\n $backgroundColor={backgroundColor}\n $isCollapsed={isCollapsed}\n $isExpanded={isSecondary ? isExpanded : undefined}\n $isInteractionDisabled={isActionDisabled}\n $isHidden={isSecondary ? isHidden : undefined}\n $isPrimary={isPrimary}\n $isSecondary={isSecondary}\n $isShrunk={isPrimary ? isShrunk : undefined}\n $isSolo={isPrimary ? isSolo : undefined}\n $pulseColors={action.status?.pulseColors}\n $height={height}\n $statusType={action.status?.type}\n $shouldUseContentWidth={shouldUseContentWidth}\n $shouldShowKeyboardHighlighting={shouldShowKeyboardHighlighting}\n onClick={onClick}\n onMouseEnter={onMouseEnter}\n onMouseLeave={onMouseLeave}\n onFocus={onFocus}\n onBlur={onBlur}\n type=\"button\"\n >\n {shouldShowDisabledReason && disabledReason ? (\n <Tooltip\n alignment={PopupAlignment.BottomRight}\n item={{ text: disabledReason }}\n maxItemWidth={400}\n >\n {actionContent}\n </Tooltip>\n ) : (\n actionContent\n )}\n </StyledActionButton>\n );\n};\n\nActionButton.displayName = 'ActionButton';\n\nexport default ActionButton;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,KAAA,GAAAD,sBAAA,CAAAF,OAAA;AACA,IAAAI,QAAA,GAAAF,sBAAA,CAAAF,OAAA;AACA,IAAAK,aAAA,GAAAL,OAAA;AAQA,IAAAM,MAAA,GAAAN,OAAA;AAAsD,SAAAE,uBAAAK,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAEtD,MAAMG,SAAS,GAAG,CAAC;AACnB,MAAMC,gBAAgB,GAAG;EAAEC,QAAQ,EAAE;AAAI,CAAC;AAuB1C;AACA;AACA;AACA;AACA,MAAMC,YAAmC,GAAGA,CAAC;EACzCC,MAAM;EACNC,UAAU;EACVC,eAAe;EACfC,WAAW;EACXC,UAAU;EACVC,UAAU;EACVC,QAAQ;EACRC,QAAQ;EACRC,MAAM;EACNC,OAAO;EACPC,YAAY;EACZC,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EAAEnB,MAAO;IAChBmD,WAAW,GAAA/C,eAAA,GAAEpB,MAAM,CAACiE,MAAM,cAAA7C,eAAA,uBAAbA,eAAA,CAAegD,IAAK;IACjCC,sBAAsB,EAAEtD,qBAAsB;IAC9CuD,+BAA+B,EAAErD,8BAA+B;IAChER,OAAO,EAAEA,OAAQ;IACjBC,YAAY,EAAEA,YAAa;IAC3BC,YAAY,EAAEA,YAAa;IAC3BC,OAAO,EAAEA,OAAQ;IACjBC,MAAM,EAAEA,MAAO;IACfuD,IAAI,EAAC;EAAQ,GAEZvC,wBAAwB,IAAIF,cAAc,gBACvCxC,OAAA,CAAAQ,OAAA,CAAAqC,aAAA,CAAC1C,QAAA,CAAAK,OAAO;IACJ4E,SAAS,EAAEC,qBAAc,CAACC,WAAY;IACtCC,IAAI,EAAE;MAAEC,IAAI,EAAEhD;IAAe,CAAE;IAC/BiD,YAAY,EAAE;EAAI,GAEjB7C,aACI,CAAC,GAEVA,aAEY,CAAC;AAE7B,CAAC;AAEDhC,YAAY,CAAC8E,WAAW,GAAG,cAAc;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAApF,OAAA,GAE3BI,YAAY","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"ActionButton.js","names":["_react","require","_react2","_interopRequireWildcard","_useFocusRingPortal","_Icon","_interopRequireDefault","_Tooltip","_ActionButton","_popup","e","__esModule","default","t","WeakMap","r","n","o","i","f","__proto__","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","LABEL_GAP","LABEL_TRANSITION","duration","ActionButton","action","actionType","backgroundColor","isCollapsed","isDisabled","isExpanded","isHidden","isShrunk","isSolo","onClick","onMouseEnter","onMouseLeave","onFocus","onBlur","showLabel","shouldUseContentWidth","height","shouldShowKeyboardHighlighting","_action$disabledReaso","_action$status","_action$status2","actionButtonRef","useRef","isPrimary","isSecondary","actionColor","color","isActionDisabled","Boolean","disabledReason","trim","shouldShowDisabledReason","iconSize","useFocusRingPortal","isEnabled","actionContent","createElement","StyledActionContent","StyledIconSlot","$height","$isDisabled","icon","icons","size","AnimatePresence","initial","StyledLabelWrapper","animate","opacity","width","marginLeft","exit","transition","StyledSecondaryLabel","style","label","StyledActionButton","ref","disabled","$backgroundColor","$isCollapsed","$isExpanded","undefined","$isInteractionDisabled","$isHidden","$isPrimary","$isSecondary","$isShrunk","$isSolo","$pulseColors","status","pulseColors","$statusType","type","$shouldUseContentWidth","alignment","PopupAlignment","BottomRight","item","text","maxItemWidth","displayName","_default","exports"],"sources":["../../../../../src/components/multi-action-button/action-button/ActionButton.tsx"],"sourcesContent":["import { AnimatePresence } from 'motion/react';\nimport React, { FC, FocusEventHandler, MouseEvent, useRef } from 'react';\nimport { useFocusRingPortal } from '../../../hooks/useFocusRingPortal';\nimport Icon from '../../icon/Icon';\nimport Tooltip from '../../tooltip/Tooltip';\nimport {\n StyledActionButton,\n StyledActionContent,\n StyledIconSlot,\n StyledLabelWrapper,\n StyledSecondaryLabel,\n} from './ActionButton.styles';\nimport type { MultiActionButtonAction } from '../MultiActionButton.types';\nimport { PopupAlignment } from '../../../types/popup';\n\nconst LABEL_GAP = 6;\nconst LABEL_TRANSITION = { duration: 0.3 };\n\nexport type ActionButtonProps = {\n action: MultiActionButtonAction;\n actionType: 'primary' | 'secondary';\n backgroundColor?: string;\n isCollapsed: boolean;\n isDisabled: boolean;\n isExpanded?: boolean;\n isHidden?: boolean;\n isShrunk?: boolean;\n isSolo?: boolean;\n onClick?: (event: MouseEvent<HTMLButtonElement>) => void;\n onMouseEnter?: () => void;\n onMouseLeave?: () => void;\n onFocus?: FocusEventHandler<HTMLButtonElement>;\n onBlur?: FocusEventHandler<HTMLButtonElement>;\n showLabel: boolean;\n shouldUseContentWidth: boolean;\n height: number;\n shouldShowKeyboardHighlighting?: boolean;\n};\n\n/**\n * Shared action button UI used by both primary and secondary actions.\n * Keeps layout and animations consistent while isolating styling details.\n */\nconst ActionButton: FC<ActionButtonProps> = ({\n action,\n actionType,\n backgroundColor,\n isCollapsed,\n isDisabled,\n isExpanded,\n isHidden,\n isShrunk,\n isSolo,\n onClick,\n onMouseEnter,\n onMouseLeave,\n onFocus,\n onBlur,\n showLabel,\n shouldUseContentWidth,\n height,\n shouldShowKeyboardHighlighting = false,\n}) => {\n const actionButtonRef = useRef<HTMLButtonElement>(null);\n\n const isPrimary = actionType === 'primary';\n const isSecondary = actionType === 'secondary';\n const actionColor = action.color ?? '#FFFFFF';\n const isActionDisabled = isDisabled || Boolean(action.isDisabled);\n const disabledReason = action.disabledReason?.trim();\n const shouldShowDisabledReason = Boolean(disabledReason) && isActionDisabled;\n const iconSize = height - 24;\n\n useFocusRingPortal(actionButtonRef, {\n isEnabled: shouldShowKeyboardHighlighting && !isActionDisabled,\n });\n\n const actionContent = (\n <StyledActionContent>\n <StyledIconSlot $height={height} $isDisabled={isActionDisabled}>\n {typeof action.icon === 'string' ? (\n <Icon icons={[action.icon]} color={actionColor} size={iconSize} />\n ) : (\n action.icon\n )}\n </StyledIconSlot>\n <AnimatePresence initial={false}>\n {/* Animate width and margin to avoid layout jumps when labels mount/unmount. */}\n {showLabel && (\n <StyledLabelWrapper\n animate={{ opacity: 1, width: 'auto', marginLeft: LABEL_GAP }}\n exit={{ opacity: 0, width: 0, marginLeft: 0 }}\n initial={{ opacity: 0, width: 0, marginLeft: 0 }}\n transition={LABEL_TRANSITION}\n >\n <StyledSecondaryLabel style={{ color: actionColor }}>\n {action.label}\n </StyledSecondaryLabel>\n </StyledLabelWrapper>\n )}\n </AnimatePresence>\n </StyledActionContent>\n );\n\n return (\n <StyledActionButton\n ref={actionButtonRef}\n aria-disabled={isActionDisabled}\n disabled={isActionDisabled && !shouldShowDisabledReason}\n $backgroundColor={backgroundColor}\n $isCollapsed={isCollapsed}\n $isExpanded={isSecondary ? isExpanded : undefined}\n $isInteractionDisabled={isActionDisabled}\n $isHidden={isSecondary ? isHidden : undefined}\n $isPrimary={isPrimary}\n $isSecondary={isSecondary}\n $isShrunk={isPrimary ? isShrunk : undefined}\n $isSolo={isPrimary ? isSolo : undefined}\n $pulseColors={action.status?.pulseColors}\n $height={height}\n $statusType={action.status?.type}\n $shouldUseContentWidth={shouldUseContentWidth}\n onClick={onClick}\n onMouseEnter={onMouseEnter}\n onMouseLeave={onMouseLeave}\n onFocus={onFocus}\n onBlur={onBlur}\n type=\"button\"\n >\n {shouldShowDisabledReason && disabledReason ? (\n <Tooltip\n alignment={PopupAlignment.BottomRight}\n item={{ text: disabledReason }}\n maxItemWidth={400}\n >\n {actionContent}\n </Tooltip>\n ) : (\n actionContent\n )}\n </StyledActionButton>\n );\n};\n\nActionButton.displayName = 'ActionButton';\n\nexport default ActionButton;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAC,uBAAA,CAAAF,OAAA;AACA,IAAAG,mBAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAC,sBAAA,CAAAL,OAAA;AACA,IAAAM,QAAA,GAAAD,sBAAA,CAAAL,OAAA;AACA,IAAAO,aAAA,GAAAP,OAAA;AAQA,IAAAQ,MAAA,GAAAR,OAAA;AAAsD,SAAAK,uBAAAI,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAP,wBAAAO,CAAA,EAAAG,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAX,uBAAA,YAAAA,CAAAO,CAAA,EAAAG,CAAA,SAAAA,CAAA,IAAAH,CAAA,IAAAA,CAAA,CAAAC,UAAA,SAAAD,CAAA,MAAAO,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAR,OAAA,EAAAF,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAAS,CAAA,MAAAF,CAAA,GAAAJ,CAAA,GAAAG,CAAA,GAAAD,CAAA,QAAAE,CAAA,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;IAC3BC,OAAO,EAAEA,OAAQ;IACjBC,MAAM,EAAEA,MAAO;IACf4D,IAAI,EAAC;EAAQ,GAEZ1C,wBAAwB,IAAIF,cAAc,gBACvC5D,OAAA,CAAAU,OAAA,CAAAyD,aAAA,CAAC9D,QAAA,CAAAK,OAAO;IACJgG,SAAS,EAAEC,qBAAc,CAACC,WAAY;IACtCC,IAAI,EAAE;MAAEC,IAAI,EAAElD;IAAe,CAAE;IAC/BmD,YAAY,EAAE;EAAI,GAEjB7C,aACI,CAAC,GAEVA,aAEY,CAAC;AAE7B,CAAC;AAEDpC,YAAY,CAACkF,WAAW,GAAG,cAAc;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAxG,OAAA,GAE3BoB,YAAY","ignoreList":[]}
|
|
@@ -177,18 +177,9 @@ const StyledActionButton = exports.StyledActionButton = _styledComponents.defaul
|
|
|
177
177
|
}
|
|
178
178
|
`}
|
|
179
179
|
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
}
|
|
183
|
-
&:focus-visible {
|
|
184
|
-
transition: none;
|
|
185
|
-
z-index: 1;
|
|
186
|
-
outline: solid 2px color-mix(in srgb, currentColor 70%, transparent);
|
|
187
|
-
box-shadow: inset 0 0 0 2px rgba(0, 102, 204, 0.25);
|
|
188
|
-
outline-offset: -2px;
|
|
189
|
-
color: white;
|
|
190
|
-
}
|
|
191
|
-
`}
|
|
180
|
+
&:focus-visible {
|
|
181
|
+
outline: none;
|
|
182
|
+
}
|
|
192
183
|
`;
|
|
193
184
|
const StyledActionContent = exports.StyledActionContent = _styledComponents.default.span`
|
|
194
185
|
align-items: center;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ActionButton.styles.js","names":["_react","require","_styledComponents","_interopRequireWildcard","_MultiActionButton","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","pulse","color1","color2","keyframes","StyledActionButton","exports","styled","button","$height","$backgroundColor","theme","primary","$shouldUseContentWidth","css","$isExpanded","props","$isCollapsed","$isPrimary","$isShrunk","$isSecondary","$isHidden","$isSolo","$isInteractionDisabled","$statusType","$pulseColors","MultiActionButtonStatusType","Pulse","$shouldShowKeyboardHighlighting","StyledActionContent","span","StyledIconSlot","$isDisabled","StyledLabelWrapper","motion","StyledSecondaryLabel"],"sources":["../../../../../src/components/multi-action-button/action-button/ActionButton.styles.ts"],"sourcesContent":["import { motion } from 'motion/react';\nimport styled, { css, keyframes } from 'styled-components';\nimport type { WithTheme } from '../../color-scheme-provider/ColorSchemeProvider';\nimport { MultiActionButtonStatusType } from '../MultiActionButton.types';\n\ntype StyledActionButtonProps = WithTheme<{\n $backgroundColor?: string;\n $isCollapsed?: boolean;\n $isExpanded?: boolean;\n $isHidden?: boolean;\n $isPrimary?: boolean;\n $isSecondary?: boolean;\n $isShrunk?: boolean;\n $isSolo?: boolean;\n $pulseColors?: [string, string];\n $isInteractionDisabled?: boolean;\n $height: number;\n $statusType?: MultiActionButtonStatusType;\n $shouldUseContentWidth?: boolean;\n $shouldShowKeyboardHighlighting?: boolean;\n}>;\n\nconst pulse = (color1: string, color2: string) => keyframes`\n 0% {\n background: ${color1};\n }\n 50% {\n background: ${color2};\n }\n 100% {\n background: ${color1};\n }\n`;\n\nexport const StyledActionButton = styled.button<StyledActionButtonProps>`\n align-items: center;\n border: none;\n border-radius: ${({ $height }) => $height / 2}px;\n cursor: pointer;\n display: inline-flex;\n flex: 1 1 auto;\n height: ${({ $height }) => $height}px;\n line-height: 22px;\n min-height: ${({ $height }) => $height}px;\n overflow: hidden;\n padding: 0;\n position: relative;\n transition:\n background-color 0.2s ease,\n border-radius 0.2s ease,\n color 0.2s ease,\n flex-grow 0.2s ease,\n opacity 0.2s ease,\n padding 0.2s ease,\n width 0.2s ease;\n user-select: none;\n white-space: nowrap;\n\n background-color: ${({ $backgroundColor, theme }) =>\n $backgroundColor || theme?.primary || '#000'};\n color: #fff;\n\n /* When width is content-driven, avoid flex stretching. */\n ${({ $shouldUseContentWidth }) =>\n $shouldUseContentWidth &&\n css`\n flex: 0 1 auto;\n `}\n\n /* Expanded secondary button when width is not content-driven. */\n ${({ $isExpanded, $shouldUseContentWidth }) =>\n $isExpanded &&\n !$shouldUseContentWidth &&\n css`\n flex: 1 1 auto;\n min-width: 0;\n `}\n\n /* Collapsed state clamps to a fixed icon size. */\n ${(props) =>\n props.$isCollapsed &&\n css`\n flex: 0 0 auto;\n padding: 0;\n width: ${props.$height}px;\n `}\n\n /* Primary action stretches unless content-driven. */\n ${({ $isPrimary, $isCollapsed, $shouldUseContentWidth }) =>\n $isPrimary &&\n !$isCollapsed &&\n !$shouldUseContentWidth &&\n css`\n flex: 1 1 auto;\n min-width: 0;\n `}\n\n /* Shrink the primary action to icon size when secondary is expanded. */\n ${(props) =>\n props.$isShrunk &&\n !props.$shouldUseContentWidth &&\n css`\n flex: 0 0 auto;\n padding: 0;\n width: ${props.$height}px;\n `}\n\n /* Keep secondary icon-only when collapsed and not expanded. */\n ${(props) =>\n props.$isSecondary &&\n !props.$isExpanded &&\n !props.$shouldUseContentWidth &&\n css`\n flex: 0 0 auto;\n padding: 0;\n width: ${props.$height}px;\n `}\n\n /* Fully hide the secondary action when the whole control is collapsed. */\n ${({ $isHidden }) =>\n $isHidden &&\n css`\n opacity: 0;\n pointer-events: none;\n width: 0;\n `}\n\n /* Joining both buttons into a pill shape. */\n ${({ $isPrimary }) =>\n $isPrimary &&\n css`\n border-bottom-right-radius: 0;\n border-top-right-radius: 0;\n `}\n\n ${(props) =>\n props.$isPrimary &&\n props.$isCollapsed &&\n css`\n border-bottom-right-radius: ${props.$height / 2}px;\n border-top-right-radius: ${props.$height / 2}px;\n `}\n\n ${({ $isSecondary }) =>\n $isSecondary &&\n css`\n border-bottom-left-radius: 0;\n border-top-left-radius: 0;\n `}\n\n ${(props) =>\n props.$isSolo &&\n css`\n border-radius: ${props.$height / 2}px;\n `}\n\n ${(props) =>\n props.$isCollapsed &&\n css`\n border-radius: ${props.$height / 2}px;\n `}\n\n ${({ $isInteractionDisabled }) =>\n $isInteractionDisabled &&\n css`\n cursor: default;\n `}\n\n /* Optional pulse overlay used by status. */\n ${({ $statusType, $pulseColors }) =>\n $statusType === MultiActionButtonStatusType.Pulse &&\n css`\n overflow: hidden;\n\n &::before {\n animation: ${pulse($pulseColors?.[0] || '#A50000', $pulseColors?.[1] || '#630000')}\n 1.6s ease-in-out infinite;\n border-radius: 3px;\n content: '';\n inset: 0;\n pointer-events: none;\n position: absolute;\n }\n `}\n\n &:disabled {\n cursor: default;\n }\n\n ${({ $isInteractionDisabled, $backgroundColor, theme }) =>\n !$isInteractionDisabled &&\n css`\n &:hover:not(:disabled) {\n background-color: ${`color-mix(in srgb, ${$backgroundColor || theme?.primary || '#000'} 85%, black)`};\n }\n `}\n\n ${({ $shouldShowKeyboardHighlighting }) =>\n $shouldShowKeyboardHighlighting &&\n css`\n &:focus-visible {\n transition: none;\n z-index: 1;\n outline: solid 2px color-mix(in srgb, currentColor 70%, transparent);\n box-shadow: inset 0 0 0 2px rgba(0, 102, 204, 0.25);\n outline-offset: -2px;\n color: white;\n }\n `}\n`;\n\nexport const StyledActionContent = styled.span`\n align-items: center;\n display: inline-flex;\n flex: 1 1 auto;\n gap: 0;\n min-width: 0;\n position: relative;\n z-index: 1;\n`;\n\nexport const StyledIconSlot = styled.span<{ $height: number; $isDisabled?: boolean }>`\n align-items: center;\n display: inline-flex;\n flex: 0 0 auto;\n height: ${({ $height }) => $height}px;\n justify-content: center;\n opacity: ${({ $isDisabled }) => ($isDisabled ? 0.5 : 1)};\n transition: opacity 0.2s ease;\n width: ${({ $height }) => $height}px;\n`;\n\nexport const StyledLabelWrapper = styled(motion.span)`\n /* The wrapper animates width/margin to avoid layout jumps. */\n display: inline-flex;\n flex: 1 1 auto;\n min-width: 0;\n overflow: hidden;\n text-align: left;\n`;\n\nexport const StyledSecondaryLabel = styled.span`\n display: block;\n flex: 1 1 auto;\n min-width: 0;\n max-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AAM,CAACuB,IAAI;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"ActionButton.styles.js","names":["_react","require","_styledComponents","_interopRequireWildcard","_MultiActionButton","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","pulse","color1","color2","keyframes","StyledActionButton","exports","styled","button","$height","$backgroundColor","theme","primary","$shouldUseContentWidth","css","$isExpanded","props","$isCollapsed","$isPrimary","$isShrunk","$isSecondary","$isHidden","$isSolo","$isInteractionDisabled","$statusType","$pulseColors","MultiActionButtonStatusType","Pulse","StyledActionContent","span","StyledIconSlot","$isDisabled","StyledLabelWrapper","motion","StyledSecondaryLabel"],"sources":["../../../../../src/components/multi-action-button/action-button/ActionButton.styles.ts"],"sourcesContent":["import { motion } from 'motion/react';\nimport styled, { css, keyframes } from 'styled-components';\nimport type { WithTheme } from '../../color-scheme-provider/ColorSchemeProvider';\nimport { MultiActionButtonStatusType } from '../MultiActionButton.types';\n\ntype StyledActionButtonProps = WithTheme<{\n $backgroundColor?: string;\n $isCollapsed?: boolean;\n $isExpanded?: boolean;\n $isHidden?: boolean;\n $isPrimary?: boolean;\n $isSecondary?: boolean;\n $isShrunk?: boolean;\n $isSolo?: boolean;\n $pulseColors?: [string, string];\n $isInteractionDisabled?: boolean;\n $height: number;\n $statusType?: MultiActionButtonStatusType;\n $shouldUseContentWidth?: boolean;\n}>;\n\nconst pulse = (color1: string, color2: string) => keyframes`\n 0% {\n background: ${color1};\n }\n 50% {\n background: ${color2};\n }\n 100% {\n background: ${color1};\n }\n`;\n\nexport const StyledActionButton = styled.button<StyledActionButtonProps>`\n align-items: center;\n border: none;\n border-radius: ${({ $height }) => $height / 2}px;\n cursor: pointer;\n display: inline-flex;\n flex: 1 1 auto;\n height: ${({ $height }) => $height}px;\n line-height: 22px;\n min-height: ${({ $height }) => $height}px;\n overflow: hidden;\n padding: 0;\n position: relative;\n transition:\n background-color 0.2s ease,\n border-radius 0.2s ease,\n color 0.2s ease,\n flex-grow 0.2s ease,\n opacity 0.2s ease,\n padding 0.2s ease,\n width 0.2s ease;\n user-select: none;\n white-space: nowrap;\n\n background-color: ${({ $backgroundColor, theme }) =>\n $backgroundColor || theme?.primary || '#000'};\n color: #fff;\n\n /* When width is content-driven, avoid flex stretching. */\n ${({ $shouldUseContentWidth }) =>\n $shouldUseContentWidth &&\n css`\n flex: 0 1 auto;\n `}\n\n /* Expanded secondary button when width is not content-driven. */\n ${({ $isExpanded, $shouldUseContentWidth }) =>\n $isExpanded &&\n !$shouldUseContentWidth &&\n css`\n flex: 1 1 auto;\n min-width: 0;\n `}\n\n /* Collapsed state clamps to a fixed icon size. */\n ${(props) =>\n props.$isCollapsed &&\n css`\n flex: 0 0 auto;\n padding: 0;\n width: ${props.$height}px;\n `}\n\n /* Primary action stretches unless content-driven. */\n ${({ $isPrimary, $isCollapsed, $shouldUseContentWidth }) =>\n $isPrimary &&\n !$isCollapsed &&\n !$shouldUseContentWidth &&\n css`\n flex: 1 1 auto;\n min-width: 0;\n `}\n\n /* Shrink the primary action to icon size when secondary is expanded. */\n ${(props) =>\n props.$isShrunk &&\n !props.$shouldUseContentWidth &&\n css`\n flex: 0 0 auto;\n padding: 0;\n width: ${props.$height}px;\n `}\n\n /* Keep secondary icon-only when collapsed and not expanded. */\n ${(props) =>\n props.$isSecondary &&\n !props.$isExpanded &&\n !props.$shouldUseContentWidth &&\n css`\n flex: 0 0 auto;\n padding: 0;\n width: ${props.$height}px;\n `}\n\n /* Fully hide the secondary action when the whole control is collapsed. */\n ${({ $isHidden }) =>\n $isHidden &&\n css`\n opacity: 0;\n pointer-events: none;\n width: 0;\n `}\n\n /* Joining both buttons into a pill shape. */\n ${({ $isPrimary }) =>\n $isPrimary &&\n css`\n border-bottom-right-radius: 0;\n border-top-right-radius: 0;\n `}\n\n ${(props) =>\n props.$isPrimary &&\n props.$isCollapsed &&\n css`\n border-bottom-right-radius: ${props.$height / 2}px;\n border-top-right-radius: ${props.$height / 2}px;\n `}\n\n ${({ $isSecondary }) =>\n $isSecondary &&\n css`\n border-bottom-left-radius: 0;\n border-top-left-radius: 0;\n `}\n\n ${(props) =>\n props.$isSolo &&\n css`\n border-radius: ${props.$height / 2}px;\n `}\n\n ${(props) =>\n props.$isCollapsed &&\n css`\n border-radius: ${props.$height / 2}px;\n `}\n\n ${({ $isInteractionDisabled }) =>\n $isInteractionDisabled &&\n css`\n cursor: default;\n `}\n\n /* Optional pulse overlay used by status. */\n ${({ $statusType, $pulseColors }) =>\n $statusType === MultiActionButtonStatusType.Pulse &&\n css`\n overflow: hidden;\n\n &::before {\n animation: ${pulse($pulseColors?.[0] || '#A50000', $pulseColors?.[1] || '#630000')}\n 1.6s ease-in-out infinite;\n border-radius: 3px;\n content: '';\n inset: 0;\n pointer-events: none;\n position: absolute;\n }\n `}\n\n &:disabled {\n cursor: default;\n }\n\n ${({ $isInteractionDisabled, $backgroundColor, theme }) =>\n !$isInteractionDisabled &&\n css`\n &:hover:not(:disabled) {\n background-color: ${`color-mix(in srgb, ${$backgroundColor || theme?.primary || '#000'} 85%, black)`};\n }\n `}\n\n &:focus-visible {\n outline: none;\n }\n`;\n\nexport const StyledActionContent = styled.span`\n align-items: center;\n display: inline-flex;\n flex: 1 1 auto;\n gap: 0;\n min-width: 0;\n position: relative;\n z-index: 1;\n`;\n\nexport const StyledIconSlot = styled.span<{ $height: number; $isDisabled?: boolean }>`\n align-items: center;\n display: inline-flex;\n flex: 0 0 auto;\n height: ${({ $height }) => $height}px;\n justify-content: center;\n opacity: ${({ $isDisabled }) => ($isDisabled ? 0.5 : 1)};\n transition: opacity 0.2s ease;\n width: ${({ $height }) => $height}px;\n`;\n\nexport const StyledLabelWrapper = styled(motion.span)`\n /* The wrapper animates width/margin to avoid layout jumps. */\n display: inline-flex;\n flex: 1 1 auto;\n min-width: 0;\n overflow: hidden;\n text-align: left;\n`;\n\nexport const StyledSecondaryLabel = styled.span`\n display: block;\n flex: 1 1 auto;\n min-width: 0;\n max-width: 100%;\n overflow: hidden;\n padding-right: 18px;\n text-overflow: ellipsis;\n white-space: nowrap;\n`;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,iBAAA,GAAAC,uBAAA,CAAAF,OAAA;AAEA,IAAAG,kBAAA,GAAAH,OAAA;AAAyE,SAAAE,wBAAAE,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAJ,uBAAA,YAAAA,CAAAE,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAC,OAAA,EAAAV,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAAQ,CAAA,MAAAF,CAAA,GAAAL,CAAA,GAAAG,CAAA,GAAAD,CAAA,QAAAG,CAAA,CAAAK,GAAA,CAAAX,CAAA,UAAAM,CAAA,CAAAM,GAAA,CAAAZ,CAAA,GAAAM,CAAA,CAAAO,GAAA,CAAAb,CAAA,EAAAQ,CAAA,gBAAAP,CAAA,IAAAD,CAAA,gBAAAC,CAAA,OAAAa,cAAA,CAAAC,IAAA,CAAAf,CAAA,EAAAC,CAAA,OAAAM,CAAA,IAAAD,CAAA,GAAAU,MAAA,CAAAC,cAAA,KAAAD,MAAA,CAAAE,wBAAA,CAAAlB,CAAA,EAAAC,CAAA,OAAAM,CAAA,CAAAK,GAAA,IAAAL,CAAA,CAAAM,GAAA,IAAAP,CAAA,CAAAE,CAAA,EAAAP,CAAA,EAAAM,CAAA,IAAAC,CAAA,CAAAP,CAAA,IAAAD,CAAA,CAAAC,CAAA,WAAAO,CAAA,KAAAR,CAAA,EAAAC,CAAA;AAkBzE,MAAMkB,K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AACA;AACA;AACA;AACA,CAAC","ignoreList":[]}
|
|
@@ -9,6 +9,7 @@ var _react2 = _interopRequireWildcard(require("react"));
|
|
|
9
9
|
var _RadioButtonGroup = require("./radio-button-group/RadioButtonGroup");
|
|
10
10
|
var _RadioButton = require("./RadioButton.styles");
|
|
11
11
|
var _calculate = require("../../utils/calculate");
|
|
12
|
+
var _useFocusRingPortal = require("../../hooks/useFocusRingPortal");
|
|
12
13
|
var _useKeyboardFocusHighlighting = require("../../hooks/useKeyboardFocusHighlighting");
|
|
13
14
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
14
15
|
const RadioButton = ({
|
|
@@ -33,12 +34,17 @@ const RadioButton = ({
|
|
|
33
34
|
const [isHovered, setIsHovered] = (0, _react2.useState)(false);
|
|
34
35
|
const [radioButtonTop, setRadioButtonTop] = (0, _react2.useState)(undefined);
|
|
35
36
|
const radioButtonBoxRef = (0, _react2.useRef)(null);
|
|
37
|
+
const radioButtonInputRef = (0, _react2.useRef)(null);
|
|
36
38
|
const radioButtonRootRef = (0, _react2.useRef)(null);
|
|
37
39
|
const isInGroup = typeof updateSelectedRadioButtonId === 'function';
|
|
38
40
|
const isMarked = isInGroup ? selectedRadioButtonId === id : internalIsChecked;
|
|
39
41
|
const uncheckable = radioButtonsCanBeUnchecked;
|
|
40
42
|
const effectiveShouldEnableKeyboardHighlighting = shouldEnableKeyboardHighlightingFromGroup ?? shouldEnableKeyboardHighlighting;
|
|
41
43
|
const shouldShowKeyboardHighlighting = (0, _useKeyboardFocusHighlighting.useKeyboardFocusHighlighting)(effectiveShouldEnableKeyboardHighlighting && !isDisabled);
|
|
44
|
+
(0, _useFocusRingPortal.useFocusRingPortal)(radioButtonInputRef, {
|
|
45
|
+
isEnabled: shouldShowKeyboardHighlighting,
|
|
46
|
+
shape: 'circle'
|
|
47
|
+
});
|
|
42
48
|
(0, _react2.useEffect)(() => {
|
|
43
49
|
if (radioButtonRootRef.current && !shouldShowCentered) {
|
|
44
50
|
var _radioButtonBoxRef$cu;
|
|
@@ -127,13 +133,13 @@ const RadioButton = ({
|
|
|
127
133
|
ref: radioButtonRootRef,
|
|
128
134
|
$shouldShowKeyboardHighlighting: shouldShowKeyboardHighlighting
|
|
129
135
|
}, /*#__PURE__*/_react2.default.createElement(_RadioButton.StyledRadioButtonCheckBox, {
|
|
136
|
+
ref: radioButtonInputRef,
|
|
130
137
|
onClick: handleClick,
|
|
131
138
|
onMouseEnter: handleMouseEnter,
|
|
132
139
|
onMouseLeave: handleMouseLeave,
|
|
133
140
|
onKeyDown: handleKeyDown,
|
|
134
141
|
disabled: isDisabled,
|
|
135
142
|
$isDisabled: isDisabled,
|
|
136
|
-
$shouldShowKeyboardHighlighting: shouldShowKeyboardHighlighting,
|
|
137
143
|
type: "radio",
|
|
138
144
|
checked: isMarked,
|
|
139
145
|
onChange: () => {}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RadioButton.js","names":["_react","require","_react2","_interopRequireWildcard","_RadioButtonGroup","_RadioButton","_calculate","_useKeyboardFocusHighlighting","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","RadioButton","children","shouldShowRightElementOnlyOnChecked","label","id","rightElement","shouldShowCentered","isDisabled","shouldEnableKeyboardHighlighting","selectedRadioButtonId","updateSelectedRadioButtonId","radioButtonRightElements","updateHasRightElement","radioButtonsCanBeUnchecked","shouldEnableKeyboardHighlightingFromGroup","useContext","RadioButtonGroupContext","internalIsChecked","setInternalIsChecked","useState","isHovered","setIsHovered","radioButtonTop","setRadioButtonTop","undefined","radioButtonBoxRef","useRef","radioButtonRootRef","isInGroup","isMarked","uncheckable","effectiveShouldEnableKeyboardHighlighting","shouldShowKeyboardHighlighting","useKeyboardFocusHighlighting","useEffect","current","_radioButtonBoxRef$cu","singleLineHeight","getHeightOfSingleTextLine","container","boxHeight","getBoundingClientRect","height","handleClick","useCallback","prev","handleMouseEnter","handleMouseLeave","handleKeyDown","event","key","preventDefault","radioButtonRightElementMargin","useMemo","index","findIndex","element","prevButton","currentButton","nextButton","hasRightElement","shouldShowRightElement","window","setTimeout","createElement","StyledRadioButton","$isDisabled","$radioButtonRightElementMargin","StyledRadioButtonWrapper","ref","$shouldShowKeyboardHighlighting","StyledRadioButtonCheckBox","onClick","onMouseEnter","onMouseLeave","onKeyDown","disabled","type","checked","onChange","StyledRadioButtonPseudoCheckBox","$isChecked","style","top","transform","StyledRadioButtonCheckBoxMark","$isHovered","$isSelected","StyledLabelWrapper","StyledRadioButtonLabel","AnimatePresence","initial","StyledMotionRadioButtonChildren","animate","opacity","transition","duration","displayName","_default","exports"],"sources":["../../../../src/components/radio-button/RadioButton.tsx"],"sourcesContent":["import { AnimatePresence } from 'motion/react';\nimport React, {\n FC,\n useCallback,\n useContext,\n useEffect,\n useMemo,\n useState,\n type ReactNode,\n useRef,\n} from 'react';\nimport { RadioButtonRightElementMargin } from '../../types/radioButton';\nimport { RadioButtonGroupContext } from './radio-button-group/RadioButtonGroup';\nimport {\n StyledLabelWrapper,\n StyledMotionRadioButtonChildren,\n StyledRadioButton,\n StyledRadioButtonCheckBox,\n StyledRadioButtonCheckBoxMark,\n StyledRadioButtonLabel,\n StyledRadioButtonPseudoCheckBox,\n StyledRadioButtonWrapper,\n} from './RadioButton.styles';\nimport { getHeightOfSingleTextLine } from '../../utils/calculate';\nimport { useKeyboardFocusHighlighting } from '../../hooks/useKeyboardFocusHighlighting';\n\nexport type RadioButtonProps = {\n /**\n * The children that should be displayed after the RadioButton is checked.\n */\n children?: ReactNode;\n /**\n * whether the RadioButton should be shown.\n */\n isDisabled?: boolean;\n /**\n * The id of the radio button.\n */\n id: string | number;\n /**\n * The label that should be displayed next to the radio button.\n */\n label?: ReactNode;\n /**\n * An element that should be displayed on the right side of the label.\n */\n rightElement?: ReactNode;\n /**\n * Whether the rightElement should only be displayed when the RadioButton is checked\n */\n shouldShowRightElementOnlyOnChecked?: boolean;\n /**\n * Whether the RadioButton should be displayed centered to the label or at the top\n */\n shouldShowCentered?: boolean;\n /**\n * Enables keyboard-only focus highlighting.\n */\n shouldEnableKeyboardHighlighting?: boolean;\n};\n\nconst RadioButton: FC<RadioButtonProps> = ({\n children,\n shouldShowRightElementOnlyOnChecked = false,\n label,\n id,\n rightElement,\n shouldShowCentered = true,\n isDisabled = false,\n shouldEnableKeyboardHighlighting,\n}) => {\n const {\n selectedRadioButtonId,\n updateSelectedRadioButtonId,\n radioButtonRightElements,\n updateHasRightElement,\n radioButtonsCanBeUnchecked,\n shouldEnableKeyboardHighlighting: shouldEnableKeyboardHighlightingFromGroup,\n } = useContext(RadioButtonGroupContext);\n\n const [internalIsChecked, setInternalIsChecked] = useState(false);\n const [isHovered, setIsHovered] = useState(false);\n const [radioButtonTop, setRadioButtonTop] = useState<number | undefined>(undefined);\n\n const radioButtonBoxRef = useRef<HTMLDivElement>(null);\n const radioButtonRootRef = useRef<HTMLDivElement>(null);\n\n const isInGroup = typeof updateSelectedRadioButtonId === 'function';\n\n const isMarked = isInGroup ? selectedRadioButtonId === id : internalIsChecked;\n\n const uncheckable = radioButtonsCanBeUnchecked;\n\n const effectiveShouldEnableKeyboardHighlighting =\n shouldEnableKeyboardHighlightingFromGroup ?? shouldEnableKeyboardHighlighting;\n\n const shouldShowKeyboardHighlighting = useKeyboardFocusHighlighting(\n effectiveShouldEnableKeyboardHighlighting && !isDisabled,\n );\n\n useEffect(() => {\n if (radioButtonRootRef.current && !shouldShowCentered) {\n const singleLineHeight = getHeightOfSingleTextLine({\n container: radioButtonRootRef.current,\n });\n\n const boxHeight = radioButtonBoxRef.current?.getBoundingClientRect().height ?? 0;\n\n setRadioButtonTop((singleLineHeight - boxHeight) / 2);\n }\n }, [shouldShowCentered]);\n\n const handleClick = useCallback(() => {\n if (isDisabled) {\n return;\n }\n\n if (uncheckable) {\n if (updateSelectedRadioButtonId) {\n updateSelectedRadioButtonId(id === selectedRadioButtonId ? undefined : id);\n }\n setInternalIsChecked((prev) => !prev);\n return;\n }\n if (typeof updateSelectedRadioButtonId === 'function') {\n updateSelectedRadioButtonId(id);\n }\n setInternalIsChecked(true);\n }, [id, isDisabled, uncheckable, selectedRadioButtonId, updateSelectedRadioButtonId]);\n\n const handleMouseEnter = useCallback(() => {\n if (!isDisabled) {\n setIsHovered(true);\n }\n }, [isDisabled]);\n\n const handleMouseLeave = () => {\n setIsHovered(false);\n };\n\n const handleKeyDown = useCallback(\n (event: React.KeyboardEvent<HTMLInputElement>) => {\n if (event.key === 'Enter' || event.key === ' ') {\n event.preventDefault();\n handleClick();\n }\n },\n [handleClick],\n );\n\n const radioButtonRightElementMargin: RadioButtonRightElementMargin = useMemo(() => {\n if (!radioButtonRightElements) {\n return 'NONE';\n }\n\n const index = radioButtonRightElements.findIndex((element) => element.id === id);\n\n if (index < 0) {\n return 'NONE';\n }\n\n const prevButton = radioButtonRightElements[index - 1];\n const currentButton = radioButtonRightElements[index];\n const nextButton = radioButtonRightElements[index + 1];\n\n if (!currentButton?.hasRightElement) {\n return 'NONE';\n }\n\n switch (true) {\n case prevButton?.hasRightElement && !nextButton?.hasRightElement:\n return 'TOP';\n case !prevButton?.hasRightElement && nextButton?.hasRightElement:\n return 'BOTTOM';\n case currentButton?.hasRightElement &&\n !nextButton?.hasRightElement &&\n !prevButton?.hasRightElement:\n return 'NONE';\n default:\n return 'BOTH';\n }\n }, [id, radioButtonRightElements]);\n\n const shouldShowRightElement = useMemo(() => {\n if (rightElement) {\n if (shouldShowRightElementOnlyOnChecked) {\n return isMarked;\n }\n\n return true;\n }\n\n return false;\n }, [isMarked, rightElement, shouldShowRightElementOnlyOnChecked]);\n\n useEffect(() => {\n if (typeof updateHasRightElement === 'function') {\n window.setTimeout(() => {\n updateHasRightElement(id, shouldShowRightElement);\n }, 10);\n }\n }, [id, shouldShowRightElement, updateHasRightElement]);\n\n return useMemo(\n () => (\n <StyledRadioButton\n $isDisabled={isDisabled}\n $radioButtonRightElementMargin={radioButtonRightElementMargin}\n >\n <StyledRadioButtonWrapper\n ref={radioButtonRootRef}\n $shouldShowKeyboardHighlighting={shouldShowKeyboardHighlighting}\n >\n <StyledRadioButtonCheckBox\n onClick={handleClick}\n onMouseEnter={handleMouseEnter}\n onMouseLeave={handleMouseLeave}\n onKeyDown={handleKeyDown}\n disabled={isDisabled}\n $isDisabled={isDisabled}\n $shouldShowKeyboardHighlighting={shouldShowKeyboardHighlighting}\n type=\"radio\"\n checked={isMarked}\n onChange={() => {}}\n />\n <StyledRadioButtonPseudoCheckBox\n $isDisabled={isDisabled}\n $isChecked={isMarked}\n ref={radioButtonBoxRef}\n onClick={handleClick}\n style={{\n top: shouldShowCentered ? '50%' : radioButtonTop,\n transform: shouldShowCentered ? 'translateY(-50%)' : undefined,\n }}\n >\n <StyledRadioButtonCheckBoxMark\n onMouseEnter={handleMouseEnter}\n onMouseLeave={handleMouseLeave}\n $isHovered={isHovered}\n $isSelected={isMarked}\n $isDisabled={isDisabled}\n />\n </StyledRadioButtonPseudoCheckBox>\n <StyledLabelWrapper>\n {label && (\n <StyledRadioButtonLabel\n $isDisabled={isDisabled}\n onClick={handleClick}\n onMouseEnter={handleMouseEnter}\n onMouseLeave={handleMouseLeave}\n >\n {label}\n </StyledRadioButtonLabel>\n )}\n {shouldShowRightElement && rightElement}\n </StyledLabelWrapper>\n </StyledRadioButtonWrapper>\n {children && (\n <AnimatePresence initial={false}>\n <StyledMotionRadioButtonChildren\n animate={\n isMarked\n ? { opacity: 1, height: 'auto' }\n : { opacity: 0, height: 0 }\n }\n transition={{ duration: 0.2 }}\n >\n {children}\n </StyledMotionRadioButtonChildren>\n </AnimatePresence>\n )}\n </StyledRadioButton>\n ),\n [\n children,\n handleClick,\n handleKeyDown,\n handleMouseEnter,\n isDisabled,\n isHovered,\n isMarked,\n label,\n radioButtonRightElementMargin,\n radioButtonTop,\n rightElement,\n shouldShowCentered,\n shouldShowKeyboardHighlighting,\n shouldShowRightElement,\n ],\n );\n};\n\nRadioButton.displayName = 'RadioButton';\n\nexport default RadioButton;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAC,uBAAA,CAAAF,OAAA;AAWA,IAAAG,iBAAA,GAAAH,OAAA;AACA,IAAAI,YAAA,GAAAJ,OAAA;AAUA,IAAAK,UAAA,GAAAL,OAAA;AACA,IAAAM,6BAAA,GAAAN,OAAA;AAAwF,SAAAE,wBAAAK,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAP,uBAAA,YAAAA,CAAAK,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAC,OAAA,EAAAV,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAAQ,CAAA,MAAAF,CAAA,GAAAL,CAAA,GAAAG,CAAA,GAAAD,CAAA,QAAAG,CAAA,CAAAK,GAAA,CAAAX,CAAA,UAAAM,CAAA,CAAAM,GAAA,CAAAZ,CAAA,GAAAM,CAAA,CAAAO,GAAA,CAAAb,CAAA,EAAAQ,CAAA,gBAAAP,CAAA,IAAAD,CAAA,gBAAAC,CAAA,OAAAa,cAAA,CAAAC,IAAA,CAAAf,CAAA,EAAAC,CAAA,OAAAM,CAAA,IAAAD,CAAA,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BAAsB,IAAIxD,YACX,CACE,CAAC,EAC1BJ,QAAQ,iBACL1B,OAAA,CAAAgB,OAAA,CAAAyE,aAAA,CAAC3F,MAAA,CAAAqH,eAAe;IAACC,OAAO,EAAE;EAAM,gBAC5BpH,OAAA,CAAAgB,OAAA,CAAAyE,aAAA,CAACtF,YAAA,CAAAkH,+BAA+B;IAC5BC,OAAO,EACHhE,QAAQ,GACF;MAAEiE,OAAO,EAAE,CAAC;MAAEpD,MAAM,EAAE;IAAO,CAAC,GAC9B;MAAEoD,OAAO,EAAE,CAAC;MAAEpD,MAAM,EAAE;IAAE,CACjC;IACDqD,UAAU,EAAE;MAAEC,QAAQ,EAAE;IAAI;EAAE,GAE7B/F,QAC4B,CACpB,CAEN,CACtB,EACD,CACIA,QAAQ,EACR0C,WAAW,EACXK,aAAa,EACbF,gBAAgB,EAChBvC,UAAU,EACVa,SAAS,EACTS,QAAQ,EACR1B,KAAK,EACLiD,6BAA6B,EAC7B9B,cAAc,EACdjB,YAAY,EACZC,kBAAkB,EAClB0B,8BAA8B,EAC9B6B,sBAAsB,CAE9B,CAAC;AACL,CAAC;AAED7D,WAAW,CAACiG,WAAW,GAAG,aAAa;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAA5G,OAAA,GAEzBS,WAAW","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"RadioButton.js","names":["_react","require","_react2","_interopRequireWildcard","_RadioButtonGroup","_RadioButton","_calculate","_useFocusRingPortal","_useKeyboardFocusHighlighting","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","RadioButton","children","shouldShowRightElementOnlyOnChecked","label","id","rightElement","shouldShowCentered","isDisabled","shouldEnableKeyboardHighlighting","selectedRadioButtonId","updateSelectedRadioButtonId","radioButtonRightElements","updateHasRightElement","radioButtonsCanBeUnchecked","shouldEnableKeyboardHighlightingFromGroup","useContext","RadioButtonGroupContext","internalIsChecked","setInternalIsChecked","useState","isHovered","setIsHovered","radioButtonTop","setRadioButtonTop","undefined","radioButtonBoxRef","useRef","radioButtonInputRef","radioButtonRootRef","isInGroup","isMarked","uncheckable","effectiveShouldEnableKeyboardHighlighting","shouldShowKeyboardHighlighting","useKeyboardFocusHighlighting","useFocusRingPortal","isEnabled","shape","useEffect","current","_radioButtonBoxRef$cu","singleLineHeight","getHeightOfSingleTextLine","container","boxHeight","getBoundingClientRect","height","handleClick","useCallback","prev","handleMouseEnter","handleMouseLeave","handleKeyDown","event","key","preventDefault","radioButtonRightElementMargin","useMemo","index","findIndex","element","prevButton","currentButton","nextButton","hasRightElement","shouldShowRightElement","window","setTimeout","createElement","StyledRadioButton","$isDisabled","$radioButtonRightElementMargin","StyledRadioButtonWrapper","ref","$shouldShowKeyboardHighlighting","StyledRadioButtonCheckBox","onClick","onMouseEnter","onMouseLeave","onKeyDown","disabled","type","checked","onChange","StyledRadioButtonPseudoCheckBox","$isChecked","style","top","transform","StyledRadioButtonCheckBoxMark","$isHovered","$isSelected","StyledLabelWrapper","StyledRadioButtonLabel","AnimatePresence","initial","StyledMotionRadioButtonChildren","animate","opacity","transition","duration","displayName","_default","exports"],"sources":["../../../../src/components/radio-button/RadioButton.tsx"],"sourcesContent":["import { AnimatePresence } from 'motion/react';\nimport React, {\n FC,\n useCallback,\n useContext,\n useEffect,\n useMemo,\n useState,\n type ReactNode,\n useRef,\n} from 'react';\nimport { RadioButtonRightElementMargin } from '../../types/radioButton';\nimport { RadioButtonGroupContext } from './radio-button-group/RadioButtonGroup';\nimport {\n StyledLabelWrapper,\n StyledMotionRadioButtonChildren,\n StyledRadioButton,\n StyledRadioButtonCheckBox,\n StyledRadioButtonCheckBoxMark,\n StyledRadioButtonLabel,\n StyledRadioButtonPseudoCheckBox,\n StyledRadioButtonWrapper,\n} from './RadioButton.styles';\nimport { getHeightOfSingleTextLine } from '../../utils/calculate';\nimport { useFocusRingPortal } from '../../hooks/useFocusRingPortal';\nimport { useKeyboardFocusHighlighting } from '../../hooks/useKeyboardFocusHighlighting';\n\nexport type RadioButtonProps = {\n /**\n * The children that should be displayed after the RadioButton is checked.\n */\n children?: ReactNode;\n /**\n * whether the RadioButton should be shown.\n */\n isDisabled?: boolean;\n /**\n * The id of the radio button.\n */\n id: string | number;\n /**\n * The label that should be displayed next to the radio button.\n */\n label?: ReactNode;\n /**\n * An element that should be displayed on the right side of the label.\n */\n rightElement?: ReactNode;\n /**\n * Whether the rightElement should only be displayed when the RadioButton is checked\n */\n shouldShowRightElementOnlyOnChecked?: boolean;\n /**\n * Whether the RadioButton should be displayed centered to the label or at the top\n */\n shouldShowCentered?: boolean;\n /**\n * Enables keyboard-only focus highlighting.\n */\n shouldEnableKeyboardHighlighting?: boolean;\n};\n\nconst RadioButton: FC<RadioButtonProps> = ({\n children,\n shouldShowRightElementOnlyOnChecked = false,\n label,\n id,\n rightElement,\n shouldShowCentered = true,\n isDisabled = false,\n shouldEnableKeyboardHighlighting,\n}) => {\n const {\n selectedRadioButtonId,\n updateSelectedRadioButtonId,\n radioButtonRightElements,\n updateHasRightElement,\n radioButtonsCanBeUnchecked,\n shouldEnableKeyboardHighlighting: shouldEnableKeyboardHighlightingFromGroup,\n } = useContext(RadioButtonGroupContext);\n\n const [internalIsChecked, setInternalIsChecked] = useState(false);\n const [isHovered, setIsHovered] = useState(false);\n const [radioButtonTop, setRadioButtonTop] = useState<number | undefined>(undefined);\n\n const radioButtonBoxRef = useRef<HTMLDivElement>(null);\n const radioButtonInputRef = useRef<HTMLInputElement>(null);\n const radioButtonRootRef = useRef<HTMLDivElement>(null);\n\n const isInGroup = typeof updateSelectedRadioButtonId === 'function';\n\n const isMarked = isInGroup ? selectedRadioButtonId === id : internalIsChecked;\n\n const uncheckable = radioButtonsCanBeUnchecked;\n\n const effectiveShouldEnableKeyboardHighlighting =\n shouldEnableKeyboardHighlightingFromGroup ?? shouldEnableKeyboardHighlighting;\n\n const shouldShowKeyboardHighlighting = useKeyboardFocusHighlighting(\n effectiveShouldEnableKeyboardHighlighting && !isDisabled,\n );\n useFocusRingPortal(radioButtonInputRef, {\n isEnabled: shouldShowKeyboardHighlighting,\n shape: 'circle',\n });\n\n useEffect(() => {\n if (radioButtonRootRef.current && !shouldShowCentered) {\n const singleLineHeight = getHeightOfSingleTextLine({\n container: radioButtonRootRef.current,\n });\n\n const boxHeight = radioButtonBoxRef.current?.getBoundingClientRect().height ?? 0;\n\n setRadioButtonTop((singleLineHeight - boxHeight) / 2);\n }\n }, [shouldShowCentered]);\n\n const handleClick = useCallback(() => {\n if (isDisabled) {\n return;\n }\n\n if (uncheckable) {\n if (updateSelectedRadioButtonId) {\n updateSelectedRadioButtonId(id === selectedRadioButtonId ? undefined : id);\n }\n setInternalIsChecked((prev) => !prev);\n return;\n }\n if (typeof updateSelectedRadioButtonId === 'function') {\n updateSelectedRadioButtonId(id);\n }\n setInternalIsChecked(true);\n }, [id, isDisabled, uncheckable, selectedRadioButtonId, updateSelectedRadioButtonId]);\n\n const handleMouseEnter = useCallback(() => {\n if (!isDisabled) {\n setIsHovered(true);\n }\n }, [isDisabled]);\n\n const handleMouseLeave = () => {\n setIsHovered(false);\n };\n\n const handleKeyDown = useCallback(\n (event: React.KeyboardEvent<HTMLInputElement>) => {\n if (event.key === 'Enter' || event.key === ' ') {\n event.preventDefault();\n handleClick();\n }\n },\n [handleClick],\n );\n\n const radioButtonRightElementMargin: RadioButtonRightElementMargin = useMemo(() => {\n if (!radioButtonRightElements) {\n return 'NONE';\n }\n\n const index = radioButtonRightElements.findIndex((element) => element.id === id);\n\n if (index < 0) {\n return 'NONE';\n }\n\n const prevButton = radioButtonRightElements[index - 1];\n const currentButton = radioButtonRightElements[index];\n const nextButton = radioButtonRightElements[index + 1];\n\n if (!currentButton?.hasRightElement) {\n return 'NONE';\n }\n\n switch (true) {\n case prevButton?.hasRightElement && !nextButton?.hasRightElement:\n return 'TOP';\n case !prevButton?.hasRightElement && nextButton?.hasRightElement:\n return 'BOTTOM';\n case currentButton?.hasRightElement &&\n !nextButton?.hasRightElement &&\n !prevButton?.hasRightElement:\n return 'NONE';\n default:\n return 'BOTH';\n }\n }, [id, radioButtonRightElements]);\n\n const shouldShowRightElement = useMemo(() => {\n if (rightElement) {\n if (shouldShowRightElementOnlyOnChecked) {\n return isMarked;\n }\n\n return true;\n }\n\n return false;\n }, [isMarked, rightElement, shouldShowRightElementOnlyOnChecked]);\n\n useEffect(() => {\n if (typeof updateHasRightElement === 'function') {\n window.setTimeout(() => {\n updateHasRightElement(id, shouldShowRightElement);\n }, 10);\n }\n }, [id, shouldShowRightElement, updateHasRightElement]);\n\n return useMemo(\n () => (\n <StyledRadioButton\n $isDisabled={isDisabled}\n $radioButtonRightElementMargin={radioButtonRightElementMargin}\n >\n <StyledRadioButtonWrapper\n ref={radioButtonRootRef}\n $shouldShowKeyboardHighlighting={shouldShowKeyboardHighlighting}\n >\n <StyledRadioButtonCheckBox\n ref={radioButtonInputRef}\n onClick={handleClick}\n onMouseEnter={handleMouseEnter}\n onMouseLeave={handleMouseLeave}\n onKeyDown={handleKeyDown}\n disabled={isDisabled}\n $isDisabled={isDisabled}\n type=\"radio\"\n checked={isMarked}\n onChange={() => {}}\n />\n <StyledRadioButtonPseudoCheckBox\n $isDisabled={isDisabled}\n $isChecked={isMarked}\n ref={radioButtonBoxRef}\n onClick={handleClick}\n style={{\n top: shouldShowCentered ? '50%' : radioButtonTop,\n transform: shouldShowCentered ? 'translateY(-50%)' : undefined,\n }}\n >\n <StyledRadioButtonCheckBoxMark\n onMouseEnter={handleMouseEnter}\n onMouseLeave={handleMouseLeave}\n $isHovered={isHovered}\n $isSelected={isMarked}\n $isDisabled={isDisabled}\n />\n </StyledRadioButtonPseudoCheckBox>\n <StyledLabelWrapper>\n {label && (\n <StyledRadioButtonLabel\n $isDisabled={isDisabled}\n onClick={handleClick}\n onMouseEnter={handleMouseEnter}\n onMouseLeave={handleMouseLeave}\n >\n {label}\n </StyledRadioButtonLabel>\n )}\n {shouldShowRightElement && rightElement}\n </StyledLabelWrapper>\n </StyledRadioButtonWrapper>\n {children && (\n <AnimatePresence initial={false}>\n <StyledMotionRadioButtonChildren\n animate={\n isMarked\n ? { opacity: 1, height: 'auto' }\n : { opacity: 0, height: 0 }\n }\n transition={{ duration: 0.2 }}\n >\n {children}\n </StyledMotionRadioButtonChildren>\n </AnimatePresence>\n )}\n </StyledRadioButton>\n ),\n [\n children,\n handleClick,\n handleKeyDown,\n handleMouseEnter,\n isDisabled,\n isHovered,\n isMarked,\n label,\n radioButtonRightElementMargin,\n radioButtonTop,\n rightElement,\n shouldShowCentered,\n shouldShowKeyboardHighlighting,\n shouldShowRightElement,\n ],\n );\n};\n\nRadioButton.displayName = 'RadioButton';\n\nexport default RadioButton;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAC,uBAAA,CAAAF,OAAA;AAWA,IAAAG,iBAAA,GAAAH,OAAA;AACA,IAAAI,YAAA,GAAAJ,OAAA;AAUA,IAAAK,UAAA,GAAAL,OAAA;AACA,IAAAM,mBAAA,GAAAN,OAAA;AACA,IAAAO,6BAAA,GAAAP,OAAA;AAAwF,SAAAE,wBAAAM,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAR,uBAAA,YAAAA,CAAAM,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAC,OAAA,EAAAV,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAAQ,CAAA,MAAAF,CAAA,GAAAL,CAAA,GAAAG,CAAA,GAAAD,CAAA,QAAAG,CAAA,CAAAK,GAAA,CAAAX,CAAA,UAAAM,CAAA,CAAAM,GAAA,CAAAZ,CAAA,GAAAM,CAAA,CAAAO,GAAA,CAA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ckBox = exports.StyledRadioButtonLabel = exports.StyledRadioButtonCheckBoxMark = exports.StyledRadioButtonCheckBox = exports.StyledRadioButton = exports.StyledMotionRadioButtonChildren = exports.StyledLabelWrapper = void 0;
|
|
7
7
|
var _react = require("motion/react");
|
|
8
8
|
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
9
|
-
var _keyboardFocusHighlighting = require("../../utils/keyboardFocusHighlighting.styles");
|
|
10
9
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
11
10
|
const StyledRadioButton = exports.StyledRadioButton = _styledComponents.default.span`
|
|
12
11
|
display: flex;
|
|
@@ -75,15 +74,6 @@ const StyledRadioButtonCheckBox = exports.StyledRadioButtonCheckBox = _styledCom
|
|
|
75
74
|
cursor: ${({
|
|
76
75
|
$isDisabled
|
|
77
76
|
}) => $isDisabled ? 'default !important' : 'pointer !important'};
|
|
78
|
-
|
|
79
|
-
${({
|
|
80
|
-
$shouldShowKeyboardHighlighting
|
|
81
|
-
}) => $shouldShowKeyboardHighlighting && (0, _styledComponents.css)`
|
|
82
|
-
&:focus-visible + ${StyledRadioButtonPseudoCheckBox} {
|
|
83
|
-
transition: none;
|
|
84
|
-
${_keyboardFocusHighlighting.keyboardFocusHighlightingCircleRingCss}
|
|
85
|
-
}
|
|
86
|
-
`}
|
|
87
77
|
`;
|
|
88
78
|
const StyledRadioButtonCheckBoxMark = exports.StyledRadioButtonCheckBoxMark = _styledComponents.default.span`
|
|
89
79
|
background-color: transparent;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RadioButton.styles.js","names":["_react","require","_styledComponents","_interopRequireWildcard","
|
|
1
|
+
{"version":3,"file":"RadioButton.styles.js","names":["_react","require","_styledComponents","_interopRequireWildcard","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","StyledRadioButton","exports","styled","span","$isDisabled","$radioButtonRightElementMargin","css","StyledRadioButtonWrapper","div","StyledRadioButtonPseudoCheckBox","theme","$isChecked","StyledRadioButtonCheckBox","input","StyledRadioButtonCheckBoxMark","$isHovered","$isSelected","StyledRadioButtonLabel","text","StyledLabelWrapper","StyledMotionRadioButtonChildren","motion"],"sources":["../../../../src/components/radio-button/RadioButton.styles.ts"],"sourcesContent":["import { motion } from 'motion/react';\nimport styled, { css } from 'styled-components';\nimport { RadioButtonRightElementMargin } from '../../types/radioButton';\nimport type { WithTheme } from '../color-scheme-provider/ColorSchemeProvider';\n\ntype StyledRadioButtonProps = WithTheme<{\n $isDisabled: boolean;\n $radioButtonRightElementMargin: RadioButtonRightElementMargin;\n}>;\n\nexport const StyledRadioButton = styled.span<StyledRadioButtonProps>`\n display: flex;\n flex-direction: column;\n\n position: relative;\n\n opacity: ${({ $isDisabled }: StyledRadioButtonProps) => ($isDisabled ? 0.5 : 1)};\n\n ${({ $radioButtonRightElementMargin }: StyledRadioButtonProps) => {\n switch ($radioButtonRightElementMargin) {\n case 'BOTH':\n return css`\n margin: 6px 0;\n `;\n case 'TOP':\n return css`\n margin-top: 6px;\n `;\n case 'BOTTOM':\n return css`\n margin-bottom: 6px;\n `;\n case 'NONE':\n default:\n return css`\n margin: 0;\n `;\n }\n }}\n`;\n\ntype StyledRadioButtonWrapperProps = {\n $shouldShowKeyboardHighlighting: boolean;\n};\n\nexport const StyledRadioButtonWrapper = styled.div<StyledRadioButtonWrapperProps>`\n display: flex;\n align-items: center;\n position: relative;\n gap: 5px;\n user-select: none;\n`;\n\ntype StyledRadioButtonPseudoCheckBoxProps = WithTheme<{\n $isChecked: boolean;\n $isDisabled: boolean;\n}>;\n\nexport const StyledRadioButtonPseudoCheckBox = styled.div<StyledRadioButtonPseudoCheckBoxProps>`\n background-color: ${({ theme, $isChecked }: StyledRadioButtonPseudoCheckBoxProps) =>\n $isChecked ? theme['secondary-408'] : theme['secondary-403']};\n opacity: 1;\n border: 1px solid\n rgba(${({ theme }: StyledRadioButtonPseudoCheckBoxProps) => theme['409-rgb']}, 0.5);\n width: 15px;\n height: 15px;\n position: absolute;\n border-radius: 100%;\n z-index: 1;\n cursor: ${({ $isDisabled }: StyledRadioButtonPseudoCheckBoxProps) =>\n $isDisabled ? 'default !important' : 'pointer !important'};\n`;\n\ntype StyledRadioButtonCheckBoxProps = WithTheme<{\n $isDisabled: boolean;\n}>;\n\nexport const StyledRadioButtonCheckBox = styled.input<StyledRadioButtonCheckBoxProps>`\n opacity: 0;\n height: 15px;\n width: 15px;\n cursor: ${({ $isDisabled }: StyledRadioButtonCheckBoxProps) =>\n $isDisabled ? 'default !important' : 'pointer !important'};\n`;\n\ntype StyledRadioButtonCheckBoxMarkProps = WithTheme<{\n $isHovered: boolean;\n $isSelected: boolean;\n $isDisabled: boolean;\n}>;\n\nexport const StyledRadioButtonCheckBoxMark = styled.span<StyledRadioButtonCheckBoxMarkProps>`\n background-color: transparent;\n position: absolute;\n top: 1px;\n left: 3.925px;\n display: inline-block;\n transform: rotate(35deg);\n height: 9px;\n width: 5px;\n border-bottom: 2px solid white;\n border-right: 2px solid white;\n border-top: transparent;\n border-left: transparent;\n z-index: 2;\n cursor: ${({ $isDisabled }: StyledRadioButtonCheckBoxMarkProps) =>\n $isDisabled ? 'default !important' : 'pointer !important'};\n\n ${({ $isHovered, $isSelected }) => {\n if ($isSelected) {\n return css`\n opacity: 1;\n `;\n }\n\n if ($isHovered) {\n return css`\n opacity: 0.5;\n `;\n }\n\n return css`\n opacity: 0;\n `;\n }}\n`;\n\ntype StyledRadioButtonLabelProps = WithTheme<{ $isDisabled: boolean }>;\n\nexport const StyledRadioButtonLabel = styled.div<StyledRadioButtonLabelProps>`\n color: ${({ theme }: StyledRadioButtonLabelProps) => theme.text};\n margin: 0;\n cursor: ${({ $isDisabled }: StyledRadioButtonLabelProps) =>\n $isDisabled ? 'default !important' : 'pointer !important'};\n`;\n\nexport const StyledLabelWrapper = styled.div`\n display: flex;\n align-items: center;\n justify-content: space-between;\n width: 100%;\n gap: 12px;\n`;\n\ntype StyledMotionRadioButtonChildrenProps = WithTheme<unknown>;\n\nexport const StyledMotionRadioButtonChildren = styled(\n motion.div,\n)<StyledMotionRadioButtonChildrenProps>`\n margin-left: 20px;\n cursor: text;\n overflow: hidden;\n color: ${({ theme }: StyledMotionRadioButtonChildrenProps) => theme.text};\n`;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,iBAAA,GAAAC,uBAAA,CAAAF,OAAA;AAAgD,SAAAE,wBAAAC,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAH,uBAAA,YAAAA,CAAAC,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAC,OAAA,EAAAV,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAAQ,CAAA,MAAAF,CAAA,GAAAL,CAAA,GAAAG,CAAA,GAAAD,CAAA,QAAAG,CAAA,CAAAK,GAAA,CAAAX,CAAA,UAAAM,CAAA,CAAAM,GAAA,CAAAZ,CAAA,GAAAM,CAAA,CAAAO,GAAA,CAAAb,CAAA,EAAAQ,CAAA,gBAAAP,CAAA,IAAAD,CAAA,gBAAAC,CAAA,OAAAa,cAAA,CAAAC,IAAA,CAAAf,CAAA,E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AA,GAAG,IAAAlB,yBAAM,EACjDmB,aAAM,CAACb,GACX,CAAuC;AACvC;AACA;AACA;AACA,aAAa,CAAC;EAAEE;AAA4C,CAAC,KAAKA,KAAK,CAACQ,IAAI;AAC5E,CAAC","ignoreList":[]}
|
|
@@ -11,6 +11,7 @@ var _Input = _interopRequireWildcard(require("../input/Input"));
|
|
|
11
11
|
var _SearchInput = require("./SearchInput.styles");
|
|
12
12
|
var _styledComponents = require("styled-components");
|
|
13
13
|
var _element = require("../../hooks/element");
|
|
14
|
+
var _useFocusRingPortal = require("../../hooks/useFocusRingPortal");
|
|
14
15
|
var _useKeyboardFocusHighlighting = require("../../hooks/useKeyboardFocusHighlighting");
|
|
15
16
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
16
17
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
@@ -34,6 +35,10 @@ const SearchInput = /*#__PURE__*/(0, _react2.forwardRef)(({
|
|
|
34
35
|
const parentWidth = (0, _element.useElementSize)(pseudoRef);
|
|
35
36
|
const theme = (0, _styledComponents.useTheme)();
|
|
36
37
|
const shouldShowKeyboardHighlighting = (0, _useKeyboardFocusHighlighting.useKeyboardFocusHighlighting)(shouldEnableKeyboardHighlighting);
|
|
38
|
+
(0, _useFocusRingPortal.useFocusRingPortal)(iconTriggerRef, {
|
|
39
|
+
isEnabled: shouldShowKeyboardHighlighting,
|
|
40
|
+
shape: 'circle'
|
|
41
|
+
});
|
|
37
42
|
const handleBackIconClick = (0, _react2.useCallback)(() => setIsSearchInputActive(false), []);
|
|
38
43
|
const handleSearchIconClick = (0, _react2.useCallback)(() => setIsSearchInputActive(true), []);
|
|
39
44
|
const handleIconTriggerClick = (0, _react2.useCallback)(() => {
|
|
@@ -95,7 +100,6 @@ const SearchInput = /*#__PURE__*/(0, _react2.forwardRef)(({
|
|
|
95
100
|
initial: false
|
|
96
101
|
}, isSearchInputActive && /*#__PURE__*/_react2.default.createElement(_SearchInput.StyledMotionSearchInputContentWrapper, {
|
|
97
102
|
$shouldUseAbsolutePositioning: shouldUseAbsolutePositioning,
|
|
98
|
-
$shouldShowKeyboardHighlighting: shouldShowKeyboardHighlighting,
|
|
99
103
|
animate: {
|
|
100
104
|
opacity: 1,
|
|
101
105
|
width
|
|
@@ -127,8 +131,7 @@ const SearchInput = /*#__PURE__*/(0, _react2.forwardRef)(({
|
|
|
127
131
|
id: isSearchInputActive ? 'search-input-backIcon' : 'search-input-searchIcon',
|
|
128
132
|
tabIndex: 0,
|
|
129
133
|
onClick: handleIconTriggerClick,
|
|
130
|
-
onKeyDown: handleIconTriggerKeyDown
|
|
131
|
-
$shouldShowKeyboardHighlighting: shouldShowKeyboardHighlighting
|
|
134
|
+
onKeyDown: handleIconTriggerKeyDown
|
|
132
135
|
}, /*#__PURE__*/_react2.default.createElement(_SearchInput.StyledMotionSearchInputIconWrapperContent, {
|
|
133
136
|
animate: {
|
|
134
137
|
opacity: 1
|
|
@@ -143,8 +146,7 @@ const SearchInput = /*#__PURE__*/(0, _react2.forwardRef)(({
|
|
|
143
146
|
key: isSearchInputActive ? 'backIcon' : 'searchIcon',
|
|
144
147
|
transition: {
|
|
145
148
|
duration: 0.3
|
|
146
|
-
}
|
|
147
|
-
$shouldShowKeyboardHighlighting: shouldShowKeyboardHighlighting
|
|
149
|
+
}
|
|
148
150
|
}, /*#__PURE__*/_react2.default.createElement(_Icon.default, {
|
|
149
151
|
key: "icon",
|
|
150
152
|
color: iconColor,
|
|
@@ -157,8 +159,7 @@ const SearchInput = /*#__PURE__*/(0, _react2.forwardRef)(({
|
|
|
157
159
|
id: isSearchInputActive ? 'search-input-backIcon' : 'search-input-searchIcon',
|
|
158
160
|
tabIndex: 0,
|
|
159
161
|
onClick: handleIconTriggerClick,
|
|
160
|
-
onKeyDown: handleIconTriggerKeyDown
|
|
161
|
-
$shouldShowKeyboardHighlighting: shouldShowKeyboardHighlighting
|
|
162
|
+
onKeyDown: handleIconTriggerKeyDown
|
|
162
163
|
}, /*#__PURE__*/_react2.default.createElement(_SearchInput.StyledMotionSearchInputIconWrapperContent, {
|
|
163
164
|
animate: {
|
|
164
165
|
opacity: 1
|
|
@@ -173,8 +174,7 @@ const SearchInput = /*#__PURE__*/(0, _react2.forwardRef)(({
|
|
|
173
174
|
key: isSearchInputActive ? 'backIcon' : 'searchIcon',
|
|
174
175
|
transition: {
|
|
175
176
|
duration: 0.3
|
|
176
|
-
}
|
|
177
|
-
$shouldShowKeyboardHighlighting: shouldShowKeyboardHighlighting
|
|
177
|
+
}
|
|
178
178
|
}, /*#__PURE__*/_react2.default.createElement(_Icon.default, {
|
|
179
179
|
key: "icon",
|
|
180
180
|
color: iconColor,
|
|
@@ -184,7 +184,6 @@ const SearchInput = /*#__PURE__*/(0, _react2.forwardRef)(({
|
|
|
184
184
|
initial: false
|
|
185
185
|
}, isSearchInputActive && /*#__PURE__*/_react2.default.createElement(_SearchInput.StyledMotionSearchInputContentWrapper, {
|
|
186
186
|
$shouldUseAbsolutePositioning: shouldUseAbsolutePositioning,
|
|
187
|
-
$shouldShowKeyboardHighlighting: shouldShowKeyboardHighlighting,
|
|
188
187
|
animate: {
|
|
189
188
|
opacity: 1,
|
|
190
189
|
width: '100%'
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SearchInput.js","names":["_react","require","_react2","_interopRequireWildcard","_Icon","_interopRequireDefault","_Input","_SearchInput","_styledComponents","_element","_useKeyboardFocusHighlighting","e","__esModule","default","t","WeakMap","r","n","o","i","f","__proto__","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","SearchInput","forwardRef","iconColor","isActive","onActiveChange","onChange","onKeyDown","placeholder","shouldUseAbsolutePositioning","size","InputSize","Medium","value","shouldEnableKeyboardHighlighting","width","widthValue","ref","isSearchInputActive","setIsSearchInputActive","useState","trim","inputRef","useRef","pseudoRef","iconTriggerRef","parentWidth","useElementSize","theme","useTheme","shouldShowKeyboardHighlighting","useKeyboardFocusHighlighting","handleBackIconClick","useCallback","handleSearchIconClick","handleIconTriggerClick","handleIconTriggerKeyDown","event","key","preventDefault","handleInputKeyDown","_iconTriggerRef$curre","current","focus","useEffect","_inputRef$current","useImperativeHandle","_inputRef$current2","blur","_inputRef$current3","useMemo","createElement","Fragment","StyledSearchInput","className","$size","$shouldUseAbsolutePositioning","AnimatePresence","initial","StyledMotionSearchInputContentWrapper","$shouldShowKeyboardHighlighting","animate","opacity","exit","transition","duration","type","shouldShowClearIcon","StyledSearchInputIconTrigger","id","tabIndex","onClick","StyledMotionSearchInputIconWrapperContent","position","color","icons","StyledMotionSearchInputIconWrapper","leftElement","text","StyledSearchInputPseudoElement","displayName","_default","exports"],"sources":["../../../../src/components/search-input/SearchInput.tsx"],"sourcesContent":["import { AnimatePresence } from 'motion/react';\nimport React, {\n ChangeEventHandler,\n CSSProperties,\n forwardRef,\n useCallback,\n useEffect,\n useImperativeHandle,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport Icon from '../icon/Icon';\nimport Input, { InputRef, InputSize } from '../input/Input';\nimport {\n StyledMotionSearchInputContentWrapper,\n StyledMotionSearchInputIconWrapper,\n StyledMotionSearchInputIconWrapperContent,\n StyledSearchInput,\n StyledSearchInputIconTrigger,\n StyledSearchInputPseudoElement,\n} from './SearchInput.styles';\nimport { useTheme } from 'styled-components';\nimport type { Theme } from '../color-scheme-provider/ColorSchemeProvider';\nimport { useElementSize } from '../../hooks/element';\nimport { useKeyboardFocusHighlighting } from '../../hooks/useKeyboardFocusHighlighting';\n\nexport type SearchInputProps = {\n /**\n * Color of the icon\n */\n iconColor?: CSSProperties['color'];\n /**\n * Force the active state of the input and override the internal state\n */\n isActive?: boolean;\n /**\n * Function that is executed when the active state of the input changes\n */\n onActiveChange?: (isActive: boolean) => void;\n /**\n * Function that is executed when the text of the input changes\n */\n onChange: ChangeEventHandler<HTMLInputElement>;\n /**\n * Function that is executed when a key is pressed\n */\n onKeyDown?: (event: React.KeyboardEvent<HTMLInputElement>) => void;\n /**\n * Placeholder for the input field\n */\n placeholder?: string;\n /**\n * Whether the SearchInput should be positioned absolute.\n */\n shouldUseAbsolutePositioning?: boolean;\n /**\n * The size of the input field\n */\n size?: InputSize;\n /**\n * Value if the input field should be controlled\n */\n value?: string;\n /**\n * Enables keyboard-only focus highlighting.\n */\n shouldEnableKeyboardHighlighting?: boolean;\n /**\n * The width of the parent.\n */\n width?: number;\n};\n\nconst SearchInput = forwardRef<InputRef, SearchInputProps>(\n (\n {\n iconColor,\n isActive,\n onActiveChange,\n onChange,\n onKeyDown,\n placeholder,\n shouldUseAbsolutePositioning = false,\n size = InputSize.Medium,\n value,\n shouldEnableKeyboardHighlighting,\n width: widthValue,\n },\n ref,\n ) => {\n const [isSearchInputActive, setIsSearchInputActive] = useState(\n isActive ?? (typeof value === 'string' && value.trim() !== ''),\n );\n\n const inputRef = useRef<InputRef>(null);\n const pseudoRef = useRef<HTMLDivElement>(null);\n const iconTriggerRef = useRef<HTMLDivElement>(null);\n\n const parentWidth = useElementSize(pseudoRef);\n\n const theme = useTheme() as Theme;\n\n const shouldShowKeyboardHighlighting = useKeyboardFocusHighlighting(\n shouldEnableKeyboardHighlighting,\n );\n\n const handleBackIconClick = useCallback(() => setIsSearchInputActive(false), []);\n\n const handleSearchIconClick = useCallback(() => setIsSearchInputActive(true), []);\n\n const handleIconTriggerClick = useCallback(() => {\n if (isSearchInputActive) {\n handleBackIconClick();\n return;\n }\n\n handleSearchIconClick();\n }, [handleBackIconClick, handleSearchIconClick, isSearchInputActive]);\n\n const handleIconTriggerKeyDown = useCallback(\n (event: React.KeyboardEvent<HTMLDivElement>) => {\n if (event.key === 'Enter' || event.key === ' ') {\n event.preventDefault();\n handleIconTriggerClick();\n }\n },\n [handleIconTriggerClick],\n );\n\n const handleInputKeyDown = useCallback(\n (event: React.KeyboardEvent<HTMLInputElement>) => {\n if (event.key === 'Escape') {\n event.preventDefault();\n setIsSearchInputActive(false);\n iconTriggerRef.current?.focus();\n }\n\n if (typeof onKeyDown === 'function') {\n onKeyDown(event);\n }\n },\n [onActiveChange, onKeyDown],\n );\n\n useEffect(() => {\n if (typeof onActiveChange === 'function') {\n onActiveChange(isSearchInputActive);\n }\n }, [isSearchInputActive, onActiveChange]);\n\n useEffect(() => {\n if (isSearchInputActive) {\n inputRef.current?.focus();\n }\n }, [isSearchInputActive]);\n\n useEffect(() => {\n if (typeof isActive === 'boolean') {\n setIsSearchInputActive(isActive);\n }\n }, [isActive]);\n\n useImperativeHandle(\n ref,\n () => ({\n focus: () => inputRef.current?.focus(),\n blur: () => inputRef.current?.blur(),\n }),\n [],\n );\n\n const width = useMemo(\n () => widthValue ?? parentWidth?.width,\n [parentWidth?.width, widthValue],\n );\n\n return (\n <>\n <StyledSearchInput\n className=\"beta-chayns-search-input\"\n $size={size}\n $shouldUseAbsolutePositioning={shouldUseAbsolutePositioning}\n >\n {shouldUseAbsolutePositioning ? (\n <AnimatePresence initial={false}>\n {isSearchInputActive && (\n <StyledMotionSearchInputContentWrapper\n $shouldUseAbsolutePositioning={shouldUseAbsolutePositioning}\n $shouldShowKeyboardHighlighting={shouldShowKeyboardHighlighting}\n animate={{ opacity: 1, width }}\n exit={{ opacity: 0, width: 0 }}\n initial={{ opacity: 0, width: 0 }}\n key=\"searchInputContentWrapper\"\n transition={{ duration: 0.25, type: 'tween' }}\n >\n <Input\n onChange={onChange}\n onKeyDown={handleInputKeyDown}\n placeholder={placeholder}\n ref={inputRef}\n shouldEnableKeyboardHighlighting={\n shouldEnableKeyboardHighlighting\n }\n shouldShowClearIcon\n size={size}\n value={value}\n />\n </StyledMotionSearchInputContentWrapper>\n )}\n <StyledSearchInputIconTrigger\n ref={iconTriggerRef}\n id={\n isSearchInputActive\n ? 'search-input-backIcon'\n : 'search-input-searchIcon'\n }\n tabIndex={0}\n onClick={handleIconTriggerClick}\n onKeyDown={handleIconTriggerKeyDown}\n $shouldShowKeyboardHighlighting={shouldShowKeyboardHighlighting}\n >\n <StyledMotionSearchInputIconWrapperContent\n animate={{ opacity: 1 }}\n exit={{ opacity: 0, position: 'absolute' }}\n initial={{ opacity: 0 }}\n key={isSearchInputActive ? 'backIcon' : 'searchIcon'}\n transition={{ duration: 0.3 }}\n $shouldShowKeyboardHighlighting={shouldShowKeyboardHighlighting}\n >\n <Icon\n key=\"icon\"\n color={iconColor}\n tabIndex={-1}\n icons={\n isSearchInputActive ? ['fa fa-xmark'] : ['fa fa-search']\n }\n />\n </StyledMotionSearchInputIconWrapperContent>\n </StyledSearchInputIconTrigger>\n </AnimatePresence>\n ) : (\n <>\n <StyledMotionSearchInputIconWrapper>\n <AnimatePresence initial={false}>\n <StyledSearchInputIconTrigger\n ref={iconTriggerRef}\n id={\n isSearchInputActive\n ? 'search-input-backIcon'\n : 'search-input-searchIcon'\n }\n tabIndex={0}\n onClick={handleIconTriggerClick}\n onKeyDown={handleIconTriggerKeyDown}\n $shouldShowKeyboardHighlighting={\n shouldShowKeyboardHighlighting\n }\n >\n <StyledMotionSearchInputIconWrapperContent\n animate={{ opacity: 1 }}\n exit={{ opacity: 0, position: 'absolute' }}\n initial={{ opacity: 0 }}\n key={isSearchInputActive ? 'backIcon' : 'searchIcon'}\n transition={{ duration: 0.3 }}\n $shouldShowKeyboardHighlighting={\n shouldShowKeyboardHighlighting\n }\n >\n <Icon\n key=\"icon\"\n color={iconColor}\n tabIndex={-1}\n icons={\n isSearchInputActive\n ? ['fa fa-arrow-left']\n : ['fa fa-search']\n }\n />\n </StyledMotionSearchInputIconWrapperContent>\n </StyledSearchInputIconTrigger>\n </AnimatePresence>\n </StyledMotionSearchInputIconWrapper>\n <AnimatePresence initial={false}>\n {isSearchInputActive && (\n <StyledMotionSearchInputContentWrapper\n $shouldUseAbsolutePositioning={shouldUseAbsolutePositioning}\n $shouldShowKeyboardHighlighting={\n shouldShowKeyboardHighlighting\n }\n animate={{ opacity: 1, width: '100%' }}\n exit={{ opacity: 0, width: 0 }}\n initial={{ opacity: 0, width: 0 }}\n key=\"searchInputContentWrapper\"\n transition={{ duration: 0.3 }}\n >\n <Input\n key=\"input\"\n leftElement={\n <Icon\n color={theme.text}\n icons={['far fa-search']}\n />\n }\n onChange={onChange}\n onKeyDown={handleInputKeyDown}\n placeholder={placeholder}\n ref={inputRef}\n shouldEnableKeyboardHighlighting={\n shouldEnableKeyboardHighlighting\n }\n shouldShowClearIcon\n size={size}\n value={value}\n />\n </StyledMotionSearchInputContentWrapper>\n )}\n </AnimatePresence>\n </>\n )}\n </StyledSearchInput>\n <StyledSearchInputPseudoElement ref={pseudoRef} />\n </>\n );\n },\n);\n\nSearchInput.displayName = 'SearchInput';\n\nexport default SearchInput;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAC,uBAAA,CAAAF,OAAA;AAWA,IAAAG,KAAA,GAAAC,sBAAA,CAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAH,uBAAA,CAAAF,OAAA;AACA,IAAAM,YAAA,GAAAN,OAAA;AAQA,IAAAO,iBAAA,GAAAP,OAAA;AAEA,IAAAQ,QAAA,GAAAR,OAAA;AACA,IAAAS,6BAAA,GAAAT,OAAA;AAAwF,SAAAI,uBAAAM,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAR,wBAAAQ,CAAA,EAAAG,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAA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"version":3,"file":"SearchInput.js","names":["_react","require","_react2","_interopRequireWildcard","_Icon","_interopRequireDefault","_Input","_SearchInput","_styledComponents","_element","_useFocusRingPortal","_useKeyboardFocusHighlighting","e","__esModule","default","t","WeakMap","r","n","o","i","f","__proto__","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","SearchInput","forwardRef","iconColor","isActive","onActiveChange","onChange","onKeyDown","placeholder","shouldUseAbsolutePositioning","size","InputSize","Medium","value","shouldEnableKeyboardHighlighting","width","widthValue","ref","isSearchInputActive","setIsSearchInputActive","useState","trim","inputRef","useRef","pseudoRef","iconTriggerRef","parentWidth","useElementSize","theme","useTheme","shouldShowKeyboardHighlighting","useKeyboardFocusHighlighting","useFocusRingPortal","isEnabled","shape","handleBackIconClick","useCallback","handleSearchIconClick","handleIconTriggerClick","handleIconTriggerKeyDown","event","key","preventDefault","handleInputKeyDown","_iconTriggerRef$curre","current","focus","useEffect","_inputRef$current","useImperativeHandle","_inputRef$current2","blur","_inputRef$current3","useMemo","createElement","Fragment","StyledSearchInput","className","$size","$shouldUseAbsolutePositioning","AnimatePresence","initial","StyledMotionSearchInputContentWrapper","animate","opacity","exit","transition","duration","type","shouldShowClearIcon","StyledSearchInputIconTrigger","id","tabIndex","onClick","StyledMotionSearchInputIconWrapperContent","position","color","icons","StyledMotionSearchInputIconWrapper","leftElement","text","StyledSearchInputPseudoElement","displayName","_default","exports"],"sources":["../../../../src/components/search-input/SearchInput.tsx"],"sourcesContent":["import { AnimatePresence } from 'motion/react';\nimport React, {\n ChangeEventHandler,\n CSSProperties,\n forwardRef,\n useCallback,\n useEffect,\n useImperativeHandle,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport Icon from '../icon/Icon';\nimport Input, { InputRef, InputSize } from '../input/Input';\nimport {\n StyledMotionSearchInputContentWrapper,\n StyledMotionSearchInputIconWrapper,\n StyledMotionSearchInputIconWrapperContent,\n StyledSearchInput,\n StyledSearchInputIconTrigger,\n StyledSearchInputPseudoElement,\n} from './SearchInput.styles';\nimport { useTheme } from 'styled-components';\nimport type { Theme } from '../color-scheme-provider/ColorSchemeProvider';\nimport { useElementSize } from '../../hooks/element';\nimport { useFocusRingPortal } from '../../hooks/useFocusRingPortal';\nimport { useKeyboardFocusHighlighting } from '../../hooks/useKeyboardFocusHighlighting';\n\nexport type SearchInputProps = {\n /**\n * Color of the icon\n */\n iconColor?: CSSProperties['color'];\n /**\n * Force the active state of the input and override the internal state\n */\n isActive?: boolean;\n /**\n * Function that is executed when the active state of the input changes\n */\n onActiveChange?: (isActive: boolean) => void;\n /**\n * Function that is executed when the text of the input changes\n */\n onChange: ChangeEventHandler<HTMLInputElement>;\n /**\n * Function that is executed when a key is pressed\n */\n onKeyDown?: (event: React.KeyboardEvent<HTMLInputElement>) => void;\n /**\n * Placeholder for the input field\n */\n placeholder?: string;\n /**\n * Whether the SearchInput should be positioned absolute.\n */\n shouldUseAbsolutePositioning?: boolean;\n /**\n * The size of the input field\n */\n size?: InputSize;\n /**\n * Value if the input field should be controlled\n */\n value?: string;\n /**\n * Enables keyboard-only focus highlighting.\n */\n shouldEnableKeyboardHighlighting?: boolean;\n /**\n * The width of the parent.\n */\n width?: number;\n};\n\nconst SearchInput = forwardRef<InputRef, SearchInputProps>(\n (\n {\n iconColor,\n isActive,\n onActiveChange,\n onChange,\n onKeyDown,\n placeholder,\n shouldUseAbsolutePositioning = false,\n size = InputSize.Medium,\n value,\n shouldEnableKeyboardHighlighting,\n width: widthValue,\n },\n ref,\n ) => {\n const [isSearchInputActive, setIsSearchInputActive] = useState(\n isActive ?? (typeof value === 'string' && value.trim() !== ''),\n );\n\n const inputRef = useRef<InputRef>(null);\n const pseudoRef = useRef<HTMLDivElement>(null);\n const iconTriggerRef = useRef<HTMLDivElement>(null);\n\n const parentWidth = useElementSize(pseudoRef);\n\n const theme = useTheme() as Theme;\n\n const shouldShowKeyboardHighlighting = useKeyboardFocusHighlighting(\n shouldEnableKeyboardHighlighting,\n );\n useFocusRingPortal(iconTriggerRef, {\n isEnabled: shouldShowKeyboardHighlighting,\n shape: 'circle',\n });\n\n const handleBackIconClick = useCallback(() => setIsSearchInputActive(false), []);\n\n const handleSearchIconClick = useCallback(() => setIsSearchInputActive(true), []);\n\n const handleIconTriggerClick = useCallback(() => {\n if (isSearchInputActive) {\n handleBackIconClick();\n return;\n }\n\n handleSearchIconClick();\n }, [handleBackIconClick, handleSearchIconClick, isSearchInputActive]);\n\n const handleIconTriggerKeyDown = useCallback(\n (event: React.KeyboardEvent<HTMLDivElement>) => {\n if (event.key === 'Enter' || event.key === ' ') {\n event.preventDefault();\n handleIconTriggerClick();\n }\n },\n [handleIconTriggerClick],\n );\n\n const handleInputKeyDown = useCallback(\n (event: React.KeyboardEvent<HTMLInputElement>) => {\n if (event.key === 'Escape') {\n event.preventDefault();\n setIsSearchInputActive(false);\n iconTriggerRef.current?.focus();\n }\n\n if (typeof onKeyDown === 'function') {\n onKeyDown(event);\n }\n },\n [onActiveChange, onKeyDown],\n );\n\n useEffect(() => {\n if (typeof onActiveChange === 'function') {\n onActiveChange(isSearchInputActive);\n }\n }, [isSearchInputActive, onActiveChange]);\n\n useEffect(() => {\n if (isSearchInputActive) {\n inputRef.current?.focus();\n }\n }, [isSearchInputActive]);\n\n useEffect(() => {\n if (typeof isActive === 'boolean') {\n setIsSearchInputActive(isActive);\n }\n }, [isActive]);\n\n useImperativeHandle(\n ref,\n () => ({\n focus: () => inputRef.current?.focus(),\n blur: () => inputRef.current?.blur(),\n }),\n [],\n );\n\n const width = useMemo(\n () => widthValue ?? parentWidth?.width,\n [parentWidth?.width, widthValue],\n );\n\n return (\n <>\n <StyledSearchInput\n className=\"beta-chayns-search-input\"\n $size={size}\n $shouldUseAbsolutePositioning={shouldUseAbsolutePositioning}\n >\n {shouldUseAbsolutePositioning ? (\n <AnimatePresence initial={false}>\n {isSearchInputActive && (\n <StyledMotionSearchInputContentWrapper\n $shouldUseAbsolutePositioning={shouldUseAbsolutePositioning}\n animate={{ opacity: 1, width }}\n exit={{ opacity: 0, width: 0 }}\n initial={{ opacity: 0, width: 0 }}\n key=\"searchInputContentWrapper\"\n transition={{ duration: 0.25, type: 'tween' }}\n >\n <Input\n onChange={onChange}\n onKeyDown={handleInputKeyDown}\n placeholder={placeholder}\n ref={inputRef}\n shouldEnableKeyboardHighlighting={\n shouldEnableKeyboardHighlighting\n }\n shouldShowClearIcon\n size={size}\n value={value}\n />\n </StyledMotionSearchInputContentWrapper>\n )}\n <StyledSearchInputIconTrigger\n ref={iconTriggerRef}\n id={\n isSearchInputActive\n ? 'search-input-backIcon'\n : 'search-input-searchIcon'\n }\n tabIndex={0}\n onClick={handleIconTriggerClick}\n onKeyDown={handleIconTriggerKeyDown}\n >\n <StyledMotionSearchInputIconWrapperContent\n animate={{ opacity: 1 }}\n exit={{ opacity: 0, position: 'absolute' }}\n initial={{ opacity: 0 }}\n key={isSearchInputActive ? 'backIcon' : 'searchIcon'}\n transition={{ duration: 0.3 }}\n >\n <Icon\n key=\"icon\"\n color={iconColor}\n tabIndex={-1}\n icons={\n isSearchInputActive ? ['fa fa-xmark'] : ['fa fa-search']\n }\n />\n </StyledMotionSearchInputIconWrapperContent>\n </StyledSearchInputIconTrigger>\n </AnimatePresence>\n ) : (\n <>\n <StyledMotionSearchInputIconWrapper>\n <AnimatePresence initial={false}>\n <StyledSearchInputIconTrigger\n ref={iconTriggerRef}\n id={\n isSearchInputActive\n ? 'search-input-backIcon'\n : 'search-input-searchIcon'\n }\n tabIndex={0}\n onClick={handleIconTriggerClick}\n onKeyDown={handleIconTriggerKeyDown}\n >\n <StyledMotionSearchInputIconWrapperContent\n animate={{ opacity: 1 }}\n exit={{ opacity: 0, position: 'absolute' }}\n initial={{ opacity: 0 }}\n key={isSearchInputActive ? 'backIcon' : 'searchIcon'}\n transition={{ duration: 0.3 }}\n >\n <Icon\n key=\"icon\"\n color={iconColor}\n tabIndex={-1}\n icons={\n isSearchInputActive\n ? ['fa fa-arrow-left']\n : ['fa fa-search']\n }\n />\n </StyledMotionSearchInputIconWrapperContent>\n </StyledSearchInputIconTrigger>\n </AnimatePresence>\n </StyledMotionSearchInputIconWrapper>\n <AnimatePresence initial={false}>\n {isSearchInputActive && (\n <StyledMotionSearchInputContentWrapper\n $shouldUseAbsolutePositioning={shouldUseAbsolutePositioning}\n animate={{ opacity: 1, width: '100%' }}\n exit={{ opacity: 0, width: 0 }}\n initial={{ opacity: 0, width: 0 }}\n key=\"searchInputContentWrapper\"\n transition={{ duration: 0.3 }}\n >\n <Input\n key=\"input\"\n leftElement={\n <Icon\n color={theme.text}\n icons={['far fa-search']}\n />\n }\n onChange={onChange}\n onKeyDown={handleInputKeyDown}\n placeholder={placeholder}\n ref={inputRef}\n shouldEnableKeyboardHighlighting={\n shouldEnableKeyboardHighlighting\n }\n shouldShowClearIcon\n size={size}\n value={value}\n />\n </StyledMotionSearchInputContentWrapper>\n )}\n </AnimatePresence>\n </>\n )}\n </StyledSearchInput>\n <StyledSearchInputPseudoElement ref={pseudoRef} />\n </>\n );\n },\n);\n\nSearchInput.displayName = 'SearchInput';\n\nexport default SearchInput;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAC,uBAAA,CAAAF,OAAA;AAWA,IAAAG,KAAA,GAAAC,sBAAA,CAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAH,uBAAA,CAAAF,OAAA;AACA,IAAAM,YAAA,GAAAN,OAAA;AAQA,IAAAO,iBAAA,GAAAP,OAAA;AAEA,IAAAQ,QAAA,GAAAR,OAAA;AACA,IAAAS,mBAAA,GAAAT,OAAA;AACA,IAAAU,6BAAA,GAAAV,OAAA;AAAwF,SAAAI,uBAAAO,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAT,wBAAAS,CAAA,EAAAG,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE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InputPseudoElement = exports.StyledSearchInputIconTrigger = exports.StyledSearchInput = exports.StyledMotionSearchInputIconWrapperContent = exports.StyledMotionSearchInputIconWrapper = exports.StyledMotionSearchInputContentWrapper = void 0;
|
|
7
7
|
var _react = require("motion/react");
|
|
8
8
|
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
9
|
-
var _keyboardFocusHighlighting = require("../../utils/keyboardFocusHighlighting.styles");
|
|
10
9
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
11
10
|
const StyledSearchInput = exports.StyledSearchInput = _styledComponents.default.div`
|
|
12
11
|
display: flex;
|
|
@@ -51,9 +50,7 @@ const StyledMotionSearchInputContentWrapper = exports.StyledMotionSearchInputCon
|
|
|
51
50
|
right: 0;
|
|
52
51
|
`}
|
|
53
52
|
|
|
54
|
-
overflow:
|
|
55
|
-
$shouldShowKeyboardHighlighting
|
|
56
|
-
}) => $shouldShowKeyboardHighlighting ? 'visible' : 'hidden'};
|
|
53
|
+
overflow: hidden;
|
|
57
54
|
`;
|
|
58
55
|
const StyledMotionSearchInputIconWrapperContent = exports.StyledMotionSearchInputIconWrapperContent = (0, _styledComponents.default)(_react.motion.div)`
|
|
59
56
|
display: flex;
|
|
@@ -68,17 +65,10 @@ const StyledSearchInputIconTrigger = exports.StyledSearchInputIconTrigger = _sty
|
|
|
68
65
|
border-radius: 6px;
|
|
69
66
|
cursor: pointer;
|
|
70
67
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
transition: none;
|
|
76
|
-
${_keyboardFocusHighlighting.keyboardFocusHighlightingRingCss}
|
|
77
|
-
border-radius: 50%;
|
|
78
|
-
box-shadow: 0 0 0 4px rgba(0, 102, 204, 0.35);
|
|
79
|
-
outline-offset: 2px;
|
|
80
|
-
}
|
|
81
|
-
`}
|
|
68
|
+
&:focus-visible {
|
|
69
|
+
outline: none;
|
|
70
|
+
box-shadow: none;
|
|
71
|
+
}
|
|
82
72
|
`;
|
|
83
73
|
const StyledMotionSearchInputIconWrapper = exports.StyledMotionSearchInputIconWrapper = _styledComponents.default.div`
|
|
84
74
|
width: 18px;
|