@dynatrace/strato-components 0.84.51 → 0.85.10

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 (65) hide show
  1. package/README.md +1 -1
  2. package/buttons/button/Button.css +92 -0
  3. package/buttons/button/Button.d.ts +94 -0
  4. package/buttons/button/Button.js +258 -0
  5. package/buttons/button/Button.sty.d.ts +51 -0
  6. package/buttons/button/Button.sty.js +33 -0
  7. package/buttons/button/Label.d.ts +16 -0
  8. package/buttons/button/Label.js +60 -0
  9. package/buttons/button/Prefix.d.ts +16 -0
  10. package/buttons/button/Prefix.js +54 -0
  11. package/buttons/button/Suffix.d.ts +16 -0
  12. package/buttons/button/Suffix.js +56 -0
  13. package/buttons/button/types/button-aria.d.ts +37 -0
  14. package/buttons/button/types/button-aria.js +15 -0
  15. package/buttons/button/utils/focus-without-scrolling.d.ts +5 -0
  16. package/buttons/button/utils/focus-without-scrolling.js +77 -0
  17. package/buttons/button/utils/is-virtual-event.d.ts +10 -0
  18. package/buttons/button/utils/is-virtual-event.js +32 -0
  19. package/buttons/index.d.ts +8 -0
  20. package/buttons/index.js +28 -0
  21. package/content/progress/ProgressBar.js +1 -2
  22. package/content/progress/ProgressCircle.js +1 -2
  23. package/esm/buttons/button/Button.css +92 -0
  24. package/esm/buttons/button/Button.js +233 -0
  25. package/esm/buttons/button/Button.js.map +7 -0
  26. package/esm/buttons/button/Button.sty.js +15 -0
  27. package/esm/buttons/button/Button.sty.js.map +7 -0
  28. package/esm/buttons/button/Label.js +32 -0
  29. package/esm/buttons/button/Label.js.map +7 -0
  30. package/esm/buttons/button/Prefix.js +26 -0
  31. package/esm/buttons/button/Prefix.js.map +7 -0
  32. package/esm/buttons/button/Suffix.js +28 -0
  33. package/esm/buttons/button/Suffix.js.map +7 -0
  34. package/esm/buttons/button/types/button-aria.js +1 -0
  35. package/esm/buttons/button/types/button-aria.js.map +7 -0
  36. package/esm/buttons/button/utils/focus-without-scrolling.js +59 -0
  37. package/esm/buttons/button/utils/focus-without-scrolling.js.map +7 -0
  38. package/esm/buttons/button/utils/is-virtual-event.js +14 -0
  39. package/esm/buttons/button/utils/is-virtual-event.js.map +7 -0
  40. package/esm/buttons/index.js +13 -0
  41. package/esm/buttons/index.js.map +7 -0
  42. package/esm/content/progress/ProgressBar.js +2 -3
  43. package/esm/content/progress/ProgressBar.js.map +2 -2
  44. package/esm/content/progress/ProgressCircle.js +2 -3
  45. package/esm/content/progress/ProgressCircle.js.map +2 -2
  46. package/esm/index.js +1 -0
  47. package/esm/index.js.map +2 -2
  48. package/esm/styles/field.css +208 -0
  49. package/esm/styles/field.sty.js +9 -0
  50. package/esm/styles/field.sty.js.map +7 -0
  51. package/esm/typography/Code/Code.js.map +1 -1
  52. package/esm/typography/ExternalLink/ExternalLink.js.map +1 -1
  53. package/esm/typography/Link/Link.js.map +1 -1
  54. package/index.d.ts +1 -0
  55. package/index.js +1 -0
  56. package/lang/en.json +6 -0
  57. package/lang/uncompiled/en.json +4 -0
  58. package/package.json +21 -14
  59. package/styles/field.css +208 -0
  60. package/styles/field.sty.d.ts +102 -0
  61. package/styles/field.sty.js +27 -0
  62. package/styles/sprinkles.sty.d.ts +107 -107
  63. package/typography/Code/Code.d.ts +1 -1
  64. package/typography/ExternalLink/ExternalLink.d.ts +1 -1
  65. package/typography/Link/Link.d.ts +1 -1
