@dynatrace/strato-components 0.85.0 → 0.85.21

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 (282) hide show
  1. package/README.md +1 -1
  2. package/buttons/button/Button.css +93 -0
  3. package/buttons/button/Button.d.ts +94 -0
  4. package/buttons/button/Button.js +258 -0
  5. package/buttons/button/Button.sty.d.ts +51 -0
  6. package/buttons/button/Button.sty.js +33 -0
  7. package/buttons/button/Label.d.ts +16 -0
  8. package/buttons/button/Label.js +60 -0
  9. package/buttons/button/Prefix.d.ts +16 -0
  10. package/buttons/button/Prefix.js +54 -0
  11. package/buttons/button/Suffix.d.ts +16 -0
  12. package/buttons/button/Suffix.js +56 -0
  13. package/buttons/button/types/button-aria.d.ts +37 -0
  14. package/buttons/button/types/button-aria.js +15 -0
  15. package/buttons/button/utils/focus-without-scrolling.d.ts +5 -0
  16. package/buttons/button/utils/focus-without-scrolling.js +77 -0
  17. package/buttons/button/utils/is-virtual-event.d.ts +10 -0
  18. package/buttons/button/utils/is-virtual-event.js +32 -0
  19. package/buttons/index.d.ts +10 -0
  20. package/buttons/index.js +30 -0
  21. package/buttons/intent-button/IntentButton.d.ts +44 -0
  22. package/buttons/intent-button/IntentButton.js +102 -0
  23. package/buttons/intent-button/useIntentButton.d.ts +12 -0
  24. package/buttons/intent-button/useIntentButton.js +72 -0
  25. package/content/index.d.ts +4 -0
  26. package/content/index.js +5 -1
  27. package/content/progress/ProgressBar.js +1 -2
  28. package/content/progress/ProgressCircle.js +1 -2
  29. package/content/skeleton/Skeleton.css +33 -0
  30. package/content/skeleton/Skeleton.d.ts +30 -0
  31. package/content/skeleton/Skeleton.js +60 -0
  32. package/content/skeleton/Skeleton.sty.d.ts +10 -0
  33. package/content/skeleton/Skeleton.sty.js +25 -0
  34. package/content/skeleton/SkeletonText.d.ts +24 -0
  35. package/content/skeleton/SkeletonText.js +84 -0
  36. package/esm/buttons/button/Button.css +93 -0
  37. package/esm/buttons/button/Button.js +233 -0
  38. package/esm/buttons/button/Button.js.map +7 -0
  39. package/esm/buttons/button/Button.sty.js +15 -0
  40. package/esm/buttons/button/Button.sty.js.map +7 -0
  41. package/esm/buttons/button/Label.js +32 -0
  42. package/esm/buttons/button/Label.js.map +7 -0
  43. package/esm/buttons/button/Prefix.js +26 -0
  44. package/esm/buttons/button/Prefix.js.map +7 -0
  45. package/esm/buttons/button/Suffix.js +28 -0
  46. package/esm/buttons/button/Suffix.js.map +7 -0
  47. package/esm/buttons/button/types/button-aria.js +1 -0
  48. package/esm/buttons/button/types/button-aria.js.map +7 -0
  49. package/esm/buttons/button/utils/focus-without-scrolling.js +59 -0
  50. package/esm/buttons/button/utils/focus-without-scrolling.js.map +7 -0
  51. package/esm/buttons/button/utils/is-virtual-event.js +14 -0
  52. package/esm/buttons/button/utils/is-virtual-event.js.map +7 -0
  53. package/esm/buttons/index.js +15 -0
  54. package/esm/buttons/index.js.map +7 -0
  55. package/esm/buttons/intent-button/IntentButton.js +74 -0
  56. package/esm/buttons/intent-button/IntentButton.js.map +7 -0
  57. package/esm/buttons/intent-button/useIntentButton.js +57 -0
  58. package/esm/buttons/intent-button/useIntentButton.js.map +7 -0
  59. package/esm/content/index.js +5 -1
  60. package/esm/content/index.js.map +2 -2
  61. package/esm/content/progress/ProgressBar.js +2 -3
  62. package/esm/content/progress/ProgressBar.js.map +2 -2
  63. package/esm/content/progress/ProgressCircle.js +2 -3
  64. package/esm/content/progress/ProgressCircle.js.map +2 -2
  65. package/esm/content/skeleton/Skeleton.css +33 -0
  66. package/esm/content/skeleton/Skeleton.js +32 -0
  67. package/esm/content/skeleton/Skeleton.js.map +7 -0
  68. package/esm/content/skeleton/Skeleton.sty.js +7 -0
  69. package/esm/content/skeleton/Skeleton.sty.js.map +7 -0
  70. package/esm/content/skeleton/SkeletonText.js +56 -0
  71. package/esm/content/skeleton/SkeletonText.js.map +7 -0
  72. package/esm/index.js +1 -0
  73. package/esm/index.js.map +2 -2
  74. package/esm/layouts/{Divider → divider}/Divider.css +5 -5
  75. package/esm/layouts/{Divider → divider}/Divider.js.map +1 -1
  76. package/esm/layouts/{Divider → divider}/Divider.sty.js +1 -1
  77. package/esm/layouts/{Divider → divider}/Divider.sty.js.map +2 -2
  78. package/esm/layouts/helpers/spacingToCss.js +13 -0
  79. package/esm/layouts/helpers/spacingToCss.js.map +7 -0
  80. package/esm/layouts/hooks/useLayoutSizeProps.js +15 -0
  81. package/esm/layouts/hooks/useLayoutSizeProps.js.map +7 -0
  82. package/esm/layouts/hooks/useLayoutStyles.js +105 -0
  83. package/esm/layouts/hooks/useLayoutStyles.js.map +7 -0
  84. package/esm/layouts/hooks/useMarginProps.js +55 -0
  85. package/esm/layouts/hooks/useMarginProps.js.map +7 -0
  86. package/esm/layouts/hooks/usePaddingProps.js +59 -0
  87. package/esm/layouts/hooks/usePaddingProps.js.map +7 -0
  88. package/esm/layouts/index.js +6 -2
  89. package/esm/layouts/index.js.map +2 -2
  90. package/esm/layouts/surface/Surface.css +95 -0
  91. package/esm/layouts/surface/Surface.js +84 -0
  92. package/esm/layouts/surface/Surface.js.map +7 -0
  93. package/esm/layouts/surface/Surface.sty.js +10 -0
  94. package/esm/layouts/surface/Surface.sty.js.map +7 -0
  95. package/esm/layouts/surface/variables.sty.js +5 -0
  96. package/esm/layouts/surface/variables.sty.js.map +7 -0
  97. package/esm/layouts/types/layout.types.js +1 -0
  98. package/esm/layouts/types/layout.types.js.map +7 -0
  99. package/esm/styles/field.css +208 -0
  100. package/esm/styles/field.sty.js +9 -0
  101. package/esm/styles/field.sty.js.map +7 -0
  102. package/esm/typography/{BlockQuote → block-quote}/Blockquote.css +2 -2
  103. package/esm/typography/{BlockQuote → block-quote}/Blockquote.js.map +2 -2
  104. package/esm/typography/{BlockQuote → block-quote}/Blockquote.sty.js +1 -1
  105. package/esm/typography/{BlockQuote → block-quote}/Blockquote.sty.js.map +2 -2
  106. package/{typography/Code → esm/typography/code}/Code.css +1 -1
  107. package/esm/typography/code/Code.js.map +7 -0
  108. package/esm/typography/{Code → code}/Code.sty.js +1 -1
  109. package/esm/typography/{Code → code}/Code.sty.js.map +2 -2
  110. package/esm/typography/{Emphasis → emphasis}/Emphasis.css +1 -1
  111. package/esm/typography/{Emphasis → emphasis}/Emphasis.js.map +2 -2
  112. package/esm/typography/{Emphasis → emphasis}/Emphasis.sty.js +1 -1
  113. package/esm/typography/{Emphasis → emphasis}/Emphasis.sty.js.map +2 -2
  114. package/{typography/ExternalLink → esm/typography/external-link}/ExternalLink.css +6 -6
  115. package/esm/typography/external-link/ExternalLink.js.map +7 -0
  116. package/esm/typography/{ExternalLink → external-link}/ExternalLink.sty.js +1 -1
  117. package/esm/typography/{ExternalLink → external-link}/ExternalLink.sty.js.map +2 -2
  118. package/esm/typography/{Heading → heading}/Heading.css +7 -7
  119. package/esm/typography/heading/Heading.js.map +7 -0
  120. package/esm/typography/heading/Heading.sty.js +7 -0
  121. package/esm/typography/{Heading → heading}/Heading.sty.js.map +2 -2
  122. package/esm/typography/{Highlight → highlight}/Highlight.css +1 -1
  123. package/esm/typography/{Highlight → highlight}/Highlight.js.map +2 -2
  124. package/esm/typography/{Highlight → highlight}/Highlight.sty.js +1 -1
  125. package/esm/typography/{Highlight → highlight}/Highlight.sty.js.map +2 -2
  126. package/esm/typography/index.js +13 -13
  127. package/esm/typography/index.js.map +1 -1
  128. package/{typography/Link → esm/typography/link}/Link.css +4 -4
  129. package/esm/typography/{Link → link}/Link.js +1 -1
  130. package/esm/typography/link/Link.js.map +7 -0
  131. package/esm/typography/{Link → link}/Link.sty.js +1 -1
  132. package/esm/typography/{Link → link}/Link.sty.js.map +2 -2
  133. package/esm/typography/{List → list}/List.css +4 -4
  134. package/esm/typography/{List → list}/List.js +1 -1
  135. package/esm/typography/{List → list}/List.js.map +2 -2
  136. package/esm/typography/{List → list}/List.sty.js +2 -2
  137. package/esm/typography/{List → list}/List.sty.js.map +2 -2
  138. package/esm/typography/{Paragraph → paragraph}/Paragraph.css +3 -3
  139. package/esm/typography/{Paragraph → paragraph}/Paragraph.js.map +2 -2
  140. package/esm/typography/{Paragraph → paragraph}/Paragraph.sty.js +1 -1
  141. package/esm/typography/{Paragraph → paragraph}/Paragraph.sty.js.map +2 -2
  142. package/{typography/Strikethrough → esm/typography/strikethrough}/Strikethrough.css +1 -1
  143. package/esm/typography/strikethrough/Strikethrough.js.map +7 -0
  144. package/esm/typography/{Strikethrough → strikethrough}/Strikethrough.sty.js +1 -1
  145. package/esm/typography/{Strikethrough → strikethrough}/Strikethrough.sty.js.map +2 -2
  146. package/{typography/Strong → esm/typography/strong}/Strong.css +1 -1
  147. package/esm/typography/{Strong → strong}/Strong.js.map +2 -2
  148. package/esm/typography/{Strong → strong}/Strong.sty.js +1 -1
  149. package/esm/typography/{Strong → strong}/Strong.sty.js.map +2 -2
  150. package/{typography/Text → esm/typography/text}/Text.css +3 -3
  151. package/esm/typography/text/Text.js.map +7 -0
  152. package/esm/typography/{Text → text}/Text.sty.js +1 -1
  153. package/esm/typography/{Text → text}/Text.sty.js.map +2 -2
  154. package/{typography/TextEllipsis → esm/typography/text-ellipsis}/TextEllipsis.css +4 -4
  155. package/esm/typography/text-ellipsis/TextEllipsis.js.map +7 -0
  156. package/esm/typography/text-ellipsis/TextEllipsis.sty.js +7 -0
  157. package/esm/typography/{TextEllipsis → text-ellipsis}/TextEllipsis.sty.js.map +2 -2
  158. package/index.d.ts +1 -0
  159. package/index.js +1 -0
  160. package/lang/en.json +12 -0
  161. package/lang/ja.json +24 -0
  162. package/lang/uncompiled/en.json +8 -0
  163. package/lang/uncompiled/ja.json +14 -1
  164. package/layouts/{Divider → divider}/Divider.css +5 -5
  165. package/layouts/{Divider → divider}/Divider.sty.js +1 -1
  166. package/layouts/helpers/spacingToCss.d.ts +6 -0
  167. package/layouts/helpers/spacingToCss.js +29 -0
  168. package/layouts/hooks/useLayoutSizeProps.d.ts +6 -0
  169. package/layouts/hooks/useLayoutSizeProps.js +33 -0
  170. package/layouts/hooks/useLayoutStyles.d.ts +7 -0
  171. package/layouts/hooks/useLayoutStyles.js +123 -0
  172. package/layouts/hooks/useMarginProps.d.ts +7 -0
  173. package/layouts/hooks/useMarginProps.js +73 -0
  174. package/layouts/hooks/usePaddingProps.d.ts +7 -0
  175. package/layouts/hooks/usePaddingProps.js +77 -0
  176. package/layouts/index.d.ts +6 -2
  177. package/layouts/index.js +6 -2
  178. package/layouts/surface/Surface.css +95 -0
  179. package/layouts/surface/Surface.d.ts +46 -0
  180. package/layouts/surface/Surface.js +110 -0
  181. package/layouts/surface/Surface.sty.d.ts +43 -0
  182. package/layouts/surface/Surface.sty.js +28 -0
  183. package/layouts/surface/variables.sty.d.ts +1 -0
  184. package/layouts/surface/variables.sty.js +23 -0
  185. package/layouts/types/layout.types.d.ts +64 -0
  186. package/layouts/types/layout.types.js +15 -0
  187. package/package.json +11 -4
  188. package/styles/field.css +208 -0
  189. package/styles/field.sty.d.ts +102 -0
  190. package/styles/field.sty.js +27 -0
  191. package/styles/sprinkles.sty.d.ts +107 -107
  192. package/typography/{BlockQuote → block-quote}/Blockquote.css +2 -2
  193. package/typography/{BlockQuote → block-quote}/Blockquote.sty.js +1 -1
  194. package/{esm/typography/Code → typography/code}/Code.css +1 -1
  195. package/typography/{Code → code}/Code.d.ts +2 -2
  196. package/typography/{Code → code}/Code.sty.js +1 -1
  197. package/typography/{Emphasis → emphasis}/Emphasis.css +1 -1
  198. package/typography/{Emphasis → emphasis}/Emphasis.sty.js +1 -1
  199. package/{esm/typography/ExternalLink → typography/external-link}/ExternalLink.css +6 -6
  200. package/typography/{ExternalLink → external-link}/ExternalLink.d.ts +2 -2
  201. package/typography/{ExternalLink → external-link}/ExternalLink.sty.js +1 -1
  202. package/typography/{Heading → heading}/Heading.css +7 -7
  203. package/typography/{Heading → heading}/Heading.d.ts +3 -2
  204. package/typography/{Heading → heading}/Heading.sty.js +1 -1
  205. package/typography/{Highlight → highlight}/Highlight.css +1 -1
  206. package/typography/{Highlight → highlight}/Highlight.sty.js +1 -1
  207. package/typography/index.d.ts +26 -26
  208. package/typography/index.js +13 -13
  209. package/{esm/typography/Link → typography/link}/Link.css +4 -4
  210. package/typography/{Link → link}/Link.d.ts +2 -2
  211. package/typography/{Link → link}/Link.js +1 -1
  212. package/typography/{Link → link}/Link.sty.js +1 -1
  213. package/typography/{List → list}/List.css +4 -4
  214. package/typography/{List → list}/List.js +1 -1
  215. package/typography/{List → list}/List.sty.js +2 -2
  216. package/typography/{Paragraph → paragraph}/Paragraph.css +3 -3
  217. package/typography/{Paragraph → paragraph}/Paragraph.sty.js +1 -1
  218. package/{esm/typography/Strikethrough → typography/strikethrough}/Strikethrough.css +1 -1
  219. package/typography/{Strikethrough → strikethrough}/Strikethrough.d.ts +2 -2
  220. package/typography/{Strikethrough → strikethrough}/Strikethrough.sty.js +1 -1
  221. package/{esm/typography/Strong → typography/strong}/Strong.css +1 -1
  222. package/typography/{Strong → strong}/Strong.sty.js +1 -1
  223. package/{esm/typography/Text → typography/text}/Text.css +3 -3
  224. package/typography/{Text → text}/Text.d.ts +3 -2
  225. package/typography/{Text → text}/Text.sty.js +1 -1
  226. package/{esm/typography/TextEllipsis → typography/text-ellipsis}/TextEllipsis.css +4 -4
  227. package/typography/{TextEllipsis → text-ellipsis}/TextEllipsis.d.ts +3 -3
  228. package/typography/{TextEllipsis → text-ellipsis}/TextEllipsis.sty.js +1 -1
  229. package/esm/typography/Code/Code.js.map +0 -7
  230. package/esm/typography/ExternalLink/ExternalLink.js.map +0 -7
  231. package/esm/typography/Heading/Heading.js.map +0 -7
  232. package/esm/typography/Heading/Heading.sty.js +0 -7
  233. package/esm/typography/Link/Link.js.map +0 -7
  234. package/esm/typography/Strikethrough/Strikethrough.js.map +0 -7
  235. package/esm/typography/Text/Text.js.map +0 -7
  236. package/esm/typography/TextEllipsis/TextEllipsis.js.map +0 -7
  237. package/esm/typography/TextEllipsis/TextEllipsis.sty.js +0 -7
  238. package/esm/layouts/{Divider → divider}/Divider.js +0 -0
  239. package/esm/typography/{BlockQuote → block-quote}/Blockquote.js +0 -0
  240. package/esm/typography/{Code → code}/Code.js +0 -0
  241. package/esm/typography/{Emphasis → emphasis}/Emphasis.js +0 -0
  242. package/esm/typography/{ExternalLink → external-link}/ExternalLink.js +0 -0
  243. package/esm/typography/{Heading → heading}/Heading.js +0 -0
  244. package/esm/typography/{Highlight → highlight}/Highlight.js +0 -0
  245. package/esm/typography/{Paragraph → paragraph}/Paragraph.js +0 -0
  246. package/esm/typography/{Strikethrough → strikethrough}/Strikethrough.js +0 -0
  247. package/esm/typography/{Strong → strong}/Strong.js +0 -0
  248. package/esm/typography/{Text → text}/Text.js +0 -0
  249. package/esm/typography/{TextEllipsis → text-ellipsis}/TextEllipsis.js +0 -0
  250. package/layouts/{Divider → divider}/Divider.d.ts +0 -0
  251. package/layouts/{Divider → divider}/Divider.js +0 -0
  252. package/layouts/{Divider → divider}/Divider.sty.d.ts +0 -0
  253. package/typography/{BlockQuote → block-quote}/Blockquote.d.ts +1 -1
  254. package/typography/{BlockQuote → block-quote}/Blockquote.js +0 -0
  255. package/typography/{BlockQuote → block-quote}/Blockquote.sty.d.ts +0 -0
  256. package/typography/{Code → code}/Code.js +0 -0
  257. package/typography/{Code → code}/Code.sty.d.ts +0 -0
  258. package/typography/{Emphasis → emphasis}/Emphasis.d.ts +1 -1
  259. package/typography/{Emphasis → emphasis}/Emphasis.js +0 -0
  260. package/typography/{Emphasis → emphasis}/Emphasis.sty.d.ts +0 -0
  261. package/typography/{ExternalLink → external-link}/ExternalLink.js +0 -0
  262. package/typography/{ExternalLink → external-link}/ExternalLink.sty.d.ts +0 -0
  263. package/typography/{Heading → heading}/Heading.js +0 -0
  264. package/typography/{Heading → heading}/Heading.sty.d.ts +0 -0
  265. package/typography/{Highlight → highlight}/Highlight.d.ts +1 -1
  266. package/typography/{Highlight → highlight}/Highlight.js +0 -0
  267. package/typography/{Highlight → highlight}/Highlight.sty.d.ts +0 -0
  268. package/typography/{Link → link}/Link.sty.d.ts +0 -0
  269. package/typography/{List → list}/List.d.ts +1 -1
  270. package/typography/{List → list}/List.sty.d.ts +0 -0
  271. package/typography/{Paragraph → paragraph}/Paragraph.d.ts +1 -1
  272. package/typography/{Paragraph → paragraph}/Paragraph.js +0 -0
  273. package/typography/{Paragraph → paragraph}/Paragraph.sty.d.ts +0 -0
  274. package/typography/{Strikethrough → strikethrough}/Strikethrough.js +0 -0
  275. package/typography/{Strikethrough → strikethrough}/Strikethrough.sty.d.ts +0 -0
  276. package/typography/{Strong → strong}/Strong.d.ts +1 -1
  277. /package/typography/{Strong → strong}/Strong.js +0 -0
  278. /package/typography/{Strong → strong}/Strong.sty.d.ts +0 -0
  279. /package/typography/{Text → text}/Text.js +0 -0
  280. /package/typography/{Text → text}/Text.sty.d.ts +0 -0
  281. /package/typography/{TextEllipsis → text-ellipsis}/TextEllipsis.js +0 -0
  282. /package/typography/{TextEllipsis → text-ellipsis}/TextEllipsis.sty.d.ts +0 -0
