@kurocado-studio/formkit-ui-react-renderer 1.0.0-develop.5 → 1.0.0-develop.7

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/exports.js CHANGED
@@ -1,2 +1,2 @@
1
- var c=(r=>(r.TEXT="TEXT",r))(c||{}),f=(o=>(o.TEXT="text",o.EMAIL="email",o.PASSWORD="password",o))(f||{}),T=(n=>(n.TEXT="text",n.NUMERIC="numeric",n.DECIMAL="decimal",n.EMAIL="email",n.TEL="tel",n.URL="url",n.SEARCH="search",n))(T||{}),u=(i=>(i.NONE="none",i.SENTENCES="sentences",i.WORDS="words",i.CHARACTERS="characters",i))(u||{});export*from"@kurocado-studio/web-forms-react";import{useAriaTextField as g}from"@kurocado-studio/web-forms-react";import a from"react";function l(e){let{labelProps:r,inputProps:t,descriptionProps:o,errorMessageProps:i}=g(e);return a.createElement(a.Fragment,null,a.createElement("label",{...r}),a.createElement("input",{...t}),a.createElement("p",{className:"block w-full",...o}),a.createElement("span",{className:"block w-full text-red-700",...i}))}import{HtmlForm as h}from"@kurocado-studio/web-forms-react";import D from"react";function H(e){return D.createElement(h,{...e})}import{useAriaTextArea as y}from"@kurocado-studio/web-forms-react";import s from"react";function Z(e){let{labelProps:r,textAreaProps:t,descriptionProps:o,errorMessageProps:i}=y(e);return s.createElement(s.Fragment,null,s.createElement("label",{...r}),s.createElement("textarea",{...t}),s.createElement("p",{className:"block w-full",...o}),s.createElement("span",{className:"block w-full text-red-700",...i}))}import{get as x}from"lodash-es";import Q from"react";function N(e){let{question:r,variant:t,variants:o,description:i}=e.question,q=x(o,[t,"id"],"unknown"),R=x(o,[t,"required"],!1);return Q.createElement(l,{required:R,name:q,label:r,description:i})}import{get as A}from"lodash-es";import V from"react";var E={TEXT:N};import{get as P}from"lodash-es";import F from"react";function v({node:e}){return F.createElement("div",{style:{color:"gray",fontStyle:"italic"}},"Unsupported node type: ",e.variant)}function b({questionNode:e,componentMap:r}){let t=P(r,[e.variant],v);return F.createElement(t,{node:e,question:e})}function de(e){return function({questionNode:t}){let o={TEXT:A(e,["TEXT"],E.TEXT)};return V.createElement(b,{questionNode:t,componentMap:o})}}import{InputFieldTypeEnum as O,VariantEnum as K}from"@kurocado-studio/formkit-ui-models";var m={id:"391a5218-2a40-4652-895b-683e2e25dd96",question:"What\u2019s the name of your form or project?",description:"Who is this description for?",hidden:!1,required:!1,variant:K.TEXT,variants:{TEXT:{id:"10ae5f58-6de4-4aef-999e-d7b9df78056b",name:"unknown",type:O.TEXT,required:!1}},name:"4c9107e4-2a29-4460-ab77-648974e2634f"},d={id:"c2bb388c-e187-440b-b4d7-092c0be49c6f",question:"Who is this form for?",description:"Who is this description for?",hidden:!1,required:!1,variant:K.TEXT,variants:{TEXT:{id:"01e3f9d0-d4c7-43f4-aa48-2987edcdafea",name:"unknown",type:O.TEXT,required:!1}},name:"e28e40c9-6821-43d7-a018-c81cf3a29dd6"},p={id:"821efcf2-cc16-4fa3-9ae9-b467738e2c4a",title:"Section 1",description:"This is a section",order:0,createdAt:"2025-11-11T16:05:23.351Z",updatedAt:"2025-11-11T16:05:23.351Z",questions:[m,d]},X={...p,questions:{[m.id]:m,[d.id]:d}},M={id:"2305e7ed-b583-4ef7-9a4c-2bc094b34894",title:"Welcome to FormKit",description:"This short demo introduces how FormKit lets you design and (soon) embed forms dynamically. You can edit any title, description, or question \u2014 just click and edit!",createdAt:"2025-11-11T16:05:23.351Z",updatedAt:"2025-11-11T16:05:23.351Z",sections:[p]},fe={[M.id]:{...M,sections:{[p.id]:X}}};var ue="2305e7ed-b583-4ef7-9a4c-2bc094b34894",le="2305e7ed-b583-4ef7-9a4c-2bc094b34894",xe="5139da7c-5fc2-4140-8041-6caff89990b5",Ne="821efcf2-cc16-4fa3-9ae9-b467738e2c4a",Ee="821efcf2-cc16-4fa3-9ae9-b467738e2c4a",S=new Date().toISOString(),_=new Date().toISOString(),Fe={createdAt:S,description:"",id:"",sections:[],updatedAt:_,title:""},be={createdAt:S,description:"No description provided",id:"",order:0,questions:[],title:"",updatedAt:_},Me={hidden:!1,id:"",question:"No name provided",description:"No description provided",required:!1,variant:"TEXT",variants:{}};export{N as BaseFormKitInputTextFieldNode,Fe as EMPTY_FORM_NODE,Me as EMPTY_QUESTION_NODE,be as EMPTY_SECTION_NODE,ue as FORMKIT_DEMO_FORM_ID,le as FORMKIT_DEMO_LONG_FORM_ID,Ee as FORMKIT_DEMO_LONG_SECTION_ID,Ne as FORMKIT_DEMO_SECTION_ID,xe as FORMKIT_LOGIN_FORM_ID,H as FormKitForm,Z as FormKitInputTextArea,l as FormKitInputTextField,u as InputFieldAutocapitalizeEnum,T as InputFieldInputModeEnum,f as InputFieldTypeEnum,c as VariantEnum,E as formKitBaseNodeVariantMap,de as formRendererComposer,M as sampledForm,fe as sampledFormsNodeTree,m as sampledQuestion1,d as sampledQuestion2,p as sampledSection,X as sampledSectionNodeTree};
1
+ var x=(r=>(r.TEXT="TEXT",r))(x||{}),F=(o=>(o.TEXT="text",o.EMAIL="email",o.PASSWORD="password",o))(F||{}),N=(i=>(i.TEXT="text",i.NUMERIC="numeric",i.DECIMAL="decimal",i.EMAIL="email",i.TEL="tel",i.URL="url",i.SEARCH="search",i))(N||{}),E=(n=>(n.NONE="none",n.SENTENCES="sentences",n.WORDS="words",n.CHARACTERS="characters",n))(E||{});export*from"@kurocado-studio/web-forms-react";import{useAriaTextField as A}from"@kurocado-studio/web-forms-react";import a from"react";function b(e){let{labelProps:r,inputProps:t,descriptionProps:o,errorMessageProps:n}=A(e);return a.createElement(a.Fragment,null,a.createElement("label",{...r}),a.createElement("input",{...t}),a.createElement("p",{className:"block w-full",...o}),a.createElement("span",{className:"block w-full text-red-700",...n}))}import{HtmlForm as k}from"@kurocado-studio/web-forms-react";import w from"react";function K(e){return w.createElement(k,{...e})}import{useAriaTextArea as B}from"@kurocado-studio/web-forms-react";import m from"react";function se(e){let{labelProps:r,textAreaProps:t,descriptionProps:o,errorMessageProps:n}=B(e);return m.createElement(m.Fragment,null,m.createElement("label",{...r}),m.createElement("textarea",{...t}),m.createElement("p",{className:"block w-full",...o}),m.createElement("span",{className:"block w-full text-red-700",...n}))}import{get as L}from"lodash-es";import H from"react";import{get as M}from"lodash-es";import V from"react";function O(e){let{question:r,variant:t,variants:o,description:n}=e.question,s=M(o,[t,"id"],"unknown"),c=M(o,[t,"required"],!1);return V.createElement(b,{required:c,name:s,label:r,description:n})}var y={TEXT:O};import{get as X}from"lodash-es";import R from"react";function G({node:e}){return R.createElement("div",{style:{color:"gray",fontStyle:"italic"}},"Unsupported node type: ",e.variant)}function g({questionNode:e,componentMap:r}){let t=X(r,[e.variant],G);return R.createElement(t,{node:e,question:e})}function Ke(e){return function({questionNode:t}){let o={TEXT:L(e,["TEXT"],y.TEXT)};return H.createElement(g,{questionNode:t,componentMap:o})}}import{get as Z}from"lodash-es";import C from"react";import{useAxios as W}from"@kurocado-studio/axios-react";import{get as f}from"lodash-es";import Y from"react";var Oe="2305e7ed-b583-4ef7-9a4c-2bc094b34894",ye="2305e7ed-b583-4ef7-9a4c-2bc094b34894",Re="5139da7c-5fc2-4140-8041-6caff89990b5",ge="821efcf2-cc16-4fa3-9ae9-b467738e2c4a",he="821efcf2-cc16-4fa3-9ae9-b467738e2c4a",h=new Date().toISOString(),S=new Date().toISOString(),I={createdAt:h,description:"",id:"",sections:[],updatedAt:S,title:""},Se={createdAt:h,description:"No description provided",id:"",order:0,questions:[],title:"",updatedAt:S},Ie={hidden:!1,id:"",question:"No name provided",description:"No description provided",required:!1,variant:"TEXT",variants:{}};import U from"axios";function p(e={}){let{baseURL:r="https://html-forms-service-staging.fly.dev",timeout:t=9e3,headers:o={}}=e;return U.create({baseURL:r,timeout:t,headers:{"Content-Type":"application/json",...o}})}var qe=p();var _=e=>{let r=Y.useMemo(()=>f(e,["axiosInstance"],p()),[e?.axiosInstance]),[t,o]=W({axiosInstance:r});return[t,async({organizationId:s,formId:c})=>{try{let i=await o({url:`/api/v1/organizations/${s}/forms/${c}`,method:"GET"});return f(e,["onSuccessCallBack"],()=>{})({form:i}),i}catch(i){let d=I;return f(e,["onErrorCallBack"],()=>{})({error:i,fallbackEmptyForm:d}),d}}]};function Le({children:e,organizationId:r,formId:t,...o}){let[{isLoading:n,data:s,error:c,resetState:i},d]=_();return C.useEffect(()=>(!n&&s===void 0&&c===void 0&&d({organizationId:r,formId:t}).then(),()=>i()),[r,t]),C.createElement(K,{...o},Z(s,["sections",0,"questions"],[]).map((Q,v)=>e({question:Q,indexInCollection:v})))}import{InputFieldTypeEnum as D,VariantEnum as P}from"@kurocado-studio/formkit-ui-models";var u={id:"391a5218-2a40-4652-895b-683e2e25dd96",question:"What\u2019s the name of your form or project?",description:"Who is this description for?",hidden:!1,required:!1,variant:P.TEXT,variants:{TEXT:{id:"10ae5f58-6de4-4aef-999e-d7b9df78056b",name:"unknown",type:D.TEXT,required:!1}},name:"4c9107e4-2a29-4460-ab77-648974e2634f"},l={id:"c2bb388c-e187-440b-b4d7-092c0be49c6f",question:"Who is this form for?",description:"Who is this description for?",hidden:!1,required:!1,variant:P.TEXT,variants:{TEXT:{id:"01e3f9d0-d4c7-43f4-aa48-2987edcdafea",name:"unknown",type:D.TEXT,required:!1}},name:"e28e40c9-6821-43d7-a018-c81cf3a29dd6"},T={id:"821efcf2-cc16-4fa3-9ae9-b467738e2c4a",title:"Section 1",description:"This is a section",order:0,createdAt:"2025-11-11T16:05:23.351Z",updatedAt:"2025-11-11T16:05:23.351Z",questions:[u,l]},j={...T,questions:{[u.id]:u,[l.id]:l}},q={id:"2305e7ed-b583-4ef7-9a4c-2bc094b34894",title:"Welcome to FormKit",description:"This short demo introduces how FormKit lets you design and (soon) embed forms dynamically. You can edit any title, description, or question \u2014 just click and edit!",createdAt:"2025-11-11T16:05:23.351Z",updatedAt:"2025-11-11T16:05:23.351Z",sections:[T]},We={[q.id]:{...q,sections:{[T.id]:j}}};export{O as BaseFormKitInputTextFieldNode,I as EMPTY_FORM_NODE,Ie as EMPTY_QUESTION_NODE,Se as EMPTY_SECTION_NODE,Oe as FORMKIT_DEMO_FORM_ID,ye as FORMKIT_DEMO_LONG_FORM_ID,he as FORMKIT_DEMO_LONG_SECTION_ID,ge as FORMKIT_DEMO_SECTION_ID,Re as FORMKIT_LOGIN_FORM_ID,Le as FormKitConsumerForm,K as FormKitForm,se as FormKitInputTextArea,b as FormKitInputTextField,E as InputFieldAutocapitalizeEnum,N as InputFieldInputModeEnum,F as InputFieldTypeEnum,g as QuestionNodeRenderer,x as VariantEnum,qe as axiosFormKitInstance,p as createFormKitClient,y as formKitBaseNodeVariantMap,Ke as formRendererComposer,q as sampledForm,We as sampledFormsNodeTree,u as sampledQuestion1,l as sampledQuestion2,T as sampledSection,j as sampledSectionNodeTree,_ as useGetFormKitFormById};
2
2
  //# sourceMappingURL=exports.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/enums/index.ts","../src/exports.ts","../src/components/controls/FormKitInputTextField.tsx","../src/components/controls/FormKitForm.tsx","../src/components/controls/FormKitInputTextArea.tsx","../src/components/nodes/BaseFormKitInputTextFieldNode.tsx","../src/components/FormRendererComposer.tsx","../src/config/formKitBaseNodeVariantMap.ts","../src/components/QuestionNodeRenderer.tsx","../src/utils/mocks.ts","../src/constants.ts"],"sourcesContent":["export enum VariantEnum {\n TEXT = 'TEXT',\n}\nexport enum InputFieldTypeEnum {\n TEXT = 'text',\n EMAIL = 'email',\n PASSWORD = 'password',\n}\n\nexport enum InputFieldInputModeEnum {\n TEXT = 'text',\n NUMERIC = 'numeric',\n DECIMAL = 'decimal',\n EMAIL = 'email',\n TEL = 'tel',\n URL = 'url',\n SEARCH = 'search',\n}\n\nexport enum InputFieldAutocapitalizeEnum {\n NONE = 'none',\n SENTENCES = 'sentences',\n WORDS = 'words',\n CHARACTERS = 'characters',\n}\n","export type Theme = Record<string, Record<string, unknown>>;\n\nexport {\n VariantEnum,\n InputFieldTypeEnum,\n InputFieldInputModeEnum,\n InputFieldAutocapitalizeEnum,\n} from './enums';\n\nexport * from '@kurocado-studio/web-forms-react';\nexport * from './components/controls';\nexport * from './components/nodes';\nexport * from './components/FormRendererComposer';\nexport * from './config/formKitBaseNodeVariantMap';\nexport * from './utils/mocks';\nexport * from './constants';\nexport * from './types';\n","import { useAriaTextField } from '@kurocado-studio/web-forms-react';\nimport React from 'react';\n\nexport function FormKitInputTextField(\n properties: {\n name: string;\n label?: string;\n description?: string;\n } & Partial<HTMLElementTagNameMap['input']>,\n): React.ReactNode {\n const { labelProps, inputProps, descriptionProps, errorMessageProps } =\n useAriaTextField(properties);\n\n return (\n <>\n <label {...labelProps} />\n <input {...inputProps} />\n <p className='block w-full' {...descriptionProps} />\n <span className='block w-full text-red-700' {...errorMessageProps} />\n </>\n );\n}\n","import { HtmlForm } from '@kurocado-studio/web-forms-react';\nimport React from 'react';\n\nimport { FormKitFormProperties } from '../../types';\n\nexport function FormKitForm<T extends Record<string, unknown>>(\n properties: FormKitFormProperties<T>,\n): React.ReactNode {\n return <HtmlForm<T> {...properties} />;\n}\n","import { useAriaTextArea } from '@kurocado-studio/web-forms-react';\nimport React from 'react';\n\nexport function FormKitInputTextArea(\n properties: { name: string } & Partial<HTMLElementTagNameMap['textarea']>,\n): React.ReactNode {\n const { labelProps, textAreaProps, descriptionProps, errorMessageProps } =\n useAriaTextArea(properties);\n\n return (\n <>\n <label {...labelProps} />\n <textarea {...textAreaProps} />\n <p className='block w-full' {...descriptionProps} />\n <span className='block w-full text-red-700' {...errorMessageProps} />\n </>\n );\n}\n","import type { Question } from '@kurocado-studio/formkit-ui-models';\nimport { get } from 'lodash-es';\nimport React from 'react';\n\nimport { FormKitInputTextField } from '../controls';\n\nexport function BaseFormKitInputTextFieldNode(properties: {\n question: Question;\n}): React.ReactNode {\n const { question, variant, variants, description } = properties.question;\n const name = get(variants, [variant, 'id'], 'unknown');\n const required = get(variants, [variant, 'required'], false);\n\n return (\n <FormKitInputTextField\n required={required}\n name={name}\n label={question}\n description={description}\n />\n );\n}\n","import { get } from 'lodash-es';\nimport React from 'react';\n\nimport { formKitBaseNodeVariantMap } from '../config/formKitBaseNodeVariantMap';\nimport { VariantEnum } from '../enums';\nimport { FormKitNodeVariantMap, Question } from '../types';\nimport { QuestionNodeRenderer } from './QuestionNodeRenderer';\n\nexport function formRendererComposer(defaultMap: FormKitNodeVariantMap) {\n return function FormRenderer({\n questionNode,\n }: {\n questionNode: Question;\n componentMap?: FormKitNodeVariantMap;\n }) {\n const nodeVariantMap: FormKitNodeVariantMap = {\n [VariantEnum.TEXT]: get(\n defaultMap,\n [VariantEnum.TEXT],\n formKitBaseNodeVariantMap.TEXT,\n ),\n };\n\n return (\n <QuestionNodeRenderer\n questionNode={questionNode}\n componentMap={nodeVariantMap}\n />\n );\n };\n}\n","import { BaseFormKitInputTextFieldNode } from '../components/nodes';\nimport { VariantEnum } from '../enums';\nimport { FormKitNodeVariantMap } from '../types';\n\nexport const formKitBaseNodeVariantMap: FormKitNodeVariantMap = {\n [VariantEnum.TEXT]: BaseFormKitInputTextFieldNode,\n};\n","import { get } from 'lodash-es';\nimport React from 'react';\n\nimport { FormKitNodeVariantMap, Question } from '../types';\n\nfunction DefaultFallback({ node }: { node: Question }) {\n return (\n <div style={{ color: 'gray', fontStyle: 'italic' }}>\n Unsupported node type: {node.variant}\n </div>\n );\n}\n\nexport function QuestionNodeRenderer({\n questionNode,\n componentMap,\n}: {\n questionNode: Question;\n componentMap: FormKitNodeVariantMap;\n}) {\n const Component = get(componentMap, [questionNode.variant], DefaultFallback);\n return <Component node={questionNode} question={questionNode} />;\n}\n","import {\n type Form,\n type FormsNodeTree,\n InputFieldTypeEnum,\n type Question,\n type Section,\n type SectionNodeTree,\n VariantEnum,\n} from '@kurocado-studio/formkit-ui-models';\n\nexport const sampledQuestion1: Question = {\n id: '391a5218-2a40-4652-895b-683e2e25dd96',\n question: 'What’s the name of your form or project?',\n description: 'Who is this description for?',\n hidden: false,\n required: false,\n variant: VariantEnum.TEXT,\n variants: {\n TEXT: {\n id: '10ae5f58-6de4-4aef-999e-d7b9df78056b',\n name: 'unknown',\n type: InputFieldTypeEnum.TEXT,\n required: false,\n },\n },\n name: '4c9107e4-2a29-4460-ab77-648974e2634f',\n};\n\nexport const sampledQuestion2: Question = {\n id: 'c2bb388c-e187-440b-b4d7-092c0be49c6f',\n question: 'Who is this form for?',\n description: 'Who is this description for?',\n hidden: false,\n required: false,\n variant: VariantEnum.TEXT,\n variants: {\n TEXT: {\n id: '01e3f9d0-d4c7-43f4-aa48-2987edcdafea',\n name: 'unknown',\n type: InputFieldTypeEnum.TEXT,\n required: false,\n },\n },\n name: 'e28e40c9-6821-43d7-a018-c81cf3a29dd6',\n};\n\nexport const sampledSection: Section = {\n id: '821efcf2-cc16-4fa3-9ae9-b467738e2c4a',\n title: 'Section 1',\n description: 'This is a section',\n order: 0,\n createdAt: '2025-11-11T16:05:23.351Z',\n updatedAt: '2025-11-11T16:05:23.351Z',\n questions: [sampledQuestion1, sampledQuestion2],\n};\n\nexport const sampledSectionNodeTree: SectionNodeTree = {\n ...sampledSection,\n questions: {\n [sampledQuestion1.id]: sampledQuestion1,\n [sampledQuestion2.id]: sampledQuestion2,\n },\n};\n\nexport const sampledForm: Form = {\n id: '2305e7ed-b583-4ef7-9a4c-2bc094b34894',\n title: 'Welcome to FormKit',\n description:\n 'This short demo introduces how FormKit lets you design and (soon) embed forms dynamically. You can edit any title, description, or question — just click and edit!',\n createdAt: '2025-11-11T16:05:23.351Z',\n updatedAt: '2025-11-11T16:05:23.351Z',\n sections: [sampledSection],\n};\n\nexport const sampledFormsNodeTree: FormsNodeTree = {\n [sampledForm.id]: {\n ...sampledForm,\n sections: {\n [sampledSection.id]: sampledSectionNodeTree,\n },\n },\n};\n","import { VariantEnum } from './enums';\nimport { Form, Question, Section } from './types';\n\nexport const FORMKIT_DEMO_FORM_ID = '2305e7ed-b583-4ef7-9a4c-2bc094b34894';\nexport const FORMKIT_DEMO_LONG_FORM_ID = '2305e7ed-b583-4ef7-9a4c-2bc094b34894';\nexport const FORMKIT_LOGIN_FORM_ID = '5139da7c-5fc2-4140-8041-6caff89990b5';\nexport const FORMKIT_DEMO_SECTION_ID = '821efcf2-cc16-4fa3-9ae9-b467738e2c4a';\nexport const FORMKIT_DEMO_LONG_SECTION_ID =\n '821efcf2-cc16-4fa3-9ae9-b467738e2c4a';\n\nconst createdAt = new Date().toISOString();\nconst updatedAt = new Date().toISOString();\n\nexport const EMPTY_FORM_NODE: Form = {\n createdAt,\n description: '',\n id: '',\n sections: [],\n updatedAt,\n title: '',\n};\n\nexport const EMPTY_SECTION_NODE: Section = {\n createdAt,\n description: 'No description provided',\n id: '',\n order: 0,\n questions: [],\n title: '',\n updatedAt,\n};\n\nexport const EMPTY_QUESTION_NODE: Question = {\n hidden: false,\n id: '',\n question: 'No name provided',\n description: 'No description provided',\n required: false,\n variant: VariantEnum.TEXT,\n variants: {},\n};\n"],"mappings":"AAAO,IAAKA,OACVA,EAAA,KAAO,OADGA,OAAA,IAGAC,OACVA,EAAA,KAAO,OACPA,EAAA,MAAQ,QACRA,EAAA,SAAW,WAHDA,OAAA,IAMAC,OACVA,EAAA,KAAO,OACPA,EAAA,QAAU,UACVA,EAAA,QAAU,UACVA,EAAA,MAAQ,QACRA,EAAA,IAAM,MACNA,EAAA,IAAM,MACNA,EAAA,OAAS,SAPCA,OAAA,IAUAC,OACVA,EAAA,KAAO,OACPA,EAAA,UAAY,YACZA,EAAA,MAAQ,QACRA,EAAA,WAAa,aAJHA,OAAA,ICVZ,WAAc,mCCTd,OAAS,oBAAAC,MAAwB,mCACjC,OAAOC,MAAW,QAEX,SAASC,EACdC,EAKiB,CACjB,GAAM,CAAE,WAAAC,EAAY,WAAAC,EAAY,iBAAAC,EAAkB,kBAAAC,CAAkB,EAClEP,EAAiBG,CAAU,EAE7B,OACEF,EAAA,cAAAA,EAAA,cACEA,EAAA,cAAC,SAAO,GAAGG,EAAY,EACvBH,EAAA,cAAC,SAAO,GAAGI,EAAY,EACvBJ,EAAA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2BACX,SAAU,CAACF,CAAc,CAC3B,EAEaG,GAAsC,CACjD,CAACD,EAAY,EAAE,EAAG,CAChB,GAAGA,EACH,SAAU,CACR,CAACF,EAAe,EAAE,EAAGC,CACvB,CACF,CACF,EC9EO,IAAMG,GAAuB,uCACvBC,GAA4B,uCAC5BC,GAAwB,uCACxBC,GAA0B,uCAC1BC,GACX,uCAEIC,EAAY,IAAI,KAAK,EAAE,YAAY,EACnCC,EAAY,IAAI,KAAK,EAAE,YAAY,EAE5BC,GAAwB,CACnC,UAAAF,EACA,YAAa,GACb,GAAI,GACJ,SAAU,CAAC,EACX,UAAAC,EACA,MAAO,EACT,EAEaE,GAA8B,CACzC,UAAAH,EACA,YAAa,0BACb,GAAI,GACJ,MAAO,EACP,UAAW,CAAC,EACZ,MAAO,GACP,UAAAC,CACF,EAEaG,GAAgC,CAC3C,OAAQ,GACR,GAAI,GACJ,SAAU,mBACV,YAAa,0BACb,SAAU,GACV,eACA,SAAU,CAAC,CACb","names":["VariantEnum","InputFieldTypeEnum","InputFieldInputModeEnum","InputFieldAutocapitalizeEnum","useAriaTextField","React","FormKitInputTextField","properties","labelProps","inputProps","descriptionProps","errorMessageProps","HtmlForm","React","FormKitForm","properties","useAriaTextArea","React","FormKitInputTextArea","properties","labelProps","textAreaProps","descriptionProps","errorMessageProps","get","React","BaseFormKitInputTextFieldNode","properties","question","variant","variants","description","name","get","required","React","FormKitInputTextField","get","React","formKitBaseNodeVariantMap","BaseFormKitInputTextFieldNode","get","React","DefaultFallback","node","QuestionNodeRenderer","questionNode","componentMap","Component","formRendererComposer","defaultMap","questionNode","nodeVariantMap","get","formKitBaseNodeVariantMap","React","QuestionNodeRenderer","InputFieldTypeEnum","VariantEnum","sampledQuestion1","sampledQuestion2","sampledSection","sampledSectionNodeTree","sampledForm","sampledFormsNodeTree","FORMKIT_DEMO_FORM_ID","FORMKIT_DEMO_LONG_FORM_ID","FORMKIT_LOGIN_FORM_ID","FORMKIT_DEMO_SECTION_ID","FORMKIT_DEMO_LONG_SECTION_ID","createdAt","updatedAt","EMPTY_FORM_NODE","EMPTY_SECTION_NODE","EMPTY_QUESTION_NODE"]}
