@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
|
@@ -0,0 +1,1064 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use strict";
|
|
3
|
+
import { t as __commonJSMin } from "./chunk-BVTlhY3a.js";
|
|
4
|
+
import { n as require_builtin_esm_external_require_react } from "./jsx-runtime-i4KUlhDu.js";
|
|
5
|
+
import { d as NOOP } from "./useRenderElement-ZBds6eRN.js";
|
|
6
|
+
import { S as useEventCallback, x as useIsoLayoutEffect } from "./floating-ui.utils.dom-CoeTbDZx.js";
|
|
7
|
+
import { F as useOpenChangeComplete, _ as useClick, a as useInteractions, c as useDismiss, i as useRole, mt as _defineProperty, n as useScrollLock, nt as getTarget, pt as useTransitionStatus, s as useFloatingRootContext, t as useOpenInteractionType } from "./useOpenInteractionType-D8vA_ZKI.js";
|
|
8
|
+
import * as React$1 from "react";
|
|
9
|
+
//#region ../../node_modules/@base-ui-components/react/esm/dialog/root/useDialogRoot.js
|
|
10
|
+
function useDialogRoot(params) {
|
|
11
|
+
const { store, parentContext } = params;
|
|
12
|
+
const open = store.useState("open");
|
|
13
|
+
const dismissible = store.useState("dismissible");
|
|
14
|
+
const modal = store.useState("modal");
|
|
15
|
+
const triggerElement = store.useState("triggerElement");
|
|
16
|
+
const popupElement = store.useState("popupElement");
|
|
17
|
+
const { mounted, setMounted, transitionStatus } = useTransitionStatus(open);
|
|
18
|
+
const { openMethod, triggerProps, reset: resetOpenInteractionType } = useOpenInteractionType(open);
|
|
19
|
+
const handleUnmount = useEventCallback(() => {
|
|
20
|
+
var _store$context$openCh, _store$context;
|
|
21
|
+
setMounted(false);
|
|
22
|
+
(_store$context$openCh = (_store$context = store.context).openChangeComplete) === null || _store$context$openCh === void 0 || _store$context$openCh.call(_store$context, false);
|
|
23
|
+
resetOpenInteractionType();
|
|
24
|
+
});
|
|
25
|
+
useOpenChangeComplete({
|
|
26
|
+
enabled: !params.actionsRef,
|
|
27
|
+
open,
|
|
28
|
+
ref: store.context.popupRef,
|
|
29
|
+
onComplete() {
|
|
30
|
+
if (!open) handleUnmount();
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
React$1.useImperativeHandle(params.actionsRef, () => ({ unmount: handleUnmount }), [handleUnmount]);
|
|
34
|
+
const context = useFloatingRootContext({
|
|
35
|
+
elements: {
|
|
36
|
+
reference: triggerElement,
|
|
37
|
+
floating: popupElement
|
|
38
|
+
},
|
|
39
|
+
open,
|
|
40
|
+
onOpenChange: store.setOpen,
|
|
41
|
+
noEmit: true
|
|
42
|
+
});
|
|
43
|
+
const [ownNestedOpenDialogs, setOwnNestedOpenDialogs] = React$1.useState(0);
|
|
44
|
+
const isTopmost = ownNestedOpenDialogs === 0;
|
|
45
|
+
const role = useRole(context);
|
|
46
|
+
const click = useClick(context);
|
|
47
|
+
const dismiss = useDismiss(context, {
|
|
48
|
+
outsidePressEvent() {
|
|
49
|
+
if (store.context.internalBackdropRef.current || store.context.backdropRef.current) return "intentional";
|
|
50
|
+
return {
|
|
51
|
+
mouse: modal === "trap-focus" ? "sloppy" : "intentional",
|
|
52
|
+
touch: "sloppy"
|
|
53
|
+
};
|
|
54
|
+
},
|
|
55
|
+
outsidePress(event) {
|
|
56
|
+
if (event.button !== 0) return false;
|
|
57
|
+
const target = getTarget(event);
|
|
58
|
+
if (isTopmost && dismissible) {
|
|
59
|
+
const eventTarget = target;
|
|
60
|
+
if (modal) return store.context.internalBackdropRef.current || store.context.backdropRef.current ? store.context.internalBackdropRef.current === eventTarget || store.context.backdropRef.current === eventTarget : true;
|
|
61
|
+
return true;
|
|
62
|
+
}
|
|
63
|
+
return false;
|
|
64
|
+
},
|
|
65
|
+
escapeKey: isTopmost
|
|
66
|
+
});
|
|
67
|
+
useScrollLock({
|
|
68
|
+
enabled: open && modal === true,
|
|
69
|
+
mounted,
|
|
70
|
+
open,
|
|
71
|
+
referenceElement: popupElement
|
|
72
|
+
});
|
|
73
|
+
const { getReferenceProps, getFloatingProps } = useInteractions([
|
|
74
|
+
role,
|
|
75
|
+
click,
|
|
76
|
+
dismiss
|
|
77
|
+
]);
|
|
78
|
+
store.useContextCallback("nestedDialogOpen", (ownChildrenCount) => {
|
|
79
|
+
setOwnNestedOpenDialogs(ownChildrenCount + 1);
|
|
80
|
+
});
|
|
81
|
+
store.useContextCallback("nestedDialogClose", () => {
|
|
82
|
+
setOwnNestedOpenDialogs(0);
|
|
83
|
+
});
|
|
84
|
+
React$1.useEffect(() => {
|
|
85
|
+
if ((parentContext === null || parentContext === void 0 ? void 0 : parentContext.nestedDialogOpen) && open) parentContext.nestedDialogOpen(ownNestedOpenDialogs);
|
|
86
|
+
if ((parentContext === null || parentContext === void 0 ? void 0 : parentContext.nestedDialogClose) && !open) parentContext.nestedDialogClose();
|
|
87
|
+
return () => {
|
|
88
|
+
if ((parentContext === null || parentContext === void 0 ? void 0 : parentContext.nestedDialogClose) && open) parentContext.nestedDialogClose();
|
|
89
|
+
};
|
|
90
|
+
}, [
|
|
91
|
+
open,
|
|
92
|
+
parentContext,
|
|
93
|
+
ownNestedOpenDialogs
|
|
94
|
+
]);
|
|
95
|
+
const dialogTriggerProps = React$1.useMemo(() => getReferenceProps(triggerProps), [getReferenceProps, triggerProps]);
|
|
96
|
+
store.useSyncedValues({
|
|
97
|
+
openMethod,
|
|
98
|
+
mounted,
|
|
99
|
+
transitionStatus,
|
|
100
|
+
triggerProps: dialogTriggerProps,
|
|
101
|
+
popupProps: getFloatingProps(),
|
|
102
|
+
floatingRootContext: context,
|
|
103
|
+
nestedOpenDialogCount: ownNestedOpenDialogs
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
//#endregion
|
|
107
|
+
//#region ../../node_modules/reselect/dist/reselect.mjs
|
|
108
|
+
var runIdentityFunctionCheck = (resultFunc, inputSelectorsResults, outputSelectorResult) => {
|
|
109
|
+
if (inputSelectorsResults.length === 1 && inputSelectorsResults[0] === outputSelectorResult) {
|
|
110
|
+
let isInputSameAsOutput = false;
|
|
111
|
+
try {
|
|
112
|
+
const emptyObject = {};
|
|
113
|
+
if (resultFunc(emptyObject) === emptyObject) isInputSameAsOutput = true;
|
|
114
|
+
} catch {}
|
|
115
|
+
if (isInputSameAsOutput) {
|
|
116
|
+
let stack = void 0;
|
|
117
|
+
try {
|
|
118
|
+
throw new Error();
|
|
119
|
+
} catch (e) {
|
|
120
|
+
({stack} = e);
|
|
121
|
+
}
|
|
122
|
+
console.warn("The result function returned its own inputs without modification. e.g\n`createSelector([state => state.todos], todos => todos)`\nThis could lead to inefficient memoization and unnecessary re-renders.\nEnsure transformation logic is in the result function, and extraction logic is in the input selectors.", { stack });
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
};
|
|
126
|
+
var runInputStabilityCheck = (inputSelectorResultsObject, options, inputSelectorArgs) => {
|
|
127
|
+
const { memoize, memoizeOptions } = options;
|
|
128
|
+
const { inputSelectorResults, inputSelectorResultsCopy } = inputSelectorResultsObject;
|
|
129
|
+
const createAnEmptyObject = memoize(() => ({}), ...memoizeOptions);
|
|
130
|
+
if (!(createAnEmptyObject.apply(null, inputSelectorResults) === createAnEmptyObject.apply(null, inputSelectorResultsCopy))) {
|
|
131
|
+
let stack = void 0;
|
|
132
|
+
try {
|
|
133
|
+
throw new Error();
|
|
134
|
+
} catch (e) {
|
|
135
|
+
({stack} = e);
|
|
136
|
+
}
|
|
137
|
+
console.warn("An input selector returned a different result when passed same arguments.\nThis means your output selector will likely run more frequently than intended.\nAvoid returning a new reference inside your input selector, e.g.\n`createSelector([state => state.todos.map(todo => todo.id)], todoIds => todoIds.length)`", {
|
|
138
|
+
arguments: inputSelectorArgs,
|
|
139
|
+
firstInputs: inputSelectorResults,
|
|
140
|
+
secondInputs: inputSelectorResultsCopy,
|
|
141
|
+
stack
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
};
|
|
145
|
+
var globalDevModeChecks = {
|
|
146
|
+
inputStabilityCheck: "once",
|
|
147
|
+
identityFunctionCheck: "once"
|
|
148
|
+
};
|
|
149
|
+
var NOT_FOUND = /* @__PURE__ */ Symbol("NOT_FOUND");
|
|
150
|
+
function assertIsFunction(func, errorMessage = `expected a function, instead received ${typeof func}`) {
|
|
151
|
+
if (typeof func !== "function") throw new TypeError(errorMessage);
|
|
152
|
+
}
|
|
153
|
+
function assertIsObject(object, errorMessage = `expected an object, instead received ${typeof object}`) {
|
|
154
|
+
if (typeof object !== "object") throw new TypeError(errorMessage);
|
|
155
|
+
}
|
|
156
|
+
function assertIsArrayOfFunctions(array, errorMessage = `expected all items to be functions, instead received the following types: `) {
|
|
157
|
+
if (!array.every((item) => typeof item === "function")) {
|
|
158
|
+
const itemTypes = array.map((item) => typeof item === "function" ? `function ${item.name || "unnamed"}()` : typeof item).join(", ");
|
|
159
|
+
throw new TypeError(`${errorMessage}[${itemTypes}]`);
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
var ensureIsArray = (item) => {
|
|
163
|
+
return Array.isArray(item) ? item : [item];
|
|
164
|
+
};
|
|
165
|
+
function getDependencies(createSelectorArgs) {
|
|
166
|
+
const dependencies = Array.isArray(createSelectorArgs[0]) ? createSelectorArgs[0] : createSelectorArgs;
|
|
167
|
+
assertIsArrayOfFunctions(dependencies, `createSelector expects all input-selectors to be functions, but received the following types: `);
|
|
168
|
+
return dependencies;
|
|
169
|
+
}
|
|
170
|
+
function collectInputSelectorResults(dependencies, inputSelectorArgs) {
|
|
171
|
+
const inputSelectorResults = [];
|
|
172
|
+
const { length } = dependencies;
|
|
173
|
+
for (let i = 0; i < length; i++) inputSelectorResults.push(dependencies[i].apply(null, inputSelectorArgs));
|
|
174
|
+
return inputSelectorResults;
|
|
175
|
+
}
|
|
176
|
+
var getDevModeChecksExecutionInfo = (firstRun, devModeChecks) => {
|
|
177
|
+
const { identityFunctionCheck, inputStabilityCheck } = {
|
|
178
|
+
...globalDevModeChecks,
|
|
179
|
+
...devModeChecks
|
|
180
|
+
};
|
|
181
|
+
return {
|
|
182
|
+
identityFunctionCheck: {
|
|
183
|
+
shouldRun: identityFunctionCheck === "always" || identityFunctionCheck === "once" && firstRun,
|
|
184
|
+
run: runIdentityFunctionCheck
|
|
185
|
+
},
|
|
186
|
+
inputStabilityCheck: {
|
|
187
|
+
shouldRun: inputStabilityCheck === "always" || inputStabilityCheck === "once" && firstRun,
|
|
188
|
+
run: runInputStabilityCheck
|
|
189
|
+
}
|
|
190
|
+
};
|
|
191
|
+
};
|
|
192
|
+
function createSingletonCache(equals) {
|
|
193
|
+
let entry;
|
|
194
|
+
return {
|
|
195
|
+
get(key) {
|
|
196
|
+
if (entry && equals(entry.key, key)) return entry.value;
|
|
197
|
+
return NOT_FOUND;
|
|
198
|
+
},
|
|
199
|
+
put(key, value) {
|
|
200
|
+
entry = {
|
|
201
|
+
key,
|
|
202
|
+
value
|
|
203
|
+
};
|
|
204
|
+
},
|
|
205
|
+
getEntries() {
|
|
206
|
+
return entry ? [entry] : [];
|
|
207
|
+
},
|
|
208
|
+
clear() {
|
|
209
|
+
entry = void 0;
|
|
210
|
+
}
|
|
211
|
+
};
|
|
212
|
+
}
|
|
213
|
+
function createLruCache(maxSize, equals) {
|
|
214
|
+
let entries = [];
|
|
215
|
+
function get(key) {
|
|
216
|
+
const cacheIndex = entries.findIndex((entry) => equals(key, entry.key));
|
|
217
|
+
if (cacheIndex > -1) {
|
|
218
|
+
const entry = entries[cacheIndex];
|
|
219
|
+
if (cacheIndex > 0) {
|
|
220
|
+
entries.splice(cacheIndex, 1);
|
|
221
|
+
entries.unshift(entry);
|
|
222
|
+
}
|
|
223
|
+
return entry.value;
|
|
224
|
+
}
|
|
225
|
+
return NOT_FOUND;
|
|
226
|
+
}
|
|
227
|
+
function put(key, value) {
|
|
228
|
+
if (get(key) === NOT_FOUND) {
|
|
229
|
+
entries.unshift({
|
|
230
|
+
key,
|
|
231
|
+
value
|
|
232
|
+
});
|
|
233
|
+
if (entries.length > maxSize) entries.pop();
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
function getEntries() {
|
|
237
|
+
return entries;
|
|
238
|
+
}
|
|
239
|
+
function clear() {
|
|
240
|
+
entries = [];
|
|
241
|
+
}
|
|
242
|
+
return {
|
|
243
|
+
get,
|
|
244
|
+
put,
|
|
245
|
+
getEntries,
|
|
246
|
+
clear
|
|
247
|
+
};
|
|
248
|
+
}
|
|
249
|
+
var referenceEqualityCheck = (a, b) => a === b;
|
|
250
|
+
function createCacheKeyComparator(equalityCheck) {
|
|
251
|
+
return function areArgumentsShallowlyEqual(prev, next) {
|
|
252
|
+
if (prev === null || next === null || prev.length !== next.length) return false;
|
|
253
|
+
const { length } = prev;
|
|
254
|
+
for (let i = 0; i < length; i++) if (!equalityCheck(prev[i], next[i])) return false;
|
|
255
|
+
return true;
|
|
256
|
+
};
|
|
257
|
+
}
|
|
258
|
+
function lruMemoize(func, equalityCheckOrOptions) {
|
|
259
|
+
const { equalityCheck = referenceEqualityCheck, maxSize = 1, resultEqualityCheck } = typeof equalityCheckOrOptions === "object" ? equalityCheckOrOptions : { equalityCheck: equalityCheckOrOptions };
|
|
260
|
+
const comparator = createCacheKeyComparator(equalityCheck);
|
|
261
|
+
let resultsCount = 0;
|
|
262
|
+
const cache = maxSize <= 1 ? createSingletonCache(comparator) : createLruCache(maxSize, comparator);
|
|
263
|
+
function memoized() {
|
|
264
|
+
let value = cache.get(arguments);
|
|
265
|
+
if (value === NOT_FOUND) {
|
|
266
|
+
value = func.apply(null, arguments);
|
|
267
|
+
resultsCount++;
|
|
268
|
+
if (resultEqualityCheck) {
|
|
269
|
+
const matchingEntry = cache.getEntries().find((entry) => resultEqualityCheck(entry.value, value));
|
|
270
|
+
if (matchingEntry) {
|
|
271
|
+
value = matchingEntry.value;
|
|
272
|
+
resultsCount !== 0 && resultsCount--;
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
cache.put(arguments, value);
|
|
276
|
+
}
|
|
277
|
+
return value;
|
|
278
|
+
}
|
|
279
|
+
memoized.clearCache = () => {
|
|
280
|
+
cache.clear();
|
|
281
|
+
memoized.resetResultsCount();
|
|
282
|
+
};
|
|
283
|
+
memoized.resultsCount = () => resultsCount;
|
|
284
|
+
memoized.resetResultsCount = () => {
|
|
285
|
+
resultsCount = 0;
|
|
286
|
+
};
|
|
287
|
+
return memoized;
|
|
288
|
+
}
|
|
289
|
+
var StrongRef = class {
|
|
290
|
+
constructor(value) {
|
|
291
|
+
this.value = value;
|
|
292
|
+
}
|
|
293
|
+
deref() {
|
|
294
|
+
return this.value;
|
|
295
|
+
}
|
|
296
|
+
};
|
|
297
|
+
var Ref = typeof WeakRef !== "undefined" ? WeakRef : StrongRef;
|
|
298
|
+
var UNTERMINATED = 0;
|
|
299
|
+
var TERMINATED = 1;
|
|
300
|
+
function createCacheNode() {
|
|
301
|
+
return {
|
|
302
|
+
s: UNTERMINATED,
|
|
303
|
+
v: void 0,
|
|
304
|
+
o: null,
|
|
305
|
+
p: null
|
|
306
|
+
};
|
|
307
|
+
}
|
|
308
|
+
function weakMapMemoize(func, options = {}) {
|
|
309
|
+
let fnNode = createCacheNode();
|
|
310
|
+
const { resultEqualityCheck } = options;
|
|
311
|
+
let lastResult;
|
|
312
|
+
let resultsCount = 0;
|
|
313
|
+
function memoized() {
|
|
314
|
+
let cacheNode = fnNode;
|
|
315
|
+
const { length } = arguments;
|
|
316
|
+
for (let i = 0, l = length; i < l; i++) {
|
|
317
|
+
const arg = arguments[i];
|
|
318
|
+
if (typeof arg === "function" || typeof arg === "object" && arg !== null) {
|
|
319
|
+
let objectCache = cacheNode.o;
|
|
320
|
+
if (objectCache === null) cacheNode.o = objectCache = /* @__PURE__ */ new WeakMap();
|
|
321
|
+
const objectNode = objectCache.get(arg);
|
|
322
|
+
if (objectNode === void 0) {
|
|
323
|
+
cacheNode = createCacheNode();
|
|
324
|
+
objectCache.set(arg, cacheNode);
|
|
325
|
+
} else cacheNode = objectNode;
|
|
326
|
+
} else {
|
|
327
|
+
let primitiveCache = cacheNode.p;
|
|
328
|
+
if (primitiveCache === null) cacheNode.p = primitiveCache = /* @__PURE__ */ new Map();
|
|
329
|
+
const primitiveNode = primitiveCache.get(arg);
|
|
330
|
+
if (primitiveNode === void 0) {
|
|
331
|
+
cacheNode = createCacheNode();
|
|
332
|
+
primitiveCache.set(arg, cacheNode);
|
|
333
|
+
} else cacheNode = primitiveNode;
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
const terminatedNode = cacheNode;
|
|
337
|
+
let result;
|
|
338
|
+
if (cacheNode.s === TERMINATED) result = cacheNode.v;
|
|
339
|
+
else {
|
|
340
|
+
result = func.apply(null, arguments);
|
|
341
|
+
resultsCount++;
|
|
342
|
+
if (resultEqualityCheck) {
|
|
343
|
+
var _lastResult$deref, _lastResult$deref2;
|
|
344
|
+
const lastResultValue = (_lastResult$deref = lastResult === null || lastResult === void 0 || (_lastResult$deref2 = lastResult.deref) === null || _lastResult$deref2 === void 0 ? void 0 : _lastResult$deref2.call(lastResult)) !== null && _lastResult$deref !== void 0 ? _lastResult$deref : lastResult;
|
|
345
|
+
if (lastResultValue != null && resultEqualityCheck(lastResultValue, result)) {
|
|
346
|
+
result = lastResultValue;
|
|
347
|
+
resultsCount !== 0 && resultsCount--;
|
|
348
|
+
}
|
|
349
|
+
lastResult = typeof result === "object" && result !== null || typeof result === "function" ? new Ref(result) : result;
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
terminatedNode.s = TERMINATED;
|
|
353
|
+
terminatedNode.v = result;
|
|
354
|
+
return result;
|
|
355
|
+
}
|
|
356
|
+
memoized.clearCache = () => {
|
|
357
|
+
fnNode = createCacheNode();
|
|
358
|
+
memoized.resetResultsCount();
|
|
359
|
+
};
|
|
360
|
+
memoized.resultsCount = () => resultsCount;
|
|
361
|
+
memoized.resetResultsCount = () => {
|
|
362
|
+
resultsCount = 0;
|
|
363
|
+
};
|
|
364
|
+
return memoized;
|
|
365
|
+
}
|
|
366
|
+
function createSelectorCreator(memoizeOrOptions, ...memoizeOptionsFromArgs) {
|
|
367
|
+
const createSelectorCreatorOptions = typeof memoizeOrOptions === "function" ? {
|
|
368
|
+
memoize: memoizeOrOptions,
|
|
369
|
+
memoizeOptions: memoizeOptionsFromArgs
|
|
370
|
+
} : memoizeOrOptions;
|
|
371
|
+
const createSelector2 = (...createSelectorArgs) => {
|
|
372
|
+
let recomputations = 0;
|
|
373
|
+
let dependencyRecomputations = 0;
|
|
374
|
+
let lastResult;
|
|
375
|
+
let directlyPassedOptions = {};
|
|
376
|
+
let resultFunc = createSelectorArgs.pop();
|
|
377
|
+
if (typeof resultFunc === "object") {
|
|
378
|
+
directlyPassedOptions = resultFunc;
|
|
379
|
+
resultFunc = createSelectorArgs.pop();
|
|
380
|
+
}
|
|
381
|
+
assertIsFunction(resultFunc, `createSelector expects an output function after the inputs, but received: [${typeof resultFunc}]`);
|
|
382
|
+
const { memoize, memoizeOptions = [], argsMemoize = weakMapMemoize, argsMemoizeOptions = [], devModeChecks = {} } = {
|
|
383
|
+
...createSelectorCreatorOptions,
|
|
384
|
+
...directlyPassedOptions
|
|
385
|
+
};
|
|
386
|
+
const finalMemoizeOptions = ensureIsArray(memoizeOptions);
|
|
387
|
+
const finalArgsMemoizeOptions = ensureIsArray(argsMemoizeOptions);
|
|
388
|
+
const dependencies = getDependencies(createSelectorArgs);
|
|
389
|
+
const memoizedResultFunc = memoize(function recomputationWrapper() {
|
|
390
|
+
recomputations++;
|
|
391
|
+
return resultFunc.apply(null, arguments);
|
|
392
|
+
}, ...finalMemoizeOptions);
|
|
393
|
+
let firstRun = true;
|
|
394
|
+
const selector = argsMemoize(function dependenciesChecker() {
|
|
395
|
+
dependencyRecomputations++;
|
|
396
|
+
const inputSelectorResults = collectInputSelectorResults(dependencies, arguments);
|
|
397
|
+
lastResult = memoizedResultFunc.apply(null, inputSelectorResults);
|
|
398
|
+
if (process.env.NODE_ENV !== "production") {
|
|
399
|
+
const { identityFunctionCheck, inputStabilityCheck } = getDevModeChecksExecutionInfo(firstRun, devModeChecks);
|
|
400
|
+
if (identityFunctionCheck.shouldRun) identityFunctionCheck.run(resultFunc, inputSelectorResults, lastResult);
|
|
401
|
+
if (inputStabilityCheck.shouldRun) {
|
|
402
|
+
const inputSelectorResultsCopy = collectInputSelectorResults(dependencies, arguments);
|
|
403
|
+
inputStabilityCheck.run({
|
|
404
|
+
inputSelectorResults,
|
|
405
|
+
inputSelectorResultsCopy
|
|
406
|
+
}, {
|
|
407
|
+
memoize,
|
|
408
|
+
memoizeOptions: finalMemoizeOptions
|
|
409
|
+
}, arguments);
|
|
410
|
+
}
|
|
411
|
+
if (firstRun) firstRun = false;
|
|
412
|
+
}
|
|
413
|
+
return lastResult;
|
|
414
|
+
}, ...finalArgsMemoizeOptions);
|
|
415
|
+
return Object.assign(selector, {
|
|
416
|
+
resultFunc,
|
|
417
|
+
memoizedResultFunc,
|
|
418
|
+
dependencies,
|
|
419
|
+
dependencyRecomputations: () => dependencyRecomputations,
|
|
420
|
+
resetDependencyRecomputations: () => {
|
|
421
|
+
dependencyRecomputations = 0;
|
|
422
|
+
},
|
|
423
|
+
lastResult: () => lastResult,
|
|
424
|
+
recomputations: () => recomputations,
|
|
425
|
+
resetRecomputations: () => {
|
|
426
|
+
recomputations = 0;
|
|
427
|
+
},
|
|
428
|
+
memoize,
|
|
429
|
+
argsMemoize
|
|
430
|
+
});
|
|
431
|
+
};
|
|
432
|
+
Object.assign(createSelector2, { withTypes: () => createSelector2 });
|
|
433
|
+
return createSelector2;
|
|
434
|
+
}
|
|
435
|
+
var createSelector$1 = /* @__PURE__ */ createSelectorCreator(weakMapMemoize);
|
|
436
|
+
var createStructuredSelector = Object.assign((inputSelectorsObject, selectorCreator = createSelector$1) => {
|
|
437
|
+
assertIsObject(inputSelectorsObject, `createStructuredSelector expects first argument to be an object where each property is a selector, instead received a ${typeof inputSelectorsObject}`);
|
|
438
|
+
const inputSelectorKeys = Object.keys(inputSelectorsObject);
|
|
439
|
+
return selectorCreator(inputSelectorKeys.map((key) => inputSelectorsObject[key]), (...inputSelectorResults) => {
|
|
440
|
+
return inputSelectorResults.reduce((composition, value, index) => {
|
|
441
|
+
composition[inputSelectorKeys[index]] = value;
|
|
442
|
+
return composition;
|
|
443
|
+
}, {});
|
|
444
|
+
});
|
|
445
|
+
}, { withTypes: () => createStructuredSelector });
|
|
446
|
+
createSelectorCreator({
|
|
447
|
+
memoize: lruMemoize,
|
|
448
|
+
memoizeOptions: {
|
|
449
|
+
maxSize: 1,
|
|
450
|
+
equalityCheck: Object.is
|
|
451
|
+
}
|
|
452
|
+
});
|
|
453
|
+
/**
|
|
454
|
+
* Creates a selector function that can be used to derive values from the store's state.
|
|
455
|
+
* The selector can take up to three additional arguments that can be used in the selector logic.
|
|
456
|
+
* This function accepts up to six functions and combines them into a single selector function.
|
|
457
|
+
* The last parameter is the combiner function that combines the results of the previous selectors.
|
|
458
|
+
*
|
|
459
|
+
* @example
|
|
460
|
+
* const selector = createSelector(
|
|
461
|
+
* (state) => state.disabled
|
|
462
|
+
* );
|
|
463
|
+
*
|
|
464
|
+
* @example
|
|
465
|
+
* const selector = createSelector(
|
|
466
|
+
* (state) => state.disabled,
|
|
467
|
+
* (state) => state.open,
|
|
468
|
+
* (disabled, open) => ({ disabled, open })
|
|
469
|
+
* );
|
|
470
|
+
*
|
|
471
|
+
*/
|
|
472
|
+
var createSelector = (a, b, c, d, e, f, ...other) => {
|
|
473
|
+
if (other.length > 0) throw new Error("Unsupported number of selectors");
|
|
474
|
+
let selector;
|
|
475
|
+
if (a && b && c && d && e && f) selector = (state, a1, a2, a3) => {
|
|
476
|
+
return f(a(state, a1, a2, a3), b(state, a1, a2, a3), c(state, a1, a2, a3), d(state, a1, a2, a3), e(state, a1, a2, a3), a1, a2, a3);
|
|
477
|
+
};
|
|
478
|
+
else if (a && b && c && d && e) selector = (state, a1, a2, a3) => {
|
|
479
|
+
return e(a(state, a1, a2, a3), b(state, a1, a2, a3), c(state, a1, a2, a3), d(state, a1, a2, a3), a1, a2, a3);
|
|
480
|
+
};
|
|
481
|
+
else if (a && b && c && d) selector = (state, a1, a2, a3) => {
|
|
482
|
+
return d(a(state, a1, a2, a3), b(state, a1, a2, a3), c(state, a1, a2, a3), a1, a2, a3);
|
|
483
|
+
};
|
|
484
|
+
else if (a && b && c) selector = (state, a1, a2, a3) => {
|
|
485
|
+
return c(a(state, a1, a2, a3), b(state, a1, a2, a3), a1, a2, a3);
|
|
486
|
+
};
|
|
487
|
+
else if (a && b) selector = (state, a1, a2, a3) => {
|
|
488
|
+
return b(a(state, a1, a2, a3), a1, a2, a3);
|
|
489
|
+
};
|
|
490
|
+
else if (a) selector = a;
|
|
491
|
+
else throw new Error("Missing arguments");
|
|
492
|
+
return selector;
|
|
493
|
+
};
|
|
494
|
+
//#endregion
|
|
495
|
+
//#region ../../node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.js
|
|
496
|
+
var require_use_sync_external_store_shim_production = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
497
|
+
/**
|
|
498
|
+
* @license React
|
|
499
|
+
* use-sync-external-store-shim.production.js
|
|
500
|
+
*
|
|
501
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
502
|
+
*
|
|
503
|
+
* This source code is licensed under the MIT license found in the
|
|
504
|
+
* LICENSE file in the root directory of this source tree.
|
|
505
|
+
*/
|
|
506
|
+
var React = require_builtin_esm_external_require_react();
|
|
507
|
+
function is(x, y) {
|
|
508
|
+
return x === y && (0 !== x || 1 / x === 1 / y) || x !== x && y !== y;
|
|
509
|
+
}
|
|
510
|
+
var objectIs = "function" === typeof Object.is ? Object.is : is, useState = React.useState, useEffect = React.useEffect, useLayoutEffect = React.useLayoutEffect, useDebugValue = React.useDebugValue;
|
|
511
|
+
function useSyncExternalStore$2(subscribe, getSnapshot) {
|
|
512
|
+
var value = getSnapshot(), _useState = useState({ inst: {
|
|
513
|
+
value,
|
|
514
|
+
getSnapshot
|
|
515
|
+
} }), inst = _useState[0].inst, forceUpdate = _useState[1];
|
|
516
|
+
useLayoutEffect(function() {
|
|
517
|
+
inst.value = value;
|
|
518
|
+
inst.getSnapshot = getSnapshot;
|
|
519
|
+
checkIfSnapshotChanged(inst) && forceUpdate({ inst });
|
|
520
|
+
}, [
|
|
521
|
+
subscribe,
|
|
522
|
+
value,
|
|
523
|
+
getSnapshot
|
|
524
|
+
]);
|
|
525
|
+
useEffect(function() {
|
|
526
|
+
checkIfSnapshotChanged(inst) && forceUpdate({ inst });
|
|
527
|
+
return subscribe(function() {
|
|
528
|
+
checkIfSnapshotChanged(inst) && forceUpdate({ inst });
|
|
529
|
+
});
|
|
530
|
+
}, [subscribe]);
|
|
531
|
+
useDebugValue(value);
|
|
532
|
+
return value;
|
|
533
|
+
}
|
|
534
|
+
function checkIfSnapshotChanged(inst) {
|
|
535
|
+
var latestGetSnapshot = inst.getSnapshot;
|
|
536
|
+
inst = inst.value;
|
|
537
|
+
try {
|
|
538
|
+
var nextValue = latestGetSnapshot();
|
|
539
|
+
return !objectIs(inst, nextValue);
|
|
540
|
+
} catch (error) {
|
|
541
|
+
return !0;
|
|
542
|
+
}
|
|
543
|
+
}
|
|
544
|
+
function useSyncExternalStore$1(subscribe, getSnapshot) {
|
|
545
|
+
return getSnapshot();
|
|
546
|
+
}
|
|
547
|
+
var shim = "undefined" === typeof window || "undefined" === typeof window.document || "undefined" === typeof window.document.createElement ? useSyncExternalStore$1 : useSyncExternalStore$2;
|
|
548
|
+
exports.useSyncExternalStore = void 0 !== React.useSyncExternalStore ? React.useSyncExternalStore : shim;
|
|
549
|
+
}));
|
|
550
|
+
//#endregion
|
|
551
|
+
//#region ../../node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js
|
|
552
|
+
var require_use_sync_external_store_shim_development = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
553
|
+
/**
|
|
554
|
+
* @license React
|
|
555
|
+
* use-sync-external-store-shim.development.js
|
|
556
|
+
*
|
|
557
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
558
|
+
*
|
|
559
|
+
* This source code is licensed under the MIT license found in the
|
|
560
|
+
* LICENSE file in the root directory of this source tree.
|
|
561
|
+
*/
|
|
562
|
+
"production" !== process.env.NODE_ENV && (function() {
|
|
563
|
+
function is(x, y) {
|
|
564
|
+
return x === y && (0 !== x || 1 / x === 1 / y) || x !== x && y !== y;
|
|
565
|
+
}
|
|
566
|
+
function useSyncExternalStore$2(subscribe, getSnapshot) {
|
|
567
|
+
didWarnOld18Alpha || void 0 === React.startTransition || (didWarnOld18Alpha = !0, console.error("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));
|
|
568
|
+
var value = getSnapshot();
|
|
569
|
+
if (!didWarnUncachedGetSnapshot) {
|
|
570
|
+
var cachedValue = getSnapshot();
|
|
571
|
+
objectIs(value, cachedValue) || (console.error("The result of getSnapshot should be cached to avoid an infinite loop"), didWarnUncachedGetSnapshot = !0);
|
|
572
|
+
}
|
|
573
|
+
cachedValue = useState({ inst: {
|
|
574
|
+
value,
|
|
575
|
+
getSnapshot
|
|
576
|
+
} });
|
|
577
|
+
var inst = cachedValue[0].inst, forceUpdate = cachedValue[1];
|
|
578
|
+
useLayoutEffect(function() {
|
|
579
|
+
inst.value = value;
|
|
580
|
+
inst.getSnapshot = getSnapshot;
|
|
581
|
+
checkIfSnapshotChanged(inst) && forceUpdate({ inst });
|
|
582
|
+
}, [
|
|
583
|
+
subscribe,
|
|
584
|
+
value,
|
|
585
|
+
getSnapshot
|
|
586
|
+
]);
|
|
587
|
+
useEffect(function() {
|
|
588
|
+
checkIfSnapshotChanged(inst) && forceUpdate({ inst });
|
|
589
|
+
return subscribe(function() {
|
|
590
|
+
checkIfSnapshotChanged(inst) && forceUpdate({ inst });
|
|
591
|
+
});
|
|
592
|
+
}, [subscribe]);
|
|
593
|
+
useDebugValue(value);
|
|
594
|
+
return value;
|
|
595
|
+
}
|
|
596
|
+
function checkIfSnapshotChanged(inst) {
|
|
597
|
+
var latestGetSnapshot = inst.getSnapshot;
|
|
598
|
+
inst = inst.value;
|
|
599
|
+
try {
|
|
600
|
+
var nextValue = latestGetSnapshot();
|
|
601
|
+
return !objectIs(inst, nextValue);
|
|
602
|
+
} catch (error) {
|
|
603
|
+
return !0;
|
|
604
|
+
}
|
|
605
|
+
}
|
|
606
|
+
function useSyncExternalStore$1(subscribe, getSnapshot) {
|
|
607
|
+
return getSnapshot();
|
|
608
|
+
}
|
|
609
|
+
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
|
|
610
|
+
var React = require_builtin_esm_external_require_react(), objectIs = "function" === typeof Object.is ? Object.is : is, useState = React.useState, useEffect = React.useEffect, useLayoutEffect = React.useLayoutEffect, useDebugValue = React.useDebugValue, didWarnOld18Alpha = !1, didWarnUncachedGetSnapshot = !1, shim = "undefined" === typeof window || "undefined" === typeof window.document || "undefined" === typeof window.document.createElement ? useSyncExternalStore$1 : useSyncExternalStore$2;
|
|
611
|
+
exports.useSyncExternalStore = void 0 !== React.useSyncExternalStore ? React.useSyncExternalStore : shim;
|
|
612
|
+
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
|
|
613
|
+
})();
|
|
614
|
+
}));
|
|
615
|
+
//#endregion
|
|
616
|
+
//#region ../../node_modules/use-sync-external-store/shim/index.js
|
|
617
|
+
var require_shim = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
618
|
+
if (process.env.NODE_ENV === "production") module.exports = require_use_sync_external_store_shim_production();
|
|
619
|
+
else module.exports = require_use_sync_external_store_shim_development();
|
|
620
|
+
}));
|
|
621
|
+
//#endregion
|
|
622
|
+
//#region ../../node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.js
|
|
623
|
+
var require_with_selector_production = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
624
|
+
/**
|
|
625
|
+
* @license React
|
|
626
|
+
* use-sync-external-store-shim/with-selector.production.js
|
|
627
|
+
*
|
|
628
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
629
|
+
*
|
|
630
|
+
* This source code is licensed under the MIT license found in the
|
|
631
|
+
* LICENSE file in the root directory of this source tree.
|
|
632
|
+
*/
|
|
633
|
+
var React = require_builtin_esm_external_require_react(), shim = require_shim();
|
|
634
|
+
function is(x, y) {
|
|
635
|
+
return x === y && (0 !== x || 1 / x === 1 / y) || x !== x && y !== y;
|
|
636
|
+
}
|
|
637
|
+
var objectIs = "function" === typeof Object.is ? Object.is : is, useSyncExternalStore = shim.useSyncExternalStore, useRef = React.useRef, useEffect = React.useEffect, useMemo = React.useMemo, useDebugValue = React.useDebugValue;
|
|
638
|
+
exports.useSyncExternalStoreWithSelector = function(subscribe, getSnapshot, getServerSnapshot, selector, isEqual) {
|
|
639
|
+
var instRef = useRef(null);
|
|
640
|
+
if (null === instRef.current) {
|
|
641
|
+
var inst = {
|
|
642
|
+
hasValue: !1,
|
|
643
|
+
value: null
|
|
644
|
+
};
|
|
645
|
+
instRef.current = inst;
|
|
646
|
+
} else inst = instRef.current;
|
|
647
|
+
instRef = useMemo(function() {
|
|
648
|
+
function memoizedSelector(nextSnapshot) {
|
|
649
|
+
if (!hasMemo) {
|
|
650
|
+
hasMemo = !0;
|
|
651
|
+
memoizedSnapshot = nextSnapshot;
|
|
652
|
+
nextSnapshot = selector(nextSnapshot);
|
|
653
|
+
if (void 0 !== isEqual && inst.hasValue) {
|
|
654
|
+
var currentSelection = inst.value;
|
|
655
|
+
if (isEqual(currentSelection, nextSnapshot)) return memoizedSelection = currentSelection;
|
|
656
|
+
}
|
|
657
|
+
return memoizedSelection = nextSnapshot;
|
|
658
|
+
}
|
|
659
|
+
currentSelection = memoizedSelection;
|
|
660
|
+
if (objectIs(memoizedSnapshot, nextSnapshot)) return currentSelection;
|
|
661
|
+
var nextSelection = selector(nextSnapshot);
|
|
662
|
+
if (void 0 !== isEqual && isEqual(currentSelection, nextSelection)) return memoizedSnapshot = nextSnapshot, currentSelection;
|
|
663
|
+
memoizedSnapshot = nextSnapshot;
|
|
664
|
+
return memoizedSelection = nextSelection;
|
|
665
|
+
}
|
|
666
|
+
var hasMemo = !1, memoizedSnapshot, memoizedSelection, maybeGetServerSnapshot = void 0 === getServerSnapshot ? null : getServerSnapshot;
|
|
667
|
+
return [function() {
|
|
668
|
+
return memoizedSelector(getSnapshot());
|
|
669
|
+
}, null === maybeGetServerSnapshot ? void 0 : function() {
|
|
670
|
+
return memoizedSelector(maybeGetServerSnapshot());
|
|
671
|
+
}];
|
|
672
|
+
}, [
|
|
673
|
+
getSnapshot,
|
|
674
|
+
getServerSnapshot,
|
|
675
|
+
selector,
|
|
676
|
+
isEqual
|
|
677
|
+
]);
|
|
678
|
+
var value = useSyncExternalStore(subscribe, instRef[0], instRef[1]);
|
|
679
|
+
useEffect(function() {
|
|
680
|
+
inst.hasValue = !0;
|
|
681
|
+
inst.value = value;
|
|
682
|
+
}, [value]);
|
|
683
|
+
useDebugValue(value);
|
|
684
|
+
return value;
|
|
685
|
+
};
|
|
686
|
+
}));
|
|
687
|
+
//#endregion
|
|
688
|
+
//#region ../../node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js
|
|
689
|
+
var require_with_selector_development = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
690
|
+
/**
|
|
691
|
+
* @license React
|
|
692
|
+
* use-sync-external-store-shim/with-selector.development.js
|
|
693
|
+
*
|
|
694
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
695
|
+
*
|
|
696
|
+
* This source code is licensed under the MIT license found in the
|
|
697
|
+
* LICENSE file in the root directory of this source tree.
|
|
698
|
+
*/
|
|
699
|
+
"production" !== process.env.NODE_ENV && (function() {
|
|
700
|
+
function is(x, y) {
|
|
701
|
+
return x === y && (0 !== x || 1 / x === 1 / y) || x !== x && y !== y;
|
|
702
|
+
}
|
|
703
|
+
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
|
|
704
|
+
var React = require_builtin_esm_external_require_react(), shim = require_shim(), objectIs = "function" === typeof Object.is ? Object.is : is, useSyncExternalStore = shim.useSyncExternalStore, useRef = React.useRef, useEffect = React.useEffect, useMemo = React.useMemo, useDebugValue = React.useDebugValue;
|
|
705
|
+
exports.useSyncExternalStoreWithSelector = function(subscribe, getSnapshot, getServerSnapshot, selector, isEqual) {
|
|
706
|
+
var instRef = useRef(null);
|
|
707
|
+
if (null === instRef.current) {
|
|
708
|
+
var inst = {
|
|
709
|
+
hasValue: !1,
|
|
710
|
+
value: null
|
|
711
|
+
};
|
|
712
|
+
instRef.current = inst;
|
|
713
|
+
} else inst = instRef.current;
|
|
714
|
+
instRef = useMemo(function() {
|
|
715
|
+
function memoizedSelector(nextSnapshot) {
|
|
716
|
+
if (!hasMemo) {
|
|
717
|
+
hasMemo = !0;
|
|
718
|
+
memoizedSnapshot = nextSnapshot;
|
|
719
|
+
nextSnapshot = selector(nextSnapshot);
|
|
720
|
+
if (void 0 !== isEqual && inst.hasValue) {
|
|
721
|
+
var currentSelection = inst.value;
|
|
722
|
+
if (isEqual(currentSelection, nextSnapshot)) return memoizedSelection = currentSelection;
|
|
723
|
+
}
|
|
724
|
+
return memoizedSelection = nextSnapshot;
|
|
725
|
+
}
|
|
726
|
+
currentSelection = memoizedSelection;
|
|
727
|
+
if (objectIs(memoizedSnapshot, nextSnapshot)) return currentSelection;
|
|
728
|
+
var nextSelection = selector(nextSnapshot);
|
|
729
|
+
if (void 0 !== isEqual && isEqual(currentSelection, nextSelection)) return memoizedSnapshot = nextSnapshot, currentSelection;
|
|
730
|
+
memoizedSnapshot = nextSnapshot;
|
|
731
|
+
return memoizedSelection = nextSelection;
|
|
732
|
+
}
|
|
733
|
+
var hasMemo = !1, memoizedSnapshot, memoizedSelection, maybeGetServerSnapshot = void 0 === getServerSnapshot ? null : getServerSnapshot;
|
|
734
|
+
return [function() {
|
|
735
|
+
return memoizedSelector(getSnapshot());
|
|
736
|
+
}, null === maybeGetServerSnapshot ? void 0 : function() {
|
|
737
|
+
return memoizedSelector(maybeGetServerSnapshot());
|
|
738
|
+
}];
|
|
739
|
+
}, [
|
|
740
|
+
getSnapshot,
|
|
741
|
+
getServerSnapshot,
|
|
742
|
+
selector,
|
|
743
|
+
isEqual
|
|
744
|
+
]);
|
|
745
|
+
var value = useSyncExternalStore(subscribe, instRef[0], instRef[1]);
|
|
746
|
+
useEffect(function() {
|
|
747
|
+
inst.hasValue = !0;
|
|
748
|
+
inst.value = value;
|
|
749
|
+
}, [value]);
|
|
750
|
+
useDebugValue(value);
|
|
751
|
+
return value;
|
|
752
|
+
};
|
|
753
|
+
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
|
|
754
|
+
})();
|
|
755
|
+
}));
|
|
756
|
+
//#endregion
|
|
757
|
+
//#region ../../node_modules/@base-ui-components/utils/esm/store/useStore.js
|
|
758
|
+
var import_with_selector = (/* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
759
|
+
if (process.env.NODE_ENV === "production") module.exports = require_with_selector_production();
|
|
760
|
+
else module.exports = require_with_selector_development();
|
|
761
|
+
})))();
|
|
762
|
+
/**
|
|
763
|
+
* Returns a value from the store. The value is derived from the store's state using the provided selector function.
|
|
764
|
+
* Updates to the store's other properties will not cause re-renders.
|
|
765
|
+
*
|
|
766
|
+
* @param store The Store instance to read from.
|
|
767
|
+
* @param selector A function that selects a value from the store's state.
|
|
768
|
+
* @param a1 Optional first argument for the selector function.
|
|
769
|
+
* @param a2 Optional second argument for the selector function.
|
|
770
|
+
* @param a3 Optional third argument for the selector function.
|
|
771
|
+
*/
|
|
772
|
+
function useStore(store, selector, a1, a2, a3) {
|
|
773
|
+
const selectorWithArgs = (state) => selector(state, a1, a2, a3);
|
|
774
|
+
return (0, import_with_selector.useSyncExternalStoreWithSelector)(store.subscribe, store.getSnapshot, store.getSnapshot, selectorWithArgs);
|
|
775
|
+
}
|
|
776
|
+
//#endregion
|
|
777
|
+
//#region ../../node_modules/@base-ui-components/utils/esm/store/Store.js
|
|
778
|
+
/**
|
|
779
|
+
* A data store implementation that allows subscribing to state changes and updating the state.
|
|
780
|
+
* It uses an observer pattern to notify subscribers when the state changes.
|
|
781
|
+
*/
|
|
782
|
+
var Store = class {
|
|
783
|
+
/**
|
|
784
|
+
* The current state of the store.
|
|
785
|
+
* This property is updated immediately when the state changes as a result of calling {@link update}, {@link apply}, or {@link set}.
|
|
786
|
+
* To subscribe to state changes, use the {@link useState} method. The value returned by {@link useState} is updated after the component renders (similarly to React's useState).
|
|
787
|
+
* The values can be used directly (to avoid subscribing to the store) in effects or event handlers.
|
|
788
|
+
*
|
|
789
|
+
* Do not modify properties in state directly. Instead, use the provided methods to ensure proper state management and listener notification.
|
|
790
|
+
*/
|
|
791
|
+
constructor(state) {
|
|
792
|
+
_defineProperty(
|
|
793
|
+
this,
|
|
794
|
+
/**
|
|
795
|
+
* Registers a listener that will be called whenever the store's state changes.
|
|
796
|
+
*
|
|
797
|
+
* @param fn The listener function to be called on state changes.
|
|
798
|
+
* @returns A function to unsubscribe the listener.
|
|
799
|
+
*/
|
|
800
|
+
"subscribe",
|
|
801
|
+
(fn) => {
|
|
802
|
+
this.listeners.add(fn);
|
|
803
|
+
return () => {
|
|
804
|
+
this.listeners.delete(fn);
|
|
805
|
+
};
|
|
806
|
+
}
|
|
807
|
+
);
|
|
808
|
+
_defineProperty(
|
|
809
|
+
this,
|
|
810
|
+
/**
|
|
811
|
+
* Returns the current state of the store.
|
|
812
|
+
*/
|
|
813
|
+
"getSnapshot",
|
|
814
|
+
() => {
|
|
815
|
+
return this.state;
|
|
816
|
+
}
|
|
817
|
+
);
|
|
818
|
+
this.state = state;
|
|
819
|
+
this.listeners = /* @__PURE__ */ new Set();
|
|
820
|
+
}
|
|
821
|
+
/**
|
|
822
|
+
* Updates the entire store's state and notifies all registered listeners.
|
|
823
|
+
*
|
|
824
|
+
* @param newState The new state to set for the store.
|
|
825
|
+
*/
|
|
826
|
+
update(newState) {
|
|
827
|
+
if (this.state !== newState) {
|
|
828
|
+
this.state = newState;
|
|
829
|
+
this.listeners.forEach((l) => l(newState));
|
|
830
|
+
}
|
|
831
|
+
}
|
|
832
|
+
/**
|
|
833
|
+
* Merges the provided changes into the current state and notifies listeners if there are changes.
|
|
834
|
+
*
|
|
835
|
+
* @param changes An object containing the changes to apply to the current state.
|
|
836
|
+
*/
|
|
837
|
+
apply(changes) {
|
|
838
|
+
for (const key in changes) if (!Object.is(this.state[key], changes[key])) {
|
|
839
|
+
this.update({
|
|
840
|
+
...this.state,
|
|
841
|
+
...changes
|
|
842
|
+
});
|
|
843
|
+
return;
|
|
844
|
+
}
|
|
845
|
+
}
|
|
846
|
+
/**
|
|
847
|
+
* Sets a specific key in the store's state to a new value and notifies listeners if the value has changed.
|
|
848
|
+
*
|
|
849
|
+
* @param key The key in the store's state to update.
|
|
850
|
+
* @param value The new value to set for the specified key.
|
|
851
|
+
*/
|
|
852
|
+
set(key, value) {
|
|
853
|
+
if (!Object.is(this.state[key], value)) this.update({
|
|
854
|
+
...this.state,
|
|
855
|
+
[key]: value
|
|
856
|
+
});
|
|
857
|
+
}
|
|
858
|
+
};
|
|
859
|
+
//#endregion
|
|
860
|
+
//#region ../../node_modules/@base-ui-components/utils/esm/store/ReactStore.js
|
|
861
|
+
/**
|
|
862
|
+
* A Store that supports controlled state keys.
|
|
863
|
+
*
|
|
864
|
+
* - Keys registered through {@link useControlledProp} become controlled when a non-undefined
|
|
865
|
+
* value is provided. Controlled keys mirror the incoming value and ignore local writes
|
|
866
|
+
* (via {@link set}, {@link apply}, or {@link update}).
|
|
867
|
+
* - When a key is uncontrolled, an optional default value is written once on first render.
|
|
868
|
+
* - Use {@link useSyncedValue} and {@link useSyncedValues} to synchronize external values/props into the
|
|
869
|
+
* store during a layout phase using {@link useIsoLayoutEffect}.
|
|
870
|
+
*/
|
|
871
|
+
var ReactStore = class extends Store {
|
|
872
|
+
constructor(state, context = {}, selectors) {
|
|
873
|
+
super(state);
|
|
874
|
+
_defineProperty(
|
|
875
|
+
this,
|
|
876
|
+
/**
|
|
877
|
+
* Non-reactive values such as refs, callbacks, etc.
|
|
878
|
+
* Unlike `state`, this property can be accessed directly.
|
|
879
|
+
*/
|
|
880
|
+
/**
|
|
881
|
+
* Keeps track of which properties are controlled.
|
|
882
|
+
*/
|
|
883
|
+
"controlledValues",
|
|
884
|
+
/* @__PURE__ */ new Map()
|
|
885
|
+
);
|
|
886
|
+
this.context = context;
|
|
887
|
+
this.selectors = selectors;
|
|
888
|
+
}
|
|
889
|
+
/**
|
|
890
|
+
* Synchronizes a single external value into the store during layout phase.
|
|
891
|
+
*/
|
|
892
|
+
useSyncedValue(key, value) {
|
|
893
|
+
useIsoLayoutEffect(() => {
|
|
894
|
+
if (this.state[key] !== value) this.set(key, value);
|
|
895
|
+
}, [key, value]);
|
|
896
|
+
}
|
|
897
|
+
/**
|
|
898
|
+
* Synchronizes a single external value into the store during layout phase and
|
|
899
|
+
* cleans it up (sets to `undefined`) on unmount.
|
|
900
|
+
*/
|
|
901
|
+
useSyncedValueWithCleanup(key, value) {
|
|
902
|
+
useIsoLayoutEffect(() => {
|
|
903
|
+
if (this.state[key] !== value) this.set(key, value);
|
|
904
|
+
return () => {
|
|
905
|
+
this.set(key, void 0);
|
|
906
|
+
};
|
|
907
|
+
}, [key, value]);
|
|
908
|
+
}
|
|
909
|
+
/**
|
|
910
|
+
* Synchronizes multiple external values into the store during layout phase.
|
|
911
|
+
*/
|
|
912
|
+
useSyncedValues(props) {
|
|
913
|
+
useIsoLayoutEffect(() => {
|
|
914
|
+
this.apply(props);
|
|
915
|
+
}, [props]);
|
|
916
|
+
}
|
|
917
|
+
/**
|
|
918
|
+
* Registers a controllable prop pair (`controlled`, `defaultValue`) for a specific key.
|
|
919
|
+
* - If `controlled` is non-undefined, the key is marked as controlled and the store's
|
|
920
|
+
* state at `key` is updated to match `controlled`. Local writes to that key are ignored.
|
|
921
|
+
* - If `controlled` is undefined, the key is marked as uncontrolled. The store's state
|
|
922
|
+
* is initialized to `defaultValue` on first render and can be updated with local writes.
|
|
923
|
+
*/
|
|
924
|
+
useControlledProp(key, controlled, defaultValue) {
|
|
925
|
+
const isControlled = controlled !== void 0;
|
|
926
|
+
if (process.env.NODE_ENV !== "production") {
|
|
927
|
+
const previouslyControlled = this.controlledValues.get(key);
|
|
928
|
+
if (previouslyControlled !== void 0 && previouslyControlled !== isControlled) console.error(`A component is changing the ${isControlled ? "" : "un"}controlled state of ${key.toString()} to be ${isControlled ? "un" : ""}controlled. Elements should not switch from uncontrolled to controlled (or vice versa).`);
|
|
929
|
+
}
|
|
930
|
+
if (!this.controlledValues.has(key)) {
|
|
931
|
+
this.controlledValues.set(key, isControlled);
|
|
932
|
+
if (!isControlled && !Object.is(this.state[key], defaultValue)) super.update({
|
|
933
|
+
...this.state,
|
|
934
|
+
[key]: defaultValue
|
|
935
|
+
});
|
|
936
|
+
}
|
|
937
|
+
useIsoLayoutEffect(() => {
|
|
938
|
+
if (isControlled && !Object.is(this.state[key], controlled)) super.update({
|
|
939
|
+
...this.state,
|
|
940
|
+
[key]: controlled
|
|
941
|
+
});
|
|
942
|
+
}, [
|
|
943
|
+
key,
|
|
944
|
+
controlled,
|
|
945
|
+
defaultValue,
|
|
946
|
+
isControlled
|
|
947
|
+
]);
|
|
948
|
+
}
|
|
949
|
+
/**
|
|
950
|
+
* Sets a specific key in the store's state to a new value and notifies listeners if the value has changed.
|
|
951
|
+
* If the key is controlled (registered via {@link useControlledProp} with a non-undefined value),
|
|
952
|
+
* the update is ignored and no listeners are notified.
|
|
953
|
+
*
|
|
954
|
+
* @param key The state key to update.
|
|
955
|
+
* @param value The new value to set for the specified key.
|
|
956
|
+
*/
|
|
957
|
+
set(key, value) {
|
|
958
|
+
if (this.controlledValues.get(key) === true) return;
|
|
959
|
+
super.set(key, value);
|
|
960
|
+
}
|
|
961
|
+
/**
|
|
962
|
+
* Merges the provided changes into the current state and notifies listeners if there are changes.
|
|
963
|
+
* Controlled keys are filtered out and not updated.
|
|
964
|
+
*
|
|
965
|
+
* @param values An object containing the changes to apply to the current state.
|
|
966
|
+
*/
|
|
967
|
+
apply(values) {
|
|
968
|
+
const newValues = { ...values };
|
|
969
|
+
for (const key in newValues) if (this.controlledValues.get(key) === true) delete newValues[key];
|
|
970
|
+
super.apply(newValues);
|
|
971
|
+
}
|
|
972
|
+
/**
|
|
973
|
+
* Updates the entire store's state and notifies all registered listeners.
|
|
974
|
+
* Controlled keys are left unchanged; only uncontrolled keys from `newState` are applied.
|
|
975
|
+
*
|
|
976
|
+
* @param newState The new state to set for the store.
|
|
977
|
+
*/
|
|
978
|
+
update(newState) {
|
|
979
|
+
const newValues = { ...newState };
|
|
980
|
+
for (const key in newValues) if (this.controlledValues.get(key) === true) delete newValues[key];
|
|
981
|
+
super.update({
|
|
982
|
+
...this.state,
|
|
983
|
+
...newValues
|
|
984
|
+
});
|
|
985
|
+
}
|
|
986
|
+
/**
|
|
987
|
+
* Returns a value from the store's state using a selector function.
|
|
988
|
+
* Used to subscribe to specific parts of the state.
|
|
989
|
+
* This methods causes a rerender whenever the selected state changes.
|
|
990
|
+
*
|
|
991
|
+
* @param key Key of the selector to use.
|
|
992
|
+
*/
|
|
993
|
+
useState(key) {
|
|
994
|
+
if (!this.selectors) throw new Error("Base UI: selectors are required to call useState.");
|
|
995
|
+
return useStore(this, this.selectors[key]);
|
|
996
|
+
}
|
|
997
|
+
/**
|
|
998
|
+
* Wraps a function with `useEventCallback` to ensure it has a stable reference
|
|
999
|
+
* and assigns it to the context.
|
|
1000
|
+
*
|
|
1001
|
+
* @param key Key of the event callback. Must be a function in the context.
|
|
1002
|
+
* @param fn Function to assign.
|
|
1003
|
+
*/
|
|
1004
|
+
useContextCallback(key, fn) {
|
|
1005
|
+
const stableFunction = useEventCallback(fn !== null && fn !== void 0 ? fn : NOOP);
|
|
1006
|
+
this.context[key] = stableFunction;
|
|
1007
|
+
}
|
|
1008
|
+
/**
|
|
1009
|
+
* Returns a stable setter function for a specific key in the store's state.
|
|
1010
|
+
* It's commonly used to pass as a ref callback to React elements.
|
|
1011
|
+
* @param key Key of the state to set.
|
|
1012
|
+
*/
|
|
1013
|
+
getElementSetter(key) {
|
|
1014
|
+
return React$1.useCallback((element) => {
|
|
1015
|
+
this.set(key, element);
|
|
1016
|
+
}, [key]);
|
|
1017
|
+
}
|
|
1018
|
+
};
|
|
1019
|
+
//#endregion
|
|
1020
|
+
//#region ../../node_modules/@base-ui-components/react/esm/dialog/store.js
|
|
1021
|
+
var selectors = {
|
|
1022
|
+
open: createSelector((state) => state.open),
|
|
1023
|
+
modal: createSelector((state) => state.modal),
|
|
1024
|
+
nested: createSelector((state) => state.nested),
|
|
1025
|
+
nestedOpenDialogCount: createSelector((state) => state.nestedOpenDialogCount),
|
|
1026
|
+
dismissible: createSelector((state) => state.dismissible),
|
|
1027
|
+
openMethod: createSelector((state) => state.openMethod),
|
|
1028
|
+
descriptionElementId: createSelector((state) => state.descriptionElementId),
|
|
1029
|
+
titleElementId: createSelector((state) => state.titleElementId),
|
|
1030
|
+
mounted: createSelector((state) => state.mounted),
|
|
1031
|
+
transitionStatus: createSelector((state) => state.transitionStatus),
|
|
1032
|
+
triggerProps: createSelector((state) => state.triggerProps),
|
|
1033
|
+
popupProps: createSelector((state) => state.popupProps),
|
|
1034
|
+
floatingRootContext: createSelector((state) => state.floatingRootContext),
|
|
1035
|
+
popupElement: createSelector((state) => state.popupElement),
|
|
1036
|
+
triggerElement: createSelector((state) => state.triggerElement)
|
|
1037
|
+
};
|
|
1038
|
+
var DialogStore = class DialogStore extends ReactStore {
|
|
1039
|
+
constructor(..._args) {
|
|
1040
|
+
super(..._args);
|
|
1041
|
+
_defineProperty(this, "setOpen", (nextOpen, eventDetails) => {
|
|
1042
|
+
var _this$context$openCha, _this$context, _this$state$floatingR;
|
|
1043
|
+
(_this$context$openCha = (_this$context = this.context).openChange) === null || _this$context$openCha === void 0 || _this$context$openCha.call(_this$context, nextOpen, eventDetails);
|
|
1044
|
+
if (eventDetails.isCanceled) return;
|
|
1045
|
+
const details = {
|
|
1046
|
+
open: nextOpen,
|
|
1047
|
+
nativeEvent: eventDetails.event,
|
|
1048
|
+
reason: eventDetails.reason,
|
|
1049
|
+
nested: this.state.nested
|
|
1050
|
+
};
|
|
1051
|
+
(_this$state$floatingR = this.state.floatingRootContext.events) === null || _this$state$floatingR === void 0 || _this$state$floatingR.emit("openchange", details);
|
|
1052
|
+
this.set("open", nextOpen);
|
|
1053
|
+
});
|
|
1054
|
+
}
|
|
1055
|
+
static create(initialState) {
|
|
1056
|
+
return new DialogStore(initialState, {
|
|
1057
|
+
popupRef: /* @__PURE__ */ React$1.createRef(),
|
|
1058
|
+
backdropRef: /* @__PURE__ */ React$1.createRef(),
|
|
1059
|
+
internalBackdropRef: /* @__PURE__ */ React$1.createRef()
|
|
1060
|
+
}, selectors);
|
|
1061
|
+
}
|
|
1062
|
+
};
|
|
1063
|
+
//#endregion
|
|
1064
|
+
export { useDialogRoot as n, DialogStore as t };
|