@preply/ds-docs 1.4.6 → 1.5.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/assets/{00.LayoutFlex.stories-Dq5DUmQD.js → 00.LayoutFlex.stories-CQZmIU-U.js} +1 -1
- package/dist/assets/{00.applications-qZlvAkr1.js → 00.applications-Di7jQEUP.js} +1 -1
- package/dist/assets/{00.favicons.guide-CKF4OV4R.js → 00.favicons.guide-BqtgcOst.js} +1 -1
- package/dist/assets/{00.token-explorer-BLPRqIDh.js → 00.token-explorer-B-hoQtAZ.js} +1 -1
- package/dist/assets/{00.using-responsive-props-CcvENalR.js → 00.using-responsive-props-yIiNVrjH.js} +1 -1
- package/dist/assets/{01.semantic-tokens-CBbAvO88.js → 01.semantic-tokens-Bszt1twO.js} +1 -1
- package/dist/assets/{01.using-shorthand-props-Dem89Aji.js → 01.using-shorthand-props-w8U5wYm4.js} +1 -1
- package/dist/assets/{10.Combinations.stories-B2t5dWpR.js → 10.Combinations.stories-BJzVfaWu.js} +1 -1
- package/dist/assets/{10.fonts.guide-LxVBwF-1.js → 10.fonts.guide-NBYHGpZG.js} +1 -1
- package/dist/assets/{10.ssr-D6Z9lhKL.js → 10.ssr-CjoJSokY.js} +1 -1
- package/dist/assets/{11.languageFont.explorer-UHlg3tYx.js → 11.languageFont.explorer-7dsvANIs.js} +1 -1
- package/dist/assets/{11.ssr.app-router-DOa7VicQ.js → 11.ssr.app-router-D7ufx5p4.js} +1 -1
- package/dist/assets/{20.libraries-DB2B5LI7.js → 20.libraries-BgURMzec.js} +1 -1
- package/dist/assets/{30.icons.explorer-hLFKyjsU.js → 30.icons.explorer-GCwQhgUE.js} +8 -8
- package/dist/assets/{30.storybook-CoVTGKPK.js → 30.storybook-6u3F3eKp.js} +1 -1
- package/dist/assets/{40.illustrations.explorer-DIVnMD9r.js → 40.illustrations.explorer-DQ5Oemtc.js} +1 -1
- package/dist/assets/{90.advanced-ChEiRXc9.js → 90.advanced-CfRw5q9D.js} +1 -1
- package/dist/assets/AlertDialog-DSR7lwcr.css +1 -0
- package/dist/assets/{AlertDialog.stories-CLOz-Xse.js → AlertDialog.stories-YL-e1X-5.js} +2 -2
- package/dist/assets/Avatar-CY8LENR_.css +1 -0
- package/dist/assets/Avatar-DBYAA8jq.js +6 -0
- package/dist/assets/Avatar-Vaj5CZzo.js +1 -0
- package/dist/assets/Avatar-yGngrFRe.css +1 -0
- package/dist/assets/{Avatar.stories-BzWIv8sX.js → Avatar.stories-Bok7S-hP.js} +1 -1
- package/dist/assets/AvatarWithStatus-C-I9yxMp.css +1 -0
- package/dist/assets/AvatarWithStatus.stories-CEZSwfci.js +41 -0
- package/dist/assets/Badge-BDfgu9OD.css +1 -0
- package/dist/assets/{Badge.stories-3y3VF7VA.js → Badge.stories-CvhsYu7L.js} +2 -2
- package/dist/assets/Box-Dl-QnUHN.css +1 -0
- package/dist/assets/Box.stories-nJvB5AvT.js +44 -0
- package/dist/assets/Button-CDbUPX5z.css +1 -0
- package/dist/assets/{Button--KAZaY7M.css → Button-CjrFqtK6.css} +1 -1
- package/dist/assets/Button-DoDXFggu.js +1 -0
- package/dist/assets/{Button-sxuW7ql0.js → Button-Dy26oY0t.js} +4 -2
- package/dist/assets/{Button.stories-DjecMnlz.js → Button.stories-C3ImqpQo.js} +1 -1
- package/dist/assets/ButtonBase-C6zIOZ7w.js +8 -0
- package/dist/assets/{ButtonBase-DsmeXloU.css → ButtonBase-CZ1X_2UT.css} +1 -1
- package/dist/assets/Chips-D3NfThf2.css +1 -0
- package/dist/assets/{Chips.stories-C6WkX-Z_.js → Chips.stories-DvnrQpsy.js} +7 -7
- package/dist/assets/{Color-YHDXOIA2-CVcfLiYQ.js → Color-YHDXOIA2-Dz3WhSmf.js} +1 -1
- package/dist/assets/Dialog-DHOGtHBQ.css +1 -0
- package/dist/assets/{Dialog.stories-CyKHJUtE.js → Dialog.stories-DFaL3AMR.js} +10 -10
- package/dist/assets/{DocsRenderer-CFRXHY34-D881Judw.js → DocsRenderer-CFRXHY34-rpqlGaZf.js} +1 -1
- package/dist/assets/{FieldAdditionalText-C5XAlipw.js → FieldAdditionalText-BCMB8JHW.js} +1 -1
- package/dist/assets/FieldAdditionalText-BtVADuTn.css +1 -0
- package/dist/assets/{FieldAdditionalText.stories-B45flMW4.js → FieldAdditionalText.stories-BTKc3XUo.js} +1 -1
- package/dist/assets/{FieldButton-DSbPDTAJ.css → FieldButton-BK6nCNDL.css} +1 -1
- package/dist/assets/{FieldButton-BGYoqsP8.js → FieldButton-BbLI1MM0.js} +1 -1
- package/dist/assets/{FieldButton.stories-lPQrEoKY.js → FieldButton.stories-vpLl5qi7.js} +1 -1
- package/dist/assets/FieldLayout-DC-YB5tP.css +1 -0
- package/dist/assets/{FieldLayout-DgtUHJnk.js → FieldLayout-zG6DP4fD.js} +1 -1
- package/dist/assets/{FieldLayout.stories-DVopjnRC.js → FieldLayout.stories-BcIZKltP.js} +1 -1
- package/dist/assets/{FieldLayoutBase-OPLZFzfB.js → FieldLayoutBase-CbZWkNI7.js} +3 -3
- package/dist/assets/FieldLayoutBase-Dv-ccXqK.css +1 -0
- package/dist/assets/{Heading-DEhP3zeq.css → Heading-B_ZQCeib.css} +1 -1
- package/dist/assets/Heading-DPPEK9A1.js +2 -0
- package/dist/assets/{Heading.stories-DzgtA5lo.js → Heading.stories-MSLqIH2n.js} +1 -1
- package/dist/assets/Icon-BNvtTXpG.js +8 -0
- package/dist/assets/Icon-DaYbmtvu.css +1 -0
- package/dist/assets/Icon-DdGCYYnw.css +1 -0
- package/dist/assets/{Icon-RSC-CIS_rYj-.js → Icon-RSC-Z5MLssxb.js} +1 -1
- package/dist/assets/Icon-wXkY19lJ.js +1 -0
- package/dist/assets/{Icon.stories-BvoIYlCX.js → Icon.stories-DoZhZVXF.js} +1 -1
- package/dist/assets/{IconButton-CBtq6L3L.js → IconButton-DMtc1AqT.js} +1 -1
- package/dist/assets/InputText-DAMAB4Tc.js +5 -0
- package/dist/assets/{LayoutFlex-eQuKAhqj.js → LayoutFlex-Cj8q1bY9.js} +1 -1
- package/dist/assets/{LayoutFlex-CF0H-L2i.js → LayoutFlex-DJgUW3tI.js} +1 -1
- package/dist/assets/LayoutFlexItem-BIkIcH4n.css +1 -0
- package/dist/assets/{LayoutFlexItem-DKXhQ4uI.js → LayoutFlexItem-C1qrSn1R.js} +1 -1
- package/dist/assets/LayoutGrid-DLuh585c.js +1 -0
- package/dist/assets/LayoutGrid-DMbtqKwQ.css +1 -0
- package/dist/assets/LayoutGrid-DqCfK2vN.css +1 -0
- package/dist/assets/{LayoutGrid.stories-CUF1pFax.js → LayoutGrid.stories-BNUhVFei.js} +3 -3
- package/dist/assets/LayoutGridItem-BissFQZa.css +1 -0
- package/dist/assets/LayoutGridItem-Cl02VDid.js +1 -0
- package/dist/assets/Link-CZvqSjA-.css +1 -0
- package/dist/assets/{Link.stories-op3rALt2.js → Link.stories-KUuvoGXv.js} +6 -6
- package/dist/assets/Loader-CPdt-2H5.css +1 -0
- package/dist/assets/{Loader.stories-DkuQH0il.js → Loader.stories-C7oYgr7U.js} +3 -3
- package/dist/assets/NumberField.stories-EBr9TWOu.js +203 -0
- package/dist/assets/{ObserveIntersection-D396wl1Z.js → ObserveIntersection-Ccn6ggRl.js} +1 -1
- package/dist/assets/{ObserveIntersection.stories-DIe0cEvy.js → ObserveIntersection.stories-CK5RwCMK.js} +1 -1
- package/dist/assets/{OnboardingTooltip-LmpN7irN.js → OnboardingTooltip-DuoU0OG7.js} +1 -1
- package/dist/assets/OnboardingTooltip-ih2-H7aT.css +1 -0
- package/dist/assets/{OnboardingTooltip.stories-Jgwhw8B7.js → OnboardingTooltip.stories-C7TCPsRd.js} +1 -1
- package/dist/assets/{OnboardingTooltip.tests.stories-SMAM4gfM.js → OnboardingTooltip.tests.stories-CR7peq2A.js} +1 -1
- package/dist/assets/{OnboardingTour-num3ncQf.js → OnboardingTour-D5pUyw-H.js} +1 -1
- package/dist/assets/{OnboardingTour-DwK5DUbq.css → OnboardingTour-a1foGtP0.css} +1 -1
- package/dist/assets/{OnboardingTour.stories-ByD_1qfY.js → OnboardingTour.stories-CHE5u2N9.js} +2 -2
- package/dist/assets/{OnboardingTour.tests.stories-CuKEIqem.js → OnboardingTour.tests.stories-L1SItA_o.js} +1 -1
- package/dist/assets/PasswordField.stories-BbIVWXCg.js +203 -0
- package/dist/assets/PreplyLogo-DzP78T2L.css +1 -0
- package/dist/assets/{PreplyLogo.stories-D1TtCHqk.js → PreplyLogo.stories-U59VXeLV.js} +4 -4
- package/dist/assets/{ProgressBar-BmXw-nZR.css → ProgressBar-wu_9uvGg.css} +1 -1
- package/dist/assets/{ProgressBar.stories-CPO4wH1o.js → ProgressBar.stories-CJHzGMBI.js} +1 -1
- package/dist/assets/{ProgressSteps-Dv8OCCuP.js → ProgressSteps-D0sRQY_x.js} +1 -1
- package/dist/assets/ProgressSteps-e3-CbmW-.css +1 -0
- package/dist/assets/{ProgressSteps.stories-BETmKQ0H.js → ProgressSteps.stories-C_1GQ6Wk.js} +1 -1
- package/dist/assets/SelectField-DtmQqReE.css +1 -0
- package/dist/assets/SelectField.stories-Dbbnnm8r.js +182 -0
- package/dist/assets/{ShowOnIntersection.stories-BYz5GE4A.js → ShowOnIntersection.stories-D4B8EpSn.js} +1 -1
- package/dist/assets/Spinner-CXZtxZbo.css +1 -0
- package/dist/assets/{Spinner-CyxiLyL8.js → Spinner-DgGnJd2k.js} +1 -1
- package/dist/assets/{Steps-C0r_s7cm.js → Steps-BC67AT21.js} +2 -2
- package/dist/assets/Steps-BemYpgTr.css +1 -0
- package/dist/assets/{Steps.stories-Cu3YnDNv.js → Steps.stories-Croh-b85.js} +1 -1
- package/dist/assets/Text-BQv_D3Xd.js +1 -0
- package/dist/assets/Text-C4DBPFZ_.js +1 -0
- package/dist/assets/{Text-Dz90MOGh.css → Text-j7spMxpW.css} +1 -1
- package/dist/assets/{Text.stories-Shf82ACe.js → Text.stories-D2QDcBIa.js} +1 -1
- package/dist/assets/TextField-4eAvmy7R.js +1 -0
- package/dist/assets/TextField-QAPIvMQf.css +1 -0
- package/dist/assets/{TextField.stories-dmjAjz-c.js → TextField.stories-BlZcgyOD.js} +1 -1
- package/dist/assets/TextHighlighted-D1Eq_O3M.js +1 -0
- package/dist/assets/TextHighlighted-Kfu8Cikz.css +1 -0
- package/dist/assets/{TextHighlighted.stories-BMKYOwah.js → TextHighlighted.stories-D5eTvy-x.js} +3 -3
- package/dist/assets/TextInline-CieB8GiR.css +1 -0
- package/dist/assets/{TextInline.stories-B_Pz9WwY.js → TextInline.stories-4RVYUyo7.js} +1 -1
- package/dist/assets/TextareaField.stories-Bp5XBUFn.js +221 -0
- package/dist/assets/Toast-BxY7edbh.css +1 -0
- package/dist/assets/{Toast.stories-DbrLDm_t.js → Toast.stories-C1rwf1P4.js} +2 -2
- package/dist/assets/{Tooltip-BAg1KQKT.js → Tooltip-BcWLgQdz.js} +1 -1
- package/dist/assets/Tooltip-C4RcESB2.css +1 -0
- package/dist/assets/{Tooltip.stories-wHqCEPWU.js → Tooltip.stories-C_eulyA8.js} +1 -1
- package/dist/assets/{Tooltip.tests.stories-D_nq5DIs.js → Tooltip.tests.stories-CNSvrg-a.js} +1 -1
- package/dist/assets/{breakpoints-BRprJf6A.js → breakpoints-C8FPGqgF.js} +1 -1
- package/dist/assets/{breakpoints-CtaUCSco.js → breakpoints-DD1YjD9M.js} +1 -1
- package/dist/assets/{breakpoints-BOyibZtN.js → breakpoints-Owi7Squn.js} +1 -1
- package/dist/assets/{changelog-TBi7WTEQ.js → changelog-BDm_gPnt.js} +217 -198
- package/dist/assets/{entry-preview-C_P_Nlzd.js → entry-preview-Djan81pS.js} +1 -1
- package/dist/assets/{getTokenVar-DCOEweXk.js → getTokenVar-D087RqJE.js} +1 -1
- package/dist/assets/{hover-kMs8GiJJ.js → hover-Bacj4cI5.js} +1 -1
- package/dist/assets/{hover-mW_YLLTC.js → hover-C9JcRjWU.js} +1 -1
- package/dist/assets/{hover-JFd-w7BX.js → hover-CrLn2ebs.js} +1 -1
- package/dist/assets/{iframe-BgwuwByS.js → iframe-CDRtj9ru.js} +2 -2
- package/dist/assets/{index-Bq6FoAGz.js → index-CV8DVSiW.js} +3 -3
- package/dist/assets/{index-B87xOJOM.js → index-CvmVTRnc.js} +1 -1
- package/dist/assets/{intro-c4tF8yKu.js → intro-BVNrHHEI.js} +1 -1
- package/dist/assets/layout-relative-ByAioz3N.css +1 -0
- package/dist/assets/layout-relative-DL5GCYL3.css +1 -0
- package/dist/assets/layout-relative-DX2HhfVy.css +1 -0
- package/dist/assets/layout-relative-vwhQiHRS.js +1 -0
- package/dist/assets/layout-relative.module-BIEPDZE2-CYlDcUGJ.js +1 -0
- package/dist/assets/layout-relative.module-Cmd2g7hD.js +1 -0
- package/dist/assets/{migrating-from-less-BxFz649c.js → migrating-from-less-Dr8tG-us.js} +1 -1
- package/dist/assets/playground-66zMGCdb.css +1 -0
- package/dist/assets/{playground.stories-C_o2YAsU.js → playground.stories-BLiukQbS.js} +88 -88
- package/dist/assets/{preview-DokNpyGe.js → preview-1ef74z28.js} +2 -2
- package/dist/assets/{preview-Cxi3mzSv.js → preview-CfQRgEmh.js} +1 -1
- package/dist/assets/{preview-CRvlowuh.js → preview-EanVfwSK.js} +1 -1
- package/dist/assets/text-accent-BbQDH9df.js +1 -0
- package/dist/assets/text-accent-DwQPHwM2.js +1 -0
- package/dist/assets/text-accent-UmsGcNvp.css +1 -0
- package/dist/assets/text-centered-BwHG-She.js +1 -0
- package/dist/assets/text-centered-Do6zdubZ.css +1 -0
- package/dist/assets/text-centered-J90FiEm7.css +1 -0
- package/dist/assets/text-centered-zQ_girwR.js +1 -0
- package/dist/assets/{tokens-DQr7_aYr.js → tokens-BtYQ8W_y.js} +1 -1
- package/dist/assets/{tokens-CQ5Gl5I2.js → tokens-DX2Hf4qt.js} +1 -1
- package/dist/assets/{tokens-Dbp-fi1-.js → tokens-noSXbqGF.js} +1 -1
- package/dist/assets/{usePortalElement-ClaqbqyG.js → usePortalElement-o38kz4UN.js} +1 -1
- package/dist/assets/{welcome-Dyttm4kJ.js → welcome-CnT01hD4.js} +1 -1
- package/dist/assets/{zeroheight-Q95Upmq8.js → zeroheight-BUMgok6n.js} +1 -1
- package/dist/iframe.html +1 -1
- package/dist/preview-stats.json +1409 -1382
- package/dist/project.json +1 -1
- package/package.json +3 -3
- package/dist/assets/AlertDialog-CCF7GpSQ.css +0 -1
- package/dist/assets/Avatar-B4uTWF6k.css +0 -1
- package/dist/assets/Avatar-CXOOPp5F.js +0 -1
- package/dist/assets/Avatar-D6tiuf1g.css +0 -1
- package/dist/assets/Avatar-DyGbZXJT.js +0 -6
- package/dist/assets/AvatarWithStatus-BiWxFmxH.css +0 -1
- package/dist/assets/AvatarWithStatus.stories-D1dAmJZA.js +0 -41
- package/dist/assets/Badge-B4U4Q-2L.css +0 -1
- package/dist/assets/Box-CXgYYZla.css +0 -1
- package/dist/assets/Box.stories-DWQHVvRJ.js +0 -44
- package/dist/assets/Button-C79RaET4.css +0 -1
- package/dist/assets/Button-D0GrV4Uw.js +0 -1
- package/dist/assets/ButtonBase-XFGBMwvm.js +0 -8
- package/dist/assets/Chips-DEkhPu7u.css +0 -1
- package/dist/assets/Dialog-DzE2u8b4.css +0 -1
- package/dist/assets/FieldAdditionalText-7SqTgPGu.css +0 -1
- package/dist/assets/FieldLayout-DMnUQxF2.css +0 -1
- package/dist/assets/FieldLayoutBase-DhmxmPiX.css +0 -1
- package/dist/assets/Heading-W4tHdF3R.js +0 -2
- package/dist/assets/Icon-BkSufs9e.css +0 -1
- package/dist/assets/Icon-CEJvCK2_.js +0 -1
- package/dist/assets/Icon-CUp8b0-U.js +0 -8
- package/dist/assets/Icon-D9BLfD32.css +0 -1
- package/dist/assets/InputText-UMYaayje.js +0 -5
- package/dist/assets/LayoutFlexItem-JfATLtRB.css +0 -1
- package/dist/assets/LayoutGrid-7peX52Vg.js +0 -1
- package/dist/assets/LayoutGrid-BT47Kl_Q.css +0 -1
- package/dist/assets/LayoutGrid-CGVWLW4Z.css +0 -1
- package/dist/assets/LayoutGridItem-6-QYYydO.css +0 -1
- package/dist/assets/LayoutGridItem-C-ej9KNj.js +0 -1
- package/dist/assets/Link-fCDYmX-7.css +0 -1
- package/dist/assets/Loader-BTxpB10O.css +0 -1
- package/dist/assets/NumberField.stories-DxU4XnMJ.js +0 -203
- package/dist/assets/OnboardingTooltip-iIP6td1I.css +0 -1
- package/dist/assets/PasswordField.stories-DstYRZDR.js +0 -203
- package/dist/assets/PreplyLogo-DBsyVspP.css +0 -1
- package/dist/assets/ProgressSteps-sMVv2IRR.css +0 -1
- package/dist/assets/SelectField-BxmHYGfP.css +0 -1
- package/dist/assets/SelectField.stories-DUyshTWW.js +0 -182
- package/dist/assets/Spinner-3LrAh6MU.css +0 -1
- package/dist/assets/Steps-CQxZhEz8.css +0 -1
- package/dist/assets/Text-Calcoo_W.js +0 -1
- package/dist/assets/Text-kaTl-B8Q.js +0 -1
- package/dist/assets/TextField-B_PVRzNM.js +0 -1
- package/dist/assets/TextField-lBm2t84t.css +0 -1
- package/dist/assets/TextHighlighted-B124J6SL.css +0 -1
- package/dist/assets/TextHighlighted-giKo87bb.js +0 -1
- package/dist/assets/TextInline-BpI6YPWG.css +0 -1
- package/dist/assets/TextareaField.stories-ByYFYI2v.js +0 -221
- package/dist/assets/Toast-DeW4F2lr.css +0 -1
- package/dist/assets/Tooltip-dFlhCupI.css +0 -1
- package/dist/assets/layout-relative-CLkOx8US.css +0 -1
- package/dist/assets/layout-relative-CqRlJdrj.js +0 -1
- package/dist/assets/layout-relative-Dg1lRTig.css +0 -1
- package/dist/assets/layout-relative-Oe5iP76h.css +0 -1
- package/dist/assets/layout-relative.module-Bbwb9_Eu.js +0 -1
- package/dist/assets/layout-relative.module-DB0GH6jo-BuT1zyXU.js +0 -1
- package/dist/assets/playground-Bt9UAyP9.css +0 -1
- package/dist/assets/text-accent-BucCjkua.js +0 -1
- package/dist/assets/text-accent-Ck8Nt9WJ.css +0 -1
- package/dist/assets/text-accent-Doi2Sa1E.js +0 -1
- package/dist/assets/text-centered-BFlte_Y7.css +0 -1
- package/dist/assets/text-centered-CvDN0Don.js +0 -1
- package/dist/assets/text-centered-CvpIKS_q.js +0 -1
- package/dist/assets/text-centered-D6faPckT.css +0 -1
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
import{j as t}from"./jsx-runtime-BTJTZTIL.js";import{r as s}from"./index-Cb9e4tly.js";import{a as u}from"./chunk-D5ZWXAHU-BhFjjRSl.js";import{e as S,u as xe,w as qe}from"./index-BVDq5o4N.js";import{F as Ee}from"./TokyoUIPhone-CvuBM6jb.js";import{B as R}from"./Button-Dy26oY0t.js";import{I as we}from"./Icon-BNvtTXpG.js";import{F as He}from"./FieldLayout-zG6DP4fD.js";import{u as Se,I as Fe,s as Ne}from"./FieldLayoutBase-CbZWkNI7.js";import{m as Ie}from"./classNames-BUL1Zq7e.js";import{w as m}from"./componentNames-Bwls0I02.js";import{u as Te}from"./useForcedRef--iGFM41p.js";import{u as Re}from"./useNumberField-AJNQGstL.js";import{T as ke}from"./Text-C4DBPFZ_.js";import"./index-ChsGqxH_.js";import"./_commonjsHelpers-Cpj98o6Y.js";import"./v4-CtRu48qb.js";import"./render-icon-BT0Aq7PA.js";import"./ButtonBase-C6zIOZ7w.js";import"./Spinner-DgGnJd2k.js";import"./defaults-B1rzzf6M.js";import"./filterHTMLAttributes-DYdLqcvH.js";import"./useHostname-Y3PlXofY.js";import"./index-DdzHuZ-Y.js";import"./index-CC6DAVyL.js";import"./text-accent-DwQPHwM2.js";import"./FieldAdditionalText-BCMB8JHW.js";import"./constants-DL6gdbsq.js";import"./index-D1pfvbUR.js";import"./tslib.es6-BntfKcQG.js";import"./hoist-non-react-statics.cjs-C-Qo8PK8.js";import"./message-B1DLZQ1U.js";import"./text-centered-BwHG-She.js";const je=({onChange:e,onValueChange:a,...n},r)=>{const i=Ie(Ne,m.InputNumber),d=Se(o=>o.target.value?Number(o.target.value):void 0,e,a);return t.jsx(Fe,{...n,type:"number",ref:r,className:i.join(" "),onChange:d,preplyDsComponent:m.InputNumber})},N=s.forwardRef(je);try{N.displayName="InputNumber",N.__docgenInfo={description:"",displayName:"InputNumber",props:{dataset:{defaultValue:null,description:"",name:"dataset",required:!1,type:{name:"enum",value:[{value:"Dataset"}]}},onClick:{defaultValue:null,description:"",name:"onClick",required:!1,type:{name:"enum",value:[{value:"MouseEventHandler<Element>"}]}},disabled:{defaultValue:null,description:"",name:"disabled",required:!1,type:{name:"enum",value:[{value:"false"},{value:"true"}]}},id:{defaultValue:null,description:"",name:"id",required:!0,type:{name:"string"}},placeholder:{defaultValue:null,description:"",name:"placeholder",required:!1,type:{name:"enum",value:[{value:"string"}]}},required:{defaultValue:null,description:"",name:"required",required:!1,type:{name:"enum",value:[{value:"false"},{value:"true"}]}},hasError:{defaultValue:null,description:"",name:"hasError",required:!1,type:{name:"enum",value:[{value:"false"},{value:"true"}]}},"aria-describedby":{defaultValue:null,description:`Identifies the element (or elements) that describes the object.
|
|
2
|
+
@see aria-labelledby`,name:"aria-describedby",required:!1,type:{name:"enum",value:[{value:"string"}]}},"aria-disabled":{defaultValue:null,description:`Indicates that the element is perceivable but disabled, so it is not editable or otherwise operable.
|
|
3
|
+
@see aria-hidden
|
|
4
|
+
@see aria-readonly.`,name:"aria-disabled",required:!1,type:{name:"enum",value:[{value:"false"},{value:"true"},{value:'"true"'},{value:'"false"'}]}},"aria-invalid":{defaultValue:null,description:`Indicates the entered value does not conform to the format expected by the application.
|
|
5
|
+
@see aria-errormessage.`,name:"aria-invalid",required:!1,type:{name:"enum",value:[{value:"false"},{value:"true"},{value:'"true"'},{value:'"false"'},{value:'"grammar"'},{value:'"spelling"'}]}},"aria-required":{defaultValue:null,description:"Indicates that user input is required on the element before a form may be submitted.",name:"aria-required",required:!1,type:{name:"enum",value:[{value:"false"},{value:"true"},{value:'"true"'},{value:'"false"'}]}},maxLength:{defaultValue:null,description:"",name:"maxLength",required:!1,type:{name:"enum",value:[{value:"number"}]}},name:{defaultValue:null,description:"",name:"name",required:!1,type:{name:"enum",value:[{value:"string"}]}},onChange:{defaultValue:null,description:"",name:"onChange",required:!1,type:{name:"enum",value:[{value:"ChangeEventHandler<Element>"}]}},onFocus:{defaultValue:null,description:"",name:"onFocus",required:!1,type:{name:"enum",value:[{value:"FocusEventHandler<Element>"}]}},onBlur:{defaultValue:null,description:"",name:"onBlur",required:!1,type:{name:"enum",value:[{value:"FocusEventHandler<Element>"}]}},onKeyDown:{defaultValue:null,description:"",name:"onKeyDown",required:!1,type:{name:"enum",value:[{value:"KeyboardEventHandler<Element>"}]}},onKeyUp:{defaultValue:null,description:"",name:"onKeyUp",required:!1,type:{name:"enum",value:[{value:"KeyboardEventHandler<Element>"}]}},onCopy:{defaultValue:null,description:"",name:"onCopy",required:!1,type:{name:"enum",value:[{value:"ClipboardEventHandler<Element>"}]}},onPaste:{defaultValue:null,description:"",name:"onPaste",required:!1,type:{name:"enum",value:[{value:"ClipboardEventHandler<Element>"}]}},readOnly:{defaultValue:null,description:"",name:"readOnly",required:!1,type:{name:"enum",value:[{value:"false"},{value:"true"}]}},value:{defaultValue:null,description:"",name:"value",required:!1,type:{name:"enum",value:[{value:"number"}]}},min:{defaultValue:null,description:"",name:"min",required:!1,type:{name:"enum",value:[{value:"number"}]}},max:{defaultValue:null,description:"",name:"max",required:!1,type:{name:"enum",value:[{value:"number"}]}},defaultValue:{defaultValue:null,description:"",name:"defaultValue",required:!1,type:{name:"enum",value:[{value:"number"}]}},onValueChange:{defaultValue:null,description:"",name:"onValueChange",required:!1,type:{name:"enum",value:[{value:"ValueChangeEventHandler<number | undefined>"}]}},ref:{defaultValue:null,description:"Allows getting a ref to the component instance.\nOnce the component unmounts, React will set `ref.current` to `null`\n(or call the ref with `null` if you passed a callback ref).\n@see {@link https://react.dev/learn/referencing-values-with-refs#refs-and-the-dom React Docs}",name:"ref",required:!1,type:{name:"enum",value:[{value:"null"},{value:"string"},{value:"(instance: InputImperativeHandle | null) => void"},{value:"RefObject<InputImperativeHandle>"}]}},key:{defaultValue:null,description:"",name:"key",required:!1,type:{name:"enum",value:[{value:"null"},{value:"string"},{value:"number"},{value:"bigint"}]}}}}}catch{}const Be="_NumberField_kx5jx_1",Pe={NumberField:Be},Le=({id:e,...a},n)=>{const r=s.useRef(null),i=Te();s.useImperativeHandle(n,()=>({setFocus:()=>{var c;return(c=r==null?void 0:r.current)==null?void 0:c.setFocus()},scrollIntoView:()=>{var c;return(c=r==null?void 0:r.current)==null?void 0:c.scrollIntoView()}}));const d=Re({id:e,...a},m.NumberField),{layoutProps:o,inputProps:F}=d,l=Ie(Pe,m.NumberField),Ce=t.jsx(N,{...F,ref:i});return t.jsx(He,{...o,className:l.join(" "),input:Ce,inputHandle:i.current,ref:r,preplyDsComponent:m.NumberField})},p=s.forwardRef(Le);try{p.displayName="NumberField",p.__docgenInfo={description:"By default, this field acts as a controlled field and expects the parent\ncomponent to manage the state, by reacting to user input via the `onChange` or\n`onValueChange` props, and providing the latest state via the `value` prop.\n\nAlternatively, you can use it as an uncontrolled field using the\n`defaultValue` prop instead of the `value` prop.",displayName:"NumberField",props:{id:{defaultValue:null,description:"",name:"id",required:!1,type:{name:"enum",value:[{value:"string"}]}},label:{defaultValue:null,description:"The field label. This is needed for accessibility purposes, but can be\nhidden using the `hideLabel` prop.",name:"label",required:!0,type:{name:"enum",value:[{value:"undefined"},{value:"null"},{value:"string"},{value:"number"},{value:"false"},{value:"true"},{value:"ReactElement<any, string | JSXElementConstructor<any>>"},{value:"Iterable<ReactNode>"},{value:"ReactPortal"}]}},requiredLabel:{defaultValue:null,description:"",name:"requiredLabel",required:!1,type:{name:"enum",value:[{value:"null"},{value:"string"},{value:"number"},{value:"false"},{value:"true"},{value:"ReactElement<any, string | JSXElementConstructor<any>>"},{value:"Iterable<ReactNode>"},{value:"ReactPortal"}]}},hideLabel:{defaultValue:null,description:"Use this to hide the `label` visually, but keep it in the accessibility\ntree.",name:"hideLabel",required:!1,type:{name:"enum",value:[{value:"false"},{value:"true"}]}},wrapLabel:{defaultValue:null,description:"",name:"wrapLabel",required:!1,type:{name:"enum",value:[{value:"false"},{value:"true"}]}},additionalText:{defaultValue:null,description:"",name:"additionalText",required:!1,type:{name:"enum",value:[{value:"null"},{value:"string"},{value:"number"},{value:"false"},{value:"true"},{value:"ReactElement<any, string | JSXElementConstructor<any>>"},{value:"Iterable<ReactNode>"},{value:"ReactPortal"}]}},preserveSpace:{defaultValue:null,description:"",name:"preserveSpace",required:!1,type:{name:"enum",value:[{value:"false"},{value:"true"}]}},hasError:{defaultValue:null,description:"",name:"hasError",required:!1,type:{name:"enum",value:[{value:"false"},{value:"true"}]}},errorMessage:{defaultValue:null,description:"",name:"errorMessage",required:!1,type:{name:"enum",value:[{value:"null"},{value:"string"},{value:"number"},{value:"false"},{value:"true"},{value:"ReactElement<any, string | JSXElementConstructor<any>>"},{value:"Iterable<ReactNode>"},{value:"ReactPortal"}]}},dataset:{defaultValue:null,description:"",name:"dataset",required:!1,type:{name:"enum",value:[{value:"Dataset"}]}},inputDataset:{defaultValue:null,description:"",name:"inputDataset",required:!1,type:{name:"enum",value:[{value:"Dataset"}]}},onClick:{defaultValue:null,description:"",name:"onClick",required:!1,type:{name:"enum",value:[{value:"MouseEventHandler<Element>"}]}},disabled:{defaultValue:null,description:"",name:"disabled",required:!1,type:{name:"enum",value:[{value:"false"},{value:"true"}]}},placeholder:{defaultValue:null,description:"",name:"placeholder",required:!1,type:{name:"enum",value:[{value:"string"}]}},required:{defaultValue:null,description:"",name:"required",required:!1,type:{name:"enum",value:[{value:"false"},{value:"true"}]}},maxLength:{defaultValue:null,description:"",name:"maxLength",required:!1,type:{name:"enum",value:[{value:"number"}]}},name:{defaultValue:null,description:"",name:"name",required:!1,type:{name:"enum",value:[{value:"string"}]}},value:{defaultValue:null,description:"",name:"value",required:!1,type:{name:"enum",value:[{value:"number"}]}},defaultValue:{defaultValue:null,description:"",name:"defaultValue",required:!1,type:{name:"enum",value:[{value:"number"}]}},onChange:{defaultValue:null,description:"",name:"onChange",required:!1,type:{name:"enum",value:[{value:"ChangeEventHandler<Element>"}]}},onFocus:{defaultValue:null,description:"",name:"onFocus",required:!1,type:{name:"enum",value:[{value:"FocusEventHandler<Element>"}]}},onBlur:{defaultValue:null,description:"",name:"onBlur",required:!1,type:{name:"enum",value:[{value:"FocusEventHandler<Element>"}]}},onKeyDown:{defaultValue:null,description:"",name:"onKeyDown",required:!1,type:{name:"enum",value:[{value:"KeyboardEventHandler<Element>"}]}},onKeyUp:{defaultValue:null,description:"",name:"onKeyUp",required:!1,type:{name:"enum",value:[{value:"KeyboardEventHandler<Element>"}]}},onCopy:{defaultValue:null,description:"",name:"onCopy",required:!1,type:{name:"enum",value:[{value:"ClipboardEventHandler<Element>"}]}},onPaste:{defaultValue:null,description:"",name:"onPaste",required:!1,type:{name:"enum",value:[{value:"ClipboardEventHandler<Element>"}]}},readOnly:{defaultValue:null,description:"",name:"readOnly",required:!1,type:{name:"enum",value:[{value:"false"},{value:"true"}]}},onValueChange:{defaultValue:null,description:"",name:"onValueChange",required:!1,type:{name:"enum",value:[{value:"ValueChangeEventHandler<number | undefined>"}]}},min:{defaultValue:null,description:"",name:"min",required:!1,type:{name:"enum",value:[{value:"number"}]}},max:{defaultValue:null,description:"",name:"max",required:!1,type:{name:"enum",value:[{value:"number"}]}},icon:{defaultValue:null,description:"",name:"icon",required:!1,type:{name:"enum",value:[{value:"ReactElement<IconProps, string | JSXElementConstructor<any>>"}]}},ref:{defaultValue:null,description:"Allows getting a ref to the component instance.\nOnce the component unmounts, React will set `ref.current` to `null`\n(or call the ref with `null` if you passed a callback ref).\n@see {@link https://react.dev/learn/referencing-values-with-refs#refs-and-the-dom React Docs}",name:"ref",required:!1,type:{name:"enum",value:[{value:"null"},{value:"string"},{value:"(instance: InputImperativeHandle | null) => void"},{value:"RefObject<InputImperativeHandle>"}]}},key:{defaultValue:null,description:"",name:"key",required:!1,type:{name:"enum",value:[{value:"null"},{value:"string"},{value:"number"},{value:"bigint"}]}}}}}catch{}const ha={title:"components/NumberField",component:p,args:{label:"Number",placeholder:"Enter a number",inputDataset:{testid:"input"},onChange:u("onChange"),onBlur:u("onBlur"),onFocus:u("onFocus"),onClick:u("onClick"),onCopy:u("onCopy"),onKeyDown:u("onKeyDown"),onKeyUp:u("onKeyUp"),onPaste:u("onPaste"),onValueChange:u("onValueChange")},render:function(a){const n=s.useRef(null);return a.ref=n,t.jsx(p,{...a})}},v={parameters:{docs:{description:{story:"An empty field with a `label` and a `placeholder`."}}}},f={args:{defaultValue:100},play:async({canvas:e,step:a})=>{await a("Validate defaultValue",async()=>{const n=e.getByTestId("input");await S(n).toHaveValue(100)}),await a("Type to value",async()=>{const n=e.getByTestId("input");await xe.type(n,",500"),await S(n).toHaveValue(100500)})}},y={args:{icon:t.jsx(we,{svg:Ee})}},h={args:{additionalText:"This is additional text"}},b={args:{required:!0}},g={args:{required:!0,requiredLabel:t.jsx(ke,{accent:"critical",variant:"m-bold",children:"Needed"})}},V={args:{hideLabel:!0}},x={args:{hasError:!0}},q={args:{hasError:!0,errorMessage:"This is an error message"}},E={args:{disabled:!0}},w={args:{readOnly:!0}},I={decorators:[(e,{args:a})=>t.jsxs("div",{style:{padding:"8px",margin:"8px"},children:[t.jsxs("p",{children:["You can"," ",t.jsx(R,{variant:"secondary",dataset:{testid:"focus-button"},onClick:()=>{var n,r;return(r=(n=a.ref)==null?void 0:n.current)==null?void 0:r.setFocus()},children:"Focus"})," ","the input imperatively."]}),t.jsx(e,{})]})],play:async({args:e,canvas:a})=>{if(!T(e.ref))throw new Error("Expected ref.current to be an InputImperativeHandle");const n=a.getByTestId("input");await xe.click(a.getByTestId("focus-button")),await qe(()=>S(n).toHaveFocus())}},C={decorators:[(e,{args:a})=>t.jsxs("div",{style:{height:"300px",overflow:"scroll",padding:"8px",margin:"8px"},children:[t.jsxs("p",{children:["You can"," ",t.jsx(R,{variant:"secondary",dataset:{testid:"scroll-button"},onClick:()=>{if(!T(a.ref))throw new Error("Expected ref.current to be an InputImperativeHandle");a.ref.current.scrollIntoView()},children:"Scroll"})," ","the input into view imperatively."]}),t.jsx("div",{style:{height:"1000px",display:"flex",flexDirection:"column",justifyContent:"end",border:"2px dashed lightgray",padding:"16px"},children:t.jsx(e,{})})]})],play:async({args:e,canvas:a})=>{if(!T(e.ref))throw new Error("Expected ref.current to be an InputImperativeHandle");const n=a.getByTestId("input");e.ref.current.scrollIntoView(),await qe(()=>S(n).toBeVisible())}};function T(e){return typeof e=="object"&&e!==null&&"current"in e&&e.current!==null&&typeof e.current=="object"&&"setFocus"in e.current}const H={tags:["!test"],parameters:{docs:{description:{story:'\nThe following code renders a `Numberfield` with the `required` flag, a `min`\nand `max` value, an `icon`, a `placeholder`, and some `additionalText`.\n\nWhen you click the "Submit" button and the input value is empty\n- it displays feedback via the `errorMessage` prop;\n- and uses the `setFocus()` API to bring the focus back to the field.\n\nIt uses the `value` and `onValueChange` props to react to the user input.\n'}},chromatic:{disableSnapshot:!0}},render:function(){const a=s.useRef(null),[n,r]=s.useState(void 0),[i,d]=s.useState(!1),o=l=>{if(l===void 0)return"Please provide a number";if(l!==Math.round(l))return"Please provide a whole number";if(l<10)return"Please book at least 10 lessons";if(l>99)return"Please book less than 100 lessons"},F=()=>{var l;d(!0),n||(l=a==null?void 0:a.current)==null||l.setFocus()};return t.jsxs("div",{style:{maxWidth:"500px",display:"flex",flexDirection:"column"},children:[t.jsx(p,{id:"lessons",name:"lessons",label:"Number of lessons",icon:t.jsx(we,{svg:Ee}),placeholder:"How about 3?",value:n,additionalText:"These lessons will be scheduled automatically",onValueChange:r,errorMessage:i?o(n):void 0,min:10,max:99,ref:a,required:!0}),t.jsx(R,{onClick:F,children:"Submit"})]})}};var k,j,B;v.parameters={...v.parameters,docs:{...(k=v.parameters)==null?void 0:k.docs,source:{originalSource:`{
|
|
6
|
+
parameters: {
|
|
7
|
+
docs: {
|
|
8
|
+
description: {
|
|
9
|
+
story: \`An empty field with a \\\`label\\\` and a \\\`placeholder\\\`.\`
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
}`,...(B=(j=v.parameters)==null?void 0:j.docs)==null?void 0:B.source}}};var P,L,D;f.parameters={...f.parameters,docs:{...(P=f.parameters)==null?void 0:P.docs,source:{originalSource:`{
|
|
14
|
+
args: {
|
|
15
|
+
defaultValue: 100
|
|
16
|
+
},
|
|
17
|
+
play: async ({
|
|
18
|
+
canvas,
|
|
19
|
+
step
|
|
20
|
+
}) => {
|
|
21
|
+
await step('Validate defaultValue', async () => {
|
|
22
|
+
const input = canvas.getByTestId<HTMLInputElement>('input');
|
|
23
|
+
await expect(input).toHaveValue(100);
|
|
24
|
+
});
|
|
25
|
+
await step('Type to value', async () => {
|
|
26
|
+
const input = canvas.getByTestId<HTMLInputElement>('input');
|
|
27
|
+
await userEvent.type(input, ',500');
|
|
28
|
+
await expect(input).toHaveValue(100_500);
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
}`,...(D=(L=f.parameters)==null?void 0:L.docs)==null?void 0:D.source}}};var _,M,K;y.parameters={...y.parameters,docs:{...(_=y.parameters)==null?void 0:_.docs,source:{originalSource:`{
|
|
32
|
+
args: {
|
|
33
|
+
icon: <Icon svg={PhoneSvg} />
|
|
34
|
+
}
|
|
35
|
+
}`,...(K=(M=y.parameters)==null?void 0:M.docs)==null?void 0:K.source}}};var W,O,A;h.parameters={...h.parameters,docs:{...(W=h.parameters)==null?void 0:W.docs,source:{originalSource:`{
|
|
36
|
+
args: {
|
|
37
|
+
additionalText: 'This is additional text'
|
|
38
|
+
}
|
|
39
|
+
}`,...(A=(O=h.parameters)==null?void 0:O.docs)==null?void 0:A.source}}};var U,J,X;b.parameters={...b.parameters,docs:{...(U=b.parameters)==null?void 0:U.docs,source:{originalSource:`{
|
|
40
|
+
args: {
|
|
41
|
+
required: true
|
|
42
|
+
}
|
|
43
|
+
}`,...(X=(J=b.parameters)==null?void 0:J.docs)==null?void 0:X.source}}};var Y,$,z;g.parameters={...g.parameters,docs:{...(Y=g.parameters)==null?void 0:Y.docs,source:{originalSource:`{
|
|
44
|
+
args: {
|
|
45
|
+
required: true,
|
|
46
|
+
requiredLabel: <Text accent="critical" variant="m-bold">
|
|
47
|
+
Needed
|
|
48
|
+
</Text>
|
|
49
|
+
}
|
|
50
|
+
}`,...(z=($=g.parameters)==null?void 0:$.docs)==null?void 0:z.source}}};var G,Q,Z;V.parameters={...V.parameters,docs:{...(G=V.parameters)==null?void 0:G.docs,source:{originalSource:`{
|
|
51
|
+
args: {
|
|
52
|
+
hideLabel: true
|
|
53
|
+
}
|
|
54
|
+
}`,...(Z=(Q=V.parameters)==null?void 0:Q.docs)==null?void 0:Z.source}}};var ee,ae,ne;x.parameters={...x.parameters,docs:{...(ee=x.parameters)==null?void 0:ee.docs,source:{originalSource:`{
|
|
55
|
+
args: {
|
|
56
|
+
hasError: true
|
|
57
|
+
}
|
|
58
|
+
}`,...(ne=(ae=x.parameters)==null?void 0:ae.docs)==null?void 0:ne.source}}};var te,re,le;q.parameters={...q.parameters,docs:{...(te=q.parameters)==null?void 0:te.docs,source:{originalSource:`{
|
|
59
|
+
args: {
|
|
60
|
+
hasError: true,
|
|
61
|
+
errorMessage: 'This is an error message'
|
|
62
|
+
}
|
|
63
|
+
}`,...(le=(re=q.parameters)==null?void 0:re.docs)==null?void 0:le.source}}};var ue,se,ie;E.parameters={...E.parameters,docs:{...(ue=E.parameters)==null?void 0:ue.docs,source:{originalSource:`{
|
|
64
|
+
args: {
|
|
65
|
+
disabled: true
|
|
66
|
+
}
|
|
67
|
+
}`,...(ie=(se=E.parameters)==null?void 0:se.docs)==null?void 0:ie.source}}};var oe,de,ce;w.parameters={...w.parameters,docs:{...(oe=w.parameters)==null?void 0:oe.docs,source:{originalSource:`{
|
|
68
|
+
args: {
|
|
69
|
+
readOnly: true
|
|
70
|
+
}
|
|
71
|
+
}`,...(ce=(de=w.parameters)==null?void 0:de.docs)==null?void 0:ce.source}}};var me,pe,ve;I.parameters={...I.parameters,docs:{...(me=I.parameters)==null?void 0:me.docs,source:{originalSource:`{
|
|
72
|
+
decorators: [(Story, {
|
|
73
|
+
args
|
|
74
|
+
}) => <div style={{
|
|
75
|
+
padding: '8px',
|
|
76
|
+
margin: '8px'
|
|
77
|
+
}}>
|
|
78
|
+
<p>
|
|
79
|
+
You can{' '}
|
|
80
|
+
<Button variant="secondary" dataset={{
|
|
81
|
+
testid: 'focus-button'
|
|
82
|
+
}} onClick={() =>
|
|
83
|
+
// @ts-expect-error - This will fail gracefully,
|
|
84
|
+
// and the \`play\` function will assert it properly
|
|
85
|
+
args.ref?.current?.setFocus()}>
|
|
86
|
+
Focus
|
|
87
|
+
</Button>{' '}
|
|
88
|
+
the input imperatively.
|
|
89
|
+
</p>
|
|
90
|
+
<Story />
|
|
91
|
+
</div>],
|
|
92
|
+
play: async ({
|
|
93
|
+
args,
|
|
94
|
+
canvas
|
|
95
|
+
}) => {
|
|
96
|
+
if (!isImperativeHandleRef(args.ref)) {
|
|
97
|
+
throw new Error('Expected ref.current to be an InputImperativeHandle');
|
|
98
|
+
}
|
|
99
|
+
const input = canvas.getByTestId('input');
|
|
100
|
+
await userEvent.click(canvas.getByTestId('focus-button'));
|
|
101
|
+
await waitFor(() => expect(input).toHaveFocus());
|
|
102
|
+
}
|
|
103
|
+
}`,...(ve=(pe=I.parameters)==null?void 0:pe.docs)==null?void 0:ve.source}}};var fe,ye,he;C.parameters={...C.parameters,docs:{...(fe=C.parameters)==null?void 0:fe.docs,source:{originalSource:`{
|
|
104
|
+
decorators: [(Story, {
|
|
105
|
+
args
|
|
106
|
+
}) => <div style={{
|
|
107
|
+
height: '300px',
|
|
108
|
+
overflow: 'scroll',
|
|
109
|
+
padding: '8px',
|
|
110
|
+
margin: '8px'
|
|
111
|
+
}}>
|
|
112
|
+
<p>
|
|
113
|
+
You can{' '}
|
|
114
|
+
<Button variant="secondary" dataset={{
|
|
115
|
+
testid: 'scroll-button'
|
|
116
|
+
}} onClick={() => {
|
|
117
|
+
if (!isImperativeHandleRef(args.ref)) {
|
|
118
|
+
throw new Error('Expected ref.current to be an InputImperativeHandle');
|
|
119
|
+
}
|
|
120
|
+
args.ref.current.scrollIntoView();
|
|
121
|
+
}}>
|
|
122
|
+
Scroll
|
|
123
|
+
</Button>{' '}
|
|
124
|
+
the input into view imperatively.
|
|
125
|
+
</p>
|
|
126
|
+
<div style={{
|
|
127
|
+
height: '1000px',
|
|
128
|
+
display: 'flex',
|
|
129
|
+
flexDirection: 'column',
|
|
130
|
+
justifyContent: 'end',
|
|
131
|
+
border: '2px dashed lightgray',
|
|
132
|
+
padding: '16px'
|
|
133
|
+
}}>
|
|
134
|
+
<Story />
|
|
135
|
+
</div>
|
|
136
|
+
</div>],
|
|
137
|
+
play: async ({
|
|
138
|
+
args,
|
|
139
|
+
canvas
|
|
140
|
+
}) => {
|
|
141
|
+
if (!isImperativeHandleRef(args.ref)) {
|
|
142
|
+
throw new Error('Expected ref.current to be an InputImperativeHandle');
|
|
143
|
+
}
|
|
144
|
+
const input = canvas.getByTestId('input');
|
|
145
|
+
args.ref.current.scrollIntoView();
|
|
146
|
+
await waitFor(() => expect(input).toBeVisible());
|
|
147
|
+
}
|
|
148
|
+
}`,...(he=(ye=C.parameters)==null?void 0:ye.docs)==null?void 0:he.source}}};var be,ge,Ve;H.parameters={...H.parameters,docs:{...(be=H.parameters)==null?void 0:be.docs,source:{originalSource:`{
|
|
149
|
+
tags: ['!test'],
|
|
150
|
+
parameters: {
|
|
151
|
+
docs: {
|
|
152
|
+
description: {
|
|
153
|
+
story: \`
|
|
154
|
+
The following code renders a \\\`Numberfield\\\` with the \\\`required\\\` flag, a \\\`min\\\`
|
|
155
|
+
and \\\`max\\\` value, an \\\`icon\\\`, a \\\`placeholder\\\`, and some \\\`additionalText\\\`.
|
|
156
|
+
|
|
157
|
+
When you click the "Submit" button and the input value is empty
|
|
158
|
+
- it displays feedback via the \\\`errorMessage\\\` prop;
|
|
159
|
+
- and uses the \\\`setFocus()\\\` API to bring the focus back to the field.
|
|
160
|
+
|
|
161
|
+
It uses the \\\`value\\\` and \\\`onValueChange\\\` props to react to the user input.
|
|
162
|
+
\`
|
|
163
|
+
}
|
|
164
|
+
},
|
|
165
|
+
chromatic: {
|
|
166
|
+
disableSnapshot: true
|
|
167
|
+
}
|
|
168
|
+
},
|
|
169
|
+
render: function Story() {
|
|
170
|
+
const fieldRef = useRef<InputImperativeHandle>(null);
|
|
171
|
+
const [value, setValue] = useState<number | undefined>(undefined);
|
|
172
|
+
const [submited, setSubmitted] = useState(false);
|
|
173
|
+
const getErrorMessage = (attempt?: number) => {
|
|
174
|
+
if (attempt === undefined) {
|
|
175
|
+
return 'Please provide a number';
|
|
176
|
+
}
|
|
177
|
+
if (attempt !== Math.round(attempt)) {
|
|
178
|
+
return 'Please provide a whole number';
|
|
179
|
+
}
|
|
180
|
+
if (attempt < 10) {
|
|
181
|
+
return 'Please book at least 10 lessons';
|
|
182
|
+
}
|
|
183
|
+
if (attempt > 99) {
|
|
184
|
+
return 'Please book less than 100 lessons';
|
|
185
|
+
}
|
|
186
|
+
return undefined;
|
|
187
|
+
};
|
|
188
|
+
const handleClick = () => {
|
|
189
|
+
setSubmitted(true);
|
|
190
|
+
if (!value) {
|
|
191
|
+
fieldRef?.current?.setFocus();
|
|
192
|
+
}
|
|
193
|
+
};
|
|
194
|
+
return <div style={{
|
|
195
|
+
maxWidth: '500px',
|
|
196
|
+
display: 'flex',
|
|
197
|
+
flexDirection: 'column'
|
|
198
|
+
}}>
|
|
199
|
+
<NumberField id="lessons" name="lessons" label="Number of lessons" icon={<Icon svg={PhoneSvg} />} placeholder="How about 3?" value={value} additionalText="These lessons will be scheduled automatically" onValueChange={setValue} errorMessage={submited ? getErrorMessage(value) : undefined} min={10} max={99} ref={fieldRef} required />
|
|
200
|
+
<Button onClick={handleClick}>Submit</Button>
|
|
201
|
+
</div>;
|
|
202
|
+
}
|
|
203
|
+
}`,...(Ve=(ge=H.parameters)==null?void 0:ge.docs)==null?void 0:Ve.source}}};const ba=["Basic","WithValue","WithIcon","WithAdditionalText","Required","RequiredWithCustomLabel","WithHiddenLabel","HasError","HasErrorWithMessage","Disabled","ReadOnly","ImperativeSetFocus","ImperativeScrollIntoView","Example"];export{v as Basic,E as Disabled,H as Example,x as HasError,q as HasErrorWithMessage,C as ImperativeScrollIntoView,I as ImperativeSetFocus,w as ReadOnly,b as Required,g as RequiredWithCustomLabel,h as WithAdditionalText,V as WithHiddenLabel,y as WithIcon,f as WithValue,ba as __namedExportsOrder,ha as default};
|
|
@@ -5,4 +5,4 @@ Triggers a callback when the wrapped component intersects with the viewport.
|
|
|
5
5
|
This can be useful in several use cases. Examples:
|
|
6
6
|
|
|
7
7
|
- Track an experiment, once a certain component scrolls into view.
|
|
8
|
-
- Trigger an animation, or a feature (e.g.: onboarding instructions).`,displayName:"ObserveIntersection",props:{onIntersect:{defaultValue:null,description:"",name:"onIntersect",required:!0,type:{name:"() => void"}},once:{defaultValue:null,description:"",name:"once",required:!1,type:{name:"enum",value:[{value:"false"},{value:"true"}]}},threshold:{defaultValue:null,description:"",name:"threshold",required:!1,type:{name:"enum",value:[{value:"number"}]}},tag:{defaultValue:null,description:"",name:"tag",required:!1,type:{name:"enum",value:[{value:'"
|
|
8
|
+
- Trigger an animation, or a feature (e.g.: onboarding instructions).`,displayName:"ObserveIntersection",props:{onIntersect:{defaultValue:null,description:"",name:"onIntersect",required:!0,type:{name:"() => void"}},once:{defaultValue:null,description:"",name:"once",required:!1,type:{name:"enum",value:[{value:"false"},{value:"true"}]}},threshold:{defaultValue:null,description:"",name:"threshold",required:!1,type:{name:"enum",value:[{value:"number"}]}},tag:{defaultValue:null,description:"",name:"tag",required:!1,type:{name:"enum",value:[{value:'"p"'},{value:'"div"'},{value:'"span"'},{value:'"main"'},{value:'"header"'},{value:'"footer"'},{value:'"article"'},{value:'"section"'},{value:'"ul"'},{value:'"ol"'},{value:'"li"'},{value:'"fieldset"'},{value:'"table"'},{value:'"th"'},{value:'"tr"'},{value:'"td"'},{value:'"thead"'},{value:'"tfoot"'},{value:'"tbody"'},{value:'"caption"'},{value:'"figure"'},{value:'"figcaption"'}]}},dataset:{defaultValue:null,description:"",name:"dataset",required:!1,type:{name:"enum",value:[{value:"Dataset"}]}}}}}catch{}export{o as O};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as t}from"./jsx-runtime-BTJTZTIL.js";import{r as a}from"./index-Cb9e4tly.js";import{O as i}from"./ObserveIntersection-
|
|
1
|
+
import{j as t}from"./jsx-runtime-BTJTZTIL.js";import{r as a}from"./index-Cb9e4tly.js";import{O as i}from"./ObserveIntersection-Ccn6ggRl.js";import"./index-ChsGqxH_.js";import"./_commonjsHelpers-Cpj98o6Y.js";import"./index-DdzHuZ-Y.js";import"./defaults-B1rzzf6M.js";import"./componentNames-Bwls0I02.js";const g={title:"components/ObserveIntersection",component:i,parameters:{tags:["!test"],chromatic:{disableSnapshot:!0}}},e=()=>{const[o,c]=a.useState(!1);return t.jsxs("div",{tabIndex:0,style:{height:"200px",overflowY:"scroll",position:"relative"},children:[t.jsx("div",{style:{position:"sticky",top:"2px"},children:o?"Intersected":"Scroll down to intersect"}),t.jsx("div",{style:{height:"400px",display:"flex",alignItems:"end"},children:t.jsx(i,{onIntersect:()=>c(!0),children:"Observer"})})]})};e.storyName="ObserveIntersection";var s,n,r;e.parameters={...e.parameters,docs:{...(s=e.parameters)==null?void 0:s.docs,source:{originalSource:`() => {
|
|
2
2
|
const [isIntersecting, setIsIntersecting] = useState(false);
|
|
3
3
|
return (
|
|
4
4
|
// eslint-disable-next-line jsx-a11y/no-noninteractive-tabindex -- This element is interactive; it's scrollable.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as a}from"./jsx-runtime-BTJTZTIL.js";import{r as n}from"./index-Cb9e4tly.js";import{R
|
|
1
|
+
import{j as a}from"./jsx-runtime-BTJTZTIL.js";import{r as n}from"./index-Cb9e4tly.js";import{R,A as V,P as q,C as x,a as O,b as N}from"./index-BOrXX8UK.js";import{F as E}from"./TokyoUIClose-thK8sk63.js";import{I as k}from"./Icon-BNvtTXpG.js";import{T as P}from"./Text-C4DBPFZ_.js";import{B as j}from"./Button-Dy26oY0t.js";import{H as T}from"./Heading-DPPEK9A1.js";import{u as S}from"./index-D1pfvbUR.js";import{g as D}from"./shared-strings-Biv7UF3M.js";import{i as L}from"./PortalElementProvider-BRcRijdp.js";import{g as M}from"./index-DdzHuZ-Y.js";import{w as H}from"./componentNames-Bwls0I02.js";import{M as J}from"./message-B1DLZQ1U.js";const X="_content_i6mwc_2",B="_header_i6mwc_23",U="_close_i6mwc_29",A="_footer_i6mwc_43",F="_arrow_i6mwc_49",o={content:X,header:B,close:U,footer:A,arrow:F},G=e=>{e.scrollIntoViewIfNeeded?e.scrollIntoViewIfNeeded(!1):e.scrollIntoView({behavior:"auto",block:"nearest",inline:"nearest"})},m=({open:e,onOpenChange:r,disabled:i,title:u,text:s,children:t,side:l,dataset:h,actionLabel:b=a.jsx(J,{id:"preply-ds.onboardingTooltip.actionLabel",defaultMessage:"Got it",description:"Default onboarding tooltip action label. Used to acknowledge and close the tooltip."}),actionOnClick:g,actionHref:y,counter:C,autoScroll:v=!0})=>{const{formatMessage:w}=S(),I=L(),f=n.useId(),_=n.useId(),d=n.useId(),c=n.useRef(null);return n.useEffect(()=>{e&&c.current&&v&&G(c.current)},[v,e]),i?t:a.jsxs(R,{open:e,onOpenChange:r,children:[a.jsx(V,{ref:c,id:d,asChild:!0,children:t}),a.jsx(q,{container:I,children:a.jsxs(x,{side:l,className:o.content,"aria-labelledby":f,"aria-describedby":`${d} ${_}`,...M(h,{preplyDsComponent:H.OnboardingTooltip}),children:[a.jsxs("div",{className:o.header,children:[a.jsx(O,{className:o.close,"aria-label":w(D.close),"data-testid":"close",children:a.jsx(k,{accent:"inverted",svg:E})}),a.jsx(T,{tag:"h1",variant:"small",accent:"inverted",id:f,"aria-describedby":d,children:u})]}),a.jsx(P,{variant:"default-regular",accent:"inverted",children:s}),a.jsxs("div",{className:o.footer,children:[C,a.jsx(j,{variant:"inverted",size:"small",onClick:g,href:y,dataset:{testid:"action"},wrap:!0,children:b})]}),a.jsx(N,{"aria-hidden":!0,className:o.arrow,width:18,height:11})]})})]})},p=e=>{const[r,i]=n.useState(!0),u=t=>{var l;t||(l=e.onClose)==null||l.call(e),i(t)},s=()=>{var t,l;(t=e.actionOnClick)==null||t.call(e),i(!1),(l=e.onClose)==null||l.call(e)};return a.jsx(m,{...e,open:r,onOpenChange:u,actionOnClick:s})};try{m.displayName="InternalOnboardingTooltip",m.__docgenInfo={description:"",displayName:"InternalOnboardingTooltip",props:{title:{defaultValue:null,description:"",name:"title",required:!0,type:{name:"enum",value:[{value:"undefined"},{value:"null"},{value:"string"},{value:"number"},{value:"false"},{value:"true"},{value:"ReactElement<any, string | JSXElementConstructor<any>>"},{value:"Iterable<ReactNode>"},{value:"ReactPortal"}]}},text:{defaultValue:null,description:"",name:"text",required:!0,type:{name:"enum",value:[{value:"undefined"},{value:"null"},{value:"string"},{value:"number"},{value:"false"},{value:"true"},{value:"ReactElement<any, string | JSXElementConstructor<any>>"},{value:"Iterable<ReactNode>"},{value:"ReactPortal"}]}},disabled:{defaultValue:null,description:"Disables tooltip completely",name:"disabled",required:!1,type:{name:"enum",value:[{value:"false"},{value:"true"}]}},onClose:{defaultValue:null,description:"Called when the tooltip is closed",name:"onClose",required:!1,type:{name:"enum",value:[{value:"() => void"}]}},actionLabel:{defaultValue:{value:`(
|
|
2
2
|
<FormattedMessage
|
|
3
3
|
id="preply-ds.onboardingTooltip.actionLabel"
|
|
4
4
|
defaultMessage="Got it"
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
._content_i6mwc_2{background-color:var(--79dffb);border-radius:var(--fa4b1a);padding:var(--558c4c);box-shadow:var(--df7dbb);width:304px;display:flex;flex-direction:column;gap:var(--813599);z-index:var(--ds-onboarding-tooltip-z-index-override, auto);animation-duration:.15s;animation-timing-function:cubic-bezier(.25,0,.5,1.3);transform-origin:var(--radix-popover-content-transform-origin);will-change:transform,opacity}._content_i6mwc_2[data-state=open]{animation-name:_appear_i6mwc_1}._content_i6mwc_2[data-state=closed]{animation-name:_disappear_i6mwc_1}._header_i6mwc_23{display:flex;flex-direction:row-reverse;justify-content:space-between;align-items:flex-start}._close_i6mwc_29{background:none;border:none;border-radius:var(--5e8be4);padding:0;margin:0;cursor:pointer}._close_i6mwc_29:focus-visible{outline-style:solid;outline-color:var(--603ec6);outline-width:var(--99d31f);outline-offset:var(--c0b12c)}._footer_i6mwc_43{display:flex;justify-content:flex-end;gap:var(--813599);align-items:center}._arrow_i6mwc_49{fill:var(--79dffb)}@keyframes _appear_i6mwc_1{0%{opacity:0;transform:scale(0)}to{opacity:1;transform:scale(1)}}@keyframes _disappear_i6mwc_1{0%{opacity:1;transform:scale(1)}to{opacity:0;transform:scale(0)}}
|
package/dist/assets/{OnboardingTooltip.stories-Jgwhw8B7.js → OnboardingTooltip.stories-C7TCPsRd.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as e}from"./jsx-runtime-BTJTZTIL.js";import{O as u}from"./OnboardingTooltip-
|
|
1
|
+
import{j as e}from"./jsx-runtime-BTJTZTIL.js";import{O as u}from"./OnboardingTooltip-DuoU0OG7.js";import{I as g}from"./IconButton-DMtc1AqT.js";import{F as x}from"./TokyoUIFav-DOVerCtW.js";import"./index-ChsGqxH_.js";import"./index-Cb9e4tly.js";import"./_commonjsHelpers-Cpj98o6Y.js";import"./index-BOrXX8UK.js";import"./PortalElementProvider-BRcRijdp.js";import"./index-BPrLDK9Y.js";import"./index-C7hTFOIV.js";import"./index-M3hvtcRE.js";import"./tslib.es6-BntfKcQG.js";import"./index-DOA2-rRC.js";import"./TokyoUIClose-thK8sk63.js";import"./Icon-BNvtTXpG.js";import"./text-accent-DwQPHwM2.js";import"./classNames-BUL1Zq7e.js";import"./filterHTMLAttributes-DYdLqcvH.js";import"./render-icon-BT0Aq7PA.js";import"./componentNames-Bwls0I02.js";import"./index-DdzHuZ-Y.js";import"./defaults-B1rzzf6M.js";import"./Text-C4DBPFZ_.js";import"./text-centered-BwHG-She.js";import"./Button-Dy26oY0t.js";import"./ButtonBase-C6zIOZ7w.js";import"./Spinner-DgGnJd2k.js";import"./useHostname-Y3PlXofY.js";import"./index-CC6DAVyL.js";import"./Heading-DPPEK9A1.js";import"./index-D1pfvbUR.js";import"./hoist-non-react-statics.cjs-C-Qo8PK8.js";import"./shared-strings-Biv7UF3M.js";import"./message-B1DLZQ1U.js";const ee={title:"Components/OnboardingTooltip",component:u,parameters:{docs:{story:{inline:!1,height:250},description:{component:"Are you looking for a step-by-step tour? Check out [OnboardingTour](/docs/components-onboardingtour--docs)"}},a11y:{config:{rules:[{id:"color-contrast",enabled:!1}]}}},decorators:[t=>e.jsx("div",{style:{margin:"auto",width:"max-content"},children:t()})]},f=t=>[!1,!1],h=t=>a=>{},o=()=>{const[t,a]=f(),v=h();return e.jsx(u,{title:"New Feature Available!",text:"We've added an exciting new feature to enhance your experience.",disabled:a||t,onClose:()=>v(!0),children:e.jsx(g,{variant:"ghost",svg:e.jsx(x,{}),assistiveText:"Favorite"})})};o.storyName="OnboardingTooltip";const r={tags:["!autodocs"],args:{title:"New Feature Available!",text:"We've added an exciting new feature to enhance your experience.",disabled:!1,onClose:()=>{},children:e.jsx(g,{variant:"ghost",svg:e.jsx(x,{}),assistiveText:"Favorite"})},argTypes:{title:{control:"text"},text:{control:"text"},actionLabel:{control:"text"},actionOnClick:{control:!1},actionHref:{control:"text"},disabled:{control:"boolean"},dataset:{control:"object"},onClose:{control:!1},children:{control:!1}},parameters:{docs:{story:{height:450}},chromatic:{disableSnapshot:!0}},decorators:[t=>e.jsx("div",{style:{minHeight:"100vh",display:"flex"},children:e.jsx("div",{style:{margin:"auto",width:"max-content"},children:t()})})]};var i,n,s,l,c;o.parameters={...o.parameters,docs:{...(i=o.parameters)==null?void 0:i.docs,source:{originalSource:`() => {
|
|
2
2
|
const [wasTooltipSeen, loading] = useIsFeatureActive('new-feature');
|
|
3
3
|
const setTooltipSeen = useToggleFeature('new-feature');
|
|
4
4
|
return <OnboardingTooltip title="New Feature Available!" text="We've added an exciting new feature to enhance your experience." disabled={loading || wasTooltipSeen} onClose={() => setTooltipSeen(true)}>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as c}from"./jsx-runtime-BTJTZTIL.js";import{O as b}from"./OnboardingTooltip-
|
|
1
|
+
import{j as c}from"./jsx-runtime-BTJTZTIL.js";import{O as b}from"./OnboardingTooltip-DuoU0OG7.js";import{I as T}from"./IconButton-DMtc1AqT.js";import{F as g}from"./TokyoUIFav-DOVerCtW.js";import{a as s,w as r,e as p,u as v}from"./index-BVDq5o4N.js";import"./index-ChsGqxH_.js";import"./index-Cb9e4tly.js";import"./_commonjsHelpers-Cpj98o6Y.js";import"./index-BOrXX8UK.js";import"./PortalElementProvider-BRcRijdp.js";import"./index-BPrLDK9Y.js";import"./index-C7hTFOIV.js";import"./index-M3hvtcRE.js";import"./tslib.es6-BntfKcQG.js";import"./index-DOA2-rRC.js";import"./TokyoUIClose-thK8sk63.js";import"./Icon-BNvtTXpG.js";import"./text-accent-DwQPHwM2.js";import"./classNames-BUL1Zq7e.js";import"./filterHTMLAttributes-DYdLqcvH.js";import"./render-icon-BT0Aq7PA.js";import"./componentNames-Bwls0I02.js";import"./index-DdzHuZ-Y.js";import"./defaults-B1rzzf6M.js";import"./Text-C4DBPFZ_.js";import"./text-centered-BwHG-She.js";import"./Button-Dy26oY0t.js";import"./ButtonBase-C6zIOZ7w.js";import"./Spinner-DgGnJd2k.js";import"./useHostname-Y3PlXofY.js";import"./index-CC6DAVyL.js";import"./Heading-DPPEK9A1.js";import"./index-D1pfvbUR.js";import"./hoist-non-react-statics.cjs-C-Qo8PK8.js";import"./shared-strings-Biv7UF3M.js";import"./message-B1DLZQ1U.js";const et={title:"Components/OnboardingTooltip/Tests",component:b,parameters:{layout:"centered",controls:{disable:!0},chromatic:{disableSnapshot:!0}},tags:["!autodocs","!a11y-test","test"],decorators:[e=>c.jsx("div",{style:{margin:"100px 0"},children:e()})],args:{title:"Title",text:"Body text",actionLabel:"Action label",disabled:!1,onClose:()=>{},dataset:{testid:"tooltip"},children:c.jsx(T,{svg:c.jsx(g,{}),assistiveText:"Favorite"})}},n={play:async({canvasElement:e,step:o})=>{const i=s(e);await o("wait for tooltip to be visible",async()=>{await r(()=>{const t=i.getByTestId("tooltip");return p(t).toBeVisible()})}),await o("close the tooltip",()=>{const l=s(i.getByTestId("tooltip")).getByTestId("close");return v.click(l)}),await o("wait for tooltip to be hidden",async()=>{await r(()=>{const t=i.queryByTestId("tooltip");return p(t).toBeNull()})})}},a={play:async({canvasElement:e,step:o})=>{const i=s(e);await o("wait for tooltip to be visible",async()=>{await r(()=>{const t=i.getByTestId("tooltip");return p(t).toBeVisible()})}),await o("close the tooltip",()=>{const l=s(i.getByTestId("tooltip")).getByTestId("action");return v.click(l)}),await o("wait for tooltip to be hidden",async()=>{await r(()=>{const t=i.queryByTestId("tooltip");return p(t).toBeNull()})})}};var m,d,u;n.parameters={...n.parameters,docs:{...(m=n.parameters)==null?void 0:m.docs,source:{originalSource:`{
|
|
2
2
|
play: async ({
|
|
3
3
|
canvasElement,
|
|
4
4
|
step
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as o}from"./jsx-runtime-BTJTZTIL.js";import{r as l}from"./index-Cb9e4tly.js";import{I as T}from"./OnboardingTooltip-
|
|
1
|
+
import{j as o}from"./jsx-runtime-BTJTZTIL.js";import{r as l}from"./index-Cb9e4tly.js";import{I as T}from"./OnboardingTooltip-DuoU0OG7.js";import"./index-D1pfvbUR.js";import{M as f}from"./message-B1DLZQ1U.js";const _="_counter_ti913_2",j={counter:_},v=({totalSteps:n,nextActionLabel:e=o.jsx(f,{id:"preply-ds.onboardingTour.nextActionLabel",defaultMessage:"Next",description:"Onboarding tour next action label"}),completeActionLabel:a=o.jsx(f,{id:"preply-ds.onboardingTour.completeActionLabel",defaultMessage:"Got it",description:"Onboarding tour complete action label"}),onClose:t,onComplete:r,onStepChange:i,disabled:s,children:p,ctx:x})=>{const[b,u]=l.useState(!0),[d,g]=l.useState(0),c={totalSteps:n,nextActionLabel:e,completeActionLabel:a,onClose:()=>{u(!1),t==null||t()},active:!s&&b,currentStep:d,onActionClick:()=>{if(d===n-1)r==null||r(),u(!1);else{const h=d+1;g(h),i==null||i(h)}}};return o.jsx(x.Provider,{value:c,children:p})},A=({ctx:n,...e})=>{const a=l.useContext(n);if(!a)throw new Error("OnboardingTourContext not found");const{currentStep:t,totalSteps:r,onActionClick:i,onClose:s,active:p,nextActionLabel:x,completeActionLabel:b}=a,u=e.step===r-1,d=e.step===t,g=u?b:x,m=()=>{var c;(c=e.actionOnClick)==null||c.call(e),i()},O=c=>{c||s==null||s()};return o.jsx(T,{...e,counter:o.jsx("p",{className:j.counter,children:o.jsx(f,{id:"preply-ds.onboardingTour.counter",defaultMessage:"{currentStep} of {totalSteps}",description:"Onboarding tour step counter, e.g. '1 of 3'",values:{currentStep:t+1,totalSteps:r}})}),open:p&&d,onOpenChange:O,actionLabel:g,actionOnClick:m})},S=()=>{const n=l.createContext(null);return{Provider:t=>o.jsx(v,{...t,ctx:n}),Step:t=>o.jsx(A,{...t,ctx:n})}};try{S.displayName="createOnboardingTour",S.__docgenInfo={description:`Creates a new onboarding tour.
|
|
2
2
|
|
|
3
3
|
This factory pattern allows multiple independent tours to be nested within each other
|
|
4
4
|
without context conflicts, as each tour maintains its own separate context and state.`,displayName:"createOnboardingTour",props:{}}}catch{}export{S as c};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.
|
|
1
|
+
._counter_ti913_2{flex:1;min-width:max-content;color:var(--a924f9);font-size:var(--f7d879);font-weight:var(--87a7e3);line-height:var(--1cb31f)}
|
package/dist/assets/{OnboardingTour.stories-ByD_1qfY.js → OnboardingTour.stories-CHE5u2N9.js}
RENAMED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import{j as e}from"./jsx-runtime-BTJTZTIL.js";import{r as b}from"./index-Cb9e4tly.js";import{c as x}from"./OnboardingTour-
|
|
1
|
+
import{j as e}from"./jsx-runtime-BTJTZTIL.js";import{r as b}from"./index-Cb9e4tly.js";import{c as x}from"./OnboardingTour-D5pUyw-H.js";import{T as n}from"./Text-C4DBPFZ_.js";import{L as y}from"./LayoutFlex-Cj8q1bY9.js";import"./index-ChsGqxH_.js";import"./_commonjsHelpers-Cpj98o6Y.js";import"./OnboardingTooltip-DuoU0OG7.js";import"./index-BOrXX8UK.js";import"./PortalElementProvider-BRcRijdp.js";import"./index-BPrLDK9Y.js";import"./index-C7hTFOIV.js";import"./index-M3hvtcRE.js";import"./tslib.es6-BntfKcQG.js";import"./index-DOA2-rRC.js";import"./TokyoUIClose-thK8sk63.js";import"./Icon-BNvtTXpG.js";import"./text-accent-DwQPHwM2.js";import"./classNames-BUL1Zq7e.js";import"./filterHTMLAttributes-DYdLqcvH.js";import"./render-icon-BT0Aq7PA.js";import"./componentNames-Bwls0I02.js";import"./index-DdzHuZ-Y.js";import"./defaults-B1rzzf6M.js";import"./Button-Dy26oY0t.js";import"./ButtonBase-C6zIOZ7w.js";import"./Spinner-DgGnJd2k.js";import"./useHostname-Y3PlXofY.js";import"./index-CC6DAVyL.js";import"./Heading-DPPEK9A1.js";import"./text-centered-BwHG-She.js";import"./index-D1pfvbUR.js";import"./hoist-non-react-statics.cjs-C-Qo8PK8.js";import"./shared-strings-Biv7UF3M.js";import"./message-B1DLZQ1U.js";import"./layout-relative.module-Cmd2g7hD.js";const l=t=>null,s=t=>null;try{l.displayName="OnboardingTourProvider",l.__docgenInfo={description:`For some reason, storybook fails to render arg tables for the components
|
|
2
2
|
when they're created with the \`createOnboardingTour\` function.
|
|
3
3
|
|
|
4
4
|
As a workaround, we're manually defining fake components with the same
|
|
5
|
-
props as originals just for props parsing ¯\\_(ツ)_/¯`,displayName:"OnboardingTourProvider",props:{totalSteps:{defaultValue:null,description:"Total number of steps in the tour",name:"totalSteps",required:!0,type:{name:"number"}},nextActionLabel:{defaultValue:{value:'"Next"'},description:'Label for the "Next" action button',name:"nextActionLabel",required:!1,type:{name:"enum",value:[{value:"null"},{value:"string"},{value:"number"},{value:"false"},{value:"true"},{value:"ReactElement<any, string | JSXElementConstructor<any>>"},{value:"Iterable<ReactNode>"},{value:"ReactPortal"}]}},completeActionLabel:{defaultValue:{value:'"Got it"'},description:'Label for the "Complete" action button',name:"completeActionLabel",required:!1,type:{name:"enum",value:[{value:"null"},{value:"string"},{value:"number"},{value:"false"},{value:"true"},{value:"ReactElement<any, string | JSXElementConstructor<any>>"},{value:"Iterable<ReactNode>"},{value:"ReactPortal"}]}},disabled:{defaultValue:null,description:"Whether the tour is disabled",name:"disabled",required:!1,type:{name:"enum",value:[{value:"false"},{value:"true"}]}},onClose:{defaultValue:null,description:"Called when the tour is closed",name:"onClose",required:!1,type:{name:"enum",value:[{value:"() => void"}]}},onComplete:{defaultValue:null,description:"Called when the tour is completed",name:"onComplete",required:!1,type:{name:"enum",value:[{value:"() => void"}]}},onStepChange:{defaultValue:null,description:"Called when the current step index changes",name:"onStepChange",required:!1,type:{name:"enum",value:[{value:"(step: number) => void"}]}}}}}catch{}try{s.displayName="OnboardingTourStep",s.__docgenInfo={description:"",displayName:"OnboardingTourStep",props:{dataset:{defaultValue:null,description:"",name:"dataset",required:!1,type:{name:"enum",value:[{value:"Dataset"}]}},title:{defaultValue:null,description:"",name:"title",required:!0,type:{name:"enum",value:[{value:"undefined"},{value:"null"},{value:"string"},{value:"number"},{value:"false"},{value:"true"},{value:"ReactElement<any, string | JSXElementConstructor<any>>"},{value:"Iterable<ReactNode>"},{value:"ReactPortal"}]}},text:{defaultValue:null,description:"",name:"text",required:!0,type:{name:"enum",value:[{value:"undefined"},{value:"null"},{value:"string"},{value:"number"},{value:"false"},{value:"true"},{value:"ReactElement<any, string | JSXElementConstructor<any>>"},{value:"Iterable<ReactNode>"},{value:"ReactPortal"}]}},
|
|
5
|
+
props as originals just for props parsing ¯\\_(ツ)_/¯`,displayName:"OnboardingTourProvider",props:{totalSteps:{defaultValue:null,description:"Total number of steps in the tour",name:"totalSteps",required:!0,type:{name:"number"}},nextActionLabel:{defaultValue:{value:'"Next"'},description:'Label for the "Next" action button',name:"nextActionLabel",required:!1,type:{name:"enum",value:[{value:"null"},{value:"string"},{value:"number"},{value:"false"},{value:"true"},{value:"ReactElement<any, string | JSXElementConstructor<any>>"},{value:"Iterable<ReactNode>"},{value:"ReactPortal"}]}},completeActionLabel:{defaultValue:{value:'"Got it"'},description:'Label for the "Complete" action button',name:"completeActionLabel",required:!1,type:{name:"enum",value:[{value:"null"},{value:"string"},{value:"number"},{value:"false"},{value:"true"},{value:"ReactElement<any, string | JSXElementConstructor<any>>"},{value:"Iterable<ReactNode>"},{value:"ReactPortal"}]}},disabled:{defaultValue:null,description:"Whether the tour is disabled",name:"disabled",required:!1,type:{name:"enum",value:[{value:"false"},{value:"true"}]}},onClose:{defaultValue:null,description:"Called when the tour is closed",name:"onClose",required:!1,type:{name:"enum",value:[{value:"() => void"}]}},onComplete:{defaultValue:null,description:"Called when the tour is completed",name:"onComplete",required:!1,type:{name:"enum",value:[{value:"() => void"}]}},onStepChange:{defaultValue:null,description:"Called when the current step index changes",name:"onStepChange",required:!1,type:{name:"enum",value:[{value:"(step: number) => void"}]}}}}}catch{}try{s.displayName="OnboardingTourStep",s.__docgenInfo={description:"",displayName:"OnboardingTourStep",props:{dataset:{defaultValue:null,description:"",name:"dataset",required:!1,type:{name:"enum",value:[{value:"Dataset"}]}},title:{defaultValue:null,description:"",name:"title",required:!0,type:{name:"enum",value:[{value:"undefined"},{value:"null"},{value:"string"},{value:"number"},{value:"false"},{value:"true"},{value:"ReactElement<any, string | JSXElementConstructor<any>>"},{value:"Iterable<ReactNode>"},{value:"ReactPortal"}]}},text:{defaultValue:null,description:"",name:"text",required:!0,type:{name:"enum",value:[{value:"undefined"},{value:"null"},{value:"string"},{value:"number"},{value:"false"},{value:"true"},{value:"ReactElement<any, string | JSXElementConstructor<any>>"},{value:"Iterable<ReactNode>"},{value:"ReactPortal"}]}},side:{defaultValue:null,description:"Preferred side of the tooltip to appear from. Use if default side might block important content.",name:"side",required:!1,type:{name:"enum",value:[{value:'"top"'},{value:'"right"'},{value:'"bottom"'},{value:'"left"'}]}},actionOnClick:{defaultValue:null,description:"By default, the action button closes the tooltip.\n\nProvide `actionOnClick` to also perform other action.",name:"actionOnClick",required:!1,type:{name:"enum",value:[{value:"() => void"}]}},autoScroll:{defaultValue:{value:"true"},description:"If true, the tooltip will automatically scroll into view when it is opened.",name:"autoScroll",required:!1,type:{name:"enum",value:[{value:"false"},{value:"true"}]}},step:{defaultValue:null,description:"Zero-based step index",name:"step",required:!0,type:{name:"number"}}}}}catch{}const o=x(),le={title:"Components/OnboardingTour",component:l,subcomponents:{OnboardingTourStep:s},parameters:{docs:{story:{inline:!1,height:250},description:{component:"Are you looking for a tooltip to highlight single element? Check out [OnboardingTooltip](/docs/components-onboardingtooltip--docs)"}},a11y:{config:{rules:[{id:"color-contrast",enabled:!1}]}}},decorators:[t=>e.jsx("div",{style:{margin:"auto",width:"max-content"},children:t()})]},C=t=>[!1,!1],j=t=>i=>{},r=()=>{const[t,i]=C(),T=j();return e.jsxs(o.Provider,{totalSteps:3,disabled:i||t,onComplete:()=>T(!0),children:[e.jsx("div",{style:{height:250},children:e.jsx(o.Step,{step:0,title:"Step 1",text:"This is the first step of the onboarding tour.",children:e.jsx(n,{children:"Step 1"})})}),e.jsx("div",{style:{height:250},children:e.jsx(o.Step,{step:1,title:"Step 2",text:"This is the second step of the onboarding tour.",children:e.jsx(n,{children:"Step 2"})})}),e.jsx("div",{style:{height:250},children:e.jsx(o.Step,{step:2,title:"Step 3",text:"This is the final step of the onboarding tour.",children:e.jsx(n,{children:"Step 3"})})})]})};r.storyName="OnboardingTour";const a=()=>{const[t,i]=b.useState(!0);return e.jsx(o.Provider,{totalSteps:3,children:e.jsxs(y,{gap:"12",children:[e.jsx(o.Step,{step:0,title:"First step",text:"This is the first step of the onboarding tour.",children:e.jsx(n,{children:"Step 1"})}),e.jsx(o.Step,{step:1,title:"Second step",text:"This is the second step of the onboarding tour.",actionOnClick:()=>i(!1),children:e.jsx(n,{children:"Step 2"})}),!t&&e.jsx(o.Step,{step:2,title:"Final step",text:"This is the final step of the onboarding tour.",children:e.jsx(n,{children:"Step 3 (I was hidden)"})})]})})};var u,p,d,c,m;r.parameters={...r.parameters,docs:{...(u=r.parameters)==null?void 0:u.docs,source:{originalSource:`() => {
|
|
6
6
|
const [wasTourCompleted, loading] = useIsFeatureActive('my-tour');
|
|
7
7
|
const setTourCompleted = useToggleFeature('my-tour');
|
|
8
8
|
return <Tour.Provider totalSteps={3} disabled={loading || wasTourCompleted} onComplete={() => setTourCompleted(true)}>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as e}from"./jsx-runtime-BTJTZTIL.js";import{r as g}from"./index-Cb9e4tly.js";import{c as h}from"./OnboardingTour-
|
|
1
|
+
import{j as e}from"./jsx-runtime-BTJTZTIL.js";import{r as g}from"./index-Cb9e4tly.js";import{c as h}from"./OnboardingTour-D5pUyw-H.js";import{T}from"./Text-C4DBPFZ_.js";import{B as S}from"./Button-Dy26oY0t.js";import{f as m,a as p,w as c,e as n,u as l}from"./index-BVDq5o4N.js";import{L as V}from"./LayoutFlex-Cj8q1bY9.js";import"./index-ChsGqxH_.js";import"./_commonjsHelpers-Cpj98o6Y.js";import"./OnboardingTooltip-DuoU0OG7.js";import"./index-BOrXX8UK.js";import"./PortalElementProvider-BRcRijdp.js";import"./index-BPrLDK9Y.js";import"./index-C7hTFOIV.js";import"./index-M3hvtcRE.js";import"./tslib.es6-BntfKcQG.js";import"./index-DOA2-rRC.js";import"./TokyoUIClose-thK8sk63.js";import"./Icon-BNvtTXpG.js";import"./text-accent-DwQPHwM2.js";import"./classNames-BUL1Zq7e.js";import"./filterHTMLAttributes-DYdLqcvH.js";import"./render-icon-BT0Aq7PA.js";import"./componentNames-Bwls0I02.js";import"./index-DdzHuZ-Y.js";import"./defaults-B1rzzf6M.js";import"./Heading-DPPEK9A1.js";import"./text-centered-BwHG-She.js";import"./index-D1pfvbUR.js";import"./hoist-non-react-statics.cjs-C-Qo8PK8.js";import"./shared-strings-Biv7UF3M.js";import"./message-B1DLZQ1U.js";import"./ButtonBase-C6zIOZ7w.js";import"./Spinner-DgGnJd2k.js";import"./useHostname-Y3PlXofY.js";import"./index-CC6DAVyL.js";import"./layout-relative.module-Cmd2g7hD.js";const d=h(),vt={title:"Components/OnboardingTour/Tests",parameters:{layout:"centered",controls:{disable:!0},chromatic:{disableSnapshot:!0}},tags:["!autodocs","!a11y-test","test"],decorators:[i=>e.jsx("div",{style:{margin:"100px 0"},children:i()})],args:{onComplete:m(),onClose:m(),onStepChange:m()}},y={render:({onComplete:i,onStepChange:s})=>e.jsx(d.Provider,{totalSteps:3,nextActionLabel:"Next",completeActionLabel:"Got it",onComplete:i,onStepChange:s,children:e.jsxs(V,{gap:"24",direction:"column",children:[e.jsx(d.Step,{step:0,title:"Title",text:"Text",dataset:{testid:"step-1"},children:e.jsx(T,{children:"Step 1 Content"})}),e.jsx(d.Step,{step:1,title:"Title",text:"Text",dataset:{testid:"step-2"},children:e.jsx(T,{children:"Step 2 Content"})}),e.jsx(d.Step,{step:2,title:"Title",text:"Text",dataset:{testid:"step-3"},children:e.jsx(T,{children:"Step 3 Content"})})]})}),play:async({canvasElement:i,step:s,args:t})=>{const a=p(i);await s("First step should be visible initially",async()=>{await c(()=>{const o=a.getByTestId("step-1");n(o).toBeVisible()})}),await s("Click Next to advance to second step",async()=>{const r=p(a.getByTestId("step-1")).getByTestId("action");await l.click(r),await c(()=>{const u=a.getByTestId("step-2");n(u).toBeVisible(),n(t.onStepChange).toHaveBeenCalledWith(1)})}),await s("Click Next to advance to final step",async()=>{const r=p(a.getByTestId("step-2")).getByTestId("action");await l.click(r),await c(()=>{const u=a.getByTestId("step-3");n(u).toBeVisible(),n(t.onStepChange).toHaveBeenCalledWith(2)})}),await s("Complete tour",async()=>{const r=p(a.getByTestId("step-3")).getByTestId("action");await l.click(r),await c(()=>{const u=a.queryByTestId("step",{exact:!1});n(u).toBeNull(),n(t.onComplete).toHaveBeenCalled()})})}},x={render:({onClose:i})=>e.jsx(d.Provider,{totalSteps:2,nextActionLabel:"Next",completeActionLabel:"Got it",onClose:i,children:e.jsx(d.Step,{step:0,title:"First step",text:"Try closing this step",dataset:{testid:"step-1"},children:e.jsx(T,{children:"Step 1 Content"})})}),play:async({canvasElement:i,step:s})=>{const t=p(i);await s("Step should be initially visible",async()=>{await c(()=>{const a=t.getByTestId("step-1");n(a).toBeVisible()})}),await s("Click close button to close tour",async({args:a})=>{const r=p(t.getByTestId("step-1")).getByTestId("close");await l.click(r),await c(()=>{const u=t.queryByTestId("step",{exact:!1});n(u).toBeNull(),n(a.onClose).toHaveBeenCalled()})})}},B={render:function(){const[s,t]=g.useState(!0);return e.jsxs(V,{gap:"24",direction:"column",children:[e.jsx(S,{onClick:()=>t(!s),dataset:{testid:"toggle-button"},children:s?"Enable Tour":"Disable Tour"}),e.jsx(d.Provider,{totalSteps:2,nextActionLabel:"Next",completeActionLabel:"Got it",disabled:s,children:e.jsx(d.Step,{step:0,title:"First step",text:"This step should be hidden when disabled",dataset:{testid:"step-1"},children:e.jsx(T,{children:"Step 1 Content"})})})]})},play:async({canvasElement:i,step:s})=>{const t=p(i);await s("Tour should be initially disabled",async()=>{const a=t.queryByTestId("step-1");n(a).toBeNull()}),await s("Click enable button to show tour",async()=>{const a=t.getByTestId("toggle-button");await l.click(a),await c(()=>{const o=t.getByTestId("step-1");n(o).toBeVisible()})})}},b=h(),v=h(),w={render:function(){const[s,t]=g.useState(!1),[a,o]=g.useState(!1);return e.jsxs(b.Provider,{totalSteps:2,disabled:!s,nextActionLabel:"Next",completeActionLabel:"Got it",children:[e.jsx(b.Step,{step:0,title:"Title",text:"Text",dataset:{testid:"outer-step-1"},children:e.jsx(S,{onClick:()=>t(!0),dataset:{testid:"start-outer-tour"},children:"Start outer tour"})}),e.jsxs(v.Provider,{totalSteps:2,disabled:!a,nextActionLabel:"Next",completeActionLabel:"Done",children:[e.jsx(b.Step,{step:1,title:"Title",text:"Text",dataset:{testid:"outer-step-2"},children:e.jsx(T,{children:"Outer Tour Step"})}),e.jsx(v.Step,{step:0,title:"Title",text:"Text",dataset:{testid:"inner-step-1"},children:e.jsx(S,{onClick:()=>o(!0),dataset:{testid:"start-inner-tour"},children:"Start inner tour"})}),e.jsx(v.Step,{step:1,title:"Title",text:"Text",dataset:{testid:"inner-step-2"},children:e.jsx(T,{children:"Inner Tour Step"})})]})]})},play:async({canvasElement:i,step:s})=>{const t=p(i);await s("Start inner tour, step 1 should be visible",async()=>{const a=t.getByTestId("start-inner-tour");await l.click(a),await c(async()=>{const o=t.queryByTestId("inner-step-1");n(o).toBeVisible()})}),await s("Advance inner tour, step 2 should be visible",async()=>{const o=p(t.getByTestId("inner-step-1")).getByTestId("action");await l.click(o),await c(async()=>{const r=t.queryByTestId("inner-step-2");n(r).toBeVisible()})}),await s("Complete inner tour",async()=>{const o=p(t.getByTestId("inner-step-2")).getByTestId("action");await l.click(o),await c(async()=>{const r=t.queryByTestId("inner-step-1",{exact:!1});n(r).toBeNull()})}),await s("Start outer tour, step 1 should be visible",async()=>{const a=t.getByTestId("start-outer-tour");await l.click(a),await c(async()=>{const o=t.queryByTestId("outer-step-1");n(o).toBeVisible()})}),await s("Advance outer tour, step 2 should be visible",async()=>{const o=p(t.getByTestId("outer-step-1")).getByTestId("action");await l.click(o),await c(async()=>{const r=t.queryByTestId("outer-step-2");n(r).toBeVisible()})}),await s("Complete outer tour",async()=>{const o=p(t.getByTestId("outer-step-2")).getByTestId("action");await l.click(o),await c(async()=>{const r=t.queryByTestId("-step-",{exact:!1});n(r).toBeNull()})})}};var I,C,k;y.parameters={...y.parameters,docs:{...(I=y.parameters)==null?void 0:I.docs,source:{originalSource:`{
|
|
2
2
|
render: ({
|
|
3
3
|
onComplete,
|
|
4
4
|
onStepChange
|