@dynatrace/strato-components 0.84.42 → 0.85.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 (224) hide show
  1. package/content/index.d.ts +7 -0
  2. package/content/index.js +25 -0
  3. package/content/progress/ProgressBar.css +52 -0
  4. package/content/progress/ProgressBar.d.ts +56 -0
  5. package/content/progress/ProgressBar.js +191 -0
  6. package/content/progress/ProgressBar.sty.d.ts +42 -0
  7. package/content/progress/ProgressBar.sty.js +28 -0
  8. package/content/progress/ProgressBarIcon.css +5 -0
  9. package/content/progress/ProgressBarIcon.d.ts +15 -0
  10. package/content/progress/ProgressBarIcon.js +68 -0
  11. package/content/progress/ProgressBarIcon.sty.d.ts +1 -0
  12. package/content/progress/ProgressBarIcon.sty.js +25 -0
  13. package/content/progress/ProgressBarLabel.css +9 -0
  14. package/content/progress/ProgressBarLabel.d.ts +15 -0
  15. package/content/progress/ProgressBarLabel.js +75 -0
  16. package/content/progress/ProgressBarLabel.sty.d.ts +13 -0
  17. package/content/progress/ProgressBarLabel.sty.js +26 -0
  18. package/content/progress/ProgressBarValue.css +28 -0
  19. package/content/progress/ProgressBarValue.d.ts +15 -0
  20. package/content/progress/ProgressBarValue.js +72 -0
  21. package/content/progress/ProgressBarValue.sty.d.ts +34 -0
  22. package/content/progress/ProgressBarValue.sty.js +26 -0
  23. package/content/progress/ProgressCircle.css +52 -0
  24. package/content/progress/ProgressCircle.d.ts +51 -0
  25. package/content/progress/ProgressCircle.js +174 -0
  26. package/content/progress/ProgressCircle.sty.d.ts +41 -0
  27. package/content/progress/ProgressCircle.sty.js +37 -0
  28. package/content/progress/contexts/SharedProgressBarPropsContext.d.ts +9 -0
  29. package/content/progress/contexts/SharedProgressBarPropsContext.js +38 -0
  30. package/content/progress/hooks/useProgressAriaProps.d.ts +38 -0
  31. package/content/progress/hooks/useProgressAriaProps.js +63 -0
  32. package/content/progress/hooks/useProgressBarPropsContext.d.ts +2 -0
  33. package/content/progress/hooks/useProgressBarPropsContext.js +32 -0
  34. package/content/progress/utils.d.ts +2 -0
  35. package/content/progress/utils.js +50 -0
  36. package/core/components/app-root/AppRoot.d.ts +2 -2
  37. package/core/hooks/useAriaLabelingProps.d.ts +6 -0
  38. package/core/hooks/useAriaLabelingProps.js +30 -0
  39. package/core/hooks/useCurrentTheme.d.ts +1 -1
  40. package/core/hooks/useId.d.ts +12 -0
  41. package/core/hooks/useId.js +32 -0
  42. package/core/hooks/useSafeForwardProps.d.ts +10 -0
  43. package/core/hooks/useSafeForwardProps.js +34 -0
  44. package/core/index.d.ts +11 -3
  45. package/core/index.js +12 -0
  46. package/core/types/a11y-props.d.ts +8 -1
  47. package/core/types/data-props.d.ts +1 -1
  48. package/core/types/dom.d.ts +2 -13
  49. package/core/types/masking-props.d.ts +2 -1
  50. package/core/types/polymorph.d.ts +10 -7
  51. package/core/types/role-variant.d.ts +10 -0
  52. package/core/types/{focusable-element.js → role-variant.js} +17 -2
  53. package/core/types/styling-props.d.ts +1 -1
  54. package/core/types/with-children.d.ts +1 -1
  55. package/core/utils/_is-string-children.d.ts +6 -0
  56. package/core/utils/_is-string-children.js +44 -0
  57. package/core/utils/isBrowser.d.ts +1 -1
  58. package/core/utils/merge-props.d.ts +4 -5
  59. package/core/utils/seed-random.d.ts +5 -0
  60. package/core/utils/seed-random.js +34 -0
  61. package/core/utils/uuidv4.d.ts +5 -0
  62. package/core/utils/uuidv4.js +31 -0
  63. package/esm/content/index.js +7 -0
  64. package/esm/content/index.js.map +7 -0
  65. package/esm/content/progress/ProgressBar.css +52 -0
  66. package/esm/content/progress/ProgressBar.js +163 -0
  67. package/esm/content/progress/ProgressBar.js.map +7 -0
  68. package/esm/content/progress/ProgressBar.sty.js +10 -0
  69. package/esm/content/progress/ProgressBar.sty.js.map +7 -0
  70. package/esm/content/progress/ProgressBarIcon.css +5 -0
  71. package/esm/content/progress/ProgressBarIcon.js +40 -0
  72. package/esm/content/progress/ProgressBarIcon.js.map +7 -0
  73. package/esm/content/progress/ProgressBarIcon.sty.js +7 -0
  74. package/esm/content/progress/ProgressBarIcon.sty.js.map +7 -0
  75. package/esm/content/progress/ProgressBarLabel.css +9 -0
  76. package/esm/content/progress/ProgressBarLabel.js +47 -0
  77. package/esm/content/progress/ProgressBarLabel.js.map +7 -0
  78. package/esm/content/progress/ProgressBarLabel.sty.js +8 -0
  79. package/esm/content/progress/ProgressBarLabel.sty.js.map +7 -0
  80. package/esm/content/progress/ProgressBarValue.css +28 -0
  81. package/esm/content/progress/ProgressBarValue.js +44 -0
  82. package/esm/content/progress/ProgressBarValue.js.map +7 -0
  83. package/esm/content/progress/ProgressBarValue.sty.js +8 -0
  84. package/esm/content/progress/ProgressBarValue.sty.js.map +7 -0
  85. package/esm/content/progress/ProgressCircle.css +52 -0
  86. package/esm/content/progress/ProgressCircle.js +153 -0
  87. package/esm/content/progress/ProgressCircle.js.map +7 -0
  88. package/esm/content/progress/ProgressCircle.sty.js +19 -0
  89. package/esm/content/progress/ProgressCircle.sty.js.map +7 -0
  90. package/esm/content/progress/contexts/SharedProgressBarPropsContext.js +10 -0
  91. package/esm/content/progress/contexts/SharedProgressBarPropsContext.js.map +7 -0
  92. package/esm/content/progress/hooks/useProgressAriaProps.js +45 -0
  93. package/esm/content/progress/hooks/useProgressAriaProps.js.map +7 -0
  94. package/esm/content/progress/hooks/useProgressBarPropsContext.js +16 -0
  95. package/esm/content/progress/hooks/useProgressBarPropsContext.js.map +7 -0
  96. package/esm/content/progress/utils.js +22 -0
  97. package/esm/content/progress/utils.js.map +7 -0
  98. package/esm/core/components/app-root/AppRoot.js.map +1 -1
  99. package/esm/core/hooks/useAriaLabelingProps.js +12 -0
  100. package/esm/core/hooks/useAriaLabelingProps.js.map +7 -0
  101. package/esm/core/hooks/useCurrentTheme.js.map +1 -1
  102. package/esm/core/hooks/useId.js +14 -0
  103. package/esm/core/hooks/useId.js.map +7 -0
  104. package/esm/core/hooks/useSafeForwardProps.js +16 -0
  105. package/esm/core/hooks/useSafeForwardProps.js.map +7 -0
  106. package/esm/core/index.js +12 -0
  107. package/esm/core/index.js.map +2 -2
  108. package/esm/core/types/role-variant.js +12 -0
  109. package/esm/core/types/role-variant.js.map +7 -0
  110. package/esm/core/utils/_is-string-children.js +16 -0
  111. package/esm/core/utils/_is-string-children.js.map +7 -0
  112. package/esm/core/utils/isBrowser.js.map +1 -1
  113. package/esm/core/utils/merge-props.js.map +2 -2
  114. package/esm/core/utils/seed-random.js +16 -0
  115. package/esm/core/utils/seed-random.js.map +7 -0
  116. package/esm/core/utils/uuidv4.js +13 -0
  117. package/esm/core/utils/uuidv4.js.map +7 -0
  118. package/esm/index.js +2 -0
  119. package/esm/index.js.map +2 -2
  120. package/esm/layouts/container/Container.css +8 -0
  121. package/esm/layouts/container/Container.js +55 -0
  122. package/esm/layouts/container/Container.js.map +7 -0
  123. package/esm/layouts/container/Container.sty.js +7 -0
  124. package/esm/layouts/container/Container.sty.js.map +7 -0
  125. package/esm/layouts/flex/Flex.js +46 -0
  126. package/esm/layouts/flex/Flex.js.map +7 -0
  127. package/esm/layouts/grid/Grid.js +46 -0
  128. package/esm/layouts/grid/Grid.js.map +7 -0
  129. package/esm/layouts/index.js +7 -1
  130. package/esm/layouts/index.js.map +2 -2
  131. package/esm/styles/colorUtils.css +80 -0
  132. package/esm/styles/colorUtils.sty.js +9 -0
  133. package/esm/styles/colorUtils.sty.js.map +7 -0
  134. package/esm/styles/container.css +64 -0
  135. package/esm/styles/container.sty.js +9 -0
  136. package/esm/styles/container.sty.js.map +7 -0
  137. package/esm/styles/ellipsis.css +5 -0
  138. package/esm/styles/ellipsis.sty.js +6 -0
  139. package/esm/styles/ellipsis.sty.js.map +7 -0
  140. package/esm/styles/extract-util.js +15 -0
  141. package/esm/styles/extract-util.js.map +7 -0
  142. package/esm/styles/getFlexStyles.js +69 -0
  143. package/esm/styles/getFlexStyles.js.map +7 -0
  144. package/esm/styles/getGapSprinkles.js +18 -0
  145. package/esm/styles/getGapSprinkles.js.map +7 -0
  146. package/esm/styles/getGridFlexPositionSprinkles.js +25 -0
  147. package/esm/styles/getGridFlexPositionSprinkles.js.map +7 -0
  148. package/esm/styles/getGridStyles.js +78 -0
  149. package/esm/styles/getGridStyles.js.map +7 -0
  150. package/esm/styles/getLayoutSizeStyles.js +21 -0
  151. package/esm/styles/getLayoutSizeStyles.js.map +7 -0
  152. package/esm/styles/getSpacingSprinkles.js +50 -0
  153. package/esm/styles/getSpacingSprinkles.js.map +7 -0
  154. package/esm/styles/index.js +49 -0
  155. package/esm/styles/index.js.map +7 -0
  156. package/esm/styles/safe-sprinkles.js +17 -0
  157. package/esm/styles/safe-sprinkles.js.map +7 -0
  158. package/esm/styles/sprinkle-properties.js +137 -0
  159. package/esm/styles/sprinkle-properties.js.map +7 -0
  160. package/esm/styles/sprinkles.css +786 -0
  161. package/esm/styles/sprinkles.sty.js +9 -0
  162. package/esm/styles/sprinkles.sty.js.map +7 -0
  163. package/esm/typography/Link/Link.js.map +2 -2
  164. package/esm/typography/List/List.js.map +1 -1
  165. package/esm/typography/Text/Text.js.map +1 -1
  166. package/esm/typography/TextEllipsis/TextEllipsis.js.map +1 -1
  167. package/index.d.ts +2 -0
  168. package/index.js +2 -0
  169. package/lang/en.json +6 -0
  170. package/lang/uncompiled/en.json +4 -0
  171. package/layouts/container/Container.css +8 -0
  172. package/layouts/container/Container.d.ts +34 -0
  173. package/layouts/container/Container.js +80 -0
  174. package/layouts/container/Container.sty.d.ts +1 -0
  175. package/layouts/container/Container.sty.js +25 -0
  176. package/layouts/flex/Flex.d.ts +23 -0
  177. package/layouts/flex/Flex.js +72 -0
  178. package/layouts/grid/Grid.d.ts +23 -0
  179. package/layouts/grid/Grid.js +72 -0
  180. package/layouts/index.d.ts +4 -0
  181. package/layouts/index.js +7 -1
  182. package/package.json +35 -20
  183. package/styles/colorUtils.css +80 -0
  184. package/styles/colorUtils.sty.d.ts +56 -0
  185. package/styles/colorUtils.sty.js +27 -0
  186. package/styles/container.css +64 -0
  187. package/styles/container.sty.d.ts +54 -0
  188. package/styles/container.sty.js +27 -0
  189. package/styles/ellipsis.css +5 -0
  190. package/styles/ellipsis.sty.d.ts +5 -0
  191. package/styles/ellipsis.sty.js +24 -0
  192. package/styles/extract-util.d.ts +9 -0
  193. package/styles/extract-util.js +33 -0
  194. package/styles/getFlexStyles.d.ts +64 -0
  195. package/styles/getFlexStyles.js +95 -0
  196. package/styles/getGapSprinkles.d.ts +19 -0
  197. package/styles/getGapSprinkles.js +36 -0
  198. package/styles/getGridFlexPositionSprinkles.d.ts +35 -0
  199. package/styles/getGridFlexPositionSprinkles.js +43 -0
  200. package/styles/getGridStyles.d.ts +74 -0
  201. package/styles/getGridStyles.js +100 -0
  202. package/styles/getLayoutSizeStyles.d.ts +29 -0
  203. package/styles/getLayoutSizeStyles.js +39 -0
  204. package/styles/getSpacingSprinkles.d.ts +74 -0
  205. package/styles/getSpacingSprinkles.js +68 -0
  206. package/styles/index.d.ts +11 -0
  207. package/styles/index.js +47 -0
  208. package/styles/safe-sprinkles.d.ts +6 -0
  209. package/styles/safe-sprinkles.js +35 -0
  210. package/styles/sprinkle-properties.d.ts +257 -0
  211. package/styles/sprinkle-properties.js +165 -0
  212. package/styles/sprinkles.css +786 -0
  213. package/styles/sprinkles.sty.d.ts +913 -0
  214. package/styles/sprinkles.sty.js +27 -0
  215. package/styles/textStyle.sty.d.ts +1 -0
  216. package/testing/mocks/canvas-mock.js +6 -1
  217. package/typography/Link/Link.d.ts +1 -2
  218. package/typography/List/List.d.ts +4 -4
  219. package/typography/Text/Text.d.ts +3 -3
  220. package/typography/TextEllipsis/TextEllipsis.d.ts +3 -3
  221. package/typography/TextEllipsis/TextEllipsis.js +2 -2
  222. package/core/types/focusable-element.d.ts +0 -5
  223. package/esm/core/types/focusable-element.js +0 -1
  224. package/esm/core/types/focusable-element.js.map +0 -7
