@hashicorp/mds-react 0.9.5 → 0.9.7

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.
Files changed (53) hide show
  1. package/components/accordion/index.d.ts +1 -1
  2. package/components/accordion/item/index.d.ts +1 -1
  3. package/components/card/index.d.ts +2 -2
  4. package/components/code-block/code-block.module.scss +3 -3
  5. package/components/code-block/index.d.ts +1 -1
  6. package/components/form/indicator/index.js +3 -4
  7. package/components/form/indicator/index.js.map +1 -1
  8. package/components/form/radio-card/index.d.ts +2 -2
  9. package/components/form/select/index.d.ts +1 -0
  10. package/components/form/select/index.js.map +1 -1
  11. package/components/text/index.d.ts +7 -7
  12. package/components/text/index.js.map +1 -1
  13. package/components/visualizations/bar-chart/horizontal-chart/index.d.ts +0 -1
  14. package/components/visualizations/bar-chart/index.d.ts +1 -1
  15. package/index.js +26 -22
  16. package/index.js.map +1 -1
  17. package/package.json +1 -1
  18. package/patterns/card/newsroom-card/index.d.ts +1 -1
  19. package/patterns/card/partner-card/index.d.ts +2 -2
  20. package/patterns/card/person-card/index.d.ts +1 -1
  21. package/patterns/card/primitives.d.ts +5 -5
  22. package/patterns/card/promo-card/index.d.ts +1 -1
  23. package/patterns/card/resource-card/index.d.ts +1 -1
  24. package/patterns/card/thumbnails/index.d.ts +1 -1
  25. package/patterns/card/types.d.ts +6 -6
  26. package/patterns/card/unified-card/index.d.ts +1 -1
  27. package/patterns/product-logo/index.d.ts +15 -15
  28. package/patterns/related-content/index.d.ts +1 -1
  29. package/patterns/related-content/types.d.ts +1 -1
  30. package/style.css +1 -1
  31. package/utils/i18n/constants/index.js +16 -3
  32. package/utils/i18n/constants/index.js.map +1 -1
  33. package/utils/i18n/helpers/index.d.ts +4 -0
  34. package/utils/i18n/helpers/index.js +8 -0
  35. package/utils/i18n/helpers/index.js.map +1 -0
  36. package/utils/i18n/helpers/locale-provider.d.ts +14 -0
  37. package/utils/i18n/helpers/locale-provider.js +14 -4
  38. package/utils/i18n/helpers/locale-provider.js.map +1 -1
  39. package/utils/i18n/helpers/to-smart-sentence-case.d.ts +2 -0
  40. package/utils/i18n/helpers/to-smart-sentence-case.js.map +1 -1
  41. package/utils/i18n/helpers/to-smart-title-case.d.ts +2 -0
  42. package/utils/i18n/helpers/to-smart-title-case.js.map +1 -1
  43. package/utils/i18n/helpers/use-locale.d.ts +2 -0
  44. package/utils/i18n/helpers/use-locale.js +1 -1
  45. package/utils/i18n/helpers/use-locale.js.map +1 -1
  46. package/utils/i18n/index.d.ts +11 -1
  47. package/utils/i18n/index.js +29 -3
  48. package/utils/i18n/index.js.map +1 -1
  49. package/utils/index.d.ts +1 -0
  50. package/utils/index.js +10 -6
  51. package/utils/index.js.map +1 -1
  52. package/utils/i18n/index2.js +0 -33
  53. package/utils/i18n/index2.js.map +0 -1
