@dynatrace/strato-components 1.5.1 → 1.6.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 (316) hide show
  1. package/buttons/button/Button.css +16 -16
  2. package/buttons/button/Button.d.ts +4 -4
  3. package/buttons/button/Button.js +47 -34
  4. package/buttons/button/Button.sty.js +4 -4
  5. package/buttons/button/Label.d.ts +2 -2
  6. package/buttons/button/Label.js +6 -5
  7. package/buttons/button/Prefix.d.ts +2 -2
  8. package/buttons/button/Prefix.js +6 -15
  9. package/buttons/button/Suffix.d.ts +3 -3
  10. package/buttons/button/Suffix.js +6 -15
  11. package/buttons/intent-button/IntentButton.d.ts +2 -2
  12. package/buttons/intent-button/IntentButton.js +16 -21
  13. package/buttons/intent-button/useIntentButton.d.ts +4 -3
  14. package/content/progress/ProgressBar.css +71 -71
  15. package/content/progress/ProgressBar.d.ts +4 -5
  16. package/content/progress/ProgressBar.js +49 -41
  17. package/content/progress/ProgressBar.sty.js +5 -5
  18. package/content/progress/ProgressBarIcon.css +2 -2
  19. package/content/progress/ProgressBarIcon.d.ts +1 -2
  20. package/content/progress/ProgressBarIcon.js +6 -5
  21. package/content/progress/ProgressBarIcon.sty.js +1 -1
  22. package/content/progress/ProgressBarLabel.css +3 -3
  23. package/content/progress/ProgressBarLabel.d.ts +1 -2
  24. package/content/progress/ProgressBarLabel.js +6 -5
  25. package/content/progress/ProgressBarLabel.sty.js +1 -1
  26. package/content/progress/ProgressBarValue.css +5 -5
  27. package/content/progress/ProgressBarValue.d.ts +1 -2
  28. package/content/progress/ProgressBarValue.js +6 -5
  29. package/content/progress/ProgressBarValue.sty.js +1 -1
  30. package/content/progress/ProgressCircle.css +40 -40
  31. package/content/progress/ProgressCircle.d.ts +1 -2
  32. package/content/progress/ProgressCircle.js +60 -55
  33. package/content/progress/ProgressCircle.sty.js +5 -5
  34. package/content/progress/contexts/SharedProgressBarPropsContext.d.ts +1 -2
  35. package/content/progress/contexts/SharedProgressBarPropsContext.js +2 -12
  36. package/content/skeleton/Skeleton.css +6 -6
  37. package/content/skeleton/Skeleton.d.ts +2 -2
  38. package/content/skeleton/Skeleton.js +6 -5
  39. package/content/skeleton/Skeleton.sty.js +1 -1
  40. package/content/skeleton/SkeletonText.d.ts +2 -2
  41. package/content/skeleton/SkeletonText.js +9 -18
  42. package/core/components/app-root/AppRoot.d.ts +3 -3
  43. package/core/components/app-root/AppRoot.js +15 -24
  44. package/core/components/focus-scope/FocusScope.d.ts +1 -2
  45. package/core/components/focus-scope/FocusScope.js +6 -15
  46. package/core/hooks/useFontsUpdated.js +1 -1
  47. package/core/hooks/useMergeRefs.d.ts +2 -2
  48. package/core/providers/FocusProvider.d.ts +1 -2
  49. package/core/providers/FocusProvider.js +6 -15
  50. package/core/styles/focusRing.css +66 -66
  51. package/core/styles/focusRing.sty.js +2 -2
  52. package/core/styles/useFocusRing.d.ts +3 -3
  53. package/core/types/polymorph.d.ts +1 -1
  54. package/core/types/styling-props.d.ts +1 -1
  55. package/core/types/with-children.d.ts +1 -1
  56. package/core/utils/_is-string-children.d.ts +2 -2
  57. package/core/utils/_is-string-children.js +2 -12
  58. package/core/utils/colorUtils.css +60 -60
  59. package/core/utils/colorUtils.sty.js +2 -2
  60. package/esm/buttons/button/Button.css +16 -16
  61. package/esm/buttons/button/Button.js +49 -35
  62. package/esm/buttons/button/Button.js.map +2 -2
  63. package/esm/buttons/button/Button.sty.js +4 -4
  64. package/esm/buttons/button/Button.sty.js.map +1 -1
  65. package/esm/buttons/button/Label.js +6 -5
  66. package/esm/buttons/button/Label.js.map +2 -2
  67. package/esm/buttons/button/Prefix.js +6 -5
  68. package/esm/buttons/button/Prefix.js.map +2 -2
  69. package/esm/buttons/button/Suffix.js +6 -5
  70. package/esm/buttons/button/Suffix.js.map +2 -2
  71. package/esm/buttons/intent-button/IntentButton.js +16 -11
  72. package/esm/buttons/intent-button/IntentButton.js.map +2 -2
  73. package/esm/buttons/intent-button/useIntentButton.js +4 -1
  74. package/esm/buttons/intent-button/useIntentButton.js.map +2 -2
  75. package/esm/content/progress/ProgressBar.css +71 -71
  76. package/esm/content/progress/ProgressBar.js +53 -41
  77. package/esm/content/progress/ProgressBar.js.map +2 -2
  78. package/esm/content/progress/ProgressBar.sty.js +5 -5
  79. package/esm/content/progress/ProgressBar.sty.js.map +1 -1
  80. package/esm/content/progress/ProgressBarIcon.css +2 -2
  81. package/esm/content/progress/ProgressBarIcon.js +6 -5
  82. package/esm/content/progress/ProgressBarIcon.js.map +2 -2
  83. package/esm/content/progress/ProgressBarIcon.sty.js +1 -1
  84. package/esm/content/progress/ProgressBarIcon.sty.js.map +1 -1
  85. package/esm/content/progress/ProgressBarLabel.css +3 -3
  86. package/esm/content/progress/ProgressBarLabel.js +6 -5
  87. package/esm/content/progress/ProgressBarLabel.js.map +2 -2
  88. package/esm/content/progress/ProgressBarLabel.sty.js +1 -1
  89. package/esm/content/progress/ProgressBarLabel.sty.js.map +1 -1
  90. package/esm/content/progress/ProgressBarValue.css +5 -5
  91. package/esm/content/progress/ProgressBarValue.js +6 -5
  92. package/esm/content/progress/ProgressBarValue.js.map +2 -2
  93. package/esm/content/progress/ProgressBarValue.sty.js +1 -1
  94. package/esm/content/progress/ProgressBarValue.sty.js.map +1 -1
  95. package/esm/content/progress/ProgressCircle.css +40 -40
  96. package/esm/content/progress/ProgressCircle.js +60 -55
  97. package/esm/content/progress/ProgressCircle.js.map +2 -2
  98. package/esm/content/progress/ProgressCircle.sty.js +5 -5
  99. package/esm/content/progress/ProgressCircle.sty.js.map +1 -1
  100. package/esm/content/progress/contexts/SharedProgressBarPropsContext.js +2 -2
  101. package/esm/content/progress/contexts/SharedProgressBarPropsContext.js.map +2 -2
  102. package/esm/content/skeleton/Skeleton.css +6 -6
  103. package/esm/content/skeleton/Skeleton.js +6 -5
  104. package/esm/content/skeleton/Skeleton.js.map +2 -2
  105. package/esm/content/skeleton/Skeleton.sty.js +1 -1
  106. package/esm/content/skeleton/Skeleton.sty.js.map +1 -1
  107. package/esm/content/skeleton/SkeletonText.js +9 -8
  108. package/esm/content/skeleton/SkeletonText.js.map +2 -2
  109. package/esm/core/components/app-root/AppRoot.js +15 -14
  110. package/esm/core/components/app-root/AppRoot.js.map +2 -2
  111. package/esm/core/components/focus-scope/FocusScope.js +6 -5
  112. package/esm/core/components/focus-scope/FocusScope.js.map +2 -2
  113. package/esm/core/hooks/useFontsUpdated.js +1 -1
  114. package/esm/core/hooks/useFontsUpdated.js.map +2 -2
  115. package/esm/core/hooks/useMergeRefs.js +3 -1
  116. package/esm/core/hooks/useMergeRefs.js.map +2 -2
  117. package/esm/core/providers/FocusProvider.js +6 -5
  118. package/esm/core/providers/FocusProvider.js.map +2 -2
  119. package/esm/core/styles/focusRing.css +66 -66
  120. package/esm/core/styles/focusRing.sty.js +2 -2
  121. package/esm/core/styles/focusRing.sty.js.map +1 -1
  122. package/esm/core/styles/useFocusRing.js.map +1 -1
  123. package/esm/core/utils/_is-string-children.js +2 -2
  124. package/esm/core/utils/_is-string-children.js.map +2 -2
  125. package/esm/core/utils/colorUtils.css +60 -60
  126. package/esm/core/utils/colorUtils.sty.js +2 -2
  127. package/esm/core/utils/colorUtils.sty.js.map +1 -1
  128. package/esm/layouts/container/Container.css +4 -4
  129. package/esm/layouts/container/Container.js +7 -6
  130. package/esm/layouts/container/Container.js.map +2 -2
  131. package/esm/layouts/container/Container.sty.js +1 -1
  132. package/esm/layouts/container/Container.sty.js.map +1 -1
  133. package/esm/layouts/divider/Divider.css +6 -6
  134. package/esm/layouts/divider/Divider.js +3 -2
  135. package/esm/layouts/divider/Divider.js.map +2 -2
  136. package/esm/layouts/divider/Divider.sty.js +1 -1
  137. package/esm/layouts/divider/Divider.sty.js.map +1 -1
  138. package/esm/layouts/flex/Flex.js +6 -5
  139. package/esm/layouts/flex/Flex.js.map +2 -2
  140. package/esm/layouts/grid/Grid.js +6 -5
  141. package/esm/layouts/grid/Grid.js.map +2 -2
  142. package/esm/layouts/surface/Surface.css +39 -39
  143. package/esm/layouts/surface/Surface.js +17 -14
  144. package/esm/layouts/surface/Surface.js.map +2 -2
  145. package/esm/layouts/surface/Surface.sty.js +2 -2
  146. package/esm/layouts/surface/Surface.sty.js.map +1 -1
  147. package/esm/layouts/surface/variables.sty.js +1 -1
  148. package/esm/layouts/surface/variables.sty.js.map +1 -1
  149. package/esm/styles/colorUtils.css +60 -60
  150. package/esm/styles/colorUtils.sty.js +2 -2
  151. package/esm/styles/colorUtils.sty.js.map +1 -1
  152. package/esm/styles/container.css +47 -47
  153. package/esm/styles/container.sty.js +2 -2
  154. package/esm/styles/container.sty.js.map +1 -1
  155. package/esm/styles/ellipsis.css +1 -1
  156. package/esm/styles/ellipsis.sty.js +1 -1
  157. package/esm/styles/ellipsis.sty.js.map +1 -1
  158. package/esm/styles/field.css +153 -153
  159. package/esm/styles/field.sty.js +2 -2
  160. package/esm/styles/field.sty.js.map +1 -1
  161. package/esm/styles/getFlexStyles.js.map +1 -1
  162. package/esm/styles/getGridStyles.js.map +1 -1
  163. package/esm/styles/getLayoutSizeStyles.js.map +1 -1
  164. package/esm/styles/sprinkles.css +262 -262
  165. package/esm/styles/sprinkles.sty.js +1 -1
  166. package/esm/styles/sprinkles.sty.js.map +1 -1
  167. package/esm/styles/textStyle.css +8 -8
  168. package/esm/styles/textStyle.sty.js +1 -1
  169. package/esm/styles/textStyle.sty.js.map +1 -1
  170. package/esm/typography/block-quote/Blockquote.css +2 -2
  171. package/esm/typography/block-quote/Blockquote.js +6 -5
  172. package/esm/typography/block-quote/Blockquote.js.map +2 -2
  173. package/esm/typography/block-quote/Blockquote.sty.js +1 -1
  174. package/esm/typography/block-quote/Blockquote.sty.js.map +1 -1
  175. package/esm/typography/code/Code.css +1 -1
  176. package/esm/typography/code/Code.js +6 -5
  177. package/esm/typography/code/Code.js.map +2 -2
  178. package/esm/typography/code/Code.sty.js +1 -1
  179. package/esm/typography/code/Code.sty.js.map +1 -1
  180. package/esm/typography/emphasis/Emphasis.css +1 -1
  181. package/esm/typography/emphasis/Emphasis.js +6 -5
  182. package/esm/typography/emphasis/Emphasis.js.map +2 -2
  183. package/esm/typography/emphasis/Emphasis.sty.js +1 -1
  184. package/esm/typography/emphasis/Emphasis.sty.js.map +1 -1
  185. package/esm/typography/external-link/ExternalLink.css +6 -6
  186. package/esm/typography/external-link/ExternalLink.js +22 -16
  187. package/esm/typography/external-link/ExternalLink.js.map +2 -2
  188. package/esm/typography/external-link/ExternalLink.sty.js +1 -1
  189. package/esm/typography/external-link/ExternalLink.sty.js.map +1 -1
  190. package/esm/typography/heading/Heading.css +7 -7
  191. package/esm/typography/heading/Heading.js +6 -5
  192. package/esm/typography/heading/Heading.js.map +2 -2
  193. package/esm/typography/heading/Heading.sty.js +1 -1
  194. package/esm/typography/heading/Heading.sty.js.map +1 -1
  195. package/esm/typography/highlight/Highlight.css +1 -1
  196. package/esm/typography/highlight/Highlight.js +31 -18
  197. package/esm/typography/highlight/Highlight.js.map +3 -3
  198. package/esm/typography/highlight/Highlight.sty.js +1 -1
  199. package/esm/typography/highlight/Highlight.sty.js.map +1 -1
  200. package/esm/typography/link/Link.css +4 -4
  201. package/esm/typography/link/Link.js +6 -5
  202. package/esm/typography/link/Link.js.map +2 -2
  203. package/esm/typography/link/Link.sty.js +1 -1
  204. package/esm/typography/link/Link.sty.js.map +1 -1
  205. package/esm/typography/list/List.css +4 -4
  206. package/esm/typography/list/List.js +14 -9
  207. package/esm/typography/list/List.js.map +2 -2
  208. package/esm/typography/list/List.sty.js +2 -2
  209. package/esm/typography/list/List.sty.js.map +1 -1
  210. package/esm/typography/paragraph/Paragraph.css +3 -3
  211. package/esm/typography/paragraph/Paragraph.js +6 -5
  212. package/esm/typography/paragraph/Paragraph.js.map +2 -2
  213. package/esm/typography/paragraph/Paragraph.sty.js +1 -1
  214. package/esm/typography/paragraph/Paragraph.sty.js.map +1 -1
  215. package/esm/typography/strikethrough/Strikethrough.css +1 -1
  216. package/esm/typography/strikethrough/Strikethrough.js +6 -5
  217. package/esm/typography/strikethrough/Strikethrough.js.map +2 -2
  218. package/esm/typography/strikethrough/Strikethrough.sty.js +1 -1
  219. package/esm/typography/strikethrough/Strikethrough.sty.js.map +1 -1
  220. package/esm/typography/strong/Strong.css +1 -1
  221. package/esm/typography/strong/Strong.js +6 -5
  222. package/esm/typography/strong/Strong.js.map +2 -2
  223. package/esm/typography/strong/Strong.sty.js +1 -1
  224. package/esm/typography/strong/Strong.sty.js.map +1 -1
  225. package/esm/typography/text/Text.css +3 -3
  226. package/esm/typography/text/Text.js +6 -5
  227. package/esm/typography/text/Text.js.map +2 -2
  228. package/esm/typography/text/Text.sty.js +1 -1
  229. package/esm/typography/text/Text.sty.js.map +1 -1
  230. package/esm/typography/text-ellipsis/TextEllipsis.css +6 -6
  231. package/esm/typography/text-ellipsis/TextEllipsis.js +12 -11
  232. package/esm/typography/text-ellipsis/TextEllipsis.js.map +2 -2
  233. package/esm/typography/text-ellipsis/TextEllipsis.sty.js +2 -2
  234. package/esm/typography/text-ellipsis/TextEllipsis.sty.js.map +1 -1
  235. package/layouts/container/Container.css +4 -4
  236. package/layouts/container/Container.js +7 -6
  237. package/layouts/container/Container.sty.js +1 -1
  238. package/layouts/divider/Divider.css +6 -6
  239. package/layouts/divider/Divider.d.ts +1 -2
  240. package/layouts/divider/Divider.js +3 -2
  241. package/layouts/divider/Divider.sty.js +1 -1
  242. package/layouts/flex/Flex.js +6 -5
  243. package/layouts/grid/Grid.d.ts +1 -1
  244. package/layouts/grid/Grid.js +6 -5
  245. package/layouts/surface/Surface.css +39 -39
  246. package/layouts/surface/Surface.js +17 -14
  247. package/layouts/surface/Surface.sty.js +2 -2
  248. package/layouts/surface/variables.sty.js +1 -1
  249. package/layouts/types/layout.types.d.ts +1 -1
  250. package/package.json +2 -2
  251. package/styles/colorUtils.css +60 -60
  252. package/styles/colorUtils.sty.js +2 -2
  253. package/styles/container.css +47 -47
  254. package/styles/container.sty.js +2 -2
  255. package/styles/ellipsis.css +1 -1
  256. package/styles/ellipsis.sty.js +1 -1
  257. package/styles/field.css +153 -153
  258. package/styles/field.sty.js +2 -2
  259. package/styles/getFlexStyles.d.ts +17 -17
  260. package/styles/getGridStyles.d.ts +22 -22
  261. package/styles/getLayoutSizeStyles.d.ts +1 -1
  262. package/styles/sprinkles.css +262 -262
  263. package/styles/sprinkles.sty.js +1 -1
  264. package/styles/textStyle.css +8 -8
  265. package/styles/textStyle.sty.js +1 -1
  266. package/typography/block-quote/Blockquote.css +2 -2
  267. package/typography/block-quote/Blockquote.d.ts +1 -2
  268. package/typography/block-quote/Blockquote.js +6 -5
  269. package/typography/block-quote/Blockquote.sty.js +1 -1
  270. package/typography/code/Code.css +1 -1
  271. package/typography/code/Code.d.ts +1 -2
  272. package/typography/code/Code.js +6 -5
  273. package/typography/code/Code.sty.js +1 -1
  274. package/typography/emphasis/Emphasis.css +1 -1
  275. package/typography/emphasis/Emphasis.d.ts +1 -2
  276. package/typography/emphasis/Emphasis.js +6 -5
  277. package/typography/emphasis/Emphasis.sty.js +1 -1
  278. package/typography/external-link/ExternalLink.css +6 -6
  279. package/typography/external-link/ExternalLink.d.ts +2 -2
  280. package/typography/external-link/ExternalLink.js +22 -16
  281. package/typography/external-link/ExternalLink.sty.js +1 -1
  282. package/typography/heading/Heading.css +7 -7
  283. package/typography/heading/Heading.d.ts +1 -2
  284. package/typography/heading/Heading.js +6 -5
  285. package/typography/heading/Heading.sty.js +1 -1
  286. package/typography/highlight/Highlight.css +1 -1
  287. package/typography/highlight/Highlight.d.ts +1 -1
  288. package/typography/highlight/Highlight.js +21 -17
  289. package/typography/highlight/Highlight.sty.js +1 -1
  290. package/typography/link/Link.css +4 -4
  291. package/typography/link/Link.d.ts +1 -1
  292. package/typography/link/Link.js +6 -5
  293. package/typography/link/Link.sty.js +1 -1
  294. package/typography/list/List.css +4 -4
  295. package/typography/list/List.d.ts +1 -2
  296. package/typography/list/List.js +10 -9
  297. package/typography/list/List.sty.js +2 -2
  298. package/typography/paragraph/Paragraph.css +3 -3
  299. package/typography/paragraph/Paragraph.d.ts +1 -2
  300. package/typography/paragraph/Paragraph.js +6 -5
  301. package/typography/paragraph/Paragraph.sty.js +1 -1
  302. package/typography/strikethrough/Strikethrough.css +1 -1
  303. package/typography/strikethrough/Strikethrough.d.ts +1 -2
  304. package/typography/strikethrough/Strikethrough.js +6 -5
  305. package/typography/strikethrough/Strikethrough.sty.js +1 -1
  306. package/typography/strong/Strong.css +1 -1
  307. package/typography/strong/Strong.d.ts +1 -2
  308. package/typography/strong/Strong.js +6 -5
  309. package/typography/strong/Strong.sty.js +1 -1
  310. package/typography/text/Text.css +3 -3
  311. package/typography/text/Text.js +6 -5
  312. package/typography/text/Text.sty.js +1 -1
  313. package/typography/text-ellipsis/TextEllipsis.css +6 -6
  314. package/typography/text-ellipsis/TextEllipsis.d.ts +2 -2
  315. package/typography/text-ellipsis/TextEllipsis.js +12 -11
  316. package/typography/text-ellipsis/TextEllipsis.sty.js +2 -2
