@razorpay/blade 12.64.0 → 12.65.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/build/lib/native/components/Badge/Badge.js +1 -1
- package/build/lib/native/components/Badge/Badge.js.map +1 -1
- package/build/lib/native/components/Badge/badgeTokens.js +1 -1
- package/build/lib/native/components/Badge/badgeTokens.js.map +1 -1
- package/build/lib/native/components/Form/CharacterCounter/CharacterCounter.js.map +1 -1
- package/build/lib/native/components/Input/BaseInput/BaseInput.js.map +1 -1
- package/build/lib/native/components/Input/BaseInput/BaseInputVisuals.js +1 -1
- package/build/lib/native/components/Input/BaseInput/BaseInputVisuals.js.map +1 -1
- package/build/lib/native/components/Input/BaseInput/baseInputTokens.js +1 -1
- package/build/lib/native/components/Input/BaseInput/baseInputTokens.js.map +1 -1
- package/build/lib/native/components/QuickFilters/QuickFilter.js +1 -1
- package/build/lib/native/components/QuickFilters/QuickFilter.js.map +1 -1
- package/build/lib/native/components/Radio/Radio.js +1 -1
- package/build/lib/native/components/Radio/Radio.js.map +1 -1
- package/build/lib/native/components/Table/TableContext.js +1 -1
- package/build/lib/native/components/Table/TableContext.js.map +1 -1
- package/build/lib/native/components/Table/tokens.js +1 -1
- package/build/lib/native/components/Table/tokens.js.map +1 -1
- package/build/lib/native/tokens/global/size.js +1 -1
- package/build/lib/native/tokens/global/size.js.map +1 -1
- package/build/lib/web/development/components/Badge/Badge.js +4 -0
- package/build/lib/web/development/components/Badge/Badge.js.map +1 -1
- package/build/lib/web/development/components/Badge/badgeTokens.js +4 -0
- package/build/lib/web/development/components/Badge/badgeTokens.js.map +1 -1
- package/build/lib/web/development/components/Dropdown/FilterChipGroup.web.js +3 -1
- package/build/lib/web/development/components/Dropdown/FilterChipGroup.web.js.map +1 -1
- package/build/lib/web/development/components/FilterChip/BaseFilterChip.web.js +8 -9
- package/build/lib/web/development/components/FilterChip/BaseFilterChip.web.js.map +1 -1
- package/build/lib/web/development/components/FilterChip/tokens.js +1 -1
- package/build/lib/web/development/components/FilterChip/tokens.js.map +1 -1
- package/build/lib/web/development/components/Form/CharacterCounter/CharacterCounter.js.map +1 -1
- package/build/lib/web/development/components/Input/BaseInput/BaseInput.js.map +1 -1
- package/build/lib/web/development/components/Input/BaseInput/BaseInputVisuals.js +2 -0
- package/build/lib/web/development/components/Input/BaseInput/BaseInputVisuals.js.map +1 -1
- package/build/lib/web/development/components/Input/BaseInput/baseInputTokens.js +11 -0
- package/build/lib/web/development/components/Input/BaseInput/baseInputTokens.js.map +1 -1
- package/build/lib/web/development/components/Input/PhoneNumberInput/CountrySelector.web.js +1 -0
- package/build/lib/web/development/components/Input/PhoneNumberInput/CountrySelector.web.js.map +1 -1
- package/build/lib/web/development/components/ListView/ListViewFilters.web.js +13 -102
- package/build/lib/web/development/components/ListView/ListViewFilters.web.js.map +1 -1
- package/build/lib/web/development/components/QuickFilters/QuickFilter.js +2 -1
- package/build/lib/web/development/components/QuickFilters/QuickFilter.js.map +1 -1
- package/build/lib/web/development/components/Radio/Radio.js +4 -2
- package/build/lib/web/development/components/Radio/Radio.js.map +1 -1
- package/build/lib/web/development/components/Table/Table.web.js +3 -1
- package/build/lib/web/development/components/Table/Table.web.js.map +1 -1
- package/build/lib/web/development/components/Table/TableBody.web.js +2 -1
- package/build/lib/web/development/components/Table/TableBody.web.js.map +1 -1
- package/build/lib/web/development/components/Table/TableContext.js +2 -1
- package/build/lib/web/development/components/Table/TableContext.js.map +1 -1
- package/build/lib/web/development/components/Table/TableFooter.web.js +2 -1
- package/build/lib/web/development/components/Table/TableFooter.web.js.map +1 -1
- package/build/lib/web/development/components/Table/TableHeader.web.js +78 -68
- package/build/lib/web/development/components/Table/TableHeader.web.js.map +1 -1
- package/build/lib/web/development/components/Table/TablePagination.web.js +5 -2
- package/build/lib/web/development/components/Table/TablePagination.web.js.map +1 -1
- package/build/lib/web/development/components/Table/TableToolbar.web.js +15 -13
- package/build/lib/web/development/components/Table/TableToolbar.web.js.map +1 -1
- package/build/lib/web/development/components/Table/tokens.js +11 -8
- package/build/lib/web/development/components/Table/tokens.js.map +1 -1
- package/build/lib/web/development/tokens/global/size.js +2 -0
- package/build/lib/web/development/tokens/global/size.js.map +1 -1
- package/build/lib/web/production/components/Badge/Badge.js +4 -0
- package/build/lib/web/production/components/Badge/Badge.js.map +1 -1
- package/build/lib/web/production/components/Badge/badgeTokens.js +4 -0
- package/build/lib/web/production/components/Badge/badgeTokens.js.map +1 -1
- package/build/lib/web/production/components/Dropdown/FilterChipGroup.web.js +3 -1
- package/build/lib/web/production/components/Dropdown/FilterChipGroup.web.js.map +1 -1
- package/build/lib/web/production/components/FilterChip/BaseFilterChip.web.js +8 -9
- package/build/lib/web/production/components/FilterChip/BaseFilterChip.web.js.map +1 -1
- package/build/lib/web/production/components/FilterChip/tokens.js +1 -1
- package/build/lib/web/production/components/FilterChip/tokens.js.map +1 -1
- package/build/lib/web/production/components/Form/CharacterCounter/CharacterCounter.js.map +1 -1
- package/build/lib/web/production/components/Input/BaseInput/BaseInput.js.map +1 -1
- package/build/lib/web/production/components/Input/BaseInput/BaseInputVisuals.js +2 -0
- package/build/lib/web/production/components/Input/BaseInput/BaseInputVisuals.js.map +1 -1
- package/build/lib/web/production/components/Input/BaseInput/baseInputTokens.js +11 -0
- package/build/lib/web/production/components/Input/BaseInput/baseInputTokens.js.map +1 -1
- package/build/lib/web/production/components/Input/PhoneNumberInput/CountrySelector.web.js +1 -0
- package/build/lib/web/production/components/Input/PhoneNumberInput/CountrySelector.web.js.map +1 -1
- package/build/lib/web/production/components/ListView/ListViewFilters.web.js +13 -102
- package/build/lib/web/production/components/ListView/ListViewFilters.web.js.map +1 -1
- package/build/lib/web/production/components/QuickFilters/QuickFilter.js +2 -1
- package/build/lib/web/production/components/QuickFilters/QuickFilter.js.map +1 -1
- package/build/lib/web/production/components/Radio/Radio.js +4 -2
- package/build/lib/web/production/components/Radio/Radio.js.map +1 -1
- package/build/lib/web/production/components/Table/Table.web.js +3 -1
- package/build/lib/web/production/components/Table/Table.web.js.map +1 -1
- package/build/lib/web/production/components/Table/TableBody.web.js +2 -1
- package/build/lib/web/production/components/Table/TableBody.web.js.map +1 -1
- package/build/lib/web/production/components/Table/TableContext.js +2 -1
- package/build/lib/web/production/components/Table/TableContext.js.map +1 -1
- package/build/lib/web/production/components/Table/TableFooter.web.js +2 -1
- package/build/lib/web/production/components/Table/TableFooter.web.js.map +1 -1
- package/build/lib/web/production/components/Table/TableHeader.web.js +78 -68
- package/build/lib/web/production/components/Table/TableHeader.web.js.map +1 -1
- package/build/lib/web/production/components/Table/TablePagination.web.js +5 -2
- package/build/lib/web/production/components/Table/TablePagination.web.js.map +1 -1
- package/build/lib/web/production/components/Table/TableToolbar.web.js +15 -13
- package/build/lib/web/production/components/Table/TableToolbar.web.js.map +1 -1
- package/build/lib/web/production/components/Table/tokens.js +11 -8
- package/build/lib/web/production/components/Table/tokens.js.map +1 -1
- package/build/lib/web/production/tokens/global/size.js +2 -0
- package/build/lib/web/production/tokens/global/size.js.map +1 -1
- package/build/types/components/index.d.ts +47 -9
- package/build/types/components/index.native.d.ts +44 -6
- package/build/types/tokens/index.d.ts +2 -0
- package/build/types/tokens/index.native.d.ts +2 -0
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseInputVisuals.js","sources":["../../../../../../src/components/Input/BaseInput/BaseInputVisuals.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/explicit-function-return-type */\nimport React from 'react';\nimport type { ReactElement } from 'react';\nimport type { BaseInputProps } from './BaseInput';\nimport BaseBox from '~components/Box/BaseBox';\nimport { Text } from '~components/Typography';\nimport type { BaseBoxProps, SpacingValueType } from '~components/Box/BaseBox';\nimport type { IconColors } from '~components/Icons';\nimport { isValidAllowedChildren } from '~utils/isValidAllowedChildren';\nimport { throwBladeError } from '~utils/logger';\nimport { Tooltip } from '~components/Tooltip';\nimport { Box } from '~components/Box';\nimport { isReactNative } from '~utils';\n\ntype InputVisuals = Pick<\n BaseInputProps,\n | 'leadingIcon'\n | 'prefix'\n | 'trailingInteractionElement'\n | 'onTrailingInteractionElementClick'\n | 'leadingInteractionElement'\n | 'leadingDropDown'\n | 'trailingDropDown'\n | 'suffix'\n | 'trailingIcon'\n | 'isDisabled'\n | 'validationState'\n | 'size'\n | 'trailingButton'\n | 'showHintsAsTooltip'\n | 'errorText'\n | 'successText'\n> & {\n size: NonNullable<BaseInputProps['size']>;\n};\n\nconst getVisualContainerStyles = ({\n shouldStretchTrailingBox,\n}: {\n shouldStretchTrailingBox?: boolean;\n} = {}): Pick<BaseBoxProps, 'display' | 'flexDirection' | 'alignItems' | 'alignSelf'> => ({\n display: 'flex',\n flexDirection: 'row',\n alignItems: 'center',\n alignSelf: shouldStretchTrailingBox ? 'stretch' : 'center',\n});\n\nconst trailingIconColor: Record<NonNullable<InputVisuals['validationState']>, IconColors> = {\n none: 'surface.icon.gray.subtle',\n error: 'feedback.icon.negative.intense',\n success: 'feedback.icon.positive.intense',\n};\n\nconst iconSize = {\n xsmall: 'small',\n medium: 'medium',\n large: 'large',\n} as const;\n\nconst textSize = {\n xsmall: 'small',\n medium: 'medium',\n large: 'large',\n} as const;\n\nconst getPrefixStyles = ({\n hasLeadingIcon,\n hasPrefix,\n}: {\n hasLeadingIcon: boolean;\n hasPrefix: boolean;\n}): Pick<BaseBoxProps, 'paddingLeft'> => {\n if (hasPrefix && hasLeadingIcon) {\n return {\n paddingLeft: 'spacing.3',\n };\n }\n\n if (hasPrefix && !hasLeadingIcon) {\n return {\n paddingLeft: 'spacing.4',\n };\n }\n\n return {\n paddingLeft: 'spacing.0',\n };\n};\n\nconst getInteractionElementStyles = ({\n hasTrailingIcon,\n hasLeadingInteractionElement,\n hasLeadingDropDown,\n hasTrailingInteractionElement,\n hasSuffix,\n hasTrailingButton,\n hasTrailingDropDown,\n}: {\n hasTrailingIcon: boolean;\n hasLeadingInteractionElement?: boolean;\n hasLeadingDropDown?: boolean;\n hasTrailingInteractionElement?: boolean;\n hasSuffix: boolean;\n hasTrailingButton: boolean;\n hasTrailingDropDown?: boolean;\n}): SpacingValueType => {\n if (hasTrailingInteractionElement && (hasSuffix || hasTrailingIcon || hasTrailingButton)) {\n return 'spacing.2';\n }\n\n if (hasLeadingDropDown || hasTrailingDropDown) {\n return 'spacing.2';\n }\n\n if (hasTrailingInteractionElement && !hasSuffix && !hasTrailingIcon && !hasTrailingButton) {\n return 'spacing.4';\n }\n\n if (hasLeadingInteractionElement) {\n return 'spacing.3';\n }\n\n return 'spacing.0';\n};\n\nconst getSuffixStyles = ({\n hasTrailingIcon,\n hasSuffix,\n hasTrailingButton,\n}: {\n hasTrailingIcon: boolean;\n hasSuffix: boolean;\n hasTrailingButton: boolean;\n}): Pick<BaseBoxProps, 'paddingRight'> => {\n if (hasSuffix && (hasTrailingIcon || hasTrailingButton)) {\n return {\n paddingRight: 'spacing.3',\n };\n }\n\n if (hasSuffix && !hasTrailingIcon && !hasTrailingButton) {\n return {\n paddingRight: 'spacing.4',\n };\n }\n\n return {\n paddingRight: 'spacing.0',\n };\n};\n\nconst getTrailingIconStyles = ({\n hasTrailingIcon,\n hasTrailingButton,\n}: {\n hasTrailingIcon: boolean;\n hasTrailingButton: boolean;\n}): Pick<BaseBoxProps, 'paddingRight'> => {\n if (hasTrailingIcon && hasTrailingButton) {\n return {\n paddingRight: 'spacing.3',\n };\n }\n\n if (hasTrailingIcon && !hasTrailingButton) {\n return {\n paddingRight: 'spacing.4',\n };\n }\n\n return {\n paddingRight: 'spacing.0',\n };\n};\n\nexport const getInputVisualsToBeRendered = ({\n leadingIcon,\n prefix,\n trailingInteractionElement,\n leadingInteractionElement,\n suffix,\n trailingIcon,\n trailingButton,\n leadingDropDown,\n trailingDropDown,\n}: InputVisuals) => ({\n hasLeadingIcon: Boolean(leadingIcon),\n hasPrefix: Boolean(prefix),\n hasTrailingInteractionElement: Boolean(trailingInteractionElement),\n hasLeadingInteractionElement: Boolean(leadingInteractionElement),\n hasSuffix: Boolean(suffix),\n hasTrailingIcon: Boolean(trailingIcon),\n hasTrailingButton: Boolean(trailingButton),\n hasLeadingDropDown: Boolean(leadingDropDown),\n hasTrailingDropDown: Boolean(trailingDropDown),\n});\n\nconst getTooltipContent = ({\n validationState,\n errorText,\n successText,\n}: {\n validationState: BaseInputProps['validationState'];\n errorText: BaseInputProps['errorText'];\n successText: BaseInputProps['errorText'];\n}): string => {\n if (validationState === 'error' && errorText) {\n return errorText;\n }\n\n if (validationState === 'success' && successText) {\n return successText;\n }\n\n return '';\n};\n\nconst ValidationIconTooltip = ({\n children,\n validationState,\n errorText,\n successText,\n showHintsAsTooltip,\n}: {\n children: ReactElement;\n validationState: BaseInputProps['validationState'];\n errorText: BaseInputProps['errorText'];\n successText: BaseInputProps['errorText'];\n showHintsAsTooltip: BaseInputProps['showHintsAsTooltip'];\n}) => {\n if (\n (showHintsAsTooltip && validationState === 'error' && errorText) ||\n (validationState === 'success' && successText)\n ) {\n return (\n <Tooltip content={getTooltipContent({ validationState, errorText, successText })}>\n <Box display=\"flex\" justifyContent=\"center\" alignItems=\"center\">\n {children}\n </Box>\n </Tooltip>\n );\n }\n\n return children;\n};\n\nexport const BaseInputVisuals = ({\n leadingIcon: LeadingIcon,\n prefix,\n trailingInteractionElement,\n onTrailingInteractionElementClick,\n leadingDropDown,\n trailingDropDown,\n leadingInteractionElement,\n suffix,\n trailingIcon: TrailingIcon,\n isDisabled,\n validationState = 'none',\n size,\n showHintsAsTooltip,\n errorText,\n successText,\n trailingButton: TrailingButton,\n}: InputVisuals): ReactElement | null => {\n const {\n hasLeadingIcon,\n hasPrefix,\n hasSuffix,\n hasTrailingInteractionElement,\n hasLeadingInteractionElement,\n hasTrailingIcon,\n hasTrailingButton,\n hasLeadingDropDown,\n hasTrailingDropDown,\n } = getInputVisualsToBeRendered({\n leadingIcon: LeadingIcon,\n prefix,\n leadingInteractionElement,\n trailingInteractionElement,\n suffix,\n trailingIcon: TrailingIcon,\n trailingButton: TrailingButton,\n leadingDropDown,\n trailingDropDown,\n size,\n });\n\n const hasLeadingVisuals =\n hasLeadingInteractionElement || hasLeadingIcon || hasPrefix || hasLeadingDropDown;\n const hasTrailingVisuals =\n hasTrailingInteractionElement ||\n hasSuffix ||\n hasTrailingIcon ||\n hasTrailingButton ||\n hasTrailingDropDown;\n\n if (__DEV__) {\n if (hasTrailingButton && !isValidAllowedChildren(TrailingButton, 'Link')) {\n throwBladeError({\n message: 'trailingButton must be a valid Blade Link component',\n moduleName: 'BaseInput',\n });\n }\n }\n\n if (hasLeadingVisuals) {\n return (\n <BaseBox {...getVisualContainerStyles()}>\n {hasLeadingInteractionElement ? (\n <BaseBox\n paddingLeft={getInteractionElementStyles({\n hasTrailingIcon,\n hasLeadingInteractionElement,\n hasSuffix,\n hasTrailingButton,\n })}\n display=\"flex\"\n alignItems=\"stretch\"\n alignSelf=\"stretch\"\n >\n {leadingInteractionElement}\n </BaseBox>\n ) : null}\n {LeadingIcon ? (\n <BaseBox paddingLeft=\"spacing.4\" display=\"flex\">\n <LeadingIcon\n size={iconSize[size]}\n color={isDisabled ? 'surface.icon.gray.disabled' : 'surface.icon.gray.muted'}\n />\n </BaseBox>\n ) : null}\n {hasPrefix ? (\n <BaseBox {...getPrefixStyles({ hasLeadingIcon, hasPrefix })}>\n <Text\n size={textSize[size]}\n variant=\"body\"\n weight=\"regular\"\n color={isDisabled ? 'surface.text.gray.disabled' : 'surface.text.gray.muted'}\n >\n {prefix}\n </Text>\n </BaseBox>\n ) : null}\n {leadingDropDown ? (\n <BaseBox paddingLeft=\"spacing.2\" display=\"flex\">\n {leadingDropDown}\n </BaseBox>\n ) : null}\n </BaseBox>\n );\n }\n\n if (hasTrailingVisuals) {\n return (\n <BaseBox\n {...getVisualContainerStyles({\n shouldStretchTrailingBox:\n hasTrailingInteractionElement && Boolean(onTrailingInteractionElementClick),\n })}\n >\n {hasTrailingInteractionElement ? (\n <BaseBox\n {...getVisualContainerStyles({\n shouldStretchTrailingBox:\n hasTrailingInteractionElement && Boolean(onTrailingInteractionElementClick),\n })}\n >\n <BaseBox\n paddingRight={getInteractionElementStyles({\n hasTrailingIcon,\n hasTrailingInteractionElement,\n hasSuffix,\n hasTrailingButton,\n hasTrailingDropDown,\n })}\n display=\"flex\"\n alignItems=\"stretch\"\n alignSelf=\"stretch\"\n {...(!isReactNative() && { onClick: onTrailingInteractionElementClick })}\n >\n {trailingInteractionElement}\n </BaseBox>\n </BaseBox>\n ) : null}\n {hasSuffix ? (\n <BaseBox {...getSuffixStyles({ hasTrailingIcon, hasSuffix, hasTrailingButton })}>\n <Text\n size={textSize[size]}\n variant=\"body\"\n weight=\"regular\"\n color={isDisabled ? 'surface.text.gray.disabled' : 'surface.text.gray.subtle'}\n >\n {suffix}\n </Text>\n </BaseBox>\n ) : null}\n {TrailingIcon ? (\n <BaseBox\n display=\"flex\"\n justifyContent=\"center\"\n alignItems=\"center\"\n {...getTrailingIconStyles({ hasTrailingIcon, hasTrailingButton })}\n >\n <ValidationIconTooltip\n showHintsAsTooltip={showHintsAsTooltip}\n errorText={errorText}\n successText={successText}\n validationState={validationState}\n >\n <TrailingIcon\n size={iconSize[size]}\n color={\n isDisabled ? 'interactive.icon.gray.disabled' : trailingIconColor[validationState]\n }\n />\n </ValidationIconTooltip>\n </BaseBox>\n ) : null}\n {TrailingButton ? (\n <BaseBox paddingRight=\"spacing.4\" display=\"flex\">\n {React.cloneElement(TrailingButton, {\n size,\n variant: 'button',\n isDisabled,\n })}\n </BaseBox>\n ) : null}\n {hasTrailingDropDown ? (\n <BaseBox paddingRight=\"spacing.2\" display=\"flex\">\n {trailingDropDown}\n </BaseBox>\n ) : null}\n </BaseBox>\n );\n }\n\n return null;\n};\n"],"names":["getVisualContainerStyles","_ref","arguments","length","undefined","shouldStretchTrailingBox","display","flexDirection","alignItems","alignSelf","trailingIconColor","none","error","success","iconSize","xsmall","medium","large","textSize","getPrefixStyles","_ref2","hasLeadingIcon","hasPrefix","paddingLeft","getInteractionElementStyles","_ref3","hasTrailingIcon","hasLeadingInteractionElement","hasLeadingDropDown","hasTrailingInteractionElement","hasSuffix","hasTrailingButton","hasTrailingDropDown","getSuffixStyles","_ref4","paddingRight","getTrailingIconStyles","_ref5","getInputVisualsToBeRendered","_ref6","leadingIcon","prefix","trailingInteractionElement","leadingInteractionElement","suffix","trailingIcon","trailingButton","leadingDropDown","trailingDropDown","Boolean","getTooltipContent","_ref7","validationState","errorText","successText","ValidationIconTooltip","_ref8","children","showHintsAsTooltip","_jsx","Tooltip","content","Box","justifyContent","BaseInputVisuals","_ref9","LeadingIcon","onTrailingInteractionElementClick","TrailingIcon","isDisabled","_ref9$validationState","size","TrailingButton","_getInputVisualsToBeR","hasLeadingVisuals","hasTrailingVisuals","__DEV__","isValidAllowedChildren","throwBladeError","message","moduleName","_jsxs","BaseBox","Object","assign","color","Text","variant","weight","isReactNative","onClick","React","cloneElement"],"mappings":";;;;;;;;;;;;;;;;;AAoCA,IAAMA,wBAAwB,CAAG,SAA3BA,wBAAwBA,EAAA,CAAA,IAAAC,IAAA,CAAAC,SAAA,CAAAC,MAAA,IAAAD,SAAA,CAAA,CAAA,CAAA,GAAAE,SAAA,CAAAF,SAAA,IAI1B,EAAE,CAHJG,wBAAwB,CAAAJ,IAAA,CAAxBI,wBAAwB,QAGgE,CACxFC,OAAO,CAAE,MAAM,CACfC,aAAa,CAAE,KAAK,CACpBC,UAAU,CAAE,QAAQ,CACpBC,SAAS,CAAEJ,wBAAwB,CAAG,SAAS,CAAG,QACpD,CAAC,EAAC,CAEF,IAAMK,iBAAmF,CAAG,CAC1FC,IAAI,CAAE,0BAA0B,CAChCC,KAAK,CAAE,gCAAgC,CACvCC,OAAO,CAAE,gCACX,CAAC,CAED,IAAMC,QAAQ,CAAG,CACfC,MAAM,CAAE,OAAO,CACfC,MAAM,CAAE,QAAQ,CAChBC,KAAK,CAAE,OACT,CAAU,CAEV,IAAMC,QAAQ,CAAG,CACfH,MAAM,CAAE,OAAO,CACfC,MAAM,CAAE,QAAQ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putVisuals.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/explicit-function-return-type */\nimport React from 'react';\nimport type { ReactElement } from 'react';\nimport type { BaseInputProps } from './BaseInput';\nimport BaseBox from '~components/Box/BaseBox';\nimport { Text } from '~components/Typography';\nimport type { BaseBoxProps, SpacingValueType } from '~components/Box/BaseBox';\nimport type { IconColors } from '~components/Icons';\nimport { isValidAllowedChildren } from '~utils/isValidAllowedChildren';\nimport { throwBladeError } from '~utils/logger';\nimport { Tooltip } from '~components/Tooltip';\nimport { Box } from '~components/Box';\nimport { isReactNative } from '~utils';\n\ntype InputVisuals = Pick<\n BaseInputProps,\n | 'leadingIcon'\n | 'prefix'\n | 'trailingInteractionElement'\n | 'onTrailingInteractionElementClick'\n | 'leadingInteractionElement'\n | 'leadingDropDown'\n | 'trailingDropDown'\n | 'suffix'\n | 'trailingIcon'\n | 'isDisabled'\n | 'validationState'\n | 'size'\n | 'trailingButton'\n | 'showHintsAsTooltip'\n | 'errorText'\n | 'successText'\n> & {\n size: NonNullable<BaseInputProps['size']>;\n};\n\nconst getVisualContainerStyles = ({\n shouldStretchTrailingBox,\n}: {\n shouldStretchTrailingBox?: boolean;\n} = {}): Pick<BaseBoxProps, 'display' | 'flexDirection' | 'alignItems' | 'alignSelf'> => ({\n display: 'flex',\n flexDirection: 'row',\n alignItems: 'center',\n alignSelf: shouldStretchTrailingBox ? 'stretch' : 'center',\n});\n\nconst trailingIconColor: Record<NonNullable<InputVisuals['validationState']>, IconColors> = {\n none: 'surface.icon.gray.subtle',\n error: 'feedback.icon.negative.intense',\n success: 'feedback.icon.positive.intense',\n};\n\nconst iconSize = {\n xsmall: 'small',\n small: 'small',\n medium: 'medium',\n large: 'large',\n} as const;\n\nconst textSize = {\n xsmall: 'small',\n small: 'small',\n medium: 'medium',\n large: 'large',\n} as const;\n\nconst getPrefixStyles = ({\n hasLeadingIcon,\n hasPrefix,\n}: {\n hasLeadingIcon: boolean;\n hasPrefix: boolean;\n}): Pick<BaseBoxProps, 'paddingLeft'> => {\n if (hasPrefix && hasLeadingIcon) {\n return {\n paddingLeft: 'spacing.3',\n };\n }\n\n if (hasPrefix && !hasLeadingIcon) {\n return {\n paddingLeft: 'spacing.4',\n };\n }\n\n return {\n paddingLeft: 'spacing.0',\n };\n};\n\nconst getInteractionElementStyles = ({\n hasTrailingIcon,\n hasLeadingInteractionElement,\n hasLeadingDropDown,\n hasTrailingInteractionElement,\n hasSuffix,\n hasTrailingButton,\n hasTrailingDropDown,\n}: {\n hasTrailingIcon: boolean;\n hasLeadingInteractionElement?: boolean;\n hasLeadingDropDown?: boolean;\n hasTrailingInteractionElement?: boolean;\n hasSuffix: boolean;\n hasTrailingButton: boolean;\n hasTrailingDropDown?: boolean;\n}): SpacingValueType => {\n if (hasTrailingInteractionElement && (hasSuffix || hasTrailingIcon || hasTrailingButton)) {\n return 'spacing.2';\n }\n\n if (hasLeadingDropDown || hasTrailingDropDown) {\n return 'spacing.2';\n }\n\n if (hasTrailingInteractionElement && !hasSuffix && !hasTrailingIcon && !hasTrailingButton) {\n return 'spacing.4';\n }\n\n if (hasLeadingInteractionElement) {\n return 'spacing.3';\n }\n\n return 'spacing.0';\n};\n\nconst getSuffixStyles = ({\n hasTrailingIcon,\n hasSuffix,\n hasTrailingButton,\n}: {\n hasTrailingIcon: boolean;\n hasSuffix: boolean;\n hasTrailingButton: boolean;\n}): Pick<BaseBoxProps, 'paddingRight'> => {\n if (hasSuffix && (hasTrailingIcon || hasTrailingButton)) {\n return {\n paddingRight: 'spacing.3',\n };\n }\n\n if (hasSuffix && !hasTrailingIcon && !hasTrailingButton) {\n return {\n paddingRight: 'spacing.4',\n };\n }\n\n return {\n paddingRight: 'spacing.0',\n };\n};\n\nconst getTrailingIconStyles = ({\n hasTrailingIcon,\n hasTrailingButton,\n}: {\n hasTrailingIcon: boolean;\n hasTrailingButton: boolean;\n}): Pick<BaseBoxProps, 'paddingRight'> => {\n if (hasTrailingIcon && hasTrailingButton) {\n return {\n paddingRight: 'spacing.3',\n };\n }\n\n if (hasTrailingIcon && !hasTrailingButton) {\n return {\n paddingRight: 'spacing.4',\n };\n }\n\n return {\n paddingRight: 'spacing.0',\n };\n};\n\nexport const getInputVisualsToBeRendered = ({\n leadingIcon,\n prefix,\n trailingInteractionElement,\n leadingInteractionElement,\n suffix,\n trailingIcon,\n trailingButton,\n leadingDropDown,\n trailingDropDown,\n}: InputVisuals) => ({\n hasLeadingIcon: Boolean(leadingIcon),\n hasPrefix: Boolean(prefix),\n hasTrailingInteractionElement: Boolean(trailingInteractionElement),\n hasLeadingInteractionElement: Boolean(leadingInteractionElement),\n hasSuffix: Boolean(suffix),\n hasTrailingIcon: Boolean(trailingIcon),\n hasTrailingButton: Boolean(trailingButton),\n hasLeadingDropDown: Boolean(leadingDropDown),\n hasTrailingDropDown: Boolean(trailingDropDown),\n});\n\nconst getTooltipContent = ({\n validationState,\n errorText,\n successText,\n}: {\n validationState: BaseInputProps['validationState'];\n errorText: BaseInputProps['errorText'];\n successText: BaseInputProps['errorText'];\n}): string => {\n if (validationState === 'error' && errorText) {\n return errorText;\n }\n\n if (validationState === 'success' && successText) {\n return successText;\n }\n\n return '';\n};\n\nconst ValidationIconTooltip = ({\n children,\n validationState,\n errorText,\n successText,\n showHintsAsTooltip,\n}: {\n children: ReactElement;\n validationState: BaseInputProps['validationState'];\n errorText: BaseInputProps['errorText'];\n successText: BaseInputProps['errorText'];\n showHintsAsTooltip: BaseInputProps['showHintsAsTooltip'];\n}) => {\n if (\n (showHintsAsTooltip && validationState === 'error' && errorText) ||\n (validationState === 'success' && successText)\n ) {\n return (\n <Tooltip content={getTooltipContent({ validationState, errorText, successText })}>\n <Box display=\"flex\" justifyContent=\"center\" alignItems=\"center\">\n {children}\n </Box>\n </Tooltip>\n );\n }\n\n return children;\n};\n\nexport const BaseInputVisuals = ({\n leadingIcon: LeadingIcon,\n prefix,\n trailingInteractionElement,\n onTrailingInteractionElementClick,\n leadingDropDown,\n trailingDropDown,\n leadingInteractionElement,\n suffix,\n trailingIcon: TrailingIcon,\n isDisabled,\n validationState = 'none',\n size,\n showHintsAsTooltip,\n errorText,\n successText,\n trailingButton: TrailingButton,\n}: InputVisuals): ReactElement | null => {\n const {\n hasLeadingIcon,\n hasPrefix,\n hasSuffix,\n hasTrailingInteractionElement,\n hasLeadingInteractionElement,\n hasTrailingIcon,\n hasTrailingButton,\n hasLeadingDropDown,\n hasTrailingDropDown,\n } = getInputVisualsToBeRendered({\n leadingIcon: LeadingIcon,\n prefix,\n leadingInteractionElement,\n trailingInteractionElement,\n suffix,\n trailingIcon: TrailingIcon,\n trailingButton: TrailingButton,\n leadingDropDown,\n trailingDropDown,\n size,\n });\n\n const hasLeadingVisuals =\n hasLeadingInteractionElement || hasLeadingIcon || hasPrefix || hasLeadingDropDown;\n const hasTrailingVisuals =\n hasTrailingInteractionElement ||\n hasSuffix ||\n hasTrailingIcon ||\n hasTrailingButton ||\n hasTrailingDropDown;\n\n if (__DEV__) {\n if (hasTrailingButton && !isValidAllowedChildren(TrailingButton, 'Link')) {\n throwBladeError({\n message: 'trailingButton must be a valid Blade Link component',\n moduleName: 'BaseInput',\n });\n }\n }\n\n if (hasLeadingVisuals) {\n return (\n <BaseBox {...getVisualContainerStyles()}>\n {hasLeadingInteractionElement ? (\n <BaseBox\n paddingLeft={getInteractionElementStyles({\n hasTrailingIcon,\n hasLeadingInteractionElement,\n hasSuffix,\n hasTrailingButton,\n })}\n display=\"flex\"\n alignItems=\"stretch\"\n alignSelf=\"stretch\"\n >\n {leadingInteractionElement}\n </BaseBox>\n ) : null}\n {LeadingIcon ? (\n <BaseBox paddingLeft=\"spacing.4\" display=\"flex\">\n <LeadingIcon\n size={iconSize[size]}\n color={isDisabled ? 'surface.icon.gray.disabled' : 'surface.icon.gray.muted'}\n />\n </BaseBox>\n ) : null}\n {hasPrefix ? (\n <BaseBox {...getPrefixStyles({ hasLeadingIcon, hasPrefix })}>\n <Text\n size={textSize[size]}\n variant=\"body\"\n weight=\"regular\"\n color={isDisabled ? 'surface.text.gray.disabled' : 'surface.text.gray.muted'}\n >\n {prefix}\n </Text>\n </BaseBox>\n ) : null}\n {leadingDropDown ? (\n <BaseBox paddingLeft=\"spacing.2\" display=\"flex\">\n {leadingDropDown}\n </BaseBox>\n ) : null}\n </BaseBox>\n );\n }\n\n if (hasTrailingVisuals) {\n return (\n <BaseBox\n {...getVisualContainerStyles({\n shouldStretchTrailingBox:\n hasTrailingInteractionElement && Boolean(onTrailingInteractionElementClick),\n })}\n >\n {hasTrailingInteractionElement ? (\n <BaseBox\n {...getVisualContainerStyles({\n shouldStretchTrailingBox:\n hasTrailingInteractionElement && Boolean(onTrailingInteractionElementClick),\n })}\n >\n <BaseBox\n paddingRight={getInteractionElementStyles({\n hasTrailingIcon,\n hasTrailingInteractionElement,\n hasSuffix,\n hasTrailingButton,\n hasTrailingDropDown,\n })}\n display=\"flex\"\n alignItems=\"stretch\"\n alignSelf=\"stretch\"\n {...(!isReactNative() && { onClick: onTrailingInteractionElementClick })}\n >\n {trailingInteractionElement}\n </BaseBox>\n </BaseBox>\n ) : null}\n {hasSuffix ? (\n <BaseBox {...getSuffixStyles({ hasTrailingIcon, hasSuffix, hasTrailingButton })}>\n <Text\n size={textSize[size]}\n variant=\"body\"\n weight=\"regular\"\n color={isDisabled ? 'surface.text.gray.disabled' : 'surface.text.gray.subtle'}\n >\n {suffix}\n </Text>\n </BaseBox>\n ) : null}\n {TrailingIcon ? (\n <BaseBox\n display=\"flex\"\n justifyContent=\"center\"\n alignItems=\"center\"\n {...getTrailingIconStyles({ hasTrailingIcon, hasTrailingButton })}\n >\n <ValidationIconTooltip\n showHintsAsTooltip={showHintsAsTooltip}\n errorText={errorText}\n successText={successText}\n validationState={validationState}\n >\n <TrailingIcon\n size={iconSize[size]}\n color={\n isDisabled ? 'interactive.icon.gray.disabled' : trailingIconColor[validationState]\n }\n />\n </ValidationIconTooltip>\n </BaseBox>\n ) : null}\n {TrailingButton ? (\n <BaseBox paddingRight=\"spacing.4\" display=\"flex\">\n {React.cloneElement(TrailingButton, {\n size,\n variant: 'button',\n isDisabled,\n })}\n </BaseBox>\n ) : null}\n {hasTrailingDropDown ? (\n <BaseBox paddingRight=\"spacing.2\" display=\"flex\">\n {trailingDropDown}\n </BaseBox>\n ) : null}\n </BaseBox>\n );\n }\n\n return null;\n};\n"],"names":["getVisualContainerStyles","_ref","arguments","length","undefined","shouldStretchTrailingBox","display","flexDirection","alignItems","alignSelf","trailingIconColor","none","error","success","iconSize","xsmall","small","medium","large","textSize","getPrefixStyles","_ref2","hasLeadingIcon","hasPrefix","paddingLeft","getInteractionElementStyles","_ref3","hasTrailingIcon","hasLeadingInteractionElement","hasLeadingDropDown","hasTrailingInteractionElement","hasSuffix","hasTrailingButton","hasTrailingDropDown","getSuffixStyles","_ref4","paddingRight","getTrailingIconStyles","_ref5","getInputVisualsToBeRendered","_ref6","leadingIcon","prefix","trailingInteractionElement","leadingInteractionElement","suffix","trailingIcon","trailingButton","leadingDropDown","trailingDropDown","Boolean","getTooltipContent","_ref7","validationState","errorText","successText","ValidationIconTooltip","_ref8","children","showHintsAsTooltip","_jsx","Tooltip","content","Box","justifyContent","BaseInputVisuals","_ref9","LeadingIcon","onTrailingInteractionElementClick","TrailingIcon","isDisabled","_ref9$validationState","size","TrailingButton","_getInputVisualsToBeR","hasLeadingVisuals","hasTrailingVisuals","__DEV__","isValidAllowedChildren","throwBladeError","message","moduleName","_jsxs","BaseBox","Object","assign","color","Text","variant","weight","isReactNative","onClick","React","cloneElement"],"mappings":";;;;;;;;;;;;;;;;;AAoCA,IAAMA,wBAAwB,CAAG,SAA3BA,wBAAwBA,EAAA,CAAA,IAAAC,IAAA,CAAAC,SAAA,CAAAC,MAAA,IAAAD,SAAA,CAAA,CAAA,CAAA,GAAAE,SAAA,CAAAF,SAAA,IAI1B,EAAE,CAHJG,wBAAwB,CAAAJ,IAAA,CAAxBI,wBAAwB,QAGgE,CACxFC,OAAO,CAAE,MAAM,CACfC,aAAa,CAAE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,QAAA,CAC7CkC,cAAK,CAACC,YAAY,CAACpB,cAAc,CAAE,CAClCD,IAAI,CAAJA,IAAI,CACJgB,OAAO,CAAE,QAAQ,CACjBlB,UAAU,CAAVA,UACF,CAAC,CAAC,CACK,CAAC,CACR,IAAI,CACPrC,mBAAmB,CAClB2B,GAAA,CAACuB,OAAO,EAAC/C,YAAY,CAAC,WAAW,CAAC9B,OAAO,CAAC,MAAM,CAAAoD,QAAA,CAC7CT,gBAAgB,CACV,CAAC,CACR,IAAI,CACD,CAAA,CAAA,CAAC,CAEd,CAEA,OAAW,IAAA,CACb;;;;"}
|
|
@@ -2,7 +2,7 @@ import '../../../tokens/global/typography.js';
|
|
|
2
2
|
import '../../../tokens/global/motion.js';
|
|
3
3
|
import { size } from '../../../tokens/global/size.js';
|
|
4
4
|
|
|
5
|
-
var BASEINPUT_MAX_ROWS=4;var baseInputHeight={xsmall:size['26'],medium:size['36'],large:size['48']};var baseInputWrapperMaxHeight={xsmall:baseInputHeight.xsmall*BASEINPUT_MAX_ROWS,medium:baseInputHeight.medium*BASEINPUT_MAX_ROWS,large:baseInputHeight.large*BASEINPUT_MAX_ROWS};var baseInputBorderColor={default:'interactive.border.gray.default',hovered:'interactive.border.gray.highlighted',focused:'interactive.border.primary.default',disabled:'interactive.border.gray.disabled',error:'interactive.border.negative.default',success:'interactive.border.positive.default'};var baseInputBackgroundColor={default:'surface.background.gray.intense',hovered:'surface.background.gray.moderate',focused:'surface.background.gray.moderate',disabled:'surface.background.gray.subtle',error:'surface.background.gray.intense',success:'surface.background.gray.intense'};var baseInputBorderlessBackgroundColor={default:'transparent',hovered:'surface.background.gray.moderate',focused:'surface.background.gray.moderate',disabled:'surface.background.gray.intense',error:'feedback.background.negative.subtle',success:'feedback.background.positive.subtle'};var baseInputBorderWidth={default:'thin',hovered:'thin',disabled:'thin',focused:'thick',error:'thick',success:'thick'};var baseInputBorderBackgroundMotion={enter:{duration:'xgentle',easing:'emphasized'},exit:{duration:'gentle',easing:'standard'}};var baseInputPaddingTokens={top:{xsmall:2,medium:3,large:4},bottom:{xsmall:2,medium:3,large:4},left:{xsmall:3,medium:4,large:4},right:{xsmall:3,medium:4,large:4}};var formHintLeftLabelMarginLeft={xsmall:136,medium:136,large:192};var baseInputCounterInputPaddingTokens={top:{xsmall:2,medium:2,large:2},bottom:{xsmall:2,medium:2,large:2},left:{xsmall:2,medium:2,large:2},right:{xsmall:2,medium:2,large:2}};
|
|
5
|
+
var BASEINPUT_MAX_ROWS=4;var baseInputHeight={xsmall:size['26'],small:size['30'],medium:size['36'],large:size['48']};var baseInputWrapperMaxHeight={xsmall:baseInputHeight.xsmall*BASEINPUT_MAX_ROWS,small:baseInputHeight.small*BASEINPUT_MAX_ROWS,medium:baseInputHeight.medium*BASEINPUT_MAX_ROWS,large:baseInputHeight.large*BASEINPUT_MAX_ROWS};var baseInputBorderColor={default:'interactive.border.gray.default',hovered:'interactive.border.gray.highlighted',focused:'interactive.border.primary.default',disabled:'interactive.border.gray.disabled',error:'interactive.border.negative.default',success:'interactive.border.positive.default'};var baseInputBackgroundColor={default:'surface.background.gray.intense',hovered:'surface.background.gray.moderate',focused:'surface.background.gray.moderate',disabled:'surface.background.gray.subtle',error:'surface.background.gray.intense',success:'surface.background.gray.intense'};var baseInputBorderlessBackgroundColor={default:'transparent',hovered:'surface.background.gray.moderate',focused:'surface.background.gray.moderate',disabled:'surface.background.gray.intense',error:'feedback.background.negative.subtle',success:'feedback.background.positive.subtle'};var baseInputBorderWidth={default:'thin',hovered:'thin',disabled:'thin',focused:'thick',error:'thick',success:'thick'};var baseInputBorderBackgroundMotion={enter:{duration:'xgentle',easing:'emphasized'},exit:{duration:'gentle',easing:'standard'}};var baseInputPaddingTokens={top:{xsmall:2,small:2,medium:3,large:4},bottom:{xsmall:2,small:2,medium:3,large:4},left:{xsmall:3,small:3,medium:4,large:4},right:{xsmall:3,small:3,medium:4,large:4}};var formHintLeftLabelMarginLeft={xsmall:136,small:136,medium:136,large:192};var baseInputCounterInputPaddingTokens={top:{xsmall:2,small:2,medium:2,large:2},bottom:{xsmall:2,small:2,medium:2,large:2},left:{xsmall:2,small:2,medium:2,large:2},right:{xsmall:2,small:2,medium:2,large:2}};
|
|
6
6
|
|
|
7
7
|
export { BASEINPUT_MAX_ROWS, baseInputBackgroundColor, baseInputBorderBackgroundMotion, baseInputBorderColor, baseInputBorderWidth, baseInputBorderlessBackgroundColor, baseInputCounterInputPaddingTokens, baseInputHeight, baseInputPaddingTokens, baseInputWrapperMaxHeight, formHintLeftLabelMarginLeft };
|
|
8
8
|
//# sourceMappingURL=baseInputTokens.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"baseInputTokens.js","sources":["../../../../../../src/components/Input/BaseInput/baseInputTokens.ts"],"sourcesContent":["import type { BaseInputProps } from './BaseInput';\nimport { size, spacing } from '~tokens/global';\n\nexport const BASEINPUT_MAX_ROWS = 4;\n\nexport const TAG_HEIGHT = size['20'];\nexport const TAG_GAP = spacing['3'];\n\n/**\n * 36px\n */\nexport const baseInputHeight: Record<\n NonNullable<BaseInputProps['size']>,\n typeof size[keyof typeof size]\n> = {\n xsmall: size['26'],\n medium: size['36'],\n large: size['48'],\n};\n\n/**\n * medium - 144px (36px height * 4 rows)\n * large - 192px (48px height * 4 rows)\n */\n// we don't want exact number but rough number to be able to animate correctly in height.\nexport const baseInputWrapperMaxHeight = {\n xsmall: baseInputHeight.xsmall * BASEINPUT_MAX_ROWS,\n medium: baseInputHeight.medium * BASEINPUT_MAX_ROWS,\n large: baseInputHeight.large * BASEINPUT_MAX_ROWS,\n} as const;\n\nexport const baseInputBorderColor = {\n default: 'interactive.border.gray.default',\n hovered: 'interactive.border.gray.highlighted',\n focused: 'interactive.border.primary.default',\n disabled: 'interactive.border.gray.disabled',\n error: 'interactive.border.negative.default',\n success: 'interactive.border.positive.default',\n} as const;\n\nexport const baseInputBackgroundColor = {\n default: 'surface.background.gray.intense',\n hovered: 'surface.background.gray.moderate',\n focused: 'surface.background.gray.moderate',\n disabled: 'surface.background.gray.subtle',\n error: 'surface.background.gray.intense',\n success: 'surface.background.gray.intense',\n} as const;\n\nexport const baseInputBorderlessBackgroundColor = {\n default: 'transparent',\n hovered: 'surface.background.gray.moderate',\n focused: 'surface.background.gray.moderate',\n disabled: 'surface.background.gray.intense',\n error: 'feedback.background.negative.subtle',\n success: 'feedback.background.positive.subtle',\n} as const;\n\nexport const baseInputBorderWidth = {\n default: 'thin',\n hovered: 'thin',\n disabled: 'thin',\n focused: 'thick',\n error: 'thick',\n success: 'thick',\n} as const;\n\nexport const baseInputBorderBackgroundMotion = {\n enter: { duration: 'xgentle', easing: 'emphasized' },\n exit: { duration: 'gentle', easing: 'standard' },\n} as const;\n\nexport const baseInputPaddingTokens = {\n top: {\n xsmall: 2,\n medium: 3,\n large: 4,\n },\n bottom: {\n xsmall: 2,\n medium: 3,\n large: 4,\n },\n left: {\n xsmall: 3,\n medium: 4,\n large: 4,\n },\n right: {\n xsmall: 3,\n medium: 4,\n large: 4,\n },\n} as const;\n\n/* the magic number 192 is basically max-width of label \ni.e 176 and then right margin \ni.e 16 which is the spacing between label and input field */\nexport const formHintLeftLabelMarginLeft = {\n xsmall: 136,\n medium: 136,\n large: 192,\n} as const;\n\nexport const baseInputCounterInputPaddingTokens = {\n top: {\n xsmall: 2,\n medium: 2,\n large: 2,\n },\n bottom: {\n xsmall: 2,\n medium: 2,\n large: 2,\n },\n left: {\n xsmall: 2,\n medium: 2,\n large: 2,\n },\n right: {\n xsmall: 2,\n medium: 2,\n large: 2,\n },\n} as const;\n"],"names":["BASEINPUT_MAX_ROWS","baseInputHeight","xsmall","size","medium","large","baseInputWrapperMaxHeight","baseInputBorderColor","default","hovered","focused","disabled","error","success","baseInputBackgroundColor","baseInputBorderlessBackgroundColor","baseInputBorderWidth","baseInputBorderBackgroundMotion","enter","duration","easing","exit","baseInputPaddingTokens","top","bottom","left","right","formHintLeftLabelMarginLeft","baseInputCounterInputPaddingTokens"],"mappings":";;;;AAGa,IAAAA,kBAAkB,CAAG,EAQrB,IAAAC,eAGZ,CAAG,CACFC,MAAM,CAAEC,IAAI,CAAC,IAAI,CAAC,CAClBC,
|
|
1
|
+
{"version":3,"file":"baseInputTokens.js","sources":["../../../../../../src/components/Input/BaseInput/baseInputTokens.ts"],"sourcesContent":["import type { BaseInputProps } from './BaseInput';\nimport { size, spacing } from '~tokens/global';\n\nexport const BASEINPUT_MAX_ROWS = 4;\n\nexport const TAG_HEIGHT = size['20'];\nexport const TAG_GAP = spacing['3'];\n\n/**\n * 36px\n */\nexport const baseInputHeight: Record<\n NonNullable<BaseInputProps['size']>,\n typeof size[keyof typeof size]\n> = {\n xsmall: size['26'],\n small: size['30'],\n medium: size['36'],\n large: size['48'],\n};\n\n/**\n * medium - 144px (36px height * 4 rows)\n * large - 192px (48px height * 4 rows)\n */\n// we don't want exact number but rough number to be able to animate correctly in height.\nexport const baseInputWrapperMaxHeight = {\n xsmall: baseInputHeight.xsmall * BASEINPUT_MAX_ROWS,\n small: baseInputHeight.small * BASEINPUT_MAX_ROWS,\n medium: baseInputHeight.medium * BASEINPUT_MAX_ROWS,\n large: baseInputHeight.large * BASEINPUT_MAX_ROWS,\n} as const;\n\nexport const baseInputBorderColor = {\n default: 'interactive.border.gray.default',\n hovered: 'interactive.border.gray.highlighted',\n focused: 'interactive.border.primary.default',\n disabled: 'interactive.border.gray.disabled',\n error: 'interactive.border.negative.default',\n success: 'interactive.border.positive.default',\n} as const;\n\nexport const baseInputBackgroundColor = {\n default: 'surface.background.gray.intense',\n hovered: 'surface.background.gray.moderate',\n focused: 'surface.background.gray.moderate',\n disabled: 'surface.background.gray.subtle',\n error: 'surface.background.gray.intense',\n success: 'surface.background.gray.intense',\n} as const;\n\nexport const baseInputBorderlessBackgroundColor = {\n default: 'transparent',\n hovered: 'surface.background.gray.moderate',\n focused: 'surface.background.gray.moderate',\n disabled: 'surface.background.gray.intense',\n error: 'feedback.background.negative.subtle',\n success: 'feedback.background.positive.subtle',\n} as const;\n\nexport const baseInputBorderWidth = {\n default: 'thin',\n hovered: 'thin',\n disabled: 'thin',\n focused: 'thick',\n error: 'thick',\n success: 'thick',\n} as const;\n\nexport const baseInputBorderBackgroundMotion = {\n enter: { duration: 'xgentle', easing: 'emphasized' },\n exit: { duration: 'gentle', easing: 'standard' },\n} as const;\n\nexport const baseInputPaddingTokens = {\n top: {\n xsmall: 2,\n small: 2,\n medium: 3,\n large: 4,\n },\n bottom: {\n xsmall: 2,\n small: 2,\n medium: 3,\n large: 4,\n },\n left: {\n xsmall: 3,\n small: 3,\n medium: 4,\n large: 4,\n },\n right: {\n xsmall: 3,\n small: 3,\n medium: 4,\n large: 4,\n },\n} as const;\n\n/* the magic number 192 is basically max-width of label \ni.e 176 and then right margin \ni.e 16 which is the spacing between label and input field */\nexport const formHintLeftLabelMarginLeft = {\n xsmall: 136,\n small: 136,\n medium: 136,\n large: 192,\n} as const;\n\nexport const baseInputCounterInputPaddingTokens = {\n top: {\n xsmall: 2,\n small: 2,\n medium: 2,\n large: 2,\n },\n bottom: {\n xsmall: 2,\n small: 2,\n medium: 2,\n large: 2,\n },\n left: {\n xsmall: 2,\n small: 2,\n medium: 2,\n large: 2,\n },\n right: {\n xsmall: 2,\n small: 2,\n medium: 2,\n large: 2,\n },\n} as const;\n"],"names":["BASEINPUT_MAX_ROWS","baseInputHeight","xsmall","size","small","medium","large","baseInputWrapperMaxHeight","baseInputBorderColor","default","hovered","focused","disabled","error","success","baseInputBackgroundColor","baseInputBorderlessBackgroundColor","baseInputBorderWidth","baseInputBorderBackgroundMotion","enter","duration","easing","exit","baseInputPaddingTokens","top","bottom","left","right","formHintLeftLabelMarginLeft","baseInputCounterInputPaddingTokens"],"mappings":";;;;AAGa,IAAAA,kBAAkB,CAAG,EAQrB,IAAAC,eAGZ,CAAG,CACFC,MAAM,CAAEC,IAAI,CAAC,IAAI,CAAC,CAClBC,KAAK,CAAED,IAAI,CAAC,IAAI,CAAC,CACjBE,MAAM,CAAEF,IAAI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card.js';
|
|
|
470
470
|
import '../Card/CardHeader.js';
|
|
471
471
|
import '../Card/CardFooter.js';
|
|
472
472
|
|
|
473
|
-
var _excluded=["value","title","trailing","selectionType","isSelected"],_excluded2=["title","value","trailing","testID"];var QuickFilterContent=function QuickFilterContent(_ref){var value=_ref.value,title=_ref.title,trailing=_ref.trailing,_ref$selectionType=_ref.selectionType,selectionType=_ref$selectionType===void 0?'single':_ref$selectionType,_ref$isSelected=_ref.isSelected,isSelected=_ref$isSelected===void 0?false:_ref$isSelected,rest=_objectWithoutProperties(_ref,_excluded);return jsxs(BaseBox,{display:"flex",flexDirection:"row",gap:"spacing.3",width:"fit-content",justifyContent:"center",alignItems:"center",paddingY:"spacing.3",paddingLeft:"spacing.3",paddingRight:"spacing.4",children:[jsxs(Box,{display:"flex",flexDirection:"row",gap:"spacing.2",justifyContent:"center",alignItems:"center",children:[selectionType==='single'?jsx(Radio,Object.assign({value:value},makeAnalyticsAttribute(rest))):jsx(Checkbox,Object.assign({value:value},makeAnalyticsAttribute(rest))),jsx(Text,{variant:"body",size:"medium",color:isSelected?'interactive.text.primary.subtle':'interactive.text.gray.subtle',weight:"medium",children:title})]}),trailing]});};var QuickFilter=forwardRef(function(_ref2,ref){var title=_ref2.title,value=_ref2.value,trailing=_ref2.trailing,testID=_ref2.testID,rest=_objectWithoutProperties(_ref2,_excluded2);var _useQuickFilterGroupC=useQuickFilterGroupContext(),selectedQuickFilters=_useQuickFilterGroupC.selectedQuickFilters,selectionType=_useQuickFilterGroupC.selectionType;var isQuickFilterSelected=selectedQuickFilters.includes(value);return jsx(Card,Object.assign({padding:"spacing.0",as:"label",accessibilityLabel:title,borderRadius:"medium",elevation:"none",isSelected:isQuickFilterSelected,ref:ref,marginRight:"spacing.1"},makeAnalyticsAttribute(rest),metaAttribute({testID:testID}),{children:jsx(CardBody,{children:jsx(QuickFilterContent,Object.assign({value:value,title:title,trailing:trailing,selectionType:selectionType,isSelected:isQuickFilterSelected},rest))})}));});
|
|
473
|
+
var _excluded=["value","title","trailing","selectionType","isSelected"],_excluded2=["title","value","trailing","testID"];var QuickFilterContent=function QuickFilterContent(_ref){var value=_ref.value,title=_ref.title,trailing=_ref.trailing,_ref$selectionType=_ref.selectionType,selectionType=_ref$selectionType===void 0?'single':_ref$selectionType,_ref$isSelected=_ref.isSelected,isSelected=_ref$isSelected===void 0?false:_ref$isSelected,rest=_objectWithoutProperties(_ref,_excluded);return jsxs(BaseBox,{display:"flex",flexDirection:"row",gap:"spacing.3",width:"fit-content",justifyContent:"center",alignItems:"center",paddingY:"spacing.3",paddingLeft:"spacing.3",paddingRight:"spacing.4",children:[jsxs(Box,{display:"flex",flexDirection:"row",gap:"spacing.2",justifyContent:"center",alignItems:"center",children:[selectionType==='single'?jsx(Radio,Object.assign({value:value,_hideRadioIcon:true},makeAnalyticsAttribute(rest))):jsx(Checkbox,Object.assign({value:value},makeAnalyticsAttribute(rest))),jsx(Text,{variant:"body",size:"medium",color:isSelected?'interactive.text.primary.subtle':'interactive.text.gray.subtle',weight:"medium",children:title})]}),trailing]});};var QuickFilter=forwardRef(function(_ref2,ref){var title=_ref2.title,value=_ref2.value,trailing=_ref2.trailing,testID=_ref2.testID,rest=_objectWithoutProperties(_ref2,_excluded2);var _useQuickFilterGroupC=useQuickFilterGroupContext(),selectedQuickFilters=_useQuickFilterGroupC.selectedQuickFilters,selectionType=_useQuickFilterGroupC.selectionType;var isQuickFilterSelected=selectedQuickFilters.includes(value);return jsx(Card,Object.assign({padding:"spacing.0",as:"label",accessibilityLabel:title,borderRadius:"medium",elevation:"none",isSelected:isQuickFilterSelected,ref:ref,marginRight:"spacing.1"},makeAnalyticsAttribute(rest),metaAttribute({testID:testID}),{children:jsx(CardBody,{children:jsx(QuickFilterContent,Object.assign({value:value,title:title,trailing:trailing,selectionType:selectionType,isSelected:isQuickFilterSelected},rest))})}));});
|
|
474
474
|
|
|
475
475
|
export { QuickFilter };
|
|
476
476
|
//# sourceMappingURL=QuickFilter.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"QuickFilter.js","sources":["../../../../../src/components/QuickFilters/QuickFilter.tsx"],"sourcesContent":["import React, { forwardRef } from 'react';\nimport type { QuickFilterProps, QuickFilterContentProps } from './types';\nimport { useQuickFilterGroupContext } from './QuickFilterGroup';\nimport { Card, CardBody } from '~components/Card';\nimport { Box } from '~components/Box';\nimport { Text } from '~components/Typography';\nimport { Radio } from '~components/Radio';\nimport { Checkbox } from '~components/Checkbox';\nimport { makeAnalyticsAttribute } from '~utils/makeAnalyticsAttribute';\nimport { metaAttribute } from '~utils/metaAttribute';\nimport BaseBox from '~components/Box/BaseBox';\nimport type { BladeElementRef } from '~utils/types';\n\nconst QuickFilterContent = ({\n value,\n title,\n trailing,\n selectionType = 'single',\n isSelected = false,\n ...rest\n}: QuickFilterContentProps): React.ReactElement => {\n return (\n <BaseBox\n display=\"flex\"\n flexDirection=\"row\"\n gap=\"spacing.3\"\n width=\"fit-content\"\n justifyContent=\"center\"\n alignItems=\"center\"\n paddingY=\"spacing.3\"\n paddingLeft=\"spacing.3\"\n paddingRight=\"spacing.4\"\n >\n <Box\n display=\"flex\"\n flexDirection=\"row\"\n gap=\"spacing.2\"\n justifyContent=\"center\"\n alignItems=\"center\"\n >\n {selectionType === 'single' ? (\n <Radio value={value} {...makeAnalyticsAttribute(rest)} />\n ) : (\n <Checkbox value={value} {...makeAnalyticsAttribute(rest)} />\n )}\n <Text\n variant=\"body\"\n size=\"medium\"\n color={isSelected ? 'interactive.text.primary.subtle' : 'interactive.text.gray.subtle'}\n weight=\"medium\"\n >\n {title}\n </Text>\n </Box>\n\n {trailing}\n </BaseBox>\n );\n};\n\nconst QuickFilter = forwardRef<BladeElementRef, QuickFilterProps>(\n ({ title, value, trailing, testID, ...rest }, ref): React.ReactElement => {\n const { selectedQuickFilters, selectionType } = useQuickFilterGroupContext();\n\n const isQuickFilterSelected = selectedQuickFilters.includes(value);\n return (\n <Card\n padding=\"spacing.0\"\n as=\"label\"\n accessibilityLabel={title}\n borderRadius=\"medium\"\n elevation=\"none\"\n isSelected={isQuickFilterSelected}\n ref={ref}\n // Add margin to accommodate the box shadow that appears when selected, preventing visual cutoff\n marginRight=\"spacing.1\"\n {...makeAnalyticsAttribute(rest)}\n {...metaAttribute({ testID })}\n >\n <CardBody>\n <QuickFilterContent\n value={value}\n title={title}\n trailing={trailing}\n selectionType={selectionType}\n isSelected={isQuickFilterSelected}\n {...rest}\n />\n </CardBody>\n </Card>\n );\n },\n);\nexport { QuickFilter };\n"],"names":["QuickFilterContent","_ref","value","title","trailing","_ref$selectionType","selectionType","_ref$isSelected","isSelected","rest","_objectWithoutProperties","_excluded","_jsxs","BaseBox","display","flexDirection","gap","width","justifyContent","alignItems","paddingY","paddingLeft","paddingRight","children","Box","_jsx","Radio","Object","assign","makeAnalyticsAttribute","Checkbox","Text","variant","size","color","weight","QuickFilter","forwardRef","_ref2","ref","testID","_excluded2","_useQuickFilterGroupC","useQuickFilterGroupContext","selectedQuickFilters","isQuickFilterSelected","includes","Card","padding","as","accessibilityLabel","borderRadius","elevation","marginRight","metaAttribute","CardBody"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;yHAaA,IAAMA,kBAAkB,CAAG,SAArBA,kBAAkBA,CAAAC,IAAA,CAO2B,CANjD,IAAAC,KAAK,CAAAD,IAAA,CAALC,KAAK,CACLC,KAAK,CAAAF,IAAA,CAALE,KAAK,CACLC,QAAQ,CAAAH,IAAA,CAARG,QAAQ,CAAAC,kBAAA,CAAAJ,IAAA,CACRK,aAAa,CAAbA,aAAa,CAAAD,kBAAA,GAAA,KAAA,CAAA,CAAG,QAAQ,CAAAA,kBAAA,CAAAE,eAAA,CAAAN,IAAA,CACxBO,UAAU,CAAVA,UAAU,CAAAD,eAAA,GAAA,KAAA,CAAA,CAAG,KAAK,CAAAA,eAAA,CACfE,IAAI,CAAAC,wBAAA,CAAAT,IAAA,CAAAU,SAAA,CAAA,CAEP,OACEC,IAAA,CAACC,OAAO,
|
|
1
|
+
{"version":3,"file":"QuickFilter.js","sources":["../../../../../src/components/QuickFilters/QuickFilter.tsx"],"sourcesContent":["import React, { forwardRef } from 'react';\nimport type { QuickFilterProps, QuickFilterContentProps } from './types';\nimport { useQuickFilterGroupContext } from './QuickFilterGroup';\nimport { Card, CardBody } from '~components/Card';\nimport { Box } from '~components/Box';\nimport { Text } from '~components/Typography';\nimport { Radio } from '~components/Radio';\nimport { Checkbox } from '~components/Checkbox';\nimport { makeAnalyticsAttribute } from '~utils/makeAnalyticsAttribute';\nimport { metaAttribute } from '~utils/metaAttribute';\nimport BaseBox from '~components/Box/BaseBox';\nimport type { BladeElementRef } from '~utils/types';\n\nconst QuickFilterContent = ({\n value,\n title,\n trailing,\n selectionType = 'single',\n isSelected = false,\n ...rest\n}: QuickFilterContentProps): React.ReactElement => {\n return (\n <BaseBox\n display=\"flex\"\n flexDirection=\"row\"\n gap=\"spacing.3\"\n width=\"fit-content\"\n justifyContent=\"center\"\n alignItems=\"center\"\n paddingY=\"spacing.3\"\n paddingLeft=\"spacing.3\"\n paddingRight=\"spacing.4\"\n >\n <Box\n display=\"flex\"\n flexDirection=\"row\"\n gap=\"spacing.2\"\n justifyContent=\"center\"\n alignItems=\"center\"\n >\n {selectionType === 'single' ? (\n <Radio value={value} _hideRadioIcon {...makeAnalyticsAttribute(rest)} />\n ) : (\n <Checkbox value={value} {...makeAnalyticsAttribute(rest)} />\n )}\n <Text\n variant=\"body\"\n size=\"medium\"\n color={isSelected ? 'interactive.text.primary.subtle' : 'interactive.text.gray.subtle'}\n weight=\"medium\"\n >\n {title}\n </Text>\n </Box>\n\n {trailing}\n </BaseBox>\n );\n};\n\nconst QuickFilter = forwardRef<BladeElementRef, QuickFilterProps>(\n ({ title, value, trailing, testID, ...rest }, ref): React.ReactElement => {\n const { selectedQuickFilters, selectionType } = useQuickFilterGroupContext();\n\n const isQuickFilterSelected = selectedQuickFilters.includes(value);\n return (\n <Card\n padding=\"spacing.0\"\n as=\"label\"\n accessibilityLabel={title}\n borderRadius=\"medium\"\n elevation=\"none\"\n isSelected={isQuickFilterSelected}\n ref={ref}\n // Add margin to accommodate the box shadow that appears when selected, preventing visual cutoff\n marginRight=\"spacing.1\"\n {...makeAnalyticsAttribute(rest)}\n {...metaAttribute({ testID })}\n >\n <CardBody>\n <QuickFilterContent\n value={value}\n title={title}\n trailing={trailing}\n selectionType={selectionType}\n isSelected={isQuickFilterSelected}\n {...rest}\n />\n </CardBody>\n </Card>\n );\n },\n);\nexport { QuickFilter };\n"],"names":["QuickFilterContent","_ref","value","title","trailing","_ref$selectionType","selectionType","_ref$isSelected","isSelected","rest","_objectWithoutProperties","_excluded","_jsxs","BaseBox","display","flexDirection","gap","width","justifyContent","alignItems","paddingY","paddingLeft","paddingRight","children","Box","_jsx","Radio","Object","assign","_hideRadioIcon","makeAnalyticsAttribute","Checkbox","Text","variant","size","color","weight","QuickFilter","forwardRef","_ref2","ref","testID","_excluded2","_useQuickFilterGroupC","useQuickFilterGroupContext","selectedQuickFilters","isQuickFilterSelected","includes","Card","padding","as","accessibilityLabel","borderRadius","elevation","marginRight","metaAttribute","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AAoB,CAAAF,qBAAA,CAApBE,oBAAoB,CAAEvC,aAAa,CAAAqC,qBAAA,CAAbrC,aAAa,CAE3C,IAAMwC,qBAAqB,CAAGD,oBAAoB,CAACE,QAAQ,CAAC7C,KAAK,CAAC,CAClE,OACEuB,GAAA,CAACuB,IAAI,CAAArB,MAAA,CAAAC,MAAA,CACHqB,CAAAA,OAAO,CAAC,WAAW,CACnBC,EAAE,CAAC,OAAO,CACVC,kBAAkB,CAAEhD,KAAM,CAC1BiD,YAAY,CAAC,QAAQ,CACrBC,SAAS,CAAC,MAAM,CAChB7C,UAAU,CAAEsC,qBAAsB,CAClCN,GAAG,CAAEA,GAAI,CAETc,WAAW,CAAC,WAAW,CACnBxB,CAAAA,sBAAsB,CAACrB,IAAI,CAAC,CAC5B8C,aAAa,CAAC,CAAEd,MAAM,CAANA,MAAO,CAAC,CAAC,CAAAlB,CAAAA,QAAA,CAE7BE,GAAA,CAAC+B,QAAQ,CAAA,CAAAjC,QAAA,CACPE,GAAA,CAACzB,kBAAkB,CAAA2B,MAAA,CAAAC,MAAA,EACjB1B,KAAK,CAAEA,KAAM,CACbC,KAAK,CAAEA,KAAM,CACbC,QAAQ,CAAEA,QAAS,CACnBE,aAAa,CAAEA,aAAc,CAC7BE,UAAU,CAAEsC,qBAAsB,CAAA,CAC9BrC,IAAI,CACT,CAAC,CACM,CAAC,CACP,CAAA,CAAC,CAEX,CACF;;;;"}
|
|
@@ -26,7 +26,7 @@ import { getOuterMotionRef, getInnerMotionRef } from '../../utils/getMotionRefs.
|
|
|
26
26
|
import { makeAnalyticsAttribute } from '../../utils/makeAnalyticsAttribute/makeAnalyticsAttribute.js';
|
|
27
27
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
28
28
|
|
|
29
|
-
var _excluded=["value","children","helpText","isDisabled","size","testID","_motionMeta"];var _Radio=function _Radio(_ref,ref){var _groupProps$state,_groupProps$size;var value=_ref.value,children=_ref.children,helpText=_ref.helpText,isDisabled=_ref.isDisabled,_ref$size=_ref.size,size=_ref$size===void 0?'medium':_ref$size,testID=_ref.testID,_motionMeta=_ref._motionMeta,rest=_objectWithoutProperties(_ref,_excluded);var _useTheme=useTheme(),theme=_useTheme.theme;var groupProps=useRadioGroupContext();var isInsideGroup=!isEmpty(groupProps);if(__DEV__){if(!isInsideGroup){throwBladeError({moduleName:'Radio',message:'Cannot use <Radio /> outside of <RadioGroup />'});}}var isChecked=groupProps==null?void 0:(_groupProps$state=groupProps.state)==null?void 0:_groupProps$state.isChecked(value);var defaultChecked=(groupProps==null?void 0:groupProps.defaultValue)===undefined?undefined:(groupProps==null?void 0:groupProps.defaultValue)===value;var validationState=groupProps==null?void 0:groupProps.validationState;var hasError=validationState==='error';var _isDisabled=isDisabled!=null?isDisabled:groupProps==null?void 0:groupProps.isDisabled;var _isRequired=(groupProps==null?void 0:groupProps.isRequired)||(groupProps==null?void 0:groupProps.necessityIndicator)==='required';var name=groupProps==null?void 0:groupProps.name;var showHelpText=helpText;var isReactNative=getPlatformType()==='react-native';var _size=(_groupProps$size=groupProps.size)!=null?_groupProps$size:size;var handleChange=function handleChange(_ref2){var isChecked=_ref2.isChecked,value=_ref2.value,event=_ref2.event;if(isChecked){var _groupProps$state2;groupProps==null?void 0:(_groupProps$state2=groupProps.state)==null?void 0:_groupProps$state2.setValue(value,event);}else {var _groupProps$state3;groupProps==null?void 0:(_groupProps$state3=groupProps.state)==null?void 0:_groupProps$state3.removeValue();}};var _useRadio=useRadio({defaultChecked:defaultChecked,isChecked:isChecked,hasError:hasError,isDisabled:_isDisabled,isRequired:_isRequired,name:name,value:value,onChange:handleChange}),state=_useRadio.state,ids=_useRadio.ids,inputProps=_useRadio.inputProps;var helpTextLeftSpacing=makeSize(radioSizes.icon[size].width+theme.spacing[3]);return jsx(BaseBox,Object.assign({ref:getOuterMotionRef({_motionMeta:_motionMeta,ref:ref})},getStyledProps(rest),{children:jsx(SelectorLabel,{componentName:MetaConstants.RadioLabel,inputProps:isReactNative?inputProps:{},testID:testID,children:jsxs(BaseBox,{display:"flex",flexDirection:"column",children:[jsxs(BaseBox,{display:"flex",alignItems:"center",flexDirection:"row",children:[jsx(SelectorInput,Object.assign({hoverTokens:radioHoverTokens,isChecked:state.isChecked,isDisabled:_isDisabled,hasError:hasError,inputProps:inputProps,ref:getInnerMotionRef({_motionMeta:_motionMeta,ref:ref})},makeAnalyticsAttribute(rest)))
|
|
29
|
+
var _excluded=["value","children","helpText","isDisabled","size","_hideRadioIcon","testID","_motionMeta"];var _Radio=function _Radio(_ref,ref){var _groupProps$state,_groupProps$size;var value=_ref.value,children=_ref.children,helpText=_ref.helpText,isDisabled=_ref.isDisabled,_ref$size=_ref.size,size=_ref$size===void 0?'medium':_ref$size,_ref$_hideRadioIcon=_ref._hideRadioIcon,_hideRadioIcon=_ref$_hideRadioIcon===void 0?false:_ref$_hideRadioIcon,testID=_ref.testID,_motionMeta=_ref._motionMeta,rest=_objectWithoutProperties(_ref,_excluded);var _useTheme=useTheme(),theme=_useTheme.theme;var groupProps=useRadioGroupContext();var isInsideGroup=!isEmpty(groupProps);if(__DEV__){if(!isInsideGroup){throwBladeError({moduleName:'Radio',message:'Cannot use <Radio /> outside of <RadioGroup />'});}}var isChecked=groupProps==null?void 0:(_groupProps$state=groupProps.state)==null?void 0:_groupProps$state.isChecked(value);var defaultChecked=(groupProps==null?void 0:groupProps.defaultValue)===undefined?undefined:(groupProps==null?void 0:groupProps.defaultValue)===value;var validationState=groupProps==null?void 0:groupProps.validationState;var hasError=validationState==='error';var _isDisabled=isDisabled!=null?isDisabled:groupProps==null?void 0:groupProps.isDisabled;var _isRequired=(groupProps==null?void 0:groupProps.isRequired)||(groupProps==null?void 0:groupProps.necessityIndicator)==='required';var name=groupProps==null?void 0:groupProps.name;var showHelpText=helpText;var isReactNative=getPlatformType()==='react-native';var _size=(_groupProps$size=groupProps.size)!=null?_groupProps$size:size;var handleChange=function handleChange(_ref2){var isChecked=_ref2.isChecked,value=_ref2.value,event=_ref2.event;if(isChecked){var _groupProps$state2;groupProps==null?void 0:(_groupProps$state2=groupProps.state)==null?void 0:_groupProps$state2.setValue(value,event);}else {var _groupProps$state3;groupProps==null?void 0:(_groupProps$state3=groupProps.state)==null?void 0:_groupProps$state3.removeValue();}};var _useRadio=useRadio({defaultChecked:defaultChecked,isChecked:isChecked,hasError:hasError,isDisabled:_isDisabled,isRequired:_isRequired,name:name,value:value,onChange:handleChange}),state=_useRadio.state,ids=_useRadio.ids,inputProps=_useRadio.inputProps;var helpTextLeftSpacing=makeSize(radioSizes.icon[size].width+theme.spacing[3]);return jsx(BaseBox,Object.assign({ref:getOuterMotionRef({_motionMeta:_motionMeta,ref:ref})},getStyledProps(rest),{children:jsx(SelectorLabel,{componentName:MetaConstants.RadioLabel,inputProps:isReactNative?inputProps:{},testID:testID,children:jsxs(BaseBox,{display:"flex",flexDirection:"column",children:[jsxs(BaseBox,{display:"flex",alignItems:"center",flexDirection:"row",children:[jsx(SelectorInput,Object.assign({hoverTokens:radioHoverTokens,isChecked:state.isChecked,isDisabled:_isDisabled,hasError:hasError,inputProps:inputProps,ref:getInnerMotionRef({_motionMeta:_motionMeta,ref:ref})},makeAnalyticsAttribute(rest))),!_hideRadioIcon&&jsx(RadioIcon,{size:_size,isChecked:state.isChecked,isDisabled:_isDisabled,isNegative:hasError}),children?jsx(SelectorTitle,{size:_size,isDisabled:_isDisabled,children:children}):null]}),showHelpText&&jsx(BaseBox,{marginLeft:helpTextLeftSpacing,children:jsx(SelectorSupportText,{size:_size,id:ids==null?void 0:ids.helpTextId,children:helpText})})]})})}));};var Radio=assignWithoutSideEffects(React__default.forwardRef(_Radio),{displayName:'Radio'});
|
|
30
30
|
|
|
31
31
|
export { Radio };
|
|
32
32
|
//# sourceMappingURL=Radio.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Radio.js","sources":["../../../../../src/components/Radio/Radio.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/restrict-plus-operands */\n/* eslint-disable @typescript-eslint/no-shadow */\nimport React from 'react';\nimport type { OnChange } from './useRadio';\nimport { useRadio } from './useRadio';\nimport { RadioIcon } from './RadioIcon/RadioIcon';\nimport { useRadioGroupContext } from './RadioGroup/RadioContext';\nimport { radioHoverTokens, radioSizes } from './radioTokens';\nimport isEmpty from '~utils/lodashButBetter/isEmpty';\nimport { SelectorLabel } from '~components/Form/Selector/SelectorLabel';\nimport BaseBox from '~components/Box/BaseBox';\nimport { SelectorTitle } from '~components/Form/Selector/SelectorTitle';\nimport { SelectorSupportText } from '~components/Form/Selector/SelectorSupportText';\nimport { SelectorInput } from '~components/Form/Selector/SelectorInput';\nimport { getStyledProps } from '~components/Box/styledProps';\nimport type { StyledPropsBlade } from '~components/Box/styledProps';\nimport type {\n BladeElementRef,\n DataAnalyticsAttribute,\n StringChildrenType,\n TestID,\n} from '~utils/types';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\nimport { getPlatformType, makeSize, useTheme } from '~utils';\nimport { MetaConstants } from '~utils/metaAttribute';\nimport { throwBladeError } from '~utils/logger';\nimport type { MotionMetaProp } from '~components/BaseMotion';\nimport { getInnerMotionRef, getOuterMotionRef } from '~utils/getMotionRefs';\nimport { makeAnalyticsAttribute } from '~utils/makeAnalyticsAttribute';\n\ntype RadioProps = {\n /**\n * Sets the label text of the Radio\n */\n children?: StringChildrenType;\n /**\n * Help text for the Radio\n */\n helpText?: string;\n /**\n * The value to be used in the Radio input.\n * This is the value that will be returned on form submission.\n */\n value: string;\n /**\n * If `true`, the Radio will be disabled\n *\n * @default false\n */\n isDisabled?: boolean;\n /**\n * Size of the radios\n *\n * @default \"medium\"\n */\n size?: 'small' | 'medium' | 'large';\n} & TestID &\n DataAnalyticsAttribute &\n StyledPropsBlade &\n MotionMetaProp;\n\nconst _Radio: React.ForwardRefRenderFunction<BladeElementRef, RadioProps> = (\n { value, children, helpText, isDisabled, size = 'medium', testID, _motionMeta, ...rest },\n ref,\n) => {\n const { theme } = useTheme();\n const groupProps = useRadioGroupContext();\n const isInsideGroup = !isEmpty(groupProps);\n\n if (__DEV__) {\n if (!isInsideGroup) {\n throwBladeError({\n moduleName: 'Radio',\n message: 'Cannot use <Radio /> outside of <RadioGroup />',\n });\n }\n }\n\n const isChecked = groupProps?.state?.isChecked(value);\n const defaultChecked =\n groupProps?.defaultValue === undefined ? undefined : groupProps?.defaultValue === value;\n const validationState = groupProps?.validationState;\n const hasError = validationState === 'error';\n const _isDisabled = isDisabled ?? groupProps?.isDisabled;\n const _isRequired = groupProps?.isRequired || groupProps?.necessityIndicator === 'required';\n const name = groupProps?.name;\n const showHelpText = helpText;\n const isReactNative = getPlatformType() === 'react-native';\n const _size = groupProps.size ?? size;\n\n const handleChange: OnChange = ({ isChecked, value, event }) => {\n if (isChecked) {\n groupProps?.state?.setValue(value!, event);\n } else {\n groupProps?.state?.removeValue();\n }\n };\n\n const { state, ids, inputProps } = useRadio({\n defaultChecked,\n isChecked,\n hasError,\n isDisabled: _isDisabled,\n isRequired: _isRequired,\n name,\n value,\n onChange: handleChange,\n });\n\n // radio icon's size & margin + margin-left of SelectorTitle which is 2\n const helpTextLeftSpacing = makeSize(radioSizes.icon[size].width + theme.spacing[3]);\n\n return (\n <BaseBox ref={getOuterMotionRef({ _motionMeta, ref })} {...getStyledProps(rest)}>\n <SelectorLabel\n componentName={MetaConstants.RadioLabel}\n inputProps={isReactNative ? inputProps : {}}\n testID={testID}\n >\n <BaseBox display=\"flex\" flexDirection=\"column\">\n <BaseBox display=\"flex\" alignItems=\"center\" flexDirection=\"row\">\n <SelectorInput\n hoverTokens={radioHoverTokens}\n isChecked={state.isChecked}\n isDisabled={_isDisabled}\n hasError={hasError}\n inputProps={inputProps}\n ref={getInnerMotionRef({ _motionMeta, ref })}\n {...makeAnalyticsAttribute(rest)}\n />\n <RadioIcon\n size={_size}\n isChecked={state.isChecked}\n isDisabled={_isDisabled}\n isNegative={hasError}\n />\n {children ? (\n <SelectorTitle size={_size} isDisabled={_isDisabled}>\n {children}\n </SelectorTitle>\n ) : null}\n </BaseBox>\n {showHelpText && (\n <BaseBox marginLeft={helpTextLeftSpacing}>\n <SelectorSupportText size={_size} id={ids?.helpTextId}>\n {helpText}\n </SelectorSupportText>\n </BaseBox>\n )}\n </BaseBox>\n </SelectorLabel>\n </BaseBox>\n );\n};\n\nconst Radio = assignWithoutSideEffects(React.forwardRef(_Radio), { displayName: 'Radio' });\n\nexport type { RadioProps };\nexport { Radio };\n"],"names":["_Radio","_ref","ref","_groupProps$state","_groupProps$size","value","children","helpText","isDisabled","_ref$size","size","testID","_motionMeta","rest","_objectWithoutProperties","_excluded","_useTheme","useTheme","theme","groupProps","useRadioGroupContext","isInsideGroup","isEmpty","__DEV__","throwBladeError","moduleName","message","isChecked","state","defaultChecked","defaultValue","undefined","validationState","hasError","_isDisabled","_isRequired","isRequired","necessityIndicator","name","showHelpText","isReactNative","getPlatformType","_size","handleChange","_ref2","event","_groupProps$state2","setValue","_groupProps$state3","removeValue","_useRadio","useRadio","onChange","ids","inputProps","helpTextLeftSpacing","makeSize","radioSizes","icon","width","spacing","_jsx","BaseBox","Object","assign","getOuterMotionRef","getStyledProps","SelectorLabel","componentName","MetaConstants","RadioLabel","_jsxs","display","flexDirection","alignItems","SelectorInput","hoverTokens","radioHoverTokens","getInnerMotionRef","makeAnalyticsAttribute","RadioIcon","isNegative","SelectorTitle","marginLeft","SelectorSupportText","id","helpTextId","Radio","assignWithoutSideEffects","React","forwardRef","displayName"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,IAAA,SAAA,CAAA,CAAA,OAAA,CAAA,UAAA,CAAA,UAAA,CAAA,YAAA,CAAA,MAAA,CAAA,QAAA,CAAA,aAAA,CAAA,CA2DA,IAAMA,MAAmE,CAAG,SAAtEA,MAAmEA,CAAAC,IAAA,CAEvEC,GAAG,CACA,CAAAC,IAAAA,iBAAA,CAAAC,gBAAA,CAAA,IAFDC,KAAK,CAAAJ,IAAA,CAALI,KAAK,CAAEC,QAAQ,CAA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CAC3BnB,UAAU,CAAE0B,WAAY,CACxBD,QAAQ,CAAEA,QAAS,CACnBqB,UAAU,CAAEA,UAAW,CACvBpD,GAAG,CAAE4E,iBAAiB,CAAC,CAAElE,WAAW,CAAXA,WAAW,CAAEV,GAAG,CAAHA,GAAI,CAAC,CAAE,CAAA,CACzC6E,sBAAsB,CAAClE,IAAI,CAAC,CACjC,CAAC,CACFgD,GAAA,CAACmB,SAAS,CACRtE,CAAAA,IAAI,CAAEgC,KAAM,CACZf,SAAS,CAAEC,KAAK,CAACD,SAAU,CAC3BnB,UAAU,CAAE0B,WAAY,CACxB+C,UAAU,CAAEhD,QAAS,CACtB,CAAC,CACD3B,QAAQ,CACPuD,GAAA,CAACqB,aAAa,CAACxE,CAAAA,IAAI,CAAEgC,KAAM,CAAClC,UAAU,CAAE0B,WAAY,CAAA5B,QAAA,CACjDA,QAAQ,CACI,CAAC,CACd,IAAI,CAAA,CACD,CAAC,CACTiC,YAAY,EACXsB,GAAA,CAACC,OAAO,CAACqB,CAAAA,UAAU,CAAE5B,mBAAoB,CAAAjD,QAAA,CACvCuD,GAAA,CAACuB,mBAAmB,CAAA,CAAC1E,IAAI,CAAEgC,KAAM,CAAC2C,EAAE,CAAEhC,GAAG,EAAHA,IAAAA,CAAAA,KAAAA,CAAAA,CAAAA,GAAG,CAAEiC,UAAW,CAAAhF,QAAA,CACnDC,QAAQ,CACU,CAAC,CACf,CACV,CACM,CAAA,CAAC,CACG,CAAC,CAAA,CACT,CAAC,CAEd,CAAC,CAEK,IAAAgF,KAAK,CAAGC,wBAAwB,CAACC,cAAK,CAACC,UAAU,CAAC1F,MAAM,CAAC,CAAE,CAAE2F,WAAW,CAAE,OAAQ,CAAC;;;;"}
|
|
1
|
+
{"version":3,"file":"Radio.js","sources":["../../../../../src/components/Radio/Radio.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/restrict-plus-operands */\n/* eslint-disable @typescript-eslint/no-shadow */\nimport React from 'react';\nimport type { OnChange } from './useRadio';\nimport { useRadio } from './useRadio';\nimport { RadioIcon } from './RadioIcon/RadioIcon';\nimport { useRadioGroupContext } from './RadioGroup/RadioContext';\nimport { radioHoverTokens, radioSizes } from './radioTokens';\nimport isEmpty from '~utils/lodashButBetter/isEmpty';\nimport { SelectorLabel } from '~components/Form/Selector/SelectorLabel';\nimport BaseBox from '~components/Box/BaseBox';\nimport { SelectorTitle } from '~components/Form/Selector/SelectorTitle';\nimport { SelectorSupportText } from '~components/Form/Selector/SelectorSupportText';\nimport { SelectorInput } from '~components/Form/Selector/SelectorInput';\nimport { getStyledProps } from '~components/Box/styledProps';\nimport type { StyledPropsBlade } from '~components/Box/styledProps';\nimport type {\n BladeElementRef,\n DataAnalyticsAttribute,\n StringChildrenType,\n TestID,\n} from '~utils/types';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\nimport { getPlatformType, makeSize, useTheme } from '~utils';\nimport { MetaConstants } from '~utils/metaAttribute';\nimport { throwBladeError } from '~utils/logger';\nimport type { MotionMetaProp } from '~components/BaseMotion';\nimport { getInnerMotionRef, getOuterMotionRef } from '~utils/getMotionRefs';\nimport { makeAnalyticsAttribute } from '~utils/makeAnalyticsAttribute';\n\ntype RadioProps = {\n /**\n * Sets the label text of the Radio\n */\n children?: StringChildrenType;\n /**\n * Help text for the Radio\n */\n helpText?: string;\n /**\n * The value to be used in the Radio input.\n * This is the value that will be returned on form submission.\n */\n value: string;\n /**\n * If `true`, the Radio will be disabled\n *\n * @default false\n */\n isDisabled?: boolean;\n /**\n * Size of the radios\n *\n * @default \"medium\"\n */\n size?: 'small' | 'medium' | 'large';\n /**\n * @private\n * Internal prop to hide the radio icon\n * @default false\n */\n _hideRadioIcon?: boolean;\n} & TestID &\n DataAnalyticsAttribute &\n StyledPropsBlade &\n MotionMetaProp;\n\nconst _Radio: React.ForwardRefRenderFunction<BladeElementRef, RadioProps> = (\n {\n value,\n children,\n helpText,\n isDisabled,\n size = 'medium',\n _hideRadioIcon = false,\n testID,\n _motionMeta,\n ...rest\n },\n ref,\n) => {\n const { theme } = useTheme();\n const groupProps = useRadioGroupContext();\n const isInsideGroup = !isEmpty(groupProps);\n\n if (__DEV__) {\n if (!isInsideGroup) {\n throwBladeError({\n moduleName: 'Radio',\n message: 'Cannot use <Radio /> outside of <RadioGroup />',\n });\n }\n }\n\n const isChecked = groupProps?.state?.isChecked(value);\n const defaultChecked =\n groupProps?.defaultValue === undefined ? undefined : groupProps?.defaultValue === value;\n const validationState = groupProps?.validationState;\n const hasError = validationState === 'error';\n const _isDisabled = isDisabled ?? groupProps?.isDisabled;\n const _isRequired = groupProps?.isRequired || groupProps?.necessityIndicator === 'required';\n const name = groupProps?.name;\n const showHelpText = helpText;\n const isReactNative = getPlatformType() === 'react-native';\n const _size = groupProps.size ?? size;\n\n const handleChange: OnChange = ({ isChecked, value, event }) => {\n if (isChecked) {\n groupProps?.state?.setValue(value!, event);\n } else {\n groupProps?.state?.removeValue();\n }\n };\n\n const { state, ids, inputProps } = useRadio({\n defaultChecked,\n isChecked,\n hasError,\n isDisabled: _isDisabled,\n isRequired: _isRequired,\n name,\n value,\n onChange: handleChange,\n });\n\n // radio icon's size & margin + margin-left of SelectorTitle which is 2\n const helpTextLeftSpacing = makeSize(radioSizes.icon[size].width + theme.spacing[3]);\n\n return (\n <BaseBox ref={getOuterMotionRef({ _motionMeta, ref })} {...getStyledProps(rest)}>\n <SelectorLabel\n componentName={MetaConstants.RadioLabel}\n inputProps={isReactNative ? inputProps : {}}\n testID={testID}\n >\n <BaseBox display=\"flex\" flexDirection=\"column\">\n <BaseBox display=\"flex\" alignItems=\"center\" flexDirection=\"row\">\n <SelectorInput\n hoverTokens={radioHoverTokens}\n isChecked={state.isChecked}\n isDisabled={_isDisabled}\n hasError={hasError}\n inputProps={inputProps}\n ref={getInnerMotionRef({ _motionMeta, ref })}\n {...makeAnalyticsAttribute(rest)}\n />\n {!_hideRadioIcon && (\n <RadioIcon\n size={_size}\n isChecked={state.isChecked}\n isDisabled={_isDisabled}\n isNegative={hasError}\n />\n )}\n {children ? (\n <SelectorTitle size={_size} isDisabled={_isDisabled}>\n {children}\n </SelectorTitle>\n ) : null}\n </BaseBox>\n {showHelpText && (\n <BaseBox marginLeft={helpTextLeftSpacing}>\n <SelectorSupportText size={_size} id={ids?.helpTextId}>\n {helpText}\n </SelectorSupportText>\n </BaseBox>\n )}\n </BaseBox>\n </SelectorLabel>\n </BaseBox>\n );\n};\n\nconst Radio = assignWithoutSideEffects(React.forwardRef(_Radio), { displayName: 'Radio' });\n\nexport type { RadioProps };\nexport { Radio };\n"],"names":["_Radio","_ref","ref","_groupProps$state","_groupProps$size","value","children","helpText","isDisabled","_ref$size","size","_ref$_hideRadioIcon","_hideRadioIcon","testID","_motionMeta","rest","_objectWithoutProperties","_excluded","_useTheme","useTheme","theme","groupProps","useRadioGroupContext","isInsideGroup","isEmpty","__DEV__","throwBladeError","moduleName","message","isChecked","state","defaultChecked","defaultValue","undefined","validationState","hasError","_isDisabled","_isRequired","isRequired","necessityIndicator","name","showHelpText","isReactNative","getPlatformType","_size","handleChange","_ref2","event","_groupProps$state2","setValue","_groupProps$state3","removeValue","_useRadio","useRadio","onChange","ids","inputProps","helpTextLeftSpacing","makeSize","radioSizes","icon","width","spacing","_jsx","BaseBox","Object","assign","getOuterMotionRef","getStyledProps","SelectorLabel","componentName","MetaConstants","RadioLabel","_jsxs","display","flexDirection","alignItems","SelectorInput","hoverTokens","radioHoverTokens","getInnerMotionRef","makeAnalyticsAttribute","RadioIcon","isNegative","SelectorTitle","marginLeft","SelectorSupportText","id","helpTextId","Radio","assignWithoutSideEffects","React","forwardRef","displayName"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;0GAmEA,IAAMA,MAAmE,CAAG,SAAtEA,MAAmEA,CAAAC,IAAA,CAYvEC,GAAG,CACA,CAAA,IAAAC,iBAAA,CAAAC,gBAAA,KAXDC,KAAK,CAAAJ,IAAA,CAALI,KAAK,CACLC,QAAQ,CAAAL,IAAA,CAAR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ACnBqB,UAAU,CAAEA,UAAW,CACvBtD,GAAG,CAAE8E,iBAAiB,CAAC,CAAElE,WAAW,CAAXA,WAAW,CAAEZ,GAAG,CAAHA,GAAI,CAAC,CAAE,CACzC+E,CAAAA,sBAAsB,CAAClE,IAAI,CAAC,CACjC,CAAC,CACD,CAACH,cAAc,EACdmD,GAAA,CAACmB,SAAS,EACRxE,IAAI,CAAEkC,KAAM,CACZf,SAAS,CAAEC,KAAK,CAACD,SAAU,CAC3BrB,UAAU,CAAE4B,WAAY,CACxB+C,UAAU,CAAEhD,QAAS,CACtB,CACF,CACA7B,QAAQ,CACPyD,GAAA,CAACqB,aAAa,CAAA,CAAC1E,IAAI,CAAEkC,KAAM,CAACpC,UAAU,CAAE4B,WAAY,CAAA9B,QAAA,CACjDA,QAAQ,CACI,CAAC,CACd,IAAI,EACD,CAAC,CACTmC,YAAY,EACXsB,GAAA,CAACC,OAAO,CAAA,CAACqB,UAAU,CAAE5B,mBAAoB,CAAAnD,QAAA,CACvCyD,GAAA,CAACuB,mBAAmB,EAAC5E,IAAI,CAAEkC,KAAM,CAAC2C,EAAE,CAAEhC,GAAG,EAAA,IAAA,CAAA,KAAA,CAAA,CAAHA,GAAG,CAAEiC,UAAW,CAAAlF,QAAA,CACnDC,QAAQ,CACU,CAAC,CACf,CACV,CAAA,CACM,CAAC,CACG,CAAC,EACT,CAAC,CAEd,CAAC,CAEK,IAAAkF,KAAK,CAAGC,wBAAwB,CAACC,cAAK,CAACC,UAAU,CAAC5F,MAAM,CAAC,CAAE,CAAE6F,WAAW,CAAE,OAAQ,CAAC;;;;"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React__default from 'react';
|
|
2
2
|
|
|
3
|
-
var TableContext=React__default.createContext({selectionType:'none',selectedRows:undefined,totalItems:0,toggleRowSelectionById:function toggleRowSelectionById(){},toggleAllRowsSelection:function toggleAllRowsSelection(){},deselectAllRows:function deselectAllRows(){},rowDensity:'normal',toggleSort:function toggleSort(){},currentSortedState:{sortKey:'',isSortReversed:false},setPaginationPage:function setPaginationPage(){},setPaginationRowSize:function setPaginationRowSize(){},disabledRows:[],setDisabledRows:function setDisabledRows(){},paginationType:'client',setPaginationType:function setPaginationType(){},backgroundColor:'surface.background.gray.intense',setHeaderRowDensity:function setHeaderRowDensity(){},showBorderedCells:false,hasHoverActions:false,setHasHoverActions:function setHasHoverActions(){},columnCount:0,gridTemplateColumns:undefined,isVirtualized:false,tableData:[],isGrouped:false});var useTableContext=function useTableContext(){var context=React__default.useContext(TableContext);return context;};
|
|
3
|
+
var TableContext=React__default.createContext({selectionType:'none',selectedRows:undefined,totalItems:0,toggleRowSelectionById:function toggleRowSelectionById(){},toggleAllRowsSelection:function toggleAllRowsSelection(){},deselectAllRows:function deselectAllRows(){},rowDensity:'normal',toggleSort:function toggleSort(){},currentSortedState:{sortKey:'',isSortReversed:false},setPaginationPage:function setPaginationPage(){},setPaginationRowSize:function setPaginationRowSize(){},disabledRows:[],setDisabledRows:function setDisabledRows(){},paginationType:'client',setPaginationType:function setPaginationType(){},backgroundColor:'surface.background.gray.intense',setHeaderRowDensity:function setHeaderRowDensity(){},showBorderedCells:false,hasHoverActions:false,setHasHoverActions:function setHasHoverActions(){},columnCount:0,gridTemplateColumns:undefined,isVirtualized:false,tableData:[],isGrouped:false,tableToolbarPlacement:'inline'});var useTableContext=function useTableContext(){var context=React__default.useContext(TableContext);return context;};
|
|
4
4
|
|
|
5
5
|
export { TableContext, useTableContext };
|
|
6
6
|
//# sourceMappingURL=TableContext.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TableContext.js","sources":["../../../../../src/components/Table/TableContext.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-empty-function */\n// eslint-disable-next-line @typescript-eslint/no-empty-function\nimport React from 'react';\nimport type { TableNode } from '@table-library/react-table-library/table';\nimport type {\n TableBackgroundColors,\n TableProps,\n TablePaginationType,\n TableHeaderRowProps,\n TableNode as LocalTableNode,\n} from './types';\n\nexport type TableContextType<Item> = {\n selectionType?: TableProps<unknown>['selectionType'];\n selectedRows?: TableNode['id'][];\n totalItems: number;\n toggleRowSelectionById: (id: TableNode['id']) => void;\n toggleAllRowsSelection: () => void;\n deselectAllRows: () => void;\n rowDensity: NonNullable<TableProps<unknown>['rowDensity']>;\n toggleSort: (sortKey: string) => void;\n currentSortedState: {\n sortKey: string;\n isSortReversed: boolean;\n sortableColumns?: string[];\n };\n setPaginationPage: (page: number) => void;\n setPaginationRowSize: (size: number) => void;\n currentPaginationState?: {\n page: number;\n size: number;\n };\n showStripedRows?: boolean;\n disabledRows: TableNode['id'][];\n setDisabledRows: React.Dispatch<React.SetStateAction<TableNode['id'][]>>;\n paginationType: NonNullable<TablePaginationType>;\n setPaginationType: React.Dispatch<React.SetStateAction<NonNullable<TablePaginationType>>>;\n backgroundColor: TableBackgroundColors | 'transparent';\n headerRowDensity?: TableHeaderRowProps['rowDensity'];\n setHeaderRowDensity: React.Dispatch<React.SetStateAction<TableHeaderRowProps['rowDensity']>>;\n showBorderedCells: NonNullable<TableProps<unknown>['showBorderedCells']>;\n hasHoverActions: boolean;\n setHasHoverActions: (hasHoverActions: boolean) => void;\n columnCount: number;\n gridTemplateColumns: string | undefined;\n isVirtualized?: boolean;\n tableData: LocalTableNode<Item>[];\n isGrouped: boolean;\n};\n\nconst TableContext = React.createContext<TableContextType<unknown>>({\n selectionType: 'none',\n selectedRows: undefined,\n totalItems: 0,\n toggleRowSelectionById: () => {},\n toggleAllRowsSelection: () => {},\n deselectAllRows: () => {},\n rowDensity: 'normal',\n toggleSort: () => {},\n currentSortedState: {\n sortKey: '',\n isSortReversed: false,\n },\n setPaginationPage: () => {},\n setPaginationRowSize: () => {},\n disabledRows: [],\n setDisabledRows: () => {},\n paginationType: 'client',\n setPaginationType: () => {},\n backgroundColor: 'surface.background.gray.intense',\n setHeaderRowDensity: () => {},\n showBorderedCells: false,\n hasHoverActions: false,\n setHasHoverActions: () => {},\n columnCount: 0,\n gridTemplateColumns: undefined,\n isVirtualized: false,\n tableData: [],\n isGrouped: false,\n});\n\nconst useTableContext = <Item,>(): TableContextType<Item> => {\n const context = React.useContext(TableContext as React.Context<TableContextType<Item>>);\n return context;\n};\n\nexport { useTableContext, TableContext };\n"],"names":["TableContext","React","createContext","selectionType","selectedRows","undefined","totalItems","toggleRowSelectionById","toggleAllRowsSelection","deselectAllRows","rowDensity","toggleSort","currentSortedState","sortKey","isSortReversed","setPaginationPage","setPaginationRowSize","disabledRows","setDisabledRows","paginationType","setPaginationType","backgroundColor","setHeaderRowDensity","showBorderedCells","hasHoverActions","setHasHoverActions","columnCount","gridTemplateColumns","isVirtualized","tableData","isGrouped","useTableContext","context","useContext"],"mappings":";;
|
|
1
|
+
{"version":3,"file":"TableContext.js","sources":["../../../../../src/components/Table/TableContext.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-empty-function */\n// eslint-disable-next-line @typescript-eslint/no-empty-function\nimport React from 'react';\nimport type { TableNode } from '@table-library/react-table-library/table';\nimport type {\n TableBackgroundColors,\n TableProps,\n TablePaginationType,\n TableHeaderRowProps,\n TableNode as LocalTableNode,\n TableToolbarPlacement,\n} from './types';\n\nexport type TableContextType<Item> = {\n selectionType?: TableProps<unknown>['selectionType'];\n selectedRows?: TableNode['id'][];\n totalItems: number;\n toggleRowSelectionById: (id: TableNode['id']) => void;\n toggleAllRowsSelection: () => void;\n deselectAllRows: () => void;\n rowDensity: NonNullable<TableProps<unknown>['rowDensity']>;\n toggleSort: (sortKey: string) => void;\n currentSortedState: {\n sortKey: string;\n isSortReversed: boolean;\n sortableColumns?: string[];\n };\n setPaginationPage: (page: number) => void;\n setPaginationRowSize: (size: number) => void;\n currentPaginationState?: {\n page: number;\n size: number;\n };\n showStripedRows?: boolean;\n disabledRows: TableNode['id'][];\n setDisabledRows: React.Dispatch<React.SetStateAction<TableNode['id'][]>>;\n paginationType: NonNullable<TablePaginationType>;\n setPaginationType: React.Dispatch<React.SetStateAction<NonNullable<TablePaginationType>>>;\n backgroundColor: TableBackgroundColors | 'transparent';\n headerRowDensity?: TableHeaderRowProps['rowDensity'];\n setHeaderRowDensity: React.Dispatch<React.SetStateAction<TableHeaderRowProps['rowDensity']>>;\n showBorderedCells: NonNullable<TableProps<unknown>['showBorderedCells']>;\n hasHoverActions: boolean;\n setHasHoverActions: (hasHoverActions: boolean) => void;\n columnCount: number;\n gridTemplateColumns: string | undefined;\n isVirtualized?: boolean;\n tableData: LocalTableNode<Item>[];\n isGrouped: boolean;\n tableToolbarPlacement: TableToolbarPlacement;\n};\n\nconst TableContext = React.createContext<TableContextType<unknown>>({\n selectionType: 'none',\n selectedRows: undefined,\n totalItems: 0,\n toggleRowSelectionById: () => {},\n toggleAllRowsSelection: () => {},\n deselectAllRows: () => {},\n rowDensity: 'normal',\n toggleSort: () => {},\n currentSortedState: {\n sortKey: '',\n isSortReversed: false,\n },\n setPaginationPage: () => {},\n setPaginationRowSize: () => {},\n disabledRows: [],\n setDisabledRows: () => {},\n paginationType: 'client',\n setPaginationType: () => {},\n backgroundColor: 'surface.background.gray.intense',\n setHeaderRowDensity: () => {},\n showBorderedCells: false,\n hasHoverActions: false,\n setHasHoverActions: () => {},\n columnCount: 0,\n gridTemplateColumns: undefined,\n isVirtualized: false,\n tableData: [],\n isGrouped: false,\n tableToolbarPlacement: 'inline',\n});\n\nconst useTableContext = <Item,>(): TableContextType<Item> => {\n const context = React.useContext(TableContext as React.Context<TableContextType<Item>>);\n return context;\n};\n\nexport { useTableContext, TableContext };\n"],"names":["TableContext","React","createContext","selectionType","selectedRows","undefined","totalItems","toggleRowSelectionById","toggleAllRowsSelection","deselectAllRows","rowDensity","toggleSort","currentSortedState","sortKey","isSortReversed","setPaginationPage","setPaginationRowSize","disabledRows","setDisabledRows","paginationType","setPaginationType","backgroundColor","setHeaderRowDensity","showBorderedCells","hasHoverActions","setHasHoverActions","columnCount","gridTemplateColumns","isVirtualized","tableData","isGrouped","tableToolbarPlacement","useTableContext","context","useContext"],"mapp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tokens/global/typography.js';
|
|
441
441
|
import '../../tokens/global/motion.js';
|
|
442
442
|
|
|
443
|
-
var tableEditableCellRowDensityToInputSizeMap={compact:'
|
|
443
|
+
var tableEditableCellRowDensityToInputSizeMap={compact:'small',normal:'medium',comfortable:'large'};var validationStateToInputTrailingIconMap={none:undefined,success:CheckIcon,error:AlertCircleIcon};var rowDensityToIsTableInputCellMapping={comfortable:false,normal:true,compact:true};
|
|
444
444
|
|
|
445
445
|
export { rowDensityToIsTableInputCellMapping, tableEditableCellRowDensityToInputSizeMap, validationStateToInputTrailingIconMap };
|
|
446
446
|
//# sourceMappingURL=tokens.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tokens.js","sources":["../../../../../src/components/Table/tokens.ts"],"sourcesContent":["import { AlertCircleIcon, CheckIcon } from '~components/Icons';\nimport { size } from '~tokens/global';\n\nconst firstColumnStickyZIndex = 2;\n\nconst refreshWrapperZIndex = 3;\n\nconst checkboxCellWidth = size['44'];\n\nconst tableBackgroundColor = 'surface.background.gray.intense';\nconst tableHeader = {\n paddingTop: 'spacing.5',\n paddingBottom: 'spacing.5',\n paddingLeft: 'spacing.4',\n paddingRight: 'spacing.4',\n backgroundColor: 'interactive.background.gray.
|
|
1
|
+
{"version":3,"file":"tokens.js","sources":["../../../../../src/components/Table/tokens.ts"],"sourcesContent":["import { AlertCircleIcon, CheckIcon } from '~components/Icons';\nimport { size } from '~tokens/global';\n\nconst firstColumnStickyZIndex = 2;\n\nconst refreshWrapperZIndex = 3;\n\nconst checkboxCellWidth = size['44'];\n\nconst tableBackgroundColor = 'surface.background.gray.intense';\nconst tableHeader = {\n paddingTop: 'spacing.5',\n paddingBottom: 'spacing.5',\n paddingLeft: 'spacing.4',\n paddingRight: 'spacing.4',\n backgroundColor: 'interactive.background.gray.faded',\n borderBottomAndTopWidth: 'thin',\n borderBottomAndTopColor: 'surface.border.gray.muted',\n} as const;\n\nconst tableFooter = {\n paddingTop: 'spacing.5',\n paddingBottom: 'spacing.5',\n paddingLeft: 'spacing.4',\n paddingRight: 'spacing.4',\n borderBottomAndTopWidth: 'thin',\n borderBottomAndTopColor: 'surface.border.gray.muted',\n backgroundColor: 'interactive.background.gray.faded',\n} as const;\n\nconst tableRow = {\n paddingLeft: {\n compact: 'spacing.4',\n normal: 'spacing.4',\n comfortable: 'spacing.4',\n },\n paddingRight: {\n compact: 'spacing.4',\n normal: 'spacing.4',\n comfortable: 'spacing.4',\n },\n minHeight: {\n compact: '36',\n normal: '48',\n comfortable: '60',\n },\n nonStripe: {\n backgroundColor: 'transparent',\n backgroundColorHover: 'interactive.background.gray.default',\n backgroundColorFocus: 'transparent',\n // TODO: Rebranding - on design side: explore pressed state color change, right now both hover & active are same\n backgroundColorActive: 'interactive.background.gray.default',\n backgroundColorSelected: 'interactive.background.primary.faded',\n backgroundColorSelectedHover: 'interactive.background.primary.fadedHighlighted',\n backgroundColorSelectedFocus: 'interactive.background.primary.faded',\n backgroundColorSelectedActive: 'interactive.background.primary.fadedHighlighted',\n },\n nonStripeWrapper: {\n // not used anywhere\n backgroundColor: 'transparent',\n backgroundColorHover: 'transparent',\n backgroundColorFocus: 'transparent',\n backgroundColorActive: 'interactive.background.gray.default',\n backgroundColorSelected: 'transparent',\n backgroundColorSelectedHover: 'transparent',\n backgroundColorSelectedFocus: 'transparent',\n backgroundColorSelectedActive: 'transparent',\n },\n stripe: {\n backgroundColor: 'transparent',\n backgroundColorHover: 'interactive.background.gray.default',\n backgroundColorFocus: 'transparent',\n backgroundColorActive: 'interactive.background.gray.default',\n backgroundColorSelected: 'interactive.background.primary.faded',\n backgroundColorSelectedHover: 'interactive.background.primary.fadedHighlighted',\n backgroundColorSelectedFocus: 'interactive.background.primary.faded',\n backgroundColorSelectedActive: 'interactive.background.primary.fadedHighlighted',\n },\n stripeWrapper: {\n backgroundColor: 'interactive.background.gray.default',\n backgroundColorHover: 'interactive.background.gray.default',\n backgroundColorFocus: 'interactive.background.gray.default',\n backgroundColorActive: 'interactive.background.gray.default',\n backgroundColorSelected: 'interactive.background.primary.faded',\n backgroundColorSelectedHover: 'interactive.background.primary.faded',\n backgroundColorSelectedFocus: 'interactive.background.primary.faded',\n backgroundColorSelectedActive: 'interactive.background.primary.faded',\n },\n borderBottomWidth: 'thin',\n borderColor: 'surface.border.gray.muted',\n backgroundColorMotionEasing: 'easing.standard',\n backgroundColorMotionDuration: 'duration.xquick',\n groupHeaderBackgroundColor: 'surface.background.gray.moderate',\n} as const;\n\nconst tableToolbar = {\n backgroundColor: 'interactive.background.gray.faded',\n backgroundColorSelected: 'interactive.background.primary.faded',\n backgroundColorMotionEasing: 'easing.standard',\n backgroundColorMotionDuration: 'duration.xquick',\n minHeight: size[37], // 37px to accommodate 1px border, matching TableHeader height\n padding: ['spacing.3', 'spacing.4'],\n} as const;\n\nconst tablePagination = {\n padding: ['6px', 'spacing.3'],\n pageSelectionButton: {\n backgroundColor: 'transparent',\n backgroundColorHover: 'interactive.background.gray.default',\n backgroundColorActive: 'interactive.background.gray.highlighted',\n backgroundColorSelected: 'interactive.background.primary.faded',\n backgroundColorSelectedHover: 'interactive.background.primary.fadedHighlighted',\n backgroundColorSelectedActive: 'interactive.background.primary.fadedHighlighted',\n padding: 'spacing.2',\n borderRadius: 'small',\n focusRingColor: 'surface.border.primary.muted',\n textColor: 'surface.text.gray.subtle',\n textColorSelected: 'surface.text.primary.normal',\n height: size['32'],\n width: size['32'],\n },\n defaultPageSize: 10,\n} as const;\n\nconst tableEditableCellRowDensityToInputSizeMap = {\n compact: 'small',\n normal: 'medium',\n comfortable: 'large',\n} as const;\n\nconst validationStateToInputTrailingIconMap = {\n none: undefined,\n success: CheckIcon,\n error: AlertCircleIcon,\n};\n\nconst rowDensityToIsTableInputCellMapping = {\n comfortable: false,\n normal: true,\n compact: true,\n};\n\nconst classes = {\n HOVER_ACTIONS: 'hover-actions',\n HOVER_ACTIONS_LAYER2: 'hover-actions-layer-2',\n HOVER_ACTIONS_LAYER3: 'hover-actions-layer-3',\n HAS_ROW_SPANNING: 'has-row-spanning',\n};\n\nexport {\n tableHeader,\n tableFooter,\n tableRow,\n tableToolbar,\n tablePagination,\n refreshWrapperZIndex,\n tableBackgroundColor,\n firstColumnStickyZIndex,\n checkboxCellWidth,\n tableEditableCellRowDensityToInputSizeMap,\n validationStateToInputTrailingIconMap,\n rowDensityToIsTableInputCellMapping,\n classes,\n};\n"],"names":["tableEditableCellRowDensityToInputSizeMap","compact","normal","comfortable","validationStateToInputTrailingIconMap","none","undefined","success","CheckIcon","error","AlertCircleIcon","rowDensityToIsTableInputCellMapping"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4HM,IAAAA,yCAAyC,CAAG,CAChDC,OAAO,CAAE,OAAO,CAChBC,MAAM,CAAE,QAAQ,CAChBC,WAAW,CAAE,OACf,EAEM,IAAAC,qCAAqC,CAAG,CAC5CC,IAAI,CAAEC,SAAS,CACfC,OAAO,CAAEC,SAAS,CAClBC,KAAK,CAAEC,eACT,EAEM,IAAAC,mCAAmC,CAAG,CAC1CR,WAAW,CAAE,KAAK,CAClBD,MAAM,CAAE,IAAI,CACZD,OAAO,CAAE,IACX;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var size={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,10:10,12:12,14:14,15:15,16:16,18:18,20:20,24:24,26:26,28:28,30:30,31:31,32:32,33:33,34:34,36:36,38:38,40:40,44:44,46:46,48:48,50:50,52:52,56:56,60:60,64:64,66:66,72:72,78:78,80:80,82:82,84:84,86:86,90:90,94:94,96:96,100:100,114:114,120:120,122:122,124:124,132:132,140:140,160:160,172:172,176:176,196:196,192:192,198:198,200:200,208:208,240:240,245:245,250:250,256:256,264:264,300:300,314:314,360:360,400:400,584:584,640:640,760:760,800:800,1024:1024,1136:1136};
|
|
1
|
+
var size={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,10:10,12:12,14:14,15:15,16:16,18:18,20:20,24:24,26:26,28:28,30:30,31:31,32:32,33:33,34:34,36:36,37:37,38:38,40:40,44:44,46:46,48:48,50:50,52:52,56:56,60:60,64:64,66:66,72:72,78:78,80:80,82:82,84:84,86:86,90:90,94:94,96:96,100:100,114:114,120:120,122:122,124:124,132:132,140:140,160:160,172:172,176:176,196:196,192:192,198:198,200:200,208:208,240:240,245:245,250:250,256:256,264:264,300:300,314:314,360:360,400:400,584:584,640:640,760:760,800:800,1024:1024,1136:1136};
|
|
2
2
|
|
|
3
3
|
export { size };
|
|
4
4
|
//# sourceMappingURL=size.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"size.js","sources":["../../../../../src/tokens/global/size.ts"],"sourcesContent":["/**\n * Size tokens are currently not exposed for users (therefore not available in theme)\n */\nexport const size = {\n /** 0 px */\n 0: 0,\n /** 1 px */\n 1: 1,\n /** 2 px */\n 2: 2,\n /** 3 px */\n 3: 3,\n /** 4 px */\n 4: 4,\n /** 5 px */\n 5: 5,\n /** 6 px */\n 6: 6,\n /** 7 px */\n 7: 7,\n /** 8 px */\n 8: 8,\n /** 10 px */\n 10: 10,\n /** 12 px */\n 12: 12,\n /** 14 px */\n 14: 14,\n /** 15 px */\n 15: 15,\n /** 16 px */\n 16: 16,\n /** 18 px */\n 18: 18,\n /** 20 px */\n 20: 20,\n /** 24 px */\n 24: 24,\n /** 26 px */\n 26: 26,\n /** 28 px */\n 28: 28,\n /** 30 px */\n 30: 30,\n /** 31 px */\n 31: 31,\n /** 32 px */\n 32: 32,\n /** 33 px */\n 33: 33,\n /** 34 px */\n 34: 34,\n /** 36 px */\n 36: 36,\n /** 38 px */\n 38: 38,\n /** 40 px */\n 40: 40,\n /** 44 px */\n 44: 44,\n /** 46 px */\n 46: 46,\n /** 48 px */\n 48: 48,\n /** 50 px */\n 50: 50,\n /** 52 px */\n 52: 52,\n /** 56 px */\n 56: 56,\n /** 60 px */\n 60: 60,\n /** 64 px */\n 64: 64,\n /** 66 px */\n 66: 66,\n /** 72 px */\n 72: 72,\n /** 78px */\n 78: 78,\n /** 80 px */\n 80: 80,\n /** 82 px */\n 82: 82,\n /** 84 px */\n 84: 84,\n /** 86 px */\n 86: 86,\n /** 90 px */\n 90: 90,\n /** 94 px */\n 94: 94,\n /** 96 px */\n 96: 96,\n /** 100 px */\n 100: 100,\n /** 114 px */\n 114: 114,\n /** 120 px */\n 120: 120,\n /** 122 px */\n 122: 122,\n /** 124 px */\n 124: 124,\n /** 132 px */\n 132: 132,\n /** 140 px */\n 140: 140,\n /** 160 px */\n 160: 160,\n /** 172 px */\n 172: 172,\n /** 176 px */\n 176: 176,\n /** 196 px */\n 196: 196,\n /** 192 px */\n 192: 192,\n /** 198 px */\n 198: 198,\n /** 200 px */\n 200: 200,\n /** 208 px */\n 208: 208,\n /** 240 px */\n 240: 240,\n /** 245 px */\n 245: 245,\n /** 250 px */\n 250: 250,\n /** 256 px */\n 256: 256,\n /** 264 px */\n 264: 264,\n /** 300 px */\n 300: 300,\n /** 314 px */\n 314: 314,\n /** 360 px */\n 360: 360,\n /** 400 px */\n 400: 400,\n /** 584 px */\n 584: 584,\n /** 640 px */\n 640: 640,\n /** 760 px */\n 760: 760,\n /** 800 px */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G,CAAE,GAAG,CAER,GAAG,CAAE,GAAG,CAER,GAAG,CAAE,GAAG,CAER,GAAG,CAAE,GAAG,CAER,GAAG,CAAE,GAAG,CAER,GAAG,CAAE,GAAG,CAER,GAAG,CAAE,GAAG,CAER,GAAG,CAAE,GAAG,CAER,GAAG,CAAE,GAAG,CAER,GAAG,CAAE,GAAG,CAER,GAAG,CAAE,GAAG,CAER,GAAG,CAAE,GAAG,CAER,GAAG,CAAE,GAAG,CAER,GAAG,CAAE,GAAG,CAER,GAAG,CAAE,GAAG,CAER,GAAG,CAAE,GAAG,CAER,GAAG,CAAE,GAAG,CAER,GAAG,CAAE,GAAG,CAER,GAAG,CAAE,GAAG,CAER,GAAG,CAAE,GAAG,CAER,GAAG,CAAE,GAAG,CAER,GAAG,CAAE,GAAG,CAER,GAAG,CAAE,GAAG,CAER,GAAG,CAAE,GAAG,CAER,GAAG,CAAE,GAAG,CAER,GAAG,CAAE,GAAG,CAER,GAAG,CAAE,GAAG,CAER,GAAG,CAAE,GAAG,CAER,IAAI,CAAE,IAAI,CAEV,IAAI,CAAE,IACR;;;;"}
|
|
1
|
+
{"version":3,"file":"size.js","sources":["../../../../../src/tokens/global/size.ts"],"sourcesContent":["/**\n * Size tokens are currently not exposed for users (therefore not available in theme)\n */\nexport const size = {\n /** 0 px */\n 0: 0,\n /** 1 px */\n 1: 1,\n /** 2 px */\n 2: 2,\n /** 3 px */\n 3: 3,\n /** 4 px */\n 4: 4,\n /** 5 px */\n 5: 5,\n /** 6 px */\n 6: 6,\n /** 7 px */\n 7: 7,\n /** 8 px */\n 8: 8,\n /** 10 px */\n 10: 10,\n /** 12 px */\n 12: 12,\n /** 14 px */\n 14: 14,\n /** 15 px */\n 15: 15,\n /** 16 px */\n 16: 16,\n /** 18 px */\n 18: 18,\n /** 20 px */\n 20: 20,\n /** 24 px */\n 24: 24,\n /** 26 px */\n 26: 26,\n /** 28 px */\n 28: 28,\n /** 30 px */\n 30: 30,\n /** 31 px */\n 31: 31,\n /** 32 px */\n 32: 32,\n /** 33 px */\n 33: 33,\n /** 34 px */\n 34: 34,\n /** 36 px */\n 36: 36,\n /** 37 px */\n 37: 37,\n /** 38 px */\n 38: 38,\n /** 40 px */\n 40: 40,\n /** 44 px */\n 44: 44,\n /** 46 px */\n 46: 46,\n /** 48 px */\n 48: 48,\n /** 50 px */\n 50: 50,\n /** 52 px */\n 52: 52,\n /** 56 px */\n 56: 56,\n /** 60 px */\n 60: 60,\n /** 64 px */\n 64: 64,\n /** 66 px */\n 66: 66,\n /** 72 px */\n 72: 72,\n /** 78px */\n 78: 78,\n /** 80 px */\n 80: 80,\n /** 82 px */\n 82: 82,\n /** 84 px */\n 84: 84,\n /** 86 px */\n 86: 86,\n /** 90 px */\n 90: 90,\n /** 94 px */\n 94: 94,\n /** 96 px */\n 96: 96,\n /** 100 px */\n 100: 100,\n /** 114 px */\n 114: 114,\n /** 120 px */\n 120: 120,\n /** 122 px */\n 122: 122,\n /** 124 px */\n 124: 124,\n /** 132 px */\n 132: 132,\n /** 140 px */\n 140: 140,\n /** 160 px */\n 160: 160,\n /** 172 px */\n 172: 172,\n /** 176 px */\n 176: 176,\n /** 196 px */\n 196: 196,\n /** 192 px */\n 192: 192,\n /** 198 px */\n 198: 198,\n /** 200 px */\n 200: 200,\n /** 208 px */\n 208: 208,\n /** 240 px */\n 240: 240,\n /** 245 px */\n 245: 245,\n /** 250 px */\n 250: 250,\n /** 256 px */\n 256: 256,\n /** 264 px */\n 264: 264,\n /** 300 px */\n 300: 300,\n /** 314 px */\n 314: 314,\n /** 360 px */\n 360: 360,\n /** 400 px */\n 400: 400,\n /** 584 px */\n 584: 584,\n /** 640 px */\n 640: 640,\n /** 760 px */\n 760: 760,\n /** 800 px */\n 800: 800,\n /** 1024 px */\n 1024: 1024,\n /** 1136 px */\n 1136: 1136,\n} as const;\n\nexport type Size = typeof size;\n"],"names":["size"],"mappings":"AAGa,IAAAA,IAAI,CAAG,CAElB,CAAC,CAAE,CAAC,CAEJ,C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G,CAAE,GAAG,CAER,GAAG,CAAE,GAAG,CAER,GAAG,CAAE,GAAG,CAER,GAAG,CAAE,GAAG,CAER,GAAG,CAAE,GAAG,CAER,GAAG,CAAE,GAAG,CAER,GAAG,CAAE,GAAG,CAER,GAAG,CAAE,GAAG,CAER,GAAG,CAAE,GAAG,CAER,GAAG,CAAE,GAAG,CAER,GAAG,CAAE,GAAG,CAER,GAAG,CAAE,GAAG,CAER,GAAG,CAAE,GAAG,CAER,GAAG,CAAE,GAAG,CAER,GAAG,CAAE,GAAG,CAER,GAAG,CAAE,GAAG,CAER,GAAG,CAAE,GAAG,CAER,GAAG,CAAE,GAAG,CAER,GAAG,CAAE,GAAG,CAER,GAAG,CAAE,GAAG,CAER,GAAG,CAAE,GAAG,CAER,GAAG,CAAE,GAAG,CAER,IAAI,CAAE,IAAI,CAEV,IAAI,CAAE,IACR;;;;"}
|
|
@@ -77,6 +77,10 @@ var _Badge = function _Badge(_ref2, ref) {
|
|
|
77
77
|
iconColor = _getColorProps.iconColor,
|
|
78
78
|
textColor = _getColorProps.textColor;
|
|
79
79
|
var badgeTextSizes = {
|
|
80
|
+
xsmall: {
|
|
81
|
+
variant: 'body',
|
|
82
|
+
size: 'xsmall'
|
|
83
|
+
},
|
|
80
84
|
small: {
|
|
81
85
|
variant: 'body',
|
|
82
86
|
size: 'xsmall'
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Badge.js","sources":["../../../../../../src/components/Badge/Badge.tsx"],"sourcesContent":["import React from 'react';\nimport type { ReactElement } from 'react';\nimport type { StyledBadgeProps } from './types';\nimport { StyledBadge } from './StyledBadge';\nimport { iconPadding, iconSize, horizontalPadding, badgeHeight } from './badgeTokens';\nimport type { IconComponent, IconProps } from '~components/Icons';\nimport BaseBox from '~components/Box/BaseBox';\nimport type { FeedbackColors, SubtleOrIntense } from '~tokens/theme/theme';\nimport type { BaseTextProps } from '~components/Typography/BaseText/types';\nimport { Text } from '~components/Typography';\nimport { metaAttribute, MetaConstants } from '~utils/metaAttribute';\nimport { getStyledProps } from '~components/Box/styledProps';\nimport type { StyledPropsBlade } from '~components/Box/styledProps';\nimport type {\n DataAnalyticsAttribute,\n BladeElementRef,\n StringChildrenType,\n TestID,\n} from '~utils/types';\nimport { getStringFromReactText } from '~src/utils/getStringChildren';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\nimport { isReactNative, makeSize } from '~utils';\nimport { throwBladeError } from '~utils/logger';\nimport { makeAnalyticsAttribute } from '~utils/makeAnalyticsAttribute';\n\ntype BadgeProps = {\n /**\n * Sets the label for the badge.\n *\n */\n children: StringChildrenType;\n /**\n * Sets the color of the badge.\n *\n * @default 'neutral'\n */\n color?: FeedbackColors | 'primary';\n /**\n * Sets the contrast of the badge.\n *\n * @default 'subtle'\n */\n emphasis?: SubtleOrIntense;\n /**\n * Sets the size of the badge.\n *\n * @default 'medium'\n */\n size?: 'small' | 'medium' | 'large';\n /**\n * Icon to be displayed in the badge.\n * Accepts a component of type `IconComponent` from Blade.\n *\n */\n icon?: IconComponent;\n} & TestID &\n StyledPropsBlade &\n DataAnalyticsAttribute;\n\ntype ColorProps = {\n iconColor: IconProps['color'];\n textColor: BaseTextProps['color'];\n backgroundColor: StyledBadgeProps['backgroundColor'];\n};\n\nconst getColorProps = ({\n color,\n emphasis,\n}: {\n color: NonNullable<BadgeProps['color']>;\n emphasis: NonNullable<BadgeProps['emphasis']>;\n}): ColorProps => {\n const props: ColorProps = {\n iconColor: 'feedback.icon.neutral.intense',\n textColor: 'feedback.text.neutral.intense',\n backgroundColor: 'feedback.background.neutral.subtle',\n };\n\n if (color === 'primary') {\n // primary color badge\n props.textColor =\n emphasis === 'intense' ? `surface.text.staticWhite.normal` : `surface.text.primary.normal`;\n props.iconColor =\n emphasis === 'intense' ? `surface.icon.staticWhite.normal` : `surface.icon.primary.normal`;\n props.backgroundColor = `surface.background.primary.${emphasis}`;\n } else {\n // feedback colors badge\n props.textColor =\n emphasis === 'intense' ? `surface.text.staticWhite.normal` : `feedback.text.${color}.intense`;\n props.iconColor =\n emphasis === 'intense' ? `surface.icon.staticWhite.normal` : `feedback.icon.${color}.intense`;\n props.backgroundColor = `feedback.background.${color}.${emphasis}`;\n }\n\n return props;\n};\n\nconst _Badge = (\n {\n children,\n emphasis = 'subtle',\n icon: Icon,\n size = 'medium',\n color = 'neutral',\n testID,\n ...props\n }: BadgeProps,\n ref: React.Ref<BladeElementRef>,\n): ReactElement => {\n const childrenString = getStringFromReactText(children);\n if (__DEV__) {\n if (!childrenString?.trim()) {\n throwBladeError({\n message: 'Text as children is required for Badge.',\n moduleName: 'Badge',\n });\n }\n }\n\n const { backgroundColor, iconColor, textColor } = getColorProps({\n color,\n emphasis,\n });\n\n const badgeTextSizes = {\n small: {\n variant: 'body',\n size: 'xsmall',\n },\n medium: {\n variant: 'body',\n size: 'small',\n },\n large: {\n variant: 'body',\n size: 'small',\n },\n } as const;\n\n return (\n <BaseBox\n ref={ref as never}\n display={(isReactNative() ? 'flex' : 'inline-flex') as never}\n {...metaAttribute({ name: MetaConstants.Badge, testID })}\n {...getStyledProps(props)}\n {...makeAnalyticsAttribute(props)}\n >\n <StyledBadge\n height={makeSize(badgeHeight[size])}\n backgroundColor={backgroundColor}\n size={size}\n textAlign={'left' as never}\n >\n <BaseBox\n paddingX={horizontalPadding[size]}\n display=\"flex\"\n flexDirection=\"row\"\n justifyContent=\"center\"\n alignItems=\"center\"\n overflow=\"hidden\"\n >\n {Icon ? (\n <BaseBox paddingRight={Boolean(Icon) ? iconPadding[size] : 'spacing.0'} display=\"flex\">\n <Icon color={iconColor} size={iconSize[size]} />\n </BaseBox>\n ) : null}\n <Text {...badgeTextSizes[size]} weight=\"medium\" truncateAfterLines={1} color={textColor}>\n {children}\n </Text>\n </BaseBox>\n </StyledBadge>\n </BaseBox>\n );\n};\n\nconst Badge = assignWithoutSideEffects(React.forwardRef(_Badge), {\n displayName: 'Badge',\n componentId: 'Badge',\n});\n\nexport type { BadgeProps };\nexport { Badge };\n"],"names":["getColorProps","_ref","color","emphasis","props","iconColor","textColor","backgroundColor","concat","_Badge","_ref2","ref","children","_ref2$emphasis","Icon","icon","_ref2$size","size","_ref2$color","testID","_objectWithoutProperties","_excluded","childrenString","getStringFromReactText","trim","throwBladeError","message","moduleName","_getColorProps","badgeTextSizes","small","variant","medium","large","_jsx","BaseBox","_objectSpread","display","isReactNative","metaAttribute","name","MetaConstants","Badge","getStyledProps","makeAnalyticsAttribute","StyledBadge","height","makeSize","badgeHeight","textAlign","_jsxs","paddingX","horizontalPadding","flexDirection","justifyContent","alignItems","overflow","paddingRight","Boolean","iconPadding","iconSize","Text","weight","truncateAfterLines","assignWithoutSideEffects","React","forwardRef","displayName","componentId"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiEA,IAAMA,aAAa,GAAG,SAAhBA,aAAaA,CAAAC,IAAA,EAMD;AAAA,EAAA,IALhBC,KAAK,GAAAD,IAAA,CAALC,KAAK;IACLC,QAAQ,GAAAF,IAAA,CAARE,QAAQ,CAAA;AAKR,EAAA,IAAMC,KAAiB,GAAG;AACxBC,IAAAA,SAAS,EAAE,+BAA+B;AAC1CC,IAAAA,SAAS,EAAE,+BAA+B;AAC1CC,IAAAA,eAAe,EAAE,oCAAA;GAClB,CAAA;EAED,IAAIL,KAAK,KAAK,SAAS,EAAE;AACvB;AACAE,IAAAA,KAAK,CAACE,SAAS,GACbH,QAAQ,KAAK,SAAS,GAAoE,iCAAA,GAAA,6BAAA,CAAA;AAC5FC,IAAAA,KAAK,CAACC,SAAS,GACbF,QAAQ,KAAK,SAAS,GAAoE,iCAAA,GAAA,6BAAA,CAAA;AAC5FC,IAAAA,KAAK,CAACG,eAAe,GAAA,6BAAA,CAAAC,MAAA,CAAiCL,QAAQ,CAAE,CAAA;AAClE,GAAC,MAAM;AACL;IACAC,KAAK,CAACE,SAAS,GACbH,QAAQ,KAAK,SAAS,GAAAK,iCAAAA,GAAAA,gBAAAA,CAAAA,MAAA,CAA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A,WAAW,EAAE,OAAA;AACf,CAAC;;;;"}
|
|
1
|
+
{"version":3,"file":"Badge.js","sources":["../../../../../../src/components/Badge/Badge.tsx"],"sourcesContent":["import React from 'react';\nimport type { ReactElement } from 'react';\nimport type { StyledBadgeProps } from './types';\nimport { StyledBadge } from './StyledBadge';\nimport { iconPadding, iconSize, horizontalPadding, badgeHeight } from './badgeTokens';\nimport type { IconComponent, IconProps } from '~components/Icons';\nimport BaseBox from '~components/Box/BaseBox';\nimport type { FeedbackColors, SubtleOrIntense } from '~tokens/theme/theme';\nimport type { BaseTextProps } from '~components/Typography/BaseText/types';\nimport { Text } from '~components/Typography';\nimport { metaAttribute, MetaConstants } from '~utils/metaAttribute';\nimport { getStyledProps } from '~components/Box/styledProps';\nimport type { StyledPropsBlade } from '~components/Box/styledProps';\nimport type {\n DataAnalyticsAttribute,\n BladeElementRef,\n StringChildrenType,\n TestID,\n} from '~utils/types';\nimport { getStringFromReactText } from '~src/utils/getStringChildren';\nimport { assignWithoutSideEffects } from '~utils/assignWithoutSideEffects';\nimport { isReactNative, makeSize } from '~utils';\nimport { throwBladeError } from '~utils/logger';\nimport { makeAnalyticsAttribute } from '~utils/makeAnalyticsAttribute';\n\ntype BadgeProps = {\n /**\n * Sets the label for the badge.\n *\n */\n children: StringChildrenType;\n /**\n * Sets the color of the badge.\n *\n * @default 'neutral'\n */\n color?: FeedbackColors | 'primary';\n /**\n * Sets the contrast of the badge.\n *\n * @default 'subtle'\n */\n emphasis?: SubtleOrIntense;\n /**\n * Sets the size of the badge.\n *\n * @default 'medium'\n */\n size?: 'xsmall' | 'small' | 'medium' | 'large';\n /**\n * Icon to be displayed in the badge.\n * Accepts a component of type `IconComponent` from Blade.\n *\n */\n icon?: IconComponent;\n} & TestID &\n StyledPropsBlade &\n DataAnalyticsAttribute;\n\ntype ColorProps = {\n iconColor: IconProps['color'];\n textColor: BaseTextProps['color'];\n backgroundColor: StyledBadgeProps['backgroundColor'];\n};\n\nconst getColorProps = ({\n color,\n emphasis,\n}: {\n color: NonNullable<BadgeProps['color']>;\n emphasis: NonNullable<BadgeProps['emphasis']>;\n}): ColorProps => {\n const props: ColorProps = {\n iconColor: 'feedback.icon.neutral.intense',\n textColor: 'feedback.text.neutral.intense',\n backgroundColor: 'feedback.background.neutral.subtle',\n };\n\n if (color === 'primary') {\n // primary color badge\n props.textColor =\n emphasis === 'intense' ? `surface.text.staticWhite.normal` : `surface.text.primary.normal`;\n props.iconColor =\n emphasis === 'intense' ? `surface.icon.staticWhite.normal` : `surface.icon.primary.normal`;\n props.backgroundColor = `surface.background.primary.${emphasis}`;\n } else {\n // feedback colors badge\n props.textColor =\n emphasis === 'intense' ? `surface.text.staticWhite.normal` : `feedback.text.${color}.intense`;\n props.iconColor =\n emphasis === 'intense' ? `surface.icon.staticWhite.normal` : `feedback.icon.${color}.intense`;\n props.backgroundColor = `feedback.background.${color}.${emphasis}`;\n }\n\n return props;\n};\n\nconst _Badge = (\n {\n children,\n emphasis = 'subtle',\n icon: Icon,\n size = 'medium',\n color = 'neutral',\n testID,\n ...props\n }: BadgeProps,\n ref: React.Ref<BladeElementRef>,\n): ReactElement => {\n const childrenString = getStringFromReactText(children);\n if (__DEV__) {\n if (!childrenString?.trim()) {\n throwBladeError({\n message: 'Text as children is required for Badge.',\n moduleName: 'Badge',\n });\n }\n }\n\n const { backgroundColor, iconColor, textColor } = getColorProps({\n color,\n emphasis,\n });\n\n const badgeTextSizes = {\n xsmall: {\n variant: 'body',\n size: 'xsmall',\n },\n small: {\n variant: 'body',\n size: 'xsmall',\n },\n medium: {\n variant: 'body',\n size: 'small',\n },\n large: {\n variant: 'body',\n size: 'small',\n },\n } as const;\n\n return (\n <BaseBox\n ref={ref as never}\n display={(isReactNative() ? 'flex' : 'inline-flex') as never}\n {...metaAttribute({ name: MetaConstants.Badge, testID })}\n {...getStyledProps(props)}\n {...makeAnalyticsAttribute(props)}\n >\n <StyledBadge\n height={makeSize(badgeHeight[size])}\n backgroundColor={backgroundColor}\n size={size}\n textAlign={'left' as never}\n >\n <BaseBox\n paddingX={horizontalPadding[size]}\n display=\"flex\"\n flexDirection=\"row\"\n justifyContent=\"center\"\n alignItems=\"center\"\n overflow=\"hidden\"\n >\n {Icon ? (\n <BaseBox paddingRight={Boolean(Icon) ? iconPadding[size] : 'spacing.0'} display=\"flex\">\n <Icon color={iconColor} size={iconSize[size]} />\n </BaseBox>\n ) : null}\n <Text {...badgeTextSizes[size]} weight=\"medium\" truncateAfterLines={1} color={textColor}>\n {children}\n </Text>\n </BaseBox>\n </StyledBadge>\n </BaseBox>\n );\n};\n\nconst Badge = assignWithoutSideEffects(React.forwardRef(_Badge), {\n displayName: 'Badge',\n componentId: 'Badge',\n});\n\nexport type { BadgeProps };\nexport { Badge };\n"],"names":["getColorProps","_ref","color","emphasis","props","iconColor","textColor","backgroundColor","concat","_Badge","_ref2","ref","children","_ref2$emphasis","Icon","icon","_ref2$size","size","_ref2$color","testID","_objectWithoutProperties","_excluded","childrenString","getStringFromReactText","trim","throwBladeError","message","moduleName","_getColorProps","badgeTextSizes","xsmall","variant","small","medium","large","_jsx","BaseBox","_objectSpread","display","isReactNative","metaAttribute","name","MetaConstants","Badge","getStyledProps","makeAnalyticsAttribute","StyledBadge","height","makeSize","badgeHeight","textAlign","_jsxs","paddingX","horizontalPadding","flexDirection","justifyContent","alignItems","overflow","paddingRight","Boolean","iconPadding","iconSize","Text","weight","truncateAfterLines","assignWithoutSideEffects","React","forwardRef","displayName","componentId"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiEA,IAAMA,aAAa,GAAG,SAAhBA,aAAaA,CAAAC,IAAA,EAMD;AAAA,EAAA,IALhBC,KAAK,GAAAD,IAAA,CAALC,KAAK;IACLC,QAAQ,GAAAF,IAAA,CAARE,QAAQ,CAAA;AAKR,EAAA,IAAMC,KAAiB,GAAG;AACxBC,IAAAA,SAAS,EAAE,+BAA+B;AAC1CC,IAAAA,SAAS,EAAE,+BAA+B;AAC1CC,IAAA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,CAAC5C,IAAI,CAAA;WAAI,CAAA;AAAC,SACzC,CAAC,GACR,IAAI,eACRkB,GAAA,CAAC2B,IAAI,EAAAzB,aAAA,CAAAA,aAAA,CAAA,EAAA,EAAKR,cAAc,CAACZ,IAAI,CAAC,CAAA,EAAA,EAAA,EAAA;AAAE8C,UAAAA,MAAM,EAAC,QAAQ;AAACC,UAAAA,kBAAkB,EAAE,CAAE;AAAC9D,UAAAA,KAAK,EAAEI,SAAU;AAAAM,UAAAA,QAAA,EACrFA,QAAAA;AAAQ,SAAA,CACL,CAAC,CAAA;OACA,CAAA;KACE,CAAA;AAAC,GAAA,CACP,CAAC,CAAA;AAEd,CAAC,CAAA;AAEK+B,IAAAA,KAAK,gBAAGsB,wBAAwB,cAACC,cAAK,CAACC,UAAU,CAAC1D,MAAM,CAAC,EAAE;AAC/D2D,EAAAA,WAAW,EAAE,OAAO;AACpBC,EAAAA,WAAW,EAAE,OAAA;AACf,CAAC;;;;"}
|
|
@@ -1,21 +1,25 @@
|
|
|
1
1
|
import { size } from '../../tokens/global/size.js';
|
|
2
2
|
|
|
3
3
|
var badgeHeight = {
|
|
4
|
+
xsmall: size[14],
|
|
4
5
|
small: size[16],
|
|
5
6
|
medium: size[20],
|
|
6
7
|
large: size[24]
|
|
7
8
|
};
|
|
8
9
|
var horizontalPadding = {
|
|
10
|
+
xsmall: 'spacing.2',
|
|
9
11
|
small: 'spacing.3',
|
|
10
12
|
medium: 'spacing.3',
|
|
11
13
|
large: 'spacing.4'
|
|
12
14
|
};
|
|
13
15
|
var iconPadding = {
|
|
16
|
+
xsmall: 'spacing.1',
|
|
14
17
|
small: 'spacing.1',
|
|
15
18
|
medium: 'spacing.2',
|
|
16
19
|
large: 'spacing.2'
|
|
17
20
|
};
|
|
18
21
|
var iconSize = {
|
|
22
|
+
xsmall: 'xsmall',
|
|
19
23
|
small: 'xsmall',
|
|
20
24
|
medium: 'small',
|
|
21
25
|
large: 'small'
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"badgeTokens.js","sources":["../../../../../../src/components/Badge/badgeTokens.ts"],"sourcesContent":["import type { BadgeProps } from './Badge';\nimport type { DotNotationSpacingStringToken } from '~utils/types';\nimport type { IconProps } from '~components/Icons';\nimport { size } from '~tokens/global/size';\n\nconst badgeHeight: Record<NonNullable<BadgeProps['size']>, number> = {\n small: size[16],\n medium: size[20],\n large: size[24],\n};\n\nconst horizontalPadding: Record<NonNullable<BadgeProps['size']>, DotNotationSpacingStringToken> = {\n small: 'spacing.3',\n medium: 'spacing.3',\n large: 'spacing.4',\n};\n\nconst iconPadding: Record<NonNullable<BadgeProps['size']>, DotNotationSpacingStringToken> = {\n small: 'spacing.1',\n medium: 'spacing.2',\n large: 'spacing.2',\n};\n\nconst iconSize: Record<NonNullable<BadgeProps['size']>, IconProps['size']> = {\n small: 'xsmall',\n medium: 'small',\n large: 'small',\n};\n\nexport { badgeHeight, horizontalPadding, iconPadding, iconSize };\n"],"names":["badgeHeight","
|
|
1
|
+
{"version":3,"file":"badgeTokens.js","sources":["../../../../../../src/components/Badge/badgeTokens.ts"],"sourcesContent":["import type { BadgeProps } from './Badge';\nimport type { DotNotationSpacingStringToken } from '~utils/types';\nimport type { IconProps } from '~components/Icons';\nimport { size } from '~tokens/global/size';\n\nconst badgeHeight: Record<NonNullable<BadgeProps['size']>, number> = {\n xsmall: size[14],\n small: size[16],\n medium: size[20],\n large: size[24],\n};\n\nconst horizontalPadding: Record<NonNullable<BadgeProps['size']>, DotNotationSpacingStringToken> = {\n xsmall: 'spacing.2',\n small: 'spacing.3',\n medium: 'spacing.3',\n large: 'spacing.4',\n};\n\nconst iconPadding: Record<NonNullable<BadgeProps['size']>, DotNotationSpacingStringToken> = {\n xsmall: 'spacing.1',\n small: 'spacing.1',\n medium: 'spacing.2',\n large: 'spacing.2',\n};\n\nconst iconSize: Record<NonNullable<BadgeProps['size']>, IconProps['size']> = {\n xsmall: 'xsmall',\n small: 'xsmall',\n medium: 'small',\n large: 'small',\n};\n\nexport { badgeHeight, horizontalPadding, iconPadding, iconSize };\n"],"names":["badgeHeight","xsmall","size","small","medium","large","horizontalPadding","iconPadding","iconSize"],"mappings":";;AAKA,IAAMA,WAA4D,GAAG;AACnEC,EAAAA,MAAM,EAAEC,IAAI,CAAC,EAAE,CAAC;AAChBC,EAAAA,KAAK,EAAED,IAAI,CAAC,EAAE,CAAC;AACfE,EAAAA,MAAM,EAAEF,IAAI,CAAC,EAAE,CAAC;EAChBG,KAAK,EAAEH,IAAI,CAAC,EAAE,CAAA;AAChB,EAAC;AAED,IAAMI,iBAAyF,GAAG;AAChGL,EAAAA,MAAM,EAAE,WAAW;AACnBE,EAAAA,KAAK,EAAE,WAAW;AAClBC,EAAAA,MAAM,EAAE,WAAW;AACnBC,EAAAA,KAAK,EAAE,WAAA;AACT,EAAC;AAED,IAAME,WAAmF,GAAG;AAC1FN,EAAAA,MAAM,EAAE,WAAW;AACnBE,EAAAA,KAAK,EAAE,WAAW;AAClBC,EAAAA,MAAM,EAAE,WAAW;AACnBC,EAAAA,KAAK,EAAE,WAAA;AACT,EAAC;AAED,IAAMG,QAAoE,GAAG;AAC3EP,EAAAA,MAAM,EAAE,QAAQ;AAChBE,EAAAA,KAAK,EAAE,QAAQ;AACfC,EAAAA,MAAM,EAAE,OAAO;AACfC,EAAAA,KAAK,EAAE,OAAA;AACT;;;;"}
|
|
@@ -56,13 +56,15 @@ var FilterChipGroup = function FilterChipGroup(_ref) {
|
|
|
56
56
|
testID: testID
|
|
57
57
|
})), makeAnalyticsAttribute(rest)), {}, {
|
|
58
58
|
display: "flex",
|
|
59
|
-
padding:
|
|
59
|
+
padding: ['spacing.4', 'spacing.1'],
|
|
60
60
|
alignItems: "center",
|
|
61
61
|
justifyContent: "flex-start",
|
|
62
62
|
width: "100%",
|
|
63
63
|
gap: "spacing.3",
|
|
64
64
|
flexWrap: "wrap",
|
|
65
65
|
children: [children, showClearButton && (filterChipGroupSelectedFilters.length > 0 || selectedFiltersCount > 0) ? /*#__PURE__*/jsx(Link, {
|
|
66
|
+
size: "xsmall",
|
|
67
|
+
color: "neutral",
|
|
66
68
|
onClick: handleClearButtonClick,
|
|
67
69
|
children: "Clear Filter".concat(filterChipGroupSelectedFilters.length > 1 || selectedFiltersCount > 1 ? 's' : '')
|
|
68
70
|
}) : null]
|