@kurocado-studio/formkit-ui-react-renderer 1.0.0 → 1.0.1

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 x=(r=>(r.TEXT="TEXT",r))(x||{}),F=(o=>(o.TEXT="text",o.EMAIL="email",o.PASSWORD="password",o))(F||{}),N=(n=>(n.TEXT="text",n.NUMERIC="numeric",n.DECIMAL="decimal",n.EMAIL="email",n.TEL="tel",n.URL="url",n.SEARCH="search",n))(N||{}),E=(i=>(i.NONE="none",i.SENTENCES="sentences",i.WORDS="words",i.CHARACTERS="characters",i))(E||{});export*from"@kurocado-studio/web-forms-react";import{useAriaTextField as k}from"@kurocado-studio/web-forms-react";import m from"react";function b(e){let{labelProps:r,inputProps:t,descriptionProps:o,errorMessageProps:i}=k(e);return m.createElement(m.Fragment,null,m.createElement("label",{...r}),m.createElement("input",{...t}),m.createElement("p",{className:"block w-full",...o}),m.createElement("span",{className:"block w-full text-red-700",...i}))}import{HtmlForm as w}from"@kurocado-studio/web-forms-react";import B from"react";function K(e){return B.createElement(w,{...e})}import{useAriaTextArea as V}from"@kurocado-studio/web-forms-react";import d from"react";function me(e){let{labelProps:r,textAreaProps:t,descriptionProps:o,errorMessageProps:i}=V(e);return d.createElement(d.Fragment,null,d.createElement("label",{...r}),d.createElement("textarea",{...t}),d.createElement("p",{className:"block w-full",...o}),d.createElement("span",{className:"block w-full text-red-700",...i}))}import{get as H}from"lodash-es";import U from"react";import{get as M}from"lodash-es";import X from"react";function g(e){let{question:r,variant:t,variants:o,description:i}=e.question,s=M(o,[t,"id"],"unknown"),a=M(o,[t,"required"],!1);return X.createElement(b,{required:a,name:s,label:r,description:i})}var y={TEXT:g};import{get as G}from"lodash-es";import O from"react";function L({node:e}){return O.createElement("div",{style:{color:"gray",fontStyle:"italic"}},"Unsupported node type: ",e.variant)}function R({questionNode:e,componentMap:r}){let t=G(r,[e.variant],L);return O.createElement(t,{node:e,question:e})}function ge(e){return function({questionNode:t}){let o={TEXT:H(e,["TEXT"],y.TEXT)};return U.createElement(R,{questionNode:t,componentMap:o})}}import{get as j}from"lodash-es";import _ from"react";import{useAxios as Y}from"@kurocado-studio/axios-react";import{get as f}from"lodash-es";import Z from"react";var Oe="2305e7ed-b583-4ef7-9a4c-2bc094b34894",Re="2305e7ed-b583-4ef7-9a4c-2bc094b34894",he="5139da7c-5fc2-4140-8041-6caff89990b5",Se="821efcf2-cc16-4fa3-9ae9-b467738e2c4a",qe="821efcf2-cc16-4fa3-9ae9-b467738e2c4a",h=new Date().toISOString(),S=new Date().toISOString(),q={createdAt:h,description:"",id:"",sections:[],updatedAt:S,title:""},Ie={createdAt:h,description:"No description provided",id:"",order:0,questions:[],title:"",updatedAt:S},_e={hidden:!1,id:"",question:"No name provided",description:"No description provided",required:!1,variant:"TEXT",variants:{}};import W from"axios";function c(e={}){let{baseURL:r="https://html-forms-service-staging.fly.dev",timeout:t=9e3,headers:o={}}=e;return W.create({baseURL:r,timeout:t,headers:{"Content-Type":"application/json",...o}})}var Pe=c();var I=e=>{let r=Z.useMemo(()=>f(e,["axiosInstance"],c()),[e?.axiosInstance]),[t,o]=Y({axiosInstance:r});return[t,async({organizationId:s,formId:a})=>{try{let n=await o({url:`/api/v1/organizations/${s}/forms/${a}`,method:"GET"});return f(e,["onSuccessCallBack"],()=>{})({form:n}),n}catch(n){let p=q;return f(e,["onErrorCallBack"],()=>{})({error:n,fallbackEmptyForm:p}),p}}]};function Ue({children:e,organizationId:r,formId:t,...o}){let[{isLoading:i,data:s,error:a,resetState:n},p]=I();return _.useEffect(()=>(!i&&s===void 0&&a===void 0&&p({organizationId:r,formId:t}).then(),()=>n()),[r,t]),_.createElement(K,{...o},j(s,["sections",0,"questions"],[]).map((v,D)=>e({question:v,indexInCollection:D})))}import{useAriaTextField as $}from"@kurocado-studio/web-forms-react";import{get as C}from"lodash-es";var je=e=>{let{question:r,variant:t,variants:o,description:i}=e.question,s=C(o,[t,"id"],"unknown"),a=C(o,[t,"required"],!1);return $({label:r,description:i,name:s,required:a})};import{InputFieldTypeEnum as P,VariantEnum as Q}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:Q.TEXT,variants:{TEXT:{id:"10ae5f58-6de4-4aef-999e-d7b9df78056b",name:"unknown",type:P.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:Q.TEXT,variants:{TEXT:{id:"01e3f9d0-d4c7-43f4-aa48-2987edcdafea",name:"unknown",type:P.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}},A={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]},ze={[A.id]:{...A,sections:{[T.id]:J}}};export{g as BaseFormKitInputTextFieldNode,q as EMPTY_FORM_NODE,_e as EMPTY_QUESTION_NODE,Ie as EMPTY_SECTION_NODE,Oe as FORMKIT_DEMO_FORM_ID,Re as FORMKIT_DEMO_LONG_FORM_ID,qe as FORMKIT_DEMO_LONG_SECTION_ID,Se as FORMKIT_DEMO_SECTION_ID,he as FORMKIT_LOGIN_FORM_ID,Ue as FormKitConsumerForm,K as FormKitForm,me as FormKitInputTextArea,b as FormKitInputTextField,E as InputFieldAutocapitalizeEnum,N as InputFieldInputModeEnum,F as InputFieldTypeEnum,R as QuestionNodeRenderer,x as VariantEnum,Pe as axiosFormKitInstance,c as createFormKitClient,y as formKitBaseNodeVariantMap,ge as formRendererComposer,A as sampledForm,ze as sampledFormsNodeTree,u as sampledQuestion1,l as sampledQuestion2,T as sampledSection,J as sampledSectionNodeTree,je as useFormKitTextNode,I as useGetFormKitFormById};
1
+ var x=(r=>(r.TEXT="TEXT",r))(x||{}),F=(o=>(o.TEXT="text",o.EMAIL="email",o.PASSWORD="password",o))(F||{}),N=(n=>(n.TEXT="text",n.NUMERIC="numeric",n.DECIMAL="decimal",n.EMAIL="email",n.TEL="tel",n.URL="url",n.SEARCH="search",n))(N||{}),E=(i=>(i.NONE="none",i.SENTENCES="sentences",i.WORDS="words",i.CHARACTERS="characters",i))(E||{});export*from"@kurocado-studio/web-forms-react";import{useAriaTextField as D}from"@kurocado-studio/web-forms-react";import m from"react";function b(e){let{labelProps:r,inputProps:t,descriptionProps:o,errorMessageProps:i}=D(e);return m.createElement(m.Fragment,null,m.createElement("label",{...r}),m.createElement("input",{...t}),m.createElement("p",{className:"block w-full",...o}),m.createElement("span",{className:"block w-full text-red-700",...i}))}import{HtmlForm as w}from"@kurocado-studio/web-forms-react";import B from"react";function K(e){return B.createElement(w,{...e})}import{useAriaTextArea as V}from"@kurocado-studio/web-forms-react";import d from"react";function me(e){let{labelProps:r,textAreaProps:t,descriptionProps:o,errorMessageProps:i}=V(e);return d.createElement(d.Fragment,null,d.createElement("label",{...r}),d.createElement("textarea",{...t}),d.createElement("p",{className:"block w-full",...o}),d.createElement("span",{className:"block w-full text-red-700",...i}))}import{get as H}from"lodash-es";import U from"react";import{get as M}from"lodash-es";import X from"react";function y(e){let{question:r,variant:t,variants:o,description:i}=e.question,s=M(o,[t,"id"],"unknown"),a=M(o,[t,"required"],!1);return X.createElement(b,{required:a,name:s,label:r,description:i})}var O={TEXT:y};import{get as G}from"lodash-es";import g from"react";function L({node:e}){return g.createElement("div",{style:{color:"gray",fontStyle:"italic"}},"Unsupported node type: ",e.variant)}function R({questionNode:e,componentMap:r}){let t=G(r,[e.variant],L);return g.createElement(t,{node:e,question:e})}function ye(e){return function({questionNode:t}){let o={TEXT:H(e,["TEXT"],O.TEXT)};return U.createElement(R,{questionNode:t,componentMap:o})}}import{get as j}from"lodash-es";import _ from"react";import{useAxios as Y}from"@kurocado-studio/axios-react";import{get as f}from"lodash-es";import Z from"react";var ge="2305e7ed-b583-4ef7-9a4c-2bc094b34894",Re="2305e7ed-b583-4ef7-9a4c-2bc094b34894",he="5139da7c-5fc2-4140-8041-6caff89990b5",Se="821efcf2-cc16-4fa3-9ae9-b467738e2c4a",qe="821efcf2-cc16-4fa3-9ae9-b467738e2c4a",h=new Date().toISOString(),S=new Date().toISOString(),q={createdAt:h,description:"",id:"",sections:[],updatedAt:S,title:""},Ie={createdAt:h,description:"No description provided",id:"",order:0,questions:[],title:"",updatedAt:S},_e={hidden:!1,id:"",question:"No name provided",description:"No description provided",required:!1,variant:"TEXT",variants:{}};import W from"axios";function c(e={}){let{baseURL:r="https://formkit.fly.dev",timeout:t=9e3,headers:o={}}=e;return W.create({baseURL:r,timeout:t,headers:{"Content-Type":"application/json",...o}})}var Pe=c();var I=e=>{let r=Z.useMemo(()=>f(e,["axiosInstance"],c()),[e?.axiosInstance]),[t,o]=Y({axiosInstance:r});return[t,async({organizationId:s,formId:a})=>{try{let n=await o({url:`/api/v1/organizations/${s}/forms/${a}`,method:"GET"});return f(e,["onSuccessCallBack"],()=>{})({form:n}),n}catch(n){let p=q;return f(e,["onErrorCallBack"],()=>{})({error:n,fallbackEmptyForm:p}),p}}]};function Ue({children:e,organizationId:r,formId:t,...o}){let[{isLoading:i,data:s,error:a,resetState:n},p]=I();return _.useEffect(()=>(!i&&s===void 0&&a===void 0&&p({organizationId:r,formId:t}).then(),()=>n()),[r,t]),_.createElement(K,{...o},j(s,["sections",0,"questions"],[]).map((k,v)=>e({question:k,indexInCollection:v})))}import{useAriaTextField as $}from"@kurocado-studio/web-forms-react";import{get as C}from"lodash-es";var je=e=>{let{question:r,variant:t,variants:o,description:i}=e.question,s=C(o,[t,"id"],"unknown"),a=C(o,[t,"required"],!1);return $({label:r,description:i,name:s,required:a})};import{InputFieldTypeEnum as P,VariantEnum as Q}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:Q.TEXT,variants:{TEXT:{id:"10ae5f58-6de4-4aef-999e-d7b9df78056b",name:"unknown",type:P.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:Q.TEXT,variants:{TEXT:{id:"01e3f9d0-d4c7-43f4-aa48-2987edcdafea",name:"unknown",type:P.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}},A={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]},ze={[A.id]:{...A,sections:{[T.id]:J}}};export{y as BaseFormKitInputTextFieldNode,q as EMPTY_FORM_NODE,_e as EMPTY_QUESTION_NODE,Ie as EMPTY_SECTION_NODE,ge as FORMKIT_DEMO_FORM_ID,Re as FORMKIT_DEMO_LONG_FORM_ID,qe as FORMKIT_DEMO_LONG_SECTION_ID,Se as FORMKIT_DEMO_SECTION_ID,he as FORMKIT_LOGIN_FORM_ID,Ue as FormKitConsumerForm,K as FormKitForm,me as FormKitInputTextArea,b as FormKitInputTextField,E as InputFieldAutocapitalizeEnum,N as InputFieldInputModeEnum,F as InputFieldTypeEnum,R as QuestionNodeRenderer,x as VariantEnum,Pe as axiosFormKitInstance,c as createFormKitClient,O as formKitBaseNodeVariantMap,ye as formRendererComposer,A as sampledForm,ze as sampledFormsNodeTree,u as sampledQuestion1,l as sampledQuestion2,T as sampledSection,J as sampledSectionNodeTree,je as useFormKitTextNode,I 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/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/components/hooks/useFormKitTextNode.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/hooks/useFormKitTextNode';\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 TextFieldApi,\n type TextFieldProperties,\n useAriaTextField,\n} from '@kurocado-studio/web-forms-react';\nimport { get } from 'lodash-es';\n\nimport { Question } from '../../types';\n\nexport const useFormKitTextNode = (payload: {\n question: Question;\n}): TextFieldApi => {\n const { question, variant, variants, description } = payload.question;\n const name = get(variants, [variant, 'id'], 'unknown');\n const required = get(variants, [variant, 'required'], false);\n\n const ariaTextFieldConfig: TextFieldProperties = {\n label: question,\n description,\n name,\n required,\n };\n\n return useAriaTextField(ariaTextFieldConfig);\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,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AC,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","useAriaTextField","get","useFormKitTextNode","payload","question","variant","variants","description","name","required","InputFieldTypeEnum","VariantEnum","sampledQuestion1","sampledQuestion2","sampledSection","sampledSectionNodeTree","sampledForm","sampledFormsNodeTree"]}
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/components/hooks/useFormKitTextNode.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/hooks/useFormKitTextNode';\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://formkit.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 TextFieldApi,\n type TextFieldProperties,\n useAriaTextField,\n} from '@kurocado-studio/web-forms-react';\nimport { get } from 'lodash-es';\n\nimport { Question } from '../../types';\n\nexport const useFormKitTextNode = (payload: {\n question: Question;\n}): TextFieldApi => {\n const { question, variant, variants, description } = payload.question;\n const name = get(variants, [variant, 'id'], 'unknown');\n const required = get(variants, [variant, 'required'], false);\n\n const ariaTextFieldConfig: TextFieldProperties = {\n label: question,\n description,\n name,\n required,\n };\n\n return useAriaTextField(ariaTextFieldConfig);\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"],"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,cAAC,KAAE,UAAU,eAAgB,GAAGK,EAAkB,EAClDL,EAAA,cAAC,QAAK,UAAU,4BAA6B,GAAGM,EAAmB,CACrE,CAEJ,CCrBA,OAAS,YAAAC,MAAgB,mCACzB,OAAOC,MAAW,QAIX,SAASC,EACdC,EACiB,CACjB,OAAOF,EAAA,cAACD,EAAA,CAAa,GAAGG,EAAY,CACtC,CCTA,OAAS,mBAAAC,MAAuB,mCACh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AU,YAAAC,CAAY,EAAIJ,EAAQ,SACvDK,EAAOP,EAAIK,EAAU,CAACD,EAAS,IAAI,EAAG,SAAS,EAC/CI,EAAWR,EAAIK,EAAU,CAACD,EAAS,UAAU,EAAG,EAAK,EAS3D,OAAOL,EAP0C,CAC/C,MAAOI,EACP,YAAAG,EACA,KAAAC,EACA,SAAAC,CACF,CAE2C,CAC7C,ECxBA,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","useAriaTextField","get","useFormKitTextNode","payload","question","variant","variants","description","name","required","InputFieldTypeEnum","VariantEnum","sampledQuestion1","sampledQuestion2","sampledSection","sampledSectionNodeTree","sampledForm","sampledFormsNodeTree"]}
@@ -5,7 +5,7 @@
5
5
  "toolPackages": [
6
6
  {
7
7
  "packageName": "@microsoft/api-extractor",
8
- "packageVersion": "7.55.0"
8
+ "packageVersion": "7.55.1"
9
9
  }
10
10
  ]
11
11
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kurocado-studio/formkit-ui-react-renderer",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "sideEffects": false,
5
5
  "keywords": [],
6
6
  "author": "@kurocado-studio",