@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,124 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { t as Icon } from "./Icon-CixAeOSd.js";
|
|
3
|
+
import { t as require_jsx_runtime } from "./jsx-runtime-i4KUlhDu.js";
|
|
4
|
+
import { t as ForwardRef$1 } from "./TokyoUIChevronDown-DGcVqR1z.js";
|
|
5
|
+
import { useBreakpointMatch } from "./components/SelectField/hooks/useBreakpointMatch.js";
|
|
6
|
+
import * as React$1 from "react";
|
|
7
|
+
import { forwardRef, useState } from "react";
|
|
8
|
+
import { getDatasetProps } from "@preply/ds-web-core";
|
|
9
|
+
import { webComponentNames } from "@preply/ds-visual-coverage-preply-component-names";
|
|
10
|
+
import { usePortalElement } from "@preply/ds-web-root";
|
|
11
|
+
import { Select } from "radix-ui";
|
|
12
|
+
import './assets/Select.css';//#region ../media-icons/dist/24/TokyoUICheckmark.svg
|
|
13
|
+
var SvgTokyoUiCheckmark = ({ title, titleId, ...props }, ref) => /* @__PURE__ */ React$1.createElement("svg", {
|
|
14
|
+
"data-preply-ds-component": "SvgTokyoUIIcon",
|
|
15
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
16
|
+
viewBox: "0 0 24 24",
|
|
17
|
+
ref,
|
|
18
|
+
"aria-labelledby": titleId,
|
|
19
|
+
...props
|
|
20
|
+
}, title ? /* @__PURE__ */ React$1.createElement("title", { id: titleId }, title) : null, /* @__PURE__ */ React$1.createElement("path", {
|
|
21
|
+
fillRule: "evenodd",
|
|
22
|
+
d: "M8.707 18 4 13.293l1.414-1.414 3.293 3.293L18 5.879l1.414 1.414L8.707 18Z",
|
|
23
|
+
clipRule: "evenodd"
|
|
24
|
+
}));
|
|
25
|
+
var ForwardRef = forwardRef(SvgTokyoUiCheckmark);
|
|
26
|
+
var SelectField_module_default = {
|
|
27
|
+
trigger: "trigger__e7qqO",
|
|
28
|
+
chevron: "chevron__jR5Zn",
|
|
29
|
+
content: "content__NwpTO",
|
|
30
|
+
viewport: "viewport__SgLBh",
|
|
31
|
+
item: "item__iOFtY",
|
|
32
|
+
indicator: "indicator__FesN8",
|
|
33
|
+
group: "group__rZ-2W",
|
|
34
|
+
groupLabel: "groupLabel__fC3jF",
|
|
35
|
+
"mobile-content-show": "mobile-content-show__KWt2y",
|
|
36
|
+
"mobile-content-hide": "mobile-content-hide__RbAVZ",
|
|
37
|
+
"fade-in": "fade-in__KIt7M",
|
|
38
|
+
"fade-out": "fade-out__zj-by"
|
|
39
|
+
};
|
|
40
|
+
//#endregion
|
|
41
|
+
//#region src/components/SelectField/Select.tsx
|
|
42
|
+
var import_jsx_runtime = require_jsx_runtime();
|
|
43
|
+
var Select$1 = forwardRef(function Select$2({ value, defaultValue, placeholder, disabled, onValueChange, children, dataset, icon, name, id, required, onFocus, onBlur, onKeyDown, onKeyUp, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledby, "aria-describedby": ariaDescribedby, "aria-invalid": ariaInvalid, "aria-errormessage": ariaErrorMessage }, ref) {
|
|
44
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
45
|
+
const portalElement = usePortalElement();
|
|
46
|
+
const datasetProps = getDatasetProps(dataset, { preplyDsComponent: webComponentNames.Select });
|
|
47
|
+
const isPopover = useBreakpointMatch("medium-s");
|
|
48
|
+
const handleValueChange = (newValue) => {
|
|
49
|
+
onValueChange === null || onValueChange === void 0 || onValueChange(newValue);
|
|
50
|
+
};
|
|
51
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Select.Root, {
|
|
52
|
+
value,
|
|
53
|
+
defaultValue,
|
|
54
|
+
onValueChange: handleValueChange,
|
|
55
|
+
disabled,
|
|
56
|
+
name,
|
|
57
|
+
open: isOpen,
|
|
58
|
+
onOpenChange: setIsOpen,
|
|
59
|
+
required,
|
|
60
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Select.Trigger, {
|
|
61
|
+
ref,
|
|
62
|
+
id,
|
|
63
|
+
className: SelectField_module_default.trigger,
|
|
64
|
+
onFocus,
|
|
65
|
+
onBlur,
|
|
66
|
+
onKeyDown,
|
|
67
|
+
onKeyUp,
|
|
68
|
+
"aria-label": ariaLabel,
|
|
69
|
+
"aria-labelledby": ariaLabelledby,
|
|
70
|
+
"aria-describedby": ariaDescribedby,
|
|
71
|
+
"aria-invalid": ariaInvalid,
|
|
72
|
+
"aria-errormessage": ariaErrorMessage,
|
|
73
|
+
...datasetProps,
|
|
74
|
+
children: [
|
|
75
|
+
icon,
|
|
76
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Select.Value, { placeholder }),
|
|
77
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Select.Icon, {
|
|
78
|
+
className: SelectField_module_default.chevron,
|
|
79
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Icon, { svg: ForwardRef$1 })
|
|
80
|
+
})
|
|
81
|
+
]
|
|
82
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Select.Portal, {
|
|
83
|
+
container: portalElement,
|
|
84
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Select.Content, {
|
|
85
|
+
position: isPopover ? "popper" : void 0,
|
|
86
|
+
sideOffset: isPopover ? 5 : void 0,
|
|
87
|
+
className: SelectField_module_default.content,
|
|
88
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Select.Viewport, {
|
|
89
|
+
className: SelectField_module_default.viewport,
|
|
90
|
+
role: "group",
|
|
91
|
+
tabIndex: 0,
|
|
92
|
+
children
|
|
93
|
+
})
|
|
94
|
+
})
|
|
95
|
+
})]
|
|
96
|
+
});
|
|
97
|
+
});
|
|
98
|
+
function SelectOption({ value, disabled, children, leadingIcon, dataset }) {
|
|
99
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Select.Item, {
|
|
100
|
+
value,
|
|
101
|
+
disabled,
|
|
102
|
+
className: SelectField_module_default.item,
|
|
103
|
+
...getDatasetProps(dataset, { preplyDsComponent: webComponentNames.SelectFieldOption }),
|
|
104
|
+
children: [
|
|
105
|
+
leadingIcon,
|
|
106
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Select.ItemText, { children }),
|
|
107
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Select.ItemIndicator, {
|
|
108
|
+
className: SelectField_module_default.indicator,
|
|
109
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Icon, { svg: ForwardRef })
|
|
110
|
+
})
|
|
111
|
+
]
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
function SelectGroup({ children, label }) {
|
|
115
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Select.Group, {
|
|
116
|
+
className: SelectField_module_default.group,
|
|
117
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Select.Label, {
|
|
118
|
+
className: SelectField_module_default.groupLabel,
|
|
119
|
+
children: label
|
|
120
|
+
}), children]
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
//#endregion
|
|
124
|
+
export { SelectGroup as n, SelectOption as r, Select$1 as t };
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { t as require_jsx_runtime } from "./jsx-runtime-i4KUlhDu.js";
|
|
3
|
+
import { forwardRef } from "react";
|
|
4
|
+
import { getDatasetProps } from "@preply/ds-web-core";
|
|
5
|
+
import { webComponentNames } from "@preply/ds-visual-coverage-preply-component-names";
|
|
6
|
+
import { Slider } from "radix-ui";
|
|
7
|
+
import './assets/Slider.css';var Slider_module_default = {
|
|
8
|
+
root: "root__QwW3E",
|
|
9
|
+
track: "track__iifdu",
|
|
10
|
+
range: "range__ZdmUh",
|
|
11
|
+
thumb: "thumb__7W7O-"
|
|
12
|
+
};
|
|
13
|
+
//#endregion
|
|
14
|
+
//#region src/components/Slider/Slider.tsx
|
|
15
|
+
var import_jsx_runtime = require_jsx_runtime();
|
|
16
|
+
function filterThumbProps(props) {
|
|
17
|
+
const thumbProps = {};
|
|
18
|
+
Object.entries(props).forEach(([key, value]) => {
|
|
19
|
+
switch (key) {
|
|
20
|
+
case "id":
|
|
21
|
+
case "aria-label":
|
|
22
|
+
case "aria-labelledby":
|
|
23
|
+
case "aria-describedby":
|
|
24
|
+
case "aria-invalid":
|
|
25
|
+
case "aria-errormessage": thumbProps[key] = value;
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
return thumbProps;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* A slider input that allows users to select a single value from a range.
|
|
32
|
+
*
|
|
33
|
+
* @example Uncontrolled
|
|
34
|
+
* <Slider />
|
|
35
|
+
* <Slider defaultValue={50} />
|
|
36
|
+
*
|
|
37
|
+
* @example Controlled
|
|
38
|
+
* const [value, setValue] = useState(50)
|
|
39
|
+
* <Slider value={value} onValueChange={setValue} />
|
|
40
|
+
*/
|
|
41
|
+
var Slider$1 = forwardRef(function Slider$2({ value, defaultValue = 0, onValueChange, min = 0, max = 100, step = 1, dataset, ...thumbProps }, ref) {
|
|
42
|
+
const datasetProps = getDatasetProps(dataset, { preplyDsComponent: webComponentNames.Slider });
|
|
43
|
+
const handleValueChange = onValueChange ? (newValue) => onValueChange(newValue[0]) : void 0;
|
|
44
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Slider.Root, {
|
|
45
|
+
ref,
|
|
46
|
+
...datasetProps,
|
|
47
|
+
className: Slider_module_default.root,
|
|
48
|
+
value: value !== void 0 ? [value] : void 0,
|
|
49
|
+
defaultValue: defaultValue !== void 0 ? [defaultValue] : void 0,
|
|
50
|
+
onValueChange: handleValueChange,
|
|
51
|
+
min,
|
|
52
|
+
max,
|
|
53
|
+
step,
|
|
54
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Slider.Track, {
|
|
55
|
+
className: Slider_module_default.track,
|
|
56
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Slider.Range, { className: Slider_module_default.range })
|
|
57
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Slider.Thumb, {
|
|
58
|
+
...filterThumbProps(thumbProps),
|
|
59
|
+
className: Slider_module_default.thumb
|
|
60
|
+
})]
|
|
61
|
+
});
|
|
62
|
+
});
|
|
63
|
+
//#endregion
|
|
64
|
+
export { filterThumbProps as n, Slider_module_default as r, Slider$1 as t };
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { t as require_jsx_runtime } from "./jsx-runtime-i4KUlhDu.js";
|
|
2
|
+
import * as React$1 from "react";
|
|
3
|
+
import { forwardRef } from "react";
|
|
4
|
+
import { moduleClassNames, moduleLocals, stringClassNames } from "@preply/ds-web-core";
|
|
5
|
+
import { SPINNER_SIZE_DEFAULT } from "@preply/ds-core";
|
|
6
|
+
import './assets/Spinner.css';//#region src/components/private/Spinner/style/index.module.less
|
|
7
|
+
var Spinner$1 = "Spinner__U3f6H";
|
|
8
|
+
var spin = "spin__6opuF";
|
|
9
|
+
var index_module_default = {
|
|
10
|
+
Spinner: Spinner$1,
|
|
11
|
+
"Spinner--size-default": "Spinner--size-default__xo-Jk",
|
|
12
|
+
"Spinner--size-large": "Spinner--size-large__2nk5J",
|
|
13
|
+
"Spinner--narrow-l--size-default": "Spinner--narrow-l--size-default__gRrq1",
|
|
14
|
+
"Spinner--narrow-l--size-large": "Spinner--narrow-l--size-large__6gb70",
|
|
15
|
+
"Spinner--medium-s--size-default": "Spinner--medium-s--size-default__bJg-R",
|
|
16
|
+
"Spinner--medium-s--size-large": "Spinner--medium-s--size-large__HAPhI",
|
|
17
|
+
"Spinner--medium-l--size-default": "Spinner--medium-l--size-default__AuHDV",
|
|
18
|
+
"Spinner--medium-l--size-large": "Spinner--medium-l--size-large__MlfBE",
|
|
19
|
+
"Spinner--wide-s--size-default": "Spinner--wide-s--size-default__3sTOC",
|
|
20
|
+
"Spinner--wide-s--size-large": "Spinner--wide-s--size-large__AkfHJ",
|
|
21
|
+
"Spinner--wide-l--size-default": "Spinner--wide-l--size-default__FDlfA",
|
|
22
|
+
"Spinner--wide-l--size-large": "Spinner--wide-l--size-large__Oyg7h",
|
|
23
|
+
"Spinner--static": "Spinner--static__3-otL",
|
|
24
|
+
"Spinner--animated": "Spinner--animated__K3vs3",
|
|
25
|
+
spin
|
|
26
|
+
};
|
|
27
|
+
//#endregion
|
|
28
|
+
//#region src/components/private/Spinner/svg/ellipsis.svg
|
|
29
|
+
var SvgEllipsis = ({ title, titleId, ...props }, ref) => /* @__PURE__ */ React$1.createElement("svg", {
|
|
30
|
+
viewBox: "0 0 24 24",
|
|
31
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
32
|
+
ref,
|
|
33
|
+
"aria-labelledby": titleId,
|
|
34
|
+
...props
|
|
35
|
+
}, title ? /* @__PURE__ */ React$1.createElement("title", { id: titleId }, title) : null, /* @__PURE__ */ React$1.createElement("path", {
|
|
36
|
+
fillRule: "evenodd",
|
|
37
|
+
clipRule: "evenodd",
|
|
38
|
+
d: "M3 12a2 2 0 1 1 4 0 2 2 0 0 1-4 0Zm7 0a2 2 0 1 1 4 0 2 2 0 0 1-4 0Zm9-2a2 2 0 1 0 0 4 2 2 0 0 0 0-4Z"
|
|
39
|
+
}));
|
|
40
|
+
var ForwardRef$1 = forwardRef(SvgEllipsis);
|
|
41
|
+
//#endregion
|
|
42
|
+
//#region src/components/private/Spinner/svg/spinner.svg
|
|
43
|
+
var SvgSpinner = ({ title, titleId, ...props }, ref) => /* @__PURE__ */ React$1.createElement("svg", {
|
|
44
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
45
|
+
viewBox: "0 0 32 32",
|
|
46
|
+
fill: "none",
|
|
47
|
+
ref,
|
|
48
|
+
"aria-labelledby": titleId,
|
|
49
|
+
...props
|
|
50
|
+
}, title ? /* @__PURE__ */ React$1.createElement("title", { id: titleId }, title) : null, /* @__PURE__ */ React$1.createElement("g", { clipPath: "url(#clip0_1785_4234)" }, /* @__PURE__ */ React$1.createElement("path", {
|
|
51
|
+
d: "M30 15.9996C30.0002 18.5815 29.2863 21.1132 27.9373 23.3148C26.5884 25.5163 24.6569 27.302 22.3564 28.4743C20.0559 29.6465 17.476 30.1598 14.902 29.9573C12.328 29.7548 9.86014 28.8444 7.77126 27.3269C5.68238 25.8093 4.05386 23.7436 3.06576 21.3582C2.07765 18.9728 1.76846 16.3606 2.17236 13.8104C2.57627 11.2602 3.67753 8.8714 5.35439 6.90808C7.03126 4.94475 9.2184 3.48339 11.674 2.68557",
|
|
52
|
+
strokeWidth: 3,
|
|
53
|
+
strokeLinecap: "round",
|
|
54
|
+
strokeLinejoin: "round"
|
|
55
|
+
}), /* @__PURE__ */ React$1.createElement("path", {
|
|
56
|
+
opacity: .3,
|
|
57
|
+
d: "M16 29.9996C23.732 29.9996 30 23.7316 30 15.9996C30 8.26758 23.732 1.99956 16 1.99956C8.26801 1.99956 2 8.26758 2 15.9996C2 23.7316 8.26801 29.9996 16 29.9996Z",
|
|
58
|
+
strokeWidth: 3,
|
|
59
|
+
strokeLinejoin: "round"
|
|
60
|
+
})), /* @__PURE__ */ React$1.createElement("defs", null, /* @__PURE__ */ React$1.createElement("clipPath", { id: "clip0_1785_4234" }, /* @__PURE__ */ React$1.createElement("rect", {
|
|
61
|
+
width: 32,
|
|
62
|
+
height: 32,
|
|
63
|
+
fill: "white"
|
|
64
|
+
}))));
|
|
65
|
+
var ForwardRef = forwardRef(SvgSpinner);
|
|
66
|
+
//#endregion
|
|
67
|
+
//#region src/components/private/Spinner/Spinner.tsx
|
|
68
|
+
var import_jsx_runtime = require_jsx_runtime();
|
|
69
|
+
var SPINNER = "Spinner";
|
|
70
|
+
var Spinner = ({ size = SPINNER_SIZE_DEFAULT }) => {
|
|
71
|
+
const classNames = moduleClassNames(index_module_default, SPINNER, [stringClassNames("size", size)]);
|
|
72
|
+
const animatedClassNames = [...moduleLocals(index_module_default, SPINNER, ["animated"])];
|
|
73
|
+
const staticClassNames = [...moduleLocals(index_module_default, SPINNER, ["static"])];
|
|
74
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
|
|
75
|
+
className: classNames.join(" "),
|
|
76
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
77
|
+
className: animatedClassNames.join(" "),
|
|
78
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ForwardRef, {})
|
|
79
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
80
|
+
className: staticClassNames.join(" "),
|
|
81
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ForwardRef$1, {})
|
|
82
|
+
})]
|
|
83
|
+
});
|
|
84
|
+
};
|
|
85
|
+
//#endregion
|
|
86
|
+
export { Spinner as t };
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { t as renderIcon } from "./render-icon-Ch3b2dE0.js";
|
|
2
|
+
import { t as require_jsx_runtime } from "./jsx-runtime-i4KUlhDu.js";
|
|
3
|
+
import "react";
|
|
4
|
+
import StarIcon from "@preply/ds-media-icons/dist/24/TokyoUIStar.svg";
|
|
5
|
+
import StarFilledIcon from "@preply/ds-media-icons/dist/24/TokyoUIStarFilled.svg";
|
|
6
|
+
import './assets/Stars.css';//#region src/components/Rating/style/index.module.less
|
|
7
|
+
var rating = "rating__Le8xf";
|
|
8
|
+
var ratingInput = "ratingInput__aOeLl";
|
|
9
|
+
var stars = "stars__7wYnu";
|
|
10
|
+
var index_module_default = {
|
|
11
|
+
rating,
|
|
12
|
+
"rating--size-small": "rating--size-small__mIdaG",
|
|
13
|
+
"rating--size-medium": "rating--size-medium__2tNG2",
|
|
14
|
+
"rating--size-large": "rating--size-large__tZXTm",
|
|
15
|
+
"rating--narrow-l--size-small": "rating--narrow-l--size-small__nDn-T",
|
|
16
|
+
"rating--narrow-l--size-medium": "rating--narrow-l--size-medium__Vfex3",
|
|
17
|
+
"rating--narrow-l--size-large": "rating--narrow-l--size-large__YVlZT",
|
|
18
|
+
"rating--medium-s--size-small": "rating--medium-s--size-small__tDVGz",
|
|
19
|
+
"rating--medium-s--size-medium": "rating--medium-s--size-medium__m53Rx",
|
|
20
|
+
"rating--medium-s--size-large": "rating--medium-s--size-large__QaGl7",
|
|
21
|
+
"rating--medium-l--size-small": "rating--medium-l--size-small__6rJT2",
|
|
22
|
+
"rating--medium-l--size-medium": "rating--medium-l--size-medium__PPIhH",
|
|
23
|
+
"rating--medium-l--size-large": "rating--medium-l--size-large__WIjDu",
|
|
24
|
+
"rating--wide-s--size-small": "rating--wide-s--size-small__8ulej",
|
|
25
|
+
"rating--wide-s--size-medium": "rating--wide-s--size-medium__2FRMh",
|
|
26
|
+
"rating--wide-s--size-large": "rating--wide-s--size-large__mc81k",
|
|
27
|
+
"rating--wide-l--size-small": "rating--wide-l--size-small__JpDLa",
|
|
28
|
+
"rating--wide-l--size-medium": "rating--wide-l--size-medium__WvAyR",
|
|
29
|
+
"rating--wide-l--size-large": "rating--wide-l--size-large__VXvoH",
|
|
30
|
+
ratingInput,
|
|
31
|
+
stars,
|
|
32
|
+
"ratingInput--dsInternalSimulation-hover": "ratingInput--dsInternalSimulation-hover__YfddP",
|
|
33
|
+
"focus-style": "focus-style__SSYAT",
|
|
34
|
+
"ratingInput--dsInternalSimulation-focus": "ratingInput--dsInternalSimulation-focus__18rP3"
|
|
35
|
+
};
|
|
36
|
+
//#endregion
|
|
37
|
+
//#region src/components/Rating/Stars.tsx
|
|
38
|
+
var import_jsx_runtime = require_jsx_runtime();
|
|
39
|
+
function FilledStars({ filledPerc }) {
|
|
40
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
41
|
+
"data-filled": "true",
|
|
42
|
+
style: { width: `${filledPerc * 100}%` },
|
|
43
|
+
children: [
|
|
44
|
+
renderIcon(StarFilledIcon),
|
|
45
|
+
renderIcon(StarFilledIcon),
|
|
46
|
+
renderIcon(StarFilledIcon),
|
|
47
|
+
renderIcon(StarFilledIcon),
|
|
48
|
+
renderIcon(StarFilledIcon)
|
|
49
|
+
]
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
function EmptyStars() {
|
|
53
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
54
|
+
"data-filled": "false",
|
|
55
|
+
children: [
|
|
56
|
+
renderIcon(StarIcon),
|
|
57
|
+
renderIcon(StarIcon),
|
|
58
|
+
renderIcon(StarIcon),
|
|
59
|
+
renderIcon(StarIcon),
|
|
60
|
+
renderIcon(StarIcon)
|
|
61
|
+
]
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
function Stars({ filledPerc }) {
|
|
65
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
66
|
+
className: index_module_default.stars,
|
|
67
|
+
"aria-hidden": "true",
|
|
68
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(FilledStars, { filledPerc }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(EmptyStars, {})]
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
//#endregion
|
|
72
|
+
export { index_module_default as n, Stars as t };
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { t as require_jsx_runtime } from "./jsx-runtime-i4KUlhDu.js";
|
|
3
|
+
import { t as Text } from "./Text-CaOF75Z-.js";
|
|
4
|
+
import { t as Heading } from "./Heading-DA9gHfsx.js";
|
|
5
|
+
import { t as Button } from "./Button-C35BZJZT.js";
|
|
6
|
+
import { t as ProgressSteps } from "./ProgressSteps-BSqopxqv.js";
|
|
7
|
+
import { createContext, forwardRef, isValidElement, useContext, useId, useState } from "react";
|
|
8
|
+
import { getDatasetProps } from "@preply/ds-web-core";
|
|
9
|
+
import { webComponentNames } from "@preply/ds-visual-coverage-preply-component-names";
|
|
10
|
+
import { FormattedMessage } from "react-intl";
|
|
11
|
+
import './assets/Steps.css';var Steps_module_default = {
|
|
12
|
+
steps: "steps__BxrkC",
|
|
13
|
+
header: "header__HFxfM"
|
|
14
|
+
};
|
|
15
|
+
//#endregion
|
|
16
|
+
//#region src/components/Steps/Steps.tsx
|
|
17
|
+
var import_jsx_runtime = require_jsx_runtime();
|
|
18
|
+
var StepsContext = createContext(void 0);
|
|
19
|
+
var useStepsContext = () => {
|
|
20
|
+
const context = useContext(StepsContext);
|
|
21
|
+
if (context === void 0) throw new Error("Steps navigation components must be used within a Steps component");
|
|
22
|
+
return context || {};
|
|
23
|
+
};
|
|
24
|
+
var StepsPrevious = forwardRef(function StepsPrevious({ onClick, disabled, variant = "ghost", ...props }, ref) {
|
|
25
|
+
const { goToPreviousStep, currentStep, isNavigating, contentId } = useStepsContext();
|
|
26
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, {
|
|
27
|
+
...props,
|
|
28
|
+
ref,
|
|
29
|
+
size: "medium",
|
|
30
|
+
variant,
|
|
31
|
+
onClick: (e) => {
|
|
32
|
+
onClick === null || onClick === void 0 || onClick(e);
|
|
33
|
+
if (e.defaultPrevented) return;
|
|
34
|
+
goToPreviousStep();
|
|
35
|
+
},
|
|
36
|
+
disabled: currentStep === 1 || isNavigating || disabled,
|
|
37
|
+
"aria-controls": contentId,
|
|
38
|
+
children: props.children || /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FormattedMessage, {
|
|
39
|
+
id: "preply-ds.steps.previous",
|
|
40
|
+
defaultMessage: "Previous",
|
|
41
|
+
description: "Button used to navigate to the previous step"
|
|
42
|
+
})
|
|
43
|
+
});
|
|
44
|
+
});
|
|
45
|
+
var StepsNext = forwardRef(function StepsNext({ onClick, disabled, variant = "primary", ...props }, ref) {
|
|
46
|
+
const { goToNextStep, currentStep, totalSteps, isNavigating, contentId } = useStepsContext();
|
|
47
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, {
|
|
48
|
+
...props,
|
|
49
|
+
ref,
|
|
50
|
+
size: "medium",
|
|
51
|
+
variant,
|
|
52
|
+
onClick: (e) => {
|
|
53
|
+
onClick === null || onClick === void 0 || onClick(e);
|
|
54
|
+
if (e.defaultPrevented) return;
|
|
55
|
+
goToNextStep();
|
|
56
|
+
},
|
|
57
|
+
disabled: currentStep === totalSteps || isNavigating || disabled,
|
|
58
|
+
"aria-controls": contentId,
|
|
59
|
+
children: props.children || /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FormattedMessage, {
|
|
60
|
+
id: "preply-ds.steps.next",
|
|
61
|
+
defaultMessage: "Next",
|
|
62
|
+
description: "Button used to navigate to the next step"
|
|
63
|
+
})
|
|
64
|
+
});
|
|
65
|
+
});
|
|
66
|
+
var StepsComponent = ({ children, "aria-label": ariaLabel, initialStep = 1, onStepChange, dataset }) => {
|
|
67
|
+
const contentId = useId();
|
|
68
|
+
const [currentStep, setCurrentStep] = useState(initialStep);
|
|
69
|
+
const [isNavigating, setIsNavigating] = useState(false);
|
|
70
|
+
const stepChildren = [];
|
|
71
|
+
const otherChildren = [];
|
|
72
|
+
children === null || children === void 0 || children.forEach((child) => {
|
|
73
|
+
if (isValidElement(child) && child.type === Step) stepChildren.push(child);
|
|
74
|
+
else otherChildren.push(child);
|
|
75
|
+
});
|
|
76
|
+
const totalSteps = stepChildren.length;
|
|
77
|
+
const datasetProps = getDatasetProps(dataset, { preplyDsComponent: webComponentNames.Steps });
|
|
78
|
+
const handleStepChange = async (nextStep) => {
|
|
79
|
+
const boundedNextStep = Math.min(Math.max(nextStep, 1), totalSteps);
|
|
80
|
+
if (!onStepChange) {
|
|
81
|
+
setCurrentStep(boundedNextStep);
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
setIsNavigating(true);
|
|
85
|
+
try {
|
|
86
|
+
const interceptedStep = await onStepChange(currentStep, boundedNextStep);
|
|
87
|
+
setCurrentStep(interceptedStep !== null && interceptedStep !== void 0 ? interceptedStep : boundedNextStep);
|
|
88
|
+
} finally {
|
|
89
|
+
setIsNavigating(false);
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
const goToPreviousStep = () => handleStepChange(currentStep - 1);
|
|
93
|
+
const goToNextStep = () => handleStepChange(currentStep + 1);
|
|
94
|
+
const goToStep = (step) => handleStepChange(step);
|
|
95
|
+
const contextValue = {
|
|
96
|
+
goToPreviousStep,
|
|
97
|
+
goToNextStep,
|
|
98
|
+
goToStep,
|
|
99
|
+
currentStep,
|
|
100
|
+
totalSteps,
|
|
101
|
+
isNavigating,
|
|
102
|
+
contentId
|
|
103
|
+
};
|
|
104
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
105
|
+
...datasetProps,
|
|
106
|
+
className: Steps_module_default.steps,
|
|
107
|
+
id: contentId,
|
|
108
|
+
"aria-live": "polite",
|
|
109
|
+
"aria-busy": isNavigating,
|
|
110
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(ProgressSteps, {
|
|
111
|
+
currentStep,
|
|
112
|
+
totalSteps,
|
|
113
|
+
"aria-label": ariaLabel
|
|
114
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
115
|
+
className: Steps_module_default.content,
|
|
116
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(StepsContext.Provider, {
|
|
117
|
+
value: contextValue,
|
|
118
|
+
children: [stepChildren[currentStep - 1], otherChildren]
|
|
119
|
+
})
|
|
120
|
+
})]
|
|
121
|
+
});
|
|
122
|
+
};
|
|
123
|
+
var Step = ({ title, description, children, hideHeader }) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("hgroup", {
|
|
124
|
+
className: Steps_module_default.header,
|
|
125
|
+
hidden: hideHeader,
|
|
126
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Heading, {
|
|
127
|
+
tag: "h3",
|
|
128
|
+
variant: {
|
|
129
|
+
_: "medium",
|
|
130
|
+
"medium-l": "large"
|
|
131
|
+
},
|
|
132
|
+
children: title
|
|
133
|
+
}), description && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
|
|
134
|
+
variant: "default-regular",
|
|
135
|
+
accent: "secondary",
|
|
136
|
+
children: description
|
|
137
|
+
})]
|
|
138
|
+
}), children] });
|
|
139
|
+
/**
|
|
140
|
+
* This component allows users to navigate through a series of steps, providing
|
|
141
|
+
* a structured way to complete tasks or forms. It will also handle screen reader
|
|
142
|
+
* announcements and progress indicators.
|
|
143
|
+
*
|
|
144
|
+
* To create a step, wrap the content of each step in a `Steps.Step` component.
|
|
145
|
+
* Any non-`Steps.Step` children will be rendered outside of the steps flow,
|
|
146
|
+
* right after the currently active step.
|
|
147
|
+
*
|
|
148
|
+
* To navigate between steps, use the `Steps.Previous` and `Steps.Next` components.
|
|
149
|
+
* Alternatively, you can use the `StepsContext` directly to call
|
|
150
|
+
* `goToPreviousStep`, `goToNextStep`, or `goToStep`.
|
|
151
|
+
*
|
|
152
|
+
* @example
|
|
153
|
+
* <Steps aria-label="Onboarding Steps" onStepChange={handleStepValidation}>
|
|
154
|
+
* <Steps.Step title="Subject" description="What do you want to learn?">
|
|
155
|
+
* <SubjectStep />
|
|
156
|
+
* </Steps.Step>
|
|
157
|
+
* <Steps.Step title="Availability" description="When would you like to have classes?">
|
|
158
|
+
* <AvailabilityStep />
|
|
159
|
+
* </Steps.Step>
|
|
160
|
+
*
|
|
161
|
+
* <LayoutFlex justifyContent="space-between">
|
|
162
|
+
* <Steps.Previous variant="tertiary">Back</Steps.Previous>
|
|
163
|
+
* <Steps.Next variant="primary">Continue</Steps.Next>
|
|
164
|
+
* </LayoutFlex>
|
|
165
|
+
* </Steps>
|
|
166
|
+
*/
|
|
167
|
+
var Steps = Object.assign(StepsComponent, {
|
|
168
|
+
Step,
|
|
169
|
+
Previous: StepsPrevious,
|
|
170
|
+
Next: StepsNext
|
|
171
|
+
});
|
|
172
|
+
//#endregion
|
|
173
|
+
export { StepsContext as n, useStepsContext as r, Steps as t };
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { t as require_jsx_runtime } from "./jsx-runtime-i4KUlhDu.js";
|
|
3
|
+
import { forwardRef, useState } from "react";
|
|
4
|
+
import { getDatasetProps } from "@preply/ds-web-core";
|
|
5
|
+
import { webComponentNames } from "@preply/ds-visual-coverage-preply-component-names";
|
|
6
|
+
import './assets/Switch.css';var Switch_module_default = {
|
|
7
|
+
Switch: "Switch__-4XFt",
|
|
8
|
+
thumb: "thumb__qAYMq"
|
|
9
|
+
};
|
|
10
|
+
//#endregion
|
|
11
|
+
//#region src/components/Switch/Switch.tsx
|
|
12
|
+
var import_jsx_runtime = require_jsx_runtime();
|
|
13
|
+
function filterSwitchProps(props) {
|
|
14
|
+
const filteredProps = {};
|
|
15
|
+
Object.entries(props).forEach(([key, value]) => {
|
|
16
|
+
switch (key) {
|
|
17
|
+
case "id":
|
|
18
|
+
case "disabled":
|
|
19
|
+
case "aria-label":
|
|
20
|
+
case "aria-labelledby":
|
|
21
|
+
case "aria-describedby":
|
|
22
|
+
case "aria-invalid":
|
|
23
|
+
case "aria-errormessage": filteredProps[key] = value;
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
return filteredProps;
|
|
27
|
+
}
|
|
28
|
+
var Switch = forwardRef(function Switch({ checked: forceChecked, defaultChecked, onCheckedChange, dataset, ...otherProps }, ref) {
|
|
29
|
+
const [internalChecked, setInternalChecked] = useState(defaultChecked !== null && defaultChecked !== void 0 ? defaultChecked : false);
|
|
30
|
+
const isControlled = forceChecked !== void 0;
|
|
31
|
+
const checked = isControlled ? forceChecked : internalChecked;
|
|
32
|
+
const handleClick = () => {
|
|
33
|
+
const newValue = !checked;
|
|
34
|
+
if (!isControlled) setInternalChecked(newValue);
|
|
35
|
+
onCheckedChange === null || onCheckedChange === void 0 || onCheckedChange(newValue);
|
|
36
|
+
};
|
|
37
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", {
|
|
38
|
+
...filterSwitchProps(otherProps),
|
|
39
|
+
...getDatasetProps(dataset, { preplyDsComponent: webComponentNames.Switch }),
|
|
40
|
+
ref,
|
|
41
|
+
role: "switch",
|
|
42
|
+
"aria-checked": checked,
|
|
43
|
+
className: Switch_module_default.Switch,
|
|
44
|
+
onClick: handleClick,
|
|
45
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: Switch_module_default.thumb })
|
|
46
|
+
});
|
|
47
|
+
});
|
|
48
|
+
//#endregion
|
|
49
|
+
export { Switch as t };
|