@vibe/core 3.36.0-alpha-94da6.0 → 3.36.0
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/dist/components/Accordion/Accordion/Accordion.d.ts +3 -15
- package/dist/components/Accordion/AccordionItem/AccordionItem.d.ts +9 -17
- package/dist/components/AlertBanner/AlertBanner.d.ts +16 -3
- package/dist/components/AlertBanner/AlertBannerButton/AlertBannerButton.d.ts +3 -0
- package/dist/components/AlertBanner/AlertBannerLink/AlertBannerLink.d.ts +3 -0
- package/dist/components/AlertBanner/AlertBannerText/AlertBannerText.d.ts +6 -0
- package/dist/components/AttentionBox/AttentionBox.d.ts +36 -4
- package/dist/components/Avatar/Avatar.d.ts +70 -3
- package/dist/components/Avatar/AvatarBadge.d.ts +10 -2
- package/dist/components/Avatar/AvatarContent.d.ts +24 -1
- package/dist/components/AvatarGroup/AvatarGroup.d.ts +17 -5
- package/dist/components/AvatarGroup/AvatarGroupCounter.d.ts +20 -2
- package/dist/components/AvatarGroup/AvatarGroupCounterTooltipContainer.d.ts +20 -3
- package/dist/components/AvatarGroup/AvatarGroupCounterTooltipContent.d.ts +10 -2
- package/dist/components/AvatarGroup/AvatarGroupCounterTooltipContentVirtualizedList.d.ts +13 -1
- package/dist/components/Badge/Badge.d.ts +15 -0
- package/dist/components/Badge/Indicator/Indicator.d.ts +3 -0
- package/dist/components/BaseInput/BaseInput.types.d.ts +8 -15
- package/dist/components/BaseListItem/BaseListItem.types.d.ts +2 -2
- package/dist/components/Box/Box.d.ts +75 -0
- package/dist/components/BreadcrumbsBar/BreadcrumbItem/BreadcrumbContent/BreadcrumbContent.d.ts +24 -0
- package/dist/components/BreadcrumbsBar/BreadcrumbItem/BreadcrumbItem.d.ts +24 -7
- package/dist/components/BreadcrumbsBar/BreadcrumbsBar.d.ts +6 -1
- package/dist/components/ButtonGroup/ButtonGroup.d.ts +46 -1
- package/dist/components/ButtonGroup/ButtonWrapper.d.ts +16 -1
- package/dist/components/Checkbox/Checkbox.d.ts +42 -18
- package/dist/components/Chips/Chips.d.ts +54 -20
- package/dist/components/Clickable/Clickable.d.ts +41 -5
- package/dist/components/Clickable/ClickableWrapper.d.ts +9 -0
- package/dist/components/ColorPicker/ColorPicker.d.ts +43 -1
- package/dist/components/ColorPicker/components/ColorPickerContent/ColorPickerClearButton.d.ts +9 -0
- package/dist/components/ColorPicker/components/ColorPickerContent/ColorPickerColorsGrid.d.ts +39 -0
- package/dist/components/ColorPicker/components/ColorPickerContent/ColorPickerContent.d.ts +48 -0
- package/dist/components/ColorPicker/components/ColorPickerItemComponent/ColorPickerItemComponent.d.ts +33 -1
- package/dist/components/Combobox/Combobox.d.ts +78 -25
- package/dist/components/Combobox/components/ComboboxCategory/ComboboxCategory.d.ts +6 -0
- package/dist/components/Combobox/components/ComboboxConstants.d.ts +156 -0
- package/dist/components/Combobox/components/ComboboxItems/ComboboxItems.d.ts +45 -0
- package/dist/components/Combobox/components/ComboboxOption/ComboboxOption.d.ts +30 -0
- package/dist/components/Counter/Counter.d.ts +33 -14
- package/dist/components/DatePicker/DateNavigationItem/DateNavigationItem.d.ts +6 -0
- package/dist/components/DatePicker/DatePicker.d.ts +39 -13
- package/dist/components/DatePicker/DatePickerHeader/DatePickerHeader.d.ts +18 -0
- package/dist/components/DatePicker/YearPicker/YearPicker.d.ts +12 -0
- package/dist/components/DatePicker/YearPicker/YearsList.d.ts +12 -0
- package/dist/components/DatePicker/types.d.ts +6 -0
- package/dist/components/Dialog/Dialog.d.ts +59 -36
- package/dist/components/Dialog/DialogContent/DialogContent.d.ts +52 -3
- package/dist/components/DialogContentContainer/DialogContentContainer.d.ts +18 -0
- package/dist/components/Divider/Divider.d.ts +2 -2
- package/dist/components/Dropdown/Dropdown.types.d.ts +97 -63
- package/dist/components/EditableHeading/EditableHeading.d.ts +4 -3
- package/dist/components/EditableText/EditableText.d.ts +6 -4
- package/dist/components/EditableTypography/EditableTypography.d.ts +48 -16
- package/dist/components/ExpandCollapse/ExpandCollapse.d.ts +20 -8
- package/dist/components/FieldLabel/FieldLabel.d.ts +18 -0
- package/dist/components/Flex/Flex.d.ts +36 -2
- package/dist/components/FormattedNumber/FormattedNumber.d.ts +8 -8
- package/dist/components/GridKeyboardNavigationContext/GridKeyboardNavigationContextConstants.d.ts +3 -0
- package/dist/components/Heading/Heading.d.ts +15 -0
- package/dist/components/HiddenText/HiddenText.d.ts +3 -0
- package/dist/components/Icon/CustomSvgIcon/CustomSvgIcon.d.ts +30 -0
- package/dist/components/Icon/FontIcon/FontIcon.d.ts +18 -0
- package/dist/components/Icon/Icon.d.ts +32 -8
- package/dist/components/IconButton/IconButton.d.ts +37 -27
- package/dist/components/Label/Label.d.ts +22 -1
- package/dist/components/Label/LabelCelebrationAnimation.d.ts +6 -0
- package/dist/components/LayerProvider/LayerContext.d.ts +3 -0
- package/dist/components/LayerProvider/LayerProvider.d.ts +7 -1
- package/dist/components/LegacyModal/LegacyModalHeader/LegacyModalHeader.d.ts +0 -8
- package/dist/components/Link/Link.d.ts +40 -14
- package/dist/components/List/List.d.ts +14 -5
- package/dist/components/List/VirtualizedListItems/VirtualizedListItems.d.ts +3 -0
- package/dist/components/ListItem/ListItem.d.ts +12 -25
- package/dist/components/ListItemAvatar/ListItemAvatar.d.ts +7 -1
- package/dist/components/ListItemIcon/ListItemIcon.d.ts +5 -2
- package/dist/components/ListTitle/ListTitle.d.ts +6 -0
- package/dist/components/Loader/Loader.d.ts +12 -2
- package/dist/components/Menu/Menu/Menu.d.ts +42 -0
- package/dist/components/Menu/MenuGridItem/MenuGridItem.d.ts +33 -5
- package/dist/components/Menu/MenuItem/AvatarMenuItem.d.ts +6 -0
- package/dist/components/Menu/MenuItem/MenuItem.d.ts +97 -7
- package/dist/components/Menu/MenuItem/components/BaseMenuItem/BaseMenuItem.types.d.ts +7 -0
- package/dist/components/Menu/MenuItem/components/MenuItemIcon/MenuItemIcon.types.d.ts +7 -6
- package/dist/components/Menu/MenuItem/components/MenuItemSubMenu/MenuItemSubMenu.types.d.ts +7 -3
- package/dist/components/Menu/MenuItem/components/MenuItemSubMenuIcon/MenuItemSubMenuIcon.types.d.ts +5 -1
- package/dist/components/Menu/MenuItemButton/MenuItemButton.d.ts +51 -0
- package/dist/components/Menu/MenuTitle/MenuTitle.d.ts +6 -0
- package/dist/components/MenuButton/MenuButton.d.ts +67 -19
- package/dist/components/Modal/ModalContent/ModalContent.types.d.ts +1 -1
- package/dist/components/Modal/ModalMedia/ModalMedia.types.d.ts +1 -1
- package/dist/components/Modal/ModalTopActions/ModalTopActions.types.d.ts +5 -5
- package/dist/components/Modal/context/ModalContext.types.d.ts +5 -5
- package/dist/components/Modal/footers/ModalFooter/ModalFooter.types.d.ts +1 -1
- package/dist/components/Modal/footers/ModalFooterBase/ModalFooterBase.types.d.ts +3 -3
- package/dist/components/Modal/footers/ModalFooterWizard/ModalFooterWizard.types.d.ts +4 -4
- package/dist/components/Modal/layouts/ModalBasicLayout/ModalBasicLayout.types.d.ts +1 -1
- package/dist/components/Modal/layouts/ModalFooterShadow.types.d.ts +1 -1
- package/dist/components/Modal/layouts/ModalLayoutScrollableContent.types.d.ts +2 -2
- package/dist/components/Modal/layouts/ModalMediaLayout/ModalMediaLayout.types.d.ts +1 -1
- package/dist/components/Modal/layouts/ModalSideBySideLayout/ModalSideBySideLayout.types.d.ts +1 -1
- package/dist/components/MultiStepIndicator/MultiStepIndicator.d.ts +30 -0
- package/dist/components/MultiStepIndicator/components/StepIndicator/StepIndicator.d.ts +57 -0
- package/dist/components/ProgressBars/LinearProgressBar/Bar/Bar.d.ts +17 -6
- package/dist/components/ProgressBars/LinearProgressBar/LinearProgressBar.d.ts +19 -22
- package/dist/components/ProgressBars/PercentageLabel/PercentageLabel.d.ts +2 -2
- package/dist/components/RadioButton/RadioButton.d.ts +45 -16
- package/dist/components/Search/Search.types.d.ts +24 -24
- package/dist/components/Skeleton/Skeleton.d.ts +16 -1
- package/dist/components/SlideTransition/SlideTransition.types.d.ts +12 -0
- package/dist/components/Slider/SelectionIndicator.d.ts +6 -0
- package/dist/components/Slider/SliderBase/SliderFilledTrack.d.ts +6 -8
- package/dist/components/Slider/SliderBase/SliderRail.d.ts +6 -4
- package/dist/components/Slider/SliderBase/SliderThumb.d.ts +9 -7
- package/dist/components/Slider/SliderBase/SliderTrack.d.ts +1 -2
- package/dist/components/Slider/SliderContext.d.ts +13 -8
- package/dist/components/Slider/SliderInfix.d.ts +1 -2
- package/dist/components/SplitButton/SplitButton.d.ts +25 -2
- package/dist/components/Steps/Steps.d.ts +32 -2
- package/dist/components/Steps/StepsCommand.d.ts +21 -0
- package/dist/components/Steps/StepsDot.d.ts +15 -0
- package/dist/components/Steps/StepsGalleryHeader.d.ts +15 -0
- package/dist/components/Steps/StepsHeader.d.ts +33 -0
- package/dist/components/Steps/StepsNumbersHeader.d.ts +9 -0
- package/dist/components/Switch/Switch.d.ts +39 -0
- package/dist/components/Table/Table/Table.d.ts +42 -0
- package/dist/components/Table/TableBody/TableBody.d.ts +3 -0
- package/dist/components/Table/TableCell/TableCell.d.ts +6 -0
- package/dist/components/Table/TableCellSkeleton/TableCellSkeleton.d.ts +6 -0
- package/dist/components/Table/TableContainer/TableContainer.types.d.ts +6 -0
- package/dist/components/Table/TableHeader/TableHeader.d.ts +3 -0
- package/dist/components/Table/TableHeaderCell/TableHeaderCell.d.ts +21 -0
- package/dist/components/Table/TableRow/TableRow.d.ts +7 -1
- package/dist/components/Table/TableRowMenu/TableRowMenu.types.d.ts +6 -0
- package/dist/components/Table/TableVirtualizedBody/TableVirtualizedBody.d.ts +15 -0
- package/dist/components/Tabs/Tab/Tab.d.ts +27 -3
- package/dist/components/Tabs/TabList/TabList.d.ts +15 -0
- package/dist/components/Tabs/TabPanel/TabPanel.d.ts +6 -0
- package/dist/components/Tabs/TabPanels/TabPanels.d.ts +9 -0
- package/dist/components/Tabs/TabsContext/TabsContext.d.ts +6 -0
- package/dist/components/Text/Text.d.ts +9 -0
- package/dist/components/TextArea/TextArea.types.d.ts +13 -16
- package/dist/components/TextField/TextField.d.ts +127 -9
- package/dist/components/TextWithHighlight/TextWithHighlight.d.ts +33 -6
- package/dist/components/ThemeProvider/ThemeProvider.d.ts +8 -5
- package/dist/components/Tipseen/Tipseen.d.ts +64 -6
- package/dist/components/Tipseen/TipseenBasicContent.d.ts +9 -0
- package/dist/components/Tipseen/TipseenContent.d.ts +25 -1
- package/dist/components/Tipseen/TipseenImage.d.ts +12 -0
- package/dist/components/Tipseen/TipseenMedia/TipseenMedia.d.ts +3 -0
- package/dist/components/Tipseen/TipseenTitle.d.ts +3 -0
- package/dist/components/Tipseen/TipseenWizard.d.ts +7 -1
- package/dist/components/Toast/Toast.d.ts +37 -8
- package/dist/components/Toggle/MockToggle.d.ts +21 -0
- package/dist/components/Toggle/Toggle.d.ts +37 -1
- package/dist/components/Toggle/ToggleText.d.ts +6 -0
- package/dist/components/Tooltip/Tooltip.d.ts +64 -27
- package/dist/components/TransitionView/TransitionView.types.d.ts +9 -0
- package/dist/components/Typography/Typography.d.ts +12 -6
- package/dist/components/VirtualizedGrid/VirtualizedGrid.d.ts +19 -19
- package/dist/components/VirtualizedList/VirtualizedList.d.ts +33 -27
- package/dist/hooks/useKeyEvent/index.d.ts +30 -0
- package/dist/hooks/useSwitch/index.d.ts +12 -0
- package/dist/hooks/useWizard/useWizard.types.d.ts +33 -0
- package/dist/mocked_classnames/components/Accordion/Accordion/Accordion.d.ts +3 -15
- package/dist/mocked_classnames/components/Accordion/AccordionItem/AccordionItem.d.ts +9 -17
- package/dist/mocked_classnames/components/AlertBanner/AlertBanner.d.ts +16 -3
- package/dist/mocked_classnames/components/AlertBanner/AlertBannerButton/AlertBannerButton.d.ts +3 -0
- package/dist/mocked_classnames/components/AlertBanner/AlertBannerLink/AlertBannerLink.d.ts +3 -0
- package/dist/mocked_classnames/components/AlertBanner/AlertBannerText/AlertBannerText.d.ts +6 -0
- package/dist/mocked_classnames/components/AttentionBox/AttentionBox.d.ts +36 -4
- package/dist/mocked_classnames/components/Avatar/Avatar.d.ts +70 -3
- package/dist/mocked_classnames/components/Avatar/AvatarBadge.d.ts +10 -2
- package/dist/mocked_classnames/components/Avatar/AvatarContent.d.ts +24 -1
- package/dist/mocked_classnames/components/AvatarGroup/AvatarGroup.d.ts +17 -5
- package/dist/mocked_classnames/components/AvatarGroup/AvatarGroupCounter.d.ts +20 -2
- package/dist/mocked_classnames/components/AvatarGroup/AvatarGroupCounterTooltipContainer.d.ts +20 -3
- package/dist/mocked_classnames/components/AvatarGroup/AvatarGroupCounterTooltipContent.d.ts +10 -2
- package/dist/mocked_classnames/components/AvatarGroup/AvatarGroupCounterTooltipContentVirtualizedList.d.ts +13 -1
- package/dist/mocked_classnames/components/Badge/Badge.d.ts +15 -0
- package/dist/mocked_classnames/components/Badge/Indicator/Indicator.d.ts +3 -0
- package/dist/mocked_classnames/components/BaseInput/BaseInput.types.d.ts +8 -15
- package/dist/mocked_classnames/components/BaseListItem/BaseListItem.types.d.ts +2 -2
- package/dist/mocked_classnames/components/Box/Box.d.ts +75 -0
- package/dist/mocked_classnames/components/BreadcrumbsBar/BreadcrumbItem/BreadcrumbContent/BreadcrumbContent.d.ts +24 -0
- package/dist/mocked_classnames/components/BreadcrumbsBar/BreadcrumbItem/BreadcrumbItem.d.ts +24 -7
- package/dist/mocked_classnames/components/BreadcrumbsBar/BreadcrumbsBar.d.ts +6 -1
- package/dist/mocked_classnames/components/ButtonGroup/ButtonGroup.d.ts +46 -1
- package/dist/mocked_classnames/components/ButtonGroup/ButtonWrapper.d.ts +16 -1
- package/dist/mocked_classnames/components/Checkbox/Checkbox.d.ts +42 -18
- package/dist/mocked_classnames/components/Chips/Chips.d.ts +54 -20
- package/dist/mocked_classnames/components/Clickable/Clickable.d.ts +41 -5
- package/dist/mocked_classnames/components/Clickable/ClickableWrapper.d.ts +9 -0
- package/dist/mocked_classnames/components/ColorPicker/ColorPicker.d.ts +43 -1
- package/dist/mocked_classnames/components/ColorPicker/components/ColorPickerContent/ColorPickerClearButton.d.ts +9 -0
- package/dist/mocked_classnames/components/ColorPicker/components/ColorPickerContent/ColorPickerColorsGrid.d.ts +39 -0
- package/dist/mocked_classnames/components/ColorPicker/components/ColorPickerContent/ColorPickerContent.d.ts +48 -0
- package/dist/mocked_classnames/components/ColorPicker/components/ColorPickerItemComponent/ColorPickerItemComponent.d.ts +33 -1
- package/dist/mocked_classnames/components/Combobox/Combobox.d.ts +78 -25
- package/dist/mocked_classnames/components/Combobox/components/ComboboxCategory/ComboboxCategory.d.ts +6 -0
- package/dist/mocked_classnames/components/Combobox/components/ComboboxConstants.d.ts +156 -0
- package/dist/mocked_classnames/components/Combobox/components/ComboboxItems/ComboboxItems.d.ts +45 -0
- package/dist/mocked_classnames/components/Combobox/components/ComboboxOption/ComboboxOption.d.ts +30 -0
- package/dist/mocked_classnames/components/Counter/Counter.d.ts +33 -14
- package/dist/mocked_classnames/components/DatePicker/DateNavigationItem/DateNavigationItem.d.ts +6 -0
- package/dist/mocked_classnames/components/DatePicker/DatePicker.d.ts +39 -13
- package/dist/mocked_classnames/components/DatePicker/DatePickerHeader/DatePickerHeader.d.ts +18 -0
- package/dist/mocked_classnames/components/DatePicker/YearPicker/YearPicker.d.ts +12 -0
- package/dist/mocked_classnames/components/DatePicker/YearPicker/YearsList.d.ts +12 -0
- package/dist/mocked_classnames/components/DatePicker/types.d.ts +6 -0
- package/dist/mocked_classnames/components/Dialog/Dialog.d.ts +59 -36
- package/dist/mocked_classnames/components/Dialog/DialogContent/DialogContent.d.ts +52 -3
- package/dist/mocked_classnames/components/DialogContentContainer/DialogContentContainer.d.ts +18 -0
- package/dist/mocked_classnames/components/Divider/Divider.d.ts +2 -2
- package/dist/mocked_classnames/components/Dropdown/Dropdown.types.d.ts +97 -63
- package/dist/mocked_classnames/components/EditableHeading/EditableHeading.d.ts +4 -3
- package/dist/mocked_classnames/components/EditableText/EditableText.d.ts +6 -4
- package/dist/mocked_classnames/components/EditableTypography/EditableTypography.d.ts +48 -16
- package/dist/mocked_classnames/components/ExpandCollapse/ExpandCollapse.d.ts +20 -8
- package/dist/mocked_classnames/components/FieldLabel/FieldLabel.d.ts +18 -0
- package/dist/mocked_classnames/components/Flex/Flex.d.ts +36 -2
- package/dist/mocked_classnames/components/FormattedNumber/FormattedNumber.d.ts +8 -8
- package/dist/mocked_classnames/components/GridKeyboardNavigationContext/GridKeyboardNavigationContextConstants.d.ts +3 -0
- package/dist/mocked_classnames/components/Heading/Heading.d.ts +15 -0
- package/dist/mocked_classnames/components/HiddenText/HiddenText.d.ts +3 -0
- package/dist/mocked_classnames/components/Icon/CustomSvgIcon/CustomSvgIcon.d.ts +30 -0
- package/dist/mocked_classnames/components/Icon/FontIcon/FontIcon.d.ts +18 -0
- package/dist/mocked_classnames/components/Icon/Icon.d.ts +32 -8
- package/dist/mocked_classnames/components/IconButton/IconButton.d.ts +37 -27
- package/dist/mocked_classnames/components/Label/Label.d.ts +22 -1
- package/dist/mocked_classnames/components/Label/LabelCelebrationAnimation.d.ts +6 -0
- package/dist/mocked_classnames/components/LayerProvider/LayerContext.d.ts +3 -0
- package/dist/mocked_classnames/components/LayerProvider/LayerProvider.d.ts +7 -1
- package/dist/mocked_classnames/components/LegacyModal/LegacyModalHeader/LegacyModalHeader.d.ts +0 -8
- package/dist/mocked_classnames/components/Link/Link.d.ts +40 -14
- package/dist/mocked_classnames/components/List/List.d.ts +14 -5
- package/dist/mocked_classnames/components/List/VirtualizedListItems/VirtualizedListItems.d.ts +3 -0
- package/dist/mocked_classnames/components/ListItem/ListItem.d.ts +12 -25
- package/dist/mocked_classnames/components/ListItemAvatar/ListItemAvatar.d.ts +7 -1
- package/dist/mocked_classnames/components/ListItemIcon/ListItemIcon.d.ts +5 -2
- package/dist/mocked_classnames/components/ListTitle/ListTitle.d.ts +6 -0
- package/dist/mocked_classnames/components/Loader/Loader.d.ts +12 -2
- package/dist/mocked_classnames/components/Menu/Menu/Menu.d.ts +42 -0
- package/dist/mocked_classnames/components/Menu/MenuGridItem/MenuGridItem.d.ts +33 -5
- package/dist/mocked_classnames/components/Menu/MenuItem/AvatarMenuItem.d.ts +6 -0
- package/dist/mocked_classnames/components/Menu/MenuItem/MenuItem.d.ts +97 -7
- package/dist/mocked_classnames/components/Menu/MenuItem/components/BaseMenuItem/BaseMenuItem.types.d.ts +7 -0
- package/dist/mocked_classnames/components/Menu/MenuItem/components/MenuItemIcon/MenuItemIcon.types.d.ts +7 -6
- package/dist/mocked_classnames/components/Menu/MenuItem/components/MenuItemSubMenu/MenuItemSubMenu.types.d.ts +7 -3
- package/dist/mocked_classnames/components/Menu/MenuItem/components/MenuItemSubMenuIcon/MenuItemSubMenuIcon.types.d.ts +5 -1
- package/dist/mocked_classnames/components/Menu/MenuItemButton/MenuItemButton.d.ts +51 -0
- package/dist/mocked_classnames/components/Menu/MenuTitle/MenuTitle.d.ts +6 -0
- package/dist/mocked_classnames/components/MenuButton/MenuButton.d.ts +67 -19
- package/dist/mocked_classnames/components/Modal/ModalContent/ModalContent.types.d.ts +1 -1
- package/dist/mocked_classnames/components/Modal/ModalMedia/ModalMedia.types.d.ts +1 -1
- package/dist/mocked_classnames/components/Modal/ModalTopActions/ModalTopActions.types.d.ts +5 -5
- package/dist/mocked_classnames/components/Modal/context/ModalContext.types.d.ts +5 -5
- package/dist/mocked_classnames/components/Modal/footers/ModalFooter/ModalFooter.types.d.ts +1 -1
- package/dist/mocked_classnames/components/Modal/footers/ModalFooterBase/ModalFooterBase.types.d.ts +3 -3
- package/dist/mocked_classnames/components/Modal/footers/ModalFooterWizard/ModalFooterWizard.types.d.ts +4 -4
- package/dist/mocked_classnames/components/Modal/layouts/ModalBasicLayout/ModalBasicLayout.types.d.ts +1 -1
- package/dist/mocked_classnames/components/Modal/layouts/ModalFooterShadow.types.d.ts +1 -1
- package/dist/mocked_classnames/components/Modal/layouts/ModalLayoutScrollableContent.types.d.ts +2 -2
- package/dist/mocked_classnames/components/Modal/layouts/ModalMediaLayout/ModalMediaLayout.types.d.ts +1 -1
- package/dist/mocked_classnames/components/Modal/layouts/ModalSideBySideLayout/ModalSideBySideLayout.types.d.ts +1 -1
- package/dist/mocked_classnames/components/MultiStepIndicator/MultiStepIndicator.d.ts +30 -0
- package/dist/mocked_classnames/components/MultiStepIndicator/components/StepIndicator/StepIndicator.d.ts +57 -0
- package/dist/mocked_classnames/components/ProgressBars/LinearProgressBar/Bar/Bar.d.ts +17 -6
- package/dist/mocked_classnames/components/ProgressBars/LinearProgressBar/LinearProgressBar.d.ts +19 -22
- package/dist/mocked_classnames/components/ProgressBars/PercentageLabel/PercentageLabel.d.ts +2 -2
- package/dist/mocked_classnames/components/RadioButton/RadioButton.d.ts +45 -16
- package/dist/mocked_classnames/components/Search/Search.types.d.ts +24 -24
- package/dist/mocked_classnames/components/Skeleton/Skeleton.d.ts +16 -1
- package/dist/mocked_classnames/components/SlideTransition/SlideTransition.types.d.ts +12 -0
- package/dist/mocked_classnames/components/Slider/SelectionIndicator.d.ts +6 -0
- package/dist/mocked_classnames/components/Slider/SliderBase/SliderFilledTrack.d.ts +6 -8
- package/dist/mocked_classnames/components/Slider/SliderBase/SliderRail.d.ts +6 -4
- package/dist/mocked_classnames/components/Slider/SliderBase/SliderThumb.d.ts +9 -7
- package/dist/mocked_classnames/components/Slider/SliderBase/SliderTrack.d.ts +1 -2
- package/dist/mocked_classnames/components/Slider/SliderContext.d.ts +13 -8
- package/dist/mocked_classnames/components/Slider/SliderInfix.d.ts +1 -2
- package/dist/mocked_classnames/components/SplitButton/SplitButton.d.ts +25 -2
- package/dist/mocked_classnames/components/Steps/Steps.d.ts +32 -2
- package/dist/mocked_classnames/components/Steps/StepsCommand.d.ts +21 -0
- package/dist/mocked_classnames/components/Steps/StepsDot.d.ts +15 -0
- package/dist/mocked_classnames/components/Steps/StepsGalleryHeader.d.ts +15 -0
- package/dist/mocked_classnames/components/Steps/StepsHeader.d.ts +33 -0
- package/dist/mocked_classnames/components/Steps/StepsNumbersHeader.d.ts +9 -0
- package/dist/mocked_classnames/components/Switch/Switch.d.ts +39 -0
- package/dist/mocked_classnames/components/Table/Table/Table.d.ts +42 -0
- package/dist/mocked_classnames/components/Table/TableBody/TableBody.d.ts +3 -0
- package/dist/mocked_classnames/components/Table/TableCell/TableCell.d.ts +6 -0
- package/dist/mocked_classnames/components/Table/TableCellSkeleton/TableCellSkeleton.d.ts +6 -0
- package/dist/mocked_classnames/components/Table/TableContainer/TableContainer.types.d.ts +6 -0
- package/dist/mocked_classnames/components/Table/TableHeader/TableHeader.d.ts +3 -0
- package/dist/mocked_classnames/components/Table/TableHeaderCell/TableHeaderCell.d.ts +21 -0
- package/dist/mocked_classnames/components/Table/TableRow/TableRow.d.ts +7 -1
- package/dist/mocked_classnames/components/Table/TableRowMenu/TableRowMenu.types.d.ts +6 -0
- package/dist/mocked_classnames/components/Table/TableVirtualizedBody/TableVirtualizedBody.d.ts +15 -0
- package/dist/mocked_classnames/components/Tabs/Tab/Tab.d.ts +27 -3
- package/dist/mocked_classnames/components/Tabs/TabList/TabList.d.ts +15 -0
- package/dist/mocked_classnames/components/Tabs/TabPanel/TabPanel.d.ts +6 -0
- package/dist/mocked_classnames/components/Tabs/TabPanels/TabPanels.d.ts +9 -0
- package/dist/mocked_classnames/components/Tabs/TabsContext/TabsContext.d.ts +6 -0
- package/dist/mocked_classnames/components/Text/Text.d.ts +9 -0
- package/dist/mocked_classnames/components/TextArea/TextArea.types.d.ts +13 -16
- package/dist/mocked_classnames/components/TextField/TextField.d.ts +127 -9
- package/dist/mocked_classnames/components/TextWithHighlight/TextWithHighlight.d.ts +33 -6
- package/dist/mocked_classnames/components/ThemeProvider/ThemeProvider.d.ts +8 -5
- package/dist/mocked_classnames/components/Tipseen/Tipseen.d.ts +64 -6
- package/dist/mocked_classnames/components/Tipseen/TipseenBasicContent.d.ts +9 -0
- package/dist/mocked_classnames/components/Tipseen/TipseenContent.d.ts +25 -1
- package/dist/mocked_classnames/components/Tipseen/TipseenImage.d.ts +12 -0
- package/dist/mocked_classnames/components/Tipseen/TipseenMedia/TipseenMedia.d.ts +3 -0
- package/dist/mocked_classnames/components/Tipseen/TipseenTitle.d.ts +3 -0
- package/dist/mocked_classnames/components/Tipseen/TipseenWizard.d.ts +7 -1
- package/dist/mocked_classnames/components/Toast/Toast.d.ts +37 -8
- package/dist/mocked_classnames/components/Toggle/MockToggle.d.ts +21 -0
- package/dist/mocked_classnames/components/Toggle/Toggle.d.ts +37 -1
- package/dist/mocked_classnames/components/Toggle/ToggleText.d.ts +6 -0
- package/dist/mocked_classnames/components/Tooltip/Tooltip.d.ts +64 -27
- package/dist/mocked_classnames/components/TransitionView/TransitionView.types.d.ts +9 -0
- package/dist/mocked_classnames/components/Typography/Typography.d.ts +12 -6
- package/dist/mocked_classnames/components/VirtualizedGrid/VirtualizedGrid.d.ts +19 -19
- package/dist/mocked_classnames/components/VirtualizedList/VirtualizedList.d.ts +33 -27
- package/dist/mocked_classnames/hooks/useKeyEvent/index.d.ts +30 -0
- package/dist/mocked_classnames/hooks/useSwitch/index.d.ts +12 -0
- package/dist/mocked_classnames/hooks/useWizard/useWizard.types.d.ts +33 -0
- package/dist/mocked_classnames/src/components/Accordion/Accordion/Accordion.js.map +1 -1
- package/dist/mocked_classnames/src/components/Accordion/AccordionItem/AccordionItem.js.map +1 -1
- package/dist/mocked_classnames/src/components/AlertBanner/AlertBanner.js.map +1 -1
- package/dist/mocked_classnames/src/components/AlertBanner/AlertBannerButton/AlertBannerButton.js.map +1 -1
- package/dist/mocked_classnames/src/components/AlertBanner/AlertBannerLink/AlertBannerLink.js.map +1 -1
- package/dist/mocked_classnames/src/components/AlertBanner/AlertBannerText/AlertBannerText.js.map +1 -1
- package/dist/mocked_classnames/src/components/AttentionBox/AttentionBox.js.map +1 -1
- package/dist/mocked_classnames/src/components/Avatar/Avatar.js.map +1 -1
- package/dist/mocked_classnames/src/components/Avatar/AvatarBadge.js.map +1 -1
- package/dist/mocked_classnames/src/components/Avatar/AvatarContent.js.map +1 -1
- package/dist/mocked_classnames/src/components/AvatarGroup/AvatarGroup.js.map +1 -1
- package/dist/mocked_classnames/src/components/AvatarGroup/AvatarGroupCounter.js.map +1 -1
- package/dist/mocked_classnames/src/components/AvatarGroup/AvatarGroupCounterTooltipContainer.js.map +1 -1
- package/dist/mocked_classnames/src/components/AvatarGroup/AvatarGroupCounterTooltipContent.js.map +1 -1
- package/dist/mocked_classnames/src/components/AvatarGroup/AvatarGroupCounterTooltipContentVirtualizedList.js.map +1 -1
- package/dist/mocked_classnames/src/components/Badge/Badge.js.map +1 -1
- package/dist/mocked_classnames/src/components/Badge/Indicator/Indicator.js.map +1 -1
- package/dist/mocked_classnames/src/components/Box/Box.js.map +1 -1
- package/dist/mocked_classnames/src/components/BreadcrumbsBar/BreadcrumbItem/BreadcrumbContent/BreadcrumbContent.js.map +1 -1
- package/dist/mocked_classnames/src/components/BreadcrumbsBar/BreadcrumbItem/BreadcrumbItem.js.map +1 -1
- package/dist/mocked_classnames/src/components/BreadcrumbsBar/BreadcrumbsBar.js.map +1 -1
- package/dist/mocked_classnames/src/components/Button/Button.js +1 -1
- package/dist/mocked_classnames/src/components/Button/Button.js.map +1 -1
- package/dist/mocked_classnames/src/components/ButtonGroup/ButtonGroup.js.map +1 -1
- package/dist/mocked_classnames/src/components/ButtonGroup/ButtonWrapper.js.map +1 -1
- package/dist/mocked_classnames/src/components/Checkbox/Checkbox.js.map +1 -1
- package/dist/mocked_classnames/src/components/Chips/Chips.js.map +1 -1
- package/dist/mocked_classnames/src/components/Clickable/Clickable.js.map +1 -1
- package/dist/mocked_classnames/src/components/Clickable/ClickableWrapper.js.map +1 -1
- package/dist/mocked_classnames/src/components/ColorPicker/ColorPicker.js.map +1 -1
- package/dist/mocked_classnames/src/components/ColorPicker/components/ColorPickerContent/ColorPickerClearButton.js.map +1 -1
- package/dist/mocked_classnames/src/components/ColorPicker/components/ColorPickerContent/ColorPickerColorsGrid.js.map +1 -1
- package/dist/mocked_classnames/src/components/ColorPicker/components/ColorPickerContent/ColorPickerContent.js.map +1 -1
- package/dist/mocked_classnames/src/components/ColorPicker/components/ColorPickerItemComponent/ColorPickerItemComponent.js.map +1 -1
- package/dist/mocked_classnames/src/components/Combobox/Combobox.js.map +1 -1
- package/dist/mocked_classnames/src/components/Combobox/components/ComboboxCategory/ComboboxCategory.js.map +1 -1
- package/dist/mocked_classnames/src/components/Combobox/components/ComboboxConstants.js.map +1 -1
- package/dist/mocked_classnames/src/components/Combobox/components/ComboboxItems/ComboboxItems.js.map +1 -1
- package/dist/mocked_classnames/src/components/Combobox/components/ComboboxOption/ComboboxOption.js.map +1 -1
- package/dist/mocked_classnames/src/components/Counter/Counter.js.map +1 -1
- package/dist/mocked_classnames/src/components/DatePicker/DateNavigationItem/DateNavigationItem.js.map +1 -1
- package/dist/mocked_classnames/src/components/DatePicker/DatePicker.js.map +1 -1
- package/dist/mocked_classnames/src/components/DatePicker/DatePickerHeader/DatePickerHeader.js.map +1 -1
- package/dist/mocked_classnames/src/components/DatePicker/YearPicker/YearPicker.js.map +1 -1
- package/dist/mocked_classnames/src/components/DatePicker/YearPicker/YearsList.js.map +1 -1
- package/dist/mocked_classnames/src/components/DatePicker/types.js.map +1 -1
- package/dist/mocked_classnames/src/components/Dialog/Dialog.js.map +1 -1
- package/dist/mocked_classnames/src/components/Dialog/DialogContent/DialogContent.js.map +1 -1
- package/dist/mocked_classnames/src/components/DialogContentContainer/DialogContentContainer.js.map +1 -1
- package/dist/mocked_classnames/src/components/Divider/Divider.js.map +1 -1
- package/dist/mocked_classnames/src/components/Dropdown/Dropdown.js +1 -1
- package/dist/mocked_classnames/src/components/Dropdown/Dropdown.js.map +1 -1
- package/dist/mocked_classnames/src/components/EditableHeading/EditableHeading.js.map +1 -1
- package/dist/mocked_classnames/src/components/EditableText/EditableText.js.map +1 -1
- package/dist/mocked_classnames/src/components/EditableTypography/EditableTypography.js.map +1 -1
- package/dist/mocked_classnames/src/components/ExpandCollapse/ExpandCollapse.js.map +1 -1
- package/dist/mocked_classnames/src/components/FieldLabel/FieldLabel.js.map +1 -1
- package/dist/mocked_classnames/src/components/Flex/Flex.js.map +1 -1
- package/dist/mocked_classnames/src/components/FormattedNumber/FormattedNumber.js.map +1 -1
- package/dist/mocked_classnames/src/components/Heading/Heading.js.map +1 -1
- package/dist/mocked_classnames/src/components/HiddenText/HiddenText.js.map +1 -1
- package/dist/mocked_classnames/src/components/Icon/CustomSvgIcon/CustomSvgIcon.js.map +1 -1
- package/dist/mocked_classnames/src/components/Icon/FontIcon/FontIcon.js.map +1 -1
- package/dist/mocked_classnames/src/components/Icon/Icon.js.map +1 -1
- package/dist/mocked_classnames/src/components/IconButton/IconButton.js.map +1 -1
- package/dist/mocked_classnames/src/components/Label/Label.js.map +1 -1
- package/dist/mocked_classnames/src/components/Label/LabelCelebrationAnimation.js.map +1 -1
- package/dist/mocked_classnames/src/components/LayerProvider/LayerContext.js.map +1 -1
- package/dist/mocked_classnames/src/components/LayerProvider/LayerProvider.js.map +1 -1
- package/dist/mocked_classnames/src/components/LegacyModal/LegacyModalHeader/LegacyModalHeader.js.map +1 -1
- package/dist/mocked_classnames/src/components/Link/Link.js.map +1 -1
- package/dist/mocked_classnames/src/components/List/List.js.map +1 -1
- package/dist/mocked_classnames/src/components/List/VirtualizedListItems/VirtualizedListItems.js.map +1 -1
- package/dist/mocked_classnames/src/components/ListItem/ListItem.js.map +1 -1
- package/dist/mocked_classnames/src/components/ListItemAvatar/ListItemAvatar.js.map +1 -1
- package/dist/mocked_classnames/src/components/ListItemIcon/ListItemIcon.js.map +1 -1
- package/dist/mocked_classnames/src/components/ListTitle/ListTitle.js.map +1 -1
- package/dist/mocked_classnames/src/components/Loader/Loader.js.map +1 -1
- package/dist/mocked_classnames/src/components/Menu/Menu/Menu.js.map +1 -1
- package/dist/mocked_classnames/src/components/Menu/MenuGridItem/MenuGridItem.js.map +1 -1
- package/dist/mocked_classnames/src/components/Menu/MenuItem/AvatarMenuItem.js.map +1 -1
- package/dist/mocked_classnames/src/components/Menu/MenuItem/MenuItem.js.map +1 -1
- package/dist/mocked_classnames/src/components/Menu/MenuItemButton/MenuItemButton.js.map +1 -1
- package/dist/mocked_classnames/src/components/Menu/MenuTitle/MenuTitle.js.map +1 -1
- package/dist/mocked_classnames/src/components/MenuButton/MenuButton.js.map +1 -1
- package/dist/mocked_classnames/src/components/Modal/hooks/usePortalTarget/usePortalTarget.js +1 -1
- package/dist/mocked_classnames/src/components/Modal/hooks/usePortalTarget/usePortalTarget.js.map +1 -1
- package/dist/mocked_classnames/src/components/MultiStepIndicator/MultiStepIndicator.js.map +1 -1
- package/dist/mocked_classnames/src/components/MultiStepIndicator/components/StepIndicator/StepIndicator.js.map +1 -1
- package/dist/mocked_classnames/src/components/ProgressBars/LinearProgressBar/Bar/Bar.js.map +1 -1
- package/dist/mocked_classnames/src/components/ProgressBars/LinearProgressBar/LinearProgressBar.js.map +1 -1
- package/dist/mocked_classnames/src/components/ProgressBars/PercentageLabel/PercentageLabel.js.map +1 -1
- package/dist/mocked_classnames/src/components/RadioButton/RadioButton.js.map +1 -1
- package/dist/mocked_classnames/src/components/Skeleton/Skeleton.js.map +1 -1
- package/dist/mocked_classnames/src/components/Slider/SelectionIndicator.js.map +1 -1
- package/dist/mocked_classnames/src/components/Slider/SliderBase/SliderFilledTrack.js.map +1 -1
- package/dist/mocked_classnames/src/components/Slider/SliderBase/SliderRail.js.map +1 -1
- package/dist/mocked_classnames/src/components/Slider/SliderBase/SliderThumb.js.map +1 -1
- package/dist/mocked_classnames/src/components/Slider/SliderBase/SliderTrack.js.map +1 -1
- package/dist/mocked_classnames/src/components/Slider/SliderContext.js.map +1 -1
- package/dist/mocked_classnames/src/components/Slider/SliderInfix.js.map +1 -1
- package/dist/mocked_classnames/src/components/SplitButton/SplitButton.js.map +1 -1
- package/dist/mocked_classnames/src/components/Steps/Steps.js.map +1 -1
- package/dist/mocked_classnames/src/components/Steps/StepsCommand.js.map +1 -1
- package/dist/mocked_classnames/src/components/Steps/StepsDot.js.map +1 -1
- package/dist/mocked_classnames/src/components/Steps/StepsGalleryHeader.js.map +1 -1
- package/dist/mocked_classnames/src/components/Steps/StepsHeader.js.map +1 -1
- package/dist/mocked_classnames/src/components/Steps/StepsNumbersHeader.js.map +1 -1
- package/dist/mocked_classnames/src/components/Switch/Switch.js.map +1 -1
- package/dist/mocked_classnames/src/components/Table/Table/Table.js.map +1 -1
- package/dist/mocked_classnames/src/components/Table/TableBody/TableBody.js.map +1 -1
- package/dist/mocked_classnames/src/components/Table/TableCell/TableCell.js.map +1 -1
- package/dist/mocked_classnames/src/components/Table/TableCellSkeleton/TableCellSkeleton.js.map +1 -1
- package/dist/mocked_classnames/src/components/Table/TableHeader/TableHeader.js.map +1 -1
- package/dist/mocked_classnames/src/components/Table/TableHeaderCell/TableHeaderCell.js.map +1 -1
- package/dist/mocked_classnames/src/components/Table/TableRow/TableRow.js.map +1 -1
- package/dist/mocked_classnames/src/components/Table/TableVirtualizedBody/TableVirtualizedBody.js.map +1 -1
- package/dist/mocked_classnames/src/components/Tabs/Tab/Tab.js.map +1 -1
- package/dist/mocked_classnames/src/components/Tabs/TabList/TabList.js.map +1 -1
- package/dist/mocked_classnames/src/components/Tabs/TabPanel/TabPanel.js.map +1 -1
- package/dist/mocked_classnames/src/components/Tabs/TabPanels/TabPanels.js.map +1 -1
- package/dist/mocked_classnames/src/components/Tabs/TabsContext/TabsContext.js.map +1 -1
- package/dist/mocked_classnames/src/components/Text/Text.js.map +1 -1
- package/dist/mocked_classnames/src/components/TextField/TextField.js.map +1 -1
- package/dist/mocked_classnames/src/components/TextWithHighlight/TextWithHighlight.js.map +1 -1
- package/dist/mocked_classnames/src/components/ThemeProvider/ThemeProvider.js.map +1 -1
- package/dist/mocked_classnames/src/components/Tipseen/Tipseen.js.map +1 -1
- package/dist/mocked_classnames/src/components/Tipseen/TipseenBasicContent.js.map +1 -1
- package/dist/mocked_classnames/src/components/Tipseen/TipseenContent.js.map +1 -1
- package/dist/mocked_classnames/src/components/Tipseen/TipseenImage.js.map +1 -1
- package/dist/mocked_classnames/src/components/Tipseen/TipseenMedia/TipseenMedia.js.map +1 -1
- package/dist/mocked_classnames/src/components/Tipseen/TipseenTitle.js.map +1 -1
- package/dist/mocked_classnames/src/components/Tipseen/TipseenWizard.js.map +1 -1
- package/dist/mocked_classnames/src/components/Toast/Toast.js.map +1 -1
- package/dist/mocked_classnames/src/components/Toggle/MockToggle.js.map +1 -1
- package/dist/mocked_classnames/src/components/Toggle/Toggle.js.map +1 -1
- package/dist/mocked_classnames/src/components/Toggle/ToggleText.js.map +1 -1
- package/dist/mocked_classnames/src/components/Tooltip/Tooltip.js.map +1 -1
- package/dist/mocked_classnames/src/components/Typography/Typography.js.map +1 -1
- package/dist/mocked_classnames/src/components/VirtualizedGrid/VirtualizedGrid.js.map +1 -1
- package/dist/mocked_classnames/src/components/VirtualizedList/VirtualizedList.js.map +1 -1
- package/dist/mocked_classnames/src/hooks/useKeyEvent/index.js.map +1 -1
- package/dist/mocked_classnames/src/hooks/useSwitch/index.js.map +1 -1
- package/dist/mocked_classnames/types/VibeComponentProps.d.ts +9 -0
- package/dist/src/components/Accordion/Accordion/Accordion.js.map +1 -1
- package/dist/src/components/Accordion/AccordionItem/AccordionItem.js.map +1 -1
- package/dist/src/components/AlertBanner/AlertBanner.js.map +1 -1
- package/dist/src/components/AlertBanner/AlertBannerButton/AlertBannerButton.js.map +1 -1
- package/dist/src/components/AlertBanner/AlertBannerLink/AlertBannerLink.js.map +1 -1
- package/dist/src/components/AlertBanner/AlertBannerText/AlertBannerText.js.map +1 -1
- package/dist/src/components/AttentionBox/AttentionBox.js.map +1 -1
- package/dist/src/components/Avatar/Avatar.js.map +1 -1
- package/dist/src/components/Avatar/AvatarBadge.js.map +1 -1
- package/dist/src/components/Avatar/AvatarContent.js.map +1 -1
- package/dist/src/components/AvatarGroup/AvatarGroup.js.map +1 -1
- package/dist/src/components/AvatarGroup/AvatarGroupCounter.js.map +1 -1
- package/dist/src/components/AvatarGroup/AvatarGroupCounterTooltipContainer.js.map +1 -1
- package/dist/src/components/AvatarGroup/AvatarGroupCounterTooltipContent.js.map +1 -1
- package/dist/src/components/AvatarGroup/AvatarGroupCounterTooltipContentVirtualizedList.js.map +1 -1
- package/dist/src/components/Badge/Badge.js.map +1 -1
- package/dist/src/components/Badge/Indicator/Indicator.js.map +1 -1
- package/dist/src/components/Box/Box.js.map +1 -1
- package/dist/src/components/BreadcrumbsBar/BreadcrumbItem/BreadcrumbContent/BreadcrumbContent.js.map +1 -1
- package/dist/src/components/BreadcrumbsBar/BreadcrumbItem/BreadcrumbItem.js.map +1 -1
- package/dist/src/components/BreadcrumbsBar/BreadcrumbsBar.js.map +1 -1
- package/dist/src/components/Button/Button.js +1 -1
- package/dist/src/components/Button/Button.js.map +1 -1
- package/dist/src/components/ButtonGroup/ButtonGroup.js.map +1 -1
- package/dist/src/components/ButtonGroup/ButtonWrapper.js.map +1 -1
- package/dist/src/components/Checkbox/Checkbox.js.map +1 -1
- package/dist/src/components/Chips/Chips.js.map +1 -1
- package/dist/src/components/Clickable/Clickable.js.map +1 -1
- package/dist/src/components/Clickable/ClickableWrapper.js.map +1 -1
- package/dist/src/components/ColorPicker/ColorPicker.js.map +1 -1
- package/dist/src/components/ColorPicker/components/ColorPickerContent/ColorPickerClearButton.js.map +1 -1
- package/dist/src/components/ColorPicker/components/ColorPickerContent/ColorPickerColorsGrid.js.map +1 -1
- package/dist/src/components/ColorPicker/components/ColorPickerContent/ColorPickerContent.js.map +1 -1
- package/dist/src/components/ColorPicker/components/ColorPickerItemComponent/ColorPickerItemComponent.js.map +1 -1
- package/dist/src/components/Combobox/Combobox.js.map +1 -1
- package/dist/src/components/Combobox/components/ComboboxCategory/ComboboxCategory.js.map +1 -1
- package/dist/src/components/Combobox/components/ComboboxConstants.js.map +1 -1
- package/dist/src/components/Combobox/components/ComboboxItems/ComboboxItems.js.map +1 -1
- package/dist/src/components/Combobox/components/ComboboxOption/ComboboxOption.js.map +1 -1
- package/dist/src/components/Counter/Counter.js.map +1 -1
- package/dist/src/components/DatePicker/DateNavigationItem/DateNavigationItem.js.map +1 -1
- package/dist/src/components/DatePicker/DatePicker.js.map +1 -1
- package/dist/src/components/DatePicker/DatePickerHeader/DatePickerHeader.js.map +1 -1
- package/dist/src/components/DatePicker/YearPicker/YearPicker.js.map +1 -1
- package/dist/src/components/DatePicker/YearPicker/YearsList.js.map +1 -1
- package/dist/src/components/DatePicker/types.js.map +1 -1
- package/dist/src/components/Dialog/Dialog.js.map +1 -1
- package/dist/src/components/Dialog/DialogContent/DialogContent.js.map +1 -1
- package/dist/src/components/DialogContentContainer/DialogContentContainer.js.map +1 -1
- package/dist/src/components/Divider/Divider.js.map +1 -1
- package/dist/src/components/Dropdown/Dropdown.js +1 -1
- package/dist/src/components/Dropdown/Dropdown.js.map +1 -1
- package/dist/src/components/EditableHeading/EditableHeading.js.map +1 -1
- package/dist/src/components/EditableText/EditableText.js.map +1 -1
- package/dist/src/components/EditableTypography/EditableTypography.js.map +1 -1
- package/dist/src/components/ExpandCollapse/ExpandCollapse.js.map +1 -1
- package/dist/src/components/FieldLabel/FieldLabel.js.map +1 -1
- package/dist/src/components/Flex/Flex.js.map +1 -1
- package/dist/src/components/FormattedNumber/FormattedNumber.js.map +1 -1
- package/dist/src/components/Heading/Heading.js.map +1 -1
- package/dist/src/components/HiddenText/HiddenText.js.map +1 -1
- package/dist/src/components/Icon/CustomSvgIcon/CustomSvgIcon.js.map +1 -1
- package/dist/src/components/Icon/FontIcon/FontIcon.js.map +1 -1
- package/dist/src/components/Icon/Icon.js.map +1 -1
- package/dist/src/components/IconButton/IconButton.js.map +1 -1
- package/dist/src/components/Label/Label.js.map +1 -1
- package/dist/src/components/Label/LabelCelebrationAnimation.js.map +1 -1
- package/dist/src/components/LayerProvider/LayerContext.js.map +1 -1
- package/dist/src/components/LayerProvider/LayerProvider.js.map +1 -1
- package/dist/src/components/LegacyModal/LegacyModalHeader/LegacyModalHeader.js.map +1 -1
- package/dist/src/components/Link/Link.js.map +1 -1
- package/dist/src/components/List/List.js.map +1 -1
- package/dist/src/components/List/VirtualizedListItems/VirtualizedListItems.js.map +1 -1
- package/dist/src/components/ListItem/ListItem.js.map +1 -1
- package/dist/src/components/ListItemAvatar/ListItemAvatar.js.map +1 -1
- package/dist/src/components/ListItemIcon/ListItemIcon.js.map +1 -1
- package/dist/src/components/ListTitle/ListTitle.js.map +1 -1
- package/dist/src/components/Loader/Loader.js.map +1 -1
- package/dist/src/components/Menu/Menu/Menu.js.map +1 -1
- package/dist/src/components/Menu/MenuGridItem/MenuGridItem.js.map +1 -1
- package/dist/src/components/Menu/MenuItem/AvatarMenuItem.js.map +1 -1
- package/dist/src/components/Menu/MenuItem/MenuItem.js.map +1 -1
- package/dist/src/components/Menu/MenuItemButton/MenuItemButton.js.map +1 -1
- package/dist/src/components/Menu/MenuTitle/MenuTitle.js.map +1 -1
- package/dist/src/components/MenuButton/MenuButton.js.map +1 -1
- package/dist/src/components/Modal/hooks/usePortalTarget/usePortalTarget.js +1 -1
- package/dist/src/components/Modal/hooks/usePortalTarget/usePortalTarget.js.map +1 -1
- package/dist/src/components/MultiStepIndicator/MultiStepIndicator.js.map +1 -1
- package/dist/src/components/MultiStepIndicator/components/StepIndicator/StepIndicator.js.map +1 -1
- package/dist/src/components/ProgressBars/LinearProgressBar/Bar/Bar.js.map +1 -1
- package/dist/src/components/ProgressBars/LinearProgressBar/LinearProgressBar.js.map +1 -1
- package/dist/src/components/ProgressBars/PercentageLabel/PercentageLabel.js.map +1 -1
- package/dist/src/components/RadioButton/RadioButton.js.map +1 -1
- package/dist/src/components/Skeleton/Skeleton.js.map +1 -1
- package/dist/src/components/Slider/SelectionIndicator.js.map +1 -1
- package/dist/src/components/Slider/SliderBase/SliderFilledTrack.js.map +1 -1
- package/dist/src/components/Slider/SliderBase/SliderRail.js.map +1 -1
- package/dist/src/components/Slider/SliderBase/SliderThumb.js.map +1 -1
- package/dist/src/components/Slider/SliderBase/SliderTrack.js.map +1 -1
- package/dist/src/components/Slider/SliderContext.js.map +1 -1
- package/dist/src/components/Slider/SliderInfix.js.map +1 -1
- package/dist/src/components/SplitButton/SplitButton.js.map +1 -1
- package/dist/src/components/Steps/Steps.js.map +1 -1
- package/dist/src/components/Steps/StepsCommand.js.map +1 -1
- package/dist/src/components/Steps/StepsDot.js.map +1 -1
- package/dist/src/components/Steps/StepsGalleryHeader.js.map +1 -1
- package/dist/src/components/Steps/StepsHeader.js.map +1 -1
- package/dist/src/components/Steps/StepsNumbersHeader.js.map +1 -1
- package/dist/src/components/Switch/Switch.js.map +1 -1
- package/dist/src/components/Table/Table/Table.js.map +1 -1
- package/dist/src/components/Table/TableBody/TableBody.js.map +1 -1
- package/dist/src/components/Table/TableCell/TableCell.js.map +1 -1
- package/dist/src/components/Table/TableCellSkeleton/TableCellSkeleton.js.map +1 -1
- package/dist/src/components/Table/TableHeader/TableHeader.js.map +1 -1
- package/dist/src/components/Table/TableHeaderCell/TableHeaderCell.js.map +1 -1
- package/dist/src/components/Table/TableRow/TableRow.js.map +1 -1
- package/dist/src/components/Table/TableVirtualizedBody/TableVirtualizedBody.js.map +1 -1
- package/dist/src/components/Tabs/Tab/Tab.js.map +1 -1
- package/dist/src/components/Tabs/TabList/TabList.js.map +1 -1
- package/dist/src/components/Tabs/TabPanel/TabPanel.js.map +1 -1
- package/dist/src/components/Tabs/TabPanels/TabPanels.js.map +1 -1
- package/dist/src/components/Tabs/TabsContext/TabsContext.js.map +1 -1
- package/dist/src/components/Text/Text.js.map +1 -1
- package/dist/src/components/TextField/TextField.js.map +1 -1
- package/dist/src/components/TextWithHighlight/TextWithHighlight.js.map +1 -1
- package/dist/src/components/ThemeProvider/ThemeProvider.js.map +1 -1
- package/dist/src/components/Tipseen/Tipseen.js.map +1 -1
- package/dist/src/components/Tipseen/TipseenBasicContent.js.map +1 -1
- package/dist/src/components/Tipseen/TipseenContent.js.map +1 -1
- package/dist/src/components/Tipseen/TipseenImage.js.map +1 -1
- package/dist/src/components/Tipseen/TipseenMedia/TipseenMedia.js.map +1 -1
- package/dist/src/components/Tipseen/TipseenTitle.js.map +1 -1
- package/dist/src/components/Tipseen/TipseenWizard.js.map +1 -1
- package/dist/src/components/Toast/Toast.js.map +1 -1
- package/dist/src/components/Toggle/MockToggle.js.map +1 -1
- package/dist/src/components/Toggle/Toggle.js.map +1 -1
- package/dist/src/components/Toggle/ToggleText.js.map +1 -1
- package/dist/src/components/Tooltip/Tooltip.js.map +1 -1
- package/dist/src/components/Typography/Typography.js.map +1 -1
- package/dist/src/components/VirtualizedGrid/VirtualizedGrid.js.map +1 -1
- package/dist/src/components/VirtualizedList/VirtualizedList.js.map +1 -1
- package/dist/src/hooks/useKeyEvent/index.js.map +1 -1
- package/dist/src/hooks/useSwitch/index.js.map +1 -1
- package/dist/types/VibeComponentProps.d.ts +9 -0
- package/package.json +3 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.js","sources":["../../../../src/components/Button/Button.tsx"],"sourcesContent":["/* eslint-disable react/button-has-type */\nimport React, { AriaAttributes, forwardRef, useCallback, useEffect, useMemo, useRef } from \"react\";\nimport { camelCase } from \"lodash-es\";\nimport cx from \"classnames\";\nimport { SIZES } from \"../../constants\";\nimport useMergeRef from \"../../hooks/useMergeRef\";\nimport { NOOP } from \"../../utils/function-utils\";\nimport Icon from \"../../components/Icon/Icon\";\nimport Loader from \"../../components/Loader/Loader\";\nimport {\n BUTTON_ICON_SIZE,\n ButtonColor as ButtonColorEnum,\n ButtonInputType as ButtonInputTypeEnum,\n ButtonType as ButtonTypeEnum,\n SMALL_BUTTON_ICON_SIZE\n} from \"./ButtonConstants\";\nimport { ButtonColor, ButtonInputType, ButtonType, ButtonSize } from \"./Button.types\";\nimport { getParentBackgroundColorNotTransparent, TRANSPARENT_COLOR } from \"./helper/dom-helpers\";\nimport { getTestId } from \"../../tests/test-ids-utils\";\nimport { SubIcon, VibeComponent, VibeComponentProps, withStaticProps } from \"../../types\";\nimport { getStyle } from \"../../helpers/typesciptCssModulesHelper\";\nimport { ComponentDefaultTestId, ComponentVibeId } from \"../../tests/constants\";\nimport styles from \"./Button.module.scss\";\nimport { useButtonLoading } from \"./helper/useButtonLoading\";\n\nexport interface ButtonProps extends VibeComponentProps {\n children: React.ReactNode;\n /** Custom class names to pass to the component */\n className?: string;\n activeButtonClassName?: string;\n /** The button's kind */\n kind?: ButtonType;\n /** Callback function to run when the button is clicked */\n onClick?: (event: React.MouseEvent<HTMLButtonElement>) => void;\n onMouseDown?: (event: React.MouseEvent<HTMLButtonElement>) => void;\n /** Blur on button click */\n blurOnMouseUp?: boolean;\n /** Name of the button - for form submit usages */\n name?: string;\n /** The button's size */\n size?: ButtonSize;\n /** The button's color */\n color?: ButtonColor;\n /** The button's type */\n type?: ButtonInputType;\n /** Whether the button should be disabled or not */\n disabled?: boolean;\n /** Icon to place on the right */\n rightIcon?: SubIcon;\n /** Icon to place on the left */\n leftIcon?: SubIcon;\n /** the success props are used when you have async action and wants to display a success message */\n success?: boolean;\n /** Success icon name */\n successIcon?: SubIcon;\n /** Success text */\n successText?: string;\n /** loading boolean which switches the text to a loader */\n loading?: boolean;\n /** className which is applied to loader container **/\n loaderClassName?: string;\n style?: React.CSSProperties;\n /** displays the active state */\n active?: boolean;\n /** id to pass to the button */\n id?: string;\n /** adds 8px margin to the right */\n marginRight?: boolean;\n /** adds 8px margin to the left */\n marginLeft?: boolean;\n /** element id to describe the button accordingly */\n ariaLabeledBy?: string;\n /** aria label to provide important when providing only Icon */\n ariaLabel?: string;\n /** aria for a button popup */\n ariaHasPopup?: React.HTMLProps<HTMLButtonElement>[\"aria-haspopup\"];\n /** aria to be set if the popup is open */\n ariaExpanded?: boolean;\n /** aria controls - receives id for the controlled region */\n ariaControls?: string;\n \"aria-describedby\"?: AriaAttributes[\"aria-describedby\"];\n /**\n * aria to be used for screen reader to know if the button is hidden\n */\n \"aria-hidden\"?: AriaAttributes[\"aria-hidden\"];\n /**\n * Indicates the current \"pressed\" state of toggle buttons\n */\n \"aria-pressed\"?: AriaAttributes[\"aria-pressed\"];\n /** On Button Focus callback */\n onFocus?: (event: React.FocusEvent<HTMLButtonElement>) => void;\n /** On Button Blur callback */\n onBlur?: (event: React.FocusEvent<HTMLButtonElement>) => void;\n rightFlat?: boolean;\n leftFlat?: boolean;\n preventClickAnimation?: boolean;\n noSidePadding?: boolean;\n /** default color for text color in ON_PRIMARY_COLOR kind (should be any type of css color (rbg, var, hex...) */\n defaultTextColorOnPrimaryColor?: string;\n \"data-testid\"?: string;\n /** Change the focus indicator from around the button to within it */\n insetFocus?: boolean;\n /** Specifies the tab order of an element */\n tabIndex?: number;\n}\n\nconst Button: VibeComponent<ButtonProps, unknown> & {\n sizes?: typeof SIZES;\n colors?: typeof ButtonColorEnum;\n kinds?: typeof ButtonTypeEnum;\n types?: typeof ButtonInputTypeEnum;\n inputTags?: typeof ButtonInputTypeEnum;\n} = forwardRef<unknown, ButtonProps>(\n (\n {\n className,\n children,\n kind,\n onClick,\n name,\n size,\n color,\n disabled,\n rightIcon,\n leftIcon,\n success,\n successText,\n successIcon,\n style,\n loading: isLoading,\n loaderClassName,\n active,\n activeButtonClassName,\n id,\n marginRight,\n marginLeft,\n type,\n onMouseDown,\n ariaLabel,\n rightFlat,\n leftFlat,\n preventClickAnimation,\n noSidePadding,\n onFocus,\n onBlur,\n ariaLabeledBy,\n defaultTextColorOnPrimaryColor,\n ariaHasPopup,\n ariaExpanded,\n ariaControls,\n \"aria-describedby\": ariaDescribedBy,\n \"aria-hidden\": ariaHidden,\n \"aria-pressed\": ariaPressed,\n blurOnMouseUp,\n \"data-testid\": dataTestId,\n insetFocus,\n tabIndex\n }: ButtonProps,\n ref\n ) => {\n const buttonRef = useRef<HTMLButtonElement>(null);\n const mergedRef = useMergeRef(ref, buttonRef);\n\n const { loading } = useButtonLoading({ isLoading });\n\n useEffect(() => {\n if (color !== \"on-primary-color\" && color !== \"fixed-light\") return;\n if (kind !== \"primary\") return;\n if (!buttonRef.current) return;\n\n const buttonElement = buttonRef.current;\n buttonElement.style.color = getParentBackgroundColorNotTransparent(buttonElement, defaultTextColorOnPrimaryColor);\n }, [kind, buttonRef, color, defaultTextColorOnPrimaryColor]);\n\n const onMouseUp = useCallback(() => {\n const button = buttonRef.current;\n if (disabled || !button) {\n return;\n }\n if (blurOnMouseUp) {\n button.blur();\n }\n }, [disabled, buttonRef, blurOnMouseUp]);\n\n const onButtonClicked = useCallback(\n (event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => {\n if (disabled || loading || success) {\n event.preventDefault();\n return;\n }\n\n if (onClick) {\n onClick(event);\n }\n },\n [onClick, disabled, loading, success]\n );\n\n const onMouseDownClicked = useCallback(\n (event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => {\n if (disabled || loading || success) {\n event.preventDefault();\n return;\n }\n\n if (onMouseDown) {\n onMouseDown(event);\n }\n },\n [onMouseDown, disabled, loading, success]\n );\n\n const classNames = useMemo(() => {\n const calculatedColor = success ? \"positive\" : color;\n return cx(\n className,\n styles.button,\n getStyle(styles, camelCase(\"size-\" + size)),\n getStyle(styles, camelCase(\"kind-\" + kind)),\n getStyle(styles, camelCase(\"color-\" + calculatedColor)),\n {\n [styles.success]: success,\n [getStyle(styles, camelCase(\"color-\" + calculatedColor + \"-active\"))]: active,\n [activeButtonClassName]: active,\n [styles.marginRight]: marginRight,\n [styles.marginLeft]: marginLeft,\n [styles.rightFlat]: rightFlat,\n [styles.leftFlat]: leftFlat,\n [styles.preventClickAnimation]: preventClickAnimation,\n [styles.noSidePadding]: noSidePadding,\n [styles.disabled]: disabled,\n [styles.insetFocusStyle]: insetFocus\n }\n );\n }, [\n success,\n color,\n className,\n size,\n kind,\n active,\n activeButtonClassName,\n marginRight,\n marginLeft,\n rightFlat,\n leftFlat,\n preventClickAnimation,\n noSidePadding,\n disabled,\n insetFocus\n ]);\n\n const buttonProps = useMemo(() => {\n const props: Record<string, unknown> = {\n ref: mergedRef,\n type,\n className: classNames,\n name,\n onMouseUp,\n style,\n onClick: onButtonClicked,\n id,\n onFocus,\n onBlur,\n tabIndex: disabled || ariaHidden ? -1 : tabIndex,\n \"data-testid\": dataTestId || getTestId(ComponentDefaultTestId.BUTTON, id),\n \"data-vibe\": ComponentVibeId.BUTTON,\n onMouseDown: onMouseDownClicked,\n \"aria-disabled\": disabled,\n \"aria-busy\": loading,\n \"aria-labelledby\": ariaLabeledBy,\n \"aria-label\": ariaLabel,\n \"aria-haspopup\": ariaHasPopup,\n \"aria-expanded\": ariaExpanded,\n \"aria-controls\": ariaControls,\n \"aria-describedby\": ariaDescribedBy,\n \"aria-hidden\": ariaHidden,\n \"aria-pressed\": ariaPressed\n };\n return props;\n }, [\n mergedRef,\n type,\n classNames,\n name,\n onMouseUp,\n style,\n onButtonClicked,\n id,\n onFocus,\n onBlur,\n tabIndex,\n dataTestId,\n onMouseDownClicked,\n disabled,\n loading,\n ariaLabeledBy,\n ariaLabel,\n ariaHasPopup,\n ariaExpanded,\n ariaControls,\n ariaDescribedBy,\n ariaHidden,\n ariaPressed\n ]);\n\n const iconSize = useCallback(\n (icon: SubIcon) => {\n if (typeof icon !== \"function\") return;\n switch (size) {\n case \"xxs\":\n case \"xs\":\n return SMALL_BUTTON_ICON_SIZE;\n default:\n return BUTTON_ICON_SIZE;\n }\n },\n [size]\n );\n\n const hasRenderableChildren = useMemo(() => React.Children.toArray(children).some(Boolean), [children]);\n\n const buttonContent = useMemo(\n () => (\n <>\n {leftIcon ? (\n <Icon\n iconType=\"font\"\n icon={leftIcon}\n iconSize={iconSize(leftIcon)}\n className={cx({\n [styles.leftIcon]: hasRenderableChildren\n })}\n ignoreFocusStyle\n />\n ) : null}\n {children}\n {rightIcon ? (\n <Icon\n iconType=\"font\"\n icon={rightIcon}\n iconSize={iconSize(rightIcon)}\n className={cx({\n [styles.rightIcon]: hasRenderableChildren\n })}\n ignoreFocusStyle\n />\n ) : null}\n </>\n ),\n [children, hasRenderableChildren, iconSize, leftIcon, rightIcon]\n );\n\n if (loading) {\n return (\n <button {...buttonProps} key={`${id}-loading`}>\n <span className={cx(styles.loader, loaderClassName)}>\n <Loader className={styles.loaderSvg} />\n <span aria-hidden className={styles.textPlaceholder}>\n {buttonContent}\n </span>\n </span>\n </button>\n );\n }\n\n if (success) {\n return (\n <button {...buttonProps} key={`${id}-success`}>\n <span className={styles.successContent}>\n {successIcon ? (\n <Icon\n iconType=\"font\"\n icon={successIcon}\n iconSize={iconSize(successIcon)}\n className={cx({\n [styles.leftIcon]: !!successText\n })}\n ignoreFocusStyle\n />\n ) : null}\n {successText}\n </span>\n <span aria-hidden=\"true\" className={styles.textPlaceholder}>\n {buttonContent}\n </span>\n </button>\n );\n }\n\n return (\n <button {...buttonProps} key={`${id}-button`}>\n {buttonContent}\n </button>\n );\n }\n);\n\nButton.defaultProps = {\n className: undefined,\n name: undefined,\n style: undefined,\n id: undefined,\n kind: \"primary\",\n onClick: NOOP,\n size: \"medium\",\n color: \"primary\",\n disabled: false,\n rightIcon: null,\n leftIcon: null,\n success: false,\n successText: \"\",\n successIcon: null,\n loading: false,\n loaderClassName: undefined,\n active: false,\n marginRight: false,\n marginLeft: false,\n type: \"button\",\n onMouseDown: NOOP,\n rightFlat: false,\n leftFlat: false,\n preventClickAnimation: false,\n noSidePadding: false,\n onFocus: NOOP,\n onBlur: NOOP,\n defaultTextColorOnPrimaryColor: TRANSPARENT_COLOR,\n ariaHasPopup: undefined,\n blurOnMouseUp: true,\n ariaExpanded: undefined,\n ariaControls: undefined,\n ariaLabel: undefined,\n ariaLabeledBy: undefined,\n insetFocus: false\n};\n\nexport default withStaticProps(Button, {\n sizes: SIZES,\n colors: ButtonColorEnum,\n kinds: ButtonTypeEnum,\n types: ButtonInputTypeEnum,\n inputTags: ButtonInputTypeEnum\n});\n"],"names":["Button","forwardRef","_ref","ref","className","children","kind","onClick","name","size","color","disabled","rightIcon","leftIcon","success","successText","successIcon","style","isLoading","loading","loaderClassName","active","activeButtonClassName","id","marginRight","marginLeft","type","onMouseDown","ariaLabel","rightFlat","leftFlat","preventClickAnimation","noSidePadding","onFocus","onBlur","ariaLabeledBy","defaultTextColorOnPrimaryColor","ariaHasPopup","ariaExpanded","ariaControls","ariaDescribedBy","ariaHidden","ariaPressed","blurOnMouseUp","dataTestId","insetFocus","tabIndex","buttonRef","useRef","mergedRef","useMergeRef","useButtonLoading","useEffect","current","buttonElement","getParentBackgroundColorNotTransparent","onMouseUp","useCallback","button","blur","onButtonClicked","event","preventDefault","onMouseDownClicked","classNames","useMemo","_cx","calculatedColor","cx","styles","getStyle","camelCase","_defineProperty","insetFocusStyle","buttonProps","getTestId","ComponentDefaultTestId","BUTTON","ComponentVibeId","iconSize","icon","SMALL_BUTTON_ICON_SIZE","BUTTON_ICON_SIZE","hasRenderableChildren","React","Children","toArray","some","Boolean","buttonContent","createElement","Fragment","Icon","iconType","ignoreFocusStyle","key","concat","loader","Loader","loaderSvg","textPlaceholder","successContent","Object","assign","defaultProps","undefined","NOOP","TRANSPARENT_COLOR","withStaticProps","sizes","SIZES","colors","ButtonColorEnum","kinds","ButtonTypeEnum","types","ButtonInputTypeEnum","inputTags"],"mappings":"klCA0GA,IAAMA,EAMFC,GACF,SAAAC,EA6CEC,GACE,IA5CAC,EAASF,EAATE,UACAC,EAAQH,EAARG,SACAC,EAAIJ,EAAJI,KACAC,EAAOL,EAAPK,QACAC,EAAIN,EAAJM,KACAC,EAAIP,EAAJO,KACAC,EAAKR,EAALQ,MACAC,EAAQT,EAARS,SACAC,EAASV,EAATU,UACAC,EAAQX,EAARW,SACAC,EAAOZ,EAAPY,QACAC,EAAWb,EAAXa,YACAC,EAAWd,EAAXc,YACAC,EAAKf,EAALe,MACSC,EAAShB,EAAlBiB,QACAC,EAAelB,EAAfkB,gBACAC,EAAMnB,EAANmB,OACAC,EAAqBpB,EAArBoB,sBACAC,EAAErB,EAAFqB,GACAC,EAAWtB,EAAXsB,YACAC,EAAUvB,EAAVuB,WACAC,EAAIxB,EAAJwB,KACAC,EAAWzB,EAAXyB,YACAC,EAAS1B,EAAT0B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KACH/E,GAEHqE,EAAAM,cAAA,OAAA,CAAA,cAAkB,OAAOtF,UAAWiE,EAAO+B,iBACxCX,KAOPL,EAAAM,cAAA,SAAAY,OAAAC,OAAA,CAAA,EAAY7B,GAAW,CAAEqB,IAAG,GAAAC,OAAKzE,EAAE,aAChCkE,GAGP,IAGFzF,EAAOwG,aAAe,CACpBpG,eAAWqG,EACXjG,UAAMiG,EACNxF,WAAOwF,EACPlF,QAAIkF,EACJnG,KAAM,UACNC,QAASmG,EACTjG,KAAM,SACNC,MAAO,UACPC,UAAU,EACVC,UAAW,KACXC,SAAU,KACVC,SAAS,EACTC,YAAa,GACbC,YAAa,KACbG,SAAS,EACTC,qBAAiBqF,EACjBpF,QAAQ,EACRG,aAAa,EACbC,YAAY,EACZC,KAAM,SACNC,YAAa+E,EACb7E,WAAW,EACXC,UAAU,EACVC,uBAAuB,EACvBC,eAAe,EACfC,QAASyE,EACTxE,OAAQwE,EACRtE,+BAAgCuE,EAChCtE,kBAAcoE,EACd9D,eAAe,EACfL,kBAAcmE,EACdlE,kBAAckE,EACd7E,eAAW6E,EACXtE,mBAAesE,EACf5D,YAAY,GAGd,IAAe+D,EAAAA,EAAgB5G,EAAQ,CACrC6G,MAAOC,EACPC,OAAQC,EACRC,MAAOC,EACPC,MAAOC,EACPC,UAAWD"}
|
|
1
|
+
{"version":3,"file":"Button.js","sources":["../../../../src/components/Button/Button.tsx"],"sourcesContent":["/* eslint-disable react/button-has-type */\nimport React, { AriaAttributes, forwardRef, useCallback, useEffect, useMemo, useRef } from \"react\";\nimport { camelCase } from \"lodash-es\";\nimport cx from \"classnames\";\nimport { SIZES } from \"../../constants\";\nimport useMergeRef from \"../../hooks/useMergeRef\";\nimport { NOOP } from \"../../utils/function-utils\";\nimport Icon from \"../../components/Icon/Icon\";\nimport Loader from \"../../components/Loader/Loader\";\nimport {\n BUTTON_ICON_SIZE,\n ButtonColor as ButtonColorEnum,\n ButtonInputType as ButtonInputTypeEnum,\n ButtonType as ButtonTypeEnum,\n SMALL_BUTTON_ICON_SIZE\n} from \"./ButtonConstants\";\nimport { ButtonColor, ButtonInputType, ButtonType, ButtonSize } from \"./Button.types\";\nimport { getParentBackgroundColorNotTransparent, TRANSPARENT_COLOR } from \"./helper/dom-helpers\";\nimport { getTestId } from \"../../tests/test-ids-utils\";\nimport { SubIcon, VibeComponent, VibeComponentProps, withStaticProps } from \"../../types\";\nimport { getStyle } from \"../../helpers/typesciptCssModulesHelper\";\nimport { ComponentDefaultTestId, ComponentVibeId } from \"../../tests/constants\";\nimport styles from \"./Button.module.scss\";\nimport { useButtonLoading } from \"./helper/useButtonLoading\";\n\nexport interface ButtonProps extends VibeComponentProps {\n children: React.ReactNode;\n /** Custom class names to pass to the component */\n className?: string;\n activeButtonClassName?: string;\n /** The button's kind */\n kind?: ButtonType;\n /** Callback function to run when the button is clicked */\n onClick?: (event: React.MouseEvent<HTMLButtonElement>) => void;\n onMouseDown?: (event: React.MouseEvent<HTMLButtonElement>) => void;\n /** Blur on button click */\n blurOnMouseUp?: boolean;\n /** Name of the button - for form submit usages */\n name?: string;\n /** The button's size */\n size?: ButtonSize;\n /** The button's color */\n color?: ButtonColor;\n /** The button's type */\n type?: ButtonInputType;\n /** Whether the button should be disabled or not */\n disabled?: boolean;\n /** Icon to place on the right */\n rightIcon?: SubIcon;\n /** Icon to place on the left */\n leftIcon?: SubIcon;\n /** the success props are used when you have async action and wants to display a success message */\n success?: boolean;\n /** Success icon name */\n successIcon?: SubIcon;\n /** Success text */\n successText?: string;\n /** loading boolean which switches the text to a loader */\n loading?: boolean;\n /** className which is applied to loader container **/\n loaderClassName?: string;\n style?: React.CSSProperties;\n /** displays the active state */\n active?: boolean;\n /** id to pass to the button */\n id?: string;\n /** adds 8px margin to the right */\n marginRight?: boolean;\n /** adds 8px margin to the left */\n marginLeft?: boolean;\n /** element id to describe the button accordingly */\n ariaLabeledBy?: string;\n /** aria label to provide important when providing only Icon */\n ariaLabel?: string;\n /** aria for a button popup */\n ariaHasPopup?: React.HTMLProps<HTMLButtonElement>[\"aria-haspopup\"];\n /** aria to be set if the popup is open */\n ariaExpanded?: boolean;\n /** aria controls - receives id for the controlled region */\n ariaControls?: string;\n \"aria-describedby\"?: AriaAttributes[\"aria-describedby\"];\n /**\n * aria to be used for screen reader to know if the button is hidden\n */\n \"aria-hidden\"?: AriaAttributes[\"aria-hidden\"];\n /**\n * Indicates the current \"pressed\" state of toggle buttons\n */\n \"aria-pressed\"?: AriaAttributes[\"aria-pressed\"];\n /** On Button Focus callback */\n onFocus?: (event: React.FocusEvent<HTMLButtonElement>) => void;\n /** On Button Blur callback */\n onBlur?: (event: React.FocusEvent<HTMLButtonElement>) => void;\n rightFlat?: boolean;\n leftFlat?: boolean;\n preventClickAnimation?: boolean;\n noSidePadding?: boolean;\n /** default color for text color in ON_PRIMARY_COLOR kind (should be any type of css color (rbg, var, hex...) */\n defaultTextColorOnPrimaryColor?: string;\n \"data-testid\"?: string;\n /** Change the focus indicator from around the button to within it */\n insetFocus?: boolean;\n /** Specifies the tab order of an element */\n tabIndex?: number;\n}\n\nconst Button: VibeComponent<ButtonProps, unknown> & {\n sizes?: typeof SIZES;\n colors?: typeof ButtonColorEnum;\n kinds?: typeof ButtonTypeEnum;\n types?: typeof ButtonInputTypeEnum;\n inputTags?: typeof ButtonInputTypeEnum;\n} = forwardRef<unknown, ButtonProps>(\n (\n {\n className,\n children,\n kind,\n onClick,\n name,\n size,\n color,\n disabled,\n rightIcon,\n leftIcon,\n success,\n successText,\n successIcon,\n style,\n loading: isLoading,\n loaderClassName,\n active,\n activeButtonClassName,\n id,\n marginRight,\n marginLeft,\n type,\n onMouseDown,\n ariaLabel,\n rightFlat,\n leftFlat,\n preventClickAnimation,\n noSidePadding,\n onFocus,\n onBlur,\n ariaLabeledBy,\n defaultTextColorOnPrimaryColor,\n ariaHasPopup,\n ariaExpanded,\n ariaControls,\n \"aria-describedby\": ariaDescribedBy,\n \"aria-hidden\": ariaHidden,\n \"aria-pressed\": ariaPressed,\n blurOnMouseUp,\n \"data-testid\": dataTestId,\n insetFocus,\n tabIndex\n }: ButtonProps,\n ref\n ) => {\n const buttonRef = useRef<HTMLButtonElement>(null);\n const mergedRef = useMergeRef(ref, buttonRef);\n\n const { loading } = useButtonLoading({ isLoading });\n\n useEffect(() => {\n if (color !== \"on-primary-color\" && color !== \"fixed-light\") return;\n if (kind !== \"primary\") return;\n if (!buttonRef.current) return;\n\n const buttonElement = buttonRef.current;\n buttonElement.style.color = getParentBackgroundColorNotTransparent(buttonElement, defaultTextColorOnPrimaryColor);\n }, [kind, buttonRef, color, defaultTextColorOnPrimaryColor]);\n\n const onMouseUp = useCallback(() => {\n const button = buttonRef.current;\n if (disabled || !button) {\n return;\n }\n if (blurOnMouseUp) {\n button.blur();\n }\n }, [disabled, buttonRef, blurOnMouseUp]);\n\n const onButtonClicked = useCallback(\n (event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => {\n if (disabled || loading || success) {\n event.preventDefault();\n return;\n }\n\n if (onClick) {\n onClick(event);\n }\n },\n [onClick, disabled, loading, success]\n );\n\n const onMouseDownClicked = useCallback(\n (event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => {\n if (disabled || loading || success) {\n event.preventDefault();\n return;\n }\n\n if (onMouseDown) {\n onMouseDown(event);\n }\n },\n [onMouseDown, disabled, loading, success]\n );\n\n const classNames = useMemo(() => {\n const calculatedColor = success ? \"positive\" : color;\n return cx(\n className,\n styles.button,\n getStyle(styles, camelCase(\"size-\" + size)),\n getStyle(styles, camelCase(\"kind-\" + kind)),\n getStyle(styles, camelCase(\"color-\" + calculatedColor)),\n {\n [styles.success]: success,\n [getStyle(styles, camelCase(\"color-\" + calculatedColor + \"-active\"))]: active,\n [activeButtonClassName]: active,\n [styles.marginRight]: marginRight,\n [styles.marginLeft]: marginLeft,\n [styles.rightFlat]: rightFlat,\n [styles.leftFlat]: leftFlat,\n [styles.preventClickAnimation]: preventClickAnimation,\n [styles.noSidePadding]: noSidePadding,\n [styles.disabled]: disabled,\n [styles.insetFocusStyle]: insetFocus\n }\n );\n }, [\n success,\n color,\n className,\n size,\n kind,\n active,\n activeButtonClassName,\n marginRight,\n marginLeft,\n rightFlat,\n leftFlat,\n preventClickAnimation,\n noSidePadding,\n disabled,\n insetFocus\n ]);\n\n const buttonProps = useMemo(() => {\n const props: Record<string, unknown> = {\n ref: mergedRef,\n type,\n className: classNames,\n name,\n onMouseUp,\n style,\n onClick: onButtonClicked,\n id,\n onFocus,\n onBlur,\n tabIndex: disabled || ariaHidden ? -1 : tabIndex,\n \"data-testid\": dataTestId || getTestId(ComponentDefaultTestId.BUTTON, id),\n \"data-vibe\": ComponentVibeId.BUTTON,\n onMouseDown: onMouseDownClicked,\n \"aria-disabled\": disabled,\n \"aria-busy\": loading,\n \"aria-labelledby\": ariaLabeledBy,\n \"aria-label\": ariaLabel,\n \"aria-haspopup\": ariaHasPopup,\n \"aria-expanded\": ariaExpanded,\n \"aria-controls\": ariaControls,\n \"aria-describedby\": ariaDescribedBy,\n \"aria-hidden\": ariaHidden,\n \"aria-pressed\": ariaPressed\n };\n return props;\n }, [\n mergedRef,\n type,\n classNames,\n name,\n onMouseUp,\n style,\n onButtonClicked,\n id,\n onFocus,\n onBlur,\n tabIndex,\n dataTestId,\n onMouseDownClicked,\n disabled,\n loading,\n ariaLabeledBy,\n ariaLabel,\n ariaHasPopup,\n ariaExpanded,\n ariaControls,\n ariaDescribedBy,\n ariaHidden,\n ariaPressed\n ]);\n\n const iconSize = useCallback(\n (icon: SubIcon) => {\n if (typeof icon !== \"function\") return;\n switch (size) {\n case \"xxs\":\n case \"xs\":\n return SMALL_BUTTON_ICON_SIZE;\n default:\n return BUTTON_ICON_SIZE;\n }\n },\n [size]\n );\n\n const hasRenderableChildren = useMemo(() => React.Children.toArray(children).some(Boolean), [children]);\n\n const buttonContent = useMemo(\n () => (\n <>\n {leftIcon ? (\n <Icon\n iconType=\"font\"\n icon={leftIcon}\n iconSize={iconSize(leftIcon)}\n className={cx({\n [styles.leftIcon]: hasRenderableChildren\n })}\n ignoreFocusStyle\n />\n ) : null}\n {children}\n {rightIcon ? (\n <Icon\n iconType=\"font\"\n icon={rightIcon}\n iconSize={iconSize(rightIcon)}\n className={cx({\n [styles.rightIcon]: hasRenderableChildren\n })}\n ignoreFocusStyle\n />\n ) : null}\n </>\n ),\n [children, hasRenderableChildren, iconSize, leftIcon, rightIcon]\n );\n\n if (loading) {\n return (\n <button {...buttonProps} key={`${id}-loading`}>\n <span className={cx(styles.loader, loaderClassName)}>\n <Loader className={styles.loaderSvg} />\n <span aria-hidden className={styles.textPlaceholder}>\n {buttonContent}\n </span>\n </span>\n </button>\n );\n }\n\n if (success) {\n return (\n <button {...buttonProps} key={`${id}-success`}>\n <span className={styles.successContent}>\n {successIcon ? (\n <Icon\n iconType=\"font\"\n icon={successIcon}\n iconSize={iconSize(successIcon)}\n className={cx({\n [styles.leftIcon]: !!successText\n })}\n ignoreFocusStyle\n />\n ) : null}\n {successText}\n </span>\n <span aria-hidden=\"true\" className={styles.textPlaceholder}>\n {buttonContent}\n </span>\n </button>\n );\n }\n\n return (\n <button {...buttonProps} key={`${id}-button`}>\n {buttonContent}\n </button>\n );\n }\n);\n\nButton.defaultProps = {\n name: undefined,\n style: undefined,\n kind: \"primary\",\n onClick: NOOP,\n size: \"medium\",\n color: \"primary\",\n disabled: false,\n rightIcon: null,\n leftIcon: null,\n success: false,\n successText: \"\",\n successIcon: null,\n loading: false,\n loaderClassName: undefined,\n active: false,\n marginRight: false,\n marginLeft: false,\n type: \"button\",\n onMouseDown: NOOP,\n rightFlat: false,\n leftFlat: false,\n preventClickAnimation: false,\n noSidePadding: false,\n onFocus: NOOP,\n onBlur: NOOP,\n defaultTextColorOnPrimaryColor: TRANSPARENT_COLOR,\n ariaHasPopup: undefined,\n blurOnMouseUp: true,\n ariaExpanded: undefined,\n ariaControls: undefined,\n ariaLabel: undefined,\n ariaLabeledBy: undefined,\n insetFocus: false\n};\n\nexport default withStaticProps(Button, {\n sizes: SIZES,\n colors: ButtonColorEnum,\n kinds: ButtonTypeEnum,\n types: ButtonInputTypeEnum,\n inputTags: ButtonInputTypeEnum\n});\n"],"names":["Button","forwardRef","_ref","ref","className","children","kind","onClick","name","size","color","disabled","rightIcon","leftIcon","success","successText","successIcon","style","isLoading","loading","loaderClassName","active","activeButtonClassName","id","marginRight","marginLeft","type","onMouseDown","ariaLabel","rightFlat","leftFlat","preventClickAnimation","noSidePadding","onFocus","onBlur","ariaLabeledBy","defaultTextColorOnPrimaryColor","ariaHasPopup","ariaExpanded","ariaControls","ariaDescribedBy","ariaHidden","ariaPressed","blurOnMouseUp","dataTestId","insetFocus","tabIndex","buttonRef","useRef","mergedRef","useMergeRef","useButtonLoading","useEffect","current","buttonElement","getParentBackgroundColorNotTransparent","onMouseUp","useCallback","button","blur","onButtonClicked","event","preventDefault","onMouseDownClicked","classNames","useMemo","_cx","calculatedColor","cx","styles","getStyle","camelCase","_defineProperty","insetFocusStyle","buttonProps","getTestId","ComponentDefaultTestId","BUTTON","ComponentVibeId","iconSize","icon","SMALL_BUTTON_ICON_SIZE","BUTTON_ICON_SIZE","hasRenderableChildren","React","Children","toArray","some","Boolean","buttonContent","createElement","Fragment","Icon","iconType","ignoreFocusStyle","key","concat","loader","Loader","loaderSvg","textPlaceholder","successContent","Object","assign","defaultProps","undefined","NOOP","TRANSPARENT_COLOR","withStaticProps","sizes","SIZES","colors","ButtonColorEnum","kinds","ButtonTypeEnum","types","ButtonInputTypeEnum","inputTags"],"mappings":"klCA0GA,IAAMA,EAMFC,GACF,SAAAC,EA6CEC,GACE,IA5CAC,EAASF,EAATE,UACAC,EAAQH,EAARG,SACAC,EAAIJ,EAAJI,KACAC,EAAOL,EAAPK,QACAC,EAAIN,EAAJM,KACAC,EAAIP,EAAJO,KACAC,EAAKR,EAALQ,MACAC,EAAQT,EAARS,SACAC,EAASV,EAATU,UACAC,EAAQX,EAARW,SACAC,EAAOZ,EAAPY,QACAC,EAAWb,EAAXa,YACAC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W,CAAEqB,IAAG,GAAAC,OAAKzE,EAAE,cACjC6D,EAAAM,cAAA,OAAA,CAAMtF,UAAWiE,EAAOgC,gBACrBrF,EACCoE,EAAAM,cAACE,EACC,CAAAC,SAAS,OACTb,KAAMhE,EACN+D,SAAUA,GAAS/D,GACnBZ,UAAWgE,EAAEI,EACVH,CAAAA,EAAAA,EAAOxD,WAAaE,IAEvB+E,kBAAgB,IAEhB,KACH/E,GAEHqE,EAAAM,cAAA,OAAA,CAAA,cAAkB,OAAOtF,UAAWiE,EAAO+B,iBACxCX,KAOPL,EAAAM,cAAA,SAAAY,OAAAC,OAAA,CAAA,EAAY7B,GAAW,CAAEqB,IAAG,GAAAC,OAAKzE,EAAE,aAChCkE,GAGP,IAGFzF,EAAOwG,aAAe,CACpBhG,UAAMiG,EACNxF,WAAOwF,EACPnG,KAAM,UACNC,QAASmG,EACTjG,KAAM,SACNC,MAAO,UACPC,UAAU,EACVC,UAAW,KACXC,SAAU,KACVC,SAAS,EACTC,YAAa,GACbC,YAAa,KACbG,SAAS,EACTC,qBAAiBqF,EACjBpF,QAAQ,EACRG,aAAa,EACbC,YAAY,EACZC,KAAM,SACNC,YAAa+E,EACb7E,WAAW,EACXC,UAAU,EACVC,uBAAuB,EACvBC,eAAe,EACfC,QAASyE,EACTxE,OAAQwE,EACRtE,+BAAgCuE,EAChCtE,kBAAcoE,EACd9D,eAAe,EACfL,kBAAcmE,EACdlE,kBAAckE,EACd7E,eAAW6E,EACXtE,mBAAesE,EACf5D,YAAY,GAGd,IAAe+D,EAAAA,EAAgB5G,EAAQ,CACrC6G,MAAOC,EACPC,OAAQC,EACRC,MAAOC,EACPC,MAAOC,EACPC,UAAWD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ButtonGroup.js","sources":["../../../../src/components/ButtonGroup/ButtonGroup.tsx"],"sourcesContent":["import React, { forwardRef, useCallback, useEffect, useMemo, useRef, useState } from \"react\";\nimport { camelCase } from \"lodash-es\";\nimport cx from \"classnames\";\nimport { getStyle } from \"../../helpers/typesciptCssModulesHelper\";\nimport Button from \"../Button/Button\";\nimport usePrevious from \"../../hooks/usePrevious\";\nimport useMergeRef from \"../../hooks/useMergeRef\";\nimport { ButtonValue } from \"./ButtonGroupConstants\";\nimport { ButtonWrapper } from \"./ButtonWrapper\";\nimport { SIZES } from \"../../constants\";\nimport { ButtonType as ButtonTypeEnum } from \"../Button/ButtonConstants\";\nimport { ButtonType, ButtonSize } from \"../Button/Button.types\";\nimport { SubIcon, VibeComponent, VibeComponentProps, withStaticProps } from \"../../types\";\nimport { MoveBy } from \"../../types/MoveBy\";\nimport { getTestId } from \"../../tests/test-ids-utils\";\nimport { ComponentDefaultTestId, ComponentVibeId } from \"../../tests/constants\";\nimport styles from \"./ButtonGroup.module.scss\";\nimport { TooltipPositions } from \"../Tooltip/Tooltip.types\";\n\ntype ButtonGroupOption = {\n icon?: SubIcon;\n leftIcon?: SubIcon;\n ariaLabel?: string;\n subText?: string;\n value: ButtonValue;\n text: string;\n disabled?: boolean;\n tooltipContent?: string;\n};\n\nexport interface ButtonGroupProps extends VibeComponentProps {\n options: Array<ButtonGroupOption>;\n value?: ButtonValue;\n onSelect?: (value: ButtonValue, name: string) => void;\n size?: ButtonSize;\n kind?: Extract<ButtonType, \"secondary\" | \"tertiary\">;\n name?: string;\n disabled?: boolean;\n groupAriaLabel?: string;\n /**\n * Where the tooltip should be in reference to the children: Top, Left, Right, Bottom ...\n */\n tooltipPosition?: TooltipPositions;\n tooltipHideDelay?: number;\n tooltipShowDelay?: number;\n tooltipContainerSelector?: string;\n tooltipMoveBy?: MoveBy;\n children?: React.ReactNode;\n fullWidth?: boolean;\n blurOnMouseUp?: boolean;\n}\n\nconst ButtonGroup: VibeComponent<ButtonGroupProps, HTMLDivElement> & {\n sizes?: typeof SIZES;\n kinds?: typeof ButtonTypeEnum;\n} = forwardRef(\n (\n {\n className,\n options,\n name = \"\",\n disabled = false,\n value = \"\",\n onSelect,\n size = \"small\",\n kind = \"secondary\",\n groupAriaLabel = \"\",\n tooltipPosition,\n tooltipHideDelay,\n tooltipShowDelay,\n tooltipContainerSelector,\n tooltipMoveBy,\n blurOnMouseUp = true,\n id,\n \"data-testid\": dataTestId,\n fullWidth = false\n }: ButtonGroupProps,\n ref\n ) => {\n const inputRef = useRef();\n const mergedRef = useMergeRef(ref, inputRef);\n\n const [valueState, setValueState] = useState(value);\n const prevValue = usePrevious(value);\n\n const onClick = useCallback(\n (option: ButtonGroupOption) => {\n const isDisabled = disabled || option.disabled;\n if (!isDisabled) {\n setValueState(option.value);\n if (onSelect) {\n onSelect(option.value, name);\n }\n }\n },\n [onSelect, disabled, name]\n );\n\n const selectedOption = useMemo(() => {\n return options.find(option => option.value === valueState);\n }, [options, valueState]);\n\n const Buttons = useMemo(() => {\n return options.map((option, index) => {\n const isSelected = option.value === valueState;\n return (\n <ButtonWrapper\n key={option.value}\n size={size}\n onClick={() => onClick(option)}\n rightIcon={option.icon}\n leftIcon={option.leftIcon}\n active={isSelected}\n rightFlat={index !== options.length - 1}\n leftFlat={index !== 0}\n kind=\"tertiary\"\n preventClickAnimation\n ariaLabel={option.ariaLabel}\n tooltipContent={option.tooltipContent}\n tooltipPosition={tooltipPosition}\n tooltipHideDelay={tooltipHideDelay}\n tooltipShowDelay={tooltipShowDelay}\n tooltipContainerSelector={tooltipContainerSelector}\n tooltipMoveBy={tooltipMoveBy}\n blurOnMouseUp={blurOnMouseUp}\n className={cx(styles.button, styles.optionText, {\n [styles.selected]: isSelected,\n [styles.disabled]: disabled,\n [styles.buttonDisabled]: option.disabled,\n [styles.fullWidth]: fullWidth\n })}\n activeButtonClassName={styles.activeButton}\n >\n {option.text}\n </ButtonWrapper>\n );\n });\n }, [\n options,\n valueState,\n size,\n tooltipPosition,\n tooltipHideDelay,\n tooltipShowDelay,\n tooltipContainerSelector,\n tooltipMoveBy,\n blurOnMouseUp,\n disabled,\n fullWidth,\n onClick\n ]);\n\n // Effects\n useEffect(() => {\n // Update value if changed from props\n if (value !== prevValue && value !== valueState) {\n setValueState(value);\n }\n }, [value, prevValue, valueState, setValueState]);\n\n return (\n <div\n className={cx(styles.buttonGroup, className, getStyle(styles, camelCase(\"kind-\" + kind)), {\n [styles.disabled]: disabled\n })}\n id={id}\n data-testid={dataTestId || getTestId(ComponentDefaultTestId.BUTTON_GROUP, id)}\n data-vibe={ComponentVibeId.BUTTON_GROUP}\n ref={mergedRef}\n >\n <div role=\"group\" aria-label={groupAriaLabel} className={cx(styles.buttonsContainer)} aria-disabled={disabled}>\n {Buttons}\n </div>\n {selectedOption && selectedOption.subText && (\n <div className={cx(styles.subTextContainer)}>{selectedOption.subText}</div>\n )}\n </div>\n );\n }\n);\n\nexport default withStaticProps(ButtonGroup, { sizes: Button.sizes, kinds: Button.kinds });\n"],"names":["withStaticProps","forwardRef","_ref","ref","className","options","_ref$name","name","_ref$disabled","disabled","_ref$value","value","onSelect","_ref$size","size","_ref$kind","kind","_ref$groupAriaLabel","groupAriaLabel","tooltipPosition","tooltipHideDelay","tooltipShowDelay","tooltipContainerSelector","tooltipMoveBy","_ref$blurOnMouseUp","blurOnMouseUp","id","dataTestId","_ref$fullWidth","fullWidth","inputRef","useRef","mergedRef","useMergeRef","_useState","useState","_useState2","_slicedToArray","valueState","setValueState","prevValue","usePrevious","onClick","useCallback","option","selectedOption","useMemo","find","Buttons","map","index","isSelected","React","createElement","ButtonWrapper","key","rightIcon","icon","leftIcon","active","rightFlat","length","leftFlat","preventClickAnimation","ariaLabel","tooltipContent","cx","styles","button","optionText","_defineProperty","selected","buttonDisabled","activeButtonClassName","activeButton","text","useEffect","buttonGroup","getStyle","camelCase","getTestId","ComponentDefaultTestId","BUTTON_GROUP","ComponentVibeId","role","buttonsContainer","subText","subTextContainer","sizes","Button","kinds"],"mappings":"oyBAoDA,IAiIeA,EAAAA,EA9HXC,GACF,SAAAC,EAqBEC,GACE,IApBAC,EAASF,EAATE,UACAC,EAAOH,EAAPG,QAAOC,EAAAJ,EACPK,KAA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
+
{"version":3,"file":"ButtonGroup.js","sources":["../../../../src/components/ButtonGroup/ButtonGroup.tsx"],"sourcesContent":["import React, { forwardRef, useCallback, useEffect, useMemo, useRef, useState } from \"react\";\nimport { camelCase } from \"lodash-es\";\nimport cx from \"classnames\";\nimport { getStyle } from \"../../helpers/typesciptCssModulesHelper\";\nimport Button from \"../Button/Button\";\nimport usePrevious from \"../../hooks/usePrevious\";\nimport useMergeRef from \"../../hooks/useMergeRef\";\nimport { ButtonValue } from \"./ButtonGroupConstants\";\nimport { ButtonWrapper } from \"./ButtonWrapper\";\nimport { SIZES } from \"../../constants\";\nimport { ButtonType as ButtonTypeEnum } from \"../Button/ButtonConstants\";\nimport { ButtonType, ButtonSize } from \"../Button/Button.types\";\nimport { SubIcon, VibeComponent, VibeComponentProps, withStaticProps } from \"../../types\";\nimport { MoveBy } from \"../../types/MoveBy\";\nimport { getTestId } from \"../../tests/test-ids-utils\";\nimport { ComponentDefaultTestId, ComponentVibeId } from \"../../tests/constants\";\nimport styles from \"./ButtonGroup.module.scss\";\nimport { TooltipPositions } from \"../Tooltip/Tooltip.types\";\n\ntype ButtonGroupOption = {\n icon?: SubIcon;\n leftIcon?: SubIcon;\n ariaLabel?: string;\n subText?: string;\n value: ButtonValue;\n text: string;\n disabled?: boolean;\n tooltipContent?: string;\n};\n\nexport interface ButtonGroupProps extends VibeComponentProps {\n /**\n * The list of button options.\n */\n options: Array<ButtonGroupOption>;\n /**\n * The currently selected button value.\n */\n value?: ButtonValue;\n /**\n * Callback fired when a button is selected.\n */\n onSelect?: (value: ButtonValue, name: string) => void;\n /**\n * The size of the buttons.\n */\n size?: ButtonSize;\n /**\n * The style variant of the buttons.\n */\n kind?: Extract<ButtonType, \"secondary\" | \"tertiary\">;\n /**\n * The name of the button group.\n */\n name?: string;\n /**\n * If true, disables all buttons in the group.\n */\n disabled?: boolean;\n /**\n * The label of the button group for accessibility.\n */\n groupAriaLabel?: string;\n /**\n * The position of the tooltip relative to the button.\n */\n tooltipPosition?: TooltipPositions;\n /**\n * The delay in milliseconds before the tooltip hides.\n */\n tooltipHideDelay?: number;\n /**\n * The delay in milliseconds before the tooltip shows.\n */\n tooltipShowDelay?: number;\n /**\n * CSS selector for the tooltip container.\n */\n tooltipContainerSelector?: string;\n /**\n * Adjusts the tooltip position.\n */\n tooltipMoveBy?: MoveBy;\n /**\n * The content inside the button group.\n */\n children?: React.ReactNode;\n /**\n * If true, makes the button group take the full width of its container.\n */\n fullWidth?: boolean;\n /**\n * If true, removes focus from the button after clicking.\n */\n blurOnMouseUp?: boolean;\n}\n\nconst ButtonGroup: VibeComponent<ButtonGroupProps, HTMLDivElement> & {\n sizes?: typeof SIZES;\n kinds?: typeof ButtonTypeEnum;\n} = forwardRef(\n (\n {\n className,\n options,\n name = \"\",\n disabled = false,\n value = \"\",\n onSelect,\n size = \"small\",\n kind = \"secondary\",\n groupAriaLabel = \"\",\n tooltipPosition,\n tooltipHideDelay,\n tooltipShowDelay,\n tooltipContainerSelector,\n tooltipMoveBy,\n blurOnMouseUp = true,\n id,\n \"data-testid\": dataTestId,\n fullWidth = false\n }: ButtonGroupProps,\n ref\n ) => {\n const inputRef = useRef();\n const mergedRef = useMergeRef(ref, inputRef);\n\n const [valueState, setValueState] = useState(value);\n const prevValue = usePrevious(value);\n\n const onClick = useCallback(\n (option: ButtonGroupOption) => {\n const isDisabled = disabled || option.disabled;\n if (!isDisabled) {\n setValueState(option.value);\n if (onSelect) {\n onSelect(option.value, name);\n }\n }\n },\n [onSelect, disabled, name]\n );\n\n const selectedOption = useMemo(() => {\n return options.find(option => option.value === valueState);\n }, [options, valueState]);\n\n const Buttons = useMemo(() => {\n return options.map((option, index) => {\n const isSelected = option.value === valueState;\n return (\n <ButtonWrapper\n key={option.value}\n size={size}\n onClick={() => onClick(option)}\n rightIcon={option.icon}\n leftIcon={option.leftIcon}\n active={isSelected}\n rightFlat={index !== options.length - 1}\n leftFlat={index !== 0}\n kind=\"tertiary\"\n preventClickAnimation\n ariaLabel={option.ariaLabel}\n tooltipContent={option.tooltipContent}\n tooltipPosition={tooltipPosition}\n tooltipHideDelay={tooltipHideDelay}\n tooltipShowDelay={tooltipShowDelay}\n tooltipContainerSelector={tooltipContainerSelector}\n tooltipMoveBy={tooltipMoveBy}\n blurOnMouseUp={blurOnMouseUp}\n className={cx(styles.button, styles.optionText, {\n [styles.selected]: isSelected,\n [styles.disabled]: disabled,\n [styles.buttonDisabled]: option.disabled,\n [styles.fullWidth]: fullWidth\n })}\n activeButtonClassName={styles.activeButton}\n >\n {option.text}\n </ButtonWrapper>\n );\n });\n }, [\n options,\n valueState,\n size,\n tooltipPosition,\n tooltipHideDelay,\n tooltipShowDelay,\n tooltipContainerSelector,\n tooltipMoveBy,\n blurOnMouseUp,\n disabled,\n fullWidth,\n onClick\n ]);\n\n // Effects\n useEffect(() => {\n // Update value if changed from props\n if (value !== prevValue && value !== valueState) {\n setValueState(value);\n }\n }, [value, prevValue, valueState, setValueState]);\n\n return (\n <div\n className={cx(styles.buttonGroup, className, getStyle(styles, camelCase(\"kind-\" + kind)), {\n [styles.disabled]: disabled\n })}\n id={id}\n data-testid={dataTestId || getTestId(ComponentDefaultTestId.BUTTON_GROUP, id)}\n data-vibe={ComponentVibeId.BUTTON_GROUP}\n ref={mergedRef}\n >\n <div role=\"group\" aria-label={groupAriaLabel} className={cx(styles.buttonsContainer)} aria-disabled={disabled}>\n {Buttons}\n </div>\n {selectedOption && selectedOption.subText && (\n <div className={cx(styles.subTextContainer)}>{selectedOption.subText}</div>\n )}\n </div>\n );\n }\n);\n\nexport default withStaticProps(ButtonGroup, { sizes: Button.sizes, kinds: Button.kinds });\n"],"names":["withStaticProps","forwardRef","_ref","ref","className","options","_ref$name","name","_ref$disabled","disabled","_ref$value","value","onSelect","_ref$size","size","_ref$kind","kind","_ref$groupAriaLabel","groupAriaLabel","tooltipPosition","tooltipHideDelay","tooltipShowDelay","tooltipContainerSelector","tooltipMoveBy","_ref$blurOnMouseUp","blurOnMouseUp","id","dataTestId","_ref$fullWidth","fullWidth","inputRef","useRef","mergedRef","useMergeRef","_useState","useState","_useState2","_slicedToArray","valueState","setValueState","prevValue","usePrevious","onClick","useCallback","option","selectedOption","useMemo","find","Buttons","map","index","isSelected","React","createElement","ButtonWrapper","key","rightIcon","icon","leftIcon","active","rightFlat","length","leftFlat","preventClickAnimation","ariaLabel","tooltipContent","cx","styles","button","optionText","_defineProperty","selected","buttonDisabled","activeButtonClassName","activeButton","text","useEffect","buttonGroup","getStyle","camelCase","getTestId","ComponentDefaultTestId","BUTTON_GROUP","ComponentVibeId","role","buttonsContainer","subText","subTextContainer","sizes","Button","kinds"],"mappings":"oyBAiGA,IAiIeA,EAAAA,EA9HXC,GACF,SAAAC,EAqBEC,GACE,IApBAC,EAASF,EAATE,UACAC,EAAOH,EAAPG,QAAOC,EAAAJ,EACPK,KAAAA,OAAO,IAAHD,EAAG,GAAEA,EAAAE,EAAAN,EACTO,SAAAA,OAAW,IAAHD,GAAQA,EAAAE,EAAAR,EAChBS,MAAAA,OAAQ,IAAHD,EAAG,GAAEA,EACVE,EAAQV,EAARU,SAAQC,EAAAX,EACRY,KAAAA,OAAO,IAAHD,EAAG,QAAOA,EAAAE,EAAAb,EACdc,KAAAA,OAAO,IAAHD,EAAG,YAAWA,EAAAE,EAAAf,EAClBgB,eAAAA,OAAiB,IAAHD,EAAG,GAAEA,EACnBE,EAAejB,EAAfiB,gBACAC,EAAgBlB,EAAhBkB,iBACAC,EAAgBnB,EAAhBmB,iBACAC,EAAwBpB,EAAxBoB,yBACAC,EAAarB,EAAbqB,cAAaC,EAAAtB,EACbuB,cAAAA,OAAgB,IAAHD,GAAOA,EACpBE,EAAExB,EAAFwB,GACeC,EAAUzB,EAAzB,eAAa0B,EAAA1B,EACb2B,UAAAA,OAAY,IAAHD,GAAQA,EAIbE,EAAWC,IACXC,EAAYC,EAAY9B,EAAK2B,GAEnCI,EAAoCC,EAASxB,GAAMyB,EAAAC,EAAAH,EAAA,GAA5CI,EAAUF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ACA,EAAO6B,EAAWF,EAAYC,IAGhCa,uBACEhD,UAAW8D,EAAGC,EAAOU,YAAazE,EAAW0E,EAASX,EAAQY,EAAU,QAAU/D,IAAMsD,EACrFH,CAAAA,EAAAA,EAAO1D,SAAWA,IAErBiB,GAAIA,gBACSC,GAAcqD,EAAUC,EAAuBC,aAAcxD,GAC/D,YAAAyD,EAAgBD,aAC3B/E,IAAK6B,GAELoB,EAAAC,cAAA,MAAA,CAAK+B,KAAK,qBAAoBlE,EAAgBd,UAAW8D,EAAGC,EAAOkB,kCAAkC5E,GAClGuC,IAEFH,IAAkBA,GAAeyC,SAChClC,EAAAC,cAAA,MAAA,CAAKjD,UAAW8D,EAAGC,EAAOoB,mBAAoB1C,GAAeyC,SAIrE,IAG0C,CAAEE,MAAOC,EAAOD,MAAOE,MAAOD,EAAOC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ButtonWrapper.js","sources":["../../../../src/components/ButtonGroup/ButtonWrapper.tsx"],"sourcesContent":["import React from \"react\";\nimport { isNil } from \"lodash-es\";\nimport Button, { ButtonProps } from \"../Button/Button\";\nimport Tooltip from \"../Tooltip/Tooltip\";\nimport { MoveBy } from \"../../types/MoveBy\";\nimport { TooltipPositions } from \"../Tooltip/Tooltip.types\";\n\nexport interface ButtonWrapperProps extends ButtonProps {\n tooltipContent?: string;\n /**\n *
|
|
1
|
+
{"version":3,"file":"ButtonWrapper.js","sources":["../../../../src/components/ButtonGroup/ButtonWrapper.tsx"],"sourcesContent":["import React from \"react\";\nimport { isNil } from \"lodash-es\";\nimport Button, { ButtonProps } from \"../Button/Button\";\nimport Tooltip from \"../Tooltip/Tooltip\";\nimport { MoveBy } from \"../../types/MoveBy\";\nimport { TooltipPositions } from \"../Tooltip/Tooltip.types\";\n\nexport interface ButtonWrapperProps extends ButtonProps {\n /**\n * The content of the tooltip.\n */\n tooltipContent?: string;\n /**\n * The position of the tooltip relative to the button.\n */\n tooltipPosition?: TooltipPositions;\n /**\n * The delay in milliseconds before the tooltip hides.\n */\n tooltipHideDelay?: number;\n /**\n * The delay in milliseconds before the tooltip shows.\n */\n tooltipShowDelay?: number;\n /**\n * CSS selector for the tooltip container.\n */\n tooltipContainerSelector?: string;\n /**\n * Adjusts the tooltip position.\n */\n tooltipMoveBy?: MoveBy;\n}\n\nexport const ButtonWrapper = ({\n tooltipContent,\n tooltipPosition,\n tooltipHideDelay,\n tooltipShowDelay,\n tooltipContainerSelector,\n tooltipMoveBy,\n ...otherProps\n}: ButtonWrapperProps) => {\n let button = <Button {...otherProps} />;\n if (!isNil(tooltipContent)) {\n button = (\n <Tooltip\n moveBy={tooltipMoveBy}\n position={tooltipPosition}\n hideDelay={tooltipHideDelay}\n showDelay={tooltipShowDelay}\n content={tooltipContent}\n showTrigger={[\"mouseenter\"]}\n hideTrigger={[\"mouseleave\"]}\n containerSelector={tooltipContainerSelector}\n >\n {button}\n </Tooltip>\n );\n }\n\n return button;\n};\n"],"names":["ButtonWrapper","_a","tooltipContent","tooltipPosition","tooltipHideDelay","tooltipShowDelay","tooltipContainerSelector","tooltipMoveBy","otherProps","__rest","button","React","createElement","Button","Object","assign","isNil","Tooltip","moveBy","position","hideDelay","showDelay","content","showTrigger","hideTrigger","containerSelector"],"mappings":"wLAkCaA,EAAgB,SAACC,GAAA,IAC5BC,EAOmBD,EAPnBC,eACAC,EAMmBF,EANnBE,gBACAC,EAKmBH,EALnBG,iBACAC,EAImBJ,EAJnBI,iBACAC,EAGmBL,EAHnBK,yBACAC,EAEmBN,EAFnBM,cACGC,EAAUC,EAAAR,EAPe,uHASxBS,EAASC,EAAAC,cAACC,EAAWC,OAAAC,OAAA,CAAA,EAAAP,IAkBzB,OAjBKQ,EAAMd,KACTQ,EACEC,EAACC,cAAAK,GACCC,OAAQX,EACRY,SAAUhB,EACViB,UAAWhB,EACXiB,UAAWhB,EACXiB,QAASpB,EACTqB,YAAa,CAAC,cACdC,YAAa,CAAC,cACdC,kBAAmBnB,GAElBI,IAKAA,CACT"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Checkbox.js","sources":["../../../../src/components/Checkbox/Checkbox.tsx"],"sourcesContent":["import cx from \"classnames\";\nimport React, { forwardRef, useCallback, useEffect, useMemo, useRef } from \"react\";\nimport { isNil, noop as NOOP } from \"lodash-es\";\nimport Icon from \"../Icon/Icon\";\nimport { Check, Remove } from \"@vibe/icons\";\nimport { useSupportFirefoxLabelClick } from \"./hooks/useSupportFirefoxLabelClick\";\nimport useMergeRef from \"../../hooks/useMergeRef\";\nimport { VibeComponent, VibeComponentProps } from \"../../types\";\nimport { getTestId } from \"../../tests/test-ids-utils\";\nimport { ComponentDefaultTestId, ComponentVibeId } from \"../../tests/constants\";\nimport Text from \"../Text/Text\";\nimport styles from \"./Checkbox.module.scss\";\n\nexport interface CheckBoxProps extends VibeComponentProps {\n
|
|
1
|
+
{"version":3,"file":"Checkbox.js","sources":["../../../../src/components/Checkbox/Checkbox.tsx"],"sourcesContent":["import cx from \"classnames\";\nimport React, { forwardRef, useCallback, useEffect, useMemo, useRef } from \"react\";\nimport { isNil, noop as NOOP } from \"lodash-es\";\nimport Icon from \"../Icon/Icon\";\nimport { Check, Remove } from \"@vibe/icons\";\nimport { useSupportFirefoxLabelClick } from \"./hooks/useSupportFirefoxLabelClick\";\nimport useMergeRef from \"../../hooks/useMergeRef\";\nimport { VibeComponent, VibeComponentProps } from \"../../types\";\nimport { getTestId } from \"../../tests/test-ids-utils\";\nimport { ComponentDefaultTestId, ComponentVibeId } from \"../../tests/constants\";\nimport Text from \"../Text/Text\";\nimport styles from \"./Checkbox.module.scss\";\n\nexport interface CheckBoxProps extends VibeComponentProps {\n /**\n * Class name applied to the checkbox element.\n */\n checkboxClassName?: string;\n /**\n * Class name applied to the label element.\n */\n labelClassName?: string;\n /**\n * The label of the checkbox for accessibility.\n */\n ariaLabel?: string;\n /**\n * The content displayed next to the checkbox.\n */\n label?: React.ReactNode | Array<React.ReactNode>;\n /**\n * The ID of an element describing the checkbox.\n */\n ariaLabelledBy?: string;\n /**\n * Callback fired when the checkbox value changes.\n */\n onChange?: (event: React.ChangeEvent<HTMLInputElement>) => void;\n /**\n * If true, controls the checked state of the checkbox.\n */\n checked?: boolean;\n /**\n * If true, displays an indeterminate state.\n */\n indeterminate?: boolean;\n /**\n * If true, the checkbox automatically receives focus.\n */\n autoFocus?: boolean;\n /**\n * If true, the checkbox is disabled.\n */\n disabled?: boolean;\n /**\n * The initial checked state of the checkbox.\n */\n defaultChecked?: boolean;\n /**\n * The value submitted with the form when checked.\n */\n value?: string;\n /**\n * The name of the checkbox, used for form submission.\n */\n name?: string;\n /**\n * The tab order of the checkbox.\n */\n tabIndex?: number;\n}\n\nconst Checkbox: VibeComponent<CheckBoxProps, HTMLInputElement> = forwardRef(\n (\n {\n className,\n checkboxClassName,\n labelClassName,\n ariaLabel,\n label,\n ariaLabelledBy,\n onChange = NOOP,\n checked,\n autoFocus,\n indeterminate = false,\n disabled = false,\n defaultChecked,\n tabIndex,\n value = \"\",\n name = \"\",\n id,\n \"data-testid\": dataTestId\n }: CheckBoxProps,\n ref\n ) => {\n const inputRef = useRef<HTMLInputElement>(null);\n const mergedInputRef = useMergeRef(ref, inputRef);\n const iconContainerRef = useRef<HTMLDivElement>(null);\n\n const onMouseUpCallback = useCallback(() => {\n const input = inputRef.current;\n if (!input) return;\n\n window.requestAnimationFrame(() => {\n window.requestAnimationFrame(() => {\n input.blur();\n });\n });\n }, [inputRef]);\n let overrideDefaultChecked = defaultChecked;\n\n // If component did not receive default checked and checked props, choose default checked as\n // default behavior (handle isChecked logic inside input) and set default value\n if (isNil(overrideDefaultChecked) && isNil(checked)) {\n overrideDefaultChecked = false;\n }\n\n useEffect(() => {\n if (inputRef.current) {\n inputRef.current.indeterminate = indeterminate;\n }\n }, [inputRef, indeterminate]);\n\n const { onClickCapture: onClickCaptureLabel } = useSupportFirefoxLabelClick({ inputRef });\n\n const finalAriaLabel = useMemo(() => {\n if (ariaLabel) return ariaLabel;\n if (typeof label === \"string\") return label;\n return \"\";\n }, [ariaLabel, label]);\n\n return (\n // eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions\n <label\n className={cx(styles.wrapper, className)}\n onMouseUp={onMouseUpCallback}\n data-testid={dataTestId || getTestId(ComponentDefaultTestId.CHECKBOX, id)}\n htmlFor={id}\n onClickCapture={onClickCaptureLabel}\n >\n <input\n ref={mergedInputRef}\n id={id}\n className={styles.input}\n value={value}\n name={name}\n type=\"checkbox\"\n autoFocus={autoFocus}\n onChange={onChange}\n defaultChecked={overrideDefaultChecked}\n disabled={disabled}\n aria-label={finalAriaLabel}\n aria-labelledby={ariaLabelledBy}\n checked={checked}\n tabIndex={tabIndex}\n />\n <div\n className={cx(styles.checkbox, checkboxClassName)}\n ref={iconContainerRef}\n data-testid={getTestId(ComponentDefaultTestId.CHECKBOX_CHECKBOX, id)}\n data-vibe={ComponentVibeId.CHECKBOX}\n >\n <Icon\n className={styles.icon}\n iconType=\"svg\"\n icon={indeterminate ? Remove : Check}\n ignoreFocusStyle\n ariaHidden={true}\n iconSize=\"16\"\n />\n </div>\n {label === false ? null : (\n <Text\n element=\"span\"\n type=\"text2\"\n className={cx(styles.label, labelClassName)}\n data-testid={getTestId(ComponentDefaultTestId.CHECKBOX_LABEL, id)}\n >\n {label}\n </Text>\n )}\n </label>\n );\n }\n);\n\nexport default Checkbox;\n"],"names":["Checkbox","forwardRef","_ref","ref","className","checkboxClassName","labelClassName","ariaLabel","label","ariaLabelledBy","_ref$onChange","onChange","NOOP","checked","autoFocus","_ref$indeterminate","indeterminate","_ref$disabled","disabled","defaultChecked","tabIndex","_ref$value","value","_ref$name","name","id","dataTestId","inputRef","useRef","mergedInputRef","useMergeRef","iconContainerRef","onMouseUpCallback","useCallback","input","current","window","requestAnimationFrame","blur","overrideDefaultChecked","isNil","useEffect","onClickCaptureLabel","useSupportFirefoxLabelClick","onClickCapture","finalAriaLabel","useMemo","React","createElement","cx","styles","wrapper","onMouseUp","getTestId","ComponentDefaultTestId","CHECKBOX","htmlFor","type","checkbox","CHECKBOX_CHECKBOX","ComponentVibeId","Icon","icon","iconType","Remove","Check","ignoreFocusStyle","ariaHidden","iconSize","Text","element","CHECKBOX_LABEL"],"mappings":"0nBAwEMA,IAAAA,EAA2DC,GAC/D,SAAAC,EAoBEC,GACE,IAnBAC,EAASF,EAATE,UACAC,EAAiBH,EAAjBG,kBACAC,EAAcJ,EAAdI,eACAC,EAASL,EAATK,UACAC,EAAKN,EAALM,MACAC,EAAcP,EAAdO,eAAcC,EAAAR,EACdS,SAAAA,OAAWC,IAAHF,EAAGE,EAAIF,EACfG,EAAOX,EAAPW,QACAC,EAASZ,EAATY,UAASC,EAAAb,EACTc,cAAAA,OAAgB,IAAHD,GAAQA,EAAAE,EAAAf,EACrBgB,SAAAA,OAAW,IAAHD,GAAQA,EAChBE,EAAcjB,EAAdiB,eACAC,EAAQlB,EAARkB,SAAQC,EAAAnB,EACRoB,MAAAA,OAAQ,IAAHD,EAAG,GAAEA,EAAAE,EAAArB,EACVsB,KAAAA,OAAO,IAAHD,EAAG,GAAEA,EACTE,EAAEvB,EAAFuB,GACeC,EAAUxB,EAAzB,eAIIyB,EAAWC,EAAyB,MACpCC,EAAiBC,EAAY3B,EAAKwB,GAClCI,EAAmBH,EAAuB,MAE1CI,EAAoBC,GAAY,WACpC,IAAMC,EAAQP,EAASQ,QAClBD,GAELE,OAAOC,uBAAsB,WAC3BD,OAAOC,uBAAsB,WAC3BH,EAAMI,MACR,GACF,GACF,GAAG,CAACX,IACAY,EAAyBpB,EAIzBqB,EAAMD,IAA2BC,EAAM3B,KACzC0B,GAAyB,GAG3BE,GAAU,WACJd,EAASQ,UACXR,EAASQ,QAAQnB,cAAgBA,EAErC,GAAG,CAACW,EAAUX,IAEd,IAAwB0B,EAAwBC,EAA4B,CAAEhB,SAAAA,IAAtEiB,eAEFC,EAAiBC,GAAQ,WAC7B,OAAIvC,IACiB,iBAAVC,EAA2BA,EAC/B,GACT,GAAG,CAACD,EAAWC,IAEf,OAEEuC,EAAAC,cAAA,QAAA,CACE5C,UAAW6C,EAAGC,EAAOC,QAAS/C,GAC9BgD,UAAWpB,EACE,cAAAN,GAAc2B,EAAUC,EAAuBC,SAAU9B,GACtE+B,QAAS/B,EACTmB,eAAgBF,GAEhBK,EACEC,cAAA,QAAA,CAAA7C,IAAK0B,EACLJ,GAAIA,EACJrB,UAAW8C,EAAOhB,MAClBZ,MAAOA,EACPE,KAAMA,EACNiC,KAAK,WACL3C,UAAWA,EACXH,SAAUA,EACVQ,eAAgBoB,EAChBrB,SAAUA,EACE,aAAA2B,EACK,kBAAApC,EACjBI,QAASA,EACTO,SAAUA,IAEZ2B,EACEC,cAAA,MAAA,CAAA5C,UAAW6C,EAAGC,EAAOQ,SAAUrD,GAC/BF,IAAK4B,EACQ,cAAAsB,EAAUC,EAAuBK,kBAAmBlC,GAAG,YACzDmC,EAAgBL,UAE3BR,EAAAC,cAACa,EAAI,CACHzD,UAAW8C,EAAOY,KAClBC,SAAS,MACTD,KAAM9C,EAAgBgD,EAASC,EAC/BC,kBAAgB,EAChBC,YAAY,EACZC,SAAS,SAGF,IAAV5D,EAAkB,KACjBuC,gBAACsB,EAAI,CACHC,QAAQ,OACRb,KAAK,QACLrD,UAAW6C,EAAGC,EAAO1C,MAAOF,GAAe,cAC9B+C,EAAUC,EAAuBiB,eAAgB9C,IAE7DjB,GAKX"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Chips.js","sources":["../../../../src/components/Chips/Chips.tsx"],"sourcesContent":["import React, { forwardRef, RefObject, useCallback, useMemo, useRef } from \"react\";\nimport cx from \"classnames\";\nimport Icon from \"../Icon/Icon\";\nimport useMergeRef from \"../../hooks/useMergeRef\";\nimport { CloseSmall } from \"@vibe/icons\";\nimport { getCSSVar } from \"../../services/themes\";\nimport { ElementAllowedColor as ElementAllowedColorEnum } from \"../../utils/colors-vars-map\";\nimport { ElementAllowedColor, getElementColor } from \"../../types/Colors\";\nimport Avatar from \"../Avatar/Avatar\";\nimport IconButton from \"../IconButton/IconButton\";\nimport Text from \"../Text/Text\";\nimport { ComponentDefaultTestId, getTestId } from \"../../tests/test-ids-utils\";\nimport { AvatarType as AvatarTypeEnum } from \"../Avatar/AvatarConstants\";\nimport { AvatarType } from \"../Avatar/Avatar.types\";\nimport { ElementContent, SubIcon, VibeComponent, VibeComponentProps, withStaticProps } from \"../../types\";\nimport useHover from \"../../hooks/useHover/useHover\";\nimport useSetFocus from \"../../hooks/useSetFocus\";\nimport useClickableProps from \"../../hooks/useClickableProps/useClickableProps\";\nimport styles from \"./Chips.module.scss\";\n\nconst CHIPS_AVATAR_SIZE = 18;\n\nexport interface ChipsProps extends VibeComponentProps {\n label?: ElementContent;\n disabled?: boolean;\n readOnly?: boolean;\n \"data-testid\"?: string;\n /**\n * A React element that is positioned to the right of the text\n */\n rightRenderer?: ElementContent;\n /**\n * A React element that is positioned to the left of the text\n */\n leftRenderer?: ElementContent;\n /** Icon to place on the right */\n rightIcon?: SubIcon;\n /** Icon to place on the left */\n leftIcon?: SubIcon;\n /** Img to place as avatar on the right */\n rightAvatar?: string;\n /** the type of right avatar */\n rightAvatarType?: AvatarType;\n /** Img to place as avatar on the left */\n leftAvatar?: string;\n /** the type of left avatar */\n leftAvatarType?: AvatarType;\n /** ClassName for left or right icon */\n iconClassName?: string;\n /** ClassName for left or right avatar */\n avatarClassName?: string;\n color?: Exclude<ElementAllowedColor, \"dark_indigo\" | \"blackish\">;\n /** Size for font icon */\n iconSize?: number | string;\n onDelete?: (id: string, event: React.MouseEvent<HTMLSpanElement>) => void;\n /**\n * Disables the Chip's entry animation\n */\n noAnimation?: boolean;\n /**\n * Allow user to select text\n */\n allowTextSelection?: boolean;\n /**\n * Callback function to be called when the user clicks the component.\n */\n onMouseDown?: (event: React.MouseEvent<HTMLDivElement, MouseEvent>) => void;\n /**\n * Callback function to be called when the user clicks the component.\n */\n onClick?: (event: React.MouseEvent<HTMLDivElement, MouseEvent>) => void;\n /**\n * Applies when element has onClick or onMouseDown props\n */\n ariaLabel?: string;\n /**\n * Disable click behaviors\n */\n disableClickableBehavior?: boolean;\n /**\n * Show border, the border color is `--text-color-on-primary`, should be when the chip is a colored background like\n * selected-color\n */\n showBorder?: boolean;\n closeButtonAriaLabel?: string;\n}\n\nconst Chips: VibeComponent<ChipsProps, HTMLDivElement> & {\n colors?: typeof ElementAllowedColorEnum;\n avatarTypes?: typeof AvatarTypeEnum;\n} = forwardRef<HTMLDivElement, ChipsProps>(\n (\n {\n className,\n avatarClassName,\n iconClassName,\n id,\n label = \"\",\n leftIcon = null,\n rightIcon = null,\n leftAvatar = null,\n rightAvatar = null,\n disabled = false,\n readOnly = false,\n allowTextSelection = false,\n color = \"primary\",\n iconSize = 18,\n onDelete = (_id: string, _e: React.MouseEvent<HTMLSpanElement>) => {},\n onMouseDown,\n onClick,\n noAnimation = true,\n ariaLabel,\n \"data-testid\": dataTestId,\n disableClickableBehavior = false,\n leftAvatarType = \"img\",\n rightAvatarType = \"img\",\n showBorder = false,\n leftRenderer,\n rightRenderer,\n closeButtonAriaLabel = \"Remove\"\n }: ChipsProps,\n ref\n ) => {\n const componentDataTestId = dataTestId || getTestId(ComponentDefaultTestId.CHIP, id);\n const hasClickableWrapper = (!!onClick || !!onMouseDown) && !disableClickableBehavior;\n const hasCloseButton = !readOnly && !disabled;\n const overrideAriaLabel = ariaLabel || (typeof label === \"string\" && label) || \"\";\n\n const iconButtonRef = useRef(null);\n const componentRef = useRef(null);\n\n const [hoverRef, isHovered] = useHover<HTMLDivElement>();\n const { isFocused } = useSetFocus({ ref: componentRef });\n\n const mergedRef = useMergeRef<HTMLDivElement>(ref, componentRef, hoverRef);\n\n const overrideClassName = cx(styles.chips, className, {\n [styles.disabled]: disabled,\n [styles.noAnimation]: noAnimation,\n [styles.withUserSelect]: allowTextSelection,\n [styles.border]: showBorder\n });\n const clickableClassName = cx(styles.clickable, overrideClassName, {\n [styles.disabled]: disabled,\n [styles.disableTextSelection]: !allowTextSelection\n });\n\n const backgroundColorStyle = useMemo(() => {\n let cssVar;\n if (disabled) {\n cssVar = getCSSVar(\"disabled-background-color\");\n } else if (hasClickableWrapper && (isHovered || isFocused)) {\n cssVar = getElementColor(color, true, true);\n } else {\n cssVar = getElementColor(color, true);\n }\n return { backgroundColor: cssVar };\n }, [disabled, hasClickableWrapper, isHovered, isFocused, color]);\n\n const onDeleteCallback = useCallback(\n (e: React.MouseEvent<HTMLSpanElement, MouseEvent>) => {\n e.stopPropagation();\n if (onDelete) {\n onDelete(id, e);\n }\n },\n [id, onDelete]\n );\n\n const onClickCallback = useCallback(\n (e: React.MouseEvent<HTMLDivElement, MouseEvent>) => {\n if (onClick !== undefined && (e.target as HTMLElement) !== iconButtonRef.current) {\n e.preventDefault();\n onClick(e);\n }\n },\n [onClick]\n );\n\n const clickableProps = useClickableProps(\n {\n onClick: onClickCallback,\n onMouseDown,\n disabled,\n id,\n \"data-testid\": componentDataTestId,\n ariaLabel: overrideAriaLabel,\n ariaHidden: false,\n ariaHasPopup: false,\n ariaExpanded: false\n },\n mergedRef\n );\n const wrapperProps = hasClickableWrapper\n ? {\n ...clickableProps,\n ref: clickableProps.ref as RefObject<HTMLDivElement>,\n className: clickableClassName,\n style: backgroundColorStyle\n }\n : {\n className: overrideClassName,\n \"aria-label\": overrideAriaLabel,\n style: backgroundColorStyle,\n ref: mergedRef,\n onClick: onClickCallback,\n onMouseDown,\n id: id,\n \"data-testid\": componentDataTestId\n };\n\n const leftAvatarProps = leftAvatarType === \"text\" ? { text: leftAvatar } : { src: leftAvatar };\n const rightAvatarProps = leftAvatarType === \"text\" ? { text: rightAvatar } : { src: rightAvatar };\n\n return (\n <div {...wrapperProps}>\n {leftAvatar ? (\n <Avatar\n withoutBorder\n className={cx(styles.avatar, styles.left, avatarClassName)}\n customSize={CHIPS_AVATAR_SIZE}\n type={leftAvatarType}\n key={id}\n {...leftAvatarProps}\n />\n ) : null}\n {leftIcon ? (\n <Icon\n className={cx(styles.icon, styles.left, iconClassName)}\n iconType=\"font\"\n icon={leftIcon}\n iconSize={iconSize}\n ignoreFocusStyle\n />\n ) : null}\n {leftRenderer && <div className={cx(styles.customRenderer, styles.left)}>{leftRenderer}</div>}\n <Text type=\"text2\" className={styles.label}>\n {label}\n </Text>\n {rightIcon ? (\n <Icon\n className={cx(styles.icon, styles.right, iconClassName)}\n iconType=\"font\"\n icon={rightIcon}\n iconSize={iconSize}\n ignoreFocusStyle\n />\n ) : null}\n {rightAvatar ? (\n <Avatar\n withoutBorder\n className={cx(styles.avatar, styles.right, avatarClassName)}\n customSize={CHIPS_AVATAR_SIZE}\n type={rightAvatarType}\n key={id}\n {...rightAvatarProps}\n />\n ) : null}\n {rightRenderer && <div className={cx(styles.customRenderer, styles.right)}>{rightRenderer}</div>}\n {hasCloseButton && (\n <IconButton\n size=\"xxs\"\n color=\"on-primary-color\"\n className={cx(styles.icon, styles.close)}\n ariaLabel={closeButtonAriaLabel}\n hideTooltip\n icon={CloseSmall}\n onClick={onDeleteCallback}\n data-testid={`${componentDataTestId}-close`}\n ref={iconButtonRef}\n />\n )}\n </div>\n );\n }\n);\n\nexport default withStaticProps(Chips, {\n colors: ElementAllowedColorEnum,\n avatarTypes: AvatarTypeEnum\n});\n"],"names":["withStaticProps","forwardRef","_ref","ref","className","avatarClassName","iconClassName","id","_ref$label","label","_ref$leftIcon","leftIcon","_ref$rightIcon","rightIcon","_ref$leftAvatar","leftAvatar","_ref$rightAvatar","rightAvatar","_ref$disabled","disabled","_ref$readOnly","readOnly","_ref$allowTextSelecti","allowTextSelection","_ref$color","color","_ref$iconSize","iconSize","_ref$onDelete","onDelete","_id","_e","onMouseDown","onClick","_ref$noAnimation","noAnimation","ariaLabel","_ref$disableClickable","disableClickableBehavior","_ref$leftAvatarType","leftAvatarType","_ref$rightAvatarType","rightAvatarType","_ref$showBorder","showBorder","leftRenderer","rightRenderer","_ref$closeButtonAriaL","closeButtonAriaLabel","componentDataTestId","getTestId","ComponentDefaultTestId","CHIP","hasClickableWrapper","hasCloseButton","overrideAriaLabel","iconButtonRef","useRef","componentRef","_useHover","useHover","_useHover2","_slicedToArray","hoverRef","isHovered","isFocused","useSetFocus","mergedRef","useMergeRef","overrideClassName","cx","styles","chips","_defineProperty","withUserSelect","border","clickableClassName","clickable","disableTextSelection","backgroundColorStyle","useMemo","backgroundColor","getCSSVar","getElementColor","onDeleteCallback","useCallback","e","stopPropagation","onClickCallback","undefined","target","current","preventDefault","clickableProps","useClickableProps","ariaHidden","ariaHasPopup","ariaExpanded","wrapperProps","style","leftAvatarProps","text","src","rightAvatarProps","React","createElement","Avatar","withoutBorder","avatar","left","customSize","type","key","Icon","icon","iconType","ignoreFocusStyle","customRenderer","Text","right","IconButton","size","close","hideTooltip","CloseSmall","colors","ElementAllowedColorEnum","avatarTypes","AvatarTypeEnum"],"mappings":"8/BAoBA,IAiQeA,EAAAA,EA3LXC,GACF,SAAAC,EA8BEC,GACE,IA7BAC,EAASF,EAATE,UACAC,EAAeH,EAAfG,gBACAC,EAAaJ,EAAbI,cACAC,EAAEL,EAAFK,GAAEC,EAAAN,EACFO,MAAAA,OAAQ,IAAHD,EAAG,GAAEA,EAAAE,EAAAR,EACVS,SAAAA,OAAW,IAAHD,EAAG,KAAIA,EAAAE,EAAAV,EACfW,UAAAA,OAAY,IAAHD,EAAG,KAAIA,EAAAE,EAAAZ,EAChBa,WAAAA,OAAa,IAAHD,EAAG,KAAIA,EAAAE,EAAAd,EACjBe,YAAAA,OAAc,IAAHD,EAAG,KAAIA,EAAAE,EAAAhB,EAClBiB,SAAAA,OAAW,IAAHD,GAAQA,EAAAE,EAAAlB,EAChBmB,SAAAA,OAAW,IAAHD,GAAQA,EAAAE,EAAApB,EAChBqB,mBAAAA,OAAqB,IAAHD,GAAQA,EAAAE,EAAAtB,EAC1BuB,MAAAA,OAAQ,IAAHD,EAAG,UAASA,EAAAE,EAAAxB,EACjByB,SAAAA,OAAW,IAAHD,EAAG,GAAEA,EAAAE,EAAA1B,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hB,KACHvE,IAAgB2D,EAAKC,cAAA,MAAA,CAAArG,UAAWkE,EAAGC,EAAO8C,eAAgB9C,EAAOsC,OAAQhE,IAC1E2D,EAAAC,cAACa,EAAI,CAACP,KAAK,QAAQ3G,UAAWmE,EAAO9D,OAClCA,GAEFI,EACC2F,EAACC,cAAAQ,GACC7G,UAAWkE,EAAGC,EAAO2C,KAAM3C,EAAOgD,MAAOjH,GACzC6G,SAAS,OACTD,KAAMrG,EACNc,SAAUA,EACVyF,kBAAgB,IAEhB,KACHnG,EACCuF,EAACC,cAAAC,iBACCC,eAAa,EACbvG,UAAWkE,EAAGC,EAAOqC,OAAQrC,EAAOgD,MAAOlH,GAC3CyG,WAxOc,GAyOdC,KAAMrE,GACNsE,IAAKzG,GACDgG,KAEJ,KACHzD,IAAiB0D,EAAKC,cAAA,MAAA,CAAArG,UAAWkE,EAAGC,EAAO8C,eAAgB9C,EAAOgD,QAASzE,IAC3EQ,IACCkD,EAACC,cAAAe,GACCC,KAAK,MACLhG,MAAM,mBACNrB,UAAWkE,EAAGC,EAAO2C,KAAM3C,EAAOmD,OAClCtF,UAAWY,GACX2E,aAAW,EACXT,KAAMU,EACN3F,QAASmD,2BACOnC,GAA2B,UAC3C9C,IAAKqD,KAKf,IAGoC,CACpCqE,OAAQC,EACRC,YAAaC"}
|
|
1
|
+
{"version":3,"file":"Chips.js","sources":["../../../../src/components/Chips/Chips.tsx"],"sourcesContent":["import React, { forwardRef, RefObject, useCallback, useMemo, useRef } from \"react\";\nimport cx from \"classnames\";\nimport Icon from \"../Icon/Icon\";\nimport useMergeRef from \"../../hooks/useMergeRef\";\nimport { CloseSmall } from \"@vibe/icons\";\nimport { getCSSVar } from \"../../services/themes\";\nimport { ElementAllowedColor as ElementAllowedColorEnum } from \"../../utils/colors-vars-map\";\nimport { ElementAllowedColor, getElementColor } from \"../../types/Colors\";\nimport Avatar from \"../Avatar/Avatar\";\nimport IconButton from \"../IconButton/IconButton\";\nimport Text from \"../Text/Text\";\nimport { ComponentDefaultTestId, getTestId } from \"../../tests/test-ids-utils\";\nimport { AvatarType as AvatarTypeEnum } from \"../Avatar/AvatarConstants\";\nimport { AvatarType } from \"../Avatar/Avatar.types\";\nimport { ElementContent, SubIcon, VibeComponent, VibeComponentProps, withStaticProps } from \"../../types\";\nimport useHover from \"../../hooks/useHover/useHover\";\nimport useSetFocus from \"../../hooks/useSetFocus\";\nimport useClickableProps from \"../../hooks/useClickableProps/useClickableProps\";\nimport styles from \"./Chips.module.scss\";\n\nconst CHIPS_AVATAR_SIZE = 18;\n\nexport interface ChipsProps extends VibeComponentProps {\n /**\n * The text or content displayed inside the chip.\n */\n label?: ElementContent;\n /**\n * If true, the chip is disabled.\n */\n disabled?: boolean;\n /**\n * If true, the chip is read-only and cannot be deleted.\n */\n readOnly?: boolean;\n /**\n * A React element displayed on the right side.\n */\n rightRenderer?: ElementContent;\n /**\n * A React element displayed on the left side.\n */\n leftRenderer?: ElementContent;\n /**\n * Icon displayed on the right side.\n */\n rightIcon?: SubIcon;\n /**\n * Icon displayed on the left side.\n */\n leftIcon?: SubIcon;\n /**\n * Image URL or text for an avatar displayed on the right.\n */\n rightAvatar?: string;\n /**\n * The type of avatar displayed on the right.\n */\n rightAvatarType?: AvatarType;\n /**\n * Image URL or text for an avatar displayed on the left.\n */\n leftAvatar?: string;\n /**\n * The type of avatar displayed on the left.\n */\n leftAvatarType?: AvatarType;\n /**\n * Class name applied to left or right icons.\n */\n iconClassName?: string;\n /**\n * Class name applied to left or right avatars.\n */\n avatarClassName?: string;\n /**\n * The background color of the chip.\n */\n color?: Exclude<ElementAllowedColor, \"dark_indigo\" | \"blackish\">;\n /**\n * The size of the icons inside the chip.\n */\n iconSize?: number | string;\n /**\n * Callback fired when the chip is deleted.\n */\n onDelete?: (id: string, event: React.MouseEvent<HTMLSpanElement>) => void;\n /**\n * If true, disables the chip's entry animation.\n */\n noAnimation?: boolean;\n /**\n * If true, allows the user to select text inside the chip.\n */\n allowTextSelection?: boolean;\n /**\n * Callback fired when the mouse button is pressed on the chip.\n */\n onMouseDown?: (event: React.MouseEvent<HTMLDivElement, MouseEvent>) => void;\n /**\n * Callback fired when the chip is clicked.\n */\n onClick?: (event: React.MouseEvent<HTMLDivElement, MouseEvent>) => void;\n /**\n * The label of the chip for accessibility.\n */\n ariaLabel?: string;\n /**\n * If true, disables all click behaviors.\n */\n disableClickableBehavior?: boolean;\n /**\n * If true, displays a border around the chip.\n */\n showBorder?: boolean;\n /**\n * The label for the close button.\n */\n closeButtonAriaLabel?: string;\n}\n\nconst Chips: VibeComponent<ChipsProps, HTMLDivElement> & {\n colors?: typeof ElementAllowedColorEnum;\n avatarTypes?: typeof AvatarTypeEnum;\n} = forwardRef<HTMLDivElement, ChipsProps>(\n (\n {\n className,\n avatarClassName,\n iconClassName,\n id,\n label = \"\",\n leftIcon = null,\n rightIcon = null,\n leftAvatar = null,\n rightAvatar = null,\n disabled = false,\n readOnly = false,\n allowTextSelection = false,\n color = \"primary\",\n iconSize = 18,\n onDelete = (_id: string, _e: React.MouseEvent<HTMLSpanElement>) => {},\n onMouseDown,\n onClick,\n noAnimation = true,\n ariaLabel,\n \"data-testid\": dataTestId,\n disableClickableBehavior = false,\n leftAvatarType = \"img\",\n rightAvatarType = \"img\",\n showBorder = false,\n leftRenderer,\n rightRenderer,\n closeButtonAriaLabel = \"Remove\"\n }: ChipsProps,\n ref\n ) => {\n const componentDataTestId = dataTestId || getTestId(ComponentDefaultTestId.CHIP, id);\n const hasClickableWrapper = (!!onClick || !!onMouseDown) && !disableClickableBehavior;\n const hasCloseButton = !readOnly && !disabled;\n const overrideAriaLabel = ariaLabel || (typeof label === \"string\" && label) || \"\";\n\n const iconButtonRef = useRef(null);\n const componentRef = useRef(null);\n\n const [hoverRef, isHovered] = useHover<HTMLDivElement>();\n const { isFocused } = useSetFocus({ ref: componentRef });\n\n const mergedRef = useMergeRef<HTMLDivElement>(ref, componentRef, hoverRef);\n\n const overrideClassName = cx(styles.chips, className, {\n [styles.disabled]: disabled,\n [styles.noAnimation]: noAnimation,\n [styles.withUserSelect]: allowTextSelection,\n [styles.border]: showBorder\n });\n const clickableClassName = cx(styles.clickable, overrideClassName, {\n [styles.disabled]: disabled,\n [styles.disableTextSelection]: !allowTextSelection\n });\n\n const backgroundColorStyle = useMemo(() => {\n let cssVar;\n if (disabled) {\n cssVar = getCSSVar(\"disabled-background-color\");\n } else if (hasClickableWrapper && (isHovered || isFocused)) {\n cssVar = getElementColor(color, true, true);\n } else {\n cssVar = getElementColor(color, true);\n }\n return { backgroundColor: cssVar };\n }, [disabled, hasClickableWrapper, isHovered, isFocused, color]);\n\n const onDeleteCallback = useCallback(\n (e: React.MouseEvent<HTMLSpanElement, MouseEvent>) => {\n e.stopPropagation();\n if (onDelete) {\n onDelete(id, e);\n }\n },\n [id, onDelete]\n );\n\n const onClickCallback = useCallback(\n (e: React.MouseEvent<HTMLDivElement, MouseEvent>) => {\n if (onClick !== undefined && (e.target as HTMLElement) !== iconButtonRef.current) {\n e.preventDefault();\n onClick(e);\n }\n },\n [onClick]\n );\n\n const clickableProps = useClickableProps(\n {\n onClick: onClickCallback,\n onMouseDown,\n disabled,\n id,\n \"data-testid\": componentDataTestId,\n ariaLabel: overrideAriaLabel,\n ariaHidden: false,\n ariaHasPopup: false,\n ariaExpanded: false\n },\n mergedRef\n );\n const wrapperProps = hasClickableWrapper\n ? {\n ...clickableProps,\n ref: clickableProps.ref as RefObject<HTMLDivElement>,\n className: clickableClassName,\n style: backgroundColorStyle\n }\n : {\n className: overrideClassName,\n \"aria-label\": overrideAriaLabel,\n style: backgroundColorStyle,\n ref: mergedRef,\n onClick: onClickCallback,\n onMouseDown,\n id: id,\n \"data-testid\": componentDataTestId\n };\n\n const leftAvatarProps = leftAvatarType === \"text\" ? { text: leftAvatar } : { src: leftAvatar };\n const rightAvatarProps = leftAvatarType === \"text\" ? { text: rightAvatar } : { src: rightAvatar };\n\n return (\n <div {...wrapperProps}>\n {leftAvatar ? (\n <Avatar\n withoutBorder\n className={cx(styles.avatar, styles.left, avatarClassName)}\n customSize={CHIPS_AVATAR_SIZE}\n type={leftAvatarType}\n key={id}\n {...leftAvatarProps}\n />\n ) : null}\n {leftIcon ? (\n <Icon\n className={cx(styles.icon, styles.left, iconClassName)}\n iconType=\"font\"\n icon={leftIcon}\n iconSize={iconSize}\n ignoreFocusStyle\n />\n ) : null}\n {leftRenderer && <div className={cx(styles.customRenderer, styles.left)}>{leftRenderer}</div>}\n <Text type=\"text2\" className={styles.label}>\n {label}\n </Text>\n {rightIcon ? (\n <Icon\n className={cx(styles.icon, styles.right, iconClassName)}\n iconType=\"font\"\n icon={rightIcon}\n iconSize={iconSize}\n ignoreFocusStyle\n />\n ) : null}\n {rightAvatar ? (\n <Avatar\n withoutBorder\n className={cx(styles.avatar, styles.right, avatarClassName)}\n customSize={CHIPS_AVATAR_SIZE}\n type={rightAvatarType}\n key={id}\n {...rightAvatarProps}\n />\n ) : null}\n {rightRenderer && <div className={cx(styles.customRenderer, styles.right)}>{rightRenderer}</div>}\n {hasCloseButton && (\n <IconButton\n size=\"xxs\"\n color=\"on-primary-color\"\n className={cx(styles.icon, styles.close)}\n ariaLabel={closeButtonAriaLabel}\n hideTooltip\n icon={CloseSmall}\n onClick={onDeleteCallback}\n data-testid={`${componentDataTestId}-close`}\n ref={iconButtonRef}\n />\n )}\n </div>\n );\n }\n);\n\nexport default withStaticProps(Chips, {\n colors: ElementAllowedColorEnum,\n avatarTypes: AvatarTypeEnum\n});\n"],"names":["withStaticProps","forwardRef","_ref","ref","className","avatarClassName","iconClassName","id","_ref$label","label","_ref$leftIcon","leftIcon","_ref$rightIcon","rightIcon","_ref$leftAvatar","leftAvatar","_ref$rightAvatar","rightAvatar","_ref$disabled","disabled","_ref$readOnly","readOnly","_ref$allowTextSelecti","allowTextSelection","_ref$color","color","_ref$iconSize","iconSize","_ref$onDelete","onDelete","_id","_e","onMouseDown","onClick","_ref$noAnimation","noAnimation","ariaLabel","_ref$disableClickable","disableClickableBehavior","_ref$leftAvatarType","leftAvatarType","_ref$rightAvatarType","rightAvatarType","_ref$showBorder","showBorder","leftRenderer","rightRenderer","_ref$closeButtonAriaL","closeButtonAriaLabel","componentDataTestId","getTestId","ComponentDefaultTestId","CHIP","hasClickableWrapper","hasCloseButton","overrideAriaLabel","iconButtonRef","useRef","componentRef","_useHover","useHover","_useHover2","_slicedToArray","hoverRef","isHovered","isFocused","useSetFocus","mergedRef","useMergeRef","overrideClassName","cx","styles","chips","_defineProperty","withUserSelect","border","clickableClassName","clickable","disableTextSelection","backgroundColorStyle","useMemo","backgroundColor","getCSSVar","getElementColor","onDeleteCallback","useCallback","e","stopPropagation","onClickCallback","undefined","target","current","preventDefault","clickableProps","useClickableProps","ariaHidden","ariaHasPopup","ariaExpanded","wrapperProps","style","leftAvatarProps","text","src","rightAvatarProps","React","createElement","Avatar","withoutBorder","avatar","left","customSize","type","key","Icon","icon","iconType","ignoreFocusStyle","customRenderer","Text","right","IconButton","size","close","hideTooltip","CloseSmall","colors","ElementAllowedColorEnum","avatarTypes","AvatarTypeEnum"],"mappings":"8/BAoBA,IAmSeA,EAAAA,EA3LXC,GACF,SAAAC,EA8BEC,GACE,IA7BAC,EAASF,EAATE,UACAC,EAAeH,EAAfG,gBACAC,EAAaJ,EAAbI,cACAC,EAAEL,EAAFK,GAAEC,EAAAN,EACFO,MAAAA,OAAQ,IAAHD,EAAG,GAAEA,EAAAE,EAAAR,EACVS,SAAAA,OAAW,IAAHD,EAAG,KAAIA,EAAAE,EAAAV,EACfW,UAAAA,OAAY,IAAHD,EAAG,KAAIA,EAAAE,EAAAZ,EAChBa,WAAAA,OAAa,IAAHD,EAAG,KAAIA,EAAAE,EAAAd,EACjBe,YAAAA,OAAc,IAAHD,EAAG,KAAIA,EAAAE,EAAAhB,EAClBiB,SAAAA,OAAW,IAAHD,GAAQA,EAAAE,EAAAlB,EAChBmB,SAAAA,OAAW,IAAHD,GAAQA,EAAAE,EAAApB,EAChBqB,mBAAAA,OAAqB,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ACHzF,EACC6F,EAACC,cAAAQ,GACC7G,UAAWkE,EAAGC,EAAO2C,KAAM3C,EAAOsC,KAAMvG,GACxC6G,SAAS,OACTD,KAAMvG,EACNgB,SAAUA,EACVyF,kBAAgB,IAEhB,KACHvE,IAAgB2D,EAAKC,cAAA,MAAA,CAAArG,UAAWkE,EAAGC,EAAO8C,eAAgB9C,EAAOsC,OAAQhE,IAC1E2D,EAAAC,cAACa,EAAI,CAACP,KAAK,QAAQ3G,UAAWmE,EAAO9D,OAClCA,GAEFI,EACC2F,EAACC,cAAAQ,GACC7G,UAAWkE,EAAGC,EAAO2C,KAAM3C,EAAOgD,MAAOjH,GACzC6G,SAAS,OACTD,KAAMrG,EACNc,SAAUA,EACVyF,kBAAgB,IAEhB,KACHnG,EACCuF,EAACC,cAAAC,iBACCC,eAAa,EACbvG,UAAWkE,EAAGC,EAAOqC,OAAQrC,EAAOgD,MAAOlH,GAC3CyG,WA1Qc,GA2QdC,KAAMrE,GACNsE,IAAKzG,GACDgG,KAEJ,KACHzD,IAAiB0D,EAAKC,cAAA,MAAA,CAAArG,UAAWkE,EAAGC,EAAO8C,eAAgB9C,EAAOgD,QAASzE,IAC3EQ,IACCkD,EAACC,cAAAe,GACCC,KAAK,MACLhG,MAAM,mBACNrB,UAAWkE,EAAGC,EAAO2C,KAAM3C,EAAOmD,OAClCtF,UAAWY,GACX2E,aAAW,EACXT,KAAMU,EACN3F,QAASmD,2BACOnC,GAA2B,UAC3C9C,IAAKqD,KAKf,IAGoC,CACpCqE,OAAQC,EACRC,YAAaC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Clickable.js","sources":["../../../../src/components/Clickable/Clickable.tsx"],"sourcesContent":["import cx from \"classnames\";\nimport React, { AriaRole, forwardRef } from \"react\";\nimport { noop as NOOP } from \"lodash-es\";\nimport VibeComponentProps from \"../../types/VibeComponentProps\";\nimport VibeComponent from \"../../types/VibeComponent\";\nimport useClickableProps from \"../../hooks/useClickableProps/useClickableProps\";\nimport styles from \"./Clickable.module.scss\";\n\nexport interface ClickableProps extends VibeComponentProps {\n /**\n * The
|
|
1
|
+
{"version":3,"file":"Clickable.js","sources":["../../../../src/components/Clickable/Clickable.tsx"],"sourcesContent":["import cx from \"classnames\";\nimport React, { AriaRole, forwardRef } from \"react\";\nimport { noop as NOOP } from \"lodash-es\";\nimport VibeComponentProps from \"../../types/VibeComponentProps\";\nimport VibeComponent from \"../../types/VibeComponent\";\nimport useClickableProps from \"../../hooks/useClickableProps/useClickableProps\";\nimport styles from \"./Clickable.module.scss\";\n\nexport interface ClickableProps extends VibeComponentProps {\n /**\n * The HTML element or custom component used as the root.\n */\n elementType?: keyof JSX.IntrinsicElements | string;\n /**\n * The content inside the clickable element.\n */\n children?: React.ReactNode;\n /**\n * The ARIA role of the element.\n */\n role?: AriaRole;\n /**\n * Callback fired when the element is clicked.\n */\n onClick?: (event: React.MouseEvent | React.KeyboardEvent) => void;\n /**\n * If true, allows text selection inside the element.\n */\n enableTextSelection?: boolean;\n /**\n * Callback fired when the mouse button is pressed down on the element.\n */\n onMouseDown?: (event: React.MouseEvent) => void;\n /**\n * Callback fired when the mouse enters the element.\n */\n onMouseEnter?: (event: React.MouseEvent) => void;\n /**\n * Callback fired when the mouse leaves the element.\n */\n onMouseLeave?: (event: React.MouseEvent) => void;\n /**\n * The label of the element for accessibility.\n */\n ariaLabel?: string;\n /**\n * If true, hides the element from assistive technologies.\n */\n ariaHidden?: boolean;\n // TODO: [breaking] remove string type\n /**\n * Indicates the presence of a popup associated with the element.\n */\n ariaHasPopup?: boolean | string;\n /**\n * If true, indicates that the associated popup is open.\n */\n ariaExpanded?: boolean;\n // TODO: [breaking] remove string type\n /**\n * The tab order of the element.\n */\n tabIndex?: string | number;\n /**\n * If true, the element is disabled.\n */\n disabled?: boolean;\n /**\n * Inline styles applied to the element.\n */\n style?: React.CSSProperties;\n}\n\nconst Clickable: VibeComponent<ClickableProps, HTMLElement> = forwardRef(\n (\n {\n elementType = \"div\",\n className = \"\",\n id,\n children,\n role = \"button\",\n onClick = NOOP,\n enableTextSelection = false,\n onMouseDown = NOOP,\n onMouseEnter = NOOP,\n onMouseLeave = NOOP,\n ariaLabel,\n ariaHidden,\n ariaHasPopup,\n ariaExpanded,\n tabIndex = \"0\",\n disabled = false,\n style,\n \"data-testid\": dataTestId\n }: ClickableProps,\n ref: React.ForwardedRef<HTMLElement>\n ) => {\n const clickableProps = useClickableProps(\n {\n onClick,\n onMouseDown,\n onMouseEnter,\n onMouseLeave,\n disabled,\n id,\n \"data-testid\": dataTestId,\n role,\n tabIndex,\n ariaLabel,\n ariaHidden,\n ariaHasPopup,\n ariaExpanded\n },\n ref\n );\n const overrideClassName = cx(styles.clickable, className, {\n [styles.disabled]: disabled,\n [styles.disableTextSelection]: !enableTextSelection\n });\n\n return React.createElement(\n elementType,\n {\n ...clickableProps,\n className: overrideClassName,\n style: style\n },\n children\n );\n }\n);\n\nexport default Clickable;\n"],"names":["Clickable","forwardRef","_ref","ref","_ref$elementType","elementType","_ref$className","className","children","_ref$role","role","_ref$onClick","onClick","_ref$enableTextSelect","enableTextSelection","_ref$onMouseDown","onMouseDown","_ref$onMouseEnter","onMouseEnter","_ref$onMouseLeave","onMouseLeave","_ref$tabIndex","tabIndex","_ref$disabled","disabled","style","clickableProps","useClickableProps","NOOP","id","ariaLabel","ariaHidden","ariaHasPopup","ariaExpanded","overrideClassName","cx","styles","clickable","_defineProperty","disableTextSelection","React","createElement","Object","assign"],"mappings":"6RAyEMA,IAAAA,EAAwDC,GAC5D,SAAAC,EAqBEC,GACE,IAAAC,EAAAF,EApBAG,YAAAA,OAAc,IAAHD,EAAG,MAAKA,EAAAE,EAAAJ,EACnBK,UAAAA,OAAY,IAAHD,EAAG,GAAEA,EAEdE,EAAQN,EAARM,SAAQC,EAAAP,EACRQ,KAAeC,EAAAT,EACfU,QAAcC,EAAAX,EACdY,oBAAAA,OAAsB,IAAHD,GAAQA,EAAAE,EAAAb,EAC3Bc,YAAkBC,EAAAf,EAClBgB,aAAmBC,EAAAjB,EACnBkB,aAIYC,EAAAnB,EACZoB,SAAcC,EAAArB,EACdsB,SAAAA,OAAW,IAAHD,GAAQA,EAChBE,EAAKvB,EAALuB,MAKIC,EAAiBC,EACrB,CACEf,aAlBQgB,IAAHjB,EAAGiB,EAAIjB,EAmBZK,iBAjBYY,IAAHb,EAAGa,EAAIb,EAkBhBG,kBAjBaU,IAAHX,EAAGW,EAAIX,EAkBjBG,kBAjBaQ,IAAHT,EAAGS,EAAIT,EAkBjBK,SAAAA,EACAK,GA1BA3B,EAAF2B,GA2BE,cAZuB3B,EAAzB,eAaEQ,UA1BK,IAAHD,EAAG,SAAQA,EA2Bba,cAjBS,IAAHD,EAAG,IAAGA,EAkBZS,UAtBO5B,EAAT4B,UAuBEC,WAtBQ7B,EAAV6B,WAuBEC,aAtBU9B,EAAZ8B,aAuBEC,aAtBU/B,EAAZ+B,cAwBA9B,GAEI+B,EAAoBC,EAAGC,EAAOC,UAAW9B,EAAS+B,EAAAA,EACrDF,CAAAA,EAAAA,EAAOZ,SAAWA,GAClBY,EAAOG,sBAAwBzB,IAGlC,OAAO0B,EAAMC,cACXpC,EAAWqC,OAAAC,OAAAD,OAAAC,OAAA,GAENjB,GACH,CAAAnB,UAAW2B,EACXT,MAAOA,IAETjB,EAEJ"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ClickableWrapper.js","sources":["../../../../src/components/Clickable/ClickableWrapper.tsx"],"sourcesContent":["import React, { forwardRef } from \"react\";\nimport Clickable from \"./Clickable\";\nimport VibeComponentProps from \"../../types/VibeComponentProps\";\nimport VibeComponent from \"../../types/VibeComponent\";\nimport { ClickableProps } from \"../Clickable/Clickable\";\n\nexport interface ClickableWrapperProps extends VibeComponentProps {\n children: React.ReactNode;\n isClickable: boolean;\n clickableProps: ClickableProps;\n}\n\nconst ClickableWrapper: VibeComponent<ClickableWrapperProps, HTMLElement> = forwardRef(\n ({ children, isClickable = true, clickableProps = {} }: ClickableWrapperProps, ref) => {\n if (!isClickable) {\n return <>{children}</>;\n }\n\n return (\n <Clickable {...clickableProps} ref={ref}>\n {children}\n </Clickable>\n );\n }\n);\n\nexport default ClickableWrapper;\n"],"names":["ClickableWrapper","forwardRef","_ref","ref","children","_ref$isClickable","isClickable","_ref$clickableProps","clickableProps","React","createElement","Clickable","Object","assign","Fragment"],"mappings":"
|
|
1
|
+
{"version":3,"file":"ClickableWrapper.js","sources":["../../../../src/components/Clickable/ClickableWrapper.tsx"],"sourcesContent":["import React, { forwardRef } from \"react\";\nimport Clickable from \"./Clickable\";\nimport VibeComponentProps from \"../../types/VibeComponentProps\";\nimport VibeComponent from \"../../types/VibeComponent\";\nimport { ClickableProps } from \"../Clickable/Clickable\";\n\nexport interface ClickableWrapperProps extends VibeComponentProps {\n /**\n * The content inside the wrapper.\n */\n children: React.ReactNode;\n /**\n * If true, wraps the content in a `Clickable` component.\n */\n isClickable: boolean;\n /**\n * Props passed to the `Clickable` component.\n */\n clickableProps: ClickableProps;\n}\n\nconst ClickableWrapper: VibeComponent<ClickableWrapperProps, HTMLElement> = forwardRef(\n ({ children, isClickable = true, clickableProps = {} }: ClickableWrapperProps, ref) => {\n if (!isClickable) {\n return <>{children}</>;\n }\n\n return (\n <Clickable {...clickableProps} ref={ref}>\n {children}\n </Clickable>\n );\n }\n);\n\nexport default ClickableWrapper;\n"],"names":["ClickableWrapper","forwardRef","_ref","ref","children","_ref$isClickable","isClickable","_ref$clickableProps","clickableProps","React","createElement","Clickable","Object","assign","Fragment"],"mappings":"oEAqBMA,IAAAA,EAAsEC,GAC1E,SAAAC,EAA+EC,GAAO,IAAnFC,EAAQF,EAARE,SAAQC,EAAAH,EAAEI,YAAkBC,EAAAL,EAAEM,eAC/B,YADyB,IAAHH,GAAOA,EAM3BI,EAAAC,cAACC,EAASC,OAAAC,OAAA,CAAA,OANiC,IAAAN,EAAG,CAAA,EAAEA,EAMnB,CAAEJ,IAAKA,IACjCC,GALIK,EAAAC,cAAAD,EAAAK,SAAA,KAAGV,EAQd"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ColorPicker.js","sources":["../../../../src/components/ColorPicker/ColorPicker.tsx"],"sourcesContent":["import cx from \"classnames\";\nimport React, { forwardRef, useCallback, useRef } from \"react\";\nimport { BaseSizes } from \"../../constants\";\nimport useMergeRef from \"../../hooks/useMergeRef\";\nimport DialogContentContainer from \"../DialogContentContainer/DialogContentContainer\";\nimport { ColorStyle as ColorStyleEnum } from \"../../utils/colors-vars-map\";\nimport { NoColor } from \"@vibe/icons\";\nimport ColorPickerContent from \"./components/ColorPickerContent/ColorPickerContent\";\nimport { ColorShapes as ColorShapesEnum, DEFAULT_NUMBER_OF_COLORS_IN_LINE } from \"./ColorPickerConstants\";\nimport { ColorShapes, ColorPickerSizes, ColorPickerValue, ColorPickerArrayValueOnly } from \"./ColorPicker.types\";\nimport { calculateColorPickerDialogWidth } from \"./services/ColorPickerStyleService\";\nimport { VibeComponentProps, VibeComponent, SubIcon, withStaticProps } from \"../../types\";\nimport { NOOP } from \"../../utils/function-utils\";\nimport { ComponentDefaultTestId, getTestId } from \"../../tests/test-ids-utils\";\nimport styles from \"./ColorPicker.module.scss\";\nimport { ColorStyle } from \"../../types/Colors\";\nimport { ComponentVibeId } from \"../../tests/constants\";\n\nexport interface ColorPickerProps extends VibeComponentProps {\n value?: ColorPickerValue;\n onSave?: (value: ColorPickerArrayValueOnly) => void;\n ColorIndicatorIcon?: SubIcon;\n SelectedIndicatorIcon?: SubIcon;\n /**\n *
|
|
1
|
+
{"version":3,"file":"ColorPicker.js","sources":["../../../../src/components/ColorPicker/ColorPicker.tsx"],"sourcesContent":["import cx from \"classnames\";\nimport React, { forwardRef, useCallback, useRef } from \"react\";\nimport { BaseSizes } from \"../../constants\";\nimport useMergeRef from \"../../hooks/useMergeRef\";\nimport DialogContentContainer from \"../DialogContentContainer/DialogContentContainer\";\nimport { ColorStyle as ColorStyleEnum } from \"../../utils/colors-vars-map\";\nimport { NoColor } from \"@vibe/icons\";\nimport ColorPickerContent from \"./components/ColorPickerContent/ColorPickerContent\";\nimport { ColorShapes as ColorShapesEnum, DEFAULT_NUMBER_OF_COLORS_IN_LINE } from \"./ColorPickerConstants\";\nimport { ColorShapes, ColorPickerSizes, ColorPickerValue, ColorPickerArrayValueOnly } from \"./ColorPicker.types\";\nimport { calculateColorPickerDialogWidth } from \"./services/ColorPickerStyleService\";\nimport { VibeComponentProps, VibeComponent, SubIcon, withStaticProps } from \"../../types\";\nimport { NOOP } from \"../../utils/function-utils\";\nimport { ComponentDefaultTestId, getTestId } from \"../../tests/test-ids-utils\";\nimport styles from \"./ColorPicker.module.scss\";\nimport { ColorStyle } from \"../../types/Colors\";\nimport { ComponentVibeId } from \"../../tests/constants\";\n\nexport interface ColorPickerProps extends VibeComponentProps {\n /**\n * The selected color(s).\n */\n value?: ColorPickerValue;\n /**\n * Callback fired when the selected color(s) change.\n */\n onSave?: (value: ColorPickerArrayValueOnly) => void;\n /**\n * Icon displayed as an indicator inside the color.\n */\n ColorIndicatorIcon?: SubIcon;\n /**\n * Icon displayed when a color is selected.\n */\n SelectedIndicatorIcon?: SubIcon;\n /**\n * Icon used for clearing the color selection.\n */\n NoColorIcon?: SubIcon;\n /**\n * The style applied to the colors.\n */\n colorStyle?: ColorStyle;\n /**\n * Text displayed for the \"no color\" option.\n */\n noColorText?: string;\n /**\n * If true, renders the color indicator without a background.\n */\n shouldRenderIndicatorWithoutBackground?: boolean;\n /**\n * If true, treats the color list as a blacklist rather than a whitelist.\n */\n isBlackListMode?: boolean;\n /**\n * The list of colors available for selection.\n */\n colorsList?: ColorPickerArrayValueOnly;\n /**\n * If true, allows selecting multiple colors.\n */\n isMultiselect?: boolean;\n /**\n * The size of the color items.\n */\n colorSize?: ColorPickerSizes;\n /**\n * The number of colors displayed per row.\n */\n numberOfColorsInLine?: number;\n /**\n * If true, the first color is focused when the component mounts.\n */\n focusOnMount?: boolean;\n /**\n * The shape of the color items.\n */\n colorShape?: ColorShapes;\n /**\n * Used to force the component render the colorList prop as is. Usually, this flag should not be used. It's intended only for edge cases.\n * Usually, only \"monday colors\" will be rendered (unless blacklist mode is used). This flag will override this behavior.\n */\n forceUseRawColorList?: boolean;\n /**\n * Used to enable color name tooltip on each color in the component.\n * When \"tooltipContentByColor\" is supplied, it will override the color name tooltip.\n *\n */\n showColorNameTooltip?: boolean;\n}\n\nconst ColorPicker: VibeComponent<ColorPickerProps> & {\n sizes?: typeof BaseSizes;\n colorStyles?: typeof ColorStyleEnum;\n colorSizes?: typeof BaseSizes;\n colorShapes?: typeof ColorShapesEnum;\n} = forwardRef(\n (\n {\n className,\n onSave = NOOP,\n value = \"\",\n noColorText,\n colorStyle = \"regular\",\n ColorIndicatorIcon,\n SelectedIndicatorIcon,\n shouldRenderIndicatorWithoutBackground,\n NoColorIcon = NoColor,\n isBlackListMode = true,\n colorsList = [],\n isMultiselect,\n colorSize = \"medium\",\n numberOfColorsInLine = DEFAULT_NUMBER_OF_COLORS_IN_LINE,\n focusOnMount,\n colorShape = \"square\",\n forceUseRawColorList,\n showColorNameTooltip,\n id,\n \"data-testid\": dataTestId\n }: ColorPickerProps,\n ref\n ) => {\n const componentRef = useRef(null);\n const mergedRef = useMergeRef(ref, componentRef);\n\n const onChange = useCallback(onSave, [onSave]);\n\n const width = calculateColorPickerDialogWidth(colorSize as BaseSizes, numberOfColorsInLine);\n\n return (\n <DialogContentContainer\n ref={mergedRef}\n className={cx(styles.colorPicker, styles.colorPickerDialogContent, className)}\n ariaLabelledby=\"Color Picker Dialog\"\n ariaDescribedby=\"Pick color\"\n style={{ width }}\n >\n <ColorPickerContent\n onValueChange={onChange}\n value={value}\n noColorText={noColorText}\n shouldRenderIndicatorWithoutBackground={ColorIndicatorIcon && shouldRenderIndicatorWithoutBackground}\n colorStyle={colorStyle}\n ColorIndicatorIcon={ColorIndicatorIcon}\n SelectedIndicatorIcon={SelectedIndicatorIcon}\n NoColorIcon={NoColorIcon}\n colorsList={colorsList}\n isBlackListMode={isBlackListMode}\n isMultiselect={isMultiselect}\n colorSize={colorSize}\n numberOfColorsInLine={numberOfColorsInLine}\n focusOnMount={focusOnMount}\n colorShape={colorShape}\n forceUseRawColorList={forceUseRawColorList}\n showColorNameTooltip={showColorNameTooltip}\n id={id}\n data-testid={dataTestId || getTestId(ComponentDefaultTestId.COLOR_PICKER, id)}\n data-vibe={ComponentVibeId.COLOR_PICKER}\n />\n </DialogContentContainer>\n );\n }\n);\n\nexport default withStaticProps(ColorPicker, {\n sizes: BaseSizes,\n colorStyles: ColorStyleEnum,\n colorSizes: BaseSizes,\n colorShapes: ColorShapesEnum\n});\n"],"names":["withStaticProps","forwardRef","_ref","ref","className","_ref$onSave","onSave","NOOP","_ref$value","value","noColorText","_ref$colorStyle","colorStyle","ColorIndicatorIcon","SelectedIndicatorIcon","shouldRenderIndicatorWithoutBackground","_ref$NoColorIcon","NoColorIcon","NoColor","_ref$isBlackListMode","isBlackListMode","_ref$colorsList","colorsList","isMultiselect","_ref$colorSize","colorSize","_ref$numberOfColorsIn","numberOfColorsInLine","DEFAULT_NUMBER_OF_COLORS_IN_LINE","focusOnMount","_ref$colorShape","colorShape","forceUseRawColorList","showColorNameTooltip","id","dataTestId","componentRef","useRef","mergedRef","useMergeRef","onChange","useCallback","width","calculateColorPickerDialogWidth","React","createElement","DialogContentContainer","cx","styles","colorPicker","colorPickerDialogContent","ariaLabelledby","ariaDescribedby","style","ColorPickerContent","onValueChange","getTestId","ComponentDefaultTestId","COLOR_PICKER","ComponentVibeId","sizes","BaseSizes","colorStyles","ColorStyleEnum","colorSizes","colorShapes","ColorShapesEnum"],"mappings":"s5BA4FA,IAyEeA,EAAAA,EApEXC,GACF,SAAAC,EAuBEC,GACE,IAtBAC,EAASF,EAATE,UAASC,EAAAH,EACTI,OAAAA,OAASC,IAAHF,EAAGE,EAAIF,EAAAG,EAAAN,EACbO,MAAAA,OAAQ,IAAHD,EAAG,GAAEA,EACVE,EAAWR,EAAX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AuBC,aAAcxB,GAC/D,YAAAyB,EAAgBD,eAInC,IAG0C,CAC1CE,MAAOC,EACPC,YAAaC,EACbC,WAAYH,EACZI,YAAaC"}
|
package/dist/src/components/ColorPicker/components/ColorPickerContent/ColorPickerClearButton.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ColorPickerClearButton.js","sources":["../../../../../../src/components/ColorPicker/components/ColorPickerContent/ColorPickerClearButton.tsx"],"sourcesContent":["import React from \"react\";\nimport useGridKeyboardNavigation from \"../../../../hooks/useGridKeyboardNavigation/useGridKeyboardNavigation\";\nimport Button from \"../../../Button/Button\";\nimport { VibeComponentProps, VibeComponent, SubIcon } from \"../../../../types\";\nimport { NOOP } from \"../../../../utils/function-utils\";\nimport styles from \"./ColorPickerClearButton.module.scss\";\n\nexport interface ColorPickerClearButtonProps extends VibeComponentProps {\n onClick: () => void;\n text?: string;\n Icon: SubIcon;\n}\n\nexport const ColorPickerClearButton: VibeComponent<ColorPickerClearButtonProps> = React.forwardRef(\n ({ onClick, text, Icon }: ColorPickerClearButtonProps, ref) => {\n const { onSelectionAction } = useGridKeyboardNavigation({\n ref: ref as React.MutableRefObject<HTMLElement>,\n itemsCount: 1,\n numberOfItemsInLine: 1,\n onItemClicked: onClick,\n getItemByIndex: NOOP //hack - we don't really have a grid, it's just for keyboard navigation outside the clear button\n });\n\n return (\n <Button\n ref={ref}\n size=\"small\"\n kind=\"tertiary\"\n onClick={() => onSelectionAction(-1)} //hack - we don't really have a grid, it's just for keyboard navigation outside the clear button\n blurOnMouseUp={false}\n className={styles.clearColorButton}\n >\n <Icon size=\"16\" className={styles.clearColorIcon} />\n {text || \"Clear\"}\n </Button>\n );\n }\n);\n"],"names":["ColorPickerClearButton","React","forwardRef","_ref","ref","text","Icon","onSelectionAction","useGridKeyboardNavigation","itemsCount","numberOfItemsInLine","onItemClicked","onClick","getItemByIndex","NOOP","createElement","Button","size","kind","blurOnMouseUp","className","styles","clearColorButton","clearColorIcon"],"mappings":"
|
|
1
|
+
{"version":3,"file":"ColorPickerClearButton.js","sources":["../../../../../../src/components/ColorPicker/components/ColorPickerContent/ColorPickerClearButton.tsx"],"sourcesContent":["import React from \"react\";\nimport useGridKeyboardNavigation from \"../../../../hooks/useGridKeyboardNavigation/useGridKeyboardNavigation\";\nimport Button from \"../../../Button/Button\";\nimport { VibeComponentProps, VibeComponent, SubIcon } from \"../../../../types\";\nimport { NOOP } from \"../../../../utils/function-utils\";\nimport styles from \"./ColorPickerClearButton.module.scss\";\n\nexport interface ColorPickerClearButtonProps extends VibeComponentProps {\n /**\n * Callback fired when the clear button is clicked.\n */\n onClick: () => void;\n /**\n * The text displayed inside the button.\n */\n text?: string;\n /**\n * The icon displayed inside the button.\n */\n Icon: SubIcon;\n}\n\nexport const ColorPickerClearButton: VibeComponent<ColorPickerClearButtonProps> = React.forwardRef(\n ({ onClick, text, Icon }: ColorPickerClearButtonProps, ref) => {\n const { onSelectionAction } = useGridKeyboardNavigation({\n ref: ref as React.MutableRefObject<HTMLElement>,\n itemsCount: 1,\n numberOfItemsInLine: 1,\n onItemClicked: onClick,\n getItemByIndex: NOOP //hack - we don't really have a grid, it's just for keyboard navigation outside the clear button\n });\n\n return (\n <Button\n ref={ref}\n size=\"small\"\n kind=\"tertiary\"\n onClick={() => onSelectionAction(-1)} //hack - we don't really have a grid, it's just for keyboard navigation outside the clear button\n blurOnMouseUp={false}\n className={styles.clearColorButton}\n >\n <Icon size=\"16\" className={styles.clearColorIcon} />\n {text || \"Clear\"}\n </Button>\n );\n }\n);\n"],"names":["ColorPickerClearButton","React","forwardRef","_ref","ref","text","Icon","onSelectionAction","useGridKeyboardNavigation","itemsCount","numberOfItemsInLine","onItemClicked","onClick","getItemByIndex","NOOP","createElement","Button","size","kind","blurOnMouseUp","className","styles","clearColorButton","clearColorIcon"],"mappings":"wQAsBO,IAAMA,EAAqEC,EAAMC,YACtF,SAAAC,EAAuDC,GAAO,IAAlDC,EAAIF,EAAJE,KAAMC,EAAIH,EAAJG,KACRC,EAAsBC,EAA0B,CACtDJ,IAAKA,EACLK,WAAY,EACZC,oBAAqB,EACrBC,cALMR,EAAPS,QAMCC,eAAgBC,IALVP,kBAQR,OACEN,EAAAc,cAACC,EAAM,CACLZ,IAAKA,EACLa,KAAK,QACLC,KAAK,WACLN,QAAS,WAAA,OAAML,GAAmB,EAAE,EACpCY,eAAe,EACfC,UAAWC,EAAOC,kBAElBrB,EAACc,cAAAT,EAAK,CAAAW,KAAK,KAAKG,UAAWC,EAAOE,iBACjClB,GAAQ,QAGf"}
|
package/dist/src/components/ColorPicker/components/ColorPickerContent/ColorPickerColorsGrid.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ColorPickerColorsGrid.js","sources":["../../../../../../src/components/ColorPicker/components/ColorPickerContent/ColorPickerColorsGrid.tsx"],"sourcesContent":["import React, { useCallback } from \"react\";\nimport useGridKeyboardNavigation from \"../../../../hooks/useGridKeyboardNavigation/useGridKeyboardNavigation\";\nimport ColorPickerItemComponent from \"../ColorPickerItemComponent/ColorPickerItemComponent\";\nimport { CONTENT_COLORS_VALUES } from \"../../../../utils/colors-vars-map\";\nimport { ColorPickerArrayValueOnly, ColorPickerValueOnly } from \"../../ColorPicker.types\";\nimport { ColorShapes, ColorPickerSizes } from \"../../ColorPicker.types\";\nimport { SubIcon, VibeComponent, VibeComponentProps } from \"../../../../types\";\nimport styles from \"./ColorPickerColorsGrid.module.scss\";\nimport { ColorStyle } from \"../../../../types/Colors\";\n\nconst formatColorNameForTooltip = (color: ColorPickerValueOnly) => {\n return color.replace(/-|_/g, \" \").replace(/(?:^|\\s)\\S/g, function (a) {\n return a.toUpperCase();\n });\n};\n\nconst calculateColorTooltip = (\n color: ColorPickerValueOnly,\n tooltipContentByColor?: Partial<Record<CONTENT_COLORS_VALUES, string> & Record<string, string>>\n) => {\n if (tooltipContentByColor && tooltipContentByColor[color]) {\n return tooltipContentByColor[color];\n } else {\n return formatColorNameForTooltip(color);\n }\n};\n\nexport interface ColorPickerColorsGridProps extends VibeComponentProps {\n onColorClicked?: (color: ColorPickerValueOnly) => void;\n colorsToRender?: ColorPickerArrayValueOnly;\n ColorIndicatorIcon?: SubIcon;\n SelectedIndicatorIcon?: SubIcon;\n colorStyle?: ColorStyle;\n value?: string | string[];\n shouldRenderIndicatorWithoutBackground?: boolean;\n colorSize?: ColorPickerSizes;\n numberOfColorsInLine?: number;\n tooltipContentByColor?: Partial<Record<CONTENT_COLORS_VALUES, string> & Record<string, string>>;\n focusOnMount?: boolean;\n colorShape?: ColorShapes;\n showColorNameTooltip?: boolean;\n}\n\nexport const ColorPickerColorsGrid: VibeComponent<ColorPickerColorsGridProps, HTMLUListElement> = React.forwardRef(\n (\n {\n onColorClicked,\n colorsToRender,\n numberOfColorsInLine,\n focusOnMount,\n value,\n colorStyle,\n ColorIndicatorIcon,\n shouldRenderIndicatorWithoutBackground,\n SelectedIndicatorIcon,\n colorSize,\n tooltipContentByColor,\n colorShape,\n showColorNameTooltip: showColorNameTooltip,\n id,\n \"data-testid\": dataTestId\n }: ColorPickerColorsGridProps,\n ref\n ) => {\n const getItemByIndex = useCallback((index: number) => colorsToRender[index], [colorsToRender]);\n\n const { activeIndex, onSelectionAction } = useGridKeyboardNavigation({\n focusOnMount,\n ref: ref as React.MutableRefObject<HTMLUListElement>,\n onItemClicked: onColorClicked,\n itemsCount: colorsToRender.length,\n numberOfItemsInLine: numberOfColorsInLine,\n getItemByIndex\n });\n\n return (\n <ul className={styles.colorsGrid} ref={ref} tabIndex={-1} id={id} data-testid={dataTestId}>\n {colorsToRender.map((color, index) => {\n return (\n <ColorPickerItemComponent\n key={color}\n color={color}\n onColorClicked={() => onSelectionAction(index)}\n shouldRenderIndicatorWithoutBackground={ColorIndicatorIcon && shouldRenderIndicatorWithoutBackground}\n colorStyle={colorStyle}\n ColorIndicatorIcon={ColorIndicatorIcon}\n SelectedIndicatorIcon={SelectedIndicatorIcon}\n isSelected={Array.isArray(value) ? value.includes(color) : value === color}\n isActive={index === activeIndex}\n colorSize={colorSize}\n tooltipContent={showColorNameTooltip ? calculateColorTooltip(color, tooltipContentByColor) : undefined}\n colorShape={colorShape}\n />\n );\n })}\n </ul>\n );\n }\n);\n"],"names":["calculateColorTooltip","color","tooltipContentByColor","replace","a","toUpperCase","formatColorNameForTooltip","ColorPickerColorsGrid","React","forwardRef","_ref","ref","onColorClicked","colorsToRender","numberOfColorsInLine","focusOnMount","value","colorStyle","ColorIndicatorIcon","shouldRenderIndicatorWithoutBackground","SelectedIndicatorIcon","colorSize","colorShape","showColorNameTooltip","id","dataTestId","getItemByIndex","useCallback","index","_useGridKeyboardNavig","useGridKeyboardNavigation","onItemClicked","itemsCount","length","numberOfItemsInLine","activeIndex","onSelectionAction","createElement","className","styles","colorsGrid","tabIndex","map","ColorPickerItemComponent","key","isSelected","Array","isArray","includes","isActive","tooltipContent","undefined"],"mappings":"4PAUA,IAMMA,EAAwB,SAC5BC,EACAC,GAEA,OAAIA,GAAyBA,EAAsBD,GAC1CC,EAAsBD,GAXC,SAACA,GACjC,OAAOA,EAAME,QAAQ,OAAQ,KAAKA,QAAQ,eAAe,SAAUC,GACjE,OAAOA,EAAEC,aACX,GACF,CASWC,CAA0BL,EAErC,
|
|
1
|
+
{"version":3,"file":"ColorPickerColorsGrid.js","sources":["../../../../../../src/components/ColorPicker/components/ColorPickerContent/ColorPickerColorsGrid.tsx"],"sourcesContent":["import React, { useCallback } from \"react\";\nimport useGridKeyboardNavigation from \"../../../../hooks/useGridKeyboardNavigation/useGridKeyboardNavigation\";\nimport ColorPickerItemComponent from \"../ColorPickerItemComponent/ColorPickerItemComponent\";\nimport { CONTENT_COLORS_VALUES } from \"../../../../utils/colors-vars-map\";\nimport { ColorPickerArrayValueOnly, ColorPickerValueOnly } from \"../../ColorPicker.types\";\nimport { ColorShapes, ColorPickerSizes } from \"../../ColorPicker.types\";\nimport { SubIcon, VibeComponent, VibeComponentProps } from \"../../../../types\";\nimport styles from \"./ColorPickerColorsGrid.module.scss\";\nimport { ColorStyle } from \"../../../../types/Colors\";\n\nconst formatColorNameForTooltip = (color: ColorPickerValueOnly) => {\n return color.replace(/-|_/g, \" \").replace(/(?:^|\\s)\\S/g, function (a) {\n return a.toUpperCase();\n });\n};\n\nconst calculateColorTooltip = (\n color: ColorPickerValueOnly,\n tooltipContentByColor?: Partial<Record<CONTENT_COLORS_VALUES, string> & Record<string, string>>\n) => {\n if (tooltipContentByColor && tooltipContentByColor[color]) {\n return tooltipContentByColor[color];\n } else {\n return formatColorNameForTooltip(color);\n }\n};\n\nexport interface ColorPickerColorsGridProps extends VibeComponentProps {\n /**\n * Callback fired when a color is clicked.\n */\n onColorClicked?: (color: ColorPickerValueOnly) => void;\n /**\n * The list of colors to be displayed.\n */\n colorsToRender?: ColorPickerArrayValueOnly;\n /**\n * Icon displayed as an indicator inside the color.\n */\n ColorIndicatorIcon?: SubIcon;\n /**\n * Icon displayed when a color is selected.\n */\n SelectedIndicatorIcon?: SubIcon;\n /**\n * The style applied to the colors.\n */\n colorStyle?: ColorStyle;\n /**\n * The currently selected color or colors.\n */\n value?: string | string[];\n /**\n * If true, renders the color indicator without a background.\n */\n shouldRenderIndicatorWithoutBackground?: boolean;\n /**\n * The size of the color items.\n */\n colorSize?: ColorPickerSizes;\n /**\n * The number of colors per row.\n */\n numberOfColorsInLine?: number;\n /**\n * Custom tooltip content for specific colors.\n */\n tooltipContentByColor?: Partial<Record<CONTENT_COLORS_VALUES, string> & Record<string, string>>;\n /**\n * If true, the first color is focused when the component mounts.\n */\n focusOnMount?: boolean;\n /**\n * The shape of the color items.\n */\n colorShape?: ColorShapes;\n /**\n * If true, displays a tooltip with the color name.\n */\n showColorNameTooltip?: boolean;\n}\n\nexport const ColorPickerColorsGrid: VibeComponent<ColorPickerColorsGridProps, HTMLUListElement> = React.forwardRef(\n (\n {\n onColorClicked,\n colorsToRender,\n numberOfColorsInLine,\n focusOnMount,\n value,\n colorStyle,\n ColorIndicatorIcon,\n shouldRenderIndicatorWithoutBackground,\n SelectedIndicatorIcon,\n colorSize,\n tooltipContentByColor,\n colorShape,\n showColorNameTooltip: showColorNameTooltip,\n id,\n \"data-testid\": dataTestId\n }: ColorPickerColorsGridProps,\n ref\n ) => {\n const getItemByIndex = useCallback((index: number) => colorsToRender[index], [colorsToRender]);\n\n const { activeIndex, onSelectionAction } = useGridKeyboardNavigation({\n focusOnMount,\n ref: ref as React.MutableRefObject<HTMLUListElement>,\n onItemClicked: onColorClicked,\n itemsCount: colorsToRender.length,\n numberOfItemsInLine: numberOfColorsInLine,\n getItemByIndex\n });\n\n return (\n <ul className={styles.colorsGrid} ref={ref} tabIndex={-1} id={id} data-testid={dataTestId}>\n {colorsToRender.map((color, index) => {\n return (\n <ColorPickerItemComponent\n key={color}\n color={color}\n onColorClicked={() => onSelectionAction(index)}\n shouldRenderIndicatorWithoutBackground={ColorIndicatorIcon && shouldRenderIndicatorWithoutBackground}\n colorStyle={colorStyle}\n ColorIndicatorIcon={ColorIndicatorIcon}\n SelectedIndicatorIcon={SelectedIndicatorIcon}\n isSelected={Array.isArray(value) ? value.includes(color) : value === color}\n isActive={index === activeIndex}\n colorSize={colorSize}\n tooltipContent={showColorNameTooltip ? calculateColorTooltip(color, tooltipContentByColor) : undefined}\n colorShape={colorShape}\n />\n );\n })}\n </ul>\n );\n }\n);\n"],"names":["calculateColorTooltip","color","tooltipContentByColor","replace","a","toUpperCase","formatColorNameForTooltip","ColorPickerColorsGrid","React","forwardRef","_ref","ref","onColorClicked","colorsToRender","numberOfColorsInLine","focusOnMount","value","colorStyle","ColorIndicatorIcon","shouldRenderIndicatorWithoutBackground","SelectedIndicatorIcon","colorSize","colorShape","showColorNameTooltip","id","dataTestId","getItemByIndex","useCallback","index","_useGridKeyboardNavig","useGridKeyboardNavigation","onItemClicked","itemsCount","length","numberOfItemsInLine","activeIndex","onSelectionAction","createElement","className","styles","colorsGrid","tabIndex","map","ColorPickerItemComponent","key","isSelected","Array","isArray","includes","isActive","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AASe,IAAUf,EACrEgD,SAAUrB,IAAUO,EACpBd,UAAWA,EACX6B,eAAgB3B,EAAuBvB,EAAsBC,EAAOC,QAAyBiD,EAC7F7B,WAAYA,GAGjB,IAGP"}
|
package/dist/src/components/ColorPicker/components/ColorPickerContent/ColorPickerContent.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ColorPickerContent.js","sources":["../../../../../../src/components/ColorPicker/components/ColorPickerContent/ColorPickerContent.tsx"],"sourcesContent":["import { difference as _difference, intersection as _intersection } from \"lodash-es\";\nimport React, { forwardRef, useCallback, useMemo, useRef } from \"react\";\nimport { BaseSizes } from \"../../../../constants\";\nimport { ColorStyle as ColorStyleEnum, CONTENT_COLORS_VALUES, contentColors } from \"../../../../utils/colors-vars-map\";\nimport { NoColor } from \"@vibe/icons\";\nimport { ColorShapes as ColorShapesEnum, DEFAULT_NUMBER_OF_COLORS_IN_LINE } from \"../../ColorPickerConstants\";\nimport { ColorShapes, ColorPickerSizes, ColorPickerValue, ColorPickerArrayValueOnly } from \"../../ColorPicker.types\";\nimport { calculateColorPickerWidth } from \"../../services/ColorPickerStyleService\";\nimport {\n GridKeyboardNavigationContext,\n useGridKeyboardNavigationContext\n} from \"../../../GridKeyboardNavigationContext/GridKeyboardNavigationContext\";\nimport { ColorPickerClearButton } from \"./ColorPickerClearButton\";\nimport { ColorPickerColorsGrid } from \"./ColorPickerColorsGrid\";\nimport { VibeComponentProps, VibeComponent, SubIcon, withStaticProps } from \"../../../../types\";\nimport useMergeRef from \"../../../../hooks/useMergeRef\";\nimport { ColorStyle } from \"../../../../types/Colors\";\n\nexport interface ColorPickerContentProps extends VibeComponentProps {\n value: ColorPickerValue;\n onValueChange: (value: ColorPickerArrayValueOnly) => void;\n colorsList: ColorPickerArrayValueOnly;\n ColorIndicatorIcon?: SubIcon;\n SelectedIndicatorIcon?: SubIcon;\n NoColorIcon?: SubIcon;\n colorStyle?: ColorStyle;\n colorSize?: ColorPickerSizes;\n colorShape?: ColorShapes;\n tooltipContentByColor?: Partial<Record<CONTENT_COLORS_VALUES, string>>;\n noColorText?: string;\n shouldRenderIndicatorWithoutBackground?: boolean;\n isBlackListMode?: boolean;\n numberOfColorsInLine?: number;\n focusOnMount?: boolean;\n isMultiselect?: boolean;\n /**\n * Used to force the component render the colorList prop as is. Usually, this flag should not be used. It's intended only for edge cases.\n * Usually, only \"monday colors\" will be rendered (unless blacklist mode is used). This flag will override this behavior.\n */\n forceUseRawColorList?: boolean;\n /**\n * Used to enable color name tooltip on each color in the component.\n * When \"tooltipContentByColor\" is supplied, it will override the color name tooltip.\n */\n showColorNameTooltip?: boolean;\n}\n\nconst ColorPickerContent: VibeComponent<ColorPickerContentProps, HTMLDivElement> & {\n sizes?: typeof BaseSizes;\n colorStyles?: typeof ColorStyleEnum;\n colorSizes?: typeof BaseSizes;\n colorShapes?: typeof ColorShapesEnum;\n} = forwardRef(\n (\n {\n className,\n onValueChange,\n value,\n noColorText,\n colorStyle = \"regular\",\n ColorIndicatorIcon,\n SelectedIndicatorIcon,\n shouldRenderIndicatorWithoutBackground,\n NoColorIcon = NoColor,\n isBlackListMode = true,\n colorsList,\n isMultiselect,\n colorSize = BaseSizes.MEDIUM,\n numberOfColorsInLine = DEFAULT_NUMBER_OF_COLORS_IN_LINE,\n tooltipContentByColor = {},\n focusOnMount,\n colorShape = \"square\",\n forceUseRawColorList,\n showColorNameTooltip,\n id,\n \"data-testid\": dataTestId\n }: ColorPickerContentProps,\n ref\n ) => {\n const gridRef = useRef(null);\n const mergedRef = useMergeRef(ref, gridRef);\n const colorsRef = useRef(null);\n const buttonRef = useRef(null);\n\n const onClearButton = useCallback(() => {\n onValueChange(null);\n }, [onValueChange]);\n\n const colorsToRender = useMemo(() => {\n if (forceUseRawColorList) {\n return colorsList;\n }\n return isBlackListMode ? _difference(contentColors, colorsList) : _intersection(contentColors, colorsList);\n }, [forceUseRawColorList, isBlackListMode, colorsList]);\n\n const onColorClicked = useCallback(\n (color: CONTENT_COLORS_VALUES) => {\n if (!isMultiselect) {\n onValueChange([color]);\n return;\n }\n const colors = [...value];\n if (colors.includes(color)) {\n const indexInSelected = colors.indexOf(color);\n if (indexInSelected > -1) {\n colors.splice(indexInSelected, 1);\n }\n } else {\n colors.push(color);\n }\n onValueChange(colors);\n },\n [isMultiselect, onValueChange, value]\n );\n\n const positions = useMemo(() => [{ topElement: colorsRef, bottomElement: buttonRef }], []);\n const keyboardContext = useGridKeyboardNavigationContext(positions, gridRef);\n const width = calculateColorPickerWidth(colorSize as BaseSizes, numberOfColorsInLine);\n\n return (\n <div className={className} style={{ width }} ref={mergedRef} tabIndex={-1}>\n <GridKeyboardNavigationContext.Provider value={keyboardContext}>\n <ColorPickerColorsGrid\n ref={colorsRef}\n onColorClicked={onColorClicked}\n colorsToRender={colorsToRender}\n numberOfColorsInLine={numberOfColorsInLine}\n focusOnMount={focusOnMount}\n value={value}\n colorStyle={colorStyle}\n ColorIndicatorIcon={ColorIndicatorIcon}\n shouldRenderIndicatorWithoutBackground={shouldRenderIndicatorWithoutBackground}\n SelectedIndicatorIcon={SelectedIndicatorIcon}\n colorSize={colorSize}\n tooltipContentByColor={tooltipContentByColor}\n colorShape={colorShape}\n showColorNameTooltip={showColorNameTooltip}\n id={id}\n data-testid={dataTestId}\n />\n {noColorText && (\n <ColorPickerClearButton Icon={NoColorIcon} onClick={onClearButton} text={noColorText} ref={buttonRef} />\n )}\n </GridKeyboardNavigationContext.Provider>\n </div>\n );\n }\n);\n\nexport default withStaticProps(ColorPickerContent, {\n sizes: BaseSizes,\n colorStyles: ColorStyleEnum,\n colorSizes: BaseSizes,\n colorShapes: ColorShapesEnum\n});\n"],"names":["withStaticProps","forwardRef","_ref","ref","className","onValueChange","value","noColorText","_ref$colorStyle","colorStyle","ColorIndicatorIcon","SelectedIndicatorIcon","shouldRenderIndicatorWithoutBackground","_ref$NoColorIcon","NoColorIcon","NoColor","_ref$isBlackListMode","isBlackListMode","colorsList","isMultiselect","_ref$colorSize","colorSize","BaseSizes","MEDIUM","_ref$numberOfColorsIn","numberOfColorsInLine","DEFAULT_NUMBER_OF_COLORS_IN_LINE","_ref$tooltipContentBy","tooltipContentByColor","focusOnMount","_ref$colorShape","colorShape","forceUseRawColorList","showColorNameTooltip","id","dataTestId","gridRef","useRef","mergedRef","useMergeRef","colorsRef","buttonRef","onClearButton","useCallback","colorsToRender","useMemo","_difference","contentColors","_intersection","onColorClicked","color","colors","_toConsumableArray","includes","indexInSelected","indexOf","splice","push","positions","topElement","bottomElement","keyboardContext","useGridKeyboardNavigationContext","width","calculateColorPickerWidth","React","createElement","style","tabIndex","GridKeyboardNavigationContext","Provider","ColorPickerColorsGrid","ColorPickerClearButton","Icon","onClick","text","sizes","colorStyles","ColorStyleEnum","colorSizes","colorShapes","ColorShapesEnum"],"mappings":"igCA+CA,IAsGeA,EAAAA,EAjGXC,GACF,SAAAC,EAwBEC,GACE,IAvBAC,EAASF,EAATE,UACAC,EAAaH,EAAbG,cACAC,EAAKJ,EAALI,MACAC,EAAWL,EAAXK,YAAWC,EAAAN,EACXO,WAAAA,OAAa,IAAHD,EAAG,UAASA,EACtBE,EAAkBR,EAAlBQ,mBACAC,EAAqBT,EAArBS,sBACAC,EAAsCV,EAAtCU,uCAAsCC,EAAAX,EACtCY,YAAAA,OAAcC,IAAHF,EAAGE,EAAOF,EAAAG,EAAAd,EACrBe,gBAAAA,OAAkB,IAAHD,GAAOA,EACtBE,EAAUhB,EAAVgB,WACAC,EAAajB,EAAbiB,cAAaC,EAAAlB,EACbmB,UAAAA,OAAS,IAAAD,EAAGE,EAAUC,OAAMH,EAAAI,EAAAtB,EAC5BuB,qBAAAA,OAAuBC,IAAHF,EAAGE,EAAgCF,EAAAG,EAAAzB,EACvD0B,sBAAAA,OAAqB,IAAAD,EAAG,CAAE,EAAAA,EAC1BE,EAAY3B,EAAZ2B,aAAYC,EAAA5B,EACZ6B,WAAAA,OAAa,IAAHD,EAAG,SAAQA,EACrBE,EAAoB9B,EAApB8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AIA,EAAE,cACOC,IAEd5B,GACC0D,EAAAC,cAACM,EAAsB,CAACC,KAAM3D,EAAa4D,QAAShC,EAAeiC,KAAMpE,EAAaJ,IAAKsC,KAKrG,IAGiD,CACjDmC,MAAOtD,EACPuD,YAAaC,EACbC,WAAYzD,EACZ0D,YAAaC"}
|
|
1
|
+
{"version":3,"file":"ColorPickerContent.js","sources":["../../../../../../src/components/ColorPicker/components/ColorPickerContent/ColorPickerContent.tsx"],"sourcesContent":["import { difference as _difference, intersection as _intersection } from \"lodash-es\";\nimport React, { forwardRef, useCallback, useMemo, useRef } from \"react\";\nimport { BaseSizes } from \"../../../../constants\";\nimport { ColorStyle as ColorStyleEnum, CONTENT_COLORS_VALUES, contentColors } from \"../../../../utils/colors-vars-map\";\nimport { NoColor } from \"@vibe/icons\";\nimport { ColorShapes as ColorShapesEnum, DEFAULT_NUMBER_OF_COLORS_IN_LINE } from \"../../ColorPickerConstants\";\nimport { ColorShapes, ColorPickerSizes, ColorPickerValue, ColorPickerArrayValueOnly } from \"../../ColorPicker.types\";\nimport { calculateColorPickerWidth } from \"../../services/ColorPickerStyleService\";\nimport {\n GridKeyboardNavigationContext,\n useGridKeyboardNavigationContext\n} from \"../../../GridKeyboardNavigationContext/GridKeyboardNavigationContext\";\nimport { ColorPickerClearButton } from \"./ColorPickerClearButton\";\nimport { ColorPickerColorsGrid } from \"./ColorPickerColorsGrid\";\nimport { VibeComponentProps, VibeComponent, SubIcon, withStaticProps } from \"../../../../types\";\nimport useMergeRef from \"../../../../hooks/useMergeRef\";\nimport { ColorStyle } from \"../../../../types/Colors\";\n\nexport interface ColorPickerContentProps extends VibeComponentProps {\n /**\n * The selected color(s).\n */\n value: ColorPickerValue;\n /**\n * Callback fired when the selected color(s) change.\n */\n onValueChange: (value: ColorPickerArrayValueOnly) => void;\n /**\n * The list of colors available for selection.\n */\n colorsList: ColorPickerArrayValueOnly;\n /**\n * Icon displayed as an indicator inside the color.\n */\n ColorIndicatorIcon?: SubIcon;\n /**\n * Icon displayed when a color is selected.\n */\n SelectedIndicatorIcon?: SubIcon;\n /**\n * Icon used for clearing the color selection.\n */\n NoColorIcon?: SubIcon;\n /**\n * The style applied to the colors.\n */\n colorStyle?: ColorStyle;\n /**\n * The size of the color items.\n */\n colorSize?: ColorPickerSizes;\n /**\n * The shape of the color items.\n */\n colorShape?: ColorShapes;\n /**\n * Custom tooltip content for specific colors.\n */\n tooltipContentByColor?: Partial<Record<CONTENT_COLORS_VALUES, string>>;\n /**\n * Text displayed for the \"no color\" option.\n */\n noColorText?: string;\n /**\n * If true, renders the color indicator without a background.\n */\n shouldRenderIndicatorWithoutBackground?: boolean;\n /**\n * If true, treats the color list as a blacklist rather than a whitelist.\n */\n isBlackListMode?: boolean;\n /**\n * The number of colors displayed per row.\n */\n numberOfColorsInLine?: number;\n /**\n * If true, the first color is focused when the component mounts.\n */\n focusOnMount?: boolean;\n /**\n * If true, allows selecting multiple colors.\n */\n isMultiselect?: boolean;\n /**\n * Used to force the component render the colorList prop as is. Usually, this flag should not be used. It's intended only for edge cases.\n * Usually, only \"monday colors\" will be rendered (unless blacklist mode is used). This flag will override this behavior.\n */\n forceUseRawColorList?: boolean;\n /**\n * Used to enable color name tooltip on each color in the component.\n * When \"tooltipContentByColor\" is supplied, it will override the color name tooltip.\n */\n showColorNameTooltip?: boolean;\n}\n\nconst ColorPickerContent: VibeComponent<ColorPickerContentProps, HTMLDivElement> & {\n sizes?: typeof BaseSizes;\n colorStyles?: typeof ColorStyleEnum;\n colorSizes?: typeof BaseSizes;\n colorShapes?: typeof ColorShapesEnum;\n} = forwardRef(\n (\n {\n className,\n onValueChange,\n value,\n noColorText,\n colorStyle = \"regular\",\n ColorIndicatorIcon,\n SelectedIndicatorIcon,\n shouldRenderIndicatorWithoutBackground,\n NoColorIcon = NoColor,\n isBlackListMode = true,\n colorsList,\n isMultiselect,\n colorSize = BaseSizes.MEDIUM,\n numberOfColorsInLine = DEFAULT_NUMBER_OF_COLORS_IN_LINE,\n tooltipContentByColor = {},\n focusOnMount,\n colorShape = \"square\",\n forceUseRawColorList,\n showColorNameTooltip,\n id,\n \"data-testid\": dataTestId\n }: ColorPickerContentProps,\n ref\n ) => {\n const gridRef = useRef(null);\n const mergedRef = useMergeRef(ref, gridRef);\n const colorsRef = useRef(null);\n const buttonRef = useRef(null);\n\n const onClearButton = useCallback(() => {\n onValueChange(null);\n }, [onValueChange]);\n\n const colorsToRender = useMemo(() => {\n if (forceUseRawColorList) {\n return colorsList;\n }\n return isBlackListMode ? _difference(contentColors, colorsList) : _intersection(contentColors, colorsList);\n }, [forceUseRawColorList, isBlackListMode, colorsList]);\n\n const onColorClicked = useCallback(\n (color: CONTENT_COLORS_VALUES) => {\n if (!isMultiselect) {\n onValueChange([color]);\n return;\n }\n const colors = [...value];\n if (colors.includes(color)) {\n const indexInSelected = colors.indexOf(color);\n if (indexInSelected > -1) {\n colors.splice(indexInSelected, 1);\n }\n } else {\n colors.push(color);\n }\n onValueChange(colors);\n },\n [isMultiselect, onValueChange, value]\n );\n\n const positions = useMemo(() => [{ topElement: colorsRef, bottomElement: buttonRef }], []);\n const keyboardContext = useGridKeyboardNavigationContext(positions, gridRef);\n const width = calculateColorPickerWidth(colorSize as BaseSizes, numberOfColorsInLine);\n\n return (\n <div className={className} style={{ width }} ref={mergedRef} tabIndex={-1}>\n <GridKeyboardNavigationContext.Provider value={keyboardContext}>\n <ColorPickerColorsGrid\n ref={colorsRef}\n onColorClicked={onColorClicked}\n colorsToRender={colorsToRender}\n numberOfColorsInLine={numberOfColorsInLine}\n focusOnMount={focusOnMount}\n value={value}\n colorStyle={colorStyle}\n ColorIndicatorIcon={ColorIndicatorIcon}\n shouldRenderIndicatorWithoutBackground={shouldRenderIndicatorWithoutBackground}\n SelectedIndicatorIcon={SelectedIndicatorIcon}\n colorSize={colorSize}\n tooltipContentByColor={tooltipContentByColor}\n colorShape={colorShape}\n showColorNameTooltip={showColorNameTooltip}\n id={id}\n data-testid={dataTestId}\n />\n {noColorText && (\n <ColorPickerClearButton Icon={NoColorIcon} onClick={onClearButton} text={noColorText} ref={buttonRef} />\n )}\n </GridKeyboardNavigationContext.Provider>\n </div>\n );\n }\n);\n\nexport default withStaticProps(ColorPickerContent, {\n sizes: BaseSizes,\n colorStyles: ColorStyleEnum,\n colorSizes: BaseSizes,\n colorShapes: ColorShapesEnum\n});\n"],"names":["withStaticProps","forwardRef","_ref","ref","className","onValueChange","value","noColorText","_ref$colorStyle","colorStyle","ColorIndicatorIcon","SelectedIndicatorIcon","shouldRenderIndicatorWithoutBackground","_ref$NoColorIcon","NoColorIcon","NoColor","_ref$isBlackListMode","isBlackListMode","colorsList","isMultiselect","_ref$colorSize","colorSize","BaseSizes","MEDIUM","_ref$numberOfColorsIn","numberOfColorsInLine","DEFAULT_NUMBER_OF_COLORS_IN_LINE","_ref$tooltipContentBy","tooltipContentByColor","focusOnMount","_ref$colorShape","colorShape","forceUseRawColorList","showColorNameTooltip","id","dataTestId","gridRef","useRef","mergedRef","useMergeRef","colorsRef","buttonRef","onClearButton","useCallback","colorsToRender","useMemo","_difference","contentColors","_intersection","onColorClicked","color","colors","_toConsumableArray","includes","indexInSelected","indexOf","splice","push","positions","topElement","bottomElement","keyboardContext","useGridKeyboardNavigationContext","width","calculateColorPickerWidth","React","createElement","style","tabIndex","GridKeyboardNavigationContext","Provider","ColorPickerColorsGrid","ColorPickerClearButton","Icon","onClick","text","sizes","colorStyles","ColorStyleEnum","colorSizes","colorShapes","ColorShapesEnum"],"mappings":"igCA+FA,IAsGeA,EAAAA,EAjGXC,GACF,SAAAC,EAwBEC,GACE,IAvBAC,EAASF,EAATE,UACAC,EAAaH,EAAbG,cACAC,EAAKJ,EAALI,MACAC,EAAWL,EAAXK,YAAWC,EAAAN,EACXO,WAAAA,OAAa,IAAHD,EAAG,UAASA,EACtBE,EAAkBR,EAAlBQ,mBACAC,EAAqBT,EAArBS,sBACAC,EAAsCV,EAAtCU,uCAAsCC,EAAAX,EACtCY,YAAAA,OAAcC,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wBI,GAEhE,OACEwC,EAAKC,cAAA,MAAA,CAAA9D,UAAWA,EAAW+D,MAAO,CAAEJ,MAAAA,IAAS5D,IAAKmC,EAAW8B,UAAW,GACtEH,EAAAC,cAACG,EAA8BC,SAAS,CAAAhE,MAAOuD,IAC7CI,EAAAC,cAACK,EAAqB,CACpBpE,IAAKqC,EACLS,eAAgBA,EAChBL,eAAgBA,EAChBnB,qBAAsBA,EACtBI,aAAcA,EACdvB,MAAOA,EACPG,WAAYA,EACZC,mBAAoBA,EACpBE,uCAAwCA,EACxCD,sBAAuBA,EACvBU,UAAWA,EACXO,sBAAuBA,EACvBG,WAAYA,EACZE,qBAAsBA,EACtBC,GAAIA,EAAE,cACOC,IAEd5B,GACC0D,EAAAC,cAACM,EAAsB,CAACC,KAAM3D,EAAa4D,QAAShC,EAAeiC,KAAMpE,EAAaJ,IAAKsC,KAKrG,IAGiD,CACjDmC,MAAOtD,EACPuD,YAAaC,EACbC,WAAYzD,EACZ0D,YAAaC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ColorPickerItemComponent.js","sources":["../../../../../../src/components/ColorPicker/components/ColorPickerItemComponent/ColorPickerItemComponent.tsx"],"sourcesContent":["import { camelCase } from \"lodash-es\";\nimport { getStyle } from \"../../../../helpers/typesciptCssModulesHelper\";\nimport cx from \"classnames\";\nimport React, { useRef, useCallback, useMemo, forwardRef, useEffect } from \"react\";\nimport { contentColors } from \"../../../../utils/colors-vars-map\";\nimport ColorUtils from \"../../../../utils/colors-utils\";\nimport Icon from \"../../../Icon/Icon\";\nimport Tooltip from \"../../../Tooltip/Tooltip\";\nimport Clickable from \"../../../Clickable/Clickable\";\nimport { ColorPickerValueOnly } from \"../../ColorPicker.types\";\nimport { ColorShapes, ColorPickerSizes } from \"../../ColorPicker.types\";\nimport { getTestId } from \"../../../../tests/test-ids-utils\";\nimport { ComponentDefaultTestId } from \"../../../../tests/constants\";\nimport { SubIcon, VibeComponent, VibeComponentProps, ElementContent, ColorStyle } from \"../../../../types\";\nimport styles from \"./ColorPickerItemComponent.module.scss\";\n\nexport interface ColorPickerItemComponentProps extends VibeComponentProps {\n color: ColorPickerValueOnly;\n onColorClicked: (color: ColorPickerValueOnly) => void;\n colorStyle: ColorStyle;\n shouldRenderIndicatorWithoutBackground: boolean;\n ColorIndicatorIcon: SubIcon;\n SelectedIndicatorIcon: SubIcon;\n isSelected: boolean;\n colorSize: ColorPickerSizes;\n tooltipContent: ElementContent;\n isActive: boolean;\n colorShape: ColorShapes;\n
|
|
1
|
+
{"version":3,"file":"ColorPickerItemComponent.js","sources":["../../../../../../src/components/ColorPicker/components/ColorPickerItemComponent/ColorPickerItemComponent.tsx"],"sourcesContent":["import { camelCase } from \"lodash-es\";\nimport { getStyle } from \"../../../../helpers/typesciptCssModulesHelper\";\nimport cx from \"classnames\";\nimport React, { useRef, useCallback, useMemo, forwardRef, useEffect } from \"react\";\nimport { contentColors } from \"../../../../utils/colors-vars-map\";\nimport ColorUtils from \"../../../../utils/colors-utils\";\nimport Icon from \"../../../Icon/Icon\";\nimport Tooltip from \"../../../Tooltip/Tooltip\";\nimport Clickable from \"../../../Clickable/Clickable\";\nimport { ColorPickerValueOnly } from \"../../ColorPicker.types\";\nimport { ColorShapes, ColorPickerSizes } from \"../../ColorPicker.types\";\nimport { getTestId } from \"../../../../tests/test-ids-utils\";\nimport { ComponentDefaultTestId } from \"../../../../tests/constants\";\nimport { SubIcon, VibeComponent, VibeComponentProps, ElementContent, ColorStyle } from \"../../../../types\";\nimport styles from \"./ColorPickerItemComponent.module.scss\";\n\nexport interface ColorPickerItemComponentProps extends VibeComponentProps {\n /**\n * The color value of the item.\n */\n color: ColorPickerValueOnly;\n /**\n * Callback fired when the color is clicked.\n */\n onColorClicked: (color: ColorPickerValueOnly) => void;\n /**\n * The style applied to the color.\n */\n colorStyle: ColorStyle;\n /**\n * If true, renders the color indicator without a background.\n */\n shouldRenderIndicatorWithoutBackground: boolean;\n /**\n * Icon displayed inside the color item.\n */\n ColorIndicatorIcon: SubIcon;\n /**\n * Icon displayed when the color is selected.\n */\n SelectedIndicatorIcon: SubIcon;\n /**\n * If true, the color is marked as selected.\n */\n isSelected: boolean;\n /**\n * The size of the color item.\n */\n colorSize: ColorPickerSizes;\n /**\n * Tooltip content for the color item.\n */\n tooltipContent: ElementContent;\n /**\n * If true, the color item is currently active.\n */\n isActive: boolean;\n /**\n * The shape of the color item.\n */\n colorShape: ColorShapes;\n}\n\nconst ColorPickerItemComponent: VibeComponent<ColorPickerItemComponentProps> = forwardRef(\n (\n {\n color,\n onColorClicked,\n colorStyle = \"regular\",\n shouldRenderIndicatorWithoutBackground,\n ColorIndicatorIcon,\n SelectedIndicatorIcon = ColorIndicatorIcon,\n isSelected,\n colorSize,\n tooltipContent,\n isActive,\n colorShape,\n \"data-testid\": dataTestId\n }: ColorPickerItemComponentProps,\n _ref\n ) => {\n const isMondayColor = useMemo(() => (contentColors as readonly string[]).includes(color), [color]); // casting to any since color can be one of the system content colors but can also be a custom one\n const colorAsStyle = isMondayColor ? ColorUtils.getMondayColorAsStyle(color, colorStyle) : color;\n const itemRef = useRef<HTMLDivElement>(null);\n\n const onClick = useCallback(() => onColorClicked(color), [onColorClicked, color]);\n\n useEffect(() => {\n if (!itemRef?.current || shouldRenderIndicatorWithoutBackground || !isMondayColor) return;\n const item = itemRef.current;\n const setHoverColor = (e: MouseEvent) => {\n if (colorStyle === \"selected\") {\n (e.target as HTMLDivElement).style.background = ColorUtils.getMondayColorAsStyle(color, \"regular\");\n } else {\n (e.target as HTMLDivElement).style.background = ColorUtils.getMondayColorAsStyle(color, \"hover\");\n }\n };\n const restoreToOriginalColor = (e: MouseEvent) => {\n (e.target as HTMLDivElement).style.background = colorAsStyle;\n };\n item.addEventListener(\"mouseenter\", setHoverColor, false);\n item.addEventListener(\"mouseleave\", restoreToOriginalColor, false);\n\n return () => {\n item.removeEventListener(\"mouseenter\", setHoverColor, false);\n item.removeEventListener(\"mouseleave\", restoreToOriginalColor, false);\n };\n }, [color, colorAsStyle, colorStyle, isMondayColor, itemRef, shouldRenderIndicatorWithoutBackground]);\n\n const shouldRenderIcon = isSelected || ColorIndicatorIcon;\n const colorIndicatorWrapperStyle = shouldRenderIndicatorWithoutBackground ? { color: colorAsStyle } : {};\n return (\n <Tooltip content={tooltipContent}>\n <li\n className={cx(styles.itemWrapper, {\n [styles.selectedColor]: isSelected,\n [styles.active]: isActive,\n [styles.circle]: colorShape === \"circle\"\n })}\n data-testid={dataTestId || getTestId(ComponentDefaultTestId.COLOR_PICKER_ITEM, color)}\n >\n <div className={cx(styles.feedbackIndicator)} />\n <Clickable\n ref={itemRef}\n ariaLabel={color}\n className={cx(styles.colorItem, getStyle(styles, camelCase(\"color-item-size-\" + colorSize)), {\n [styles.colorItemTextMode]: shouldRenderIndicatorWithoutBackground\n })}\n style={{ background: shouldRenderIndicatorWithoutBackground ? \"transparent\" : colorAsStyle }}\n onClick={onClick}\n tabIndex=\"-1\"\n onMouseDown={e => e.preventDefault()} // this is for quill to not lose the selection\n >\n <div className={cx(styles.colorIndicatorWrapper)} style={colorIndicatorWrapperStyle}>\n {shouldRenderIcon && (\n <Icon\n icon={isSelected ? SelectedIndicatorIcon : ColorIndicatorIcon}\n className={cx({\n [styles.colorIconWhite]: !shouldRenderIndicatorWithoutBackground\n })}\n ignoreFocusStyle\n />\n )}\n </div>\n </Clickable>\n </li>\n </Tooltip>\n );\n }\n);\n\nexport default ColorPickerItemComponent;\n"],"names":["ColorPickerItemComponent","forwardRef","_ref2","_ref","color","onColorClicked","_ref2$colorStyle","colorStyle","shouldRenderIndicatorWithoutBackground","ColorIndicatorIcon","_ref2$SelectedIndicat","SelectedIndicatorIcon","isSelected","colorSize","tooltipContent","isActive","colorShape","dataTestId","isMondayColor","useMemo","contentColors","includes","colorAsStyle","ColorUtils","getMondayColorAsStyle","itemRef","useRef","onClick","useCallback","useEffect","current","item","setHoverColor","e","target","style","background","restoreToOriginalColor","addEventListener","removeEventListener","shouldRenderIcon","colorIndicatorWrapperStyle","React","createElement","Tooltip","content","className","cx","styles","itemWrapper","_defineProperty","selectedColor","active","circle","getTestId","ComponentDefaultTestId","COLOR_PICKER_ITEM","feedbackIndicator","Clickable","ref","ariaLabel","colorItem","getStyle","camelCase","colorItemTextMode","tabIndex","onMouseDown","preventDefault","colorIndicatorWrapper","Icon","icon","colorIconWhite","ignoreFocusStyle"],"mappings":"gvBA+DMA,IAAAA,EAAyEC,GAC7E,SAAAC,EAeEC,GACE,IAdAC,EAAKF,EAALE,MACAC,EAAcH,EAAdG,eAAcC,EAAAJ,EACdK,WAAAA,OAAa,IAAHD,EAAG,UAASA,EACtBE,EAAsCN,EAAtCM,uCACAC,EAAkBP,EAAlBO,mBAAkBC,EAAAR,EAClBS,sBAAAA,OAAwBF,IAAHC,EAAGD,EAAkBC,EAC1CE,EAAUV,EAAVU,WACAC,EAASX,EAATW,UACAC,EAAcZ,EAAdY,eACAC,EAAQb,EAARa,SACAC,EAAUd,EAAVc,WACeC,EAAUf,EAAzB,eAIIgB,EAAgBC,GAAQ,WAAA,OAAOC,EAAoCC,SAASjB,EAAM,GAAE,CAACA,IACrFkB,EAAeJ,EAAgBK,EAAWC,sBAAsBpB,EAAOG,GAAcH,EACrFqB,EAAUC,EAAuB,MAEjCC,EAAUC,GAAY,WAAA,OAAMvB,EAAeD,EAAM,GAAE,CAACC,EAAgBD,IAE1EyB,GAAU,WACR,IAAKJ,aAAA,EAAAA,EAASK,WAAWtB,GAA2CU,EAApE,CACA,IAAMa,EAAON,EAAQK,QACfE,EAAgB,SAACC,GAElBA,EAAEC,OAA0BC,MAAMC,WAAab,EAAWC,sBAAsBpB,EADhE,aAAfG,EACsF,UAEA,UAGtF8B,EAAyB,SAACJ,GAC7BA,EAAEC,OAA0BC,MAAMC,WAAad,GAKlD,OAHAS,EAAKO,iBAAiB,aAAcN,GAAe,GACnDD,EAAKO,iBAAiB,aAAcD,GAAwB,GAErD,WACLN,EAAKQ,oBAAoB,aAAcP,GAAe,G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