@dynatrace/strato-components 0.84.21 → 0.84.42

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 (230) hide show
  1. package/core/components/app-root/AppRoot.d.ts +9 -4
  2. package/core/components/app-root/AppRoot.js +6 -2
  3. package/core/contexts/FocusContext.d.ts +1 -1
  4. package/core/hooks/useCurrentTheme.d.ts +4 -1
  5. package/core/hooks/useFontsUpdated.d.ts +9 -0
  6. package/core/hooks/useFontsUpdated.js +51 -0
  7. package/core/hooks/useMergeRefs.d.ts +7 -0
  8. package/core/hooks/useMergeRefs.js +34 -0
  9. package/core/index.d.ts +5 -0
  10. package/core/styles/focusRing.css +88 -0
  11. package/core/styles/focusRing.sty.d.ts +96 -0
  12. package/core/styles/focusRing.sty.js +27 -0
  13. package/core/styles/useFocusRing.d.ts +49 -0
  14. package/core/styles/useFocusRing.js +83 -0
  15. package/core/types/a11y-props.d.ts +19 -0
  16. package/core/types/a11y-props.js +15 -0
  17. package/core/types/data-props.d.ts +1 -0
  18. package/core/types/dom.d.ts +19 -0
  19. package/core/types/dom.js +15 -0
  20. package/core/types/focusable-element.d.ts +5 -0
  21. package/core/types/focusable-element.js +15 -0
  22. package/core/types/heading.d.ts +9 -0
  23. package/core/types/heading.js +15 -0
  24. package/core/types/masking-props.d.ts +9 -0
  25. package/core/types/masking-props.js +15 -0
  26. package/core/types/polymorph.d.ts +25 -0
  27. package/core/types/polymorph.js +15 -0
  28. package/core/types/styling-props.d.ts +3 -2
  29. package/core/types/with-children.d.ts +4 -1
  30. package/core/utils/colorUtils.css +80 -0
  31. package/core/utils/colorUtils.sty.d.ts +48 -0
  32. package/core/utils/colorUtils.sty.js +27 -0
  33. package/esm/core/components/app-root/AppRoot.js +6 -2
  34. package/esm/core/components/app-root/AppRoot.js.map +2 -2
  35. package/esm/core/contexts/FocusContext.js.map +1 -1
  36. package/esm/core/hooks/useCurrentTheme.js.map +2 -2
  37. package/esm/core/hooks/useFontsUpdated.js +33 -0
  38. package/esm/core/hooks/useFontsUpdated.js.map +7 -0
  39. package/esm/core/hooks/useMergeRefs.js +16 -0
  40. package/esm/core/hooks/useMergeRefs.js.map +7 -0
  41. package/esm/core/index.js.map +2 -2
  42. package/esm/core/styles/focusRing.css +88 -0
  43. package/esm/core/styles/focusRing.sty.js +9 -0
  44. package/esm/core/styles/focusRing.sty.js.map +7 -0
  45. package/esm/core/styles/useFocusRing.js +69 -0
  46. package/esm/core/styles/useFocusRing.js.map +7 -0
  47. package/esm/core/types/a11y-props.js +1 -0
  48. package/esm/core/types/a11y-props.js.map +7 -0
  49. package/esm/core/types/dom.js +1 -0
  50. package/esm/core/types/dom.js.map +7 -0
  51. package/esm/core/types/focusable-element.js +1 -0
  52. package/esm/core/types/focusable-element.js.map +7 -0
  53. package/esm/core/types/heading.js +1 -0
  54. package/esm/core/types/heading.js.map +7 -0
  55. package/esm/core/types/masking-props.js +1 -0
  56. package/esm/core/types/masking-props.js.map +7 -0
  57. package/esm/core/types/polymorph.js +1 -0
  58. package/esm/core/types/polymorph.js.map +7 -0
  59. package/esm/core/utils/colorUtils.css +80 -0
  60. package/esm/core/utils/colorUtils.sty.js +9 -0
  61. package/esm/core/utils/colorUtils.sty.js.map +7 -0
  62. package/esm/index.js +2 -0
  63. package/esm/index.js.map +2 -2
  64. package/esm/layouts/Divider/Divider.css +23 -0
  65. package/esm/layouts/Divider/Divider.js +39 -0
  66. package/esm/layouts/Divider/Divider.js.map +7 -0
  67. package/esm/layouts/Divider/Divider.sty.js +8 -0
  68. package/esm/layouts/Divider/Divider.sty.js.map +7 -0
  69. package/esm/layouts/index.js +5 -0
  70. package/esm/layouts/index.js.map +7 -0
  71. package/esm/styles/textStyle.css +64 -0
  72. package/esm/styles/textStyle.sty.js +7 -0
  73. package/esm/styles/textStyle.sty.js.map +7 -0
  74. package/esm/typography/BlockQuote/Blockquote.css +17 -0
  75. package/esm/typography/BlockQuote/Blockquote.js +34 -0
  76. package/esm/typography/BlockQuote/Blockquote.js.map +7 -0
  77. package/esm/typography/BlockQuote/Blockquote.sty.js +6 -0
  78. package/esm/typography/BlockQuote/Blockquote.sty.js.map +7 -0
  79. package/esm/typography/Code/Code.css +16 -0
  80. package/esm/typography/Code/Code.js +34 -0
  81. package/esm/typography/Code/Code.js.map +7 -0
  82. package/esm/typography/Code/Code.sty.js +6 -0
  83. package/esm/typography/Code/Code.sty.js.map +7 -0
  84. package/esm/typography/Emphasis/Emphasis.css +4 -0
  85. package/esm/typography/Emphasis/Emphasis.js +34 -0
  86. package/esm/typography/Emphasis/Emphasis.js.map +7 -0
  87. package/esm/typography/Emphasis/Emphasis.sty.js +6 -0
  88. package/esm/typography/Emphasis/Emphasis.sty.js.map +7 -0
  89. package/esm/typography/ExternalLink/ExternalLink.css +28 -0
  90. package/esm/typography/ExternalLink/ExternalLink.js +56 -0
  91. package/esm/typography/ExternalLink/ExternalLink.js.map +7 -0
  92. package/esm/typography/ExternalLink/ExternalLink.sty.js +6 -0
  93. package/esm/typography/ExternalLink/ExternalLink.sty.js.map +7 -0
  94. package/esm/typography/Heading/Heading.css +54 -0
  95. package/esm/typography/Heading/Heading.js +36 -0
  96. package/esm/typography/Heading/Heading.js.map +7 -0
  97. package/esm/typography/Heading/Heading.sty.js +7 -0
  98. package/esm/typography/Heading/Heading.sty.js.map +7 -0
  99. package/esm/typography/Highlight/Highlight.css +4 -0
  100. package/esm/typography/Highlight/Highlight.js +111 -0
  101. package/esm/typography/Highlight/Highlight.js.map +7 -0
  102. package/esm/typography/Highlight/Highlight.sty.js +6 -0
  103. package/esm/typography/Highlight/Highlight.sty.js.map +7 -0
  104. package/esm/typography/Link/Link.css +15 -0
  105. package/esm/typography/Link/Link.js +49 -0
  106. package/esm/typography/Link/Link.js.map +7 -0
  107. package/esm/typography/Link/Link.sty.js +6 -0
  108. package/esm/typography/Link/Link.sty.js.map +7 -0
  109. package/esm/typography/List/List.css +16 -0
  110. package/esm/typography/List/List.js +81 -0
  111. package/esm/typography/List/List.js.map +7 -0
  112. package/esm/typography/List/List.sty.js +8 -0
  113. package/esm/typography/List/List.sty.js.map +7 -0
  114. package/esm/typography/Paragraph/Paragraph.css +19 -0
  115. package/esm/typography/Paragraph/Paragraph.js +49 -0
  116. package/esm/typography/Paragraph/Paragraph.js.map +7 -0
  117. package/esm/typography/Paragraph/Paragraph.sty.js +7 -0
  118. package/esm/typography/Paragraph/Paragraph.sty.js.map +7 -0
  119. package/esm/typography/Strikethrough/Strikethrough.css +5 -0
  120. package/esm/typography/Strikethrough/Strikethrough.js +32 -0
  121. package/esm/typography/Strikethrough/Strikethrough.js.map +7 -0
  122. package/esm/typography/Strikethrough/Strikethrough.sty.js +6 -0
  123. package/esm/typography/Strikethrough/Strikethrough.sty.js.map +7 -0
  124. package/esm/typography/Strong/Strong.css +4 -0
  125. package/esm/typography/Strong/Strong.js +34 -0
  126. package/esm/typography/Strong/Strong.js.map +7 -0
  127. package/esm/typography/Strong/Strong.sty.js +6 -0
  128. package/esm/typography/Strong/Strong.sty.js.map +7 -0
  129. package/esm/typography/Text/Text.css +18 -0
  130. package/esm/typography/Text/Text.js +43 -0
  131. package/esm/typography/Text/Text.js.map +7 -0
  132. package/esm/typography/Text/Text.sty.js +7 -0
  133. package/esm/typography/Text/Text.sty.js.map +7 -0
  134. package/esm/typography/TextEllipsis/TextEllipsis.css +22 -0
  135. package/esm/typography/TextEllipsis/TextEllipsis.js +143 -0
  136. package/esm/typography/TextEllipsis/TextEllipsis.js.map +7 -0
  137. package/esm/typography/TextEllipsis/TextEllipsis.sty.js +7 -0
  138. package/esm/typography/TextEllipsis/TextEllipsis.sty.js.map +7 -0
  139. package/esm/typography/index.js +43 -0
  140. package/esm/typography/index.js.map +7 -0
  141. package/esm/typography/utils.js +101 -0
  142. package/esm/typography/utils.js.map +7 -0
  143. package/index.d.ts +2 -0
  144. package/index.js +2 -0
  145. package/lang/en.json +6 -0
  146. package/lang/uncompiled/en.json +6 -1
  147. package/layouts/Divider/Divider.css +23 -0
  148. package/layouts/Divider/Divider.d.ts +39 -0
  149. package/layouts/Divider/Divider.js +67 -0
  150. package/layouts/Divider/Divider.sty.d.ts +16 -0
  151. package/layouts/Divider/Divider.sty.js +26 -0
  152. package/layouts/index.d.ts +2 -0
  153. package/layouts/index.js +23 -0
  154. package/package.json +17 -2
  155. package/styles/textStyle.css +64 -0
  156. package/styles/textStyle.sty.d.ts +12 -0
  157. package/styles/textStyle.sty.js +25 -0
  158. package/testing/custom-render.d.ts +1 -1
  159. package/testing/mocks/resize-observer-mock.d.ts +1 -1
  160. package/testing/mocks/text-ellipsis-mock.d.ts +1 -1
  161. package/testing/mocks/text-ellipsis-mock.js +8 -3
  162. package/typography/BlockQuote/Blockquote.css +17 -0
  163. package/typography/BlockQuote/Blockquote.d.ts +19 -0
  164. package/typography/BlockQuote/Blockquote.js +62 -0
  165. package/typography/BlockQuote/Blockquote.sty.d.ts +1 -0
  166. package/typography/BlockQuote/Blockquote.sty.js +24 -0
  167. package/typography/Code/Code.css +16 -0
  168. package/typography/Code/Code.d.ts +17 -0
  169. package/typography/Code/Code.js +62 -0
  170. package/typography/Code/Code.sty.d.ts +1 -0
  171. package/typography/Code/Code.sty.js +24 -0
  172. package/typography/Emphasis/Emphasis.css +4 -0
  173. package/typography/Emphasis/Emphasis.d.ts +14 -0
  174. package/typography/Emphasis/Emphasis.js +62 -0
  175. package/typography/Emphasis/Emphasis.sty.d.ts +1 -0
  176. package/typography/Emphasis/Emphasis.sty.js +24 -0
  177. package/typography/ExternalLink/ExternalLink.css +28 -0
  178. package/typography/ExternalLink/ExternalLink.d.ts +21 -0
  179. package/typography/ExternalLink/ExternalLink.js +82 -0
  180. package/typography/ExternalLink/ExternalLink.sty.d.ts +1 -0
  181. package/typography/ExternalLink/ExternalLink.sty.js +24 -0
  182. package/typography/Heading/Heading.css +54 -0
  183. package/typography/Heading/Heading.d.ts +24 -0
  184. package/typography/Heading/Heading.js +64 -0
  185. package/typography/Heading/Heading.sty.d.ts +52 -0
  186. package/typography/Heading/Heading.sty.js +25 -0
  187. package/typography/Highlight/Highlight.css +4 -0
  188. package/typography/Highlight/Highlight.d.ts +27 -0
  189. package/typography/Highlight/Highlight.js +139 -0
  190. package/typography/Highlight/Highlight.sty.d.ts +1 -0
  191. package/typography/Highlight/Highlight.sty.js +24 -0
  192. package/typography/Link/Link.css +15 -0
  193. package/typography/Link/Link.d.ts +17 -0
  194. package/typography/Link/Link.js +75 -0
  195. package/typography/Link/Link.sty.d.ts +1 -0
  196. package/typography/Link/Link.sty.js +24 -0
  197. package/typography/List/List.css +16 -0
  198. package/typography/List/List.d.ts +39 -0
  199. package/typography/List/List.js +109 -0
  200. package/typography/List/List.sty.d.ts +2 -0
  201. package/typography/List/List.sty.js +26 -0
  202. package/typography/Paragraph/Paragraph.css +19 -0
  203. package/typography/Paragraph/Paragraph.d.ts +19 -0
  204. package/typography/Paragraph/Paragraph.js +77 -0
  205. package/typography/Paragraph/Paragraph.sty.d.ts +16 -0
  206. package/typography/Paragraph/Paragraph.sty.js +25 -0
  207. package/typography/Strikethrough/Strikethrough.css +5 -0
  208. package/typography/Strikethrough/Strikethrough.d.ts +15 -0
  209. package/typography/Strikethrough/Strikethrough.js +60 -0
  210. package/typography/Strikethrough/Strikethrough.sty.d.ts +1 -0
  211. package/typography/Strikethrough/Strikethrough.sty.js +24 -0
  212. package/typography/Strong/Strong.css +4 -0
  213. package/typography/Strong/Strong.d.ts +14 -0
  214. package/typography/Strong/Strong.js +62 -0
  215. package/typography/Strong/Strong.sty.d.ts +1 -0
  216. package/typography/Strong/Strong.sty.js +24 -0
  217. package/typography/Text/Text.css +18 -0
  218. package/typography/Text/Text.d.ts +26 -0
  219. package/typography/Text/Text.js +71 -0
  220. package/typography/Text/Text.sty.d.ts +16 -0
  221. package/typography/Text/Text.sty.js +25 -0
  222. package/typography/TextEllipsis/TextEllipsis.css +22 -0
  223. package/typography/TextEllipsis/TextEllipsis.d.ts +32 -0
  224. package/typography/TextEllipsis/TextEllipsis.js +167 -0
  225. package/typography/TextEllipsis/TextEllipsis.sty.d.ts +15 -0
  226. package/typography/TextEllipsis/TextEllipsis.sty.js +25 -0
  227. package/typography/index.d.ts +28 -0
  228. package/typography/index.js +54 -0
  229. package/typography/utils.d.ts +52 -0
  230. package/typography/utils.js +119 -0
