@preply/ds-web-lib 11.0.0 → 11.1.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/Accordion-B0hR-tcI.js +96 -0
- package/dist/AlertBannerProvider-Cf7w9AOq.js +76 -0
- package/dist/AlertDialog-BG-diKBi.js +475 -0
- package/dist/Avatar-B-JdqVyg.js +66 -0
- package/dist/AvatarWithStatus-CD9jEqEB.js +36 -0
- package/dist/Badge-Dd-CLBoW.js +50 -0
- package/dist/Box-BJBE9KNm.js +91 -0
- package/dist/BubbleCounter.module-BU2S0euA.js +16 -0
- package/dist/Button-C35BZJZT.js +91 -0
- package/dist/ButtonBase-8eUyTWxX.js +215 -0
- package/dist/Checkbox-CtolNbxI.js +108 -0
- package/dist/Chips-BRGw7Uup.js +99 -0
- package/dist/ChipsPrimitive-Bezq7ptE.js +1179 -0
- package/dist/CountryFlag-DVDKHmQH.js +43 -0
- package/dist/Dialog.module-Db2BJAn4.js +21 -0
- package/dist/DialogCloseButton-DjDd9Mid.js +98 -0
- package/dist/DialogDescription-8zw9t6pm.js +44 -0
- package/dist/DialogRoot-B67oJduC.js +335 -0
- package/dist/DialogRootContext-Bz8RW-Mq.js +12 -0
- package/dist/DialogTitle-C2Nn2ys-.js +43 -0
- package/dist/Divider-DvwDWB9_.js +17 -0
- package/dist/DropdownMenu.primitives-BrsTBvMk.js +4007 -0
- package/dist/FieldButton-B2slox8P.js +32 -0
- package/dist/FormControl-qnbQL1iF.js +128 -0
- package/dist/Heading-DA9gHfsx.js +71 -0
- package/dist/Icon-CixAeOSd.js +48 -0
- package/dist/IconButton-BPKpgfep.js +31 -0
- package/dist/InputContainer-CzzuOe_p.js +38 -0
- package/dist/LayoutFlex-e9auDvWD.js +86 -0
- package/dist/LayoutFlexItem-D9ziMmHe.js +48 -0
- package/dist/LayoutGridItem-Q8Lnvrri.js +34 -0
- package/dist/Link-CdoJVeER.js +66 -0
- package/dist/Loader-BMOxdJce.js +26 -0
- package/dist/OnboardingTooltip-B47_Yrsj.js +165 -0
- package/dist/OnboardingTour-DUUoI5WE.js +131 -0
- package/dist/PasswordField-Bx5YG62t.js +93 -0
- package/dist/PreplyLogo-abgOre30.js +112 -0
- package/dist/ProgressBar-CEU4GyHn.js +31 -0
- package/dist/ProgressSteps-BSqopxqv.js +45 -0
- package/dist/Select-Bo7PX_8V.js +124 -0
- package/dist/Slider-Crg4DEn_.js +64 -0
- package/dist/Spinner-Ck8KQA22.js +86 -0
- package/dist/Stars-D5QspUBE.js +72 -0
- package/dist/Steps-DbN5vFrP.js +173 -0
- package/dist/Switch-Ck_xB0ID.js +49 -0
- package/dist/Text-CaOF75Z-.js +121 -0
- package/dist/TextHighlighted-Dwq9Clgn.js +34 -0
- package/dist/TextInline-BcA4H2Tk.js +34 -0
- package/dist/Toast-wJAjSLfo.js +1019 -0
- package/dist/TokyoUIChevronDown-DGcVqR1z.js +14 -0
- package/dist/Tooltip-grvKQxTN.js +84 -0
- package/dist/VisuallyHidden-CtcHcZCK.js +29 -0
- package/dist/align-self-VrZUceie.js +42 -0
- 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 +40 -46
- 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 +13 -4
- 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/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 +1 -1
- package/dist/assets/OnboardingTour.css +1 -1
- 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/{IconTile.css → components.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/chunk-BVTlhY3a.js +24 -0
- package/dist/components/Accordion/Accordion.js +4 -60
- package/dist/components/Accordion/hooks/useOnOpenChange.js +19 -28
- package/dist/components/AlertBanner/AlertBanner.js +11 -26
- package/dist/components/AlertBanner/AlertBannerProvider.js +3 -8
- package/dist/components/AlertBanner/primitives/AlertBannerAction.js +11 -69
- package/dist/components/AlertBanner/primitives/AlertBannerIcon.js +77 -39
- package/dist/components/AlertBanner/primitives/AlertBannerRoot.js +26 -22
- package/dist/components/AlertBanner/primitives/AlertBannerText.js +11 -70
- package/dist/components/AlertDialog/AlertDialog.js +5 -430
- package/dist/components/Avatar/Avatar.js +3 -71
- package/dist/components/AvatarWithStatus/AvatarWithStatus.js +3 -43
- package/dist/components/Badge/Badge.js +4 -62
- package/dist/components/Box/Box.js +3 -95
- package/dist/components/BubbleCounter/BubbleCounter.js +23 -28
- package/dist/components/Button/Button.js +4 -80
- package/dist/components/CalloutBanner/CalloutBanner.js +61 -12
- package/dist/components/CalloutBanner/primitives/CalloutBannerDismissButton.js +50 -22
- package/dist/components/CalloutBanner/primitives/CalloutBannerIcon.js +86 -45
- package/dist/components/CalloutBanner/primitives/CalloutBannerRoot.js +50 -24
- package/dist/components/CalloutBanner/primitives/CalloutBannerText.js +41 -11
- package/dist/components/Checkbox/Checkbox.js +4 -78
- package/dist/components/Checkbox/hooks/useIndeterminate.js +24 -30
- package/dist/components/Chips/Chips.types.js +0 -1
- package/dist/components/Chips/DismissibleChips.js +117 -86
- package/dist/components/Chips/MultiSelectChips.js +98 -64
- package/dist/components/Chips/SingleSelectChips.js +94 -57
- package/dist/components/Chips/private/ChipsPrimitive.js +4 -17
- package/dist/components/CountryFlag/CountryFlag.js +3 -44
- package/dist/components/Dialog/Dialog.js +56 -31
- package/dist/components/Dialog/DialogSteps.js +40 -29
- package/dist/components/Dialog/primitives/DialogActions.js +26 -19
- package/dist/components/Dialog/primitives/DialogButtonStack.d.ts.map +1 -1
- package/dist/components/Dialog/primitives/DialogButtonStack.js +22 -15
- package/dist/components/Dialog/primitives/DialogCloseButton.d.ts +1 -1
- package/dist/components/Dialog/primitives/DialogCloseButton.d.ts.map +1 -1
- package/dist/components/Dialog/primitives/DialogCloseButton.js +4 -67
- package/dist/components/Dialog/primitives/DialogDescription.js +3 -43
- package/dist/components/Dialog/primitives/DialogFooter.js +37 -34
- package/dist/components/Dialog/primitives/DialogRoot.js +4 -315
- package/dist/components/Dialog/primitives/DialogTitle.js +3 -42
- package/dist/components/Divider/Divider.js +3 -14
- package/dist/components/DropdownMenu/DropdownMenu.js +253 -188
- package/dist/components/DropdownMenu/primitives/DropdownMenu.primitives.js +5 -34
- package/dist/components/DropdownMenu/primitives/DropdownMenuSelectItem.primitives.js +121 -71
- package/dist/components/FieldButton/FieldButton.js +3 -37
- package/dist/components/FormControl/FormControl.js +3 -105
- package/dist/components/Heading/Heading.js +3 -78
- package/dist/components/Icon/Icon.js +4 -49
- package/dist/components/IconButton/IconButton.d.ts +5 -1
- package/dist/components/IconButton/IconButton.d.ts.map +1 -1
- package/dist/components/IconButton/IconButton.js +4 -28
- package/dist/components/IconTile/IconTile.js +11 -69
- package/dist/components/IntlFormatted/IntlFormattedAggregatedDateTime.js +16 -32
- package/dist/components/IntlFormatted/IntlFormattedCurrency.js +20 -42
- package/dist/components/IntlFormatted/IntlFormattedDate.js +73 -195
- package/dist/components/IntlFormatted/IntlFormattedTime.js +14 -24
- package/dist/components/IntlFormatted/Wrapper.js +14 -8
- package/dist/components/LayoutFlex/LayoutFlex.js +3 -100
- package/dist/components/LayoutFlex/style/getStyleAttrs.js +71 -143
- package/dist/components/LayoutFlex/tests/AlignItems.js +67 -97
- package/dist/components/LayoutFlex/tests/ColumnReverse.js +63 -100
- package/dist/components/LayoutFlex/tests/DataOverride.js +1498 -1093
- package/dist/components/LayoutFlex/tests/Default.js +19 -20
- package/dist/components/LayoutFlex/tests/Direction.js +65 -88
- package/dist/components/LayoutFlex/tests/Gap.js +115 -197
- package/dist/components/LayoutFlex/tests/HideInline.js +95 -136
- package/dist/components/LayoutFlex/tests/JustifyContent.js +75 -108
- package/dist/components/LayoutFlex/tests/Nowrap.js +35 -42
- package/dist/components/LayoutFlex/tests/Padding.js +207 -263
- package/dist/components/LayoutFlex/tests/Relative.js +49 -64
- package/dist/components/LayoutFlexItem/LayoutFlexItem.js +3 -54
- package/dist/components/LayoutGrid/LayoutGrid.js +26 -34
- package/dist/components/LayoutGridItem/LayoutGridItem.js +3 -41
- package/dist/components/Link/Link.js +3 -72
- package/dist/components/Loader/Loader.js +3 -32
- package/dist/components/NumberField/NumberField.js +33 -35
- package/dist/components/ObserveIntersection/ObserveIntersection.js +41 -42
- package/dist/components/OnboardingTooltip/OnboardingTooltip.js +4 -115
- package/dist/components/OnboardingTour/OnboardingTour.js +4 -114
- package/dist/components/PasswordField/PasswordField.js +3 -78
- package/dist/components/PreplyLogo/PreplyLogo.js +3 -81
- package/dist/components/ProgressBar/ProgressBar.js +3 -27
- package/dist/components/ProgressSteps/ProgressSteps.js +3 -48
- package/dist/components/Rating/Rating.js +29 -20
- package/dist/components/Rating/RatingInput.js +57 -59
- package/dist/components/Rating/Stars.js +4 -8
- package/dist/components/Rating/hooks/useHasError.js +11 -15
- package/dist/components/Rating/hooks/useHoverPercentage.js +37 -45
- package/dist/components/Rating/hooks/useInputState.js +18 -24
- package/dist/components/Rating/hooks/useLocalizations.js +12 -24
- package/dist/components/Rating/utils/roundToHalfDecimal.js +4 -4
- package/dist/components/SelectField/Select.js +5 -112
- package/dist/components/SelectField/SelectField.js +29 -24
- package/dist/components/SelectField/hooks/useBreakpointMatch.js +18 -19
- package/dist/components/ShowOnIntersection/ShowOnIntersection.js +32 -21
- package/dist/components/Slider/RangeSlider.js +62 -52
- package/dist/components/Slider/Slider.js +3 -10
- package/dist/components/Steps/Steps.js +4 -210
- package/dist/components/Switch/Switch.js +3 -51
- package/dist/components/Text/Text.js +3 -128
- package/dist/components/TextField/TextField.js +27 -29
- package/dist/components/TextHighlighted/TextHighlighted.js +3 -41
- package/dist/components/TextInline/TextInline.js +3 -40
- package/dist/components/TextareaField/TextareaField.js +26 -28
- package/dist/components/Toast/Toast.js +4 -1168
- package/dist/components/Tooltip/Tooltip.js +3 -66
- package/dist/components/deprecated/Chips/Chips.js +4 -76
- package/dist/components/deprecated/NativeSelectField/NativeSelect.js +40 -32
- package/dist/components/deprecated/NativeSelectField/NativeSelectField.js +34 -33
- package/dist/components/deprecated/index.js +5 -6
- package/dist/components/index.js +50 -150
- package/dist/components/private/ButtonBase/ButtonBase.d.ts +7 -11
- package/dist/components/private/ButtonBase/ButtonBase.d.ts.map +1 -1
- package/dist/components/private/ButtonBase/ButtonBase.js +3 -247
- package/dist/components/private/Input/Input.js +27 -19
- package/dist/components/private/Input/InputContainer.js +3 -5
- package/dist/components/private/Input/Textarea.js +24 -20
- package/dist/components/private/Input/index.js +2 -4
- package/dist/components/private/Spinner/Spinner.js +3 -52
- package/dist/components/private/VisuallyHidden/VisuallyHidden.js +3 -15
- package/dist/components-BIYP8wHJ.js +200 -0
- package/dist/exp-color-C5mKAN91.js +74 -0
- package/dist/floating-ui.utils.dom-CoeTbDZx.js +215 -0
- package/dist/index.js +50 -150
- package/dist/index.module-1c7ENvxc.js +7 -0
- package/dist/jsx-runtime-i4KUlhDu.js +743 -0
- package/dist/layout-gap.module-DLD8bcR4.js +95 -0
- package/dist/layout-grid.module-CZfhrKrB.js +101 -0
- package/dist/layout-hide.module-B1P0N4i3.js +53 -0
- package/dist/layout-padding-ugY-yd2q.js +389 -0
- package/dist/layout-relative.module-B5xrFD9j.js +6 -0
- package/dist/render-icon-Ch3b2dE0.js +290 -0
- package/dist/shared-styles/align-self/align-self.js +2 -36
- package/dist/shared-styles/exp-color/exp-color.js +2 -68
- package/dist/shared-styles/layout-gap/layout-gap.js +13 -7
- package/dist/shared-styles/layout-grid/layout-grid.js +28 -28
- package/dist/shared-styles/layout-grid-responsive-columns/layout-grid-responsive-columns.js +29 -43
- package/dist/shared-styles/layout-hide/layout-hide.js +8 -8
- package/dist/shared-styles/layout-padding/layout-padding.js +2 -5
- package/dist/shared-styles/layout-relative/layout-relative.js +14 -8
- package/dist/shared-styles/text-accent/text-accent.js +2 -25
- package/dist/shared-styles/text-centered/text-centered.js +2 -24
- package/dist/shared-styles/text-weight/text-weight.js +2 -15
- package/dist/store-sN_eYeZT.js +1064 -0
- package/dist/storybook-utils/consts.js +6 -8
- package/dist/storybook-utils/index.js +1 -5
- package/dist/text-accent-CfUFx-1K.js +30 -0
- package/dist/text-centered-Dwp2_-Yp.js +30 -0
- package/dist/text-weight-CwoqmM4o.js +21 -0
- package/dist/useBaseUiId-CWAD_PSs.js +13 -0
- package/dist/useBreakpointMatch-D9a3CTNK.js +338 -0
- package/dist/useButton-DHTh3Hm7.js +148 -0
- package/dist/useDialogClose-BzFIyWco.js +22 -0
- package/dist/useId-CJsH-2wV.js +34 -0
- package/dist/useOpenInteractionType-D8vA_ZKI.js +4104 -0
- package/dist/useRenderElement-ZBds6eRN.js +341 -0
- package/dist/utils/Orientation/OrientationProvider.js +54 -23
- package/dist/utils/Orientation/index.js +2 -4
- package/dist/utils/RovingTabIndex/RovingTabIndexProvider.js +70 -44
- package/dist/utils/RovingTabIndex/index.js +2 -4
- package/dist/utils/createRequiredContext.js +23 -13
- package/dist/utils/filterAttributesPassedByRadixUIAtRuntime.js +28 -25
- package/dist/utils/render-icon.js +3 -320
- package/dist/utils/shared-strings.js +24 -32
- package/dist/utils/useBreakpointMatch.d.ts.map +1 -1
- package/dist/utils/useBreakpointMatch.js +2 -183
- package/dist/utils/useControllableState/useControllableState.js +31 -25
- package/dist/utils/useMergeRefs.js +29 -14
- package/dist/utils/useStableCallback/useStableCallback.js +28 -13
- package/package.json +17 -22
- package/dist/AlertBannerProvider-DTx2Xp3V.js +0 -50
- package/dist/BubbleCounter.module-QMwXWFIS.js +0 -16
- package/dist/ChipsPrimitive-DzsaOWgY.js +0 -1244
- package/dist/Dialog.module-Ba1X7b3N.js +0 -29
- package/dist/DialogRootContext-BCXmmJAw.js +0 -15
- package/dist/DropdownMenu.primitives-B3WK71bR.js +0 -5871
- package/dist/IconTile-D1G7MljH.js +0 -172
- package/dist/InputContainer-oHJlLWIi.js +0 -30
- package/dist/Slider-DB4Maswa.js +0 -55
- package/dist/Stars-C_mHop2H.js +0 -67
- package/dist/TokyoUIChevronDown-D_tD1yU8.js +0 -11
- package/dist/floating-ui.utils.dom-3OgjGonN.js +0 -234
- package/dist/index.module-Q9TzIR6B.js +0 -11
- package/dist/layout-gap.module-MKn_un_k.js +0 -97
- package/dist/layout-grid.module-P4B4WVUy.js +0 -103
- package/dist/layout-hide.module-Bpl3Pl-a.js +0 -55
- package/dist/layout-padding-D5I6rRlL.js +0 -373
- package/dist/layout-relative.module-1z75aSwo.js +0 -8
- package/dist/store-BUKWfVf3.js +0 -1155
- package/dist/useBaseUiId-DavsGYu9.js +0 -8
- package/dist/useButton-CFPpP0o5.js +0 -193
- package/dist/useDialogClose-C9x1leGd.js +0 -34
- package/dist/useId-BhIOp2JG.js +0 -28
- package/dist/useOpenInteractionType-Cj41-8Yk.js +0 -2880
- package/dist/useRenderElement-DtYPTE_y.js +0 -350
|
@@ -1,38 +1,41 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { t as require_jsx_runtime } from "../../../jsx-runtime-i4KUlhDu.js";
|
|
3
|
+
import { t as Dialog_module_default } from "../../../Dialog.module-Db2BJAn4.js";
|
|
4
|
+
import { useLayoutEffect, useRef } from "react";
|
|
4
5
|
import { getDatasetProps } from "@preply/ds-web-core";
|
|
5
|
-
import { s as styles } from "../../../Dialog.module-Ba1X7b3N.js";
|
|
6
6
|
import { webComponentNames } from "@preply/ds-visual-coverage-preply-component-names";
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
7
|
+
//#region src/components/Dialog/primitives/DialogFooter.tsx
|
|
8
|
+
var import_jsx_runtime = require_jsx_runtime();
|
|
9
|
+
var DialogFooter = ({ children, className, dataset, ...props }) => {
|
|
10
|
+
const scrollDetectorRef = useRef(null);
|
|
11
|
+
const footerRef = useRef(null);
|
|
12
|
+
const classNames = [Dialog_module_default.footer, className].filter(Boolean).join(" ");
|
|
13
|
+
const datasetProps = getDatasetProps(dataset, { preplyDsComponent: webComponentNames.DialogFooter });
|
|
14
|
+
/**
|
|
15
|
+
* Detects if dialog is fully scrolled to the bottom and adds border to the footer
|
|
16
|
+
*/
|
|
17
|
+
useLayoutEffect(() => {
|
|
18
|
+
if (!footerRef.current || !scrollDetectorRef.current) return;
|
|
19
|
+
const observer = new IntersectionObserver(([entry]) => {
|
|
20
|
+
var _footerRef$current;
|
|
21
|
+
(_footerRef$current = footerRef.current) === null || _footerRef$current === void 0 || _footerRef$current.toggleAttribute("data-sticky", !entry.isIntersecting);
|
|
22
|
+
}, {
|
|
23
|
+
root: footerRef.current.closest("[role=dialog]"),
|
|
24
|
+
rootMargin: `0px 0px -${footerRef.current.offsetHeight}px 0px`
|
|
25
|
+
});
|
|
26
|
+
observer.observe(scrollDetectorRef.current);
|
|
27
|
+
return () => observer.disconnect();
|
|
28
|
+
}, []);
|
|
29
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
30
|
+
className: Dialog_module_default.scrollEndDetector,
|
|
31
|
+
ref: scrollDetectorRef
|
|
32
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("footer", {
|
|
33
|
+
className: classNames,
|
|
34
|
+
ref: footerRef,
|
|
35
|
+
...datasetProps,
|
|
36
|
+
...props,
|
|
37
|
+
children
|
|
38
|
+
})] });
|
|
38
39
|
};
|
|
40
|
+
//#endregion
|
|
41
|
+
export { DialogFooter };
|
|
@@ -1,315 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
import { getDatasetProps } from "@preply/ds-web-core";
|
|
6
|
-
import { usePortalElement } from "@preply/ds-web-root";
|
|
7
|
-
import { webComponentNames } from "@preply/ds-visual-coverage-preply-component-names";
|
|
8
|
-
import { s as styles } from "../../../Dialog.module-Ba1X7b3N.js";
|
|
9
|
-
import { u as useRenderElement, b as useRefWithInit, E as EMPTY_OBJECT } from "../../../useRenderElement-DtYPTE_y.js";
|
|
10
|
-
import { D as DialogStore, u as useDialogRoot } from "../../../store-BUKWfVf3.js";
|
|
11
|
-
import { u as useDialogRootContext, D as DialogRootContext } from "../../../DialogRootContext-BCXmmJAw.js";
|
|
12
|
-
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 } from "../../../useOpenInteractionType-Cj41-8Yk.js";
|
|
13
|
-
import { u as useEventCallback } from "../../../floating-ui.utils.dom-3OgjGonN.js";
|
|
14
|
-
const stateAttributesMapping$1 = {
|
|
15
|
-
...popupStateMapping,
|
|
16
|
-
...transitionStatusMapping
|
|
17
|
-
};
|
|
18
|
-
const DialogBackdrop = /* @__PURE__ */ React.forwardRef(function DialogBackdrop2(componentProps, forwardedRef) {
|
|
19
|
-
const {
|
|
20
|
-
render,
|
|
21
|
-
className,
|
|
22
|
-
forceRender = false,
|
|
23
|
-
...elementProps
|
|
24
|
-
} = componentProps;
|
|
25
|
-
const {
|
|
26
|
-
store
|
|
27
|
-
} = useDialogRootContext();
|
|
28
|
-
const open = store.useState("open");
|
|
29
|
-
const nested = store.useState("nested");
|
|
30
|
-
const mounted = store.useState("mounted");
|
|
31
|
-
const transitionStatus = store.useState("transitionStatus");
|
|
32
|
-
const state = React.useMemo(() => ({
|
|
33
|
-
open,
|
|
34
|
-
transitionStatus
|
|
35
|
-
}), [open, transitionStatus]);
|
|
36
|
-
return useRenderElement("div", componentProps, {
|
|
37
|
-
state,
|
|
38
|
-
ref: [store.context.backdropRef, forwardedRef],
|
|
39
|
-
stateAttributesMapping: stateAttributesMapping$1,
|
|
40
|
-
props: [{
|
|
41
|
-
role: "presentation",
|
|
42
|
-
hidden: !mounted,
|
|
43
|
-
style: {
|
|
44
|
-
userSelect: "none",
|
|
45
|
-
WebkitUserSelect: "none"
|
|
46
|
-
}
|
|
47
|
-
}, elementProps],
|
|
48
|
-
enabled: forceRender || !nested
|
|
49
|
-
});
|
|
50
|
-
});
|
|
51
|
-
if (process.env.NODE_ENV !== "production") DialogBackdrop.displayName = "DialogBackdrop";
|
|
52
|
-
let DialogPopupCssVars = /* @__PURE__ */ (function(DialogPopupCssVars2) {
|
|
53
|
-
DialogPopupCssVars2["nestedDialogs"] = "--nested-dialogs";
|
|
54
|
-
return DialogPopupCssVars2;
|
|
55
|
-
})({});
|
|
56
|
-
let DialogPopupDataAttributes = (function(DialogPopupDataAttributes2) {
|
|
57
|
-
DialogPopupDataAttributes2[DialogPopupDataAttributes2["open"] = CommonPopupDataAttributes.open] = "open";
|
|
58
|
-
DialogPopupDataAttributes2[DialogPopupDataAttributes2["closed"] = CommonPopupDataAttributes.closed] = "closed";
|
|
59
|
-
DialogPopupDataAttributes2[DialogPopupDataAttributes2["startingStyle"] = CommonPopupDataAttributes.startingStyle] = "startingStyle";
|
|
60
|
-
DialogPopupDataAttributes2[DialogPopupDataAttributes2["endingStyle"] = CommonPopupDataAttributes.endingStyle] = "endingStyle";
|
|
61
|
-
DialogPopupDataAttributes2["nested"] = "data-nested";
|
|
62
|
-
DialogPopupDataAttributes2["nestedDialogOpen"] = "data-nested-dialog-open";
|
|
63
|
-
return DialogPopupDataAttributes2;
|
|
64
|
-
})({});
|
|
65
|
-
const DialogPortalContext = /* @__PURE__ */ React.createContext(void 0);
|
|
66
|
-
if (process.env.NODE_ENV !== "production") DialogPortalContext.displayName = "DialogPortalContext";
|
|
67
|
-
function useDialogPortalContext() {
|
|
68
|
-
const value = React.useContext(DialogPortalContext);
|
|
69
|
-
if (value === void 0) {
|
|
70
|
-
throw new Error("Base UI: <Dialog.Portal> is missing.");
|
|
71
|
-
}
|
|
72
|
-
return value;
|
|
73
|
-
}
|
|
74
|
-
const stateAttributesMapping = {
|
|
75
|
-
...popupStateMapping,
|
|
76
|
-
...transitionStatusMapping,
|
|
77
|
-
nestedDialogOpen(value) {
|
|
78
|
-
return value ? {
|
|
79
|
-
[DialogPopupDataAttributes.nestedDialogOpen]: ""
|
|
80
|
-
} : null;
|
|
81
|
-
}
|
|
82
|
-
};
|
|
83
|
-
const DialogPopup = /* @__PURE__ */ React.forwardRef(function DialogPopup2(componentProps, forwardedRef) {
|
|
84
|
-
const {
|
|
85
|
-
className,
|
|
86
|
-
finalFocus,
|
|
87
|
-
initialFocus,
|
|
88
|
-
render,
|
|
89
|
-
...elementProps
|
|
90
|
-
} = componentProps;
|
|
91
|
-
const {
|
|
92
|
-
store
|
|
93
|
-
} = useDialogRootContext();
|
|
94
|
-
const descriptionElementId = store.useState("descriptionElementId");
|
|
95
|
-
const dismissible = store.useState("dismissible");
|
|
96
|
-
const floatingRootContext = store.useState("floatingRootContext");
|
|
97
|
-
const rootPopupProps = store.useState("popupProps");
|
|
98
|
-
const modal = store.useState("modal");
|
|
99
|
-
const mounted = store.useState("mounted");
|
|
100
|
-
const nested = store.useState("nested");
|
|
101
|
-
const nestedOpenDialogCount = store.useState("nestedOpenDialogCount");
|
|
102
|
-
const open = store.useState("open");
|
|
103
|
-
const openMethod = store.useState("openMethod");
|
|
104
|
-
const titleElementId = store.useState("titleElementId");
|
|
105
|
-
const transitionStatus = store.useState("transitionStatus");
|
|
106
|
-
useDialogPortalContext();
|
|
107
|
-
useOpenChangeComplete({
|
|
108
|
-
open,
|
|
109
|
-
ref: store.context.popupRef,
|
|
110
|
-
onComplete() {
|
|
111
|
-
var _a, _b;
|
|
112
|
-
if (open) {
|
|
113
|
-
(_b = (_a = store.context).openChangeComplete) == null ? void 0 : _b.call(_a, true);
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
});
|
|
117
|
-
const defaultInitialFocus = useEventCallback((interactionType) => {
|
|
118
|
-
if (interactionType === "touch") {
|
|
119
|
-
return store.context.popupRef.current;
|
|
120
|
-
}
|
|
121
|
-
return true;
|
|
122
|
-
});
|
|
123
|
-
const resolvedInitialFocus = initialFocus === void 0 ? defaultInitialFocus : initialFocus;
|
|
124
|
-
const nestedDialogOpen = nestedOpenDialogCount > 0;
|
|
125
|
-
const state = React.useMemo(() => ({
|
|
126
|
-
open,
|
|
127
|
-
nested,
|
|
128
|
-
transitionStatus,
|
|
129
|
-
nestedDialogOpen
|
|
130
|
-
}), [open, nested, transitionStatus, nestedDialogOpen]);
|
|
131
|
-
const element = useRenderElement("div", componentProps, {
|
|
132
|
-
state,
|
|
133
|
-
props: [rootPopupProps, {
|
|
134
|
-
"aria-labelledby": titleElementId != null ? titleElementId : void 0,
|
|
135
|
-
"aria-describedby": descriptionElementId != null ? descriptionElementId : void 0,
|
|
136
|
-
role: "dialog",
|
|
137
|
-
tabIndex: -1,
|
|
138
|
-
hidden: !mounted,
|
|
139
|
-
onKeyDown(event) {
|
|
140
|
-
if (COMPOSITE_KEYS.has(event.key)) {
|
|
141
|
-
event.stopPropagation();
|
|
142
|
-
}
|
|
143
|
-
},
|
|
144
|
-
style: {
|
|
145
|
-
[DialogPopupCssVars.nestedDialogs]: nestedOpenDialogCount
|
|
146
|
-
}
|
|
147
|
-
}, elementProps],
|
|
148
|
-
ref: [forwardedRef, store.context.popupRef, store.getElementSetter("popupElement")],
|
|
149
|
-
stateAttributesMapping
|
|
150
|
-
});
|
|
151
|
-
return /* @__PURE__ */ jsxs(React.Fragment, {
|
|
152
|
-
children: [mounted && modal === true && /* @__PURE__ */ jsx(InternalBackdrop, {
|
|
153
|
-
ref: store.context.internalBackdropRef,
|
|
154
|
-
inert: inertValue(!open)
|
|
155
|
-
}), /* @__PURE__ */ jsx(FloatingFocusManager, {
|
|
156
|
-
context: floatingRootContext,
|
|
157
|
-
openInteractionType: openMethod,
|
|
158
|
-
disabled: !mounted,
|
|
159
|
-
closeOnFocusOut: dismissible,
|
|
160
|
-
initialFocus: resolvedInitialFocus,
|
|
161
|
-
returnFocus: finalFocus,
|
|
162
|
-
modal: modal !== false,
|
|
163
|
-
restoreFocus: "popup",
|
|
164
|
-
children: element
|
|
165
|
-
})]
|
|
166
|
-
});
|
|
167
|
-
});
|
|
168
|
-
if (process.env.NODE_ENV !== "production") DialogPopup.displayName = "DialogPopup";
|
|
169
|
-
function DialogPortal(props) {
|
|
170
|
-
const {
|
|
171
|
-
children,
|
|
172
|
-
keepMounted = false,
|
|
173
|
-
container
|
|
174
|
-
} = props;
|
|
175
|
-
const {
|
|
176
|
-
store
|
|
177
|
-
} = useDialogRootContext();
|
|
178
|
-
const mounted = store.useState("mounted");
|
|
179
|
-
const shouldRender = mounted || keepMounted;
|
|
180
|
-
if (!shouldRender) {
|
|
181
|
-
return null;
|
|
182
|
-
}
|
|
183
|
-
return /* @__PURE__ */ jsx(DialogPortalContext.Provider, {
|
|
184
|
-
value: keepMounted,
|
|
185
|
-
children: /* @__PURE__ */ jsx(FloatingPortal, {
|
|
186
|
-
root: container,
|
|
187
|
-
children
|
|
188
|
-
})
|
|
189
|
-
});
|
|
190
|
-
}
|
|
191
|
-
const INITIAL_STATE = {
|
|
192
|
-
open: false,
|
|
193
|
-
dismissible: true,
|
|
194
|
-
nested: false,
|
|
195
|
-
popupElement: null,
|
|
196
|
-
triggerElement: null,
|
|
197
|
-
modal: true,
|
|
198
|
-
descriptionElementId: void 0,
|
|
199
|
-
titleElementId: void 0,
|
|
200
|
-
openMethod: null,
|
|
201
|
-
mounted: false,
|
|
202
|
-
transitionStatus: "idle",
|
|
203
|
-
nestedOpenDialogCount: 0,
|
|
204
|
-
triggerProps: EMPTY_OBJECT,
|
|
205
|
-
popupProps: EMPTY_OBJECT,
|
|
206
|
-
floatingRootContext: getEmptyContext()
|
|
207
|
-
};
|
|
208
|
-
const DialogRoot$1 = function DialogRoot(props) {
|
|
209
|
-
const {
|
|
210
|
-
children,
|
|
211
|
-
open: openProp,
|
|
212
|
-
defaultOpen: defaultOpenProp = false,
|
|
213
|
-
onOpenChange,
|
|
214
|
-
onOpenChangeComplete,
|
|
215
|
-
dismissible = true,
|
|
216
|
-
modal = true,
|
|
217
|
-
actionsRef
|
|
218
|
-
} = props;
|
|
219
|
-
const parentDialogRootContext = useDialogRootContext(true);
|
|
220
|
-
const nested = Boolean(parentDialogRootContext);
|
|
221
|
-
const store = useRefWithInit(DialogStore.create, INITIAL_STATE).current;
|
|
222
|
-
store.useControlledProp("open", openProp, defaultOpenProp);
|
|
223
|
-
store.useSyncedValues({
|
|
224
|
-
dismissible,
|
|
225
|
-
nested,
|
|
226
|
-
modal
|
|
227
|
-
});
|
|
228
|
-
store.useContextCallback("openChange", onOpenChange);
|
|
229
|
-
store.useContextCallback("openChangeComplete", onOpenChangeComplete);
|
|
230
|
-
useDialogRoot({
|
|
231
|
-
store,
|
|
232
|
-
actionsRef,
|
|
233
|
-
parentContext: parentDialogRootContext == null ? void 0 : parentDialogRootContext.store.context
|
|
234
|
-
});
|
|
235
|
-
const contextValue = React.useMemo(() => ({
|
|
236
|
-
store
|
|
237
|
-
}), [store]);
|
|
238
|
-
return /* @__PURE__ */ jsx(DialogRootContext.Provider, {
|
|
239
|
-
value: contextValue,
|
|
240
|
-
children
|
|
241
|
-
});
|
|
242
|
-
};
|
|
243
|
-
if (process.env.NODE_ENV !== "production") DialogRoot$1.displayName = "DialogRoot";
|
|
244
|
-
const DialogRoot2 = ({
|
|
245
|
-
children,
|
|
246
|
-
open,
|
|
247
|
-
onOpen,
|
|
248
|
-
onClose,
|
|
249
|
-
overlay = true,
|
|
250
|
-
size = "md",
|
|
251
|
-
mobileFullHeight = false,
|
|
252
|
-
className,
|
|
253
|
-
dataset,
|
|
254
|
-
...props
|
|
255
|
-
}) => {
|
|
256
|
-
const container = usePortalElement();
|
|
257
|
-
const respondToHeightChange = useResponsiveFullHeightStyle(open);
|
|
258
|
-
const onOpenChange = useCallback((open2) => {
|
|
259
|
-
if (!open2) {
|
|
260
|
-
onClose == null ? void 0 : onClose();
|
|
261
|
-
} else {
|
|
262
|
-
onOpen == null ? void 0 : onOpen();
|
|
263
|
-
}
|
|
264
|
-
}, [onClose, onOpen]);
|
|
265
|
-
const classNames = [styles.dialog, className].filter(Boolean).join(" ");
|
|
266
|
-
const datasetProps = getDatasetProps(dataset, {
|
|
267
|
-
preplyDsComponent: webComponentNames.DialogRoot
|
|
268
|
-
});
|
|
269
|
-
return /* @__PURE__ */ jsx(DialogRoot$1, { open, onOpenChange, children: /* @__PURE__ */ jsxs(DialogPortal, { container, children: [
|
|
270
|
-
overlay && /* @__PURE__ */ jsx(DialogBackdrop, { className: styles.overlay, forceRender: true, "data-testid": "dialog-overlay", "data-preply-ds-component": webComponentNames.DialogOverlay }),
|
|
271
|
-
/* @__PURE__ */ jsx(DialogPopup, { ref: respondToHeightChange, className: classNames, ...getResponsiveSizeAttributes(size), "data-mobile-full-height": mobileFullHeight ? "" : void 0, ...datasetProps, ...props, children })
|
|
272
|
-
] }) });
|
|
273
|
-
};
|
|
274
|
-
function useResponsiveFullHeightStyle(isOpen) {
|
|
275
|
-
const [el, setEl] = useState(null);
|
|
276
|
-
const captureRef = useCallback((node) => setEl(node), []);
|
|
277
|
-
useEffect(() => {
|
|
278
|
-
if (!isOpen || !el) {
|
|
279
|
-
return;
|
|
280
|
-
}
|
|
281
|
-
const toggleFullHeight = async () => {
|
|
282
|
-
const animations = el.getAnimations().map((a) => a.finished);
|
|
283
|
-
await Promise.allSettled(animations);
|
|
284
|
-
const {
|
|
285
|
-
y
|
|
286
|
-
} = el.getBoundingClientRect();
|
|
287
|
-
el.toggleAttribute("data-no-border-radius", y === 0);
|
|
288
|
-
};
|
|
289
|
-
toggleFullHeight();
|
|
290
|
-
window.addEventListener("resize", toggleFullHeight);
|
|
291
|
-
const resizeObserver = new ResizeObserver(toggleFullHeight);
|
|
292
|
-
resizeObserver.observe(el);
|
|
293
|
-
return () => {
|
|
294
|
-
window.removeEventListener("resize", toggleFullHeight);
|
|
295
|
-
resizeObserver.disconnect();
|
|
296
|
-
};
|
|
297
|
-
}, [isOpen, el]);
|
|
298
|
-
return captureRef;
|
|
299
|
-
}
|
|
300
|
-
function getResponsiveSizeAttributes(size) {
|
|
301
|
-
if (typeof size === "string") return {
|
|
302
|
-
"data-size": size
|
|
303
|
-
};
|
|
304
|
-
const dataAttrs = {};
|
|
305
|
-
if (typeof size._ === "string") dataAttrs["data-size"] = size._;
|
|
306
|
-
if (typeof size["narrow-l"] === "string") dataAttrs["data-size-narrow-l"] = size["narrow-l"];
|
|
307
|
-
if (typeof size["medium-s"] === "string") dataAttrs["data-size-medium-s"] = size["medium-s"];
|
|
308
|
-
if (typeof size["medium-l"] === "string") dataAttrs["data-size-medium-l"] = size["medium-l"];
|
|
309
|
-
if (typeof size["wide-s"] === "string") dataAttrs["data-size-wide-s"] = size["wide-s"];
|
|
310
|
-
if (typeof size["wide-l"] === "string") dataAttrs["data-size-wide-l"] = size["wide-l"];
|
|
311
|
-
return dataAttrs;
|
|
312
|
-
}
|
|
313
|
-
export {
|
|
314
|
-
DialogRoot2 as DialogRoot
|
|
315
|
-
};
|
|
1
|
+
import "../../../jsx-runtime-i4KUlhDu.js";
|
|
2
|
+
import "../../../store-sN_eYeZT.js";
|
|
3
|
+
import { t as DialogRoot } from "../../../DialogRoot-B67oJduC.js";
|
|
4
|
+
export { DialogRoot };
|
|
@@ -1,42 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
import { forwardRef } from "react";
|
|
5
|
-
import { getDatasetProps } from "@preply/ds-web-core";
|
|
6
|
-
import { s as styles } from "../../../Dialog.module-Ba1X7b3N.js";
|
|
7
|
-
import { u as useDialogRootContext } from "../../../DialogRootContext-BCXmmJAw.js";
|
|
8
|
-
import { u as useRenderElement } from "../../../useRenderElement-DtYPTE_y.js";
|
|
9
|
-
import { u as useBaseUiId } from "../../../useBaseUiId-DavsGYu9.js";
|
|
10
|
-
const DialogTitle$1 = /* @__PURE__ */ React.forwardRef(function DialogTitle(componentProps, forwardedRef) {
|
|
11
|
-
const {
|
|
12
|
-
render,
|
|
13
|
-
className,
|
|
14
|
-
id: idProp,
|
|
15
|
-
...elementProps
|
|
16
|
-
} = componentProps;
|
|
17
|
-
const {
|
|
18
|
-
store
|
|
19
|
-
} = useDialogRootContext();
|
|
20
|
-
const id = useBaseUiId(idProp);
|
|
21
|
-
store.useSyncedValueWithCleanup("titleElementId", id);
|
|
22
|
-
return useRenderElement("h2", componentProps, {
|
|
23
|
-
ref: forwardedRef,
|
|
24
|
-
props: [{
|
|
25
|
-
id
|
|
26
|
-
}, elementProps]
|
|
27
|
-
});
|
|
28
|
-
});
|
|
29
|
-
if (process.env.NODE_ENV !== "production") DialogTitle$1.displayName = "DialogTitle";
|
|
30
|
-
const DialogTitle2 = forwardRef(function DialogTitle22({
|
|
31
|
-
children,
|
|
32
|
-
className,
|
|
33
|
-
dataset,
|
|
34
|
-
...props
|
|
35
|
-
}, ref) {
|
|
36
|
-
const classNames = [styles.title, className].filter(Boolean).join(" ");
|
|
37
|
-
const datasetProps = getDatasetProps(dataset);
|
|
38
|
-
return /* @__PURE__ */ jsx(DialogTitle$1, { ref, className: classNames, ...datasetProps, ...props, children });
|
|
39
|
-
});
|
|
40
|
-
export {
|
|
41
|
-
DialogTitle2 as DialogTitle
|
|
42
|
-
};
|
|
1
|
+
import "../../../jsx-runtime-i4KUlhDu.js";
|
|
2
|
+
import { t as DialogTitle } from "../../../DialogTitle-C2Nn2ys-.js";
|
|
3
|
+
export { DialogTitle };
|
|
@@ -1,14 +1,3 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
const styles = {
|
|
5
|
-
Divider: Divider$1,
|
|
6
|
-
"size-small": "size-small__OdB2p",
|
|
7
|
-
"size-large": "size-large__4iJ0a"
|
|
8
|
-
};
|
|
9
|
-
const Divider = ({
|
|
10
|
-
size = "small"
|
|
11
|
-
}) => /* @__PURE__ */ jsx("hr", { className: `${styles.Divider} ${styles[`size-${size}`]}`, "data-preply-ds-component": webComponentNames.Divider });
|
|
12
|
-
export {
|
|
13
|
-
Divider
|
|
14
|
-
};
|
|
1
|
+
import "../../jsx-runtime-i4KUlhDu.js";
|
|
2
|
+
import { t as Divider } from "../../Divider-DvwDWB9_.js";
|
|
3
|
+
export { Divider };
|