@@ -0,0 +1,63 @@
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 useProgressAriaProps_exports = {};
19
+ __export(useProgressAriaProps_exports, {
20
+ useProgressAriaProps: () => useProgressAriaProps
21
+ });
22
+ module.exports = __toCommonJS(useProgressAriaProps_exports);
23
+ var import_lodash_es = require("lodash");
24
+ var import_units = require("@dynatrace-sdk/units");
25
+ function useProgressAriaProps(originalValue, min, max, valueText) {
26
+ let value;
27
+ let isIndeterminate;
28
+ if (originalValue === "indeterminate" || originalValue === void 0) {
29
+ value = void 0;
30
+ isIndeterminate = true;
31
+ } else {
32
+ value = originalValue;
33
+ isIndeterminate = false;
34
+ }
35
+ if (!isIndeterminate) {
36
+ value = (0, import_lodash_es.clamp)(originalValue, min, max);
37
+ }
38
+ if (!isIndeterminate && value !== void 0 && !valueText) {
39
+ valueText = (0, import_units.format)(value, { input: import_units.units.percentage.percent });
40
+ }
41
+ const progressAriaProps = {
42
+ // aria-valuenow should only be provided and updated if the value is not indeterminate https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/progressbar_role)
43
+ "aria-valuenow": isIndeterminate ? void 0 : value,
44
+ "aria-valuetext": isIndeterminate ? void 0 : valueText,
45
+ // aria-valuemin should only be provided if min is not 0 (https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/progressbar_role)
46
+ "aria-valuemin": min !== 0 ? min : void 0,
47
+ // aria-valuemax should only be provided if min is not 100 (https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/progressbar_role)
48
+ "aria-valuemax": max !== 100 ? max : void 0,
49
+ role: "progressbar"
50
+ };
51
+ if (isIndeterminate === true && value === void 0) {
52
+ return {
53
+ value: void 0,
54
+ isIndeterminate: true,
55
+ progressAriaProps
56
+ };
57
+ }
58
+ return {
59
+ value,
60
+ isIndeterminate: false,
61
+ progressAriaProps
62
+ };
63
+ }
@@ -0,0 +1,2 @@
1
+ import { SharedProgressBarProps } from '../contexts/SharedProgressBarPropsContext.js';
2
+ export declare function _useSharedProgressBarPropsContext(): SharedProgressBarProps;
@@ -0,0 +1,32 @@
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 useProgressBarPropsContext_exports = {};
19
+ __export(useProgressBarPropsContext_exports, {
20
+ _useSharedProgressBarPropsContext: () => _useSharedProgressBarPropsContext
21
+ });
22
+ module.exports = __toCommonJS(useProgressBarPropsContext_exports);
23
+ var import_react = require("react");
24
+ var import_SharedProgressBarPropsContext = require("../contexts/SharedProgressBarPropsContext.js");
25
+ function _useSharedProgressBarPropsContext() {
26
+ const context = (0, import_react.useContext)(import_SharedProgressBarPropsContext.SharedProgressBarPropsContext);
27
+ return {
28
+ id: context.id,
29
+ variant: context.variant,
30
+ density: context.density
31
+ };
32
+ }
@@ -0,0 +1,2 @@
1
+ import { RoleVariantType } from '../../core/types/role-variant.js';
2
+ export declare function getFillColorFromVariant($variant: RoleVariantType): string;
@@ -0,0 +1,50 @@
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 utils_exports = {};
29
+ __export(utils_exports, {
30
+ getFillColorFromVariant: () => getFillColorFromVariant
31
+ });
32
+ module.exports = __toCommonJS(utils_exports);
33
+ var import_colors = __toESM(require("@dynatrace/strato-design-tokens/colors"));
34
+ function getFillColorFromVariant($variant) {
35
+ switch ($variant) {
36
+ case "onAccent":
37
+ return import_colors.default.Border.OnAccent.Default;
38
+ case "primary":
39
+ return import_colors.default.Border.Primary.Accent;
40
+ case "success":
41
+ return import_colors.default.Border.Success.Accent;
42
+ case "warning":
43
+ return import_colors.default.Border.Warning.Accent;
44
+ case "critical":
45
+ return import_colors.default.Border.Critical.Accent;
46
+ case "neutral":
47
+ default:
48
+ return import_colors.default.Border.Neutral.Accent;
49
+ }
50
+ }
@@ -5,17 +5,17 @@ import { type DataTestId } from '../../types/data-props.js';
5
5
  import { type MaskingProps } from '../../types/masking-props.js';