@@ -0,0 +1,233 @@
1
+ import clsx from "clsx";
2
+ import React, {
3
+ forwardRef,
4
+ useMemo
5
+ } from "react";
6
+ import { useIntl } from "react-intl";
7
+ import { isElement } from "react-is";
8
+ import { buttonCSS, buttonLoadingCSS, buttonWidthsCSS } from "./Button.sty.js";
9
+ import { Label } from "./Label.js";
10
+ import { Prefix } from "./Prefix.js";
11
+ import { Suffix } from "./Suffix.js";
12
+ import { ProgressCircle } from "../../content/progress/ProgressCircle.js";
13
+ import { useAriaLabelingProps } from "../../core/hooks/useAriaLabelingProps.js";
14
+ import { useFocusRing } from "../../core/styles/useFocusRing.js";
15
+ import { mergeProps } from "../../core/utils/merge-props.js";
16
+ import { Flex } from "../../layouts/flex/Flex.js";
17
+ import { Grid } from "../../layouts/grid/Grid.js";
18
+ import { fieldColorsCSS } from "../../styles/field.sty.js";
19
+ function getButtonSlots(children) {
20
+ const slots = {};
21
+ React.Children.forEach(children, (child) => {
22
+ if (isElement(child)) {
23
+ switch (child.type) {
24
+ case Suffix:
25
+ slots.suffix = child;
26
+ break;
27
+ case Prefix:
28
+ slots.prefix = child;
29
+ break;
30
+ case Label:
31
+ slots.label = child;
32
+ break;
33
+ default:
34
+ slots.freeform ??= [];
35
+ slots.freeform.push(child);
36
+ break;
37
+ }
38
+ } else {
39
+ if (child) {
40
+ slots.freeform ??= [];
41
+ slots.freeform.push(child);
42
+ }
43
+ }
44
+ });
45
+ return slots;
46
+ }
47
+ const _Button = /* @__PURE__ */ forwardRef(
48
+ (props, ref) => {
49
+ const {
50
+ children,
51
+ variant = "default",
52
+ disabled,
53
+ "aria-disabled": ariaDisabledProp,
54
+ required,
55
+ id: propId,
56
+ type = "button",
57
+ onClick,
58
+ ariaLabel,
59
+ width = "content",
60
+ color = "neutral",
61
+ textAlign = "center",
62
+ size = "default",
63
+ loading = false,
64
+ className: consumerClassName,
65
+ style: consumerStyle,
66
+ "data-testid": dataTestId,
67
+ "data-dtrum-mask": dataDtrumMask,
68
+ "data-dtrum-allow": dataDtrumAllow,
69
+ readOnly,
70
+ as,
71
+ ...remainingProps
72
+ } = props;
73
+ const slots = getButtonSlots(children);
74
+ const ariaDisabled = ariaDisabledProp === true || ariaDisabledProp === "true";
75
+ const nativeDisabledOrLoading = useMemo(
76
+ () => loading ? true : disabled,
77
+ [disabled, loading]
78
+ );
79
+ const disabledOrLoading = useMemo(
80
+ () => nativeDisabledOrLoading || ariaDisabled,
81
+ [ariaDisabled, nativeDisabledOrLoading]
82
+ );
83
+ const { focusProps, focusClassName } = useFocusRing({
84
+ variant: !disabledOrLoading ? color : "neutral",
85
+ disabled: nativeDisabledOrLoading
86
+ });
87
+ const ariaLabelingProps = useAriaLabelingProps(remainingProps);
88
+ const handleButtonClick = (event) => {
89
+ if (nativeDisabledOrLoading) {
90
+ event.preventDefault();
91
+ event.stopPropagation();
92
+ return;
93
+ }
94
+ onClick?.(event);
95
+ };
96
+ const buttonProps = {
97
+ ref,
98
+ "data-testid": dataTestId,
99
+ "data-dtrum-mask": dataDtrumMask,
100
+ "data-dtrum-allow": dataDtrumAllow,
101
+ required,
102
+ disabled: nativeDisabledOrLoading && !ariaDisabled,
103
+ id: propId,
104
+ type,
105
+ ...ariaLabelingProps,
106
+ "aria-disabled": ariaDisabledProp,
107
+ onClick: handleButtonClick
108
+ };
109
+ const disabledPropagationProps = {
110
+ onPointerDown(evt) {
111
+ if (nativeDisabledOrLoading) {
112
+ evt.preventDefault();
113
+ evt.stopPropagation();
114
+ }
115
+ },
116
+ onPointerUp(evt) {
117
+ if (nativeDisabledOrLoading) {
118
+ evt.preventDefault();
119
+ evt.stopPropagation();
120
+ }
121
+ }
122
+ };
123
+ const hasChildren = children || children === 0;
124
+ const buttonMergedProps = {
125
+ ...mergeProps(
126
+ buttonProps,
127
+ disabledPropagationProps,
128
+ // Need to cast this one as the inference of mergeProps would generate
129
+ // a not allowed overlap. The remainingProps type is too complex due to the
130
+ // polymorphic inheritance.
131
+ remainingProps,
132
+ focusProps
133
+ )
134
+ };
135
+ const intl = useIntl();
136
+ const Component = as || "button";
137
+ if (!hasChildren) {
138
+ return /* @__PURE__ */ React.createElement(
139
+ Component,
140
+ {
141
+ ...buttonMergedProps,
142
+ className: clsx(
143
+ consumerClassName,
144
+ fieldColorsCSS({ variant, color, disabled: disabledOrLoading }),
145
+ buttonCSS({
146
+ disabled: disabledOrLoading,
147
+ textAlign,
148
+ size,
149
+ readOnly
150
+ }),
151
+ focusClassName,
152
+ {
153
+ [`${buttonWidthsCSS.content}`]: width === "content",
154
+ [`${buttonWidthsCSS.full}`]: width === "full"
155
+ }
156
+ ),
157
+ style: {
158
+ width: width !== "content" && width !== "full" ? width : void 0
159
+ }
160
+ }
161
+ );
162
+ }
163
+ return /* @__PURE__ */ React.createElement(
164
+ Component,
165
+ {
166
+ className: clsx(
167
+ consumerClassName,
168
+ fieldColorsCSS({
169
+ variant,
170
+ color,
171
+ disabled: disabledOrLoading || ariaDisabled
172
+ }),
173
+ buttonCSS({
174
+ disabled: disabledOrLoading || ariaDisabled,
175
+ textAlign,
176
+ size,
177
+ readOnly
178
+ }),
179
+ {
180
+ [`${buttonWidthsCSS.content}`]: width === "content",
181
+ [`${buttonWidthsCSS.full}`]: width === "full"
182
+ },
183
+ focusClassName
184
+ ),
185
+ style: {
186
+ width: width !== "content" && width !== "full" ? width : void 0,
187
+ ...consumerStyle
188
+ },
189
+ ...buttonMergedProps
190
+ },
191
+ loading && /* @__PURE__ */ React.createElement("div", { className: buttonLoadingCSS }, /* @__PURE__ */ React.createElement(
192
+ ProgressCircle,
193
+ {
194
+ size: "small",
195
+ variant: color,
196
+ "aria-label": intl.formatMessage({
197
+ defaultMessage: "Loading",
198
+ id: "cycz+bYG+VH7Of4e",
199
+ description: "Label for the loading state."
200
+ })
201
+ }
202
+ )),
203
+ /* @__PURE__ */ React.createElement(
204
+ Grid,
205
+ {
206
+ gap: size === "default" ? 4 : 2,
207
+ grid: "auto / auto-flow auto",
208
+ width: "100%",
209
+ maxWidth: "100%",
210
+ alignItems: "center",
211
+ justifyContent: textAlign === "start" ? "space-between" : "center",
212
+ style: {
213
+ visibility: loading ? "hidden" : void 0
214
+ }
215
+ },
216
+ textAlign === "start" ? /* @__PURE__ */ React.createElement(Flex, { minWidth: 0, gap: size === "default" ? 4 : 2 }, slots.prefix, slots.label, slots.freeform && /* @__PURE__ */ React.createElement(Button.Label, null, slots.freeform)) : /* @__PURE__ */ React.createElement(React.Fragment, null, slots.prefix, slots.label, slots.freeform && /* @__PURE__ */ React.createElement(Button.Label, null, slots.freeform)),
217
+ slots.suffix
218
+ )
219
+ );
220
+ }
221
+ );
222
+ _Button.displayName = "Button";
223
+ const Button = Object.assign(_Button, {
224
+ Suffix,
225
+ Prefix,
226
+ Label
227
+ });
228
+ export {
229
+ Button,
230
+ _Button,
231
+ getButtonSlots as default
232
+ };
233
+ //# sourceMappingURL=Button.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../src/buttons/button/Button.tsx"],
4
+ "sourcesContent": ["import clsx from 'clsx';\nimport * as CSS from 'csstype';\nimport React, {\n type ElementType,\n type MouseEventHandler,\n type PointerEvent,\n type ReactElement,\n type ReactNode,\n forwardRef,\n useMemo,\n} from 'react';\nimport { useIntl } from 'react-intl';\nimport { isElement } from 'react-is';\n\nimport { buttonCSS, buttonLoadingCSS, buttonWidthsCSS } from './Button.sty.js';\nimport { Label } from './Label.js';\nimport { Prefix } from './Prefix.js';\nimport { Suffix } from './Suffix.js';\nimport { ProgressCircle } from '../../content/progress/ProgressCircle.js';\nimport { useAriaLabelingProps } from '../../core/hooks/useAriaLabelingProps.js';\nimport { useFocusRing } from '../../core/styles/useFocusRing.js';\nimport {\n type AriaDisabledProps,\n type AriaLabelingProps,\n} from '../../core/types/a11y-props.js';\nimport { type DataTestId } from '../../core/types/data-props.js';\nimport { type MaskingProps } from '../../core/types/masking-props.js';\nimport { type PolymorphicComponentProps } from '../../core/types/polymorph.js';\nimport { type StylingProps } from '../../core/types/styling-props.js';\nimport { type WithChildren } from '../../core/types/with-children.js';\nimport { mergeProps } from '../../core/utils/merge-props.js';\nimport { Flex } from '../../layouts/flex/Flex.js';\nimport { Grid } from '../../layouts/grid/Grid.js';\nimport { fieldColorsCSS } from '../../styles/field.sty.js';\n\n//#region Typings\n\n/**\n * Accepted properties for the Button.\n * @public\n */\nexport interface ButtonOwnProps\n extends AriaLabelingProps,\n AriaDisabledProps,\n WithChildren,\n StylingProps,\n DataTestId,\n MaskingProps {\n /**\n * If a button is disabled e.g. it cannot be interacted with.\n * @defaultValue false\n */\n disabled?: boolean;\n\n /**\n * Different variants have different styles.\n * @defaultValue 'default'\n */\n variant?: 'default' | 'emphasized' | 'accent';\n\n /**\n * The HTML button type.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#attr-type}\n * @defaultValue 'button'\n */\n type?: 'button' | 'reset' | 'submit';\n\n /** Called when the button is interacted with. */\n onClick?: MouseEventHandler;\n\n /**\n * The width of the button.\n * @defaultValue 'content'\n */\n // eslint-disable-next-line @typescript-eslint/ban-types\n width?: 'content' | 'full' | CSS.Property.Width<string & {}>;\n\n /**\n * The color of the button. This should be chosen based on the context\n * the button is used in.\n * @defaultValue 'neutral'\n */\n color?: 'primary' | 'neutral' | 'success' | 'critical' | 'warning';\n\n /**\n * Controls the text alignment inside the button. Only affects the button\n * if the width is not set to 'content'.\n * @defaultValue 'center'\n */\n textAlign?: 'center' | 'start';\n\n /**\n * The size of the button.\n * @defaultValue 'default'\n */\n size?: 'default' | 'condensed';\n\n /**\n * The current loading state of the button. If true, a loading icon is shown and the button is disabled.\n * @defaultValue false\n */\n loading?: boolean;\n\n /**\n * Determines whether the element is in read-only mode.\n * @defaultValue false\n */\n readOnly?: boolean;\n}\n\n/**\n * Merge own props with others inherited from the underlying element type.\n * @public\n */\nexport type ButtonProps<E extends ElementType> = PolymorphicComponentProps<\n E,\n ButtonOwnProps\n>;\n\ntype ButtonSlots = {\n label?: ReactNode;\n prefix?: ReactNode;\n suffix?: ReactNode;\n freeform?: ReactNode[];\n};\n\n//#endregion\n\n/**\n * Iterates over child nodes to extract specific component slots.\n * @public\n */\nexport default function getButtonSlots(children: ReactNode) {\n const slots: ButtonSlots = {};\n\n React.Children.forEach(children, (child) => {\n if (isElement(child)) {\n switch (child.type) {\n case Suffix:\n slots.suffix = child;\n break;\n case Prefix:\n slots.prefix = child;\n break;\n case Label:\n slots.label = child;\n break;\n default:\n slots.freeform ??= [];\n slots.freeform.push(child);\n break;\n }\n } else {\n if (child) {\n slots.freeform ??= [];\n slots.freeform.push(child);\n }\n }\n });\n\n return slots;\n}\n\nexport const _Button: <E extends ElementType = 'button'>(\n props: ButtonProps<E>,\n) => ReactElement | null = /* @__PURE__ */ forwardRef(\n <E extends ElementType>(props: ButtonProps<E>, ref: typeof props.ref) => {\n const {\n children,\n variant = 'default',\n disabled,\n 'aria-disabled': ariaDisabledProp,\n required,\n id: propId,\n type = 'button',\n onClick,\n ariaLabel,\n width = 'content',\n color = 'neutral',\n textAlign = 'center',\n size = 'default',\n loading = false,\n className: consumerClassName,\n style: consumerStyle,\n 'data-testid': dataTestId,\n 'data-dtrum-mask': dataDtrumMask,\n 'data-dtrum-allow': dataDtrumAllow,\n readOnly,\n as,\n ...remainingProps\n }: ButtonProps<E> = props;\n const slots = getButtonSlots(children);\n\n const ariaDisabled =\n ariaDisabledProp === true || ariaDisabledProp === 'true';\n\n const nativeDisabledOrLoading = useMemo(\n () => (loading ? true : disabled),\n [disabled, loading],\n );\n const disabledOrLoading = useMemo(\n () => nativeDisabledOrLoading || ariaDisabled,\n [ariaDisabled, nativeDisabledOrLoading],\n );\n\n const { focusProps, focusClassName } = useFocusRing({\n variant: !disabledOrLoading ? color : 'neutral',\n disabled: nativeDisabledOrLoading,\n });\n\n const ariaLabelingProps = useAriaLabelingProps(remainingProps);\n\n const handleButtonClick: MouseEventHandler<HTMLElement> = (event) => {\n if (nativeDisabledOrLoading) {\n event.preventDefault();\n event.stopPropagation();\n return;\n }\n\n onClick?.(event);\n };\n\n const buttonProps = {\n ref,\n 'data-testid': dataTestId,\n 'data-dtrum-mask': dataDtrumMask,\n 'data-dtrum-allow': dataDtrumAllow,\n required,\n disabled: nativeDisabledOrLoading && !ariaDisabled,\n id: propId,\n type,\n ...ariaLabelingProps,\n 'aria-disabled': ariaDisabledProp,\n onClick: handleButtonClick,\n };\n\n // Propagation needs to be disabled on the disabled button because\n // it would still trigger actions on parents that would listen to it.\n // For example the menu or the useOverlay hook.\n const disabledPropagationProps = {\n onPointerDown(evt: PointerEvent) {\n if (nativeDisabledOrLoading) {\n evt.preventDefault();\n evt.stopPropagation();\n }\n },\n onPointerUp(evt: PointerEvent) {\n if (nativeDisabledOrLoading) {\n evt.preventDefault();\n evt.stopPropagation();\n }\n },\n };\n\n const hasChildren = children || children === 0;\n\n const buttonMergedProps = {\n ...mergeProps(\n buttonProps,\n disabledPropagationProps,\n // Need to cast this one as the inference of mergeProps would generate\n // a not allowed overlap. The remainingProps type is too complex due to the\n // polymorphic inheritance.\n remainingProps as Record<string, unknown>,\n focusProps,\n ),\n };\n\n const intl = useIntl();\n\n // Make the component polymorphic\n const Component = as || 'button';\n\n // Render a void element if no children are set and it's not loading (so self-closing polymorphed tags won't break)\n if (!hasChildren) {\n return (\n <Component\n {...buttonMergedProps}\n className={clsx(\n consumerClassName,\n fieldColorsCSS({ variant, color, disabled: disabledOrLoading }),\n buttonCSS({\n disabled: disabledOrLoading,\n textAlign,\n size,\n readOnly,\n }),\n focusClassName,\n {\n [`${buttonWidthsCSS.content}`]: width === 'content',\n [`${buttonWidthsCSS.full}`]: width === 'full',\n },\n )}\n style={{\n width: width !== 'content' && width !== 'full' ? width : undefined,\n }}\n />\n );\n }\n\n return (\n <Component\n className={clsx(\n consumerClassName,\n fieldColorsCSS({\n variant,\n color,\n disabled: disabledOrLoading || ariaDisabled,\n }),\n buttonCSS({\n disabled: disabledOrLoading || ariaDisabled,\n textAlign,\n size,\n readOnly,\n }),\n {\n [`${buttonWidthsCSS.content}`]: width === 'content',\n [`${buttonWidthsCSS.full}`]: width === 'full',\n },\n focusClassName,\n )}\n style={{\n width: width !== 'content' && width !== 'full' ? width : undefined,\n ...consumerStyle,\n }}\n {...buttonMergedProps}\n >\n {loading && (\n <div className={buttonLoadingCSS}>\n <ProgressCircle\n size=\"small\"\n variant={color}\n aria-label={intl.formatMessage({\n defaultMessage: 'Loading',\n id: 'cycz+bYG+VH7Of4e',\n description: 'Label for the loading state.',\n })}\n />\n </div>\n )}\n <Grid\n gap={size === 'default' ? 4 : 2}\n grid=\"auto / auto-flow auto\"\n width={'100%'}\n maxWidth=\"100%\"\n alignItems=\"center\"\n justifyContent={textAlign === 'start' ? 'space-between' : 'center'}\n style={{\n visibility: loading ? 'hidden' : undefined,\n }}\n >\n {textAlign === 'start' ? (\n <Flex minWidth={0} gap={size === 'default' ? 4 : 2}>\n {slots.prefix}\n {slots.label}\n {slots.freeform && <Button.Label>{slots.freeform}</Button.Label>}\n </Flex>\n ) : (\n <>\n {slots.prefix}\n {slots.label}\n {slots.freeform && <Button.Label>{slots.freeform}</Button.Label>}\n </>\n )}\n {slots.suffix}\n </Grid>\n </Component>\n );\n },\n);\n\n(_Button as typeof _Button & { displayName: string }).displayName = 'Button';\n\n/**\n * Buttons allow users to trigger actions or events\n * with a single click anywhere within the button container.\n * Users can also trigger a button by pressing\n * `Enter` or `Space` while the button has focus.\n * @public\n */\nexport const Button = Object.assign(_Button, {\n Suffix,\n Prefix,\n Label,\n});\n"],
5
+ "mappings": "AAAA,OAAO,UAAU;AAEjB,OAAO;AAAA,EAML;AAAA,EACA;AAAA,OACK;AACP,SAAS,eAAe;AACxB,SAAS,iBAAiB;AAE1B,SAAS,WAAW,kBAAkB,uBAAuB;AAC7D,SAAS,aAAa;AACtB,SAAS,cAAc;AACvB,SAAS,cAAc;AACvB,SAAS,sBAAsB;AAC/B,SAAS,4BAA4B;AACrC,SAAS,oBAAoB;AAU7B,SAAS,kBAAkB;AAC3B,SAAS,YAAY;AACrB,SAAS,YAAY;AACrB,SAAS,sBAAsB;AAmGhB,SAAR,eAAgC,UAAqB;AAC1D,QAAM,QAAqB,CAAC;AAE5B,QAAM,SAAS,QAAQ,UAAU,CAAC,UAAU;AAC1C,QAAI,UAAU,KAAK,GAAG;AACpB,cAAQ,MAAM,MAAM;AAAA,QAClB,KAAK;AACH,gBAAM,SAAS;AACf;AAAA,QACF,KAAK;AACH,gBAAM,SAAS;AACf;AAAA,QACF,KAAK;AACH,gBAAM,QAAQ;AACd;AAAA,QACF;AACE,gBAAM,aAAa,CAAC;AACpB,gBAAM,SAAS,KAAK,KA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,CAAC;",
6
+ "names": []
7
+ }
@@ -0,0 +1,15 @@
1
+ import "../../styles/ellipsis.css";
2
+ import "../../styles/field.css";
3
+ import "./Button.css";
4
+ import { createRuntimeFn as _7a468 } from "@vanilla-extract/recipes/createRuntimeFn";
5
+ var buttonCSS = _7a468({ defaultClassName: "Button_buttonCSS__10kgnsa0", variantClassNames: { textAlign: { start: "Button_buttonCSS_textAlign_start__10kgnsa1", center: "Button_buttonCSS_textAlign_center__10kgnsa2" }, size: { condensed: "Button_buttonCSS_size_condensed__10kgnsa3", "default": "Button_buttonCSS_size_default__10kgnsa4" }, disabled: { true: "Button_buttonCSS_disabled_true__10kgnsa5" }, readOnly: { true: "Button_buttonCSS_readOnly_true__10kgnsa6" } }, defaultVariants: { size: "default", textAlign: "center", disabled: false }, compoundVariants: [] });
6
+ var buttonLabelCSS = _7a468({ defaultClassName: "Button_buttonLabelCSS__10kgnsaa", variantClassNames: { textual: { true: "ellipsis_ellipsisCSS__oqqp1n0", false: "Button_buttonLabelCSS_textual_false__10kgnsac" } }, defaultVariants: {}, compoundVariants: [] });
7
+ var buttonLoadingCSS = "Button_buttonLoadingCSS__10kgnsa9";
8
+ var buttonWidthsCSS = { full: "Button_buttonWidthsCSS_full__10kgnsa7", content: "Button_buttonWidthsCSS_content__10kgnsa8" };
9
+ export {
10
+ buttonCSS,
11
+ buttonLabelCSS,
12
+ buttonLoadingCSS,
13
+ buttonWidthsCSS
14
+ };
15
+ //# sourceMappingURL=Button.sty.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../src/buttons/button/Button.css.ts"],
4
+ "sourcesContent": ["import '../../styles/ellipsis.css';\nimport '../../styles/field.css';\nimport './Button.css';\nimport { createRuntimeFn as _7a468 } from '@vanilla-extract/recipes/createRuntimeFn';\nexport var buttonCSS = _7a468({defaultClassName:'Button_buttonCSS__10kgnsa0',variantClassNames:{textAlign:{start:'Button_buttonCSS_textAlign_start__10kgnsa1',center:'Button_buttonCSS_textAlign_center__10kgnsa2'},size:{condensed:'Button_buttonCSS_size_condensed__10kgnsa3','default':'Button_buttonCSS_size_default__10kgnsa4'},disabled:{true:'Button_buttonCSS_disabled_true__10kgnsa5'},readOnly:{true:'Button_buttonCSS_readOnly_true__10kgnsa6'}},defaultVariants:{size:'default',textAlign:'center',disabled:false},compoundVariants:[]});\nexport var buttonLabelCSS = _7a468({defaultClassName:'Button_buttonLabelCSS__10kgnsaa',variantClassNames:{textual:{true:'ellipsis_ellipsisCSS__oqqp1n0',false:'Button_buttonLabelCSS_textual_false__10kgnsac'}},defaultVariants:{},compoundVariants:[]});\nexport var buttonLoadingCSS = 'Button_buttonLoadingCSS__10kgnsa9';\nexport var buttonWidthsCSS = {full:'Button_buttonWidthsCSS_full__10kgnsa7',content:'Button_buttonWidthsCSS_content__10kgnsa8'};"],
5
+ "mappings": "AAAA,OAAO;AACP,OAAO;AACP,OAAO;AACP,SAAS,mBAAmB,cAAc;AACnC,IAAI,YAAY,OAAO,EAAC,kBAAiB,8BAA6B,mBAAkB,EAAC,WAAU,EAAC,OAAM,8CAA6C,QAAO,8CAA6C,GAAE,MAAK,EAAC,WAAU,6CAA4C,WAAU,0CAAyC,GAAE,UAAS,EAAC,MAAK,2CAA0C,GAAE,UAAS,EAAC,MAAK,2CAA0C,EAAC,GAAE,iBAAgB,EAAC,MAAK,WAAU,WAAU,UAAS,UAAS,MAAK,GAAE,kBAAiB,CAAC,EAAC,CAAC;AAC5gB,IAAI,iBAAiB,OAAO,EAAC,kBAAiB,mCAAkC,mBAAkB,EAAC,SAAQ,EAAC,MAAK,iCAAgC,OAAM,gDAA+C,EAAC,GAAE,iBAAgB,CAAC,GAAE,kBAAiB,CAAC,EAAC,CAAC;AAChP,IAAI,mBAAmB;AACvB,IAAI,kBAAkB,EAAC,MAAK,yCAAwC,SAAQ,2CAA0C;",
6
+ "names": []
7
+ }
@@ -0,0 +1,32 @@
1
+ import clsx from "clsx";
2
+ import React, { forwardRef } from "react";
3
+ import { buttonLabelCSS } from "./Button.sty.js";
4
+ import { isStringChildren } from "../../core/utils/_is-string-children.js";
5
+ const Label = /* @__PURE__ */ forwardRef((props, forwardedRef) => {
6
+ const {
7
+ children,
8
+ className: consumerClassName,
9
+ style: consumerStyle,
10
+ "data-testid": dataTestId
11
+ } = props;
12
+ const textual = isStringChildren(children);
13
+ return /* @__PURE__ */ React.createElement(
14
+ "div",
15
+ {
16
+ ref: forwardedRef,
17
+ "data-testid": dataTestId,
18
+ className: clsx(
19
+ "strato-button-label",
20
+ buttonLabelCSS({ textual }),
21
+ consumerClassName
22
+ ),
23
+ style: consumerStyle
24
+ },
25
+ children
26
+ );
27
+ });
28
+ Label.displayName = "Button.Label";
29
+ export {
30
+ Label
31
+ };
32
+ //# sourceMappingURL=Label.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../src/buttons/button/Label.tsx"],
4
+ "sourcesContent": ["import clsx from 'clsx';\nimport React, { forwardRef, type ReactNode } from 'react';\n\nimport { buttonLabelCSS } from './Button.sty.js';\nimport { type DataTestId } from '../../core/types/data-props.js';\nimport { type StylingProps } from '../../core/types/styling-props.js';\nimport { isStringChildren } from '../../core/utils/_is-string-children.js';\n\n//#region Typings\n/**\n * Accepted properties for the Button Label.\n * @public\n */\nexport interface ButtonLabelProps extends StylingProps, DataTestId {\n /** Elements to be displayed in the Button Label slot. */\n children: ReactNode;\n}\n//#endregion\n\n/**\n * Button Label component.\n * @public\n */\nexport const Label = /* @__PURE__ */ forwardRef<\n HTMLDivElement,\n ButtonLabelProps\n>((props, forwardedRef) => {\n const {\n children,\n className: consumerClassName,\n style: consumerStyle,\n 'data-testid': dataTestId,\n }: ButtonLabelProps = props;\n\n const textual = isStringChildren(children);\n\n return (\n <div\n ref={forwardedRef}\n data-testid={dataTestId}\n className={clsx(\n 'strato-button-label',\n buttonLabelCSS({ textual }),\n consumerClassName,\n )}\n style={consumerStyle}\n >\n {children}\n </div>\n );\n});\n\n(Label as typeof Label & { displayName: string }).displayName = 'Button.Label';\n"],
5
+ "mappings": "AAAA,OAAO,UAAU;AACjB,OAAO,SAAS,kBAAkC;AAElD,SAAS,sBAAsB;AAG/B,SAAS,wBAAwB;AAiB1B,MAAM,QAAwB,2BAGnC,CAAC,OAAO,iBAAiB;AACzB,QAAM;AAAA,IACJ;AAAA,IACA,WAAW;AAAA,IACX,OAAO;AAAA,IACP,eAAe;AAAA,EACjB,IAAsB;AAEtB,QAAM,UAAU,iBAAiB,QAAQ;AAEzC,SACE;AAAA,IAAC;AAAA;AAAA,MACC,KAAK;AAAA,MACL,eAAa;AAAA,MACb,WAAW;AAAA,QACT;AAAA,QACA,eAAe,EAAE,QAAQ,CAAC;AAAA,QAC1B;AAAA,MACF;AAAA,MACA,OAAO;AAAA;AAAA,IAEN;AAAA,EACH;AAEJ,CAAC;AAEA,MAAiD,cAAc;",
6
+ "names": []
7
+ }
@@ -0,0 +1,26 @@
1
+ import React, { forwardRef } from "react";
2
+ import { Flex } from "../../layouts/flex/Flex.js";
3
+ const Prefix = /* @__PURE__ */ forwardRef((props, forwardedRef) => {
4
+ const {
5
+ children,
6
+ className: consumerClassName,
7
+ style: consumerStyle,
8
+ "data-testid": dataTestId
9
+ } = props;
10
+ return /* @__PURE__ */ React.createElement(
11
+ Flex,
12
+ {
13
+ "data-testid": dataTestId,
14
+ ref: forwardedRef,
15
+ gap: 0,
16
+ className: consumerClassName,
17
+ style: consumerStyle
18
+ },
19
+ children
20
+ );
21
+ });
22
+ Prefix.displayName = "Button.Prefix";
23
+ export {
24
+ Prefix
25
+ };
26
+ //# sourceMappingURL=Prefix.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../src/buttons/button/Prefix.tsx"],
4
+ "sourcesContent": ["import React, { forwardRef, type ReactNode } from 'react';\n\nimport { type DataTestId } from '../../core/types/data-props.js';\nimport { type StylingProps } from '../../core/types/styling-props.js';\nimport { Flex } from '../../layouts/flex/Flex.js';\n\n//#region Typings\n/**\n * Accepted properties for the Button Prefix.\n * @public\n */\nexport interface ButtonPrefixProps extends StylingProps, DataTestId {\n /** Elements to be displayed in the Button Prefix slot. */\n children: ReactNode;\n}\n//#endregion\n\n/**\n * Button Prefix component.\n * @public\n */\nexport const Prefix = /* @__PURE__ */ forwardRef<\n HTMLDivElement,\n ButtonPrefixProps\n>((props, forwardedRef) => {\n const {\n children,\n className: consumerClassName,\n style: consumerStyle,\n 'data-testid': dataTestId,\n }: ButtonPrefixProps = props;\n\n return (\n <Flex\n data-testid={dataTestId}\n ref={forwardedRef}\n gap={0}\n className={consumerClassName}\n style={consumerStyle}\n >\n {children}\n </Flex>\n );\n});\n\n(Prefix as typeof Prefix & { displayName: string }).displayName =\n 'Button.Prefix';\n"],
5
+ "mappings": "AAAA,OAAO,SAAS,kBAAkC;AAIlD,SAAS,YAAY;AAiBd,MAAM,SAAyB,2BAGpC,CAAC,OAAO,iBAAiB;AACzB,QAAM;AAAA,IACJ;AAAA,IACA,WAAW;AAAA,IACX,OAAO;AAAA,IACP,eAAe;AAAA,EACjB,IAAuB;AAEvB,SACE;AAAA,IAAC;AAAA;AAAA,MACC,eAAa;AAAA,MACb,KAAK;AAAA,MACL,KAAK;AAAA,MACL,WAAW;AAAA,MACX,OAAO;AAAA;AAAA,IAEN;AAAA,EACH;AAEJ,CAAC;AAEA,OAAmD,cAClD;",
6
+ "names": []
7
+ }
@@ -0,0 +1,28 @@
1
+ import React, { forwardRef } from "react";
2
+ import { Flex } from "../../layouts/flex/Flex.js";
3
+ const Suffix = forwardRef(
4
+ (props, forwardedRef) => {
5
+ const {
6
+ children,
7
+ className: consumerClassName,
8
+ style: consumerStyle,
9
+ "data-testid": dataTestId
10
+ } = props;
11
+ return /* @__PURE__ */ React.createElement(
12
+ Flex,
13
+ {
14
+ "data-testid": dataTestId,
15
+ gap: 0,
16
+ ref: forwardedRef,
17
+ className: consumerClassName,
18
+ style: consumerStyle
19
+ },
20
+ children
21
+ );
22
+ }
23
+ );
24
+ Suffix.displayName = "Button.Suffix";
25
+ export {
26
+ Suffix
27
+ };
28
+ //# sourceMappingURL=Suffix.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../src/buttons/button/Suffix.tsx"],
4
+ "sourcesContent": ["import React, { forwardRef } from 'react';\n\nimport { type DataTestId } from '../../core/types/data-props.js';\nimport { type StylingProps } from '../../core/types/styling-props.js';\nimport { Flex } from '../../layouts/flex/Flex.js';\n\n//#region Typings\n/**\n * Accepted properties for the Button Suffix.\n * @public\n */\nexport interface ButtonSuffixProps extends StylingProps, DataTestId {\n /** Elements to be displayed in the Button Suffix slot. */\n children: React.ReactNode;\n}\n//#endregion\n\n/**\n * Button Suffix component.\n * @public\n */\nexport const Suffix = forwardRef<HTMLDivElement, ButtonSuffixProps>(\n (props, forwardedRef) => {\n const {\n children,\n className: consumerClassName,\n style: consumerStyle,\n 'data-testid': dataTestId,\n }: ButtonSuffixProps = props;\n\n return (\n <Flex\n data-testid={dataTestId}\n gap={0}\n ref={forwardedRef}\n className={consumerClassName}\n style={consumerStyle}\n >\n {children}\n </Flex>\n );\n },\n);\n\n(Suffix as typeof Suffix & { displayName: string }).displayName =\n 'Button.Suffix';\n"],
5
+ "mappings": "AAAA,OAAO,SAAS,kBAAkB;AAIlC,SAAS,YAAY;AAiBd,MAAM,SAAS;AAAA,EACpB,CAAC,OAAO,iBAAiB;AACvB,UAAM;AAAA,MACJ;AAAA,MACA,WAAW;AAAA,MACX,OAAO;AAAA,MACP,eAAe;AAAA,IACjB,IAAuB;AAEvB,WACE;AAAA,MAAC;AAAA;AAAA,QACC,eAAa;AAAA,QACb,KAAK;AAAA,QACL,KAAK;AAAA,QACL,WAAW;AAAA,QACX,OAAO;AAAA;AAAA,MAEN;AAAA,IACH;AAAA,EAEJ;AACF;AAEC,OAAmD,cAClD;",
6
+ "names": []
7
+ }
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=button-aria.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": [],
4
+ "sourcesContent": [],
5
+ "mappings": "",
6
+ "names": []
7
+ }
@@ -0,0 +1,59 @@
1
+ let supportsPreventScrollCached = null;
2
+ function supportsPreventScroll() {
3
+ if (supportsPreventScrollCached === null) {
4
+ supportsPreventScrollCached = false;
5
+ try {
6
+ const focusElem = document.createElement("div");
7
+ focusElem.focus({
8
+ get preventScroll() {
9
+ supportsPreventScrollCached = true;
10
+ return true;
11
+ }
12
+ });
13
+ } catch (e) {
14
+ }
15
+ }
16
+ return supportsPreventScrollCached;
17
+ }
18
+ function getScrollableElements(element) {
19
+ let parent = element.parentNode;
20
+ const scrollableElements = [];
21
+ const rootScrollingElement = document.scrollingElement || document.documentElement;
22
+ while (parent instanceof HTMLElement && parent !== rootScrollingElement) {
23
+ if (parent.offsetHeight < parent.scrollHeight || parent.offsetWidth < parent.scrollWidth) {
24
+ scrollableElements.push({
25
+ element: parent,
26
+ scrollTop: parent.scrollTop,
27
+ scrollLeft: parent.scrollLeft
28
+ });
29
+ }
30
+ parent = parent.parentNode;
31
+ }
32
+ if (rootScrollingElement instanceof HTMLElement) {
33
+ scrollableElements.push({
34
+ element: rootScrollingElement,
35
+ scrollTop: rootScrollingElement.scrollTop,
36
+ scrollLeft: rootScrollingElement.scrollLeft
37
+ });
38
+ }
39
+ return scrollableElements;
40
+ }
41
+ function restoreScrollPosition(scrollableElements) {
42
+ for (const { element, scrollTop, scrollLeft } of scrollableElements) {
43
+ element.scrollTop = scrollTop;
44
+ element.scrollLeft = scrollLeft;
45
+ }
46
+ }
47
+ function focusWithoutScrolling(element) {
48
+ if (supportsPreventScroll()) {
49
+ element.focus({ preventScroll: true });
50
+ } else {
51
+ const scrollableElements = getScrollableElements(element);
52
+ element.focus();
53
+ restoreScrollPosition(scrollableElements);
54
+ }
55
+ }
56
+ export {
57
+ focusWithoutScrolling
58
+ };
59
+ //# sourceMappingURL=focus-without-scrolling.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../src/buttons/button/utils/focus-without-scrolling.ts"],
4
+ "sourcesContent": ["interface ScrollableElement {\n element: HTMLElement;\n scrollTop: number;\n scrollLeft: number;\n}\n\nlet supportsPreventScrollCached: boolean | null = null;\nfunction supportsPreventScroll() {\n if (supportsPreventScrollCached === null) {\n supportsPreventScrollCached = false;\n try {\n const focusElem = document.createElement('div');\n focusElem.focus({\n get preventScroll() {\n supportsPreventScrollCached = true;\n return true;\n },\n });\n } catch (e) {\n // Ignore\n }\n }\n\n return supportsPreventScrollCached;\n}\n\nfunction getScrollableElements(\n element: Element & HTMLOrSVGElement,\n): ScrollableElement[] {\n let parent = element.parentNode;\n const scrollableElements: ScrollableElement[] = [];\n const rootScrollingElement =\n document.scrollingElement || document.documentElement;\n\n while (parent instanceof HTMLElement && parent !== rootScrollingElement) {\n if (\n parent.offsetHeight < parent.scrollHeight ||\n parent.offsetWidth < parent.scrollWidth\n ) {\n scrollableElements.push({\n element: parent,\n scrollTop: parent.scrollTop,\n scrollLeft: parent.scrollLeft,\n });\n }\n parent = parent.parentNode;\n }\n\n if (rootScrollingElement instanceof HTMLElement) {\n scrollableElements.push({\n element: rootScrollingElement,\n scrollTop: rootScrollingElement.scrollTop,\n scrollLeft: rootScrollingElement.scrollLeft,\n });\n }\n\n return scrollableElements;\n}\n\nfunction restoreScrollPosition(scrollableElements: ScrollableElement[]) {\n for (const { element, scrollTop, scrollLeft } of scrollableElements) {\n element.scrollTop = scrollTop;\n element.scrollLeft = scrollLeft;\n }\n}\n\n/**\n * Focuses on the given element without triggering scrolling behavior.\n * @internal\n */\nexport function focusWithoutScrolling(element: Element & HTMLOrSVGElement) {\n if (supportsPreventScroll()) {\n element.focus({ preventScroll: true });\n } else {\n const scrollableElements = getScrollableElements(element);\n element.focus();\n restoreScrollPosition(scrollableElements);\n }\n}\n"],
5
+ "mappings": "AAMA,IAAI,8BAA8C;AAClD,SAAS,wBAAwB;AAC/B,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+ return event.detail === 0 && !event.pointerType;
6
+ }
7
+ function isVirtualPointerEvent(event) {
8
+ return event.width === 0 && event.height === 0 || event.width === 1 && event.height === 1 && event.pressure === 0 && event.detail === 0 && event.pointerType === "mouse";
9
+ }
10
+ export {
11
+ isVirtualClick,
12
+ isVirtualPointerEvent
13
+ };
14
+ //# sourceMappingURL=is-virtual-event.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../src/buttons/button/utils/is-virtual-event.ts"],
4
+ "sourcesContent": ["/**\n * Determines whether the given event represents a virtual click.\n * @internal\n */\nexport function isVirtualClick(event: MouseEvent | PointerEvent): boolean {\n // JAWS/NVDA with Firefox.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n if ((event as any).mozInputSource === 0 && event.isTrusted) {\n return true;\n }\n return event.detail === 0 && !(event as PointerEvent).pointerType;\n}\n\n/**\n * Determines whether the given event represents a virtual pointer event.\n * @internal\n */\nexport function isVirtualPointerEvent(event: PointerEvent) {\n // If the pointer size is zero, then we assume it's from a screen reader.\n // Android TalkBack double tap will sometimes return a event with width and height of 1\n // and pointerType === 'mouse' so we need to check for a specific combination of event attributes.\n // Cannot use \"event.pressure === 0\" as the sole check due to Safari pointer events always returning pressure === 0\n // instead of .5, see https://bugs.webkit.org/show_bug.cgi?id=206216. event.pointerType === 'mouse' is to distingush\n // Talkback double tap from Windows Firefox touch screen press\n return (\n (event.width === 0 && event.height === 0) ||\n (event.width === 1 &&\n event.height === 1 &&\n event.pressure === 0 &&\n event.detail === 0 &&\n event.pointerType === 'mouse')\n );\n}\n"],
5
+ "mappings": "AAIO,SAAS,eAAe,OAA2C;AAGxE,MAAK,MAAc,mBAAmB,KAAK,MAAM,WAAW;AAC1D,WAAO;AAAA,EACT;AACA,SAAO,MAAM,WAAW,KAAK,CAAE,MAAuB;AACxD;AAMO,SAAS,sBAAsB,OAAqB;AAOzD,SACG,MAAM,UAAU,KAAK,MAAM,WAAW,KACtC,MAAM,UAAU,KACf,MAAM,WAAW,KACjB,MAAM,aAAa,KACnB,MAAM,WAAW,KACjB,MAAM,gBAAgB;AAE5B;",
6
+ "names": []
7
+ }
@@ -0,0 +1,13 @@
1
+ import { Button } from "./button/Button.js";
2
+ import { focusWithoutScrolling } from "./button/utils/focus-without-scrolling.js";
3
+ import {
4
+ isVirtualPointerEvent,
5
+ isVirtualClick
6
+ } from "./button/utils/is-virtual-event.js";
7
+ export {
8
+ Button,
9
+ focusWithoutScrolling as _focusWithoutScrolling,
10
+ isVirtualClick as _isVirtualClick,
11
+ isVirtualPointerEvent as _isVirtualPointerEvent
12
+ };
13
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/buttons/index.ts"],
4
+ "sourcesContent": ["export { Button } from './button/Button.js';\nexport type { ButtonOwnProps, ButtonProps } from './button/Button.js';\nexport type { ButtonLabelProps } from './button/Label.js';\nexport type { ButtonPrefixProps } from './button/Prefix.js';\nexport type { ButtonSuffixProps } from './button/Suffix.js';\nexport type {\n AriaButtonProps as _AriaButtonProps,\n ButtonAria as _ButtonAria,\n AriaBaseButtonProps as _AriaBaseButtonProps,\n} from './button/types/button-aria.js';\nexport { focusWithoutScrolling as _focusWithoutScrolling } from './button/utils/focus-without-scrolling.js';\nexport {\n isVirtualPointerEvent as _isVirtualPointerEvent,\n isVirtualClick as _isVirtualClick,\n} from './button/utils/is-virtual-event.js';\n"],
5
+ "mappings": "AAAA,SAAS,cAAc;AAUvB,SAAkC,6BAA8B;AAChE;AAAA,EAC2B;AAAA,EACP;AAAA,OACb;",
6
+ "names": []
7
+ }
@@ -1,5 +1,5 @@
1
1
  import clsx from "clsx";
