@bikdotai/bik-component-library 0.0.840-tools-beta.5 → 0.0.841-beta.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/cjs/components/BikGiftedChat/GiftedChat/GiftedChat.js +1 -1
- package/dist/cjs/components/BikGiftedChat/GiftedChat/GiftedChat.js.map +1 -1
- package/dist/cjs/components/SearchFilter/index.js +1 -1
- package/dist/cjs/components/SearchFilter/index.js.map +1 -1
- package/dist/cjs/components/agent-builder/constants/tools.js.map +1 -1
- package/dist/cjs/components/analytics-chips-and-dropdowns/AnalyticsChip.js +1 -1
- package/dist/cjs/components/analytics-chips-and-dropdowns/AnalyticsChip.js.map +1 -1
- package/dist/cjs/components/avatar/Avatar.js +1 -1
- package/dist/cjs/components/avatar/Avatar.js.map +1 -1
- package/dist/cjs/components/avatar/Avatar.styled.js +12 -4
- package/dist/cjs/components/avatar/Avatar.styled.js.map +1 -1
- package/dist/cjs/components/button/themes.js +11 -11
- package/dist/cjs/components/button/themes.js.map +1 -1
- package/dist/cjs/components/card-selector/CardSelector.js +1 -1
- package/dist/cjs/components/card-selector/CardSelector.js.map +1 -1
- package/dist/cjs/components/card-selector/CardSelectorGroup.js +1 -1
- package/dist/cjs/components/card-selector/CardSelectorGroup.js.map +1 -1
- package/dist/cjs/components/carousel/carousel.js +2 -2
- package/dist/cjs/components/carousel/carousel.js.map +1 -1
- package/dist/cjs/components/checkBox/CheckBox.js +1 -1
- package/dist/cjs/components/checkBox/CheckBox.js.map +1 -1
- package/dist/cjs/components/code-block/CodeBlock.js +2 -2
- package/dist/cjs/components/code-block/CodeBlock.js.map +1 -1
- package/dist/cjs/components/colourInput/ColourInput.js +1 -1
- package/dist/cjs/components/colourInput/ColourInput.js.map +1 -1
- package/dist/cjs/components/dashboard-review-popup/DashboardReviewPopUp.js +1 -1
- package/dist/cjs/components/dashboard-review-popup/DashboardReviewPopUp.js.map +1 -1
- package/dist/cjs/components/dot-pulse/DotPulse.js +3 -3
- package/dist/cjs/components/dot-pulse/DotPulse.js.map +1 -1
- package/dist/cjs/components/dropShadow/DropShadow.js +1 -1
- package/dist/cjs/components/dropShadow/DropShadow.js.map +1 -1
- package/dist/cjs/components/dropdown/ChipInput.js +1 -1
- package/dist/cjs/components/dropdown/ChipInput.js.map +1 -1
- package/dist/cjs/components/dropdown/DropdownPopover/index.js +1 -1
- package/dist/cjs/components/dropdown/DropdownPopover/index.js.map +1 -1
- package/dist/cjs/components/dropdown-button/DropdownButton.js +1 -1
- package/dist/cjs/components/dropdown-button/DropdownButton.js.map +1 -1
- package/dist/cjs/components/floater/floater.js +1 -1
- package/dist/cjs/components/floater/floater.js.map +1 -1
- package/dist/cjs/components/input/Input.js +1 -1
- package/dist/cjs/components/input/Input.js.map +1 -1
- package/dist/cjs/components/modals/styledModal.js +2 -2
- package/dist/cjs/components/modals/styledModal.js.map +1 -1
- package/dist/cjs/components/multi-level-dropdown/MenuItem.js +1 -1
- package/dist/cjs/components/multi-level-dropdown/MenuItem.js.map +1 -1
- package/dist/cjs/components/pagination/Pagination.js +1 -1
- package/dist/cjs/components/pagination/Pagination.js.map +1 -1
- package/dist/cjs/components/progress-bar/CircularProgressBar.js +1 -1
- package/dist/cjs/components/progress-bar/CircularProgressBar.js.map +1 -1
- package/dist/cjs/components/progress-bar/ProgressBarComponent.js +2 -2
- package/dist/cjs/components/progress-bar/ProgressBarComponent.js.map +1 -1
- package/dist/cjs/components/progress-bar-v2/ProgressBarV2.js +17 -17
- package/dist/cjs/components/progress-bar-v2/ProgressBarV2.js.map +1 -1
- package/dist/cjs/components/radioButton/RadioButton.js +1 -1
- package/dist/cjs/components/radioButton/RadioButton.js.map +1 -1
- package/dist/cjs/components/radioList/RadioList.js +1 -1
- package/dist/cjs/components/radioList/RadioList.js.map +1 -1
- package/dist/cjs/components/searchBar/searchBar.js +1 -1
- package/dist/cjs/components/searchBar/searchBar.js.map +1 -1
- package/dist/cjs/components/shimmer-image/ShimmerImage.js +1 -1
- package/dist/cjs/components/shimmer-image/ShimmerImage.js.map +1 -1
- package/dist/cjs/components/side-modal/SideModal.js +1 -1
- package/dist/cjs/components/side-modal/SideModal.js.map +1 -1
- package/dist/cjs/components/spinner/Spinner.js +3 -3
- package/dist/cjs/components/spinner/Spinner.js.map +1 -1
- package/dist/cjs/components/star-rating/Star.js +1 -1
- package/dist/cjs/components/star-rating/Star.js.map +1 -1
- package/dist/cjs/components/star-rating/StarRating.js +2 -2
- package/dist/cjs/components/star-rating/StarRating.js.map +1 -1
- package/dist/cjs/components/states/StateComponent.js +1 -1
- package/dist/cjs/components/states/StateComponent.js.map +1 -1
- package/dist/cjs/components/stepper/Stepper.js +1 -1
- package/dist/cjs/components/stepper/Stepper.js.map +1 -1
- package/dist/cjs/components/template-preview/TemplatePreview.js +1 -1
- package/dist/cjs/components/template-preview/TemplatePreview.js.map +1 -1
- package/dist/cjs/components/testimonial-card/TestimonialCard.js +1 -1
- package/dist/cjs/components/testimonial-card/TestimonialCard.js.map +1 -1
- package/dist/cjs/components/thumbnail/Thumbnail.js +1 -1
- package/dist/cjs/components/thumbnail/Thumbnail.js.map +1 -1
- package/dist/cjs/components/unsatisfactory-response-list/UnsatisfactoryResponseList.js +1 -1
- package/dist/cjs/components/unsatisfactory-response-list/UnsatisfactoryResponseList.js.map +1 -1
- package/dist/cjs/components/zeroState/ZeroState.js +3 -3
- package/dist/cjs/components/zeroState/ZeroState.js.map +1 -1
- package/dist/cjs/icons/Media/Visual/FormkitNeutral.js +2 -0
- package/dist/cjs/icons/Media/Visual/FormkitNeutral.js.map +1 -0
- package/dist/cjs/icons/Media/Visual/FormkitSad.js +2 -0
- package/dist/cjs/icons/Media/Visual/FormkitSad.js.map +1 -0
- package/dist/cjs/icons/index.js +1 -1
- package/dist/esm/components/BikGiftedChat/GiftedChat/GiftedChat.js +66 -61
- package/dist/esm/components/BikGiftedChat/GiftedChat/GiftedChat.js.map +1 -1
- package/dist/esm/components/SearchFilter/index.js +11 -10
- package/dist/esm/components/SearchFilter/index.js.map +1 -1
- package/dist/esm/components/agent-builder/constants/tools.js.map +1 -1
- package/dist/esm/components/analytics-chips-and-dropdowns/AnalyticsChip.js +11 -10
- package/dist/esm/components/analytics-chips-and-dropdowns/AnalyticsChip.js.map +1 -1
- package/dist/esm/components/avatar/Avatar.d.ts +2 -1
- package/dist/esm/components/avatar/Avatar.js +34 -24
- package/dist/esm/components/avatar/Avatar.js.map +1 -1
- package/dist/esm/components/avatar/Avatar.styled.d.ts +1 -0
- package/dist/esm/components/avatar/Avatar.styled.js +17 -8
- package/dist/esm/components/avatar/Avatar.styled.js.map +1 -1
- package/dist/esm/components/button/themes.d.ts +1 -0
- package/dist/esm/components/button/themes.js +61 -51
- package/dist/esm/components/button/themes.js.map +1 -1
- package/dist/esm/components/card-selector/CardSelector.js +11 -9
- package/dist/esm/components/card-selector/CardSelector.js.map +1 -1
- package/dist/esm/components/card-selector/CardSelectorGroup.js +1 -0
- package/dist/esm/components/card-selector/CardSelectorGroup.js.map +1 -1
- package/dist/esm/components/carousel/carousel.js +8 -8
- package/dist/esm/components/carousel/carousel.js.map +1 -1
- package/dist/esm/components/checkBox/CheckBox.js +8 -5
- package/dist/esm/components/checkBox/CheckBox.js.map +1 -1
- package/dist/esm/components/code-block/CodeBlock.js +14 -14
- package/dist/esm/components/code-block/CodeBlock.js.map +1 -1
- package/dist/esm/components/colourInput/ColourInput.js +11 -10
- package/dist/esm/components/colourInput/ColourInput.js.map +1 -1
- package/dist/esm/components/dashboard-review-popup/DashboardReviewPopUp.js +28 -21
- package/dist/esm/components/dashboard-review-popup/DashboardReviewPopUp.js.map +1 -1
- package/dist/esm/components/dot-pulse/DotPulse.js +15 -15
- package/dist/esm/components/dot-pulse/DotPulse.js.map +1 -1
- package/dist/esm/components/dropShadow/DropShadow.js +6 -6
- package/dist/esm/components/dropShadow/DropShadow.js.map +1 -1
- package/dist/esm/components/dropdown/ChipInput.js +10 -9
- package/dist/esm/components/dropdown/ChipInput.js.map +1 -1
- package/dist/esm/components/dropdown/DropdownPopover/index.js +26 -25
- package/dist/esm/components/dropdown/DropdownPopover/index.js.map +1 -1
- package/dist/esm/components/dropdown-button/DropdownButton.js +13 -13
- package/dist/esm/components/dropdown-button/DropdownButton.js.map +1 -1
- package/dist/esm/components/floater/floater.js +14 -13
- package/dist/esm/components/floater/floater.js.map +1 -1
- package/dist/esm/components/input/Input.js +35 -34
- package/dist/esm/components/input/Input.js.map +1 -1
- package/dist/esm/components/input/Input.model.d.ts +1 -0
- package/dist/esm/components/modals/styledModal.js +6 -5
- package/dist/esm/components/modals/styledModal.js.map +1 -1
- package/dist/esm/components/multi-level-dropdown/MenuItem.js +28 -27
- package/dist/esm/components/multi-level-dropdown/MenuItem.js.map +1 -1
- package/dist/esm/components/pagination/Pagination.js +7 -7
- package/dist/esm/components/pagination/Pagination.js.map +1 -1
- package/dist/esm/components/progress-bar/CircularProgressBar.js +61 -50
- package/dist/esm/components/progress-bar/CircularProgressBar.js.map +1 -1
- package/dist/esm/components/progress-bar/ProgressBarComponent.js +14 -13
- package/dist/esm/components/progress-bar/ProgressBarComponent.js.map +1 -1
- package/dist/esm/components/progress-bar-v2/ProgressBarV2.js +57 -39
- package/dist/esm/components/progress-bar-v2/ProgressBarV2.js.map +1 -1
- package/dist/esm/components/radioButton/RadioButton.js +10 -9
- package/dist/esm/components/radioButton/RadioButton.js.map +1 -1
- package/dist/esm/components/radioList/RadioList.js +28 -19
- package/dist/esm/components/radioList/RadioList.js.map +1 -1
- package/dist/esm/components/searchBar/searchBar.js +11 -10
- package/dist/esm/components/searchBar/searchBar.js.map +1 -1
- package/dist/esm/components/shimmer-image/ShimmerImage.js +19 -18
- package/dist/esm/components/shimmer-image/ShimmerImage.js.map +1 -1
- package/dist/esm/components/side-modal/SideModal.js +13 -5
- package/dist/esm/components/side-modal/SideModal.js.map +1 -1
- package/dist/esm/components/spinner/Spinner.js +19 -11
- package/dist/esm/components/spinner/Spinner.js.map +1 -1
- package/dist/esm/components/star-rating/Star.d.ts +1 -0
- package/dist/esm/components/star-rating/Star.js +32 -27
- package/dist/esm/components/star-rating/Star.js.map +1 -1
- package/dist/esm/components/star-rating/StarRating.js +17 -16
- package/dist/esm/components/star-rating/StarRating.js.map +1 -1
- package/dist/esm/components/states/StateComponent.js +47 -30
- package/dist/esm/components/states/StateComponent.js.map +1 -1
- package/dist/esm/components/stepper/Stepper.js +24 -16
- package/dist/esm/components/stepper/Stepper.js.map +1 -1
- package/dist/esm/components/template-preview/TemplatePreview.js +41 -40
- package/dist/esm/components/template-preview/TemplatePreview.js.map +1 -1
- package/dist/esm/components/testimonial-card/TestimonialCard.js +5 -4
- package/dist/esm/components/testimonial-card/TestimonialCard.js.map +1 -1
- package/dist/esm/components/thumbnail/Thumbnail.js +3 -3
- package/dist/esm/components/thumbnail/Thumbnail.js.map +1 -1
- package/dist/esm/components/unsatisfactory-response-list/UnsatisfactoryResponseList.js +19 -18
- package/dist/esm/components/unsatisfactory-response-list/UnsatisfactoryResponseList.js.map +1 -1
- package/dist/esm/components/zeroState/ZeroState.js +20 -13
- package/dist/esm/components/zeroState/ZeroState.js.map +1 -1
- package/dist/esm/icons/Media/Visual/FormkitNeutral.js +58 -0
- package/dist/esm/icons/Media/Visual/FormkitNeutral.js.map +1 -0
- package/dist/esm/icons/Media/Visual/FormkitSad.js +61 -0
- package/dist/esm/icons/Media/Visual/FormkitSad.js.map +1 -0
- package/dist/esm/icons/Media/Visual/index.d.ts +2 -0
- package/dist/esm/icons/index.d.ts +25 -25
- package/dist/esm/icons/index.js +420 -416
- package/dist/esm/icons/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"themes.js","sources":["../../../../src/components/button/themes.tsx"],"sourcesContent":["import { COLORS } from '@src/constants/Theme';\nimport {\n\tBodyCaption,\n\tBodySecondary,\n\tButtonLarge,\n\tButtonLargeAI,\n\tButtonRegular,\n\tButtonRegularAI,\n} from '../TypographyStyle';\nimport { Size, Type } from './model';\n\nexport const getBackgroundColor = (\n\ttype: Type,\n\tsize: Size,\n\tinverse?: boolean,\n\tdarkMode?: boolean,\n\tbuttonColor?: string,\n): string => {\n\tif (type === 'special') return COLORS.background.brandVeryLight;\n\tif (type === 'secondaryGray') return 'transparent';\n\n\tif (size === 'chip') {\n\t\tif (type === 'text') {\n\t\t\treturn 'transparent';\n\t\t}\n\t\treturn darkMode ? COLORS.surface.hovered : COLORS.surface.subdued;\n\t}\n\tswitch (type) {\n\t\tcase 'primary':\n\t\t\treturn buttonColor\n\t\t\t\t? buttonColor\n\t\t\t\t: inverse\n\t\t\t\t? COLORS.background.warning.vibrant\n\t\t\t\t: COLORS.background.inverseLight;\n\t\tcase 'destructive':\n\t\t\treturn COLORS.background.negative.vibrant;\n\t\tcase 'tertiary':\n\t\t\treturn 'transparent';\n\t\tdefault:\n\t\t\treturn 'transparent';\n\t}\n};\n\nexport const getColor = (\n\ttype: Type,\n\tsize: Size,\n\tinverse?: boolean,\n\tdarkMode?: boolean,\n): string => {\n\tif (type === 'special') return COLORS.background.inverseLight;\n\tif (type === 'secondaryGray') return COLORS.content.secondary;\n\n\tif (size === 'chip') {\n\t\tif (type === 'text') {\n\t\t\treturn inverse ? COLORS.content.inactive : COLORS.content.brand;\n\t\t}\n\t\treturn darkMode ? COLORS.content.primary : COLORS.content.secondary;\n\t}\n\tswitch (type) {\n\t\tcase 'primary':\n\t\t\treturn inverse ? COLORS.content.primary : COLORS.content.primaryInverse;\n\t\tcase 'tertiaryGray':\n\t\t\treturn COLORS.content.secondary;\n\t\tcase 'destructive':\n\t\t\treturn COLORS.content.primaryInverse;\n\t\tcase 'dashBold':\n\t\t\treturn COLORS.content.secondary;\n\t\tcase 'dashRegular':\n\t\t\treturn COLORS.content.secondary;\n\t\tcase 'ai':\n\t\t\treturn COLORS.content.ai;\n\t\tdefault:\n\t\t\treturn inverse ? COLORS.content.primaryInverse : COLORS.stroke.brand;\n\t}\n};\n\nexport const getDisabledTextColor = (inverse?: boolean) => {\n\tif (inverse) {\n\t\treturn 'rgba(255, 255, 255, 0.5)';\n\t}\n\treturn COLORS.content.inactive;\n};\n\nexport const getPadding = (type: Type, size: Size) => {\n\tif (type === 'text') {\n\t\treturn '0px';\n\t} else if (size === 'xs') {\n\t\treturn '4px 6px';\n\t} else if (size === 'chip') {\n\t\treturn '4px 8px';\n\t} else if (size === 'small') {\n\t\tswitch (type) {\n\t\t\tcase 'tertiary':\n\t\t\t\treturn '6px 4px';\n\t\t\tcase 'tertiaryGray':\n\t\t\t\treturn '6px 4px';\n\t\t\tdefault:\n\t\t\t\treturn '6px 12px';\n\t\t}\n\t} else if (size === 'medium') {\n\t\tswitch (type) {\n\t\t\tcase 'tertiary':\n\t\t\t\treturn '10px 4px';\n\t\t\tcase 'tertiaryGray':\n\t\t\t\treturn '10px 4px';\n\t\t\tdefault:\n\t\t\t\treturn '10px 12px';\n\t\t}\n\t} else if (size === 'large') {\n\t\tswitch (type) {\n\t\t\tcase 'tertiary':\n\t\t\t\treturn '14px 4px';\n\t\t\tcase 'tertiaryGray':\n\t\t\t\treturn '14px 4px';\n\t\t\tdefault:\n\t\t\t\treturn '14px 12px';\n\t\t}\n\t}\n};\nexport const GetButtonTextComponent = (\n\tsize: Size,\n\ttype: Type,\n\tdisabled?: boolean,\n) => {\n\tif (!disabled && type === 'ai') {\n\t\tif (size === 'small') {\n\t\t\treturn ButtonRegularAI;\n\t\t} else {\n\t\t\treturn ButtonLargeAI;\n\t\t}\n\t}\n\n\tif (type === 'dashRegular') {\n\t\treturn BodySecondary;\n\t}\n\tif (size === 'chip' || size === 'xs') {\n\t\treturn BodyCaption;\n\t} else if (size === 'small') {\n\t\treturn ButtonRegular;\n\t}\n\treturn ButtonLarge;\n};\n\nexport const getBorderColor = (\n\ttype: Type,\n\tinverse?: boolean,\n\terror?: boolean,\n): string => {\n\tif (error) {\n\t\treturn COLORS.stroke.negative.vibrant;\n\t}\n\n\tif (inverse) {\n\t\treturn COLORS.surface.standard;\n\t}\n\tif (type == 'secondary') {\n\t\treturn COLORS.stroke.brand;\n\t}\n\treturn COLORS.content.placeholder;\n};\n\nexport const getBorder = (\n\tversion: '1.0' | '2.0' | '3.0',\n\ttype: Type,\n\tsize: Size,\n\tinverse?: boolean,\n\terror?: boolean,\n): string => {\n\tif (type == 'text') {\n\t\treturn 'border: none;';\n\t}\n\tif (type === 'special') {\n\t\treturn `border: 1px solid ${COLORS.stroke.brandLightAlt};`;\n\t}\n\tif (type === 'secondaryGray') {\n\t\treturn `border: 1px solid ${COLORS.stroke.primary};`;\n\t}\n\tif (size === 'chip') {\n\t\treturn `border: ${version === '2.0' ? 0.5 : 1}px solid ${\n\t\t\tCOLORS.stroke.primary\n\t\t};`;\n\t}\n\tif (inverse) {\n\t\tif (type === 'secondary') {\n\t\t\treturn `border: ${version === '2.0' ? 0.5 : 1}px solid ${getBorderColor(\n\t\t\t\ttype,\n\t\t\t\tinverse,\n\t\t\t\terror,\n\t\t\t)};`;\n\t\t}\n\t\treturn 'border: none;';\n\t}\n\n\tif (type === 'secondary') {\n\t\treturn `border: ${version === '2.0' ? 0.5 : 1}px solid ${getBorderColor(\n\t\t\ttype,\n\t\t\tfalse,\n\t\t\terror,\n\t\t)};`;\n\t}\n\treturn 'border: none;';\n};\n\nexport const getLinearGradientValue = (size: Size): string => {\n\tif (size === 'medium') {\n\t\treturn `5px,\n\t\ttransparent 5px,\n\t\ttransparent 10px`;\n\t}\n\treturn `6px,\n\t\ttransparent 6px,\n\t\ttransparent 12px`;\n};\n\n/**\n * Adjusts the brightness of a given hex color by a specified percentage.\n * Below function is used to generate a hover effect for button backgrounds.\n *\n * @param {string} color - The hex color code to be adjusted (e.g., \"#ff0000\").\n * @param {number} percent - The percentage by which to darken the color. Positive values darken the color.\n * @returns {string} - The adjusted hex color code.\n *\n * @example\n * // Darken the color #ff0000 (red) by 10%\n * const darkerRed = getHoverButtonBackgroundCustom(\"#ff0000\", 10);\n * console.log(darkerRed); // Output might be \"#e60000\"\n */\n\nexport const getHoverButtonBackgroundCustom = (\n\tcolor: string,\n\tpercent: number,\n) => {\n\tconst num = parseInt(color.replace('#', ''), 16),\n\t\tamt = Math.round(2.55 * percent),\n\t\tR = (num >> 16) - amt,\n\t\tG = ((num >> 8) & 0x00ff) - amt,\n\t\tB = (num & 0x0000ff) - amt;\n\n\treturn `#${(\n\t\t0x1000000 +\n\t\t(Math.max(R, 0) << 16) +\n\t\t(Math.max(G, 0) << 8) +\n\t\tMath.max(B, 0)\n\t)\n\t\t.toString(16)\n\t\t.slice(1)}`;\n};\n\n/**\n * Generates a new color by adjusting the brightness of the given color by a specified percentage.\n *\n * @param color - The original color in hexadecimal format (e.g., \"#RRGGBB\").\n * @param percent - The percentage to adjust the brightness. Positive values will lighten the color, while negative values will darken it.\n * @returns The new color in hexadecimal format after adjusting the brightness.\n *\n * @example\n * // Lighten the color by 20%\n * const newColor = getLoadingButtonBackgroundCustom(\"#ff0000\", 20); // \"#ff3333\"\n *\n * @example\n * // Darken the color by 10%\n * const newColor = getLoadingButtonBackgroundCustom(\"#00ff00\", -10); // \"#00e600\"\n */\nexport const getLoadingButtonBackgroundCustom = (\n\tcolor: string,\n\tpercent: number,\n) => {\n\tconst num = parseInt(color.replace('#', ''), 16),\n\t\tamt = Math.round(2.55 * percent),\n\t\tR = (num >> 16) + amt,\n\t\tG = ((num >> 8) & 0x00ff) + amt,\n\t\tB = (num & 0x0000ff) + amt;\n\n\treturn `#${(\n\t\t0x1000000 +\n\t\t(Math.min(R, 255) << 16) +\n\t\t(Math.min(G, 255) << 8) +\n\t\tMath.min(B, 255)\n\t)\n\t\t.toString(16)\n\t\t.slice(1)}`;\n};\n\nexport const getHoverButtonBackground = (type: Type, inverse?: boolean) => {\n\tif (type === 'ai') {\n\t\treturn `background: ${COLORS.surface.aiLight};`;\n\t}\n\n\tif (type === 'text') {\n\t\treturn `background-color:transparent;`;\n\t}\n\tif (type === 'special' || type === 'secondaryGray') {\n\t\treturn '';\n\t}\n\tif (!inverse && type !== 'primary') {\n\t\treturn `background-color: #000000;\n\t\t\t\topacity: 0.03;`;\n\t}\n\n\treturn ``;\n};\n\nexport const getHoverButtonTextDecorationStyle = (\n\ttype: Type,\n\tdisabled?: boolean,\n) => {\n\tif (disabled) {\n\t\treturn '';\n\t}\n\treturn `text-decoration-line: underline;\n\t\t\ttext-decoration-color: ${COLORS.content.brand};`;\n};\n\nexport const generateInverseHoverBackground = (\n\ttype: Type,\n\tdisabled?: boolean,\n) => {\n\tif (disabled) {\n\t\treturn '';\n\t}\n\tif (type === 'primary') {\n\t\treturn `background-color: ${COLORS.stroke.warning.lightAlt};`;\n\t}\n\treturn `background-color: rgba(255, 255, 255, 0.1)`;\n};\n\nexport const generateDisabledStyling = (\n\ttype: Type,\n\tsize: Size,\n\tinverse?: boolean,\n) => {\n\tif (type === 'special') {\n\t\treturn `background-color: ${COLORS.background.base}; border: 1px solid ${COLORS.stroke.primary};`;\n\t}\n\tif (type === 'secondaryGray') {\n\t\treturn `border: 1px solid ${COLORS.stroke.primary};`;\n\t}\n\tif (size === 'chip') {\n\t\treturn `background-color: transparent;`;\n\t}\n\tif (type === 'primary' || type === 'destructive') {\n\t\treturn inverse\n\t\t\t? 'background-color: rgba(255,255,255,0.3);'\n\t\t\t: `background-color: ${COLORS.background.inactive};`;\n\t} else if (type === 'secondary') {\n\t\treturn inverse\n\t\t\t? `border: 1px solid rgba(255, 255, 255, 0.5);`\n\t\t\t: `border: 1px solid ${COLORS.stroke.primary};`;\n\t}\n\treturn '';\n};\n\nexport const getDashedBorderStyling = (\n\ttype: Type,\n\tsize: Size,\n\tborderColor: string = getBorderColor(type, false),\n) => {\n\treturn `\n\t.line-top {\n\t\tposition: absolute;\n\t\tleft: 0;\n\t\ttop: 0;\n\t\theight: 1px;\n\t\twidth: 100%;\n\t\tbackground: repeating-linear-gradient(\n\t\t\tto right,\n\t\t\t${borderColor},\n\t\t\t${borderColor}\n\t\t\t\t${getLinearGradientValue(size)}\n\t\t);\n\t}\n\t.line-right {\n\t\tposition: absolute;\n\t\tright: 0;\n\t\ttop: 0;\n\t\twidth: 1px;\n\t\theight: 100%;\n\t\tbackground: repeating-linear-gradient(\n\t\t\tto bottom,\n\t\t\t${borderColor},\n\t\t\t${borderColor}\n\t\t\t\t${getLinearGradientValue(size)}\n\t\t);\n\t}\n\t.line-bottom {\n\t\tposition: absolute;\n\t\tleft: 0;\n\t\tbottom: 0;\n\t\theight: 1px;\n\t\twidth: 100%;\n\t\tbackground: repeating-linear-gradient(\n\t\t\tto right,\n\t\t\t${borderColor},\n\t\t\t${borderColor}\n\t\t\t\t${getLinearGradientValue(size)}\n\t\t);\n\t}\n\t.line-left {\n\t\tposition: absolute;\n\t\tleft: 0;\n\t\ttop: 0;\n\t\twidth: 1px;\n\t\theight: 100%;\n\t\tbackground: repeating-linear-gradient(\n\t\t\tto bottom,\n\t\t\t${borderColor},\n\t\t\t${borderColor}\n\t\t\t\t${getLinearGradientValue(size)}\n\t\t);\n\t}\n\t`;\n};\n\nexport const getClickEffect = (type: Type, size: Size, inverse?: boolean) => {\n\tif (type === 'text') {\n\t\treturn `background-color: ${COLORS.background.brandLight};\n\t\t\ttext-decoration-line: underline;\n\t\t\ttext-decoration-color: ${COLORS.content.brand};`;\n\t}\n\tif (type === 'special') {\n\t\treturn `background-color: ${COLORS.background.brandLight}; border: 1px solid ${COLORS.stroke.brandLightAlt};`;\n\t}\n\tif (type === 'secondaryGray') {\n\t\treturn `background-color: ${COLORS.surface.hovered}; border: 1px solid ${COLORS.stroke.primary};`;\n\t}\n\tif (size === 'chip') {\n\t\treturn `border: 1px solid ${COLORS.stroke.brandLightAlt};\n\t\tbackground-color: ${COLORS.background.brandLight};`;\n\t}\n\tif (type === 'primary' || type === 'destructive') {\n\t\tif (inverse) {\n\t\t\treturn `background-color: ${COLORS.background.warning.vibrant} !important;\n\t\t\tbox-shadow: inset 0px 4px 12px rgba(0, 0, 0, 0.35);\n\t\t\t`;\n\t\t}\n\t\treturn 'box-shadow: inset 0px 4px 12px rgba(0, 0, 0, 0.35);';\n\t} else if (\n\t\ttype === 'secondary' ||\n\t\ttype === 'tertiary' ||\n\t\ttype === 'tertiaryGray' ||\n\t\ttype.startsWith('dash')\n\t) {\n\t\treturn inverse\n\t\t\t? `background-color: ${COLORS.background.inverseLight} !important;`\n\t\t\t: `background-color: ${COLORS.background.brandLight};`;\n\t}\n};\nexport const getLoadingBackground = (\n\ttype: Type,\n\tsize: Size,\n\tinverse?: boolean,\n\tbuttonColor?: string,\n) => {\n\tif (type === 'special') {\n\t\treturn `background-color: ${COLORS.background.brandVeryLight};`;\n\t}\n\tif (type === 'secondaryGray') {\n\t\treturn `background-color: ${COLORS.surface.subdued};`;\n\t}\n\tif (size === 'chip') {\n\t\treturn `background-color: ${COLORS.background.base};`;\n\t}\n\tif (type === 'primary') {\n\t\tif (buttonColor) {\n\t\t\treturn `background-color: ${getLoadingButtonBackgroundCustom(\n\t\t\t\tbuttonColor,\n\t\t\t\t50,\n\t\t\t)};`;\n\t\t}\n\t\treturn `background-color: ${\n\t\t\tinverse ? COLORS.background.warning.vibrant : COLORS.background.brandLight\n\t\t};`;\n\t}\n\tif (type === 'destructive') {\n\t\treturn `background-color: ${COLORS.background.negative.light};`;\n\t}\n\treturn 'background-color: transparent;';\n};\n\nexport const getLoadingBorder = (type: Type, size: Size, inverse?: boolean) => {\n\tif (type === 'special') {\n\t\treturn `border: 1px solid ${COLORS.stroke.brandLightAlt};`;\n\t}\n\tif (type === 'secondaryGray') {\n\t\treturn `border: 1px solid ${COLORS.stroke.primary};`;\n\t}\n\tif (size === 'chip') {\n\t\treturn `border: none;`;\n\t}\n\tif (type === 'secondary') {\n\t\treturn inverse\n\t\t\t? `border: 1px solid ${COLORS.content.secondary};`\n\t\t\t: `border: 1px solid ${COLORS.stroke.brandLightAlt};`;\n\t}\n\treturn '';\n};\n\nexport const SpinnerColorMap = (type: Type, inverse?: boolean) => {\n\tif (type === 'secondaryGray') return COLORS.content.secondary;\n\tif (inverse) {\n\t\tif (type === 'primary') {\n\t\t\treturn COLORS.content.primary;\n\t\t}\n\t\treturn COLORS.content.primaryInverse;\n\t}\n\tif (type === 'destructive') {\n\t\treturn COLORS.content.negative;\n\t}\n\treturn COLORS.content.brand;\n};\n\nexport const getButtonIconColor = (\n\tsize: Size,\n\ttype: Type,\n\tinverse?: boolean,\n\tdisabled?: boolean,\n\tisLoading?: boolean,\n\tdarkMode?: boolean,\n) => {\n\tif (size === 'chip') {\n\t\tif (disabled) {\n\t\t\treturn COLORS.content.inactive;\n\t\t} else if (darkMode) {\n\t\t\treturn COLORS.content.primary;\n\t\t}\n\t\treturn COLORS.content.secondary;\n\t}\n\tif (isLoading) {\n\t\treturn 'transparent';\n\t}\n\tif (type === 'special') {\n\t\treturn disabled ? COLORS.content.inactive : COLORS.background.inverseLight;\n\t}\n\tif (type === 'secondaryGray') {\n\t\treturn disabled ? COLORS.content.inactive : COLORS.content.secondary;\n\t}\n\tif (type === 'primary' || type === 'destructive') {\n\t\tif (inverse) {\n\t\t\tif (disabled) {\n\t\t\t\treturn 'rgba(255, 255, 255, 0.5)';\n\t\t\t}\n\t\t\treturn COLORS.content.primary;\n\t\t}\n\t\tif (disabled) {\n\t\t\treturn COLORS.content.inactive;\n\t\t}\n\t\treturn COLORS.content.primaryInverse;\n\t} else if (type === 'secondary') {\n\t\tif (inverse) {\n\t\t\tif (disabled) {\n\t\t\t\treturn 'rgba(255, 255, 255, 0.5)';\n\t\t\t}\n\t\t\treturn COLORS.content.primaryInverse;\n\t\t}\n\t\tif (disabled) {\n\t\t\treturn COLORS.content.inactive;\n\t\t}\n\t\treturn COLORS.content.brand;\n\t} else if (type === 'tertiary') {\n\t\tif (inverse) {\n\t\t\tif (disabled) {\n\t\t\t\treturn 'rgba(255, 255, 255, 0.5)';\n\t\t\t}\n\t\t\treturn COLORS.content.primaryInverse;\n\t\t}\n\t\tif (disabled) {\n\t\t\treturn COLORS.content.inactive;\n\t\t}\n\t\treturn COLORS.content.brand;\n\t} else if (type === 'tertiaryGray' || type.startsWith('dash')) {\n\t\tif (disabled) {\n\t\t\treturn COLORS.content.inactive;\n\t\t}\n\t\treturn COLORS.content.secondary;\n\t}\n};\n"],"names":["getBackgroundColor","type","size","inverse","darkMode","buttonColor","COLORS","getColor","getDisabledTextColor","getPadding","GetButtonTextComponent","disabled","ButtonRegularAI","ButtonLargeAI","BodySecondary","BodyCaption","ButtonRegular","ButtonLarge","getBorderColor","error","getBorder","version","getLinearGradientValue","getHoverButtonBackgroundCustom","color","percent","num","amt","R","G","B","getLoadingButtonBackgroundCustom","getHoverButtonBackground","getHoverButtonTextDecorationStyle","generateInverseHoverBackground","generateDisabledStyling","getDashedBorderStyling","borderColor","getClickEffect","getLoadingBackground","getLoadingBorder","SpinnerColorMap","getButtonIconColor","isLoading"],"mappings":";;AAWO,MAAMA,IAAqB,CACjCC,GACAC,GACAC,GACAC,GACAC,MACY;AACZ,MAAIJ,MAAS,UAAW,QAAOK,EAAO,WAAW;AACjD,MAAIL,MAAS,gBAAiB,QAAO;AAErC,MAAIC,MAAS;AACZ,WAAID,MAAS,SACL,gBAEDG,IAAWE,EAAO,QAAQ,UAAUA,EAAO,QAAQ;AAE3D,UAAQL,GAAA;AAAA,IACP,KAAK;AACJ,aAAOI,MAEJF,IACAG,EAAO,WAAW,QAAQ,UAC1BA,EAAO,WAAW;AAAA,IACtB,KAAK;AACJ,aAAOA,EAAO,WAAW,SAAS;AAAA,IACnC,KAAK;AACJ,aAAO;AAAA,IACR;AACC,aAAO;AAAA,EAAA;AAEV,GAEaC,IAAW,CACvBN,GACAC,GACAC,GACAC,MACY;AACZ,MAAIH,MAAS,UAAW,QAAOK,EAAO,WAAW;AACjD,MAAIL,MAAS,gBAAiB,QAAOK,EAAO,QAAQ;AAEpD,MAAIJ,MAAS;AACZ,WAAID,MAAS,SACLE,IAAUG,EAAO,QAAQ,WAAWA,EAAO,QAAQ,QAEpDF,IAAWE,EAAO,QAAQ,UAAUA,EAAO,QAAQ;A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M;AAC3D,WAAIU,IACIL,EAAO,QAAQ,WAEhBA,EAAO,QAAQ;AAExB;"}
|
|
1
|
+
{"version":3,"file":"themes.js","sources":["../../../../src/components/button/themes.tsx"],"sourcesContent":["import { COLORS } from '@src/constants/Theme';\nimport {\n\tBodyCaption,\n\tBodySecondary,\n\tButtonLarge,\n\tButtonLargeAI,\n\tButtonRegular,\n\tButtonRegularAI,\n} from '../TypographyStyle';\nimport { Size, Type } from './model';\n\nexport const getBackgroundColor = (\n\ttype: Type,\n\tsize: Size,\n\tinverse?: boolean,\n\tdarkMode?: boolean,\n\tbuttonColor?: string,\n): string => {\n\tif (type === 'special') return COLORS.background.brandVeryLight;\n\tif (type === 'secondaryGray') return 'transparent';\n\n\tif (size === 'chip') {\n\t\tif (type === 'text') {\n\t\t\treturn 'transparent';\n\t\t}\n\t\treturn darkMode ? COLORS.surface.hovered : COLORS.surface.subdued;\n\t}\n\tswitch (type) {\n\t\tcase 'primary':\n\t\t\treturn buttonColor\n\t\t\t\t? buttonColor\n\t\t\t\t: inverse\n\t\t\t\t? COLORS.background.warning.vibrant\n\t\t\t\t: COLORS.background.inverseLight;\n\t\tcase 'destructive':\n\t\t\treturn COLORS.background.negative.vibrant;\n\t\tcase 'tertiary':\n\t\t\treturn 'transparent';\n\t\tdefault:\n\t\t\treturn 'transparent';\n\t}\n};\n\nexport const getColor = (\n\ttype: Type,\n\tsize: Size,\n\tinverse?: boolean,\n\tdarkMode?: boolean,\n): string => {\n\tif (type === 'special') return COLORS.background.inverseLight;\n\tif (type === 'secondaryGray') return COLORS.content.secondary;\n\n\tif (size === 'chip') {\n\t\tif (type === 'text') {\n\t\t\treturn inverse ? COLORS.content.inactive : COLORS.content.brand;\n\t\t}\n\t\treturn darkMode ? COLORS.content.primary : COLORS.content.secondary;\n\t}\n\tswitch (type) {\n\t\tcase 'primary':\n\t\t\treturn inverse ? COLORS.content.primary : COLORS.content.primaryInverse;\n\t\tcase 'tertiaryGray':\n\t\t\treturn COLORS.content.secondary;\n\t\tcase 'destructive':\n\t\t\treturn COLORS.content.primaryInverse;\n\t\tcase 'dashBold':\n\t\t\treturn COLORS.content.secondary;\n\t\tcase 'dashRegular':\n\t\t\treturn COLORS.content.secondary;\n\t\tcase 'ai':\n\t\t\treturn COLORS.content.ai;\n\t\tdefault:\n\t\t\treturn inverse ? COLORS.content.primaryInverse : COLORS.stroke.brand;\n\t}\n};\n\nexport const getDisabledTextColor = (inverse?: boolean) => {\n\tif (inverse) {\n\t\treturn 'rgba(255, 255, 255, 0.5)';\n\t}\n\treturn COLORS.content.inactive;\n};\n\nexport const getPadding = (type: Type, size: Size) => {\n\tif (type === 'text') {\n\t\treturn '0px';\n\t} else if (size === 'xs') {\n\t\treturn '4px 6px';\n\t} else if (size === 'chip') {\n\t\treturn '4px 8px';\n\t} else if (size === 'small') {\n\t\tswitch (type) {\n\t\t\tcase 'tertiary':\n\t\t\t\treturn '6px 4px';\n\t\t\tcase 'tertiaryGray':\n\t\t\t\treturn '6px 4px';\n\t\t\tdefault:\n\t\t\t\treturn '6px 12px';\n\t\t}\n\t} else if (size === 'medium') {\n\t\tswitch (type) {\n\t\t\tcase 'tertiary':\n\t\t\t\treturn '10px 4px';\n\t\t\tcase 'tertiaryGray':\n\t\t\t\treturn '10px 4px';\n\t\t\tdefault:\n\t\t\t\treturn '10px 12px';\n\t\t}\n\t} else if (size === 'large') {\n\t\tswitch (type) {\n\t\t\tcase 'tertiary':\n\t\t\t\treturn '14px 4px';\n\t\t\tcase 'tertiaryGray':\n\t\t\t\treturn '14px 4px';\n\t\t\tdefault:\n\t\t\t\treturn '14px 12px';\n\t\t}\n\t}\n};\nexport const GetButtonTextComponent = (\n\tsize: Size,\n\ttype: Type,\n\tdisabled?: boolean,\n) => {\n\tif (!disabled && type === 'ai') {\n\t\tif (size === 'small') {\n\t\t\treturn ButtonRegularAI;\n\t\t} else {\n\t\t\treturn ButtonLargeAI;\n\t\t}\n\t}\n\n\tif (type === 'dashRegular') {\n\t\treturn BodySecondary;\n\t}\n\tif (size === 'chip' || size === 'xs') {\n\t\treturn BodyCaption;\n\t} else if (size === 'small') {\n\t\treturn ButtonRegular;\n\t}\n\treturn ButtonLarge;\n};\n\nexport const getBorderColor = (\n\ttype: Type,\n\tinverse?: boolean,\n\terror?: boolean,\n): string => {\n\tif (error) {\n\t\treturn COLORS.stroke.negative.vibrant;\n\t}\n\n\tif (inverse) {\n\t\treturn COLORS.surface.standard;\n\t}\n\tif (type == 'secondary') {\n\t\treturn COLORS.stroke.brand;\n\t}\n\treturn COLORS.content.placeholder;\n};\n\nexport const strokeStyle = (size: Size, color: string, width = 1): string =>\n\tsize === 'xs'\n\t\t? `box-shadow: inset 0 0 0 ${width}px ${color}; border: none;`\n\t\t: `border: ${width}px solid ${color};`;\n\nexport const getBorder = (\n\tversion: '1.0' | '2.0' | '3.0',\n\ttype: Type,\n\tsize: Size,\n\tinverse?: boolean,\n\terror?: boolean,\n): string => {\n\tif (type == 'text') {\n\t\treturn 'border: none;';\n\t}\n\tif (type === 'special') {\n\t\treturn strokeStyle(size, COLORS.stroke.brandLightAlt);\n\t}\n\tif (type === 'secondaryGray') {\n\t\treturn strokeStyle(size, COLORS.stroke.primary);\n\t}\n\tif (size === 'chip') {\n\t\treturn `border: ${version === '2.0' ? 0.5 : 1}px solid ${\n\t\t\tCOLORS.stroke.primary\n\t\t};`;\n\t}\n\tif (inverse) {\n\t\tif (type === 'secondary') {\n\t\t\treturn strokeStyle(\n\t\t\t\tsize,\n\t\t\t\tgetBorderColor(type, inverse, error),\n\t\t\t\tversion === '2.0' ? 0.5 : 1,\n\t\t\t);\n\t\t}\n\t\treturn 'border: none;';\n\t}\n\n\tif (type === 'secondary') {\n\t\treturn strokeStyle(\n\t\t\tsize,\n\t\t\tgetBorderColor(type, false, error),\n\t\t\tversion === '2.0' ? 0.5 : 1,\n\t\t);\n\t}\n\treturn 'border: none;';\n};\n\nexport const getLinearGradientValue = (size: Size): string => {\n\tif (size === 'medium') {\n\t\treturn `5px,\n\t\ttransparent 5px,\n\t\ttransparent 10px`;\n\t}\n\treturn `6px,\n\t\ttransparent 6px,\n\t\ttransparent 12px`;\n};\n\n/**\n * Adjusts the brightness of a given hex color by a specified percentage.\n * Below function is used to generate a hover effect for button backgrounds.\n *\n * @param {string} color - The hex color code to be adjusted (e.g., \"#ff0000\").\n * @param {number} percent - The percentage by which to darken the color. Positive values darken the color.\n * @returns {string} - The adjusted hex color code.\n *\n * @example\n * // Darken the color #ff0000 (red) by 10%\n * const darkerRed = getHoverButtonBackgroundCustom(\"#ff0000\", 10);\n * console.log(darkerRed); // Output might be \"#e60000\"\n */\n\nexport const getHoverButtonBackgroundCustom = (\n\tcolor: string,\n\tpercent: number,\n) => {\n\tconst num = parseInt(color.replace('#', ''), 16),\n\t\tamt = Math.round(2.55 * percent),\n\t\tR = (num >> 16) - amt,\n\t\tG = ((num >> 8) & 0x00ff) - amt,\n\t\tB = (num & 0x0000ff) - amt;\n\n\treturn `#${(\n\t\t0x1000000 +\n\t\t(Math.max(R, 0) << 16) +\n\t\t(Math.max(G, 0) << 8) +\n\t\tMath.max(B, 0)\n\t)\n\t\t.toString(16)\n\t\t.slice(1)}`;\n};\n\n/**\n * Generates a new color by adjusting the brightness of the given color by a specified percentage.\n *\n * @param color - The original color in hexadecimal format (e.g., \"#RRGGBB\").\n * @param percent - The percentage to adjust the brightness. Positive values will lighten the color, while negative values will darken it.\n * @returns The new color in hexadecimal format after adjusting the brightness.\n *\n * @example\n * // Lighten the color by 20%\n * const newColor = getLoadingButtonBackgroundCustom(\"#ff0000\", 20); // \"#ff3333\"\n *\n * @example\n * // Darken the color by 10%\n * const newColor = getLoadingButtonBackgroundCustom(\"#00ff00\", -10); // \"#00e600\"\n */\nexport const getLoadingButtonBackgroundCustom = (\n\tcolor: string,\n\tpercent: number,\n) => {\n\tconst num = parseInt(color.replace('#', ''), 16),\n\t\tamt = Math.round(2.55 * percent),\n\t\tR = (num >> 16) + amt,\n\t\tG = ((num >> 8) & 0x00ff) + amt,\n\t\tB = (num & 0x0000ff) + amt;\n\n\treturn `#${(\n\t\t0x1000000 +\n\t\t(Math.min(R, 255) << 16) +\n\t\t(Math.min(G, 255) << 8) +\n\t\tMath.min(B, 255)\n\t)\n\t\t.toString(16)\n\t\t.slice(1)}`;\n};\n\nexport const getHoverButtonBackground = (type: Type, inverse?: boolean) => {\n\tif (type === 'ai') {\n\t\treturn `background: ${COLORS.surface.aiLight};`;\n\t}\n\n\tif (type === 'text') {\n\t\treturn `background-color:transparent;`;\n\t}\n\tif (type === 'special' || type === 'secondaryGray') {\n\t\treturn '';\n\t}\n\tif (!inverse && type !== 'primary') {\n\t\treturn `background-color: #000000;\n\t\t\t\topacity: 0.03;`;\n\t}\n\n\treturn ``;\n};\n\nexport const getHoverButtonTextDecorationStyle = (\n\ttype: Type,\n\tdisabled?: boolean,\n) => {\n\tif (disabled) {\n\t\treturn '';\n\t}\n\treturn `text-decoration-line: underline;\n\t\t\ttext-decoration-color: ${COLORS.content.brand};`;\n};\n\nexport const generateInverseHoverBackground = (\n\ttype: Type,\n\tdisabled?: boolean,\n) => {\n\tif (disabled) {\n\t\treturn '';\n\t}\n\tif (type === 'primary') {\n\t\treturn `background-color: ${COLORS.stroke.warning.lightAlt};`;\n\t}\n\treturn `background-color: rgba(255, 255, 255, 0.1)`;\n};\n\nexport const generateDisabledStyling = (\n\ttype: Type,\n\tsize: Size,\n\tinverse?: boolean,\n) => {\n\tif (type === 'special') {\n\t\treturn `background-color: ${COLORS.background.base}; ${strokeStyle(\n\t\t\tsize,\n\t\t\tCOLORS.stroke.primary,\n\t\t)}`;\n\t}\n\tif (type === 'secondaryGray') {\n\t\treturn strokeStyle(size, COLORS.stroke.primary);\n\t}\n\tif (size === 'chip') {\n\t\treturn `background-color: transparent;`;\n\t}\n\tif (type === 'primary' || type === 'destructive') {\n\t\treturn inverse\n\t\t\t? 'background-color: rgba(255,255,255,0.3);'\n\t\t\t: `background-color: ${COLORS.background.inactive};`;\n\t} else if (type === 'secondary') {\n\t\treturn inverse\n\t\t\t? strokeStyle(size, 'rgba(255, 255, 255, 0.5)')\n\t\t\t: strokeStyle(size, COLORS.stroke.primary);\n\t}\n\treturn '';\n};\n\nexport const getDashedBorderStyling = (\n\ttype: Type,\n\tsize: Size,\n\tborderColor: string = getBorderColor(type, false),\n) => {\n\treturn `\n\t.line-top {\n\t\tposition: absolute;\n\t\tleft: 0;\n\t\ttop: 0;\n\t\theight: 1px;\n\t\twidth: 100%;\n\t\tbackground: repeating-linear-gradient(\n\t\t\tto right,\n\t\t\t${borderColor},\n\t\t\t${borderColor}\n\t\t\t\t${getLinearGradientValue(size)}\n\t\t);\n\t}\n\t.line-right {\n\t\tposition: absolute;\n\t\tright: 0;\n\t\ttop: 0;\n\t\twidth: 1px;\n\t\theight: 100%;\n\t\tbackground: repeating-linear-gradient(\n\t\t\tto bottom,\n\t\t\t${borderColor},\n\t\t\t${borderColor}\n\t\t\t\t${getLinearGradientValue(size)}\n\t\t);\n\t}\n\t.line-bottom {\n\t\tposition: absolute;\n\t\tleft: 0;\n\t\tbottom: 0;\n\t\theight: 1px;\n\t\twidth: 100%;\n\t\tbackground: repeating-linear-gradient(\n\t\t\tto right,\n\t\t\t${borderColor},\n\t\t\t${borderColor}\n\t\t\t\t${getLinearGradientValue(size)}\n\t\t);\n\t}\n\t.line-left {\n\t\tposition: absolute;\n\t\tleft: 0;\n\t\ttop: 0;\n\t\twidth: 1px;\n\t\theight: 100%;\n\t\tbackground: repeating-linear-gradient(\n\t\t\tto bottom,\n\t\t\t${borderColor},\n\t\t\t${borderColor}\n\t\t\t\t${getLinearGradientValue(size)}\n\t\t);\n\t}\n\t`;\n};\n\nexport const getClickEffect = (type: Type, size: Size, inverse?: boolean) => {\n\tif (type === 'text') {\n\t\treturn `background-color: ${COLORS.background.brandLight};\n\t\t\ttext-decoration-line: underline;\n\t\t\ttext-decoration-color: ${COLORS.content.brand};`;\n\t}\n\tif (type === 'special') {\n\t\treturn `background-color: ${COLORS.background.brandLight}; ${strokeStyle(\n\t\t\tsize,\n\t\t\tCOLORS.stroke.brandLightAlt,\n\t\t)}`;\n\t}\n\tif (type === 'secondaryGray') {\n\t\treturn `background-color: ${COLORS.surface.hovered}; ${strokeStyle(\n\t\t\tsize,\n\t\t\tCOLORS.stroke.primary,\n\t\t)}`;\n\t}\n\tif (size === 'chip') {\n\t\treturn `border: 1px solid ${COLORS.stroke.brandLightAlt};\n\t\tbackground-color: ${COLORS.background.brandLight};`;\n\t}\n\tif (type === 'primary' || type === 'destructive') {\n\t\tif (inverse) {\n\t\t\treturn `background-color: ${COLORS.background.warning.vibrant} !important;\n\t\t\tbox-shadow: inset 0px 4px 12px rgba(0, 0, 0, 0.35);\n\t\t\t`;\n\t\t}\n\t\treturn 'box-shadow: inset 0px 4px 12px rgba(0, 0, 0, 0.35);';\n\t} else if (\n\t\ttype === 'secondary' ||\n\t\ttype === 'tertiary' ||\n\t\ttype === 'tertiaryGray' ||\n\t\ttype.startsWith('dash')\n\t) {\n\t\treturn inverse\n\t\t\t? `background-color: ${COLORS.background.inverseLight} !important;`\n\t\t\t: `background-color: ${COLORS.background.brandLight};`;\n\t}\n};\nexport const getLoadingBackground = (\n\ttype: Type,\n\tsize: Size,\n\tinverse?: boolean,\n\tbuttonColor?: string,\n) => {\n\tif (type === 'special') {\n\t\treturn `background-color: ${COLORS.background.brandVeryLight};`;\n\t}\n\tif (type === 'secondaryGray') {\n\t\treturn `background-color: ${COLORS.surface.subdued};`;\n\t}\n\tif (size === 'chip') {\n\t\treturn `background-color: ${COLORS.background.base};`;\n\t}\n\tif (type === 'primary') {\n\t\tif (buttonColor) {\n\t\t\treturn `background-color: ${getLoadingButtonBackgroundCustom(\n\t\t\t\tbuttonColor,\n\t\t\t\t50,\n\t\t\t)};`;\n\t\t}\n\t\treturn `background-color: ${\n\t\t\tinverse ? COLORS.background.warning.vibrant : COLORS.background.brandLight\n\t\t};`;\n\t}\n\tif (type === 'destructive') {\n\t\treturn `background-color: ${COLORS.background.negative.light};`;\n\t}\n\treturn 'background-color: transparent;';\n};\n\nexport const getLoadingBorder = (type: Type, size: Size, inverse?: boolean) => {\n\tif (type === 'special') {\n\t\treturn strokeStyle(size, COLORS.stroke.brandLightAlt);\n\t}\n\tif (type === 'secondaryGray') {\n\t\treturn strokeStyle(size, COLORS.stroke.primary);\n\t}\n\tif (size === 'chip') {\n\t\treturn `border: none;`;\n\t}\n\tif (type === 'secondary') {\n\t\treturn inverse\n\t\t\t? strokeStyle(size, COLORS.content.secondary)\n\t\t\t: strokeStyle(size, COLORS.stroke.brandLightAlt);\n\t}\n\treturn '';\n};\n\nexport const SpinnerColorMap = (type: Type, inverse?: boolean) => {\n\tif (type === 'secondaryGray') return COLORS.content.secondary;\n\tif (inverse) {\n\t\tif (type === 'primary') {\n\t\t\treturn COLORS.content.primary;\n\t\t}\n\t\treturn COLORS.content.primaryInverse;\n\t}\n\tif (type === 'destructive') {\n\t\treturn COLORS.content.negative;\n\t}\n\treturn COLORS.content.brand;\n};\n\nexport const getButtonIconColor = (\n\tsize: Size,\n\ttype: Type,\n\tinverse?: boolean,\n\tdisabled?: boolean,\n\tisLoading?: boolean,\n\tdarkMode?: boolean,\n) => {\n\tif (size === 'chip') {\n\t\tif (disabled) {\n\t\t\treturn COLORS.content.inactive;\n\t\t} else if (darkMode) {\n\t\t\treturn COLORS.content.primary;\n\t\t}\n\t\treturn COLORS.content.secondary;\n\t}\n\tif (isLoading) {\n\t\treturn 'transparent';\n\t}\n\tif (type === 'special') {\n\t\treturn disabled ? COLORS.content.inactive : COLORS.background.inverseLight;\n\t}\n\tif (type === 'secondaryGray') {\n\t\treturn disabled ? COLORS.content.inactive : COLORS.content.secondary;\n\t}\n\tif (type === 'primary' || type === 'destructive') {\n\t\tif (inverse) {\n\t\t\tif (disabled) {\n\t\t\t\treturn 'rgba(255, 255, 255, 0.5)';\n\t\t\t}\n\t\t\treturn COLORS.content.primary;\n\t\t}\n\t\tif (disabled) {\n\t\t\treturn COLORS.content.inactive;\n\t\t}\n\t\treturn COLORS.content.primaryInverse;\n\t} else if (type === 'secondary') {\n\t\tif (inverse) {\n\t\t\tif (disabled) {\n\t\t\t\treturn 'rgba(255, 255, 255, 0.5)';\n\t\t\t}\n\t\t\treturn COLORS.content.primaryInverse;\n\t\t}\n\t\tif (disabled) {\n\t\t\treturn COLORS.content.inactive;\n\t\t}\n\t\treturn COLORS.content.brand;\n\t} else if (type === 'tertiary') {\n\t\tif (inverse) {\n\t\t\tif (disabled) {\n\t\t\t\treturn 'rgba(255, 255, 255, 0.5)';\n\t\t\t}\n\t\t\treturn COLORS.content.primaryInverse;\n\t\t}\n\t\tif (disabled) {\n\t\t\treturn COLORS.content.inactive;\n\t\t}\n\t\treturn COLORS.content.brand;\n\t} else if (type === 'tertiaryGray' || type.startsWith('dash')) {\n\t\tif (disabled) {\n\t\t\treturn COLORS.content.inactive;\n\t\t}\n\t\treturn COLORS.content.secondary;\n\t}\n};\n"],"names":["getBackgroundColor","type","size","inverse","darkMode","buttonColor","COLORS","getColor","getDisabledTextColor","getPadding","GetButtonTextComponent","disabled","ButtonRegularAI","ButtonLargeAI","BodySecondary","BodyCaption","ButtonRegular","ButtonLarge","getBorderColor","error","strokeStyle","color","width","getBorder","version","getLinearGradientValue","getHoverButtonBackgroundCustom","percent","num","amt","R","G","B","getLoadingButtonBackgroundCustom","getHoverButtonBackground","getHoverButtonTextDecorationStyle","generateInverseHoverBackground","generateDisabledStyling","getDashedBorderStyling","borderColor","getClickEffect","getLoadingBackground","getLoadingBorder","SpinnerColorMap","getButtonIconColor","isLoading"],"mappings":";;AAWO,MAAMA,IAAqB,CACjCC,GACAC,GACAC,GACAC,GACAC,MACY;AACZ,MAAIJ,MAAS,UAAW,QAAOK,EAAO,WAAW;AACjD,MAAIL,MAAS,gBAAiB,QAAO;AAErC,MAAIC,MAAS;AACZ,WAAID,MAAS,SACL,gBAEDG,IAAWE,EAAO,QAAQ,UAAUA,EAAO,QAAQ;AAE3D,UAAQL,GAAA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,EAAO,QAAQ,iBAEnBL,MAAS,gBACLK,EAAO,QAAQ,WAEhBA,EAAO,QAAQ,OAGVsC,IAAqB,CACjC1C,GACAD,GACAE,GACAQ,GACAkC,GACAzC,MACI;AACJ,MAAIF,MAAS;AACZ,WAAIS,IACIL,EAAO,QAAQ,WACZF,IACHE,EAAO,QAAQ,UAEhBA,EAAO,QAAQ;AAEvB,MAAIuC;AACH,WAAO;AAER,MAAI5C,MAAS;AACZ,WAAOU,IAAWL,EAAO,QAAQ,WAAWA,EAAO,WAAW;AAE/D,MAAIL,MAAS;AACZ,WAAOU,IAAWL,EAAO,QAAQ,WAAWA,EAAO,QAAQ;AAE5D,MAAIL,MAAS,aAAaA,MAAS;AAClC,WAAIE,IACCQ,IACI,6BAEDL,EAAO,QAAQ,UAEnBK,IACIL,EAAO,QAAQ,WAEhBA,EAAO,QAAQ;AACvB,MAAWL,MAAS;AACnB,WAAIE,IACCQ,IACI,6BAEDL,EAAO,QAAQ,iBAEnBK,IACIL,EAAO,QAAQ,WAEhBA,EAAO,QAAQ;AACvB,MAAWL,MAAS;AACnB,WAAIE,IACCQ,IACI,6BAEDL,EAAO,QAAQ,iBAEnBK,IACIL,EAAO,QAAQ,WAEhBA,EAAO,QAAQ;MACZL,MAAS,kBAAkBA,EAAK,WAAW,MAAM;AAC3D,WAAIU,IACIL,EAAO,QAAQ,WAEhBA,EAAO,QAAQ;AAExB;"}
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { jsx as t, Fragment as l, jsxs as n } from "react/jsx-runtime";
|
|
2
2
|
import { COLORS as i } from "../../constants/Theme.js";
|
|
3
|
-
import { Spinner as
|
|
4
|
-
import { TitleSmall as o, BodyCaption as
|
|
5
|
-
import { Container as d, Loader as
|
|
6
|
-
import { Tooltip as
|
|
7
|
-
const u = (e) => /* @__PURE__ */ t(l, { children: e.tooltip ? /* @__PURE__ */ t(
|
|
3
|
+
import { Spinner as c } from "../spinner/Spinner.js";
|
|
4
|
+
import { TitleSmall as o, BodyCaption as r } from "../TypographyStyle.js";
|
|
5
|
+
import { Container as d, Loader as h } from "./CardSelector.styled.js";
|
|
6
|
+
import { Tooltip as m } from "../tooltips/Tooltip.js";
|
|
7
|
+
const u = (e) => /* @__PURE__ */ t(l, { children: e.tooltip ? /* @__PURE__ */ t(m, { title: e.tooltip, children: /* @__PURE__ */ t(
|
|
8
8
|
d,
|
|
9
9
|
{
|
|
10
|
+
"data-testid": "card-selector-container",
|
|
10
11
|
style: {
|
|
11
12
|
alignItems: e.title && e.subtitle ? "flex-start" : "center"
|
|
12
13
|
},
|
|
@@ -17,11 +18,12 @@ const u = (e) => /* @__PURE__ */ t(l, { children: e.tooltip ? /* @__PURE__ */ t(
|
|
|
17
18
|
!e.disabled && !e.loading && e.onCardClick(e.id);
|
|
18
19
|
},
|
|
19
20
|
isTooltipPresent: !!e.tooltip,
|
|
20
|
-
children: /* @__PURE__ */ t(
|
|
21
|
+
children: /* @__PURE__ */ t(a, { ...e })
|
|
21
22
|
}
|
|
22
23
|
) }) : /* @__PURE__ */ t(
|
|
23
24
|
d,
|
|
24
25
|
{
|
|
26
|
+
"data-testid": "card-selector-container",
|
|
25
27
|
style: {
|
|
26
28
|
alignItems: e.title && e.subtitle ? "flex-start" : "center"
|
|
27
29
|
},
|
|
@@ -32,9 +34,9 @@ const u = (e) => /* @__PURE__ */ t(l, { children: e.tooltip ? /* @__PURE__ */ t(
|
|
|
32
34
|
!e.disabled && !e.loading && e.onCardClick(e.id);
|
|
33
35
|
},
|
|
34
36
|
isTooltipPresent: !!e.tooltip,
|
|
35
|
-
children: /* @__PURE__ */ t(
|
|
37
|
+
children: /* @__PURE__ */ t(a, { ...e })
|
|
36
38
|
}
|
|
37
|
-
) }),
|
|
39
|
+
) }), a = (e) => /* @__PURE__ */ t(l, { children: e.loading ? /* @__PURE__ */ t(h, { children: /* @__PURE__ */ t(c, { size: "large" }) }) : /* @__PURE__ */ n(l, { children: [
|
|
38
40
|
e?.icon && /* @__PURE__ */ t("div", { style: { width: 24, height: 24 }, children: /* @__PURE__ */ t(
|
|
39
41
|
e.icon,
|
|
40
42
|
{
|
|
@@ -53,7 +55,7 @@ const u = (e) => /* @__PURE__ */ t(l, { children: e.tooltip ? /* @__PURE__ */ t(
|
|
|
53
55
|
}
|
|
54
56
|
),
|
|
55
57
|
e.subtitle && /* @__PURE__ */ t(
|
|
56
|
-
|
|
58
|
+
r,
|
|
57
59
|
{
|
|
58
60
|
style: {
|
|
59
61
|
marginTop: e.title ? 4 : 0,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CardSelector.js","sources":["../../../../src/components/card-selector/CardSelector.tsx"],"sourcesContent":["import React from 'react';\nimport { COLORS } from '@src/constants/Theme';\nimport { Spinner } from '../spinner/Spinner';\nimport { Tooltip } from '../tooltips';\nimport { BodyCaption, TitleSmall } from '../TypographyStyle';\nimport { Container, Loader } from './CardSelector.styled';\n\nexport type CardSelectorProps = {\n\tid: number;\n\ticon?: React.FunctionComponent<React.SVGAttributes<SVGElement>>;\n\ttitle?: string;\n\tsubtitle?: string;\n\tselected: boolean;\n\tloading?: boolean;\n\tdisabled?: boolean;\n\tdataTestId?: string;\n\ttooltip?: string;\n};\n\ntype CardSelectorInternalProps = CardSelectorProps & {\n\tonCardClick: (id: number) => void;\n};\n\nexport const CardSelector: React.FC<CardSelectorInternalProps> = (props) => {\n\treturn (\n\t\t<>\n\t\t\t{props.tooltip ? (\n\t\t\t\t<Tooltip title={props.tooltip}>\n\t\t\t\t\t<Container\n\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\talignItems:\n\t\t\t\t\t\t\t\tprops.title && props.subtitle ? 'flex-start' : 'center',\n\t\t\t\t\t\t}}\n\t\t\t\t\t\tselected={props.selected}\n\t\t\t\t\t\tdisabled={props.disabled ?? false}\n\t\t\t\t\t\tloading={props.loading ?? false}\n\t\t\t\t\t\tonClick={() => {\n\t\t\t\t\t\t\tif (!props.disabled && !props.loading) {\n\t\t\t\t\t\t\t\tprops.onCardClick(props.id);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}}\n\t\t\t\t\t\tisTooltipPresent={!!props.tooltip}\n\t\t\t\t\t>\n\t\t\t\t\t\t<EachSelector {...props} />\n\t\t\t\t\t</Container>\n\t\t\t\t</Tooltip>\n\t\t\t) : (\n\t\t\t\t<Container\n\t\t\t\t\tstyle={{\n\t\t\t\t\t\talignItems: props.title && props.subtitle ? 'flex-start' : 'center',\n\t\t\t\t\t}}\n\t\t\t\t\tselected={props.selected}\n\t\t\t\t\tdisabled={props.disabled ?? false}\n\t\t\t\t\tloading={props.loading ?? false}\n\t\t\t\t\tonClick={() => {\n\t\t\t\t\t\tif (!props.disabled && !props.loading) {\n\t\t\t\t\t\t\tprops.onCardClick(props.id);\n\t\t\t\t\t\t}\n\t\t\t\t\t}}\n\t\t\t\t\tisTooltipPresent={!!props.tooltip}\n\t\t\t\t>\n\t\t\t\t\t<EachSelector {...props} />\n\t\t\t\t</Container>\n\t\t\t)}\n\t\t</>\n\t);\n};\n\nconst EachSelector: React.FC<CardSelectorInternalProps> = (props) => {\n\treturn (\n\t\t<>\n\t\t\t{props.loading ? (\n\t\t\t\t<Loader>\n\t\t\t\t\t<Spinner size={'large'} />\n\t\t\t\t</Loader>\n\t\t\t) : (\n\t\t\t\t<>\n\t\t\t\t\t{props?.icon && (\n\t\t\t\t\t\t<div style={{ width: 24, height: 24 }}>\n\t\t\t\t\t\t\t<props.icon\n\t\t\t\t\t\t\t\twidth={24}\n\t\t\t\t\t\t\t\tcolor={\n\t\t\t\t\t\t\t\t\tprops.selected\n\t\t\t\t\t\t\t\t\t\t? COLORS.content.brand\n\t\t\t\t\t\t\t\t\t\t: props.disabled\n\t\t\t\t\t\t\t\t\t\t? COLORS.content.inactive\n\t\t\t\t\t\t\t\t\t\t: COLORS.content.placeholder\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t)}\n\t\t\t\t\t<div data-test={props?.dataTestId}>\n\t\t\t\t\t\t{props.title && (\n\t\t\t\t\t\t\t<TitleSmall\n\t\t\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\t\t\tcolor: props.selected\n\t\t\t\t\t\t\t\t\t\t? COLORS.content.brand\n\t\t\t\t\t\t\t\t\t\t: props.disabled\n\t\t\t\t\t\t\t\t\t\t? COLORS.content.inactive\n\t\t\t\t\t\t\t\t\t\t: COLORS.content.secondary,\n\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{props.title}\n\t\t\t\t\t\t\t</TitleSmall>\n\t\t\t\t\t\t)}\n\t\t\t\t\t\t{props.subtitle && (\n\t\t\t\t\t\t\t<BodyCaption\n\t\t\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\t\t\tmarginTop: props.title ? 4 : 0,\n\t\t\t\t\t\t\t\t\tcolor: props.selected\n\t\t\t\t\t\t\t\t\t\t? COLORS.content.brand\n\t\t\t\t\t\t\t\t\t\t: props.disabled\n\t\t\t\t\t\t\t\t\t\t? COLORS.content.inactive\n\t\t\t\t\t\t\t\t\t\t: COLORS.content.secondary,\n\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{props.subtitle}\n\t\t\t\t\t\t\t</BodyCaption>\n\t\t\t\t\t\t)}\n\t\t\t\t\t</div>\n\t\t\t\t</>\n\t\t\t)}\n\t\t</>\n\t);\n};\n"],"names":["CardSelector","props","Tooltip","jsx","Container","EachSelector","Fragment","Loader","Spinner","jsxs","COLORS","TitleSmall","BodyCaption"],"mappings":";;;;;;AAuBO,MAAMA,IAAoD,CAACC,6BAG9D,UAAAA,EAAM,4BACLC,GAAA,EAAQ,OAAOD,EAAM,SACrB,UAAA,gBAAAE;AAAA,EAACC;AAAA,EAAA;AAAA,IACA,OAAO;AAAA,MACN,YACCH,EAAM,SAASA,EAAM,WAAW,eAAe;AAAA,IAAA;AAAA,IAEjD,UAAUA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AED,gBAAAD,EAAC,OAAA,EAAI,aAAWR,GAAO,YACrB,UAAA;AAAA,IAAAA,EAAM,SACN,gBAAAE;AAAA,MAACQ;AAAA,MAAA;AAAA,QACA,OAAO;AAAA,UACN,OAAOV,EAAM,WACVS,EAAO,QAAQ,QACfT,EAAM,WACNS,EAAO,QAAQ,WACfA,EAAO,QAAQ;AAAA,QAAA;AAAA,QAGlB,UAAAT,EAAM;AAAA,MAAA;AAAA,IAAA;AAAA,IAGRA,EAAM,YACN,gBAAAE;AAAA,MAACS;AAAA,MAAA;AAAA,QACA,OAAO;AAAA,UACN,WAAWX,EAAM,QAAQ,IAAI;AAAA,UAC7B,OAAOA,EAAM,WACVS,EAAO,QAAQ,QACfT,EAAM,WACNS,EAAO,QAAQ,WACfA,EAAO,QAAQ;AAAA,QAAA;AAAA,QAGlB,UAAAT,EAAM;AAAA,MAAA;AAAA,IAAA;AAAA,EACR,EAAA,CAEF;AAAA,EAAA,CACD,EAAA,CAEF;"}
|
|
1
|
+
{"version":3,"file":"CardSelector.js","sources":["../../../../src/components/card-selector/CardSelector.tsx"],"sourcesContent":["import React from 'react';\nimport { COLORS } from '@src/constants/Theme';\nimport { Spinner } from '../spinner/Spinner';\nimport { Tooltip } from '../tooltips';\nimport { BodyCaption, TitleSmall } from '../TypographyStyle';\nimport { Container, Loader } from './CardSelector.styled';\n\nexport type CardSelectorProps = {\n\tid: number;\n\ticon?: React.FunctionComponent<React.SVGAttributes<SVGElement>>;\n\ttitle?: string;\n\tsubtitle?: string;\n\tselected: boolean;\n\tloading?: boolean;\n\tdisabled?: boolean;\n\tdataTestId?: string;\n\ttooltip?: string;\n};\n\ntype CardSelectorInternalProps = CardSelectorProps & {\n\tonCardClick: (id: number) => void;\n};\n\nexport const CardSelector: React.FC<CardSelectorInternalProps> = (props) => {\n\treturn (\n\t\t<>\n\t\t\t{props.tooltip ? (\n\t\t\t\t<Tooltip title={props.tooltip}>\n\t\t\t\t\t<Container\n\t\t\t\t\t\tdata-testid=\"card-selector-container\"\n\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\talignItems:\n\t\t\t\t\t\t\t\tprops.title && props.subtitle ? 'flex-start' : 'center',\n\t\t\t\t\t\t}}\n\t\t\t\t\t\tselected={props.selected}\n\t\t\t\t\t\tdisabled={props.disabled ?? false}\n\t\t\t\t\t\tloading={props.loading ?? false}\n\t\t\t\t\t\tonClick={() => {\n\t\t\t\t\t\t\tif (!props.disabled && !props.loading) {\n\t\t\t\t\t\t\t\tprops.onCardClick(props.id);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}}\n\t\t\t\t\t\tisTooltipPresent={!!props.tooltip}\n\t\t\t\t\t>\n\t\t\t\t\t\t<EachSelector {...props} />\n\t\t\t\t\t</Container>\n\t\t\t\t</Tooltip>\n\t\t\t) : (\n\t\t\t\t<Container\n\t\t\t\t\tdata-testid=\"card-selector-container\"\n\t\t\t\t\tstyle={{\n\t\t\t\t\t\talignItems: props.title && props.subtitle ? 'flex-start' : 'center',\n\t\t\t\t\t}}\n\t\t\t\t\tselected={props.selected}\n\t\t\t\t\tdisabled={props.disabled ?? false}\n\t\t\t\t\tloading={props.loading ?? false}\n\t\t\t\t\tonClick={() => {\n\t\t\t\t\t\tif (!props.disabled && !props.loading) {\n\t\t\t\t\t\t\tprops.onCardClick(props.id);\n\t\t\t\t\t\t}\n\t\t\t\t\t}}\n\t\t\t\t\tisTooltipPresent={!!props.tooltip}\n\t\t\t\t>\n\t\t\t\t\t<EachSelector {...props} />\n\t\t\t\t</Container>\n\t\t\t)}\n\t\t</>\n\t);\n};\n\nconst EachSelector: React.FC<CardSelectorInternalProps> = (props) => {\n\treturn (\n\t\t<>\n\t\t\t{props.loading ? (\n\t\t\t\t<Loader>\n\t\t\t\t\t<Spinner size={'large'} />\n\t\t\t\t</Loader>\n\t\t\t) : (\n\t\t\t\t<>\n\t\t\t\t\t{props?.icon && (\n\t\t\t\t\t\t<div style={{ width: 24, height: 24 }}>\n\t\t\t\t\t\t\t<props.icon\n\t\t\t\t\t\t\t\twidth={24}\n\t\t\t\t\t\t\t\tcolor={\n\t\t\t\t\t\t\t\t\tprops.selected\n\t\t\t\t\t\t\t\t\t\t? COLORS.content.brand\n\t\t\t\t\t\t\t\t\t\t: props.disabled\n\t\t\t\t\t\t\t\t\t\t? COLORS.content.inactive\n\t\t\t\t\t\t\t\t\t\t: COLORS.content.placeholder\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t)}\n\t\t\t\t\t<div data-test={props?.dataTestId}>\n\t\t\t\t\t\t{props.title && (\n\t\t\t\t\t\t\t<TitleSmall\n\t\t\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\t\t\tcolor: props.selected\n\t\t\t\t\t\t\t\t\t\t? COLORS.content.brand\n\t\t\t\t\t\t\t\t\t\t: props.disabled\n\t\t\t\t\t\t\t\t\t\t? COLORS.content.inactive\n\t\t\t\t\t\t\t\t\t\t: COLORS.content.secondary,\n\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{props.title}\n\t\t\t\t\t\t\t</TitleSmall>\n\t\t\t\t\t\t)}\n\t\t\t\t\t\t{props.subtitle && (\n\t\t\t\t\t\t\t<BodyCaption\n\t\t\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\t\t\tmarginTop: props.title ? 4 : 0,\n\t\t\t\t\t\t\t\t\tcolor: props.selected\n\t\t\t\t\t\t\t\t\t\t? COLORS.content.brand\n\t\t\t\t\t\t\t\t\t\t: props.disabled\n\t\t\t\t\t\t\t\t\t\t? COLORS.content.inactive\n\t\t\t\t\t\t\t\t\t\t: COLORS.content.secondary,\n\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{props.subtitle}\n\t\t\t\t\t\t\t</BodyCaption>\n\t\t\t\t\t\t)}\n\t\t\t\t\t</div>\n\t\t\t\t</>\n\t\t\t)}\n\t\t</>\n\t);\n};\n"],"names":["CardSelector","props","Tooltip","jsx","Container","EachSelector","Fragment","Loader","Spinner","jsxs","COLORS","TitleSmall","BodyCaption"],"mappings":";;;;;;AAuBO,MAAMA,IAAoD,CAACC,6BAG9D,UAAAA,EAAM,4BACLC,GAAA,EAAQ,OAAOD,EAAM,SACrB,UAAA,gBAAAE;AAAA,EAACC;AAAA,EAAA;AAAA,IACA,eAAY;AAAA,IACZ,OAAO;AAAA,MACN,YACCH,EAAM,SAASA,EAAM,WAAW,eAAe;AAAA,IAAA;AAAA,IAEjD,UAAUA,EAAM;AAAA,IAChB,UAAUA,EAAM,YAAY;AAAA,IAC5B,SAASA,EAAM,WAAW;AAAA,IAC1B,SAAS,MAAM;AACd,MAAI,CAACA,EAAM,YAAY,CAACA,EAAM,WAC7BA,EAAM,YAAYA,EAAM,EAAE;AAAA,IAE5B;AAAA,IACA,kBAAkB,CAAC,CAACA,EAAM;AAAA,IAE1B,UAAA,gBAAAE,EAACE,GAAA,EAAc,GAAGJ,EAAA,CAAO;AAAA,EAAA;AAAA,GAE3B,IAEA,gBAAAE;AAAA,EAACC;AAAA,EAAA;AAAA,IACA,eAAY;AAAA,IACZ,OAAO;AAAA,MACN,YAAYH,EAAM,SAASA,EAAM,WAAW,eAAe;AAAA,IAAA;AAAA,IAE5D,UAAUA,EAAM;AAAA,IAChB,UAAUA,EAAM,YAAY;AAAA,IAC5B,SAASA,EAAM,WAAW;AAAA,IAC1B,SAAS,MAAM;AACd,MAAI,CAACA,EAAM,YAAY,CAACA,EAAM,WAC7BA,EAAM,YAAYA,EAAM,EAAE;AAAA,IAE5B;AAAA,IACA,kBAAkB,CAAC,CAACA,EAAM;AAAA,IAE1B,UAAA,gBAAAE,EAACE,GAAA,EAAc,GAAGJ,EAAA,CAAO;AAAA,EAAA;AAAA,GAG5B,GAIII,IAAoD,CAACJ,MAEzD,gBAAAE,EAAAG,GAAA,EACE,UAAAL,EAAM,UACN,gBAAAE,EAACI,GAAA,EACA,UAAA,gBAAAJ,EAACK,GAAA,EAAQ,MAAM,QAAA,CAAS,EAAA,CACzB,IAEA,gBAAAC,EAAAH,GAAA,EACE,UAAA;AAAA,EAAAL,GAAO,0BACN,OAAA,EAAI,OAAO,EAAE,OAAO,IAAI,QAAQ,GAAA,GAChC,UAAA,gBAAAE;AAAA,IAACF,EAAM;AAAA,IAAN;AAAA,MACA,OAAO;AAAA,MACP,OACCA,EAAM,WACHS,EAAO,QAAQ,QACfT,EAAM,WACNS,EAAO,QAAQ,WACfA,EAAO,QAAQ;AAAA,IAAA;AAAA,EAAA,GAGrB;AAAA,EAED,gBAAAD,EAAC,OAAA,EAAI,aAAWR,GAAO,YACrB,UAAA;AAAA,IAAAA,EAAM,SACN,gBAAAE;AAAA,MAACQ;AAAA,MAAA;AAAA,QACA,OAAO;AAAA,UACN,OAAOV,EAAM,WACVS,EAAO,QAAQ,QACfT,EAAM,WACNS,EAAO,QAAQ,WACfA,EAAO,QAAQ;AAAA,QAAA;AAAA,QAGlB,UAAAT,EAAM;AAAA,MAAA;AAAA,IAAA;AAAA,IAGRA,EAAM,YACN,gBAAAE;AAAA,MAACS;AAAA,MAAA;AAAA,QACA,OAAO;AAAA,UACN,WAAWX,EAAM,QAAQ,IAAI;AAAA,UAC7B,OAAOA,EAAM,WACVS,EAAO,QAAQ,QACfT,EAAM,WACNS,EAAO,QAAQ,WACfA,EAAO,QAAQ;AAAA,QAAA;AAAA,QAGlB,UAAAT,EAAM;AAAA,MAAA;AAAA,IAAA;AAAA,EACR,EAAA,CAEF;AAAA,EAAA,CACD,EAAA,CAEF;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CardSelectorGroup.js","sources":["../../../../src/components/card-selector/CardSelectorGroup.tsx"],"sourcesContent":["import React from 'react';\nimport { CardSelector, CardSelectorProps } from './CardSelector';\n\nexport type CardSelectorGroupProps = {\n\tgap?: number;\n\talign?: 'horizontal' | 'vertical';\n\tcards: CardSelectorProps[];\n\tonClick: (id: number) => void;\n\t'data-test': string;\n};\n\nexport const CardSelectorGroup: React.FC<CardSelectorGroupProps> = (props) => {\n\treturn (\n\t\t<div\n\t\t\tstyle={{\n\t\t\t\tdisplay: 'flex',\n\t\t\t\tflexDirection: props.align === 'vertical' ? 'column' : 'row',\n\t\t\t\tgap: props.gap || 16,\n\t\t\t}}\n\t\t>\n\t\t\t{props.cards.map((card) => (\n\t\t\t\t<div key={card.id} style={{ display: 'flex', flex: 1 }}>\n\t\t\t\t\t<CardSelector\n\t\t\t\t\t\tdata-test={props['data-test']}\n\t\t\t\t\t\tid={card.id}\n\t\t\t\t\t\ticon={card.icon}\n\t\t\t\t\t\ttitle={card.title}\n\t\t\t\t\t\tsubtitle={card.subtitle}\n\t\t\t\t\t\tselected={card.selected}\n\t\t\t\t\t\tonCardClick={props.onClick}\n\t\t\t\t\t\tloading={card.loading}\n\t\t\t\t\t\tdisabled={card.disabled}\n\t\t\t\t\t\tdataTestId={card.dataTestId}\n\t\t\t\t\t\ttooltip={card.tooltip}\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t))}\n\t\t</div>\n\t);\n};\n"],"names":["CardSelectorGroup","props","jsx","card","CardSelector"],"mappings":";;AAWO,MAAMA,IAAsD,CAACC,MAElE,gBAAAC;AAAA,EAAC;AAAA,EAAA;AAAA,IACA,OAAO;AAAA,MACN,SAAS;AAAA,MACT,eAAeD,EAAM,UAAU,aAAa,WAAW;AAAA,MACvD,KAAKA,EAAM,OAAO;AAAA,IAAA;AAAA,IAGlB,UAAAA,EAAM,MAAM,IAAI,CAACE,MACjB,gBAAAD,EAAC,OAAA,EAAkB,OAAO,EAAE,SAAS,QAAQ,MAAM,KAClD,UAAA,gBAAAA;AAAA,MAACE;AAAA,MAAA;AAAA,QACA,aAAWH,EAAM,WAAW;AAAA,QAC5B,IAAIE,EAAK;AAAA,QACT,MAAMA,EAAK;AAAA,QACX,OAAOA,EAAK;AAAA,QACZ,UAAUA,EAAK;AAAA,QACf,UAAUA,EAAK;AAAA,QACf,aAAaF,EAAM;AAAA,QACnB,SAASE,EAAK;AAAA,QACd,UAAUA,EAAK;AAAA,QACf,YAAYA,EAAK;AAAA,QACjB,SAASA,EAAK;AAAA,MAAA;AAAA,IAAA,EACf,GAbSA,EAAK,EAcf,CACA;AAAA,EAAA;AAAA;"}
|
|
1
|
+
{"version":3,"file":"CardSelectorGroup.js","sources":["../../../../src/components/card-selector/CardSelectorGroup.tsx"],"sourcesContent":["import React from 'react';\nimport { CardSelector, CardSelectorProps } from './CardSelector';\n\nexport type CardSelectorGroupProps = {\n\tgap?: number;\n\talign?: 'horizontal' | 'vertical';\n\tcards: CardSelectorProps[];\n\tonClick: (id: number) => void;\n\t'data-test': string;\n};\n\nexport const CardSelectorGroup: React.FC<CardSelectorGroupProps> = (props) => {\n\treturn (\n\t\t<div\n\t\t\tdata-testid=\"card-selector-group\"\n\t\t\tstyle={{\n\t\t\t\tdisplay: 'flex',\n\t\t\t\tflexDirection: props.align === 'vertical' ? 'column' : 'row',\n\t\t\t\tgap: props.gap || 16,\n\t\t\t}}\n\t\t>\n\t\t\t{props.cards.map((card) => (\n\t\t\t\t<div key={card.id} style={{ display: 'flex', flex: 1 }}>\n\t\t\t\t\t<CardSelector\n\t\t\t\t\t\tdata-test={props['data-test']}\n\t\t\t\t\t\tid={card.id}\n\t\t\t\t\t\ticon={card.icon}\n\t\t\t\t\t\ttitle={card.title}\n\t\t\t\t\t\tsubtitle={card.subtitle}\n\t\t\t\t\t\tselected={card.selected}\n\t\t\t\t\t\tonCardClick={props.onClick}\n\t\t\t\t\t\tloading={card.loading}\n\t\t\t\t\t\tdisabled={card.disabled}\n\t\t\t\t\t\tdataTestId={card.dataTestId}\n\t\t\t\t\t\ttooltip={card.tooltip}\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t))}\n\t\t</div>\n\t);\n};\n"],"names":["CardSelectorGroup","props","jsx","card","CardSelector"],"mappings":";;AAWO,MAAMA,IAAsD,CAACC,MAElE,gBAAAC;AAAA,EAAC;AAAA,EAAA;AAAA,IACA,eAAY;AAAA,IACZ,OAAO;AAAA,MACN,SAAS;AAAA,MACT,eAAeD,EAAM,UAAU,aAAa,WAAW;AAAA,MACvD,KAAKA,EAAM,OAAO;AAAA,IAAA;AAAA,IAGlB,UAAAA,EAAM,MAAM,IAAI,CAACE,MACjB,gBAAAD,EAAC,OAAA,EAAkB,OAAO,EAAE,SAAS,QAAQ,MAAM,KAClD,UAAA,gBAAAA;AAAA,MAACE;AAAA,MAAA;AAAA,QACA,aAAWH,EAAM,WAAW;AAAA,QAC5B,IAAIE,EAAK;AAAA,QACT,MAAMA,EAAK;AAAA,QACX,OAAOA,EAAK;AAAA,QACZ,UAAUA,EAAK;AAAA,QACf,UAAUA,EAAK;AAAA,QACf,aAAaF,EAAM;AAAA,QACnB,SAASE,EAAK;AAAA,QACd,UAAUA,EAAK;AAAA,QACf,YAAYA,EAAK;AAAA,QACjB,SAASA,EAAK;AAAA,MAAA;AAAA,IAAA,EACf,GAbSA,EAAK,EAcf,CACA;AAAA,EAAA;AAAA;"}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { jsx as r, Fragment as
|
|
1
|
+
import { jsx as r, Fragment as o } from "react/jsx-runtime";
|
|
2
2
|
import i from "../../assets/icons/chevronLeft.svg.js";
|
|
3
|
-
import
|
|
4
|
-
import { Carousel as
|
|
3
|
+
import a from "../../assets/icons/chevronRight.svg.js";
|
|
4
|
+
import { Carousel as n } from "@trendyol-js/react-carousel";
|
|
5
5
|
import s from "styled-components";
|
|
6
|
-
const
|
|
7
|
-
|
|
6
|
+
const l = () => /* @__PURE__ */ r(e, { className: "left", "data-testid": "carousel-left-arrow", children: /* @__PURE__ */ r(i, { width: 16, height: 16, color: "#fff" }) }), h = () => /* @__PURE__ */ r(e, { className: "right", "data-testid": "carousel-right-arrow", children: /* @__PURE__ */ r(a, { width: 16, height: 16, color: "#fff" }) }), u = (t) => /* @__PURE__ */ r(o, { children: /* @__PURE__ */ r(
|
|
7
|
+
n,
|
|
8
8
|
{
|
|
9
|
-
leftArrow: /* @__PURE__ */ r(
|
|
9
|
+
leftArrow: /* @__PURE__ */ r(l, {}),
|
|
10
10
|
rightArrow: /* @__PURE__ */ r(h, {}),
|
|
11
11
|
...t,
|
|
12
12
|
children: t.children
|
|
13
13
|
}
|
|
14
|
-
) }),
|
|
14
|
+
) }), e = s.div`
|
|
15
15
|
cursor: pointer;
|
|
16
16
|
margin: 0 8px;
|
|
17
17
|
width: 50px;
|
|
@@ -34,6 +34,6 @@ const a = () => /* @__PURE__ */ r(o, { className: "left", children: /* @__PURE__
|
|
|
34
34
|
}
|
|
35
35
|
`;
|
|
36
36
|
export {
|
|
37
|
-
|
|
37
|
+
u as Carousel
|
|
38
38
|
};
|
|
39
39
|
//# sourceMappingURL=carousel.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"carousel.js","sources":["../../../../src/components/carousel/carousel.tsx"],"sourcesContent":["import ChevronLeft from '@src/assets/icons/chevronLeft.svg';\nimport ChevronRight from '@src/assets/icons/chevronRight.svg';\nimport { Carousel as ReactCarousel } from '@trendyol-js/react-carousel';\nimport { CarouselProps } from '@trendyol-js/react-carousel/dist/types/components/carousel';\nimport styled from 'styled-components';\n\nconst LeftArrow = () => {\n\treturn (\n\t\t<ArrowContainer className=\"left\">\n\t\t\t<ChevronLeft width={16} height={16} color=\"#fff\" />\n\t\t</ArrowContainer>\n\t);\n};\n\nconst RightArrow = () => {\n\treturn (\n\t\t<ArrowContainer className=\"right\">\n\t\t\t<ChevronRight width={16} height={16} color=\"#fff\" />\n\t\t</ArrowContainer>\n\t);\n};\n\nexport const Carousel = (props: CarouselProps) => {\n\treturn (\n\t\t<>\n\t\t\t<ReactCarousel\n\t\t\t\tleftArrow={<LeftArrow />}\n\t\t\t\trightArrow={<RightArrow />}\n\t\t\t\t{...props}\n\t\t\t>\n\t\t\t\t{props.children}\n\t\t\t</ReactCarousel>\n\t\t</>\n\t);\n};\n\nconst ArrowContainer = styled.div`\n\tcursor: pointer;\n\tmargin: 0 8px;\n\twidth: 50px;\n\theight: 50px;\n\tborder-radius: 25px;\n\tdisplay: flex;\n\talign-items: center;\n\tbackground-color: rgba(0, 0, 0, 0.4);\n\tjustify-content: center;\n\tposition: absolute;\n\tz-index: 2;\n\ttop: 50%;\n\t&.left {\n\t\ttransform: translate(0%, -50%);\n\t\tleft: 0;\n\t}\n\t&.right {\n\t\ttransform: translate(0%, -50%);\n\t\tright: 0;\n\t}\n`;\n"],"names":["LeftArrow","jsx","ArrowContainer","ChevronLeft","RightArrow","ChevronRight","Carousel","props","Fragment","ReactCarousel","styled"],"mappings":";;;;;AAMA,MAAMA,IAAY,MAEhB,gBAAAC,EAACC,GAAA,EAAe,WAAU,
|
|
1
|
+
{"version":3,"file":"carousel.js","sources":["../../../../src/components/carousel/carousel.tsx"],"sourcesContent":["import ChevronLeft from '@src/assets/icons/chevronLeft.svg';\nimport ChevronRight from '@src/assets/icons/chevronRight.svg';\nimport { Carousel as ReactCarousel } from '@trendyol-js/react-carousel';\nimport { CarouselProps } from '@trendyol-js/react-carousel/dist/types/components/carousel';\nimport styled from 'styled-components';\n\nconst LeftArrow = () => {\n\treturn (\n\t\t<ArrowContainer className=\"left\" data-testid=\"carousel-left-arrow\">\n\t\t\t<ChevronLeft width={16} height={16} color=\"#fff\" />\n\t\t</ArrowContainer>\n\t);\n};\n\nconst RightArrow = () => {\n\treturn (\n\t\t<ArrowContainer className=\"right\" data-testid=\"carousel-right-arrow\">\n\t\t\t<ChevronRight width={16} height={16} color=\"#fff\" />\n\t\t</ArrowContainer>\n\t);\n};\n\nexport const Carousel = (props: CarouselProps) => {\n\treturn (\n\t\t<>\n\t\t\t<ReactCarousel\n\t\t\t\tleftArrow={<LeftArrow />}\n\t\t\t\trightArrow={<RightArrow />}\n\t\t\t\t{...props}\n\t\t\t>\n\t\t\t\t{props.children}\n\t\t\t</ReactCarousel>\n\t\t</>\n\t);\n};\n\nconst ArrowContainer = styled.div`\n\tcursor: pointer;\n\tmargin: 0 8px;\n\twidth: 50px;\n\theight: 50px;\n\tborder-radius: 25px;\n\tdisplay: flex;\n\talign-items: center;\n\tbackground-color: rgba(0, 0, 0, 0.4);\n\tjustify-content: center;\n\tposition: absolute;\n\tz-index: 2;\n\ttop: 50%;\n\t&.left {\n\t\ttransform: translate(0%, -50%);\n\t\tleft: 0;\n\t}\n\t&.right {\n\t\ttransform: translate(0%, -50%);\n\t\tright: 0;\n\t}\n`;\n"],"names":["LeftArrow","jsx","ArrowContainer","ChevronLeft","RightArrow","ChevronRight","Carousel","props","Fragment","ReactCarousel","styled"],"mappings":";;;;;AAMA,MAAMA,IAAY,MAEhB,gBAAAC,EAACC,GAAA,EAAe,WAAU,QAAO,eAAY,uBAC5C,UAAA,gBAAAD,EAACE,GAAA,EAAY,OAAO,IAAI,QAAQ,IAAI,OAAM,QAAO,GAClD,GAIIC,IAAa,MAEjB,gBAAAH,EAACC,GAAA,EAAe,WAAU,SAAQ,eAAY,wBAC7C,UAAA,gBAAAD,EAACI,GAAA,EAAa,OAAO,IAAI,QAAQ,IAAI,OAAM,QAAO,GACnD,GAIWC,IAAW,CAACC,MAEvB,gBAAAN,EAAAO,GAAA,EACC,UAAA,gBAAAP;AAAA,EAACQ;AAAAA,EAAA;AAAA,IACA,6BAAYT,GAAA,EAAU;AAAA,IACtB,8BAAaI,GAAA,EAAW;AAAA,IACvB,GAAGG;AAAA,IAEH,UAAAA,EAAM;AAAA,EAAA;AAAA,GAET,GAIIL,IAAiBQ,EAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsxs as w, jsx as a, Fragment as M } from "react/jsx-runtime";
|
|
2
2
|
import { useState as r, useEffect as o, useMemo as P } from "react";
|
|
3
3
|
import { CheckboxContainer as B, CheckboxIcon as I } from "./CheckBox.styled.js";
|
|
4
|
-
import { TitleSmall as
|
|
4
|
+
import { TitleSmall as C, BodyPrimary as f, BodySecondary as h, BodyCaption as m, TitleRegular as H } from "../TypographyStyle.js";
|
|
5
5
|
import { COLORS as i } from "../../constants/Theme.js";
|
|
6
6
|
const T = (e) => {
|
|
7
7
|
const c = P(
|
|
@@ -23,6 +23,7 @@ const T = (e) => {
|
|
|
23
23
|
return /* @__PURE__ */ w(
|
|
24
24
|
"svg",
|
|
25
25
|
{
|
|
26
|
+
"data-testid": "checkbox-mark",
|
|
26
27
|
width: l.box,
|
|
27
28
|
height: l.box,
|
|
28
29
|
viewBox: `0 0 ${l.box} ${l.box}`,
|
|
@@ -43,6 +44,7 @@ const T = (e) => {
|
|
|
43
44
|
!e.isPartial && /* @__PURE__ */ a(
|
|
44
45
|
"svg",
|
|
45
46
|
{
|
|
47
|
+
"data-testid": "checkmark-icon",
|
|
46
48
|
width: l.check.w,
|
|
47
49
|
height: l.check.h,
|
|
48
50
|
x: l.check.x,
|
|
@@ -64,6 +66,7 @@ const T = (e) => {
|
|
|
64
66
|
e.isPartial && /* @__PURE__ */ a(
|
|
65
67
|
"rect",
|
|
66
68
|
{
|
|
69
|
+
"data-testid": "partial-mark",
|
|
67
70
|
x: l.partial.x,
|
|
68
71
|
y: l.partial.y,
|
|
69
72
|
width: l.partial.w,
|
|
@@ -80,8 +83,8 @@ const T = (e) => {
|
|
|
80
83
|
e.isPartiallyChecked || !1
|
|
81
84
|
), [d, u] = r(e.isDisabled || !1), [v, b] = r(!1), [g, x] = r(!1), y = (t) => {
|
|
82
85
|
if (!e.isDisabled) {
|
|
83
|
-
const
|
|
84
|
-
n ? s(!n) : l(
|
|
86
|
+
const k = !c;
|
|
87
|
+
n ? s(!n) : l(k), e.onValueChange?.(k, e.value, t);
|
|
85
88
|
}
|
|
86
89
|
}, D = (t) => {
|
|
87
90
|
y(t);
|
|
@@ -103,7 +106,7 @@ const T = (e) => {
|
|
|
103
106
|
bodyCaption: m,
|
|
104
107
|
bodySecondary: h,
|
|
105
108
|
bodyPrimary: f,
|
|
106
|
-
titleSmall:
|
|
109
|
+
titleSmall: C
|
|
107
110
|
}[e.labelTypography];
|
|
108
111
|
return /* @__PURE__ */ a(
|
|
109
112
|
t,
|
|
@@ -126,7 +129,7 @@ const T = (e) => {
|
|
|
126
129
|
children: e.label
|
|
127
130
|
}
|
|
128
131
|
) : /* @__PURE__ */ a(
|
|
129
|
-
|
|
132
|
+
C,
|
|
130
133
|
{
|
|
131
134
|
color: e.isDisabled ? i.text.disabled : i.text.primary,
|
|
132
135
|
children: e.label
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CheckBox.js","sources":["../../../../src/components/checkBox/CheckBox.tsx"],"sourcesContent":["import React, { useEffect, useMemo, useState } from 'react';\nimport {\n\tCheckboxContainer,\n\tCheckboxIcon,\n} from '@src/components/checkBox/CheckBox.styled';\nimport {\n\tBodyCaption,\n\tBodyPrimary,\n\tBodySecondary,\n\tTitleRegular,\n\tTitleSmall,\n} from '@src/components/TypographyStyle';\nimport { COLORS } from '@src/constants/Theme';\n\nexport type CheckBoxProps = {\n\tisChecked: boolean;\n\tisPartiallyChecked?: boolean;\n\tisDisabled?: boolean;\n\tvalue?: string;\n\tonValueChange: (\n\t\tchecked: boolean,\n\t\tvalue?: string,\n\t\tevent?: React.MouseEvent,\n\t) => void;\n\tlabel?: string;\n\tsize?: 'DEFAULT' | 'SMALL' | 'XS';\n\tskipHoverState?: boolean;\n\tlabelSize?: 'DEFAULT' | 'SMALL';\n\trightComponent?: JSX.Element;\n\tcheckboxBorderColor?: string;\n\tboldOnChecked?: boolean;\n\tbold?: boolean;\n\tstyle?: React.CSSProperties;\n\tenableHover?: boolean;\n\tactiveColor?: string;\n\t/** Accessible name when no visible label is rendered (e.g. product-picker rows). */\n\tariaLabel?: string;\n\tlabelTypography?:\n\t\t| 'bodyCaption'\n\t\t| 'bodySecondary'\n\t\t| 'bodyPrimary'\n\t\t| 'titleSmall';\n};\n\nconst CheckMark: React.FC<{\n\tisPartial: boolean;\n\tisDisabled: boolean;\n\tsize?: 'DEFAULT' | 'SMALL' | 'XS';\n\tactiveColor?: string;\n}> = (props) => {\n\tconst fillColor = useMemo(\n\t\t() => props.activeColor || COLORS.background.positive.vibrant,\n\t\t[props.activeColor],\n\t);\n\n\t// Box (and inner check) dimensions per size — XS renders a 12x12 mark.\n\tconst dims =\n\t\tprops.size === 'XS'\n\t\t\t? {\n\t\t\t\t\tbox: 12,\n\t\t\t\t\tcheck: { w: 6, h: 5, x: 3, y: 3.5 },\n\t\t\t\t\tpartial: { x: 3, y: 5, w: 6 },\n\t\t\t }\n\t\t\t: props.size === 'SMALL'\n\t\t\t? {\n\t\t\t\t\tbox: 16,\n\t\t\t\t\tcheck: { w: 8, h: 7, x: 4, y: 4 },\n\t\t\t\t\tpartial: { x: 5, y: 7, w: 6 },\n\t\t\t }\n\t\t\t: {\n\t\t\t\t\tbox: 18,\n\t\t\t\t\tcheck: { w: 10, h: 9, x: 4, y: 4 },\n\t\t\t\t\tpartial: { x: 5, y: 8, w: 8 },\n\t\t\t };\n\n\treturn (\n\t\t<svg\n\t\t\twidth={dims.box}\n\t\t\theight={dims.box}\n\t\t\tviewBox={`0 0 ${dims.box} ${dims.box}`}\n\t\t\tfill=\"none\"\n\t\t\txmlns=\"http://www.w3.org/2000/svg\"\n\t\t>\n\t\t\t<rect\n\t\t\t\tx=\"0\"\n\t\t\t\ty=\"0\"\n\t\t\t\twidth={dims.box}\n\t\t\t\theight={dims.box}\n\t\t\t\trx=\"4\"\n\t\t\t\tfill={props.isDisabled ? COLORS.content.inactive : fillColor}\n\t\t\t/>\n\t\t\t{!props.isPartial && (\n\t\t\t\t<svg\n\t\t\t\t\twidth={dims.check.w}\n\t\t\t\t\theight={dims.check.h}\n\t\t\t\t\tx={dims.check.x}\n\t\t\t\t\ty={dims.check.y}\n\t\t\t\t\tviewBox=\"0 0 10 9\"\n\t\t\t\t\tfill=\"none\"\n\t\t\t\t\txmlns=\"http://www.w3.org/2000/svg\"\n\t\t\t\t>\n\t\t\t\t\t<path\n\t\t\t\t\t\tfillRule=\"evenodd\"\n\t\t\t\t\t\tclipRule=\"evenodd\"\n\t\t\t\t\t\td=\"M9.68189 1.06043C10.0724 1.45096 10.0724 2.08412 9.68189 2.47464L4.02501 8.13152C3.63449 8.52205 3.00132 8.52205 2.6108 8.13152L0.489684 6.01041C0.0991601 5.61988 0.0991598 4.98672 0.489684 4.59619C0.880209 4.20567 1.51337 4.20567 1.9039 4.59619L3.31791 6.0102L8.26768 1.06043C8.6582 0.669907 9.29137 0.669907 9.68189 1.06043Z\"\n\t\t\t\t\t\tfill=\"white\"\n\t\t\t\t\t/>\n\t\t\t\t</svg>\n\t\t\t)}\n\t\t\t{props.isPartial && (\n\t\t\t\t<rect\n\t\t\t\t\tx={dims.partial.x}\n\t\t\t\t\ty={dims.partial.y}\n\t\t\t\t\twidth={dims.partial.w}\n\t\t\t\t\theight=\"2\"\n\t\t\t\t\trx=\"1\"\n\t\t\t\t\tfill={COLORS.surface.standard}\n\t\t\t\t/>\n\t\t\t)}\n\t\t</svg>\n\t);\n};\n\nexport const CheckBox: React.FC<CheckBoxProps> = (props) => {\n\tconst [isChecked, setIsChecked] = useState(props.isChecked || false);\n\tconst [isPartiallyChecked, setIsPartiallyChecked] = useState(\n\t\tprops.isPartiallyChecked || false,\n\t);\n\tconst [isDisabled, setIsDisabled] = useState(props.isDisabled || false);\n\tconst [isHovered, setIsHovered] = useState(false);\n\tconst [isClicked, setIsClicked] = useState(false);\n\n\tconst toggleCheck = (event?: React.SyntheticEvent) => {\n\t\tif (!props.isDisabled) {\n\t\t\tconst newVal = !isChecked;\n\t\t\tif (isPartiallyChecked) {\n\t\t\t\tsetIsPartiallyChecked(!isPartiallyChecked);\n\t\t\t} else {\n\t\t\t\tsetIsChecked(newVal);\n\t\t\t}\n\t\t\tprops.onValueChange?.(newVal, props.value, event as React.MouseEvent);\n\t\t}\n\t};\n\n\tconst handleCheck = (event: React.MouseEvent) => {\n\t\ttoggleCheck(event);\n\t};\n\n\tconst handleKeyDown = (event: React.KeyboardEvent) => {\n\t\tif (event.key === ' ' || event.key === 'Enter') {\n\t\t\tevent.preventDefault();\n\t\t\ttoggleCheck(event);\n\t\t}\n\t};\n\n\tconst ariaChecked = isPartiallyChecked\n\t\t? 'mixed'\n\t\t: isChecked\n\t\t? 'true'\n\t\t: 'false';\n\n\tuseEffect(() => {\n\t\tsetIsChecked(props.isChecked);\n\t}, [props.isChecked]);\n\n\tuseEffect(() => {\n\t\tsetIsDisabled(props.isDisabled || false);\n\t}, [props.isDisabled]);\n\n\tuseEffect(() => {\n\t\tsetIsPartiallyChecked(props.isPartiallyChecked || false);\n\t}, [props.isPartiallyChecked]);\n\n\tconst renderLabel = () => {\n\t\tif (!props.label) {\n\t\t\treturn <></>;\n\t\t}\n\n\t\tif (props.labelTypography) {\n\t\t\tconst LabelTypography = {\n\t\t\t\tbodyCaption: BodyCaption,\n\t\t\t\tbodySecondary: BodySecondary,\n\t\t\t\tbodyPrimary: BodyPrimary,\n\t\t\t\ttitleSmall: TitleSmall,\n\t\t\t}[props.labelTypography];\n\t\t\treturn (\n\t\t\t\t<LabelTypography\n\t\t\t\t\tcolor={props.isDisabled ? COLORS.text.disabled : COLORS.text.primary}\n\t\t\t\t>\n\t\t\t\t\t{props.label}\n\t\t\t\t</LabelTypography>\n\t\t\t);\n\t\t}\n\n\t\tif (props.size === 'XS') {\n\t\t\treturn (\n\t\t\t\t<BodyCaption\n\t\t\t\t\tcolor={props.isDisabled ? COLORS.text.disabled : COLORS.text.primary}\n\t\t\t\t>\n\t\t\t\t\t{props.label}\n\t\t\t\t</BodyCaption>\n\t\t\t);\n\t\t}\n\n\t\tif ((props.boldOnChecked && isChecked) || props.bold) {\n\t\t\tif (props.labelSize === 'DEFAULT') {\n\t\t\t\treturn (\n\t\t\t\t\t<TitleRegular\n\t\t\t\t\t\tcolor={\n\t\t\t\t\t\t\tprops.isDisabled ? COLORS.text.disabled : COLORS.text.primary\n\t\t\t\t\t\t}\n\t\t\t\t\t>\n\t\t\t\t\t\t{props.label}\n\t\t\t\t\t</TitleRegular>\n\t\t\t\t);\n\t\t\t}\n\t\t\treturn (\n\t\t\t\t<TitleSmall\n\t\t\t\t\tcolor={props.isDisabled ? COLORS.text.disabled : COLORS.text.primary}\n\t\t\t\t>\n\t\t\t\t\t{props.label}\n\t\t\t\t</TitleSmall>\n\t\t\t);\n\t\t}\n\n\t\tif (props.size === 'SMALL') {\n\t\t\treturn (\n\t\t\t\t<BodySecondary\n\t\t\t\t\tcolor={props.isDisabled ? COLORS.text.disabled : COLORS.text.primary}\n\t\t\t\t>\n\t\t\t\t\t{props.label}\n\t\t\t\t</BodySecondary>\n\t\t\t);\n\t\t}\n\n\t\tif (props.labelSize === 'SMALL') {\n\t\t\treturn (\n\t\t\t\t<BodySecondary\n\t\t\t\t\tcolor={props.isDisabled ? COLORS.text.disabled : COLORS.text.primary}\n\t\t\t\t>\n\t\t\t\t\t{props.label}\n\t\t\t\t</BodySecondary>\n\t\t\t);\n\t\t}\n\n\t\treturn (\n\t\t\t<BodyPrimary\n\t\t\t\tcolor={props.isDisabled ? COLORS.text.disabled : COLORS.text.primary}\n\t\t\t>\n\t\t\t\t{props.label}\n\t\t\t</BodyPrimary>\n\t\t);\n\t};\n\n\treturn (\n\t\t<CheckboxContainer\n\t\t\trole=\"checkbox\"\n\t\t\taria-checked={ariaChecked}\n\t\t\taria-disabled={isDisabled || undefined}\n\t\t\taria-label={props.label ? undefined : props.ariaLabel}\n\t\t\ttabIndex={isDisabled ? -1 : 0}\n\t\t\tonClick={handleCheck}\n\t\t\tonKeyDown={handleKeyDown}\n\t\t\tonMouseEnter={() => setIsHovered(!props.skipHoverState)}\n\t\t\tonMouseLeave={() => setIsHovered(false)}\n\t\t\tonMouseDown={() => setIsClicked(!props.skipHoverState)}\n\t\t\tonMouseUp={() => setIsClicked(false)}\n\t\t\tisDisabled={isDisabled}\n\t\t\tenableHover={props.enableHover}\n\t\t\tstyle={props.style ?? {}}\n\t\t>\n\t\t\t<CheckboxIcon\n\t\t\t\tchecked={isChecked}\n\t\t\t\thovered={isHovered}\n\t\t\t\tclicked={isClicked}\n\t\t\t\tisDisabled={isDisabled}\n\t\t\t\tsize={props.size}\n\t\t\t\tborderColor={props.checkboxBorderColor}\n\t\t\t\tactiveColor={props.activeColor}\n\t\t\t>\n\t\t\t\t{isChecked && (\n\t\t\t\t\t<CheckMark\n\t\t\t\t\t\tisPartial={isPartiallyChecked || false}\n\t\t\t\t\t\tisDisabled={isDisabled}\n\t\t\t\t\t\tsize={props.size}\n\t\t\t\t\t\tactiveColor={props?.activeColor}\n\t\t\t\t\t/>\n\t\t\t\t)}\n\t\t\t</CheckboxIcon>\n\t\t\t{renderLabel()}\n\t\t\t{props.rightComponent}\n\t\t</CheckboxContainer>\n\t);\n};\n"],"names":["CheckMark","props","fillColor","useMemo","COLORS","dims","jsxs","jsx","CheckBox","isChecked","setIsChecked","useState","isPartiallyChecked","setIsPartiallyChecked","isDisabled","setIsDisabled","isHovered","setIsHovered","isClicked","setIsClicked","toggleCheck","event","newVal","handleCheck","handleKeyDown","ariaChecked","useEffect","renderLabel","Fragment","LabelTypography","BodyCaption","BodySecondary","BodyPrimary","TitleSmall","TitleRegular","CheckboxContainer","CheckboxIcon"],"mappings":";;;;;AA4CA,MAAMA,IAKD,CAACC,MAAU;AACf,QAAMC,IAAYC;AAAA,IACjB,MAAMF,EAAM,eAAeG,EAAO,WAAW,SAAS;AAAA,IACtD,CAACH,EAAM,WAAW;AAAA,EAAA,GAIbI,IACLJ,EAAM,SAAS,OACZ;AAAA,IACA,KAAK;AAAA,IACL,OAAO,EAAE,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,IAAA;AAAA,IAC9B,SAAS,EAAE,GAAG,GAAG,GAAG,GAAG,GAAG,EAAA;AAAA,EAAE,IAE5BA,EA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0B,EAAA;AAAA,QACA1B,EAAM;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGV;"}
|
|
1
|
+
{"version":3,"file":"CheckBox.js","sources":["../../../../src/components/checkBox/CheckBox.tsx"],"sourcesContent":["import React, { useEffect, useMemo, useState } from 'react';\nimport {\n\tCheckboxContainer,\n\tCheckboxIcon,\n} from '@src/components/checkBox/CheckBox.styled';\nimport {\n\tBodyCaption,\n\tBodyPrimary,\n\tBodySecondary,\n\tTitleRegular,\n\tTitleSmall,\n} from '@src/components/TypographyStyle';\nimport { COLORS } from '@src/constants/Theme';\n\nexport type CheckBoxProps = {\n\tisChecked: boolean;\n\tisPartiallyChecked?: boolean;\n\tisDisabled?: boolean;\n\tvalue?: string;\n\tonValueChange: (\n\t\tchecked: boolean,\n\t\tvalue?: string,\n\t\tevent?: React.MouseEvent,\n\t) => void;\n\tlabel?: string;\n\tsize?: 'DEFAULT' | 'SMALL' | 'XS';\n\tskipHoverState?: boolean;\n\tlabelSize?: 'DEFAULT' | 'SMALL';\n\trightComponent?: JSX.Element;\n\tcheckboxBorderColor?: string;\n\tboldOnChecked?: boolean;\n\tbold?: boolean;\n\tstyle?: React.CSSProperties;\n\tenableHover?: boolean;\n\tactiveColor?: string;\n\t/** Accessible name when no visible label is rendered (e.g. product-picker rows). */\n\tariaLabel?: string;\n\tlabelTypography?:\n\t\t| 'bodyCaption'\n\t\t| 'bodySecondary'\n\t\t| 'bodyPrimary'\n\t\t| 'titleSmall';\n};\n\nconst CheckMark: React.FC<{\n\tisPartial: boolean;\n\tisDisabled: boolean;\n\tsize?: 'DEFAULT' | 'SMALL' | 'XS';\n\tactiveColor?: string;\n}> = (props) => {\n\tconst fillColor = useMemo(\n\t\t() => props.activeColor || COLORS.background.positive.vibrant,\n\t\t[props.activeColor],\n\t);\n\n\t// Box (and inner check) dimensions per size — XS renders a 12x12 mark.\n\tconst dims =\n\t\tprops.size === 'XS'\n\t\t\t? {\n\t\t\t\t\tbox: 12,\n\t\t\t\t\tcheck: { w: 6, h: 5, x: 3, y: 3.5 },\n\t\t\t\t\tpartial: { x: 3, y: 5, w: 6 },\n\t\t\t }\n\t\t\t: props.size === 'SMALL'\n\t\t\t? {\n\t\t\t\t\tbox: 16,\n\t\t\t\t\tcheck: { w: 8, h: 7, x: 4, y: 4 },\n\t\t\t\t\tpartial: { x: 5, y: 7, w: 6 },\n\t\t\t }\n\t\t\t: {\n\t\t\t\t\tbox: 18,\n\t\t\t\t\tcheck: { w: 10, h: 9, x: 4, y: 4 },\n\t\t\t\t\tpartial: { x: 5, y: 8, w: 8 },\n\t\t\t };\n\n\treturn (\n\t\t<svg\n\t\t\tdata-testid=\"checkbox-mark\"\n\t\t\twidth={dims.box}\n\t\t\theight={dims.box}\n\t\t\tviewBox={`0 0 ${dims.box} ${dims.box}`}\n\t\t\tfill=\"none\"\n\t\t\txmlns=\"http://www.w3.org/2000/svg\"\n\t\t>\n\t\t\t<rect\n\t\t\t\tx=\"0\"\n\t\t\t\ty=\"0\"\n\t\t\t\twidth={dims.box}\n\t\t\t\theight={dims.box}\n\t\t\t\trx=\"4\"\n\t\t\t\tfill={props.isDisabled ? COLORS.content.inactive : fillColor}\n\t\t\t/>\n\t\t\t{!props.isPartial && (\n\t\t\t\t<svg\n\t\t\t\t\tdata-testid=\"checkmark-icon\"\n\t\t\t\t\twidth={dims.check.w}\n\t\t\t\t\theight={dims.check.h}\n\t\t\t\t\tx={dims.check.x}\n\t\t\t\t\ty={dims.check.y}\n\t\t\t\t\tviewBox=\"0 0 10 9\"\n\t\t\t\t\tfill=\"none\"\n\t\t\t\t\txmlns=\"http://www.w3.org/2000/svg\"\n\t\t\t\t>\n\t\t\t\t\t<path\n\t\t\t\t\t\tfillRule=\"evenodd\"\n\t\t\t\t\t\tclipRule=\"evenodd\"\n\t\t\t\t\t\td=\"M9.68189 1.06043C10.0724 1.45096 10.0724 2.08412 9.68189 2.47464L4.02501 8.13152C3.63449 8.52205 3.00132 8.52205 2.6108 8.13152L0.489684 6.01041C0.0991601 5.61988 0.0991598 4.98672 0.489684 4.59619C0.880209 4.20567 1.51337 4.20567 1.9039 4.59619L3.31791 6.0102L8.26768 1.06043C8.6582 0.669907 9.29137 0.669907 9.68189 1.06043Z\"\n\t\t\t\t\t\tfill=\"white\"\n\t\t\t\t\t/>\n\t\t\t\t</svg>\n\t\t\t)}\n\t\t\t{props.isPartial && (\n\t\t\t\t<rect\n\t\t\t\t\tdata-testid=\"partial-mark\"\n\t\t\t\t\tx={dims.partial.x}\n\t\t\t\t\ty={dims.partial.y}\n\t\t\t\t\twidth={dims.partial.w}\n\t\t\t\t\theight=\"2\"\n\t\t\t\t\trx=\"1\"\n\t\t\t\t\tfill={COLORS.surface.standard}\n\t\t\t\t/>\n\t\t\t)}\n\t\t</svg>\n\t);\n};\n\nexport const CheckBox: React.FC<CheckBoxProps> = (props) => {\n\tconst [isChecked, setIsChecked] = useState(props.isChecked || false);\n\tconst [isPartiallyChecked, setIsPartiallyChecked] = useState(\n\t\tprops.isPartiallyChecked || false,\n\t);\n\tconst [isDisabled, setIsDisabled] = useState(props.isDisabled || false);\n\tconst [isHovered, setIsHovered] = useState(false);\n\tconst [isClicked, setIsClicked] = useState(false);\n\n\tconst toggleCheck = (event?: React.SyntheticEvent) => {\n\t\tif (!props.isDisabled) {\n\t\t\tconst newVal = !isChecked;\n\t\t\tif (isPartiallyChecked) {\n\t\t\t\tsetIsPartiallyChecked(!isPartiallyChecked);\n\t\t\t} else {\n\t\t\t\tsetIsChecked(newVal);\n\t\t\t}\n\t\t\tprops.onValueChange?.(newVal, props.value, event as React.MouseEvent);\n\t\t}\n\t};\n\n\tconst handleCheck = (event: React.MouseEvent) => {\n\t\ttoggleCheck(event);\n\t};\n\n\tconst handleKeyDown = (event: React.KeyboardEvent) => {\n\t\tif (event.key === ' ' || event.key === 'Enter') {\n\t\t\tevent.preventDefault();\n\t\t\ttoggleCheck(event);\n\t\t}\n\t};\n\n\tconst ariaChecked = isPartiallyChecked\n\t\t? 'mixed'\n\t\t: isChecked\n\t\t? 'true'\n\t\t: 'false';\n\n\tuseEffect(() => {\n\t\tsetIsChecked(props.isChecked);\n\t}, [props.isChecked]);\n\n\tuseEffect(() => {\n\t\tsetIsDisabled(props.isDisabled || false);\n\t}, [props.isDisabled]);\n\n\tuseEffect(() => {\n\t\tsetIsPartiallyChecked(props.isPartiallyChecked || false);\n\t}, [props.isPartiallyChecked]);\n\n\tconst renderLabel = () => {\n\t\tif (!props.label) {\n\t\t\treturn <></>;\n\t\t}\n\n\t\tif (props.labelTypography) {\n\t\t\tconst LabelTypography = {\n\t\t\t\tbodyCaption: BodyCaption,\n\t\t\t\tbodySecondary: BodySecondary,\n\t\t\t\tbodyPrimary: BodyPrimary,\n\t\t\t\ttitleSmall: TitleSmall,\n\t\t\t}[props.labelTypography];\n\t\t\treturn (\n\t\t\t\t<LabelTypography\n\t\t\t\t\tcolor={props.isDisabled ? COLORS.text.disabled : COLORS.text.primary}\n\t\t\t\t>\n\t\t\t\t\t{props.label}\n\t\t\t\t</LabelTypography>\n\t\t\t);\n\t\t}\n\n\t\tif (props.size === 'XS') {\n\t\t\treturn (\n\t\t\t\t<BodyCaption\n\t\t\t\t\tcolor={props.isDisabled ? COLORS.text.disabled : COLORS.text.primary}\n\t\t\t\t>\n\t\t\t\t\t{props.label}\n\t\t\t\t</BodyCaption>\n\t\t\t);\n\t\t}\n\n\t\tif ((props.boldOnChecked && isChecked) || props.bold) {\n\t\t\tif (props.labelSize === 'DEFAULT') {\n\t\t\t\treturn (\n\t\t\t\t\t<TitleRegular\n\t\t\t\t\t\tcolor={\n\t\t\t\t\t\t\tprops.isDisabled ? COLORS.text.disabled : COLORS.text.primary\n\t\t\t\t\t\t}\n\t\t\t\t\t>\n\t\t\t\t\t\t{props.label}\n\t\t\t\t\t</TitleRegular>\n\t\t\t\t);\n\t\t\t}\n\t\t\treturn (\n\t\t\t\t<TitleSmall\n\t\t\t\t\tcolor={props.isDisabled ? COLORS.text.disabled : COLORS.text.primary}\n\t\t\t\t>\n\t\t\t\t\t{props.label}\n\t\t\t\t</TitleSmall>\n\t\t\t);\n\t\t}\n\n\t\tif (props.size === 'SMALL') {\n\t\t\treturn (\n\t\t\t\t<BodySecondary\n\t\t\t\t\tcolor={props.isDisabled ? COLORS.text.disabled : COLORS.text.primary}\n\t\t\t\t>\n\t\t\t\t\t{props.label}\n\t\t\t\t</BodySecondary>\n\t\t\t);\n\t\t}\n\n\t\tif (props.labelSize === 'SMALL') {\n\t\t\treturn (\n\t\t\t\t<BodySecondary\n\t\t\t\t\tcolor={props.isDisabled ? COLORS.text.disabled : COLORS.text.primary}\n\t\t\t\t>\n\t\t\t\t\t{props.label}\n\t\t\t\t</BodySecondary>\n\t\t\t);\n\t\t}\n\n\t\treturn (\n\t\t\t<BodyPrimary\n\t\t\t\tcolor={props.isDisabled ? COLORS.text.disabled : COLORS.text.primary}\n\t\t\t>\n\t\t\t\t{props.label}\n\t\t\t</BodyPrimary>\n\t\t);\n\t};\n\n\treturn (\n\t\t<CheckboxContainer\n\t\t\trole=\"checkbox\"\n\t\t\taria-checked={ariaChecked}\n\t\t\taria-disabled={isDisabled || undefined}\n\t\t\taria-label={props.label ? undefined : props.ariaLabel}\n\t\t\ttabIndex={isDisabled ? -1 : 0}\n\t\t\tonClick={handleCheck}\n\t\t\tonKeyDown={handleKeyDown}\n\t\t\tonMouseEnter={() => setIsHovered(!props.skipHoverState)}\n\t\t\tonMouseLeave={() => setIsHovered(false)}\n\t\t\tonMouseDown={() => setIsClicked(!props.skipHoverState)}\n\t\t\tonMouseUp={() => setIsClicked(false)}\n\t\t\tisDisabled={isDisabled}\n\t\t\tenableHover={props.enableHover}\n\t\t\tstyle={props.style ?? {}}\n\t\t>\n\t\t\t<CheckboxIcon\n\t\t\t\tchecked={isChecked}\n\t\t\t\thovered={isHovered}\n\t\t\t\tclicked={isClicked}\n\t\t\t\tisDisabled={isDisabled}\n\t\t\t\tsize={props.size}\n\t\t\t\tborderColor={props.checkboxBorderColor}\n\t\t\t\tactiveColor={props.activeColor}\n\t\t\t>\n\t\t\t\t{isChecked && (\n\t\t\t\t\t<CheckMark\n\t\t\t\t\t\tisPartial={isPartiallyChecked || false}\n\t\t\t\t\t\tisDisabled={isDisabled}\n\t\t\t\t\t\tsize={props.size}\n\t\t\t\t\t\tactiveColor={props?.activeColor}\n\t\t\t\t\t/>\n\t\t\t\t)}\n\t\t\t</CheckboxIcon>\n\t\t\t{renderLabel()}\n\t\t\t{props.rightComponent}\n\t\t</CheckboxContainer>\n\t);\n};\n"],"names":["CheckMark","props","fillColor","useMemo","COLORS","dims","jsxs","jsx","CheckBox","isChecked","setIsChecked","useState","isPartiallyChecked","setIsPartiallyChecked","isDisabled","setIsDisabled","isHovered","setIsHovered","isClicked","setIsClicked","toggleCheck","event","newVal","handleCheck","handleKeyDown","ariaChecked","useEffect","renderLabel","Fragment","LabelTypography","BodyCaption","BodySecondary","BodyPrimary","TitleSmall","TitleRegular","CheckboxContainer","CheckboxIcon"],"mappings":";;;;;AA4CA,MAAMA,IAKD,CAACC,MAAU;AACf,QAAMC,IAAYC;AAAA,IACjB,MAAMF,EAAM,eAAeG,EAAO,WAAW,SAAS;AAAA,IACtD,CAACH,EAAM,WAAW;AAAA,EAAA,GAIbI,IACLJ,EAAM,SAAS,OACZ;AAAA,IACA,KAAK;AAAA,IACL,OAAO,EAAE,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,IAAA;AAAA,IAC9B,SAAS,EAAE,GAAG,GAAG,GAAG,GAAG,GAAG,EAAA;AAAA,EAAE,IAE5BA,EAAM,SAAS,UACf;AAAA,IACA,KAAK;AAAA,IACL,OAAO,EAAE,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,EAAA;AAAA,IAC9B,SAAS,EAAE,GAAG,GAAG,GAAG,GAAG,GAAG,EAAA;AAAA,EAAE,IAE5B;AAAA,IACA,KAAK;AAAA,IACL,OAAO,EAAE,GAAG,IAAI,GAAG,GAAG,GAAG,GA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!1), [v, d] = c(!1), [
|
|
19
|
+
const [j, l] = c(!1), [v, d] = c(!1), [m, p] = c(
|
|
20
20
|
"success"
|
|
21
|
-
),
|
|
21
|
+
), w = async () => {
|
|
22
22
|
try {
|
|
23
|
-
await navigator.clipboard.writeText(a), l(!0),
|
|
23
|
+
await navigator.clipboard.writeText(a), l(!0), p("success"), d(!0), setTimeout(() => l(!1), 2e3);
|
|
24
24
|
} catch {
|
|
25
|
-
|
|
25
|
+
p("error"), d(!0);
|
|
26
26
|
}
|
|
27
|
-
}, [
|
|
27
|
+
}, [x, f] = c(a);
|
|
28
28
|
L(() => {
|
|
29
29
|
let e = !0;
|
|
30
30
|
return (async () => {
|
|
@@ -41,15 +41,15 @@ const U = ({
|
|
|
41
41
|
e = !1;
|
|
42
42
|
};
|
|
43
43
|
}, [a, s]);
|
|
44
|
-
const C =
|
|
45
|
-
`),
|
|
44
|
+
const C = x.split(`
|
|
45
|
+
`), S = (e) => ({
|
|
46
46
|
javascript: "#FEC02D",
|
|
47
47
|
python: "#3776ab",
|
|
48
48
|
java: "#ed8b00",
|
|
49
49
|
css: "#1572b6",
|
|
50
50
|
html: "#e34c26",
|
|
51
51
|
json: "#000000"
|
|
52
|
-
})[e.toLowerCase()] || (t === "dark" ? "#6e7681" : "#656d76"),
|
|
52
|
+
})[e.toLowerCase()] || (t === "dark" ? "#6e7681" : "#656d76"), _ = (e) => ({
|
|
53
53
|
javascript: "#000"
|
|
54
54
|
})?.[e.toLowerCase()] || "#fff";
|
|
55
55
|
return /* @__PURE__ */ i(k, { themeMode: t, maxWidth: T, children: [
|
|
@@ -59,16 +59,16 @@ const U = ({
|
|
|
59
59
|
/* @__PURE__ */ o(
|
|
60
60
|
D,
|
|
61
61
|
{
|
|
62
|
-
bg:
|
|
63
|
-
color:
|
|
62
|
+
bg: S(s),
|
|
63
|
+
color: _(s),
|
|
64
64
|
children: s
|
|
65
65
|
}
|
|
66
66
|
)
|
|
67
67
|
] }),
|
|
68
|
-
!M && /* @__PURE__ */ o(E, { themeMode: t, onClick:
|
|
68
|
+
!M && /* @__PURE__ */ o(E, { themeMode: t, onClick: w, children: j ? /* @__PURE__ */ o(u, { children: "✓ Copied" }) : /* @__PURE__ */ o(u, { children: "Copy" }) })
|
|
69
69
|
] }),
|
|
70
70
|
/* @__PURE__ */ i(P, { maxHeight: y, children: [
|
|
71
|
-
!g && /* @__PURE__ */ o(R, { themeMode: t, children: C.map((e, r) => /* @__PURE__ */ o("div", { children: r + 1 }, r)) }),
|
|
71
|
+
!g && /* @__PURE__ */ o(R, { themeMode: t, children: C.map((e, r) => /* @__PURE__ */ o("div", { "data-testid": "line-number-row", children: r + 1 }, r)) }),
|
|
72
72
|
/* @__PURE__ */ o(J, { themeMode: t, children: C.map((e, r) => /* @__PURE__ */ o(
|
|
73
73
|
"div",
|
|
74
74
|
{
|
|
@@ -83,9 +83,9 @@ const U = ({
|
|
|
83
83
|
v && /* @__PURE__ */ o(
|
|
84
84
|
B,
|
|
85
85
|
{
|
|
86
|
-
text:
|
|
86
|
+
text: m === "success" ? "Code copied to clipboard!" : "Failed to copy code",
|
|
87
87
|
autoClose: 2e3,
|
|
88
|
-
type:
|
|
88
|
+
type: m,
|
|
89
89
|
hideProgressBar: !0,
|
|
90
90
|
onCloseToast: () => d(!1)
|
|
91
91
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CodeBlock.js","sources":["../../../../src/components/code-block/CodeBlock.tsx"],"sourcesContent":["import { useEffect, useState } from 'react';\nimport { Toaster } from '@src/components/toaster/Toaster';\nimport {\n\tCode,\n\tCodeContainer,\n\tContainer,\n\tCopyButton,\n\tHeader,\n\tLanguageBadge,\n\tLineNumbers,\n\tTitle,\n\tTitleSection,\n} from './CodeBlock.styled';\nimport { highlightCode } from './CodeBlockHelper';\nimport { CodeBlockProps, CodeLanguage } from './types';\n\n// optional types extraction\n\nexport const CodeBlock = ({\n\tcode = '',\n\tlanguage = CodeLanguage.JAVASCRIPT,\n\ttitle = '',\n\thideLineNumbers = false,\n\tmaxHeight = '400px',\n\tmaxWidth,\n\ttheme = 'dark',\n\thideHeader = false,\n\thideCopy = false,\n}: CodeBlockProps) => {\n\tconst [copied, setCopied] = useState(false);\n\tconst [showToaster, setShowToaster] = useState(false);\n\tconst [toasterType, setToasterType] = useState<'success' | 'error'>(\n\t\t'success',\n\t);\n\n\tconst handleCopy = async () => {\n\t\ttry {\n\t\t\tawait navigator.clipboard.writeText(code);\n\t\t\tsetCopied(true);\n\t\t\tsetToasterType('success');\n\t\t\tsetShowToaster(true);\n\t\t\tsetTimeout(() => setCopied(false), 2000);\n\t\t} catch (err) {\n\t\t\tsetToasterType('error');\n\t\t\tsetShowToaster(true);\n\t\t}\n\t};\n\n\t// Apply language-specific formatting\n\tconst [formattedCode, setFormattedCode] = useState(code);\n\n\tuseEffect(() => {\n\t\tlet isMounted = true;\n\t\tconst formatCode = async () => {\n\t\t\ttry {\n\t\t\t\tconst formatterModule = await import(\n\t\t\t\t\t/* webpackChunkName: \"languageSpecificFormatting-[request]\" */\n\t\t\t\t\t`./languageSpecificFormatting/${language}_file.ts`\n\t\t\t\t);\n\t\t\t\tif (formatterModule?.format && isMounted) {\n\t\t\t\t\tsetFormattedCode(formatterModule.format(code));\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t} catch {\n\t\t\t\t// No formatter found — just use original\n\t\t\t}\n\t\t\tif (isMounted) setFormattedCode(code);\n\t\t};\n\n\t\tformatCode();\n\t\treturn () => {\n\t\t\tisMounted = false;\n\t\t};\n\t}, [code, language]);\n\n\tconst lines = formattedCode.split('\\n');\n\n\tconst getLanguageBadgeColor = (lang: CodeLanguage) => {\n\t\tconst colors: Record<CodeLanguage, string> = {\n\t\t\tjavascript: '#FEC02D',\n\t\t\tpython: '#3776ab',\n\t\t\tjava: '#ed8b00',\n\t\t\tcss: '#1572b6',\n\t\t\thtml: '#e34c26',\n\t\t\tjson: '#000000',\n\t\t};\n\t\treturn (\n\t\t\tcolors[lang.toLowerCase()] || (theme === 'dark' ? '#6e7681' : '#656d76')\n\t\t);\n\t};\n\n\tconst getBadgeTextColor = (lang: CodeLanguage) => {\n\t\tconst colors: Record<string, string> = {\n\t\t\tjavascript: '#000',\n\t\t};\n\t\treturn colors?.[lang.toLowerCase()] || '#fff';\n\t};\n\n\treturn (\n\t\t<Container themeMode={theme} maxWidth={maxWidth}>\n\t\t\t{!hideHeader && (\n\t\t\t\t<Header themeMode={theme}>\n\t\t\t\t\t<TitleSection>\n\t\t\t\t\t\t{!!title && title && <Title themeMode={theme}>{title}</Title>}\n\t\t\t\t\t\t<LanguageBadge\n\t\t\t\t\t\t\tbg={getLanguageBadgeColor(language)}\n\t\t\t\t\t\t\tcolor={getBadgeTextColor(language)}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{language}\n\t\t\t\t\t\t</LanguageBadge>\n\t\t\t\t\t</TitleSection>\n\t\t\t\t\t{!hideCopy && (\n\t\t\t\t\t\t<CopyButton themeMode={theme} onClick={handleCopy}>\n\t\t\t\t\t\t\t{copied ? <>✓ Copied</> : <>Copy</>}\n\t\t\t\t\t\t</CopyButton>\n\t\t\t\t\t)}\n\t\t\t\t</Header>\n\t\t\t)}\n\n\t\t\t<CodeContainer maxHeight={maxHeight}>\n\t\t\t\t{!hideLineNumbers && (\n\t\t\t\t\t<LineNumbers themeMode={theme}>\n\t\t\t\t\t\t{lines.map((_, index) => (\n\t\t\t\t\t\t\t<div key={index}
|
|
1
|
+
{"version":3,"file":"CodeBlock.js","sources":["../../../../src/components/code-block/CodeBlock.tsx"],"sourcesContent":["import { useEffect, useState } from 'react';\nimport { Toaster } from '@src/components/toaster/Toaster';\nimport {\n\tCode,\n\tCodeContainer,\n\tContainer,\n\tCopyButton,\n\tHeader,\n\tLanguageBadge,\n\tLineNumbers,\n\tTitle,\n\tTitleSection,\n} from './CodeBlock.styled';\nimport { highlightCode } from './CodeBlockHelper';\nimport { CodeBlockProps, CodeLanguage } from './types';\n\n// optional types extraction\n\nexport const CodeBlock = ({\n\tcode = '',\n\tlanguage = CodeLanguage.JAVASCRIPT,\n\ttitle = '',\n\thideLineNumbers = false,\n\tmaxHeight = '400px',\n\tmaxWidth,\n\ttheme = 'dark',\n\thideHeader = false,\n\thideCopy = false,\n}: CodeBlockProps) => {\n\tconst [copied, setCopied] = useState(false);\n\tconst [showToaster, setShowToaster] = useState(false);\n\tconst [toasterType, setToasterType] = useState<'success' | 'error'>(\n\t\t'success',\n\t);\n\n\tconst handleCopy = async () => {\n\t\ttry {\n\t\t\tawait navigator.clipboard.writeText(code);\n\t\t\tsetCopied(true);\n\t\t\tsetToasterType('success');\n\t\t\tsetShowToaster(true);\n\t\t\tsetTimeout(() => setCopied(false), 2000);\n\t\t} catch (err) {\n\t\t\tsetToasterType('error');\n\t\t\tsetShowToaster(true);\n\t\t}\n\t};\n\n\t// Apply language-specific formatting\n\tconst [formattedCode, setFormattedCode] = useState(code);\n\n\tuseEffect(() => {\n\t\tlet isMounted = true;\n\t\tconst formatCode = async () => {\n\t\t\ttry {\n\t\t\t\tconst formatterModule = await import(\n\t\t\t\t\t/* webpackChunkName: \"languageSpecificFormatting-[request]\" */\n\t\t\t\t\t`./languageSpecificFormatting/${language}_file.ts`\n\t\t\t\t);\n\t\t\t\tif (formatterModule?.format && isMounted) {\n\t\t\t\t\tsetFormattedCode(formatterModule.format(code));\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t} catch {\n\t\t\t\t// No formatter found — just use original\n\t\t\t}\n\t\t\tif (isMounted) setFormattedCode(code);\n\t\t};\n\n\t\tformatCode();\n\t\treturn () => {\n\t\t\tisMounted = false;\n\t\t};\n\t}, [code, language]);\n\n\tconst lines = formattedCode.split('\\n');\n\n\tconst getLanguageBadgeColor = (lang: CodeLanguage) => {\n\t\tconst colors: Record<CodeLanguage, string> = {\n\t\t\tjavascript: '#FEC02D',\n\t\t\tpython: '#3776ab',\n\t\t\tjava: '#ed8b00',\n\t\t\tcss: '#1572b6',\n\t\t\thtml: '#e34c26',\n\t\t\tjson: '#000000',\n\t\t};\n\t\treturn (\n\t\t\tcolors[lang.toLowerCase()] || (theme === 'dark' ? '#6e7681' : '#656d76')\n\t\t);\n\t};\n\n\tconst getBadgeTextColor = (lang: CodeLanguage) => {\n\t\tconst colors: Record<string, string> = {\n\t\t\tjavascript: '#000',\n\t\t};\n\t\treturn colors?.[lang.toLowerCase()] || '#fff';\n\t};\n\n\treturn (\n\t\t<Container themeMode={theme} maxWidth={maxWidth}>\n\t\t\t{!hideHeader && (\n\t\t\t\t<Header themeMode={theme}>\n\t\t\t\t\t<TitleSection>\n\t\t\t\t\t\t{!!title && title && <Title themeMode={theme}>{title}</Title>}\n\t\t\t\t\t\t<LanguageBadge\n\t\t\t\t\t\t\tbg={getLanguageBadgeColor(language)}\n\t\t\t\t\t\t\tcolor={getBadgeTextColor(language)}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{language}\n\t\t\t\t\t\t</LanguageBadge>\n\t\t\t\t\t</TitleSection>\n\t\t\t\t\t{!hideCopy && (\n\t\t\t\t\t\t<CopyButton themeMode={theme} onClick={handleCopy}>\n\t\t\t\t\t\t\t{copied ? <>✓ Copied</> : <>Copy</>}\n\t\t\t\t\t\t</CopyButton>\n\t\t\t\t\t)}\n\t\t\t\t</Header>\n\t\t\t)}\n\n\t\t\t<CodeContainer maxHeight={maxHeight}>\n\t\t\t\t{!hideLineNumbers && (\n\t\t\t\t\t<LineNumbers themeMode={theme}>\n\t\t\t\t\t\t{lines.map((_, index) => (\n\t\t\t\t\t\t\t<div key={index} data-testid=\"line-number-row\">\n\t\t\t\t\t\t\t\t{index + 1}\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t))}\n\t\t\t\t\t</LineNumbers>\n\t\t\t\t)}\n\t\t\t\t<Code themeMode={theme}>\n\t\t\t\t\t{lines.map((line, index) => (\n\t\t\t\t\t\t<div\n\t\t\t\t\t\t\tkey={index}\n\t\t\t\t\t\t\tstyle={{ minHeight: line.trim() ? '20px' : '0px' }}\n\t\t\t\t\t\t\tdangerouslySetInnerHTML={{\n\t\t\t\t\t\t\t\t__html: highlightCode(line, language, theme) || ' ',\n\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t/>\n\t\t\t\t\t))}\n\t\t\t\t</Code>\n\t\t\t</CodeContainer>\n\t\t\t{showToaster && (\n\t\t\t\t<Toaster\n\t\t\t\t\ttext={\n\t\t\t\t\t\ttoasterType === 'success'\n\t\t\t\t\t\t\t? 'Code copied to clipboard!'\n\t\t\t\t\t\t\t: 'Failed to copy code'\n\t\t\t\t\t}\n\t\t\t\t\tautoClose={2000}\n\t\t\t\t\ttype={toasterType}\n\t\t\t\t\thideProgressBar\n\t\t\t\t\tonCloseToast={() => setShowToaster(false)}\n\t\t\t\t/>\n\t\t\t)}\n\t\t</Container>\n\t);\n};\n"],"names":["CodeBlock","code","language","CodeLanguage","title","hideLineNumbers","maxHeight","maxWidth","theme","hideHeader","hideCopy","copied","setCopied","useState","showToaster","setShowToaster","toasterType","setToasterType","handleCopy","formattedCode","setFormattedCode","useEffect","isMounted","formatterModule","__variableDynamicImportRuntimeHelper","lines","getLanguageBadgeColor","lang","getBadgeTextColor","jsxs","Container","Header","TitleSection","Title","jsx","LanguageBadge","CopyButton","Fragment","CodeContainer","LineNumbers","_","index","Code","line","highlightCode","Toaster"],"mappings":";;;;;;;AAkBO,MAAMA,IAAY,CAAC;AAAA,EACzB,MAAAC,IAAO;AAAA,EACP,UAAAC,IAAWC,EAAa;AAAA,EACxB,OAAAC,IAAQ;AAAA,EACR,iBAAAC,IAAkB;AAAA,EAClB,WAAAC,IAAY;AAAA,EACZ,UAAAC;AAAA,EACA,OAAAC,IAAQ;AAAA,EACR,YAAAC,IAAa;AAAA,EACb,UAAAC,IAAW;AACZ,MAAsB;AACrB,QAAM,CAACC,GAAQC,CAAS,IAAIC,EAAS,EAAK,GACpC,CAACC,GAAaC,CAAc,IAAIF,EAAS,EAAK,GAC9C,CAACG,GAAaC,CAAc,IAA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A;AAAA,QAEJ,WAAW;AAAA,QACX,MAAMA;AAAA,QACN,iBAAe;AAAA,QACf,cAAc,MAAMD,EAAe,EAAK;AAAA,MAAA;AAAA,IAAA;AAAA,EACzC,GAEF;AAEF;"}
|
|
@@ -1,23 +1,24 @@
|
|
|
1
|
-
import { jsxs as
|
|
1
|
+
import { jsxs as t, jsx as e } from "react/jsx-runtime";
|
|
2
2
|
import { ColorInputContainer as n, StyledColorInput as l } from "./ColourInput.styled.js";
|
|
3
3
|
import { BodySecondary as a, BodyPrimary as i } from "../TypographyStyle.js";
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
/* @__PURE__ */
|
|
7
|
-
/* @__PURE__ */
|
|
8
|
-
/* @__PURE__ */
|
|
4
|
+
const m = (o) => /* @__PURE__ */ t("div", { className: "buttonColorCustom", children: [
|
|
5
|
+
o.headingText && /* @__PURE__ */ e(a, { children: o.headingText }),
|
|
6
|
+
/* @__PURE__ */ t(n, { children: [
|
|
7
|
+
/* @__PURE__ */ e(i, { children: o.labelText ?? "Colour" }),
|
|
8
|
+
/* @__PURE__ */ e(
|
|
9
9
|
l,
|
|
10
10
|
{
|
|
11
11
|
type: "color",
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
"data-testid": "colour-input",
|
|
13
|
+
onChange: (r) => {
|
|
14
|
+
o.onValueChange(r.target.value);
|
|
14
15
|
},
|
|
15
|
-
value:
|
|
16
|
+
value: o.value
|
|
16
17
|
}
|
|
17
18
|
)
|
|
18
19
|
] })
|
|
19
20
|
] });
|
|
20
21
|
export {
|
|
21
|
-
|
|
22
|
+
m as ColourInput
|
|
22
23
|
};
|
|
23
24
|
//# sourceMappingURL=ColourInput.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ColourInput.js","sources":["../../../../src/components/colourInput/ColourInput.tsx"],"sourcesContent":["import React from 'react';\nimport {\n\tColorInputContainer,\n\tStyledColorInput,\n} from '@src/components/colourInput/ColourInput.styled';\nimport { BodyPrimary, BodySecondary } from '@src/components/TypographyStyle';\n\nexport interface ColourInputProps {\n\tvalue: string;\n\tlabelText: string;\n\theadingText?: string;\n\tonValueChange: (value: string) => void;\n}\n\nexport const ColourInput: React.FC<ColourInputProps> = (props) => {\n\treturn (\n\t\t<div className=\"buttonColorCustom\">\n\t\t\t{props.headingText && <BodySecondary>{props.headingText}</BodySecondary>}\n\t\t\t<ColorInputContainer>\n\t\t\t\t<BodyPrimary>{props.labelText ?? 'Colour'}</BodyPrimary>\n\t\t\t\t<StyledColorInput\n\t\t\t\t\ttype=\"color\"\n\t\t\t\t\tonChange={(e) => {\n\t\t\t\t\t\tprops.onValueChange(e.target.value);\n\t\t\t\t\t}}\n\t\t\t\t\tvalue={props.value}\n\t\t\t\t/>\n\t\t\t</ColorInputContainer>\n\t\t</div>\n\t);\n};\n"],"names":["ColourInput","props","jsxs","jsx","BodySecondary","ColorInputContainer","BodyPrimary","StyledColorInput","e"],"mappings":";;;AAcO,MAAMA,IAA0C,CAACC,MAEtD,gBAAAC,EAAC,OAAA,EAAI,WAAU,qBACb,UAAA;AAAA,EAAAD,EAAM,eAAe,gBAAAE,EAACC,GAAA,EAAe,UAAAH,EAAM,aAAY;AAAA,oBACvDI,GAAA,EACA,UAAA;AAAA,IAAA,gBAAAF,EAACG,GAAA,EAAa,UAAAL,EAAM,aAAa,UAAS;AAAA,IAC1C,gBAAAE;AAAA,MAACI;AAAA,MAAA;AAAA,QACA,MAAK;AAAA,QACL,UAAU,CAACC,MAAM;AAChB,UAAAP,EAAM,cAAcO,EAAE,OAAO,KAAK;AAAA,QACnC;AAAA,QACA,OAAOP,EAAM;AAAA,MAAA;AAAA,IAAA;AAAA,EACd,EAAA,CACD;AAAA,GACD;"}
|
|
1
|
+
{"version":3,"file":"ColourInput.js","sources":["../../../../src/components/colourInput/ColourInput.tsx"],"sourcesContent":["import React from 'react';\nimport {\n\tColorInputContainer,\n\tStyledColorInput,\n} from '@src/components/colourInput/ColourInput.styled';\nimport { BodyPrimary, BodySecondary } from '@src/components/TypographyStyle';\n\nexport interface ColourInputProps {\n\tvalue: string;\n\tlabelText: string;\n\theadingText?: string;\n\tonValueChange: (value: string) => void;\n}\n\nexport const ColourInput: React.FC<ColourInputProps> = (props) => {\n\treturn (\n\t\t<div className=\"buttonColorCustom\">\n\t\t\t{props.headingText && <BodySecondary>{props.headingText}</BodySecondary>}\n\t\t\t<ColorInputContainer>\n\t\t\t\t<BodyPrimary>{props.labelText ?? 'Colour'}</BodyPrimary>\n\t\t\t\t<StyledColorInput\n\t\t\t\t\ttype=\"color\"\n\t\t\t\t\tdata-testid=\"colour-input\"\n\t\t\t\t\tonChange={(e) => {\n\t\t\t\t\t\tprops.onValueChange(e.target.value);\n\t\t\t\t\t}}\n\t\t\t\t\tvalue={props.value}\n\t\t\t\t/>\n\t\t\t</ColorInputContainer>\n\t\t</div>\n\t);\n};\n"],"names":["ColourInput","props","jsxs","jsx","BodySecondary","ColorInputContainer","BodyPrimary","StyledColorInput","e"],"mappings":";;;AAcO,MAAMA,IAA0C,CAACC,MAEtD,gBAAAC,EAAC,OAAA,EAAI,WAAU,qBACb,UAAA;AAAA,EAAAD,EAAM,eAAe,gBAAAE,EAACC,GAAA,EAAe,UAAAH,EAAM,aAAY;AAAA,oBACvDI,GAAA,EACA,UAAA;AAAA,IAAA,gBAAAF,EAACG,GAAA,EAAa,UAAAL,EAAM,aAAa,UAAS;AAAA,IAC1C,gBAAAE;AAAA,MAACI;AAAA,MAAA;AAAA,QACA,MAAK;AAAA,QACL,eAAY;AAAA,QACZ,UAAU,CAACC,MAAM;AAChB,UAAAP,EAAM,cAAcO,EAAE,OAAO,KAAK;AAAA,QACnC;AAAA,QACA,OAAOP,EAAM;AAAA,MAAA;AAAA,IAAA;AAAA,EACd,EAAA,CACD;AAAA,GACD;"}
|