@hitachivantara/uikit-react-core 5.20.0 → 5.20.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -46,7 +46,7 @@ const HvButton = React.forwardRef((props, ref) => {
46
46
  return /* @__PURE__ */ jsxRuntime.jsxs(Component, {
47
47
  ref,
48
48
  type: "button",
49
- className: cx(classes.root, css(Button_styles.getVariantStyles(variant)), size && css(Button_styles.getSizeStyles(size)), radius && css(Button_styles.getRadiusStyles(radius)), overrideIconColors && css(Button_styles.getOverrideColors(variant)), {
49
+ className: cx(classes.root, css(Button_styles.getVariantStyles(variant)), size && css(Button_styles.getSizeStyles(size)), radius && css(Button_styles.getRadiusStyles(radius)), overrideIconColors && css(Button_styles.getOverrideColors()), {
50
50
  [classes.icon]: icon,
51
51
  [classes.disabled]: disabled
52
52
  }, className),
@@ -1 +1 @@
1
- {"version":3,"file":"Button.cjs","sources":["../../../../src/components/Button/Button.tsx"],"sourcesContent":["import React, { forwardRef, ReactElement } from \"react\";\nimport { useTheme } from \"@core/hooks\";\nimport { PolymorphicComponentRef, PolymorphicRef } from \"@core/types\";\nimport { ExtractNames } from \"@core/utils\";\nimport {\n staticClasses as buttonClasses,\n getOverrideColors,\n getRadiusStyles,\n getSizeStyles,\n getVariantStyles,\n useClasses,\n} from \"./Button.styles\";\n\nexport { buttonClasses };\n\nexport type HvButtonClasses = ExtractNames<typeof useClasses>;\n\nexport const buttonVariant = [\n \"primary\",\n \"primarySubtle\",\n \"primaryGhost\",\n \"secondarySubtle\",\n \"secondaryGhost\",\n \"semantic\",\n // deprecated props\n \"secondary\",\n \"ghost\",\n] as const;\nexport type HvButtonVariant = (typeof buttonVariant)[number];\n\nexport const buttonSize = [\"xs\", \"sm\", \"md\", \"lg\", \"xl\"] as const;\nexport type HvButtonSize = (typeof buttonSize)[number];\n\nexport const buttonRadius = [\n \"none\",\n \"base\",\n \"round\",\n \"circle\",\n \"full\",\n] as const;\nexport type HvButtonRadius = (typeof buttonRadius)[number];\n\nexport type HvButtonProps<C extends React.ElementType = \"button\"> =\n PolymorphicComponentRef<\n C,\n {\n /** Use the variant prop to change the visual style of the Button. */\n variant?: HvButtonVariant;\n /** Whether the Button is an icon-only button. */\n icon?: boolean;\n /** Whether the Button is disabled or not. */\n disabled?: boolean;\n /** Class names to be applied. */\n className?: string;\n /** Element placed before the children. */\n startIcon?: ReactElement;\n /** Element placed after the children. */\n endIcon?: ReactElement;\n /** Button size. */\n size?: HvButtonSize;\n /** Button border radius. */\n radius?: HvButtonRadius;\n /** Defines the default colors of the button are forced into the icon. */\n overrideIconColors?: boolean;\n /** A Jss Object used to override or extend the styles applied. */\n classes?: HvButtonClasses;\n /** Whether the Button is selected or not. */\n selected?: boolean;\n }\n >;\n\n/**\n * Normalize the button variant. It's meant to give us some retro-compatibility with\n * the DS 3.6 API.\n * @returns the normalized variant in DS 5 API\n */\nconst mapVariant = (\n variant: HvButtonVariant,\n theme?: string\n): HvButtonVariant => {\n if (theme === \"ds3\") return variant;\n\n const deprecatedVariantMap: Record<string, HvButtonVariant> = {\n secondary: \"secondarySubtle\",\n ghost: \"primaryGhost\",\n };\n\n const mappedVariant = deprecatedVariantMap[variant];\n\n if (mappedVariant) {\n // eslint-disable-next-line no-console\n console.warn(\n `Button variant '${variant}' is deprecated. Please use '${mappedVariant}'.`\n );\n }\n\n return mappedVariant || variant;\n};\n\n/**\n * Button component is used to trigger an action or event.\n */\nexport const HvButton: <C extends React.ElementType = \"button\">(\n props: HvButtonProps<C>\n) => React.ReactElement | null = forwardRef(\n <C extends React.ElementType = \"button\">(\n props: HvButtonProps<C>,\n ref: PolymorphicRef<C>\n ) => {\n const {\n id,\n classes: classesProp,\n children,\n variant: variantProp = \"primary\",\n disabled = false,\n className,\n startIcon,\n endIcon,\n icon = false,\n size,\n radius,\n overrideIconColors = true,\n component: Component = \"button\",\n ...others\n } = props;\n const { classes, css, cx } = useClasses(classesProp);\n const { activeTheme } = useTheme();\n\n const variant = mapVariant(variantProp, activeTheme?.name);\n\n return (\n <Component\n ref={ref}\n type=\"button\"\n className={cx(\n classes.root,\n css(getVariantStyles(variant)),\n size && css(getSizeStyles(size)),\n radius && css(getRadiusStyles(radius)),\n overrideIconColors && css(getOverrideColors(variant)),\n {\n [classes.icon]: icon,\n [classes.disabled]: disabled,\n },\n className\n )}\n {...(disabled && {\n disabled: true,\n tabIndex: -1,\n \"aria-disabled\": true,\n })}\n {...others}\n >\n {startIcon && <span className={classes.startIcon}>{startIcon}</span>}\n {children}\n {endIcon && <span className={classes.endIcon}>{endIcon}</span>}\n </Component>\n );\n }\n);\n"],"names":["mapVariant","variant","theme","deprecatedVariantMap","secondary","ghost","mappedVariant","warn","HvButton","forwardRef","props","ref","id","classes","classesProp","children","variantProp","disabled","className","startIcon","endIcon","icon","size","radius","overrideIconColors","component","Component","others","css","cx","useClasses","activeTheme","useTheme","name","type","root","getVariantStyles","getSizeStyles","getRadiusStyles","getOverrideColors","tabIndex","_jsx"],"mappings":";;;;;;AA4EA,MAAMA,aAAaA,CACjBC,SACAC,UACoB;AACpB,MAAIA,UAAU;AAAcD,WAAAA;AAE5B,QAAME,uBAAwD;AAAA,IAC5DC,WAAW;AAAA,IACXC,OAAO;AAAA,EAAA;AAGHC,QAAAA,gBAAgBH,qBAAqBF,OAAO;AAElD,MAAIK,eAAe;AAETC,YAAAA,KACL,mBAAkBN,uCAAuCK,iBAC5D;AAAA,EACF;AAEA,SAAOA,iBAAiBL;AAC1B;AAKO,MAAMO,WAEoBC,MAAAA,WAC/B,CACEC,OACAC,QACG;AACG,QAAA;AAAA,IACJC;AAAAA,IACAC,SAASC;AAAAA,IACTC;AAAAA,IACAd,SAASe,cAAc;AAAA,IACvBC,WAAW;AAAA,IACXC;AAAAA,IACAC;AAAAA,IACAC;AAAAA,IACAC,OAAO;AAAA,IACPC;AAAAA,IACAC;AAAAA,IACAC,qBAAqB;AAAA,IACrBC,WAAWC,YAAY;AAAA,IACvB,GAAGC;AAAAA,EACDjB,IAAAA;AACE,QAAA;AAAA,IAAEG;AAAAA,IAASe;AAAAA,IAAKC;AAAAA,EAAAA,IAAOC,cAAAA,WAAWhB,WAAW;AAC7C,QAAA;AAAA,IAAEiB;AAAAA,MAAgBC,SAAS,SAAA;AAEjC,QAAM/B,UAAUD,WAAWgB,aAAae,2CAAaE,IAAI;AAEzD,yCACGP,WAAS;AAAA,IACRf;AAAAA,IACAuB,MAAK;AAAA,IACLhB,WAAWW,GACThB,QAAQsB,MACRP,IAAIQ,+BAAiBnC,OAAO,CAAC,GAC7BqB,QAAQM,IAAIS,cAAcf,cAAAA,IAAI,CAAC,GAC/BC,UAAUK,IAAIU,cAAAA,gBAAgBf,MAAM,CAAC,GACrCC,sBAAsBI,IAAIW,gCAAkBtC,OAAO,CAAC,GACpD;AAAA,MACE,CAACY,QAAQQ,IAAI,GAAGA;AAAAA,MAChB,CAACR,QAAQI,QAAQ,GAAGA;AAAAA,OAEtBC,SACF;AAAA,IAAE,GACGD,YAAY;AAAA,MACfA,UAAU;AAAA,MACVuB,UAAU;AAAA,MACV,iBAAiB;AAAA,IACnB;AAAA,IAAC,GACGb;AAAAA,IAAMZ,UAAA,CAETI,aAAasB,2BAAAA,IAAA,QAAA;AAAA,MAAMvB,WAAWL,QAAQM;AAAAA,MAAUJ,UAAEI;AAAAA,IAAgB,CAAA,GAClEJ,UACAK,0CAAW,QAAA;AAAA,MAAMF,WAAWL,QAAQO;AAAAA,MAAQL,UAAEK;AAAAA,IAAAA,CAAc,CAAC;AAAA,EAAA,CACrD;AAEf,CACF;;;"}
1
+ {"version":3,"file":"Button.cjs","sources":["../../../../src/components/Button/Button.tsx"],"sourcesContent":["import React, { forwardRef, ReactElement } from \"react\";\nimport { useTheme } from \"@core/hooks\";\nimport { PolymorphicComponentRef, PolymorphicRef } from \"@core/types\";\nimport { ExtractNames } from \"@core/utils\";\nimport {\n staticClasses as buttonClasses,\n getOverrideColors,\n getRadiusStyles,\n getSizeStyles,\n getVariantStyles,\n useClasses,\n} from \"./Button.styles\";\n\nexport { buttonClasses };\n\nexport type HvButtonClasses = ExtractNames<typeof useClasses>;\n\nexport const buttonVariant = [\n \"primary\",\n \"primarySubtle\",\n \"primaryGhost\",\n \"secondarySubtle\",\n \"secondaryGhost\",\n \"semantic\",\n // deprecated props\n \"secondary\",\n \"ghost\",\n] as const;\nexport type HvButtonVariant = (typeof buttonVariant)[number];\n\nexport const buttonSize = [\"xs\", \"sm\", \"md\", \"lg\", \"xl\"] as const;\nexport type HvButtonSize = (typeof buttonSize)[number];\n\nexport const buttonRadius = [\n \"none\",\n \"base\",\n \"round\",\n \"circle\",\n \"full\",\n] as const;\nexport type HvButtonRadius = (typeof buttonRadius)[number];\n\nexport type HvButtonProps<C extends React.ElementType = \"button\"> =\n PolymorphicComponentRef<\n C,\n {\n /** Use the variant prop to change the visual style of the Button. */\n variant?: HvButtonVariant;\n /** Whether the Button is an icon-only button. */\n icon?: boolean;\n /** Whether the Button is disabled or not. */\n disabled?: boolean;\n /** Class names to be applied. */\n className?: string;\n /** Element placed before the children. */\n startIcon?: ReactElement;\n /** Element placed after the children. */\n endIcon?: ReactElement;\n /** Button size. */\n size?: HvButtonSize;\n /** Button border radius. */\n radius?: HvButtonRadius;\n /** Defines the default colors of the button are forced into the icon. */\n overrideIconColors?: boolean;\n /** A Jss Object used to override or extend the styles applied. */\n classes?: HvButtonClasses;\n /** Whether the Button is selected or not. */\n selected?: boolean;\n }\n >;\n\n/**\n * Normalize the button variant. It's meant to give us some retro-compatibility with\n * the DS 3.6 API.\n * @returns the normalized variant in DS 5 API\n */\nconst mapVariant = (\n variant: HvButtonVariant,\n theme?: string\n): HvButtonVariant => {\n if (theme === \"ds3\") return variant;\n\n const deprecatedVariantMap: Record<string, HvButtonVariant> = {\n secondary: \"secondarySubtle\",\n ghost: \"primaryGhost\",\n };\n\n const mappedVariant = deprecatedVariantMap[variant];\n\n if (mappedVariant) {\n // eslint-disable-next-line no-console\n console.warn(\n `Button variant '${variant}' is deprecated. Please use '${mappedVariant}'.`\n );\n }\n\n return mappedVariant || variant;\n};\n\n/**\n * Button component is used to trigger an action or event.\n */\nexport const HvButton: <C extends React.ElementType = \"button\">(\n props: HvButtonProps<C>\n) => React.ReactElement | null = forwardRef(\n <C extends React.ElementType = \"button\">(\n props: HvButtonProps<C>,\n ref: PolymorphicRef<C>\n ) => {\n const {\n id,\n classes: classesProp,\n children,\n variant: variantProp = \"primary\",\n disabled = false,\n className,\n startIcon,\n endIcon,\n icon = false,\n size,\n radius,\n overrideIconColors = true,\n component: Component = \"button\",\n ...others\n } = props;\n const { classes, css, cx } = useClasses(classesProp);\n const { activeTheme } = useTheme();\n\n const variant = mapVariant(variantProp, activeTheme?.name);\n\n return (\n <Component\n ref={ref}\n type=\"button\"\n className={cx(\n classes.root,\n css(getVariantStyles(variant)),\n size && css(getSizeStyles(size)),\n radius && css(getRadiusStyles(radius)),\n overrideIconColors && css(getOverrideColors()),\n {\n [classes.icon]: icon,\n [classes.disabled]: disabled,\n },\n className\n )}\n {...(disabled && {\n disabled: true,\n tabIndex: -1,\n \"aria-disabled\": true,\n })}\n {...others}\n >\n {startIcon && <span className={classes.startIcon}>{startIcon}</span>}\n {children}\n {endIcon && <span className={classes.endIcon}>{endIcon}</span>}\n </Component>\n );\n }\n);\n"],"names":["mapVariant","variant","theme","deprecatedVariantMap","secondary","ghost","mappedVariant","warn","HvButton","forwardRef","props","ref","id","classes","classesProp","children","variantProp","disabled","className","startIcon","endIcon","icon","size","radius","overrideIconColors","component","Component","others","css","cx","useClasses","activeTheme","useTheme","name","type","root","getVariantStyles","getSizeStyles","getRadiusStyles","getOverrideColors","tabIndex","_jsx"],"mappings":";;;;;;AA4EA,MAAMA,aAAaA,CACjBC,SACAC,UACoB;AACpB,MAAIA,UAAU;AAAcD,WAAAA;AAE5B,QAAME,uBAAwD;AAAA,IAC5DC,WAAW;AAAA,IACXC,OAAO;AAAA,EAAA;AAGHC,QAAAA,gBAAgBH,qBAAqBF,OAAO;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IAAgB,CAAA,GAClEJ,UACAK,0CAAW,QAAA;AAAA,MAAMF,WAAWL,QAAQO;AAAAA,MAAQL,UAAEK;AAAAA,IAAAA,CAAc,CAAC;AAAA,EAAA,CACrD;AAEf,CACF;;;"}
@@ -121,9 +121,9 @@ const getSizeStyles = (size) => ({
121
121
  paddingRight: uikitStyles.theme.space[size],
122
122
  fontSize: uikitStyles.theme.fontSizes[size]
123
123
  });
124
- const getOverrideColors = (variant) => ({
124
+ const getOverrideColors = () => ({
125
125
  "& svg .color0": {
126
- fill: variant === "primary" ? uikitStyles.theme.colors.primary : "currentcolor"
126
+ fill: "currentcolor"
127
127
  }
128
128
  });
129
129
  exports.getOverrideColors = getOverrideColors;
@@ -1 +1 @@
1
- {"version":3,"file":"Button.styles.cjs","sources":["../../../../src/components/Button/Button.styles.ts"],"sourcesContent":["import { CSSInterpolation } from \"@emotion/serialize\";\nimport { theme } from \"@hitachivantara/uikit-styles\";\nimport { createClasses, outlineStyles } from \"@core/utils\";\nimport { HvButtonRadius, HvButtonSize, HvButtonVariant } from \".\";\n\nexport const { staticClasses, useClasses } = createClasses(\"HvButton\", {\n root: {\n display: \"inline-flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n textTransform: \"none\",\n cursor: \"pointer\",\n minWidth: \"70px\",\n\n whiteSpace: \"nowrap\",\n\n \"&:hover\": {},\n \"&:focus\": {},\n \"&:focus-visible\": { ...outlineStyles },\n \"&:active\": {},\n\n // default button - no size specified\n fontFamily: theme.fontFamily.body,\n fontSize: theme.fontSizes.base,\n fontWeight: theme.fontWeights.semibold,\n lineHeight: \"11px\",\n letterSpacing: 0,\n height: \"32px\",\n borderRadius: theme.button.borderRadius,\n padding: theme.button.padding,\n },\n startIcon: {\n marginLeft: `calc(-1 * ${theme.space.xs})`,\n },\n endIcon: {\n marginRight: `calc(-1 * ${theme.space.xs})`,\n },\n focusVisible: {},\n\n disabled: {\n color: theme.colors.secondary_60,\n borderColor: theme.colors.atmo4,\n backgroundColor: theme.colors.atmo3,\n cursor: \"not-allowed\",\n pointerEvents: \"none\",\n },\n\n icon: {\n margin: 0,\n padding: 0,\n height: \"fit-content\",\n minWidth: \"unset\",\n },\n});\n\nexport const getVariantStyles = (variant: HvButtonVariant) => {\n const variantStyles: Record<HvButtonVariant, CSSInterpolation> = {\n primary: {\n color: theme.colors.atmo1,\n backgroundColor: theme.colors.primary,\n \"&:hover, &:focus-visible\": {\n backgroundColor: theme.colors.primary_80,\n },\n },\n primarySubtle: {\n color: theme.colors.primary,\n backgroundColor: \"transparent\",\n border: `1px solid ${theme.colors.primary}`,\n \"&:hover, &:focus-visible\": {\n backgroundColor: theme.button.hoverColor,\n },\n },\n primaryGhost: {\n color: theme.colors.primary,\n backgroundColor: \"transparent\",\n \"&:hover, &:focus-visible\": {\n backgroundColor: theme.button.hoverColor,\n },\n \"&:disabled\": {\n backgroundColor: \"transparent\",\n },\n },\n secondarySubtle: {\n color: theme.colors.secondary,\n backgroundColor: theme.button.secondaryBackgroundColor,\n border: `1px solid ${theme.button.secondarySubtleBorderColor}`,\n \"&:hover, &:focus-visible\": {\n backgroundColor: theme.button.hoverColor,\n },\n },\n secondaryGhost: {\n color: theme.colors.secondary,\n backgroundColor: \"transparent\",\n \"&:hover, &:focus-visible\": {\n backgroundColor: theme.button.hoverColor,\n },\n \"&:disabled\": {\n backgroundColor: \"transparent\",\n },\n },\n semantic: {\n color: theme.colors.base_dark,\n backgroundColor: \"transparent\",\n \"&:hover, &:focus-visible\": {\n backgroundColor: theme.button.semanticColor,\n },\n \"&:disabled\": {\n backgroundColor: theme.button.semanticColorDisabled,\n },\n },\n secondary: undefined,\n ghost: undefined,\n };\n\n return variantStyles[variant];\n};\n\nexport const getRadiusStyles = (radius: HvButtonRadius): CSSInterpolation => ({\n borderRadius: theme.radii[radius],\n});\n\nexport const getSizeStyles = (size: HvButtonSize): CSSInterpolation => ({\n height: theme.sizes[size],\n paddingLeft: theme.space[size],\n paddingRight: theme.space[size],\n fontSize: theme.fontSizes[size],\n});\n\nexport const getOverrideColors = (\n variant: HvButtonVariant\n): CSSInterpolation => ({\n \"& svg .color0\": {\n fill: variant === \"primary\" ? theme.colors.primary : \"currentcolor\",\n },\n});\n"],"names":["staticClasses","useClasses","createClasses","root","display","alignItems","justifyContent","textTransform","cursor","minWidth","whiteSpace","outlineStyles","fontFamily","theme","body","fontSize","fontSizes","base","fontWeight","fontWeights","semibold","lineHeight","letterSpacing","height","borderRadius","button","padding","startIcon","marginLeft","space","xs","endIcon","marginRight","focusVisible","disabled","color","colors","secondary_60","borderColor","atmo4","backgroundColor","atmo3","pointerEvents","icon","margin","getVariantStyles","variant","variantStyles","primary","atmo1","primary_80","primarySubtle","border","hoverColor","primaryGhost","secondarySubtle","secondary","secondaryBackgroundColor","secondarySubtleBorderColor","secondaryGhost","semantic","base_dark","semanticColor","semanticColorDisabled","undefined","ghost","getRadiusStyles","radius","radii","getSizeStyles","size","sizes","paddingLeft","paddingRight","getOverrideColors","fill"],"mappings":";;;;;AAKa,MAAA;AAAA,EAAEA;AAAAA,EAAeC;AAAW,IAAIC,QAAAA,cAAc,YAAY;AAAA,EACrEC,MAAM;AAAA,IACJC,SAAS;AAAA,IACTC,YAAY;AAAA,IACZC,gBAAgB;AAAA,IAChBC,eAAe;AAAA,IACfC,QAAQ;AAAA,IACRC,UAAU;AAAA,IAEVC,YAAY;AAAA,IAEZ,WAAW,CAAC;AAAA,IACZ,WAAW,CAAC;AAAA,IACZ,mBAAmB;AAAA,MAAE,GAAGC,WAAAA;AAAAA,IAAc;AAAA,IACtC,YAAY,CAAC;AAAA;AAAA,IAGbC,YAAYC,YAAAA,MAAMD,WAAWE;AAAAA,IAC7BC,UAAUF,YAAAA,MAAMG,UAAUC;AAAAA,IAC1BC,YAAYL,YAAAA,MAAMM,YAAYC;AAAAA,IAC9BC,YAAY;AAAA,IACZC,eAAe;AAAA,IACfC,QAAQ;AAAA,IACRC,cAAcX,YAAAA,MAAMY,OAAOD;AAAAA,IAC3BE,SAASb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C;AAEaI,MAAAA,oBAAoBA,CAC/B5B,aACsB;AAAA,EACtB,iBAAiB;AAAA,IACf6B,MAAM7B,YAAY,YAAYjC,YAAAA,MAAMuB,OAAOY,UAAU;AAAA,EACvD;AACF;;;;;;;"}
1
+ {"version":3,"file":"Button.styles.cjs","sources":["../../../../src/components/Button/Button.styles.ts"],"sourcesContent":["import { CSSInterpolation } from \"@emotion/serialize\";\nimport { theme } from \"@hitachivantara/uikit-styles\";\nimport { createClasses, outlineStyles } from \"@core/utils\";\nimport { HvButtonRadius, HvButtonSize, HvButtonVariant } from \".\";\n\nexport const { staticClasses, useClasses } = createClasses(\"HvButton\", {\n root: {\n display: \"inline-flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n textTransform: \"none\",\n cursor: \"pointer\",\n minWidth: \"70px\",\n\n whiteSpace: \"nowrap\",\n\n \"&:hover\": {},\n \"&:focus\": {},\n \"&:focus-visible\": { ...outlineStyles },\n \"&:active\": {},\n\n // default button - no size specified\n fontFamily: theme.fontFamily.body,\n fontSize: theme.fontSizes.base,\n fontWeight: theme.fontWeights.semibold,\n lineHeight: \"11px\",\n letterSpacing: 0,\n height: \"32px\",\n borderRadius: theme.button.borderRadius,\n padding: theme.button.padding,\n },\n startIcon: {\n marginLeft: `calc(-1 * ${theme.space.xs})`,\n },\n endIcon: {\n marginRight: `calc(-1 * ${theme.space.xs})`,\n },\n focusVisible: {},\n\n disabled: {\n color: theme.colors.secondary_60,\n borderColor: theme.colors.atmo4,\n backgroundColor: theme.colors.atmo3,\n cursor: \"not-allowed\",\n pointerEvents: \"none\",\n },\n\n icon: {\n margin: 0,\n padding: 0,\n height: \"fit-content\",\n minWidth: \"unset\",\n },\n});\n\nexport const getVariantStyles = (variant: HvButtonVariant) => {\n const variantStyles: Record<HvButtonVariant, CSSInterpolation> = {\n primary: {\n color: theme.colors.atmo1,\n backgroundColor: theme.colors.primary,\n \"&:hover, &:focus-visible\": {\n backgroundColor: theme.colors.primary_80,\n },\n },\n primarySubtle: {\n color: theme.colors.primary,\n backgroundColor: \"transparent\",\n border: `1px solid ${theme.colors.primary}`,\n \"&:hover, &:focus-visible\": {\n backgroundColor: theme.button.hoverColor,\n },\n },\n primaryGhost: {\n color: theme.colors.primary,\n backgroundColor: \"transparent\",\n \"&:hover, &:focus-visible\": {\n backgroundColor: theme.button.hoverColor,\n },\n \"&:disabled\": {\n backgroundColor: \"transparent\",\n },\n },\n secondarySubtle: {\n color: theme.colors.secondary,\n backgroundColor: theme.button.secondaryBackgroundColor,\n border: `1px solid ${theme.button.secondarySubtleBorderColor}`,\n \"&:hover, &:focus-visible\": {\n backgroundColor: theme.button.hoverColor,\n },\n },\n secondaryGhost: {\n color: theme.colors.secondary,\n backgroundColor: \"transparent\",\n \"&:hover, &:focus-visible\": {\n backgroundColor: theme.button.hoverColor,\n },\n \"&:disabled\": {\n backgroundColor: \"transparent\",\n },\n },\n semantic: {\n color: theme.colors.base_dark,\n backgroundColor: \"transparent\",\n \"&:hover, &:focus-visible\": {\n backgroundColor: theme.button.semanticColor,\n },\n \"&:disabled\": {\n backgroundColor: theme.button.semanticColorDisabled,\n },\n },\n secondary: undefined,\n ghost: undefined,\n };\n\n return variantStyles[variant];\n};\n\nexport const getRadiusStyles = (radius: HvButtonRadius): CSSInterpolation => ({\n borderRadius: theme.radii[radius],\n});\n\nexport const getSizeStyles = (size: HvButtonSize): CSSInterpolation => ({\n height: theme.sizes[size],\n paddingLeft: theme.space[size],\n paddingRight: theme.space[size],\n fontSize: theme.fontSizes[size],\n});\n\nexport const getOverrideColors = (): CSSInterpolation => ({\n \"& svg .color0\": {\n fill: \"currentcolor\",\n },\n});\n"],"names":["staticClasses","useClasses","createClasses","root","display","alignItems","justifyContent","textTransform","cursor","minWidth","whiteSpace","outlineStyles","fontFamily","theme","body","fontSize","fontSizes","base","fontWeight","fontWeights","semibold","lineHeight","letterSpacing","height","borderRadius","button","padding","startIcon","marginLeft","space","xs","endIcon","marginRight","focusVisible","disabled","color","colors","secondary_60","borderColor","atmo4","backgroundColor","atmo3","pointerEvents","icon","margin","getVariantStyles","variant","variantStyles","primary","atmo1","primary_80","primarySubtle","border","hoverColor","primaryGhost","secondarySubtle","secondary","secondaryBackgroundColor","secondarySubtleBorderColor","secondaryGhost","semantic","base_dark","semanticColor","semanticColorDisabled","undefined","ghost","getRadiusStyles","radius","radii","getSizeStyles","size","sizes","paddingLeft","paddingRight","getOverrideColors","fill"],"mappings":";;;;;AAKa,MAAA;AAAA,EAAEA;AAAAA,EAAeC;AAAW,IAAIC,QAAAA,cAAc,YAAY;AAAA,EACrEC,MAAM;AAAA,IACJC,SAAS;AAAA,IACTC,YAAY;AAAA,IACZC,gBAAgB;AAAA,IAChBC,eAAe;AAAA,IACfC,QAAQ;AAAA,IACRC,UAAU;AAAA,IAEVC,YAAY;AAAA,IAEZ,WAAW,CAAC;AAAA,IACZ,WAAW,CAAC;AAAA,IACZ,mBAAmB;AAAA,MAAE,GAAGC,WAAAA;AAAAA,IAAc;AAAA,IACtC,YAAY,CAAC;AAAA;AAAA,IAGbC,YAAYC,YAAAA,MAAMD,WAAWE;AAAAA,IAC7BC,UAAUF,YAAAA,MAAMG,UAAUC;AAAAA,IAC1BC,YAAYL,YAAAA,MAAMM,YAAYC;AAAAA,IAC9BC,YAAY;AAAA,IACZC,eAAe;AAAA,IACfC,QAAQ;AAAA,IACRC,cAAcX,YAAAA,MAAMY,OAAOD;AAAAA,IAC3BE,SAASb,YAAAA,MAAMY,OAAOC;AAAAA,EACxB;AAAA,EACAC,WAAW;AAAA,IACTC,YAAa,aAAYf,YAAAA,MAAMgB,MAAMC;AAAAA,EACvC;AAAA,EACAC,SAAS;AAAA,IACPC,aAAc,aAAYnB,YAAAA,MAAMgB,MAAMC;AAAAA,EACxC;AAAA,EACAG,cAAc,CAAC;AAAA,EAEfC,UAAU;AAAA,IACRC,OAAOtB,YAAAA,MAAMuB,OAAOC;AAAAA,IACpBC,aAAazB,YAAAA,MAAMuB,OAAOG;AAAAA,IAC1B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OAAOtB,YAAAA,MAAMuB,OAAOoB;AAAAA,MACpBhB,iBAAiB;AAAA,MACjB,4BAA4B;AAAA,QAC1BA,iBAAiB3B,YAAAA,MAAMY,OAAO4B;AAAAA,MAChC;AAAA,MACA,cAAc;AAAA,QACZb,iBAAiB;AAAA,MACnB;AAAA,IACF;AAAA,IACAoB,UAAU;AAAA,MACRzB,OAAOtB,YAAAA,MAAMuB,OAAOyB;AAAAA,MACpBrB,iBAAiB;AAAA,MACjB,4BAA4B;AAAA,QAC1BA,iBAAiB3B,YAAAA,MAAMY,OAAOqC;AAAAA,MAChC;AAAA,MACA,cAAc;AAAA,QACZtB,iBAAiB3B,YAAAA,MAAMY,OAAOsC;AAAAA,MAChC;AAAA,IACF;AAAA,IACAP,WAAWQ;AAAAA,IACXC,OAAOD;AAAAA,EAAAA;AAGT,SAAOjB,cAAcD,OAAO;AAC9B;AAEaoB,MAAAA,kBAAkBA,CAACC,YAA8C;AAAA,EAC5E3C,cAAcX,YAAAA,MAAMuD,MAAMD,MAAM;AAClC;AAEaE,MAAAA,gBAAgBA,CAACC,UAA0C;AAAA,EACtE/C,QAAQV,YAAAA,MAAM0D,MAAMD,IAAI;AAAA,EACxBE,aAAa3D,YAAAA,MAAMgB,MAAMyC,IAAI;AAAA,EAC7BG,cAAc5D,YAAAA,MAAMgB,MAAMyC,IAAI;AAAA,EAC9BvD,UAAUF,YAAAA,MAAMG,UAAUsD,IAAI;AAChC;AAEO,MAAMI,oBAAoBA,OAAyB;AAAA,EACxD,iBAAiB;AAAA,IACfC,MAAM;AAAA,EACR;AACF;;;;;;;"}
@@ -68,7 +68,7 @@ const HvDrawer = ({
68
68
  children: [/* @__PURE__ */ jsxRuntime.jsx(Button.HvButton, {
69
69
  id: setId.setId(id, "close"),
70
70
  className: classes.closeButton,
71
- variant: "primaryGhost",
71
+ variant: "secondaryGhost",
72
72
  onClick: onClose,
73
73
  "aria-label": buttonTitle,
74
74
  children: /* @__PURE__ */ jsxRuntime.jsx(CloseButtonTooltipWrapper, {})
@@ -1 +1 @@
1
- {"version":3,"file":"Drawer.cjs","sources":["../../../../src/components/Drawer/Drawer.tsx"],"sourcesContent":["import {\n Drawer as MuiDrawer,\n DrawerProps as MuiDrawerProps,\n} from \"@mui/material\";\nimport { Close } from \"@hitachivantara/uikit-react-icons\";\nimport { HvBaseProps } from \"@core/types/generic\";\nimport { withTooltip } from \"@core/hocs\";\nimport {\n hexToRgbA,\n setId,\n checkValidHexColorValue,\n ExtractNames,\n getVarValue,\n} from \"@core/utils\";\nimport { theme } from \"@hitachivantara/uikit-styles\";\nimport { HvButton } from \"@core/components\";\nimport { useEffect, useState } from \"react\";\nimport { useTheme } from \"@core/hooks\";\nimport { staticClasses, useClasses } from \"./Drawer.styles\";\n\nexport { staticClasses as drawerClasses };\n\nexport type HvDrawerClasses = ExtractNames<typeof useClasses>;\n\nexport interface HvDrawerProps\n extends MuiDrawerProps,\n Omit<MuiDrawerProps, \"classes\">,\n HvBaseProps<HTMLDivElement> {\n /**\n * Class names to be applied.\n */\n className?: string;\n /**\n * Id to be applied to the root node.\n */\n id?: string;\n /**\n * A Jss Object used to override or extend the styles applied.\n */\n classes?: HvDrawerClasses;\n /**\n * Components of the Drawer.\n */\n children?: React.ReactNode;\n /**\n * Current state of the Drawer.\n */\n open?: boolean;\n /**\n * Function executed on close.\n * Extended from Modal from material-ui\n *\n */\n onClose?: (\n event: React.SyntheticEvent,\n reason?: \"escapeKeyDown\" | \"backdropClick\"\n ) => void;\n /**\n * The side the drawer opens from.\n */\n anchor?: \"left\" | \"top\" | \"right\" | \"bottom\";\n /**\n * Title for the button close.\n */\n buttonTitle?: string;\n}\n\nconst getBackgroundColor = (color: string) => {\n return checkValidHexColorValue(color) ? hexToRgbA(color, 0.8) : color;\n};\n\n/**\n * The Drawer component provides a foundation to create a sliding pane.\n * It only provides the pane with a close button, the rest of the\n * content can be customized.\n */\nexport const HvDrawer = ({\n className,\n classes: classesProp,\n id,\n children,\n open,\n onClose,\n anchor = \"right\",\n buttonTitle = \"Close\",\n ...others\n}: HvDrawerProps) => {\n const { classes, css, cx } = useClasses(classesProp);\n const { activeTheme, rootId } = useTheme();\n\n const [backgroundColorValue, setBackgroundColorValue] = useState<string>(\n getVarValue(theme.drawer.backDropBackgroundColor, rootId) || \"\"\n );\n\n const closeButtonDisplay = () => <Close role=\"presentation\" />;\n\n const CloseButtonTooltipWrapper = buttonTitle\n ? withTooltip(closeButtonDisplay, buttonTitle, \"top\")\n : closeButtonDisplay;\n\n const [backgroundColor, setBackgroundColor] = useState(\n getBackgroundColor(backgroundColorValue)\n );\n\n useEffect(() => {\n setBackgroundColorValue(\n getVarValue(theme.drawer.backDropBackgroundColor, rootId) ||\n activeTheme?.drawer.backDropBackgroundColor ||\n \"\"\n );\n\n setBackgroundColor(getBackgroundColor(backgroundColorValue));\n }, [\n activeTheme?.colors.modes.selectedMode,\n backgroundColorValue,\n setBackgroundColor,\n rootId,\n activeTheme?.drawer.backDropBackgroundColor,\n ]);\n\n return (\n <MuiDrawer\n className={cx(classes.root, className)}\n id={id}\n anchor={anchor}\n open={open}\n PaperProps={{\n classes: {\n root: classes.paper,\n },\n }}\n BackdropProps={{\n classes: {\n root: cx(css({ backgroundColor }), classes.background),\n },\n }}\n onClose={onClose}\n {...others}\n >\n <HvButton\n id={setId(id, \"close\")}\n className={classes.closeButton}\n variant=\"primaryGhost\"\n onClick={onClose}\n aria-label={buttonTitle}\n >\n <CloseButtonTooltipWrapper />\n </HvButton>\n {children}\n </MuiDrawer>\n );\n};\n"],"names":["getBackgroundColor","color","checkValidHexColorValue","hexToRgbA","HvDrawer","className","classes","classesProp","id","children","open","onClose","anchor","buttonTitle","others","css","cx","useClasses","activeTheme","rootId","useTheme","backgroundColorValue","setBackgroundColorValue","useState","getVarValue","theme","drawer","backDropBackgroundColor","closeButtonDisplay","_jsx","Close","role","CloseButtonTooltipWrapper","withTooltip","backgroundColor","setBackgroundColor","useEffect","colors","modes","selectedMode","MuiDrawer","root","PaperProps","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QAAQmC,MAAMpC,SAAS;AAAA,IACrCG;AAAAA,IACAI;AAAAA,IACAF;AAAAA,IACAgC,YAAY;AAAA,MACVpC,SAAS;AAAA,QACPmC,MAAMnC,QAAQqC;AAAAA,MAChB;AAAA,IACF;AAAA,IACAC,eAAe;AAAA,MACbtC,SAAS;AAAA,QACPmC,MAAMzB,GAAGD,IAAI;AAAA,UAAEmB;AAAAA,QAAAA,CAAiB,GAAG5B,QAAQuC,UAAU;AAAA,MACvD;AAAA,IACF;AAAA,IACAlC;AAAAA,IAAiB,GACbG;AAAAA,IAAML,UAAA,CAEVoB,2BAAAA,IAACiB,iBAAQ;AAAA,MACPtC,IAAIuC,MAAAA,MAAMvC,IAAI,OAAO;AAAA,MACrBH,WAAWC,QAAQ0C;AAAAA,MACnBC,SAAQ;AAAA,MACRC,SAASvC;AAAAA,MACT,cAAYE;AAAAA,MAAYJ,UAExBoB,2BAAAA,IAACG,2BAA2B,EAAA;AAAA,IACpB,CAAA,GACTvB,QAAQ;AAAA,EAAA,CACA;AAEf;;;"}
1
+ {"version":3,"file":"Drawer.cjs","sources":["../../../../src/components/Drawer/Drawer.tsx"],"sourcesContent":["import {\n Drawer as MuiDrawer,\n DrawerProps as MuiDrawerProps,\n} from \"@mui/material\";\nimport { Close } from \"@hitachivantara/uikit-react-icons\";\nimport { HvBaseProps } from \"@core/types/generic\";\nimport { withTooltip } from \"@core/hocs\";\nimport {\n hexToRgbA,\n setId,\n checkValidHexColorValue,\n ExtractNames,\n getVarValue,\n} from \"@core/utils\";\nimport { theme } from \"@hitachivantara/uikit-styles\";\nimport { HvButton } from \"@core/components\";\nimport { useEffect, useState } from \"react\";\nimport { useTheme } from \"@core/hooks\";\nimport { staticClasses, useClasses } from \"./Drawer.styles\";\n\nexport { staticClasses as drawerClasses };\n\nexport type HvDrawerClasses = ExtractNames<typeof useClasses>;\n\nexport interface HvDrawerProps\n extends MuiDrawerProps,\n Omit<MuiDrawerProps, \"classes\">,\n HvBaseProps<HTMLDivElement> {\n /**\n * Class names to be applied.\n */\n className?: string;\n /**\n * Id to be applied to the root node.\n */\n id?: string;\n /**\n * A Jss Object used to override or extend the styles applied.\n */\n classes?: HvDrawerClasses;\n /**\n * Components of the Drawer.\n */\n children?: React.ReactNode;\n /**\n * Current state of the Drawer.\n */\n open?: boolean;\n /**\n * Function executed on close.\n * Extended from Modal from material-ui\n *\n */\n onClose?: (\n event: React.SyntheticEvent,\n reason?: \"escapeKeyDown\" | \"backdropClick\"\n ) => void;\n /**\n * The side the drawer opens from.\n */\n anchor?: \"left\" | \"top\" | \"right\" | \"bottom\";\n /**\n * Title for the button close.\n */\n buttonTitle?: string;\n}\n\nconst getBackgroundColor = (color: string) => {\n return checkValidHexColorValue(color) ? hexToRgbA(color, 0.8) : color;\n};\n\n/**\n * The Drawer component provides a foundation to create a sliding pane.\n * It only provides the pane with a close button, the rest of the\n * content can be customized.\n */\nexport const HvDrawer = ({\n className,\n classes: classesProp,\n id,\n children,\n open,\n onClose,\n anchor = \"right\",\n buttonTitle = \"Close\",\n ...others\n}: HvDrawerProps) => {\n const { classes, css, cx } = useClasses(classesProp);\n const { activeTheme, rootId } = useTheme();\n\n const [backgroundColorValue, setBackgroundColorValue] = useState<string>(\n getVarValue(theme.drawer.backDropBackgroundColor, rootId) || \"\"\n );\n\n const closeButtonDisplay = () => <Close role=\"presentation\" />;\n\n const CloseButtonTooltipWrapper = buttonTitle\n ? withTooltip(closeButtonDisplay, buttonTitle, \"top\")\n : closeButtonDisplay;\n\n const [backgroundColor, setBackgroundColor] = useState(\n getBackgroundColor(backgroundColorValue)\n );\n\n useEffect(() => {\n setBackgroundColorValue(\n getVarValue(theme.drawer.backDropBackgroundColor, rootId) ||\n activeTheme?.drawer.backDropBackgroundColor ||\n \"\"\n );\n\n setBackgroundColor(getBackgroundColor(backgroundColorValue));\n }, [\n activeTheme?.colors.modes.selectedMode,\n backgroundColorValue,\n setBackgroundColor,\n rootId,\n activeTheme?.drawer.backDropBackgroundColor,\n ]);\n\n return (\n <MuiDrawer\n className={cx(classes.root, className)}\n id={id}\n anchor={anchor}\n open={open}\n PaperProps={{\n classes: {\n root: classes.paper,\n },\n }}\n BackdropProps={{\n classes: {\n root: cx(css({ backgroundColor }), classes.background),\n },\n }}\n onClose={onClose}\n {...others}\n >\n <HvButton\n id={setId(id, \"close\")}\n className={classes.closeButton}\n variant=\"secondaryGhost\"\n onClick={onClose}\n aria-label={buttonTitle}\n >\n <CloseButtonTooltipWrapper />\n </HvButton>\n {children}\n </MuiDrawer>\n );\n};\n"],"names":["getBackgroundColor","color","checkValidHexColorValue","hexToRgbA","HvDrawer","className","classes","classesProp","id","children","open","onClose","anchor","buttonTitle","others","css","cx","useClasses","activeTheme","rootId","useTheme","backgroundColorValue","setBackgroundColorValue","useState","getVarValue","theme","drawer","backDropBackgroundColor","closeButtonDisplay","_jsx","Close","role","CloseButtonTooltipWrapper","withTooltip","backgroundColor","setBackgroundColor","useEffect","colors","modes","selectedMode","MuiDrawer","root","PaperProps","paper","BackdropProps","background","HvButton","setId","closeButton","variant","onClick"],"mappings":";;;;;;;;;;;;;;;AAmEA,MAAMA,qBAAqBA,CAACC,UAAkB;AAC5C,SAAOC,wBAAAA,QAAwBD,KAAK,IAAIE,UAAAA,QAAUF,OAAO,GAAG,IAAIA;AAClE;AAOO,MAAMG,WAAWA,CAAC;AAAA,EACvBC;AAAAA,EACAC,SAASC;AAAAA,EACTC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC,SAAS;AAAA,EACTC,cAAc;AAAA,EACd,GAAGC;AACU,MAAM;AACb,QAAA;AAAA,IAAER;AAAAA,IAASS;AAAAA,IAAKC;AAAAA,EAAAA,IAAOC,cAAAA,WAAWV,WAAW;AAC7C,QAAA;AAAA,IAAEW;AAAAA,IAAaC;AAAAA,MAAWC,SAAS,SAAA;AAEnC,QAAA,CAACC,sBAAsBC,uBAAuB,IAAIC,MAAAA,SACtDC,MAAYC,YAAAA,kBAAMC,OAAOC,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,QAAQ;AAAA,EAAA,CACA;AAEf;;;"}
@@ -13,7 +13,7 @@ const HvTypographyMap = {
13
13
  title3: "h3",
14
14
  title4: "h4",
15
15
  body: "p",
16
- label: "label",
16
+ label: "span",
17
17
  caption1: "p",
18
18
  caption2: "p",
19
19
  // LEGACY
@@ -1 +1 @@
1
- {"version":3,"file":"Typography.cjs","sources":["../../../../src/components/Typography/Typography.tsx"],"sourcesContent":["import { forwardRef, AllHTMLAttributes, Ref } from \"react\";\nimport { HvBaseProps } from \"@core/types\";\nimport { ExtractNames } from \"@core/utils\";\nimport { useTheme } from \"@core/hooks\";\nimport { mapVariant } from \"./utils\";\nimport { staticClasses, useClasses } from \"./Typography.styles\";\n\nexport { staticClasses as typographyClasses };\n\nexport type HvTypographyClasses = ExtractNames<typeof useClasses>;\n\nexport const typographyVariants = [\n \"display\",\n \"title1\",\n \"title2\",\n \"title3\",\n \"title4\",\n \"body\",\n \"label\",\n \"caption1\",\n \"caption2\",\n] as const;\n\nexport type HvTypographyVariants = (typeof typographyVariants)[number];\n\n/** @deprecated */\nexport type HvTypographyLegacyVariants =\n | \"5xlTitle\"\n | \"4xlTitle\"\n | \"3xlTitle\"\n | \"xxlTitle\"\n | \"xlTitle\"\n | \"lTitle\"\n | \"mTitle\"\n | \"sTitle\"\n | \"xsTitle\"\n | \"xxsTitle\"\n | \"sectionTitle\"\n | \"highlightText\"\n | \"normalText\"\n | \"placeholderText\"\n | \"link\"\n | \"disabledText\"\n | \"selectedNavText\"\n | \"vizText\"\n | \"vizTextDisabled\"\n | \"xsInlineLink\";\n\nconst HvTypographyMap = {\n display: \"h1\",\n title1: \"h1\",\n title2: \"h2\",\n title3: \"h3\",\n title4: \"h4\",\n body: \"p\",\n label: \"label\",\n caption1: \"p\",\n caption2: \"p\",\n // LEGACY\n \"5xlTitle\": \"h1\",\n \"4xlTitle\": \"h1\",\n xxlTitle: \"h1\",\n lTitle: \"h2\",\n sTitle: \"h4\",\n xxsTitle: \"h6\",\n sectionTitle: \"p\",\n placeholderText: \"p\",\n link: \"p\",\n disabledText: \"p\",\n selectedNavText: \"p\",\n vizTextDisabled: \"p\",\n xsInlineLink: \"p\",\n} as const;\n\nexport interface HvTypographyProps\n extends Omit<AllHTMLAttributes<HTMLElement>, \"disabled\">,\n HvBaseProps<HTMLElement> {\n component?: React.ElementType;\n /** Use the variant prop to change the visual style of the Typography. */\n variant?: HvTypographyVariants | HvTypographyLegacyVariants;\n /** If `true` the typography will display the look of a link. */\n link?: boolean;\n /** If `true` the typography will display the look of a disabled state. */\n disabled?: boolean;\n /** If `true`, the text will have a bottom margin. */\n paragraph?: boolean;\n /**\n * If `true`, the text will not wrap, but instead will truncate with a text overflow ellipsis.\n *\n * Note that text overflow can only happen with block or inline-block level elements\n * (the element needs to have a width in order to overflow).\n */\n noWrap?: boolean;\n /** A Jss Object used to override or extend the styles applied to the component. */\n classes?: HvTypographyClasses;\n}\n\n/**\n * Typography component is used to render text and paragraphs within an interface.\n */\nexport const HvTypography = forwardRef(\n (props: HvTypographyProps, ref: Ref<HTMLElement>) => {\n const {\n className,\n component: ComponentProp,\n classes: classesProp,\n variant: variantProp = \"body\",\n link = false,\n disabled = false,\n noWrap = false,\n paragraph = false,\n ...others\n } = props;\n const { classes, cx } = useClasses(classesProp);\n const { activeTheme } = useTheme();\n\n const variant = mapVariant(variantProp, activeTheme?.name);\n\n const Component =\n ComponentProp || (paragraph && \"p\") || HvTypographyMap[variant] || \"span\";\n\n return (\n <Component\n ref={ref}\n className={cx(classes.root, classes[variant], className, {\n [classes.isLink]: link,\n [classes.noWrap]: noWrap,\n [classes.disabled]: disabled,\n })}\n {...others}\n />\n );\n }\n);\n"],"names":["typographyVariants","HvTypographyMap","display","title1","title2","title3","title4","body","label","caption1","caption2","xxlTitle","lTitle","sTitle","xxsTitle","sectionTitle","placeholderText","link","disabledText","selectedNavText","vizTextDisabled","xsInlineLink","HvTypography","forwardRef","props","ref","className","component","ComponentProp","classes","classesProp","variant","variantProp","disabled","noWrap","paragraph","others","cx","useClasses","activeTheme","useTheme","mapVariant","name","Component","root","isLink"],"mappings":";;;;;;;AAWaA,MAAAA,qBAAqB,CAChC,WACA,UACA,UACA,UACA,UACA,QACA,SACA,YACA,UAAU;AA4BZ,MAAMC,kBAAkB;AAAA,EACtBC,SAAS;AAAA,EACTC,QAAQ;AAAA,EACRC,QAAQ;AAAA,EACRC,QAAQ;AAAA,EACRC,QAAQ;AAAA,EACRC,MAAM;AAAA,EACNC,OAAO;AAAA,EACPC,UAAU;AAAA,EACVC,UAAU;AAAA;AAAA,EAEV,YAAY;AAAA,EACZ,YAAY;AAAA,EACZC,UAAU;AAAA,EACVC,QAAQ;AAAA,EACRC,QAAQ;AAAA,EACRC,UAAU;AAAA,EACVC,cAAc;AAAA,EACdC,iBAAiB;AAAA,EACjBC,MAAM;AAAA,EACNC,cAAc;AAAA,EACdC,iBAAiB;AAAA,EACjBC,iBAAiB;AAAA,EACjBC,cAAc;AAChB;AA4BO,MAAMC,eAAeC,MAAAA,WAC1B,CAACC,OAA0BC,QAA0B;AAC7C,QAAA;AAAA,IACJC;AAAAA,IACAC,WAAWC;AAAAA,IACXC,SAASC;AAAAA,IACTC,SAASC,cAAc;AAAA,IACvBf,OAAO;AAAA,IACPgB,WAAW;AAAA,IACXC,SAAS;AAAA,IACTC,YAAY;AAAA,IACZ,GAAGC;AAAAA,EACDZ,IAAAA;AACE,QAAA;AAAA,IAAEK;AAAAA,IAASQ;AAAAA,EAAAA,IAAOC,kBAAAA,WAAWR,WAAW;AACxC,QAAA;AAAA,IAAES;AAAAA,MAAgBC,SAAS,SAAA;AAEjC,QAAMT,UAAUU,MAAAA,WAAWT,aAAaO,2CAAaG,IAAI;AAEzD,QAAMC,YACJf,iBAAkBO,aAAa,OAAQlC,gBAAgB8B,OAAO,KAAK;AAErE,wCACGY,WAAS;AAAA,IACRlB;AAAAA,IACAC,WAAWW,GAAGR,QAAQe,MAAMf,QAAQE,OAAO,GAAGL,WAAW;AAAA,MACvD,CAACG,QAAQgB,MAAM,GAAG5B;AAAAA,MAClB,CAACY,QAAQK,MAAM,GAAGA;AAAAA,MAClB,CAACL,QAAQI,QAAQ,GAAGA;AAAAA,IAAAA,CACrB;AAAA,IAAE,GACCG;AAAAA,EAAAA,CACL;AAEL,CACF;;;;"}
1
+ {"version":3,"file":"Typography.cjs","sources":["../../../../src/components/Typography/Typography.tsx"],"sourcesContent":["import { forwardRef, AllHTMLAttributes, Ref } from \"react\";\nimport { HvBaseProps } from \"@core/types\";\nimport { ExtractNames } from \"@core/utils\";\nimport { useTheme } from \"@core/hooks\";\nimport { mapVariant } from \"./utils\";\nimport { staticClasses, useClasses } from \"./Typography.styles\";\n\nexport { staticClasses as typographyClasses };\n\nexport type HvTypographyClasses = ExtractNames<typeof useClasses>;\n\nexport const typographyVariants = [\n \"display\",\n \"title1\",\n \"title2\",\n \"title3\",\n \"title4\",\n \"body\",\n \"label\",\n \"caption1\",\n \"caption2\",\n] as const;\n\nexport type HvTypographyVariants = (typeof typographyVariants)[number];\n\n/** @deprecated */\nexport type HvTypographyLegacyVariants =\n | \"5xlTitle\"\n | \"4xlTitle\"\n | \"3xlTitle\"\n | \"xxlTitle\"\n | \"xlTitle\"\n | \"lTitle\"\n | \"mTitle\"\n | \"sTitle\"\n | \"xsTitle\"\n | \"xxsTitle\"\n | \"sectionTitle\"\n | \"highlightText\"\n | \"normalText\"\n | \"placeholderText\"\n | \"link\"\n | \"disabledText\"\n | \"selectedNavText\"\n | \"vizText\"\n | \"vizTextDisabled\"\n | \"xsInlineLink\";\n\nconst HvTypographyMap = {\n display: \"h1\",\n title1: \"h1\",\n title2: \"h2\",\n title3: \"h3\",\n title4: \"h4\",\n body: \"p\",\n label: \"span\",\n caption1: \"p\",\n caption2: \"p\",\n // LEGACY\n \"5xlTitle\": \"h1\",\n \"4xlTitle\": \"h1\",\n xxlTitle: \"h1\",\n lTitle: \"h2\",\n sTitle: \"h4\",\n xxsTitle: \"h6\",\n sectionTitle: \"p\",\n placeholderText: \"p\",\n link: \"p\",\n disabledText: \"p\",\n selectedNavText: \"p\",\n vizTextDisabled: \"p\",\n xsInlineLink: \"p\",\n} as const;\n\nexport interface HvTypographyProps\n extends Omit<AllHTMLAttributes<HTMLElement>, \"disabled\">,\n HvBaseProps<HTMLElement> {\n component?: React.ElementType;\n /** Use the variant prop to change the visual style of the Typography. */\n variant?: HvTypographyVariants | HvTypographyLegacyVariants;\n /** If `true` the typography will display the look of a link. */\n link?: boolean;\n /** If `true` the typography will display the look of a disabled state. */\n disabled?: boolean;\n /** If `true`, the text will have a bottom margin. */\n paragraph?: boolean;\n /**\n * If `true`, the text will not wrap, but instead will truncate with a text overflow ellipsis.\n *\n * Note that text overflow can only happen with block or inline-block level elements\n * (the element needs to have a width in order to overflow).\n */\n noWrap?: boolean;\n /** A Jss Object used to override or extend the styles applied to the component. */\n classes?: HvTypographyClasses;\n}\n\n/**\n * Typography component is used to render text and paragraphs within an interface.\n */\nexport const HvTypography = forwardRef(\n (props: HvTypographyProps, ref: Ref<HTMLElement>) => {\n const {\n className,\n component: ComponentProp,\n classes: classesProp,\n variant: variantProp = \"body\",\n link = false,\n disabled = false,\n noWrap = false,\n paragraph = false,\n ...others\n } = props;\n const { classes, cx } = useClasses(classesProp);\n const { activeTheme } = useTheme();\n\n const variant = mapVariant(variantProp, activeTheme?.name);\n\n const Component =\n ComponentProp || (paragraph && \"p\") || HvTypographyMap[variant] || \"span\";\n\n return (\n <Component\n ref={ref}\n className={cx(classes.root, classes[variant], className, {\n [classes.isLink]: link,\n [classes.noWrap]: noWrap,\n [classes.disabled]: disabled,\n })}\n {...others}\n />\n );\n }\n);\n"],"names":["typographyVariants","HvTypographyMap","display","title1","title2","title3","title4","body","label","caption1","caption2","xxlTitle","lTitle","sTitle","xxsTitle","sectionTitle","placeholderText","link","disabledText","selectedNavText","vizTextDisabled","xsInlineLink","HvTypography","forwardRef","props","ref","className","component","ComponentProp","classes","classesProp","variant","variantProp","disabled","noWrap","paragraph","others","cx","use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AM,GAAG5B;AAAAA,MAClB,CAACY,QAAQK,MAAM,GAAGA;AAAAA,MAClB,CAACL,QAAQI,QAAQ,GAAGA;AAAAA,IAAAA,CACrB;AAAA,IAAE,GACCG;AAAAA,EAAAA,CACL;AAEL,CACF;;;;"}
@@ -45,7 +45,7 @@ const HvButton = forwardRef((props, ref) => {
45
45
  return /* @__PURE__ */ jsxs(Component, {
46
46
  ref,
47
47
  type: "button",
48
- className: cx(classes.root, css(getVariantStyles(variant)), size && css(getSizeStyles(size)), radius && css(getRadiusStyles(radius)), overrideIconColors && css(getOverrideColors(variant)), {
48
+ className: cx(classes.root, css(getVariantStyles(variant)), size && css(getSizeStyles(size)), radius && css(getRadiusStyles(radius)), overrideIconColors && css(getOverrideColors()), {
49
49
  [classes.icon]: icon,
50
50
  [classes.disabled]: disabled
51
51
  }, className),
@@ -1 +1 @@
1
- {"version":3,"file":"Button.js","sources":["../../../../src/components/Button/Button.tsx"],"sourcesContent":["import React, { forwardRef, ReactElement } from \"react\";\nimport { useTheme } from \"@core/hooks\";\nimport { PolymorphicComponentRef, PolymorphicRef } from \"@core/types\";\nimport { ExtractNames } from \"@core/utils\";\nimport {\n staticClasses as buttonClasses,\n getOverrideColors,\n getRadiusStyles,\n getSizeStyles,\n getVariantStyles,\n useClasses,\n} from \"./Button.styles\";\n\nexport { buttonClasses };\n\nexport type HvButtonClasses = ExtractNames<typeof useClasses>;\n\nexport const buttonVariant = [\n \"primary\",\n \"primarySubtle\",\n \"primaryGhost\",\n \"secondarySubtle\",\n \"secondaryGhost\",\n \"semantic\",\n // deprecated props\n \"secondary\",\n \"ghost\",\n] as const;\nexport type HvButtonVariant = (typeof buttonVariant)[number];\n\nexport const buttonSize = [\"xs\", \"sm\", \"md\", \"lg\", \"xl\"] as const;\nexport type HvButtonSize = (typeof buttonSize)[number];\n\nexport const buttonRadius = [\n \"none\",\n \"base\",\n \"round\",\n \"circle\",\n \"full\",\n] as const;\nexport type HvButtonRadius = (typeof buttonRadius)[number];\n\nexport type HvButtonProps<C extends React.ElementType = \"button\"> =\n PolymorphicComponentRef<\n C,\n {\n /** Use the variant prop to change the visual style of the Button. */\n variant?: HvButtonVariant;\n /** Whether the Button is an icon-only button. */\n icon?: boolean;\n /** Whether the Button is disabled or not. */\n disabled?: boolean;\n /** Class names to be applied. */\n className?: string;\n /** Element placed before the children. */\n startIcon?: ReactElement;\n /** Element placed after the children. */\n endIcon?: ReactElement;\n /** Button size. */\n size?: HvButtonSize;\n /** Button border radius. */\n radius?: HvButtonRadius;\n /** Defines the default colors of the button are forced into the icon. */\n overrideIconColors?: boolean;\n /** A Jss Object used to override or extend the styles applied. */\n classes?: HvButtonClasses;\n /** Whether the Button is selected or not. */\n selected?: boolean;\n }\n >;\n\n/**\n * Normalize the button variant. It's meant to give us some retro-compatibility with\n * the DS 3.6 API.\n * @returns the normalized variant in DS 5 API\n */\nconst mapVariant = (\n variant: HvButtonVariant,\n theme?: string\n): HvButtonVariant => {\n if (theme === \"ds3\") return variant;\n\n const deprecatedVariantMap: Record<string, HvButtonVariant> = {\n secondary: \"secondarySubtle\",\n ghost: \"primaryGhost\",\n };\n\n const mappedVariant = deprecatedVariantMap[variant];\n\n if (mappedVariant) {\n // eslint-disable-next-line no-console\n console.warn(\n `Button variant '${variant}' is deprecated. Please use '${mappedVariant}'.`\n );\n }\n\n return mappedVariant || variant;\n};\n\n/**\n * Button component is used to trigger an action or event.\n */\nexport const HvButton: <C extends React.ElementType = \"button\">(\n props: HvButtonProps<C>\n) => React.ReactElement | null = forwardRef(\n <C extends React.ElementType = \"button\">(\n props: HvButtonProps<C>,\n ref: PolymorphicRef<C>\n ) => {\n const {\n id,\n classes: classesProp,\n children,\n variant: variantProp = \"primary\",\n disabled = false,\n className,\n startIcon,\n endIcon,\n icon = false,\n size,\n radius,\n overrideIconColors = true,\n component: Component = \"button\",\n ...others\n } = props;\n const { classes, css, cx } = useClasses(classesProp);\n const { activeTheme } = useTheme();\n\n const variant = mapVariant(variantProp, activeTheme?.name);\n\n return (\n <Component\n ref={ref}\n type=\"button\"\n className={cx(\n classes.root,\n css(getVariantStyles(variant)),\n size && css(getSizeStyles(size)),\n radius && css(getRadiusStyles(radius)),\n overrideIconColors && css(getOverrideColors(variant)),\n {\n [classes.icon]: icon,\n [classes.disabled]: disabled,\n },\n className\n )}\n {...(disabled && {\n disabled: true,\n tabIndex: -1,\n \"aria-disabled\": true,\n })}\n {...others}\n >\n {startIcon && <span className={classes.startIcon}>{startIcon}</span>}\n {children}\n {endIcon && <span className={classes.endIcon}>{endIcon}</span>}\n </Component>\n );\n }\n);\n"],"names":["mapVariant","variant","theme","deprecatedVariantMap","secondary","ghost","mappedVariant","warn","HvButton","forwardRef","props","ref","id","classes","classesProp","children","variantProp","disabled","className","startIcon","endIcon","icon","size","radius","overrideIconColors","component","Component","others","css","cx","useClasses","activeTheme","useTheme","name","type","root","getVariantStyles","getSizeStyles","getRadiusStyles","getOverrideColors","tabIndex","_jsx"],"mappings":";;;;;AA4EA,MAAMA,aAAaA,CACjBC,SACAC,UACoB;AACpB,MAAIA,UAAU;AAAcD,WAAAA;AAE5B,QAAME,uBAAwD;AAAA,IAC5DC,WAAW;AAAA,IACXC,OAAO;AAAA,EAAA;AAGHC,QAAAA,gBAAgBH,qBAAqBF,OAAO;AAElD,MAAIK,eAAe;AAETC,YAAAA,KACL,mBAAkBN,uCAAuCK,iBAC5D;AAAA,EACF;AAEA,SAAOA,iBAAiBL;AAC1B;AAKO,MAAMO,WAEoBC,WAC/B,CACEC,OACAC,QACG;AACG,QAAA;AAAA,IACJC;AAAAA,IACAC,SAASC;AAAAA,IACTC;AAAAA,IACAd,SAASe,cAAc;AAAA,IACvBC,WAAW;AAAA,IACXC;AAAAA,IACAC;AAAAA,IACAC;AAAAA,IACAC,OAAO;AAAA,IACPC;AAAAA,IACAC;AAAAA,IACAC,qBAAqB;AAAA,IACrBC,WAAWC,YAAY;AAAA,IACvB,GAAGC;AAAAA,EACDjB,IAAAA;AACE,QAAA;AAAA,IAAEG;AAAAA,IAASe;AAAAA,IAAKC;AAAAA,EAAAA,IAAOC,WAAWhB,WAAW;AAC7C,QAAA;AAAA,IAAEiB;AAAAA,MAAgBC,SAAS;AAEjC,QAAM/B,UAAUD,WAAWgB,aAAae,2CAAaE,IAAI;AAEzD,8BACGP,WAAS;AAAA,IACRf;AAAAA,IACAuB,MAAK;AAAA,IACLhB,WAAWW,GACThB,QAAQsB,MACRP,IAAIQ,iBAAiBnC,OAAO,CAAC,GAC7BqB,QAAQM,IAAIS,cAAcf,IAAI,CAAC,GAC/BC,UAAUK,IAAIU,gBAAgBf,MAAM,CAAC,GACrCC,sBAAsBI,IAAIW,kBAAkBtC,OAAO,CAAC,GACpD;AAAA,MACE,CAACY,QAAQQ,IAAI,GAAGA;AAAAA,MAChB,CAACR,QAAQI,QAAQ,GAAGA;AAAAA,OAEtBC,SACF;AAAA,IAAE,GACGD,YAAY;AAAA,MACfA,UAAU;AAAA,MACVuB,UAAU;AAAA,MACV,iBAAiB;AAAA,IACnB;AAAA,IAAC,GACGb;AAAAA,IAAMZ,UAAA,CAETI,aAAasB,oBAAA,QAAA;AAAA,MAAMvB,WAAWL,QAAQM;AAAAA,MAAUJ,UAAEI;AAAAA,IAAgB,CAAA,GAClEJ,UACAK,+BAAW,QAAA;AAAA,MAAMF,WAAWL,QAAQO;AAAAA,MAAQL,UAAEK;AAAAA,IAAAA,CAAc,CAAC;AAAA,EAAA,CACrD;AAEf,CACF;"}
1
+ {"version":3,"file":"Button.js","sources":["../../../../src/components/Button/Button.tsx"],"sourcesContent":["import React, { forwardRef, ReactElement } from \"react\";\nimport { useTheme } from \"@core/hooks\";\nimport { PolymorphicComponentRef, PolymorphicRef } from \"@core/types\";\nimport { ExtractNames } from \"@core/utils\";\nimport {\n staticClasses as buttonClasses,\n getOverrideColors,\n getRadiusStyles,\n getSizeStyles,\n getVariantStyles,\n useClasses,\n} from \"./Button.styles\";\n\nexport { buttonClasses };\n\nexport type HvButtonClasses = ExtractNames<typeof useClasses>;\n\nexport const buttonVariant = [\n \"primary\",\n \"primarySubtle\",\n \"primaryGhost\",\n \"secondarySubtle\",\n \"secondaryGhost\",\n \"semantic\",\n // deprecated props\n \"secondary\",\n \"ghost\",\n] as const;\nexport type HvButtonVariant = (typeof buttonVariant)[number];\n\nexport const buttonSize = [\"xs\", \"sm\", \"md\", \"lg\", \"xl\"] as const;\nexport type HvButtonSize = (typeof buttonSize)[number];\n\nexport const buttonRadius = [\n \"none\",\n \"base\",\n \"round\",\n \"circle\",\n \"full\",\n] as const;\nexport type HvButtonRadius = (typeof buttonRadius)[number];\n\nexport type HvButtonProps<C extends React.ElementType = \"button\"> =\n PolymorphicComponentRef<\n C,\n {\n /** Use the variant prop to change the visual style of the Button. */\n variant?: HvButtonVariant;\n /** Whether the Button is an icon-only button. */\n icon?: boolean;\n /** Whether the Button is disabled or not. */\n disabled?: boolean;\n /** Class names to be applied. */\n className?: string;\n /** Element placed before the children. */\n startIcon?: ReactElement;\n /** Element placed after the children. */\n endIcon?: ReactElement;\n /** Button size. */\n size?: HvButtonSize;\n /** Button border radius. */\n radius?: HvButtonRadius;\n /** Defines the default colors of the button are forced into the icon. */\n overrideIconColors?: boolean;\n /** A Jss Object used to override or extend the styles applied. */\n classes?: HvButtonClasses;\n /** Whether the Button is selected or not. */\n selected?: boolean;\n }\n >;\n\n/**\n * Normalize the button variant. It's meant to give us some retro-compatibility with\n * the DS 3.6 API.\n * @returns the normalized variant in DS 5 API\n */\nconst mapVariant = (\n variant: HvButtonVariant,\n theme?: string\n): HvButtonVariant => {\n if (theme === \"ds3\") return variant;\n\n const deprecatedVariantMap: Record<string, HvButtonVariant> = {\n secondary: \"secondarySubtle\",\n ghost: \"primaryGhost\",\n };\n\n const mappedVariant = deprecatedVariantMap[variant];\n\n if (mappedVariant) {\n // eslint-disable-next-line no-console\n console.warn(\n `Button variant '${variant}' is deprecated. Please use '${mappedVariant}'.`\n );\n }\n\n return mappedVariant || variant;\n};\n\n/**\n * Button component is used to trigger an action or event.\n */\nexport const HvButton: <C extends React.ElementType = \"button\">(\n props: HvButtonProps<C>\n) => React.ReactElement | null = forwardRef(\n <C extends React.ElementType = \"button\">(\n props: HvButtonProps<C>,\n ref: PolymorphicRef<C>\n ) => {\n const {\n id,\n classes: classesProp,\n children,\n variant: variantProp = \"primary\",\n disabled = false,\n className,\n startIcon,\n endIcon,\n icon = false,\n size,\n radius,\n overrideIconColors = true,\n component: Component = \"button\",\n ...others\n } = props;\n const { classes, css, cx } = useClasses(classesProp);\n const { activeTheme } = useTheme();\n\n const variant = mapVariant(variantProp, activeTheme?.name);\n\n return (\n <Component\n ref={ref}\n type=\"button\"\n className={cx(\n classes.root,\n css(getVariantStyles(variant)),\n size && css(getSizeStyles(size)),\n radius && css(getRadiusStyles(radius)),\n overrideIconColors && css(getOverrideColors()),\n {\n [classes.icon]: icon,\n [classes.disabled]: disabled,\n },\n className\n )}\n {...(disabled && {\n disabled: true,\n tabIndex: -1,\n \"aria-disabled\": true,\n })}\n {...others}\n >\n {startIcon && <span className={classes.startIcon}>{startIcon}</span>}\n {children}\n {endIcon && <span className={classes.endIcon}>{endIcon}</span>}\n </Component>\n );\n }\n);\n"],"names":["mapVariant","variant","theme","deprecatedVariantMap","secondary","ghost","mappedVariant","warn","HvButton","forwardRef","props","ref","id","classes","classesProp","children","variantProp","disabled","className","startIcon","endIcon","icon","size","radius","overrideIconColors","component","Component","others","css","cx","useClasses","activeTheme","useTheme","name","type","root","getVariantStyles","getSizeStyles","getRadiusStyles","getOverrideColors","tabIndex","_jsx"],"mappings":";;;;;AA4EA,MAAMA,aAAaA,CACjBC,SACAC,UACoB;AACpB,MAAIA,UAAU;AAAcD,WAAAA;AAE5B,QAAME,uBAAwD;AAAA,IAC5DC,WAAW;AAAA,IACXC,OAAO;AAAA,EAAA;AAGHC,QAAAA,gBAAgBH,qBAAqBF,OAAO;AAElD,MAAIK,eAAe;AAETC,YAAAA,KACL,mBAAkBN,uCAAuCK,iBAC5D;AAAA,E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AC;AAAA,EAAA,CACrD;AAEf,CACF;"}
@@ -119,9 +119,9 @@ const getSizeStyles = (size) => ({
119
119
  paddingRight: theme.space[size],
120
120
  fontSize: theme.fontSizes[size]
121
121
  });
122
- const getOverrideColors = (variant) => ({
122
+ const getOverrideColors = () => ({
123
123
  "& svg .color0": {
124
- fill: variant === "primary" ? theme.colors.primary : "currentcolor"
124
+ fill: "currentcolor"
125
125
  }
126
126
  });
127
127
  export {
@@ -1 +1 @@
1
- {"version":3,"file":"Button.styles.js","sources":["../../../../src/components/Button/Button.styles.ts"],"sourcesContent":["import { CSSInterpolation } from \"@emotion/serialize\";\nimport { theme } from \"@hitachivantara/uikit-styles\";\nimport { createClasses, outlineStyles } from \"@core/utils\";\nimport { HvButtonRadius, HvButtonSize, HvButtonVariant } from \".\";\n\nexport const { staticClasses, useClasses } = createClasses(\"HvButton\", {\n root: {\n display: \"inline-flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n textTransform: \"none\",\n cursor: \"pointer\",\n minWidth: \"70px\",\n\n whiteSpace: \"nowrap\",\n\n \"&:hover\": {},\n \"&:focus\": {},\n \"&:focus-visible\": { ...outlineStyles },\n \"&:active\": {},\n\n // default button - no size specified\n fontFamily: theme.fontFamily.body,\n fontSize: theme.fontSizes.base,\n fontWeight: theme.fontWeights.semibold,\n lineHeight: \"11px\",\n letterSpacing: 0,\n height: \"32px\",\n borderRadius: theme.button.borderRadius,\n padding: theme.button.padding,\n },\n startIcon: {\n marginLeft: `calc(-1 * ${theme.space.xs})`,\n },\n endIcon: {\n marginRight: `calc(-1 * ${theme.space.xs})`,\n },\n focusVisible: {},\n\n disabled: {\n color: theme.colors.secondary_60,\n borderColor: theme.colors.atmo4,\n backgroundColor: theme.colors.atmo3,\n cursor: \"not-allowed\",\n pointerEvents: \"none\",\n },\n\n icon: {\n margin: 0,\n padding: 0,\n height: \"fit-content\",\n minWidth: \"unset\",\n },\n});\n\nexport const getVariantStyles = (variant: HvButtonVariant) => {\n const variantStyles: Record<HvButtonVariant, CSSInterpolation> = {\n primary: {\n color: theme.colors.atmo1,\n backgroundColor: theme.colors.primary,\n \"&:hover, &:focus-visible\": {\n backgroundColor: theme.colors.primary_80,\n },\n },\n primarySubtle: {\n color: theme.colors.primary,\n backgroundColor: \"transparent\",\n border: `1px solid ${theme.colors.primary}`,\n \"&:hover, &:focus-visible\": {\n backgroundColor: theme.button.hoverColor,\n },\n },\n primaryGhost: {\n color: theme.colors.primary,\n backgroundColor: \"transparent\",\n \"&:hover, &:focus-visible\": {\n backgroundColor: theme.button.hoverColor,\n },\n \"&:disabled\": {\n backgroundColor: \"transparent\",\n },\n },\n secondarySubtle: {\n color: theme.colors.secondary,\n backgroundColor: theme.button.secondaryBackgroundColor,\n border: `1px solid ${theme.button.secondarySubtleBorderColor}`,\n \"&:hover, &:focus-visible\": {\n backgroundColor: theme.button.hoverColor,\n },\n },\n secondaryGhost: {\n color: theme.colors.secondary,\n backgroundColor: \"transparent\",\n \"&:hover, &:focus-visible\": {\n backgroundColor: theme.button.hoverColor,\n },\n \"&:disabled\": {\n backgroundColor: \"transparent\",\n },\n },\n semantic: {\n color: theme.colors.base_dark,\n backgroundColor: \"transparent\",\n \"&:hover, &:focus-visible\": {\n backgroundColor: theme.button.semanticColor,\n },\n \"&:disabled\": {\n backgroundColor: theme.button.semanticColorDisabled,\n },\n },\n secondary: undefined,\n ghost: undefined,\n };\n\n return variantStyles[variant];\n};\n\nexport const getRadiusStyles = (radius: HvButtonRadius): CSSInterpolation => ({\n borderRadius: theme.radii[radius],\n});\n\nexport const getSizeStyles = (size: HvButtonSize): CSSInterpolation => ({\n height: theme.sizes[size],\n paddingLeft: theme.space[size],\n paddingRight: theme.space[size],\n fontSize: theme.fontSizes[size],\n});\n\nexport const getOverrideColors = (\n variant: HvButtonVariant\n): CSSInterpolation => ({\n \"& svg .color0\": {\n fill: variant === \"primary\" ? theme.colors.primary : \"currentcolor\",\n },\n});\n"],"names":["staticClasses","useClasses","createClasses","root","display","alignItems","justifyContent","textTransform","cursor","minWidth","whiteSpace","outlineStyles","fontFamily","theme","body","fontSize","fontSizes","base","fontWeight","fontWeights","semibold","lineHeight","letterSpacing","height","borderRadius","button","padding","startIcon","marginLeft","space","xs","endIcon","marginRight","focusVisible","disabled","color","colors","secondary_60","borderColor","atmo4","backgroundColor","atmo3","pointerEvents","icon","margin","getVariantStyles","variant","variantStyles","primary","atmo1","primary_80","primarySubtle","border","hoverColor","primaryGhost","secondarySubtle","secondary","secondaryBackgroundColor","secondarySubtleBorderColor","secondaryGhost","semantic","base_dark","semanticColor","semanticColorDisabled","undefined","ghost","getRadiusStyles","radius","radii","getSizeStyles","size","sizes","paddingLeft","paddingRight","getOverrideColors","fill"],"mappings":";;;AAKa,MAAA;AAAA,EAAEA;AAAAA,EAAeC;AAAW,IAAIC,cAAc,YAAY;AAAA,EACrEC,MAAM;AAAA,IACJC,SAAS;AAAA,IACTC,YAAY;AAAA,IACZC,gBAAgB;AAAA,IAChBC,eAAe;AAAA,IACfC,QAAQ;AAAA,IACRC,UAAU;AAAA,IAEVC,YAAY;AAAA,IAEZ,WAAW,CAAC;AAAA,IACZ,WAAW,CAAC;AAAA,IACZ,mBAAmB;AAAA,MAAE,GAAGC;AAAAA,IAAc;AAAA,IACtC,YAAY,CAAC;AAAA;AAAA,IAGbC,YAAYC,MAAMD,WAAWE;AAAAA,IAC7BC,UAAUF,MAAMG,UAAUC;AAAAA,IAC1BC,YAAYL,MAAMM,YAAYC;AAAAA,IAC9BC,YAAY;AAAA,IACZC,eAAe;AAAA,IACfC,QAAQ;AAAA,IACRC,cAAcX,MAAMY,OAAOD;AAAAA,IAC3BE,SAASb,MAAMY,OAAOC;AAAAA,EACxB;AAAA,EACAC,WAAW;AAAA,IACTC,YAAa,aAAYf,MAAMgB,MAAMC;AAAAA,EACvC;AAAA,EACAC,SAAS;AAAA,IACPC,aAAc,aAAYnB,MAAMgB,MAAMC;AAAAA,EACxC;AAAA,EACAG,cAAc,CAAC;AAAA,EAEf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,OAAOtB,MAAMuB,OAAOoB;AAAAA,MACpBhB,iBAAiB;AAAA,MACjB,4BAA4B;AAAA,QAC1BA,iBAAiB3B,MAAMY,OAAO4B;AAAAA,MAChC;AAAA,MACA,cAAc;AAAA,QACZb,iBAAiB;AAAA,MACnB;AAAA,IACF;AAAA,IACAoB,UAAU;AAAA,MACRzB,OAAOtB,MAAMuB,OAAOyB;AAAAA,MACpBrB,iBAAiB;AAAA,MACjB,4BAA4B;AAAA,QAC1BA,iBAAiB3B,MAAMY,OAAOqC;AAAAA,MAChC;AAAA,MACA,cAAc;AAAA,QACZtB,iBAAiB3B,MAAMY,OAAOsC;AAAAA,MAChC;AAAA,IACF;AAAA,IACAP,WAAWQ;AAAAA,IACXC,OAAOD;AAAAA,EAAAA;AAGT,SAAOjB,cAAcD,OAAO;AAC9B;AAEaoB,MAAAA,kBAAkBA,CAACC,YAA8C;AAAA,EAC5E3C,cAAcX,MAAMuD,MAAMD,MAAM;AAClC;AAEaE,MAAAA,gBAAgBA,CAACC,UAA0C;AAAA,EACtE/C,QAAQV,MAAM0D,MAAMD,IAAI;AAAA,EACxBE,aAAa3D,MAAMgB,MAAMyC,IAAI;AAAA,EAC7BG,cAAc5D,MAAMgB,MAAMyC,IAAI;AAAA,EAC9BvD,UAAUF,MAAMG,UAAUsD,IAAI;AAChC;AAEaI,MAAAA,oBAAoBA,CAC/B5B,aACsB;AAAA,EACtB,iBAAiB;AAAA,IACf6B,MAAM7B,YAAY,YAAYjC,MAAMuB,OAAOY,UAAU;AAAA,EACvD;AACF;"}
1
+ {"version":3,"file":"Button.styles.js","sources":["../../../../src/components/Button/Button.styles.ts"],"sourcesContent":["import { CSSInterpolation } from \"@emotion/serialize\";\nimport { theme } from \"@hitachivantara/uikit-styles\";\nimport { createClasses, outlineStyles } from \"@core/utils\";\nimport { HvButtonRadius, HvButtonSize, HvButtonVariant } from \".\";\n\nexport const { staticClasses, useClasses } = createClasses(\"HvButton\", {\n root: {\n display: \"inline-flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n textTransform: \"none\",\n cursor: \"pointer\",\n minWidth: \"70px\",\n\n whiteSpace: \"nowrap\",\n\n \"&:hover\": {},\n \"&:focus\": {},\n \"&:focus-visible\": { ...outlineStyles },\n \"&:active\": {},\n\n // default button - no size specified\n fontFamily: theme.fontFamily.body,\n fontSize: theme.fontSizes.base,\n fontWeight: theme.fontWeights.semibold,\n lineHeight: \"11px\",\n letterSpacing: 0,\n height: \"32px\",\n borderRadius: theme.button.borderRadius,\n padding: theme.button.padding,\n },\n startIcon: {\n marginLeft: `calc(-1 * ${theme.space.xs})`,\n },\n endIcon: {\n marginRight: `calc(-1 * ${theme.space.xs})`,\n },\n focusVisible: {},\n\n disabled: {\n color: theme.colors.secondary_60,\n borderColor: theme.colors.atmo4,\n backgroundColor: theme.colors.atmo3,\n cursor: \"not-allowed\",\n pointerEvents: \"none\",\n },\n\n icon: {\n margin: 0,\n padding: 0,\n height: \"fit-content\",\n minWidth: \"unset\",\n },\n});\n\nexport const getVariantStyles = (variant: HvButtonVariant) => {\n const variantStyles: Record<HvButtonVariant, CSSInterpolation> = {\n primary: {\n color: theme.colors.atmo1,\n backgroundColor: theme.colors.primary,\n \"&:hover, &:focus-visible\": {\n backgroundColor: theme.colors.primary_80,\n },\n },\n primarySubtle: {\n color: theme.colors.primary,\n backgroundColor: \"transparent\",\n border: `1px solid ${theme.colors.primary}`,\n \"&:hover, &:focus-visible\": {\n backgroundColor: theme.button.hoverColor,\n },\n },\n primaryGhost: {\n color: theme.colors.primary,\n backgroundColor: \"transparent\",\n \"&:hover, &:focus-visible\": {\n backgroundColor: theme.button.hoverColor,\n },\n \"&:disabled\": {\n backgroundColor: \"transparent\",\n },\n },\n secondarySubtle: {\n color: theme.colors.secondary,\n backgroundColor: theme.button.secondaryBackgroundColor,\n border: `1px solid ${theme.button.secondarySubtleBorderColor}`,\n \"&:hover, &:focus-visible\": {\n backgroundColor: theme.button.hoverColor,\n },\n },\n secondaryGhost: {\n color: theme.colors.secondary,\n backgroundColor: \"transparent\",\n \"&:hover, &:focus-visible\": {\n backgroundColor: theme.button.hoverColor,\n },\n \"&:disabled\": {\n backgroundColor: \"transparent\",\n },\n },\n semantic: {\n color: theme.colors.base_dark,\n backgroundColor: \"transparent\",\n \"&:hover, &:focus-visible\": {\n backgroundColor: theme.button.semanticColor,\n },\n \"&:disabled\": {\n backgroundColor: theme.button.semanticColorDisabled,\n },\n },\n secondary: undefined,\n ghost: undefined,\n };\n\n return variantStyles[variant];\n};\n\nexport const getRadiusStyles = (radius: HvButtonRadius): CSSInterpolation => ({\n borderRadius: theme.radii[radius],\n});\n\nexport const getSizeStyles = (size: HvButtonSize): CSSInterpolation => ({\n height: theme.sizes[size],\n paddingLeft: theme.space[size],\n paddingRight: theme.space[size],\n fontSize: theme.fontSizes[size],\n});\n\nexport const getOverrideColors = (): CSSInterpolation => ({\n \"& svg .color0\": {\n fill: \"currentcolor\",\n },\n});\n"],"names":["staticClasses","useClasses","createClasses","root","display","alignItems","justifyContent","textTransform","cursor","minWidth","whiteSpace","outlineStyles","fontFamily","theme","body","fontSize","fontSizes","base","fontWeight","fontWeights","semibold","lineHeight","letterSpacing","height","borderRadius","button","padding","startIcon","marginLeft","space","xs","endIcon","marginRight","focusVisible","disabled","color","colors","secondary_60","borderColor","atmo4","backgroundColor","atmo3","pointerEvents","icon","margin","getVariantStyles","variant","variantStyles","primary","atmo1","primary_80","primarySubtle","border","hoverColor","primaryGhost","secondarySubtle","secondary","secondaryBackgroundColor","secondarySubtleBorderColor","secondaryGhost","semantic","base_dark","semanticColor","semanticColorDisabled","undefined","ghost","getRadiusStyles","radius","radii","getSizeStyles","size","sizes","paddingLeft","paddingRight","getOverrideColors","fill"],"mappings":";;;AAKa,MAAA;AAAA,EAAEA;AAAAA,EAAeC;AAAW,IAAIC,cAAc,YAAY;AAAA,EACrEC,MAAM;AAAA,IACJC,SAAS;AAAA,IACTC,YAAY;AAAA,IACZC,gBAAgB;AAAA,IAChBC,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aE,MAAAA,gBAAgBA,CAACC,UAA0C;AAAA,EACtE/C,QAAQV,MAAM0D,MAAMD,IAAI;AAAA,EACxBE,aAAa3D,MAAMgB,MAAMyC,IAAI;AAAA,EAC7BG,cAAc5D,MAAMgB,MAAMyC,IAAI;AAAA,EAC9BvD,UAAUF,MAAMG,UAAUsD,IAAI;AAChC;AAEO,MAAMI,oBAAoBA,OAAyB;AAAA,EACxD,iBAAiB;AAAA,IACfC,MAAM;AAAA,EACR;AACF;"}
@@ -67,7 +67,7 @@ const HvDrawer = ({
67
67
  children: [/* @__PURE__ */ jsx(HvButton, {
68
68
  id: setId(id, "close"),
69
69
  className: classes.closeButton,
70
- variant: "primaryGhost",
70
+ variant: "secondaryGhost",
71
71
  onClick: onClose,
72
72
  "aria-label": buttonTitle,
73
73
  children: /* @__PURE__ */ jsx(CloseButtonTooltipWrapper, {})
@@ -1 +1 @@
1
- {"version":3,"file":"Drawer.js","sources":["../../../../src/components/Drawer/Drawer.tsx"],"sourcesContent":["import {\n Drawer as MuiDrawer,\n DrawerProps as MuiDrawerProps,\n} from \"@mui/material\";\nimport { Close } from \"@hitachivantara/uikit-react-icons\";\nimport { HvBaseProps } from \"@core/types/generic\";\nimport { withTooltip } from \"@core/hocs\";\nimport {\n hexToRgbA,\n setId,\n checkValidHexColorValue,\n ExtractNames,\n getVarValue,\n} from \"@core/utils\";\nimport { theme } from \"@hitachivantara/uikit-styles\";\nimport { HvButton } from \"@core/components\";\nimport { useEffect, useState } from \"react\";\nimport { useTheme } from \"@core/hooks\";\nimport { staticClasses, useClasses } from \"./Drawer.styles\";\n\nexport { staticClasses as drawerClasses };\n\nexport type HvDrawerClasses = ExtractNames<typeof useClasses>;\n\nexport interface HvDrawerProps\n extends MuiDrawerProps,\n Omit<MuiDrawerProps, \"classes\">,\n HvBaseProps<HTMLDivElement> {\n /**\n * Class names to be applied.\n */\n className?: string;\n /**\n * Id to be applied to the root node.\n */\n id?: string;\n /**\n * A Jss Object used to override or extend the styles applied.\n */\n classes?: HvDrawerClasses;\n /**\n * Components of the Drawer.\n */\n children?: React.ReactNode;\n /**\n * Current state of the Drawer.\n */\n open?: boolean;\n /**\n * Function executed on close.\n * Extended from Modal from material-ui\n *\n */\n onClose?: (\n event: React.SyntheticEvent,\n reason?: \"escapeKeyDown\" | \"backdropClick\"\n ) => void;\n /**\n * The side the drawer opens from.\n */\n anchor?: \"left\" | \"top\" | \"right\" | \"bottom\";\n /**\n * Title for the button close.\n */\n buttonTitle?: string;\n}\n\nconst getBackgroundColor = (color: string) => {\n return checkValidHexColorValue(color) ? hexToRgbA(color, 0.8) : color;\n};\n\n/**\n * The Drawer component provides a foundation to create a sliding pane.\n * It only provides the pane with a close button, the rest of the\n * content can be customized.\n */\nexport const HvDrawer = ({\n className,\n classes: classesProp,\n id,\n children,\n open,\n onClose,\n anchor = \"right\",\n buttonTitle = \"Close\",\n ...others\n}: HvDrawerProps) => {\n const { classes, css, cx } = useClasses(classesProp);\n const { activeTheme, rootId } = useTheme();\n\n const [backgroundColorValue, setBackgroundColorValue] = useState<string>(\n getVarValue(theme.drawer.backDropBackgroundColor, rootId) || \"\"\n );\n\n const closeButtonDisplay = () => <Close role=\"presentation\" />;\n\n const CloseButtonTooltipWrapper = buttonTitle\n ? withTooltip(closeButtonDisplay, buttonTitle, \"top\")\n : closeButtonDisplay;\n\n const [backgroundColor, setBackgroundColor] = useState(\n getBackgroundColor(backgroundColorValue)\n );\n\n useEffect(() => {\n setBackgroundColorValue(\n getVarValue(theme.drawer.backDropBackgroundColor, rootId) ||\n activeTheme?.drawer.backDropBackgroundColor ||\n \"\"\n );\n\n setBackgroundColor(getBackgroundColor(backgroundColorValue));\n }, [\n activeTheme?.colors.modes.selectedMode,\n backgroundColorValue,\n setBackgroundColor,\n rootId,\n activeTheme?.drawer.backDropBackgroundColor,\n ]);\n\n return (\n <MuiDrawer\n className={cx(classes.root, className)}\n id={id}\n anchor={anchor}\n open={open}\n PaperProps={{\n classes: {\n root: classes.paper,\n },\n }}\n BackdropProps={{\n classes: {\n root: cx(css({ backgroundColor }), classes.background),\n },\n }}\n onClose={onClose}\n {...others}\n >\n <HvButton\n id={setId(id, \"close\")}\n className={classes.closeButton}\n variant=\"primaryGhost\"\n onClick={onClose}\n aria-label={buttonTitle}\n >\n <CloseButtonTooltipWrapper />\n </HvButton>\n {children}\n </MuiDrawer>\n );\n};\n"],"names":["getBackgroundColor","color","checkValidHexColorValue","hexToRgbA","HvDrawer","className","classes","classesProp","id","children","open","onClose","anchor","buttonTitle","others","css","cx","useClasses","activeTheme","rootId","useTheme","backgroundColorValue","setBackgroundColorValue","useState","getVarValue","theme","drawer","backDropBackgroundColor","closeButtonDisplay","_jsx","Close","role","CloseButtonTooltipWrapper","withTooltip","backgroundColor","setBackgroundColor","useEffect","colors","modes","selectedMode","MuiDrawer","root","PaperProps","paper","BackdropProps","background","HvButton","setId","closeButton","variant","onClick"],"mappings":";;;;;;;;;;;;;;AAmEA,MAAMA,qBAAqBA,CAACC,UAAkB;AAC5C,SAAOC,wBAAwBD,KAAK,IAAIE,KAAUF,OAAO,GAAG,IAAIA;AAClE;AAOO,MAAMG,WAAWA,CAAC;AAAA,EACvBC;AAAAA,EACAC,SAASC;AAAAA,EACTC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC;AAAAA,EACAC,SAAS;AAAA,EACTC,cAAc;AAAA,EACd,GAAGC;AACU,MAAM;AACb,QAAA;AAAA,IAAER;AAAAA,IAASS;AAAAA,IAAKC;AAAAA,EAAAA,IAAOC,WAAWV,WAAW;AAC7C,QAAA;AAAA,IAAEW;AAAAA,IAAaC;AAAAA,MAAWC,SAAS;AAEnC,QAAA,CAACC,sBAAsBC,uBAAuB,IAAIC,SACtDC,YAAYC,MAAMC,OAAOC,yBAAyBR,MAAM,KAAK,EAC/D;AAEMS,QAAAA,qBAAqBA,MAAMC,oBAACC,OAAK;AAAA,IAACC,MAAK;AAAA,EAAA,CAAgB;AAE7D,QAAMC,4BAA4BnB,cAC9BoB,YAAYL,oBAAoBf,aAAa,KAAK,IAClDe;AAEJ,QAAM,CAACM,iBAAiBC,kBAAkB,IAAIZ,SAC5CvB,mBAAmBqB,oBAAoB,CACzC;AAEAe,YAAU,MAAM;AAEZZ,4BAAAA,YAAYC,MAAMC,OAAOC,yBAAyBR,MAAM,MACtDD,2CAAaQ,OAAOC,4BACpB,EACJ;AAEmB3B,uBAAAA,mBAAmBqB,oBAAoB,CAAC;AAAA,EAC1D,GAAA,CACDH,2CAAamB,OAAOC,MAAMC,cAC1BlB,sBACAc,oBACAhB,QACAD,2CAAaQ,OAAOC,uBAAuB,CAC5C;AAED,8BACGa,QAAS;AAAA,IACRnC,WAAWW,GAAGV,QAAQmC,MAAMpC,SAAS;AAAA,IACrCG;AAAAA,IACAI;AAAAA,IACAF;AAAAA,IACAgC,YAAY;AAAA,MACVpC,SAAS;AAAA,QACPmC,MAAMnC,QAAQqC;AAAAA,MAChB;AAAA,IACF;AAAA,IACAC,eAAe;AAAA,MACbtC,SAAS;AAAA,QACPmC,MAAMzB,GAAGD,IAAI;AAAA,UAAEmB;AAAAA,QAAAA,CAAiB,GAAG5B,QAAQuC,UAAU;AAAA,MACvD;AAAA,IACF;AAAA,IACAlC;AAAAA,IAAiB,GACbG;AAAAA,IAAML,UAAA,CAEVoB,oBAACiB,UAAQ;AAAA,MACPtC,IAAIuC,MAAMvC,IAAI,OAAO;AAAA,MACrBH,WAAWC,QAAQ0C;AAAAA,MACnBC,SAAQ;AAAA,MACRC,SAASvC;AAAAA,MACT,cAAYE;AAAAA,MAAYJ,UAExBoB,oBAACG,2BAA2B,EAAA;AAAA,IACpB,CAAA,GACTvB,QAAQ;AAAA,EAAA,CACA;AAEf;"}
1
+ {"version":3,"file":"Drawer.js","sources":["../../../../src/components/Drawer/Drawer.tsx"],"sourcesContent":["import {\n Drawer as MuiDrawer,\n DrawerProps as MuiDrawerProps,\n} from \"@mui/material\";\nimport { Close } from \"@hitachivantara/uikit-react-icons\";\nimport { HvBaseProps } from \"@core/types/generic\";\nimport { withTooltip } from \"@core/hocs\";\nimport {\n hexToRgbA,\n setId,\n checkValidHexColorValue,\n ExtractNames,\n getVarValue,\n} from \"@core/utils\";\nimport { theme } from \"@hitachivantara/uikit-styles\";\nimport { HvButton } from \"@core/components\";\nimport { useEffect, useState } from \"react\";\nimport { useTheme } from \"@core/hooks\";\nimport { staticClasses, useClasses } from \"./Drawer.styles\";\n\nexport { staticClasses as drawerClasses };\n\nexport type HvDrawerClasses = ExtractNames<typeof useClasses>;\n\nexport interface HvDrawerProps\n extends MuiDrawerProps,\n Omit<MuiDrawerProps, \"classes\">,\n HvBaseProps<HTMLDivElement> {\n /**\n * Class names to be applied.\n */\n className?: string;\n /**\n * Id to be applied to the root node.\n */\n id?: string;\n /**\n * A Jss Object used to override or extend the styles applied.\n */\n classes?: HvDrawerClasses;\n /**\n * Components of the Drawer.\n */\n children?: React.ReactNode;\n /**\n * Current state of the Drawer.\n */\n open?: boolean;\n /**\n * Function executed on close.\n * Extended from Modal from material-ui\n *\n */\n onClose?: (\n event: React.SyntheticEvent,\n reason?: \"escapeKeyDown\" | \"backdropClick\"\n ) => void;\n /**\n * The side the drawer opens from.\n */\n anchor?: \"left\" | \"top\" | \"right\" | \"bottom\";\n /**\n * Title for the button close.\n */\n buttonTitle?: string;\n}\n\nconst getBackgroundColor = (color: string) => {\n return checkValidHexColorValue(color) ? hexToRgbA(color, 0.8) : color;\n};\n\n/**\n * The Drawer component provides a foundation to create a sliding pane.\n * It only provides the pane with a close button, the rest of the\n * content can be customized.\n */\nexport const HvDrawer = ({\n className,\n classes: classesProp,\n id,\n children,\n open,\n onClose,\n anchor = \"right\",\n buttonTitle = \"Close\",\n ...others\n}: HvDrawerProps) => {\n const { classes, css, cx } = useClasses(classesProp);\n const { activeTheme, rootId } = useTheme();\n\n const [backgroundColorValue, setBackgroundColorValue] = useState<string>(\n getVarValue(theme.drawer.backDropBackgroundColor, rootId) || \"\"\n );\n\n const closeButtonDisplay = () => <Close role=\"presentation\" />;\n\n const CloseButtonTooltipWrapper = buttonTitle\n ? withTooltip(closeButtonDisplay, buttonTitle, \"top\")\n : closeButtonDisplay;\n\n const [backgroundColor, setBackgroundColor] = useState(\n getBackgroundColor(backgroundColorValue)\n );\n\n useEffect(() => {\n setBackgroundColorValue(\n getVarValue(theme.drawer.backDropBackgroundColor, rootId) ||\n activeTheme?.drawer.backDropBackgroundColor ||\n \"\"\n );\n\n setBackgroundColor(getBackgroundColor(backgroundColorValue));\n }, [\n activeTheme?.colors.modes.selectedMode,\n backgroundColorValue,\n setBackgroundColor,\n rootId,\n activeTheme?.drawer.backDropBackgroundColor,\n ]);\n\n return (\n <MuiDrawer\n className={cx(classes.root, className)}\n id={id}\n anchor={anchor}\n open={open}\n PaperProps={{\n classes: {\n root: classes.paper,\n },\n }}\n BackdropProps={{\n classes: {\n root: cx(css({ backgroundColor }), classes.background),\n },\n }}\n onClose={onClose}\n {...others}\n >\n <HvButton\n id={setId(id, \"close\")}\n className={classes.closeButton}\n variant=\"secondaryGhost\"\n onClick={onClose}\n aria-label={buttonTitle}\n >\n <CloseButtonTooltipWrapper />\n </HvButton>\n {children}\n </MuiDrawer>\n );\n};\n"],"names":["getBackgroundColor","color","checkValidHexColorValue","hexToRgbA","HvDrawer","className","classes","classesProp","id","children","open","onClose","anchor","buttonTitle","others","css","cx","useClasses","activeTheme","rootId","useTheme","backgroundColorValue","setBackgroundColorValue","useState","getVarValue","theme","drawer","backDropBackgroundColor","closeButtonDisplay","_jsx","Close","role","CloseButtonTooltipWrapper","withTooltip","backgroundColor","setBackgroundColor","useEffect","colors","modes","selectedMode","MuiDrawer","root","PaperProps","paper","BackdropProps","background","HvButton","setId","closeButton","variant","onClick"],"mappings":";;;;;;;;;;;;;;AAmEA,MAAMA,qBAAqBA,CAACC,UAAkB;AAC5C,SAAOC,wBAAwBD,KAAK,IAAIE,KAAUF,OAAO,GAAG,IAAIA;AAClE;AAOO,MAAMG,WAAWA,CAAC;AAAA,EACvBC;A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AAA,IACF;AAAA,IACAlC;AAAAA,IAAiB,GACbG;AAAAA,IAAML,UAAA,CAEVoB,oBAACiB,UAAQ;AAAA,MACPtC,IAAIuC,MAAMvC,IAAI,OAAO;AAAA,MACrBH,WAAWC,QAAQ0C;AAAAA,MACnBC,SAAQ;AAAA,MACRC,SAASvC;AAAAA,MACT,cAAYE;AAAAA,MAAYJ,UAExBoB,oBAACG,2BAA2B,EAAA;AAAA,IACpB,CAAA,GACTvB,QAAQ;AAAA,EAAA,CACA;AAEf;"}
@@ -12,7 +12,7 @@ const HvTypographyMap = {
12
12
  title3: "h3",
13
13
  title4: "h4",
14
14
  body: "p",
15
- label: "label",
15
+ label: "span",
16
16
  caption1: "p",
17
17
  caption2: "p",
18
18
  // LEGACY
@@ -1 +1 @@
1
- {"version":3,"file":"Typography.js","sources":["../../../../src/components/Typography/Typography.tsx"],"sourcesContent":["import { forwardRef, AllHTMLAttributes, Ref } from \"react\";\nimport { HvBaseProps } from \"@core/types\";\nimport { ExtractNames } from \"@core/utils\";\nimport { useTheme } from \"@core/hooks\";\nimport { mapVariant } from \"./utils\";\nimport { staticClasses, useClasses } from \"./Typography.styles\";\n\nexport { staticClasses as typographyClasses };\n\nexport type HvTypographyClasses = ExtractNames<typeof useClasses>;\n\nexport const typographyVariants = [\n \"display\",\n \"title1\",\n \"title2\",\n \"title3\",\n \"title4\",\n \"body\",\n \"label\",\n \"caption1\",\n \"caption2\",\n] as const;\n\nexport type HvTypographyVariants = (typeof typographyVariants)[number];\n\n/** @deprecated */\nexport type HvTypographyLegacyVariants =\n | \"5xlTitle\"\n | \"4xlTitle\"\n | \"3xlTitle\"\n | \"xxlTitle\"\n | \"xlTitle\"\n | \"lTitle\"\n | \"mTitle\"\n | \"sTitle\"\n | \"xsTitle\"\n | \"xxsTitle\"\n | \"sectionTitle\"\n | \"highlightText\"\n | \"normalText\"\n | \"placeholderText\"\n | \"link\"\n | \"disabledText\"\n | \"selectedNavText\"\n | \"vizText\"\n | \"vizTextDisabled\"\n | \"xsInlineLink\";\n\nconst HvTypographyMap = {\n display: \"h1\",\n title1: \"h1\",\n title2: \"h2\",\n title3: \"h3\",\n title4: \"h4\",\n body: \"p\",\n label: \"label\",\n caption1: \"p\",\n caption2: \"p\",\n // LEGACY\n \"5xlTitle\": \"h1\",\n \"4xlTitle\": \"h1\",\n xxlTitle: \"h1\",\n lTitle: \"h2\",\n sTitle: \"h4\",\n xxsTitle: \"h6\",\n sectionTitle: \"p\",\n placeholderText: \"p\",\n link: \"p\",\n disabledText: \"p\",\n selectedNavText: \"p\",\n vizTextDisabled: \"p\",\n xsInlineLink: \"p\",\n} as const;\n\nexport interface HvTypographyProps\n extends Omit<AllHTMLAttributes<HTMLElement>, \"disabled\">,\n HvBaseProps<HTMLElement> {\n component?: React.ElementType;\n /** Use the variant prop to change the visual style of the Typography. */\n variant?: HvTypographyVariants | HvTypographyLegacyVariants;\n /** If `true` the typography will display the look of a link. */\n link?: boolean;\n /** If `true` the typography will display the look of a disabled state. */\n disabled?: boolean;\n /** If `true`, the text will have a bottom margin. */\n paragraph?: boolean;\n /**\n * If `true`, the text will not wrap, but instead will truncate with a text overflow ellipsis.\n *\n * Note that text overflow can only happen with block or inline-block level elements\n * (the element needs to have a width in order to overflow).\n */\n noWrap?: boolean;\n /** A Jss Object used to override or extend the styles applied to the component. */\n classes?: HvTypographyClasses;\n}\n\n/**\n * Typography component is used to render text and paragraphs within an interface.\n */\nexport const HvTypography = forwardRef(\n (props: HvTypographyProps, ref: Ref<HTMLElement>) => {\n const {\n className,\n component: ComponentProp,\n classes: classesProp,\n variant: variantProp = \"body\",\n link = false,\n disabled = false,\n noWrap = false,\n paragraph = false,\n ...others\n } = props;\n const { classes, cx } = useClasses(classesProp);\n const { activeTheme } = useTheme();\n\n const variant = mapVariant(variantProp, activeTheme?.name);\n\n const Component =\n ComponentProp || (paragraph && \"p\") || HvTypographyMap[variant] || \"span\";\n\n return (\n <Component\n ref={ref}\n className={cx(classes.root, classes[variant], className, {\n [classes.isLink]: link,\n [classes.noWrap]: noWrap,\n [classes.disabled]: disabled,\n })}\n {...others}\n />\n );\n }\n);\n"],"names":["typographyVariants","HvTypographyMap","display","title1","title2","title3","title4","body","label","caption1","caption2","xxlTitle","lTitle","sTitle","xxsTitle","sectionTitle","placeholderText","link","disabledText","selectedNavText","vizTextDisabled","xsInlineLink","HvTypography","forwardRef","props","ref","className","component","ComponentProp","classes","classesProp","variant","variantProp","disabled","noWrap","paragraph","others","cx","useClasses","activeTheme","useTheme","mapVariant","name","Component","root","isLink"],"mappings":";;;;;;AAWaA,MAAAA,qBAAqB,CAChC,WACA,UACA,UACA,UACA,UACA,QACA,SACA,YACA,UAAU;AA4BZ,MAAMC,kBAAkB;AAAA,EACtBC,SAAS;AAAA,EACTC,QAAQ;AAAA,EACRC,QAAQ;AAAA,EACRC,QAAQ;AAAA,EACRC,QAAQ;AAAA,EACRC,MAAM;AAAA,EACNC,OAAO;AAAA,EACPC,UAAU;AAAA,EACVC,UAAU;AAAA;AAAA,EAEV,YAAY;AAAA,EACZ,YAAY;AAAA,EACZC,UAAU;AAAA,EACVC,QAAQ;AAAA,EACRC,QAAQ;AAAA,EACRC,UAAU;AAAA,EACVC,cAAc;AAAA,EACdC,iBAAiB;AAAA,EACjBC,MAAM;AAAA,EACNC,cAAc;AAAA,EACdC,iBAAiB;AAAA,EACjBC,iBAAiB;AAAA,EACjBC,cAAc;AAChB;AA4BO,MAAMC,eAAeC,WAC1B,CAACC,OAA0BC,QAA0B;AAC7C,QAAA;AAAA,IACJC;AAAAA,IACAC,WAAWC;AAAAA,IACXC,SAASC;AAAAA,IACTC,SAASC,cAAc;AAAA,IACvBf,OAAO;AAAA,IACPgB,WAAW;AAAA,IACXC,SAAS;AAAA,IACTC,YAAY;AAAA,IACZ,GAAGC;AAAAA,EACDZ,IAAAA;AACE,QAAA;AAAA,IAAEK;AAAAA,IAASQ;AAAAA,EAAAA,IAAOC,WAAWR,WAAW;AACxC,QAAA;AAAA,IAAES;AAAAA,MAAgBC,SAAS;AAEjC,QAAMT,UAAUU,WAAWT,aAAaO,2CAAaG,IAAI;AAEzD,QAAMC,YACJf,iBAAkBO,aAAa,OAAQlC,gBAAgB8B,OAAO,KAAK;AAErE,6BACGY,WAAS;AAAA,IACRlB;AAAAA,IACAC,WAAWW,GAAGR,QAAQe,MAAMf,QAAQE,OAAO,GAAGL,WAAW;AAAA,MACvD,CAACG,QAAQgB,MAAM,GAAG5B;AAAAA,MAClB,CAACY,QAAQK,MAAM,GAAGA;AAAAA,MAClB,CAACL,QAAQI,QAAQ,GAAGA;AAAAA,IAAAA,CACrB;AAAA,IAAE,GACCG;AAAAA,EAAAA,CACL;AAEL,CACF;"}
1
+ {"version":3,"file":"Typography.js","sources":["../../../../src/components/Typography/Typography.tsx"],"sourcesContent":["import { forwardRef, AllHTMLAttributes, Ref } from \"react\";\nimport { HvBaseProps } from \"@core/types\";\nimport { ExtractNames } from \"@core/utils\";\nimport { useTheme } from \"@core/hooks\";\nimport { mapVariant } from \"./utils\";\nimport { staticClasses, useClasses } from \"./Typography.styles\";\n\nexport { staticClasses as typographyClasses };\n\nexport type HvTypographyClasses = ExtractNames<typeof useClasses>;\n\nexport const typographyVariants = [\n \"display\",\n \"title1\",\n \"title2\",\n \"title3\",\n \"title4\",\n \"body\",\n \"label\",\n \"caption1\",\n \"caption2\",\n] as const;\n\nexport type HvTypographyVariants = (typeof typographyVariants)[number];\n\n/** @deprecated */\nexport type HvTypographyLegacyVariants =\n | \"5xlTitle\"\n | \"4xlTitle\"\n | \"3xlTitle\"\n | \"xxlTitle\"\n | \"xlTitle\"\n | \"lTitle\"\n | \"mTitle\"\n | \"sTitle\"\n | \"xsTitle\"\n | \"xxsTitle\"\n | \"sectionTitle\"\n | \"highlightText\"\n | \"normalText\"\n | \"placeholderText\"\n | \"link\"\n | \"disabledText\"\n | \"selectedNavText\"\n | \"vizText\"\n | \"vizTextDisabled\"\n | \"xsInlineLink\";\n\nconst HvTypographyMap = {\n display: \"h1\",\n title1: \"h1\",\n title2: \"h2\",\n title3: \"h3\",\n title4: \"h4\",\n body: \"p\",\n label: \"span\",\n caption1: \"p\",\n caption2: \"p\",\n // LEGACY\n \"5xlTitle\": \"h1\",\n \"4xlTitle\": \"h1\",\n xxlTitle: \"h1\",\n lTitle: \"h2\",\n sTitle: \"h4\",\n xxsTitle: \"h6\",\n sectionTitle: \"p\",\n placeholderText: \"p\",\n link: \"p\",\n disabledText: \"p\",\n selectedNavText: \"p\",\n vizTextDisabled: \"p\",\n xsInlineLink: \"p\",\n} as const;\n\nexport interface HvTypographyProps\n extends Omit<AllHTMLAttributes<HTMLElement>, \"disabled\">,\n HvBaseProps<HTMLElement> {\n component?: React.ElementType;\n /** Use the variant prop to change the visual style of the Typography. */\n variant?: HvTypographyVariants | HvTypographyLegacyVariants;\n /** If `true` the typography will display the look of a link. */\n link?: boolean;\n /** If `true` the typography will display the look of a disabled state. */\n disabled?: boolean;\n /** If `true`, the text will have a bottom margin. */\n paragraph?: boolean;\n /**\n * If `true`, the text will not wrap, but instead will truncate with a text overflow ellipsis.\n *\n * Note that text overflow can only happen with block or inline-block level elements\n * (the element needs to have a width in order to overflow).\n */\n noWrap?: boolean;\n /** A Jss Object used to override or extend the styles applied to the component. */\n classes?: HvTypographyClasses;\n}\n\n/**\n * Typography component is used to render text and paragraphs within an interface.\n */\nexport const HvTypography = forwardRef(\n (props: HvTypographyProps, ref: Ref<HTMLElement>) => {\n const {\n className,\n component: ComponentProp,\n classes: classesProp,\n variant: variantProp = \"body\",\n link = false,\n disabled = false,\n noWrap = false,\n paragraph = false,\n ...others\n } = props;\n const { classes, cx } = useClasses(classesProp);\n const { activeTheme } = useTheme();\n\n const variant = mapVariant(variantProp, activeTheme?.name);\n\n const Component =\n ComponentProp || (paragraph && \"p\") || HvTypographyMap[variant] || \"span\";\n\n return (\n <Component\n ref={ref}\n className={cx(classes.root, classes[variant], className, {\n [classes.isLink]: link,\n [classes.noWrap]: noWrap,\n [classes.disabled]: disabled,\n })}\n {...others}\n />\n );\n }\n);\n"],"names":["typographyVariants","HvTypographyMap","display","title1","title2","title3","title4","body","label","caption1","caption2","xxlTitle","lTitle","sTitle","xxsTitle","sectionTitle","placeholderText","link","disabledText","selectedNavText","vizTextDisabled","xsInlineLink","HvTypography","forwardRef","props","ref","className","component","ComponentProp","classes","classesProp","variant","variantProp","disabled","noWrap","paragraph","others","cx","useClasses","activeTheme","useTheme","mapVariant","name","Component","root","isLink"],"mappings":";;;;;;AAWaA,MAAAA,qBAAqB,CAChC,WACA,UACA,UACA,UACA,UACA,QACA,SACA,YACA,UAAU;AA4BZ,MAAMC,kBAAkB;AAAA,EACtBC,SAAS;AAAA,EACTC,QAAQ;AAAA,EACRC,QAAQ;AAAA,EACRC,QAAQ;AAAA,EACRC,QAAQ;AAAA,EACRC,MAAM;AAAA,EACNC,OAAO;AAAA,EACPC,UAAU;AAAA,EACVC,UAAU;AAAA;AAAA,EAEV,YAAY;AAAA,EACZ,YAAY;AAAA,EACZC,UAAU;AAAA,EACVC,QAAQ;AAAA,EACRC,QAAQ;AAAA,EACRC,UAAU;AAAA,EACVC,cAAc;AAAA,EACdC,iBAAiB;AAAA,EACjBC,MAAM;AAAA,EACNC,cAAc;AAAA,EACdC,iBAAiB;AAAA,EACjBC,iBAAiB;AAAA,EACjBC,cAAc;AAChB;AA4BO,MAAMC,eAAeC,WAC1B,CAACC,OAA0BC,QAA0B;AAC7C,QAAA;AAAA,IACJC;AAAAA,IACAC,WAAWC;AAAAA,IACXC,SAASC;AAAAA,IACTC,SAASC,cAAc;AAAA,IACvBf,OAAO;AAAA,IACPgB,WAAW;AAAA,IACXC,SAAS;AAAA,IACTC,YAAY;AAAA,IACZ,GAAGC;AAAAA,EACDZ,IAAAA;AACE,QAAA;AAAA,IAAEK;AAAAA,IAASQ;AAAAA,EAAAA,IAAOC,WAAWR,WAAW;AACxC,QAAA;AAAA,IAAES;AAAAA,MAAgBC,SAAS;AAEjC,QAAMT,UAAUU,WAAWT,aAAaO,2CAAaG,IAAI;AAEzD,QAAMC,YACJf,iBAAkBO,aAAa,OAAQlC,gBAAgB8B,OAAO,KAAK;AAErE,6BACGY,WAAS;AAAA,IACRlB;AAAAA,IACAC,WAAWW,GAAGR,QAAQe,MAAMf,QAAQE,OAAO,GAAGL,WAAW;AAAA,MACvD,CAACG,QAAQgB,MAAM,GAAG5B;AAAAA,MAClB,CAACY,QAAQK,MAAM,GAAGA;AAAAA,MAClB,CAACL,QAAQI,QAAQ,GAAGA;AAAAA,IAAAA,CACrB;AAAA,IAAE,GACCG;AAAAA,EAAAA,CACL;AAEL,CACF;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hitachivantara/uikit-react-core",
3
- "version": "5.20.0",
3
+ "version": "5.20.1",
4
4
  "private": false,
5
5
  "author": "Hitachi Vantara UI Kit Team",
6
6
  "description": "Core React components for the NEXT Design System.",
@@ -33,7 +33,7 @@
33
33
  "@emotion/css": "^11.11.0",
34
34
  "@emotion/serialize": "^1.1.2",
35
35
  "@emotion/utils": "^1.2.1",
36
- "@hitachivantara/uikit-react-icons": "^5.3.0",
36
+ "@hitachivantara/uikit-react-icons": "^5.4.0",
37
37
  "@hitachivantara/uikit-react-shared": "^5.1.0",
38
38
  "@hitachivantara/uikit-styles": "^5.9.1",
39
39
  "@internationalized/date": "^3.2.0",
@@ -64,7 +64,7 @@
64
64
  "access": "public",
65
65
  "directory": "package"
66
66
  },
67
- "gitHead": "b0550721e47be70defa2c21bc5e49d99ba8c39ad",
67
+ "gitHead": "bf72281c787be46139b4db124c399b9b74555cb6",
68
68
  "main": "dist/cjs/index.cjs",
69
69
  "exports": {
70
70
  ".": {