@preply/ds-docs 1.4.0 → 1.4.2
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-ed2lpBeG.js → 00.LayoutFlex.stories-C6NuyaJx.js} +1 -1
- package/dist/assets/{00.applications-DLWUENDG.js → 00.applications-CzRQjSiq.js} +1 -1
- package/dist/assets/{00.favicons.guide-D5-20tQH.js → 00.favicons.guide-Cl2xkhMN.js} +1 -1
- package/dist/assets/{00.token-explorer-BIc8vy7H.js → 00.token-explorer-Bjz10JOk.js} +1 -1
- package/dist/assets/{00.using-responsive-props-CY9p8v_u.js → 00.using-responsive-props-BJUez61e.js} +1 -1
- package/dist/assets/{01.semantic-tokens-CThrY5Ts.js → 01.semantic-tokens-rGQpGJVg.js} +1 -1
- package/dist/assets/{01.using-shorthand-props-C_vbhNfL.js → 01.using-shorthand-props-C5dLPYVH.js} +1 -1
- package/dist/assets/{10.Combinations.stories-Bj20QCLY.js → 10.Combinations.stories-BCpu8o_W.js} +1 -1
- package/dist/assets/{10.fonts.guide-Dy8fgLU5.js → 10.fonts.guide-DDN5fND8.js} +1 -1
- package/dist/assets/{10.ssr-D9v_dR0o.js → 10.ssr-D-rANvZ-.js} +1 -1
- package/dist/assets/{11.languageFont.explorer-BZuqA2Qd.js → 11.languageFont.explorer-BV6Gwq5u.js} +1 -1
- package/dist/assets/{11.ssr.app-router-CU9S0P9E.js → 11.ssr.app-router-Ch1ZJjg-.js} +1 -1
- package/dist/assets/{20.libraries-CG6__ozS.js → 20.libraries-oHi972pc.js} +1 -1
- package/dist/assets/{30.icons.explorer-CK_LzlUE.js → 30.icons.explorer-CTyGJI0M.js} +1 -1
- package/dist/assets/{30.storybook-Be_FRDz_.js → 30.storybook-C0MSe3yp.js} +1 -1
- package/dist/assets/{40.illustrations.explorer-lGFuCzSa.js → 40.illustrations.explorer-1aFkROmz.js} +1 -1
- package/dist/assets/{90.advanced-C4czMsOy.js → 90.advanced-t0tp7qCO.js} +1 -1
- package/dist/assets/AlertDialog-8zNG4W6P.css +1 -0
- package/dist/assets/{AlertDialog.stories-DlRWBYYU.js → AlertDialog.stories-C5USsoA-.js} +1 -1
- package/dist/assets/Avatar-BZKmHoZm.css +1 -0
- package/dist/assets/Avatar-BkmMIq29.css +1 -0
- package/dist/assets/Avatar-D5vkZljP.js +1 -0
- package/dist/assets/Avatar-lFZ8Cfpv.js +6 -0
- package/dist/assets/{Avatar.stories-OTgx0pcM.js → Avatar.stories-CLQ3BvQW.js} +1 -1
- package/dist/assets/AvatarWithStatus-Dv8yodGu.css +1 -0
- package/dist/assets/{AvatarWithStatus.stories--mF91ETX.js → AvatarWithStatus.stories-BsgFOyBx.js} +5 -5
- package/dist/assets/Badge-kZt_FH50.css +1 -0
- package/dist/assets/{Badge.stories-D8nghiXL.js → Badge.stories-CsQItVr_.js} +2 -2
- package/dist/assets/Box-4GImUu2D.css +1 -0
- package/dist/assets/Box.stories-C3UUNdDi.js +44 -0
- package/dist/assets/Button-CawJKyho.css +1 -0
- package/dist/assets/{Button-DqwK0S70.js → Button-G5Zxq86f.js} +2 -2
- package/dist/assets/{Button-CHTJqu07.css → Button-GOFCl1lS.css} +1 -1
- package/dist/assets/Button-Oaj5OWvs.js +1 -0
- package/dist/assets/{Button.stories-oW-QBb5C.js → Button.stories-BuHavCSD.js} +1 -1
- package/dist/assets/{ButtonBase-CuGZo0xf.css → ButtonBase-CN93Hyoe.css} +1 -1
- package/dist/assets/ButtonBase-Desxs10d.js +8 -0
- package/dist/assets/Chips-DIrYdYig.css +1 -0
- package/dist/assets/{Chips.stories-DiprPB2i.js → Chips.stories-DwatZLP-.js} +1 -1
- package/dist/assets/{Color-YHDXOIA2-C2h0aGNO.js → Color-YHDXOIA2-CR40pFdp.js} +1 -1
- package/dist/assets/Dialog-B5rqi-V8.css +1 -0
- package/dist/assets/{Dialog.stories-CAPNnMI_.js → Dialog.stories-aheiL1C_.js} +13 -13
- package/dist/assets/{DocsRenderer-CFRXHY34-C35smYsV.js → DocsRenderer-CFRXHY34-C7iNFBWT.js} +1 -1
- package/dist/assets/{FieldAdditionalText-lW7Q1VGp.js → FieldAdditionalText-CK-mP7eE.js} +1 -1
- package/dist/assets/FieldAdditionalText-DmrAhCSm.css +1 -0
- package/dist/assets/{FieldAdditionalText.stories-DcGxrOlS.js → FieldAdditionalText.stories-JWcqGRDw.js} +1 -1
- package/dist/assets/{FieldButton-QHhW28uq.js → FieldButton-B9DsbnCd.js} +1 -1
- package/dist/assets/{FieldButton-k7TvuQHy.css → FieldButton-ClSNKPdl.css} +1 -1
- package/dist/assets/{FieldButton.stories-vBmg2O9Q.js → FieldButton.stories-B5JDNmNP.js} +1 -1
- package/dist/assets/FieldLayout-2zlcC5-S.js +1 -0
- package/dist/assets/FieldLayout-ayailSRB.css +1 -0
- package/dist/assets/{FieldLayout.stories-CtD6-C6l.js → FieldLayout.stories-oIX7x6Q6.js} +1 -1
- package/dist/assets/{FieldLayoutBase-DQbxDQVA.js → FieldLayoutBase-0r0SpleC.js} +3 -3
- package/dist/assets/FieldLayoutBase-DaHOfSqh.css +1 -0
- package/dist/assets/Heading-BDNRMwVu.js +2 -0
- package/dist/assets/{Heading-DeYpQLgb.css → Heading-DhbbSS03.css} +1 -1
- package/dist/assets/{Heading.stories-CROOXvlq.js → Heading.stories-BW49vEiT.js} +1 -1
- package/dist/assets/Icon-COBslmJH.css +1 -0
- package/dist/assets/Icon-DAQd7Eod.js +8 -0
- package/dist/assets/{Icon-RSC-BOyrffYC.js → Icon-RSC-DXv5b9K1.js} +1 -1
- package/dist/assets/Icon-VzZ0SATJ.css +1 -0
- package/dist/assets/Icon-qme4Scxh.js +1 -0
- package/dist/assets/{Icon.stories-BqehTDt3.js → Icon.stories-MzKcutu8.js} +1 -1
- package/dist/assets/{IconButton-CI9clg4P.js → IconButton-iyWiUe9X.js} +2 -2
- package/dist/assets/InputText-IEjR9ee0.js +5 -0
- package/dist/assets/{LayoutFlex-CaenMVBF.js → LayoutFlex-BaXqezhY.js} +1 -1
- package/dist/assets/{LayoutFlex-JnKYDcpC.js → LayoutFlex-pzKY-vUQ.js} +1 -1
- package/dist/assets/LayoutFlexItem-CzflYuZ_.js +1 -0
- package/dist/assets/LayoutFlexItem-Dci-Cv-V.css +1 -0
- package/dist/assets/LayoutGrid-C8hq1-LL.css +1 -0
- package/dist/assets/LayoutGrid-CULegRpi.css +1 -0
- package/dist/assets/LayoutGrid-ZAYmKrcj.js +1 -0
- package/dist/assets/{LayoutGrid.stories-Dv8lBJmB.js → LayoutGrid.stories-CSBUYfM6.js} +3 -3
- package/dist/assets/LayoutGridItem-DJDMWtVq.css +1 -0
- package/dist/assets/LayoutGridItem-m645Lhkq.js +1 -0
- package/dist/assets/Link-CPkXDszE.css +1 -0
- package/dist/assets/{Link.stories-DXbiFw9-.js → Link.stories-BGmSAnPH.js} +4 -4
- package/dist/assets/Loader-C5QrrxXJ.css +1 -0
- package/dist/assets/{Loader.stories-DvgUtUpE.js → Loader.stories-DaYtlzeB.js} +1 -1
- package/dist/assets/NumberField.stories-DIRO8IHc.js +203 -0
- package/dist/assets/OnboardingTooltip-BfzcF9sW.css +1 -0
- package/dist/assets/{OnboardingTooltip-IYSphueI.js → OnboardingTooltip-BqDG-2Rd.js} +1 -1
- package/dist/assets/{OnboardingTooltip.stories-DnfLcLUg.js → OnboardingTooltip.stories-Dx5F7YBG.js} +1 -1
- package/dist/assets/{OnboardingTooltip.tests.stories-DobHu21P.js → OnboardingTooltip.tests.stories-DvcLnD5j.js} +1 -1
- package/dist/assets/{OnboardingTour-2YaW_XWj.js → OnboardingTour-B_yyU1AU.js} +1 -1
- package/dist/assets/{OnboardingTour-Dr4ZlIUd.css → OnboardingTour-CnsU5p_A.css} +1 -1
- package/dist/assets/{OnboardingTour.stories-BUBpjiez.js → OnboardingTour.stories-LGCUxWl4.js} +1 -1
- package/dist/assets/{OnboardingTour.tests.stories-Buou9m4A.js → OnboardingTour.tests.stories-C9CKn7JQ.js} +1 -1
- package/dist/assets/PasswordField.stories-CvnCM5rD.js +203 -0
- package/dist/assets/PreplyLogo-Cecouk_S.css +1 -0
- package/dist/assets/{PreplyLogo.stories-BReIYVeE.js → PreplyLogo.stories-ZhZHvw_M.js} +1 -1
- package/dist/assets/{ProgressBar-D5aTIWY3.css → ProgressBar-DYzJL8gA.css} +1 -1
- package/dist/assets/{ProgressBar.stories-wrAgHPrO.js → ProgressBar.stories-XmMUjDS5.js} +1 -1
- package/dist/assets/{ProgressSteps-DWp2S1-b.js → ProgressSteps-CVWVi5_G.js} +1 -1
- package/dist/assets/ProgressSteps-Dip-BZlm.css +1 -0
- package/dist/assets/{ProgressSteps.stories-CsWQLVog.js → ProgressSteps.stories-B57q5WFr.js} +1 -1
- package/dist/assets/SelectField-CTB098t-.css +1 -0
- package/dist/assets/SelectField.stories-CqnGEFQn.js +182 -0
- package/dist/assets/Spinner-BuihcWyQ.css +1 -0
- package/dist/assets/{Spinner-Dsa9X0G6.js → Spinner-C3p2WoxW.js} +1 -1
- package/dist/assets/Steps-Bd4yQjwc.css +1 -0
- package/dist/assets/{Steps-ifU4R9DW.js → Steps-DbST4vmL.js} +1 -1
- package/dist/assets/{Steps.stories-DkI3jK5X.js → Steps.stories-gWR5Lpwz.js} +1 -1
- package/dist/assets/Text-BeAjllqh.js +1 -0
- package/dist/assets/{Text-BWNSh4D5.css → Text-CgAyAgxF.css} +1 -1
- package/dist/assets/Text-D3ATKGXs.js +1 -0
- package/dist/assets/{Text.stories-B8iegpqH.js → Text.stories-BlLgBmMi.js} +1 -1
- package/dist/assets/TextField-BiEzDuCh.js +1 -0
- package/dist/assets/TextField-C3owY_ZE.css +1 -0
- package/dist/assets/{TextField.stories-Beeq1JfY.js → TextField.stories-CPD818W_.js} +1 -1
- package/dist/assets/TextHighlighted-B_WQpKk8.css +1 -0
- package/dist/assets/TextHighlighted-DoFzmVL0.js +1 -0
- package/dist/assets/{TextHighlighted.stories-DdbLv0RQ.js → TextHighlighted.stories-DTNcmEX3.js} +3 -3
- package/dist/assets/TextInline-BqUzWrD4.css +1 -0
- package/dist/assets/{TextInline.stories-aCVFO11z.js → TextInline.stories-DqX-qocx.js} +1 -1
- package/dist/assets/TextareaField.stories-D95m8D1f.js +221 -0
- package/dist/assets/Toast-BsJOXveW.css +1 -0
- package/dist/assets/{Toast.stories-BZFlc1-_.js → Toast.stories-CGXB3Oyz.js} +9 -9
- package/dist/assets/Tooltip-9him0tBb.css +1 -0
- package/dist/assets/{Tooltip-BvCJt9jJ.js → Tooltip-kdQF0n0X.js} +1 -1
- package/dist/assets/{Tooltip.stories-Crh2sW9L.js → Tooltip.stories-ChMEb5wa.js} +1 -1
- package/dist/assets/{Tooltip.tests.stories-bmaSwgkR.js → Tooltip.tests.stories-DRKkU6_h.js} +1 -1
- package/dist/assets/{breakpoints-CIpR6Rpt.js → breakpoints-BKtvPn4z.js} +1 -1
- package/dist/assets/{breakpoints-BELcY-aB.js → breakpoints-CvGR1154.js} +1 -1
- package/dist/assets/{breakpoints-_joXL0S9.js → breakpoints-Dw3ULM7j.js} +1 -1
- package/dist/assets/{changelog-DdodvQsh.js → changelog-DXXuLjII.js} +1 -1
- package/dist/assets/{entry-preview-DNvfsvqm.js → entry-preview-DKCl8pnk.js} +1 -1
- package/dist/assets/{getTokenVar-RiIceD0Y.js → getTokenVar-BWljsLZ6.js} +1 -1
- package/dist/assets/{hover-D2OphZ3W.js → hover-BRNG4vFt.js} +1 -1
- package/dist/assets/{hover-DDVoGg-g.js → hover-BpH2YvND.js} +1 -1
- package/dist/assets/{hover-BIABQ7bm.js → hover-Cun_Hxa2.js} +1 -1
- package/dist/assets/{iframe-B08s_jqc.js → iframe-DbVfH8B5.js} +2 -2
- package/dist/assets/{index-BGAhMoqL.js → index-UAdYqHL0.js} +3 -3
- package/dist/assets/{index-DmM0DblE.js → index-lpmehhNH.js} +1 -1
- package/dist/assets/{intro-9BhCdV9M.js → intro-CQsqeQsV.js} +1 -1
- package/dist/assets/layout-relative-Cf09gtOc.css +1 -0
- package/dist/assets/layout-relative-DA7rS9QX.js +1 -0
- package/dist/assets/layout-relative-Jxb51_Sh.css +1 -0
- package/dist/assets/layout-relative-mSX9oB2N.css +1 -0
- package/dist/assets/layout-relative.module-CYNzEGVH.js +1 -0
- package/dist/assets/layout-relative.module-yZwngsDw-BiwrSIEl.js +1 -0
- package/dist/assets/{migrating-from-less-DX0PnZZJ.js → migrating-from-less-DAZke_bf.js} +1 -1
- package/dist/assets/playground-w72anE0z.css +1 -0
- package/dist/assets/{playground.stories-IM0Bn8my.js → playground.stories-Dpb3xI2s.js} +2 -2
- package/dist/assets/{preview-DSwUvj7R.js → preview-DchamjVK.js} +1 -1
- package/dist/assets/{preview-D_cPBI7P.js → preview-HuUbG8ej.js} +2 -2
- package/dist/assets/{preview-E8zsGlo4.js → preview-kCY-Nq0t.js} +1 -1
- package/dist/assets/text-accent-CuYWdzBU.js +1 -0
- package/dist/assets/text-accent-DbbdQjKI.js +1 -0
- package/dist/assets/text-accent-da8yAj-M.css +1 -0
- package/dist/assets/text-centered-6MZg9O0U.js +1 -0
- package/dist/assets/text-centered-CrBlvRDP.js +1 -0
- package/dist/assets/text-centered-DUL478eo.css +1 -0
- package/dist/assets/text-centered-RwJDmlB2.css +1 -0
- package/dist/assets/{tokens-yG_wYklp.js → tokens-BaIvp8uk.js} +1 -1
- package/dist/assets/{tokens-D2SDDihU.js → tokens-BqWh6RWP.js} +1 -1
- package/dist/assets/{tokens-DRcTh2ws.js → tokens-KVFCTIK3.js} +1 -1
- package/dist/assets/{usePortalElement-aOX_O1I5.js → usePortalElement-DBJJ4TO9.js} +1 -1
- package/dist/assets/{welcome-CGkWDS9u.js → welcome-CaHVZaZ7.js} +1 -1
- package/dist/assets/{zeroheight-CH9deXT2.js → zeroheight-DobKPt2E.js} +1 -1
- package/dist/iframe.html +1 -1
- package/dist/preview-stats.json +1350 -1350
- package/dist/project.json +1 -1
- package/package.json +3 -3
- package/dist/assets/AlertDialog-CSUTu5O6.css +0 -1
- package/dist/assets/Avatar-CmnrM37w.js +0 -6
- package/dist/assets/Avatar-JE3Hcbkv.css +0 -1
- package/dist/assets/Avatar-_W1s5JpT.css +0 -1
- package/dist/assets/Avatar-iqWOn9Tl.js +0 -1
- package/dist/assets/AvatarWithStatus-pddO2Nza.css +0 -1
- package/dist/assets/Badge-DcbG4N4-.css +0 -1
- package/dist/assets/Box-CJkXzUjZ.css +0 -1
- package/dist/assets/Box.stories-DxW6l-HA.js +0 -44
- package/dist/assets/Button-B1mdczvv.js +0 -1
- package/dist/assets/Button-C6kEKm6h.css +0 -1
- package/dist/assets/ButtonBase-D31GBWHv.js +0 -8
- package/dist/assets/Chips-Dejf8Sh_.css +0 -1
- package/dist/assets/Dialog-DwZQYtV6.css +0 -1
- package/dist/assets/FieldAdditionalText-CUu6JGoC.css +0 -1
- package/dist/assets/FieldLayout-BGkL1EMg.js +0 -1
- package/dist/assets/FieldLayout-CG9n-WOS.css +0 -1
- package/dist/assets/FieldLayoutBase-CoIn-2cd.css +0 -1
- package/dist/assets/Heading-CifnBvGj.js +0 -2
- package/dist/assets/Icon-BVvspUlo.js +0 -1
- package/dist/assets/Icon-BwwIOKM_.js +0 -8
- package/dist/assets/Icon-ByJ3-8OT.css +0 -1
- package/dist/assets/Icon-DghDQiVd.css +0 -1
- package/dist/assets/InputText-DmOW3mdD.js +0 -5
- package/dist/assets/LayoutFlexItem-BM0Abp7Y.js +0 -1
- package/dist/assets/LayoutFlexItem-Dv67D5k3.css +0 -1
- package/dist/assets/LayoutGrid-BG6JKtyy.css +0 -1
- package/dist/assets/LayoutGrid-BhioG4bL.js +0 -1
- package/dist/assets/LayoutGrid-CJQpEAmZ.css +0 -1
- package/dist/assets/LayoutGridItem-BDT0sqW-.css +0 -1
- package/dist/assets/LayoutGridItem-CdnUXNtY.js +0 -1
- package/dist/assets/Link-vYql_2wB.css +0 -1
- package/dist/assets/Loader-DLP0PI5-.css +0 -1
- package/dist/assets/NumberField.stories-BQIOdo90.js +0 -203
- package/dist/assets/OnboardingTooltip-RxaiJe-3.css +0 -1
- package/dist/assets/PasswordField.stories-BevSwKGm.js +0 -203
- package/dist/assets/PreplyLogo-CBB3sPr3.css +0 -1
- package/dist/assets/ProgressSteps-s9ACrzTy.css +0 -1
- package/dist/assets/SelectField-N7X7yUPn.css +0 -1
- package/dist/assets/SelectField.stories-9iipR200.js +0 -182
- package/dist/assets/Spinner-CVHMc-T0.css +0 -1
- package/dist/assets/Steps-CQWsOQKy.css +0 -1
- package/dist/assets/Text-CDqVYAcD.js +0 -1
- package/dist/assets/Text-CdCGNBj4.js +0 -1
- package/dist/assets/TextField-DAwVD2CM.css +0 -1
- package/dist/assets/TextField-q53ruCuh.js +0 -1
- package/dist/assets/TextHighlighted-BHCtybuo.css +0 -1
- package/dist/assets/TextHighlighted-BdF2_CZo.js +0 -1
- package/dist/assets/TextInline-CDFHfvph.css +0 -1
- package/dist/assets/TextareaField.stories-bA314Jtt.js +0 -221
- package/dist/assets/Toast-BBn7aSpe.css +0 -1
- package/dist/assets/Tooltip-Mm-tBuF2.css +0 -1
- package/dist/assets/layout-relative-0-BGcS53.css +0 -1
- package/dist/assets/layout-relative-D-nYASza.css +0 -1
- package/dist/assets/layout-relative-DZ8FL-vJ.js +0 -1
- package/dist/assets/layout-relative-DiL5t_eA.css +0 -1
- package/dist/assets/layout-relative.module-Bf3FithH.js +0 -1
- package/dist/assets/layout-relative.module-CXJ9jc4G--YD8TQc4.js +0 -1
- package/dist/assets/playground-BQGD3iU0.css +0 -1
- package/dist/assets/text-accent-0oTyB6kb.css +0 -1
- package/dist/assets/text-accent-BMcamJQk.js +0 -1
- package/dist/assets/text-accent-CrnHOlvW.js +0 -1
- package/dist/assets/text-centered-1sU8-E1D.js +0 -1
- package/dist/assets/text-centered-BSdMMoT9.js +0 -1
- package/dist/assets/text-centered-BttmHjSJ.css +0 -1
- package/dist/assets/text-centered-V2JhT89g.css +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as e}from"./jsx-runtime-BTJTZTIL.js";import{r as
|
|
1
|
+
import{j as e}from"./jsx-runtime-BTJTZTIL.js";import{r as x}from"./index-Cb9e4tly.js";import{f as h}from"./filterHTMLAttributes-DYdLqcvH.js";import{S as z}from"./Spinner-C3p2WoxW.js";import{m as k,b as q}from"./classNames-BUL1Zq7e.js";import{w as l}from"./componentNames-Bwls0I02.js";import{g as C}from"./index-DdzHuZ-Y.js";import{S as E}from"./consts-KAYct7Gj.js";import{g as N}from"./getTokenVar-DU_DEzTd.js";import{c as R}from"./tokens-Di5DrZN4.js";import"./index-ChsGqxH_.js";import"./_commonjsHelpers-Cpj98o6Y.js";import"./defaults-B1rzzf6M.js";import"./constants-BgBLeZzp.js";const T="_Loader_jv7qu_2",V={Loader:T,"Loader--normal":"_Loader--normal_jv7qu_7","Loader--inverted":"_Loader--inverted_jv7qu_10"},r=x.forwardRef(function({size:t,inverted:y=!1,dataset:L,..._},b){const S=k(V,l.Loader,[q("inverted","normal",y)]),j={...h(_),ref:b,className:S.join(" "),...C(L,{preplyDsComponent:l.Loader})};return e.jsx("span",{...j,children:e.jsx(z,{size:t})})});try{r.displayName="Loader",r.__docgenInfo={description:"",displayName:"Loader",props:{size:{defaultValue:null,description:"",name:"size",required:!1,type:{name:"enum",value:[{value:'"large"'},{value:'"default"'},{value:"ResponsiveProp<SpinnerSize>"}]}},inverted:{defaultValue:{value:"false"},description:"",name:"inverted",required:!1,type:{name:"enum",value:[{value:"false"},{value:"true"}]}},dataset:{defaultValue:null,description:"",name:"dataset",required:!1,type:{name:"enum",value:[{value:"Dataset"}]}},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: HTMLSpanElement | null) => void"},{value:"RefObject<HTMLSpanElement>"}]}},key:{defaultValue:null,description:"",name:"key",required:!1,type:{name:"enum",value:[{value:"null"},{value:"string"},{value:"number"},{value:"bigint"}]}}}}}catch{}const K={title:"components/Loader",component:r,argTypes:{size:{description:E}}},o=()=>e.jsxs("div",{style:{display:"flex",alignItems:"end",gap:"8px"},children:[e.jsx(r,{size:"default"}),e.jsx(r,{size:"large"})]}),n=()=>e.jsx(r,{inverted:!0});n.decorators=[a=>{const t=N(R.background.primaryInverted);return e.jsx("div",{style:{backgroundColor:t},children:a()})}];const s={parameters:{chromatic:{disableSnapshot:!0}},decorators:[(a,{args:t})=>e.jsx("div",{style:{backgroundColor:t.inverted?"black":void 0},children:a()})],args:{size:"default",inverted:!1,dataset:{qaid:"loader"}},argTypes:{dataset:{control:"object"},size:{control:"select"},inverted:{control:"boolean"}}};var d,i,c;o.parameters={...o.parameters,docs:{...(d=o.parameters)==null?void 0:d.docs,source:{originalSource:`() => <div style={{
|
|
2
2
|
display: 'flex',
|
|
3
3
|
alignItems: 'end',
|
|
4
4
|
gap: '8px'
|
|
@@ -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 F,u as Ce,w as xe}from"./index-BVDq5o4N.js";import{F as qe}from"./TokyoUIPhone-CvuBM6jb.js";import{B as T}from"./Button-G5Zxq86f.js";import{I as Ee}from"./Icon-DAQd7Eod.js";import{F as He}from"./FieldLayout-2zlcC5-S.js";import{u as Fe,I as Se,s as Ne}from"./FieldLayoutBase-0r0SpleC.js";import{m as we}from"./classNames-BUL1Zq7e.js";import{w as m}from"./componentNames-Bwls0I02.js";import{u as Re}from"./useForcedRef--iGFM41p.js";import{u as Te}from"./useNumberField-AJNQGstL.js";import{T as ke}from"./Text-D3ATKGXs.js";import"./index-ChsGqxH_.js";import"./_commonjsHelpers-Cpj98o6Y.js";import"./v4-CtRu48qb.js";import"./render-icon-BT0Aq7PA.js";import"./ButtonBase-Desxs10d.js";import"./Spinner-C3p2WoxW.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-DbbdQjKI.js";import"./FieldAdditionalText-CK-mP7eE.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-6MZg9O0U.js";const je=({onChange:e,onValueChange:a,...n},r)=>{const i=we(Ne,m.InputNumber),d=Fe(o=>o.target.value?Number(o.target.value):void 0,e,a);return t.jsx(Se,{...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"}]}},placeholder:{defaultValue:null,description:"",name:"placeholder",required:!1,type:{name:"enum",value:[{value:"string"}]}},id:{defaultValue:null,description:"",name:"id",required:!0,type:{name:"string"}},"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>"}]}},required:{defaultValue:null,description:"",name:"required",required:!1,type:{name:"enum",value:[{value:"false"},{value:"true"}]}},readOnly:{defaultValue:null,description:"",name:"readOnly",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"}]}},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=Re();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=Te({id:e,...a},m.NumberField),{layoutProps:o,inputProps:S}=d,l=we(Pe,m.NumberField),Ie=t.jsx(N,{...S,ref:i});return t.jsx(He,{...o,className:l.join(" "),input:Ie,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"}]}},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"}]}},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"}]}},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>"}]}},required:{defaultValue:null,description:"",name:"required",required:!1,type:{name:"enum",value:[{value:"false"},{value:"true"}]}},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>"}]}},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 F(n).toHaveValue(100)}),await a("Type to value",async()=>{const n=e.getByTestId("input");await Ce.type(n,",500"),await F(n).toHaveValue(100500)})}},y={args:{icon:t.jsx(Ee,{svg:qe})}},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(T,{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(!R(e.ref))throw new Error("Expected ref.current to be an InputImperativeHandle");const n=a.getByTestId("input");e.ref.current.setFocus(),await xe(()=>F(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(T,{variant:"secondary",dataset:{testid:"scroll-button"},onClick:()=>{if(!R(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(!R(e.ref))throw new Error("Expected ref.current to be an InputImperativeHandle");const n=a.getByTestId("input");e.ref.current.scrollIntoView(),await xe(()=>F(n).toBeVisible())}};function R(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"},S=()=>{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(Ee,{svg:qe}),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(T,{onClick:S,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
|
+
args.ref.current.setFocus();
|
|
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};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
._content_1d1nw_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(--preply-ds-onboarding-tooltip-z-index);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_1d1nw_2[data-state=open]{animation-name:_appear_1d1nw_1}._content_1d1nw_2[data-state=closed]{animation-name:_disappear_1d1nw_1}._header_1d1nw_23{display:flex;flex-direction:row-reverse;justify-content:space-between;align-items:flex-start}._close_1d1nw_29{background:none;border:none;border-radius:var(--5e8be4);padding:0;margin:0;cursor:pointer}._close_1d1nw_29:focus-visible{outline-style:solid;outline-color:var(--603ec6);outline-width:var(--99d31f);outline-offset:var(--c0b12c)}._footer_1d1nw_43{display:flex;justify-content:flex-end;gap:var(--813599);align-items:center}._arrow_1d1nw_49{fill:var(--79dffb)}@keyframes _appear_1d1nw_1{0%{opacity:0;transform:scale(0)}to{opacity:1;transform:scale(1)}}@keyframes _disappear_1d1nw_1{0%{opacity:1;transform:scale(1)}to{opacity:0;transform:scale(0)}}
|
|
@@ -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-DSa6qU7h.js";import{F as E}from"./TokyoUIClose-thK8sk63.js";import{I as k}from"./Icon-DAQd7Eod.js";import{T as P}from"./Text-D3ATKGXs.js";import{B as j}from"./Button-G5Zxq86f.js";import{H as T}from"./Heading-BDNRMwVu.js";import{u as S}from"./index-D1pfvbUR.js";import{g as D}from"./shared-strings-Biv7UF3M.js";import{i as L}from"./PortalElementProvider-DidBkzFe.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_1d1nw_2",B="_header_1d1nw_23",U="_close_1d1nw_29",A="_footer_1d1nw_43",F="_arrow_1d1nw_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:i,disabled:r,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]),r?t:a.jsxs(R,{open:e,onOpenChange:i,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[i,r]=n.useState(!0),u=t=>{var l;t||(l=e.onClose)==null||l.call(e),r(t)},s=()=>{var t,l;(t=e.actionOnClick)==null||t.call(e),r(!1),(l=e.onClose)==null||l.call(e)};return a.jsx(m,{...e,open:i,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"
|
package/dist/assets/{OnboardingTooltip.stories-DnfLcLUg.js → OnboardingTooltip.stories-Dx5F7YBG.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-BqDG-2Rd.js";import{I as g}from"./IconButton-iyWiUe9X.js";import{F as x}from"./TokyoUIFav-DOVerCtW.js";import"./index-ChsGqxH_.js";import"./index-Cb9e4tly.js";import"./_commonjsHelpers-Cpj98o6Y.js";import"./index-DSa6qU7h.js";import"./PortalElementProvider-DidBkzFe.js";import"./index-BPrLDK9Y.js";import"./index-C7hTFOIV.js";import"./index-B-5rsJjr.js";import"./tslib.es6-BntfKcQG.js";import"./index-B77PBZuV.js";import"./TokyoUIClose-thK8sk63.js";import"./Icon-DAQd7Eod.js";import"./text-accent-DbbdQjKI.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-D3ATKGXs.js";import"./text-centered-6MZg9O0U.js";import"./Button-G5Zxq86f.js";import"./ButtonBase-Desxs10d.js";import"./Spinner-C3p2WoxW.js";import"./useHostname-Y3PlXofY.js";import"./index-CC6DAVyL.js";import"./Heading-BDNRMwVu.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-BqDG-2Rd.js";import{I as T}from"./IconButton-iyWiUe9X.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-DSa6qU7h.js";import"./PortalElementProvider-DidBkzFe.js";import"./index-BPrLDK9Y.js";import"./index-C7hTFOIV.js";import"./index-B-5rsJjr.js";import"./tslib.es6-BntfKcQG.js";import"./index-B77PBZuV.js";import"./TokyoUIClose-thK8sk63.js";import"./Icon-DAQd7Eod.js";import"./text-accent-DbbdQjKI.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-D3ATKGXs.js";import"./text-centered-6MZg9O0U.js";import"./Button-G5Zxq86f.js";import"./ButtonBase-Desxs10d.js";import"./Spinner-C3p2WoxW.js";import"./useHostname-Y3PlXofY.js";import"./index-CC6DAVyL.js";import"./Heading-BDNRMwVu.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
|
|
1
|
+
import{j as o}from"./jsx-runtime-BTJTZTIL.js";import{r as l}from"./index-Cb9e4tly.js";import{I as v}from"./OnboardingTooltip-BqDG-2Rd.js";import"./index-D1pfvbUR.js";import{M as f}from"./message-B1DLZQ1U.js";const T="_counter_i4yv4_2",_={counter:T},j=({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})},y=({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(v,{...e,counter:o.jsx("p",{className:_.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(j,{...t,ctx:n}),Step:t=>o.jsx(y,{...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_i4yv4_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-BUBpjiez.js → OnboardingTour.stories-LGCUxWl4.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
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-B_yyU1AU.js";import{T as n}from"./Text-D3ATKGXs.js";import{L as y}from"./LayoutFlex-BaXqezhY.js";import"./index-ChsGqxH_.js";import"./_commonjsHelpers-Cpj98o6Y.js";import"./OnboardingTooltip-BqDG-2Rd.js";import"./index-DSa6qU7h.js";import"./PortalElementProvider-DidBkzFe.js";import"./index-BPrLDK9Y.js";import"./index-C7hTFOIV.js";import"./index-B-5rsJjr.js";import"./tslib.es6-BntfKcQG.js";import"./index-B77PBZuV.js";import"./TokyoUIClose-thK8sk63.js";import"./Icon-DAQd7Eod.js";import"./text-accent-DbbdQjKI.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-G5Zxq86f.js";import"./ButtonBase-Desxs10d.js";import"./Spinner-C3p2WoxW.js";import"./useHostname-Y3PlXofY.js";import"./index-CC6DAVyL.js";import"./Heading-BDNRMwVu.js";import"./text-centered-6MZg9O0U.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-CYNzEGVH.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
|
|
@@ -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-B_yyU1AU.js";import{T}from"./Text-D3ATKGXs.js";import{B as S}from"./Button-G5Zxq86f.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-BaXqezhY.js";import"./index-ChsGqxH_.js";import"./_commonjsHelpers-Cpj98o6Y.js";import"./OnboardingTooltip-BqDG-2Rd.js";import"./index-DSa6qU7h.js";import"./PortalElementProvider-DidBkzFe.js";import"./index-BPrLDK9Y.js";import"./index-C7hTFOIV.js";import"./index-B-5rsJjr.js";import"./tslib.es6-BntfKcQG.js";import"./index-B77PBZuV.js";import"./TokyoUIClose-thK8sk63.js";import"./Icon-DAQd7Eod.js";import"./text-accent-DbbdQjKI.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-BDNRMwVu.js";import"./text-centered-6MZg9O0U.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-Desxs10d.js";import"./Spinner-C3p2WoxW.js";import"./useHostname-Y3PlXofY.js";import"./index-CC6DAVyL.js";import"./layout-relative.module-CYNzEGVH.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
|