@@ -1,4 +1,4 @@
1
- import { HTMLAttributes } from 'react';
1
+ import type { HTMLAttributes } from 'react';
2
2
  interface AccordionProps extends HTMLAttributes<HTMLDivElement> {
3
3
  /**
4
4
  * optional class name to add to the accordion
@@ -1,4 +1,4 @@
1
- import { HTMLAttributes } from 'react';
1
+ import type { HTMLAttributes } from 'react';
2
2
  interface AccordionItemProps extends HTMLAttributes<HTMLDivElement> {
3
3
  ariaLabel?: string;
4
4
  isOpen?: boolean;
@@ -1,4 +1,4 @@
1
- import { CardContentProps, CardProps } from './types';
2
- declare const Card: import('react').ForwardRefExoticComponent<CardProps & import('react').RefAttributes<HTMLDivElement>>;
1
+ import type { CardContentProps, CardProps } from './types';
2
+ declare const Card: import("react").ForwardRefExoticComponent<CardProps & import("react").RefAttributes<HTMLDivElement>>;
3
3
  export declare const CardContent: ({ badges, description, eyebrow, heading, thumbnail, subheading, cta, children, showArrow, }: CardContentProps) => import("react/jsx-runtime").JSX.Element;
4
4
  export { Card };
@@ -381,9 +381,9 @@
381
381
 
382
382
  // CopyButton
383
383
  .copy-button {
384
- --copy-button-token-idle: var(--code-block-color-foreground-primary);
385
- --copy-button-token-success: var(--code-block-color-foreground-success);
386
- --copy-button-token-error: var(--code-block-color-foreground-success);
384
+ --copy-button-token-idle: var(--code-block-color-foreground-primary) !important;
385
+ --copy-button-token-success: var(--code-block-color-foreground-success) !important;
386
+ --copy-button-token-error: var(--code-block-color-foreground-critical) !important;
387
387
 
388
388
  position: absolute !important;
389
389
  top: 11px; // 12px -1px accounting for border
@@ -1,4 +1,4 @@
1
- import { ReactNode } from 'react';
1
+ import { type ReactNode } from 'react';
2
2
  /**
3
3
  * ALERT: This component is a combination of logic from the official HashiCorp
4
4
  * Design System CodeBlock component and the CodeBlock component written by the
@@ -1,11 +1,10 @@
1
1
  import { jsx as o } from "react/jsx-runtime";
2
2
  import { Badge as a } from "../../badge/index.js";
3
3
  import { localize as i } from "../../../utils/i18n/index.js";
4
- import "../../../utils/i18n/helpers/locale-provider.js";
5
- import { useLocale as n } from "../../../utils/i18n/helpers/use-locale.js";
6
- import m from "./form-indicator.module.css.js";
4
+ import n from "./form-indicator.module.css.js";
5
+ import { useLocale as m } from "../../../utils/i18n/helpers/use-locale.js";
7
6
  const s = ({ isOptional: r, isRequired: l }) => {
8
- const e = n(), t = r ? m.optional : null;
7
+ const e = m(), t = r ? n.optional : null;
9
8
  return r ? /* @__PURE__ */ o("span", { "aria-hidden": "true", className: t, children: `(${i("optional", e, "title")})` }) : l ? /* @__PURE__ */ o(
10
9
  a,
11
10
  {
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../../src/components/form/indicator/index.tsx"],"sourcesContent":["import { Badge } from '../../badge'\nimport { localize } from '../../../utils/i18n'\nimport { useLocale } from '@web/utils/i18n/helpers'\nimport s from './form-indicator.module.css'\n\ninterface IndicatorProps {\n\tisOptional?: boolean\n\tisRequired?: boolean\n}\n\nconst Indicator = ({ isOptional, isRequired }: IndicatorProps) => {\n\tconst locale = useLocale()\n\n\tconst className = isOptional ? s.optional : null\n\n\tif (isOptional) {\n\t\treturn (\n\t\t\t<span aria-hidden=\"true\" className={className}>\n\t\t\t\t{`(${localize('optional', locale, 'title')})`}\n\t\t\t</span>\n\t\t)\n\t} else if (isRequired) {\n\t\treturn (\n\t\t\t<Badge\n\t\t\t\taria-hidden=\"true\"\n\t\t\t\tclassName={className}\n\t\t\t\tsize=\"small\"\n\t\t\t\ttext={localize('required', locale, 'title')}\n\t\t\t/>\n\t\t)\n\t}\n\n\treturn null\n}\n\nIndicator.displayName = 'Indicator'\n\nexport { Indicator }\n"],"names":["Indicator","isOptional","isRequired","locale","useLocale","className","s","jsx","localize","Badge"],"mappings":";;;;;;AAUA,MAAMA,IAAY,CAAC,EAAE,YAAAC,GAAY,YAAAC,QAAiC;AACjE,QAAMC,IAASC,EAAA,GAETC,IAAYJ,IAAaK,EAAE,WAAW;AAE5C,SAAIL,IAEF,gBAAAM,EAAC,QAAA,EAAK,eAAY,QAAO,WAAAF,GACvB,UAAA,IAAIG,EAAS,YAAYL,GAAQ,OAAO,CAAC,KAC3C,IAESD,IAET,gBAAAK;AAAA,IAACE;AAAA,IAAA;AAAA,MACA,eAAY;AAAA,MACZ,WAAAJ;AAAA,MACA,MAAK;AAAA,MACL,MAAMG,EAAS,YAAYL,GAAQ,OAAO;AAAA,IAAA;AAAA,EAAA,IAKtC;AACR;AAEAH,EAAU,cAAc;"}
1
+ {"version":3,"file":"index.js","sources":["../../../../src/components/form/indicator/index.tsx"],"sourcesContent":["import { Badge } from '../../badge'\nimport { localize } from '../../../utils/i18n'\nimport { useLocale } from '../../../utils/i18n/helpers'\nimport s from './form-indicator.module.css'\n\ninterface IndicatorProps {\n\tisOptional?: boolean\n\tisRequired?: boolean\n}\n\nconst Indicator = ({ isOptional, isRequired }: IndicatorProps) => {\n\tconst locale = useLocale()\n\n\tconst className = isOptional ? s.optional : null\n\n\tif (isOptional) {\n\t\treturn (\n\t\t\t<span aria-hidden=\"true\" className={className}>\n\t\t\t\t{`(${localize('optional', locale, 'title')})`}\n\t\t\t</span>\n\t\t)\n\t} else if (isRequired) {\n\t\treturn (\n\t\t\t<Badge\n\t\t\t\taria-hidden=\"true\"\n\t\t\t\tclassName={className}\n\t\t\t\tsize=\"small\"\n\t\t\t\ttext={localize('required', locale, 'title')}\n\t\t\t/>\n\t\t)\n\t}\n\n\treturn null\n}\n\nIndicator.displayName = 'Indicator'\n\nexport { Indicator }\n"],"names":["Indicator","isOptional","isRequired","locale","useLocale","className","s","jsx","localize","Badge"],"mappings":";;;;;AAUA,MAAMA,IAAY,CAAC,EAAE,YAAAC,GAAY,YAAAC,QAAiC;AACjE,QAAMC,IAASC,EAAA,GAETC,IAAYJ,IAAaK,EAAE,WAAW;AAE5C,SAAIL,IAEF,gBAAAM,EAAC,QAAA,EAAK,eAAY,QAAO,WAAAF,GACvB,UAAA,IAAIG,EAAS,YAAYL,GAAQ,OAAO,CAAC,KAC3C,IAESD,IAET,gBAAAK;AAAA,IAACE;AAAA,IAAA;AAAA,MACA,eAAY;AAAA,MACZ,WAAAJ;AAAA,MACA,MAAK;AAAA,MACL,MAAMG,EAAS,YAAYL,GAAQ,OAAO;AAAA,IAAA;AAAA,EAAA,IAKtC;AACR;AAEAH,EAAU,cAAc;"}
@@ -1,6 +1,6 @@
1
1
  import { RadioCardGroup } from './group';
2
- import { HTMLProps, ReactNode } from 'react';
3
- import { BadgeProps } from '../../badge';
2
+ import type { HTMLProps, ReactNode } from 'react';
3
+ import type { BadgeProps } from '../../badge';
4
4
  export declare const DEFAULT_CONTROL_POSITION = "bottom";
5
5
  export declare const DEFAULT_ALIGNMENT = "left";
6
6
  export declare const CONTROL_POSITIONS: readonly ["bottom", "left"];
@@ -13,6 +13,7 @@ interface SelectFieldProps {
13
13
  className?: string;
14
14
  size?: 'medium' | 'large';
15
15
  disabled?: boolean;
16
+ multiple?: boolean;
16
17
  }
17
18
  declare const SelectField: {
18
19
  ({ isInvalid, isLoading, isRequired, isOptional, id, label, helperText, error, field, children, className, size, ...rest }: SelectFieldProps): import("react/jsx-runtime").JSX.Element;
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../../src/components/form/select/index.tsx"],"sourcesContent":["import classNames from 'classnames'\nimport type { HTMLProps, ReactNode } from 'react'\nimport { useId } from 'react'\nimport { Field } from '../field'\nimport s from './form-select.module.css'\n\ninterface SelectBaseProps {\n\tisInvalid?: boolean\n\tisLoading?: boolean\n\trequired?: boolean\n\tclassName?: string\n\tid: string\n\tfield: HTMLProps<HTMLSelectElement>\n\tchildren: ReactNode\n\tsize: 'medium' | 'large'\n\terror?: ReactNode\n\tdisabled?: boolean\n}\n\nconst SelectBase = ({\n\tisInvalid,\n\tisLoading,\n\tclassName,\n\tid,\n\tfield,\n\tchildren,\n\tsize,\n\terror,\n\t...rest\n}: SelectBaseProps) => {\n\treturn (\n\t\t<select\n\t\t\tid={id}\n\t\t\tclassName={classNames(\n\t\t\t\ts.select,\n\t\t\t\ts[size],\n\t\t\t\t{\n\t\t\t\t\t[s.invalid]: isInvalid,\n\t\t\t\t},\n\t\t\t\tclassName\n\t\t\t)}\n\t\t\taria-describedby={`${error ? 'error' : 'helper-text'}-${id}`}\n\t\t\t{...field}\n\t\t\t{...rest}\n\t\t>\n\t\t\t{children}\n\t\t</select>\n\t)\n}\n\ninterface SelectFieldProps {\n\tisInvalid?: boolean\n\tisLoading?: boolean\n\tisRequired?: boolean\n\tisOptional?: boolean\n\tid?: string\n\tlabel?: ReactNode\n\thelperText?: ReactNode\n\terror?: ReactNode\n\tfield: HTMLProps<HTMLSelectElement>\n\tchildren: ReactNode\n\tclassName?: string\n\tsize?: 'medium' | 'large'\n\tdisabled?: boolean\n}\n\nconst SelectField = ({\n\tisInvalid,\n\tisLoading,\n\tisRequired,\n\tisOptional,\n\tid,\n\tlabel,\n\thelperText,\n\terror,\n\tfield,\n\tchildren,\n\tclassName,\n\tsize = 'medium',\n\t...rest\n}: SelectFieldProps) => {\n\tconst generatedId = useId()\n\tconst inputId = id ?? generatedId\n\n\treturn (\n\t\t<Field\n\t\t\tlabel={label}\n\t\t\thelperText={helperText}\n\t\t\terror={error}\n\t\t\tisRequired={isRequired}\n\t\t\tisOptional={isOptional}\n\t\t\tid={inputId}\n\t\t\tlayout=\"vertical\"\n\t\t\tclassName={className}\n\t\t>\n\t\t\t<SelectBase\n\t\t\t\tid={inputId}\n\t\t\t\tisInvalid={isInvalid}\n\t\t\t\trequired={isRequired}\n\t\t\t\tfield={field}\n\t\t\t\tsize={size}\n\t\t\t\t{...rest}\n\t\t\t>\n\t\t\t\t{children}\n\t\t\t</SelectBase>\n\t\t</Field>\n\t)\n}\n\nSelectField.displayName = 'SelectField'\n\nexport { SelectField }\n"],"names":["SelectBase","isInvalid","isLoading","className","id","field","children","size","error","rest","jsx","classNames","s","SelectField","isRequired","isOptional","label","helperText","generatedId","useId","inputId","Field"],"mappings":";;;;;AAmBA,MAAMA,IAAa,CAAC;AAAA,EACnB,WAAAC;AAAA,EACA,WAAAC;AAAA,EACA,WAAAC;AAAA,EACA,IAAAC;AAAA,EACA,OAAAC;AAAA,EACA,UAAAC;AAAA,EACA,MAAAC;AAAA,EACA,OAAAC;AAAA,EACA,GAAGC;AACJ,MAEE,gBAAAC;AAAA,EAAC;AAAA,EAAA;AAAA,IACA,IAAAN;AAAA,IACA,WAAWO;AAAA,MACVC,EAAE;AAAA,MACFA,EAAEL,CAAI;AAAA,MACN;AAAA,QACC,CAACK,EAAE,OAAO,GAAGX;AAAA,MAAA;AAAA,MAEdE;AAAA,IAAA;AAAA,IAED,oBAAkB,GAAGK,IAAQ,UAAU,aAAa,IAAIJ,CAAE;AAAA,IACzD,GAAGC;AAAA,IACH,GAAGI;AAAA,IAEH,UAAAH;AAAA,EAAA;AAAA,GAqBEO,IAAc,CAAC;AAAA,EACpB,WAAAZ;AAAA,EACA,WAAAC;AAAA,EACA,YAAAY;AAAA,EACA,YAAAC;AAAA,EACA,IAAAX;AAAA,EACA,OAAAY;AAAA,EACA,YAAAC;AAAA,EACA,OAAAT;AAAA,EACA,OAAAH;AAAA,EACA,UAAAC;AAAA,EACA,WAAAH;AAAA,EACA,MAAAI,IAAO;AAAA,EACP,GAAGE;AACJ,MAAwB;AACvB,QAAMS,IAAcC,EAAA,GACdC,IAAUhB,KAAMc;AAEtB,SACC,gBAAAR;AAAA,IAACW;AAAA,IAAA;AAAA,MACA,OAAAL;AAAA,MACA,YAAAC;AAAA,MACA,OAAAT;AAAA,MACA,YAAAM;AAAA,MACA,YAAAC;AAAA,MACA,IAAIK;AAAA,MACJ,QAAO;AAAA,MACP,WAAAjB;AAAA,MAEA,UAAA,gBAAAO;AAAA,QAACV;AAAA,QAAA;AAAA,UACA,IAAIoB;AAAA,UACJ,WAAAnB;AAAA,UACA,UAAUa;AAAA,UACV,OAAAT;AAAA,UACA,MAAAE;AAAA,UACC,GAAGE;AAAA,UAEH,UAAAH;AAAA,QAAA;AAAA,MAAA;AAAA,IACF;AAAA,EAAA;AAGH;AAEAO,EAAY,cAAc;"}
1
+ {"version":3,"file":"index.js","sources":["../../../../src/components/form/select/index.tsx"],"sourcesContent":["import classNames from 'classnames'\nimport type { HTMLProps, ReactNode } from 'react'\nimport { useId } from 'react'\nimport { Field } from '../field'\nimport s from './form-select.module.css'\n\ninterface SelectBaseProps {\n\tisInvalid?: boolean\n\tisLoading?: boolean\n\trequired?: boolean\n\tclassName?: string\n\tid: string\n\tfield: HTMLProps<HTMLSelectElement>\n\tchildren: ReactNode\n\tsize: 'medium' | 'large'\n\terror?: ReactNode\n\tdisabled?: boolean\n}\n\nconst SelectBase = ({\n\tisInvalid,\n\tisLoading,\n\tclassName,\n\tid,\n\tfield,\n\tchildren,\n\tsize,\n\terror,\n\t...rest\n}: SelectBaseProps) => {\n\treturn (\n\t\t<select\n\t\t\tid={id}\n\t\t\tclassName={classNames(\n\t\t\t\ts.select,\n\t\t\t\ts[size],\n\t\t\t\t{\n\t\t\t\t\t[s.invalid]: isInvalid,\n\t\t\t\t},\n\t\t\t\tclassName\n\t\t\t)}\n\t\t\taria-describedby={`${error ? 'error' : 'helper-text'}-${id}`}\n\t\t\t{...field}\n\t\t\t{...rest}\n\t\t>\n\t\t\t{children}\n\t\t</select>\n\t)\n}\n\ninterface SelectFieldProps {\n\tisInvalid?: boolean\n\tisLoading?: boolean\n\tisRequired?: boolean\n\tisOptional?: boolean\n\tid?: string\n\tlabel?: ReactNode\n\thelperText?: ReactNode\n\terror?: ReactNode\n\tfield: HTMLProps<HTMLSelectElement>\n\tchildren: ReactNode\n\tclassName?: string\n\tsize?: 'medium' | 'large'\n\tdisabled?: boolean\n\tmultiple?: boolean\n}\n\nconst SelectField = ({\n\tisInvalid,\n\tisLoading,\n\tisRequired,\n\tisOptional,\n\tid,\n\tlabel,\n\thelperText,\n\terror,\n\tfield,\n\tchildren,\n\tclassName,\n\tsize = 'medium',\n\t...rest\n}: SelectFieldProps) => {\n\tconst generatedId = useId()\n\tconst inputId = id ?? generatedId\n\n\treturn (\n\t\t<Field\n\t\t\tlabel={label}\n\t\t\thelperText={helperText}\n\t\t\terror={error}\n\t\t\tisRequired={isRequired}\n\t\t\tisOptional={isOptional}\n\t\t\tid={inputId}\n\t\t\tlayout=\"vertical\"\n\t\t\tclassName={className}\n\t\t>\n\t\t\t<SelectBase\n\t\t\t\tid={inputId}\n\t\t\t\tisInvalid={isInvalid}\n\t\t\t\trequired={isRequired}\n\t\t\t\tfield={field}\n\t\t\t\tsize={size}\n\t\t\t\t{...rest}\n\t\t\t>\n\t\t\t\t{children}\n\t\t\t</SelectBase>\n\t\t</Field>\n\t)\n}\n\nSelectField.displayName = 'SelectField'\n\nexport { SelectField }\n"],"names":["SelectBase","isInvalid","isLoading","className","id","field","children","size","error","rest","jsx","classNames","s","SelectField","isRequired","isOptional","label","helperText","generatedId","useId","inputId","Field"],"mappings":";;;;;AAmBA,MAAMA,IAAa,CAAC;AAAA,EACnB,WAAAC;AAAA,EACA,WAAAC;AAAA,EACA,WAAAC;AAAA,EACA,IAAAC;AAAA,EACA,OAAAC;AAAA,EACA,UAAAC;AAAA,EACA,MAAAC;AAAA,EACA,OAAAC;AAAA,EACA,GAAGC;AACJ,MAEE,gBAAAC;AAAA,EAAC;AAAA,EAAA;AAAA,IACA,IAAAN;AAAA,IACA,WAAWO;AAAA,MACVC,EAAE;AAAA,MACFA,EAAEL,CAAI;AAAA,MACN;AAAA,QACC,CAACK,EAAE,OAAO,GAAGX;AAAA,MAAA;AAAA,MAEdE;AAAA,IAAA;AAAA,IAED,oBAAkB,GAAGK,IAAQ,UAAU,aAAa,IAAIJ,CAAE;AAAA,IACzD,GAAGC;AAAA,IACH,GAAGI;AAAA,IAEH,UAAAH;AAAA,EAAA;AAAA,GAsBEO,IAAc,CAAC;AAAA,EACpB,WAAAZ;AAAA,EACA,WAAAC;AAAA,EACA,YAAAY;AAAA,EACA,YAAAC;AAAA,EACA,IAAAX;AAAA,EACA,OAAAY;AAAA,EACA,YAAAC;AAAA,EACA,OAAAT;AAAA,EACA,OAAAH;AAAA,EACA,UAAAC;AAAA,EACA,WAAAH;AAAA,EACA,MAAAI,IAAO;AAAA,EACP,GAAGE;AACJ,MAAwB;AACvB,QAAMS,IAAcC,EAAA,GACdC,IAAUhB,KAAMc;AAEtB,SACC,gBAAAR;AAAA,IAACW;AAAA,IAAA;AAAA,MACA,OAAAL;AAAA,MACA,YAAAC;AAAA,MACA,OAAAT;AAAA,MACA,YAAAM;AAAA,MACA,YAAAC;AAAA,MACA,IAAIK;AAAA,MACJ,QAAO;AAAA,MACP,WAAAjB;AAAA,MAEA,UAAA,gBAAAO;AAAA,QAACV;AAAA,QAAA;AAAA,UACA,IAAIoB;AAAA,UACJ,WAAAnB;AAAA,UACA,UAAUa;AAAA,UACV,OAAAT;AAAA,UACA,MAAAE;AAAA,UACC,GAAGE;AAAA,UAEH,UAAAH;AAAA,QAAA;AAAA,MAAA;AAAA,IACF;AAAA,EAAA;AAGH;AAEAO,EAAY,cAAc;"}
@@ -1,4 +1,4 @@
1
- import { ComponentPropsWithRef, ElementType } from 'react';
1
+ import { type ComponentPropsWithRef, type ElementType } from 'react';
2
2
  declare const TEXT_COLORS: readonly ["primary", "strong", "faint", "disabled", "high-contrast", "action", "action-hover", "action-active", "highlight", "highlight-on-surface", "highlight-high-contrast", "success", "success-on-surface", "success-high-contrast", "warning", "warning-on-surface", "warning-high-contrast", "critical", "critical-on-surface", "critical-high-contrast"];
3
3
  declare const TEXT_GROUPS: readonly ["hds-body", "code", "body", "display-expressive", "label"];
4
4
  declare const TEXT_SIZES: readonly ["100", "200", "300", "400", "500", "600", "700", "800"];
@@ -10,7 +10,7 @@ type TextSize = (typeof TEXT_SIZES)[number];
10
10
  type HexColor = string & {
11
11
  hexish?: unknown;
12
12
  };
13
- interface BaseTextProps<T extends ElementType> {
13
+ interface BaseTextProps<T extends ElementType> extends React.PropsWithChildren {
14
14
  tag?: T;
15
15
  size?: TextSize;
16
16
  weight?: TextWeight;
@@ -35,10 +35,10 @@ interface CodeProps<T extends ElementType> extends BaseTextProps<T> {
35
35
  size?: '100' | '200' | '300';
36
36
  }
37
37
  declare const Text: {
38
- Body: <T extends ElementType<any, keyof import("react").JSX.IntrinsicElements>>({ size, ...rest }: BodyProps<T> & Omit<ComponentPropsWithRef<T>, keyof BodyProps<T>>) => import('react').FunctionComponentElement<TextImplProps<ElementType<any, keyof import("react").JSX.IntrinsicElements>> & Omit<any, keyof TextImplProps<T_1>>>;
39
- DisplayExpressive: <T_2 extends ElementType<any, keyof import("react").JSX.IntrinsicElements>>({ size, ...rest }: DisplayExpressiveProps<T_2> & Omit<ComponentPropsWithRef<T_2>, keyof DisplayExpressiveProps<T_2>>) => import('react').FunctionComponentElement<TextImplProps<ElementType<any, keyof import("react").JSX.IntrinsicElements>> & Omit<any, keyof TextImplProps<T_1>>>;
40
- Label: <T_3 extends ElementType<any, keyof import("react").JSX.IntrinsicElements>>(props: LabelProps<T_3> & Omit<ComponentPropsWithRef<T_3>, "className" | "color" | "tag" | "weight" | "align">) => import('react').FunctionComponentElement<TextImplProps<ElementType<any, keyof import("react").JSX.IntrinsicElements>> & Omit<any, keyof TextImplProps<T_1>>>;
41
- HDSBody: <T_4 extends ElementType<any, keyof import("react").JSX.IntrinsicElements>>({ size, weight, ...rest }: HDSBodyProps<T_4> & Omit<ComponentPropsWithRef<T_4>, keyof HDSBodyProps<T_4>>) => import('react').FunctionComponentElement<TextImplProps<ElementType<any, keyof import("react").JSX.IntrinsicElements>> & Omit<any, keyof TextImplProps<T_1>>>;
42
- Code: <T_5 extends ElementType<any, keyof import("react").JSX.IntrinsicElements>>({ size, weight, ...rest }: CodeProps<T_5> & Omit<ComponentPropsWithRef<T_5>, keyof CodeProps<T_5>>) => import('react').FunctionComponentElement<TextImplProps<ElementType<any, keyof import("react").JSX.IntrinsicElements>> & Omit<any, keyof TextImplProps<T_1>>>;
38
+ Body: <T extends ElementType>({ size, ...rest }: BodyProps<T> & Omit<ComponentPropsWithRef<T>, keyof BodyProps<T>>) => import("react").FunctionComponentElement<TextImplProps<ElementType> & Omit<any, keyof TextImplProps<T_1>>>;
39
+ DisplayExpressive: <T extends ElementType>({ size, ...rest }: DisplayExpressiveProps<T> & Omit<ComponentPropsWithRef<T>, keyof DisplayExpressiveProps<T>>) => import("react").FunctionComponentElement<TextImplProps<ElementType> & Omit<any, keyof TextImplProps<T_1>>>;
40
+ Label: <T extends ElementType>(props: LabelProps<T> & Omit<ComponentPropsWithRef<T>, keyof LabelProps<T>>) => import("react").FunctionComponentElement<TextImplProps<ElementType> & Omit<any, keyof TextImplProps<T_1>>>;
41
+ HDSBody: <T extends ElementType>({ size, weight, ...rest }: HDSBodyProps<T> & Omit<ComponentPropsWithRef<T>, keyof HDSBodyProps<T>>) => import("react").FunctionComponentElement<TextImplProps<ElementType> & Omit<any, keyof TextImplProps<T_1>>>;
42
+ Code: <T extends ElementType>({ size, weight, ...rest }: CodeProps<T> & Omit<ComponentPropsWithRef<T>, keyof CodeProps<T>>) => import("react").FunctionComponentElement<TextImplProps<ElementType> & Omit<any, keyof TextImplProps<T_1>>>;
43
43
  };
44
44
  export { Text, TEXT_COLORS, TEXT_WEIGHTS };
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../src/components/text/index.tsx"],"sourcesContent":["import classNames from 'classnames'\nimport {\n\tcreateElement,\n\ttype ComponentPropsWithRef,\n\ttype ElementType,\n} from 'react'\nimport s from './style.module.scss'\n\nconst TEXT_COLORS = [\n\t'primary',\n\t'strong',\n\t'faint',\n\t'disabled',\n\t'high-contrast',\n\t'action',\n\t'action-hover',\n\t'action-active',\n\t'highlight',\n\t'highlight-on-surface',\n\t'highlight-high-contrast',\n\t'success',\n\t'success-on-surface',\n\t'success-high-contrast',\n\t'warning',\n\t'warning-on-surface',\n\t'warning-high-contrast',\n\t'critical',\n\t'critical-on-surface',\n\t'critical-high-contrast',\n] as const\n\nconst TEXT_GROUPS = [\n\t'hds-body',\n\t'code',\n\t'body',\n\t'display-expressive',\n\t'label',\n] as const\n\nconst TEXT_SIZES = [\n\t'100',\n\t'200',\n\t'300',\n\t'400',\n\t'500',\n\t'600',\n\t'700',\n\t'800',\n] as const\n\nconst TEXT_WEIGHTS = ['regular', 'medium', 'semibold', 'bold'] as const\n\ntype TextColor = (typeof TEXT_COLORS)[number]\ntype TextWeight = (typeof TEXT_WEIGHTS)[number]\ntype TextGroup = (typeof TEXT_GROUPS)[number]\ntype TextSize = (typeof TEXT_SIZES)[number]\n\n// small typescript hack to support autocomplete and arbitrary strings\ntype HexColor = string & { hexish?: unknown }\n\ninterface BaseTextProps<T extends ElementType> {\n\ttag?: T\n\tsize?: TextSize\n\tweight?: TextWeight\n\talign?: 'left' | 'center' | 'right'\n\tcolor?: TextColor | HexColor\n\tclassName?: string\n}\n\ninterface TextImplProps<T extends ElementType> extends BaseTextProps<T> {\n\tgroup: TextGroup\n}\n\nfunction getTypographyToken(group: TextGroup, size: TextSize): string {\n\tconst groupToTokenMap: Record<TextGroup, string> = {\n\t\t'hds-body': `mds-typography-legacy-body-${size}`,\n\t\tcode: `mds-typography-code-${size}`,\n\t\t'display-expressive': `mds-typography-display-expressive-${size}`,\n\t\tlabel: `mds-typography-label`,\n\t\tbody: `mds-typography-body-${size}`,\n\t}\n\n\treturn groupToTokenMap[group]\n}\n\nconst TextImpl = <T extends ElementType = 'span'>({\n\ttag,\n\tgroup,\n\tsize = '200',\n\tweight,\n\talign,\n\tcolor,\n\tchildren,\n\tclassName,\n\t...rest\n}: TextImplProps<T> &\n\tOmit<ComponentPropsWithRef<T>, keyof TextImplProps<T>>) => {\n\tconst Component = tag ?? 'span'\n\tconst variant = getTypographyToken(group, size)\n\n\tconst usesPredefinedColor = TEXT_COLORS.includes(color as TextColor)\n\n\treturn (\n\t\t<Component\n\t\t\tclassName={classNames(\n\t\t\t\tvariant,\n\t\t\t\t{\n\t\t\t\t\t[s[`align-${align}`]]: align,\n\t\t\t\t\t[`mds-typography-font-weight-${weight}`]: weight,\n\t\t\t\t\t[`mds-foreground-${color}`]: color && usesPredefinedColor,\n\t\t\t\t},\n\t\t\t\tclassName\n\t\t\t)}\n\t\t\tstyle={color && !usesPredefinedColor ? { color } : {}}\n\t\t\t{...rest}\n\t\t>\n\t\t\t{children}\n\t\t</Component>\n\t)\n}\n\ninterface BodyProps<T extends ElementType> extends BaseTextProps<T> {\n\tsize?: '200' | '300' | '400'\n}\n\nconst Body = <T extends ElementType>({\n\tsize = '300',\n\t...rest\n}: BodyProps<T> & Omit<ComponentPropsWithRef<T>, keyof BodyProps<T>>) => {\n\treturn createElement(TextImpl, {\n\t\t...rest,\n\t\tsize,\n\t\tgroup: 'body',\n\t})\n}\n\ninterface DisplayExpressiveProps<T extends ElementType>\n\textends BaseTextProps<T> {\n\tsize?: '100' | '200' | '300' | '400' | '500' | '600' | '700' | '800'\n}\n\nconst DisplayExpressive = <T extends ElementType>({\n\tsize = '200',\n\t...rest\n}: DisplayExpressiveProps<T> &\n\tOmit<ComponentPropsWithRef<T>, keyof DisplayExpressiveProps<T>>) => {\n\treturn createElement(TextImpl, {\n\t\t...rest,\n\t\tsize,\n\t\tgroup: 'display-expressive',\n\t})\n}\n\ntype LabelProps<T extends ElementType> = Omit<BaseTextProps<T>, 'size'>\n\nconst Label = <T extends ElementType>(\n\tprops: LabelProps<T> & Omit<ComponentPropsWithRef<T>, keyof LabelProps<T>>\n) => {\n\treturn createElement(TextImpl, {\n\t\t...props,\n\t\tgroup: 'label',\n\t})\n}\n\ninterface HDSBodyProps<T extends ElementType> extends BaseTextProps<T> {\n\tsize?: '100' | '200' | '300'\n}\n\nconst HDSBody = <T extends ElementType>({\n\tsize = '200',\n\tweight = 'regular',\n\t...rest\n}: HDSBodyProps<T> & Omit<ComponentPropsWithRef<T>, keyof HDSBodyProps<T>>) => {\n\treturn createElement(TextImpl, {\n\t\t...rest,\n\t\tsize,\n\t\tweight,\n\t\tgroup: 'hds-body',\n\t})\n}\n\ninterface CodeProps<T extends ElementType> extends BaseTextProps<T> {\n\tsize?: '100' | '200' | '300'\n}\n\nconst Code = <T extends ElementType>({\n\tsize = '200',\n\tweight = 'regular',\n\t...rest\n}: CodeProps<T> & Omit<ComponentPropsWithRef<T>, keyof CodeProps<T>>) => {\n\treturn createElement(TextImpl, {\n\t\t...rest,\n\t\tsize,\n\t\tweight,\n\t\tgroup: 'code',\n\t})\n}\n\nconst Text = {\n\tBody,\n\tDisplayExpressive,\n\tLabel,\n\tHDSBody,\n\tCode,\n}\n\nexport { Text, TEXT_COLORS, TEXT_WEIGHTS }\n"],"names":["TEXT_COLORS","TEXT_WEIGHTS","getTypographyToken","group","size","TextImpl","tag","weight","align","color","children","className","rest","Component","variant","usesPredefinedColor","jsx","classNames","s","Body","createElement","DisplayExpressive","Label","props","HDSBody","Code","Text"],"mappings":";;;;AAQA,MAAMA,IAAc;AAAA,EACnB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD,GAqBMC,IAAe,CAAC,WAAW,UAAU,YAAY,MAAM;AAuB7D,SAASC,EAAmBC,GAAkBC,GAAwB;AASrE,SARmD;AAAA,IAClD,YAAY,8BAA8BA,CAAI;AAAA,IAC9C,MAAM,uBAAuBA,CAAI;AAAA,IACjC,sBAAsB,qCAAqCA,CAAI;AAAA,IAC/D,OAAO;AAAA,IACP,MAAM,uBAAuBA,CAAI;AAAA,EAAA,EAGXD,CAAK;AAC7B;AAEA,MAAME,IAAW,CAAiC;AAAA,EACjD,KAAAC;AAAA,EACA,OAAAH;AAAA,EACA,MAAAC,IAAO;AAAA,EACP,QAAAG;AAAA,EACA,OAAAC;AAAA,EACA,OAAAC;AAAA,EACA,UAAAC;AAAA,EACA,WAAAC;AAAA,EACA,GAAGC;AACJ,MAC4D;AAC3D,QAAMC,IAAYP,KAAO,QACnBQ,IAAUZ,EAAmBC,GAAOC,CAAI,GAExCW,IAAsBf,EAAY,SAASS,CAAkB;AAEnE,SACC,gBAAAO;AAAA,IAACH;AAAA,IAAA;AAAA,MACA,WAAWI;AAAA,QACVH;AAAA,QACA;AAAA,UACC,CAACI,EAAE,SAASV,CAAK,EAAE,CAAC,GAAGA;AAAA,UACvB,CAAC,8BAA8BD,CAAM,EAAE,GAAGA;AAAA,UAC1C,CAAC,kBAAkBE,CAAK,EAAE,GAAGA,KAASM;AAAA,QAAA;AAAA,QAEvCJ;AAAA,MAAA;AAAA,MAED,OAAOF,KAAS,CAACM,IAAsB,EAAE,OAAAN,EAAA,IAAU,CAAA;AAAA,MAClD,GAAGG;AAAA,MAEH,UAAAF;AAAA,IAAA;AAAA,EAAA;AAGJ,GAMMS,IAAO,CAAwB;AAAA,EACpC,MAAAf,IAAO;AAAA,EACP,GAAGQ;AACJ,MACQQ,EAAcf,GAAU;AAAA,EAC9B,GAAGO;AAAA,EACH,MAAAR;AAAA,EACA,OAAO;AAAA,CACP,GAQIiB,IAAoB,CAAwB;AAAA,EACjD,MAAAjB,IAAO;AAAA,EACP,GAAGQ;AACJ,MAEQQ,EAAcf,GAAU;AAAA,EAC9B,GAAGO;AAAA,EACH,MAAAR;AAAA,EACA,OAAO;AAAA,CACP,GAKIkB,IAAQ,CACbC,MAEOH,EAAcf,GAAU;AAAA,EAC9B,GAAGkB;AAAA,EACH,OAAO;AAAA,CACP,GAOIC,IAAU,CAAwB;AAAA,EACvC,MAAApB,IAAO;AAAA,EACP,QAAAG,IAAS;AAAA,EACT,GAAGK;AACJ,MACQQ,EAAcf,GAAU;AAAA,EAC9B,GAAGO;AAAA,EACH,MAAAR;AAAA,EACA,QAAAG;AAAA,EACA,OAAO;AAAA,CACP,GAOIkB,IAAO,CAAwB;AAAA,EACpC,MAAArB,IAAO;AAAA,EACP,QAAAG,IAAS;AAAA,EACT,GAAGK;AACJ,MACQQ,EAAcf,GAAU;AAAA,EAC9B,GAAGO;AAAA,EACH,MAAAR;AAAA,EACA,QAAAG;AAAA,EACA,OAAO;AAAA,CACP,GAGImB,IAAO;AAAA,EACZ,MAAAP;AAAA,EACA,mBAAAE;AAAA,EACA,OAAAC;AAAA,EACA,SAAAE;AAAA,EACA,MAAAC;AACD;"}
1
+ {"version":3,"file":"index.js","sources":["../../../src/components/text/index.tsx"],"sourcesContent":["import classNames from 'classnames'\nimport {\n\tcreateElement,\n\ttype ComponentPropsWithRef,\n\ttype ElementType,\n} from 'react'\nimport s from './style.module.scss'\n\nconst TEXT_COLORS = [\n\t'primary',\n\t'strong',\n\t'faint',\n\t'disabled',\n\t'high-contrast',\n\t'action',\n\t'action-hover',\n\t'action-active',\n\t'highlight',\n\t'highlight-on-surface',\n\t'highlight-high-contrast',\n\t'success',\n\t'success-on-surface',\n\t'success-high-contrast',\n\t'warning',\n\t'warning-on-surface',\n\t'warning-high-contrast',\n\t'critical',\n\t'critical-on-surface',\n\t'critical-high-contrast',\n] as const\n\nconst TEXT_GROUPS = [\n\t'hds-body',\n\t'code',\n\t'body',\n\t'display-expressive',\n\t'label',\n] as const\n\nconst TEXT_SIZES = [\n\t'100',\n\t'200',\n\t'300',\n\t'400',\n\t'500',\n\t'600',\n\t'700',\n\t'800',\n] as const\n\nconst TEXT_WEIGHTS = ['regular', 'medium', 'semibold', 'bold'] as const\n\ntype TextColor = (typeof TEXT_COLORS)[number]\ntype TextWeight = (typeof TEXT_WEIGHTS)[number]\ntype TextGroup = (typeof TEXT_GROUPS)[number]\ntype TextSize = (typeof TEXT_SIZES)[number]\n\n// small typescript hack to support autocomplete and arbitrary strings\ntype HexColor = string & { hexish?: unknown }\n\ninterface BaseTextProps<T extends ElementType> extends React.PropsWithChildren {\n\ttag?: T\n\tsize?: TextSize\n\tweight?: TextWeight\n\talign?: 'left' | 'center' | 'right'\n\tcolor?: TextColor | HexColor\n\tclassName?: string\n}\n\ninterface TextImplProps<T extends ElementType> extends BaseTextProps<T> {\n\tgroup: TextGroup\n}\n\nfunction getTypographyToken(group: TextGroup, size: TextSize): string {\n\tconst groupToTokenMap: Record<TextGroup, string> = {\n\t\t'hds-body': `mds-typography-legacy-body-${size}`,\n\t\tcode: `mds-typography-code-${size}`,\n\t\t'display-expressive': `mds-typography-display-expressive-${size}`,\n\t\tlabel: `mds-typography-label`,\n\t\tbody: `mds-typography-body-${size}`,\n\t}\n\n\treturn groupToTokenMap[group]\n}\n\nconst TextImpl = <T extends ElementType = 'span'>({\n\ttag,\n\tgroup,\n\tsize = '200',\n\tweight,\n\talign,\n\tcolor,\n\tchildren,\n\tclassName,\n\t...rest\n}: TextImplProps<T> &\n\tOmit<ComponentPropsWithRef<T>, keyof TextImplProps<T>>) => {\n\tconst Component = tag ?? 'span'\n\tconst variant = getTypographyToken(group, size)\n\n\tconst usesPredefinedColor = TEXT_COLORS.includes(color as TextColor)\n\n\treturn (\n\t\t<Component\n\t\t\tclassName={classNames(\n\t\t\t\tvariant,\n\t\t\t\t{\n\t\t\t\t\t[s[`align-${align}`]]: align,\n\t\t\t\t\t[`mds-typography-font-weight-${weight}`]: weight,\n\t\t\t\t\t[`mds-foreground-${color}`]: color && usesPredefinedColor,\n\t\t\t\t},\n\t\t\t\tclassName\n\t\t\t)}\n\t\t\tstyle={color && !usesPredefinedColor ? { color } : {}}\n\t\t\t{...rest}\n\t\t>\n\t\t\t{children}\n\t\t</Component>\n\t)\n}\n\ninterface BodyProps<T extends ElementType> extends BaseTextProps<T> {\n\tsize?: '200' | '300' | '400'\n}\n\nconst Body = <T extends ElementType>({\n\tsize = '300',\n\t...rest\n}: BodyProps<T> & Omit<ComponentPropsWithRef<T>, keyof BodyProps<T>>) => {\n\treturn createElement(TextImpl, {\n\t\t...rest,\n\t\tsize,\n\t\tgroup: 'body',\n\t})\n}\n\ninterface DisplayExpressiveProps<T extends ElementType>\n\textends BaseTextProps<T> {\n\tsize?: '100' | '200' | '300' | '400' | '500' | '600' | '700' | '800'\n}\n\nconst DisplayExpressive = <T extends ElementType>({\n\tsize = '200',\n\t...rest\n}: DisplayExpressiveProps<T> &\n\tOmit<ComponentPropsWithRef<T>, keyof DisplayExpressiveProps<T>>) => {\n\treturn createElement(TextImpl, {\n\t\t...rest,\n\t\tsize,\n\t\tgroup: 'display-expressive',\n\t})\n}\n\ntype LabelProps<T extends ElementType> = Omit<BaseTextProps<T>, 'size'>\n\nconst Label = <T extends ElementType>(\n\tprops: LabelProps<T> & Omit<ComponentPropsWithRef<T>, keyof LabelProps<T>>\n) => {\n\treturn createElement(TextImpl, {\n\t\t...props,\n\t\tgroup: 'label',\n\t})\n}\n\ninterface HDSBodyProps<T extends ElementType> extends BaseTextProps<T> {\n\tsize?: '100' | '200' | '300'\n}\n\nconst HDSBody = <T extends ElementType>({\n\tsize = '200',\n\tweight = 'regular',\n\t...rest\n}: HDSBodyProps<T> & Omit<ComponentPropsWithRef<T>, keyof HDSBodyProps<T>>) => {\n\treturn createElement(TextImpl, {\n\t\t...rest,\n\t\tsize,\n\t\tweight,\n\t\tgroup: 'hds-body',\n\t})\n}\n\ninterface CodeProps<T extends ElementType> extends BaseTextProps<T> {\n\tsize?: '100' | '200' | '300'\n}\n\nconst Code = <T extends ElementType>({\n\tsize = '200',\n\tweight = 'regular',\n\t...rest\n}: CodeProps<T> & Omit<ComponentPropsWithRef<T>, keyof CodeProps<T>>) => {\n\treturn createElement(TextImpl, {\n\t\t...rest,\n\t\tsize,\n\t\tweight,\n\t\tgroup: 'code',\n\t})\n}\n\nconst Text = {\n\tBody,\n\tDisplayExpressive,\n\tLabel,\n\tHDSBody,\n\tCode,\n}\n\nexport { Text, TEXT_COLORS, TEXT_WEIGHTS }\n"],"names":["TEXT_COLORS","TEXT_WEIGHTS","getTypographyToken","group","size","TextImpl","tag","weight","align","color","children","className","rest","Component","variant","usesPredefinedColor","jsx","classNames","s","Body","createElement","DisplayExpressive","Label","props","HDSBody","Code","Text"],"mappings":";;;;AAQA,MAAMA,IAAc;AAAA,EACnB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD,GAqBMC,IAAe,CAAC,WAAW,UAAU,YAAY,MAAM;AAuB7D,SAASC,EAAmBC,GAAkBC,GAAwB;AASrE,SARmD;AAAA,IAClD,YAAY,8BAA8BA,CAAI;AAAA,IAC9C,MAAM,uBAAuBA,CAAI;AAAA,IACjC,sBAAsB,qCAAqCA,CAAI;AAAA,IAC/D,OAAO;AAAA,IACP,MAAM,uBAAuBA,CAAI;AAAA,EAAA,EAGXD,CAAK;AAC7B;AAEA,MAAME,IAAW,CAAiC;AAAA,EACjD,KAAAC;AAAA,EACA,OAAAH;AAAA,EACA,MAAAC,IAAO;AAAA,EACP,QAAAG;AAAA,EACA,OAAAC;AAAA,EACA,OAAAC;AAAA,EACA,UAAAC;AAAA,EACA,WAAAC;AAAA,EACA,GAAGC;AACJ,MAC4D;AAC3D,QAAMC,IAAYP,KAAO,QACnBQ,IAAUZ,EAAmBC,GAAOC,CAAI,GAExCW,IAAsBf,EAAY,SAASS,CAAkB;AAEnE,SACC,gBAAAO;AAAA,IAACH;AAAA,IAAA;AAAA,MACA,WAAWI;AAAA,QACVH;AAAA,QACA;AAAA,UACC,CAACI,EAAE,SAASV,CAAK,EAAE,CAAC,GAAGA;AAAA,UACvB,CAAC,8BAA8BD,CAAM,EAAE,GAAGA;AAAA,UAC1C,CAAC,kBAAkBE,CAAK,EAAE,GAAGA,KAASM;AAAA,QAAA;AAAA,QAEvCJ;AAAA,MAAA;AAAA,MAED,OAAOF,KAAS,CAACM,IAAsB,EAAE,OAAAN,EAAA,IAAU,CAAA;AAAA,MAClD,GAAGG;AAAA,MAEH,UAAAF;AAAA,IAAA;AAAA,EAAA;AAGJ,GAMMS,IAAO,CAAwB;AAAA,EACpC,MAAAf,IAAO;AAAA,EACP,GAAGQ;AACJ,MACQQ,EAAcf,GAAU;AAAA,EAC9B,GAAGO;AAAA,EACH,MAAAR;AAAA,EACA,OAAO;AAAA,CACP,GAQIiB,IAAoB,CAAwB;AAAA,EACjD,MAAAjB,IAAO;AAAA,EACP,GAAGQ;AACJ,MAEQQ,EAAcf,GAAU;AAAA,EAC9B,GAAGO;AAAA,EACH,MAAAR;AAAA,EACA,OAAO;AAAA,CACP,GAKIkB,IAAQ,CACbC,MAEOH,EAAcf,GAAU;AAAA,EAC9B,GAAGkB;AAAA,EACH,OAAO;AAAA,CACP,GAOIC,IAAU,CAAwB;AAAA,EACvC,MAAApB,IAAO;AAAA,EACP,QAAAG,IAAS;AAAA,EACT,GAAGK;AACJ,MACQQ,EAAcf,GAAU;AAAA,EAC9B,GAAGO;AAAA,EACH,MAAAR;AAAA,EACA,QAAAG;AAAA,EACA,OAAO;AAAA,CACP,GAOIkB,IAAO,CAAwB;AAAA,EACpC,MAAArB,IAAO;AAAA,EACP,QAAAG,IAAS;AAAA,EACT,GAAGK;AACJ,MACQQ,EAAcf,GAAU;AAAA,EAC9B,GAAGO;AAAA,EACH,MAAAR;AAAA,EACA,QAAAG;AAAA,EACA,OAAO;AAAA,CACP,GAGImB,IAAO;AAAA,EACZ,MAAAP;AAAA,EACA,mBAAAE;AAAA,EACA,OAAAC;AAAA,EACA,SAAAE;AAAA,EACA,MAAAC;AACD;"}
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  interface Dataset {
3
2
  label: string;
4
3
  values: Array<{
@@ -1,4 +1,4 @@
1
- import { default as HorizontalBarChart, HorizontalBarChartProps } from './horizontal-chart';
1
+ import HorizontalBarChart, { type HorizontalBarChartProps } from './horizontal-chart';
2
2
  interface HorizontalBarChart extends HorizontalBarChartProps {
3
3
  name: string;
4
4
  caption: string;
package/index.js CHANGED
@@ -3,14 +3,14 @@ import { BADGE_COLORS as p, BADGE_SIZES as m, BADGE_TYPES as x, Badge as f } fro
3
3
  import { BadgeCount as i } from "./components/badge-count/index.js";
4
4
  import { Alert as n, AlertActions as l, AlertButton as T, AlertStandaloneLink as C } from "./components/alert/index.js";
5
5
  import { Breadcrumbs as S } from "./components/breadcrumbs/index.js";
6
- import { BUTTON_COLORS as A, BUTTON_ICON_POSITIONS as s, BUTTON_SIZES as L, Button as c } from "./components/button/index.js";
6
+ import { BUTTON_COLORS as L, BUTTON_ICON_POSITIONS as c, BUTTON_SIZES as s, Button as A } from "./components/button/index.js";
7
7
  import { Card as _, CardContent as P } from "./components/card/index.js";
8
8
  import { CodeBlock as B } from "./components/code-block/index.js";
9
9
  import { DisclosurePrimitive as D } from "./components/disclosure-primitive/index.js";
10
10
  import { useDisclosurePrimitive as R } from "./components/disclosure-primitive/use-disclosure-primitive.js";
11
11
  import { Dropdown as F } from "./components/dropdown/index.js";
12
12
  import { FLIGHT_ICON_SIZES as b, FlightIcon as k } from "./components/flight-icon/index.js";
13
- import { CheckboxBase as M, CheckboxField as v, CheckboxGroup as Z } from "./components/form/checkbox/index.js";
13
+ import { CheckboxBase as v, CheckboxField as M, CheckboxGroup as Z } from "./components/form/checkbox/index.js";
14
14
  import { Error as H } from "./components/form/error/index.js";
15
15
  import { Field as Y } from "./components/form/field/index.js";
16
16
  import { Fieldset as w } from "./components/form/fieldset/index.js";
@@ -24,14 +24,14 @@ import { RadioCard as ao } from "./components/form/radio-card/index.js";
24
24
  import { SelectField as no } from "./components/form/select/index.js";
25
25
  import { SuperSelectField as To } from "./components/form/super-select/index.js";
26
26
  import { TextInput as Oo, TextInputBase as So } from "./components/form/text-input/index.js";
27
- import { TextAreaField as Ao } from "./components/form/textarea/index.js";
28
- import { ToggleBase as Lo, ToggleField as co, ToggleGroup as Io } from "./components/form/toggle/index.js";
27
+ import { TextAreaField as Lo } from "./components/form/textarea/index.js";
28
+ import { ToggleBase as so, ToggleField as Ao, ToggleGroup as Io } from "./components/form/toggle/index.js";
29
29
  import { IconTile as Po } from "./components/icon-tile/index.js";
30
30
  import { InlineLink as Bo } from "./components/inline-link/index.js";
31
31
  import { MDSButton as Do } from "./components/legacy-button/index.js";
32
32
  import { ModalProvider as Ro } from "./components/modal/index.js";
33
33
  import { Separator as Fo } from "./components/separator/index.js";
34
- import { STANDALONE_LINK_COLORS as bo, STANDALONE_LINK_ICON_POSITIONS as ko, STANDALONE_LINK_SIZES as ho, StandaloneLink as Mo } from "./components/standalone-link/index.js";
34
+ import { STANDALONE_LINK_COLORS as bo, STANDALONE_LINK_ICON_POSITIONS as ko, STANDALONE_LINK_SIZES as ho, StandaloneLink as vo } from "./components/standalone-link/index.js";
35
35
  import { Table as Zo } from "./components/table/index.js";
36
36
  import { getDensity as Ho, getHorizontalAlignment as Ko, getScope as Yo, getVerticalAlignment as zo } from "./components/table/utils.js";
37
37
  import { Tabs as Xo } from "./components/tabs/index.js";
@@ -44,18 +44,20 @@ import { CardPrimitives as xr } from "./patterns/card/primitives.js";
44
44
  import { CopyButton as ar } from "./patterns/copy-button/index.js";
45
45
  import { LAYOUT_APPEARANCES as dr, LAYOUT_BACKGROUNDS as nr, LAYOUT_PADDING as lr, Layout as Tr, normalizeLayoutProps as Cr } from "./patterns/layout/index.js";
46
46
  import { ProductBadge as Sr } from "./patterns/product-badge/index.js";
47
- import { PRODUCT_LOGO_COLORS as Ar, PRODUCT_LOGO_PRODUCTS as sr, PRODUCT_LOGO_SIZES as Lr, ProductLogo as cr, normalizeProductLogoProps as Ir } from "./patterns/product-logo/index.js";
47
+ import { PRODUCT_LOGO_COLORS as Lr, PRODUCT_LOGO_PRODUCTS as cr, PRODUCT_LOGO_SIZES as sr, ProductLogo as Ar, normalizeProductLogoProps as Ir } from "./patterns/product-logo/index.js";
48
48
  import { RelatedContent as Pr } from "./patterns/related-content/index.js";
49
49
  import { useLarge as Br, useMedium as Nr, useMediumUp as Dr, useSmall as Er } from "./utils/hooks/use-screen-size.js";
50
50
  import { MDSProvider as Gr } from "./utils/mds-context/index.js";
51
51
  import { AccordionContent as Ur, AccordionItem as br, AccordionToggle as kr } from "./components/accordion/item/index.js";
52
- import { RadioCardGroup as Mr } from "./components/form/radio-card/group.js";
52
+ import { RadioCardGroup as vr } from "./components/form/radio-card/group.js";
53
53
  import { useModal as Zr } from "./components/modal/use-modal.js";
54
54
  import { NewsroomCard as Hr } from "./patterns/card/newsroom-card/index.js";
55
55
  import { PersonCard as Yr } from "./patterns/card/person-card/index.js";
56
56
  import { PromoCard as wr } from "./patterns/card/promo-card/index.js";
57
57
  import { ResourceCard as Vr } from "./patterns/card/resource-card/index.js";
58
58
  import { UnifiedCard as jr } from "./patterns/card/unified-card/index.js";
59
+ import { LocaleProvider as Jr } from "./utils/i18n/helpers/locale-provider.js";
60
+ import { useLocale as $r } from "./utils/i18n/helpers/use-locale.js";
59
61
  export {
60
62
  e as Accordion,
61
63
  Ur as AccordionContent,
@@ -68,19 +70,19 @@ export {
68
70
  p as BADGE_COLORS,
69
71
  m as BADGE_SIZES,
70
72
  x as BADGE_TYPES,
71
- A as BUTTON_COLORS,
72
- s as BUTTON_ICON_POSITIONS,
73
- L as BUTTON_SIZES,
73
+ L as BUTTON_COLORS,
74
+ c as BUTTON_ICON_POSITIONS,
75
+ s as BUTTON_SIZES,
74
76
  f as Badge,
75
77
  i as BadgeCount,
76
78
  or as BarChart,
77
79
  S as Breadcrumbs,
78
- c as Button,
80
+ A as Button,
79
81
  _ as Card,
80
82
  P as CardContent,
81
83
  xr as CardPrimitives,
82
- M as CheckboxBase,
83
- v as CheckboxField,
84
+ v as CheckboxBase,
85
+ M as CheckboxField,
84
86
  Z as CheckboxGroup,
85
87
  B as CodeBlock,
86
88
  ar as CopyButton,
@@ -104,21 +106,22 @@ export {
104
106
  oo as Label,
105
107
  Tr as Layout,
106
108
  eo as Legend,
109
+ Jr as LocaleProvider,
107
110
  Do as MDSButton,
108
111
  Gr as MDSProvider,
109
112
  Ro as ModalProvider,
110
113
  Hr as NewsroomCard,
111
- Ar as PRODUCT_LOGO_COLORS,
112
- sr as PRODUCT_LOGO_PRODUCTS,
113
- Lr as PRODUCT_LOGO_SIZES,
114
+ Lr as PRODUCT_LOGO_COLORS,
115
+ cr as PRODUCT_LOGO_PRODUCTS,
116
+ sr as PRODUCT_LOGO_SIZES,
114
117
  pr as PartnerCard,
115
118
  Yr as PersonCard,
116
119
  Sr as ProductBadge,
117
- cr as ProductLogo,
120
+ Ar as ProductLogo,
118
121
  wr as PromoCard,
119
122
  po as RadioBase,
120
123
  ao as RadioCard,
121
- Mr as RadioCardGroup,
124
+ vr as RadioCardGroup,
122
125
  mo as RadioField,
123
126
  xo as RadioGroup,
124
127
  Pr as RelatedContent,
@@ -128,18 +131,18 @@ export {
128
131
  ho as STANDALONE_LINK_SIZES,
129
132
  no as SelectField,
130
133
  Fo as Separator,
131
- Mo as StandaloneLink,
134
+ vo as StandaloneLink,
132
135
  To as SuperSelectField,
133
136
  qo as TEXT_COLORS,
134
137
  Jo as TEXT_WEIGHTS,
135
138
  Zo as Table,
136
139
  Xo as Tabs,
137
140
  Qo as Text,
138
- Ao as TextAreaField,
141
+ Lo as TextAreaField,
139
142
  Oo as TextInput,
140
143
  So as TextInputBase,
141
- Lo as ToggleBase,
142
- co as ToggleField,
144
+ so as ToggleBase,
145
+ Ao as ToggleField,
143
146
  Io as ToggleGroup,
144
147
  jr as UnifiedCard,
145
148
  Ho as getDensity,
@@ -150,6 +153,7 @@ export {
150
153
  Ir as normalizeProductLogoProps,
151
154
  R as useDisclosurePrimitive,
152
155
  Br as useLarge,
156
+ $r as useLocale,
153
157
  Nr as useMedium,
154
158
  Dr as useMediumUp,
155
159
  Zr as useModal,
package/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hashicorp/mds-react",
3
- "version": "0.9.5",
3
+ "version": "0.9.7",
4
4
  "description": "Materia Design System React components",
5
5
  "author": "HashiCorp",
6
6
  "license": "MPL-2.0",
@@ -1,4 +1,4 @@
1
- import { ThumbnailProps } from '../types';
1
+ import type { ThumbnailProps } from '../types';
2
2
  interface NewsroomCardProps {
3
3
  heading: string;
4
4
  date: string;
@@ -1,5 +1,5 @@
1
- import { MDSImageProps } from '../../../utils/mds-context';
2
- import { CardPatternProps } from '../types';
1
+ import type { MDSImageProps } from '../../../utils/mds-context';
2
+ import type { CardPatternProps } from '../types';
3
3
  interface PartnerCardProps {
4
4
  heading: string;
5
5
  description: string;
@@ -1,4 +1,4 @@
1
- import { ProductBadgesProps, ThumbnailProps } from '../types';
1
+ import type { ProductBadgesProps, ThumbnailProps } from '../types';
2
2
  interface PersonCardProps {
3
3
  thumbnail: ThumbnailProps;
4
4
  link: string;
@@ -1,16 +1,16 @@
1
- import { CardPrimitiveProps, MetaProps, ContentProps, HeadingProps, ProductBadgesProps, DescriptionProps } from './types';
1
+ import type { CardPrimitiveProps, MetaProps, ContentProps, HeadingProps, ProductBadgesProps, DescriptionProps } from './types';
2
2
  declare const CardPrimitives: {
3
- Root: import('react').ForwardRefExoticComponent<CardPrimitiveProps & import('react').RefAttributes<HTMLDivElement>>;
3
+ Root: import("react").ForwardRefExoticComponent<CardPrimitiveProps & import("react").RefAttributes<HTMLDivElement>>;
4
4
  Thumbnail: {
5
- ({ src, alt }: import('./types').ThumbnailProps): import("react/jsx-runtime").JSX.Element;
5
+ ({ src, alt }: import("./types").ThumbnailProps): import("react/jsx-runtime").JSX.Element;
6
6
  displayName: string;
7
7
  };
8
8
  PersonThumbnail: {
9
- ({ src, alt }: import('./types').ThumbnailProps): import("react/jsx-runtime").JSX.Element;
9
+ ({ src, alt }: import("./types").ThumbnailProps): import("react/jsx-runtime").JSX.Element;
10
10
  displayName: string;
11
11
  };
12
12
  LogoThumbnail: {
13
- ({ src, alt }: import('./types').ThumbnailProps): import("react/jsx-runtime").JSX.Element;
13
+ ({ src, alt }: import("./types").ThumbnailProps): import("react/jsx-runtime").JSX.Element;
14
14
  displayName: string;
15
15
  };
16
16
  Meta: {
@@ -1,4 +1,4 @@
1
- import { ThumbnailProps } from '../types';
1
+ import type { ThumbnailProps } from '../types';
2
2
  interface PromoCardProps {
3
3
  heading: string;
4
4
  description?: string;
@@ -1,4 +1,4 @@
1
- import { CardPatternProps, ThumbnailProps } from '../types';
1
+ import type { CardPatternProps, ThumbnailProps } from '../types';
2
2
  interface ResourceCardProps {
3
3
  heading: string;
4
4
  date?: string;
@@ -1,4 +1,4 @@
1
- import { ThumbnailProps } from '../types';
1
+ import type { ThumbnailProps } from '../types';
2
2
  export declare const Thumbnail: {
3
3
  ({ src, alt }: ThumbnailProps): import("react/jsx-runtime").JSX.Element;
4
4
  displayName: string;
@@ -1,9 +1,9 @@
1
- import { PropsWithChildren, ReactNode } from 'react';
2
- import { ProductBadgeProps } from '../../patterns/product-badge';
3
- import { NewsroomCardProps } from './newsroom-card';
4
- import { PersonCardProps } from './person-card';
5
- import { ResourceCardProps } from './resource-card';
6
- import { UnifiedCardProps } from './unified-card';
1
+ import type { PropsWithChildren, ReactNode } from 'react';
2
+ import type { ProductBadgeProps } from '../../patterns/product-badge';
3
+ import type { NewsroomCardProps } from './newsroom-card';
4
+ import type { PersonCardProps } from './person-card';
5
+ import type { ResourceCardProps } from './resource-card';
6
+ import type { UnifiedCardProps } from './unified-card';
7
7
  interface BaseCardProps extends Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, 'aria-label'> {
8
8
  withArrow?: boolean;
9
9
  link: string;
@@ -1,4 +1,4 @@
1
- import { CardPatternProps } from '../types';
1
+ import type { CardPatternProps } from '../types';
2
2
  interface UnifiedCardProps extends CardPatternProps {
3
3
  badges?: (string | string[])[];
4
4
  }
@@ -9,32 +9,32 @@ export declare const normalizeProductLogoProps: ((input: {
9
9
  color?: unknown;
10
10
  product?: unknown;
11
11
  }, opts?: {
12
- all?: Pick<import('../../utils/make-normalizer').NormalizerOpts<string>, "transform"> | undefined;
12
+ all?: Pick<import("../../utils/make-normalizer").NormalizerOpts<string>, "transform">;
13
13
  each?: {
14
- size?: import('../../utils/make-normalizer').NormalizerOpts<"small"> | undefined;
15
- color?: import('../../utils/make-normalizer').NormalizerOpts<"primary"> | undefined;
16
- product?: import('../../utils/make-normalizer').NormalizerOpts<"hcp"> | undefined;
14
+ size?: import("../../utils/make-normalizer").NormalizerOpts<"medium" | "small" | "large"> | undefined;
15
+ color?: import("../../utils/make-normalizer").NormalizerOpts<"primary" | "strong"> | undefined;
16
+ product?: import("../../utils/make-normalizer").NormalizerOpts<"boundary" | "consul" | "nomad" | "packer" | "terraform" | "vagrant" | "vault" | "vault-radar" | "vault-secrets" | "waypoint" | "hashicorp" | "hcp" | "vault-dedicated" | "vault-enterprise"> | undefined;
17
17
  } | undefined;
18
18
  } | undefined) => {
19
- size: "small";
20
- color: "primary";
21
- product: "hcp";
19
+ size: "medium" | "small" | "large";
20
+ color: "primary" | "strong";
21
+ product: "boundary" | "consul" | "nomad" | "packer" | "terraform" | "vagrant" | "vault" | "vault-radar" | "vault-secrets" | "waypoint" | "hashicorp" | "hcp" | "vault-dedicated" | "vault-enterprise";
22
22
  }) & {
23
- with(all: Pick<import('../../utils/make-normalizer').NormalizerOpts<string>, "transform">): (input: {
23
+ with(all: Pick<import("../../utils/make-normalizer").NormalizerOpts<string>, "transform">): (input: {
24
24
  size?: unknown;
25
25
  color?: unknown;
26
26
  product?: unknown;
27
27
  }, opts?: {
28
- all?: Pick<import('../../utils/make-normalizer').NormalizerOpts<string>, "transform"> | undefined;
28
+ all?: Pick<import("../../utils/make-normalizer").NormalizerOpts<string>, "transform">;
29
29
  each?: {
30
- size?: import('../../utils/make-normalizer').NormalizerOpts<"small"> | undefined;
31
- color?: import('../../utils/make-normalizer').NormalizerOpts<"primary"> | undefined;
32
- product?: import('../../utils/make-normalizer').NormalizerOpts<"hcp"> | undefined;
30
+ size?: import("../../utils/make-normalizer").NormalizerOpts<"medium" | "small" | "large"> | undefined;
31
+ color?: import("../../utils/make-normalizer").NormalizerOpts<"primary" | "strong"> | undefined;
32
+ product?: import("../../utils/make-normalizer").NormalizerOpts<"boundary" | "consul" | "nomad" | "packer" | "terraform" | "vagrant" | "vault" | "vault-radar" | "vault-secrets" | "waypoint" | "hashicorp" | "hcp" | "vault-dedicated" | "vault-enterprise"> | undefined;
33
33
  } | undefined;
34
34
  } | undefined) => {
35
- size: "small";
36
- color: "primary";
37
- product: "hcp";
35
+ size: "medium" | "small" | "large";
36
+ color: "primary" | "strong";
37
+ product: "boundary" | "consul" | "nomad" | "packer" | "terraform" | "vagrant" | "vault" | "vault-radar" | "vault-secrets" | "waypoint" | "hashicorp" | "hcp" | "vault-dedicated" | "vault-enterprise";
38
38
  };
39
39
  };
40
40
  export interface ProductLogoProps {
@@ -1,4 +1,4 @@
1
- import { RelatedContentProps } from './types';
1
+ import type { RelatedContentProps } from './types';
2
2
  declare const RelatedContent: {
3
3
  ({ appearance, headline, description, cards, cta, }: RelatedContentProps): import("react/jsx-runtime").JSX.Element;
4
4
  displayName: string;
@@ -1,4 +1,4 @@
1
- import { CardPatternProps } from '../card/types';
1
+ import type { CardPatternProps } from '../card/types';
2
2
  interface RelatedContentCtaProps {
3
3
  href: string;
4
4
  text: string;