@preply/ds-web-lib 10.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 +6 -4
- package/dist/assets/OnboardingTour.css +3 -2
- package/dist/assets/PreplyLogo.css +1 -1
- package/dist/assets/ProgressBar.css +1 -1
- package/dist/assets/ProgressSteps.css +1 -1
- package/dist/assets/Select.css +2 -2
- package/dist/assets/Slider.css +1 -1
- package/dist/assets/Spinner.css +3 -3
- package/dist/assets/Stars.css +3 -3
- package/dist/assets/Steps.css +2 -2
- package/dist/assets/Switch.css +1 -1
- package/dist/assets/Text.css +3 -3
- package/dist/assets/TextHighlighted.css +3 -3
- package/dist/assets/TextInline.css +3 -3
- package/dist/assets/Toast.css +2 -2
- package/dist/assets/Tooltip.css +1 -1
- package/dist/assets/align-self.css +1 -1
- package/dist/assets/{IconTile.css → components.css} +9 -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.d.ts +3 -3
- package/dist/components/AlertDialog/AlertDialog.d.ts.map +1 -1
- package/dist/components/AlertDialog/AlertDialog.js +5 -94
- 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 -93
- 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 -1459
- 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-CqJE9k4D.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-BvMNldxo.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/useBaseUiId-DavsGYu9.js +0 -8
- package/dist/useButton-fjQ0ak8m.js +0 -193
- package/dist/useId-BhIOp2JG.js +0 -28
- package/dist/useOpenInteractionType-DNYFqf-a.js +0 -2880
- package/dist/useRenderElement-BSthtPOr.js +0 -350
|
@@ -1,30 +1,56 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
2
|
+
import { t as require_jsx_runtime } from "../../../jsx-runtime-i4KUlhDu.js";
|
|
3
|
+
import { t as index_module_default } from "../../../index.module-1c7ENvxc.js";
|
|
3
4
|
import { createContext, forwardRef } from "react";
|
|
4
5
|
import { getDatasetProps } from "@preply/ds-web-core";
|
|
5
6
|
import { webComponentNames } from "@preply/ds-visual-coverage-preply-component-names";
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
//#region src/components/CalloutBanner/primitives/CalloutBannerRoot.tsx
|
|
8
|
+
var import_jsx_runtime = require_jsx_runtime();
|
|
9
|
+
var CalloutBannerContext = createContext({
|
|
10
|
+
variant: "neutral",
|
|
11
|
+
size: "regular"
|
|
10
12
|
});
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
13
|
+
/**
|
|
14
|
+
* The root primitive for the callout banner.
|
|
15
|
+
*
|
|
16
|
+
* This component is used to create a custom callout banner; it accepts a
|
|
17
|
+
* `className prop to override the default styles for the callout banner
|
|
18
|
+
* container. The `variant` prop is exposed as a data attribute on the root
|
|
19
|
+
* element to aid in styling.
|
|
20
|
+
*
|
|
21
|
+
* You can use the other `CalloutBanner*` subcomponents as you normally would
|
|
22
|
+
* with the `CalloutBanner` component.
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* // Custom callout banner with style override class name
|
|
26
|
+
* <CalloutBannerRoot className={customStyles.pinkBanner}>
|
|
27
|
+
* {children}
|
|
28
|
+
* </CalloutBannerRoot>
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* // CSS
|
|
32
|
+
* .pinkBanner[data-variant='neutral'] {
|
|
33
|
+
* background-color: hotpink;
|
|
34
|
+
* }
|
|
35
|
+
*/
|
|
36
|
+
var CalloutBannerRoot = forwardRef(function CalloutBannerRoot({ variant = "neutral", size = "regular", children, dataset, className = "", ...props }, ref) {
|
|
37
|
+
const classNames = [index_module_default.banner, className].join(" ");
|
|
38
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CalloutBannerContext.Provider, {
|
|
39
|
+
value: {
|
|
40
|
+
variant,
|
|
41
|
+
size
|
|
42
|
+
},
|
|
43
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
44
|
+
ref,
|
|
45
|
+
role: "note",
|
|
46
|
+
className: classNames,
|
|
47
|
+
...getDatasetProps(dataset, { preplyDsComponent: webComponentNames.CalloutBanner }),
|
|
48
|
+
"data-variant": variant,
|
|
49
|
+
"data-size": size,
|
|
50
|
+
...props,
|
|
51
|
+
children
|
|
52
|
+
})
|
|
53
|
+
});
|
|
26
54
|
});
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
CalloutBannerRoot
|
|
30
|
-
};
|
|
55
|
+
//#endregion
|
|
56
|
+
export { CalloutBannerContext, CalloutBannerRoot };
|
|
@@ -1,14 +1,44 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { Text } from "../../Text/Text.js";
|
|
2
|
+
import { t as require_jsx_runtime } from "../../../jsx-runtime-i4KUlhDu.js";
|
|
3
|
+
import { t as Text } from "../../../Text-CaOF75Z-.js";
|
|
5
4
|
import { CalloutBannerContext } from "./CalloutBannerRoot.js";
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
5
|
+
import { forwardRef, useContext } from "react";
|
|
6
|
+
//#region src/components/CalloutBanner/primitives/CalloutBannerText.tsx
|
|
7
|
+
var import_jsx_runtime = require_jsx_runtime();
|
|
8
|
+
/**
|
|
9
|
+
* A `Text` component alias for the callout banner that is context-aware,
|
|
10
|
+
* adjusting its own `variant` based on the parent `CalloutBanner`'s `size`.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* <CalloutBannerText>
|
|
14
|
+
* Callout banner message goes here.
|
|
15
|
+
* </CalloutBannerText>
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* // Set `Text` props
|
|
19
|
+
* <CalloutBannerText tag="span">
|
|
20
|
+
* Callout banner message goes here.
|
|
21
|
+
* </CalloutBannerText>
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* // Override `Text` `variant` prop
|
|
25
|
+
* <CalloutBannerText variant="default-semibold">
|
|
26
|
+
* Callout banner message goes here.
|
|
27
|
+
* </CalloutBannerText>
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* // Override styles via `className` prop
|
|
31
|
+
* <CalloutBannerText className={myCustomStyles.text}>
|
|
32
|
+
* Callout banner message goes here.
|
|
33
|
+
* </CalloutBannerText>
|
|
34
|
+
*/
|
|
35
|
+
var CalloutBannerText = forwardRef(function CalloutBannerText(props, ref) {
|
|
36
|
+
const { size } = useContext(CalloutBannerContext);
|
|
37
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
|
|
38
|
+
ref,
|
|
39
|
+
variant: size === "small" ? "small-regular" : "default-regular",
|
|
40
|
+
...props
|
|
41
|
+
});
|
|
11
42
|
});
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
};
|
|
43
|
+
//#endregion
|
|
44
|
+
export { CalloutBannerText };
|
|
@@ -1,78 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
import { webComponentNames } from "@preply/ds-visual-coverage-preply-component-names";
|
|
6
|
-
import { moduleClassNames, stringClassNames, getDatasetProps } from "@preply/ds-web-core";
|
|
7
|
-
import { renderIcon } from "../../utils/render-icon.js";
|
|
8
|
-
import { filterAttributesPassedByRadixUIAtRuntime } from "../../utils/filterAttributesPassedByRadixUIAtRuntime.js";
|
|
9
|
-
import { useIndeterminate } from "./hooks/useIndeterminate.js";
|
|
10
|
-
import '../../assets/Checkbox.css';const SvgRemove = ({
|
|
11
|
-
title,
|
|
12
|
-
titleId,
|
|
13
|
-
...props
|
|
14
|
-
}, ref) => /* @__PURE__ */ React.createElement("svg", { "data-preply-ds-component": "SvgTokyoUIIcon", viewBox: "0 0 14 2", xmlns: "http://www.w3.org/2000/svg", ref, "aria-labelledby": titleId, ...props }, title ? /* @__PURE__ */ React.createElement("title", { id: titleId }, title) : null, /* @__PURE__ */ React.createElement("path", { d: "M0 0h14v2H0z" }));
|
|
15
|
-
const ForwardRef$1 = forwardRef(SvgRemove);
|
|
16
|
-
const SvgCheckmark = ({
|
|
17
|
-
title,
|
|
18
|
-
titleId,
|
|
19
|
-
...props
|
|
20
|
-
}, ref) => /* @__PURE__ */ React.createElement("svg", { "data-preply-ds-component": "SvgTokyoUIIcon", viewBox: "0 0 13 11", xmlns: "http://www.w3.org/2000/svg", ref, "aria-labelledby": titleId, ...props }, title ? /* @__PURE__ */ React.createElement("title", { id: titleId }, title) : null, /* @__PURE__ */ React.createElement("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M3.923 10.101 0 6.18 1.179 5l2.744 2.744L11.667 0l1.178 1.179z" }));
|
|
21
|
-
const ForwardRef = forwardRef(SvgCheckmark);
|
|
22
|
-
const checkbox = "checkbox__KtCna";
|
|
23
|
-
const remove = "remove__GrRcv";
|
|
24
|
-
const checkmark = "checkmark__ha-Nu";
|
|
25
|
-
const styles = {
|
|
26
|
-
checkbox,
|
|
27
|
-
remove,
|
|
28
|
-
checkmark,
|
|
29
|
-
"checkbox--dsInternalSimulation-focus": "checkbox--dsInternalSimulation-focus__NqNUT"
|
|
30
|
-
};
|
|
31
|
-
const Checkbox = forwardRef(function Checkbox2({
|
|
32
|
-
id,
|
|
33
|
-
name,
|
|
34
|
-
checked,
|
|
35
|
-
defaultChecked,
|
|
36
|
-
indeterminate,
|
|
37
|
-
onChange,
|
|
38
|
-
onCheckedChange,
|
|
39
|
-
hasError,
|
|
40
|
-
disabled,
|
|
41
|
-
required,
|
|
42
|
-
"aria-label": ariaLabel,
|
|
43
|
-
"aria-labelledby": ariaLabelledby,
|
|
44
|
-
"aria-describedby": ariaDescribedby,
|
|
45
|
-
dataset,
|
|
46
|
-
dsInternalSimulation,
|
|
47
|
-
onBlur,
|
|
48
|
-
onFocus,
|
|
49
|
-
...restPropsPassedByRadixUI
|
|
50
|
-
}, ref) {
|
|
51
|
-
const {
|
|
52
|
-
mergedRef,
|
|
53
|
-
onChangeHandler,
|
|
54
|
-
ariaChecked
|
|
55
|
-
} = useIndeterminate({
|
|
56
|
-
ref,
|
|
57
|
-
onChange,
|
|
58
|
-
indeterminate,
|
|
59
|
-
onCheckedChange
|
|
60
|
-
});
|
|
61
|
-
const classNames = moduleClassNames(styles, "checkbox", [stringClassNames(`dsInternalSimulation`, dsInternalSimulation)]);
|
|
62
|
-
return /* @__PURE__ */ jsxs("div", { ...filterAttributesPassedByRadixUIAtRuntime(restPropsPassedByRadixUI), className: classNames.join(" "), "data-preply-ds-component": webComponentNames.Checkbox, children: [
|
|
63
|
-
/* @__PURE__ */ jsx("input", { id, name, type: "checkbox", required, disabled, checked, defaultChecked, "aria-checked": ariaChecked, "aria-invalid": hasError === true ? true : void 0, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledby, "aria-describedby": ariaDescribedby, onChange: onChangeHandler, ref: mergedRef, onBlur, onFocus, ...getDatasetProps(dataset) }),
|
|
64
|
-
renderIcon(ForwardRef, {
|
|
65
|
-
focusable: "false",
|
|
66
|
-
"aria-hidden": "true",
|
|
67
|
-
className: styles.checkmark
|
|
68
|
-
}),
|
|
69
|
-
renderIcon(ForwardRef$1, {
|
|
70
|
-
focusable: "false",
|
|
71
|
-
"aria-hidden": "true",
|
|
72
|
-
className: styles.remove
|
|
73
|
-
})
|
|
74
|
-
] });
|
|
75
|
-
});
|
|
76
|
-
export {
|
|
77
|
-
Checkbox
|
|
78
|
-
};
|
|
1
|
+
import "../../render-icon-Ch3b2dE0.js";
|
|
2
|
+
import "../../jsx-runtime-i4KUlhDu.js";
|
|
3
|
+
import { t as Checkbox } from "../../Checkbox-CtolNbxI.js";
|
|
4
|
+
export { Checkbox };
|
|
@@ -1,33 +1,27 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { useRef, useLayoutEffect, useCallback } from "react";
|
|
3
2
|
import { useMergeRefs } from "../../../utils/useMergeRefs.js";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
mergedRef,
|
|
27
|
-
ariaChecked,
|
|
28
|
-
onChangeHandler
|
|
29
|
-
};
|
|
3
|
+
import { useCallback, useLayoutEffect, useRef } from "react";
|
|
4
|
+
//#region src/components/Checkbox/hooks/useIndeterminate.ts
|
|
5
|
+
function useIndeterminate({ ref, onChange, indeterminate, onCheckedChange }) {
|
|
6
|
+
const checkboxRef = useRef(null);
|
|
7
|
+
const mergedRef = useMergeRefs(checkboxRef, ref);
|
|
8
|
+
useLayoutEffect(() => {
|
|
9
|
+
if (checkboxRef.current && typeof indeterminate === "boolean") checkboxRef.current.indeterminate = indeterminate;
|
|
10
|
+
}, [indeterminate]);
|
|
11
|
+
const onChangeHandler = useCallback((event) => {
|
|
12
|
+
onChange === null || onChange === void 0 || onChange(event);
|
|
13
|
+
if (typeof indeterminate === "boolean") event.target.indeterminate = indeterminate;
|
|
14
|
+
onCheckedChange === null || onCheckedChange === void 0 || onCheckedChange(event.target.checked);
|
|
15
|
+
}, [
|
|
16
|
+
onChange,
|
|
17
|
+
indeterminate,
|
|
18
|
+
onCheckedChange
|
|
19
|
+
]);
|
|
20
|
+
return {
|
|
21
|
+
mergedRef,
|
|
22
|
+
ariaChecked: indeterminate ? "mixed" : void 0,
|
|
23
|
+
onChangeHandler
|
|
24
|
+
};
|
|
30
25
|
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
};
|
|
26
|
+
//#endregion
|
|
27
|
+
export { useIndeterminate };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
|
|
@@ -1,92 +1,123 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
7
|
-
import { VisuallyHidden } from "../private/VisuallyHidden/VisuallyHidden.js";
|
|
8
|
-
import { FormattedMessage } from "react-intl";
|
|
2
|
+
import { filterAttributesPassedByRadixUIAtRuntime } from "../../utils/filterAttributesPassedByRadixUIAtRuntime.js";
|
|
3
|
+
import { t as Icon } from "../../Icon-CixAeOSd.js";
|
|
4
|
+
import "../../render-icon-Ch3b2dE0.js";
|
|
5
|
+
import { t as require_jsx_runtime } from "../../jsx-runtime-i4KUlhDu.js";
|
|
6
|
+
import { t as VisuallyHidden } from "../../VisuallyHidden-CtcHcZCK.js";
|
|
9
7
|
import { genericAriaLabels } from "../../utils/shared-strings.js";
|
|
8
|
+
import { useControllableState } from "../../utils/useControllableState/useControllableState.js";
|
|
9
|
+
import { a as ChipsList, c as $9bf71ea28793e738$export$10c5169755ce7bd7, i as ChipListItem, o as ChipsRoot, r as ChipLabel, t as ChipButton } from "../../ChipsPrimitive-Bezq7ptE.js";
|
|
10
|
+
import { createRequiredContext } from "../../utils/createRequiredContext.js";
|
|
11
|
+
import { forwardRef } from "react";
|
|
10
12
|
import { getDatasetProps } from "@preply/ds-web-core";
|
|
11
13
|
import { webComponentNames } from "@preply/ds-visual-coverage-preply-component-names";
|
|
12
|
-
import {
|
|
13
|
-
import
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
14
|
+
import { FormattedMessage } from "react-intl";
|
|
15
|
+
import CloseSvg from "@preply/ds-media-icons/dist/24/TokyoUIClose.svg";
|
|
16
|
+
//#region src/components/Chips/DismissibleChips.tsx
|
|
17
|
+
var import_jsx_runtime = require_jsx_runtime();
|
|
18
|
+
var [Provider, useDismissibleChipsContext] = createRequiredContext("DismissibleChips");
|
|
19
|
+
/**
|
|
20
|
+
* A chips component for displaying dismissible/removable items.
|
|
21
|
+
*
|
|
22
|
+
* @remarks
|
|
23
|
+
* **Keyboard interactions:**
|
|
24
|
+
* - **Tab** to enter/exit the component (uses [roving tabindex pattern](https://www.w3.org/WAI/ARIA/apg/practices/keyboard-interface/#kbd_roving_tabindex))
|
|
25
|
+
* - **Arrow keys** to navigate between chips within the group
|
|
26
|
+
* - **Space/Enter** to remove the focused chip
|
|
27
|
+
* - **Delete/Backspace** to remove the focused chip
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```tsx
|
|
31
|
+
* <DismissibleChips
|
|
32
|
+
* aria-label="Selected skills"
|
|
33
|
+
* defaultValue={['vocabulary', 'speaking', 'listening']}
|
|
34
|
+
* >
|
|
35
|
+
* <DismissibleChipsItem value="vocabulary">Vocabulary</DismissibleChipsItem>
|
|
36
|
+
* <DismissibleChipsItem value="speaking">Speaking</DismissibleChipsItem>
|
|
37
|
+
* <DismissibleChipsItem value="listening">Listening</DismissibleChipsItem>
|
|
38
|
+
* </DismissibleChips>
|
|
39
|
+
* ```
|
|
40
|
+
*/
|
|
41
|
+
var DismissibleChips = forwardRef(function DismissibleChips({ items, children, orientation, "aria-label": ariaLabel, "aria-controls": ariaControls, value: valueProp, onValueChange: onValueChangeProp, defaultValue, dataset, ...restPropsPassedByRadixUI }, ref) {
|
|
42
|
+
const [values, onValueChange] = useControllableState({
|
|
43
|
+
value: valueProp,
|
|
44
|
+
onValueChange: onValueChangeProp,
|
|
45
|
+
defaultValue: defaultValue !== null && defaultValue !== void 0 ? defaultValue : []
|
|
46
|
+
});
|
|
47
|
+
const onRemove = (value) => {
|
|
48
|
+
onValueChange(values.filter((v) => v !== value));
|
|
49
|
+
};
|
|
50
|
+
const content = items ? items.map(({ label, value, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DismissibleChipsItem, {
|
|
51
|
+
value,
|
|
52
|
+
...props,
|
|
53
|
+
children: label
|
|
54
|
+
}, value)) : children;
|
|
55
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Provider, {
|
|
56
|
+
value: {
|
|
57
|
+
values,
|
|
58
|
+
onRemove,
|
|
59
|
+
ariaControls
|
|
60
|
+
},
|
|
61
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ChipsRoot, {
|
|
62
|
+
orientation,
|
|
63
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ChipsList, {
|
|
64
|
+
...filterAttributesPassedByRadixUIAtRuntime(restPropsPassedByRadixUI),
|
|
65
|
+
ref,
|
|
66
|
+
orientation,
|
|
67
|
+
"aria-label": ariaLabel,
|
|
68
|
+
...getDatasetProps(dataset, { preplyDsComponent: webComponentNames.DismissibleChips }),
|
|
69
|
+
children: content
|
|
70
|
+
})
|
|
71
|
+
})
|
|
72
|
+
});
|
|
48
73
|
});
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
}, ref) {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
74
|
+
/**
|
|
75
|
+
* Individual dismissible chip item for use within DismissibleChips.
|
|
76
|
+
*
|
|
77
|
+
* @example
|
|
78
|
+
* ```tsx
|
|
79
|
+
* <DismissibleChipsItem value="english">
|
|
80
|
+
* English
|
|
81
|
+
* </DismissibleChipsItem>
|
|
82
|
+
* ```
|
|
83
|
+
*/
|
|
84
|
+
var DismissibleChipsItem = forwardRef(function DismissibleChipsItem({ value, children, icon, countryFlagCode, disabled, counter, dataset, dsInternalSimulation, ...restPropsPassedByRadixUI }, ref) {
|
|
85
|
+
const { values, onRemove, ariaControls } = useDismissibleChipsContext();
|
|
86
|
+
const focusManager = $9bf71ea28793e738$export$10c5169755ce7bd7();
|
|
87
|
+
const handleRemove = () => {
|
|
88
|
+
onRemove(value);
|
|
89
|
+
focusManager === null || focusManager === void 0 || focusManager.focusNext({ wrap: true });
|
|
90
|
+
};
|
|
91
|
+
const handleKeyDown = (e) => {
|
|
92
|
+
switch (e.key) {
|
|
93
|
+
case "Delete":
|
|
94
|
+
case "Backspace":
|
|
95
|
+
handleRemove();
|
|
96
|
+
break;
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
if (!values.includes(value)) return null;
|
|
100
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ChipListItem, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(ChipButton, {
|
|
101
|
+
...filterAttributesPassedByRadixUIAtRuntime(restPropsPassedByRadixUI),
|
|
102
|
+
ref,
|
|
103
|
+
variant: "dismissible",
|
|
104
|
+
onClick: handleRemove,
|
|
105
|
+
onKeyDown: handleKeyDown,
|
|
106
|
+
icon,
|
|
107
|
+
countryFlagCode,
|
|
108
|
+
disabled,
|
|
109
|
+
"aria-controls": ariaControls,
|
|
110
|
+
dsInternalSimulation,
|
|
111
|
+
...getDatasetProps(dataset, { preplyDsComponent: webComponentNames.DismissibleChipsItem }),
|
|
112
|
+
children: [
|
|
113
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(VisuallyHidden, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FormattedMessage, { ...genericAriaLabels.remove }) }),
|
|
114
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(ChipLabel, {
|
|
115
|
+
counter,
|
|
116
|
+
children
|
|
117
|
+
}),
|
|
118
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Icon, { svg: CloseSvg })
|
|
119
|
+
]
|
|
120
|
+
}) });
|
|
88
121
|
});
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
DismissibleChipsItem
|
|
92
|
-
};
|
|
122
|
+
//#endregion
|
|
123
|
+
export { DismissibleChips, DismissibleChipsItem };
|