@preply/ds-web-lib 10.0.0 → 11.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{DropdownMenu.primitives-CqJE9k4D.js → DropdownMenu.primitives-B3WK71bR.js} +4 -4
- package/dist/assets/Accordion.css +2 -2
- package/dist/assets/AlertBannerProvider.css +2 -2
- package/dist/assets/AlertDialog.css +2 -2
- package/dist/assets/Avatar.css +3 -3
- package/dist/assets/AvatarWithStatus.css +2 -2
- package/dist/assets/Badge.css +1 -1
- package/dist/assets/Box.css +3 -3
- package/dist/assets/BubbleCounter.css +1 -1
- package/dist/assets/Button.css +4 -4
- package/dist/assets/ButtonBase.css +4 -4
- package/dist/assets/Checkbox.css +1 -1
- package/dist/assets/Chips.css +2 -2
- package/dist/assets/ChipsPrimitive.css +2 -2
- package/dist/assets/CountryFlag.css +1 -1
- package/dist/assets/Dialog.css +3 -3
- package/dist/assets/Divider.css +1 -1
- package/dist/assets/DropdownMenu.css +2 -2
- package/dist/assets/FieldButton.css +3 -3
- package/dist/assets/FormControl.css +1 -1
- package/dist/assets/Heading.css +3 -3
- package/dist/assets/Icon.css +3 -3
- package/dist/assets/IconTile.css +9 -1
- package/dist/assets/InputContainer.css +2 -2
- package/dist/assets/LayoutFlex.css +1 -1
- package/dist/assets/LayoutFlexItem.css +1 -1
- package/dist/assets/Link.css +3 -3
- package/dist/assets/Loader.css +1 -1
- package/dist/assets/OnboardingTooltip.css +6 -4
- package/dist/assets/OnboardingTour.css +3 -2
- package/dist/assets/PreplyLogo.css +1 -1
- package/dist/assets/ProgressBar.css +1 -1
- package/dist/assets/ProgressSteps.css +1 -1
- package/dist/assets/Select.css +2 -2
- package/dist/assets/Slider.css +1 -1
- package/dist/assets/Spinner.css +3 -3
- package/dist/assets/Stars.css +3 -3
- package/dist/assets/Steps.css +2 -2
- package/dist/assets/Switch.css +1 -1
- package/dist/assets/Text.css +3 -3
- package/dist/assets/TextHighlighted.css +3 -3
- package/dist/assets/TextInline.css +3 -3
- package/dist/assets/Toast.css +2 -2
- package/dist/assets/Tooltip.css +1 -1
- package/dist/assets/align-self.css +1 -1
- package/dist/assets/exp-color.css +2 -2
- package/dist/assets/index.css +1 -1
- package/dist/assets/layout-gap.css +3 -3
- package/dist/assets/layout-grid.css +3 -3
- package/dist/assets/layout-hide.css +1 -1
- package/dist/assets/layout-padding.css +3 -3
- package/dist/assets/layout-relative.css +1 -1
- package/dist/assets/text-accent.css +2 -2
- package/dist/assets/text-centered.css +1 -1
- package/dist/assets/text-weight.css +2 -2
- package/dist/components/AlertDialog/AlertDialog.d.ts +3 -3
- package/dist/components/AlertDialog/AlertDialog.d.ts.map +1 -1
- package/dist/components/AlertDialog/AlertDialog.js +354 -18
- package/dist/components/Dialog/primitives/DialogCloseButton.d.ts.map +1 -1
- package/dist/components/Dialog/primitives/DialogCloseButton.js +5 -31
- package/dist/components/Dialog/primitives/DialogDescription.js +1 -1
- package/dist/components/Dialog/primitives/DialogRoot.js +5 -1149
- package/dist/components/Dialog/primitives/DialogTitle.js +1 -1
- package/dist/components/DropdownMenu/DropdownMenu.js +1 -1
- package/dist/components/DropdownMenu/primitives/DropdownMenu.primitives.js +1 -1
- package/dist/components/DropdownMenu/primitives/DropdownMenuSelectItem.primitives.js +1 -1
- package/dist/components/OnboardingTooltip/OnboardingTooltip.js +1 -1
- package/dist/{floating-ui.utils.dom-BvMNldxo.js → floating-ui.utils.dom-3OgjGonN.js} +1 -1
- package/dist/store-BUKWfVf3.js +1155 -0
- package/dist/{useButton-fjQ0ak8m.js → useButton-CFPpP0o5.js} +2 -2
- package/dist/useDialogClose-C9x1leGd.js +34 -0
- package/dist/{useOpenInteractionType-DNYFqf-a.js → useOpenInteractionType-Cj41-8Yk.js} +48 -48
- package/dist/{useRenderElement-BSthtPOr.js → useRenderElement-DtYPTE_y.js} +2 -2
- package/package.json +12 -12
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
/* AUTO GENERATED by support/tools/src/tool/code-generator/output/tokens/web-core-tokens-less.ts @Mon
|
|
2
|
-
/* AUTO GENERATED by support/tools/src/tool/code-generator/output/types/web-core-options-less.ts @Mon
|
|
3
|
-
/* AUTO GENERATED by support/tools/src/tool/code-generator/output/breakpoints/web-core-breakpoints-less.ts @Mon
|
|
1
|
+
/* AUTO GENERATED by support/tools/src/tool/code-generator/output/tokens/web-core-tokens-less.ts @Mon Mar 02 2026 15:14:21 GMT+0000 (Coordinated Universal Time) */
|
|
2
|
+
/* AUTO GENERATED by support/tools/src/tool/code-generator/output/types/web-core-options-less.ts @Mon Mar 02 2026 15:14:20 GMT+0000 (Coordinated Universal Time) */
|
|
3
|
+
/* AUTO GENERATED by support/tools/src/tool/code-generator/output/breakpoints/web-core-breakpoints-less.ts @Mon Mar 02 2026 15:14:22 GMT+0000 (Coordinated Universal Time) */
|
|
4
4
|
[data-preply-ds-component="LayoutFlex"][data-ds-padding="0"],
|
|
5
5
|
[data-preply-ds-component="LayoutFlex"][data-ds-padding*='"_":"0"'] {
|
|
6
6
|
padding: var(--d434fb);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* AUTO GENERATED by support/tools/src/tool/code-generator/output/breakpoints/web-core-breakpoints-less.ts @Mon
|
|
1
|
+
/* AUTO GENERATED by support/tools/src/tool/code-generator/output/breakpoints/web-core-breakpoints-less.ts @Mon Mar 02 2026 15:14:22 GMT+0000 (Coordinated Universal Time) */
|
|
2
2
|
[data-preply-ds-component="LayoutFlex"][data-ds-relative="true"],
|
|
3
3
|
[data-preply-ds-component="LayoutFlex"][data-ds-relative*='"_":true'] {
|
|
4
4
|
position: relative;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/* AUTO GENERATED by support/tools/src/tool/code-generator/output/types/web-core-options-less.ts @Mon
|
|
2
|
-
/* AUTO GENERATED by support/tools/src/tool/code-generator/output/tokens/web-core-tokens-less.ts @Mon
|
|
1
|
+
/* AUTO GENERATED by support/tools/src/tool/code-generator/output/types/web-core-options-less.ts @Mon Mar 02 2026 15:14:20 GMT+0000 (Coordinated Universal Time) */
|
|
2
|
+
/* AUTO GENERATED by support/tools/src/tool/code-generator/output/tokens/web-core-tokens-less.ts @Mon Mar 02 2026 15:14:21 GMT+0000 (Coordinated Universal Time) */
|
|
3
3
|
.TextAccent__AfPNQ.TextAccent--accent-default__rjbSO {
|
|
4
4
|
color: var(--628fb7);
|
|
5
5
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* AUTO GENERATED by support/tools/src/tool/code-generator/output/breakpoints/web-core-breakpoints-less.ts @Mon
|
|
1
|
+
/* AUTO GENERATED by support/tools/src/tool/code-generator/output/breakpoints/web-core-breakpoints-less.ts @Mon Mar 02 2026 15:14:22 GMT+0000 (Coordinated Universal Time) */
|
|
2
2
|
.TextCentered__7KaTF.TextCentered--centered__4f-qW {
|
|
3
3
|
text-align: center;
|
|
4
4
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/* AUTO GENERATED by support/tools/src/tool/code-generator/output/types/web-core-options-less.ts @Mon
|
|
2
|
-
/* AUTO GENERATED by support/tools/src/tool/code-generator/output/tokens/web-core-tokens-less.ts @Mon
|
|
1
|
+
/* AUTO GENERATED by support/tools/src/tool/code-generator/output/types/web-core-options-less.ts @Mon Mar 02 2026 15:14:20 GMT+0000 (Coordinated Universal Time) */
|
|
2
|
+
/* AUTO GENERATED by support/tools/src/tool/code-generator/output/tokens/web-core-tokens-less.ts @Mon Mar 02 2026 15:14:21 GMT+0000 (Coordinated Universal Time) */
|
|
3
3
|
.TextWeight__nr38y.TextWeight--weight-normal__WoBtA {
|
|
4
4
|
font-weight: var(--5ea101);
|
|
5
5
|
}
|
|
@@ -79,20 +79,20 @@ export declare const AlertDialog: React.FC<AlertDialogProps> & {
|
|
|
79
79
|
* as a trigger button, at the location where the `AlertDialog` node is
|
|
80
80
|
* placed in the DOM.
|
|
81
81
|
*/
|
|
82
|
-
Trigger: React.
|
|
82
|
+
Trigger: React.ForwardRefExoticComponent<AlertDialogTriggerProps & React.RefAttributes<HTMLButtonElement | HTMLAnchorElement>>;
|
|
83
83
|
/**
|
|
84
84
|
* Wraps a Button component that closes the dialog when clicked, unless if
|
|
85
85
|
* `event.defaultPrevented`.
|
|
86
86
|
*
|
|
87
87
|
* It's intended for the main/confirmatory action (e.g. "Delete", "Confirm").
|
|
88
88
|
*/
|
|
89
|
-
Action: React.ForwardRefExoticComponent<ButtonProps & React.RefAttributes<HTMLButtonElement
|
|
89
|
+
Action: React.ForwardRefExoticComponent<ButtonProps & React.RefAttributes<HTMLButtonElement>>;
|
|
90
90
|
/**
|
|
91
91
|
* Wraps a Button component that closes the dialog when clicked, unless if
|
|
92
92
|
* `event.defaultPrevented`.
|
|
93
93
|
*
|
|
94
94
|
* It's intended for the secondary/cancellation action (e.g. "Cancel", "Close").
|
|
95
95
|
*/
|
|
96
|
-
Cancel: React.ForwardRefExoticComponent<ButtonProps & React.RefAttributes<HTMLButtonElement
|
|
96
|
+
Cancel: React.ForwardRefExoticComponent<ButtonProps & React.RefAttributes<HTMLButtonElement>>;
|
|
97
97
|
};
|
|
98
98
|
//# sourceMappingURL=AlertDialog.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AlertDialog.d.ts","sourceRoot":"","sources":["../../../src/components/AlertDialog/AlertDialog.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,EAAgC,SAAS,
|
|
1
|
+
{"version":3,"file":"AlertDialog.d.ts","sourceRoot":"","sources":["../../../src/components/AlertDialog/AlertDialog.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,EAAgC,SAAS,EAA4B,MAAM,OAAO,CAAC;AAMjG,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAE1C,OAAO,EAAU,KAAK,IAAI,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAEhE,MAAM,MAAM,uBAAuB,GAAG;IAClC,QAAQ,EAAE,SAAS,CAAC;CACvB,CAAC;AAoBF,MAAM,MAAM,sBAAsB,GAAG,WAAW,CAAC;AAQjD,MAAM,MAAM,sBAAsB,GAAG,WAAW,CAAC;AAQjD,MAAM,MAAM,gBAAgB,GAAG;IAC3B,mEAAmE;IACnE,KAAK,EAAE,SAAS,CAAC;IACjB,oDAAoD;IACpD,WAAW,EAAE,SAAS,CAAC;IACvB;;;;OAIG;IACH,QAAQ,EAAE,SAAS,CAAC;IACpB;;;;;OAKG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,OAAO,CAAC,EAAE,OAAO,CAAC;CACrB,CAAC;AAiDF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,eAAO,MAAM,WAAW;IACpB;;;;;;;;;;;OAWG;;IAEH;;;;;OAKG;;IAEH;;;;;OAKG;;CAEL,CAAC"}
|
|
@@ -1,13 +1,341 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
2
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { forwardRef, Children, isValidElement, cloneElement } from "react";
|
|
5
5
|
import { usePortalElement } from "@preply/ds-web-root";
|
|
6
6
|
import { Heading } from "../Heading/Heading.js";
|
|
7
7
|
import { getDatasetProps } from "@preply/ds-web-core";
|
|
8
8
|
import { webComponentNames } from "@preply/ds-visual-coverage-preply-component-names";
|
|
9
9
|
import { Button } from "../Button/Button.js";
|
|
10
|
-
import
|
|
10
|
+
import { u as useDialogRootContext, D as DialogRootContext } from "../../DialogRootContext-BCXmmJAw.js";
|
|
11
|
+
import { u as useButton } from "../../useButton-CFPpP0o5.js";
|
|
12
|
+
import { u as useRenderElement, b as useRefWithInit, E as EMPTY_OBJECT } from "../../useRenderElement-DtYPTE_y.js";
|
|
13
|
+
import { p as popupStateMapping, t as transitionStatusMapping, C as CommonPopupDataAttributes, u as useOpenChangeComplete, a as COMPOSITE_KEYS, I as InternalBackdrop, i as inertValue, F as FloatingFocusManager, b as FloatingPortal, g as getEmptyContext, c as triggerOpenStateMapping } from "../../useOpenInteractionType-Cj41-8Yk.js";
|
|
14
|
+
import { u as useDialogClose } from "../../useDialogClose-C9x1leGd.js";
|
|
15
|
+
import { u as useDialogRoot, D as DialogStore } from "../../store-BUKWfVf3.js";
|
|
16
|
+
import { u as useEventCallback } from "../../floating-ui.utils.dom-3OgjGonN.js";
|
|
17
|
+
import { u as useBaseUiId } from "../../useBaseUiId-DavsGYu9.js";
|
|
18
|
+
import '../../assets/AlertDialog.css';const stateAttributesMapping$1 = {
|
|
19
|
+
...popupStateMapping,
|
|
20
|
+
...transitionStatusMapping
|
|
21
|
+
};
|
|
22
|
+
const AlertDialogBackdrop = /* @__PURE__ */ React.forwardRef(function AlertDialogBackdrop2(componentProps, forwardedRef) {
|
|
23
|
+
const {
|
|
24
|
+
render,
|
|
25
|
+
className,
|
|
26
|
+
forceRender = false,
|
|
27
|
+
...elementProps
|
|
28
|
+
} = componentProps;
|
|
29
|
+
const {
|
|
30
|
+
store
|
|
31
|
+
} = useDialogRootContext();
|
|
32
|
+
const open = store.useState("open");
|
|
33
|
+
const nested = store.useState("nested");
|
|
34
|
+
const mounted = store.useState("mounted");
|
|
35
|
+
const transitionStatus = store.useState("transitionStatus");
|
|
36
|
+
const state = React.useMemo(() => ({
|
|
37
|
+
open,
|
|
38
|
+
transitionStatus
|
|
39
|
+
}), [open, transitionStatus]);
|
|
40
|
+
return useRenderElement("div", componentProps, {
|
|
41
|
+
state,
|
|
42
|
+
ref: [store.context.backdropRef, forwardedRef],
|
|
43
|
+
props: [{
|
|
44
|
+
role: "presentation",
|
|
45
|
+
hidden: !mounted,
|
|
46
|
+
style: {
|
|
47
|
+
userSelect: "none",
|
|
48
|
+
WebkitUserSelect: "none"
|
|
49
|
+
}
|
|
50
|
+
}, elementProps],
|
|
51
|
+
stateAttributesMapping: stateAttributesMapping$1,
|
|
52
|
+
enabled: forceRender || !nested
|
|
53
|
+
});
|
|
54
|
+
});
|
|
55
|
+
if (process.env.NODE_ENV !== "production") AlertDialogBackdrop.displayName = "AlertDialogBackdrop";
|
|
56
|
+
const AlertDialogClose = /* @__PURE__ */ React.forwardRef(function AlertDialogClose2(componentProps, forwardedRef) {
|
|
57
|
+
const {
|
|
58
|
+
render,
|
|
59
|
+
className,
|
|
60
|
+
disabled = false,
|
|
61
|
+
nativeButton = true,
|
|
62
|
+
...elementProps
|
|
63
|
+
} = componentProps;
|
|
64
|
+
const {
|
|
65
|
+
store
|
|
66
|
+
} = useDialogRootContext();
|
|
67
|
+
const open = store.useState("open");
|
|
68
|
+
const {
|
|
69
|
+
getRootProps,
|
|
70
|
+
ref
|
|
71
|
+
} = useDialogClose({
|
|
72
|
+
disabled,
|
|
73
|
+
open,
|
|
74
|
+
setOpen: store.setOpen,
|
|
75
|
+
nativeButton
|
|
76
|
+
});
|
|
77
|
+
const state = React.useMemo(() => ({
|
|
78
|
+
disabled
|
|
79
|
+
}), [disabled]);
|
|
80
|
+
return useRenderElement("button", componentProps, {
|
|
81
|
+
state,
|
|
82
|
+
ref: [forwardedRef, ref],
|
|
83
|
+
props: [elementProps, getRootProps]
|
|
84
|
+
});
|
|
85
|
+
});
|
|
86
|
+
if (process.env.NODE_ENV !== "production") AlertDialogClose.displayName = "AlertDialogClose";
|
|
87
|
+
const AlertDialogDescription = /* @__PURE__ */ React.forwardRef(function AlertDialogDescription2(componentProps, forwardedRef) {
|
|
88
|
+
const {
|
|
89
|
+
render,
|
|
90
|
+
className,
|
|
91
|
+
id: idProp,
|
|
92
|
+
...elementProps
|
|
93
|
+
} = componentProps;
|
|
94
|
+
const {
|
|
95
|
+
store
|
|
96
|
+
} = useDialogRootContext();
|
|
97
|
+
const id = useBaseUiId(idProp);
|
|
98
|
+
store.useSyncedValueWithCleanup("descriptionElementId", id);
|
|
99
|
+
return useRenderElement("p", componentProps, {
|
|
100
|
+
ref: forwardedRef,
|
|
101
|
+
props: [{
|
|
102
|
+
id
|
|
103
|
+
}, elementProps]
|
|
104
|
+
});
|
|
105
|
+
});
|
|
106
|
+
if (process.env.NODE_ENV !== "production") AlertDialogDescription.displayName = "AlertDialogDescription";
|
|
107
|
+
let AlertDialogPopupCssVars = /* @__PURE__ */ (function(AlertDialogPopupCssVars2) {
|
|
108
|
+
AlertDialogPopupCssVars2["nestedDialogs"] = "--nested-dialogs";
|
|
109
|
+
return AlertDialogPopupCssVars2;
|
|
110
|
+
})({});
|
|
111
|
+
let AlertDialogPopupDataAttributes = (function(AlertDialogPopupDataAttributes2) {
|
|
112
|
+
AlertDialogPopupDataAttributes2[AlertDialogPopupDataAttributes2["open"] = CommonPopupDataAttributes.open] = "open";
|
|
113
|
+
AlertDialogPopupDataAttributes2[AlertDialogPopupDataAttributes2["closed"] = CommonPopupDataAttributes.closed] = "closed";
|
|
114
|
+
AlertDialogPopupDataAttributes2[AlertDialogPopupDataAttributes2["startingStyle"] = CommonPopupDataAttributes.startingStyle] = "startingStyle";
|
|
115
|
+
AlertDialogPopupDataAttributes2[AlertDialogPopupDataAttributes2["endingStyle"] = CommonPopupDataAttributes.endingStyle] = "endingStyle";
|
|
116
|
+
AlertDialogPopupDataAttributes2["nested"] = "data-nested";
|
|
117
|
+
AlertDialogPopupDataAttributes2["nestedDialogOpen"] = "data-nested-dialog-open";
|
|
118
|
+
return AlertDialogPopupDataAttributes2;
|
|
119
|
+
})({});
|
|
120
|
+
const AlertDialogPortalContext = /* @__PURE__ */ React.createContext(void 0);
|
|
121
|
+
if (process.env.NODE_ENV !== "production") AlertDialogPortalContext.displayName = "AlertDialogPortalContext";
|
|
122
|
+
function useAlertDialogPortalContext() {
|
|
123
|
+
const value = React.useContext(AlertDialogPortalContext);
|
|
124
|
+
if (value === void 0) {
|
|
125
|
+
throw new Error("Base UI: <AlertDialog.Portal> is missing.");
|
|
126
|
+
}
|
|
127
|
+
return value;
|
|
128
|
+
}
|
|
129
|
+
const stateAttributesMapping = {
|
|
130
|
+
...popupStateMapping,
|
|
131
|
+
...transitionStatusMapping,
|
|
132
|
+
nestedDialogOpen(value) {
|
|
133
|
+
return value ? {
|
|
134
|
+
[AlertDialogPopupDataAttributes.nestedDialogOpen]: ""
|
|
135
|
+
} : null;
|
|
136
|
+
}
|
|
137
|
+
};
|
|
138
|
+
const AlertDialogPopup = /* @__PURE__ */ React.forwardRef(function AlertDialogPopup2(componentProps, forwardedRef) {
|
|
139
|
+
const {
|
|
140
|
+
className,
|
|
141
|
+
render,
|
|
142
|
+
initialFocus,
|
|
143
|
+
finalFocus,
|
|
144
|
+
...elementProps
|
|
145
|
+
} = componentProps;
|
|
146
|
+
const {
|
|
147
|
+
store
|
|
148
|
+
} = useDialogRootContext();
|
|
149
|
+
const descriptionElementId = store.useState("descriptionElementId");
|
|
150
|
+
const floatingRootContext = store.useState("floatingRootContext");
|
|
151
|
+
const rootPopupProps = store.useState("popupProps");
|
|
152
|
+
const mounted = store.useState("mounted");
|
|
153
|
+
const nested = store.useState("nested");
|
|
154
|
+
const nestedOpenDialogCount = store.useState("nestedOpenDialogCount");
|
|
155
|
+
const open = store.useState("open");
|
|
156
|
+
const titleElementId = store.useState("titleElementId");
|
|
157
|
+
const transitionStatus = store.useState("transitionStatus");
|
|
158
|
+
useAlertDialogPortalContext();
|
|
159
|
+
useOpenChangeComplete({
|
|
160
|
+
open,
|
|
161
|
+
ref: store.context.popupRef,
|
|
162
|
+
onComplete() {
|
|
163
|
+
var _a, _b;
|
|
164
|
+
if (open) {
|
|
165
|
+
(_b = (_a = store.context).openChangeComplete) == null ? void 0 : _b.call(_a, true);
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
});
|
|
169
|
+
const defaultInitialFocus = useEventCallback((interactionType) => {
|
|
170
|
+
if (interactionType === "touch") {
|
|
171
|
+
return store.context.popupRef.current;
|
|
172
|
+
}
|
|
173
|
+
return true;
|
|
174
|
+
});
|
|
175
|
+
const resolvedInitialFocus = initialFocus === void 0 ? defaultInitialFocus : initialFocus;
|
|
176
|
+
const nestedDialogOpen = nestedOpenDialogCount > 0;
|
|
177
|
+
const state = React.useMemo(() => ({
|
|
178
|
+
open,
|
|
179
|
+
nested,
|
|
180
|
+
transitionStatus,
|
|
181
|
+
nestedDialogOpen
|
|
182
|
+
}), [open, nested, transitionStatus, nestedDialogOpen]);
|
|
183
|
+
const element = useRenderElement("div", componentProps, {
|
|
184
|
+
state,
|
|
185
|
+
props: [rootPopupProps, {
|
|
186
|
+
"aria-labelledby": titleElementId != null ? titleElementId : void 0,
|
|
187
|
+
"aria-describedby": descriptionElementId != null ? descriptionElementId : void 0,
|
|
188
|
+
role: "alertdialog",
|
|
189
|
+
tabIndex: -1,
|
|
190
|
+
hidden: !mounted,
|
|
191
|
+
onKeyDown(event) {
|
|
192
|
+
if (COMPOSITE_KEYS.has(event.key)) {
|
|
193
|
+
event.stopPropagation();
|
|
194
|
+
}
|
|
195
|
+
},
|
|
196
|
+
style: {
|
|
197
|
+
[AlertDialogPopupCssVars.nestedDialogs]: nestedOpenDialogCount
|
|
198
|
+
}
|
|
199
|
+
}, elementProps],
|
|
200
|
+
ref: [forwardedRef, store.context.popupRef, store.getElementSetter("popupElement")],
|
|
201
|
+
stateAttributesMapping
|
|
202
|
+
});
|
|
203
|
+
return /* @__PURE__ */ jsxs(React.Fragment, {
|
|
204
|
+
children: [mounted && /* @__PURE__ */ jsx(InternalBackdrop, {
|
|
205
|
+
ref: store.context.internalBackdropRef,
|
|
206
|
+
inert: inertValue(!open)
|
|
207
|
+
}), /* @__PURE__ */ jsx(FloatingFocusManager, {
|
|
208
|
+
context: floatingRootContext,
|
|
209
|
+
disabled: !mounted,
|
|
210
|
+
initialFocus: resolvedInitialFocus,
|
|
211
|
+
returnFocus: finalFocus,
|
|
212
|
+
children: element
|
|
213
|
+
})]
|
|
214
|
+
});
|
|
215
|
+
});
|
|
216
|
+
if (process.env.NODE_ENV !== "production") AlertDialogPopup.displayName = "AlertDialogPopup";
|
|
217
|
+
function AlertDialogPortal(props) {
|
|
218
|
+
const {
|
|
219
|
+
children,
|
|
220
|
+
keepMounted = false,
|
|
221
|
+
container
|
|
222
|
+
} = props;
|
|
223
|
+
const {
|
|
224
|
+
store
|
|
225
|
+
} = useDialogRootContext();
|
|
226
|
+
const mounted = store.useState("mounted");
|
|
227
|
+
const shouldRender = mounted || keepMounted;
|
|
228
|
+
if (!shouldRender) {
|
|
229
|
+
return null;
|
|
230
|
+
}
|
|
231
|
+
return /* @__PURE__ */ jsx(AlertDialogPortalContext.Provider, {
|
|
232
|
+
value: keepMounted,
|
|
233
|
+
children: /* @__PURE__ */ jsx(FloatingPortal, {
|
|
234
|
+
root: container,
|
|
235
|
+
children
|
|
236
|
+
})
|
|
237
|
+
});
|
|
238
|
+
}
|
|
239
|
+
const INITIAL_STATE = {
|
|
240
|
+
open: false,
|
|
241
|
+
dismissible: false,
|
|
242
|
+
nested: false,
|
|
243
|
+
popupElement: null,
|
|
244
|
+
triggerElement: null,
|
|
245
|
+
modal: true,
|
|
246
|
+
descriptionElementId: void 0,
|
|
247
|
+
titleElementId: void 0,
|
|
248
|
+
openMethod: null,
|
|
249
|
+
mounted: false,
|
|
250
|
+
transitionStatus: "idle",
|
|
251
|
+
nestedOpenDialogCount: 0,
|
|
252
|
+
triggerProps: EMPTY_OBJECT,
|
|
253
|
+
popupProps: EMPTY_OBJECT,
|
|
254
|
+
floatingRootContext: getEmptyContext()
|
|
255
|
+
};
|
|
256
|
+
const AlertDialogRoot = function AlertDialogRoot2(props) {
|
|
257
|
+
const {
|
|
258
|
+
children,
|
|
259
|
+
defaultOpen = false,
|
|
260
|
+
onOpenChange,
|
|
261
|
+
onOpenChangeComplete,
|
|
262
|
+
open: openProp,
|
|
263
|
+
actionsRef
|
|
264
|
+
} = props;
|
|
265
|
+
const parentDialogRootContext = useDialogRootContext();
|
|
266
|
+
const nested = Boolean(parentDialogRootContext);
|
|
267
|
+
const store = useRefWithInit(DialogStore.create, INITIAL_STATE).current;
|
|
268
|
+
store.useControlledProp("open", openProp, defaultOpen);
|
|
269
|
+
store.useSyncedValue("nested", nested);
|
|
270
|
+
store.useContextCallback("openChange", onOpenChange);
|
|
271
|
+
store.useContextCallback("openChangeComplete", onOpenChangeComplete);
|
|
272
|
+
useDialogRoot({
|
|
273
|
+
store,
|
|
274
|
+
actionsRef,
|
|
275
|
+
parentContext: parentDialogRootContext == null ? void 0 : parentDialogRootContext.store.context
|
|
276
|
+
});
|
|
277
|
+
const contextValue = React.useMemo(() => ({
|
|
278
|
+
store
|
|
279
|
+
}), [store]);
|
|
280
|
+
return /* @__PURE__ */ jsx(DialogRootContext.Provider, {
|
|
281
|
+
value: contextValue,
|
|
282
|
+
children
|
|
283
|
+
});
|
|
284
|
+
};
|
|
285
|
+
if (process.env.NODE_ENV !== "production") AlertDialogRoot.displayName = "AlertDialogRoot";
|
|
286
|
+
const AlertDialogTitle = /* @__PURE__ */ React.forwardRef(function AlertDialogTitle2(componentProps, forwardedRef) {
|
|
287
|
+
const {
|
|
288
|
+
render,
|
|
289
|
+
className,
|
|
290
|
+
id: idProp,
|
|
291
|
+
...elementProps
|
|
292
|
+
} = componentProps;
|
|
293
|
+
const {
|
|
294
|
+
store
|
|
295
|
+
} = useDialogRootContext();
|
|
296
|
+
const id = useBaseUiId(idProp);
|
|
297
|
+
store.useSyncedValueWithCleanup("titleElementId", id);
|
|
298
|
+
return useRenderElement("h2", componentProps, {
|
|
299
|
+
ref: forwardedRef,
|
|
300
|
+
props: [{
|
|
301
|
+
id
|
|
302
|
+
}, elementProps]
|
|
303
|
+
});
|
|
304
|
+
});
|
|
305
|
+
if (process.env.NODE_ENV !== "production") AlertDialogTitle.displayName = "AlertDialogTitle";
|
|
306
|
+
const AlertDialogTrigger$1 = /* @__PURE__ */ React.forwardRef(function AlertDialogTrigger(componentProps, forwardedRef) {
|
|
307
|
+
const {
|
|
308
|
+
render,
|
|
309
|
+
className,
|
|
310
|
+
disabled = false,
|
|
311
|
+
nativeButton = true,
|
|
312
|
+
...elementProps
|
|
313
|
+
} = componentProps;
|
|
314
|
+
const {
|
|
315
|
+
store
|
|
316
|
+
} = useDialogRootContext();
|
|
317
|
+
const open = store.useState("open");
|
|
318
|
+
const triggerProps = store.useState("triggerProps");
|
|
319
|
+
const state = React.useMemo(() => ({
|
|
320
|
+
disabled,
|
|
321
|
+
open
|
|
322
|
+
}), [disabled, open]);
|
|
323
|
+
const {
|
|
324
|
+
getButtonProps,
|
|
325
|
+
buttonRef
|
|
326
|
+
} = useButton({
|
|
327
|
+
disabled,
|
|
328
|
+
native: nativeButton
|
|
329
|
+
});
|
|
330
|
+
return useRenderElement("button", componentProps, {
|
|
331
|
+
state,
|
|
332
|
+
ref: [forwardedRef, buttonRef, store.getElementSetter("triggerElement")],
|
|
333
|
+
stateAttributesMapping: triggerOpenStateMapping,
|
|
334
|
+
props: [triggerProps, elementProps, getButtonProps]
|
|
335
|
+
});
|
|
336
|
+
});
|
|
337
|
+
if (process.env.NODE_ENV !== "production") AlertDialogTrigger$1.displayName = "AlertDialogTrigger";
|
|
338
|
+
const overlay = "overlay__cqEa0";
|
|
11
339
|
const content = "content__U-iLo";
|
|
12
340
|
const description = "description__7w95W";
|
|
13
341
|
const actions = "actions__DbfEY";
|
|
@@ -17,14 +345,22 @@ const styles = {
|
|
|
17
345
|
description,
|
|
18
346
|
actions
|
|
19
347
|
};
|
|
20
|
-
const
|
|
21
|
-
children
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
348
|
+
const AlertDialogTrigger2 = forwardRef(function AlertDialogActionComponent(props, ref) {
|
|
349
|
+
const child = Children.only(props.children);
|
|
350
|
+
if (!isValidElement(child)) return null;
|
|
351
|
+
return /* @__PURE__ */ jsx(AlertDialogTrigger$1, { render: (primitiveProps) => {
|
|
352
|
+
const mergedProps = {
|
|
353
|
+
...primitiveProps,
|
|
354
|
+
ref
|
|
355
|
+
};
|
|
356
|
+
return cloneElement(child, mergedProps);
|
|
357
|
+
} });
|
|
358
|
+
});
|
|
359
|
+
const AlertDialogAction = forwardRef(function AlertDialogActionComponent2(props, ref) {
|
|
360
|
+
return /* @__PURE__ */ jsx(AlertDialogClose, { ref, render: /* @__PURE__ */ jsx(Button, {}), ...props });
|
|
25
361
|
});
|
|
26
362
|
const AlertDialogCancel = forwardRef(function AlertDialogCancelComponent(props, ref) {
|
|
27
|
-
return /* @__PURE__ */ jsx(
|
|
363
|
+
return /* @__PURE__ */ jsx(AlertDialogClose, { ref, render: /* @__PURE__ */ jsx(Button, {}), ...props });
|
|
28
364
|
});
|
|
29
365
|
const AlertDialogComponent = ({
|
|
30
366
|
open,
|
|
@@ -41,20 +377,20 @@ const AlertDialogComponent = ({
|
|
|
41
377
|
const actions2 = [];
|
|
42
378
|
Children.forEach(children, (child) => {
|
|
43
379
|
if (isValidElement(child)) {
|
|
44
|
-
if (child.type ===
|
|
380
|
+
if (child.type === AlertDialogTrigger2) {
|
|
45
381
|
trigger = child;
|
|
46
382
|
} else {
|
|
47
383
|
actions2.push(child);
|
|
48
384
|
}
|
|
49
385
|
}
|
|
50
386
|
});
|
|
51
|
-
return /* @__PURE__ */ jsxs(
|
|
387
|
+
return /* @__PURE__ */ jsxs(AlertDialogRoot, { open, children: [
|
|
52
388
|
trigger,
|
|
53
|
-
/* @__PURE__ */ jsxs(
|
|
54
|
-
/* @__PURE__ */ jsx(
|
|
55
|
-
/* @__PURE__ */ jsxs(
|
|
56
|
-
/* @__PURE__ */ jsx(
|
|
57
|
-
/* @__PURE__ */ jsx(
|
|
389
|
+
/* @__PURE__ */ jsxs(AlertDialogPortal, { container, children: [
|
|
390
|
+
/* @__PURE__ */ jsx(AlertDialogBackdrop, { className: styles.overlay }),
|
|
391
|
+
/* @__PURE__ */ jsxs(AlertDialogPopup, { ...datasetProps, className: styles.content, children: [
|
|
392
|
+
/* @__PURE__ */ jsx(AlertDialogTitle, { render: /* @__PURE__ */ jsx(Heading, { tag: "h3", variant: "medium", children: title }) }),
|
|
393
|
+
/* @__PURE__ */ jsx(AlertDialogDescription, { className: styles.description, children: description2 }),
|
|
58
394
|
/* @__PURE__ */ jsx("div", { className: styles.actions, children: actions2 })
|
|
59
395
|
] })
|
|
60
396
|
] })
|
|
@@ -73,7 +409,7 @@ const AlertDialog = Object.assign(AlertDialogComponent, {
|
|
|
73
409
|
* as a trigger button, at the location where the `AlertDialog` node is
|
|
74
410
|
* placed in the DOM.
|
|
75
411
|
*/
|
|
76
|
-
Trigger:
|
|
412
|
+
Trigger: AlertDialogTrigger2,
|
|
77
413
|
/**
|
|
78
414
|
* Wraps a Button component that closes the dialog when clicked, unless if
|
|
79
415
|
* `event.defaultPrevented`.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DialogCloseButton.d.ts","sourceRoot":"","sources":["../../../../src/components/Dialog/primitives/DialogCloseButton.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,EAAc,YAAY,EAAE,MAAM,OAAO,CAAC;AAIxD,OAAO,EAAc,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAI1E,MAAM,MAAM,sBAAsB,GAAG;IACjC,QAAQ,CAAC,EAAE,YAAY,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,eAAO,MAAM,iBAAiB,kGAS7B,CAAC;AAEF,MAAM,MAAM,6BAA6B,GAAG,eAAe,CAAC;AAE5D,eAAO,MAAM,wBAAwB,
|
|
1
|
+
{"version":3,"file":"DialogCloseButton.d.ts","sourceRoot":"","sources":["../../../../src/components/Dialog/primitives/DialogCloseButton.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,EAAc,YAAY,EAAE,MAAM,OAAO,CAAC;AAIxD,OAAO,EAAc,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAI1E,MAAM,MAAM,sBAAsB,GAAG;IACjC,QAAQ,CAAC,EAAE,YAAY,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,eAAO,MAAM,iBAAiB,kGAS7B,CAAC;AAEF,MAAM,MAAM,6BAA6B,GAAG,eAAe,CAAC;AAE5D,eAAO,MAAM,wBAAwB,2FAgBnC,CAAC"}
|
|
@@ -6,37 +6,9 @@ import { useIntl } from "react-intl";
|
|
|
6
6
|
import { IconButton } from "../../IconButton/IconButton.js";
|
|
7
7
|
import { genericAriaLabels } from "../../../utils/shared-strings.js";
|
|
8
8
|
import { s as styles } from "../../../Dialog.module-Ba1X7b3N.js";
|
|
9
|
-
import { u as
|
|
10
|
-
import { u as useButton } from "../../../useButton-fjQ0ak8m.js";
|
|
11
|
-
import { m as mergeProps, u as useRenderElement } from "../../../useRenderElement-BSthtPOr.js";
|
|
9
|
+
import { u as useDialogClose } from "../../../useDialogClose-C9x1leGd.js";
|
|
12
10
|
import { u as useDialogRootContext } from "../../../DialogRootContext-BCXmmJAw.js";
|
|
13
|
-
|
|
14
|
-
const {
|
|
15
|
-
open,
|
|
16
|
-
setOpen,
|
|
17
|
-
disabled,
|
|
18
|
-
nativeButton
|
|
19
|
-
} = params;
|
|
20
|
-
const handleClick = useEventCallback((event) => {
|
|
21
|
-
if (open) {
|
|
22
|
-
setOpen(false, createChangeEventDetails("close-press", event.nativeEvent));
|
|
23
|
-
}
|
|
24
|
-
});
|
|
25
|
-
const {
|
|
26
|
-
getButtonProps,
|
|
27
|
-
buttonRef
|
|
28
|
-
} = useButton({
|
|
29
|
-
disabled,
|
|
30
|
-
native: nativeButton
|
|
31
|
-
});
|
|
32
|
-
const getRootProps = (externalProps) => mergeProps({
|
|
33
|
-
onClick: handleClick
|
|
34
|
-
}, externalProps, getButtonProps);
|
|
35
|
-
return {
|
|
36
|
-
getRootProps,
|
|
37
|
-
ref: buttonRef
|
|
38
|
-
};
|
|
39
|
-
}
|
|
11
|
+
import { u as useRenderElement } from "../../../useRenderElement-DtYPTE_y.js";
|
|
40
12
|
const DialogClose = /* @__PURE__ */ React.forwardRef(function DialogClose2(componentProps, forwardedRef) {
|
|
41
13
|
const {
|
|
42
14
|
render,
|
|
@@ -85,7 +57,9 @@ const DialogDefaultCloseButton = forwardRef(function DefaultCloseButton(props, r
|
|
|
85
57
|
const {
|
|
86
58
|
formatMessage
|
|
87
59
|
} = useIntl();
|
|
88
|
-
return /* @__PURE__ */ jsx(IconButton, { ref, size: "small", variant: "ghost",
|
|
60
|
+
return /* @__PURE__ */ jsx(IconButton, { ref, size: "small", variant: "ghost", dataset: {
|
|
61
|
+
testid: "dialog-close"
|
|
62
|
+
}, assistiveText: formatMessage(genericAriaLabels.close), svg: ForwardRef, ...props });
|
|
89
63
|
});
|
|
90
64
|
export {
|
|
91
65
|
DialogCloseButton,
|
|
@@ -5,7 +5,7 @@ import { forwardRef } from "react";
|
|
|
5
5
|
import { getDatasetProps } from "@preply/ds-web-core";
|
|
6
6
|
import { s as styles } from "../../../Dialog.module-Ba1X7b3N.js";
|
|
7
7
|
import { u as useDialogRootContext } from "../../../DialogRootContext-BCXmmJAw.js";
|
|
8
|
-
import { u as useRenderElement } from "../../../useRenderElement-
|
|
8
|
+
import { u as useRenderElement } from "../../../useRenderElement-DtYPTE_y.js";
|
|
9
9
|
import { u as useBaseUiId } from "../../../useBaseUiId-DavsGYu9.js";
|
|
10
10
|
const DialogDescription$1 = /* @__PURE__ */ React.forwardRef(function DialogDescription(componentProps, forwardedRef) {
|
|
11
11
|
const {
|