Skip to content

Commit 5d8207b

Browse files
Deploy Storybook preview for PR #3841
1 parent f25a81e commit 5d8207b

227 files changed

Lines changed: 195 additions & 195 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

storybook/pr-3841/0c0be69474c419c4fb8cacd1e6809df9f59010d1/assets/DateRangeCalendar-D1jqc6MW.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

storybook/pr-3841/0c0be69474c419c4fb8cacd1e6809df9f59010d1/assets/allPaths-gnzz0yva.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

storybook/pr-3841/0c0be69474c419c4fb8cacd1e6809df9f59010d1/assets/allPathsLoader-DtWNcZxf.js

Lines changed: 0 additions & 2 deletions
This file was deleted.

storybook/pr-3841/0c0be69474c419c4fb8cacd1e6809df9f59010d1/assets/formatter-EIJCOSYU-C_C0NUX0.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

storybook/pr-3841/0c0be69474c419c4fb8cacd1e6809df9f59010d1/assets/index-DErAUfdw.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

storybook/pr-3841/0c0be69474c419c4fb8cacd1e6809df9f59010d1/assets/pdf-viewer-DHSiPhOz.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

storybook/pr-3841/0c0be69474c419c4fb8cacd1e6809df9f59010d1/assets/useOsdkClient-D7_YHw9a.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

storybook/pr-3841/0c0be69474c419c4fb8cacd1e6809df9f59010d1/assets/ActionButton-Chkht-BK.js renamed to storybook/pr-3841/7d5fccfd9cc8df4da8dc6aed9b5b285001341650/assets/ActionButton-Cf5BY1g0.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

storybook/pr-3841/0c0be69474c419c4fb8cacd1e6809df9f59010d1/assets/ActionForm-cpXmdZvz.js renamed to storybook/pr-3841/7d5fccfd9cc8df4da8dc6aed9b5b285001341650/assets/ActionForm-CxY21jQp.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

