@hashicorp/mds-react 0.9.4 → 0.9.6

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 (62) hide show
  1. package/components/badge/style.module.scss +8 -6
  2. package/components/badge-count/style.module.scss +7 -6
  3. package/components/breadcrumbs/truncation-button/index.js +6 -6
  4. package/components/breadcrumbs/truncation-button/index.js.map +1 -1
  5. package/components/button/button-primitive.d.ts +5 -0
  6. package/components/button/button-primitive.js +59 -0
  7. package/components/button/button-primitive.js.map +1 -0
  8. package/components/button/index.d.ts +2 -4
  9. package/components/button/index.js +21 -71
  10. package/components/button/index.js.map +1 -1
  11. package/components/card/index.js +9 -9
  12. package/components/card/index.js.map +1 -1
  13. package/components/code-block/code-block.module.scss +3 -3
  14. package/components/form/error/index.js +7 -7
  15. package/components/form/error/index.js.map +1 -1
  16. package/components/form/fieldset/index.d.ts +1 -2
  17. package/components/form/fieldset/index.js.map +1 -1
  18. package/components/form/file-input/form-file-input.module.scss +2 -2
  19. package/components/form/indicator/index.js +3 -4
  20. package/components/form/indicator/index.js.map +1 -1
  21. package/components/form/radio/index.d.ts +3 -5
  22. package/components/form/radio/index.js.map +1 -1
  23. package/components/form/radio-card/RadioCardStory.css +21 -0
  24. package/components/form/select/index.d.ts +1 -0
  25. package/components/form/select/index.js.map +1 -1
  26. package/components/icon-tile/style.module.scss +12 -10
  27. package/components/inline-link/index.js +12 -11
  28. package/components/inline-link/index.js.map +1 -1
  29. package/components/modal/modal.module.css +5 -0
  30. package/components/tabs/index.js +63 -65
  31. package/components/tabs/index.js.map +1 -1
  32. package/index.js +26 -22
  33. package/index.js.map +1 -1
  34. package/package.json +1 -1
  35. package/patterns/card/person-card/index.js +37 -35
  36. package/patterns/card/person-card/index.js.map +1 -1
  37. package/patterns/card/primitives.js +16 -16
  38. package/patterns/card/primitives.js.map +1 -1
  39. package/style.css +1 -1
  40. package/utils/i18n/constants/index.js +16 -3
  41. package/utils/i18n/constants/index.js.map +1 -1
  42. package/utils/i18n/helpers/index.d.ts +4 -0
  43. package/utils/i18n/helpers/index.js +8 -0
  44. package/utils/i18n/helpers/index.js.map +1 -0
  45. package/utils/i18n/helpers/locale-provider.d.ts +14 -0
  46. package/utils/i18n/helpers/locale-provider.js +14 -4
  47. package/utils/i18n/helpers/locale-provider.js.map +1 -1
  48. package/utils/i18n/helpers/to-smart-sentence-case.d.ts +2 -0
  49. package/utils/i18n/helpers/to-smart-sentence-case.js.map +1 -1
  50. package/utils/i18n/helpers/to-smart-title-case.d.ts +2 -0
  51. package/utils/i18n/helpers/to-smart-title-case.js.map +1 -1
  52. package/utils/i18n/helpers/use-locale.d.ts +2 -0
  53. package/utils/i18n/helpers/use-locale.js +1 -1
  54. package/utils/i18n/helpers/use-locale.js.map +1 -1
  55. package/utils/i18n/index.d.ts +11 -1
  56. package/utils/i18n/index.js +29 -3
  57. package/utils/i18n/index.js.map +1 -1
  58. package/utils/index.d.ts +1 -0
  59. package/utils/index.js +10 -6
  60. package/utils/index.js.map +1 -1
  61. package/utils/i18n/index2.js +0 -33
  62. package/utils/i18n/index2.js.map +0 -1
