@preply/ds-docs 2.2.2 → 2.4.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-DG5XDWWv.js → 00.LayoutFlex.stories-D9Mbli09.js} +1 -1
- package/dist/assets/{00.applications-D9LRSiJ2.js → 00.applications-h3eU30x1.js} +1 -1
- package/dist/assets/{00.favicons.guide-Ckn8Ny70.js → 00.favicons.guide-BAXqiQQX.js} +1 -1
- package/dist/assets/{00.token-explorer-r_cr8B1c.js → 00.token-explorer-Dm9UX3N0.js} +8 -8
- package/dist/assets/{00.using-responsive-props-C6sHJ8kz.js → 00.using-responsive-props-CzuKWDWH.js} +1 -1
- package/dist/assets/01.semantic-tokens-BJHIZq-S.js +2 -0
- package/dist/assets/{01.using-shorthand-props-C9Ntfrh8.js → 01.using-shorthand-props-w68fjJ1S.js} +1 -1
- package/dist/assets/10.Combinations.stories-DpIFw2ZH.js +144 -0
- package/dist/assets/{10.fonts.guide-e6UD4uLu.js → 10.fonts.guide-Dy8ifEG0.js} +1 -1
- package/dist/assets/{10.ssr-CVR5x6k2.js → 10.ssr-CTf7FA6T.js} +1 -1
- package/dist/assets/{11.languageFont.explorer-D-2_ljwo.js → 11.languageFont.explorer-CzzsAo_-.js} +4 -4
- package/dist/assets/{11.ssr.app-router-DCaas1Jg.js → 11.ssr.app-router-1a1bLSxS.js} +1 -1
- package/dist/assets/{20.libraries-DaFUTy97.js → 20.libraries-cfFMZ5jt.js} +1 -1
- package/dist/assets/30.icons.explorer-DkDUlAAs.js +73 -0
- package/dist/assets/{30.storybook-CNA1zJjZ.js → 30.storybook-Df7y_pEg.js} +1 -1
- package/dist/assets/40.illustrations.explorer-Cp-KWsVv.js +21 -0
- package/dist/assets/{90.advanced-CR3aXZf3.js → 90.advanced-hQWASLuO.js} +1 -1
- package/dist/assets/{AlertDialog.stories-CB_cqbh2.js → AlertDialog.stories-BYaM3Dmh.js} +1 -1
- package/dist/assets/Avatar-BhXAiEHx.js +1 -0
- package/dist/assets/Avatar-DB1aMzdM.js +6 -0
- package/dist/assets/{Avatar.stories--exyM3AW.js → Avatar.stories-DjqCRDPm.js} +1 -1
- package/dist/assets/{AvatarWithStatus.stories-DoxREpBO.js → AvatarWithStatus.stories-BZuSG4Su.js} +2 -2
- package/dist/assets/{Badge.stories-CkfGCM6P.js → Badge.stories-DUeSVdhy.js} +2 -2
- package/dist/assets/Box.stories-Nfk41bTN.js +44 -0
- package/dist/assets/{Button-Ua3wdhT5.js → Button-BwzVXfnD.js} +1 -1
- package/dist/assets/Button-DBRxFdD6.js +1 -0
- package/dist/assets/{Button.stories-Ch27R8oX.js → Button.stories-Ds7LLJCv.js} +1 -1
- package/dist/assets/ButtonBase-fjWfWc99.js +8 -0
- package/dist/assets/Checkbox-CLpuKQf1.js +10 -0
- package/dist/assets/{Checkbox.stories-D3hadrXr.js → Checkbox.stories-BpslrBRV.js} +1 -1
- package/dist/assets/Checkbox.tests.stories-CunSiMPy.js +137 -0
- package/dist/assets/{Chips.stories-DRsHKMsQ.js → Chips.stories-BpSsn1sj.js} +4 -4
- package/dist/assets/{Color-YHDXOIA2-B7l-M1yz.js → Color-YHDXOIA2-nYlMi6NW.js} +1 -1
- package/dist/assets/{Dialog.stories-DxdwCMLf.js → Dialog.stories-BjLQxUlw.js} +1 -1
- package/dist/assets/{DocsRenderer-CFRXHY34-CwOeTrS1.js → DocsRenderer-CFRXHY34-E44rqLii.js} +1 -1
- package/dist/assets/FieldButton-BcfNDhpZ.js +1 -0
- package/dist/assets/FieldButton.stories-DiyzxI51.js +1 -0
- package/dist/assets/{FieldLayout-BTyC7lWj.js → FieldLayout-Df4DLDsB.js} +1 -1
- package/dist/assets/{FieldLayout.stories-CuEj0T8M.js → FieldLayout.stories-XL0oFgId.js} +1 -1
- package/dist/assets/{FieldLayoutBase-F3pRKFiA.js → FieldLayoutBase-anE7xqIx.js} +2 -2
- package/dist/assets/Heading-Iho_snJl.js +2 -0
- package/dist/assets/{Heading.stories-D8_2U4kZ.js → Heading.stories-BmAkaflC.js} +1 -1
- package/dist/assets/Icon-BlrxZqIa.js +1 -0
- package/dist/assets/Icon-CzZtXwMO.js +8 -0
- package/dist/assets/{Icon-RSC-Vg8p_sFp.js → Icon-RSC-FCfhIsMz.js} +1 -1
- package/dist/assets/{Icon.stories-D8MBZIDN.js → Icon.stories-B1XRazs6.js} +1 -1
- package/dist/assets/{IconButton-BUDpAbUP.js → IconButton-BXhZQuQT.js} +1 -1
- package/dist/assets/InputText-DsxbN3CG.js +5 -0
- package/dist/assets/LayoutFlex-B25JvLRp.js +1 -0
- package/dist/assets/LayoutFlex-DVn5GUOH.js +1 -0
- package/dist/assets/{Text-BjBJEVRG.css → LayoutFlex-a_rYMhDk.css} +1 -1
- package/dist/assets/LayoutFlexItem-BoPow6tI.js +1 -0
- package/dist/assets/LayoutGrid-BPWOaksx.js +1 -0
- package/dist/assets/LayoutGrid.stories-DDK_v_6q.js +88 -0
- package/dist/assets/LayoutGridItem-DbVmH61j.js +1 -0
- package/dist/assets/{Link.stories-D970H-zX.js → Link.stories-BV1DTHIx.js} +6 -6
- package/dist/assets/Loader.stories-BtMhSe5v.js +37 -0
- package/dist/assets/{NumberField.stories-CmsQI4vK.js → NumberField.stories-DLUFUbhI.js} +2 -2
- package/dist/assets/{ObserveIntersection-DmUYWtw_.js → ObserveIntersection-X9T7s8C_.js} +1 -1
- package/dist/assets/{ObserveIntersection.stories-D9iSLGDs.js → ObserveIntersection.stories-CL2a-4JN.js} +1 -1
- package/dist/assets/{OnboardingTooltip-CBrKU8Xk.js → OnboardingTooltip-BPM5tdAw.js} +1 -1
- package/dist/assets/{OnboardingTooltip.stories-Co4Xw1ei.js → OnboardingTooltip.stories-Ddrm-Vy0.js} +1 -1
- package/dist/assets/{OnboardingTooltip.tests.stories-BNTOBN_G.js → OnboardingTooltip.tests.stories-BHVQqSnl.js} +1 -1
- package/dist/assets/{OnboardingTour-D3bCOYvo.js → OnboardingTour-CoyXtu8b.js} +1 -1
- package/dist/assets/{OnboardingTour.stories-IjbV5XsB.js → OnboardingTour.stories-vU8ghqhL.js} +2 -2
- package/dist/assets/{OnboardingTour.tests.stories-EupxMCzm.js → OnboardingTour.tests.stories-vXlx1Tk2.js} +1 -1
- package/dist/assets/PasswordField.stories-BGY7rjXV.js +203 -0
- package/dist/assets/PreplyLogo.stories-_fxAXZGE.js +97 -0
- package/dist/assets/{ProgressBar.stories-uMqhJXI-.js → ProgressBar.stories-BclbcX02.js} +1 -1
- package/dist/assets/{ProgressSteps.stories-CD8imjKH.js → ProgressSteps.stories-_F3izKgu.js} +1 -1
- package/dist/assets/SelectField.stories-_QOq1bZM.js +182 -0
- package/dist/assets/{ShowOnIntersection.stories-DkmJRWg7.js → ShowOnIntersection.stories-kLcUye2N.js} +1 -1
- package/dist/assets/{Steps-D250tL4K.js → Steps-Dhp0iBn3.js} +1 -1
- package/dist/assets/{Steps.stories-D87rOP2-.js → Steps.stories-Bte8vve5.js} +1 -1
- package/dist/assets/Text-C6Y3rIRK.js +1 -0
- package/dist/assets/{Text.stories-DGPV9-zq.js → Text.stories-X4B6SOqs.js} +1 -1
- package/dist/assets/TextField.stories-BNT31zf0.js +178 -0
- package/dist/assets/TextHighlighted-BzUuo56x.js +1 -0
- package/dist/assets/TextHighlighted.stories-BnvdwfAX.js +32 -0
- package/dist/assets/TextInline.stories-BlmLch3R.js +37 -0
- package/dist/assets/TextareaField.stories-DGd7H0kt.js +221 -0
- package/dist/assets/{Toast.stories-C11cgX_6.js → Toast.stories-BrR9WTSV.js} +1 -1
- package/dist/assets/{Tooltip.stories-Dq5PJhdA.js → Tooltip.stories-C5jfWW6M.js} +1 -1
- package/dist/assets/{Tooltip.tests.stories-Cie8T0vz.js → Tooltip.tests.stories-D6ZXwY8n.js} +1 -1
- package/dist/assets/{breakpoints-DUiEWk32.js → breakpoints-BRV2oI45.js} +1 -1
- package/dist/assets/{breakpoints-Kkq9QlyD.js → breakpoints-CZRP5Alm.js} +1 -1
- package/dist/assets/{breakpoints-BRdPP1TZ.js → breakpoints-sSFugu-b.js} +1 -1
- package/dist/assets/{changelog-cNICkEng.js → changelog-B1t0y4q9.js} +124 -110
- package/dist/assets/{entry-preview-1hDLzyVO.js → entry-preview-gixUDv64.js} +1 -1
- package/dist/assets/filterAttributesPassedByRadixUIAtRuntime-B7QTVwVw.js +1 -0
- package/dist/assets/filterAttributesPassedByRadixUIAtRuntime-Bye2JkZ0.js +1 -0
- package/dist/assets/{getTokenVar-Dcfo1be_.js → getTokenVar-CybtM9M1.js} +1 -1
- package/dist/assets/{hover-BGigwCNJ.js → hover-BiJvfb0v.js} +1 -1
- package/dist/assets/{hover-Cyb6UrgY.js → hover-D4e5NPL-.js} +1 -1
- package/dist/assets/{hover-DtM1J8qe.js → hover-swm44S6H.js} +1 -1
- package/dist/assets/{iframe-BH3uiHBc.js → iframe-D-owUXoQ.js} +2 -2
- package/dist/assets/{index-Ck13yCbr.js → index-DR0BJ77C.js} +3 -3
- package/dist/assets/{index-BS21oJwQ.js → index-DaKSiyPo.js} +1 -1
- package/dist/assets/{intro-CSxtP1xn.js → intro-BmEWNarv.js} +1 -1
- package/dist/assets/{migrating-from-less-ippcIs1q.js → migrating-from-less-OVTYMVPH.js} +1 -1
- package/dist/assets/{playground.stories-DL5fpOBd.js → playground.stories-BXB-tnbw.js} +4 -4
- package/dist/assets/{preview-_3frqnfu.js → preview-DBV_6kXj.js} +1 -1
- package/dist/assets/{preview-CM4C4-L-.js → preview-DfxRAFJo.js} +2 -2
- package/dist/assets/{preview-D_fhqkVz.js → preview-_QLeU3Ae.js} +1 -1
- package/dist/assets/text-centered-C0V1O_Sd.js +1 -0
- package/dist/assets/{text-accent-CDvOoGdV.css → text-centered-fslmi4MP.css} +1 -1
- package/dist/assets/{tokens-xt6pG3U-.js → tokens-2b0Aegc5.js} +1 -1
- package/dist/assets/{tokens-CJ63pfRL.js → tokens-B5EFsLtR.js} +1 -1
- package/dist/assets/{tokens-C1MGvdIw.js → tokens-CvzHiOXz.js} +1 -1
- package/dist/assets/{usePortalElement-2c19axHO.js → usePortalElement-DnCZkF76.js} +1 -1
- package/dist/assets/useToken-BExS62AK.js +1 -0
- package/dist/assets/{welcome-CT5T3CAe.js → welcome-BjgujnHV.js} +1 -1
- package/dist/assets/{zeroheight-5br1IU2I.js → zeroheight-DeWlsak-.js} +1 -1
- package/dist/iframe.html +1 -1
- package/dist/preview-stats.json +1154 -1127
- package/dist/project.json +1 -1
- package/package.json +3 -3
- package/dist/assets/01.semantic-tokens-CrBTxkww.js +0 -2
- package/dist/assets/10.Combinations.stories-Ce5YVZgO.js +0 -144
- package/dist/assets/30.icons.explorer-C9gwiQSc.js +0 -72
- package/dist/assets/40.illustrations.explorer-CE4NkG7U.js +0 -21
- package/dist/assets/Avatar-CH0_UrRN.js +0 -6
- package/dist/assets/Avatar-Iyph9-aQ.js +0 -1
- package/dist/assets/Box.stories-BmdIAENY.js +0 -44
- package/dist/assets/Button-BzRWDefj.js +0 -1
- package/dist/assets/ButtonBase-D0ZIVzRq.js +0 -8
- package/dist/assets/Checkbox-BxvcX_wW.js +0 -10
- package/dist/assets/Checkbox.tests.stories-1YpjlZVu.js +0 -137
- package/dist/assets/FieldButton-CCz9-7Bu.js +0 -1
- package/dist/assets/FieldButton.stories-Cf4ZQ0zO.js +0 -1
- package/dist/assets/Heading-CQ-2lErO.js +0 -2
- package/dist/assets/Icon-CcRUbFZa.js +0 -1
- package/dist/assets/Icon-CsccYTZ-.js +0 -8
- package/dist/assets/InputText-D9JhNXoc.js +0 -5
- package/dist/assets/LayoutFlex-7DoB3s9X.css +0 -1
- package/dist/assets/LayoutFlex-BHnRSdTL.js +0 -1
- package/dist/assets/LayoutFlex-b2QXeA0z.js +0 -1
- package/dist/assets/LayoutFlexItem-CJkCBZ-T.js +0 -1
- package/dist/assets/LayoutGrid-CvUo6BcD.js +0 -1
- package/dist/assets/LayoutGrid.stories-SyasmoS3.js +0 -88
- package/dist/assets/LayoutGridItem-CxfS8XlV.js +0 -1
- package/dist/assets/Loader.stories-BYeEl9cb.js +0 -37
- package/dist/assets/PasswordField.stories-BF8iWcu_.js +0 -203
- package/dist/assets/PreplyLogo.stories-Cb304jZX.js +0 -97
- package/dist/assets/SelectField.stories-pGSDbpvG.js +0 -182
- package/dist/assets/Text-D7kiVARi.js +0 -1
- package/dist/assets/Text-QKoyPmSP.js +0 -1
- package/dist/assets/TextField.stories-CNsyGMQ7.js +0 -178
- package/dist/assets/TextHighlighted-DMdISSz2.js +0 -1
- package/dist/assets/TextHighlighted.stories-CbkTjtVw.js +0 -32
- package/dist/assets/TextInline.stories-DTtJTDzJ.js +0 -37
- package/dist/assets/TextareaField.stories-D6Ov6Kwe.js +0 -221
- package/dist/assets/filterHTMLAttributes-DYdLqcvH.js +0 -1
- package/dist/assets/filterHTMLAttributes-UOns5Q7s.js +0 -1
- package/dist/assets/text-accent-CZD2Hmtq.js +0 -1
- package/dist/assets/text-centered-Bk7GkK8R.js +0 -1
- package/dist/assets/text-centered-DN9XHxjM.css +0 -1
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
import{j as t}from"./jsx-runtime-BTJTZTIL.js";import{r as s}from"./index-Cb9e4tly.js";import{a as n}from"./chunk-D5ZWXAHU-BhFjjRSl.js";import{e as q,u as be,w as we}from"./index-BVDq5o4N.js";import{F as Ve,a as Fe}from"./TokyoUITextShort-B-mpUykT.js";import{B as R}from"./Button-BwzVXfnD.js";import{F as qe}from"./FieldButton-BcfNDhpZ.js";import{I as Ee}from"./Icon-CzZtXwMO.js";import{F as Se}from"./FieldLayout-Df4DLDsB.js";import{I as Ce}from"./InputText-DsxbN3CG.js";import{u as He}from"./useForcedRef--iGFM41p.js";import{u as Re}from"./useTextField-CErcB8j4.js";import{m as ke}from"./classNames-BUL1Zq7e.js";import{w as C}from"./componentNames-Y1T_IIlY.js";import{F as Be}from"./constants-DL6gdbsq.js";import{T as je}from"./Text-C6Y3rIRK.js";import"./index-ChsGqxH_.js";import"./_commonjsHelpers-Cpj98o6Y.js";import"./v4-CtRu48qb.js";import"./render-icon-BT0Aq7PA.js";import"./ButtonBase-fjWfWc99.js";import"./filterAttributesPassedByRadixUIAtRuntime-B7QTVwVw.js";import"./Spinner-B2C3RkCF.js";import"./defaults-B1rzzf6M.js";import"./useMergeRefs-SFH7Mw4x.js";import"./useHostname-Y3PlXofY.js";import"./index-DdzHuZ-Y.js";import"./index-CC6DAVyL.js";import"./text-accent-DZDDtpIt.js";import"./FieldLayoutBase-anE7xqIx.js";import"./FieldAdditionalText-Du1TBs7a.js";import"./index-D1pfvbUR.js";import"./tslib.es6-BntfKcQG.js";import"./hoist-non-react-statics.cjs-C-Qo8PK8.js";import"./message-B1DLZQ1U.js";import"./constants-BaXVdZRV.js";import"./text-centered-CznToR0o.js";const De="TextField__0TQjD",Le={TextField:De},We=({id:e,type:a=Be,...r},u)=>{const o=s.useRef(null),l=He();s.useImperativeHandle(u,()=>({setFocus:()=>{var d;return(d=l==null?void 0:l.current)==null?void 0:d.setFocus()},scrollIntoView:()=>{var d;return(d=o==null?void 0:o.current)==null?void 0:d.scrollIntoView()}}));const i=Re({id:e,type:a,...r},C.TextField),{layoutProps:S,inputProps:p}=i,Ie=ke(Le,C.TextField),Te=t.jsx(Ce,{...p,ref:l});return t.jsx(Se,{...S,className:Ie.join(" "),input:Te,inputHandle:l.current,ref:o,preplyDsComponent:C.TextField})},c=s.forwardRef(We);try{c.displayName="TextField",c.__docgenInfo={description:"",displayName:"TextField",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"}]}},type:{defaultValue:{value:"text"},description:"",name:"type",required:!1,type:{name:"enum",value:[{value:'"url"'},{value:'"text"'},{value:'"search"'},{value:'"email"'},{value:'"tel"'}]}},icon:{defaultValue:null,description:"",name:"icon",required:!1,type:{name:"enum",value:[{value:"ReactElement<IconProps, string | JSXElementConstructor<any>>"}]}},button:{defaultValue:null,description:"",name:"button",required:!1,type:{name:"enum",value:[{value:"ReactElement<FieldButtonProps, string | JSXElementConstructor<any>>"}]}},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"}]}},name:{defaultValue:null,description:"",name:"name",required:!1,type:{name:"enum",value:[{value:"string"}]}},required:{defaultValue:null,description:"",name:"required",required:!1,type:{name:"enum",value:[{value:"false"},{value:"true"}]}},onChange:{defaultValue:null,description:"",name:"onChange",required:!1,type:{name:"enum",value:[{value:"ChangeEventHandler<Element>"}]}},onBlur:{defaultValue:null,description:"",name:"onBlur",required:!1,type:{name:"enum",value:[{value:"FocusEventHandler<Element>"}]}},onFocus:{defaultValue:null,description:"",name:"onFocus",required:!1,type:{name:"enum",value:[{value:"FocusEventHandler<Element>"}]}},defaultValue:{defaultValue:null,description:"",name:"defaultValue",required:!1,type:{name:"enum",value:[{value:"string"}]}},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>"}]}},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>"}]}},autoComplete:{defaultValue:null,description:"",name:"autoComplete",required:!1,type:{name:"enum",value:[{value:'"url"'},{value:'"name"'},{value:'"off"'},{value:'"on"'},{value:'"email"'},{value:'"username"'},{value:'"language"'},{value:'"tel"'},{value:'"new-password"'},{value:'"current-password"'}]}},maxLength:{defaultValue:null,description:"",name:"maxLength",required:!1,type:{name:"enum",value:[{value:"number"}]}},value:{defaultValue:null,description:"",name:"value",required:!1,type:{name:"enum",value:[{value:"string"}]}},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<string>"}]}},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 wa={title:"components/TextField",component:c,args:{label:"Text",defaultValue:"",placeholder:"Enter a text",inputDataset:{testid:"input"},onChange:n("onChange"),onBlur:n("onBlur"),onFocus:n("onFocus"),onClick:n("onClick"),onCopy:n("onCopy"),onKeyDown:n("onKeyDown"),onKeyUp:n("onKeyUp"),onPaste:n("onPaste"),onValueChange:n("onValueChange")},render:function(a){const r=s.useRef(null);return a.ref=r,t.jsx(c,{...a})}},m={parameters:{docs:{description:{story:"An empty field with a `label` and a `placeholder`."}}}},v={args:{defaultValue:"Hey, you!"},play:async({canvas:e})=>{const a=e.getByTestId("input");return await q(a).toHaveValue("Hey, you!"),await be.type(a," How's it going?"),q(a).toHaveValue("Hey, you! How's it going?")}},f={args:{icon:t.jsx(Ee,{svg:Ve})}},y={args:{additionalText:"This is additional text"}},g={args:{required:!0}},h={args:{required:!0,requiredLabel:t.jsx(je,{accent:"critical",variant:"m-bold",children:"Needed"})}},x={args:{hideLabel:!0}},b={args:{hasError:!0}},w={args:{hasError:!0,errorMessage:"This is an error message"}},V={args:{disabled:!0}},E={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 r,u;return(u=(r=a.ref)==null?void 0:r.current)==null?void 0:u.setFocus()},children:"Focus"})," ","the input imperatively."]}),t.jsx(e,{})]})],play:async({args:e,canvas:a})=>{if(!H(e.ref))throw new Error("Expected ref.current to be an InputImperativeHandle");const r=a.getByTestId("input");await be.click(a.getByTestId("focus-button")),await we(()=>q(r).toHaveFocus())}},T={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(!H(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(!H(e.ref))throw new Error("Expected ref.current to be an InputImperativeHandle");const r=a.getByTestId("input");e.ref.current.scrollIntoView(),await we(()=>q(r).toBeVisible())}};function H(e){return typeof e=="object"&&e!==null&&"current"in e&&e.current!==null&&typeof e.current=="object"&&"setFocus"in e.current}const F={tags:["!test"],parameters:{docs:{description:{story:'\nThe following code renders a `TextField` with the `required` flag, an\n`icon`, `button`, `placeholder` and some `additionalText`.\n\nWhen you click the "Submit" button, and the input `value` is empty:\n\n- Displays feedback via the `errorMessage` prop;\n- Brings the focus back to the field.\n'}},chromatic:{disableSnapshot:!0}},render:function(){const[a,r]=s.useState(""),[u,o]=s.useState(!1),l=u&&!a&&"Please provide your full name",i=s.useRef(null),S=()=>{var p;o(!0),a||(p=i==null?void 0:i.current)==null||p.setFocus()};return t.jsxs("div",{style:{maxWidth:"500px",display:"flex",flexDirection:"column"},children:[t.jsx(c,{value:a,label:"Full name",required:!0,icon:t.jsx(Ee,{svg:Ve,label:"The hat"}),placeholder:"e.g.: Mary Williams",button:t.jsx(qe,{svg:Fe,assistiveText:"Do the thing",onClick:n("field button clicked")}),additionalText:"Will be shown in your profile",onValueChange:r,errorMessage:l,ref:i}),t.jsx(R,{onClick:S,children:"Submit"})]})}};var k,B,j;m.parameters={...m.parameters,docs:{...(k=m.parameters)==null?void 0:k.docs,source:{originalSource:`{
|
|
2
|
+
parameters: {
|
|
3
|
+
docs: {
|
|
4
|
+
description: {
|
|
5
|
+
story: \`An empty field with a \\\`label\\\` and a \\\`placeholder\\\`.\`
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
}`,...(j=(B=m.parameters)==null?void 0:B.docs)==null?void 0:j.source}}};var D,L,W;v.parameters={...v.parameters,docs:{...(D=v.parameters)==null?void 0:D.docs,source:{originalSource:`{
|
|
10
|
+
args: {
|
|
11
|
+
defaultValue: 'Hey, you!'
|
|
12
|
+
},
|
|
13
|
+
play: async ({
|
|
14
|
+
canvas
|
|
15
|
+
}) => {
|
|
16
|
+
const input = canvas.getByTestId('input');
|
|
17
|
+
await expect(input).toHaveValue('Hey, you!');
|
|
18
|
+
await userEvent.type(input, " How's it going?");
|
|
19
|
+
return expect(input).toHaveValue("Hey, you! How's it going?");
|
|
20
|
+
}
|
|
21
|
+
}`,...(W=(L=v.parameters)==null?void 0:L.docs)==null?void 0:W.source}}};var M,P,_;f.parameters={...f.parameters,docs:{...(M=f.parameters)==null?void 0:M.docs,source:{originalSource:`{
|
|
22
|
+
args: {
|
|
23
|
+
icon: <Icon svg={TextSvg} />
|
|
24
|
+
}
|
|
25
|
+
}`,...(_=(P=f.parameters)==null?void 0:P.docs)==null?void 0:_.source}}};var N,K,O;y.parameters={...y.parameters,docs:{...(N=y.parameters)==null?void 0:N.docs,source:{originalSource:`{
|
|
26
|
+
args: {
|
|
27
|
+
additionalText: 'This is additional text'
|
|
28
|
+
}
|
|
29
|
+
}`,...(O=(K=y.parameters)==null?void 0:K.docs)==null?void 0:O.source}}};var A,J,U;g.parameters={...g.parameters,docs:{...(A=g.parameters)==null?void 0:A.docs,source:{originalSource:`{
|
|
30
|
+
args: {
|
|
31
|
+
required: true
|
|
32
|
+
}
|
|
33
|
+
}`,...(U=(J=g.parameters)==null?void 0:J.docs)==null?void 0:U.source}}};var X,Y,$;h.parameters={...h.parameters,docs:{...(X=h.parameters)==null?void 0:X.docs,source:{originalSource:`{
|
|
34
|
+
args: {
|
|
35
|
+
required: true,
|
|
36
|
+
requiredLabel: <Text accent="critical" variant="m-bold">
|
|
37
|
+
Needed
|
|
38
|
+
</Text>
|
|
39
|
+
}
|
|
40
|
+
}`,...($=(Y=h.parameters)==null?void 0:Y.docs)==null?void 0:$.source}}};var Q,z,G;x.parameters={...x.parameters,docs:{...(Q=x.parameters)==null?void 0:Q.docs,source:{originalSource:`{
|
|
41
|
+
args: {
|
|
42
|
+
hideLabel: true
|
|
43
|
+
}
|
|
44
|
+
}`,...(G=(z=x.parameters)==null?void 0:z.docs)==null?void 0:G.source}}};var Z,ee,ae;b.parameters={...b.parameters,docs:{...(Z=b.parameters)==null?void 0:Z.docs,source:{originalSource:`{
|
|
45
|
+
args: {
|
|
46
|
+
hasError: true
|
|
47
|
+
}
|
|
48
|
+
}`,...(ae=(ee=b.parameters)==null?void 0:ee.docs)==null?void 0:ae.source}}};var te,re,ne;w.parameters={...w.parameters,docs:{...(te=w.parameters)==null?void 0:te.docs,source:{originalSource:`{
|
|
49
|
+
args: {
|
|
50
|
+
hasError: true,
|
|
51
|
+
errorMessage: 'This is an error message'
|
|
52
|
+
}
|
|
53
|
+
}`,...(ne=(re=w.parameters)==null?void 0:re.docs)==null?void 0:ne.source}}};var le,se,ue;V.parameters={...V.parameters,docs:{...(le=V.parameters)==null?void 0:le.docs,source:{originalSource:`{
|
|
54
|
+
args: {
|
|
55
|
+
disabled: true
|
|
56
|
+
}
|
|
57
|
+
}`,...(ue=(se=V.parameters)==null?void 0:se.docs)==null?void 0:ue.source}}};var oe,ie,de;E.parameters={...E.parameters,docs:{...(oe=E.parameters)==null?void 0:oe.docs,source:{originalSource:`{
|
|
58
|
+
args: {
|
|
59
|
+
readOnly: true
|
|
60
|
+
}
|
|
61
|
+
}`,...(de=(ie=E.parameters)==null?void 0:ie.docs)==null?void 0:de.source}}};var ce,pe,me;I.parameters={...I.parameters,docs:{...(ce=I.parameters)==null?void 0:ce.docs,source:{originalSource:`{
|
|
62
|
+
decorators: [(Story, {
|
|
63
|
+
args
|
|
64
|
+
}) => <div style={{
|
|
65
|
+
padding: '8px',
|
|
66
|
+
margin: '8px'
|
|
67
|
+
}}>
|
|
68
|
+
<p>
|
|
69
|
+
You can{' '}
|
|
70
|
+
<Button variant="secondary" dataset={{
|
|
71
|
+
testid: 'focus-button'
|
|
72
|
+
}} onClick={() =>
|
|
73
|
+
// @ts-expect-error - This will fail gracefully,
|
|
74
|
+
// and the \`play\` function will assert it properly
|
|
75
|
+
args.ref?.current?.setFocus()}>
|
|
76
|
+
Focus
|
|
77
|
+
</Button>{' '}
|
|
78
|
+
the input imperatively.
|
|
79
|
+
</p>
|
|
80
|
+
<Story />
|
|
81
|
+
</div>],
|
|
82
|
+
play: async ({
|
|
83
|
+
args,
|
|
84
|
+
canvas
|
|
85
|
+
}) => {
|
|
86
|
+
if (!isImperativeHandleRef(args.ref)) {
|
|
87
|
+
throw new Error('Expected ref.current to be an InputImperativeHandle');
|
|
88
|
+
}
|
|
89
|
+
const input = canvas.getByTestId('input');
|
|
90
|
+
await userEvent.click(canvas.getByTestId('focus-button'));
|
|
91
|
+
await waitFor(() => expect(input).toHaveFocus());
|
|
92
|
+
}
|
|
93
|
+
}`,...(me=(pe=I.parameters)==null?void 0:pe.docs)==null?void 0:me.source}}};var ve,fe,ye;T.parameters={...T.parameters,docs:{...(ve=T.parameters)==null?void 0:ve.docs,source:{originalSource:`{
|
|
94
|
+
decorators: [(Story, {
|
|
95
|
+
args
|
|
96
|
+
}) => <div style={{
|
|
97
|
+
height: '300px',
|
|
98
|
+
overflow: 'scroll',
|
|
99
|
+
padding: '8px',
|
|
100
|
+
margin: '8px'
|
|
101
|
+
}}>
|
|
102
|
+
<p>
|
|
103
|
+
You can{' '}
|
|
104
|
+
<Button variant="secondary" dataset={{
|
|
105
|
+
testid: 'scroll-button'
|
|
106
|
+
}} onClick={() => {
|
|
107
|
+
if (!isImperativeHandleRef(args.ref)) {
|
|
108
|
+
throw new Error('Expected ref.current to be an InputImperativeHandle');
|
|
109
|
+
}
|
|
110
|
+
args.ref.current.scrollIntoView();
|
|
111
|
+
}}>
|
|
112
|
+
Scroll
|
|
113
|
+
</Button>{' '}
|
|
114
|
+
the input into view imperatively.
|
|
115
|
+
</p>
|
|
116
|
+
<div style={{
|
|
117
|
+
height: '1000px',
|
|
118
|
+
display: 'flex',
|
|
119
|
+
flexDirection: 'column',
|
|
120
|
+
justifyContent: 'end',
|
|
121
|
+
border: '2px dashed lightgray',
|
|
122
|
+
padding: '16px'
|
|
123
|
+
}}>
|
|
124
|
+
<Story />
|
|
125
|
+
</div>
|
|
126
|
+
</div>],
|
|
127
|
+
play: async ({
|
|
128
|
+
args,
|
|
129
|
+
canvas
|
|
130
|
+
}) => {
|
|
131
|
+
if (!isImperativeHandleRef(args.ref)) {
|
|
132
|
+
throw new Error('Expected ref.current to be an InputImperativeHandle');
|
|
133
|
+
}
|
|
134
|
+
const input = canvas.getByTestId('input');
|
|
135
|
+
args.ref.current.scrollIntoView();
|
|
136
|
+
await waitFor(() => expect(input).toBeVisible());
|
|
137
|
+
}
|
|
138
|
+
}`,...(ye=(fe=T.parameters)==null?void 0:fe.docs)==null?void 0:ye.source}}};var ge,he,xe;F.parameters={...F.parameters,docs:{...(ge=F.parameters)==null?void 0:ge.docs,source:{originalSource:`{
|
|
139
|
+
tags: ['!test'],
|
|
140
|
+
parameters: {
|
|
141
|
+
docs: {
|
|
142
|
+
description: {
|
|
143
|
+
story: \`
|
|
144
|
+
The following code renders a \\\`TextField\\\` with the \\\`required\\\` flag, an
|
|
145
|
+
\\\`icon\\\`, \\\`button\\\`, \\\`placeholder\\\` and some \\\`additionalText\\\`.
|
|
146
|
+
|
|
147
|
+
When you click the "Submit" button, and the input \\\`value\\\` is empty:
|
|
148
|
+
|
|
149
|
+
- Displays feedback via the \\\`errorMessage\\\` prop;
|
|
150
|
+
- Brings the focus back to the field.
|
|
151
|
+
\`
|
|
152
|
+
}
|
|
153
|
+
},
|
|
154
|
+
chromatic: {
|
|
155
|
+
disableSnapshot: true
|
|
156
|
+
}
|
|
157
|
+
},
|
|
158
|
+
render: function Story() {
|
|
159
|
+
const [value, setValue] = useState('');
|
|
160
|
+
const [submited, setSubmitted] = useState(false);
|
|
161
|
+
const errorMessage = submited && !value && 'Please provide your full name';
|
|
162
|
+
const fieldRef = useRef<InputImperativeHandle>(null);
|
|
163
|
+
const handleClick = () => {
|
|
164
|
+
setSubmitted(true);
|
|
165
|
+
if (!value) {
|
|
166
|
+
fieldRef?.current?.setFocus();
|
|
167
|
+
}
|
|
168
|
+
};
|
|
169
|
+
return <div style={{
|
|
170
|
+
maxWidth: '500px',
|
|
171
|
+
display: 'flex',
|
|
172
|
+
flexDirection: 'column'
|
|
173
|
+
}}>
|
|
174
|
+
<TextField value={value} label="Full name" required icon={<Icon svg={TextSvg} label="The hat" />} placeholder="e.g.: Mary Williams" button={<FieldButton svg={ErrorSvg} assistiveText="Do the thing" onClick={action('field button clicked')} />} additionalText="Will be shown in your profile" onValueChange={setValue} errorMessage={errorMessage} ref={fieldRef} />
|
|
175
|
+
<Button onClick={handleClick}>Submit</Button>
|
|
176
|
+
</div>;
|
|
177
|
+
}
|
|
178
|
+
}`,...(xe=(he=F.parameters)==null?void 0:he.docs)==null?void 0:xe.source}}};const Va=["Basic","WithValue","WithIcon","WithAdditionalText","Required","RequiredWithCustomLabel","WithHiddenLabel","HasError","HasErrorWithMessage","Disabled","ReadOnly","ImperativeSetFocus","ImperativeScrollIntoView","Example"];export{m as Basic,V as Disabled,F as Example,b as HasError,w as HasErrorWithMessage,T as ImperativeScrollIntoView,I as ImperativeSetFocus,E as ReadOnly,g as Required,h as RequiredWithCustomLabel,y as WithAdditionalText,x as WithHiddenLabel,f as WithIcon,v as WithValue,Va as __namedExportsOrder,wa as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c as n,d as T}from"./constants-BgBLeZzp.js";import{r as e}from"./index-Cb9e4tly.js";import{T as m}from"./useTheme-DpAUb62T.js";import{j as x}from"./jsx-runtime-BTJTZTIL.js";import{f as p}from"./filterAttributesPassedByRadixUIAtRuntime-Bye2JkZ0.js";import{m as _,s as H}from"./classNames-BUL1Zq7e.js";import{i as c,h as f}from"./defaults-B1rzzf6M.js";import{w as i}from"./componentNames-Y1T_IIlY.js";import{g as u}from"./index-DdzHuZ-Y.js";const P=t=>Array.isArray(t)&&t.length===3&&n.includes(t[T]),R=()=>{const{setTheme:t}=e.useContext(m);return{setTheme:t}},E="TextHighlighted__ehLpO",y={TextHighlighted:E,"TextHighlighted--highlight-blue":"TextHighlighted--highlight-blue__a1Ymf","TextHighlighted--highlight-green":"TextHighlighted--highlight-green__QQm6L","TextHighlighted--highlight-primary":"TextHighlighted--highlight-primary__n35-d","TextHighlighted--highlight-secondary":"TextHighlighted--highlight-secondary__YEj6c","TextHighlighted--highlight-tertiary":"TextHighlighted--highlight-tertiary__uDEFk","TextHighlighted--highlight-accent":"TextHighlighted--highlight-accent__JrA2s","TextHighlighted--highlight-positive":"TextHighlighted--highlight-positive__tfVNZ","TextHighlighted--highlight-info":"TextHighlighted--highlight-info__W1sMI","TextHighlighted--highlight-warning":"TextHighlighted--highlight-warning__dzj54","TextHighlighted--highlight-critical":"TextHighlighted--highlight-critical__V3-1S"},N=e.forwardRef(function({children:h,highlight:g=c,tag:l=f,dataset:s,...r},a){const o=_(y,i.TextHighlighted,[H("highlight",g)]),d={...p(r),ref:a,className:o.join(" "),...u(s,{preplyDsComponent:i.TextHighlighted})};return x.jsx(l,{...d,children:h})});N.__docgenInfo={description:"",methods:[],displayName:"TextHighlighted",props:{highlight:{defaultValue:{value:"'green'",computed:!1},required:!1},tag:{defaultValue:{value:"'span'",computed:!1},required:!1}}};export{N as T,P as i,R as u};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import{j as i}from"./jsx-runtime-BTJTZTIL.js";import{r as j}from"./index-Cb9e4tly.js";import{f as E}from"./filterAttributesPassedByRadixUIAtRuntime-B7QTVwVw.js";import{m as L,s as w}from"./classNames-BUL1Zq7e.js";import{w as h}from"./componentNames-Y1T_IIlY.js";import{g as I}from"./index-DdzHuZ-Y.js";import{h as N,i as S}from"./defaults-B1rzzf6M.js";import{T as D}from"./Text-C6Y3rIRK.js";import{a as O}from"./options-Dn0Ts6qK.js";import"./index-ChsGqxH_.js";import"./_commonjsHelpers-Cpj98o6Y.js";import"./text-accent-DZDDtpIt.js";import"./text-centered-CznToR0o.js";const q="TextHighlighted__ErxU-",A={TextHighlighted:q,"TextHighlighted--highlight-blue":"TextHighlighted--highlight-blue__3H-tS","TextHighlighted--highlight-green":"TextHighlighted--highlight-green__PXiKm","TextHighlighted--highlight-primary":"TextHighlighted--highlight-primary__cKWhc","TextHighlighted--highlight-secondary":"TextHighlighted--highlight-secondary__24A04","TextHighlighted--highlight-tertiary":"TextHighlighted--highlight-tertiary__gkbLj","TextHighlighted--highlight-accent":"TextHighlighted--highlight-accent__DsZKF","TextHighlighted--highlight-positive":"TextHighlighted--highlight-positive__Tag8x","TextHighlighted--highlight-info":"TextHighlighted--highlight-info__Qqv0l","TextHighlighted--highlight-warning":"TextHighlighted--highlight-warning__--U9g","TextHighlighted--highlight-critical":"TextHighlighted--highlight-critical__D9jbb"},a=j.forwardRef(function({children:T,highlight:x=S,tag:H=N,dataset:f,..._},v){const y=L(A,h.TextHighlighted,[w("highlight",x)]),b={...E(_),ref:v,className:y.join(" "),...I(f,{preplyDsComponent:h.TextHighlighted})};return i.jsx(H,{...b,children:T})});try{a.displayName="TextHighlighted",a.__docgenInfo={description:"",displayName:"TextHighlighted",props:{highlight:{defaultValue:{value:"green"},description:"",name:"highlight",required:!1,type:{name:"enum",value:[{value:'"primary"'},{value:'"secondary"'},{value:'"tertiary"'},{value:'"critical"'},{value:'"info"'},{value:'"positive"'},{value:'"warning"'},{value:'"accent"'},{value:'"blue"'},{value:'"green"'}]}},tag:{defaultValue:null,description:"",name:"tag",required:!1,type:{name:"enum",value:[{value:'"span"'},{value:'"strong"'},{value:'"em"'}]}},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 W={title:"components/TextHighlighted",component:a},t=()=>i.jsx(a,{children:"Lorem ipsum"});t.tags=["!test"];t.parameters={chromatic:{disableSnapshot:!0}};const r=()=>i.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"0.25rem",width:"fit-content"},children:O.map(({id:e})=>i.jsx(a,{highlight:e,children:e},e))}),l={parameters:{chromatic:{disableSnapshot:!0}},render:e=>i.jsxs(D,{children:["Lorem ipsum ",i.jsx(a,{...e})]}),args:{children:"dolor sit amet",dataset:{qaid:"text-highlighted"}},argTypes:{dataset:{control:"object"}}};var n,g,s;t.parameters={...t.parameters,docs:{...(n=t.parameters)==null?void 0:n.docs,source:{originalSource:"() => <TextHighlighted>Lorem ipsum</TextHighlighted>",...(s=(g=t.parameters)==null?void 0:g.docs)==null?void 0:s.source}}};var o,d,m;r.parameters={...r.parameters,docs:{...(o=r.parameters)==null?void 0:o.docs,source:{originalSource:`() => <div style={{
|
|
2
|
+
display: 'flex',
|
|
3
|
+
flexDirection: 'column',
|
|
4
|
+
gap: '0.25rem',
|
|
5
|
+
width: 'fit-content'
|
|
6
|
+
}}>
|
|
7
|
+
{TEXT_HIGHLIGHT_OPTIONS.map(({
|
|
8
|
+
id
|
|
9
|
+
}) => <TextHighlighted key={id} highlight={id}>
|
|
10
|
+
{id}
|
|
11
|
+
</TextHighlighted>)}
|
|
12
|
+
</div>`,...(m=(d=r.parameters)==null?void 0:d.docs)==null?void 0:m.source}}};var c,u,p;l.parameters={...l.parameters,docs:{...(c=l.parameters)==null?void 0:c.docs,source:{originalSource:`{
|
|
13
|
+
parameters: {
|
|
14
|
+
chromatic: {
|
|
15
|
+
disableSnapshot: true
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
render: args => <Text>
|
|
19
|
+
Lorem ipsum <TextHighlighted {...args} />
|
|
20
|
+
</Text>,
|
|
21
|
+
args: {
|
|
22
|
+
children: 'dolor sit amet',
|
|
23
|
+
dataset: {
|
|
24
|
+
qaid: 'text-highlighted'
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
argTypes: {
|
|
28
|
+
dataset: {
|
|
29
|
+
control: 'object'
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}`,...(p=(u=l.parameters)==null?void 0:u.docs)==null?void 0:p.source}}};const Z=["Base","Options","Playground"];export{t as Base,r as Options,l as Playground,Z as __namedExportsOrder,W as default};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import{j as t}from"./jsx-runtime-BTJTZTIL.js";import{r as j}from"./index-Cb9e4tly.js";import{g as D,a as q}from"./text-accent-DZDDtpIt.js";import{m as p,s as A,b as L}from"./classNames-BUL1Zq7e.js";import{f as V}from"./filterAttributesPassedByRadixUIAtRuntime-B7QTVwVw.js";import{w as i}from"./componentNames-Y1T_IIlY.js";import{g as R}from"./index-DdzHuZ-Y.js";import{h as k,j as M}from"./defaults-B1rzzf6M.js";import{T as S}from"./Text-C6Y3rIRK.js";import"./index-ChsGqxH_.js";import"./_commonjsHelpers-Cpj98o6Y.js";import"./text-centered-CznToR0o.js";const G="TextWeight__tMRbd",P={TextWeight:G,"TextWeight--weight-400":"TextWeight--weight-400__EopTe","TextWeight--weight-500":"TextWeight--weight-500__wlyrw","TextWeight--weight-700":"TextWeight--weight-700__sVSfY","TextWeight--weight-normal":"TextWeight--weight-normal__M5PxM","TextWeight--weight-medium":"TextWeight--weight-medium__8f3CD","TextWeight--weight-bold":"TextWeight--weight-bold__MG-yF"},H="TextWeight",U=e=>p(P,H,[A("weight",e)]),B="TextInline__fMaqi",F={TextInline:B,"TextInline--italic":"TextInline--italic__yG-Qj"},l=j.forwardRef(function({children:g,accent:r,color:h,weight:T=M,italic:x=!1,tag:f=k,dataset:y,..._},w){const b=p(F,i.TextInline,[L("italic",void 0,x)]),s=r?void 0:h,I=D(!s,r),W=q(s),N=U(T),C=[...b,...I,...W,...N],E={...V(_),ref:w,className:C.join(" "),...R(y,{preplyDsComponent:i.TextInline})};return t.jsx(f,{...E,children:g})});try{l.displayName="TextInline",l.__docgenInfo={description:"",displayName:"TextInline",props:{accent:{defaultValue:null,description:"",name:"accent",required:!1,type:{name:"enum",value:[{value:'"primary"'},{value:'"secondary"'},{value:'"tertiary"'},{value:'"critical"'},{value:'"inverted"'},{value:'"disabled"'},{value:'"selected"'},{value:'"info"'},{value:'"positive"'},{value:'"warning"'},{value:'"accent"'},{value:'"accentDark"'},{value:'"placeholder"'},{value:'"branded"'},{value:'"error"'}]}},color:{defaultValue:null,description:"@deprecated Use accent instead.",name:"color",required:!1,type:{name:"enum",value:[{value:'"white"'},{value:'"gray-100"'},{value:'"gray-200"'},{value:'"gray-300"'},{value:'"gray-400"'},{value:'"gray-500"'},{value:'"gray-600"'},{value:'"teal-100"'},{value:'"teal-200"'},{value:'"teal-300"'},{value:'"teal-400"'},{value:'"teal-500"'},{value:'"green-100"'},{value:'"green-200"'},{value:'"green-300"'},{value:'"green-400"'},{value:'"green-500"'},{value:'"yellow-100"'},{value:'"yellow-200"'},{value:'"yellow-300"'},{value:'"yellow-400"'},{value:'"yellow-500"'},{value:'"red-100"'},{value:'"red-200"'},{value:'"red-300"'},{value:'"red-400"'},{value:'"red-500"'},{value:'"blue-100"'},{value:'"blue-200"'},{value:'"blue-300"'},{value:'"blue-400"'},{value:'"blue-500"'},{value:'"magenta-100"'},{value:'"magenta-200"'},{value:'"magenta-300"'},{value:'"magenta-400"'},{value:'"magenta-500"'}]}},weight:{defaultValue:{value:"normal"},description:"",name:"weight",required:!1,type:{name:"enum",value:[{value:'"medium"'},{value:'"normal"'},{value:'"bold"'},{value:'"400"'},{value:'"500"'},{value:'"700"'}]}},italic:{defaultValue:{value:"false"},description:"",name:"italic",required:!1,type:{name:"enum",value:[{value:"false"},{value:"true"}]}},tag:{defaultValue:null,description:"",name:"tag",required:!1,type:{name:"enum",value:[{value:'"span"'},{value:'"strong"'},{value:'"em"'}]}},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 ne={title:"components/TextInline",component:l},a=()=>t.jsxs("p",{children:["Lorem ",t.jsx(l,{children:"ipsum"})]});a.storyName="TextInline";const n={parameters:{chromatic:{disableSnapshot:!0}},render:e=>t.jsxs(S,{children:["Lorem ipsum ",t.jsx(l,{...e})]}),args:{children:"dolor sit amet",accent:"accentDark",tag:"span",dataset:{qaid:"text-inline"}},argTypes:{dataset:{control:"object"},children:{control:"text"},italic:{control:"boolean"},color:{table:{disable:!0}}}};var o,u,c;a.parameters={...a.parameters,docs:{...(o=a.parameters)==null?void 0:o.docs,source:{originalSource:`() => <p>
|
|
2
|
+
Lorem <TextInline>ipsum</TextInline>
|
|
3
|
+
</p>`,...(c=(u=a.parameters)==null?void 0:u.docs)==null?void 0:c.source}}};var m,d,v;n.parameters={...n.parameters,docs:{...(m=n.parameters)==null?void 0:m.docs,source:{originalSource:`{
|
|
4
|
+
parameters: {
|
|
5
|
+
chromatic: {
|
|
6
|
+
disableSnapshot: true
|
|
7
|
+
}
|
|
8
|
+
},
|
|
9
|
+
render: args => <Text>
|
|
10
|
+
Lorem ipsum <TextInline {...args} />
|
|
11
|
+
</Text>,
|
|
12
|
+
args: {
|
|
13
|
+
children: 'dolor sit amet',
|
|
14
|
+
accent: 'accentDark',
|
|
15
|
+
tag: 'span',
|
|
16
|
+
dataset: {
|
|
17
|
+
qaid: 'text-inline'
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
argTypes: {
|
|
21
|
+
dataset: {
|
|
22
|
+
control: 'object'
|
|
23
|
+
},
|
|
24
|
+
children: {
|
|
25
|
+
control: 'text'
|
|
26
|
+
},
|
|
27
|
+
italic: {
|
|
28
|
+
control: 'boolean'
|
|
29
|
+
},
|
|
30
|
+
// Disable deprecated props
|
|
31
|
+
color: {
|
|
32
|
+
table: {
|
|
33
|
+
disable: true
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}`,...(v=(d=n.parameters)==null?void 0:d.docs)==null?void 0:v.source}}};const re=["Base","Playground"];export{a as Base,n as Playground,re as __namedExportsOrder,ne as default};
|
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
import{j as n}from"./jsx-runtime-BTJTZTIL.js";import{r as s}from"./index-Cb9e4tly.js";import{a as r}from"./chunk-D5ZWXAHU-BhFjjRSl.js";import{e as i,u as Fe,w as Re}from"./index-BVDq5o4N.js";import{B as j}from"./Button-BwzVXfnD.js";import{F as Be}from"./FieldLayout-Df4DLDsB.js";import{s as ke,u as je,I as _e}from"./FieldLayoutBase-anE7xqIx.js";import{m as ze,s as De}from"./classNames-BUL1Zq7e.js";import{w as p}from"./componentNames-Y1T_IIlY.js";import{u as Le}from"./useForcedRef--iGFM41p.js";import{u as We}from"./useTextareaField-BP4f3uTe.js";import{T as Ke}from"./Text-C6Y3rIRK.js";import"./index-ChsGqxH_.js";import"./_commonjsHelpers-Cpj98o6Y.js";import"./v4-CtRu48qb.js";import"./render-icon-BT0Aq7PA.js";import"./ButtonBase-fjWfWc99.js";import"./filterAttributesPassedByRadixUIAtRuntime-B7QTVwVw.js";import"./Spinner-B2C3RkCF.js";import"./defaults-B1rzzf6M.js";import"./useMergeRefs-SFH7Mw4x.js";import"./useHostname-Y3PlXofY.js";import"./index-DdzHuZ-Y.js";import"./index-CC6DAVyL.js";import"./FieldAdditionalText-Du1TBs7a.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"./constants-BaXVdZRV.js";import"./text-accent-DZDDtpIt.js";import"./text-centered-CznToR0o.js";const z=({onChange:e,onValueChange:a,resize:t="vertical",...l},o)=>{const d=ze(ke,p.Textarea,[De("resize",t)]),u=je(c=>c.target.value,e,a);return n.jsx(_e,{...l,ref:o,type:"textarea",className:d.join(" "),onChange:u,preplyDsComponent:p.Textarea})},B=s.forwardRef(z);try{z.displayName="TextareaLocal",z.__docgenInfo={description:"",displayName:"TextareaLocal",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"}]}},name:{defaultValue:null,description:"",name:"name",required:!1,type:{name:"enum",value:[{value:"string"}]}},required:{defaultValue:null,description:"",name:"required",required:!1,type:{name:"enum",value:[{value:"false"},{value:"true"}]}},onChange:{defaultValue:null,description:"",name:"onChange",required:!1,type:{name:"enum",value:[{value:"ChangeEventHandler<Element>"}]}},onBlur:{defaultValue:null,description:"",name:"onBlur",required:!1,type:{name:"enum",value:[{value:"FocusEventHandler<Element>"}]}},onFocus:{defaultValue:null,description:"",name:"onFocus",required:!1,type:{name:"enum",value:[{value:"FocusEventHandler<Element>"}]}},"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"}]}},hasError:{defaultValue:null,description:"",name:"hasError",required:!1,type:{name:"enum",value:[{value:"false"},{value:"true"}]}},defaultValue:{defaultValue:null,description:"",name:"defaultValue",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"'}]}},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>"}]}},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>"}]}},autoComplete:{defaultValue:null,description:"",name:"autoComplete",required:!1,type:{name:"enum",value:[{value:'"off"'},{value:'"on"'}]}},maxLength:{defaultValue:null,description:"",name:"maxLength",required:!1,type:{name:"enum",value:[{value:"number"}]}},value:{defaultValue:null,description:"",name:"value",required:!1,type:{name:"enum",value:[{value:"string"}]}},readOnly:{defaultValue:null,description:"",name:"readOnly",required:!1,type:{name:"enum",value:[{value:"false"},{value:"true"}]}},rows:{defaultValue:null,description:"",name:"rows",required:!1,type:{name:"enum",value:[{value:"number"}]}},resize:{defaultValue:{value:"vertical"},description:"",name:"resize",required:!1,type:{name:"enum",value:[{value:'"none"'},{value:'"vertical"'},{value:'"horizontal"'},{value:'"both"'}]}},onValueChange:{defaultValue:null,description:"",name:"onValueChange",required:!1,type:{name:"enum",value:[{value:"ValueChangeEventHandler<string>"}]}}}}}catch{}try{B.displayName="Textarea",B.__docgenInfo={description:"",displayName:"Textarea",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"}]}},name:{defaultValue:null,description:"",name:"name",required:!1,type:{name:"enum",value:[{value:"string"}]}},required:{defaultValue:null,description:"",name:"required",required:!1,type:{name:"enum",value:[{value:"false"},{value:"true"}]}},onChange:{defaultValue:null,description:"",name:"onChange",required:!1,type:{name:"enum",value:[{value:"ChangeEventHandler<Element>"}]}},onBlur:{defaultValue:null,description:"",name:"onBlur",required:!1,type:{name:"enum",value:[{value:"FocusEventHandler<Element>"}]}},onFocus:{defaultValue:null,description:"",name:"onFocus",required:!1,type:{name:"enum",value:[{value:"FocusEventHandler<Element>"}]}},"aria-describedby":{defaultValue:null,description:`Identifies the element (or elements) that describes the object.
|
|
6
|
+
@see aria-labelledby`,name:"aria-describedby",required:!1,type:{name:"enum",value:[{value:"string"}]}},hasError:{defaultValue:null,description:"",name:"hasError",required:!1,type:{name:"enum",value:[{value:"false"},{value:"true"}]}},defaultValue:{defaultValue:null,description:"",name:"defaultValue",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.
|
|
7
|
+
@see aria-hidden
|
|
8
|
+
@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.
|
|
9
|
+
@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"'}]}},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>"}]}},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>"}]}},autoComplete:{defaultValue:null,description:"",name:"autoComplete",required:!1,type:{name:"enum",value:[{value:'"off"'},{value:'"on"'}]}},maxLength:{defaultValue:null,description:"",name:"maxLength",required:!1,type:{name:"enum",value:[{value:"number"}]}},value:{defaultValue:null,description:"",name:"value",required:!1,type:{name:"enum",value:[{value:"string"}]}},readOnly:{defaultValue:null,description:"",name:"readOnly",required:!1,type:{name:"enum",value:[{value:"false"},{value:"true"}]}},rows:{defaultValue:null,description:"",name:"rows",required:!1,type:{name:"enum",value:[{value:"number"}]}},resize:{defaultValue:{value:"vertical"},description:"",name:"resize",required:!1,type:{name:"enum",value:[{value:'"none"'},{value:'"vertical"'},{value:'"horizontal"'},{value:'"both"'}]}},onValueChange:{defaultValue:null,description:"",name:"onValueChange",required:!1,type:{name:"enum",value:[{value:"ValueChangeEventHandler<string>"}]}},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 Ne="TextareaField__Wpx9P",Me={TextareaField:Ne},Pe=({id:e,...a},t)=>{const l=s.useRef(null),o=Le();s.useImperativeHandle(t,()=>({setFocus:()=>{var m;return(m=l==null?void 0:l.current)==null?void 0:m.setFocus()},scrollIntoView:()=>{var m;return(m=l==null?void 0:l.current)==null?void 0:m.scrollIntoView()}}));const{layoutProps:d,inputProps:u}=We({id:e,...a},p.TextareaField),c=ze(Me,p.TextareaField),f=n.jsx(B,{...u,ref:o});return n.jsx(Be,{...d,className:c.join(" "),input:f,inputHandle:o.current,ref:l,preplyDsComponent:p.TextareaField})},v=s.forwardRef(Pe);try{v.displayName="TextareaField",v.__docgenInfo={description:"",displayName:"TextareaField",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"}]}},name:{defaultValue:null,description:"",name:"name",required:!1,type:{name:"enum",value:[{value:"string"}]}},required:{defaultValue:null,description:"",name:"required",required:!1,type:{name:"enum",value:[{value:"false"},{value:"true"}]}},onChange:{defaultValue:null,description:"",name:"onChange",required:!1,type:{name:"enum",value:[{value:"ChangeEventHandler<Element>"}]}},onBlur:{defaultValue:null,description:"",name:"onBlur",required:!1,type:{name:"enum",value:[{value:"FocusEventHandler<Element>"}]}},onFocus:{defaultValue:null,description:"",name:"onFocus",required:!1,type:{name:"enum",value:[{value:"FocusEventHandler<Element>"}]}},defaultValue:{defaultValue:null,description:"",name:"defaultValue",required:!1,type:{name:"enum",value:[{value:"string"}]}},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>"}]}},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>"}]}},autoComplete:{defaultValue:null,description:"",name:"autoComplete",required:!1,type:{name:"enum",value:[{value:'"off"'},{value:'"on"'}]}},maxLength:{defaultValue:null,description:"",name:"maxLength",required:!1,type:{name:"enum",value:[{value:"number"}]}},value:{defaultValue:null,description:"",name:"value",required:!1,type:{name:"enum",value:[{value:"string"}]}},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<string>"}]}},rows:{defaultValue:null,description:"",name:"rows",required:!1,type:{name:"enum",value:[{value:"number"}]}},resize:{defaultValue:null,description:"",name:"resize",required:!1,type:{name:"enum",value:[{value:'"none"'},{value:'"vertical"'},{value:'"horizontal"'},{value:'"both"'}]}},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 Ea={title:"components/TextareaField",component:v,args:{label:"Textarea",defaultValue:"",placeholder:"Enter text here",inputDataset:{testid:"input"},onChange:r("onChange"),onBlur:r("onBlur"),onFocus:r("onFocus"),onClick:r("onClick"),onCopy:r("onCopy"),onKeyDown:r("onKeyDown"),onKeyUp:r("onKeyUp"),onPaste:r("onPaste"),onValueChange:r("onValueChange")},render:function(a){const t=s.useRef(null);return a.ref=t,n.jsx(v,{...a})}},y={parameters:{docs:{description:{story:"An empty field with a `label` and a `placeholder`."}}}},h={args:{defaultValue:"Hey, you!"},play:async({canvas:e})=>{const a=e.getByTestId("input");return await i(a).toHaveValue("Hey, you!"),await Fe.type(a," How's it going?"),i(a).toHaveValue("Hey, you! How's it going?")}},g={args:{defaultValue:"Hey, you!",resize:"both"},play:({canvas:e})=>{const a=e.getByTestId("input");i(a).toHaveStyle({resize:"both"})}},b={args:{defaultValue:"Hey, you!",resize:"vertical"},play:({canvas:e})=>{const a=e.getByTestId("input");i(a).toHaveStyle({resize:"vertical"})}},V={args:{defaultValue:"Hey, you!",resize:"horizontal"},play:({canvas:e})=>{const a=e.getByTestId("input");i(a).toHaveStyle({resize:"horizontal"})}},x={args:{additionalText:"This is additional text"}},q={args:{required:!0}},E={args:{required:!0,requiredLabel:n.jsx(Ke,{accent:"critical",variant:"m-bold",children:"Needed"})}},w={args:{hideLabel:!0}},H={args:{hasError:!0}},C={args:{hasError:!0,errorMessage:"This is an error message"}},I={args:{disabled:!0}},T={args:{readOnly:!0}},S={decorators:[(e,{args:a})=>n.jsxs("div",{style:{padding:"8px",margin:"8px"},children:[n.jsxs("p",{children:["You can"," ",n.jsx(j,{variant:"secondary",dataset:{testid:"focus-button"},onClick:()=>{var t,l;return(l=(t=a.ref)==null?void 0:t.current)==null?void 0:l.setFocus()},children:"Focus"})," ","the input imperatively."]}),n.jsx(e,{})]})],play:async({args:e,canvas:a})=>{if(!k(e.ref))throw new Error("Expected ref.current to be an InputImperativeHandle");const t=a.getByTestId("input");await Fe.click(a.getByTestId("focus-button")),await Re(()=>i(t).toHaveFocus())}},F={decorators:[(e,{args:a})=>n.jsxs("div",{style:{height:"300px",overflow:"scroll",padding:"8px",margin:"8px"},children:[n.jsxs("p",{children:["You can"," ",n.jsx(j,{variant:"secondary",dataset:{testid:"scroll-button"},onClick:()=>{if(!k(a.ref))throw new Error("Expected ref.current to be an InputImperativeHandle");a.ref.current.scrollIntoView()},children:"Scroll"})," ","the input into view imperatively."]}),n.jsx("div",{style:{height:"1000px",display:"flex",flexDirection:"column",justifyContent:"end",border:"2px dashed lightgray",padding:"16px"},children:n.jsx(e,{})})]})],play:async({args:e,canvas:a})=>{if(!k(e.ref))throw new Error("Expected ref.current to be an InputImperativeHandle");const t=a.getByTestId("input");e.ref.current.scrollIntoView(),await Re(()=>i(t).toBeVisible())}};function k(e){return typeof e=="object"&&e!==null&&"current"in e&&e.current!==null&&typeof e.current=="object"&&"setFocus"in e.current}const R={tags:["!test"],parameters:{docs:{description:{story:'\nThe following code renders a `TextareaField` with the `required` flag, a\n`button`, `placeholder` and some `additionalText`.\n\nWhen you click the "Submit" button, and the input `value` is empty:\n\n- Displays feedback via the `errorMessage` prop;\n- Brings the focus back to the field.\n'}},chromatic:{disableSnapshot:!0}},render:function(){const[a,t]=s.useState(""),[l,o]=s.useState(!1),d=l&&!a&&"Please provide your full name",u=s.useRef(null),c=()=>{var f;o(!0),a||(f=u==null?void 0:u.current)==null||f.setFocus()};return n.jsxs("div",{style:{maxWidth:"500px",display:"flex",flexDirection:"column"},children:[n.jsx(v,{value:a,label:"Full name",required:!0,placeholder:"e.g.: Mary Williams",additionalText:"Will be shown in your profile",onValueChange:t,errorMessage:d,ref:u,resize:"horizontal"}),n.jsx(j,{onClick:c,children:"Submit"})]})}};var _,D,L;y.parameters={...y.parameters,docs:{...(_=y.parameters)==null?void 0:_.docs,source:{originalSource:`{
|
|
10
|
+
parameters: {
|
|
11
|
+
docs: {
|
|
12
|
+
description: {
|
|
13
|
+
story: \`An empty field with a \\\`label\\\` and a \\\`placeholder\\\`.\`
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}`,...(L=(D=y.parameters)==null?void 0:D.docs)==null?void 0:L.source}}};var W,K,N;h.parameters={...h.parameters,docs:{...(W=h.parameters)==null?void 0:W.docs,source:{originalSource:`{
|
|
18
|
+
args: {
|
|
19
|
+
defaultValue: 'Hey, you!'
|
|
20
|
+
},
|
|
21
|
+
play: async ({
|
|
22
|
+
canvas
|
|
23
|
+
}) => {
|
|
24
|
+
const input = canvas.getByTestId('input');
|
|
25
|
+
await expect(input).toHaveValue('Hey, you!');
|
|
26
|
+
await userEvent.type(input, " How's it going?");
|
|
27
|
+
return expect(input).toHaveValue("Hey, you! How's it going?");
|
|
28
|
+
}
|
|
29
|
+
}`,...(N=(K=h.parameters)==null?void 0:K.docs)==null?void 0:N.source}}};var M,P,O;g.parameters={...g.parameters,docs:{...(M=g.parameters)==null?void 0:M.docs,source:{originalSource:`{
|
|
30
|
+
args: {
|
|
31
|
+
defaultValue: 'Hey, you!',
|
|
32
|
+
resize: 'both'
|
|
33
|
+
},
|
|
34
|
+
play: ({
|
|
35
|
+
canvas
|
|
36
|
+
}) => {
|
|
37
|
+
const textarea = canvas.getByTestId('input');
|
|
38
|
+
expect(textarea).toHaveStyle({
|
|
39
|
+
resize: 'both'
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
}`,...(O=(P=g.parameters)==null?void 0:P.docs)==null?void 0:O.source}}};var U,A,J;b.parameters={...b.parameters,docs:{...(U=b.parameters)==null?void 0:U.docs,source:{originalSource:`{
|
|
43
|
+
args: {
|
|
44
|
+
defaultValue: 'Hey, you!',
|
|
45
|
+
resize: 'vertical'
|
|
46
|
+
},
|
|
47
|
+
play: ({
|
|
48
|
+
canvas
|
|
49
|
+
}) => {
|
|
50
|
+
const textarea = canvas.getByTestId('input');
|
|
51
|
+
expect(textarea).toHaveStyle({
|
|
52
|
+
resize: 'vertical'
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
}`,...(J=(A=b.parameters)==null?void 0:A.docs)==null?void 0:J.source}}};var X,Y,$;V.parameters={...V.parameters,docs:{...(X=V.parameters)==null?void 0:X.docs,source:{originalSource:`{
|
|
56
|
+
args: {
|
|
57
|
+
defaultValue: 'Hey, you!',
|
|
58
|
+
resize: 'horizontal'
|
|
59
|
+
},
|
|
60
|
+
play: ({
|
|
61
|
+
canvas
|
|
62
|
+
}) => {
|
|
63
|
+
const textarea = canvas.getByTestId('input');
|
|
64
|
+
expect(textarea).toHaveStyle({
|
|
65
|
+
resize: 'horizontal'
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
}`,...($=(Y=V.parameters)==null?void 0:Y.docs)==null?void 0:$.source}}};var G,Q,Z;x.parameters={...x.parameters,docs:{...(G=x.parameters)==null?void 0:G.docs,source:{originalSource:`{
|
|
69
|
+
args: {
|
|
70
|
+
additionalText: 'This is additional text'
|
|
71
|
+
}
|
|
72
|
+
}`,...(Z=(Q=x.parameters)==null?void 0:Q.docs)==null?void 0:Z.source}}};var ee,ae,ne;q.parameters={...q.parameters,docs:{...(ee=q.parameters)==null?void 0:ee.docs,source:{originalSource:`{
|
|
73
|
+
args: {
|
|
74
|
+
required: true
|
|
75
|
+
}
|
|
76
|
+
}`,...(ne=(ae=q.parameters)==null?void 0:ae.docs)==null?void 0:ne.source}}};var te,le,re;E.parameters={...E.parameters,docs:{...(te=E.parameters)==null?void 0:te.docs,source:{originalSource:`{
|
|
77
|
+
args: {
|
|
78
|
+
required: true,
|
|
79
|
+
requiredLabel: <Text accent="critical" variant="m-bold">
|
|
80
|
+
Needed
|
|
81
|
+
</Text>
|
|
82
|
+
}
|
|
83
|
+
}`,...(re=(le=E.parameters)==null?void 0:le.docs)==null?void 0:re.source}}};var ue,se,ie;w.parameters={...w.parameters,docs:{...(ue=w.parameters)==null?void 0:ue.docs,source:{originalSource:`{
|
|
84
|
+
args: {
|
|
85
|
+
hideLabel: true
|
|
86
|
+
}
|
|
87
|
+
}`,...(ie=(se=w.parameters)==null?void 0:se.docs)==null?void 0:ie.source}}};var oe,de,ce;H.parameters={...H.parameters,docs:{...(oe=H.parameters)==null?void 0:oe.docs,source:{originalSource:`{
|
|
88
|
+
args: {
|
|
89
|
+
hasError: true
|
|
90
|
+
}
|
|
91
|
+
}`,...(ce=(de=H.parameters)==null?void 0:de.docs)==null?void 0:ce.source}}};var me,pe,ve;C.parameters={...C.parameters,docs:{...(me=C.parameters)==null?void 0:me.docs,source:{originalSource:`{
|
|
92
|
+
args: {
|
|
93
|
+
hasError: true,
|
|
94
|
+
errorMessage: 'This is an error message'
|
|
95
|
+
}
|
|
96
|
+
}`,...(ve=(pe=C.parameters)==null?void 0:pe.docs)==null?void 0:ve.source}}};var fe,ye,he;I.parameters={...I.parameters,docs:{...(fe=I.parameters)==null?void 0:fe.docs,source:{originalSource:`{
|
|
97
|
+
args: {
|
|
98
|
+
disabled: true
|
|
99
|
+
}
|
|
100
|
+
}`,...(he=(ye=I.parameters)==null?void 0:ye.docs)==null?void 0:he.source}}};var ge,be,Ve;T.parameters={...T.parameters,docs:{...(ge=T.parameters)==null?void 0:ge.docs,source:{originalSource:`{
|
|
101
|
+
args: {
|
|
102
|
+
readOnly: true
|
|
103
|
+
}
|
|
104
|
+
}`,...(Ve=(be=T.parameters)==null?void 0:be.docs)==null?void 0:Ve.source}}};var xe,qe,Ee;S.parameters={...S.parameters,docs:{...(xe=S.parameters)==null?void 0:xe.docs,source:{originalSource:`{
|
|
105
|
+
decorators: [(Story, {
|
|
106
|
+
args
|
|
107
|
+
}) => <div style={{
|
|
108
|
+
padding: '8px',
|
|
109
|
+
margin: '8px'
|
|
110
|
+
}}>
|
|
111
|
+
<p>
|
|
112
|
+
You can{' '}
|
|
113
|
+
<Button variant="secondary" dataset={{
|
|
114
|
+
testid: 'focus-button'
|
|
115
|
+
}} onClick={() =>
|
|
116
|
+
// @ts-expect-error - This will fail gracefully,
|
|
117
|
+
// and the \`play\` function will assert it properly
|
|
118
|
+
args.ref?.current?.setFocus()}>
|
|
119
|
+
Focus
|
|
120
|
+
</Button>{' '}
|
|
121
|
+
the input imperatively.
|
|
122
|
+
</p>
|
|
123
|
+
<Story />
|
|
124
|
+
</div>],
|
|
125
|
+
play: async ({
|
|
126
|
+
args,
|
|
127
|
+
canvas
|
|
128
|
+
}) => {
|
|
129
|
+
if (!isImperativeHandleRef(args.ref)) {
|
|
130
|
+
throw new Error('Expected ref.current to be an InputImperativeHandle');
|
|
131
|
+
}
|
|
132
|
+
const input = canvas.getByTestId('input');
|
|
133
|
+
await userEvent.click(canvas.getByTestId('focus-button'));
|
|
134
|
+
await waitFor(() => expect(input).toHaveFocus());
|
|
135
|
+
}
|
|
136
|
+
}`,...(Ee=(qe=S.parameters)==null?void 0:qe.docs)==null?void 0:Ee.source}}};var we,He,Ce;F.parameters={...F.parameters,docs:{...(we=F.parameters)==null?void 0:we.docs,source:{originalSource:`{
|
|
137
|
+
decorators: [(Story, {
|
|
138
|
+
args
|
|
139
|
+
}) => <div style={{
|
|
140
|
+
height: '300px',
|
|
141
|
+
overflow: 'scroll',
|
|
142
|
+
padding: '8px',
|
|
143
|
+
margin: '8px'
|
|
144
|
+
}}>
|
|
145
|
+
<p>
|
|
146
|
+
You can{' '}
|
|
147
|
+
<Button variant="secondary" dataset={{
|
|
148
|
+
testid: 'scroll-button'
|
|
149
|
+
}} onClick={() => {
|
|
150
|
+
if (!isImperativeHandleRef(args.ref)) {
|
|
151
|
+
throw new Error('Expected ref.current to be an InputImperativeHandle');
|
|
152
|
+
}
|
|
153
|
+
args.ref.current.scrollIntoView();
|
|
154
|
+
}}>
|
|
155
|
+
Scroll
|
|
156
|
+
</Button>{' '}
|
|
157
|
+
the input into view imperatively.
|
|
158
|
+
</p>
|
|
159
|
+
<div style={{
|
|
160
|
+
height: '1000px',
|
|
161
|
+
display: 'flex',
|
|
162
|
+
flexDirection: 'column',
|
|
163
|
+
justifyContent: 'end',
|
|
164
|
+
border: '2px dashed lightgray',
|
|
165
|
+
padding: '16px'
|
|
166
|
+
}}>
|
|
167
|
+
<Story />
|
|
168
|
+
</div>
|
|
169
|
+
</div>],
|
|
170
|
+
play: async ({
|
|
171
|
+
args,
|
|
172
|
+
canvas
|
|
173
|
+
}) => {
|
|
174
|
+
if (!isImperativeHandleRef(args.ref)) {
|
|
175
|
+
throw new Error('Expected ref.current to be an InputImperativeHandle');
|
|
176
|
+
}
|
|
177
|
+
const input = canvas.getByTestId('input');
|
|
178
|
+
args.ref.current.scrollIntoView();
|
|
179
|
+
await waitFor(() => expect(input).toBeVisible());
|
|
180
|
+
}
|
|
181
|
+
}`,...(Ce=(He=F.parameters)==null?void 0:He.docs)==null?void 0:Ce.source}}};var Ie,Te,Se;R.parameters={...R.parameters,docs:{...(Ie=R.parameters)==null?void 0:Ie.docs,source:{originalSource:`{
|
|
182
|
+
tags: ['!test'],
|
|
183
|
+
parameters: {
|
|
184
|
+
docs: {
|
|
185
|
+
description: {
|
|
186
|
+
story: \`
|
|
187
|
+
The following code renders a \\\`TextareaField\\\` with the \\\`required\\\` flag, a
|
|
188
|
+
\\\`button\\\`, \\\`placeholder\\\` and some \\\`additionalText\\\`.
|
|
189
|
+
|
|
190
|
+
When you click the "Submit" button, and the input \\\`value\\\` is empty:
|
|
191
|
+
|
|
192
|
+
- Displays feedback via the \\\`errorMessage\\\` prop;
|
|
193
|
+
- Brings the focus back to the field.
|
|
194
|
+
\`
|
|
195
|
+
}
|
|
196
|
+
},
|
|
197
|
+
chromatic: {
|
|
198
|
+
disableSnapshot: true
|
|
199
|
+
}
|
|
200
|
+
},
|
|
201
|
+
render: function Story() {
|
|
202
|
+
const [value, setValue] = useState('');
|
|
203
|
+
const [submited, setSubmitted] = useState(false);
|
|
204
|
+
const errorMessage = submited && !value && 'Please provide your full name';
|
|
205
|
+
const fieldRef = useRef<InputImperativeHandle>(null);
|
|
206
|
+
const handleClick = () => {
|
|
207
|
+
setSubmitted(true);
|
|
208
|
+
if (!value) {
|
|
209
|
+
fieldRef?.current?.setFocus();
|
|
210
|
+
}
|
|
211
|
+
};
|
|
212
|
+
return <div style={{
|
|
213
|
+
maxWidth: '500px',
|
|
214
|
+
display: 'flex',
|
|
215
|
+
flexDirection: 'column'
|
|
216
|
+
}}>
|
|
217
|
+
<TextareaField value={value} label="Full name" required placeholder="e.g.: Mary Williams" additionalText="Will be shown in your profile" onValueChange={setValue} errorMessage={errorMessage} ref={fieldRef} resize="horizontal" />
|
|
218
|
+
<Button onClick={handleClick}>Submit</Button>
|
|
219
|
+
</div>;
|
|
220
|
+
}
|
|
221
|
+
}`,...(Se=(Te=R.parameters)==null?void 0:Te.docs)==null?void 0:Se.source}}};const wa=["Basic","WithValue","WithResize","WithVerticalResize","WithHorizontalResize","WithAdditionalText","Required","RequiredWithCustomLabel","WithHiddenLabel","HasError","HasErrorWithMessage","Disabled","ReadOnly","ImperativeSetFocus","ImperativeScrollIntoView","Example"];export{y as Basic,I as Disabled,R as Example,H as HasError,C as HasErrorWithMessage,F as ImperativeScrollIntoView,S as ImperativeSetFocus,T as ReadOnly,q as Required,E as RequiredWithCustomLabel,x as WithAdditionalText,w as WithHiddenLabel,V as WithHorizontalResize,g as WithResize,h as WithValue,b as WithVerticalResize,wa as __namedExportsOrder,Ea as default};
|