1
+ {"version":3,"sources":["../src/enums/index.ts","../src/exports.ts","../src/components/controls/FormKitInputTextField.tsx","../src/components/controls/FormKitForm.tsx","../src/components/controls/FormKitInputTextArea.tsx","../src/components/FormRendererComposer.tsx","../src/components/nodes/BaseFormKitInputTextFieldNode.tsx","../src/config/formKitBaseNodeVariantMap.ts","../src/components/QuestionNodeRenderer.tsx","../src/components/FormKitConsumerForm.tsx","../src/components/hooks/useGetFormKitFormById.ts","../src/constants.ts","../src/components/api/createFormKitClient.ts","../src/utils/mocks.ts"],"sourcesContent":["export enum VariantEnum {\n TEXT = 'TEXT',\n}\nexport enum InputFieldTypeEnum {\n TEXT = 'text',\n EMAIL = 'email',\n PASSWORD = 'password',\n}\n\nexport enum InputFieldInputModeEnum {\n TEXT = 'text',\n NUMERIC = 'numeric',\n DECIMAL = 'decimal',\n EMAIL = 'email',\n TEL = 'tel',\n URL = 'url',\n SEARCH = 'search',\n}\n\nexport enum InputFieldAutocapitalizeEnum {\n NONE = 'none',\n SENTENCES = 'sentences',\n WORDS = 'words',\n CHARACTERS = 'characters',\n}\n","export type Theme = Record<string, Record<string, unknown>>;\n\nexport {\n VariantEnum,\n InputFieldTypeEnum,\n InputFieldInputModeEnum,\n InputFieldAutocapitalizeEnum,\n} from './enums';\n\nexport * from '@kurocado-studio/web-forms-react';\nexport * from './components/controls';\nexport * from './components/FormRendererComposer';\nexport * from './components/FormKitConsumerForm';\nexport * from './components/QuestionNodeRenderer';\nexport * from './components/nodes';\nexport * from './components/api/createFormKitClient';\nexport * from './components/nodes/index';\nexport * from './components/hooks/useGetFormKitFormById';\nexport * from './components/FormRendererComposer';\nexport * from './config/formKitBaseNodeVariantMap';\nexport * from './utils/mocks';\nexport * from './constants';\nexport * from './types';\n","import { useAriaTextField } from '@kurocado-studio/web-forms-react';\nimport React from 'react';\n\nexport function FormKitInputTextField(\n properties: {\n name: string;\n label?: string;\n description?: string;\n } & Partial<HTMLElementTagNameMap['input']>,\n): React.ReactNode {\n const { labelProps, inputProps, descriptionProps, errorMessageProps } =\n useAriaTextField(properties);\n\n return (\n <>\n <label {...labelProps} />\n <input {...inputProps} />\n <p className='block w-full' {...descriptionProps} />\n <span className='block w-full text-red-700' {...errorMessageProps} />\n </>\n );\n}\n","import { HtmlForm } from '@kurocado-studio/web-forms-react';\nimport React from 'react';\n\nimport { FormKitFormProperties } from '../../types';\n\nexport function FormKitForm<T extends Record<string, unknown>>(\n properties: FormKitFormProperties<T>,\n): React.ReactNode {\n return <HtmlForm<T> {...properties} />;\n}\n","import { useAriaTextArea } from '@kurocado-studio/web-forms-react';\nimport React from 'react';\n\nexport function FormKitInputTextArea(\n properties: { name: string } & Partial<HTMLElementTagNameMap['textarea']>,\n): React.ReactNode {\n const { labelProps, textAreaProps, descriptionProps, errorMessageProps } =\n useAriaTextArea(properties);\n\n return (\n <>\n <label {...labelProps} />\n <textarea {...textAreaProps} />\n <p className='block w-full' {...descriptionProps} />\n <span className='block w-full text-red-700' {...errorMessageProps} />\n </>\n );\n}\n","import { get } from 'lodash-es';\nimport React from 'react';\n\nimport { formKitBaseNodeVariantMap } from '../config/formKitBaseNodeVariantMap';\nimport { VariantEnum } from '../enums';\nimport { FormKitNodeVariantMap, Question } from '../types';\nimport { QuestionNodeRenderer } from './QuestionNodeRenderer';\n\nexport function formRendererComposer(defaultMap: FormKitNodeVariantMap) {\n return function FormRenderer({\n questionNode,\n }: {\n questionNode: Question;\n componentMap?: FormKitNodeVariantMap;\n }) {\n const nodeVariantMap: FormKitNodeVariantMap = {\n [VariantEnum.TEXT]: get(\n defaultMap,\n [VariantEnum.TEXT],\n formKitBaseNodeVariantMap.TEXT,\n ),\n };\n\n return (\n <QuestionNodeRenderer\n questionNode={questionNode}\n componentMap={nodeVariantMap}\n />\n );\n };\n}\n","import type { Question } from '@kurocado-studio/formkit-ui-models';\nimport { get } from 'lodash-es';\nimport React from 'react';\n\nimport { FormKitInputTextField } from '../controls';\n\nexport function BaseFormKitInputTextFieldNode(properties: {\n question: Question;\n}): React.ReactNode {\n const { question, variant, variants, description } = properties.question;\n const name = get(variants, [variant, 'id'], 'unknown');\n const required = get(variants, [variant, 'required'], false);\n\n return (\n <FormKitInputTextField\n required={required}\n name={name}\n label={question}\n description={description}\n />\n );\n}\n","import { BaseFormKitInputTextFieldNode } from '../components/nodes';\nimport { VariantEnum } from '../enums';\nimport { FormKitNodeVariantMap } from '../types';\n\nexport const formKitBaseNodeVariantMap: FormKitNodeVariantMap = {\n [VariantEnum.TEXT]: BaseFormKitInputTextFieldNode,\n};\n","import { get } from 'lodash-es';\nimport React from 'react';\n\nimport { FormKitNodeVariantMap, Question } from '../types';\n\nfunction DefaultFallback({ node }: { node: Question }) {\n return (\n <div style={{ color: 'gray', fontStyle: 'italic' }}>\n Unsupported node type: {node.variant}\n </div>\n );\n}\n\nexport function QuestionNodeRenderer({\n questionNode,\n componentMap,\n}: {\n questionNode: Question;\n componentMap: FormKitNodeVariantMap;\n}) {\n const Component = get(componentMap, [questionNode.variant], DefaultFallback);\n return <Component node={questionNode} question={questionNode} />;\n}\n","import { get } from 'lodash-es';\nimport React from 'react';\n\nimport { FormKitConsumerFormProperties, Question } from '../types';\nimport { FormKitForm } from './controls';\nimport { useGetFormKitFormById } from './hooks/useGetFormKitFormById';\n\nexport function FormKitConsumerForm<T extends Record<string, unknown>>({\n children,\n organizationId,\n formId,\n ...properties\n}: FormKitConsumerFormProperties<T>): React.ReactNode {\n const [{ isLoading, data, error, resetState }, handleGetForm] =\n useGetFormKitFormById();\n\n React.useEffect(() => {\n if (!isLoading && data === undefined && error === undefined) {\n handleGetForm({ organizationId, formId }).then();\n }\n return () => resetState();\n }, [organizationId, formId]);\n\n return (\n <FormKitForm<T> {...properties}>\n {get(data, ['sections', 0, 'questions'], []).map(\n (question: Question, index: number): React.ReactNode =>\n children({ question, indexInCollection: index }),\n )}\n </FormKitForm>\n );\n}\n","import { useAxios } from '@kurocado-studio/axios-react';\nimport { get } from 'lodash-es';\nimport React from 'react';\n\nimport { EMPTY_FORM_NODE } from '../../constants';\nimport { Form, GetFormByIdHandler, UseGetFormKitFormById } from '../../types';\nimport { createFormKitClient } from '../api/createFormKitClient';\n\nexport const useGetFormKitFormById: UseGetFormKitFormById = (payload) => {\n const axiosInstance = React.useMemo(\n () => get(payload, ['axiosInstance'], createFormKitClient()),\n [payload?.axiosInstance],\n );\n\n const [getFormByIdState, getFormByIdHandler] = useAxios<Form>({\n axiosInstance,\n });\n\n const handleGetFormById: GetFormByIdHandler = async ({\n organizationId,\n formId,\n }) => {\n try {\n const form = await getFormByIdHandler({\n url: `/api/v1/organizations/${organizationId}/forms/${formId}`,\n method: 'GET',\n });\n get(payload, ['onSuccessCallBack'], () => {})({ form });\n return form;\n } catch (error) {\n const fallbackEmptyForm = EMPTY_FORM_NODE;\n get(payload, ['onErrorCallBack'], () => {})({ error, fallbackEmptyForm });\n return fallbackEmptyForm;\n }\n };\n\n return [getFormByIdState, handleGetFormById];\n};\n","import { VariantEnum } from './enums';\nimport { Form, Question, Section } from './types';\n\nexport const FORMKIT_DEMO_FORM_ID = '2305e7ed-b583-4ef7-9a4c-2bc094b34894';\nexport const FORMKIT_DEMO_LONG_FORM_ID = '2305e7ed-b583-4ef7-9a4c-2bc094b34894';\nexport const FORMKIT_LOGIN_FORM_ID = '5139da7c-5fc2-4140-8041-6caff89990b5';\nexport const FORMKIT_DEMO_SECTION_ID = '821efcf2-cc16-4fa3-9ae9-b467738e2c4a';\nexport const FORMKIT_DEMO_LONG_SECTION_ID =\n '821efcf2-cc16-4fa3-9ae9-b467738e2c4a';\n\nconst createdAt = new Date().toISOString();\nconst updatedAt = new Date().toISOString();\n\nexport const EMPTY_FORM_NODE: Form = {\n createdAt,\n description: '',\n id: '',\n sections: [],\n updatedAt,\n title: '',\n};\n\nexport const EMPTY_SECTION_NODE: Section = {\n createdAt,\n description: 'No description provided',\n id: '',\n order: 0,\n questions: [],\n title: '',\n updatedAt,\n};\n\nexport const EMPTY_QUESTION_NODE: Question = {\n hidden: false,\n id: '',\n question: 'No name provided',\n description: 'No description provided',\n required: false,\n variant: VariantEnum.TEXT,\n variants: {},\n};\n","import axios, { type AxiosInstance } from 'axios';\n\nexport interface FormKitClientOptions {\n baseURL?: string;\n timeout?: number;\n headers?: Record<string, string>;\n}\n\nexport function createFormKitClient(\n options: FormKitClientOptions = {},\n): AxiosInstance {\n const {\n baseURL = 'https://html-forms-service-staging.fly.dev',\n timeout = 9000,\n headers = {},\n } = options;\n\n return axios.create({\n baseURL,\n timeout,\n headers: {\n 'Content-Type': 'application/json',\n ...headers,\n },\n });\n}\n\nexport const axiosFormKitInstance = createFormKitClient();\n","import {\n type Form,\n type FormsNodeTree,\n InputFieldTypeEnum,\n type Question,\n type Section,\n type SectionNodeTree,\n VariantEnum,\n} from '@kurocado-studio/formkit-ui-models';\n\nexport const sampledQuestion1: Question = {\n id: '391a5218-2a40-4652-895b-683e2e25dd96',\n question: 'What’s the name of your form or project?',\n description: 'Who is this description for?',\n hidden: false,\n required: false,\n variant: VariantEnum.TEXT,\n variants: {\n TEXT: {\n id: '10ae5f58-6de4-4aef-999e-d7b9df78056b',\n name: 'unknown',\n type: InputFieldTypeEnum.TEXT,\n required: false,\n },\n },\n name: '4c9107e4-2a29-4460-ab77-648974e2634f',\n};\n\nexport const sampledQuestion2: Question = {\n id: 'c2bb388c-e187-440b-b4d7-092c0be49c6f',\n question: 'Who is this form for?',\n description: 'Who is this description for?',\n hidden: false,\n required: false,\n variant: VariantEnum.TEXT,\n variants: {\n TEXT: {\n id: '01e3f9d0-d4c7-43f4-aa48-2987edcdafea',\n name: 'unknown',\n type: InputFieldTypeEnum.TEXT,\n required: false,\n },\n },\n name: 'e28e40c9-6821-43d7-a018-c81cf3a29dd6',\n};\n\nexport const sampledSection: Section = {\n id: '821efcf2-cc16-4fa3-9ae9-b467738e2c4a',\n title: 'Section 1',\n description: 'This is a section',\n order: 0,\n createdAt: '2025-11-11T16:05:23.351Z',\n updatedAt: '2025-11-11T16:05:23.351Z',\n questions: [sampledQuestion1, sampledQuestion2],\n};\n\nexport const sampledSectionNodeTree: SectionNodeTree = {\n ...sampledSection,\n questions: {\n [sampledQuestion1.id]: sampledQuestion1,\n [sampledQuestion2.id]: sampledQuestion2,\n },\n};\n\nexport const sampledForm: Form = {\n id: '2305e7ed-b583-4ef7-9a4c-2bc094b34894',\n title: 'Welcome to FormKit',\n description:\n 'This short demo introduces how FormKit lets you design and (soon) embed forms dynamically. You can edit any title, description, or question — just click and edit!',\n createdAt: '2025-11-11T16:05:23.351Z',\n updatedAt: '2025-11-11T16:05:23.351Z',\n sections: [sampledSection],\n};\n\nexport const sampledFormsNodeTree: FormsNodeTree = {\n [sampledForm.id]: {\n ...sampledForm,\n sections: {\n [sampledSection.id]: sampledSectionNodeTree,\n },\n },\n};\n"],"mappings":"AAAO,IAAKA,OACVA,EAAA,KAAO,OADGA,OAAA,IAGAC,OACVA,EAAA,KAAO,OACPA,EAAA,MAAQ,QACRA,EAAA,SAAW,WAHDA,OAAA,IAMAC,OACVA,EAAA,KAAO,OACPA,EAAA,QAAU,UACVA,EAAA,QAAU,UACVA,EAAA,MAAQ,QACRA,EAAA,IAAM,MACNA,EAAA,IAAM,MACNA,EAAA,OAAS,SAPCA,OAAA,IAUAC,OACVA,EAAA,KAAO,OACPA,EAAA,UAAY,YACZA,EAAA,MAAQ,QACRA,EAAA,WAAa,aAJHA,OAAA,ICVZ,WAAc,mCCTd,OAAS,oBAAAC,MAAwB,mCACjC,OAAOC,MAAW,QAEX,SAASC,EACdC,EAKiB,CACjB,GAAM,CAAE,WAAAC,EAAY,WAAAC,EAAY,iBAAAC,EAAkB,kBAAAC,CAAkB,EAClEP,EAAiBG,CAAU,EAE7B,OACEF,EAAA,cAAAA,EAAA,cACEA,EAAA,cAAC,SAAO,GAAGG,EAAY,EACvBH,EAAA,cAAC,SAAO,GAA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S,EAAIP,EAAM,CAAC,WAAY,EAAG,WAAW,EAAG,CAAC,CAAC,EAAE,IAC3C,CAACQ,EAAoBC,IACnBd,EAAS,CAAE,SAAAa,EAAU,kBAAmBC,CAAM,CAAC,CACnD,CACF,CAEJ,CI/BA,OAGE,sBAAAC,EAIA,eAAAC,MACK,qCAEA,IAAMC,EAA6B,CACxC,GAAI,uCACJ,SAAU,gDACV,YAAa,+BACb,OAAQ,GACR,SAAU,GACV,QAASD,EAAY,KACrB,SAAU,CACR,KAAM,CACJ,GAAI,uCACJ,KAAM,UACN,KAAMD,EAAmB,KACzB,SAAU,EACZ,CACF,EACA,KAAM,sCACR,EAEaG,EAA6B,CACxC,GAAI,uCACJ,SAAU,wBACV,YAAa,+BACb,OAAQ,GACR,SAAU,GACV,QAASF,EAAY,KACrB,SAAU,CACR,KAAM,CACJ,GAAI,uCACJ,KAAM,UACN,KAAMD,EAAmB,KACzB,SAAU,EACZ,CACF,EACA,KAAM,sCACR,EAEaI,EAA0B,CACrC,GAAI,uCACJ,MAAO,YACP,YAAa,oBACb,MAAO,EACP,UAAW,2BACX,UAAW,2BACX,UAAW,CAACF,EAAkBC,CAAgB,CAChD,EAEaE,EAA0C,CACrD,GAAGD,EACH,UAAW,CACT,CAACF,EAAiB,EAAE,EAAGA,EACvB,CAACC,EAAiB,EAAE,EAAGA,CACzB,CACF,EAEaG,EAAoB,CAC/B,GAAI,uCACJ,MAAO,qBACP,YACE,0KACF,UAAW,2BACX,UAAW,2BACX,SAAU,CAACF,CAAc,CAC3B,EAEaG,GAAsC,CACjD,CAACD,EAAY,EAAE,EAAG,CAChB,GAAGA,EACH,SAAU,CACR,CAACF,EAAe,EAAE,EAAGC,CACvB,CACF,CACF","names":["VariantEnum","InputFieldTypeEnum","InputFieldInputModeEnum","InputFieldAutocapitalizeEnum","useAriaTextField","React","FormKitInputTextField","properties","labelProps","inputProps","descriptionProps","errorMessageProps","HtmlForm","React","FormKitForm","properties","useAriaTextArea","React","FormKitInputTextArea","properties","labelProps","textAreaProps","descriptionProps","errorMessageProps","get","React","get","React","BaseFormKitInputTextFieldNode","properties","question","variant","variants","description","name","get","required","React","FormKitInputTextField","formKitBaseNodeVariantMap","BaseFormKitInputTextFieldNode","get","React","DefaultFallback","node","QuestionNodeRenderer","questionNode","componentMap","Component","formRendererComposer","defaultMap","questionNode","nodeVariantMap","get","formKitBaseNodeVariantMap","React","QuestionNodeRenderer","get","React","useAxios","get","React","FORMKIT_DEMO_FORM_ID","FORMKIT_DEMO_LONG_FORM_ID","FORMKIT_LOGIN_FORM_ID","FORMKIT_DEMO_SECTION_ID","FORMKIT_DEMO_LONG_SECTION_ID","createdAt","updatedAt","EMPTY_FORM_NODE","EMPTY_SECTION_NODE","EMPTY_QUESTION_NODE","axios","createFormKitClient","options","baseURL","timeout","headers","axiosFormKitInstance","useGetFormKitFormById","payload","axiosInstance","React","get","createFormKitClient","getFormByIdState","getFormByIdHandler","useAxios","organizationId","formId","form","error","fallbackEmptyForm","EMPTY_FORM_NODE","FormKitConsumerForm","children","organizationId","formId","properties","isLoading","data","error","resetState","handleGetForm","useGetFormKitFormById","React","FormKitForm","get","question","index","InputFieldTypeEnum","VariantEnum","sampledQuestion1","sampledQuestion2","sampledSection","sampledSectionNodeTree","sampledForm","sampledFormsNodeTree"]}
package/dist/index.d.ts CHANGED
@@ -3,10 +3,14 @@ import { AxiosState } from '@kurocado-studio/axios-react';
3
3
  import { HtmlFormProperties } from '@kurocado-studio/web-forms-react';