@@ -2,16 +2,21 @@ import React, { type PropsWithChildren } from 'react';
2
2
  import 'wicg-inert';
3
3
  import './AppRoot.css.js';
4
4
  import { type DataTestId } from '../../types/data-props.js';
5
+ import { type MaskingProps } from '../../types/masking-props.js';
5
6
  import { type StylingProps } from '../../types/styling-props.js';
6
- /** AppRoot component props. */
7
- export type AppRootProps = PropsWithChildren<DataTestId & StylingProps>;
8
7
  /**
8
+ * @public
9
+ * AppRoot component props.
10
+ */
11
+ export type AppRootProps = PropsWithChildren<DataTestId & StylingProps & MaskingProps>;
12
+ /**
13
+ * @public
9
14
  * In order to have all the providers in place for rendering overlays, applying
10
15
  * global styles or internationalization, you need to wrap your app in the
11
16
  * `AppRoot`. If you're using the `dt-app` to create your app, this is
12
17
  * automatically taken care of and you can start working on your app without
13
18
  * further ado.
14
19
  */
15
- export declare const AppRoot: React.ForwardRefExoticComponent<DataTestId & StylingProps & {
20
+ export declare const AppRoot: (props: DataTestId & StylingProps & MaskingProps & {
16
21
  children?: React.ReactNode;
17
- } & React.RefAttributes<HTMLDivElement>>;
22
+ } & React.RefAttributes<HTMLDivElement>) => React.ReactElement<any, string | React.JSXElementConstructor<any>> | null;
@@ -49,7 +49,9 @@ const AppRoot = /* @__PURE__ */ (0, import_react.forwardRef)(
49
49
  const {
50
50
  style: consumerStyle,
51
51
  className: consumerClassName,
52
- "data-testid": dataTestId = "app-root"
52
+ "data-testid": dataTestId = "app-root",
53
+ "data-dtrum-mask": dataDtrumMask,
54
+ "data-dtrum-allow": dataDtrumAllow
53
55
  } = props;
54
56
  const [messages, setMessages] = (0, import_react.useState)({});
55
57
  const { children } = props;
@@ -94,7 +96,9 @@ const AppRoot = /* @__PURE__ */ (0, import_react.forwardRef)(
94
96
  "data-testid": dataTestId,
95
97
  className: consumerClassName,
96
98
  style: consumerStyle,
97
- "data-theme": theme
99
+ "data-theme": theme,
100
+ "data-dtrum-mask": dataDtrumMask,
101
+ "data-dtrum-allow": dataDtrumAllow
98
102
  },
99
103
  /* @__PURE__ */ import_react.default.createElement(
100
104
  import_react_intl.IntlProvider,
@@ -1,4 +1,4 @@
1
- import { Modality } from '../providers/FocusProvider.js';
1
+ import type { Modality } from '../providers/FocusProvider.js';
2
2
  /**
3
3
  * Defines the contents of the FocusContext.
4
4
  * @internal
@@ -1,2 +1,5 @@
1
- /** Returns the current theme based on sdk-setting or browsers preferred color-scheme */
1
+ /**
2
+ * @public
3
+ * Returns the current theme based on sdk-setting or browsers preferred color-scheme
4
+ */
2
5
  export declare function useCurrentTheme(): 'light' | 'dark';
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Hook that checks if the initially loaded fonts were updated.
3
+ * Used to trigger remeasuring in the DataTable (autoWidth) and TextEllipsis once all fonts are loaded.
4
+ *
5
+ * @param callback - optionally pass a function to be executed once when the fonts were updated
6
+ * @returns boolean whether the fonts have changed
7
+ * @internal
8
+ */
9
+ export declare function _useFontsUpdated(callback?: () => void): boolean;
@@ -0,0 +1,51 @@
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 useFontsUpdated_exports = {};
19
+ __export(useFontsUpdated_exports, {
20
+ _useFontsUpdated: () => _useFontsUpdated
21
+ });
22
+ module.exports = __toCommonJS(useFontsUpdated_exports);
23
+ var import_lodash_es = require("lodash");
24
+ var import_react = require("react");
25
+ function _useFontsUpdated(callback) {
26
+ const [fontsUpdated, setFontsUpdated] = (0, import_react.useState)(false);
27
+ const prevFontFamilies = (0, import_react.useRef)();
28
+ const fontFamilies = [];
29
+ const firstRender = (0, import_react.useRef)(true);
30
+ if (document.fonts) {
31
+ if (firstRender.current) {
32
+ const loadedFontFamilies = [];
33
+ document.fonts.forEach(
34
+ (fontFace) => loadedFontFamilies.push(`${fontFace.family} ${fontFace.weight}`)
35
+ );
36
+ prevFontFamilies.current = loadedFontFamilies;
37
+ firstRender.current = false;
38
+ }
39
+ document.fonts.ready.then((fontFaceSet) => {
40
+ fontFaceSet.forEach(
41
+ (fontFace) => fontFamilies.push(`${fontFace.family} ${fontFace.weight}`)
42
+ );
43
+ if (!(0, import_lodash_es.isEqual)(prevFontFamilies.current, fontFamilies)) {
44
+ prevFontFamilies.current = fontFamilies;
45
+ callback?.();
46
+ setFontsUpdated(true);
47
+ }
48
+ });
49
+ }
50
+ return fontsUpdated;
51
+ }
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ /**
3
+ * If you have multiple references (e.g. from different hooks) you need to apply to
4
+ * the same element, you can use the `useMergeRefs` hook to combine them into one
5
+ * reference.
6
+ */
7
+ export declare function useMergeRefs<T = unknown>(refs: Array<React.MutableRefObject<T> | React.LegacyRef<T> | React.Dispatch<React.SetStateAction<T | null>> | undefined>): React.RefCallback<T>;
@@ -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 useMergeRefs_exports = {};
19
+ __export(useMergeRefs_exports, {
20
+ useMergeRefs: () => useMergeRefs
21
+ });
22
+ module.exports = __toCommonJS(useMergeRefs_exports);
23
+ var import_react = require("react");
24
+ function useMergeRefs(refs) {
25
+ return (0, import_react.useCallback)((value) => {
26
+ for (const ref of refs) {
27
+ if (typeof ref === "function") {
28
+ ref(value);
29
+ } else if (ref !== void 0 && ref !== null) {
30
+ ref.current = value;
31
+ }
32
+ }
33
+ }, refs);
34
+ }
package/core/index.d.ts CHANGED
@@ -4,6 +4,7 @@ export { type FocusContextProps as _FocusContextProps } from './contexts/FocusCo
4
4
  export { useCurrentTheme } from './hooks/useCurrentTheme.js';
5
5
  export { useFocusContext as _useFocusContext } from './hooks/useFocusContext.js';
6
6
  export { FocusProvider as _FocusProvider, type Modality as _Modality, } from './providers/FocusProvider.js';
7
+ export type { MaskingProps } from './types/masking-props.js';
7
8
  export type { DataTestId } from './types/data-props.js';
8
9
  export type { StylingProps } from './types/styling-props.js';
9
10
  export type { WithChildren } from './types/with-children.js';
@@ -14,3 +15,7 @@ export { getLastFocusableChild as _getLastFocusableChild } from './utils/focus-m
14
15
  export { isFocusable as _isFocusable } from './utils/focus-management/is-focusable.js';
15
16
  export { isBrowser as _isBrowser } from './utils/isBrowser.js';
16
17
  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
+ export { type _HeadingLevel, type _HeadingTag } from './types/heading.js';
@@ -0,0 +1,88 @@
1
+ .focusRing_focusRingCSS__z2r50s3 {
2
+ outline: none;
3
+ }
4
+ .focusRing_focusRingCSS__z2r50s3:focus-visible {
5
+ outline: none;
6
+ }
7
+ .focusRing_focusRingCSS_minimal_true__z2r50s4 {
8
+ border-radius: calc(var(--dt-borders-radius-field-subdued, 4px) / 2);
9
+ box-shadow: inset 0 0 0 var(--dt-borders-width-default, 1px) var(--outerShadow__z2r50s0);
10
+ background-color: var(--backgroundColor__z2r50s2);
11
+ }
12
+ .focusRing_focusRingCSS_minimal_false__z2r50s5.focusRing_focusRingCSS_minimal_false__z2r50s5 {
13
+ box-shadow: inset 0 0 0 var(--dt-borders-width-emphasized, 2px) var(--outerShadow__z2r50s0), inset 0 0 0 calc(var(--dt-borders-width-emphasized, 2px) + 1px) var(--innerShadow__z2r50s1);
14
+ }
15
+ .focusRing_focusRingCSS_variant_neutral__z2r50s6 {
16
+ --outerShadow__z2r50s0: var(--dt-colors-border-neutral-accent, #545587);
17
+ --innerShadow__z2r50s1: var(--dt-colors-border-neutral-default, #d2d3e1);
18
+ --backgroundColor__z2r50s2: var(--dt-colors-background-field-neutral-emphasized, #dadbe7);
19
+ }
20
+ .focusRing_focusRingCSS_variant_primary__z2r50s7 {
21
+ --outerShadow__z2r50s0: var(--dt-colors-border-primary-accent, #454cc9);
22
+ --innerShadow__z2r50s1: var(--dt-colors-border-primary-default, #ccd3f3);
23
+ --backgroundColor__z2r50s2: var(--dt-colors-background-field-primary-emphasized, #d6dbf4);
24
+ }
25
+ .focusRing_focusRingCSS_variant_success__z2r50s8 {
26
+ --outerShadow__z2r50s0: var(--dt-colors-border-success-accent, #2c6360);
27
+ --innerShadow__z2r50s1: var(--dt-colors-border-success-default, #cad6d7);
28
+ --backgroundColor__z2r50s2: var(--dt-colors-background-field-success-emphasized, #d4dddf);
29
+ }
30
+ .focusRing_focusRingCSS_variant_warning__z2r50s9 {
31
+ --outerShadow__z2r50s0: var(--dt-colors-border-warning-accent, #805100);
32
+ --innerShadow__z2r50s1: var(--dt-colors-border-warning-default, #f4e5d5);
33
+ --backgroundColor__z2r50s2: var(--dt-colors-background-field-warning-emphasized, #f4e8de);
34
+ }
35
+ .focusRing_focusRingCSS_variant_critical__z2r50sa {
36
+ --outerShadow__z2r50s0: var(--dt-colors-border-critical-accent, #b80031);
37
+ --innerShadow__z2r50s1: var(--dt-colors-border-critical-default, #f1cdcf);
38
+ --backgroundColor__z2r50s2: var(--dt-colors-background-field-critical-emphasized, #f2d7d9);
39
+ }
40
+ .focusRing_focusRingCSS_variant_onAccent__z2r50sb {
41
+ --outerShadow__z2r50s0: var(--dt-colors-border-on-accent-default, #f3f3f7);
42
+ --innerShadow__z2r50s1: var(--dt-colors-border-on-accent-default, #f3f3f7);
43
+ --backgroundColor__z2r50s2: var(--dt-colors-background-field-on-accent-emphasized, #f3f3f733);
44
+ }
45
+ .focusRing_focusRingFocusWithinCSS__z2r50sc:focus-within {
46
+ outline: none;
47
+ :focus-visible {
48
+ outline: none;
49
+ }
50
+ }
51
+ .focusRing_focusRingFocusWithinCSS_minimal_true__z2r50sd:focus-within {
52
+ border-radius: calc(var(--dt-borders-radius-field-subdued, 4px) / 2);
53
+ box-shadow: inset 0 0 0 var(--dt-borders-width-default, 1px) var(--outerShadow__z2r50s0);
54
+ background-color: var(--backgroundColor__z2r50s2);
55
+ }
56
+ .focusRing_focusRingFocusWithinCSS_minimal_false__z2r50se:focus-within {
57
+ box-shadow: inset 0 0 0 var(--dt-borders-width-emphasized, 2px) var(--outerShadow__z2r50s0), inset 0 0 0 calc(var(--dt-borders-width-emphasized, 2px) + 1px) var(--innerShadow__z2r50s1);
58
+ }
59
+ .focusRing_focusRingFocusWithinCSS_variant_neutral__z2r50sf {
60
+ --outerShadow__z2r50s0: var(--dt-colors-border-neutral-accent, #545587);
61
+ --innerShadow__z2r50s1: var(--dt-colors-border-neutral-default, #d2d3e1);
62
+ --backgroundColor__z2r50s2: var(--dt-colors-background-field-neutral-emphasized, #dadbe7);
63
+ }
64
+ .focusRing_focusRingFocusWithinCSS_variant_primary__z2r50sg {
65
+ --outerShadow__z2r50s0: var(--dt-colors-border-primary-accent, #454cc9);
66
+ --innerShadow__z2r50s1: var(--dt-colors-border-primary-default, #ccd3f3);
67
+ --backgroundColor__z2r50s2: var(--dt-colors-background-field-primary-emphasized, #d6dbf4);
68
+ }
69
+ .focusRing_focusRingFocusWithinCSS_variant_success__z2r50sh {
70
+ --outerShadow__z2r50s0: var(--dt-colors-border-success-accent, #2c6360);
71
+ --innerShadow__z2r50s1: var(--dt-colors-border-success-default, #cad6d7);
72
+ --backgroundColor__z2r50s2: var(--dt-colors-background-field-success-emphasized, #d4dddf);
73
+ }
74
+ .focusRing_focusRingFocusWithinCSS_variant_warning__z2r50si {
75
+ --outerShadow__z2r50s0: var(--dt-colors-border-warning-accent, #805100);
76
+ --innerShadow__z2r50s1: var(--dt-colors-border-warning-default, #f4e5d5);
77
+ --backgroundColor__z2r50s2: var(--dt-colors-background-field-warning-emphasized, #f4e8de);
78
+ }
79
+ .focusRing_focusRingFocusWithinCSS_variant_critical__z2r50sj {
80
+ --outerShadow__z2r50s0: var(--dt-colors-border-critical-accent, #b80031);
81
+ --innerShadow__z2r50s1: var(--dt-colors-border-critical-default, #f1cdcf);
82
+ --backgroundColor__z2r50s2: var(--dt-colors-background-field-critical-emphasized, #f2d7d9);
83
+ }
84
+ .focusRing_focusRingFocusWithinCSS_variant_onAccent__z2r50sk {
85
+ --outerShadow__z2r50s0: var(--dt-colors-border-on-accent-default, #f3f3f7);
86
+ --innerShadow__z2r50s1: var(--dt-colors-border-on-accent-default, #f3f3f7);
87
+ --backgroundColor__z2r50s2: var(--dt-colors-background-field-on-accent-emphasized, #f3f3f733);
88
+ }
@@ -0,0 +1,96 @@
1
+ export declare const focusRingCSS: import("@vanilla-extract/recipes").RuntimeFn<{
2
+ minimal: {
3
+ true: {
4
+ borderRadius: string;
5
+ boxShadow: string;
6
+ backgroundColor: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
7
+ };
8
+ false: {
9
+ selectors: {
10
+ '&&': {
11
+ boxShadow: string;
12
+ };
13
+ };
14
+ };
15
+ };
16
+ variant: {
17
+ neutral: {
18
+ vars: {
19
+ [x: string]: string;
20
+ };
21
+ };
22
+ primary: {
23
+ vars: {
24
+ [x: string]: string;
25
+ };
26
+ };
27
+ success: {
28
+ vars: {
29
+ [x: string]: string;
30
+ };
31
+ };
32
+ warning: {
33
+ vars: {
34
+ [x: string]: string;
35
+ };
36
+ };
37
+ critical: {
38
+ vars: {
39
+ [x: string]: string;
40
+ };
41
+ };
42
+ onAccent: {
43
+ vars: {
44
+ [x: string]: string;
45
+ };
46
+ };
47
+ };
48
+ }>;
49
+ export declare const focusRingFocusWithinCSS: import("@vanilla-extract/recipes").RuntimeFn<{
50
+ minimal: {
51
+ true: {
52
+ ':focus-within': {
53
+ borderRadius: string;
54
+ boxShadow: string;
55
+ backgroundColor: `var(--${string})` | `var(--${string}, ${string})` | `var(--${string}, ${number})`;
56
+ };
57
+ };
58
+ false: {
59
+ ':focus-within': {
60
+ boxShadow: string;
61
+ };
62
+ };
63
+ };
64
+ variant: {
65
+ neutral: {
66
+ vars: {
67
+ [x: string]: string;
68
+ };
69
+ };
70
+ primary: {
71
+ vars: {
72
+ [x: string]: string;
73
+ };
74
+ };
75
+ success: {
76
+ vars: {
77
+ [x: string]: string;
78
+ };
79
+ };
80
+ warning: {
81
+ vars: {
82
+ [x: string]: string;
83
+ };
84
+ };
85
+ critical: {
86
+ vars: {
87
+ [x: string]: string;
88
+ };
89
+ };
90
+ onAccent: {
91
+ vars: {
92
+ [x: string]: string;
93
+ };
94
+ };
95
+ };
96
+ }>;
@@ -0,0 +1,27 @@
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 focusRing_css_exports = {};
19
+ __export(focusRing_css_exports, {
20
+ focusRingCSS: () => focusRingCSS,
21
+ focusRingFocusWithinCSS: () => focusRingFocusWithinCSS
22
+ });
23
+ module.exports = __toCommonJS(focusRing_css_exports);
24
+ var import_focusRing_css_ts_vanilla = require("./focusRing.css");
25
+ var import_createRuntimeFn = require("@vanilla-extract/recipes/createRuntimeFn");
26
+ var focusRingCSS = (0, import_createRuntimeFn.createRuntimeFn)({ defaultClassName: "focusRing_focusRingCSS__z2r50s3", variantClassNames: { minimal: { true: "focusRing_focusRingCSS_minimal_true__z2r50s4", false: "focusRing_focusRingCSS_minimal_false__z2r50s5" }, variant: { neutral: "focusRing_focusRingCSS_variant_neutral__z2r50s6", primary: "focusRing_focusRingCSS_variant_primary__z2r50s7", success: "focusRing_focusRingCSS_variant_success__z2r50s8", warning: "focusRing_focusRingCSS_variant_warning__z2r50s9", critical: "focusRing_focusRingCSS_variant_critical__z2r50sa", onAccent: "focusRing_focusRingCSS_variant_onAccent__z2r50sb" } }, defaultVariants: {}, compoundVariants: [] });
27
+ var focusRingFocusWithinCSS = (0, import_createRuntimeFn.createRuntimeFn)({ defaultClassName: "focusRing_focusRingFocusWithinCSS__z2r50sc", variantClassNames: { minimal: { true: "focusRing_focusRingFocusWithinCSS_minimal_true__z2r50sd", false: "focusRing_focusRingFocusWithinCSS_minimal_false__z2r50se" }, variant: { neutral: "focusRing_focusRingFocusWithinCSS_variant_neutral__z2r50sf", primary: "focusRing_focusRingFocusWithinCSS_variant_primary__z2r50sg", success: "focusRing_focusRingFocusWithinCSS_variant_success__z2r50sh", warning: "focusRing_focusRingFocusWithinCSS_variant_warning__z2r50si", critical: "focusRing_focusRingFocusWithinCSS_variant_critical__z2r50sj", onAccent: "focusRing_focusRingFocusWithinCSS_variant_onAccent__z2r50sk" } }, defaultVariants: {}, compoundVariants: [] });
@@ -0,0 +1,49 @@
1
+ import { FocusEvent } from 'react';
2
+ export type Modality = 'keyboard' | 'pointer' | 'touch' | 'unknown';
3
+ /** @internal */
4
+ export declare const variants: readonly ["neutral", "primary", "success", "warning", "critical", "onAccent"];
5
+ /** @internal */
6
+ export type VariantType = (typeof variants)[number];
7
+ /** @internal */
8
+ export type UseFocusRingProps = {
9
+ /**
10
+ * A minimal focus outline is available for smaller content elements like links. This variant is applied when set to true.
11
+ * @defaultValue false
12
+ */
13
+ isMinimal?: boolean;
14
+ /**
15
+ * Whether or not the modality should be ignored, so that the focus ring is also present if users clicks the element (not just by tabbing to it).
16
+ * @defaultValue false
17
+ */
18
+ ignoreModality?: boolean;
19
+ /**
20
+ * The styling variant of the element.
21
+ * @defaultValue neutral
22
+ */
23
+ variant?: VariantType;
24
+ /**
25
+ * Apply the focus ring styling if an embedded element gains the focus
26
+ */
27
+ focusWithin?: boolean;
28
+ /**
29
+ * Whether the element is disabled. If disabled changes to true, the focus will be removed.
30
+ */
31
+ disabled?: boolean;
32
+ };
33
+ export type FocusRingProps = {
34
+ /** The focus styles that depend on modality. */
35
+ focusClassName: string;
36
+ /** Focus handlers used to manage the focus state. Must be applied to the element that receives the focus.*/
37
+ focusProps: {
38
+ onFocus: (e: FocusEvent) => void;
39
+ onBlur: (e: FocusEvent) => void;
40
+ };
41
+ /** Whether or not the element got focus via keyboard. */
42
+ isFocusVisible: boolean;
43
+ };
44
+ /**
45
+ * Custom hook used to determine focus styling depending on modality.
46
+ * Returns the css classes (vanilla) that can be applied to the component in order to show the correct focus outline.
47
+ * @internal
48
+ */
49
+ export declare function useFocusRing(props?: UseFocusRingProps): FocusRingProps;
@@ -0,0 +1,83 @@
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 useFocusRing_exports = {};
19
+ __export(useFocusRing_exports, {
20
+ useFocusRing: () => useFocusRing,
21
+ variants: () => variants
22
+ });
23
+ module.exports = __toCommonJS(useFocusRing_exports);
24
+ var import_react = require("react");
25
+ var import_focusRing_css = require("./focusRing.sty.js");
26
+ var import__ = require("../index.js");
27
+ const variants = [
28
+ "neutral",
29
+ "primary",
30
+ "success",
31
+ "warning",
32
+ "critical",
33
+ "onAccent"
34
+ ];
35
+ function useFocusRing(props = {}) {
36
+ const {
37
+ variant = "neutral",
38
+ ignoreModality = false,
39
+ isMinimal = false,
40
+ focusWithin = false,
41
+ disabled = false
42
+ } = props;
43
+ const [isFocused, setIsFocused] = (0, import_react.useState)(false);
44
+ const { modality } = (0, import__._useFocusContext)();
45
+ (0, import_react.useEffect)(() => {
46
+ if (disabled) {
47
+ setIsFocused(false);
48
+ }
49
+ }, [disabled]);
50
+ const onBlur = (0, import_react.useCallback)((e) => {
51
+ if (e.currentTarget === e.target) {
52
+ setIsFocused(false);
53
+ }
54
+ }, []);
55
+ const onFocus = (0, import_react.useCallback)((e) => {
56
+ if (e.currentTarget === e.target) {
57
+ setIsFocused(true);
58
+ }
59
+ }, []);
60
+ const focusProps = {
61
+ onFocus,
62
+ onBlur
63
+ };
64
+ if ((ignoreModality || modality === "keyboard") && isFocused || focusWithin) {
65
+ if (isMinimal) {
66
+ return {
67
+ focusClassName: focusWithin ? (0, import_focusRing_css.focusRingFocusWithinCSS)({ minimal: true, variant }) : (0, import_focusRing_css.focusRingCSS)({ minimal: true, variant }),
68
+ isFocusVisible: !focusWithin,
69
+ focusProps
70
+ };
71
+ }
72
+ return {
73
+ focusClassName: focusWithin ? (0, import_focusRing_css.focusRingFocusWithinCSS)({ minimal: false, variant }) : (0, import_focusRing_css.focusRingCSS)({ minimal: false, variant }),
74
+ isFocusVisible: !focusWithin,
75
+ focusProps
76
+ };
77
+ }
78
+ return {
79
+ focusClassName: focusWithin ? (0, import_focusRing_css.focusRingFocusWithinCSS)() : (0, import_focusRing_css.focusRingCSS)(),
80
+ isFocusVisible: false,
81
+ focusProps
82
+ };
83
+ }
@@ -0,0 +1,19 @@
1
+ import type { AriaAttributes } from 'react';
2
+ /** @public */
3
+ export interface AriaLabelingProps {
4
+ /** Labels the current element. */
5
+ 'aria-label'?: string;
6
+ /** Identifies the element (or elements) that label(s) the current element. */
7
+ 'aria-labelledby'?: string;
8
+ /** Identifies the element (or elements) that describe(s) the object. */
9
+ 'aria-describedby'?: string;
10
+ /** Identifies the element (or elements) that provide(s) a detailed, extended description for the object. */
11
+ 'aria-details'?: string;
12
+ }
13
+ export type AriaDisabledProps = {
14
+ /**
15
+ * Whether the element and all focusable descendants are disabled.
16
+ * `aria-disabled="true"` only semantically exposes these elements as being disabled.
17
+ */
18
+ 'aria-disabled'?: AriaAttributes['aria-disabled'];
19
+ };
@@ -0,0 +1,15 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __copyProps = (to, from, except, desc) => {
6
+ if (from && typeof from === "object" || typeof from === "function") {
7
+ for (let key of __getOwnPropNames(from))
8
+ if (!__hasOwnProp.call(to, key) && key !== except)
9
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
10
+ }
11
+ return to;
12
+ };
13
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
14
+ var a11y_props_exports = {};
15
+ module.exports = __toCommonJS(a11y_props_exports);
@@ -1,4 +1,5 @@
1
1
  /**
2
+ * @public
2
3
  * Type defining the data-testid prop that is mapped to the rendered components root node.
3
4
  */
4
5
  export type DataTestId = {
@@ -0,0 +1,19 @@
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
+ /**
11
+ * The props of a DOM Element.
12
+ * @public
13
+ * */
14
+ 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
+ */
18
+ id?: string;
19
+ }
@@ -0,0 +1,15 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __copyProps = (to, from, except, desc) => {
6
+ if (from && typeof from === "object" || typeof from === "function") {
7
+ for (let key of __getOwnPropNames(from))
8
+ if (!__hasOwnProp.call(to, key) && key !== except)
9
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
10
+ }
11
+ return to;
12
+ };
13
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
14
+ var dom_exports = {};
15
+ module.exports = __toCommonJS(dom_exports);
@@ -0,0 +1,5 @@
1
+ /**
2
+ * @public
3
+ * Any focusable element, including both HTML and SVG elements. */
4
+ export interface FocusableElement extends Element, HTMLOrSVGElement {
5
+ }
@@ -0,0 +1,15 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __copyProps = (to, from, except, desc) => {
6
+ if (from && typeof from === "object" || typeof from === "function") {
7
+ for (let key of __getOwnPropNames(from))
8
+ if (!__hasOwnProp.call(to, key) && key !== except)
9
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
10
+ }
11
+ return to;
12
+ };
13
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
14
+ var focusable_element_exports = {};
15
+ module.exports = __toCommonJS(focusable_element_exports);
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Type for heading levels
3
+ * @internal
4
+ */
5
+ export type _HeadingLevel = 1 | 2 | 3 | 4 | 5 | 6;
6
+ /** Type for all correct semantic html tags
7
+ * @internal
8
+ */
9
+ export type _HeadingTag = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';