@@ -1,5 +1,5 @@
1
- import { ComponentProps, HTMLProps, ReactNode } from 'react';
2
- import { Fieldset } from '../fieldset';
1
+ import { HTMLProps, ReactNode } from 'react';
2
+ import { FieldsetProps } from '../fieldset';
3
3
  interface RadioBaseProps {
4
4
  id: string;
5
5
  required?: boolean;
@@ -28,9 +28,7 @@ declare const RadioField: {
28
28
  ({ isInvalid, isLoading, isRequired, isOptional, id, label, helperText, error, field, className, testingKey, ...rest }: RadioFieldProps): import("react/jsx-runtime").JSX.Element;
29
29
  displayName: string;
30
30
  };
31
- interface RadioGroupProps extends ComponentProps<typeof Fieldset> {
32
- children: ReactNode;
33
- }
31
+ type RadioGroupProps = FieldsetProps;
34
32
  declare const RadioGroup: {
35
33
  Root: {
36
34
  ({ layout, legend, isOptional, isRequired, children, }: RadioGroupProps): import("react/jsx-runtime").JSX.Element;
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../../src/components/form/radio/index.tsx"],"sourcesContent":["import {\n\tuseId,\n\ttype ComponentProps,\n\ttype HTMLProps,\n\ttype ReactNode,\n} from 'react'\nimport { Field } from '../field'\nimport { Fieldset } from '../fieldset'\nimport classNames from 'classnames'\nimport s from './form-radio.module.scss'\n\ninterface RadioBaseProps {\n\tid: string\n\trequired?: boolean\n\tfield: HTMLProps<HTMLInputElement>\n\tclassName?: string\n\ttestingKey?: string\n}\n\nconst RadioBase = ({\n\tid,\n\trequired,\n\tfield,\n\tclassName,\n\ttestingKey,\n}: RadioBaseProps) => {\n\treturn (\n\t\t<input\n\t\t\tid={id}\n\t\t\ttype=\"radio\"\n\t\t\tclassName={classNames(s.radio, className)}\n\t\t\trequired={required}\n\t\t\tdata-testid={testingKey}\n\t\t\t{...field}\n\t\t/>\n\t)\n}\n\nRadioBase.displayName = 'RadioBase'\n\ninterface RadioFieldProps {\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<HTMLInputElement>\n\tclassName?: string\n\ttestingKey?: string\n}\n\nconst RadioField = ({\n\tisInvalid,\n\tisLoading,\n\tisRequired,\n\tisOptional,\n\tid,\n\tlabel,\n\thelperText,\n\terror,\n\tfield,\n\tclassName,\n\ttestingKey,\n\t...rest\n}: RadioFieldProps) => {\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=\"flag\"\n\t\t\tclassName={className}\n\t\t>\n\t\t\t<RadioBase\n\t\t\t\tid={inputId}\n\t\t\t\trequired={isRequired}\n\t\t\t\tfield={{ ...field, 'aria-describedby': `error-${id}` }}\n\t\t\t\ttestingKey={testingKey}\n\t\t\t\t{...rest}\n\t\t\t/>\n\t\t</Field>\n\t)\n}\n\nRadioField.displayName = 'RadioField'\n\ninterface RadioGroupProps extends ComponentProps<typeof Fieldset> {\n\tchildren: ReactNode\n}\n\nconst RadioGroupRoot = ({\n\tlayout = 'vertical',\n\tlegend,\n\tisOptional,\n\tisRequired,\n\tchildren,\n}: RadioGroupProps) => {\n\treturn (\n\t\t<Fieldset\n\t\t\tlayout={layout}\n\t\t\tlegend={legend}\n\t\t\tisOptional={isOptional}\n\t\t\tisRequired={isRequired}\n\t\t>\n\t\t\t{children}\n\t\t</Fieldset>\n\t)\n}\n\nRadioGroupRoot.displayName = 'RadioGroupRoot'\n\nconst RadioGroupField = (props: RadioFieldProps) => {\n\treturn (\n\t\t<RadioField\n\t\t\t{...props}\n\t\t\ttestingKey={props.testingKey}\n\t\t\tclassName={props.className}\n\t\t/>\n\t)\n}\n\nRadioGroupField.displayName = 'RadioGroupField'\n\nconst RadioGroup = {\n\tRoot: RadioGroupRoot,\n\tField: RadioGroupField,\n}\n\nexport { RadioGroup, RadioBase, RadioField }\n"],"names":["RadioBase","id","required","field","className","testingKey","jsx","classNames","s","RadioField","isInvalid","isLoading","isRequired","isOptional","label","helperText","error","rest","generatedId","useId","inputId","Field","RadioGroupRoot","layout","legend","children","Fieldset","RadioGroupField","props","RadioGroup"],"mappings":";;;;;;AAmBA,MAAMA,IAAY,CAAC;AAAA,EAClB,IAAAC;AAAA,EACA,UAAAC;AAAA,EACA,OAAAC;AAAA,EACA,WAAAC;AAAA,EACA,YAAAC;AACD,MAEE,gBAAAC;AAAA,EAAC;AAAA,EAAA;AAAA,IACA,IAAAL;AAAA,IACA,MAAK;AAAA,IACL,WAAWM,EAAWC,EAAE,OAAOJ,CAAS;AAAA,IACxC,UAAAF;AAAA,IACA,eAAaG;AAAA,IACZ,GAAGF;AAAA,EAAA;AAAA;AAKPH,EAAU,cAAc;AAgBxB,MAAMS,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MAAME,IAAa;AAAA,EAClB,MAAMP;AAAA,EACN,OAAOK;AACR;"}
1
+ {"version":3,"file":"index.js","sources":["../../../../src/components/form/radio/index.tsx"],"sourcesContent":["import { useId, type HTMLProps, type ReactNode } from 'react'\nimport { Field } from '../field'\nimport { Fieldset, type FieldsetProps } from '../fieldset'\nimport classNames from 'classnames'\nimport s from './form-radio.module.scss'\n\ninterface RadioBaseProps {\n\tid: string\n\trequired?: boolean\n\tfield: HTMLProps<HTMLInputElement>\n\tclassName?: string\n\ttestingKey?: string\n}\n\nconst RadioBase = ({\n\tid,\n\trequired,\n\tfield,\n\tclassName,\n\ttestingKey,\n}: RadioBaseProps) => {\n\treturn (\n\t\t<input\n\t\t\tid={id}\n\t\t\ttype=\"radio\"\n\t\t\tclassName={classNames(s.radio, className)}\n\t\t\trequired={required}\n\t\t\tdata-testid={testingKey}\n\t\t\t{...field}\n\t\t/>\n\t)\n}\n\nRadioBase.displayName = 'RadioBase'\n\ninterface RadioFieldProps {\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<HTMLInputElement>\n\tclassName?: string\n\ttestingKey?: string\n}\n\nconst RadioField = ({\n\tisInvalid,\n\tisLoading,\n\tisRequired,\n\tisOptional,\n\tid,\n\tlabel,\n\thelperText,\n\terror,\n\tfield,\n\tclassName,\n\ttestingKey,\n\t...rest\n}: RadioFieldProps) => {\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=\"flag\"\n\t\t\tclassName={className}\n\t\t>\n\t\t\t<RadioBase\n\t\t\t\tid={inputId}\n\t\t\t\trequired={isRequired}\n\t\t\t\tfield={{ ...field, 'aria-describedby': `error-${id}` }}\n\t\t\t\ttestingKey={testingKey}\n\t\t\t\t{...rest}\n\t\t\t/>\n\t\t</Field>\n\t)\n}\n\nRadioField.displayName = 'RadioField'\n\ntype RadioGroupProps = FieldsetProps\n\nconst RadioGroupRoot = ({\n\tlayout = 'vertical',\n\tlegend,\n\tisOptional,\n\tisRequired,\n\tchildren,\n}: RadioGroupProps) => {\n\treturn (\n\t\t<Fieldset\n\t\t\tlayout={layout}\n\t\t\tlegend={legend}\n\t\t\tisOptional={isOptional}\n\t\t\tisRequired={isRequired}\n\t\t>\n\t\t\t{children}\n\t\t</Fieldset>\n\t)\n}\n\nRadioGroupRoot.displayName = 'RadioGroupRoot'\n\nconst RadioGroupField = (props: RadioFieldProps) => {\n\treturn (\n\t\t<RadioField\n\t\t\t{...props}\n\t\t\ttestingKey={props.testingKey}\n\t\t\tclassName={props.className}\n\t\t/>\n\t)\n}\n\nRadioGroupField.displayName = 'RadioGroupField'\n\nconst RadioGroup = {\n\tRoot: RadioGroupRoot,\n\tField: RadioGroupField,\n}\n\nexport { RadioGroup, RadioBase, RadioField }\n"],"names":["RadioBase","id","required","field","className","testingKey","jsx","classNames","s","RadioField","isInvalid","isLoading","isRequired","isOptional","label","helperText","error","rest","generatedId","useId","inputId","Field","RadioGroupRoot","layout","legend","children","Fieldset","RadioGroupField","props","RadioGroup"],"mappings":";;;;;;AAcA,MAAMA,IAAY,CAAC;AAAA,EAClB,IAAAC;AAAA,EACA,UAAAC;AAAA,EACA,OAAAC;AAAA,EACA,WAAAC;AAAA,EACA,YAAAC;AACD,MAEE,gBAAAC;AAAA,EAAC;AAAA,EAAA;AAAA,IACA,IAAAL;AAAA,IACA,MAAK;AAAA,IACL,WAAWM,EAAWC,EAAE,OAAOJ,CAAS;AAAA,IACxC,UAAAF;AAAA,IACA,eAAaG;AAAA,IACZ,GAAGF;AAAA,EAAA;AAAA;AAKPH,EAAU,cAAc;AAgBxB,MAAMS,IAAa,CAAC;AA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AA,EAClB,MAAMP;AAAA,EACN,OAAOK;AACR;"}
@@ -0,0 +1,21 @@
1
+ .doc-radio-card-list-demo {
2
+ margin: 0;
3
+ padding: 0;
4
+ color: #3b3d45;
5
+
6
+ & li {
7
+ margin: 0;
8
+ padding: 8px 0 8px 24px;
9
+ list-style: none;
10
+ background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 16 16' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M11.78 5.22a.75.75 0 010 1.06l-4.5 4.5a.75.75 0 01-1.06 0l-2-2a.75.75 0 011.06-1.06l1.47 1.47 3.97-3.97a.75.75 0 011.06 0z' fill='%233b3d45'/%3E%3Cpath d='M0 8a8 8 0 1116 0A8 8 0 010 8zm8-6.5a6.5 6.5 0 100 13 6.5 6.5 0 000-13z' fill='%233b3d45'/%3E%3C/svg%3E");
11
+ background-repeat: no-repeat;
12
+ background-position: left 9px;
13
+ background-size: 16px;
14
+ border-bottom: 1px solid #ddd;
15
+ font-family: var(--mds-typography-font-stack-text);
16
+
17
+ &:last-child {
18
+ border-bottom: none;
19
+ }
20
+ }
21
+ }
@@ -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,3 +1,5 @@
1
+ @use 'sass:map';
2
+
1
3
  $hds-icon-tile-sizes: ('small', 'medium', 'large');
2
4
  $hds-icon-tile-colors-products: (
3
5
  'boundary',
@@ -78,24 +80,24 @@ $size-props: (
78
80
 
79
81
  @each $size in $hds-icon-tile-sizes {
80
82
  .size-#{$size} {
81
- width: map-get($size-props, $size, 'size');
82
- height: map-get($size-props, $size, 'size');
83
- border-radius: map-get($size-props, $size, 'border-radius');
83
+ width: map.get($size-props, $size, 'size');
84
+ height: map.get($size-props, $size, 'size');
85
+ border-radius: map.get($size-props, $size, 'border-radius');
84
86
 
85
87
  .icon {
86
- width: map-get($size-props, $size, 'icon-size');
87
- height: map-get($size-props, $size, 'icon-size');
88
+ width: map.get($size-props, $size, 'icon-size');
89
+ height: map.get($size-props, $size, 'icon-size');
88
90
  }
89
91
 
90
92
  .logo {
91
- width: map-get($size-props, $size, 'logo-size');
92
- height: map-get($size-props, $size, 'logo-size');
93
+ width: map.get($size-props, $size, 'logo-size');
94
+ height: map.get($size-props, $size, 'logo-size');
93
95
  }
94
96
 
95
97
  .extra {
96
- width: map-get($size-props, $size, 'extra-size');
97
- height: map-get($size-props, $size, 'extra-size');
98
- border-radius: map-get($size-props, $size, 'extra-border-radius');
98
+ width: map.get($size-props, $size, 'extra-size');
99
+ height: map.get($size-props, $size, 'extra-size');
100
+ border-radius: map.get($size-props, $size, 'extra-border-radius');
99
101
  }
100
102
  }
101
103
  }
@@ -1,26 +1,27 @@
1
1
  import { jsxs as c, jsx as p } from "react/jsx-runtime";
2
- import f from "classnames";
3
- import { Interactive as I } from "../interactive/index.js";
2
+ import I from "classnames";
3
+ import { Interactive as d } from "../interactive/index.js";
4
4
  import i from "./inline-link.module.css.js";
5
- import { FlightIcon as d } from "../flight-icon/index.js";
5
+ import { FlightIcon as f } from "../flight-icon/index.js";
6
6
  const g = ({
7
- text: m,
8
- color: o = "primary",
7
+ text: o,
8
+ color: s = "primary",
9
9
  icon: r,
10
10
  iconPosition: e = "trailing",
11
- className: s,
12
- isHrefExternal: t,
11
+ className: t,
12
+ isHrefExternal: l,
13
13
  ...a
14
14
  }) => {
15
- const l = r || !t ? r : "external-link", n = l && /* @__PURE__ */ p(d, { name: l, size: 16, className: i.icon });
15
+ const m = r || !l ? r : "external-link", n = m && /* @__PURE__ */ p(f, { name: m, size: 16, className: i.icon });
16
16
  return /* @__PURE__ */ c(
17
- I,
17
+ d,
18
18
  {
19
- className: f(i["link-inline"], i[`color-${o}`], s),
19
+ className: I(i["link-inline"], i[`color-${s}`], t),
20
+ isHrefExternal: l,
20
21
  ...a,
21
22
  children: [
22
23
  n && e === "leading" && n,
23
- m,
24
+ o,
24
25
  n && e === "trailing" && n
25
26
  ]
26
27
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../src/components/inline-link/index.tsx"],"sourcesContent":["import classNames from 'classnames'\nimport { Interactive } from '../interactive'\nimport s from './inline-link.module.css'\nimport type { FlightIconName } from '../flight-icon'\nimport { FlightIcon } from '../flight-icon'\n\ninterface InlineLinkProps {\n\t/**\n\t * There are two available colors for an `<InlineLink />`: primary and secondary.\n\t */\n\tcolor?: 'primary' | 'secondary'\n\t/**\n\t * Use this parameter to show an icon.\n\t */\n\ticon?: FlightIconName\n\t/**\n\t * Positions the icon before or after the text.\n\t */\n\ticonPosition?: 'leading' | 'trailing'\n\t/**\n\t * URL parameter that’s passed down to the `<a>` element.\n\t */\n\thref: string\n\t/**\n\t * Controls if the <a> link is external. For security reasons, we add the target=\"_blank\" and rel=\"noopener noreferrer\" attributes to it by default.\n\t * default: `false`\n\t */\n\tisHrefExternal?: boolean\n\t/**\n\t * The content of the <a> HTML element.\n\t */\n\ttext: string\n\t/**\n\t * Optional class name to add to the component.\n\t */\n\tclassName?: string\n\tprefetch?: boolean\n\tlocale?: string\n}\n\nconst InlineLink = ({\n\ttext,\n\tcolor = 'primary',\n\ticon,\n\ticonPosition = 'trailing',\n\tclassName,\n\tisHrefExternal,\n\t...props\n}: InlineLinkProps) => {\n\tconst resolvedIcon = icon || !isHrefExternal ? icon : 'external-link'\n\tconst iconElement = resolvedIcon && (\n\t\t<FlightIcon name={resolvedIcon} size={16} className={s.icon} />\n\t)\n\n\treturn (\n\t\t<Interactive\n\t\t\tclassName={classNames(s['link-inline'], s[`color-${color}`], className)}\n\t\t\t{...props}\n\t\t>\n\t\t\t{iconElement && iconPosition === 'leading' && iconElement}\n\t\t\t{text}\n\t\t\t{iconElement && iconPosition === 'trailing' && iconElement}\n\t\t</Interactive>\n\t)\n}\n\nInlineLink.displayName = 'InlineLink'\n\nexport type { InlineLinkProps }\nexport { InlineLink }\n"],"names":["InlineLink","text","color","icon","iconPosition","className","isHrefExternal","props","resolvedIcon","iconElement","jsx","FlightIcon","s","jsxs","Interactive","classNames"],"mappings":";;;;;AAwCA,MAAMA,IAAa,CAAC;AAAA,EACnB,MAAAC;AAAA,EACA,OAAAC,IAAQ;AAAA,EACR,MAAAC;AAAA,EACA,cAAAC,IAAe;AAAA,EACf,WAAAC;AAAA,EACA,gBAAAC;AAAA,EACA,GAAGC;AACJ,MAAuB;AACtB,QAAMC,IAAeL,KAAQ,CAACG,IAAiBH,IAAO,iBAChDM,IAAcD,KACnB,gBAAAE,EAACC,GAAA,EAAW,MAAMH,GAAc,MAAM,IAAI,WAAWI,EAAE,KAAA,CAAM;AAG9D,SACC,gBAAAC;AAAA,IAACC;AAAA,IAAA;AAAA,MACA,WAAWC,EAAWH,EAAE,aAAa,GAAGA,EAAE,SAASV,CAAK,EAAE,GAAGG,CAAS;AAAA,MACrE,GAAGE;AAAA,MAEH,UAAA;AAAA,QAAAE,KAAeL,MAAiB,aAAaK;AAAA,QAC7CR;AAAA,QACAQ,KAAeL,MAAiB,cAAcK;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGlD;AAEAT,EAAW,cAAc;"}
1
+ {"version":3,"file":"index.js","sources":["../../../src/components/inline-link/index.tsx"],"sourcesContent":["import classNames from 'classnames'\nimport { Interactive } from '../interactive'\nimport s from './inline-link.module.css'\nimport type { FlightIconName } from '../flight-icon'\nimport { FlightIcon } from '../flight-icon'\n\ninterface InlineLinkProps {\n\t/**\n\t * There are two available colors for an `<InlineLink />`: primary and secondary.\n\t */\n\tcolor?: 'primary' | 'secondary'\n\t/**\n\t * Use this parameter to show an icon.\n\t */\n\ticon?: FlightIconName\n\t/**\n\t * Positions the icon before or after the text.\n\t */\n\ticonPosition?: 'leading' | 'trailing'\n\t/**\n\t * URL parameter that’s passed down to the `<a>` element.\n\t */\n\thref: string\n\t/**\n\t * Controls if the <a> link is external. For security reasons, we add the target=\"_blank\" and rel=\"noopener noreferrer\" attributes to it by default.\n\t * default: `false`\n\t */\n\tisHrefExternal?: boolean\n\t/**\n\t * The content of the <a> HTML element.\n\t */\n\ttext: string\n\t/**\n\t * Optional class name to add to the component.\n\t */\n\tclassName?: string\n\tprefetch?: boolean\n\tlocale?: string\n}\n\nconst InlineLink = ({\n\ttext,\n\tcolor = 'primary',\n\ticon,\n\ticonPosition = 'trailing',\n\tclassName,\n\tisHrefExternal,\n\t...props\n}: InlineLinkProps) => {\n\tconst resolvedIcon = icon || !isHrefExternal ? icon : 'external-link'\n\tconst iconElement = resolvedIcon && (\n\t\t<FlightIcon name={resolvedIcon} size={16} className={s.icon} />\n\t)\n\n\treturn (\n\t\t<Interactive\n\t\t\tclassName={classNames(s['link-inline'], s[`color-${color}`], className)}\n\t\t\tisHrefExternal={isHrefExternal}\n\t\t\t{...props}\n\t\t>\n\t\t\t{iconElement && iconPosition === 'leading' && iconElement}\n\t\t\t{text}\n\t\t\t{iconElement && iconPosition === 'trailing' && iconElement}\n\t\t</Interactive>\n\t)\n}\n\nInlineLink.displayName = 'InlineLink'\n\nexport type { InlineLinkProps }\nexport { InlineLink }\n"],"names":["InlineLink","text","color","icon","iconPosition","className","isHrefExternal","props","resolvedIcon","iconElement","jsx","FlightIcon","s","jsxs","Interactive","classNames"],"mappings":";;;;;AAwCA,MAAMA,IAAa,CAAC;AAAA,EACnB,MAAAC;AAAA,EACA,OAAAC,IAAQ;AAAA,EACR,MAAAC;AAAA,EACA,cAAAC,IAAe;AAAA,EACf,WAAAC;AAAA,EACA,gBAAAC;AAAA,EACA,GAAGC;AACJ,MAAuB;AACtB,QAAMC,IAAeL,KAAQ,CAACG,IAAiBH,IAAO,iBAChDM,IAAcD,KACnB,gBAAAE,EAACC,GAAA,EAAW,MAAMH,GAAc,MAAM,IAAI,WAAWI,EAAE,KAAA,CAAM;AAG9D,SACC,gBAAAC;AAAA,IAACC;AAAA,IAAA;AAAA,MACA,WAAWC,EAAWH,EAAE,aAAa,GAAGA,EAAE,SAASV,CAAK,EAAE,GAAGG,CAAS;AAAA,MACtE,gBAAAC;AAAA,MACC,GAAGC;AAAA,MAEH,UAAA;AAAA,QAAAE,KAAeL,MAAiB,aAAaK;AAAA,QAC7CR;AAAA,QACAQ,KAAeL,MAAiB,cAAcK;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGlD;AAEAT,EAAW,cAAc;"}
@@ -1,4 +1,9 @@
1
1
  .modal {
2
+ display: flex;
3
+ overflow: scroll;
4
+ border-radius: 8px;
5
+ padding: 0;
6
+ border: 0;
2
7
  position: fixed;
3
8
  z-index: 50;
4
9
  height: fit-content;
@@ -1,22 +1,22 @@
1
1
  "use client";
2
- import { jsx as b, jsxs as M } from "react/jsx-runtime";
3
- import I from "classnames";
4
- import { useState as i, useRef as N, useCallback as m, useEffect as u, useMemo as O } from "react";
2
+ import { jsx as u, jsxs as M } from "react/jsx-runtime";
3
+ import x from "classnames";
4
+ import { useState as a, useRef as T, useCallback as f, useEffect as d, useMemo as O } from "react";
5
5
  import { TabPanel as S } from "./tab-panel.js";
6
6
  import { Tab as U } from "./tab.js";
7
7
  import { useTabsContext as q, TabsContext as B } from "./use-tabs-context.js";
8
- import p from "./tabs.module.scss.js";
8
+ import m from "./tabs.module.scss.js";
9
9
  const F = ({
10
- children: h,
11
- onClickTab: n,
12
- initialSelectedTabIndex: c = 0,
13
- size: x = "medium",
14
- className: E,
10
+ children: p,
11
+ onClickTab: r,
12
+ initialSelectedTabIndex: n = 0,
13
+ size: w = "medium",
14
+ className: I,
15
15
  ...k
16
16
  }) => {
17
- const [l, f] = i(
18
- c
19
- ), s = N([]), d = N([]), [r, A] = i([]), [L, R] = i([]), [W, C] = i(0), [K, V] = i(0), a = N(null), y = m((t) => {
17
+ const [i, b] = a(
18
+ n
19
+ ), s = T([]), l = T([]), [o, A] = a([]), [L, E] = a([]), [R, W] = a(0), [C, K] = a(0), c = T(null), h = f((t) => {
20
20
  const e = s.current[t]?.parentNode;
21
21
  e && e.scrollIntoView({
22
22
  behavior: "smooth",
@@ -24,91 +24,89 @@ const F = ({
24
24
  inline: "nearest"
25
25
  });
26
26
  }, []);
27
- u(() => {
28
- f(c);
29
- }, [c]), u(() => {
30
- const t = s.current[l]?.parentElement;
31
- if (t && a.current) {
32
- const e = t.offsetLeft, o = t.offsetWidth;
33
- V(e), C(o), a.current.scrollTo({
27
+ d(() => {
28
+ b(n);
29
+ }, [n]), d(() => {
30
+ const t = s.current[i]?.parentElement;
31
+ if (t && c.current) {
32
+ const e = t.offsetLeft, v = t.offsetWidth;
33
+ K(e), W(v), c.current.scrollTo({
34
34
  left: e,
35
35
  behavior: "smooth"
36
36
  });
37
37
  }
38
- }, [s, l, y, a]), u(() => {
39
- A(s.current.map((o) => o.id));
40
- let t = 0, e = 0;
41
- if (s.current.forEach((o, T) => {
42
- o.hasAttribute("data-is-selected") && (t = T, e++);
43
- }), e > 1)
44
- throw new Error("Only one tab may use isSelected argument");
45
- f(t);
46
- }, [s]), u(() => {
47
- R(d.current.map((t) => t.id));
48
- }, [d]);
49
- const P = m(
38
+ }, [s, i, h, c]), d(() => {
39
+ A(s.current.map((e) => e.id));
40
+ let t = 0;
41
+ s.current.forEach((e) => {
42
+ e.hasAttribute("data-is-selected") && t++;
43
+ }), t > 1 && console.error("Only one tab may use isSelected argument");
44
+ }, [s]), d(() => {
45
+ E(l.current.map((t) => t.id));
46
+ }, [l]);
47
+ const P = f(
50
48
  (t, e) => {
51
- f(t), y(t), typeof n == "function" && n(e, t);
49
+ b(t), h(t), typeof r == "function" && r(e, t);
52
50
  },
53
- [n, y]
54
- ), w = m(
51
+ [r, h]
52
+ ), y = f(
55
53
  (t, e) => {
56
54
  e.preventDefault(), s.current[t].focus();
57
55
  },
58
56
  []
59
- ), g = m(
57
+ ), g = f(
60
58
  (t, e) => {
61
- const o = "ArrowLeft", T = "ArrowRight", $ = "Enter", D = " ";
62
- if (e.key === T) {
63
- const v = (t + 1) % r.length;
64
- w(v, e);
65
- } else if (e.key === o) {
66
- const v = (t + r.length - 1) % r.length;
67
- w(v, e);
68
- } else (e.key === $ || e.key === D) && f(t);
59
+ const v = "ArrowLeft", j = "ArrowRight", $ = "Enter", D = " ";
60
+ if (e.key === j) {
61
+ const N = (t + 1) % o.length;
62
+ y(N, e);
63
+ } else if (e.key === v) {
64
+ const N = (t + o.length - 1) % o.length;
65
+ y(N, e);
66
+ } else (e.key === $ || e.key === D) && b(t);
69
67
  },
70
- [w, r.length]
71
- ), j = O(
68
+ [y, o.length]
69
+ ), V = O(
72
70
  () => ({
73
71
  tabNodes: s,
74
- tabIds: r,
75
- panelNodes: d,
72
+ tabIds: o,
73
+ panelNodes: l,
76
74
  panelIds: L,
77
- selectedTabIndex: l,
75
+ selectedTabIndex: i,
78
76
  onClick: P,
79
77
  onKeyUp: g,
80
- size: x,
81
- tabsListRef: a
78
+ size: w,
79
+ tabsListRef: c
82
80
  }),
83
81
  [
84
82
  s,
85
- r,
86
- d,
87
- L,
83
+ o,
88
84
  l,
85
+ L,
86
+ i,
89
87
  P,
90
88
  g,
91
- x,
92
- a
89
+ w,
90
+ c
93
91
  ]
94
92
  );
95
- return /* @__PURE__ */ b(B.Provider, { value: j, children: /* @__PURE__ */ b(
93
+ return /* @__PURE__ */ u(B.Provider, { value: V, children: /* @__PURE__ */ u(
96
94
  "div",
97
95
  {
98
- className: I(p.tabs, E),
96
+ className: x(m.tabs, I),
99
97
  ...k,
100
98
  style: {
101
- "--indicator-left-pos": `${K}px`,
102
- "--indicator-width": `${W}px`
99
+ "--indicator-left-pos": `${C}px`,
100
+ "--indicator-width": `${R}px`
103
101
  },
104
- children: h
102
+ children: p
105
103
  }
106
104
  ) });
107
- }, G = ({ children: h, className: n }) => {
108
- const { tabsListRef: c } = q();
109
- return /* @__PURE__ */ b("div", { className: I(p["tablist-wrapper"], n), children: /* @__PURE__ */ M("ul", { className: p.tablist, role: "tablist", ref: c, children: [
110
- h,
111
- /* @__PURE__ */ b("li", { className: p.indicator, role: "presentation" })
105
+ }, G = ({ children: p, className: r }) => {
106
+ const { tabsListRef: n } = q();
107
+ return /* @__PURE__ */ u("div", { className: x(m["tablist-wrapper"], r), children: /* @__PURE__ */ M("ul", { className: m.tablist, role: "tablist", ref: n, children: [
108
+ p,
109
+ /* @__PURE__ */ u("li", { className: m.indicator, role: "presentation" })
112
110
  ] }) });
113
111
  }, z = { Provider: F, TabList: G, Panel: S, Tab: U };
114
112
  export {
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../src/components/tabs/index.tsx"],"sourcesContent":["'use client'\n\nimport classNames from 'classnames'\nimport {\n\ttype ReactNode,\n\ttype HTMLAttributes,\n\ttype KeyboardEvent,\n\ttype MouseEvent,\n\tuseState,\n\tuseMemo,\n\tuseRef,\n\tuseEffect,\n\tuseCallback,\n} from 'react'\nimport { TabPanel } from './tab-panel'\nimport { Tab } from './tab'\nimport { TabsContext, useTabsContext } from './use-tabs-context'\nimport s from './tabs.module.scss'\n\nexport interface TabsProps extends HTMLAttributes<HTMLDivElement> {\n\tonClickTab?: (event: MouseEvent<HTMLButtonElement>, tabIndex: number) => void\n\tinitialSelectedTabIndex?: number\n\tsize?: 'medium' | 'large'\n}\n\nconst Provider = ({\n\tchildren,\n\tonClickTab,\n\tinitialSelectedTabIndex = 0,\n\tsize = 'medium',\n\tclassName,\n\t...rest\n}: TabsProps) => {\n\tconst [selectedTabIndex, setSelectedTabIndex] = useState(\n\t\tinitialSelectedTabIndex\n\t)\n\tconst tabNodes = useRef<Array<HTMLButtonElement>>([])\n\tconst panelNodes = useRef<Array<HTMLDivElement>>([])\n\tconst [tabIds, setTabIds] = useState<Array<string>>([])\n\tconst [panelIds, setPanelIds] = useState<Array<string>>([])\n\tconst [indicatorWidth, setIndicatorWidth] = useState(0)\n\tconst [indicatorLeftPosition, setIndicatorLeftPosition] = useState(0)\n\tconst tabsListRef = useRef<HTMLUListElement | null>(null)\n\n\tconst scrollIntoView = useCallback((tabIndex: number) => {\n\t\t// Scroll Tab into view if it's out of view\n\t\tconst parentNode = tabNodes.current[tabIndex]\n\t\t\t?.parentNode as HTMLElement | null\n\t\tif (parentNode) {\n\t\t\tparentNode.scrollIntoView({\n\t\t\t\tbehavior: 'smooth',\n\t\t\t\tblock: 'nearest',\n\t\t\t\tinline: 'nearest',\n\t\t\t})\n\t\t}\n\t}, [])\n\n\tuseEffect(() => {\n\t\tsetSelectedTabIndex(initialSelectedTabIndex)\n\t}, [initialSelectedTabIndex])\n\n\tuseEffect(() => {\n\t\tconst tabElem = tabNodes.current[selectedTabIndex]?.parentElement\n\t\tif (tabElem && tabsListRef.current) {\n\t\t\tconst tabLeftPos = tabElem.offsetLeft\n\t\t\tconst tabWidth = tabElem.offsetWidth\n\t\t\tsetIndicatorLeftPosition(tabLeftPos)\n\t\t\tsetIndicatorWidth(tabWidth)\n\t\t\ttabsListRef.current.scrollTo({\n\t\t\t\tleft: tabLeftPos,\n\t\t\t\tbehavior: 'smooth',\n\t\t\t})\n\t\t}\n\t}, [tabNodes, selectedTabIndex, scrollIntoView, tabsListRef])\n\n\tuseEffect(() => {\n\t\tsetTabIds(tabNodes.current.map((tab) => tab.id))\n\t\tlet initialTabIndex = 0\n\t\tlet selectedCount = 0\n\n\t\ttabNodes.current.forEach((tabElement, index) => {\n\t\t\tif (tabElement.hasAttribute('data-is-selected')) {\n\t\t\t\tinitialTabIndex = index\n\t\t\t\tselectedCount++\n\t\t\t}\n\t\t})\n\n\t\tif (selectedCount > 1) {\n\t\t\tthrow new Error('Only one tab may use isSelected argument')\n\t\t}\n\n\t\tsetSelectedTabIndex(initialTabIndex)\n\t}, [tabNodes])\n\n\tuseEffect(() => {\n\t\tsetPanelIds(panelNodes.current.map((tab) => tab.id))\n\t}, [panelNodes])\n\n\tconst onClick = useCallback(\n\t\t(tabIndex: number, event: MouseEvent<HTMLButtonElement>) => {\n\t\t\tsetSelectedTabIndex(tabIndex)\n\n\t\t\tscrollIntoView(tabIndex)\n\n\t\t\t// invoke the callback function if it's provided as argument\n\t\t\tif (typeof onClickTab === 'function') {\n\t\t\t\tonClickTab(event, tabIndex)\n\t\t\t}\n\t\t},\n\t\t[onClickTab, scrollIntoView]\n\t)\n\n\t// Focus tab for keyboard & mouse navigation:\n\tconst focusTab = useCallback(\n\t\t(tabIndex: number, e: KeyboardEvent<HTMLButtonElement>) => {\n\t\t\te.preventDefault()\n\t\t\ttabNodes.current[tabIndex].focus()\n\t\t},\n\t\t[]\n\t)\n\n\tconst onKeyUp = useCallback(\n\t\t(tabIndex: number, e: KeyboardEvent<HTMLButtonElement>) => {\n\t\t\tconst leftArrow = 'ArrowLeft'\n\t\t\tconst rightArrow = 'ArrowRight'\n\t\t\tconst enterKey = 'Enter'\n\t\t\tconst spaceKey = ' '\n\n\t\t\tif (e.key === rightArrow) {\n\t\t\t\tconst nextTabIndex = (tabIndex + 1) % tabIds.length\n\t\t\t\tfocusTab(nextTabIndex, e)\n\t\t\t} else if (e.key === leftArrow) {\n\t\t\t\tconst prevTabIndex = (tabIndex + tabIds.length - 1) % tabIds.length\n\t\t\t\tfocusTab(prevTabIndex, e)\n\t\t\t} else if (e.key === enterKey || e.key === spaceKey) {\n\t\t\t\tsetSelectedTabIndex(tabIndex)\n\t\t\t}\n\t\t},\n\t\t[focusTab, tabIds.length]\n\t)\n\n\tconst contextValue = useMemo(\n\t\t() => ({\n\t\t\ttabNodes,\n\t\t\ttabIds,\n\t\t\tpanelNodes,\n\t\t\tpanelIds,\n\t\t\tselectedTabIndex,\n\t\t\tonClick,\n\t\t\tonKeyUp,\n\t\t\tsize,\n\t\t\ttabsListRef,\n\t\t}),\n\t\t[\n\t\t\ttabNodes,\n\t\t\ttabIds,\n\t\t\tpanelNodes,\n\t\t\tpanelIds,\n\t\t\tselectedTabIndex,\n\t\t\tonClick,\n\t\t\tonKeyUp,\n\t\t\tsize,\n\t\t\ttabsListRef,\n\t\t]\n\t)\n\n\treturn (\n\t\t<TabsContext.Provider value={contextValue}>\n\t\t\t<div\n\t\t\t\tclassName={classNames(s.tabs, className)}\n\t\t\t\t{...rest}\n\t\t\t\tstyle={{\n\t\t\t\t\t['--indicator-left-pos' as string]: `${indicatorLeftPosition}px`,\n\t\t\t\t\t['--indicator-width' as string]: `${indicatorWidth}px`,\n\t\t\t\t}}\n\t\t\t>\n\t\t\t\t{children}\n\t\t\t</div>\n\t\t</TabsContext.Provider>\n\t)\n}\n\ninterface TabsListProps {\n\t/**\n\t * `<Tabs.Tab />` as children\n\t */\n\tchildren: ReactNode\n\tclassName?: string\n}\n\nconst TabList = ({ children, className }: TabsListProps) => {\n\tconst { tabsListRef } = useTabsContext()\n\treturn (\n\t\t<div className={classNames(s['tablist-wrapper'], className)}>\n\t\t\t<ul className={s.tablist} role=\"tablist\" ref={tabsListRef}>\n\t\t\t\t{children}\n\t\t\t\t<li className={s.indicator} role=\"presentation\"></li>\n\t\t\t</ul>\n\t\t</div>\n\t)\n}\n\nconst Tabs = { Provider, TabList, Panel: TabPanel, Tab }\n\nexport type { TabsListProps }\nexport { Tabs }\n"],"names":["Provider","children","onClickTab","initialSelectedTabIndex","size","className","rest","selectedTabIndex","setSelectedTabIndex","useState","tabNodes","useRef","panelNodes","tabIds","setTabIds","panelIds","setPanelIds","indicatorWidth","setIndicatorWidth","indicatorLeftPosition","tabsListRef","scrollIntoView","useCallback","tabIndex","parentNode","useEffect","tabElem","tabLeftPos","tabWidth","setIndicatorLeftPosition","tab","initialTabIndex","selectedCount","index","tabElement","onClick","event","focusTab","onKeyUp","leftArrow","rightArrow","enterKey","spaceKey","nextTabIndex","prevTabIndex","contextValue","useMemo","jsx","TabsContext","classNames","s","jsxs"],"mappings":";;;;;;;;AAyBkB,MACjBA,IAAA,CAAA;AAAA,EACA,UAAAC;AAAA,EACA,YAAAC;AAAA,EACA,yBAAAC,IAAO;AAAA,EACP,MAAAC,IAAA;AAAA,EACA,WAAAC;AAAA,EACD,GAAAC;AACC;AAAgD,QAC/C,CAAAC,GAAAC,CAAA,IAAAC;AAAA,IACDN;AAAA,EACA,GACMO,I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AA,UAAA,EAAA,OAAAH,GAAA,UAAA,gBAAAE;AAAA,IAAA;AAAA,IAAA;AAAA,MAEC,WAAGE,EAAAC,EAAA,MAAA7C,CAAA;AAAA,MACJ;MAAO;QAEL,wBAAmC,GAAAc,CAAc;AAAA,QACnD,qBAAA,GAAAF,CAAA;AAAA,MAEC;AAAA,MAAA,UAAAhB;AAAA;EAIL,EAAA,CAAA;AAUA,OACS,CAAA,EAAA,UAAAA,sBAA+B;AACvC;AAGI,SAAA,gBAAA8C,EAAA,OAAA,EAAA,WAAAE,EAAAC,EAAA,iBAAA,GAAA7C,CAAA,GAAA,UAAA,gBAAA8C,EAAA,MAAA,EAAA,WAAAD,EAAA,SAAA,MAAA,WAAA,KAAA9B,GAAA,UAAA;AAAA,IAAAnB;AAAA,IAGH,gBAAA8C,EAAA,MAAA,EAAA,WAAAG,EAAA,WAAA,MAAA,eAAA,CAAA;AAAA,EAEF,EAAA,CAAA,EAAA,CAAA;AAEA;"}
1
+ {"version":3,"file":"index.js","sources":["../../../src/components/tabs/index.tsx"],"sourcesContent":["'use client'\n\nimport classNames from 'classnames'\nimport {\n\ttype ReactNode,\n\ttype HTMLAttributes,\n\ttype KeyboardEvent,\n\ttype MouseEvent,\n\tuseState,\n\tuseMemo,\n\tuseRef,\n\tuseEffect,\n\tuseCallback,\n} from 'react'\nimport { TabPanel } from './tab-panel'\nimport { Tab } from './tab'\nimport { TabsContext, useTabsContext } from './use-tabs-context'\nimport s from './tabs.module.scss'\n\nexport interface TabsProps extends HTMLAttributes<HTMLDivElement> {\n\tonClickTab?: (event: MouseEvent<HTMLButtonElement>, tabIndex: number) => void\n\tinitialSelectedTabIndex?: number\n\tsize?: 'medium' | 'large'\n}\n\nconst Provider = ({\n\tchildren,\n\tonClickTab,\n\tinitialSelectedTabIndex = 0,\n\tsize = 'medium',\n\tclassName,\n\t...rest\n}: TabsProps) => {\n\tconst [selectedTabIndex, setSelectedTabIndex] = useState(\n\t\tinitialSelectedTabIndex\n\t)\n\tconst tabNodes = useRef<Array<HTMLButtonElement>>([])\n\tconst panelNodes = useRef<Array<HTMLDivElement>>([])\n\tconst [tabIds, setTabIds] = useState<Array<string>>([])\n\tconst [panelIds, setPanelIds] = useState<Array<string>>([])\n\tconst [indicatorWidth, setIndicatorWidth] = useState(0)\n\tconst [indicatorLeftPosition, setIndicatorLeftPosition] = useState(0)\n\tconst tabsListRef = useRef<HTMLUListElement | null>(null)\n\n\tconst scrollIntoView = useCallback((tabIndex: number) => {\n\t\t// Scroll Tab into view if it's out of view\n\t\tconst parentNode = tabNodes.current[tabIndex]\n\t\t\t?.parentNode as HTMLElement | null\n\t\tif (parentNode) {\n\t\t\tparentNode.scrollIntoView({\n\t\t\t\tbehavior: 'smooth',\n\t\t\t\tblock: 'nearest',\n\t\t\t\tinline: 'nearest',\n\t\t\t})\n\t\t}\n\t}, [])\n\n\tuseEffect(() => {\n\t\tsetSelectedTabIndex(initialSelectedTabIndex)\n\t}, [initialSelectedTabIndex])\n\n\tuseEffect(() => {\n\t\tconst tabElem = tabNodes.current[selectedTabIndex]?.parentElement\n\t\tif (tabElem && tabsListRef.current) {\n\t\t\tconst tabLeftPos = tabElem.offsetLeft\n\t\t\tconst tabWidth = tabElem.offsetWidth\n\t\t\tsetIndicatorLeftPosition(tabLeftPos)\n\t\t\tsetIndicatorWidth(tabWidth)\n\t\t\ttabsListRef.current.scrollTo({\n\t\t\t\tleft: tabLeftPos,\n\t\t\t\tbehavior: 'smooth',\n\t\t\t})\n\t\t}\n\t}, [tabNodes, selectedTabIndex, scrollIntoView, tabsListRef])\n\n\tuseEffect(() => {\n\t\tsetTabIds(tabNodes.current.map((tab) => tab.id))\n\n\t\tlet selectedCount = 0\n\n\t\ttabNodes.current.forEach((tabElement) => {\n\t\t\tif (tabElement.hasAttribute('data-is-selected')) {\n\t\t\t\tselectedCount++\n\t\t\t}\n\t\t})\n\n\t\tif (selectedCount > 1) {\n\t\t\tconsole.error('Only one tab may use isSelected argument')\n\t\t}\n\t}, [tabNodes])\n\n\tuseEffect(() => {\n\t\tsetPanelIds(panelNodes.current.map((tab) => tab.id))\n\t}, [panelNodes])\n\n\tconst onClick = useCallback(\n\t\t(tabIndex: number, event: MouseEvent<HTMLButtonElement>) => {\n\t\t\tsetSelectedTabIndex(tabIndex)\n\n\t\t\tscrollIntoView(tabIndex)\n\n\t\t\t// invoke the callback function if it's provided as argument\n\t\t\tif (typeof onClickTab === 'function') {\n\t\t\t\tonClickTab(event, tabIndex)\n\t\t\t}\n\t\t},\n\t\t[onClickTab, scrollIntoView]\n\t)\n\n\t// Focus tab for keyboard & mouse navigation:\n\tconst focusTab = useCallback(\n\t\t(tabIndex: number, e: KeyboardEvent<HTMLButtonElement>) => {\n\t\t\te.preventDefault()\n\t\t\ttabNodes.current[tabIndex].focus()\n\t\t},\n\t\t[]\n\t)\n\n\tconst onKeyUp = useCallback(\n\t\t(tabIndex: number, e: KeyboardEvent<HTMLButtonElement>) => {\n\t\t\tconst leftArrow = 'ArrowLeft'\n\t\t\tconst rightArrow = 'ArrowRight'\n\t\t\tconst enterKey = 'Enter'\n\t\t\tconst spaceKey = ' '\n\n\t\t\tif (e.key === rightArrow) {\n\t\t\t\tconst nextTabIndex = (tabIndex + 1) % tabIds.length\n\t\t\t\tfocusTab(nextTabIndex, e)\n\t\t\t} else if (e.key === leftArrow) {\n\t\t\t\tconst prevTabIndex = (tabIndex + tabIds.length - 1) % tabIds.length\n\t\t\t\tfocusTab(prevTabIndex, e)\n\t\t\t} else if (e.key === enterKey || e.key === spaceKey) {\n\t\t\t\tsetSelectedTabIndex(tabIndex)\n\t\t\t}\n\t\t},\n\t\t[focusTab, tabIds.length]\n\t)\n\n\tconst contextValue = useMemo(\n\t\t() => ({\n\t\t\ttabNodes,\n\t\t\ttabIds,\n\t\t\tpanelNodes,\n\t\t\tpanelIds,\n\t\t\tselectedTabIndex,\n\t\t\tonClick,\n\t\t\tonKeyUp,\n\t\t\tsize,\n\t\t\ttabsListRef,\n\t\t}),\n\t\t[\n\t\t\ttabNodes,\n\t\t\ttabIds,\n\t\t\tpanelNodes,\n\t\t\tpanelIds,\n\t\t\tselectedTabIndex,\n\t\t\tonClick,\n\t\t\tonKeyUp,\n\t\t\tsize,\n\t\t\ttabsListRef,\n\t\t]\n\t)\n\n\treturn (\n\t\t<TabsContext.Provider value={contextValue}>\n\t\t\t<div\n\t\t\t\tclassName={classNames(s.tabs, className)}\n\t\t\t\t{...rest}\n\t\t\t\tstyle={{\n\t\t\t\t\t['--indicator-left-pos' as string]: `${indicatorLeftPosition}px`,\n\t\t\t\t\t['--indicator-width' as string]: `${indicatorWidth}px`,\n\t\t\t\t}}\n\t\t\t>\n\t\t\t\t{children}\n\t\t\t</div>\n\t\t</TabsContext.Provider>\n\t)\n}\n\ninterface TabsListProps {\n\t/**\n\t * `<Tabs.Tab />` as children\n\t */\n\tchildren: ReactNode\n\tclassName?: string\n}\n\nconst TabList = ({ children, className }: TabsListProps) => {\n\tconst { tabsListRef } = useTabsContext()\n\treturn (\n\t\t<div className={classNames(s['tablist-wrapper'], className)}>\n\t\t\t<ul className={s.tablist} role=\"tablist\" ref={tabsListRef}>\n\t\t\t\t{children}\n\t\t\t\t<li className={s.indicator} role=\"presentation\"></li>\n\t\t\t</ul>\n\t\t</div>\n\t)\n}\n\nconst Tabs = { Provider, TabList, Panel: TabPanel, Tab }\n\nexport type { TabsListProps }\nexport { Tabs }\n"],"names":["Provider","children","onClickTab","initialSelectedTabIndex","size","className","rest","selectedTabIndex","setSelectedTabIndex","useState","tabNodes","useRef","panelNodes","tabIds","setTabIds","panelIds","setPanelIds","indicatorWidth","setIndicatorWidth","indicatorLeftPosition","tabsListRef","scrollIntoView","useCallback","tabIndex","parentNode","useEffect","tabElem","tabLeftPos","tabWidth","setIndicatorLeftPosition","tab","selectedCount","onClick","event","focusTab","onKeyUp","leftArrow","rightArrow","enterKey","spaceKey","nextTabIndex","prevTabIndex","contextValue","useMemo","jsx","TabsContext","classNames","s","jsxs"],"mappings":";;;;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AA,MACAD;AAAA,MACAG;AAAA,MACAR;AAAA,MACAyB;AAAA,MACAG;AAAA,MACA/B;AAAA,MAAAgB;AAAA,IAEF;AAAA,EAEA;AAEE,SAAC,gBAAAwB,EAAAC,EAAA,UAAA,EAAA,OAAAH,GAAA,UAAA,gBAAAE;AAAA,IAAA;AAAA,IAAA;AAAA,MAEC,WAAGE,EAAAC,EAAA,MAAA1C,CAAA;AAAA,MACJ;MAAO;QAEL,wBAAmC,GAAAc,CAAc;AAAA,QACnD,qBAAA,GAAAF,CAAA;AAAA,MAEC;AAAA,MAAA,UAAAhB;AAAA;EAIL,EAAA,CAAA;AAUA,OACS,CAAA,EAAA,UAAAA,sBAA+B;AACvC;AAGI,SAAA,gBAAA2C,EAAA,OAAA,EAAA,WAAAE,EAAAC,EAAA,iBAAA,GAAA1C,CAAA,GAAA,UAAA,gBAAA2C,EAAA,MAAA,EAAA,WAAAD,EAAA,SAAA,MAAA,WAAA,KAAA3B,GAAA,UAAA;AAAA,IAAAnB;AAAA,IAGH,gBAAA2C,EAAA,MAAA,EAAA,WAAAG,EAAA,WAAA,MAAA,eAAA,CAAA;AAAA,EAEF,EAAA,CAAA,EAAA,CAAA;AAEA;"}
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.4",
3
+ "version": "0.9.6",
4
4
  "description": "Materia Design System React components",
5
5
  "author": "HashiCorp",
6
6
  "license": "MPL-2.0",