@@ -1,7 +1,9 @@
1
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
1
2
  import clsx from "clsx";
2
- import React, {
3
+ import {
3
4
  forwardRef,
4
- useMemo
5
+ useMemo,
6
+ Children
5
7
  } from "react";
6
8
  import { useIntl } from "react-intl";
7
9
  import { isElement } from "react-is";
@@ -19,7 +21,7 @@ import { Grid } from "../../layouts/grid/Grid.js";
19
21
  import { fieldColorsCSS } from "../../styles/field.sty.js";
20
22
  function getButtonSlots(children) {
21
23
  const slots = {};
22
- React.Children.forEach(children, (child) => {
24
+ Children.forEach(children, (child) => {
23
25
  if (isElement(child)) {
24
26
  switch (child.type) {
25
27
  case Suffix:
@@ -137,7 +139,7 @@ const _Button = /* @__PURE__ */ forwardRef(
137
139
  const intl = useIntl();
138
140
  const Component = as || "button";
139
141
  if (!hasChildren) {
140
- return /* @__PURE__ */ React.createElement(
142
+ return /* @__PURE__ */ jsx(
141
143
  Component,
142
144
  {
143
145
  ...buttonMergedProps,
@@ -163,7 +165,7 @@ const _Button = /* @__PURE__ */ forwardRef(
163
165
  }
164
166
  );
165
167
  }
166
- return /* @__PURE__ */ React.createElement(
168
+ return /* @__PURE__ */ jsxs(
167
169
  Component,
168
170
  {
169
171
  className: clsx(
@@ -190,36 +192,48 @@ const _Button = /* @__PURE__ */ forwardRef(
190
192
  width: width !== "content" && width !== "full" ? width : void 0,
191
193
  ...consumerStyle
192
194
  },
193
- ...buttonMergedProps
194
- },
195
- loading && /* @__PURE__ */ React.createElement("div", { className: buttonLoadingCSS }, /* @__PURE__ */ React.createElement(
196
- ProgressCircle,
197
- {
198
- size: "small",
199
- color,
200
- "aria-label": intl.formatMessage({
201
- defaultMessage: "Loading",
202
- id: "cycz+bYG+VH7Of4e",
203
- description: "Label for the loading state."
204
- })
205
- }
206
- )),
207
- /* @__PURE__ */ React.createElement(
208
- Grid,
209
- {
210
- gap: size === "default" ? 4 : 2,
211
- grid: "auto / auto-flow auto",
212
- width: "100%",
213
- maxWidth: "100%",
214
- alignItems: "center",
215
- justifyContent: textAlign === "start" ? "space-between" : "center",
216
- style: {
217
- visibility: loading ? "hidden" : void 0
218
- }
219
- },
220
- textAlign === "start" ? /* @__PURE__ */ React.createElement(Flex, { minWidth: 0, gap: size === "default" ? 4 : 2 }, slots.prefix, slots.label, slots.freeform && /* @__PURE__ */ React.createElement(Button.Label, null, slots.freeform)) : /* @__PURE__ */ React.createElement(React.Fragment, null, slots.prefix, slots.label, slots.freeform && /* @__PURE__ */ React.createElement(Button.Label, null, slots.freeform)),
221
- slots.suffix
222
- )
195
+ ...buttonMergedProps,
196
+ children: [
197
+ loading && /* @__PURE__ */ jsx("div", { className: buttonLoadingCSS, children: /* @__PURE__ */ jsx(
198
+ ProgressCircle,
199
+ {
200
+ size: "small",
201
+ color,
202
+ "aria-label": intl.formatMessage({
203
+ defaultMessage: "Loading",
204
+ id: "cycz+bYG+VH7Of4e",
205
+ description: "Label for the loading state."
206
+ })
207
+ }
208
+ ) }),
209
+ /* @__PURE__ */ jsxs(
210
+ Grid,
211
+ {
212
+ gap: size === "default" ? 4 : 2,
213
+ grid: "auto / auto-flow auto",
214
+ width: "100%",
215
+ maxWidth: "100%",
216
+ alignItems: "center",
217
+ justifyContent: textAlign === "start" ? "space-between" : "center",
218
+ style: {
219
+ visibility: loading ? "hidden" : void 0
220
+ },
221
+ children: [
222
+ textAlign === "start" ? /* @__PURE__ */ jsxs(Flex, { minWidth: 0, gap: size === "default" ? 4 : 2, children: [
223
+ slots.prefix,
224
+ slots.label,
225
+ slots.freeform && /* @__PURE__ */ jsx(Button.Label, { children: slots.freeform })
226
+ ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
227
+ slots.prefix,
228
+ slots.label,
229
+ slots.freeform && /* @__PURE__ */ jsx(Button.Label, { children: slots.freeform })
230
+ ] }),
231
+ slots.suffix
232
+ ]
233
+ }
234
+ )
235
+ ]
236
+ }
223
237
  );
224
238
  }
225
239
  );
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/buttons/button/Button.tsx"],
4
- "sourcesContent": ["import clsx from 'clsx';\nimport * as CSS from 'csstype';\nimport React, {\n type ElementType,\n type MouseEventHandler,\n type PointerEvent,\n type ReactElement,\n type ReactNode,\n forwardRef,\n useMemo,\n} from 'react';\nimport { useIntl } from 'react-intl';\nimport { isElement } from 'react-is';\n\nimport { buttonCSS, buttonLoadingCSS, buttonWidthsCSS } from './Button.sty.js';\nimport { Label } from './Label.js';\nimport { Prefix } from './Prefix.js';\nimport { Suffix } from './Suffix.js';\nimport { ProgressCircle } from '../../content/progress/ProgressCircle.js';\nimport { useAriaLabelingProps } from '../../core/hooks/useAriaLabelingProps.js';\nimport { useFocusRing } from '../../core/styles/useFocusRing.js';\nimport {\n type AriaDisabledProps,\n type AriaLabelingProps,\n} from '../../core/types/a11y-props.js';\nimport { type DataTestId } from '../../core/types/data-props.js';\nimport { type MaskingProps } from '../../core/types/masking-props.js';\nimport { type PolymorphicComponentProps } from '../../core/types/polymorph.js';\nimport { type StylingProps } from '../../core/types/styling-props.js';\nimport { type WithChildren } from '../../core/types/with-children.js';\nimport { mergeProps } from '../../core/utils/merge-props.js';\nimport { parseBoolean } from '../../core/utils/parse-boolean.js';\nimport { Flex } from '../../layouts/flex/Flex.js';\nimport { Grid } from '../../layouts/grid/Grid.js';\nimport { fieldColorsCSS } from '../../styles/field.sty.js';\n\n//#region Typings\n\n/**\n * Accepted properties for the Button.\n * @public\n */\nexport interface ButtonOwnProps\n extends AriaLabelingProps,\n AriaDisabledProps,\n WithChildren,\n StylingProps,\n DataTestId,\n MaskingProps {\n /**\n * If a button is disabled e.g. it cannot be interacted with.\n * @defaultValue false\n */\n disabled?: boolean;\n\n /**\n * Different variants have different styles.\n * @defaultValue 'default'\n */\n variant?: 'default' | 'emphasized' | 'accent';\n\n /**\n * The HTML button type.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#attr-type}\n * @defaultValue 'button'\n */\n type?: 'button' | 'reset' | 'submit';\n\n /** Called when the button is interacted with. */\n onClick?: MouseEventHandler;\n\n /**\n * The width of the button.\n * @defaultValue 'content'\n */\n // eslint-disable-next-line @typescript-eslint/no-restricted-types\n width?: 'content' | 'full' | CSS.Property.Width<string & {}>;\n\n /**\n * The color of the button. This should be chosen based on the context\n * the button is used in.\n * @defaultValue 'neutral'\n */\n color?: 'primary' | 'neutral' | 'success' | 'critical' | 'warning';\n\n /**\n * Controls the text alignment inside the button. Only affects the button\n * if the width is not set to 'content'.\n * @defaultValue 'center'\n */\n textAlign?: 'center' | 'start';\n\n /**\n * The size of the button.\n * @defaultValue 'default'\n */\n size?: 'default' | 'condensed';\n\n /**\n * The current loading state of the button. If true, a loading icon is shown and the button is disabled.\n * @defaultValue false\n */\n loading?: boolean;\n\n /**\n * Determines whether the element is in read-only mode.\n * @defaultValue false\n * @deprecated - readOnly is not a valid property on a button. Please use disabled if needed.\n */\n readOnly?: boolean;\n}\n\n/**\n * Merge own props with others inherited from the underlying element type.\n * @public\n */\nexport type ButtonProps<E extends ElementType> = PolymorphicComponentProps<\n E,\n ButtonOwnProps\n>;\n\ntype ButtonSlots = {\n label?: ReactNode;\n prefix?: ReactNode;\n suffix?: ReactNode;\n freeform?: ReactNode[];\n};\n\n//#endregion\n\n/**\n * Iterates over child nodes to extract specific component slots.\n * @public\n */\nexport default function getButtonSlots(children: ReactNode) {\n const slots: ButtonSlots = {};\n\n React.Children.forEach(children, (child) => {\n if (isElement(child)) {\n switch (child.type) {\n case Suffix:\n slots.suffix = child;\n break;\n case Prefix:\n slots.prefix = child;\n break;\n case Label:\n slots.label = child;\n break;\n default:\n slots.freeform ??= [];\n slots.freeform.push(child);\n break;\n }\n } else {\n if (child !== null && child !== undefined) {\n slots.freeform ??= [];\n slots.freeform.push(child);\n }\n }\n });\n\n return slots;\n}\n\nexport const _Button: <E extends ElementType = 'button'>(\n props: ButtonProps<E>,\n) => ReactElement | null = /* @__PURE__ */ forwardRef(\n <E extends ElementType>(props: ButtonProps<E>, ref: typeof props.ref) => {\n const {\n children,\n variant = 'default',\n disabled,\n 'aria-disabled': ariaDisabledProp,\n required,\n id: propId,\n type = 'button',\n onClick,\n ariaLabel,\n width = 'content',\n color = 'neutral',\n textAlign = 'center',\n size = 'default',\n loading = false,\n className: consumerClassName,\n style: consumerStyle,\n 'data-testid': dataTestId,\n 'data-dtrum-mask': dataDtrumMask,\n 'data-dtrum-allow': dataDtrumAllow,\n // eslint-disable-next-line deprecation/deprecation\n readOnly,\n as,\n ...remainingProps\n }: ButtonProps<E> = props;\n const slots = getButtonSlots(children);\n\n const ariaDisabled = parseBoolean(ariaDisabledProp);\n\n const nativeDisabledOrLoading = useMemo(\n () => (loading ? true : disabled),\n [disabled, loading],\n );\n const disabledOrLoading = useMemo(\n () => nativeDisabledOrLoading || ariaDisabled,\n [ariaDisabled, nativeDisabledOrLoading],\n );\n\n const { focusProps, focusClassName } = useFocusRing({\n variant: !disabledOrLoading ? color : 'neutral',\n disabled: nativeDisabledOrLoading,\n });\n\n const ariaLabelingProps = useAriaLabelingProps(remainingProps);\n\n const handleButtonClick: MouseEventHandler<HTMLElement> = (event) => {\n if (nativeDisabledOrLoading) {\n event.preventDefault();\n event.stopPropagation();\n return;\n }\n\n onClick?.(event);\n };\n\n const buttonProps = {\n ref,\n 'data-testid': dataTestId,\n 'data-dtrum-mask': dataDtrumMask,\n 'data-dtrum-allow': dataDtrumAllow,\n required,\n disabled: nativeDisabledOrLoading && !ariaDisabled,\n id: propId,\n type,\n ...ariaLabelingProps,\n 'aria-disabled': ariaDisabledProp,\n onClick: handleButtonClick,\n };\n\n // Propagation needs to be disabled on the disabled button because\n // it would still trigger actions on parents that would listen to it.\n // For example the menu or the useOverlay hook.\n const disabledPropagationProps = {\n onPointerDown(evt: PointerEvent) {\n if (nativeDisabledOrLoading) {\n evt.preventDefault();\n evt.stopPropagation();\n }\n },\n onPointerUp(evt: PointerEvent) {\n if (nativeDisabledOrLoading) {\n evt.preventDefault();\n evt.stopPropagation();\n }\n },\n };\n\n const hasChildren = children || children === 0;\n\n const buttonMergedProps = {\n ...mergeProps(\n buttonProps,\n disabledPropagationProps,\n // Need to cast this one as the inference of mergeProps would generate\n // a not allowed overlap. The remainingProps type is too complex due to the\n // polymorphic inheritance.\n remainingProps as Record<string, unknown>,\n focusProps,\n ),\n };\n\n const intl = useIntl();\n\n // Make the component polymorphic\n const Component = as || 'button';\n\n // Render a void element if no children are set and it's not loading (so self-closing polymorphed tags won't break)\n if (!hasChildren) {\n return (\n <Component\n {...buttonMergedProps}\n className={clsx(\n consumerClassName,\n 'strato-inputgroup',\n fieldColorsCSS({ variant, color, disabled: disabledOrLoading }),\n buttonCSS({\n disabled: disabledOrLoading,\n textAlign,\n size,\n readOnly,\n }),\n focusClassName,\n {\n [`${buttonWidthsCSS.content}`]: width === 'content',\n [`${buttonWidthsCSS.full}`]: width === 'full',\n },\n )}\n style={{\n width: width !== 'content' && width !== 'full' ? width : undefined,\n }}\n />\n );\n }\n\n return (\n <Component\n className={clsx(\n consumerClassName,\n 'strato-inputgroup',\n fieldColorsCSS({\n variant,\n color,\n disabled: disabledOrLoading || ariaDisabled,\n }),\n buttonCSS({\n disabled: disabledOrLoading || ariaDisabled,\n textAlign,\n size,\n readOnly,\n }),\n {\n [`${buttonWidthsCSS.content}`]: width === 'content',\n [`${buttonWidthsCSS.full}`]: width === 'full',\n },\n focusClassName,\n )}\n style={{\n width: width !== 'content' && width !== 'full' ? width : undefined,\n ...consumerStyle,\n }}\n {...buttonMergedProps}\n >\n {loading && (\n <div className={buttonLoadingCSS}>\n <ProgressCircle\n size=\"small\"\n color={color}\n aria-label={intl.formatMessage({\n defaultMessage: 'Loading',\n id: 'cycz+bYG+VH7Of4e',\n description: 'Label for the loading state.',\n })}\n />\n </div>\n )}\n <Grid\n gap={size === 'default' ? 4 : 2}\n grid=\"auto / auto-flow auto\"\n width={'100%'}\n maxWidth=\"100%\"\n alignItems=\"center\"\n justifyContent={textAlign === 'start' ? 'space-between' : 'center'}\n style={{\n visibility: loading ? 'hidden' : undefined,\n }}\n >\n {textAlign === 'start' ? (\n <Flex minWidth={0} gap={size === 'default' ? 4 : 2}>\n {slots.prefix}\n {slots.label}\n {slots.freeform && <Button.Label>{slots.freeform}</Button.Label>}\n </Flex>\n ) : (\n <>\n {slots.prefix}\n {slots.label}\n {slots.freeform && <Button.Label>{slots.freeform}</Button.Label>}\n </>\n )}\n {slots.suffix}\n </Grid>\n </Component>\n );\n },\n);\n\n(_Button as typeof _Button & { displayName: string }).displayName = 'Button';\n\n/**\n * Buttons allow users to trigger actions or events\n * with a single click anywhere within the button container.\n * Users can also trigger a button by pressing\n * `Enter` or `Space` while the button has focus.\n * @public\n */\nexport const Button = Object.assign(_Button, {\n Suffix,\n Prefix,\n Label,\n});\n"],
5
- "mappings": "AAAA,OAAO,UAAU;AAEjB,OAAO;AAAA,EAML;AAAA,EACA;AAAA,OACK;AACP,SAAS,eAAe;AACxB,SAAS,iBAAiB;AAE1B,SAAS,WAAW,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;AAAA,UACC,KAAK,SAAS,YAAY,IAAI;AAAA,UAC9B,MAAK;AAAA,UACL,OAAO;AAAA,UACP,UAAS;AAAA,UACT,YAAW;AAAA,UACX,gBAAgB,cAAc,UAAU,kBAAkB;AAAA,UAC1D,OAAO;AAAA,YACL,YAAY,UAAU,WAAW;AAAA,UACnC;AAAA;AAAA,QAEC,cAAc,UACb,oCAAC,QAAK,UAAU,GAAG,KAAK,SAAS,YAAY,IAAI,KAC9C,MAAM,QACN,MAAM,OACN,MAAM,YAAY,oCAAC,OAAO,OAAP,MAAc,MAAM,QAAS,CACnD,IAEA,0DACG,MAAM,QACN,MAAM,OACN,MAAM,YAAY,oCAAC,OAAO,OAAP,MAAc,MAAM,QAAS,CACnD;AAAA,QAED,MAAM;AAAA,MACT;AAAA,IACF;AAAA,EAEJ;AACF;AAEC,QAAqD,cAAc;AAS7D,MAAM,SAAS,OAAO,OAAO,SAAS;AAAA,EAC3C;AAAA,EACA;AAAA,EACA;AACF,CAAC;",
4
+ "sourcesContent": ["import clsx from 'clsx';\nimport * as CSS from 'csstype';\nimport {\n type ElementType,\n type MouseEventHandler,\n type PointerEvent,\n type ReactElement,\n type ReactNode,\n forwardRef,\n useMemo,\n Children,\n} from 'react';\nimport { useIntl } from 'react-intl';\nimport { isElement } from 'react-is';\n\nimport { buttonCSS, buttonLoadingCSS, buttonWidthsCSS } from './Button.sty.js';\nimport { Label } from './Label.js';\nimport { Prefix } from './Prefix.js';\nimport { Suffix } from './Suffix.js';\nimport { ProgressCircle } from '../../content/progress/ProgressCircle.js';\nimport { useAriaLabelingProps } from '../../core/hooks/useAriaLabelingProps.js';\nimport { useFocusRing } from '../../core/styles/useFocusRing.js';\nimport {\n type AriaDisabledProps,\n type AriaLabelingProps,\n} from '../../core/types/a11y-props.js';\nimport { type DataTestId } from '../../core/types/data-props.js';\nimport { type MaskingProps } from '../../core/types/masking-props.js';\nimport { type PolymorphicComponentProps } from '../../core/types/polymorph.js';\nimport { type StylingProps } from '../../core/types/styling-props.js';\nimport { type WithChildren } from '../../core/types/with-children.js';\nimport { mergeProps } from '../../core/utils/merge-props.js';\nimport { parseBoolean } from '../../core/utils/parse-boolean.js';\nimport { Flex } from '../../layouts/flex/Flex.js';\nimport { Grid } from '../../layouts/grid/Grid.js';\nimport { fieldColorsCSS } from '../../styles/field.sty.js';\n\n//#region Typings\n\n/**\n * Accepted properties for the Button.\n * @public\n */\nexport interface ButtonOwnProps\n extends AriaLabelingProps,\n AriaDisabledProps,\n WithChildren,\n StylingProps,\n DataTestId,\n MaskingProps {\n /**\n * If a button is disabled e.g. it cannot be interacted with.\n * @defaultValue false\n */\n disabled?: boolean;\n\n /**\n * Different variants have different styles.\n * @defaultValue 'default'\n */\n variant?: 'default' | 'emphasized' | 'accent';\n\n /**\n * The HTML button type.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#attr-type}\n * @defaultValue 'button'\n */\n type?: 'button' | 'reset' | 'submit';\n\n /** Called when the button is interacted with. */\n onClick?: MouseEventHandler;\n\n /**\n * The width of the button.\n * @defaultValue 'content'\n */\n // eslint-disable-next-line @typescript-eslint/no-restricted-types\n width?: 'content' | 'full' | CSS.Property.Width<string & {}>;\n\n /**\n * The color of the button. This should be chosen based on the context\n * the button is used in.\n * @defaultValue 'neutral'\n */\n color?: 'primary' | 'neutral' | 'success' | 'critical' | 'warning';\n\n /**\n * Controls the text alignment inside the button. Only affects the button\n * if the width is not set to 'content'.\n * @defaultValue 'center'\n */\n textAlign?: 'center' | 'start';\n\n /**\n * The size of the button.\n * @defaultValue 'default'\n */\n size?: 'default' | 'condensed';\n\n /**\n * The current loading state of the button. If true, a loading icon is shown and the button is disabled.\n * @defaultValue false\n */\n loading?: boolean;\n\n /**\n * Determines whether the element is in read-only mode.\n * @defaultValue false\n * @deprecated - readOnly is not a valid property on a button. Please use disabled if needed.\n */\n readOnly?: boolean;\n}\n\n/**\n * Merge own props with others inherited from the underlying element type.\n * @public\n */\nexport type ButtonProps<E extends ElementType> = PolymorphicComponentProps<\n E,\n ButtonOwnProps\n>;\n\ntype ButtonSlots = {\n label?: ReactNode;\n prefix?: ReactNode;\n suffix?: ReactNode;\n freeform?: ReactNode[];\n};\n\n//#endregion\n\n/**\n * Iterates over child nodes to extract specific component slots.\n * @public\n */\nexport default function getButtonSlots(children: ReactNode) {\n const slots: ButtonSlots = {};\n\n Children.forEach(children, (child) => {\n if (isElement(child)) {\n switch (child.type) {\n case Suffix:\n slots.suffix = child;\n break;\n case Prefix:\n slots.prefix = child;\n break;\n case Label:\n slots.label = child;\n break;\n default:\n slots.freeform ??= [];\n slots.freeform.push(child);\n break;\n }\n } else {\n if (child !== null && child !== undefined) {\n slots.freeform ??= [];\n slots.freeform.push(child);\n }\n }\n });\n\n return slots;\n}\n\nexport const _Button: <E extends ElementType = 'button'>(\n props: ButtonProps<E>,\n) => ReactElement | null = /* @__PURE__ */ forwardRef(\n <E extends ElementType>(props: ButtonProps<E>, ref: typeof props.ref) => {\n const {\n children,\n variant = 'default',\n disabled,\n 'aria-disabled': ariaDisabledProp,\n required,\n id: propId,\n type = 'button',\n onClick,\n ariaLabel,\n width = 'content',\n color = 'neutral',\n textAlign = 'center',\n size = 'default',\n loading = false,\n className: consumerClassName,\n style: consumerStyle,\n 'data-testid': dataTestId,\n 'data-dtrum-mask': dataDtrumMask,\n 'data-dtrum-allow': dataDtrumAllow,\n // eslint-disable-next-line deprecation/deprecation\n readOnly,\n as,\n ...remainingProps\n }: ButtonProps<E> = props;\n const slots = getButtonSlots(children);\n\n const ariaDisabled = parseBoolean(ariaDisabledProp);\n\n const nativeDisabledOrLoading = useMemo(\n () => (loading ? true : disabled),\n [disabled, loading],\n );\n const disabledOrLoading = useMemo(\n () => nativeDisabledOrLoading || ariaDisabled,\n [ariaDisabled, nativeDisabledOrLoading],\n );\n\n const { focusProps, focusClassName } = useFocusRing({\n variant: !disabledOrLoading ? color : 'neutral',\n disabled: nativeDisabledOrLoading,\n });\n\n const ariaLabelingProps = useAriaLabelingProps(remainingProps);\n\n const handleButtonClick: MouseEventHandler<HTMLElement> = (event) => {\n if (nativeDisabledOrLoading) {\n event.preventDefault();\n event.stopPropagation();\n return;\n }\n\n onClick?.(event);\n };\n\n const buttonProps = {\n ref,\n 'data-testid': dataTestId,\n 'data-dtrum-mask': dataDtrumMask,\n 'data-dtrum-allow': dataDtrumAllow,\n required,\n disabled: nativeDisabledOrLoading && !ariaDisabled,\n id: propId,\n type,\n ...ariaLabelingProps,\n 'aria-disabled': ariaDisabledProp,\n onClick: handleButtonClick,\n };\n\n // Propagation needs to be disabled on the disabled button because\n // it would still trigger actions on parents that would listen to it.\n // For example the menu or the useOverlay hook.\n const disabledPropagationProps = {\n onPointerDown(evt: PointerEvent) {\n if (nativeDisabledOrLoading) {\n evt.preventDefault();\n evt.stopPropagation();\n }\n },\n onPointerUp(evt: PointerEvent) {\n if (nativeDisabledOrLoading) {\n evt.preventDefault();\n evt.stopPropagation();\n }\n },\n };\n\n const hasChildren = children || children === 0;\n\n const buttonMergedProps = {\n ...mergeProps(\n buttonProps,\n disabledPropagationProps,\n // Need to cast this one as the inference of mergeProps would generate\n // a not allowed overlap. The remainingProps type is too complex due to the\n // polymorphic inheritance.\n remainingProps as Record<string, unknown>,\n focusProps,\n ),\n };\n\n const intl = useIntl();\n\n // Make the component polymorphic\n const Component = as || 'button';\n\n // Render a void element if no children are set and it's not loading (so self-closing polymorphed tags won't break)\n if (!hasChildren) {\n return (\n <Component\n {...buttonMergedProps}\n className={clsx(\n consumerClassName,\n 'strato-inputgroup',\n fieldColorsCSS({ variant, color, disabled: disabledOrLoading }),\n buttonCSS({\n disabled: disabledOrLoading,\n textAlign,\n size,\n readOnly,\n }),\n focusClassName,\n {\n [`${buttonWidthsCSS.content}`]: width === 'content',\n [`${buttonWidthsCSS.full}`]: width === 'full',\n },\n )}\n style={{\n width: width !== 'content' && width !== 'full' ? width : undefined,\n }}\n />\n );\n }\n\n return (\n <Component\n className={clsx(\n consumerClassName,\n 'strato-inputgroup',\n fieldColorsCSS({\n variant,\n color,\n disabled: disabledOrLoading || ariaDisabled,\n }),\n buttonCSS({\n disabled: disabledOrLoading || ariaDisabled,\n textAlign,\n size,\n readOnly,\n }),\n {\n [`${buttonWidthsCSS.content}`]: width === 'content',\n [`${buttonWidthsCSS.full}`]: width === 'full',\n },\n focusClassName,\n )}\n style={{\n width: width !== 'content' && width !== 'full' ? width : undefined,\n ...consumerStyle,\n }}\n {...buttonMergedProps}\n >\n {loading && (\n <div className={buttonLoadingCSS}>\n <ProgressCircle\n size=\"small\"\n color={color}\n aria-label={intl.formatMessage({\n defaultMessage: 'Loading',\n id: 'cycz+bYG+VH7Of4e',\n description: 'Label for the loading state.',\n })}\n />\n </div>\n )}\n <Grid\n gap={size === 'default' ? 4 : 2}\n grid=\"auto / auto-flow auto\"\n width={'100%'}\n maxWidth=\"100%\"\n alignItems=\"center\"\n justifyContent={textAlign === 'start' ? 'space-between' : 'center'}\n style={{\n visibility: loading ? 'hidden' : undefined,\n }}\n >\n {textAlign === 'start' ? (\n <Flex minWidth={0} gap={size === 'default' ? 4 : 2}>\n {slots.prefix}\n {slots.label}\n {slots.freeform && <Button.Label>{slots.freeform}</Button.Label>}\n </Flex>\n ) : (\n <>\n {slots.prefix}\n {slots.label}\n {slots.freeform && <Button.Label>{slots.freeform}</Button.Label>}\n </>\n )}\n {slots.suffix}\n </Grid>\n </Component>\n );\n },\n);\n\n(_Button as typeof _Button & { displayName: string }).displayName = 'Button';\n\n/**\n * Buttons allow users to trigger actions or events\n * with a single click anywhere within the button container.\n * Users can also trigger a button by pressing\n * `Enter` or `Space` while the button has focus.\n * @public\n */\nexport const Button = Object.assign(_Button, {\n Suffix,\n Prefix,\n Label,\n});\n"],
5
+ "mappings": "AAuRQ,SAoFI,UApFJ,KA8EI,YA9EJ;AAvRR,OAAO,UAAU;AAEjB;AAAA,EAME;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,eAAe;AACxB,SAAS,iBAAiB;AAE1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,YAAC;AAAA;AAAA,cACC,KAAK,SAAS,YAAY,IAAI;AAAA,cAC9B,MAAK;AAAA,cACL,OAAO;AAAA,cACP,UAAS;AAAA,cACT,YAAW;AAAA,cACX,gBAAgB,cAAc,UAAU,kBAAkB;AAAA,cAC1D,OAAO;AAAA,gBACL,YAAY,UAAU,WAAW;AAAA,cACnC;AAAA,cAEC;AAAA,8BAAc,UACb,qBAAC,QAAK,UAAU,GAAG,KAAK,SAAS,YAAY,IAAI,GAC9C;AAAA,wBAAM;AAAA,kBACN,MAAM;AAAA,kBACN,MAAM,YAAY,oBAAC,OAAO,OAAP,EAAc,gBAAM,UAAS;AAAA,mBACnD,IAEA,iCACG;AAAA,wBAAM;AAAA,kBACN,MAAM;AAAA,kBACN,MAAM,YAAY,oBAAC,OAAO,OAAP,EAAc,gBAAM,UAAS;AAAA,mBACnD;AAAA,gBAED,MAAM;AAAA;AAAA;AAAA,UACT;AAAA;AAAA;AAAA,IACF;AAAA,EAEJ;AACF;AAEC,QAAqD,cAAc;AAS7D,MAAM,SAAS,OAAO,OAAO,SAAS;AAAA,EAC3C;AAAA,EACA;AAAA,EACA;AACF,CAAC;",
6
6
  "names": []
7
7
  }
@@ -2,10 +2,10 @@ import "../../styles/ellipsis.css";
2
2
  import "../../styles/field.css";
3
3
  import "./Button.css";
4
4
  import { createRuntimeFn as _7a468 } from "@vanilla-extract/recipes/createRuntimeFn";
5
- var buttonCSS = _7a468({ defaultClassName: "_10kgnsa0-1-5-1", variantClassNames: { textAlign: { start: "_10kgnsa1-1-5-1", center: "_10kgnsa2-1-5-1" }, size: { condensed: "_10kgnsa3-1-5-1", "default": "_10kgnsa4-1-5-1" }, disabled: { true: "_10kgnsa5-1-5-1" }, readOnly: { true: "_10kgnsa6-1-5-1" } }, defaultVariants: { size: "default", textAlign: "center", disabled: false }, compoundVariants: [] });
6
- var buttonLabelCSS = _7a468({ defaultClassName: "_10kgnsaa-1-5-1", variantClassNames: { textual: { true: "_oqqp1n0-1-5-1", false: "_10kgnsac-1-5-1" } }, defaultVariants: {}, compoundVariants: [] });
7
- var buttonLoadingCSS = "_10kgnsa9-1-5-1";
8
- var buttonWidthsCSS = { full: "_10kgnsa7-1-5-1", content: "_10kgnsa8-1-5-1" };
5
+ var buttonCSS = _7a468({ defaultClassName: "_10kgnsa0-1-6-0", variantClassNames: { textAlign: { start: "_10kgnsa1-1-6-0", center: "_10kgnsa2-1-6-0" }, size: { condensed: "_10kgnsa3-1-6-0", "default": "_10kgnsa4-1-6-0" }, disabled: { true: "_10kgnsa5-1-6-0" }, readOnly: { true: "_10kgnsa6-1-6-0" } }, defaultVariants: { size: "default", textAlign: "center", disabled: false }, compoundVariants: [] });
6
+ var buttonLabelCSS = _7a468({ defaultClassName: "_10kgnsaa-1-6-0", variantClassNames: { textual: { true: "_oqqp1n0-1-6-0", false: "_10kgnsac-1-6-0" } }, defaultVariants: {}, compoundVariants: [] });
7
+ var buttonLoadingCSS = "_10kgnsa9-1-6-0";
8
+ var buttonWidthsCSS = { full: "_10kgnsa7-1-6-0", content: "_10kgnsa8-1-6-0" };
9
9
  export {
10
10
  buttonCSS,
11
11
  buttonLabelCSS,
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/buttons/button/Button.css.ts"],
4
- "sourcesContent": ["import '../../styles/ellipsis.css';\nimport '../../styles/field.css';\nimport './Button.css';\nimport { createRuntimeFn as _7a468 } from '@vanilla-extract/recipes/createRuntimeFn';\nexport var buttonCSS = _7a468({defaultClassName:'_10kgnsa0-1-5-1',variantClassNames:{textAlign:{start:'_10kgnsa1-1-5-1',center:'_10kgnsa2-1-5-1'},size:{condensed:'_10kgnsa3-1-5-1','default':'_10kgnsa4-1-5-1'},disabled:{true:'_10kgnsa5-1-5-1'},readOnly:{true:'_10kgnsa6-1-5-1'}},defaultVariants:{size:'default',textAlign:'center',disabled:false},compoundVariants:[]});\nexport var buttonLabelCSS = _7a468({defaultClassName:'_10kgnsaa-1-5-1',variantClassNames:{textual:{true:'_oqqp1n0-1-5-1',false:'_10kgnsac-1-5-1'}},defaultVariants:{},compoundVariants:[]});\nexport var buttonLoadingCSS = '_10kgnsa9-1-5-1';\nexport var buttonWidthsCSS = {full:'_10kgnsa7-1-5-1',content:'_10kgnsa8-1-5-1'};"],
4
+ "sourcesContent": ["import '../../styles/ellipsis.css';\nimport '../../styles/field.css';\nimport './Button.css';\nimport { createRuntimeFn as _7a468 } from '@vanilla-extract/recipes/createRuntimeFn';\nexport var buttonCSS = _7a468({defaultClassName:'_10kgnsa0-1-6-0',variantClassNames:{textAlign:{start:'_10kgnsa1-1-6-0',center:'_10kgnsa2-1-6-0'},size:{condensed:'_10kgnsa3-1-6-0','default':'_10kgnsa4-1-6-0'},disabled:{true:'_10kgnsa5-1-6-0'},readOnly:{true:'_10kgnsa6-1-6-0'}},defaultVariants:{size:'default',textAlign:'center',disabled:false},compoundVariants:[]});\nexport var buttonLabelCSS = _7a468({defaultClassName:'_10kgnsaa-1-6-0',variantClassNames:{textual:{true:'_oqqp1n0-1-6-0',false:'_10kgnsac-1-6-0'}},defaultVariants:{},compoundVariants:[]});\nexport var buttonLoadingCSS = '_10kgnsa9-1-6-0';\nexport var buttonWidthsCSS = {full:'_10kgnsa7-1-6-0',content:'_10kgnsa8-1-6-0'};"],
5
5
  "mappings": "AAAA,OAAO;AACP,OAAO;AACP,OAAO;AACP,SAAS,mBAAmB,cAAc;AACnC,IAAI,YAAY,OAAO,EAAC,kBAAiB,mBAAkB,mBAAkB,EAAC,WAAU,EAAC,OAAM,mBAAkB,QAAO,kBAAiB,GAAE,MAAK,EAAC,WAAU,mBAAkB,WAAU,kBAAiB,GAAE,UAAS,EAAC,MAAK,kBAAiB,GAAE,UAAS,EAAC,MAAK,kBAAiB,EAAC,GAAE,iBAAgB,EAAC,MAAK,WAAU,WAAU,UAAS,UAAS,MAAK,GAAE,kBAAiB,CAAC,EAAC,CAAC;AACtW,IAAI,iBAAiB,OAAO,EAAC,kBAAiB,mBAAkB,mBAAkB,EAAC,SAAQ,EAAC,MAAK,kBAAiB,OAAM,kBAAiB,EAAC,GAAE,iBAAgB,CAAC,GAAE,kBAAiB,CAAC,EAAC,CAAC;AACnL,IAAI,mBAAmB;AACvB,IAAI,kBAAkB,EAAC,MAAK,mBAAkB,SAAQ,kBAAiB;",
6
6
  "names": []
7
7
  }
@@ -1,5 +1,6 @@
1
+ import { jsx } from "react/jsx-runtime";
1
2
  import clsx from "clsx";
2
- import React, { forwardRef } from "react";
3
+ import { forwardRef } from "react";
3
4
  import { buttonLabelCSS } from "./Button.sty.js";
4
5
  import { isStringChildren } from "../../core/utils/_is-string-children.js";
5
6
  const Label = /* @__PURE__ */ forwardRef((props, forwardedRef) => {
@@ -10,7 +11,7 @@ const Label = /* @__PURE__ */ forwardRef((props, forwardedRef) => {
10
11
  "data-testid": dataTestId
11
12
  } = props;
12
13
  const textual = isStringChildren(children);
13
- return /* @__PURE__ */ React.createElement(
14
+ return /* @__PURE__ */ jsx(
14
15
  "div",
15
16
  {
16
17
  ref: forwardedRef,
@@ -20,9 +21,9 @@ const Label = /* @__PURE__ */ forwardRef((props, forwardedRef) => {
20
21
  buttonLabelCSS({ textual }),
21
22
  consumerClassName
22
23
  ),
23
- style: consumerStyle
24
- },
25
- children
24
+ style: consumerStyle,
25
+ children
26
+ }
26
27
  );
27
28
  });
28
29
  Label.displayName = "Button.Label";
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/buttons/button/Label.tsx"],
4
- "sourcesContent": ["import clsx from 'clsx';\nimport React, { forwardRef, type ReactNode } from 'react';\n\nimport { buttonLabelCSS } from './Button.sty.js';\nimport { type DataTestId } from '../../core/types/data-props.js';\nimport { type StylingProps } from '../../core/types/styling-props.js';\nimport { isStringChildren } from '../../core/utils/_is-string-children.js';\n\n//#region Typings\n/**\n * Accepted properties for the Button Label.\n * @public\n */\nexport interface ButtonLabelProps extends StylingProps, DataTestId {\n /** Elements to be displayed in the Button Label slot. */\n children: ReactNode;\n}\n//#endregion\n\n/**\n * Button Label component.\n * @public\n */\nexport const Label = /* @__PURE__ */ forwardRef<\n HTMLDivElement,\n ButtonLabelProps\n>((props, forwardedRef) => {\n const {\n children,\n className: consumerClassName,\n style: consumerStyle,\n 'data-testid': dataTestId,\n }: ButtonLabelProps = props;\n\n const textual = isStringChildren(children);\n\n return (\n <div\n ref={forwardedRef}\n data-testid={dataTestId}\n className={clsx(\n 'strato-button-label',\n buttonLabelCSS({ textual }),\n consumerClassName,\n )}\n style={consumerStyle}\n >\n {children}\n </div>\n );\n});\n\n(Label as typeof Label & { displayName: string }).displayName = 'Button.Label';\n"],
5
- "mappings": "AAAA,OAAO,UAAU;AACjB,OAAO,SAAS,kBAAkC;AAElD,SAAS,sBAAsB;AAG/B,SAAS,wBAAwB;AAiB1B,MAAM,QAAwB,2BAGnC,CAAC,OAAO,iBAAiB;AACzB,QAAM;AAAA,IACJ;AAAA,IACA,WAAW;AAAA,IACX,OAAO;AAAA,IACP,eAAe;AAAA,EACjB,IAAsB;AAEtB,QAAM,UAAU,iBAAiB,QAAQ;AAEzC,SACE;AAAA,IAAC;AAAA;AAAA,MACC,KAAK;AAAA,MACL,eAAa;AAAA,MACb,WAAW;AAAA,QACT;AAAA,QACA,eAAe,EAAE,QAAQ,CAAC;AAAA,QAC1B;AAAA,MACF;AAAA,MACA,OAAO;AAAA;AAAA,IAEN;AAAA,EACH;AAEJ,CAAC;AAEA,MAAiD,cAAc;",
4
+ "sourcesContent": ["import clsx from 'clsx';\nimport { forwardRef, type ReactNode } from 'react';\n\nimport { buttonLabelCSS } from './Button.sty.js';\nimport { type DataTestId } from '../../core/types/data-props.js';\nimport { type StylingProps } from '../../core/types/styling-props.js';\nimport { isStringChildren } from '../../core/utils/_is-string-children.js';\n\n//#region Typings\n/**\n * Accepted properties for the Button Label.\n * @public\n */\nexport interface ButtonLabelProps extends StylingProps, DataTestId {\n /** Elements to be displayed in the Button Label slot. */\n children: ReactNode;\n}\n//#endregion\n\n/**\n * Button Label component.\n * @public\n */\nexport const Label = /* @__PURE__ */ forwardRef<\n HTMLDivElement,\n ButtonLabelProps\n>((props, forwardedRef) => {\n const {\n children,\n className: consumerClassName,\n style: consumerStyle,\n 'data-testid': dataTestId,\n }: ButtonLabelProps = props;\n\n const textual = isStringChildren(children);\n\n return (\n <div\n ref={forwardedRef}\n data-testid={dataTestId}\n className={clsx(\n 'strato-button-label',\n buttonLabelCSS({ textual }),\n consumerClassName,\n )}\n style={consumerStyle}\n >\n {children}\n </div>\n );\n});\n\n(Label as typeof Label & { displayName: string }).displayName = 'Button.Label';\n"],
5
+ "mappings": "AAqCI;AArCJ,OAAO,UAAU;AACjB,SAAS,kBAAkC;AAE3C,SAAS,sBAAsB;AAG/B,SAAS,wBAAwB;AAiB1B,MAAM,QAAwB,2BAGnC,CAAC,OAAO,iBAAiB;AACzB,QAAM;AAAA,IACJ;AAAA,IACA,WAAW;AAAA,IACX,OAAO;AAAA,IACP,eAAe;AAAA,EACjB,IAAsB;AAEtB,QAAM,UAAU,iBAAiB,QAAQ;AAEzC,SACE;AAAA,IAAC;AAAA;AAAA,MACC,KAAK;AAAA,MACL,eAAa;AAAA,MACb,WAAW;AAAA,QACT;AAAA,QACA,eAAe,EAAE,QAAQ,CAAC;AAAA,QAC1B;AAAA,MACF;AAAA,MACA,OAAO;AAAA,MAEN;AAAA;AAAA,EACH;AAEJ,CAAC;AAEA,MAAiD,cAAc;",
6
6
  "names": []
7
7
  }
@@ -1,4 +1,5 @@
1
- import React, { forwardRef } from "react";
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { forwardRef } from "react";
2
3
  import { Flex } from "../../layouts/flex/Flex.js";
3
4
  const Prefix = /* @__PURE__ */ forwardRef((props, forwardedRef) => {
4
5
  const {
@@ -7,16 +8,16 @@ const Prefix = /* @__PURE__ */ forwardRef((props, forwardedRef) => {
7
8
  style: consumerStyle,
8
9
  "data-testid": dataTestId
9
10
  } = props;
10
- return /* @__PURE__ */ React.createElement(
11
+ return /* @__PURE__ */ jsx(
11
12
  Flex,
12
13
  {
13
14
  "data-testid": dataTestId,
14
15
  ref: forwardedRef,
15
16
  gap: 0,
16
17
  className: consumerClassName,
17
- style: consumerStyle
18
- },
19
- children
18
+ style: consumerStyle,
19
+ children
20
+ }
20
21
  );
21
22
  });
22
23
  Prefix.displayName = "Button.Prefix";
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/buttons/button/Prefix.tsx"],
4
- "sourcesContent": ["import React, { forwardRef, type ReactNode } from 'react';\n\nimport { type DataTestId } from '../../core/types/data-props.js';\nimport { type StylingProps } from '../../core/types/styling-props.js';\nimport { Flex } from '../../layouts/flex/Flex.js';\n\n//#region Typings\n/**\n * Accepted properties for the Button Prefix.\n * @public\n */\nexport interface ButtonPrefixProps extends StylingProps, DataTestId {\n /** Elements to be displayed in the Button Prefix slot. */\n children: ReactNode;\n}\n//#endregion\n\n/**\n * Button Prefix component.\n * @public\n */\nexport const Prefix = /* @__PURE__ */ forwardRef<\n HTMLDivElement,\n ButtonPrefixProps\n>((props, forwardedRef) => {\n const {\n children,\n className: consumerClassName,\n style: consumerStyle,\n 'data-testid': dataTestId,\n }: ButtonPrefixProps = props;\n\n return (\n <Flex\n data-testid={dataTestId}\n ref={forwardedRef}\n gap={0}\n className={consumerClassName}\n style={consumerStyle}\n >\n {children}\n </Flex>\n );\n});\n\n(Prefix as typeof Prefix & { displayName: string }).displayName =\n 'Button.Prefix';\n"],
5
- "mappings": "AAAA,OAAO,SAAS,kBAAkC;AAIlD,SAAS,YAAY;AAiBd,MAAM,SAAyB,2BAGpC,CAAC,OAAO,iBAAiB;AACzB,QAAM;AAAA,IACJ;AAAA,IACA,WAAW;AAAA,IACX,OAAO;AAAA,IACP,eAAe;AAAA,EACjB,IAAuB;AAEvB,SACE;AAAA,IAAC;AAAA;AAAA,MACC,eAAa;AAAA,MACb,KAAK;AAAA,MACL,KAAK;AAAA,MACL,WAAW;AAAA,MACX,OAAO;AAAA;AAAA,IAEN;AAAA,EACH;AAEJ,CAAC;AAEA,OAAmD,cAClD;",
4
+ "sourcesContent": ["import { forwardRef, type ReactNode } from 'react';\n\nimport { type DataTestId } from '../../core/types/data-props.js';\nimport { type StylingProps } from '../../core/types/styling-props.js';\nimport { Flex } from '../../layouts/flex/Flex.js';\n\n//#region Typings\n/**\n * Accepted properties for the Button Prefix.\n * @public\n */\nexport interface ButtonPrefixProps extends StylingProps, DataTestId {\n /** Elements to be displayed in the Button Prefix slot. */\n children: ReactNode;\n}\n//#endregion\n\n/**\n * Button Prefix component.\n * @public\n */\nexport const Prefix = /* @__PURE__ */ forwardRef<\n HTMLDivElement,\n ButtonPrefixProps\n>((props, forwardedRef) => {\n const {\n children,\n className: consumerClassName,\n style: consumerStyle,\n 'data-testid': dataTestId,\n }: ButtonPrefixProps = props;\n\n return (\n <Flex\n data-testid={dataTestId}\n ref={forwardedRef}\n gap={0}\n className={consumerClassName}\n style={consumerStyle}\n >\n {children}\n </Flex>\n );\n});\n\n(Prefix as typeof Prefix & { displayName: string }).displayName =\n 'Button.Prefix';\n"],
5
+ "mappings": "AAiCI;AAjCJ,SAAS,kBAAkC;AAI3C,SAAS,YAAY;AAiBd,MAAM,SAAyB,2BAGpC,CAAC,OAAO,iBAAiB;AACzB,QAAM;AAAA,IACJ;AAAA,IACA,WAAW;AAAA,IACX,OAAO;AAAA,IACP,eAAe;AAAA,EACjB,IAAuB;AAEvB,SACE;AAAA,IAAC;AAAA;AAAA,MACC,eAAa;AAAA,MACb,KAAK;AAAA,MACL,KAAK;AAAA,MACL,WAAW;AAAA,MACX,OAAO;AAAA,MAEN;AAAA;AAAA,EACH;AAEJ,CAAC;AAEA,OAAmD,cAClD;",
6
6
  "names": []
7
7
  }
@@ -1,4 +1,5 @@
1
- import React, { forwardRef } from "react";
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { forwardRef } from "react";
2
3
  import { Flex } from "../../layouts/flex/Flex.js";
3
4
  const Suffix = forwardRef(
4
5
  (props, forwardedRef) => {
@@ -8,16 +9,16 @@ const Suffix = forwardRef(
8
9
  style: consumerStyle,
9
10
  "data-testid": dataTestId
10
11
  } = props;
11
- return /* @__PURE__ */ React.createElement(
12
+ return /* @__PURE__ */ jsx(
12
13
  Flex,
13
14
  {
14
15
  "data-testid": dataTestId,
15
16
  gap: 0,
16
17
  ref: forwardedRef,
17
18
  className: consumerClassName,
18
- style: consumerStyle
19
- },
20
- children
19
+ style: consumerStyle,
20
+ children
21
+ }
21
22
  );
22
23
  }
23
24
  );
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/buttons/button/Suffix.tsx"],
4
- "sourcesContent": ["import React, { forwardRef } from 'react';\n\nimport { type DataTestId } from '../../core/types/data-props.js';\nimport { type StylingProps } from '../../core/types/styling-props.js';\nimport { Flex } from '../../layouts/flex/Flex.js';\n\n//#region Typings\n/**\n * Accepted properties for the Button Suffix.\n * @public\n */\nexport interface ButtonSuffixProps extends StylingProps, DataTestId {\n /** Elements to be displayed in the Button Suffix slot. */\n children: React.ReactNode;\n}\n//#endregion\n\n/**\n * Button Suffix component.\n * @public\n */\nexport const Suffix = forwardRef<HTMLDivElement, ButtonSuffixProps>(\n (props, forwardedRef) => {\n const {\n children,\n className: consumerClassName,\n style: consumerStyle,\n 'data-testid': dataTestId,\n }: ButtonSuffixProps = props;\n\n return (\n <Flex\n data-testid={dataTestId}\n gap={0}\n ref={forwardedRef}\n className={consumerClassName}\n style={consumerStyle}\n >\n {children}\n </Flex>\n );\n },\n);\n\n(Suffix as typeof Suffix & { displayName: string }).displayName =\n 'Button.Suffix';\n"],
5
- "mappings": "AAAA,OAAO,SAAS,kBAAkB;AAIlC,SAAS,YAAY;AAiBd,MAAM,SAAS;AAAA,EACpB,CAAC,OAAO,iBAAiB;AACvB,UAAM;AAAA,MACJ;AAAA,MACA,WAAW;AAAA,MACX,OAAO;AAAA,MACP,eAAe;AAAA,IACjB,IAAuB;AAEvB,WACE;AAAA,MAAC;AAAA;AAAA,QACC,eAAa;AAAA,QACb,KAAK;AAAA,QACL,KAAK;AAAA,QACL,WAAW;AAAA,QACX,OAAO;AAAA;AAAA,MAEN;AAAA,IACH;AAAA,EAEJ;AACF;AAEC,OAAmD,cAClD;",
4
+ "sourcesContent": ["import { forwardRef, type ReactNode } from 'react';\n\nimport { type DataTestId } from '../../core/types/data-props.js';\nimport { type StylingProps } from '../../core/types/styling-props.js';\nimport { Flex } from '../../layouts/flex/Flex.js';\n\n//#region Typings\n/**\n * Accepted properties for the Button Suffix.\n * @public\n */\nexport interface ButtonSuffixProps extends StylingProps, DataTestId {\n /** Elements to be displayed in the Button Suffix slot. */\n children: ReactNode;\n}\n//#endregion\n\n/**\n * Button Suffix component.\n * @public\n */\nexport const Suffix = forwardRef<HTMLDivElement, ButtonSuffixProps>(\n (props, forwardedRef) => {\n const {\n children,\n className: consumerClassName,\n style: consumerStyle,\n 'data-testid': dataTestId,\n }: ButtonSuffixProps = props;\n\n return (\n <Flex\n data-testid={dataTestId}\n gap={0}\n ref={forwardedRef}\n className={consumerClassName}\n style={consumerStyle}\n >\n {children}\n </Flex>\n );\n },\n);\n\n(Suffix as typeof Suffix & { displayName: string }).displayName =\n 'Button.Suffix';\n"],
5
+ "mappings": "AA+BM;AA/BN,SAAS,kBAAkC;AAI3C,SAAS,YAAY;AAiBd,MAAM,SAAS;AAAA,EACpB,CAAC,OAAO,iBAAiB;AACvB,UAAM;AAAA,MACJ;AAAA,MACA,WAAW;AAAA,MACX,OAAO;AAAA,MACP,eAAe;AAAA,IACjB,IAAuB;AAEvB,WACE;AAAA,MAAC;AAAA;AAAA,QACC,eAAa;AAAA,QACb,KAAK;AAAA,QACL,KAAK;AAAA,QACL,WAAW;AAAA,QACX,OAAO;AAAA,QAEN;AAAA;AAAA,IACH;AAAA,EAEJ;AACF;AAEC,OAAmD,cAClD;",
6
6
  "names": []
7
7
  }
@@ -1,4 +1,5 @@
1
- import React, { forwardRef } from "react";
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { forwardRef } from "react";
2
3
  import { useIntl } from "react-intl";
3
4
  import { OpenWithIcon } from "@dynatrace/strato-icons";
4
5
  import { useIntentButton } from "./useIntentButton.js";
@@ -38,7 +39,7 @@ const IntentButton = /* @__PURE__ */ forwardRef((props, forwardedRef) => {
38
39
  onClickProp
39
40
  );
40
41
  if (disabled) {
41
- return /* @__PURE__ */ React.createElement(
42
+ return /* @__PURE__ */ jsxs(
42
43
  Button,
43
44
  {
44
45
  disabled: true,
@@ -49,13 +50,15 @@ const IntentButton = /* @__PURE__ */ forwardRef((props, forwardedRef) => {
49
50
  className: consumerClassName,
50
51
  style: consumerStyle,
51
52
  readOnly,
52
- ...remainingProps
53
- },
54
- label,
55
- /* @__PURE__ */ React.createElement(Button.Suffix, null, /* @__PURE__ */ React.createElement(OpenWithIcon, null))
53
+ ...remainingProps,
54
+ children: [
55
+ label,
56
+ /* @__PURE__ */ jsx(Button.Suffix, { children: /* @__PURE__ */ jsx(OpenWithIcon, {}) })
57
+ ]
58
+ }
56
59
  );
57
60
  }
58
- return /* @__PURE__ */ React.createElement(
61
+ return /* @__PURE__ */ jsxs(
59
62
  Button,
60
63
  {
61
64
  as: "a",
@@ -68,10 +71,12 @@ const IntentButton = /* @__PURE__ */ forwardRef((props, forwardedRef) => {
68
71
  style: consumerStyle,
69
72
  readOnly,
70
73
  ...remainingProps,
71
- ...intentButtonProps
72
- },
73
- label,
74
- /* @__PURE__ */ React.createElement(Button.Suffix, null, /* @__PURE__ */ React.createElement(OpenWithIcon, null))
74
+ ...intentButtonProps,
75
+ children: [
76
+ label,
77
+ /* @__PURE__ */ jsx(Button.Suffix, { children: /* @__PURE__ */ jsx(OpenWithIcon, {}) })
78
+ ]
79
+ }
75
80
  );
76
81
  });
77
82
  IntentButton.displayName = "IntentButton";
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/buttons/intent-button/IntentButton.tsx"],
4
- "sourcesContent": ["import React, { forwardRef, type ReactNode } from 'react';\nimport { useIntl } from 'react-intl';\n\nimport { OpenWithIcon } from '@dynatrace/strato-icons';\nimport { type IntentPayload } from '@dynatrace-sdk/navigation';\n\nimport { useIntentButton } from './useIntentButton.js';\nimport { type AriaLabelingProps } from '../../core/types/a11y-props.js';\nimport { type DataTestId } from '../../core/types/data-props.js';\nimport { type DOMProps } from '../../core/types/dom.js';\nimport { type MaskingProps } from '../../core/types/masking-props.js';\nimport { type StylingProps } from '../../core/types/styling-props.js';\nimport { Button, type ButtonOwnProps } from '../button/Button.js';\n\n//#region Typings\n/**\n * Accepted properties for the Button.\n * @public\n */\nexport interface IntentButtonPropsBase\n extends Omit<ButtonOwnProps, 'loading' | 'type'>,\n AriaLabelingProps,\n DOMProps,\n StylingProps,\n DataTestId,\n MaskingProps {\n /** Intent payload passed between apps.*/\n payload: IntentPayload;\n\n /** Intended for setting a custom button label. When nothing is set, no label is shown. */\n children?: ReactNode;\n}\n\n/**\n * Merge own props with ID props.\n * Props for recommending an app to receive the intent. Either both properties or none of them needs to be specified.\n * @public\n */\nexport type IntentButtonProps = IntentButtonPropsBase &\n (\n | {\n appId?: never;\n intentId?: never;\n }\n | {\n /**\n * ID of the app that will be launched to handle the intent.\n */\n appId: string;\n\n /**\n * ID of the action that will be passed to the app.\n */\n intentId: string;\n }\n );\n\n//#endregion\n\n/**\n * The `IntentButton` is a dedicated button component for sending\n * {@link https://developer.dynatrace.com/develop/intents/ | intents}.\n * It takes care of opening the intent dialog. An `IntentButton` only works\n * in the AppShell context.\n * @public\n */\nexport const IntentButton = /* @__PURE__ */ forwardRef<\n HTMLAnchorElement,\n IntentButtonProps\n>((props, forwardedRef) => {\n const intl = useIntl();\n const {\n children,\n payload,\n appId,\n intentId,\n disabled,\n onClick: onClickProp,\n 'aria-label': ariaLabelProp,\n className: consumerClassName,\n style: consumerStyle,\n 'data-testid': dataTestId,\n 'data-dtrum-mask': dataDtrumMask,\n 'data-dtrum-allow': dataDtrumAllow,\n // eslint-disable-next-line deprecation/deprecation\n readOnly,\n ...remainingProps\n }: IntentButtonProps = props;\n\n let label = children;\n if (typeof label === 'string') {\n label = label.trim();\n }\n\n const ariaLabel =\n ariaLabelProp ||\n intl.formatMessage({\n description: 'Intent button open label',\n defaultMessage: 'Open with',\n id: 'JQOGuaGgqJObmSY1',\n });\n\n const intentButtonProps = useIntentButton(\n payload,\n appId,\n intentId,\n onClickProp,\n );\n\n // polymorph it back to a button in case it's disabled.\n // Keep the button focusable if disabled for better screen reader support.\n if (disabled) {\n return (\n <Button\n disabled\n data-testid={dataTestId}\n data-dtrum-mask={dataDtrumMask}\n data-dtrum-allow={dataDtrumAllow}\n aria-label={ariaLabel}\n className={consumerClassName}\n style={consumerStyle}\n // eslint-disable-next-line deprecated-jsx-props/deprecated-props\n readOnly={readOnly}\n {...remainingProps}\n >\n {label}\n <Button.Suffix>\n <OpenWithIcon />\n </Button.Suffix>\n </Button>\n );\n }\n\n return (\n <Button\n as=\"a\"\n ref={forwardedRef}\n data-testid={dataTestId}\n data-dtrum-mask={dataDtrumMask}\n data-dtrum-allow={dataDtrumAllow}\n aria-label={ariaLabel ?? label}\n className={consumerClassName}\n style={consumerStyle}\n // eslint-disable-next-line deprecated-jsx-props/deprecated-props\n readOnly={readOnly}\n {...remainingProps}\n {...intentButtonProps}\n >\n {label}\n <Button.Suffix>\n <OpenWithIcon />\n </Button.Suffix>\n </Button>\n );\n});\n\n(IntentButton as typeof IntentButton & { displayName: string }).displayName =\n 'IntentButton';\n"],
5
- "mappings": "AAAA,OAAO,SAAS,kBAAkC;AAClD,SAAS,eAAe;AAExB,SAAS,oBAAoB;AAG7B,SAAS,uBAAuB;AAMhC,SAAS,cAAmC;AAsDrC,MAAM,eAA+B,2BAG1C,CAAC,OAAO,iBAAiB;AACzB,QAAM,OAAO,QAAQ;AACrB,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,SAAS;AAAA,IACT,cAAc;AAAA,IACd,WAAW;AAAA,IACX,OAAO;AAAA,IACP,eAAe;AAAA,IACf,mBAAmB;AAAA,IACnB,oBAAoB;AAAA;AAAA,IAEpB;AAAA,IACA,GAAG;AAAA,EACL,IAAuB;AAEvB,MAAI,QAAQ;AACZ,MAAI,OAAO,UAAU,UAAU;AAC7B,YAAQ,MAAM,KAAK;AAAA,EACrB;AAEA,QAAM,YACJ,iBACA,KAAK,cAAc;AAAA,IACjB,aAAa;AAAA,IACb,gBAAgB;AAAA,IAChB,IAAI;AAAA,EACN,CAAC;AAEH,QAAM,oBAAoB;AAAA,IACxB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AAIA,MAAI,UAAU;AACZ,WACE;AAAA,MAAC;AAAA;AAAA,QACC,UAAQ;AAAA,QACR,eAAa;AAAA,QACb,mBAAiB;AAAA,QACjB,oBAAkB;AAAA,QAClB,cAAY;AAAA,QACZ,WAAW;AAAA,QACX,OAAO;AAAA,QAEP;AAAA,QACC,GAAG;AAAA;AAAA,MAEH;AAAA,MACD,oCAAC,OAAO,QAAP,MACC,oCAAC,kBAAa,CAChB;AAAA,IACF;AAAA,EAEJ;AAEA,SACE;AAAA,IAAC;AAAA;AAAA,MACC,IAAG;AAAA,MACH,KAAK;AAAA,MACL,eAAa;AAAA,MACb,mBAAiB;AAAA,MACjB,oBAAkB;AAAA,MAClB,cAAY,aAAa;AAAA,MACzB,WAAW;AAAA,MACX,OAAO;AAAA,MAEP;AAAA,MACC,GAAG;AAAA,MACH,GAAG;AAAA;AAAA,IAEH;AAAA,IACD,oCAAC,OAAO,QAAP,MACC,oCAAC,kBAAa,CAChB;AAAA,EACF;AAEJ,CAAC;AAEA,aAA+D,cAC9D;",
4
+ "sourcesContent": ["import { forwardRef, type ReactNode } from 'react';\nimport { useIntl } from 'react-intl';\n\nimport { OpenWithIcon } from '@dynatrace/strato-icons';\nimport { type IntentPayload } from '@dynatrace-sdk/navigation';\n\nimport { useIntentButton } from './useIntentButton.js';\nimport { type AriaLabelingProps } from '../../core/types/a11y-props.js';\nimport { type DataTestId } from '../../core/types/data-props.js';\nimport { type DOMProps } from '../../core/types/dom.js';\nimport { type MaskingProps } from '../../core/types/masking-props.js';\nimport { type StylingProps } from '../../core/types/styling-props.js';\nimport { Button, type ButtonOwnProps } from '../button/Button.js';\n\n//#region Typings\n/**\n * Accepted properties for the Button.\n * @public\n */\nexport interface IntentButtonPropsBase\n extends Omit<ButtonOwnProps, 'loading' | 'type'>,\n AriaLabelingProps,\n DOMProps,\n StylingProps,\n DataTestId,\n MaskingProps {\n /** Intent payload passed between apps.*/\n payload: IntentPayload;\n\n /** Intended for setting a custom button label. When nothing is set, no label is shown. */\n children?: ReactNode;\n}\n\n/**\n * Merge own props with ID props.\n * Props for recommending an app to receive the intent. Either both properties or none of them needs to be specified.\n * @public\n */\nexport type IntentButtonProps = IntentButtonPropsBase &\n (\n | {\n appId?: never;\n intentId?: never;\n }\n | {\n /**\n * ID of the app that will be launched to handle the intent.\n */\n appId: string;\n\n /**\n * ID of the action that will be passed to the app.\n */\n intentId: string;\n }\n );\n\n//#endregion\n\n/**\n * The `IntentButton` is a dedicated button component for sending\n * {@link https://developer.dynatrace.com/develop/intents/ | intents}.\n * It takes care of opening the intent dialog. An `IntentButton` only works\n * in the AppShell context.\n * @public\n */\nexport const IntentButton = /* @__PURE__ */ forwardRef<\n HTMLAnchorElement,\n IntentButtonProps\n>((props, forwardedRef) => {\n const intl = useIntl();\n const {\n children,\n payload,\n appId,\n intentId,\n disabled,\n onClick: onClickProp,\n 'aria-label': ariaLabelProp,\n className: consumerClassName,\n style: consumerStyle,\n 'data-testid': dataTestId,\n 'data-dtrum-mask': dataDtrumMask,\n 'data-dtrum-allow': dataDtrumAllow,\n // eslint-disable-next-line deprecation/deprecation\n readOnly,\n ...remainingProps\n }: IntentButtonProps = props;\n\n let label = children;\n if (typeof label === 'string') {\n label = label.trim();\n }\n\n const ariaLabel =\n ariaLabelProp ||\n intl.formatMessage({\n description: 'Intent button open label',\n defaultMessage: 'Open with',\n id: 'JQOGuaGgqJObmSY1',\n });\n\n const intentButtonProps = useIntentButton(\n payload,\n appId,\n intentId,\n onClickProp,\n );\n\n // polymorph it back to a button in case it's disabled.\n // Keep the button focusable if disabled for better screen reader support.\n if (disabled) {\n return (\n <Button\n disabled\n data-testid={dataTestId}\n data-dtrum-mask={dataDtrumMask}\n data-dtrum-allow={dataDtrumAllow}\n aria-label={ariaLabel}\n className={consumerClassName}\n style={consumerStyle}\n // eslint-disable-next-line deprecated-jsx-props/deprecated-props\n readOnly={readOnly}\n {...remainingProps}\n >\n {label}\n <Button.Suffix>\n <OpenWithIcon />\n </Button.Suffix>\n </Button>\n );\n }\n\n return (\n <Button\n as=\"a\"\n ref={forwardedRef}\n data-testid={dataTestId}\n data-dtrum-mask={dataDtrumMask}\n data-dtrum-allow={dataDtrumAllow}\n aria-label={ariaLabel ?? label}\n className={consumerClassName}\n style={consumerStyle}\n // eslint-disable-next-line deprecated-jsx-props/deprecated-props\n readOnly={readOnly}\n {...remainingProps}\n {...intentButtonProps}\n >\n {label}\n <Button.Suffix>\n <OpenWithIcon />\n </Button.Suffix>\n </Button>\n );\n});\n\n(IntentButton as typeof IntentButton & { displayName: string }).displayName =\n 'IntentButton';\n"],
5
+ "mappings": "AAiHM,SAcI,KAdJ;AAjHN,SAAS,kBAAkC;AAC3C,SAAS,eAAe;AAExB,SAAS,oBAAoB;AAG7B,SAAS,uBAAuB;AAMhC,SAAS,cAAmC;AAsDrC,MAAM,eAA+B,2BAG1C,CAAC,OAAO,iBAAiB;AACzB,QAAM,OAAO,QAAQ;AACrB,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,SAAS;AAAA,IACT,cAAc;AAAA,IACd,WAAW;AAAA,IACX,OAAO;AAAA,IACP,eAAe;AAAA,IACf,mBAAmB;AAAA,IACnB,oBAAoB;AAAA;AAAA,IAEpB;AAAA,IACA,GAAG;AAAA,EACL,IAAuB;AAEvB,MAAI,QAAQ;AACZ,MAAI,OAAO,UAAU,UAAU;AAC7B,YAAQ,MAAM,KAAK;AAAA,EACrB;AAEA,QAAM,YACJ,iBACA,KAAK,cAAc;AAAA,IACjB,aAAa;AAAA,IACb,gBAAgB;AAAA,IAChB,IAAI;AAAA,EACN,CAAC;AAEH,QAAM,oBAAoB;AAAA,IACxB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AAIA,MAAI,UAAU;AACZ,WACE;AAAA,MAAC;AAAA;AAAA,QACC,UAAQ;AAAA,QACR,eAAa;AAAA,QACb,mBAAiB;AAAA,QACjB,oBAAkB;AAAA,QAClB,cAAY;AAAA,QACZ,WAAW;AAAA,QACX,OAAO;AAAA,QAEP;AAAA,QACC,GAAG;AAAA,QAEH;AAAA;AAAA,UACD,oBAAC,OAAO,QAAP,EACC,8BAAC,gBAAa,GAChB;AAAA;AAAA;AAAA,IACF;AAAA,EAEJ;AAEA,SACE;AAAA,IAAC;AAAA;AAAA,MACC,IAAG;AAAA,MACH,KAAK;AAAA,MACL,eAAa;AAAA,MACb,mBAAiB;AAAA,MACjB,oBAAkB;AAAA,MAClB,cAAY,aAAa;AAAA,MACzB,WAAW;AAAA,MACX,OAAO;AAAA,MAEP;AAAA,MACC,GAAG;AAAA,MACH,GAAG;AAAA,MAEH;AAAA;AAAA,QACD,oBAAC,OAAO,QAAP,EACC,8BAAC,gBAAa,GAChB;AAAA;AAAA;AAAA,EACF;AAEJ,CAAC;AAEA,aAA+D,cAC9D;",
6
6
  "names": []
7
7
  }
@@ -1,4 +1,7 @@
1
- import { useCallback, useMemo } from "react";
1
+ import {
2
+ useCallback,
3
+ useMemo
4
+ } from "react";
2
5
  import {
3
6
  getIntentLink,
4
7
  sendIntent
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/buttons/intent-button/useIntentButton.ts"],
4
- "sourcesContent": ["import { useCallback, useMemo } from 'react';\n\nimport {\n getIntentLink,\n type IntentPayload,\n sendIntent,\n} from '@dynatrace-sdk/navigation';\n\n/**\n * return shared intent button logic\n * @param payload - an intent payload\n * @returns intentLink and triggerIntent\n * @internal\n */\nexport function useIntentButton(\n payload: IntentPayload,\n appId?: string,\n intentId?: string,\n onClickProp?: React.MouseEventHandler,\n) {\n /**\n * Contains the url created via the getIntentLink SDK method.\n * @returns a url to be used\n */\n const href = useMemo(\n () =>\n // SDK documentation is invalid. appId & intentId are in fact mandatory.\n // This is why the ternary is necessary to ensure to call the correct signature.\n appId && intentId\n ? getIntentLink(payload, appId, intentId)\n : getIntentLink(payload),\n [appId, intentId, payload],\n );\n\n /**\n * Sends intent to shell.\n * @returns void\n */\n const triggerIntent = useCallback(() => {\n // SDK documentation is invalid. appId & intentId are in fact mandatory.\n // This is why the ternary is necessary to ensure to call the correct signature.\n appId && intentId\n ? sendIntent(payload, {\n recommendedAppId: appId,\n recommendedIntentId: intentId,\n })\n : sendIntent(payload);\n }, [appId, intentId, payload]);\n\n /**\n * Mouse event handler, send intent on left button click without using any modifiers.\n */\n const onClick = useCallback(\n (event: React.MouseEvent) => {\n onClickProp?.(event);\n if (event.isDefaultPrevented()) {\n // already handled\n return;\n }\n\n const nativeEvent = event.nativeEvent;\n\n if (\n nativeEvent.button !== 0 ||\n nativeEvent.metaKey ||\n nativeEvent.ctrlKey ||\n nativeEvent.shiftKey\n ) {\n return; // let the browser handle the event\n }\n\n event.preventDefault();\n triggerIntent();\n },\n [onClickProp, triggerIntent],\n );\n\n /**\n * KeyDown event handler, sent intent on Space and ENTER\n */\n const onKeyDown = useCallback(\n (event: React.KeyboardEvent) => {\n const nativeEvent = event.nativeEvent;\n\n if (nativeEvent.code !== 'Space' && nativeEvent.code !== 'Enter') {\n return; // let the browser handle the event\n }\n\n event.preventDefault();\n\n // open intent link in new tab while pressing ctrl/meta\n if (nativeEvent.metaKey || nativeEvent.ctrlKey) {\n window.open(href);\n return;\n }\n\n // open intent link in new window\n if (nativeEvent.shiftKey) {\n window.open(href, '_blank', 'menubar');\n return;\n }\n\n // let the shell handle the intent\n triggerIntent();\n },\n [href, triggerIntent],\n );\n\n return { href, onClick, onKeyDown };\n}\n"],
5
- "mappings": "AAAA,SAAS,aAAa,eAAe;AAErC;AAAA,EACE;AAAA,EAEA;AAAA,OACK;AAQA,SAAS,gBACd,SACA,OACA,UACA,aACA;AAKA,QAAM,OAAO;AAAA,IACX;AAAA;AAAA;AAAA,MAGE,SAAS,WACL,cAAc,SAAS,OAAO,QAAQ,IACtC,cAAc,OAAO;AAAA;AAAA,IAC3B,CAAC,OAAO,UAAU,OAAO;AAAA,EAC3B;AAMA,QAAM,gBAAgB,YAAY,MAAM;AAGtC,aAAS,WACL,WAAW,SAAS;AAAA,MAClB,kBAAkB;AAAA,MAClB,qBAAqB;AAAA,IACvB,CAAC,IACD,WAAW,OAAO;AAAA,EACxB,GAAG,CAAC,OAAO,UAAU,OAAO,CAAC;AAK7B,QAAM,UAAU;AAAA,IACd,CAAC,UAA4B;AAC3B,oBAAc,KAAK;AACnB,UAAI,MAAM,mBAAmB,GAAG;AAE9B;AAAA,MACF;AAEA,YAAM,cAAc,MAAM;AAE1B,UACE,YAAY,WAAW,KACvB,YAAY,WACZ,YAAY,WACZ,YAAY,UACZ;AACA;AAAA,MACF;AAEA,YAAM,eAAe;AACrB,oBAAc;AAAA,IAChB;AAAA,IACA,CAAC,aAAa,aAAa;AAAA,EAC7B;AAKA,QAAM,YAAY;AAAA,IAChB,CAAC,UAA+B;AAC9B,YAAM,cAAc,MAAM;AAE1B,UAAI,YAAY,SAAS,WAAW,YAAY,SAAS,SAAS;AAChE;AAAA,MACF;AAEA,YAAM,eAAe;AAGrB,UAAI,YAAY,WAAW,YAAY,SAAS;AAC9C,eAAO,KAAK,IAAI;AAChB;AAAA,MACF;AAGA,UAAI,YAAY,UAAU;AACxB,eAAO,KAAK,MAAM,UAAU,SAAS;AACrC;AAAA,MACF;AAGA,oBAAc;AAAA,IAChB;AAAA,IACA,CAAC,MAAM,aAAa;AAAA,EACtB;AAEA,SAAO,EAAE,MAAM,SAAS,UAAU;AACpC;",
4
+ "sourcesContent": ["import {\n useCallback,\n useMemo,\n type MouseEventHandler as ReactMouseEventHandler,\n type MouseEvent as ReactMouseEvent,\n type KeyboardEvent as ReactKeyboardEvent,\n} from 'react';\n\nimport {\n getIntentLink,\n type IntentPayload,\n sendIntent,\n} from '@dynatrace-sdk/navigation';\n\n/**\n * return shared intent button logic\n * @param payload - an intent payload\n * @returns intentLink and triggerIntent\n * @internal\n */\nexport function useIntentButton(\n payload: IntentPayload,\n appId?: string,\n intentId?: string,\n onClickProp?: ReactMouseEventHandler,\n) {\n /**\n * Contains the url created via the getIntentLink SDK method.\n * @returns a url to be used\n */\n const href = useMemo(\n () =>\n // SDK documentation is invalid. appId & intentId are in fact mandatory.\n // This is why the ternary is necessary to ensure to call the correct signature.\n appId && intentId\n ? getIntentLink(payload, appId, intentId)\n : getIntentLink(payload),\n [appId, intentId, payload],\n );\n\n /**\n * Sends intent to shell.\n * @returns void\n */\n const triggerIntent = useCallback(() => {\n // SDK documentation is invalid. appId & intentId are in fact mandatory.\n // This is why the ternary is necessary to ensure to call the correct signature.\n appId && intentId\n ? sendIntent(payload, {\n recommendedAppId: appId,\n recommendedIntentId: intentId,\n })\n : sendIntent(payload);\n }, [appId, intentId, payload]);\n\n /**\n * Mouse event handler, send intent on left button click without using any modifiers.\n */\n const onClick = useCallback(\n (event: ReactMouseEvent) => {\n onClickProp?.(event);\n if (event.isDefaultPrevented()) {\n // already handled\n return;\n }\n\n const nativeEvent = event.nativeEvent;\n\n if (\n nativeEvent.button !== 0 ||\n nativeEvent.metaKey ||\n nativeEvent.ctrlKey ||\n nativeEvent.shiftKey\n ) {\n return; // let the browser handle the event\n }\n\n event.preventDefault();\n triggerIntent();\n },\n [onClickProp, triggerIntent],\n );\n\n /**\n * KeyDown event handler, sent intent on Space and ENTER\n */\n const onKeyDown = useCallback(\n (event: ReactKeyboardEvent) => {\n const nativeEvent = event.nativeEvent;\n\n if (nativeEvent.code !== 'Space' && nativeEvent.code !== 'Enter') {\n return; // let the browser handle the event\n }\n\n event.preventDefault();\n\n // open intent link in new tab while pressing ctrl/meta\n if (nativeEvent.metaKey || nativeEvent.ctrlKey) {\n window.open(href);\n return;\n }\n\n // open intent link in new window\n if (nativeEvent.shiftKey) {\n window.open(href, '_blank', 'menubar');\n return;\n }\n\n // let the shell handle the intent\n triggerIntent();\n },\n [href, triggerIntent],\n );\n\n return { href, onClick, onKeyDown };\n}\n"],
5
+ "mappings": "AAAA;AAAA,EACE;AAAA,EACA;AAAA,OAIK;AAEP;AAAA,EACE;AAAA,EAEA;AAAA,OACK;AAQA,SAAS,gBACd,SACA,OACA,UACA,aACA;AAKA,QAAM,OAAO;AAAA,IACX;AAAA;AAAA;AAAA,MAGE,SAAS,WACL,cAAc,SAAS,OAAO,QAAQ,IACtC,cAAc,OAAO;AAAA;AAAA,IAC3B,CAAC,OAAO,UAAU,OAAO;AAAA,EAC3B;AAMA,QAAM,gBAAgB,YAAY,MAAM;AAGtC,aAAS,WACL,WAAW,SAAS;AAAA,MAClB,kBAAkB;AAAA,MAClB,qBAAqB;AAAA,IACvB,CAAC,IACD,WAAW,OAAO;AAAA,EACxB,GAAG,CAAC,OAAO,UAAU,OAAO,CAAC;AAK7B,QAAM,UAAU;AAAA,IACd,CAAC,UAA2B;AAC1B,oBAAc,KAAK;AACnB,UAAI,MAAM,mBAAmB,GAAG;AAE9B;AAAA,MACF;AAEA,YAAM,cAAc,MAAM;AAE1B,UACE,YAAY,WAAW,KACvB,YAAY,WACZ,YAAY,WACZ,YAAY,UACZ;AACA;AAAA,MACF;AAEA,YAAM,eAAe;AACrB,oBAAc;AAAA,IAChB;AAAA,IACA,CAAC,aAAa,aAAa;AAAA,EAC7B;AAKA,QAAM,YAAY;AAAA,IAChB,CAAC,UAA8B;AAC7B,YAAM,cAAc,MAAM;AAE1B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