@lidofinance/lido-app-ui 1.14.0 → 1.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (142) hide show
  1. package/README.md +22 -1
  2. package/dist/README.md +22 -1
  3. package/dist/cjs/breadcrumbs/Breadcrumbs.cjs +10 -3
  4. package/dist/cjs/breadcrumbs/Breadcrumbs.cjs.map +1 -1
  5. package/dist/cjs/button/Button.cjs +7 -7
  6. package/dist/cjs/button/Button.cjs.map +1 -1
  7. package/dist/cjs/button/ButtonContent.cjs +0 -2
  8. package/dist/cjs/button/ButtonContent.cjs.map +1 -1
  9. package/dist/cjs/button/LinkButton.cjs +6 -35
  10. package/dist/cjs/button/LinkButton.cjs.map +1 -1
  11. package/dist/cjs/counter/Counter.module.css.cjs +1 -1
  12. package/dist/cjs/disclaimer/Disclaimer.cjs +0 -1
  13. package/dist/cjs/disclaimer/Disclaimer.cjs.map +1 -1
  14. package/dist/cjs/icon-button/CloseButton.cjs.map +1 -1
  15. package/dist/cjs/icon-button/IconButton.cjs +7 -7
  16. package/dist/cjs/icon-button/IconButton.cjs.map +1 -1
  17. package/dist/cjs/index.cjs +3 -0
  18. package/dist/cjs/index.cjs.map +1 -1
  19. package/dist/cjs/index.css +10 -4
  20. package/dist/cjs/info-tooltip/InfoTooltip.cjs +4 -4
  21. package/dist/cjs/info-tooltip/InfoTooltip.cjs.map +1 -1
  22. package/dist/cjs/info-tooltip/InfoTooltip.module.css.cjs +1 -1
  23. package/dist/cjs/link-provider/Anchor.cjs +19 -6
  24. package/dist/cjs/link-provider/Anchor.cjs.map +1 -1
  25. package/dist/cjs/link-provider/LinkProvider.cjs +1 -1
  26. package/dist/cjs/link-provider/LinkProvider.cjs.map +1 -1
  27. package/dist/cjs/logo/Logo.cjs.map +1 -1
  28. package/dist/cjs/nav-link/NavLink.cjs +7 -3
  29. package/dist/cjs/nav-link/NavLink.cjs.map +1 -1
  30. package/dist/cjs/rich-input/RichInput.cjs +23 -3
  31. package/dist/cjs/rich-input/RichInput.cjs.map +1 -1
  32. package/dist/cjs/rich-input/RichInput.module.css.cjs +1 -1
  33. package/dist/cjs/sidebar/SidebarToggle.cjs.map +1 -1
  34. package/dist/cjs/small-card/SmallCard.cjs.map +1 -1
  35. package/dist/cjs/tag/Tag.cjs.map +1 -1
  36. package/dist/cjs/tag/Tag.module.css.cjs +1 -1
  37. package/dist/cjs/text-link/TextLink.cjs +1 -3
  38. package/dist/cjs/text-link/TextLink.cjs.map +1 -1
  39. package/dist/cjs/theme-switcher/ThemeSwitcher.cjs.map +1 -1
  40. package/dist/cjs/typography/Typography.cjs +21 -8
  41. package/dist/cjs/typography/Typography.cjs.map +1 -1
  42. package/dist/cjs/typography/Typography.module.css.cjs +1 -1
  43. package/dist/cjs/utils/ActionElement.cjs +1 -1
  44. package/dist/cjs/utils/ActionElement.cjs.map +1 -1
  45. package/dist/cjs/utils/joinAriaLabel.cjs +8 -0
  46. package/dist/cjs/utils/joinAriaLabel.cjs.map +1 -0
  47. package/dist/esm/breadcrumbs/Breadcrumbs.mjs +10 -3
  48. package/dist/esm/breadcrumbs/Breadcrumbs.mjs.map +1 -1
  49. package/dist/esm/button/Button.mjs +7 -7
  50. package/dist/esm/button/Button.mjs.map +1 -1
  51. package/dist/esm/button/ButtonContent.mjs +1 -2
  52. package/dist/esm/button/ButtonContent.mjs.map +1 -1
  53. package/dist/esm/button/LinkButton.mjs +6 -35
  54. package/dist/esm/button/LinkButton.mjs.map +1 -1
  55. package/dist/esm/counter/Counter.module.css.mjs +1 -1
  56. package/dist/esm/disclaimer/Disclaimer.mjs +0 -1
  57. package/dist/esm/disclaimer/Disclaimer.mjs.map +1 -1
  58. package/dist/esm/icon-button/CloseButton.mjs.map +1 -1
  59. package/dist/esm/icon-button/IconButton.mjs +7 -7
  60. package/dist/esm/icon-button/IconButton.mjs.map +1 -1
  61. package/dist/esm/index.css +10 -4
  62. package/dist/esm/index.mjs +1 -1
  63. package/dist/esm/info-tooltip/InfoTooltip.mjs +4 -4
  64. package/dist/esm/info-tooltip/InfoTooltip.mjs.map +1 -1
  65. package/dist/esm/info-tooltip/InfoTooltip.module.css.mjs +1 -1
  66. package/dist/esm/link-provider/Anchor.mjs +19 -7
  67. package/dist/esm/link-provider/Anchor.mjs.map +1 -1
  68. package/dist/esm/link-provider/LinkProvider.mjs +1 -1
  69. package/dist/esm/link-provider/LinkProvider.mjs.map +1 -1
  70. package/dist/esm/logo/Logo.mjs.map +1 -1
  71. package/dist/esm/nav-link/NavLink.mjs +8 -4
  72. package/dist/esm/nav-link/NavLink.mjs.map +1 -1
  73. package/dist/esm/rich-input/RichInput.mjs +23 -3
  74. package/dist/esm/rich-input/RichInput.mjs.map +1 -1
  75. package/dist/esm/rich-input/RichInput.module.css.mjs +1 -1
  76. package/dist/esm/sidebar/SidebarToggle.mjs.map +1 -1
  77. package/dist/esm/small-card/SmallCard.mjs.map +1 -1
  78. package/dist/esm/tag/Tag.mjs.map +1 -1
  79. package/dist/esm/tag/Tag.module.css.mjs +1 -1
  80. package/dist/esm/text-link/TextLink.mjs +1 -3
  81. package/dist/esm/text-link/TextLink.mjs.map +1 -1
  82. package/dist/esm/theme-switcher/ThemeSwitcher.mjs.map +1 -1
  83. package/dist/esm/typography/Typography.mjs +19 -9
  84. package/dist/esm/typography/Typography.mjs.map +1 -1
  85. package/dist/esm/typography/Typography.module.css.mjs +1 -1
  86. package/dist/esm/utils/ActionElement.mjs +1 -1
  87. package/dist/esm/utils/ActionElement.mjs.map +1 -1
  88. package/dist/esm/utils/joinAriaLabel.mjs +4 -0
  89. package/dist/esm/utils/joinAriaLabel.mjs.map +1 -0
  90. package/dist/index.css +10 -4
  91. package/dist/styles/typography-mixins.css +14 -4
  92. package/dist/types/breadcrumbs/Breadcrumbs.d.ts +2 -2
  93. package/dist/types/breadcrumbs/Breadcrumbs.d.ts.map +1 -1
  94. package/dist/types/button/Button.d.ts +4 -10
  95. package/dist/types/button/Button.d.ts.map +1 -1
  96. package/dist/types/button/ButtonContent.d.ts +0 -1
  97. package/dist/types/button/ButtonContent.d.ts.map +1 -1
  98. package/dist/types/button/LinkButton.d.ts +9 -8
  99. package/dist/types/button/LinkButton.d.ts.map +1 -1
  100. package/dist/types/button/index.d.ts +1 -1
  101. package/dist/types/button/index.d.ts.map +1 -1
  102. package/dist/types/button/types.d.ts +4 -0
  103. package/dist/types/button/types.d.ts.map +1 -1
  104. package/dist/types/icon-button/CloseButton.d.ts +3 -3
  105. package/dist/types/icon-button/CloseButton.d.ts.map +1 -1
  106. package/dist/types/icon-button/IconButton.d.ts +4 -38
  107. package/dist/types/icon-button/IconButton.d.ts.map +1 -1
  108. package/dist/types/icon-button/index.d.ts +1 -1
  109. package/dist/types/icon-button/index.d.ts.map +1 -1
  110. package/dist/types/icon-button/types.d.ts +26 -0
  111. package/dist/types/icon-button/types.d.ts.map +1 -0
  112. package/dist/types/info-tooltip/InfoTooltip.d.ts +4 -1
  113. package/dist/types/info-tooltip/InfoTooltip.d.ts.map +1 -1
  114. package/dist/types/link-provider/Anchor.d.ts +3 -2
  115. package/dist/types/link-provider/Anchor.d.ts.map +1 -1
  116. package/dist/types/link-provider/LinkProvider.d.ts +1 -1
  117. package/dist/types/link-provider/LinkProvider.d.ts.map +1 -1
  118. package/dist/types/logo/Logo.d.ts +3 -6
  119. package/dist/types/logo/Logo.d.ts.map +1 -1
  120. package/dist/types/nav-link/NavLink.d.ts +2 -2
  121. package/dist/types/nav-link/NavLink.d.ts.map +1 -1
  122. package/dist/types/rich-input/RichInput.d.ts +7 -2
  123. package/dist/types/rich-input/RichInput.d.ts.map +1 -1
  124. package/dist/types/sidebar/SidebarToggle.d.ts +3 -3
  125. package/dist/types/sidebar/SidebarToggle.d.ts.map +1 -1
  126. package/dist/types/small-card/SmallCard.d.ts +2 -8
  127. package/dist/types/small-card/SmallCard.d.ts.map +1 -1
  128. package/dist/types/tag/Tag.d.ts +3 -1
  129. package/dist/types/tag/Tag.d.ts.map +1 -1
  130. package/dist/types/text-link/TextLink.d.ts +3 -9
  131. package/dist/types/text-link/TextLink.d.ts.map +1 -1
  132. package/dist/types/theme-switcher/ThemeSwitcher.d.ts +3 -3
  133. package/dist/types/theme-switcher/ThemeSwitcher.d.ts.map +1 -1
  134. package/dist/types/typography/Typography.d.ts +15 -6
  135. package/dist/types/typography/Typography.d.ts.map +1 -1
  136. package/dist/types/utils/ActionElement.d.ts +11 -1
  137. package/dist/types/utils/ActionElement.d.ts.map +1 -1
  138. package/dist/types/utils/index.d.ts +2 -1
  139. package/dist/types/utils/index.d.ts.map +1 -1
  140. package/dist/types/utils/joinAriaLabel.d.ts +2 -0
  141. package/dist/types/utils/joinAriaLabel.d.ts.map +1 -0
  142. package/package.json +1 -1
@@ -6,32 +6,39 @@ const cn = require('classnames');
6
6
  const Typography_module = require('./Typography.module.css.cjs');
7
7
  const jsxRuntime = require('react/jsx-runtime');
8
8
 
9
+ const typographyColors = ['default', 'secondary', 'tertiary', 'neutral', 'active', 'success', 'warning', 'error', 'info', 'inverse', 'disabled'];
10
+ const typographyWeights = ['thin', 'regular', 'medium', 'semibold', 'bold'];
11
+
12
+ /** @deprecated `richInput` → `amount`, `groupName` → `caption` */
13
+
14
+ const resolveVariant = variant => variant === 'richInput' ? 'amount' : variant === 'groupName' ? 'caption' : variant;
9
15
  const variantTag = {
10
16
  h1: 'h1',
11
17
  h2: 'h2',
12
18
  h3: 'h3',
13
- richInput: 'p',
19
+ amount: 'p',
14
20
  bodyLarge: 'p',
15
21
  body: 'p',
16
22
  description: 'p',
17
- groupName: 'p'
23
+ caption: 'p'
18
24
  };
19
- const isBodyVariant = variant => variant === 'bodyLarge' || variant === 'body' || variant === 'description';
20
25
 
21
26
  /** Typed text in Manrope; use the shortcuts (`H1`, `Body`, ...) in app code and `Typography` when the variant is dynamic. The same styles ship as PostCSS mixins from `@lidofinance/lido-app-ui/styles`. */