storybook/pr-3841/0c0be69474c419c4fb8cacd1e6809df9f59010d1/assets/ActionForm.stories-C7-VEXiu.js renamed to storybook/pr-3841/7d5fccfd9cc8df4da8dc6aed9b5b285001341650/assets/ActionForm.stories-BChGSKBe.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import{j as n,u as xe,r as D,g as De,a as Ee}from"./iframe-p9M8Eb1o.js";import{F as j,S as O}from"./SubmissionOutputPanel-AtcfveJz.js";import{A as E}from"./action-form-DvT4pAYT.js";import"./preload-helper-BmPKtly3.js";import"./DropdownField-DdBLMtNy.js";import"./debounce-2Qm8GLyy.js";import"./useOsdkClient-D7_YHw9a.js";import"./index-C7HqDw_m.js";import"./Input-C1Qbw3qy.js";import"./useBaseUiId-44IrCziu.js";import"./useControlled-4rsFBSOI.js";import"./index-DErAUfdw.js";import"./index-KTI1yLVe.js";import"./PopoverPopup-vzbW-VJo.js";import"./InternalBackdrop-BvVIg8pG.js";import"./composite-VcTvRuc6.js";import"./index-_-VNpVA1.js";import"./getDisabledMountTransitionStyles-CdOWit4h.js";import"./ToolbarRootContext-tC1th2e9.js";import"./tick-BWy-f_cg.js";import"./svgIconContainer-ORV28Ze3.js";import"./small-cross-Bd_YaqEW.js";import"./search-BgxntRlT.js";import"./cross-DvJLudhK.js";import"./useValueChanged-CQ0CbEeS.js";import"./getPseudoElementBounds-D0nkbtwp.js";import"./CompositeItem-ZctO4SwH.js";import"./makeExternalStore-BEpV-olz.js";import"./BaseForm-DPywn3ng.js";import"./ActionButton-Chkht-BK.js";import"./Button-C6WWR2wI.js";import"./SkeletonBar-DTlAHnHY.js";import"./Tooltip-Dj16PZ2B.js";import"./info-sign-BN1TBfNs.js";import"./chevron-up-CLZaXA7l.js";import"./chevron-down-SljOnwRS.js";import"./useEventCallback-C6mJqMK5.js";import"./iconLoader-CjgTWu0b.js";import"./CompositeRoot-DapZFHSH.js";import"./Switch-Cxaie005.js";import"./TimePicker-D-gbMRFo.js";import"./CollapsiblePanel-C57d84wj.js";import"./error-qZyqYi81.js";import"./assertUnreachable-tCT10eXl.js";import"./withOsdkMetrics-CirbbHCI.js";const{expect:i,fn:y,userEvent:s,waitFor:u,within:c}=__STORYBOOK_MODULE_TEST__,Ne=xe.actionDefinition,Be=De.actionDefinition,Re=Ee.actionDefinition,Pe=1500,Ie=[{fieldKey:"fullName",label:"Full name",fieldComponent:"TEXT_INPUT",defaultValue:"Grace Hopper",fieldComponentProps:{}},{fieldKey:"yearsExperience",label:"Years of experience",fieldComponent:"NUMBER_INPUT",defaultValue:42,fieldComponentProps:{min:0}},{fieldKey:"isRemote",label:"Remote employee",fieldComponent:"RADIO_BUTTONS",defaultValue:!0,fieldComponentProps:{options:[{label:"True",value:!0},{label:"False",value:!1}]}},{fieldKey:"isFullTime",label:"Employment type",fieldComponent:"DROPDOWN",defaultValue:!0,fieldComponentProps:{items:[!0,!1],itemToStringLabel:t=>t===!0?"Full-time":"Contractor",placeholder:"Select employment type"}}],Ue=[{fieldKey:"fullName",label:"Employee legal name",fieldComponent:"TEXT_INPUT",helperText:"Use the name that should appear in HR records.",fieldComponentProps:{placeholder:"Ada Lovelace",minLength:2}},{fieldKey:"yearsExperience",label:"Relevant experience",fieldComponent:"NUMBER_INPUT",helperText:"Whole years only.",fieldComponentProps:{min:0,max:80}},{fieldKey:"isRemote",label:"Remote employee",fieldComponent:"SWITCH",helperText:"Turn on when the employee is not assigned to an office.",fieldComponentProps:{}},{fieldKey:"isFullTime",label:"Employment type",fieldComponent:"DROPDOWN",helperText:"Choose whether this employee is full-time or a contractor.",fieldComponentProps:{items:[!0,!1],itemToStringLabel:t=>t===!0?"Full-time":"Contractor",placeholder:"Select employment type"}}],d=y().mockName("onSuccess"),P=y().mockName("onError"),I=y().mockName("onSubmit"),U=y().mockName("onSubmit:slow"),k=y().mockName("onSubmit:failure");function ke(t){d(t)}function B(t,e){return e(t)}function je(t,e){return e(t)}function Oe(t,e){return e(t)}const He=(t,e)=>(I(t),B(t,e)),Ke=async(t,e)=>(U(t),await Ae(Pe),B(t,e)),We=async t=>{throw k(t),await Ae(300),new Error("Demo submission failed")};function Ae(t){return new Promise(e=>setTimeout(e,t))}function R({applyStoryAction:t,onSubmit:e}){const[o,a]=D.useState({status:"idle"}),p=D.useCallback(async(r,m)=>{a({status:"submitting",submittedValues:r});try{let l;if(e==null){const K=await t(r,m);ke(K),l=K}else l=await e(r,m);return a({status:"success",submittedValues:r,response:l}),l}catch(l){throw a({status:"error",submittedValues:r,error:l}),l}},[t,e]);return{handleStoryError:D.useCallback(r=>{a(m=>({...m,status:"error",error:r})),P(r)},[]),handleStorySubmit:p,submission:o}}function _e({formFieldDefinitions:t,formTitle:e,isSubmitDisabled:o,onSubmit:a,showFormTitle:p}){const{handleStoryError:H,handleStorySubmit:r,submission:m}=R({applyStoryAction:B,onSubmit:a});return n.jsx(j,{output:n.jsx(O,{idleMessage:"Submit the form to see the action response.",snapshot:m}),children:n.jsx(E,{actionDefinition:Ne,formFieldDefinitions:t,formTitle:e,isSubmitDisabled:o,onError:H,onSubmit:r,showFormTitle:p})})}function Le(){const{handleStoryError:t,handleStorySubmit:e}=R({applyStoryAction:je});return n.jsx("div",{className:"osdkFormCard",style:{marginInline:"auto"},children:n.jsx(E,{actionDefinition:Be,onError:t,onSubmit:e,showFormTitle:!0})})}function Ve(){const{handleStoryError:t,handleStorySubmit:e,submission:o}=R({applyStoryAction:Oe});return n.jsx(j,{output:n.jsx(O,{idleMessage:"Submit the form to see the action response.",snapshot:o}),children:n.jsx(E,{actionDefinition:Re,onError:t,onSubmit:e,showFormTitle:!0})})}const jt={title:"Components/ActionForm/Usage",component:_e,tags:["beta"],parameters:{controls:{expanded:!0},docs:{description:{component:"ActionForm fetches action metadata through @osdk/react, renders fields for each action parameter, validates user input, and submits through useOsdkAction."}}},argTypes:{formFieldDefinitions:{control:!1,description:"Complete replacement for generated fields. Include every action parameter that should appear in the form."},formTitle:{control:"text",description:"Optional title used when showFormTitle is true."},isSubmitDisabled:{control:"boolean",description:"Disables the submit button before validation runs."},onSubmit:{control:!1,table:{category:"Events"}},showFormTitle:{control:"boolean",description:"Shows the form title above the generated fields."}},args:{isSubmitDisabled:!1,showFormTitle:!1}},f={render:()=>n.jsx(Le,{}),parameters:{docs:{description:{story:"Shows ActionForm's default behavior: it maps action metadata to generated field components when no formFieldDefinitions are provided."},source:{code:`import { ActionForm } from "@osdk/react-components/experimental";
1+
import{j as n,u as xe,r as D,g as De,a as Ee}from"./iframe-BkXStBnn.js";import{F as j,S as O}from"./SubmissionOutputPanel-1XuMs2fQ.js";import{A as E}from"./action-form-1Uaau22x.js";import"./preload-helper-C6eJ-LAJ.js";import"./DropdownField-CuSoYmnK.js";import"./debounce-D3smnzmF.js";import"./useOsdkClient-B0RQ_x0Y.js";import"./index-CQxVyxO9.js";import"./Input-DxDpsYC6.js";import"./useBaseUiId-96F5yHVy.js";import"./useControlled-Bs-hAIWu.js";import"./index-CtVGck09.js";import"./index-CDh6F1Zg.js";import"./PopoverPopup-CSkaVaIl.js";import"./InternalBackdrop-BdYFQb3t.js";import"./composite-DEOhu-ZQ.js";import"./index-C4IkCmST.js";import"./getDisabledMountTransitionStyles-583SAe4r.js";import"./ToolbarRootContext-CPU8X__7.js";import"./tick-Bd8vtLY5.js";import"./svgIconContainer-BOZhbAbH.js";import"./small-cross-Sg31I6zP.js";import"./search-BVUjqmoy.js";import"./cross-kW0EKRmx.js";import"./useValueChanged-HslFxBcd.js";import"./getPseudoElementBounds-C11mWzsA.js";import"./CompositeItem-CqdHioqm.js";import"./makeExternalStore-D61zLkvo.js";import"./BaseForm-D3tHXdKr.js";import"./ActionButton-Cf5BY1g0.js";import"./Button-tcqZupxX.js";import"./SkeletonBar-Ctttl4g0.js";import"./Tooltip-COBqsjpT.js";import"./info-sign-DKJMxtPU.js";import"./chevron-up-8UqiQzNM.js";import"./chevron-down-BqO1VsFu.js";import"./useEventCallback-CH-hvduU.js";import"./iconLoader-AZFf-rl3.js";import"./CompositeRoot-BKjzZtKd.js";import"./Switch-B6oM_eYU.js";import"./TimePicker-l-pqYmH4.js";import"./CollapsiblePanel-ddkAZxfQ.js";import"./error-BWtJwOh6.js";import"./assertUnreachable-tCT10eXl.js";import"./withOsdkMetrics-CndFlT5a.js";const{expect:i,fn:y,userEvent:s,waitFor:u,within:c}=__STORYBOOK_MODULE_TEST__,Ne=xe.actionDefinition,Be=De.actionDefinition,Re=Ee.actionDefinition,Pe=1500,Ie=[{fieldKey:"fullName",label:"Full name",fieldComponent:"TEXT_INPUT",defaultValue:"Grace Hopper",fieldComponentProps:{}},{fieldKey:"yearsExperience",label:"Years of experience",fieldComponent:"NUMBER_INPUT",defaultValue:42,fieldComponentProps:{min:0}},{fieldKey:"isRemote",label:"Remote employee",fieldComponent:"RADIO_BUTTONS",defaultValue:!0,fieldComponentProps:{options:[{label:"True",value:!0},{label:"False",value:!1}]}},{fieldKey:"isFullTime",label:"Employment type",fieldComponent:"DROPDOWN",defaultValue:!0,fieldComponentProps:{items:[!0,!1],itemToStringLabel:t=>t===!0?"Full-time":"Contractor",placeholder:"Select employment type"}}],Ue=[{fieldKey:"fullName",label:"Employee legal name",fieldComponent:"TEXT_INPUT",helperText:"Use the name that should appear in HR records.",fieldComponentProps:{placeholder:"Ada Lovelace",minLength:2}},{fieldKey:"yearsExperience",label:"Relevant experience",fieldComponent:"NUMBER_INPUT",helperText:"Whole years only.",fieldComponentProps:{min:0,max:80}},{fieldKey:"isRemote",label:"Remote employee",fieldComponent:"SWITCH",helperText:"Turn on when the employee is not assigned to an office.",fieldComponentProps:{}},{fieldKey:"isFullTime",label:"Employment type",fieldComponent:"DROPDOWN",helperText:"Choose whether this employee is full-time or a contractor.",fieldComponentProps:{items:[!0,!1],itemToStringLabel:t=>t===!0?"Full-time":"Contractor",placeholder:"Select employment type"}}],d=y().mockName("onSuccess"),P=y().mockName("onError"),I=y().mockName("onSubmit"),U=y().mockName("onSubmit:slow"),k=y().mockName("onSubmit:failure");function ke(t){d(t)}function B(t,e){return e(t)}function je(t,e){return e(t)}function Oe(t,e){return e(t)}const He=(t,e)=>(I(t),B(t,e)),Ke=async(t,e)=>(U(t),await Ae(Pe),B(t,e)),We=async t=>{throw k(t),await Ae(300),new Error("Demo submission failed")};function Ae(t){return new Promise(e=>setTimeout(e,t))}function R({applyStoryAction:t,onSubmit:e}){const[o,a]=D.useState({status:"idle"}),p=D.useCallback(async(r,m)=>{a({status:"submitting",submittedValues:r});try{let l;if(e==null){const K=await t(r,m);ke(K),l=K}else l=await e(r,m);return a({status:"success",submittedValues:r,response:l}),l}catch(l){throw a({status:"error",submittedValues:r,error:l}),l}},[t,e]);return{handleStoryError:D.useCallback(r=>{a(m=>({...m,status:"error",error:r})),P(r)},[]),handleStorySubmit:p,submission:o}}function _e({formFieldDefinitions:t,formTitle:e,isSubmitDisabled:o,onSubmit:a,showFormTitle:p}){const{handleStoryError:H,handleStorySubmit:r,submission:m}=R({applyStoryAction:B,onSubmit:a});return n.jsx(j,{output:n.jsx(O,{idleMessage:"Submit the form to see the action response.",snapshot:m}),children:n.jsx(E,{actionDefinition:Ne,formFieldDefinitions:t,formTitle:e,isSubmitDisabled:o,onError:H,onSubmit:r,showFormTitle:p})})}function Le(){const{handleStoryError:t,handleStorySubmit:e}=R({applyStoryAction:je});return n.jsx("div",{className:"osdkFormCard",style:{marginInline:"auto"},children:n.jsx(E,{actionDefinition:Be,onError:t,onSubmit:e,showFormTitle:!0})})}function Ve(){const{handleStoryError:t,handleStorySubmit:e,submission:o}=R({applyStoryAction:Oe});return n.jsx(j,{output:n.jsx(O,{idleMessage:"Submit the form to see the action response.",snapshot:o}),children:n.jsx(E,{actionDefinition:Re,onError:t,onSubmit:e,showFormTitle:!0})})}const jt={title:"Components/ActionForm/Usage",component:_e,tags:["beta"],parameters:{controls:{expanded:!0},docs:{description:{component:"ActionForm fetches action metadata through @osdk/react, renders fields for each action parameter, validates user input, and submits through useOsdkAction."}}},argTypes:{formFieldDefinitions:{control:!1,description:"Complete replacement for generated fields. Include every action parameter that should appear in the form."},formTitle:{control:"text",description:"Optional title used when showFormTitle is true."},isSubmitDisabled:{control:"boolean",description:"Disables the submit button before validation runs."},onSubmit:{control:!1,table:{category:"Events"}},showFormTitle:{control:"boolean",description:"Shows the form title above the generated fields."}},args:{isSubmitDisabled:!1,showFormTitle:!1}},f={render:()=>n.jsx(Le,{}),parameters:{docs:{description:{story:"Shows ActionForm's default behavior: it maps action metadata to generated field components when no formFieldDefinitions are provided."},source:{code:`import { ActionForm } from "@osdk/react-components/experimental";
22
33
// ActionForm reads the action definition metadata and chooses default
44
// field components for supported parameter types.

0 commit comments

Comments
 (0)