6
6
  import { type StylingProps } from '../../types/styling-props.js';
7
7
  /**
8
- * @public
9
8
  * AppRoot component props.
9
+ * @public
10
10
  */
11
11
  export type AppRootProps = PropsWithChildren<DataTestId & StylingProps & MaskingProps>;
12
12
  /**
13
- * @public
14
13
  * In order to have all the providers in place for rendering overlays, applying
15
14
  * global styles or internationalization, you need to wrap your app in the
16
15
  * `AppRoot`. If you're using the `dt-app` to create your app, this is
17
16
  * automatically taken care of and you can start working on your app without
18
17
  * further ado.
18
+ * @public
19
19
  */
20
20
  export declare const AppRoot: (props: DataTestId & StylingProps & MaskingProps & {
21
21
  children?: React.ReactNode;
@@ -0,0 +1,6 @@
1
+ import { AriaLabelingProps } from '../types/a11y-props.js';
2
+ /**
3
+ * Utility function to extract aria-labeling props from component props to easily spread them to the desired child.
4
+ * @internal
5
+ */
6
+ export declare function useAriaLabelingProps<T extends object>(props: AriaLabelingProps & T): AriaLabelingProps;
@@ -0,0 +1,30 @@
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 useAriaLabelingProps_exports = {};
19
+ __export(useAriaLabelingProps_exports, {
20
+ useAriaLabelingProps: () => useAriaLabelingProps
21
+ });
22
+ module.exports = __toCommonJS(useAriaLabelingProps_exports);
23
+ function useAriaLabelingProps(props) {
24
+ return {
25
+ "aria-label": props["aria-label"],
26
+ "aria-labelledby": props["aria-labelledby"],
27
+ "aria-describedby": props["aria-describedby"],
28
+ "aria-details": props["aria-details"]
29
+ };
30
+ }
@@ -1,5 +1,5 @@
1
1
  /**
2
+ * Returns the current theme based on sdk-setting or browsers preferred color-scheme.
2
3
  * @public
3
- * Returns the current theme based on sdk-setting or browsers preferred color-scheme
4
4
  */
5
5
  export declare function useCurrentTheme(): 'light' | 'dark';
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Hook used to generate a unique identifier.
3
+ * @internal
4
+ */
5
+ export declare const useId: (props?: {
6
+ /** If a prefix is defined, the hook prepends the prefix with a hyphen to the generated id.
7
+ * @defaultValue 'strato'
8
+ */
9
+ prefix?: string;
10
+ /** If a seed is defined, the hook uses a seeded random function to generate the id consistently. */
11
+ seed?: number;
12
+ }) => string;
@@ -0,0 +1,32 @@
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 useId_exports = {};
19
+ __export(useId_exports, {
20
+ useId: () => useId
21
+ });
22
+ module.exports = __toCommonJS(useId_exports);
23
+ var import_react = require("react");
24
+ var import_uuidv4 = require("../utils/uuidv4.js");
25
+ const useId = (props = {}) => {
26
+ const { prefix = "strato", seed } = props;
27
+ const generatedId = (0, import_react.useMemo)(
28
+ () => `${prefix}-${(0, import_uuidv4.uuidv4)(seed)}`,
29
+ [prefix, seed]
30
+ );
31
+ return generatedId;
32
+ };
@@ -0,0 +1,10 @@
1
+ /**
2
+ * The Filtered Props from 'useSafeForwardProps'
3
+ * @internal
4
+ */
5
+ export type UseSafeForwardReturnProps<T, P> = Omit<T, keyof P | 'className' | 'classNames' | 'style'>;
6
+ /**
7
+ * Filters props out of a prop list. Per default className, classNames & style are filtered.
8
+ * @internal
9
+ */
10
+ export declare function useSafeForwardProps<T extends object, P extends object>(props: T, excludedProps?: P): UseSafeForwardReturnProps<T, P>;
@@ -0,0 +1,34 @@
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 useSafeForwardProps_exports = {};
19
+ __export(useSafeForwardProps_exports, {
20
+ useSafeForwardProps: () => useSafeForwardProps
21
+ });
22
+ module.exports = __toCommonJS(useSafeForwardProps_exports);
23
+ function useSafeForwardProps(props, excludedProps) {
24
+ const ignoreStyles = ["className", "classNames", "style"];
25
+ const ignoreList = excludedProps ? [...ignoreStyles, ...Object.keys(excludedProps)] : ignoreStyles;
26
+ const safeForwardProps = {};
27
+ for (const [name, prop] of Object.entries(props)) {
28
+ if (!ignoreList.includes(name)) {
29
+ const localName = name;
30
+ safeForwardProps[localName] = prop;
31
+ }
32
+ }
33
+ return safeForwardProps;
34
+ }
package/core/index.d.ts CHANGED
@@ -8,6 +8,7 @@ export type { MaskingProps } from './types/masking-props.js';
8
8
  export type { DataTestId } from './types/data-props.js';
9
9
  export type { StylingProps } from './types/styling-props.js';
10
10
  export type { WithChildren } from './types/with-children.js';
11
+ export type { PolymorphOwnProps, PolymorphProps, PolymorphicComponentProps, } from './types/polymorph.js';
11
12
  export { attemptFocus as _attemptFocus } from './utils/focus-management/attempt-focus.js';
12
13
  export { focusFirstDescendant as _focusFirstDescendant } from './utils/focus-management/focus-first-descendant.js';
13
14
  export { getFirstFocusableChild as _getFirstFocusableChild } from './utils/focus-management/get-first-focusable-child.js';
@@ -15,7 +16,14 @@ export { getLastFocusableChild as _getLastFocusableChild } from './utils/focus-m
15
16
  export { isFocusable as _isFocusable } from './utils/focus-management/is-focusable.js';
16
17
  export { isBrowser as _isBrowser } from './utils/isBrowser.js';
17
18
  export { mergeProps as _mergeProps, type NullToObject as _NullToObject, type TupleTypes as _TupleTypes, type UnionToIntersection as _UnionToIntersection, } from './utils/merge-props.js';
18
- export type { AriaLabelingProps } from './types/a11y-props.js';
19
- export type { DOMProps } from './types/dom.js';
20
- export type { PolymorphicComponentProps, PolymorphProps, PolymorphOwnProps, } from './types/polymorph.js';
21
19
  export { type _HeadingLevel, type _HeadingTag } from './types/heading.js';
20
+ export { useAriaLabelingProps as _useAriaLabelingProps } from './hooks/useAriaLabelingProps.js';
21
+ export { useId as _useId } from './hooks/useId.js';
22
+ export { useSafeForwardProps as _useSafeForwardProps } from './hooks/useSafeForwardProps.js';
23
+ export type { UseSafeForwardReturnProps as _UseSafeForwardReturnProps } from './hooks/useSafeForwardProps.js';
24
+ export type { AriaDisabledProps, AriaLabelingProps, } from './types/a11y-props.js';
25
+ export type { DOMProps } from './types/dom.js';
26
+ export { roleVariants } from './types/role-variant.js';
27
+ export type { RoleVariantType } from './types/role-variant.js';
28
+ export { uuidv4 as _uuidv4 } from './utils/uuidv4.js';
29
+ export { isStringChildren as _isStringChildren } from './utils/_is-string-children.js';
package/core/index.js CHANGED
@@ -26,8 +26,14 @@ __export(core_exports, {
26
26
  _getLastFocusableChild: () => import_get_last_focusable_child.getLastFocusableChild,
27
27
  _isBrowser: () => import_isBrowser.isBrowser,
28
28
  _isFocusable: () => import_is_focusable.isFocusable,
29
+ _isStringChildren: () => import_is_string_children.isStringChildren,
29
30
  _mergeProps: () => import_merge_props.mergeProps,
31
+ _useAriaLabelingProps: () => import_useAriaLabelingProps.useAriaLabelingProps,
30
32
  _useFocusContext: () => import_useFocusContext.useFocusContext,
33
+ _useId: () => import_useId.useId,
34
+ _useSafeForwardProps: () => import_useSafeForwardProps.useSafeForwardProps,
35
+ _uuidv4: () => import_uuidv4.uuidv4,
36
+ roleVariants: () => import_role_variant.roleVariants,
31
37
  useCurrentTheme: () => import_useCurrentTheme.useCurrentTheme
32
38
  });
33
39
  module.exports = __toCommonJS(core_exports);
@@ -43,3 +49,9 @@ var import_get_last_focusable_child = require("./utils/focus-management/get-last
43
49
  var import_is_focusable = require("./utils/focus-management/is-focusable.js");
44
50
  var import_isBrowser = require("./utils/isBrowser.js");
45
51
  var import_merge_props = require("./utils/merge-props.js");
52
+ var import_useAriaLabelingProps = require("./hooks/useAriaLabelingProps.js");
53
+ var import_useId = require("./hooks/useId.js");
54
+ var import_useSafeForwardProps = require("./hooks/useSafeForwardProps.js");
55
+ var import_role_variant = require("./types/role-variant.js");
56
+ var import_uuidv4 = require("./utils/uuidv4.js");
57
+ var import_is_string_children = require("./utils/_is-string-children.js");
@@ -1,5 +1,8 @@
1
1
  import type { AriaAttributes } from 'react';
2
- /** @public */
2
+ /**
3
+ * Collection of component aria props.
4
+ * @public
5
+ */
3
6
  export interface AriaLabelingProps {
4
7
  /** Labels the current element. */
5
8
  'aria-label'?: string;
@@ -10,6 +13,10 @@ export interface AriaLabelingProps {
10
13
  /** Identifies the element (or elements) that provide(s) a detailed, extended description for the object. */
11
14
  'aria-details'?: string;
12
15
  }
16
+ /**
17
+ * Type used for the adding the `aria-disabled` prop.
18
+ * @public
19
+ */
13
20
  export type AriaDisabledProps = {
14
21
  /**
15
22
  * Whether the element and all focusable descendants are disabled.
@@ -1,6 +1,6 @@
1
1
  /**
2
- * @public
3
2
  * Type defining the data-testid prop that is mapped to the rendered components root node.
3
+ * @public
4
4
  */
5
5
  export type DataTestId = {
6
6
  /** Test id used for selecting the component's container. */
@@ -1,19 +1,8 @@
1
- import type { AriaAttributes, AriaRole, CSSProperties, DOMAttributes as ReactDOMAttributes } from 'react';
2
- import type { FocusableElement } from './focusable-element.js';
3
- export interface DOMAttributes<T = FocusableElement> extends AriaAttributes, ReactDOMAttributes<T> {
4
- id?: string | undefined;
5
- role?: AriaRole | undefined;
6
- tabIndex?: number | undefined;
7
- style?: CSSProperties | undefined;
8
- className?: string | undefined;
9
- }
10
1
  /**
11
2
  * The props of a DOM Element.
12
3
  * @public
13
- * */
4
+ */
14
5
  export interface DOMProps {
15
- /**
16
- * The element's unique identifier. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/id).
17
- */
6
+ /** The element's unique identifier. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/id). */
18
7
  id?: string;
19
8
  }
@@ -1,6 +1,7 @@
1
1
  /**
2
+ * Props defining the masking of data in Session Replay. They are applied to the component's root node.
2
3
  * @public
3
- * Props defining the masking of data in Session Replay. They are applied to the component's root node. */
4
+ */
4
5
  export interface MaskingProps {
5
6
  /** Determines whether masking is enabled and the data is replaced with asterisks. */
6
7
  'data-dtrum-mask'?: boolean;
@@ -1,11 +1,12 @@
1
- import { ComponentProps, ElementType } from 'react';
1
+ import React, { type ComponentProps, type ElementType } from 'react';
2
2
  /**
3
+ * Props type to use with your own to add the as polymorphing prop.
3
4
  * @public
4
- * Props type to use with your own to add the as polymorphing prop */
5
+ */
5
6
  export type PolymorphOwnProps<E extends ElementType = ElementType> = {
6
7
  /**
7
- * The element type / component used to render
8
- * e.g. when `a` is used an anchor tag is created and the component
8
+ * The element type / component used for rendering
9
+ * e.g. when `a` is used, an anchor tag is created and the component
9
10
  * accepts all props a native anchor also accepts, e.g. a `href` tag.
10
11
  * Custom components with their own props are also supported, e.g. a `Link`
11
12
  * from a router.
@@ -13,12 +14,14 @@ export type PolymorphOwnProps<E extends ElementType = ElementType> = {
13
14
  as?: E;
14
15
  };
15
16
  /**
17
+ * Combine the props that come from the underlying ElementType and from your own types and omit naming duplicates.
16
18
  * @public
17
- * Combine the props that come from the underlying ElementType and from your own types and omit naming duplicates */
19
+ */
18
20
  export type PolymorphProps<E extends ElementType> = PolymorphOwnProps<E> & Omit<ComponentProps<E>, keyof PolymorphOwnProps>;
19
21
  /**
20
- * @public
21
- * Uniontype for the elementtypes polymorph props and your own props P */
22
+ * Union type for the element types polymorphic props and your own props
23
+ * @public
24
+ */
22
25
  export type PolymorphicComponentProps<E extends ElementType, P> = P & PolymorphProps<E>;
23
26
  declare module 'react' {
24
27
  function forwardRef<T, P = unknown>(render: (props: P, ref: React.Ref<T>) => React.ReactElement | null): (props: P & React.RefAttributes<T>) => React.ReactElement | null;
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Defines role / color variants
3
+ * @public
4
+ */
5
+ export declare const roleVariants: readonly ["neutral", "primary", "success", "warning", "critical", "onAccent"];
6
+ /**
7
+ * Defines the types of role variants
8
+ * @public
9
+ */
10
+ export type RoleVariantType = (typeof roleVariants)[number];
@@ -2,6 +2,10 @@ var __defProp = Object.defineProperty;
2
2
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
3
  var __getOwnPropNames = Object.getOwnPropertyNames;
4
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
+ };
5
9
  var __copyProps = (to, from, except, desc) => {
6
10
  if (from && typeof from === "object" || typeof from === "function") {
7
11
  for (let key of __getOwnPropNames(from))
@@ -11,5 +15,16 @@ var __copyProps = (to, from, except, desc) => {
11
15
  return to;
12
16
  };
13
17
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
14
- var focusable_element_exports = {};
15
- module.exports = __toCommonJS(focusable_element_exports);
18
+ var role_variant_exports = {};
19
+ __export(role_variant_exports, {
20
+ roleVariants: () => roleVariants
21
+ });
22
+ module.exports = __toCommonJS(role_variant_exports);
23
+ const roleVariants = [
24
+ "neutral",
25
+ "primary",
26
+ "success",
27
+ "warning",
28
+ "critical",
29
+ "onAccent"
30
+ ];
@@ -1,7 +1,7 @@
1
1
  import type { CSSProperties } from 'react';
2
2
  /**
3
- * @public
4
3
  * Collection of component styling props including `style` and `className` types.
4
+ * @public
5
5
  */
6
6
  export interface StylingProps {
7
7
  /**
@@ -1,7 +1,7 @@
1
1
  import type { ReactNode } from 'react';
2
2
  /**
3
+ * Helper type to add children to props.
3
4
  * @public
4
- * Helper type to add children to props
5
5
  */
6
6
  export interface WithChildren {
7
7
  /** Children provided to the component. */
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ /**
3
+ * Returns whether children only consist of text nodes.
4
+ * @internal
5
+ */
6
+ export declare function isStringChildren(children: React.ReactNode): boolean;
@@ -0,0 +1,44 @@
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 is_string_children_exports = {};
29
+ __export(is_string_children_exports, {
30
+ isStringChildren: () => isStringChildren
31
+ });
32
+ module.exports = __toCommonJS(is_string_children_exports);
33
+ var import_react = __toESM(require("react"));
34
+ var import_react_intl = require("react-intl");
35
+ var import_react_is = require("react-is");
36
+ function isStringChildren(children) {
37
+ const childrenArray = import_react.default.Children.toArray(children);
38
+ if (!childrenArray.some(import_react_is.isElement)) {
39
+ return true;
40
+ }
41
+ return childrenArray.every(
42
+ (child) => !(0, import_react_is.isElement)(child) || (0, import_react_is.isElement)(child) && child.type && child.type === import_react_intl.FormattedMessage
43
+ );
44
+ }
@@ -2,6 +2,6 @@
2
2
  * @internal
3
3
  *
4
4
  * Whether the code is currently executed in a browser
5
- * @see https://github.com/chakra-ui/chakra-ui/blob/main/packages/utils/src/dom.ts
5
+ * @see {@link https://github.com/chakra-ui/chakra-ui/blob/main/packages/utils/src/dom.ts}
6
6
  */
7
7
  export declare const isBrowser: boolean;
@@ -1,6 +1,6 @@
1
1
  /**
2
+ * Internal helper mapper type for mergeProps.
2
3
  * @internal
3
- * Internal helper mapper type for mergeProps
4
4
  */
5
5
  export type TupleTypes<T> = {
6
6
  [P in keyof T]: T[P];
@@ -8,23 +8,22 @@ export type TupleTypes<T> = {
8
8
  [key: number]: infer V;
9
9
  } ? NullToObject<V> : never;
10
10
  /**
11
+ * Internal helper mapper type for mergeProps.
11
12
  * @internal
12
- * Internal helper mapper type for mergeProps
13
13
  */
14
14
  export type NullToObject<T> = T extends null | undefined ? {} : T;
15
15
  /**
16
+ * Internal helper mapper type for mergeProps.
16
17
  * @internal
17
- * Internal helper mapper type for mergeProps
18
18
  */
19
19
  export type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never;
20
20
  /**
21
- * @internal
22
- *
23
21
  * Merges multiple props objects together. Event handlers are chained,
24
22
  * classNames are combined, and ids are deduplicated - different ids
25
23
  * will trigger a side-effect and re-render components hooked up with `useId`.
26
24
  * For all other props, the last prop object overrides all previous ones.
27
25
  * @param args - Multiple sets of props to merge together.
26
+ * @internal
28
27
  */
29
28
  export declare function mergeProps<T extends ({
30
29
  [key: string]: any;
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Generate a random seed function based on the mulberry32 algorithm
3
+ * @internal
4
+ */
5
+ export declare function mulberry32(seed: number): () => number;