Skip to content

Commit fd4e4f5

Browse files
Deploy Storybook preview for PR #3841
1 parent 3fb5b00 commit fd4e4f5

227 files changed

Lines changed: 207 additions & 207 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/88532eb9412d1aaa7103a6e78e7b5c97b375b72b/assets/ActionButton-B0l2nlsG.js renamed to storybook/pr-3841/2e9f787c90cd05caeaff74d20c310606360eb780/assets/ActionButton-Dwew71_H.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/88532eb9412d1aaa7103a6e78e7b5c97b375b72b/assets/ActionForm-B4dGwFYN.js renamed to storybook/pr-3841/2e9f787c90cd05caeaff74d20c310606360eb780/assets/ActionForm-FMO_zOVW.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/88532eb9412d1aaa7103a6e78e7b5c97b375b72b/assets/ActionForm.stories-QQp1eu8L.js renamed to storybook/pr-3841/2e9f787c90cd05caeaff74d20c310606360eb780/assets/ActionForm.stories-CKJhyHxp.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-Bbl8xWS4.js";import{F as j,S as O}from"./SubmissionOutputPanel-DIaTA9BC.js";import{A as E}from"./action-form-CSpkjj0t.js";import"./preload-helper-BUAbRzmt.js";import"./DropdownField-DdP67yjj.js";import"./debounce-BFaUKRpC.js";import"./useOsdkClient-BVIzgYNI.js";import"./index-BrhvBMro.js";import"./Input-C7X_QVu0.js";import"./useBaseUiId-Cmt5VEHx.js";import"./useControlled-DGf-N-MW.js";import"./index-Dg_zHENz.js";import"./index-CHJ1j1l2.js";import"./PopoverPopup-CwfkGrBk.js";import"./InternalBackdrop-DQJVIwhZ.js";import"./composite-BZ5wkolO.js";import"./index-CE5JSKtI.js";import"./getDisabledMountTransitionStyles-DYMa362i.js";import"./ToolbarRootContext-mlwQOMjb.js";import"./tick-CSFR0LjW.js";import"./svgIconContainer-C49n10_C.js";import"./small-cross-DTh3t08g.js";import"./search-BoObENrO.js";import"./cross-D1K3qdEd.js";import"./useValueChanged-1sJEL3iN.js";import"./getPseudoElementBounds-r4lx2DpE.js";import"./CompositeItem-UpHYLeRj.js";import"./makeExternalStore-k_EKqWBg.js";import"./BaseForm-BYgVWEj4.js";import"./ActionButton-B0l2nlsG.js";import"./Button-vDgXwn6I.js";import"./SkeletonBar-BtzllBK1.js";import"./Tooltip-d-UN8rHt.js";import"./info-sign-SPnyj-7G.js";import"./chevron-up-e2-zMua8.js";import"./chevron-down-CguzkHKU.js";import"./useEventCallback-BqyCjoBA.js";import"./iconLoader-CnVhGmsY.js";import"./CompositeRoot-BV_6M09p.js";import"./Switch--jL4z2rR.js";import"./TimePicker-C5j-jd8V.js";import"./CollapsiblePanel-j2kmvttF.js";import"./error-BL4iX6t3.js";import"./assertUnreachable-tCT10eXl.js";import"./withOsdkMetrics-D-pE8QrY.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-DHxsU2_I.js";import{F as j,S as O}from"./SubmissionOutputPanel-Bx94HTF_.js";import{A as E}from"./action-form-BohNyEyI.js";import"./preload-helper-BR3ABpJE.js";import"./DropdownField-BRqSpCyG.js";import"./debounce-tNYRe4e5.js";import"./useOsdkClient-CORV7Qba.js";import"./index-vnjM7992.js";import"./Input-CHAbdjgV.js";import"./useBaseUiId-pTRtJO1U.js";import"./useControlled-DDSoMtR7.js";import"./index-CDRJBt8l.js";import"./index-BjXFS9V3.js";import"./PopoverPopup-CEuqgSR5.js";import"./InternalBackdrop-DUaK7Jhb.js";import"./composite-6SoNaUP7.js";import"./index-C4c1CFQV.js";import"./getDisabledMountTransitionStyles-uvRwRUIa.js";import"./ToolbarRootContext-Brnit9i4.js";import"./tick-CquZwjil.js";import"./svgIconContainer-B2plqKMw.js";import"./small-cross-Bagi3YzR.js";import"./search-Cyzg0Z92.js";import"./cross-RIzAoTK6.js";import"./useValueChanged-BI16DUVB.js";import"./getPseudoElementBounds-Eh1BWRFI.js";import"./CompositeItem-B_q3XIVN.js";import"./makeExternalStore-BfJvolns.js";import"./BaseForm-CkNoPSoU.js";import"./ActionButton-Dwew71_H.js";import"./Button-DytbmDZO.js";import"./SkeletonBar-Tdn8qzhi.js";import"./Tooltip-CJPtjYYA.js";import"./info-sign-Dz3Rycic.js";import"./chevron-up-BRGNqedv.js";import"./chevron-down-zF0nXAC0.js";import"./useEventCallback-CqytFUcr.js";import"./iconLoader-BfCiTHQl.js";import"./CompositeRoot-Y7QrxVA5.js";import"./Switch-DuA_GfXr.js";import"./TimePicker-BHKiggsu.js";import"./CollapsiblePanel-DHckIMdd.js";import"./error-CPSw0Cte.js";import"./assertUnreachable-tCT10eXl.js";import"./withOsdkMetrics-flaJFZYR.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.

storybook/pr-3841/88532eb9412d1aaa7103a6e78e7b5c97b375b72b/assets/AipAgentChat-BZl0bYPb.js renamed to storybook/pr-3841/2e9f787c90cd05caeaff74d20c310606360eb780/assets/AipAgentChat-D6_nZAg0.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import{j as e}from"./iframe-Bbl8xWS4.js";import{useMDXComponents as s}from"./index-BLGzy-2o.js";import{b as a,c as r}from"./blocks-BDG4wbPf.js";import"./preload-helper-BUAbRzmt.js";import"./index-Dg_zHENz.js";import"./index-CHJ1j1l2.js";import"./index-CE5JSKtI.js";const i=`# AipAgentChat
1+
import{j as e}from"./iframe-DHxsU2_I.js";import{useMDXComponents as s}from"./index-Du0c-ohz.js";import{b as a,c as r}from"./blocks-B0fSYtk9.js";import"./preload-helper-BR3ABpJE.js";import"./index-CDRJBt8l.js";import"./index-BjXFS9V3.js";import"./index-C4c1CFQV.js";const i=`# AipAgentChat
22
33
A React component for rendering an AI chat surface backed by Foundry's
44
LMS via \`useChat\` from \`@osdk/react/experimental/aip\`. Importing the

0 commit comments

Comments
 (0)