22
27
  const Typography = _ref => {
23
28
  let {
24
- variant,
29
+ variant = 'body',
25
30
  weight,
31
+ color,
26
32
  as,
27
33
  className,
28
34
  children,
29
35
  dataTestId,
30
36
  ...rest
31
37
  } = _ref;
32
- const Component = as ?? variantTag[variant];
38
+ const resolved = resolveVariant(variant);
39
+ const Component = as ?? variantTag[resolved];
33
40
  return /*#__PURE__*/jsxRuntime.jsx(Component, {
34
- className: cn(Typography_module.root, Typography_module[variant], weight === 'semibold' && isBodyVariant(variant) && Typography_module.semibold, className),
41
+ className: cn(Typography_module.root, Typography_module[resolved], color && Typography_module[`color-${color}`], weight && Typography_module[`weight-${weight}`], className),
35
42
  "data-testid": dataTestId?.root,
36
43
  ...rest,
37
44
  children: children
@@ -61,17 +68,23 @@ const Description = props => /*#__PURE__*/jsxRuntime.jsx(Typography, {
61
68
  ...props,
62
69
  variant: "description"
63
70
  });
64
- const GroupName = props => /*#__PURE__*/jsxRuntime.jsx(Typography, {
71
+ const Caption = props => /*#__PURE__*/jsxRuntime.jsx(Typography, {
65
72
  ...props,
66
- variant: "groupName"
73
+ variant: "caption"
67
74
  });
68
75
 
76
+ /** @deprecated use Caption */
77
+ const GroupName = Caption;
78
+
69
79
  exports.Body = Body;
70
80
  exports.BodyLarge = BodyLarge;
81
+ exports.Caption = Caption;
71
82
  exports.Description = Description;
72
83
  exports.GroupName = GroupName;
73
84
  exports.H1 = H1;
74
85
  exports.H2 = H2;
75
86
  exports.H3 = H3;
76
87
  exports.Typography = Typography;
88
+ exports.typographyColors = typographyColors;
89
+ exports.typographyWeights = typographyWeights;
77
90
  //# sourceMappingURL=Typography.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"Typography.cjs","sources":["../../../src/typography/Typography.tsx"],"sourcesContent":["import type { ElementType, HTMLAttributes } from 'react'\n\nimport cn from 'classnames'\n\nimport styles from './Typography.module.css'\n\nexport type TypographyVariant =\n | 'h1'\n | 'h2'\n | 'h3'\n | 'richInput'\n | 'bodyLarge'\n | 'body'\n | 'description'\n | 'groupName'\n\n// Weight only applies to bodyLarge/body/description; headings are single-weight by design.\nexport type TypographyWeight = 'regular' | 'semibold'\n\nexport type TypographyDataTestId = {\n root?: string\n}\n\nexport type TypographyProps = HTMLAttributes<HTMLElement> & {\n /** Type style; also decides the default tag. */\n variant: TypographyVariant\n /** Only `bodyLarge`, `body` and `description` have two weights. */\n weight?: TypographyWeight\n /** Overrides the rendered tag without changing the style. */\n as?: ElementType\n dataTestId?: TypographyDataTestId\n}\n\nconst variantTag: Record<TypographyVariant, ElementType> = {\n h1: 'h1',\n h2: 'h2',\n h3: 'h3',\n richInput: 'p',\n bodyLarge: 'p',\n body: 'p',\n description: 'p',\n groupName: 'p',\n}\n\nconst isBodyVariant = (variant: TypographyVariant): boolean =>\n variant === 'bodyLarge' || variant === 'body' || variant === 'description'\n\n/** Typed text in Manrope; use the shortcuts (`H1`, `Body`, ...) in app code and `Typography` when the variant is dynamic. The same styles ship as PostCSS mixins from `@lidofinance/lido-app-ui/styles`. */\nexport const Typography = ({\n variant,\n weight,\n as,\n className,\n children,\n dataTestId,\n ...rest\n}: TypographyProps) => {\n const Component = as ?? variantTag[variant]\n\n return (\n <Component\n className={cn(\n styles.root,\n styles[variant],\n weight === 'semibold' && isBodyVariant(variant) && styles.semibold,\n className,\n )}\n data-testid={dataTestId?.root}\n {...rest}\n >\n {children}\n </Component>\n )\n}\n\ntype ShorthandProps = Omit<TypographyProps, 'variant'>\n\nexport const H1 = (props: ShorthandProps) => (\n <Typography {...props} variant='h1' />\n)\n\nexport const H2 = (props: ShorthandProps) => (\n <Typography {...props} variant='h2' />\n)\n\nexport const H3 = (props: ShorthandProps) => (\n <Typography {...props} variant='h3' />\n)\n\nexport const BodyLarge = (props: ShorthandProps) => (\n <Typography {...props} variant='bodyLarge' />\n)\n\nexport const Body = (props: ShorthandProps) => (\n <Typography {...props} variant='body' />\n)\n\nexport const Description = (props: ShorthandProps) => (\n <Typography {...props} variant='description' />\n)\n\nexport const GroupName = (props: ShorthandProps) => (\n <Typography {...props} variant='groupName' />\n)\n"],"names":["variantTag","h1","h2","h3","richInput","bodyLarge","body","description","groupName","isBodyVariant","variant","Typography","_ref","weight","as","className","children","dataTestId","rest","Component","_jsx","cn","styles","root","semibold","H1","props","H2","H3","BodyLarge","Body","Description","GroupName"],"mappings":";;;;;;;;AAiCA,MAAMA,UAAkD,GAAG;AACzDC,EAAAA,EAAE,EAAE,IAAI;AACRC,EAAAA,EAAE,EAAE,IAAI;AACRC,EAAAA,EAAE,EAAE,IAAI;AACRC,EAAAA,SAAS,EAAE,GAAG;AACdC,EAAAA,SAAS,EAAE,GAAG;AACdC,EAAAA,IAAI,EAAE,GAAG;AACTC,EAAAA,WAAW,EAAE,GAAG;AAChBC,EAAAA,SAAS,EAAE,GAAA;AACb,CAAC,CAAA;AAED,MAAMC,aAAa,GAAIC,OAA0B,IAC/CA,OAAO,KAAK,WAAW,IAAIA,OAAO,KAAK,MAAM,IAAIA,OAAO,KAAK,aAAa,CAAA;;AAE5E;AACaC,MAAAA,UAAU,GAAGC,IAAA,IAQH;EAAA,IARI;IACzBF,OAAO;IACPG,MAAM;IACNC,EAAE;IACFC,SAAS;IACTC,QAAQ;IACRC,UAAU;IACV,GAAGC,IAAAA;AACY,GAAC,GAAAN,IAAA,CAAA;AAChB,EAAA,MAAMO,SAAS,GAAGL,EAAE,IAAId,UAAU,CAACU,OAAO,CAAC,CAAA;EAE3C,oBACEU,cAAA,CAACD,SAAS,EAAA;IACRJ,SAAS,EAAEM,EAAE,CACXC,iBAAM,CAACC,IAAI,EACXD,iBAAM,CAACZ,OAAO,CAAC,EACfG,MAAM,KAAK,UAAU,IAAIJ,aAAa,CAACC,OAAO,CAAC,IAAIY,iBAAM,CAACE,QAAQ,EAClET,SACF,CAAE;IACF,aAAaE,EAAAA,UAAU,EAAEM,IAAK;AAAA,IAAA,GAC1BL,IAAI;AAAAF,IAAAA,QAAA,EAEPA,QAAAA;AAAQ,GACA,CAAC,CAAA;AAEhB,EAAC;MAIYS,EAAE,GAAIC,KAAqB,iBACtCN,cAAA,CAACT,UAAU,EAAA;AAAA,EAAA,GAAKe,KAAK;AAAEhB,EAAAA,OAAO,EAAC,IAAA;AAAI,CAAE,EACtC;MAEYiB,EAAE,GAAID,KAAqB,iBACtCN,cAAA,CAACT,UAAU,EAAA;AAAA,EAAA,GAAKe,KAAK;AAAEhB,EAAAA,OAAO,EAAC,IAAA;AAAI,CAAE,EACtC;MAEYkB,EAAE,GAAIF,KAAqB,iBACtCN,cAAA,CAACT,UAAU,EAAA;AAAA,EAAA,GAAKe,KAAK;AAAEhB,EAAAA,OAAO,EAAC,IAAA;AAAI,CAAE,EACtC;MAEYmB,SAAS,GAAIH,KAAqB,iBAC7CN,cAAA,CAACT,UAAU,EAAA;AAAA,EAAA,GAAKe,KAAK;AAAEhB,EAAAA,OAAO,EAAC,WAAA;AAAW,CAAE,EAC7C;MAEYoB,IAAI,GAAIJ,KAAqB,iBACxCN,cAAA,CAACT,UAAU,EAAA;AAAA,EAAA,GAAKe,KAAK;AAAEhB,EAAAA,OAAO,EAAC,MAAA;AAAM,CAAE,EACxC;MAEYqB,WAAW,GAAIL,KAAqB,iBAC/CN,cAAA,CAACT,UAAU,EAAA;AAAA,EAAA,GAAKe,KAAK;AAAEhB,EAAAA,OAAO,EAAC,aAAA;AAAa,CAAE,EAC/C;MAEYsB,SAAS,GAAIN,KAAqB,iBAC7CN,cAAA,CAACT,UAAU,EAAA;AAAA,EAAA,GAAKe,KAAK;AAAEhB,EAAAA,OAAO,EAAC,WAAA;AAAW,CAAE;;;;;;;;;;;"}
1
+ {"version":3,"file":"Typography.cjs","sources":["../../../src/typography/Typography.tsx"],"sourcesContent":["import type { ElementType, HTMLAttributes } from 'react'\n\nimport cn from 'classnames'\n\nimport styles from './Typography.module.css'\n\nexport const typographyColors = [\n 'default',\n 'secondary',\n 'tertiary',\n 'neutral',\n 'active',\n 'success',\n 'warning',\n 'error',\n 'info',\n 'inverse',\n 'disabled',\n] as const\n\nexport type TypographyColor = (typeof typographyColors)[number]\n\nexport const typographyWeights = [\n 'thin',\n 'regular',\n 'medium',\n 'semibold',\n 'bold',\n] as const\n\nexport type TypographyWeight = (typeof typographyWeights)[number]\n\nexport type TypographyVariant =\n | 'h1'\n | 'h2'\n | 'h3'\n | 'amount'\n | 'bodyLarge'\n | 'body'\n | 'description'\n | 'caption'\n\n/** @deprecated `richInput` → `amount`, `groupName` → `caption` */\ntype DeprecatedTypographyVariant = 'richInput' | 'groupName'\n\nexport type TypographyDataTestId = {\n root?: string\n}\n\nexport type TypographyProps = Omit<HTMLAttributes<HTMLElement>, 'color'> & {\n /** Type style; also decides the default tag. */\n variant?: TypographyVariant | DeprecatedTypographyVariant\n /** Overrides the variant's font weight. */\n weight?: TypographyWeight\n /** Text color token; omit to inherit. */\n color?: TypographyColor\n /** Overrides the rendered tag without changing the style. */\n as?: ElementType\n dataTestId?: TypographyDataTestId\n}\n\nconst resolveVariant = (\n variant: TypographyVariant | DeprecatedTypographyVariant,\n): TypographyVariant =>\n variant === 'richInput'\n ? 'amount'\n : variant === 'groupName'\n ? 'caption'\n : variant\n\nconst variantTag: Record<TypographyVariant, ElementType> = {\n h1: 'h1',\n h2: 'h2',\n h3: 'h3',\n amount: 'p',\n bodyLarge: 'p',\n body: 'p',\n description: 'p',\n caption: 'p',\n}\n\n/** Typed text in Manrope; use the shortcuts (`H1`, `Body`, ...) in app code and `Typography` when the variant is dynamic. The same styles ship as PostCSS mixins from `@lidofinance/lido-app-ui/styles`. */\nexport const Typography = ({\n variant = 'body',\n weight,\n color,\n as,\n className,\n children,\n dataTestId,\n ...rest\n}: TypographyProps) => {\n const resolved = resolveVariant(variant)\n const Component = as ?? variantTag[resolved]\n\n return (\n <Component\n className={cn(\n styles.root,\n styles[resolved],\n color && styles[`color-${color}`],\n weight && styles[`weight-${weight}`],\n className,\n )}\n data-testid={dataTestId?.root}\n {...rest}\n >\n {children}\n </Component>\n )\n}\n\ntype ShorthandProps = Omit<TypographyProps, 'variant'>\n\nexport const H1 = (props: ShorthandProps) => (\n <Typography {...props} variant='h1' />\n)\n\nexport const H2 = (props: ShorthandProps) => (\n <Typography {...props} variant='h2' />\n)\n\nexport const H3 = (props: ShorthandProps) => (\n <Typography {...props} variant='h3' />\n)\n\nexport const BodyLarge = (props: ShorthandProps) => (\n <Typography {...props} variant='bodyLarge' />\n)\n\nexport const Body = (props: ShorthandProps) => (\n <Typography {...props} variant='body' />\n)\n\nexport const Description = (props: ShorthandProps) => (\n <Typography {...props} variant='description' />\n)\n\nexport const Caption = (props: ShorthandProps) => (\n <Typography {...props} variant='caption' />\n)\n\n/** @deprecated use Caption */\nexport const GroupName = Caption\n"],"names":["typographyColors","typographyWeights","resolveVariant","variant","variantTag","h1","h2","h3","amount","bodyLarge","body","description","caption","Typography","_ref","weight","color","as","className","children","dataTestId","rest","resolved","Component","_jsx","cn","styles","root","H1","props","H2","H3","BodyLarge","Body","Description","Caption","GroupName"],"mappings":";;;;;;;;AAMO,MAAMA,gBAAgB,GAAG,CAC9B,SAAS,EACT,WAAW,EACX,UAAU,EACV,SAAS,EACT,QAAQ,EACR,SAAS,EACT,SAAS,EACT,OAAO,EACP,MAAM,EACN,SAAS,EACT,UAAU,EACF;AAIGC,MAAAA,iBAAiB,GAAG,CAC/B,MAAM,EACN,SAAS,EACT,QAAQ,EACR,UAAU,EACV,MAAM,EACE;;AAcV;;AAmBA,MAAMC,cAAc,GAClBC,OAAwD,IAExDA,OAAO,KAAK,WAAW,GACnB,QAAQ,GACRA,OAAO,KAAK,WAAW,GACrB,SAAS,GACTA,OAAO,CAAA;AAEf,MAAMC,UAAkD,GAAG;AACzDC,EAAAA,EAAE,EAAE,IAAI;AACRC,EAAAA,EAAE,EAAE,IAAI;AACRC,EAAAA,EAAE,EAAE,IAAI;AACRC,EAAAA,MAAM,EAAE,GAAG;AACXC,EAAAA,SAAS,EAAE,GAAG;AACdC,EAAAA,IAAI,EAAE,GAAG;AACTC,EAAAA,WAAW,EAAE,GAAG;AAChBC,EAAAA,OAAO,EAAE,GAAA;AACX,CAAC,CAAA;;AAED;A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iBAC7CL,cAAA,CAACX,UAAU,EAAA;AAAA,EAAA,GAAKgB,KAAK;AAAE1B,EAAAA,OAAO,EAAC,WAAA;AAAW,CAAE,EAC7C;MAEY8B,IAAI,GAAIJ,KAAqB,iBACxCL,cAAA,CAACX,UAAU,EAAA;AAAA,EAAA,GAAKgB,KAAK;AAAE1B,EAAAA,OAAO,EAAC,MAAA;AAAM,CAAE,EACxC;MAEY+B,WAAW,GAAIL,KAAqB,iBAC/CL,cAAA,CAACX,UAAU,EAAA;AAAA,EAAA,GAAKgB,KAAK;AAAE1B,EAAAA,OAAO,EAAC,aAAA;AAAa,CAAE,EAC/C;MAEYgC,OAAO,GAAIN,KAAqB,iBAC3CL,cAAA,CAACX,UAAU,EAAA;AAAA,EAAA,GAAKgB,KAAK;AAAE1B,EAAAA,OAAO,EAAC,SAAA;AAAS,CAAE,EAC3C;;AAED;AACO,MAAMiC,SAAS,GAAGD;;;;;;;;;;;;;;"}
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- const styles = {"root":"Typography-module_root__2cRgG","h1":"Typography-module_h1__Owx3Q","h2":"Typography-module_h2__PGKur","h3":"Typography-module_h3__SyRpZ","richInput":"Typography-module_richInput__QDHSm","bodyLarge":"Typography-module_bodyLarge__ziLsk","body":"Typography-module_body__fowlB","description":"Typography-module_description__5mtlx","groupName":"Typography-module_groupName__DNolh","semibold":"Typography-module_semibold__pf-6N"};
3
+ const styles = {"root":"Typography-module_root__2cRgG","h1":"Typography-module_h1__Owx3Q","h2":"Typography-module_h2__PGKur","h3":"Typography-module_h3__SyRpZ","amount":"Typography-module_amount__drtq0","bodyLarge":"Typography-module_bodyLarge__ziLsk","body":"Typography-module_body__fowlB","description":"Typography-module_description__5mtlx","caption":"Typography-module_caption__ftWKE","weight-thin":"Typography-module_weight-thin__55oL6","weight-regular":"Typography-module_weight-regular__m5NNo","weight-medium":"Typography-module_weight-medium__CQ2Eb","weight-semibold":"Typography-module_weight-semibold__n7eLX","weight-bold":"Typography-module_weight-bold__CeKLl","color-default":"Typography-module_color-default__7FQuh","color-secondary":"Typography-module_color-secondary__HtGK2","color-tertiary":"Typography-module_color-tertiary__c-6R5","color-neutral":"Typography-module_color-neutral__VDBOX","color-active":"Typography-module_color-active__PcBdi","color-success":"Typography-module_color-success__j7XIf","color-warning":"Typography-module_color-warning__q1VU-","color-error":"Typography-module_color-error__ABRrW","color-info":"Typography-module_color-info__BzlBj","color-inverse":"Typography-module_color-inverse__9urcs","color-disabled":"Typography-module_color-disabled__1XM9m"};
4
4
 
5
5
  module.exports = styles;
6
6
  //# sourceMappingURL=Typography.module.css.cjs.map
@@ -6,7 +6,7 @@ const react = require('react');
6
6
  const Anchor = require('../link-provider/Anchor.cjs');
7
7
  const jsxRuntime = require('react/jsx-runtime');
8
8
 
9
- /** Internal, not exported from the package. Renders `Anchor` when `href` is set (see `AnchorProps` for `disabled` and `external`), otherwise `<button type='button'>`. */
9
+ /** Internal, not exported from the package. Renders `Anchor` when `href` is set (see `AnchorProps` for `disabled`), otherwise `<button type='button'>`. */
10
10
  const ActionElement = /*#__PURE__*/react.forwardRef((props, ref) => {
11
11
  if (props.href !== undefined) {
12
12
  return /*#__PURE__*/jsxRuntime.jsx(Anchor.Anchor, {
@@ -1 +1 @@
1
- {"version":3,"file":"ActionElement.cjs","sources":["../../../src/utils/ActionElement.tsx"],"sourcesContent":["import { forwardRef, type ButtonHTMLAttributes, type ForwardedRef } from 'react'\n\nimport { Anchor, type AnchorProps } from '../link-provider/Anchor'\n\nexport type ActionElementProps =\n | (AnchorProps & { href: string })\n | (ButtonHTMLAttributes<HTMLButtonElement> & { href?: undefined })\n\n/** Internal, not exported from the package. Renders `Anchor` when `href` is set (see `AnchorProps` for `disabled` and `external`), otherwise `<button type='button'>`. */\nexport const ActionElement = forwardRef<\n HTMLAnchorElement | HTMLButtonElement,\n ActionElementProps\n>((props, ref) => {\n if (props.href !== undefined) {\n return <Anchor ref={ref as ForwardedRef<HTMLAnchorElement>} {...props} />\n }\n\n const { type = 'button', ...rest } = props\n return (\n <button\n ref={ref as ForwardedRef<HTMLButtonElement>}\n type={type}\n {...rest}\n />\n )\n})\n\nActionElement.displayName = 'ActionElement'\n"],"names":["ActionElement","forwardRef","props","ref","href","undefined","_jsx","Anchor","type","rest","displayName"],"mappings":";;;;;;;;AAQA;AACO,MAAMA,aAAa,gBAAGC,gBAAU,CAGrC,CAACC,KAAK,EAAEC,GAAG,KAAK;AAChB,EAAA,IAAID,KAAK,CAACE,IAAI,KAAKC,SAAS,EAAE;IAC5B,oBAAOC,cAAA,CAACC,aAAM,EAAA;AAACJ,MAAAA,GAAG,EAAEA,GAAuC;MAAA,GAAKD,KAAAA;AAAK,KAAG,CAAC,CAAA;AAC3E,GAAA;EAEA,MAAM;AAAEM,IAAAA,IAAI,GAAG,QAAQ;IAAE,GAAGC,IAAAA;AAAK,GAAC,GAAGP,KAAK,CAAA;AAC1C,EAAA,oBACEI,cAAA,CAAA,QAAA,EAAA;AACEH,IAAAA,GAAG,EAAEA,GAAuC;AAC5CK,IAAAA,IAAI,EAAEA,IAAK;IAAA,GACPC,IAAAA;AAAI,GACT,CAAC,CAAA;AAEN,CAAC,EAAC;AAEFT,aAAa,CAACU,WAAW,GAAG,eAAe;;;;"}
1
+ {"version":3,"file":"ActionElement.cjs","sources":["../../../src/utils/ActionElement.tsx"],"sourcesContent":["import { forwardRef, type ButtonHTMLAttributes, type ForwardedRef } from 'react'\n\nimport { Anchor, type AnchorProps } from '../link-provider/Anchor'\n\nexport type ActionElementProps =\n | (AnchorProps & { href: string })\n | (ButtonHTMLAttributes<HTMLButtonElement> & { href?: undefined })\n\nexport type ActionAsButtonProps = ButtonHTMLAttributes<HTMLButtonElement> & {\n href?: never\n linkProps?: never\n loading?: boolean\n}\n\nexport type ActionAsLinkProps = Omit<AnchorProps, 'href' | 'external'> & {\n href: string\n loading?: never\n type?: never\n}\n\n/** Internal, not exported from the package. Renders `Anchor` when `href` is set (see `AnchorProps` for `disabled`), otherwise `<button type='button'>`. */\nexport const ActionElement = forwardRef<\n HTMLAnchorElement | HTMLButtonElement,\n ActionElementProps\n>((props, ref) => {\n if (props.href !== undefined) {\n return <Anchor ref={ref as ForwardedRef<HTMLAnchorElement>} {...props} />\n }\n\n const { type = 'button', ...rest } = props\n return (\n <button\n ref={ref as ForwardedRef<HTMLButtonElement>}\n type={type}\n {...rest}\n />\n )\n})\n\nActionElement.displayName = 'ActionElement'\n"],"names":["ActionElement","forwardRef","props","ref","href","undefined","_jsx","Anchor","type","rest","displayName"],"mappings":";;;;;;;;AAoBA;AACO,MAAMA,aAAa,gBAAGC,gBAAU,CAGrC,CAACC,KAAK,EAAEC,GAAG,KAAK;AAChB,EAAA,IAAID,KAAK,CAACE,IAAI,KAAKC,SAAS,EAAE;IAC5B,oBAAOC,cAAA,CAACC,aAAM,EAAA;AAACJ,MAAAA,GAAG,EAAEA,GAAuC;MAAA,GAAKD,KAAAA;AAAK,KAAG,CAAC,CAAA;AAC3E,GAAA;EAEA,MAAM;AAAEM,IAAAA,IAAI,GAAG,QAAQ;IAAE,GAAGC,IAAAA;AAAK,GAAC,GAAGP,KAAK,CAAA;AAC1C,EAAA,oBACEI,cAAA,CAAA,QAAA,EAAA;AACEH,IAAAA,GAAG,EAAEA,GAAuC;AAC5CK,IAAAA,IAAI,EAAEA,IAAK;IAAA,GACPC,IAAAA;AAAI,GACT,CAAC,CAAA;AAEN,CAAC,EAAC;AAEFT,aAAa,CAACU,WAAW,GAAG,eAAe;;;;"}
@@ -0,0 +1,8 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
+
5
+ const joinAriaLabel = (ariaLabel, counterLabel) => ariaLabel && counterLabel ? `${ariaLabel}, ${counterLabel}` : ariaLabel;
6
+
7
+ exports.joinAriaLabel = joinAriaLabel;
8
+ //# sourceMappingURL=joinAriaLabel.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"joinAriaLabel.cjs","sources":["../../../src/utils/joinAriaLabel.ts"],"sourcesContent":["export const joinAriaLabel = (\n ariaLabel: string | undefined,\n counterLabel: string | undefined,\n) => (ariaLabel && counterLabel ? `${ariaLabel}, ${counterLabel}` : ariaLabel)\n"],"names":["joinAriaLabel","ariaLabel","counterLabel"],"mappings":";;;;MAAaA,aAAa,GAAGA,CAC3BC,SAA6B,EAC7BC,YAAgC,KAC5BD,SAAS,IAAIC,YAAY,GAAG,CAAGD,EAAAA,SAAS,KAAKC,YAAY,CAAA,CAAE,GAAGD;;;;"}
@@ -20,9 +20,7 @@ const syncTitle = e => {
20
20
  if (!el) return;
21
21
  if (el.scrollWidth > el.clientWidth) el.setAttribute('title', el.textContent ?? '');else el.removeAttribute('title');
22
22
  };
23
-
24
- /** Trail of ancestors ending in the current page (`aria-current="page"`); scrolls horizontally with an edge fade when it overflows. */
25
- const Breadcrumbs = /*#__PURE__*/forwardRef((_ref, ref) => {
23
+ const BreadcrumbsTrail = /*#__PURE__*/forwardRef((_ref, ref) => {
26
24
  let {
27
25
  items,
28
26
  className,
@@ -111,6 +109,15 @@ const Breadcrumbs = /*#__PURE__*/forwardRef((_ref, ref) => {
111
109
  })
112
110
  });
113
111
  });
112
+ BreadcrumbsTrail.displayName = 'BreadcrumbsTrail';
113
+
114
+ /** Trail of ancestors ending in the current page (`aria-current="page"`); scrolls horizontally with an edge fade when it overflows. */
115
+ const Breadcrumbs = /*#__PURE__*/forwardRef((props, ref) =>
116
+ // Separate component so its mount effects attach once the list exists.
117
+ props.items.length === 0 ? null : /*#__PURE__*/jsx(BreadcrumbsTrail, {
118
+ ref: ref,
119
+ ...props
120
+ }));
114
121
  Breadcrumbs.displayName = 'Breadcrumbs';
115
122
 
116
123
  export { Breadcrumbs };
@@ -1 +1 @@
1
- {"version":3,"file":"Breadcrumbs.mjs","sources":["../../../src/breadcrumbs/Breadcrumbs.tsx"],"sourcesContent":["import { forwardRef, useEffect, useRef } from 'react'\nimport type { HTMLAttributes, PointerEvent, ReactNode } from 'react'\n\nimport cn from 'classnames'\n\nimport { useEdgeFade, useIsomorphicLayoutEffect } from '../hooks'\nimport { IconChevronRight } from '../icons'\nimport { ActionElement, type ActionElementProps } from '../utils'\nimport styles from './Breadcrumbs.module.css'\n\nexport type BreadcrumbItemDataTestId = { root?: string }\n\nexport type BreadcrumbItem = ActionElementProps & {\n label: ReactNode\n children?: never\n /** Test id of the item's label element, for link, plain and current items alike. */\n dataTestId?: BreadcrumbItemDataTestId\n}\n\nexport type BreadcrumbsDataTestId = { root?: string; list?: string }\n\nexport type BreadcrumbsProps = HTMLAttributes<HTMLElement> & {\n /** `href` renders a link, only `onClick` a button, anything else (and `disabled`) plain text; the last item is the current page. */\n items: BreadcrumbItem[]\n dataTestId?: BreadcrumbsDataTestId\n}\n\nconst ANCHOR_ONLY = [\n 'href',\n 'onClick',\n 'disabled',\n 'external',\n 'linkProps',\n 'type',\n 'target',\n 'rel',\n 'download',\n] as const\n\nconst spanAttrs = (props: Omit<BreadcrumbItem, 'label'>) => {\n const attrs: Record<string, unknown> = { ...props }\n for (const key of ANCHOR_ONLY) delete attrs[key]\n return attrs as HTMLAttributes<HTMLSpanElement>\n}\n\nconst syncTitle = (e: PointerEvent<HTMLElement>) => {\n const el = (e.target as Element).closest('[data-label]')\n if (!el) return\n if (el.scrollWidth > el.clientWidth)\n el.setAttribute('title', el.textContent ?? '')\n else el.removeAttribute('title')\n}\n\n/** Trail of ancestors ending in the current page (`aria-current=\"page\"`); scrolls horizontally with an edge fade when it overflows. */\nexport const Breadcrumbs = forwardRef<HTMLElement, BreadcrumbsProps>(\n ({ items, className, dataTestId, ...rest }, ref) => {\n const listRef = useRef<HTMLOListElement>(null)\n\n const { sync, onFocus } = useEdgeFade(listRef)\n const trailRef = useRef<string>()\n\n useIsomorphicLayoutEffect(() => {\n const list = listRef.current\n if (!list) return\n const trail = Array.from(list.children, (li) => li.textContent).join(\n '\\u0000',\n )\n if (trail !== trailRef.current) {\n trailRef.current = trail\n list.scrollLeft = list.scrollWidth\n }\n sync()\n })\n\n // A list mounted hidden (display: none) can't scroll on mount, so scroll once it gets a width.\n useEffect(() => {\n const list = listRef.current\n if (!list || typeof ResizeObserver === 'undefined') return\n let hidden = list.clientWidth === 0\n const observer = new ResizeObserver(() => {\n const wasHidden = hidden\n hidden = list.clientWidth === 0\n if (!wasHidden || hidden) return\n list.scrollLeft = list.scrollWidth\n sync()\n })\n observer.observe(list)\n return () => observer.disconnect()\n }, [sync])\n\n return (\n <nav\n ref={ref}\n aria-label='Breadcrumb'\n className={cn(styles.nav, className)}\n data-testid={dataTestId?.root}\n {...rest}\n >\n <ol\n ref={listRef}\n className={styles.list}\n data-testid={dataTestId?.list}\n onScroll={sync}\n onFocus={onFocus}\n onPointerOver={syncTitle}\n >\n {items.map(\n ({ label, dataTestId: itemTestId, ...itemProps }, index) => {\n const current = index === items.length - 1\n const labelAttrs =\n itemProps.title === undefined ? { 'data-label': '' } : {}\n const interactive =\n !current &&\n (itemProps.href !== undefined ||\n itemProps.onClick !== undefined) &&\n !itemProps.disabled\n return (\n <li key={index} className={styles.item}>\n {interactive ? (\n <ActionElement\n data-testid={itemTestId?.root}\n {...itemProps}\n {...labelAttrs}\n className={cn(\n styles.label,\n styles.link,\n itemProps.className,\n )}\n >\n {label}\n </ActionElement>\n ) : (\n <span\n data-testid={itemTestId?.root}\n {...spanAttrs(itemProps)}\n {...labelAttrs}\n {...(current && { 'aria-current': 'page' as const })}\n className={cn(\n styles.label,\n current && styles.current,\n itemProps.className,\n )}\n >\n {label}\n </span>\n )}\n {!current && (\n <IconChevronRight\n className={styles.separator}\n aria-hidden='true'\n />\n )}\n </li>\n )\n },\n )}\n </ol>\n </nav>\n )\n },\n)\n\nBreadcrumbs.displayName = 'Breadcrumbs'\n"],"names":["ANCHOR_ONLY","spanAttrs","props","attrs","key","syncTitle","e","el","target","closest","scrollWidth","clientWidth","setAttribute","textContent","removeAttribute","Breadcrumbs","forwardRef","_ref","ref","items","className","dataTestId","rest","listRef","useRef","sync","onFocus","useEdgeFade","trailRef","useIsomorphicLayoutEffect","list","current","trail","Array","from","children","li","join","scrollLeft","useEffect","ResizeObserver","hidden","observer","wasHidden","observe","disconnect","_jsx","cn","styles","nav","root","onScroll","onPointerOver","map","_ref2","index","label","itemTestId","itemProps","length","labelAttrs","title","undefined","interactive","href","onClick","disabled","_jsxs","item","ActionElement","link","IconChevronRight","separator","displayName"],"mappings":";;;;;;;;;AA2BA,MAAMA,WAAW,GAAG,CAClB,MAAM,EACN,SAAS,EACT,UAAU,EACV,UAAU,EACV,WAAW,EACX,MAAM,EACN,QAAQ,EACR,KAAK,EACL,UAAU,CACF,CAAA;AAEV,MAAMC,SAAS,GAAIC,KAAoC,IAAK;AAC1D,EAAA,MAAMC,KAA8B,GAAG;IAAE,GAAGD,KAAAA;GAAO,CAAA;EACnD,KAAK,MAAME,GAAG,IAAIJ,WAAW,EAAE,OAAOG,KAAK,CAACC,GAAG,CAAC,CAAA;AAChD,EAAA,OAAOD,KAAK,CAAA;AACd,CAAC,CAAA;AAED,MAAME,SAAS,GAAIC,CAA4B,IAAK;EAClD,MAAMC,EAAE,GAAID,CAAC,CAACE,MAAM,CAAaC,OAAO,CAAC,cAAc,CAAC,CAAA;EACxD,IAAI,CAACF,EAAE,EAAE,OAAA;EACT,IAAIA,EAAE,CAACG,WAAW,GAAGH,EAAE,CAACI,WAAW,EACjCJ,EAAE,CAACK,YAAY,CAAC,OAAO,EAAEL,EAAE,CAACM,WAAW,IAAI,EAAE,CAAC,CAC3CN,KAAAA,EAAE,CAACO,eAAe,CAAC,OAAO,CAAC,CAAA;AAClC,CAAC,CAAA;;AAED;AACO,MAAMC,WAAW,gBAAGC,UAAU,CACnC,CAAAC,IAAA,EAA4CC,GAAG,KAAK;EAAA,IAAnD;IAAEC,KAAK;IAAEC,SAAS;IAAEC,UAAU;IAAE,GAAGC,IAAAA;AAAK,GAAC,GAAAL,IAAA,CAAA;AACxC,EAAA,MAAMM,OAAO,GAAGC,MAAM,CAAmB,IAAI,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sx"],"sourcesContent":["import { forwardRef, useEffect, useRef } from 'react'\nimport type { HTMLAttributes, PointerEvent, ReactNode } from 'react'\n\nimport cn from 'classnames'\n\nimport { useEdgeFade, useIsomorphicLayoutEffect } from '../hooks'\nimport { IconChevronRight } from '../icons'\nimport { ActionElement, type ActionElementProps } from '../utils'\nimport styles from './Breadcrumbs.module.css'\n\nexport type BreadcrumbItemDataTestId = { root?: string }\n\nexport type BreadcrumbItem = ActionElementProps & {\n label: ReactNode\n children?: never\n /** Test id of the item's label element, for link, plain and current items alike. */\n dataTestId?: BreadcrumbItemDataTestId\n}\n\nexport type BreadcrumbsDataTestId = { root?: string; list?: string }\n\nexport type BreadcrumbsProps = HTMLAttributes<HTMLElement> & {\n /** `href` renders a link, only `onClick` a button, anything else (and `disabled`) plain text; the last item is the current page; an empty array renders nothing. */\n items: BreadcrumbItem[]\n dataTestId?: BreadcrumbsDataTestId\n}\n\nconst ANCHOR_ONLY = [\n 'href',\n 'onClick',\n 'disabled',\n 'external',\n 'linkProps',\n 'type',\n 'target',\n 'rel',\n 'download',\n] as const\n\nconst spanAttrs = (props: Omit<BreadcrumbItem, 'label'>) => {\n const attrs: Record<string, unknown> = { ...props }\n for (const key of ANCHOR_ONLY) delete attrs[key]\n return attrs as HTMLAttributes<HTMLSpanElement>\n}\n\nconst syncTitle = (e: PointerEvent<HTMLElement>) => {\n const el = (e.target as Element).closest('[data-label]')\n if (!el) return\n if (el.scrollWidth > el.clientWidth)\n el.setAttribute('title', el.textContent ?? '')\n else el.removeAttribute('title')\n}\n\nconst BreadcrumbsTrail = forwardRef<HTMLElement, BreadcrumbsProps>(\n ({ items, className, dataTestId, ...rest }, ref) => {\n const listRef = useRef<HTMLOListElement>(null)\n\n const { sync, onFocus } = useEdgeFade(listRef)\n const trailRef = useRef<string>()\n\n useIsomorphicLayoutEffect(() => {\n const list = listRef.current\n if (!list) return\n const trail = Array.from(list.children, (li) => li.textContent).join(\n '\\u0000',\n )\n if (trail !== trailRef.current) {\n trailRef.current = trail\n list.scrollLeft = list.scrollWidth\n }\n sync()\n })\n\n // A list mounted hidden (display: none) can't scroll on mount, so scroll once it gets a width.\n useEffect(() => {\n const list = listRef.current\n if (!list || typeof ResizeObserver === 'undefined') return\n let hidden = list.clientWidth === 0\n const observer = new ResizeObserver(() => {\n const wasHidden = hidden\n hidden = list.clientWidth === 0\n if (!wasHidden || hidden) return\n list.scrollLeft = list.scrollWidth\n sync()\n })\n observer.observe(list)\n return () => observer.disconnect()\n }, [sync])\n\n return (\n <nav\n ref={ref}\n aria-label='Breadcrumb'\n className={cn(styles.nav, className)}\n data-testid={dataTestId?.root}\n {...rest}\n >\n <ol\n ref={listRef}\n className={styles.list}\n data-testid={dataTestId?.list}\n onScroll={sync}\n onFocus={onFocus}\n onPointerOver={syncTitle}\n >\n {items.map(\n ({ label, dataTestId: itemTestId, ...itemProps }, index) => {\n const current = index === items.length - 1\n const labelAttrs =\n itemProps.title === undefined ? { 'data-label': '' } : {}\n const interactive =\n !current &&\n (itemProps.href !== undefined ||\n itemProps.onClick !== undefined) &&\n !itemProps.disabled\n return (\n <li key={index} className={styles.item}>\n {interactive ? (\n <ActionElement\n data-testid={itemTestId?.root}\n {...itemProps}\n {...labelAttrs}\n className={cn(\n styles.label,\n styles.link,\n itemProps.className,\n )}\n >\n {label}\n </ActionElement>\n ) : (\n <span\n data-testid={itemTestId?.root}\n {...spanAttrs(itemProps)}\n {...labelAttrs}\n {...(current && { 'aria-current': 'page' as const })}\n className={cn(\n styles.label,\n current && styles.current,\n itemProps.className,\n )}\n >\n {label}\n </span>\n )}\n {!current && (\n <IconChevronRight\n className={styles.separator}\n aria-hidden='true'\n />\n )}\n </li>\n )\n },\n )}\n </ol>\n </nav>\n )\n },\n)\n\nBreadcrumbsTrail.displayName = 'BreadcrumbsTrail'\n\n/** Trail of ancestors ending in the current page (`aria-current=\"page\"`); scrolls horizontally with an edge fade when it overflows. */\nexport const Breadcrumbs = forwardRef<HTMLElement, BreadcrumbsProps>(\n (props, ref) =>\n // Separate component so its mount effects attach once the list exists.\n props.items.length === 0 ? null : <BreadcrumbsTrail ref={ref} {...props} />,\n)\n\nBreadcrumbs.displayName = 'Breadcrumbs'\n"],"names":["ANCHOR_ONLY","spanAttrs","props","attrs","key","syncTitle","e","el","target","closest","scrollWidth","clientWidth","setAttribute","textContent","removeAttribute","BreadcrumbsTrail","forwardRef","_ref","ref","items","className","dataTestId","rest","listRef","useRef","sync","onFocus","useEdgeFade","trailRef","useIsomorphicLayoutEffect","list","current","trail","Array","from","children","li","join","scrollLeft","useEffect","ResizeObserver","hidden","observer","wasHidden","observe","disconnect","_jsx","cn","styles","nav","root","onScroll","onPointerOver","map","_ref2","index","label","itemTestId","itemProps","length","labelAttrs","title","undefined","interactive","href","onClick","disabled","_jsxs","item","ActionElement","link","IconChevronRight","separator","displayName","Breadcrumbs"],"mappings":";;;;;;;;;AA2BA,MAAMA,WAAW,GAAG,CAClB,MAAM,EACN,SAAS,EACT,UAAU,EACV,UAAU,EACV,WAAW,EACX,MAAM,EACN,QAAQ,EACR,KAAK,EACL,UAAU,CACF,CAAA;AAEV,MAAMC,SAAS,GAAIC,KAAoC,IAAK;AAC1D,EAAA,MAAMC,KAA8B,GAAG;IAAE,GAAGD,KAAAA;GAAO,CAAA;EACnD,KAAK,MAAME,GAAG,IAAIJ,WAAW,EAAE,OAAOG,KAAK,CAACC,GAAG,CAAC,CAAA;AAChD,EAAA,OAAOD,KAAK,CAAA;AACd,CAAC,CAAA;AAED,MAAME,SAAS,GAAIC,CAA4B,IAAK;EAClD,MAAMC,EAAE,GAAID,CAAC,CAACE,MAAM,CAAaC,OAAO,CAAC,cAAc,CAAC,CAAA;EACxD,IAAI,CAACF,EAAE,EAAE,OAAA;EACT,IAAIA,EAAE,CAACG,WAAW,GAAGH,EAAE,CAACI,WAAW,EACjCJ,EAAE,CAACK,YAAY,CAAC,OAAO,EAAEL,EAAE,CAACM,WAAW,IAAI,EAAE,CAAC,CAC3CN,KAAAA,EAA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4B,MAAM,CAACwB,SAAU;YAC5B,aAAY,EAAA,MAAA;AAAM,WACnB,CACF,CAAA;AAAA,SAAA,EAlCMjB,KAmCL,CAAC,CAAA;OAGX,CAAA;KACE,CAAA;AAAC,GACF,CAAC,CAAA;AAEV,CACF,CAAC,CAAA;AAEDxC,gBAAgB,CAAC0D,WAAW,GAAG,kBAAkB,CAAA;;AAEjD;AACO,MAAMC,WAAW,gBAAG1D,UAAU,CACnC,CAACd,KAAK,EAAEgB,GAAG;AACT;AACAhB,KAAK,CAACiB,KAAK,CAACwC,MAAM,KAAK,CAAC,GAAG,IAAI,gBAAGb,GAAA,CAAC/B,gBAAgB,EAAA;AAACG,EAAAA,GAAG,EAAEA,GAAI;EAAA,GAAKhB,KAAAA;AAAK,CAAG,CAC9E,EAAC;AAEDwE,WAAW,CAACD,WAAW,GAAG,aAAa;;;;"}
@@ -1,15 +1,16 @@
1
1
  import { forwardRef } from 'react';
2
2
  import cn from 'classnames';
3
3
  import styles from './Button.module.css.mjs';
4
- import { joinAriaLabel, ButtonContent } from './ButtonContent.mjs';
4
+ import { ButtonContent } from './ButtonContent.mjs';
5
5
  import { jsx } from 'react/jsx-runtime';
6
+ import { ActionElement } from '../utils/ActionElement.mjs';
7
+ import { joinAriaLabel } from '../utils/joinAriaLabel.mjs';
6
8
 
7
- /** Fully rounded call to action; `size` is big (52px) or small (36px), `loading` swaps the icon slot for a spinner and disables the button. */
9
+ /** Fully rounded call to action; `size` is big (52px) or small (36px), `loading` swaps the icon slot for a spinner and disables it. With `href` it renders a link that routes through `LinkProvider`. */
8
10
  const Button = /*#__PURE__*/forwardRef((_ref, ref) => {
9
11
  let {
10
12
  className,
11
13
  children,
12
- type = 'button',
13
14
  variant = 'primary',
14
15
  size = 'big',
15
16
  loading = false,
@@ -22,14 +23,13 @@ const Button = /*#__PURE__*/forwardRef((_ref, ref) => {
22
23
  'aria-label': ariaLabel,
23
24
  ...rest
24
25
  } = _ref;
25
- return /*#__PURE__*/jsx("button", {
26
+ return /*#__PURE__*/jsx(ActionElement, {
26
27
  ref: ref,
27
- type: type,
28
- disabled: disabled || loading,
29
- "aria-busy": loading || undefined,
30
28
  className: cn(styles.button, styles[variant], styles[size], loading && !disabled && styles.loading, className),
31
29
  "data-testid": dataTestId?.root,
32
30
  "aria-label": joinAriaLabel(ariaLabel, counterLabel),
31
+ "aria-busy": loading || undefined,
32
+ disabled: disabled || loading,
33
33
  ...rest,
34
34
  children: /*#__PURE__*/jsx(ButtonContent, {
35
35
  loading: loading,
@@ -1 +1 @@
1
- {"version":3,"file":"Button.mjs","sources":["../../../src/button/Button.tsx"],"sourcesContent":["import { forwardRef, type ButtonHTMLAttributes } from 'react'\n\nimport cn from 'classnames'\n\nimport styles from './Button.module.css'\nimport { ButtonContent, joinAriaLabel } from './ButtonContent'\nimport type {\n ButtonDataTestId,\n ButtonOwnProps,\n ButtonSize,\n ButtonVariant,\n} from './types'\n\nexport type { ButtonDataTestId, ButtonSize, ButtonVariant }\n\nexport type ButtonProps = ButtonHTMLAttributes<HTMLButtonElement> &\n ButtonOwnProps & {\n loading?: boolean\n }\n\n/** Fully rounded call to action; `size` is big (52px) or small (36px), `loading` swaps the icon slot for a spinner and disables the button. */\nexport const Button = forwardRef<HTMLButtonElement, ButtonProps>(\n (\n {\n className,\n children,\n type = 'button',\n variant = 'primary',\n size = 'big',\n loading = false,\n disabled = false,\n iconLeft,\n iconRight,\n counter,\n counterLabel,\n dataTestId,\n 'aria-label': ariaLabel,\n ...rest\n },\n ref,\n ) => (\n <button\n ref={ref}\n type={type}\n disabled={disabled || loading}\n aria-busy={loading || undefined}\n className={cn(\n styles.button,\n styles[variant],\n styles[size],\n loading && !disabled && styles.loading,\n className,\n )}\n data-testid={dataTestId?.root}\n aria-label={joinAriaLabel(ariaLabel, counterLabel)}\n {...rest}\n >\n <ButtonContent\n loading={loading}\n iconLeft={iconLeft}\n iconRight={iconRight}\n counter={counter}\n counterLabel={counterLabel}\n dataTestId={dataTestId}\n >\n {children}\n </ButtonContent>\n </button>\n ),\n)\n\nButton.displayName = 'Button'\n"],"names":["Button","forwardRef","_ref","ref","className","children","type","variant","size","loading","disabled","iconLeft","iconRight","counter","counterLabel","dataTestId","ariaLabel","rest","_jsx","undefined","cn","styles","button","root","joinAriaLabel","ButtonContent","displayName"],"mappings":";;;;;;AAoBA;AACO,MAAMA,MAAM,gBAAGC,UAAU,CAC9B,CAAAC,IAAA,EAiBEC,GAAG,KAAA;EAAA,IAhBH;IACEC,SAAS;IACTC,QAAQ;AACRC,IAAAA,IAAI,GAAG,QAAQ;AACfC,IAAAA,OAAO,GAAG,SAAS;AACnBC,IAAAA,IAAI,GAAG,KAAK;AACZC,IAAAA,OAAO,GAAG,KAAK;AACfC,IAAAA,QAAQ,GAAG,KAAK;IAChBC,QAAQ;IACRC,SAAS;IACTC,OAAO;IACPC,YAAY;IACZC,UAAU;AACV,IAAA,YAAY,EAAEC,SAAS;IACvB,GAAGC,IAAAA;AACL,GAAC,GAAAf,IAAA,CAAA;AAAA,EAAA,oBAGDgB,GAAA,CAAA,QAAA,EAAA;AACEf,IAAAA,GAAG,EAAEA,GAAI;AACTG,IAAAA,IAAI,EAAEA,IAAK;IACXI,QAAQ,EAAEA,QAAQ,IAAID,OAAQ;IAC9B,WAAWA,EAAAA,OAAO,IAAIU,SAAU;IAChCf,SAAS,EAAEgB,EAAE,CACXC,MAAM,CAACC,MAAM,EACbD,MAAM,CAACd,OAAO,CAAC,EACfc,MAAM,CAACb,IAAI,CAAC,EACZC,OAAO,IAAI,CAACC,QAAQ,IAAIW,MAAM,CAACZ,OAAO,EACtCL,SACF,CAAE;IACF,aAAaW,EAAAA,UAAU,EAAEQ,IAAK;AAC9B,IAAA,YAAA,EAAYC,aAAa,CAACR,SAAS,EAAEF,YAAY,CAAE;AAAA,IAAA,GAC/CG,IAAI;IAAAZ,QAAA,eAERa,GAAA,CAACO,aAAa,EAAA;AACZhB,MAAAA,OAAO,EAAEA,OAAQ;AACjBE,MAAAA,QAAQ,EAAEA,QAAS;AACnBC,MAAAA,SAAS,EAAEA,SAAU;AACrBC,MAAAA,OAAO,EAAEA,OAAQ;AACjBC,MAAAA,YAAY,EAAEA,YAAa;AAC3BC,MAAAA,UAAU,EAAEA,UAAW;AAAAV,MAAAA,QAAA,EAEtBA,QAAAA;KACY,CAAA;AAAC,GACV,CAAC,CAAA;AAAA,CAEb,EAAC;AAEDL,MAAM,CAAC0B,WAAW,GAAG,QAAQ;;;;"}
1
+ {"version":3,"file":"Button.mjs","sources":["../../../src/button/Button.tsx"],"sourcesContent":["import { forwardRef } from 'react'\n\nimport cn from 'classnames'\n\nimport { ActionElement, joinAriaLabel } from '../utils'\nimport styles from './Button.module.css'\nimport { ButtonContent } from './ButtonContent'\nimport type {\n ButtonAsButtonProps,\n ButtonAsLinkProps,\n ButtonDataTestId,\n ButtonProps,\n ButtonSize,\n ButtonVariant,\n} from './types'\n\nexport type {\n ButtonAsButtonProps,\n ButtonAsLinkProps,\n ButtonDataTestId,\n ButtonProps,\n ButtonSize,\n ButtonVariant,\n}\n\n/** Fully rounded call to action; `size` is big (52px) or small (36px), `loading` swaps the icon slot for a spinner and disables it. With `href` it renders a link that routes through `LinkProvider`. */\nexport const Button = forwardRef<\n HTMLButtonElement | HTMLAnchorElement,\n ButtonProps\n>(\n (\n {\n className,\n children,\n variant = 'primary',\n size = 'big',\n loading = false,\n disabled = false,\n iconLeft,\n iconRight,\n counter,\n counterLabel,\n dataTestId,\n 'aria-label': ariaLabel,\n ...rest\n },\n ref,\n ) => (\n <ActionElement\n ref={ref}\n className={cn(\n styles.button,\n styles[variant],\n styles[size],\n loading && !disabled && styles.loading,\n className,\n )}\n data-testid={dataTestId?.root}\n aria-label={joinAriaLabel(ariaLabel, counterLabel)}\n aria-busy={loading || undefined}\n disabled={disabled || loading}\n {...rest}\n >\n <ButtonContent\n loading={loading}\n iconLeft={iconLeft}\n iconRight={iconRight}\n counter={counter}\n counterLabel={counterLabel}\n dataTestId={dataTestId}\n >\n {children}\n </ButtonContent>\n </ActionElement>\n ),\n)\n\nButton.displayName = 'Button'\n"],"names":["Button","forwardRef","_ref","ref","className","children","variant","size","loading","disabled","iconLeft","iconRight","counter","counterLabel","dataTestId","ariaLabel","rest","_jsx","ActionElement","cn","styles","button","root","joinAriaLabel","undefined","ButtonContent","displayName"],"mappings":";;;;;;;;AAyBA;AACO,MAAMA,MAAM,gBAAGC,UAAU,CAI9B,CAAAC,IAAA,EAgBEC,GAAG,KAAA;EAAA,IAfH;IACEC,SAAS;IACTC,QAAQ;AACRC,IAAAA,OAAO,GAAG,SAAS;AACnBC,IAAAA,IAAI,GAAG,KAAK;AACZC,IAAAA,OAAO,GAAG,KAAK;AACfC,IAAAA,QAAQ,GAAG,KAAK;IAChBC,QAAQ;IACRC,SAAS;IACTC,OAAO;IACPC,YAAY;IACZC,UAAU;AACV,IAAA,YAAY,EAAEC,SAAS;IACvB,GAAGC,IAAAA;AACL,GAAC,GAAAd,IAAA,CAAA;EAAA,oBAGDe,GAAA,CAACC,aAAa,EAAA;AACZf,IAAAA,GAAG,EAAEA,GAAI;IACTC,SAAS,EAAEe,EAAE,CACXC,MAAM,CAACC,MAAM,EACbD,MAAM,CAACd,OAAO,CAAC,EACfc,MAAM,CAACb,IAAI,CAAC,EACZC,OAAO,IAAI,CAACC,QAAQ,IAAIW,MAAM,CAACZ,OAAO,EACtCJ,SACF,CAAE;IACF,aAAaU,EAAAA,UAAU,EAAEQ,IAAK;AAC9B,IAAA,YAAA,EAAYC,aAAa,CAACR,SAAS,EAAEF,YAAY,CAAE;IACnD,WAAWL,EAAAA,OAAO,IAAIgB,SAAU;IAChCf,QAAQ,EAAEA,QAAQ,IAAID,OAAQ;AAAA,IAAA,GAC1BQ,IAAI;IAAAX,QAAA,eAERY,GAAA,CAACQ,aAAa,EAAA;AACZjB,MAAAA,OAAO,EAAEA,OAAQ;AACjBE,MAAAA,QAAQ,EAAEA,QAAS;AACnBC,MAAAA,SAAS,EAAEA,SAAU;AACrBC,MAAAA,OAAO,EAAEA,OAAQ;AACjBC,MAAAA,YAAY,EAAEA,YAAa;AAC3BC,MAAAA,UAAU,EAAEA,UAAW;AAAAT,MAAAA,QAAA,EAEtBA,QAAAA;KACY,CAAA;AAAC,GACH,CAAC,CAAA;AAAA,CAEpB,EAAC;AAEDL,MAAM,CAAC0B,WAAW,GAAG,QAAQ;;;;"}
@@ -3,7 +3,6 @@ import styles from './Button.module.css.mjs';
3
3
  import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
4
4
  import { IconLoaderCircle } from '../icons/components/base/IconLoaderCircle.mjs';
5
5
 
6
- const joinAriaLabel = (ariaLabel, counterLabel) => ariaLabel && counterLabel ? `${ariaLabel}, ${counterLabel}` : ariaLabel;
7
6
  const ButtonContent = _ref => {
8
7
  let {
9
8
  loading = false,
@@ -41,5 +40,5 @@ const ButtonContent = _ref => {
41
40
  });
42
41
  };
43
42
 
44
- export { ButtonContent, joinAriaLabel };
43
+ export { ButtonContent };
45
44
  //# sourceMappingURL=ButtonContent.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"ButtonContent.mjs","sources":["../../../src/button/ButtonContent.tsx"],"sourcesContent":["import type { ReactNode } from 'react'\n\nimport { CounterLabel, CounterSlot } from '../counter/CounterSlot'\nimport { IconLoaderCircle } from '../icons'\nimport styles from './Button.module.css'\nimport type { ButtonOwnProps } from './types'\n\nexport const joinAriaLabel = (\n ariaLabel: string | undefined,\n counterLabel: string | undefined,\n) => (ariaLabel && counterLabel ? `${ariaLabel}, ${counterLabel}` : ariaLabel)\n\ntype ButtonContentProps = Pick<\n ButtonOwnProps,\n 'iconLeft' | 'iconRight' | 'counter' | 'counterLabel' | 'dataTestId'\n> & {\n loading?: boolean\n children?: ReactNode\n}\n\nexport const ButtonContent = ({\n loading = false,\n iconLeft,\n iconRight,\n counter,\n counterLabel,\n dataTestId,\n children,\n}: ButtonContentProps) => (\n <>\n {loading ? (\n <IconLoaderCircle className={styles.spinner} aria-hidden='true' />\n ) : (\n iconLeft != null && (\n <span\n className={styles.icon}\n aria-hidden='true'\n data-testid={dataTestId?.iconLeft}\n >\n {iconLeft}\n </span>\n )\n )}\n <span className={styles.content} data-testid={dataTestId?.content}>\n {children}\n </span>\n {!loading && iconRight != null ? (\n <span\n className={styles.icon}\n aria-hidden='true'\n data-testid={dataTestId?.iconRight}\n >\n {iconRight}\n </span>\n ) : null}\n <CounterSlot dataTestId={dataTestId?.counter}>{counter}</CounterSlot>\n <CounterLabel>{counterLabel}</CounterLabel>\n </>\n)\n"],"names":["joinAriaLabel","ariaLabel","counterLabel","ButtonContent","_ref","loading","iconLeft","iconRight","counter","dataTestId","children","_jsxs","_Fragment","_jsx","IconLoaderCircle","className","styles","spinner","icon","content","CounterSlot","CounterLabel"],"mappings":";;;;;MAOaA,aAAa,GAAGA,CAC3BC,SAA6B,EAC7BC,YAAgC,KAC5BD,SAAS,IAAIC,YAAY,GAAG,CAAGD,EAAAA,SAAS,KAAKC,YAAY,CAAA,CAAE,GAAGD,UAAU;AAUvE,MAAME,aAAa,GAAGC,IAAA,IAAA;EAAA,IAAC;AAC5BC,IAAAA,OAAO,GAAG,KAAK;IACfC,QAAQ;IACRC,SAAS;IACTC,OAAO;IACPN,YAAY;IACZO,UAAU;AACVC,IAAAA,QAAAA;AACkB,GAAC,GAAAN,IAAA,CAAA;EAAA,oBACnBO,IAAA,CAAAC,QAAA,EAAA;AAAAF,IAAAA,QAAA,EACGL,CAAAA,OAAO,gBACNQ,GAAA,CAACC,gBAAgB,EAAA;MAACC,SAAS,EAAEC,MAAM,CAACC,OAAQ;MAAC,aAAY,EAAA,MAAA;AAAM,KAAE,CAAC,GAElEX,QAAQ,IAAI,IAAI,iBACdO,GAAA,CAAA,MAAA,EAAA;MACEE,SAAS,EAAEC,MAAM,CAACE,IAAK;AACvB,MAAA,aAAA,EAAY,MAAM;MAClB,aAAaT,EAAAA,UAAU,EAAEH,QAAS;AAAAI,MAAAA,QAAA,EAEjCJ,QAAAA;KACG,CAET,eACDO,GAAA,CAAA,MAAA,EAAA;MAAME,SAAS,EAAEC,MAAM,CAACG,OAAQ;MAAC,aAAaV,EAAAA,UAAU,EAAEU,OAAQ;AAAAT,MAAAA,QAAA,EAC/DA,QAAAA;KACG,CAAC,EACN,CAACL,OAAO,IAAIE,SAAS,IAAI,IAAI,gBAC5BM,GAAA,CAAA,MAAA,EAAA;MACEE,SAAS,EAAEC,MAAM,CAACE,IAAK;AACvB,MAAA,aAAA,EAAY,MAAM;MAClB,aAAaT,EAAAA,UAAU,EAAEF,SAAU;AAAAG,MAAAA,QAAA,EAElCH,SAAAA;AAAS,KACN,CAAC,GACL,IAAI,eACRM,GAAA,CAACO,WAAW,EAAA;MAACX,UAAU,EAAEA,UAAU,EAAED,OAAQ;AAAAE,MAAAA,QAAA,EAAEF,OAAAA;AAAO,KAAc,CAAC,eACrEK,GAAA,CAACQ,YAAY,EAAA;AAAAX,MAAAA,QAAA,EAAER,YAAAA;AAAY,KAAe,CAAC,CAAA;AAAA,GAC3C,CAAC,CAAA;AAAA;;;;"}
1
+ {"version":3,"file":"ButtonContent.mjs","sources":["../../../src/button/ButtonContent.tsx"],"sourcesContent":["import type { ReactNode } from 'react'\n\nimport { CounterLabel, CounterSlot } from '../counter/CounterSlot'\nimport { IconLoaderCircle } from '../icons'\nimport styles from './Button.module.css'\nimport type { ButtonOwnProps } from './types'\n\ntype ButtonContentProps = Pick<\n ButtonOwnProps,\n 'iconLeft' | 'iconRight' | 'counter' | 'counterLabel' | 'dataTestId'\n> & {\n loading?: boolean\n children?: ReactNode\n}\n\nexport const ButtonContent = ({\n loading = false,\n iconLeft,\n iconRight,\n counter,\n counterLabel,\n dataTestId,\n children,\n}: ButtonContentProps) => (\n <>\n {loading ? (\n <IconLoaderCircle className={styles.spinner} aria-hidden='true' />\n ) : (\n iconLeft != null && (\n <span\n className={styles.icon}\n aria-hidden='true'\n data-testid={dataTestId?.iconLeft}\n >\n {iconLeft}\n </span>\n )\n )}\n <span className={styles.content} data-testid={dataTestId?.content}>\n {children}\n </span>\n {!loading && iconRight != null ? (\n <span\n className={styles.icon}\n aria-hidden='true'\n data-testid={dataTestId?.iconRight}\n >\n {iconRight}\n </span>\n ) : null}\n <CounterSlot dataTestId={dataTestId?.counter}>{counter}</CounterSlot>\n <CounterLabel>{counterLabel}</CounterLabel>\n </>\n)\n"],"names":["ButtonContent","_ref","loading","iconLeft","iconRight","counter","counterLabel","dataTestId","children","_jsxs","_Fragment","_jsx","IconLoaderCircle","className","styles","spinner","icon","content","CounterSlot","CounterLabel"],"mappings":";;;;;AAeO,MAAMA,aAAa,GAAGC,IAAA,IAAA;EAAA,IAAC;AAC5BC,IAAAA,OAAO,GAAG,KAAK;IACfC,QAAQ;IACRC,SAAS;IACTC,OAAO;IACPC,YAAY;IACZC,UAAU;AACVC,IAAAA,QAAAA;AACkB,GAAC,GAAAP,IAAA,CAAA;EAAA,oBACnBQ,IAAA,CAAAC,QAAA,EAAA;AAAAF,IAAAA,QAAA,EACGN,CAAAA,OAAO,gBACNS,GAAA,CAACC,gBAAgB,EAAA;MAACC,SAAS,EAAEC,MAAM,CAACC,OAAQ;MAAC,aAAY,EAAA,MAAA;AAAM,KAAE,CAAC,GAElEZ,QAAQ,IAAI,IAAI,iBACdQ,GAAA,CAAA,MAAA,EAAA;MACEE,SAAS,EAAEC,MAAM,CAACE,IAAK;AACvB,MAAA,aAAA,EAAY,MAAM;MAClB,aAAaT,EAAAA,UAAU,EAAEJ,QAAS;AAAAK,MAAAA,QAAA,EAEjCL,QAAAA;KACG,CAET,eACDQ,GAAA,CAAA,MAAA,EAAA;MAAME,SAAS,EAAEC,MAAM,CAACG,OAAQ;MAAC,aAAaV,EAAAA,UAAU,EAAEU,OAAQ;AAAAT,MAAAA,QAAA,EAC/DA,QAAAA;KACG,CAAC,EACN,CAACN,OAAO,IAAIE,SAAS,IAAI,IAAI,gBAC5BO,GAAA,CAAA,MAAA,EAAA;MACEE,SAAS,EAAEC,MAAM,CAACE,IAAK;AACvB,MAAA,aAAA,EAAY,MAAM;MAClB,aAAaT,EAAAA,UAAU,EAAEH,SAAU;AAAAI,MAAAA,QAAA,EAElCJ,SAAAA;AAAS,KACN,CAAC,GACL,IAAI,eACRO,GAAA,CAACO,WAAW,EAAA;MAACX,UAAU,EAAEA,UAAU,EAAEF,OAAQ;AAAAG,MAAAA,QAAA,EAAEH,OAAAA;AAAO,KAAc,CAAC,eACrEM,GAAA,CAACQ,YAAY,EAAA;AAAAX,MAAAA,QAAA,EAAEF,YAAAA;AAAY,KAAe,CAAC,CAAA;AAAA,GAC3C,CAAC,CAAA;AAAA;;;;"}
@@ -1,41 +1,12 @@
1
1
  import { forwardRef } from 'react';
2
- import cn from 'classnames';
3
- import { Anchor } from '../link-provider/Anchor.mjs';
4
- import styles from './Button.module.css.mjs';
5
- import { joinAriaLabel, ButtonContent } from './ButtonContent.mjs';
2
+ import { Button } from './Button.mjs';
6
3
  import { jsx } from 'react/jsx-runtime';
7
4
 
8
- /** Button-styled `<a>` that routes through `LinkProvider`; `disabled` drops the `href`. */
9
- const LinkButton = /*#__PURE__*/forwardRef((_ref, ref) => {
10
- let {
11
- className,
12
- children,
13
- variant = 'primary',
14
- size = 'big',
15
- iconLeft,
16
- iconRight,
17
- counter,
18
- counterLabel,
19
- dataTestId,
20
- 'aria-label': ariaLabel,
21
- ...rest
22
- } = _ref;
23
- return /*#__PURE__*/jsx(Anchor, {
24
- ref: ref,
25
- className: cn(styles.button, styles[variant], styles[size], className),
26
- "data-testid": dataTestId?.root,
27
- "aria-label": joinAriaLabel(ariaLabel, counterLabel),
28
- ...rest,
29
- children: /*#__PURE__*/jsx(ButtonContent, {
30
- iconLeft: iconLeft,
31
- iconRight: iconRight,
32
- counter: counter,
33
- counterLabel: counterLabel,
34
- dataTestId: dataTestId,
35
- children: children
36
- })
37
- });
38
- });
5
+ /** @deprecated Use `Button` with `href`. */
6
+ const LinkButton = /*#__PURE__*/forwardRef((props, ref) => /*#__PURE__*/jsx(Button, {
7
+ ref: ref,
8
+ ...props
9
+ }));
39
10
  LinkButton.displayName = 'LinkButton';
40
11
 
41
12
  export { LinkButton };
@@ -1 +1 @@
1
- {"version":3,"file":"LinkButton.mjs","sources":["../../../src/button/LinkButton.tsx"],"sourcesContent":["import { forwardRef } from 'react'\n\nimport cn from 'classnames'\n\nimport { Anchor, type AnchorProps } from '../link-provider/Anchor'\nimport styles from './Button.module.css'\nimport { ButtonContent, joinAriaLabel } from './ButtonContent'\nimport type { ButtonOwnProps } from './types'\n\nexport type LinkButtonProps = Omit<AnchorProps, 'href'> &\n ButtonOwnProps & {\n href: string\n }\n\n/** Button-styled `<a>` that routes through `LinkProvider`; `disabled` drops the `href`. */\nexport const LinkButton = forwardRef<HTMLAnchorElement, LinkButtonProps>(\n (\n {\n className,\n children,\n variant = 'primary',\n size = 'big',\n iconLeft,\n iconRight,\n counter,\n counterLabel,\n dataTestId,\n 'aria-label': ariaLabel,\n ...rest\n },\n ref,\n ) => (\n <Anchor\n ref={ref}\n className={cn(styles.button, styles[variant], styles[size], className)}\n data-testid={dataTestId?.root}\n aria-label={joinAriaLabel(ariaLabel, counterLabel)}\n {...rest}\n >\n <ButtonContent\n iconLeft={iconLeft}\n iconRight={iconRight}\n counter={counter}\n counterLabel={counterLabel}\n dataTestId={dataTestId}\n >\n {children}\n </ButtonContent>\n </Anchor>\n ),\n)\n\nLinkButton.displayName = 'LinkButton'\n"],"names":["LinkButton","forwardRef","_ref","ref","className","children","variant","size","iconLeft","iconRight","counter","counterLabel","dataTestId","ariaLabel","rest","_jsx","Anchor","cn","styles","button","root","joinAriaLabel","ButtonContent","displayName"],"mappings":";;;;;;;AAcA;AACO,MAAMA,UAAU,gBAAGC,UAAU,CAClC,CAAAC,IAAA,EAcEC,GAAG,KAAA;EAAA,IAbH;IACEC,SAAS;IACTC,QAAQ;AACRC,IAAAA,OAAO,GAAG,SAAS;AACnBC,IAAAA,IAAI,GAAG,KAAK;IACZC,QAAQ;IACRC,SAAS;IACTC,OAAO;IACPC,YAAY;IACZC,UAAU;AACV,IAAA,YAAY,EAAEC,SAAS;IACvB,GAAGC,IAAAA;AACL,GAAC,GAAAZ,IAAA,CAAA;EAAA,oBAGDa,GAAA,CAACC,MAAM,EAAA;AACLb,IAAAA,GAAG,EAAEA,GAAI;AACTC,IAAAA,SAAS,EAAEa,EAAE,CAACC,MAAM,CAACC,MAAM,EAAED,MAAM,CAACZ,OAAO,CAAC,EAAEY,MAAM,CAACX,IAAI,CAAC,EAAEH,SAAS,CAAE;IACvE,aAAaQ,EAAAA,UAAU,EAAEQ,IAAK;AAC9B,IAAA,YAAA,EAAYC,aAAa,CAACR,SAAS,EAAEF,YAAY,CAAE;AAAA,IAAA,GAC/CG,IAAI;IAAAT,QAAA,eAERU,GAAA,CAACO,aAAa,EAAA;AACZd,MAAAA,QAAQ,EAAEA,QAAS;AACnBC,MAAAA,SAAS,EAAEA,SAAU;AACrBC,MAAAA,OAAO,EAAEA,OAAQ;AACjBC,MAAAA,YAAY,EAAEA,YAAa;AAC3BC,MAAAA,UAAU,EAAEA,UAAW;AAAAP,MAAAA,QAAA,EAEtBA,QAAAA;KACY,CAAA;AAAC,GACV,CAAC,CAAA;AAAA,CAEb,EAAC;AAEDL,UAAU,CAACuB,WAAW,GAAG,YAAY;;;;"}
1
+ {"version":3,"file":"LinkButton.mjs","sources":["../../../src/button/LinkButton.tsx"],"sourcesContent":["import { forwardRef } from 'react'\n\nimport type { AnchorProps } from '../link-provider/Anchor'\nimport { Button } from './Button'\nimport type { ButtonAsLinkProps } from './types'\n\n/** @deprecated Use `Button` with `href`. */\nexport type LinkButtonProps = ButtonAsLinkProps & Pick<AnchorProps, 'external'>\n\n/** @deprecated Use `Button` with `href`. */\nexport const LinkButton = forwardRef<HTMLAnchorElement, LinkButtonProps>(\n (props, ref) => <Button ref={ref} {...props} />,\n)\n\nLinkButton.displayName = 'LinkButton'\n"],"names":["LinkButton","forwardRef","props","ref","_jsx","Button","displayName"],"mappings":";;;;AASA;AACaA,MAAAA,UAAU,gBAAGC,UAAU,CAClC,CAACC,KAAK,EAAEC,GAAG,kBAAKC,GAAA,CAACC,MAAM,EAAA;AAACF,EAAAA,GAAG,EAAEA,GAAI;EAAA,GAAKD,KAAAA;AAAK,CAAG,CAChD,EAAC;AAEDF,UAAU,CAACM,WAAW,GAAG,YAAY;;;;"}
@@ -1,4 +1,4 @@
1
- const styles = {"counter":"Counter-module_counter__qutVl","neutral":"Counter-module_neutral__Z5iCI","default":"Counter-module_default__W0-pw","error":"Counter-module_error__srNOJ","warning":"Counter-module_warning__5OY4o","action":"Counter-module_action__ywkeX","active":"Counter-module_active__AZ4oD"};
1
+ const styles = {"counter":"Counter-module_counter__qutVl","neutral":"Counter-module_neutral__Z5iCI","error":"Counter-module_error__srNOJ","warning":"Counter-module_warning__5OY4o","action":"Counter-module_action__ywkeX","active":"Counter-module_active__AZ4oD"};
2
2
 
3
3
  export { styles as default };
4
4
  //# sourceMappingURL=Counter.module.css.mjs.map
@@ -7,7 +7,6 @@ import { TextLink } from '../text-link/TextLink.mjs';
7
7
  const defaultContent = /*#__PURE__*/jsxs(Fragment, {
8
8
  children: ["Your privacy matters. We use cookieless analytics and collect only anonymized data for improvements. Cookies are used for functionality only. For more info read", ' ', /*#__PURE__*/jsx(TextLink, {
9
9
  href: "https://lido.fi/privacy-notice",
10
- external: true,
11
10
  size: "inherit",
12
11
  children: "Privacy Notice"
13
12
  }), "."]
@@ -1 +1 @@
1
- {"version":3,"file":"Disclaimer.mjs","sources":["../../../src/disclaimer/Disclaimer.tsx"],"sourcesContent":["import { forwardRef, type ComponentPropsWithoutRef, type Ref } from 'react'\n\nimport cn from 'classnames'\n\nimport { TextLink } from '../text-link'\nimport styles from './Disclaimer.module.css'\n\nexport type DisclaimerDataTestId = {\n root?: string\n}\n\nexport type DisclaimerProps = ComponentPropsWithoutRef<'p'> & {\n /** Root element; use `div` when `children` contain block content. */\n as?: 'p' | 'div'\n dataTestId?: DisclaimerDataTestId\n}\n\nconst defaultContent = (\n <>\n Your privacy matters. We use cookieless analytics and collect only\n anonymized data for improvements. Cookies are used for functionality only.\n For more info read{' '}\n <TextLink href='https://lido.fi/privacy-notice' external size='inherit'>\n Privacy Notice\n </TextLink>\n .\n </>\n)\n\n/** Page-level note that defaults to the privacy text and pins to the bottom (`margin-top: auto`) as the last child of a flex column. */\nexport const Disclaimer = forwardRef<HTMLElement, DisclaimerProps>(\n (\n {\n as: Component = 'p',\n className,\n children = defaultContent,\n dataTestId,\n ...rest\n },\n ref,\n ) => (\n <Component\n ref={ref as Ref<HTMLDivElement & HTMLParagraphElement>}\n className={cn(styles.root, className)}\n data-testid={dataTestId?.root}\n {...rest}\n >\n {children}\n </Component>\n ),\n)\n\nDisclaimer.displayName = 'Disclaimer'\n"],"names":["defaultContent","_jsxs","_Fragment","children","_jsx","TextLink","href","external","size","Disclaimer","forwardRef","_ref","ref","as","Component","className","dataTestId","rest","cn","styles","root","displayName"],"mappings":";;;;;;AAiBA,MAAMA,cAAc,gBAClBC,IAAA,CAAAC,QAAA,EAAA;AAAAC,EAAAA,QAAA,GAAE,kKAGkB,EAAC,GAAG,eACtBC,GAAA,CAACC,QAAQ,EAAA;AAACC,IAAAA,IAAI,EAAC,gCAAgC;IAACC,QAAQ,EAAA,IAAA;AAACC,IAAAA,IAAI,EAAC,SAAS;AAAAL,IAAAA,QAAA,EAAC,gBAAA;AAExE,GAAU,CAAC,EAEb,GAAA,CAAA;AAAA,CAAE,CACH,CAAA;;AAED;AACO,MAAMM,UAAU,gBAAGC,UAAU,CAClC,CAAAC,IAAA,EAQEC,GAAG,KAAA;EAAA,IAPH;IACEC,EAAE,EAAEC,SAAS,GAAG,GAAG;IACnBC,SAAS;AACTZ,IAAAA,QAAQ,GAAGH,cAAc;IACzBgB,UAAU;IACV,GAAGC,IAAAA;AACL,GAAC,GAAAN,IAAA,CAAA;EAAA,oBAGDP,GAAA,CAACU,SAAS,EAAA;AACRF,IAAAA,GAAG,EAAEA,GAAkD;IACvDG,SAAS,EAAEG,EAAE,CAACC,MAAM,CAACC,IAAI,EAAEL,SAAS,CAAE;IACtC,aAAaC,EAAAA,UAAU,EAAEI,IAAK;AAAA,IAAA,GAC1BH,IAAI;AAAAd,IAAAA,QAAA,EAEPA,QAAAA;AAAQ,GACA,CAAC,CAAA;AAAA,CAEhB,EAAC;AAEDM,UAAU,CAACY,WAAW,GAAG,YAAY;;;;"}
1
+ {"version":3,"file":"Disclaimer.mjs","sources":["../../../src/disclaimer/Disclaimer.tsx"],"sourcesContent":["import { forwardRef, type ComponentPropsWithoutRef, type Ref } from 'react'\n\nimport cn from 'classnames'\n\nimport { TextLink } from '../text-link'\nimport styles from './Disclaimer.module.css'\n\nexport type DisclaimerDataTestId = {\n root?: string\n}\n\nexport type DisclaimerProps = ComponentPropsWithoutRef<'p'> & {\n /** Root element; use `div` when `children` contain block content. */\n as?: 'p' | 'div'\n dataTestId?: DisclaimerDataTestId\n}\n\nconst defaultContent = (\n <>\n Your privacy matters. We use cookieless analytics and collect only\n anonymized data for improvements. Cookies are used for functionality only.\n For more info read{' '}\n <TextLink href='https://lido.fi/privacy-notice' size='inherit'>\n Privacy Notice\n </TextLink>\n .\n </>\n)\n\n/** Page-level note that defaults to the privacy text and pins to the bottom (`margin-top: auto`) as the last child of a flex column. */\nexport const Disclaimer = forwardRef<HTMLElement, DisclaimerProps>(\n (\n {\n as: Component = 'p',\n className,\n children = defaultContent,\n dataTestId,\n ...rest\n },\n ref,\n ) => (\n <Component\n ref={ref as Ref<HTMLDivElement & HTMLParagraphElement>}\n className={cn(styles.root, className)}\n data-testid={dataTestId?.root}\n {...rest}\n >\n {children}\n </Component>\n ),\n)\n\nDisclaimer.displayName = 'Disclaimer'\n"],"names":["defaultContent","_jsxs","_Fragment","children","_jsx","TextLink","href","size","Disclaimer","forwardRef","_ref","ref","as","Component","className","dataTestId","rest","cn","styles","root","displayName"],"mappings":";;;;;;AAiBA,MAAMA,cAAc,gBAClBC,IAAA,CAAAC,QAAA,EAAA;AAAAC,EAAAA,QAAA,GAAE,kKAGkB,EAAC,GAAG,eACtBC,GAAA,CAACC,QAAQ,EAAA;AAACC,IAAAA,IAAI,EAAC,gCAAgC;AAACC,IAAAA,IAAI,EAAC,SAAS;AAAAJ,IAAAA,QAAA,EAAC,gBAAA;AAE/D,GAAU,CAAC,EAEb,GAAA,CAAA;AAAA,CAAE,CACH,CAAA;;AAED;AACO,MAAMK,UAAU,gBAAGC,UAAU,CAClC,CAAAC,IAAA,EAQEC,GAAG,KAAA;EAAA,IAPH;IACEC,EAAE,EAAEC,SAAS,GAAG,GAAG;IACnBC,SAAS;AACTX,IAAAA,QAAQ,GAAGH,cAAc;IACzBe,UAAU;IACV,GAAGC,IAAAA;AACL,GAAC,GAAAN,IAAA,CAAA;EAAA,oBAGDN,GAAA,CAACS,SAAS,EAAA;AACRF,IAAAA,GAAG,EAAEA,GAAkD;IACvDG,SAAS,EAAEG,EAAE,CAACC,MAAM,CAACC,IAAI,EAAEL,SAAS,CAAE;IACtC,aAAaC,EAAAA,UAAU,EAAEI,IAAK;AAAA,IAAA,GAC1BH,IAAI;AAAAb,IAAAA,QAAA,EAEPA,QAAAA;AAAQ,GACA,CAAC,CAAA;AAAA,CAEhB,EAAC;AAEDK,UAAU,CAACY,WAAW,GAAG,YAAY;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"CloseButton.mjs","sources":["../../../src/icon-button/CloseButton.tsx"],"sourcesContent":["import { forwardRef } from 'react'\n\nimport { IconCross } from '../icons'\nimport { IconButton, type IconButtonProps } from './IconButton'\n\nexport type CloseButtonProps = Omit<\n IconButtonProps,\n 'icon' | 'variant' | 'aria-label'\n> & { 'aria-label'?: string }\n\n/** Ghost `IconButton` with a cross icon; `aria-label` defaults to \"Close\". */\nexport const CloseButton = forwardRef<HTMLButtonElement, CloseButtonProps>(\n ({ 'aria-label': ariaLabel = 'Close', ...rest }, ref) => (\n <IconButton\n ref={ref}\n variant='ghost'\n icon={<IconCross />}\n aria-label={ariaLabel}\n {...rest}\n />\n ),\n)\n\nCloseButton.displayName = 'CloseButton'\n"],"names":["CloseButton","forwardRef","_ref","ref","ariaLabel","rest","_jsx","IconButton","variant","icon","IconCross","displayName"],"mappings":";;;;;AAUA;AACO,MAAMA,WAAW,gBAAGC,UAAU,CACnC,CAAAC,IAAA,EAAiDC,GAAG,KAAA;EAAA,IAAnD;IAAE,YAAY,EAAEC,SAAS,GAAG,OAAO;IAAE,GAAGC,IAAAA;AAAK,GAAC,GAAAH,IAAA,CAAA;EAAA,oBAC7CI,GAAA,CAACC,UAAU,EAAA;AACTJ,IAAAA,GAAG,EAAEA,GAAI;AACTK,IAAAA,OAAO,EAAC,OAAO;AACfC,IAAAA,IAAI,eAAEH,GAAA,CAACI,SAAS,IAAE,CAAE;AACpB,IAAA,YAAA,EAAYN,SAAU;IAAA,GAClBC,IAAAA;AAAI,GACT,CAAC,CAAA;AAAA,CAEN,EAAC;AAEDL,WAAW,CAACW,WAAW,GAAG,aAAa;;;;"}
1
+ {"version":3,"file":"CloseButton.mjs","sources":["../../../src/icon-button/CloseButton.tsx"],"sourcesContent":["import { forwardRef } from 'react'\n\nimport { IconCross } from '../icons'\nimport { IconButton } from './IconButton'\nimport type { IconButtonAsButtonProps } from './types'\n\nexport type CloseButtonProps = Omit<\n IconButtonAsButtonProps,\n 'icon' | 'variant' | 'aria-label'\n> & { 'aria-label'?: string }\n\n/** Ghost `IconButton` with a cross icon; `aria-label` defaults to \"Close\". */\nexport const CloseButton = forwardRef<HTMLButtonElement, CloseButtonProps>(\n ({ 'aria-label': ariaLabel = 'Close', ...rest }, ref) => (\n <IconButton\n ref={ref}\n variant='ghost'\n icon={<IconCross />}\n aria-label={ariaLabel}\n {...rest}\n />\n ),\n)\n\nCloseButton.displayName = 'CloseButton'\n"],"names":["CloseButton","forwardRef","_ref","ref","ariaLabel","rest","_jsx","IconButton","variant","icon","IconCross","displayName"],"mappings":";;;;;AAWA;AACO,MAAMA,WAAW,gBAAGC,UAAU,CACnC,CAAAC,IAAA,EAAiDC,GAAG,KAAA;EAAA,IAAnD;IAAE,YAAY,EAAEC,SAAS,GAAG,OAAO;IAAE,GAAGC,IAAAA;AAAK,GAAC,GAAAH,IAAA,CAAA;EAAA,oBAC7CI,GAAA,CAACC,UAAU,EAAA;AACTJ,IAAAA,GAAG,EAAEA,GAAI;AACTK,IAAAA,OAAO,EAAC,OAAO;AACfC,IAAAA,IAAI,eAAEH,GAAA,CAACI,SAAS,IAAE,CAAE;AACpB,IAAA,YAAA,EAAYN,SAAU;IAAA,GAClBC,IAAAA;AAAI,GACT,CAAC,CAAA;AAAA,CAEN,EAAC;AAEDL,WAAW,CAACW,WAAW,GAAG,aAAa;;;;"}
@@ -4,13 +4,14 @@ import { CounterSlot } from '../counter/CounterSlot.mjs';
4
4
  import surfaceStyles from '../utils/surface.module.css.mjs';
5
5
  import styles from './IconButton.module.css.mjs';
6
6
  import { jsxs, jsx } from 'react/jsx-runtime';
7
+ import { ActionElement } from '../utils/ActionElement.mjs';
8
+ import { joinAriaLabel } from '../utils/joinAriaLabel.mjs';
7
9
  import { IconLoaderCircle } from '../icons/components/base/IconLoaderCircle.mjs';
8
10
 
9
- /** 36px fully rounded icon-only button; `loading` swaps the icon for a spinner and disables it. */
11
+ /** 36px fully rounded icon-only button; `loading` swaps the icon for a spinner and disables it. With `href` it renders a link that routes through `LinkProvider`. */
10
12
  const IconButton = /*#__PURE__*/forwardRef((_ref, ref) => {
11
13
  let {
12
14
  className,
13
- type = 'button',
14
15
  variant = 'outline',
15
16
  loading = false,
16
17
  disabled = false,
@@ -21,14 +22,13 @@ const IconButton = /*#__PURE__*/forwardRef((_ref, ref) => {
21
22
  dataTestId,
22
23
  ...rest
23
24
  } = _ref;
24
- return /*#__PURE__*/jsxs("button", {
25
+ return /*#__PURE__*/jsxs(ActionElement, {
25
26
  ref: ref,
26
- type: type,
27
- disabled: disabled || loading,
28
- "aria-busy": loading || undefined,
29
27
  className: cn(styles.button, styles[variant], variant === 'surface' && surfaceStyles.surface, loading && !disabled && styles.loading, className),
30
28
  "data-testid": dataTestId?.root,
31
- "aria-label": counterLabel ? `${ariaLabel}, ${counterLabel}` : ariaLabel,
29
+ "aria-label": joinAriaLabel(ariaLabel, counterLabel),
30
+ "aria-busy": loading || undefined,
31
+ disabled: disabled || loading,
32
32
  ...rest,
33
33
  children: [loading ? /*#__PURE__*/jsx(IconLoaderCircle, {
34
34
  className: styles.spinner,
@@ -1 +1 @@
1
- {"version":3,"file":"IconButton.mjs","sources":["../../../src/icon-button/IconButton.tsx"],"sourcesContent":["import { forwardRef, type ButtonHTMLAttributes, type ReactNode } from 'react'\n\nimport cn from 'classnames'\n\nimport { CounterSlot } from '../counter/CounterSlot'\nimport { IconLoaderCircle } from '../icons'\nimport surfaceStyles from '../utils/surface.module.css'\nimport styles from './IconButton.module.css'\n\nexport type IconButtonVariant = 'outline' | 'ghost' | 'surface'\n\nexport type IconButtonDataTestId = {\n root?: string\n icon?: string\n counter?: string\n}\n\nexport type IconButtonProps = Omit<\n ButtonHTMLAttributes<HTMLButtonElement>,\n 'aria-label'\n> & {\n 'aria-label': string\n icon: ReactNode\n variant?: IconButtonVariant\n loading?: boolean\n /**\n * Corner slot, aria-hidden. A number or string renders a default `Counter`\n * (`0` shows a \"0\" pill; use `counter={count || null}` to hide it), or pass a\n * `<Counter variant=...>` element. Announce the count with `counterLabel`.\n */\n counter?: ReactNode\n /** Spoken with the name, e.g. \"3 unread\". */\n counterLabel?: string\n dataTestId?: IconButtonDataTestId\n}\n\n/** 36px fully rounded icon-only button; `loading` swaps the icon for a spinner and disables it. */\nexport const IconButton = forwardRef<HTMLButtonElement, IconButtonProps>(\n (\n {\n className,\n type = 'button',\n variant = 'outline',\n loading = false,\n disabled = false,\n icon,\n counter,\n counterLabel,\n 'aria-label': ariaLabel,\n dataTestId,\n ...rest\n },\n ref,\n ) => (\n <button\n ref={ref}\n type={type}\n disabled={disabled || loading}\n aria-busy={loading || undefined}\n className={cn(\n styles.button,\n styles[variant],\n variant === 'surface' && surfaceStyles.surface,\n loading && !disabled && styles.loading,\n className,\n )}\n data-testid={dataTestId?.root}\n aria-label={counterLabel ? `${ariaLabel}, ${counterLabel}` : ariaLabel}\n {...rest}\n >\n {loading ? (\n <IconLoaderCircle className={styles.spinner} aria-hidden='true' />\n ) : (\n <span\n className={styles.icon}\n aria-hidden='true'\n data-testid={dataTestId?.icon}\n >\n {icon}\n </span>\n )}\n <CounterSlot dataTestId={dataTestId?.counter}>{counter}</CounterSlot>\n </button>\n ),\n)\n\nIconButton.displayName = 'IconButton'\n"],"names":["IconButton","forwardRef","_ref","ref","className","type","variant","loading","disabled","icon","counter","counterLabel","ariaLabel","dataTestId","rest","_jsxs","undefined","cn","styles","button","surfaceStyles","surface","root","children","_jsx","IconLoaderCircle","spinner","CounterSlot","displayName"],"mappings":";;;;;;;;AAoCA;AACO,MAAMA,UAAU,gBAAGC,UAAU,CAClC,CAAAC,IAAA,EAcEC,GAAG,KAAA;EAAA,IAbH;IACEC,SAAS;AACTC,IAAAA,IAAI,GAAG,QAAQ;AACfC,IAAAA,OAAO,GAAG,SAAS;AACnBC,IAAAA,OAAO,GAAG,KAAK;AACfC,IAAAA,QAAQ,GAAG,KAAK;IAChBC,IAAI;IACJC,OAAO;IACPC,YAAY;AACZ,IAAA,YAAY,EAAEC,SAAS;IACvBC,UAAU;IACV,GAAGC,IAAAA;AACL,GAAC,GAAAZ,IAAA,CAAA;AAAA,EAAA,oBAGDa,IAAA,CAAA,QAAA,EAAA;AACEZ,IAAAA,GAAG,EAAEA,GAAI;AACTE,IAAAA,IAAI,EAAEA,IAAK;IACXG,QAAQ,EAAEA,QAAQ,IAAID,OAAQ;IAC9B,WAAWA,EAAAA,OAAO,IAAIS,SAAU;AAChCZ,IAAAA,SAAS,EAAEa,EAAE,CACXC,MAAM,CAACC,MAAM,EACbD,MAAM,CAACZ,OAAO,CAAC,EACfA,OAAO,KAAK,SAAS,IAAIc,aAAa,CAACC,OAAO,EAC9Cd,OAAO,IAAI,CAACC,QAAQ,IAAIU,MAAM,CAACX,OAAO,EACtCH,SACF,CAAE;IACF,aAAaS,EAAAA,UAAU,EAAES,IAAK;IAC9B,YAAYX,EAAAA,YAAY,GAAG,CAAGC,EAAAA,SAAS,KAAKD,YAAY,CAAA,CAAE,GAAGC,SAAU;AAAA,IAAA,GACnEE,IAAI;AAAAS,IAAAA,QAAA,EAEPhB,CAAAA,OAAO,gBACNiB,GAAA,CAACC,gBAAgB,EAAA;MAACrB,SAAS,EAAEc,MAAM,CAACQ,OAAQ;MAAC,aAAY,EAAA,MAAA;KAAQ,CAAC,gBAElEF,GAAA,CAAA,MAAA,EAAA;MACEpB,SAAS,EAAEc,MAAM,CAACT,IAAK;AACvB,MAAA,aAAA,EAAY,MAAM;MAClB,aAAaI,EAAAA,UAAU,EAAEJ,IAAK;AAAAc,MAAAA,QAAA,EAE7Bd,IAAAA;AAAI,KACD,CACP,eACDe,GAAA,CAACG,WAAW,EAAA;MAACd,UAAU,EAAEA,UAAU,EAAEH,OAAQ;AAAAa,MAAAA,QAAA,EAAEb,OAAAA;AAAO,KAAc,CAAC,CAAA;AAAA,GAC/D,CAAC,CAAA;AAAA,CAEb,EAAC;AAEDV,UAAU,CAAC4B,WAAW,GAAG,YAAY;;;;"}
1
+ {"version":3,"file":"IconButton.mjs","sources":["../../../src/icon-button/IconButton.tsx"],"sourcesContent":["import { forwardRef } from 'react'\n\nimport cn from 'classnames'\n\nimport { CounterSlot } from '../counter/CounterSlot'\nimport { IconLoaderCircle } from '../icons'\nimport { ActionElement, joinAriaLabel } from '../utils'\nimport surfaceStyles from '../utils/surface.module.css'\nimport styles from './IconButton.module.css'\nimport type {\n IconButtonAsButtonProps,\n IconButtonAsLinkProps,\n IconButtonDataTestId,\n IconButtonProps,\n IconButtonVariant,\n} from './types'\n\nexport type {\n IconButtonAsButtonProps,\n IconButtonAsLinkProps,\n IconButtonDataTestId,\n IconButtonProps,\n IconButtonVariant,\n}\n\n/** 36px fully rounded icon-only button; `loading` swaps the icon for a spinner and disables it. With `href` it renders a link that routes through `LinkProvider`. */\nexport const IconButton = forwardRef<\n HTMLButtonElement | HTMLAnchorElement,\n IconButtonProps\n>(\n (\n {\n className,\n variant = 'outline',\n loading = false,\n disabled = false,\n icon,\n counter,\n counterLabel,\n 'aria-label': ariaLabel,\n dataTestId,\n ...rest\n },\n ref,\n ) => (\n <ActionElement\n ref={ref}\n className={cn(\n styles.button,\n styles[variant],\n variant === 'surface' && surfaceStyles.surface,\n loading && !disabled && styles.loading,\n className,\n )}\n data-testid={dataTestId?.root}\n aria-label={joinAriaLabel(ariaLabel, counterLabel)}\n aria-busy={loading || undefined}\n disabled={disabled || loading}\n {...rest}\n >\n {loading ? (\n <IconLoaderCircle className={styles.spinner} aria-hidden='true' />\n ) : (\n <span\n className={styles.icon}\n aria-hidden='true'\n data-testid={dataTestId?.icon}\n >\n {icon}\n </span>\n )}\n <CounterSlot dataTestId={dataTestId?.counter}>{counter}</CounterSlot>\n </ActionElement>\n ),\n)\n\nIconButton.displayName = 'IconButton'\n"],"names":["IconButton","forwardRef","_ref","ref","className","variant","loading","disabled","icon","counter","counterLabel","ariaLabel","dataTestId","rest","_jsxs","ActionElement","cn","styles","button","surfaceStyles","surface","root","joinAriaLabel","undefined","children","_jsx","IconLoaderCircle","spinner","CounterSlot","displayName"],"mappings":";;;;;;;;;;AAyBA;AACO,MAAMA,UAAU,gBAAGC,UAAU,CAIlC,CAAAC,IAAA,EAaEC,GAAG,KAAA;EAAA,IAZH;IACEC,SAAS;AACTC,IAAAA,OAAO,GAAG,SAAS;AACnBC,IAAAA,OAAO,GAAG,KAAK;AACfC,IAAAA,QAAQ,GAAG,KAAK;IAChBC,IAAI;IACJC,OAAO;IACPC,YAAY;AACZ,IAAA,YAAY,EAAEC,SAAS;IACvBC,UAAU;IACV,GAAGC,IAAAA;AACL,GAAC,GAAAX,IAAA,CAAA;EAAA,oBAGDY,IAAA,CAACC,aAAa,EAAA;AACZZ,IAAAA,GAAG,EAAEA,GA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