@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,350 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import * as React from "react";
|
|
3
|
-
import { jsx } from "react/jsx-runtime";
|
|
4
|
-
const UNINITIALIZED = {};
|
|
5
|
-
function useRefWithInit(init, initArg) {
|
|
6
|
-
const ref = React.useRef(UNINITIALIZED);
|
|
7
|
-
if (ref.current === UNINITIALIZED) {
|
|
8
|
-
ref.current = init(initArg);
|
|
9
|
-
}
|
|
10
|
-
return ref;
|
|
11
|
-
}
|
|
12
|
-
function NOOP() {
|
|
13
|
-
}
|
|
14
|
-
const EMPTY_ARRAY = Object.freeze([]);
|
|
15
|
-
const EMPTY_OBJECT = Object.freeze({});
|
|
16
|
-
function useMergedRefs(a, b, c, d) {
|
|
17
|
-
const forkRef = useRefWithInit(createForkRef).current;
|
|
18
|
-
if (didChange(forkRef, a, b, c, d)) {
|
|
19
|
-
update(forkRef, [a, b, c, d]);
|
|
20
|
-
}
|
|
21
|
-
return forkRef.callback;
|
|
22
|
-
}
|
|
23
|
-
function useMergedRefsN(refs) {
|
|
24
|
-
const forkRef = useRefWithInit(createForkRef).current;
|
|
25
|
-
if (didChangeN(forkRef, refs)) {
|
|
26
|
-
update(forkRef, refs);
|
|
27
|
-
}
|
|
28
|
-
return forkRef.callback;
|
|
29
|
-
}
|
|
30
|
-
function createForkRef() {
|
|
31
|
-
return {
|
|
32
|
-
callback: null,
|
|
33
|
-
cleanup: null,
|
|
34
|
-
refs: []
|
|
35
|
-
};
|
|
36
|
-
}
|
|
37
|
-
function didChange(forkRef, a, b, c, d) {
|
|
38
|
-
return forkRef.refs[0] !== a || forkRef.refs[1] !== b || forkRef.refs[2] !== c || forkRef.refs[3] !== d;
|
|
39
|
-
}
|
|
40
|
-
function didChangeN(forkRef, newRefs) {
|
|
41
|
-
return forkRef.refs.length !== newRefs.length || forkRef.refs.some((ref, index) => ref !== newRefs[index]);
|
|
42
|
-
}
|
|
43
|
-
function update(forkRef, refs) {
|
|
44
|
-
forkRef.refs = refs;
|
|
45
|
-
if (refs.every((ref) => ref == null)) {
|
|
46
|
-
forkRef.callback = null;
|
|
47
|
-
return;
|
|
48
|
-
}
|
|
49
|
-
forkRef.callback = (instance) => {
|
|
50
|
-
if (forkRef.cleanup) {
|
|
51
|
-
forkRef.cleanup();
|
|
52
|
-
forkRef.cleanup = null;
|
|
53
|
-
}
|
|
54
|
-
if (instance != null) {
|
|
55
|
-
const cleanupCallbacks = Array(refs.length).fill(null);
|
|
56
|
-
for (let i = 0; i < refs.length; i += 1) {
|
|
57
|
-
const ref = refs[i];
|
|
58
|
-
if (ref == null) {
|
|
59
|
-
continue;
|
|
60
|
-
}
|
|
61
|
-
switch (typeof ref) {
|
|
62
|
-
case "function": {
|
|
63
|
-
const refCleanup = ref(instance);
|
|
64
|
-
if (typeof refCleanup === "function") {
|
|
65
|
-
cleanupCallbacks[i] = refCleanup;
|
|
66
|
-
}
|
|
67
|
-
break;
|
|
68
|
-
}
|
|
69
|
-
case "object": {
|
|
70
|
-
ref.current = instance;
|
|
71
|
-
break;
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
forkRef.cleanup = () => {
|
|
76
|
-
for (let i = 0; i < refs.length; i += 1) {
|
|
77
|
-
const ref = refs[i];
|
|
78
|
-
if (ref == null) {
|
|
79
|
-
continue;
|
|
80
|
-
}
|
|
81
|
-
switch (typeof ref) {
|
|
82
|
-
case "function": {
|
|
83
|
-
const cleanupCallback = cleanupCallbacks[i];
|
|
84
|
-
if (typeof cleanupCallback === "function") {
|
|
85
|
-
cleanupCallback();
|
|
86
|
-
} else {
|
|
87
|
-
ref(null);
|
|
88
|
-
}
|
|
89
|
-
break;
|
|
90
|
-
}
|
|
91
|
-
case "object": {
|
|
92
|
-
ref.current = null;
|
|
93
|
-
break;
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
};
|
|
98
|
-
}
|
|
99
|
-
};
|
|
100
|
-
}
|
|
101
|
-
const majorVersion = parseInt(React.version, 10);
|
|
102
|
-
function isReactVersionAtLeast(reactVersionToCheck) {
|
|
103
|
-
return majorVersion >= reactVersionToCheck;
|
|
104
|
-
}
|
|
105
|
-
function mergeObjects(a, b) {
|
|
106
|
-
if (a && !b) {
|
|
107
|
-
return a;
|
|
108
|
-
}
|
|
109
|
-
if (!a && b) {
|
|
110
|
-
return b;
|
|
111
|
-
}
|
|
112
|
-
if (a || b) {
|
|
113
|
-
return {
|
|
114
|
-
...a,
|
|
115
|
-
...b
|
|
116
|
-
};
|
|
117
|
-
}
|
|
118
|
-
return void 0;
|
|
119
|
-
}
|
|
120
|
-
function getStateAttributesProps(state, customMapping) {
|
|
121
|
-
const props = {};
|
|
122
|
-
for (const key in state) {
|
|
123
|
-
const value = state[key];
|
|
124
|
-
if (customMapping == null ? void 0 : customMapping.hasOwnProperty(key)) {
|
|
125
|
-
const customProps = customMapping[key](value);
|
|
126
|
-
if (customProps != null) {
|
|
127
|
-
Object.assign(props, customProps);
|
|
128
|
-
}
|
|
129
|
-
continue;
|
|
130
|
-
}
|
|
131
|
-
if (value === true) {
|
|
132
|
-
props[`data-${key.toLowerCase()}`] = "";
|
|
133
|
-
} else if (value) {
|
|
134
|
-
props[`data-${key.toLowerCase()}`] = value.toString();
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
return props;
|
|
138
|
-
}
|
|
139
|
-
function resolveClassName(className, state) {
|
|
140
|
-
return typeof className === "function" ? className(state) : className;
|
|
141
|
-
}
|
|
142
|
-
const EMPTY_PROPS = {};
|
|
143
|
-
function mergeProps(a, b, c, d, e) {
|
|
144
|
-
let merged = {
|
|
145
|
-
...resolvePropsGetter(a, EMPTY_PROPS)
|
|
146
|
-
};
|
|
147
|
-
if (b) {
|
|
148
|
-
merged = mergeOne(merged, b);
|
|
149
|
-
}
|
|
150
|
-
if (c) {
|
|
151
|
-
merged = mergeOne(merged, c);
|
|
152
|
-
}
|
|
153
|
-
if (d) {
|
|
154
|
-
merged = mergeOne(merged, d);
|
|
155
|
-
}
|
|
156
|
-
return merged;
|
|
157
|
-
}
|
|
158
|
-
function mergePropsN(props) {
|
|
159
|
-
if (props.length === 0) {
|
|
160
|
-
return EMPTY_PROPS;
|
|
161
|
-
}
|
|
162
|
-
if (props.length === 1) {
|
|
163
|
-
return resolvePropsGetter(props[0], EMPTY_PROPS);
|
|
164
|
-
}
|
|
165
|
-
let merged = {
|
|
166
|
-
...resolvePropsGetter(props[0], EMPTY_PROPS)
|
|
167
|
-
};
|
|
168
|
-
for (let i = 1; i < props.length; i += 1) {
|
|
169
|
-
merged = mergeOne(merged, props[i]);
|
|
170
|
-
}
|
|
171
|
-
return merged;
|
|
172
|
-
}
|
|
173
|
-
function mergeOne(merged, inputProps) {
|
|
174
|
-
if (isPropsGetter(inputProps)) {
|
|
175
|
-
return inputProps(merged);
|
|
176
|
-
}
|
|
177
|
-
return mutablyMergeInto(merged, inputProps);
|
|
178
|
-
}
|
|
179
|
-
function mutablyMergeInto(mergedProps, externalProps) {
|
|
180
|
-
if (!externalProps) {
|
|
181
|
-
return mergedProps;
|
|
182
|
-
}
|
|
183
|
-
for (const propName in externalProps) {
|
|
184
|
-
const externalPropValue = externalProps[propName];
|
|
185
|
-
switch (propName) {
|
|
186
|
-
case "style": {
|
|
187
|
-
mergedProps[propName] = mergeObjects(mergedProps.style, externalPropValue);
|
|
188
|
-
break;
|
|
189
|
-
}
|
|
190
|
-
case "className": {
|
|
191
|
-
mergedProps[propName] = mergeClassNames(mergedProps.className, externalPropValue);
|
|
192
|
-
break;
|
|
193
|
-
}
|
|
194
|
-
default: {
|
|
195
|
-
if (isEventHandler(propName, externalPropValue)) {
|
|
196
|
-
mergedProps[propName] = mergeEventHandlers(mergedProps[propName], externalPropValue);
|
|
197
|
-
} else {
|
|
198
|
-
mergedProps[propName] = externalPropValue;
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
return mergedProps;
|
|
204
|
-
}
|
|
205
|
-
function isEventHandler(key, value) {
|
|
206
|
-
const code0 = key.charCodeAt(0);
|
|
207
|
-
const code1 = key.charCodeAt(1);
|
|
208
|
-
const code2 = key.charCodeAt(2);
|
|
209
|
-
return code0 === 111 && code1 === 110 && code2 >= 65 && code2 <= 90 && (typeof value === "function" || typeof value === "undefined");
|
|
210
|
-
}
|
|
211
|
-
function isPropsGetter(inputProps) {
|
|
212
|
-
return typeof inputProps === "function";
|
|
213
|
-
}
|
|
214
|
-
function resolvePropsGetter(inputProps, previousProps) {
|
|
215
|
-
if (isPropsGetter(inputProps)) {
|
|
216
|
-
return inputProps(previousProps);
|
|
217
|
-
}
|
|
218
|
-
return inputProps != null ? inputProps : EMPTY_PROPS;
|
|
219
|
-
}
|
|
220
|
-
function mergeEventHandlers(ourHandler, theirHandler) {
|
|
221
|
-
if (!theirHandler) {
|
|
222
|
-
return ourHandler;
|
|
223
|
-
}
|
|
224
|
-
if (!ourHandler) {
|
|
225
|
-
return theirHandler;
|
|
226
|
-
}
|
|
227
|
-
return (event) => {
|
|
228
|
-
if (isSyntheticEvent(event)) {
|
|
229
|
-
const baseUIEvent = event;
|
|
230
|
-
makeEventPreventable(baseUIEvent);
|
|
231
|
-
const result2 = theirHandler(baseUIEvent);
|
|
232
|
-
if (!baseUIEvent.baseUIHandlerPrevented) {
|
|
233
|
-
ourHandler == null ? void 0 : ourHandler(baseUIEvent);
|
|
234
|
-
}
|
|
235
|
-
return result2;
|
|
236
|
-
}
|
|
237
|
-
const result = theirHandler(event);
|
|
238
|
-
ourHandler == null ? void 0 : ourHandler(event);
|
|
239
|
-
return result;
|
|
240
|
-
};
|
|
241
|
-
}
|
|
242
|
-
function makeEventPreventable(event) {
|
|
243
|
-
event.preventBaseUIHandler = () => {
|
|
244
|
-
event.baseUIHandlerPrevented = true;
|
|
245
|
-
};
|
|
246
|
-
return event;
|
|
247
|
-
}
|
|
248
|
-
function mergeClassNames(ourClassName, theirClassName) {
|
|
249
|
-
if (theirClassName) {
|
|
250
|
-
if (ourClassName) {
|
|
251
|
-
return theirClassName + " " + ourClassName;
|
|
252
|
-
}
|
|
253
|
-
return theirClassName;
|
|
254
|
-
}
|
|
255
|
-
return ourClassName;
|
|
256
|
-
}
|
|
257
|
-
function isSyntheticEvent(event) {
|
|
258
|
-
return event != null && typeof event === "object" && "nativeEvent" in event;
|
|
259
|
-
}
|
|
260
|
-
function useRenderElement(element, componentProps, params = {}) {
|
|
261
|
-
var _a;
|
|
262
|
-
const renderProp = componentProps.render;
|
|
263
|
-
const outProps = useRenderElementProps(componentProps, params);
|
|
264
|
-
if (params.enabled === false) {
|
|
265
|
-
return null;
|
|
266
|
-
}
|
|
267
|
-
const state = (_a = params.state) != null ? _a : EMPTY_OBJECT;
|
|
268
|
-
return evaluateRenderProp(element, renderProp, outProps, state);
|
|
269
|
-
}
|
|
270
|
-
function useRenderElementProps(componentProps, params = {}) {
|
|
271
|
-
var _a;
|
|
272
|
-
const {
|
|
273
|
-
className: classNameProp,
|
|
274
|
-
render: renderProp
|
|
275
|
-
} = componentProps;
|
|
276
|
-
const {
|
|
277
|
-
state = EMPTY_OBJECT,
|
|
278
|
-
ref,
|
|
279
|
-
props,
|
|
280
|
-
stateAttributesMapping,
|
|
281
|
-
enabled = true
|
|
282
|
-
} = params;
|
|
283
|
-
const className = enabled ? resolveClassName(classNameProp, state) : void 0;
|
|
284
|
-
const stateProps = enabled ? getStateAttributesProps(state, stateAttributesMapping) : EMPTY_OBJECT;
|
|
285
|
-
const outProps = enabled ? (_a = mergeObjects(stateProps, Array.isArray(props) ? mergePropsN(props) : props)) != null ? _a : EMPTY_OBJECT : EMPTY_OBJECT;
|
|
286
|
-
if (typeof document !== "undefined") {
|
|
287
|
-
if (!enabled) {
|
|
288
|
-
useMergedRefs(null, null);
|
|
289
|
-
} else if (Array.isArray(ref)) {
|
|
290
|
-
outProps.ref = useMergedRefsN([outProps.ref, getChildRef(renderProp), ...ref]);
|
|
291
|
-
} else {
|
|
292
|
-
outProps.ref = useMergedRefs(outProps.ref, getChildRef(renderProp), ref);
|
|
293
|
-
}
|
|
294
|
-
}
|
|
295
|
-
if (!enabled) {
|
|
296
|
-
return EMPTY_OBJECT;
|
|
297
|
-
}
|
|
298
|
-
if (className !== void 0) {
|
|
299
|
-
outProps.className = mergeClassNames(outProps.className, className);
|
|
300
|
-
}
|
|
301
|
-
return outProps;
|
|
302
|
-
}
|
|
303
|
-
function evaluateRenderProp(element, render, props, state) {
|
|
304
|
-
if (render) {
|
|
305
|
-
if (typeof render === "function") {
|
|
306
|
-
return render(props, state);
|
|
307
|
-
}
|
|
308
|
-
const mergedProps = mergeProps(props, render.props);
|
|
309
|
-
mergedProps.ref = props.ref;
|
|
310
|
-
return /* @__PURE__ */ React.cloneElement(render, mergedProps);
|
|
311
|
-
}
|
|
312
|
-
if (element) {
|
|
313
|
-
if (typeof element === "string") {
|
|
314
|
-
return renderTag(element, props);
|
|
315
|
-
}
|
|
316
|
-
}
|
|
317
|
-
throw new Error("Base UI: Render element or function are not defined.");
|
|
318
|
-
}
|
|
319
|
-
function renderTag(Tag, props) {
|
|
320
|
-
if (Tag === "button") {
|
|
321
|
-
return /* @__PURE__ */ jsx("button", {
|
|
322
|
-
type: "button",
|
|
323
|
-
...props
|
|
324
|
-
});
|
|
325
|
-
}
|
|
326
|
-
if (Tag === "img") {
|
|
327
|
-
return /* @__PURE__ */ jsx("img", {
|
|
328
|
-
alt: "",
|
|
329
|
-
...props
|
|
330
|
-
});
|
|
331
|
-
}
|
|
332
|
-
return /* @__PURE__ */ React.createElement(Tag, props);
|
|
333
|
-
}
|
|
334
|
-
function getChildRef(render) {
|
|
335
|
-
if (render && typeof render !== "function") {
|
|
336
|
-
return isReactVersionAtLeast(19) ? render.props.ref : render.ref;
|
|
337
|
-
}
|
|
338
|
-
return null;
|
|
339
|
-
}
|
|
340
|
-
export {
|
|
341
|
-
EMPTY_OBJECT as E,
|
|
342
|
-
NOOP as N,
|
|
343
|
-
makeEventPreventable as a,
|
|
344
|
-
useRefWithInit as b,
|
|
345
|
-
useMergedRefs as c,
|
|
346
|
-
EMPTY_ARRAY as d,
|
|
347
|
-
isReactVersionAtLeast as i,
|
|
348
|
-
mergeProps as m,
|
|
349
|
-
useRenderElement as u
|
|
350
|
-
};
|