4
4
  import { default as React_2 } from 'react';
5
5
 
6
+ export declare const axiosFormKitInstance: AxiosInstance;
7
+
6
8
  export declare function BaseFormKitInputTextFieldNode(properties: {
7
9
  question: Question_2;
8
10
  }): React_2.ReactNode;
9
11
 
12
+ export declare function createFormKitClient(options?: FormKitClientOptions): AxiosInstance;
13
+
10
14
  export declare const EMPTY_FORM_NODE: Form;
11
15
 
12
16
  export declare const EMPTY_QUESTION_NODE: Question;
@@ -43,6 +47,14 @@ export declare const FORMKIT_LOGIN_FORM_ID = "5139da7c-5fc2-4140-8041-6caff89990
43
47
 
44
48
  export declare const formKitBaseNodeVariantMap: FormKitNodeVariantMap;
45
49
 
50
+ export declare interface FormKitClientOptions {
51
+ baseURL?: string;
52
+ timeout?: number;
53
+ headers?: Record<string, string>;
54
+ }
55
+
56
+ export declare function FormKitConsumerForm<T extends Record<string, unknown>>({ children, organizationId, formId, ...properties }: FormKitConsumerFormProperties<T>): React_2.ReactNode;
57
+
46
58
  export declare interface FormKitConsumerFormProperties<T extends Record<string, unknown> = Record<string, unknown>> extends Omit<FormKitFormProperties<T>, 'children'> {
47
59
  organizationId: string;
48
60
  formId: string;
@@ -176,6 +188,11 @@ export declare interface QuestionCreatorPayload<T extends VariantEnum = VariantE
176
188
  variant: VariantCreatorDto<T>;
177
189
  }
178
190
 
191
+ export declare function QuestionNodeRenderer({ questionNode, componentMap, }: {
192
+ questionNode: Question;
193
+ componentMap: FormKitNodeVariantMap;
194
+ }): React_2.JSX.Element;
195
+
179
196
  export declare const sampledForm: Form_2;
180
197
 
181
198
  export declare const sampledFormsNodeTree: FormsNodeTree;
@@ -268,6 +285,8 @@ formKitFormByIdState: AxiosState<Form>,
268
285
  handleGetFormById: GetFormByIdHandler
269
286
  ];
270
287
 
288
+ export declare const useGetFormKitFormById: UseGetFormKitFormById;
289
+
271
290
  export declare interface VariantCreatorDto<T extends VariantEnum = VariantEnum.TEXT> {
272
291
  variantPayload: Record<string, unknown>;
273
292
  variantType: T;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kurocado-studio/formkit-ui-react-renderer",
3
- "version": "1.0.0-develop.5",
3
+ "version": "1.0.0-develop.7",
4
4
  "sideEffects": false,
5
5
  "keywords": [],
6
6
  "author": "@kurocado-studio",