2
- import React, { forwardRef } from "react";
2
+ import React, { forwardRef, useId } from "react";
3
3
  import { isElement } from "react-is";
4
4
  import Spacings from "@dynatrace/strato-design-tokens/spacings";
5
5
  import { SharedProgressBarPropsContext } from "./contexts/SharedProgressBarPropsContext.js";
@@ -9,7 +9,6 @@ import { ProgressBarIcon } from "./ProgressBarIcon.js";
9
9
  import { ProgressBarLabel } from "./ProgressBarLabel.js";
10
10
  import { ProgressBarValue } from "./ProgressBarValue.js";
11
11
  import { useAriaLabelingProps } from "../../core/hooks/useAriaLabelingProps.js";
12
- import { useId } from "../../core/hooks/useId.js";
13
12
  import { useSafeForwardProps } from "../../core/hooks/useSafeForwardProps.js";
14
13
  import { colorUtilsCSS } from "../../styles/colorUtils.sty.js";
15
14
  function getProgressBarSlots(children) {
@@ -67,7 +66,7 @@ const _ProgressBar = forwardRef(
67
66
  );
68
67
  const ariaLabelingProps = useAriaLabelingProps(remainingProps);
69
68
  const forwardProps = useSafeForwardProps(remainingProps, ariaLabelingProps);
70
- const generatedId = useId({ prefix: "progress-bar" });
69
+ const generatedId = useId();
71
70
  const id = propId ?? generatedId;
72
71
  if (!slots.label && !ariaLabelingProps["aria-label"] && !ariaLabelingProps["aria-labelledby"]) {
73
72
  // eslint-disable-next-line no-console