@@ -0,0 +1,33 @@
1
+ @keyframes Skeleton_skeletonAnimationKeyframes__1a1ozfd0 {
2
+ 0% {
3
+ transform: translateX(-100%) scaleX(0);
4
+ }
5
+ 100% {
6
+ transform: translateX(100%) scaleX(1.5);
7
+ }
8
+ }
9
+ .Skeleton_skeletonPlaceholderCSS__1a1ozfd1 {
10
+ position: relative;
11
+ overflow: hidden;
12
+ background-color: var(--dt-colors-background-field-neutral-disabled, #dadbe780);
13
+ }
14
+ .Skeleton_skeletonPlaceholderCSS__1a1ozfd1:after {
15
+ content: "";
16
+ position: absolute;
17
+ top: 0;
18
+ left: 0;
19
+ width: 100%;
20
+ height: 100%;
21
+ background-color: var(--dt-colors-background-field-neutral-disabled, #dadbe780);
22
+ animation-iteration-count: infinite;
23
+ transform-origin: left center;
24
+ animation-name: Skeleton_skeletonAnimationKeyframes__1a1ozfd0;
25
+ animation-duration: var(--dt-timings-slow-gentle, 800ms);
26
+ animation-timing-function: var(--dt-easings-fast-in-slow-out, cubic-bezier(0.4, 0, 0.2, 1));
27
+ }
28
+ .Skeleton_skeletonPlaceholderCSS_variant_default__1a1ozfd2 {
29
+ border-radius: var(--dt-borders-radius-container-subdued, 8px);
30
+ }
31
+ .Skeleton_skeletonPlaceholderCSS_variant_rounded__1a1ozfd3 {
32
+ border-radius: 9999px;
33
+ }
@@ -0,0 +1,30 @@
1
+ import React, { CSSProperties } from 'react';
2
+ import { type DataTestId } from '../../core/types/data-props.js';
3
+ import { type StylingProps } from '../../core/types/styling-props.js';
4
+ import { type WithChildren } from '../../core/types/with-children.js';
5
+ /**
6
+ * Accepted properties for Skeleton
7
+ * @public
8
+ */
9
+ export interface SkeletonProps extends WithChildren, StylingProps, DataTestId {
10
+ /**
11
+ * Defines the shape of the Skeleton.
12
+ * @defaultValue 'default'
13
+ */
14
+ variant?: 'default' | 'rounded';
15
+ /**
16
+ * Width of the Skeleton placeholder.
17
+ * @defaultValue 100%
18
+ */
19
+ width?: CSSProperties['width'];
20
+ /**
21
+ * Height of the Skeleton placeholder.
22
+ * @defaultValue 100%
23
+ */
24
+ height?: CSSProperties['height'];
25
+ }
26
+ /**
27
+ * The `Skeleton` component renders a colored block with an animated background, indicating that something is loading.
28
+ * @public
29
+ */
30
+ export declare const Skeleton: (props: SkeletonProps & React.RefAttributes<HTMLDivElement>) => React.ReactElement<any, string | React.JSXElementConstructor<any>> | null;
@@ -0,0 +1,60 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
24
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
+ mod
26
+ ));
27
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
+ var Skeleton_exports = {};
29
+ __export(Skeleton_exports, {
30
+ Skeleton: () => Skeleton
31
+ });
32
+ module.exports = __toCommonJS(Skeleton_exports);
33
+ var import_clsx = __toESM(require("clsx"));
34
+ var import_react = __toESM(require("react"));
35
+ var import_Skeleton_css = require("./Skeleton.sty.js");
36
+ const Skeleton = (0, import_react.forwardRef)(
37
+ (props, forwardedRef) => {
38
+ const {
39
+ children,
40
+ variant = "default",
41
+ width = "100%",
42
+ height = "100%",
43
+ className: consumerClassName,
44
+ style: consumerStyle,
45
+ "data-testid": dataTestId,
46
+ ...remainingProps
47
+ } = props;
48
+ return /* @__PURE__ */ import_react.default.createElement(
49
+ "div",
50
+ {
51
+ "data-testid": dataTestId,
52
+ ref: forwardedRef,
53
+ className: (0, import_clsx.default)((0, import_Skeleton_css.skeletonPlaceholderCSS)({ variant }), consumerClassName),
54
+ style: { width, height, ...consumerStyle },
55
+ ...remainingProps
56
+ },
57
+ children
58
+ );
59
+ }
60
+ );
@@ -0,0 +1,10 @@
1
+ export declare const skeletonPlaceholderCSS: import("@vanilla-extract/recipes").RuntimeFn<{
2
+ variant: {
3
+ default: {
4
+ borderRadius: string;
5
+ };
6
+ rounded: {
7
+ borderRadius: "9999px";
8
+ };
9
+ };
10
+ }>;
@@ -0,0 +1,25 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+ var Skeleton_css_exports = {};
19
+ __export(Skeleton_css_exports, {
20
+ skeletonPlaceholderCSS: () => skeletonPlaceholderCSS
21
+ });
22
+ module.exports = __toCommonJS(Skeleton_css_exports);
23
+ var import_Skeleton_css_ts_vanilla = require("./Skeleton.css");
24
+ var import_createRuntimeFn = require("@vanilla-extract/recipes/createRuntimeFn");
25
+ var skeletonPlaceholderCSS = (0, import_createRuntimeFn.createRuntimeFn)({ defaultClassName: "Skeleton_skeletonPlaceholderCSS__1a1ozfd1", variantClassNames: { variant: { "default": "Skeleton_skeletonPlaceholderCSS_variant_default__1a1ozfd2", rounded: "Skeleton_skeletonPlaceholderCSS_variant_rounded__1a1ozfd3" } }, defaultVariants: {}, compoundVariants: [] });
@@ -0,0 +1,24 @@
1
+ import React, { type CSSProperties } from 'react';
2
+ import { type DataTestId } from '../../core/types/data-props.js';
3
+ import { type StylingProps } from '../../core/types/styling-props.js';
4
+ /**
5
+ * Accepted properties for SkeletonText
6
+ * @public
7
+ */
8
+ export interface SkeletonTextProps extends StylingProps, DataTestId {
9
+ /**
10
+ * Width of the SkeletonText placeholder.
11
+ * @defaultValue 100%
12
+ */
13
+ width?: CSSProperties['width'];
14
+ /**
15
+ * Number of Lines of the SkeletonText placeholder.
16
+ * @defaultValue 3
17
+ */
18
+ lines?: number;
19
+ }
20
+ /**
21
+ * The `SkeletonText` component renders a specified number of placeholder boxes for lines of text with an animated background.
22
+ * @public
23
+ */
24
+ export declare const SkeletonText: (props: SkeletonTextProps & React.RefAttributes<HTMLDivElement>) => React.ReactElement<any, string | React.JSXElementConstructor<any>> | null;
@@ -0,0 +1,84 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
24
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
+ mod
26
+ ));
27
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
+ var SkeletonText_exports = {};
29
+ __export(SkeletonText_exports, {
30
+ SkeletonText: () => SkeletonText
31
+ });
32
+ module.exports = __toCommonJS(SkeletonText_exports);
33
+ var import_react = __toESM(require("react"));
34
+ var import_Skeleton = require("./Skeleton.js");
35
+ var import_Flex = require("../../layouts/flex/Flex.js");
36
+ const SkeletonText = (0, import_react.forwardRef)(
37
+ (props, forwardedRef) => {
38
+ const {
39
+ width = "100%",
40
+ lines = 3,
41
+ className: consumerClassName,
42
+ style: consumerStyle,
43
+ "data-testid": dataTestId,
44
+ ...remainingProps
45
+ } = props;
46
+ const getSkeletonLinesMargin = (line, lines2) => {
47
+ if (lines2 === 1) {
48
+ return 0;
49
+ }
50
+ return (line + 2) % 3 * 12;
51
+ };
52
+ const getSkeletonLines = (lines2) => {
53
+ const render = [];
54
+ for (let line = 0; line < lines2; line++) {
55
+ const width2 = `calc(100% - ${getSkeletonLinesMargin(line, lines2)}px)`;
56
+ render.push(
57
+ /* @__PURE__ */ import_react.default.createElement(
58
+ import_Skeleton.Skeleton,
59
+ {
60
+ key: `${lines2}-${line}`,
61
+ width: width2,
62
+ height: "12px"
63
+ }
64
+ )
65
+ );
66
+ }
67
+ return render;
68
+ };
69
+ return /* @__PURE__ */ import_react.default.createElement(
70
+ import_Flex.Flex,
71
+ {
72
+ "data-testid": dataTestId,
73
+ ref: forwardedRef,
74
+ flexDirection: "column",
75
+ gap: 8,
76
+ paddingY: 4,
77
+ className: consumerClassName,
78
+ style: { width, ...consumerStyle },
79
+ ...remainingProps
80
+ },
81
+ getSkeletonLines(lines)
82
+ );
83
+ }
84
+ );
@@ -0,0 +1,93 @@
1
+ .Button_buttonCSS__10kgnsa0 {
2
+ font-family: var(--dt-typography-text-base-default-family, DynatraceFlow,Roboto,Helvetica,sans-serif);
3
+ font-weight: var(--dt-typography-text-base-emphasized-weight, 500);
4
+ font-size: var(--dt-typography-text-base-default-size, 14px);
5
+ line-height: var(--dt-typography-text-base-default-line-height, 1.4285714286);
6
+ text-decoration: var(--dt-typography-text-base-default-text-decoration, none);
7
+ text-transform: none;
8
+ background: var(--vars_background__bx32h3);
9
+ color: var(--vars_text__bx32h0);
10
+ display: inline-flex;
11
+ position: relative;
12
+ align-items: center;
13
+ flex-direction: row;
14
+ max-width: 100%;
15
+ height: max-content;
16
+ cursor: pointer;
17
+ box-sizing: border-box;
18
+ border-color: transparent;
19
+ border-style: solid;
20
+ border-width: 0;
21
+ border-radius: var(--dt-borders-radius-field-default, 8px);
22
+ transition-timing-function: var(--dt-animations-fade-out-easing, cubic-bezier(0, 0, 0.2, 1));
23
+ transition-duration: var(--dt-animations-fade-out-duration-base, 250ms);
24
+ transition-property: color, background-color, transform;
25
+ }
26
+ .Button_buttonCSS__10kgnsa0:hover {
27
+ transition-timing-function: var(--dt-animations-fade-in-easing, cubic-bezier(0.5, 0, 1, 1));
28
+ transition-duration: var(--dt-animations-fade-in-duration-base, 250ms);
29
+ }
30
+ .Button_buttonCSS_textAlign_start__10kgnsa1 {
31
+ text-align: start;
32
+ justify-content: space-between;
33
+ }
34
+ .Button_buttonCSS_textAlign_center__10kgnsa2 {
35
+ text-align: center;
36
+ justify-content: center;
37
+ }
38
+ .Button_buttonCSS_size_condensed__10kgnsa3 {
39
+ padding-top: var(--dt-spacings-size-2, 2px);
40
+ padding-bottom: var(--dt-spacings-size-2, 2px);
41
+ padding-left: var(--dt-spacings-size-4, 4px);
42
+ padding-right: var(--dt-spacings-size-4, 4px);
43
+ gap: var(--dt-spacings-size-2, 2px);
44
+ }
45
+ .Button_buttonCSS_size_default__10kgnsa4 {
46
+ padding-top: var(--dt-spacings-size-6, 6px);
47
+ padding-bottom: var(--dt-spacings-size-6, 6px);
48
+ padding-left: var(--dt-spacings-size-8, 8px);
49
+ padding-right: var(--dt-spacings-size-8, 8px);
50
+ gap: var(--dt-spacings-size-4, 4px);
51
+ }
52
+ .Button_buttonCSS_disabled_true__10kgnsa5 {
53
+ cursor: not-allowed;
54
+ }
55
+ .Button_buttonCSS_readOnly_true__10kgnsa6 {
56
+ cursor: not-allowed;
57
+ background: var(--vars_backgroundStatic__bx32h2);
58
+ }
59
+ .Button_buttonWidthsCSS_full__10kgnsa7 {
60
+ width: 100%;
61
+ }
62
+ .Button_buttonWidthsCSS_content__10kgnsa8 {
63
+ width: fit-content;
64
+ }
65
+ .Button_buttonLoadingCSS__10kgnsa9 {
66
+ position: absolute;
67
+ top: 0;
68
+ left: 0;
69
+ width: 100%;
70
+ height: 100%;
71
+ border-radius: var(--dt-borders-radius-field-default, 8px);
72
+ display: flex;
73
+ justify-content: center;
74
+ align-items: center;
75
+ z-index: 1;
76
+ }
77
+ .Button_buttonCSS_size_condensed__10kgnsa3 .Button_buttonLabelCSS__10kgnsaa:not(:has(svg:only-child)) {
78
+ padding-top: 0;
79
+ padding-bottom: 0;
80
+ padding-left: 2px;
81
+ padding-right: 2px;
82
+ }
83
+ .Button_buttonCSS_size_default__10kgnsa4 .Button_buttonLabelCSS__10kgnsaa:not(:has(svg:only-child)) {
84
+ padding-top: 0;
85
+ padding-bottom: 0;
86
+ padding-left: 4px;
87
+ padding-right: 4px;
88
+ }
89
+ .Button_buttonLabelCSS_textual_false__10kgnsac {
90
+ display: inline-flex;
91
+ min-width: 0;
92
+ max-width: 100%;
93
+ }
@@ -0,0 +1,233 @@
1
+ import clsx from "clsx";
2
+ import React, {
3
+ forwardRef,
4
+ useMemo
5
+ } from "react";
6
+ import { useIntl } from "react-intl";
7
+ import { isElement } from "react-is";
8
+ import { buttonCSS, buttonLoadingCSS, buttonWidthsCSS } from "./Button.sty.js";
9
+ import { Label } from "./Label.js";
10
+ import { Prefix } from "./Prefix.js";
11
+ import { Suffix } from "./Suffix.js";
12
+ import { ProgressCircle } from "../../content/progress/ProgressCircle.js";
13
+ import { useAriaLabelingProps } from "../../core/hooks/useAriaLabelingProps.js";
14
+ import { useFocusRing } from "../../core/styles/useFocusRing.js";
15
+ import { mergeProps } from "../../core/utils/merge-props.js";
16
+ import { Flex } from "../../layouts/flex/Flex.js";
17
+ import { Grid } from "../../layouts/grid/Grid.js";
18
+ import { fieldColorsCSS } from "../../styles/field.sty.js";
19
+ function getButtonSlots(children) {
20
+ const slots = {};
21
+ React.Children.forEach(children, (child) => {
22
+ if (isElement(child)) {
23
+ switch (child.type) {
24
+ case Suffix:
25
+ slots.suffix = child;
26
+ break;
27
+ case Prefix:
28
+ slots.prefix = child;
29
+ break;
30
+ case Label:
31
+ slots.label = child;
32
+ break;
33
+ default:
34
+ slots.freeform ??= [];
35
+ slots.freeform.push(child);
36
+ break;
37
+ }
38
+ } else {
39
+ if (child) {
40
+ slots.freeform ??= [];
41
+ slots.freeform.push(child);
42
+ }
43
+ }
44
+ });
45
+ return slots;
46
+ }
47
+ const _Button = /* @__PURE__ */ forwardRef(
48
+ (props, ref) => {
49
+ const {
50
+ children,
51
+ variant = "default",
52
+ disabled,
53
+ "aria-disabled": ariaDisabledProp,
54
+ required,
55
+ id: propId,
56
+ type = "button",
57
+ onClick,
58
+ ariaLabel,
59
+ width = "content",
60
+ color = "neutral",
61
+ textAlign = "center",
62
+ size = "default",
63
+ loading = false,
64
+ className: consumerClassName,
65
+ style: consumerStyle,
66
+ "data-testid": dataTestId,
67
+ "data-dtrum-mask": dataDtrumMask,
68
+ "data-dtrum-allow": dataDtrumAllow,
69
+ readOnly,
70
+ as,
71
+ ...remainingProps
72
+ } = props;
73
+ const slots = getButtonSlots(children);
74
+ const ariaDisabled = ariaDisabledProp === true || ariaDisabledProp === "true";
75
+ const nativeDisabledOrLoading = useMemo(
76
+ () => loading ? true : disabled,
77
+ [disabled, loading]
78
+ );
79
+ const disabledOrLoading = useMemo(
80
+ () => nativeDisabledOrLoading || ariaDisabled,
81
+ [ariaDisabled, nativeDisabledOrLoading]
82
+ );
83
+ const { focusProps, focusClassName } = useFocusRing({
84
+ variant: !disabledOrLoading ? color : "neutral",
85
+ disabled: nativeDisabledOrLoading
86
+ });
87
+ const ariaLabelingProps = useAriaLabelingProps(remainingProps);
88
+ const handleButtonClick = (event) => {
89
+ if (nativeDisabledOrLoading) {
90
+ event.preventDefault();
91
+ event.stopPropagation();
92
+ return;
93
+ }
94
+ onClick?.(event);
95
+ };
96
+ const buttonProps = {
97
+ ref,
98
+ "data-testid": dataTestId,
99
+ "data-dtrum-mask": dataDtrumMask,
100
+ "data-dtrum-allow": dataDtrumAllow,
101
+ required,
102
+ disabled: nativeDisabledOrLoading && !ariaDisabled,
103
+ id: propId,
104
+ type,
105
+ ...ariaLabelingProps,
106
+ "aria-disabled": ariaDisabledProp,
107
+ onClick: handleButtonClick
108
+ };
109
+ const disabledPropagationProps = {
110
+ onPointerDown(evt) {
111
+ if (nativeDisabledOrLoading) {
112
+ evt.preventDefault();
113
+ evt.stopPropagation();
114
+ }
115
+ },
116
+ onPointerUp(evt) {
117
+ if (nativeDisabledOrLoading) {
118
+ evt.preventDefault();
119
+ evt.stopPropagation();
120
+ }
121
+ }
122
+ };
123
+ const hasChildren = children || children === 0;
124
+ const buttonMergedProps = {
125
+ ...mergeProps(
126
+ buttonProps,
127
+ disabledPropagationProps,
128
+ // Need to cast this one as the inference of mergeProps would generate
129
+ // a not allowed overlap. The remainingProps type is too complex due to the
130
+ // polymorphic inheritance.
131
+ remainingProps,
132
+ focusProps
133
+ )
134
+ };
135
+ const intl = useIntl();
136
+ const Component = as || "button";
137
+ if (!hasChildren) {
138
+ return /* @__PURE__ */ React.createElement(
139
+ Component,
140
+ {
141
+ ...buttonMergedProps,
142
+ className: clsx(
143
+ consumerClassName,
144
+ fieldColorsCSS({ variant, color, disabled: disabledOrLoading }),
145
+ buttonCSS({
146
+ disabled: disabledOrLoading,
147
+ textAlign,
148
+ size,
149
+ readOnly
150
+ }),
151
+ focusClassName,
152
+ {
153
+ [`${buttonWidthsCSS.content}`]: width === "content",
154
+ [`${buttonWidthsCSS.full}`]: width === "full"
155
+ }
156
+ ),
157
+ style: {
158
+ width: width !== "content" && width !== "full" ? width : void 0
159
+ }
160
+ }
161
+ );
162
+ }
163
+ return /* @__PURE__ */ React.createElement(
164
+ Component,
165
+ {
166
+ className: clsx(
167
+ consumerClassName,
168
+ fieldColorsCSS({
169
+ variant,
170
+ color,
171
+ disabled: disabledOrLoading || ariaDisabled
172
+ }),
173
+ buttonCSS({
174
+ disabled: disabledOrLoading || ariaDisabled,
175
+ textAlign,
176
+ size,
177
+ readOnly
178
+ }),
179
+ {
180
+ [`${buttonWidthsCSS.content}`]: width === "content",
181
+ [`${buttonWidthsCSS.full}`]: width === "full"
182
+ },
183
+ focusClassName
184
+ ),
185
+ style: {
186
+ width: width !== "content" && width !== "full" ? width : void 0,
187
+ ...consumerStyle
188
+ },
189
+ ...buttonMergedProps
190
+ },
191
+ loading && /* @__PURE__ */ React.createElement("div", { className: buttonLoadingCSS }, /* @__PURE__ */ React.createElement(
192
+ ProgressCircle,
193
+ {
194
+ size: "small",
195
+ variant: color,
196
+ "aria-label": intl.formatMessage({
197
+ defaultMessage: "Loading",
198
+ id: "cycz+bYG+VH7Of4e",
199
+ description: "Label for the loading state."
200
+ })
201
+ }
202
+ )),
203
+ /* @__PURE__ */ React.createElement(
204
+ Grid,
205
+ {
206
+ gap: size === "default" ? 4 : 2,
207
+ grid: "auto / auto-flow auto",
208
+ width: "100%",
209
+ maxWidth: "100%",
210
+ alignItems: "center",
211
+ justifyContent: textAlign === "start" ? "space-between" : "center",
212
+ style: {
213
+ visibility: loading ? "hidden" : void 0
214
+ }
215
+ },
216
+ 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)),
217
+ slots.suffix
218
+ )
219
+ );
220
+ }
221
+ );
222
+ _Button.displayName = "Button";
223
+ const Button = Object.assign(_Button, {
224
+ Suffix,
225
+ Prefix,
226
+ Label
227
+ });
228
+ export {
229
+ Button,
230
+ _Button,
231
+ getButtonSlots as default
232
+ };
233
+ //# sourceMappingURL=Button.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 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 { 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/ban-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 */\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) {\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 readOnly,\n as,\n ...remainingProps\n }: ButtonProps<E> = props;\n const slots = getButtonSlots(children);\n\n const ariaDisabled =\n ariaDisabledProp === true || ariaDisabledProp === 'true';\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 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 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 variant={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": "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",
6
+ "names": []
7
+ }
@@ -0,0 +1,15 @@
1
+ import "../../styles/ellipsis.css";
2
+ import "../../styles/field.css";
3
+ import "./Button.css";
4
+ import { createRuntimeFn as _7a468 } from "@vanilla-extract/recipes/createRuntimeFn";
5
+ var buttonCSS = _7a468({ defaultClassName: "Button_buttonCSS__10kgnsa0", variantClassNames: { textAlign: { start: "Button_buttonCSS_textAlign_start__10kgnsa1", center: "Button_buttonCSS_textAlign_center__10kgnsa2" }, size: { condensed: "Button_buttonCSS_size_condensed__10kgnsa3", "default": "Button_buttonCSS_size_default__10kgnsa4" }, disabled: { true: "Button_buttonCSS_disabled_true__10kgnsa5" }, readOnly: { true: "Button_buttonCSS_readOnly_true__10kgnsa6" } }, defaultVariants: { size: "default", textAlign: "center", disabled: false }, compoundVariants: [] });
6
+ var buttonLabelCSS = _7a468({ defaultClassName: "Button_buttonLabelCSS__10kgnsaa", variantClassNames: { textual: { true: "ellipsis_ellipsisCSS__oqqp1n0", false: "Button_buttonLabelCSS_textual_false__10kgnsac" } }, defaultVariants: {}, compoundVariants: [] });
7
+ var buttonLoadingCSS = "Button_buttonLoadingCSS__10kgnsa9";
8
+ var buttonWidthsCSS = { full: "Button_buttonWidthsCSS_full__10kgnsa7", content: "Button_buttonWidthsCSS_content__10kgnsa8" };
9
+ export {
10
+ buttonCSS,
11
+ buttonLabelCSS,
12
+ buttonLoadingCSS,
13
+ buttonWidthsCSS
14
+ };
15
+ //# sourceMappingURL=Button.sty.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 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:'Button_buttonCSS__10kgnsa0',variantClassNames:{textAlign:{start:'Button_buttonCSS_textAlign_start__10kgnsa1',center:'Button_buttonCSS_textAlign_center__10kgnsa2'},size:{condensed:'Button_buttonCSS_size_condensed__10kgnsa3','default':'Button_buttonCSS_size_default__10kgnsa4'},disabled:{true:'Button_buttonCSS_disabled_true__10kgnsa5'},readOnly:{true:'Button_buttonCSS_readOnly_true__10kgnsa6'}},defaultVariants:{size:'default',textAlign:'center',disabled:false},compoundVariants:[]});\nexport var buttonLabelCSS = _7a468({defaultClassName:'Button_buttonLabelCSS__10kgnsaa',variantClassNames:{textual:{true:'ellipsis_ellipsisCSS__oqqp1n0',false:'Button_buttonLabelCSS_textual_false__10kgnsac'}},defaultVariants:{},compoundVariants:[]});\nexport var buttonLoadingCSS = 'Button_buttonLoadingCSS__10kgnsa9';\nexport var buttonWidthsCSS = {full:'Button_buttonWidthsCSS_full__10kgnsa7',content:'Button_buttonWidthsCSS_content__10kgnsa8'};"],
5
+ "mappings": "AAAA,OAAO;AACP,OAAO;AACP,OAAO;AACP,SAAS,mBAAmB,cAAc;AACnC,IAAI,YAAY,OAAO,EAAC,kBAAiB,8BAA6B,mBAAkB,EAAC,WAAU,EAAC,OAAM,8CAA6C,QAAO,8CAA6C,GAAE,MAAK,EAAC,WAAU,6CAA4C,WAAU,0CAAyC,GAAE,UAAS,EAAC,MAAK,2CAA0C,GAAE,UAAS,EAAC,MAAK,2CAA0C,EAAC,GAAE,iBAAgB,EAAC,MAAK,WAAU,WAAU,UAAS,UAAS,MAAK,GAAE,kBAAiB,CAAC,EAAC,CAAC;AAC5gB,IAAI,iBAAiB,OAAO,EAAC,kBAAiB,mCAAkC,mBAAkB,EAAC,SAAQ,EAAC,MAAK,iCAAgC,OAAM,gDAA+C,EAAC,GAAE,iBAAgB,CAAC,GAAE,kBAAiB,CAAC,EAAC,CAAC;AAChP,IAAI,mBAAmB;AACvB,IAAI,kBAAkB,EAAC,MAAK,yCAAwC,SAAQ,2CAA0C;",
6
+ "names": []
7
+ }