@dynatrace/strato-components 0.85.21 → 0.85.32
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.
- package/buttons/button/Button.d.ts +4 -4
- package/buttons/button/Label.d.ts +1 -1
- package/buttons/button/Prefix.d.ts +1 -1
- package/buttons/button/Suffix.d.ts +1 -1
- package/buttons/intent-button/IntentButton.d.ts +1 -1
- package/content/progress/ProgressBar.d.ts +4 -4
- package/content/progress/ProgressBarIcon.d.ts +1 -1
- package/content/progress/ProgressBarLabel.d.ts +1 -1
- package/content/progress/ProgressBarValue.d.ts +1 -1
- package/content/progress/ProgressCircle.d.ts +1 -1
- package/content/skeleton/Skeleton.d.ts +1 -1
- package/content/skeleton/SkeletonText.d.ts +1 -1
- package/core/components/app-root/AppRoot.d.ts +2 -2
- package/core/components/focus-scope/FocusScope.d.ts +1 -1
- package/core/contexts/FocusContext.d.ts +1 -2
- package/core/providers/FocusProvider.d.ts +2 -3
- package/esm/core/components/focus-scope/FocusScope.js.map +1 -1
- package/esm/core/contexts/FocusContext.js.map +2 -2
- package/esm/core/providers/FocusProvider.js.map +2 -2
- package/esm/layouts/hooks/useBreakpoint.js +44 -0
- package/esm/layouts/hooks/useBreakpoint.js.map +7 -0
- package/esm/layouts/index.js +3 -1
- package/esm/layouts/index.js.map +2 -2
- package/esm/typography/text/Text.js.map +2 -2
- package/layouts/divider/Divider.d.ts +1 -1
- package/layouts/hooks/useBreakpoint.d.ts +27 -0
- package/layouts/hooks/useBreakpoint.js +62 -0
- package/layouts/index.d.ts +1 -0
- package/layouts/index.js +3 -1
- package/package.json +10 -3
- package/typography/block-quote/Blockquote.d.ts +1 -1
- package/typography/code/Code.d.ts +1 -1
- package/typography/emphasis/Emphasis.d.ts +1 -1
- package/typography/external-link/ExternalLink.d.ts +1 -1
- package/typography/heading/Heading.d.ts +1 -1
- package/typography/list/List.d.ts +1 -1
- package/typography/paragraph/Paragraph.d.ts +1 -1
- package/typography/strikethrough/Strikethrough.d.ts +1 -1
- package/typography/strong/Strong.d.ts +1 -1
- package/typography/text/Text.d.ts +2 -1
- package/typography/text-ellipsis/TextEllipsis.d.ts +1 -1
|
@@ -86,9 +86,9 @@ export declare const _Button: <E extends ElementType = 'button'>(props: ButtonPr
|
|
|
86
86
|
* `Enter` or `Space` while the button has focus.
|
|
87
87
|
* @public
|
|
88
88
|
*/
|
|
89
|
-
export declare const Button: (<E extends
|
|
90
|
-
Suffix: (props: import("./Suffix.js").ButtonSuffixProps & React.RefAttributes<HTMLDivElement>) => React.ReactElement
|
|
91
|
-
Prefix: (props: import("./Prefix.js").ButtonPrefixProps & React.RefAttributes<HTMLDivElement>) => React.ReactElement
|
|
92
|
-
Label: (props: import("./Label.js").ButtonLabelProps & React.RefAttributes<HTMLDivElement>) => React.ReactElement
|
|
89
|
+
export declare const Button: (<E extends ElementType = "button">(props: ButtonProps<E>) => ReactElement | null) & {
|
|
90
|
+
Suffix: (props: import("./Suffix.js").ButtonSuffixProps & React.RefAttributes<HTMLDivElement>) => React.ReactElement | null;
|
|
91
|
+
Prefix: (props: import("./Prefix.js").ButtonPrefixProps & React.RefAttributes<HTMLDivElement>) => React.ReactElement | null;
|
|
92
|
+
Label: (props: import("./Label.js").ButtonLabelProps & React.RefAttributes<HTMLDivElement>) => React.ReactElement | null;
|
|
93
93
|
};
|
|
94
94
|
export {};
|
|
@@ -13,4 +13,4 @@ export interface ButtonLabelProps extends StylingProps, DataTestId {
|
|
|
13
13
|
* Button Label component.
|
|
14
14
|
* @public
|
|
15
15
|
*/
|
|
16
|
-
export declare const Label: (props: ButtonLabelProps & React.RefAttributes<HTMLDivElement>) => React.ReactElement
|
|
16
|
+
export declare const Label: (props: ButtonLabelProps & React.RefAttributes<HTMLDivElement>) => React.ReactElement | null;
|
|
@@ -13,4 +13,4 @@ export interface ButtonPrefixProps extends StylingProps, DataTestId {
|
|
|
13
13
|
* Button Prefix component.
|
|
14
14
|
* @public
|
|
15
15
|
*/
|
|
16
|
-
export declare const Prefix: (props: ButtonPrefixProps & React.RefAttributes<HTMLDivElement>) => React.ReactElement
|
|
16
|
+
export declare const Prefix: (props: ButtonPrefixProps & React.RefAttributes<HTMLDivElement>) => React.ReactElement | null;
|
|
@@ -13,4 +13,4 @@ export interface ButtonSuffixProps extends StylingProps, DataTestId {
|
|
|
13
13
|
* Button Suffix component.
|
|
14
14
|
* @public
|
|
15
15
|
*/
|
|
16
|
-
export declare const Suffix: (props: ButtonSuffixProps & React.RefAttributes<HTMLDivElement>) => React.ReactElement
|
|
16
|
+
export declare const Suffix: (props: ButtonSuffixProps & React.RefAttributes<HTMLDivElement>) => React.ReactElement | null;
|
|
@@ -41,4 +41,4 @@ export type IntentButtonProps = IntentButtonPropsBase & ({
|
|
|
41
41
|
* in the AppShell context.
|
|
42
42
|
* @public
|
|
43
43
|
*/
|
|
44
|
-
export declare const IntentButton: (props: IntentButtonProps & React.RefAttributes<HTMLAnchorElement>) => React.ReactElement
|
|
44
|
+
export declare const IntentButton: (props: IntentButtonProps & React.RefAttributes<HTMLAnchorElement>) => React.ReactElement | null;
|
|
@@ -49,8 +49,8 @@ export interface ProgressBarProps extends WithChildren, DOMProps, AriaLabelingPr
|
|
|
49
49
|
* The `ProgressBar` can be used to visualize determinate or indeterminate progress.
|
|
50
50
|
* @public
|
|
51
51
|
*/
|
|
52
|
-
export declare const ProgressBar: ((props: ProgressBarProps & React.RefAttributes<HTMLDivElement>) => React.ReactElement
|
|
53
|
-
Value: (props: import("./ProgressBarValue.js").ProgressBarValueProps & React.RefAttributes<HTMLDivElement>) => React.ReactElement
|
|
54
|
-
Label: (props: import("./ProgressBarLabel.js").ProgressBarLabelProps & React.RefAttributes<HTMLLabelElement>) => React.ReactElement
|
|
55
|
-
Icon: (props: import("./ProgressBarIcon.js").ProgressBarIconProps & React.RefAttributes<HTMLDivElement>) => React.ReactElement
|
|
52
|
+
export declare const ProgressBar: ((props: ProgressBarProps & React.RefAttributes<HTMLDivElement>) => React.ReactElement | null) & {
|
|
53
|
+
Value: (props: import("./ProgressBarValue.js").ProgressBarValueProps & React.RefAttributes<HTMLDivElement>) => React.ReactElement | null;
|
|
54
|
+
Label: (props: import("./ProgressBarLabel.js").ProgressBarLabelProps & React.RefAttributes<HTMLLabelElement>) => React.ReactElement | null;
|
|
55
|
+
Icon: (props: import("./ProgressBarIcon.js").ProgressBarIconProps & React.RefAttributes<HTMLDivElement>) => React.ReactElement | null;
|
|
56
56
|
};
|
|
@@ -12,4 +12,4 @@ export interface ProgressBarIconProps extends WithChildren, StylingProps, DataTe
|
|
|
12
12
|
* The ProgressBarIcon subcomponent is rendered inside the ProgressBar component.
|
|
13
13
|
* @public
|
|
14
14
|
*/
|
|
15
|
-
export declare const ProgressBarIcon: (props: ProgressBarIconProps & React.RefAttributes<HTMLDivElement>) => React.ReactElement
|
|
15
|
+
export declare const ProgressBarIcon: (props: ProgressBarIconProps & React.RefAttributes<HTMLDivElement>) => React.ReactElement | null;
|
|
@@ -12,4 +12,4 @@ export interface ProgressBarLabelProps extends WithChildren, StylingProps, DataT
|
|
|
12
12
|
* ProgressBarLabel sub-component is rendered inside ProgressBar component.
|
|
13
13
|
* @public
|
|
14
14
|
*/
|
|
15
|
-
export declare const ProgressBarLabel: (props: ProgressBarLabelProps & React.RefAttributes<HTMLLabelElement>) => React.ReactElement
|
|
15
|
+
export declare const ProgressBarLabel: (props: ProgressBarLabelProps & React.RefAttributes<HTMLLabelElement>) => React.ReactElement | null;
|
|
@@ -12,4 +12,4 @@ export interface ProgressBarValueProps extends WithChildren, StylingProps, DataT
|
|
|
12
12
|
* ProgressBarValue sub-component is rendered inside ProgressBar component.
|
|
13
13
|
* @public
|
|
14
14
|
*/
|
|
15
|
-
export declare const ProgressBarValue: (props: ProgressBarValueProps & React.RefAttributes<HTMLDivElement>) => React.ReactElement
|
|
15
|
+
export declare const ProgressBarValue: (props: ProgressBarValueProps & React.RefAttributes<HTMLDivElement>) => React.ReactElement | null;
|
|
@@ -48,4 +48,4 @@ export interface ProgressCircleProps extends WithChildren, DOMProps, AriaLabelin
|
|
|
48
48
|
* The `ProgressCircle` component is used to indicate the progress or completion status of a task or process.
|
|
49
49
|
* @public
|
|
50
50
|
* */
|
|
51
|
-
export declare const ProgressCircle: (props: ProgressCircleProps & React.RefAttributes<HTMLDivElement>) => React.ReactElement
|
|
51
|
+
export declare const ProgressCircle: (props: ProgressCircleProps & React.RefAttributes<HTMLDivElement>) => React.ReactElement | null;
|
|
@@ -27,4 +27,4 @@ export interface SkeletonProps extends WithChildren, StylingProps, DataTestId {
|
|
|
27
27
|
* The `Skeleton` component renders a colored block with an animated background, indicating that something is loading.
|
|
28
28
|
* @public
|
|
29
29
|
*/
|
|
30
|
-
export declare const Skeleton: (props: SkeletonProps & React.RefAttributes<HTMLDivElement>) => React.ReactElement
|
|
30
|
+
export declare const Skeleton: (props: SkeletonProps & React.RefAttributes<HTMLDivElement>) => React.ReactElement | null;
|
|
@@ -21,4 +21,4 @@ export interface SkeletonTextProps extends StylingProps, DataTestId {
|
|
|
21
21
|
* The `SkeletonText` component renders a specified number of placeholder boxes for lines of text with an animated background.
|
|
22
22
|
* @public
|
|
23
23
|
*/
|
|
24
|
-
export declare const SkeletonText: (props: SkeletonTextProps & React.RefAttributes<HTMLDivElement>) => React.ReactElement
|
|
24
|
+
export declare const SkeletonText: (props: SkeletonTextProps & React.RefAttributes<HTMLDivElement>) => React.ReactElement | null;
|
|
@@ -18,5 +18,5 @@ export type AppRootProps = PropsWithChildren<DataTestId & StylingProps & Masking
|
|
|
18
18
|
* @public
|
|
19
19
|
*/
|
|
20
20
|
export declare const AppRoot: (props: DataTestId & StylingProps & MaskingProps & {
|
|
21
|
-
children?: React.ReactNode;
|
|
22
|
-
} & React.RefAttributes<HTMLDivElement>) => React.ReactElement
|
|
21
|
+
children?: React.ReactNode | undefined;
|
|
22
|
+
} & React.RefAttributes<HTMLDivElement>) => React.ReactElement | null;
|
|
@@ -17,11 +17,11 @@ export interface FocusScopeProps extends WithChildren {
|
|
|
17
17
|
contain?: boolean;
|
|
18
18
|
}
|
|
19
19
|
/**
|
|
20
|
-
* @internal
|
|
21
20
|
* The `FocusScope` helps you manage the focus when opening any overlay. If you
|
|
22
21
|
* want to create a custom overlay, you can wrap the content of your overlay in the
|
|
23
22
|
* `FocusScope` to help you make the overlay accessible and handle focus
|
|
24
23
|
* appropriately.
|
|
24
|
+
* @internal
|
|
25
25
|
*/
|
|
26
26
|
export declare const FocusScope: {
|
|
27
27
|
(props: FocusScopeProps): React.JSX.Element;
|
|
@@ -9,11 +9,10 @@ export type FocusContextProps = {
|
|
|
9
9
|
setBackgroundInertness: (value: boolean) => void;
|
|
10
10
|
};
|
|
11
11
|
/**
|
|
12
|
-
* @internal
|
|
13
|
-
*
|
|
14
12
|
* This context keeps all information needed for proper focus management.
|
|
15
13
|
* @param modality - currently used pointer device
|
|
16
14
|
* @param backgroundInertness - if the background (behind overlays) is currently inert (inactive)
|
|
17
15
|
* @param setBackgroundInertness - updates the backgrounds active status
|
|
16
|
+
* @internal
|
|
18
17
|
*/
|
|
19
18
|
export declare const FocusContext: import("react").Context<FocusContextProps>;
|
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { WithChildren } from '../types/with-children.js';
|
|
3
3
|
/**
|
|
4
|
-
* @internal
|
|
5
4
|
* Type defining the modality options for the focus handling.
|
|
5
|
+
* @internal
|
|
6
6
|
*/
|
|
7
7
|
export type Modality = 'keyboard' | 'pointer' | 'touch' | 'unknown';
|
|
8
8
|
/**
|
|
9
|
-
* @internal
|
|
10
|
-
*
|
|
11
9
|
* Provider that can be reused in components for storing the focus context props.
|
|
12
10
|
* Loosely inspired by [what-input-js](https://github.com/ten1seven/what-input/blob/main/src/scripts/what-input.js).
|
|
11
|
+
* @internal
|
|
13
12
|
*/
|
|
14
13
|
export declare const FocusProvider: {
|
|
15
14
|
({ children }: WithChildren): React.JSX.Element;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/core/components/focus-scope/FocusScope.tsx"],
|
|
4
|
-
"sourcesContent": ["import React, { useEffect, useRef } from 'react';\n\nimport { useActiveElement } from '../../hooks/useActiveElement.js';\nimport { useFocusContext } from '../../hooks/useFocusContext.js';\nimport type { WithChildren } from '../../types/with-children.js';\nimport { focusFirstDescendant } from '../../utils/focus-management/focus-first-descendant.js';\n\n// #region Types\n\n/**\n * Prop definition of the `FocusScope` component.\n * @internal\n */\nexport interface FocusScopeProps extends WithChildren {\n /**\n * If set to true, the focus scope automatically focuses the first focusable element inside.\n * @defaultValue false\n */\n autoFocus?: boolean;\n /**\n * If set to true, the focus scope traps the focus inside.\n * @defaultValue false\n */\n contain?: boolean;\n}\n// #endregion Types\n\n/**\n *
|
|
4
|
+
"sourcesContent": ["import React, { useEffect, useRef } from 'react';\n\nimport { useActiveElement } from '../../hooks/useActiveElement.js';\nimport { useFocusContext } from '../../hooks/useFocusContext.js';\nimport type { WithChildren } from '../../types/with-children.js';\nimport { focusFirstDescendant } from '../../utils/focus-management/focus-first-descendant.js';\n\n// #region Types\n\n/**\n * Prop definition of the `FocusScope` component.\n * @internal\n */\nexport interface FocusScopeProps extends WithChildren {\n /**\n * If set to true, the focus scope automatically focuses the first focusable element inside.\n * @defaultValue false\n */\n autoFocus?: boolean;\n /**\n * If set to true, the focus scope traps the focus inside.\n * @defaultValue false\n */\n contain?: boolean;\n}\n// #endregion Types\n\n/**\n * The `FocusScope` helps you manage the focus when opening any overlay. If you\n * want to create a custom overlay, you can wrap the content of your overlay in the\n * `FocusScope` to help you make the overlay accessible and handle focus\n * appropriately.\n * @internal\n */\nexport const FocusScope = (props: FocusScopeProps) => {\n const { autoFocus, contain, children } = props;\n const focusContext = useFocusContext();\n const wrapperRef = useRef<HTMLDivElement>(null);\n const focusedElement = useActiveElement();\n const triggerElement = useRef(focusedElement);\n\n useEffect(() => {\n if (contain || autoFocus) {\n focusFirstDescendant(wrapperRef.current);\n }\n\n if (contain) {\n focusContext.setBackgroundInertness(true);\n const triggerElementCopy = triggerElement.current;\n\n return () => {\n focusContext.setBackgroundInertness(false);\n // The focus must be restored on the trigger after removing the inert prop on\n // AppRoot (rendering complete). SetTimeout creates a macrotask to change queueing order.\n window.setTimeout(() => triggerElementCopy.focus(), 0);\n };\n }\n\n if (!autoFocus && !contain) {\n document.addEventListener('keydown', (e) => {\n if (e.key !== 'Tab') {\n return;\n }\n\n if (e.target === triggerElement.current) {\n e.preventDefault();\n focusFirstDescendant(wrapperRef.current);\n }\n });\n }\n\n const triggerElementCopy = triggerElement.current;\n\n return () => {\n // restore focus on trigger when unmounting the focusscope\n triggerElementCopy.focus();\n };\n\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [contain, autoFocus]);\n\n return (\n <div\n style={{ display: 'contents' }}\n ref={wrapperRef}\n aria-labelledby={triggerElement.current.id}\n // Prevents that focus is lost when clicking on non-focusable items inside (atm used in the internal Drawer).\n // Probably worth considering moving that to the focusScope when redoing the overlays.\n // tabIndex={-1}\n >\n {children}\n </div>\n );\n};\n\nFocusScope.displayName = 'FocusScope';\n"],
|
|
5
5
|
"mappings": "AAAA,OAAO,SAAS,WAAW,cAAc;AAEzC,SAAS,wBAAwB;AACjC,SAAS,uBAAuB;AAEhC,SAAS,4BAA4B;AA6B9B,MAAM,aAAa,CAAC,UAA2B;AACpD,QAAM,EAAE,WAAW,SAAS,SAAS,IAAI;AACzC,QAAM,eAAe,gBAAgB;AACrC,QAAM,aAAa,OAAuB,IAAI;AAC9C,QAAM,iBAAiB,iBAAiB;AACxC,QAAM,iBAAiB,OAAO,cAAc;AAE5C,YAAU,MAAM;AACd,QAAI,WAAW,WAAW;AACxB,2BAAqB,WAAW,OAAO;AAAA,IACzC;AAEA,QAAI,SAAS;AACX,mBAAa,uBAAuB,IAAI;AACxC,YAAMA,sBAAqB,eAAe;AAE1C,aAAO,MAAM;AACX,qBAAa,uBAAuB,KAAK;AAGzC,eAAO,WAAW,MAAMA,oBAAmB,MAAM,GAAG,CAAC;AAAA,MACvD;AAAA,IACF;AAEA,QAAI,CAAC,aAAa,CAAC,SAAS;AAC1B,eAAS,iBAAiB,WAAW,CAAC,MAAM;AAC1C,YAAI,EAAE,QAAQ,OAAO;AACnB;AAAA,QACF;AAEA,YAAI,EAAE,WAAW,eAAe,SAAS;AACvC,YAAE,eAAe;AACjB,+BAAqB,WAAW,OAAO;AAAA,QACzC;AAAA,MACF,CAAC;AAAA,IACH;AAEA,UAAM,qBAAqB,eAAe;AAE1C,WAAO,MAAM;AAEX,yBAAmB,MAAM;AAAA,IAC3B;AAAA,EAGF,GAAG,CAAC,SAAS,SAAS,CAAC;AAEvB,SACE;AAAA,IAAC;AAAA;AAAA,MACC,OAAO,EAAE,SAAS,WAAW;AAAA,MAC7B,KAAK;AAAA,MACL,mBAAiB,eAAe,QAAQ;AAAA;AAAA,IAKvC;AAAA,EACH;AAEJ;AAEA,WAAW,cAAc;",
|
|
6
6
|
"names": ["triggerElementCopy"]
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/core/contexts/FocusContext.tsx"],
|
|
4
|
-
"sourcesContent": ["import { createContext } from 'react';\n\nimport type { Modality } from '../providers/FocusProvider.js';\n\n/**\n * Defines the contents of the FocusContext.\n * @internal\n */\nexport type FocusContextProps = {\n backgroundInertness?: boolean;\n modality: Modality;\n setBackgroundInertness: (value: boolean) => void;\n};\n\n/**\n *
|
|
5
|
-
"mappings": "AAAA,SAAS,qBAAqB;
|
|
4
|
+
"sourcesContent": ["import { createContext } from 'react';\n\nimport type { Modality } from '../providers/FocusProvider.js';\n\n/**\n * Defines the contents of the FocusContext.\n * @internal\n */\nexport type FocusContextProps = {\n backgroundInertness?: boolean;\n modality: Modality;\n setBackgroundInertness: (value: boolean) => void;\n};\n\n/**\n * This context keeps all information needed for proper focus management.\n * @param modality - currently used pointer device\n * @param backgroundInertness - if the background (behind overlays) is currently inert (inactive)\n * @param setBackgroundInertness - updates the backgrounds active status\n * @internal\n */\nexport const FocusContext = createContext<FocusContextProps>({\n modality: 'unknown',\n backgroundInertness: undefined,\n setBackgroundInertness: (value) => null,\n});\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,qBAAqB;AAqBvB,MAAM,eAAe,cAAiC;AAAA,EAC3D,UAAU;AAAA,EACV,qBAAqB;AAAA,EACrB,wBAAwB,CAAC,UAAU;AACrC,CAAC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/core/providers/FocusProvider.tsx"],
|
|
4
|
-
"sourcesContent": ["import React, { useCallback, useEffect, useState } from 'react';\n\nimport { FocusContext } from '../contexts/FocusContext.js';\nimport { useFocusContext } from '../hooks/useFocusContext.js';\nimport type { WithChildren } from '../types/with-children.js';\nimport { mergeProps } from '../utils/merge-props.js';\n\n// list of modifier keys commonly used in a mouse or keyboard combination,\n// see https://developer.mozilla.org/en-US/docs/Web/API/UI_Events/Keyboard_event_key_values#modifier_keys.\nconst ignoreMap = [\n 'Alt',\n 'AltGraph',\n 'CapsLock',\n 'Control',\n 'Fn',\n 'FnLock',\n 'Hyper',\n 'Meta', // Command (Mac), in some browsers also Windows-key\n 'NumLock',\n 'OS', // Windows-key\n 'ScrollLock',\n 'Super', // Virtual keyboard key\n 'Symbol',\n 'SymbolLock',\n];\n\n/** Look-up map of all event types and the corresponding modalities. */\nconst eventTypeMap: Record<string, string> = {\n keydown: 'keyboard',\n keyup: 'keyboard',\n mousedown: 'mouse',\n mousemove: 'mouse',\n MSPointerDown: 'pointer',\n MSPointerMove: 'pointer',\n pointerdown: 'pointer',\n pointermove: 'pointer',\n touchstart: 'touch',\n touchend: 'touch',\n wheel: 'wheel',\n};\n\n/**\n *
|
|
5
|
-
"mappings": "AAAA,OAAO,SAAS,aAAa,WAAW,gBAAgB;AAExD,SAAS,oBAAoB;AAC7B,SAAS,uBAAuB;AAEhC,SAAS,kBAAkB;AAI3B,MAAM,YAAY;AAAA,EAChB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA;AAAA,EACA;AAAA,EACA;AAAA;AAAA,EACA;AAAA,EACA;AAAA;AAAA,EACA;AAAA,EACA;AACF;AAGA,MAAM,eAAuC;AAAA,EAC3C,SAAS;AAAA,EACT,OAAO;AAAA,EACP,WAAW;AAAA,EACX,WAAW;AAAA,EACX,eAAe;AAAA,EACf,eAAe;AAAA,EACf,aAAa;AAAA,EACb,aAAa;AAAA,EACb,YAAY;AAAA,EACZ,UAAU;AAAA,EACV,OAAO;AACT;AAYA,MAAM,mBAAmB;AAAA,EACvB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;
|
|
4
|
+
"sourcesContent": ["import React, { useCallback, useEffect, useState } from 'react';\n\nimport { FocusContext } from '../contexts/FocusContext.js';\nimport { useFocusContext } from '../hooks/useFocusContext.js';\nimport type { WithChildren } from '../types/with-children.js';\nimport { mergeProps } from '../utils/merge-props.js';\n\n// list of modifier keys commonly used in a mouse or keyboard combination,\n// see https://developer.mozilla.org/en-US/docs/Web/API/UI_Events/Keyboard_event_key_values#modifier_keys.\nconst ignoreMap = [\n 'Alt',\n 'AltGraph',\n 'CapsLock',\n 'Control',\n 'Fn',\n 'FnLock',\n 'Hyper',\n 'Meta', // Command (Mac), in some browsers also Windows-key\n 'NumLock',\n 'OS', // Windows-key\n 'ScrollLock',\n 'Super', // Virtual keyboard key\n 'Symbol',\n 'SymbolLock',\n];\n\n/** Look-up map of all event types and the corresponding modalities. */\nconst eventTypeMap: Record<string, string> = {\n keydown: 'keyboard',\n keyup: 'keyboard',\n mousedown: 'mouse',\n mousemove: 'mouse',\n MSPointerDown: 'pointer',\n MSPointerMove: 'pointer',\n pointerdown: 'pointer',\n pointermove: 'pointer',\n touchstart: 'touch',\n touchend: 'touch',\n wheel: 'wheel',\n};\n\n/**\n * Type defining the modality options for the focus handling.\n * @internal\n */\nexport type Modality = 'keyboard' | 'pointer' | 'touch' | 'unknown';\n\n/**\n * All navigational keys that should be considered keyboard users,\n * see https://developer.mozilla.org/en-US/docs/Web/API/UI_Events/Keyboard_event_key_values#navigation_keys\n */\nconst navigationalKeys = [\n 'Tab',\n 'Esc',\n 'Escape',\n ' ',\n 'ArrowDown',\n 'Down',\n 'ArrowUp',\n 'Up',\n 'ArrowLeft',\n 'Left',\n 'ArrowRight',\n 'Right',\n 'End',\n 'Home',\n 'PageDown',\n 'PageUp',\n];\n\n/**\n * Provider that can be reused in components for storing the focus context props.\n * Loosely inspired by [what-input-js](https://github.com/ten1seven/what-input/blob/main/src/scripts/what-input.js).\n * @internal\n */\nexport const FocusProvider = ({ children }: WithChildren) => {\n const [backgroundInertness, setBackgroundInertness] = useState(false);\n const focusContext = useFocusContext();\n const [modality, setModality] = useState<Modality>('unknown');\n\n const setKeyboardInputModality = useCallback((event: KeyboardEvent) => {\n if (ignoreMap.includes(event.key)) {\n setModality('pointer');\n return;\n }\n\n if (!event.target || navigationalKeys.includes(event.key)) {\n setModality('keyboard');\n }\n }, []);\n\n const setMouseInputModality = useCallback((event: MouseEvent) => {\n switch (eventTypeMap[event.type]) {\n case 'touch':\n case 'pen':\n return setModality('touch');\n case 'mouse':\n case 'pointer':\n case 'wheel':\n return setModality('pointer');\n default:\n return 'unknown';\n }\n }, []);\n\n useEffect(() => {\n window.addEventListener('pointerdown', setMouseInputModality);\n // we need to rely on the keydown event (already in the capture phase) here so we don't break usages where the event default behavior is prevented or propagation is stopped,\n // which would otherwise get the wrong, initial, modality (unknown); by using the capture phase, we can ensure we set the modality correctly before the other events occur\n window.addEventListener('keydown', setKeyboardInputModality, {\n capture: true,\n });\n window.addEventListener('wheel', setMouseInputModality);\n\n return () => {\n window.removeEventListener('pointerdown', setMouseInputModality);\n window.removeEventListener('keydown', setKeyboardInputModality, {\n capture: true,\n });\n window.removeEventListener('wheel', setMouseInputModality);\n };\n }, [setKeyboardInputModality, setMouseInputModality]);\n\n const focusProps = backgroundInertness\n ? {\n inert: 'true',\n tabIndex: -1,\n 'aria-hidden': true,\n }\n : { inert: undefined, tabIndex: undefined, 'aria-hidden': false };\n\n return (\n <FocusContext.Provider\n value={{\n ...mergeProps(focusContext, {\n backgroundInertness,\n setBackgroundInertness,\n modality,\n }),\n }}\n >\n <div {...focusProps}>{children}</div>\n </FocusContext.Provider>\n );\n};\n\nFocusProvider['displayName'] = 'FocusProvider';\n"],
|
|
5
|
+
"mappings": "AAAA,OAAO,SAAS,aAAa,WAAW,gBAAgB;AAExD,SAAS,oBAAoB;AAC7B,SAAS,uBAAuB;AAEhC,SAAS,kBAAkB;AAI3B,MAAM,YAAY;AAAA,EAChB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA;AAAA,EACA;AAAA,EACA;AAAA;AAAA,EACA;AAAA,EACA;AAAA;AAAA,EACA;AAAA,EACA;AACF;AAGA,MAAM,eAAuC;AAAA,EAC3C,SAAS;AAAA,EACT,OAAO;AAAA,EACP,WAAW;AAAA,EACX,WAAW;AAAA,EACX,eAAe;AAAA,EACf,eAAe;AAAA,EACf,aAAa;AAAA,EACb,aAAa;AAAA,EACb,YAAY;AAAA,EACZ,UAAU;AAAA,EACV,OAAO;AACT;AAYA,MAAM,mBAAmB;AAAA,EACvB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAOO,MAAM,gBAAgB,CAAC,EAAE,SAAS,MAAoB;AAC3D,QAAM,CAAC,qBAAqB,sBAAsB,IAAI,SAAS,KAAK;AACpE,QAAM,eAAe,gBAAgB;AACrC,QAAM,CAAC,UAAU,WAAW,IAAI,SAAmB,SAAS;AAE5D,QAAM,2BAA2B,YAAY,CAAC,UAAyB;AACrE,QAAI,UAAU,SAAS,MAAM,GAAG,GAAG;AACjC,kBAAY,SAAS;AACrB;AAAA,IACF;AAEA,QAAI,CAAC,MAAM,UAAU,iBAAiB,SAAS,MAAM,GAAG,GAAG;AACzD,kBAAY,UAAU;AAAA,IACxB;AAAA,EACF,GAAG,CAAC,CAAC;AAEL,QAAM,wBAAwB,YAAY,CAAC,UAAsB;AAC/D,YAAQ,aAAa,MAAM,IAAI,GAAG;AAAA,MAChC,KAAK;AAAA,MACL,KAAK;AACH,eAAO,YAAY,OAAO;AAAA,MAC5B,KAAK;AAAA,MACL,KAAK;AAAA,MACL,KAAK;AACH,eAAO,YAAY,SAAS;AAAA,MAC9B;AACE,eAAO;AAAA,IACX;AAAA,EACF,GAAG,CAAC,CAAC;AAEL,YAAU,MAAM;AACd,WAAO,iBAAiB,eAAe,qBAAqB;AAG5D,WAAO,iBAAiB,WAAW,0BAA0B;AAAA,MAC3D,SAAS;AAAA,IACX,CAAC;AACD,WAAO,iBAAiB,SAAS,qBAAqB;AAEtD,WAAO,MAAM;AACX,aAAO,oBAAoB,eAAe,qBAAqB;AAC/D,aAAO,oBAAoB,WAAW,0BAA0B;AAAA,QAC9D,SAAS;AAAA,MACX,CAAC;AACD,aAAO,oBAAoB,SAAS,qBAAqB;AAAA,IAC3D;AAAA,EACF,GAAG,CAAC,0BAA0B,qBAAqB,CAAC;AAEpD,QAAM,aAAa,sBACf;AAAA,IACE,OAAO;AAAA,IACP,UAAU;AAAA,IACV,eAAe;AAAA,EACjB,IACA,EAAE,OAAO,QAAW,UAAU,QAAW,eAAe,MAAM;AAElE,SACE;AAAA,IAAC,aAAa;AAAA,IAAb;AAAA,MACC,OAAO;AAAA,QACL,GAAG,WAAW,cAAc;AAAA,UAC1B;AAAA,UACA;AAAA,UACA;AAAA,QACF,CAAC;AAAA,MACH;AAAA;AAAA,IAEA,oCAAC,SAAK,GAAG,cAAa,QAAS;AAAA,EACjC;AAEJ;AAEA,cAAc,aAAa,IAAI;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { useCallback, useMemo, useSyncExternalStore } from "react";
|
|
2
|
+
function useBreakpoint(queries, ssrInitialValue) {
|
|
3
|
+
const _ssrInitialValue = ssrInitialValue ?? (Array.isArray(queries) ? [] : false);
|
|
4
|
+
const mediaQueryLists = useMemo(() => {
|
|
5
|
+
const queryStrings = Array.isArray(queries) ? queries : [queries];
|
|
6
|
+
return queryStrings.map((q) => window.matchMedia(q));
|
|
7
|
+
}, [queries]);
|
|
8
|
+
const subscribe = useCallback(
|
|
9
|
+
(callback) => {
|
|
10
|
+
mediaQueryLists.forEach(
|
|
11
|
+
(mql) => mql.addEventListener("change", callback)
|
|
12
|
+
);
|
|
13
|
+
return () => {
|
|
14
|
+
mediaQueryLists.forEach(
|
|
15
|
+
(mql) => mql.removeEventListener("change", callback)
|
|
16
|
+
);
|
|
17
|
+
};
|
|
18
|
+
},
|
|
19
|
+
[mediaQueryLists]
|
|
20
|
+
);
|
|
21
|
+
const getSnapshot = () => {
|
|
22
|
+
return JSON.stringify(mediaQueryLists.map((q) => q.matches));
|
|
23
|
+
};
|
|
24
|
+
const getServerSnapshot = () => {
|
|
25
|
+
if (Array.isArray(_ssrInitialValue)) {
|
|
26
|
+
const adjustedValue = _ssrInitialValue.concat(Array(queries.length).fill(false)).slice(0, queries.length);
|
|
27
|
+
return JSON.stringify(adjustedValue);
|
|
28
|
+
}
|
|
29
|
+
return JSON.stringify([_ssrInitialValue]);
|
|
30
|
+
};
|
|
31
|
+
const queryValues = useSyncExternalStore(
|
|
32
|
+
subscribe,
|
|
33
|
+
getSnapshot,
|
|
34
|
+
getServerSnapshot
|
|
35
|
+
);
|
|
36
|
+
if (!Array.isArray(queries)) {
|
|
37
|
+
return JSON.parse(queryValues)[0];
|
|
38
|
+
}
|
|
39
|
+
return JSON.parse(queryValues);
|
|
40
|
+
}
|
|
41
|
+
export {
|
|
42
|
+
useBreakpoint
|
|
43
|
+
};
|
|
44
|
+
//# sourceMappingURL=useBreakpoint.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/layouts/hooks/useBreakpoint.ts"],
|
|
4
|
+
"sourcesContent": ["// taken and adapted from https://github.com/jepser/use-match-media\n\nimport { useCallback, useMemo, useSyncExternalStore } from 'react';\n\n/**\n * `useBreakpoint` is a hook used to determine if the document matches the media\n * query string (or media query list). It will listen to the breakpoints specified\n * and will return a boolean value indicating if this media query is met or not.\n * @public\n */\nfunction useBreakpoint(\n /** Media Query you want to test, eg '(min-width: 800px)' */\n query: string,\n /** Default value (fallback value to support SSR)\n * @defaultValue false\n */\n ssrInitialValue?: boolean,\n): boolean;\n\n/**\n * `useBreakpoint` is a hook used to determine if the document matches the media\n * query string (or media query list). It will listen to the breakpoints specified\n * and will return a boolean value indicating if this media query is met or not.\n * @public\n */\nfunction useBreakpoint(\n /** Media Queries you want to test, eg '[(min-width: 400px), (min-width: 800px)]' */\n queries: string[],\n /** Default values (fallback values to support SSR)\n * @defaultValue []\n */\n ssrInitialValue?: boolean[],\n): boolean[];\n\n/** @public */\nfunction useBreakpoint(\n queries: string | string[],\n ssrInitialValue?: boolean | boolean[],\n): boolean | boolean[] {\n const _ssrInitialValue =\n ssrInitialValue ?? (Array.isArray(queries) ? [] : false);\n\n const mediaQueryLists = useMemo(() => {\n const queryStrings = Array.isArray(queries) ? queries : [queries];\n return queryStrings.map((q) => window.matchMedia(q));\n }, [queries]);\n\n const subscribe = useCallback(\n (callback: () => void) => {\n mediaQueryLists.forEach((mql) =>\n mql.addEventListener('change', callback),\n );\n return (): void => {\n mediaQueryLists.forEach((mql) =>\n mql.removeEventListener('change', callback),\n );\n };\n },\n [mediaQueryLists],\n );\n\n /**\n * Generates an immutable snapshot of the current media query matches.\n * This is necessary to ensure the snapshot remains consistent and does not change.\n * @see {@link https://react.dev/reference/react/useSyncExternalStore#im-getting-an-error-the-result-of-getsnapshot-should-be-cached}\n */\n const getSnapshot = () => {\n return JSON.stringify(mediaQueryLists.map((q) => q.matches));\n };\n\n const getServerSnapshot = () => {\n if (Array.isArray(_ssrInitialValue)) {\n // Ensure the array is filled with false values or sliced to match queries.length\n const adjustedValue = _ssrInitialValue\n .concat(Array(queries.length).fill(false))\n .slice(0, queries.length);\n return JSON.stringify(adjustedValue);\n }\n return JSON.stringify([_ssrInitialValue] || [false]);\n };\n\n const queryValues = useSyncExternalStore(\n subscribe,\n getSnapshot,\n getServerSnapshot,\n );\n\n if (!Array.isArray(queries)) {\n return JSON.parse(queryValues)[0];\n }\n return JSON.parse(queryValues);\n}\n\nexport { useBreakpoint };\n"],
|
|
5
|
+
"mappings": "AAEA,SAAS,aAAa,SAAS,4BAA4B;AAiC3D,SAAS,cACP,SACA,iBACqB;AACrB,QAAM,mBACJ,oBAAoB,MAAM,QAAQ,OAAO,IAAI,CAAC,IAAI;AAEpD,QAAM,kBAAkB,QAAQ,MAAM;AACpC,UAAM,eAAe,MAAM,QAAQ,OAAO,IAAI,UAAU,CAAC,OAAO;AAChE,WAAO,aAAa,IAAI,CAAC,MAAM,OAAO,WAAW,CAAC,CAAC;AAAA,EACrD,GAAG,CAAC,OAAO,CAAC;AAEZ,QAAM,YAAY;AAAA,IAChB,CAAC,aAAyB;AACxB,sBAAgB;AAAA,QAAQ,CAAC,QACvB,IAAI,iBAAiB,UAAU,QAAQ;AAAA,MACzC;AACA,aAAO,MAAY;AACjB,wBAAgB;AAAA,UAAQ,CAAC,QACvB,IAAI,oBAAoB,UAAU,QAAQ;AAAA,QAC5C;AAAA,MACF;AAAA,IACF;AAAA,IACA,CAAC,eAAe;AAAA,EAClB;AAOA,QAAM,cAAc,MAAM;AACxB,WAAO,KAAK,UAAU,gBAAgB,IAAI,CAAC,MAAM,EAAE,OAAO,CAAC;AAAA,EAC7D;AAEA,QAAM,oBAAoB,MAAM;AAC9B,QAAI,MAAM,QAAQ,gBAAgB,GAAG;AAEnC,YAAM,gBAAgB,iBACnB,OAAO,MAAM,QAAQ,MAAM,EAAE,KAAK,KAAK,CAAC,EACxC,MAAM,GAAG,QAAQ,MAAM;AAC1B,aAAO,KAAK,UAAU,aAAa;AAAA,IACrC;AACA,WAAO,KAAK,UAAU,CAAC,gBAAgB,CAAY;AAAA,EACrD;AAEA,QAAM,cAAc;AAAA,IAClB;AAAA,IACA;AAAA,IACA;AAAA,EACF;AAEA,MAAI,CAAC,MAAM,QAAQ,OAAO,GAAG;AAC3B,WAAO,KAAK,MAAM,WAAW,EAAE,CAAC;AAAA,EAClC;AACA,SAAO,KAAK,MAAM,WAAW;AAC/B;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/esm/layouts/index.js
CHANGED
|
@@ -4,12 +4,14 @@ import { Divider } from "./divider/Divider.js";
|
|
|
4
4
|
import { Container } from "./container/Container.js";
|
|
5
5
|
import { Surface } from "./surface/Surface.js";
|
|
6
6
|
import { surfaceBorderRadius } from "./surface/variables.sty.js";
|
|
7
|
+
import { useBreakpoint } from "./hooks/useBreakpoint.js";
|
|
7
8
|
export {
|
|
8
9
|
Container,
|
|
9
10
|
Divider,
|
|
10
11
|
Flex,
|
|
11
12
|
Grid,
|
|
12
13
|
Surface,
|
|
13
|
-
surfaceBorderRadius as _surfaceBorderRadius
|
|
14
|
+
surfaceBorderRadius as _surfaceBorderRadius,
|
|
15
|
+
useBreakpoint
|
|
14
16
|
};
|
|
15
17
|
//# sourceMappingURL=index.js.map
|
package/esm/layouts/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/layouts/index.ts"],
|
|
4
|
-
"sourcesContent": ["export { Flex, type FlexOwnProps, type FlexProps } from './flex/Flex.js';\nexport { Grid, type GridOwnProps, type GridProps } from './grid/Grid.js';\nexport { Divider } from './divider/Divider.js';\nexport type { DividerProps } from './divider/Divider.js';\nexport { Container } from './container/Container.js';\nexport type {\n ContainerOwnProps,\n ContainerProps,\n} from './container/Container.js';\nexport type { LayoutSizeCSS } from './types/layout.types.js';\nexport { Surface } from './surface/Surface.js';\nexport type { SurfaceOwnProps, SurfaceProps } from './surface/Surface.js';\nexport { surfaceBorderRadius as _surfaceBorderRadius } from './surface/variables.sty.js';\n"],
|
|
5
|
-
"mappings": "AAAA,SAAS,YAA+C;AACxD,SAAS,YAA+C;AACxD,SAAS,eAAe;AAExB,SAAS,iBAAiB;AAM1B,SAAS,eAAe;AAExB,SAAgC,2BAA4B;",
|
|
4
|
+
"sourcesContent": ["export { Flex, type FlexOwnProps, type FlexProps } from './flex/Flex.js';\nexport { Grid, type GridOwnProps, type GridProps } from './grid/Grid.js';\nexport { Divider } from './divider/Divider.js';\nexport type { DividerProps } from './divider/Divider.js';\nexport { Container } from './container/Container.js';\nexport type {\n ContainerOwnProps,\n ContainerProps,\n} from './container/Container.js';\nexport type { LayoutSizeCSS } from './types/layout.types.js';\nexport { Surface } from './surface/Surface.js';\nexport type { SurfaceOwnProps, SurfaceProps } from './surface/Surface.js';\nexport { surfaceBorderRadius as _surfaceBorderRadius } from './surface/variables.sty.js';\nexport { useBreakpoint } from './hooks/useBreakpoint.js';\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,YAA+C;AACxD,SAAS,YAA+C;AACxD,SAAS,eAAe;AAExB,SAAS,iBAAiB;AAM1B,SAAS,eAAe;AAExB,SAAgC,2BAA4B;AAC5D,SAAS,qBAAqB;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/typography/text/Text.tsx"],
|
|
4
|
-
"sourcesContent": ["import clsx from 'clsx';\nimport React, { type ElementType, type ReactElement, forwardRef } from 'react';\n\nimport { textCSS } from './Text.sty.js';\nimport type { AriaLabelingProps } from '../../core/types/a11y-props.js';\nimport type { DataTestId } from '../../core/types/data-props.js';\nimport type { DOMProps } from '../../core/types/dom.js';\nimport type { MaskingProps } from '../../core/types/masking-props.js';\nimport type { 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 { textStyleCSS } from '../../styles/textStyle.sty.js';\n\n/**\n * The props for the text component without any props coming from polymorphing.\n * @public\n */\nexport interface TextOwnProps\n extends WithChildren,\n DOMProps,\n AriaLabelingProps,\n StylingProps,\n DataTestId,\n MaskingProps {\n /** Sets the text style. Variants include \"base\", \"base-emphasized\", etc. */\n textStyle?: 'base' | 'base-emphasized' | 'small' | 'small-emphasized';\n /** Sets the font style. Can either be \"text\" or \"code\" */\n fontStyle?: 'text' | 'code';\n}\n\n/**\n *
|
|
5
|
-
"mappings": "AAAA,OAAO,UAAU;AACjB,OAAO,SAA8C,kBAAkB;AAEvE,SAAS,eAAe;AAQxB,SAAS,oBAAoB;
|
|
4
|
+
"sourcesContent": ["import clsx from 'clsx';\nimport React, { type ElementType, type ReactElement, forwardRef } from 'react';\n\nimport { textCSS } from './Text.sty.js';\nimport type { AriaLabelingProps } from '../../core/types/a11y-props.js';\nimport type { DataTestId } from '../../core/types/data-props.js';\nimport type { DOMProps } from '../../core/types/dom.js';\nimport type { MaskingProps } from '../../core/types/masking-props.js';\nimport type { 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 { textStyleCSS } from '../../styles/textStyle.sty.js';\n\n/**\n * The props for the text component without any props coming from polymorphing.\n * @public\n */\nexport interface TextOwnProps\n extends WithChildren,\n DOMProps,\n AriaLabelingProps,\n StylingProps,\n DataTestId,\n MaskingProps {\n /** Sets the text style. Variants include \"base\", \"base-emphasized\", etc. */\n textStyle?: 'base' | 'base-emphasized' | 'small' | 'small-emphasized';\n /** Sets the font style. Can either be \"text\" or \"code\" */\n fontStyle?: 'text' | 'code';\n}\n\n/**\n * Combined props for the text component - polymorphing and own props.\n * @public\n */\nexport type TextProps<E extends ElementType> = PolymorphicComponentProps<\n E,\n TextOwnProps\n>;\n\n/**\n * Use the `Text` component for text that is rendered without any semantic markup.\n * @public\n */\nexport const Text: <E extends ElementType = 'span'>(\n props: TextProps<E>,\n) => ReactElement | null = /* @__PURE__ */ forwardRef(\n <E extends ElementType>(\n {\n children,\n textStyle,\n fontStyle,\n as,\n className: consumerClassName,\n style: consumerStyle,\n 'data-testid': dataTestId,\n 'data-dtrum-mask': dataDtrumMask,\n 'data-dtrum-allow': dataDtrumAllow,\n ...remainingProps\n }: TextProps<E>,\n ref: typeof remainingProps.ref,\n ) => {\n const TextTag = as || 'span';\n\n let ellipsis: undefined | 'singleLine' | 'multiLine';\n\n return (\n <TextTag\n data-testid={dataTestId}\n data-dtrum-mask={dataDtrumMask}\n data-dtrum-allow={dataDtrumAllow}\n ref={ref}\n className={clsx([\n textCSS({ ellipsis }),\n (fontStyle || textStyle) && textStyleCSS({ fontStyle, textStyle }),\n consumerClassName,\n ])}\n style={consumerStyle}\n {...remainingProps}\n >\n {children}\n </TextTag>\n );\n },\n);\n\n(Text as typeof Text & { displayName: string }).displayName = 'Text';\n"],
|
|
5
|
+
"mappings": "AAAA,OAAO,UAAU;AACjB,OAAO,SAA8C,kBAAkB;AAEvE,SAAS,eAAe;AAQxB,SAAS,oBAAoB;AAgCtB,MAAM,OAE8B;AAAA,EACzC,CACE;AAAA,IACE;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,WAAW;AAAA,IACX,OAAO;AAAA,IACP,eAAe;AAAA,IACf,mBAAmB;AAAA,IACnB,oBAAoB;AAAA,IACpB,GAAG;AAAA,EACL,GACA,QACG;AACH,UAAM,UAAU,MAAM;AAEtB,QAAI;AAEJ,WACE;AAAA,MAAC;AAAA;AAAA,QACC,eAAa;AAAA,QACb,mBAAiB;AAAA,QACjB,oBAAkB;AAAA,QAClB;AAAA,QACA,WAAW,KAAK;AAAA,UACd,QAAQ,EAAE,SAAS,CAAC;AAAA,WACnB,aAAa,cAAc,aAAa,EAAE,WAAW,UAAU,CAAC;AAAA,UACjE;AAAA,QACF,CAAC;AAAA,QACD,OAAO;AAAA,QACN,GAAG;AAAA;AAAA,MAEH;AAAA,IACH;AAAA,EAEJ;AACF;AAEC,KAA+C,cAAc;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -36,4 +36,4 @@ export interface DividerProps extends StylingProps, DataTestId {
|
|
|
36
36
|
* The `Divider` component visually separates groups of content.
|
|
37
37
|
* @public
|
|
38
38
|
*/
|
|
39
|
-
export declare const Divider: (props: DividerProps & React.RefAttributes<HTMLDivElement | HTMLHRElement>) => React.ReactElement
|
|
39
|
+
export declare const Divider: (props: DividerProps & React.RefAttributes<HTMLDivElement | HTMLHRElement>) => React.ReactElement | null;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `useBreakpoint` is a hook used to determine if the document matches the media
|
|
3
|
+
* query string (or media query list). It will listen to the breakpoints specified
|
|
4
|
+
* and will return a boolean value indicating if this media query is met or not.
|
|
5
|
+
* @public
|
|
6
|
+
*/
|
|
7
|
+
declare function useBreakpoint(
|
|
8
|
+
/** Media Query you want to test, eg '(min-width: 800px)' */
|
|
9
|
+
query: string,
|
|
10
|
+
/** Default value (fallback value to support SSR)
|
|
11
|
+
* @defaultValue false
|
|
12
|
+
*/
|
|
13
|
+
ssrInitialValue?: boolean): boolean;
|
|
14
|
+
/**
|
|
15
|
+
* `useBreakpoint` is a hook used to determine if the document matches the media
|
|
16
|
+
* query string (or media query list). It will listen to the breakpoints specified
|
|
17
|
+
* and will return a boolean value indicating if this media query is met or not.
|
|
18
|
+
* @public
|
|
19
|
+
*/
|
|
20
|
+
declare function useBreakpoint(
|
|
21
|
+
/** Media Queries you want to test, eg '[(min-width: 400px), (min-width: 800px)]' */
|
|
22
|
+
queries: string[],
|
|
23
|
+
/** Default values (fallback values to support SSR)
|
|
24
|
+
* @defaultValue []
|
|
25
|
+
*/
|
|
26
|
+
ssrInitialValue?: boolean[]): boolean[];
|
|
27
|
+
export { useBreakpoint };
|
|
@@ -0,0 +1,62 @@
|
|
|
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 useBreakpoint_exports = {};
|
|
19
|
+
__export(useBreakpoint_exports, {
|
|
20
|
+
useBreakpoint: () => useBreakpoint
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(useBreakpoint_exports);
|
|
23
|
+
var import_react = require("react");
|
|
24
|
+
function useBreakpoint(queries, ssrInitialValue) {
|
|
25
|
+
const _ssrInitialValue = ssrInitialValue ?? (Array.isArray(queries) ? [] : false);
|
|
26
|
+
const mediaQueryLists = (0, import_react.useMemo)(() => {
|
|
27
|
+
const queryStrings = Array.isArray(queries) ? queries : [queries];
|
|
28
|
+
return queryStrings.map((q) => window.matchMedia(q));
|
|
29
|
+
}, [queries]);
|
|
30
|
+
const subscribe = (0, import_react.useCallback)(
|
|
31
|
+
(callback) => {
|
|
32
|
+
mediaQueryLists.forEach(
|
|
33
|
+
(mql) => mql.addEventListener("change", callback)
|
|
34
|
+
);
|
|
35
|
+
return () => {
|
|
36
|
+
mediaQueryLists.forEach(
|
|
37
|
+
(mql) => mql.removeEventListener("change", callback)
|
|
38
|
+
);
|
|
39
|
+
};
|
|
40
|
+
},
|
|
41
|
+
[mediaQueryLists]
|
|
42
|
+
);
|
|
43
|
+
const getSnapshot = () => {
|
|
44
|
+
return JSON.stringify(mediaQueryLists.map((q) => q.matches));
|
|
45
|
+
};
|
|
46
|
+
const getServerSnapshot = () => {
|
|
47
|
+
if (Array.isArray(_ssrInitialValue)) {
|
|
48
|
+
const adjustedValue = _ssrInitialValue.concat(Array(queries.length).fill(false)).slice(0, queries.length);
|
|
49
|
+
return JSON.stringify(adjustedValue);
|
|
50
|
+
}
|
|
51
|
+
return JSON.stringify([_ssrInitialValue]);
|
|
52
|
+
};
|
|
53
|
+
const queryValues = (0, import_react.useSyncExternalStore)(
|
|
54
|
+
subscribe,
|
|
55
|
+
getSnapshot,
|
|
56
|
+
getServerSnapshot
|
|
57
|
+
);
|
|
58
|
+
if (!Array.isArray(queries)) {
|
|
59
|
+
return JSON.parse(queryValues)[0];
|
|
60
|
+
}
|
|
61
|
+
return JSON.parse(queryValues);
|
|
62
|
+
}
|
package/layouts/index.d.ts
CHANGED
|
@@ -8,3 +8,4 @@ export type { LayoutSizeCSS } from './types/layout.types.js';
|
|
|
8
8
|
export { Surface } from './surface/Surface.js';
|
|
9
9
|
export type { SurfaceOwnProps, SurfaceProps } from './surface/Surface.js';
|
|
10
10
|
export { surfaceBorderRadius as _surfaceBorderRadius } from './surface/variables.css.js';
|
|
11
|
+
export { useBreakpoint } from './hooks/useBreakpoint.js';
|
package/layouts/index.js
CHANGED
|
@@ -22,7 +22,8 @@ __export(layouts_exports, {
|
|
|
22
22
|
Flex: () => import_Flex.Flex,
|
|
23
23
|
Grid: () => import_Grid.Grid,
|
|
24
24
|
Surface: () => import_Surface.Surface,
|
|
25
|
-
_surfaceBorderRadius: () => import_variables_css.surfaceBorderRadius
|
|
25
|
+
_surfaceBorderRadius: () => import_variables_css.surfaceBorderRadius,
|
|
26
|
+
useBreakpoint: () => import_useBreakpoint.useBreakpoint
|
|
26
27
|
});
|
|
27
28
|
module.exports = __toCommonJS(layouts_exports);
|
|
28
29
|
var import_Flex = require("./flex/Flex.js");
|
|
@@ -31,3 +32,4 @@ var import_Divider = require("./divider/Divider.js");
|
|
|
31
32
|
var import_Container = require("./container/Container.js");
|
|
32
33
|
var import_Surface = require("./surface/Surface.js");
|
|
33
34
|
var import_variables_css = require("./surface/variables.sty.js");
|
|
35
|
+
var import_useBreakpoint = require("./hooks/useBreakpoint.js");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynatrace/strato-components",
|
|
3
|
-
"version": "0.85.
|
|
3
|
+
"version": "0.85.32",
|
|
4
4
|
"private": false,
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"lang": "lang/uncompiled",
|
|
@@ -75,12 +75,16 @@
|
|
|
75
75
|
"@dynatrace/devkit": "^0.3.2",
|
|
76
76
|
"@formatjs/icu-messageformat-parser": "^2.7.8",
|
|
77
77
|
"@jest/globals": "^29.7.0",
|
|
78
|
+
"@vanilla-extract/css": "^1.15.5",
|
|
79
|
+
"@vanilla-extract/dynamic": "^2.1.0",
|
|
80
|
+
"@vanilla-extract/recipes": "^0.5.5",
|
|
81
|
+
"@vanilla-extract/sprinkles": "^1.6.3",
|
|
78
82
|
"clsx": "^2.1.1",
|
|
79
83
|
"lodash-es": "^4.17.21",
|
|
80
84
|
"wicg-inert": "^3.1.2",
|
|
81
85
|
"use-resize-observer": "^9.1.0",
|
|
82
86
|
"@dynatrace/strato-design-tokens": "0.20.40",
|
|
83
|
-
"@dynatrace/strato-icons": "0.39.
|
|
87
|
+
"@dynatrace/strato-icons": "0.39.2"
|
|
84
88
|
},
|
|
85
89
|
"peerDependencies": {
|
|
86
90
|
"@dynatrace-sdk/app-environment": "^1.0.0",
|
|
@@ -107,5 +111,8 @@
|
|
|
107
111
|
"./esm/core/components/app-root/AppRoot.css",
|
|
108
112
|
"./core/components/app-root/AppRoot.sty.js",
|
|
109
113
|
"./esm/core/components/app-root/AppRoot.sty.js"
|
|
110
|
-
]
|
|
114
|
+
],
|
|
115
|
+
"dt": {
|
|
116
|
+
"migrations": []
|
|
117
|
+
}
|
|
111
118
|
}
|
|
@@ -16,4 +16,4 @@ export interface BlockquoteProps extends WithChildren, StylingProps, DataTestId,
|
|
|
16
16
|
* The `Blockquote` component wraps longer text blocks and indicates that the passage is quoted from another source.
|
|
17
17
|
* @public
|
|
18
18
|
*/
|
|
19
|
-
export declare const Blockquote: (props: BlockquoteProps & React.RefAttributes<HTMLQuoteElement>) => React.ReactElement
|
|
19
|
+
export declare const Blockquote: (props: BlockquoteProps & React.RefAttributes<HTMLQuoteElement>) => React.ReactElement | null;
|
|
@@ -14,4 +14,4 @@ export interface CodeProps extends WithChildren, StylingProps, DataTestId, Maski
|
|
|
14
14
|
* component instead.
|
|
15
15
|
* @public
|
|
16
16
|
*/
|
|
17
|
-
export declare const Code: (props: CodeProps & React.RefAttributes<HTMLElement>) => React.ReactElement
|
|
17
|
+
export declare const Code: (props: CodeProps & React.RefAttributes<HTMLElement>) => React.ReactElement | null;
|
|
@@ -11,4 +11,4 @@ export interface EmphasisProps extends WithChildren, StylingProps, DataTestId, M
|
|
|
11
11
|
* The `Emphasis` component adds visual and semantic emphasis to stressed or essential content.
|
|
12
12
|
* @public
|
|
13
13
|
*/
|
|
14
|
-
export declare const Emphasis: (props: EmphasisProps & React.RefAttributes<HTMLElement>) => React.ReactElement
|
|
14
|
+
export declare const Emphasis: (props: EmphasisProps & React.RefAttributes<HTMLElement>) => React.ReactElement | null;
|
|
@@ -18,4 +18,4 @@ export interface ExternalLinkProps extends WithChildren, StylingProps, DataTestI
|
|
|
18
18
|
* component instead.
|
|
19
19
|
* @public
|
|
20
20
|
*/
|
|
21
|
-
export declare const ExternalLink: (props: ExternalLinkProps & React.RefAttributes<HTMLAnchorElement>) => React.ReactElement
|
|
21
|
+
export declare const ExternalLink: (props: ExternalLinkProps & React.RefAttributes<HTMLAnchorElement>) => React.ReactElement | null;
|
|
@@ -22,4 +22,4 @@ export interface HeadingProps extends DOMProps, WithChildren, StylingProps, Data
|
|
|
22
22
|
* The component allows you to independently define both the visual and the semantic level of the heading.
|
|
23
23
|
* @public
|
|
24
24
|
*/
|
|
25
|
-
export declare const Heading: (props: HeadingProps & React.RefAttributes<HTMLHeadingElement>) => React.ReactElement
|
|
25
|
+
export declare const Heading: (props: HeadingProps & React.RefAttributes<HTMLHeadingElement>) => React.ReactElement | null;
|
|
@@ -36,4 +36,4 @@ export interface ListProps<TOrdered extends boolean = false> extends WithChildre
|
|
|
36
36
|
* (for unordered lists).
|
|
37
37
|
* @public
|
|
38
38
|
*/
|
|
39
|
-
export declare const List: <TOrdered extends boolean = false>(props: ListProps<TOrdered> & React.RefAttributes<TOrdered extends true ? HTMLOListElement : HTMLUListElement>) => React.ReactElement
|
|
39
|
+
export declare const List: <TOrdered extends boolean = false>(props: ListProps<TOrdered> & React.RefAttributes<TOrdered extends true ? HTMLOListElement : HTMLUListElement>) => React.ReactElement | null;
|
|
@@ -16,4 +16,4 @@ export interface ParagraphProps extends WithChildren, DOMProps, StylingProps, Da
|
|
|
16
16
|
* The `Paragraph` component displays a block of text with the default text style and supports text truncation.
|
|
17
17
|
* @public
|
|
18
18
|
*/
|
|
19
|
-
export declare const Paragraph: (props: ParagraphProps & React.RefAttributes<HTMLParagraphElement>) => React.ReactElement
|
|
19
|
+
export declare const Paragraph: (props: ParagraphProps & React.RefAttributes<HTMLParagraphElement>) => React.ReactElement | null;
|
|
@@ -12,4 +12,4 @@ export interface StrikethroughProps extends WithChildren, StylingProps, DataTest
|
|
|
12
12
|
* represent things that are no longer relevant or accurate.
|
|
13
13
|
* @public
|
|
14
14
|
*/
|
|
15
|
-
export declare const Strikethrough: (props: StrikethroughProps & React.RefAttributes<HTMLElement>) => React.ReactElement
|
|
15
|
+
export declare const Strikethrough: (props: StrikethroughProps & React.RefAttributes<HTMLElement>) => React.ReactElement | null;
|
|
@@ -11,4 +11,4 @@ export interface StrongProps extends WithChildren, StylingProps, DataTestId, Mas
|
|
|
11
11
|
* Use the `Strong` component to render text in bold type to emphasize it.
|
|
12
12
|
* @public
|
|
13
13
|
*/
|
|
14
|
-
export declare const Strong: (props: StrongProps & React.RefAttributes<HTMLElement>) => React.ReactElement
|
|
14
|
+
export declare const Strong: (props: StrongProps & React.RefAttributes<HTMLElement>) => React.ReactElement | null;
|
|
@@ -17,8 +17,9 @@ export interface TextOwnProps extends WithChildren, DOMProps, AriaLabelingProps,
|
|
|
17
17
|
fontStyle?: 'text' | 'code';
|
|
18
18
|
}
|
|
19
19
|
/**
|
|
20
|
+
* Combined props for the text component - polymorphing and own props.
|
|
20
21
|
* @public
|
|
21
|
-
|
|
22
|
+
*/
|
|
22
23
|
export type TextProps<E extends ElementType> = PolymorphicComponentProps<E, TextOwnProps>;
|
|
23
24
|
/**
|
|
24
25
|
* Use the `Text` component for text that is rendered without any semantic markup.
|
|
@@ -29,4 +29,4 @@ export interface TextEllipsisProps extends HTMLAttributes<HTMLSpanElement>, Styl
|
|
|
29
29
|
* when writing your own components.
|
|
30
30
|
* @public
|
|
31
31
|
*/
|
|
32
|
-
export declare const TextEllipsis: (props: TextEllipsisProps & React.RefAttributes<HTMLSpanElement>) => React.ReactElement
|
|
32
|
+
export declare const TextEllipsis: (props: TextEllipsisProps & React.RefAttributes<HTMLSpanElement>) => React.ReactElement | null;
|