@tsed/react-formio 3.0.0-alpha.11 → 3.0.0-alpha.12
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/atoms/icon/Icon.js.map +1 -1
- package/dist/chunks/index.js +33 -30
- package/dist/chunks/index.js.map +1 -1
- package/dist/chunks/index.module.js +16 -16
- package/dist/chunks/index.module.js.map +1 -1
- package/dist/chunks/react-select-animated.esm.js +1204 -1101
- package/dist/chunks/react-select-animated.esm.js.map +1 -1
- package/dist/hooks/keyboard.constants.js.map +1 -1
- package/dist/hooks/useKeyboardControls.js.map +1 -1
- package/dist/hooks/useTooltip.js.map +1 -1
- package/dist/molecules/alert/Alert.js.map +1 -1
- package/dist/molecules/button/Button.js +17 -20
- package/dist/molecules/button/Button.js.map +1 -1
- package/dist/molecules/card/Card.js.map +1 -1
- package/dist/molecules/forms/form-control/FormControl.js.map +1 -1
- package/dist/molecules/forms/input-tags/InputTags.js.map +1 -1
- package/dist/molecules/forms/input-tags/components/ChoicesTags.js +26 -26
- package/dist/molecules/forms/input-tags/components/ChoicesTags.js.map +1 -1
- package/dist/molecules/forms/input-tags/components/ReactTags.js +289 -300
- package/dist/molecules/forms/input-tags/components/ReactTags.js.map +1 -1
- package/dist/molecules/forms/input-text/InputText.js +3 -3
- package/dist/molecules/forms/input-text/InputText.js.map +1 -1
- package/dist/molecules/forms/select/Select.js.map +1 -1
- package/dist/molecules/forms/select/components/ChoicesSelect.js +71 -73
- package/dist/molecules/forms/select/components/ChoicesSelect.js.map +1 -1
- package/dist/molecules/forms/select/components/HtmlSelect.js.map +1 -1
- package/dist/molecules/forms/select/components/ReactSelect.js +13 -14
- package/dist/molecules/forms/select/components/ReactSelect.js.map +1 -1
- package/dist/molecules/forms/select/components/choices.template.js +2340 -2257
- package/dist/molecules/forms/select/components/choices.template.js.map +1 -1
- package/dist/molecules/forms/select/hooks/useOptions.js.map +1 -1
- package/dist/molecules/loader/Loader.js.map +1 -1
- package/dist/molecules/modal/Modal.js +23 -24
- package/dist/molecules/modal/Modal.js.map +1 -1
- package/dist/molecules/pagination/Pagination.js +19 -19
- package/dist/molecules/pagination/Pagination.js.map +1 -1
- package/dist/molecules/pagination/PaginationButton.js.map +1 -1
- package/dist/molecules/pagination/utils/getPageNumbers.js.map +1 -1
- package/dist/molecules/table/Table.js +29 -35
- package/dist/molecules/table/Table.js.map +1 -1
- package/dist/molecules/table/components/DefaultArrowSort.js.map +1 -1
- package/dist/molecules/table/components/DefaultCell.js.map +1 -1
- package/dist/molecules/table/components/DefaultCellFooter.js.map +1 -1
- package/dist/molecules/table/components/DefaultCellHeader.js.map +1 -1
- package/dist/molecules/table/components/DefaultCellOperations.js +10 -10
- package/dist/molecules/table/components/DefaultCellOperations.js.map +1 -1
- package/dist/molecules/table/components/DefaultFilter.js.map +1 -1
- package/dist/molecules/table/components/DefaultOperationButton.js +1 -1
- package/dist/molecules/table/components/DefaultOperationButton.js.map +1 -1
- package/dist/molecules/table/filters/RangeFilter.js +23 -24
- package/dist/molecules/table/filters/RangeFilter.js.map +1 -1
- package/dist/molecules/table/filters/SelectFilter.js +11 -13
- package/dist/molecules/table/filters/SelectFilter.js.map +1 -1
- package/dist/molecules/table/filters/TextFieldFilter.js.map +1 -1
- package/dist/molecules/table/hooks/useTable.js +7 -7
- package/dist/molecules/table/hooks/useTable.js.map +1 -1
- package/dist/molecules/table/hooks/useUniqValues.js.map +1 -1
- package/dist/molecules/table/utils/mapFormToColumns.js +20 -21
- package/dist/molecules/table/utils/mapFormToColumns.js.map +1 -1
- package/dist/molecules/tabs/Tab.js +36 -37
- package/dist/molecules/tabs/Tab.js.map +1 -1
- package/dist/molecules/tabs/TabList.js +9 -10
- package/dist/molecules/tabs/TabList.js.map +1 -1
- package/dist/molecules/tabs/TabPanel.js.map +1 -1
- package/dist/molecules/tabs/Tabs.js.map +1 -1
- package/dist/molecules/tabs/TabsBody.js.map +1 -1
- package/dist/molecules/tabs/TabsLegacy.js.map +1 -1
- package/dist/molecules/tabs/context/TabControl.js.map +1 -1
- package/dist/molecules/tabs/hooks/tabControl.js.map +1 -1
- package/dist/organisms/form/Form.js.map +1 -1
- package/dist/organisms/form/access/FormAccess.js +41 -41
- package/dist/organisms/form/access/FormAccess.js.map +1 -1
- package/dist/organisms/form/access/FormAccess.schema.js.map +1 -1
- package/dist/organisms/form/access/FormAccess.utils.js +2 -2
- package/dist/organisms/form/access/FormAccess.utils.js.map +1 -1
- package/dist/organisms/form/actions/FormAction.js +7 -8
- package/dist/organisms/form/actions/FormAction.js.map +1 -1
- package/dist/organisms/form/builder/FormBuilder.js.map +1 -1
- package/dist/organisms/form/builder/FormEdit.js.map +1 -1
- package/dist/organisms/form/builder/FormEdit.reducer.js.map +1 -1
- package/dist/organisms/form/builder/FormEditCtas.js +34 -34
- package/dist/organisms/form/builder/FormEditCtas.js.map +1 -1
- package/dist/organisms/form/builder/FormParameters.js.map +1 -1
- package/dist/organisms/form/builder/useFormBuilder.js +41 -38
- package/dist/organisms/form/builder/useFormBuilder.js.map +1 -1
- package/dist/organisms/form/builder/useFormEdit.js +17 -17
- package/dist/organisms/form/builder/useFormEdit.js.map +1 -1
- package/dist/organisms/form/exports/FormExport.js +29 -29
- package/dist/organisms/form/exports/FormExport.js.map +1 -1
- package/dist/organisms/form/preview/FormPreview.js.map +1 -1
- package/dist/organisms/form/settings/FormSettings.js +24 -24
- package/dist/organisms/form/settings/FormSettings.js.map +1 -1
- package/dist/organisms/form/settings/FormSettings.schema.js.map +1 -1
- package/dist/organisms/form/settings/FormSettings.utils.js.map +1 -1
- package/dist/organisms/form/useForm.js +664 -661
- package/dist/organisms/form/useForm.js.map +1 -1
- package/dist/organisms/modal/RemoveModal.js +16 -17
- package/dist/organisms/modal/RemoveModal.js.map +1 -1
- package/dist/organisms/table/actions/ActionsTable.js.map +1 -1
- package/dist/organisms/table/forms/FormsTable.js.map +1 -1
- package/dist/organisms/table/forms/components/FormsCell.js.map +1 -1
- package/dist/organisms/table/submissions/SubmissionsTable.js.map +1 -1
- package/dist/organisms/views/FormViews.js.map +1 -1
- package/dist/registries/components.js.map +1 -1
- package/dist/utils/getEventValue.js.map +1 -1
- package/dist/utils/iconClass.js.map +1 -1
- package/dist/utils/mapPagination.js.map +1 -1
- package/dist/utils/stopPropagationWrapper.js.map +1 -1
- package/package.json +7 -7
- package/src/atoms/icon/Icon.stories.tsx +1 -1
- package/src/molecules/button/Button.stories.tsx +1 -1
- package/src/molecules/forms/form-control/FormControl.stories.tsx +1 -1
- package/src/molecules/forms/input-tags/components/ChoicesTags.stories.tsx +1 -1
- package/src/molecules/forms/input-tags/components/ReactTags.stories.tsx +1 -1
- package/src/molecules/forms/input-text/InputText.stories.tsx +2 -2
- package/src/molecules/forms/select/components/ChoicesSelect.stories.tsx +2 -2
- package/src/molecules/forms/select/components/HtmlSelect.stories.tsx +2 -2
- package/src/molecules/forms/select/components/ReactSelect.stories.tsx +2 -2
- package/src/molecules/loader/Loader.stories.tsx +1 -1
- package/src/molecules/modal/Modal.stories.tsx +1 -1
- package/src/molecules/pagination/Pagination.stories.tsx +1 -1
- package/src/molecules/pagination/Pagination.tsx +0 -1
- package/src/molecules/table/Table.stories.tsx +2 -2
- package/src/molecules/table/filters/SelectFilter.tsx +1 -1
- package/src/molecules/tabs/Tabs.stories.tsx +2 -2
- package/src/molecules/tabs/TabsLegacy.stories.tsx +1 -1
- package/src/organisms/form/Form.stories.tsx +94 -118
- package/src/organisms/form/access/FormAccess.stories.tsx +2 -2
- package/src/organisms/form/actions/FormAction.stories.tsx +1 -1
- package/src/organisms/form/builder/FormBuilder.stories.tsx +4 -1
- package/src/organisms/form/builder/FormEdit.stories.tsx +1 -1
- package/src/organisms/form/builder/useFormBuilder.ts +5 -1
- package/src/organisms/form/exports/FormExport.stories.tsx +1 -1
- package/src/organisms/form/preview/FormPreview.stories.tsx +1 -1
- package/src/organisms/modal/RemoveModal.stories.tsx +1 -1
- package/src/organisms/table/actions/ActionsTable.stories.tsx +2 -2
- package/src/organisms/table/submissions/SubmissionsTable.stories.tsx +1 -1
- package/src/organisms/views/FormViews.stories.tsx +1 -1
- package/vite.config.mts +2 -2
- package/tsconfig.app.json +0 -11
- package/tsconfig.json +0 -21
- package/tsconfig.node.json +0 -13
- package/tsconfig.spec.json +0 -14
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"keyboard.constants.js","sources":["../../src/hooks/keyboard.constants.ts"],"sourcesContent":["export const enum CODE {\n ENTER = \"Enter\",\n ESCAPE = \"Escape\",\n ARROW_LEFT = \"ArrowLeft\",\n ARROW_UP = \"ArrowUp\",\n ARROW_RIGHT = \"ArrowRight\",\n ARROW_DOWN = \"ArrowDown\",\n SPACE = \"Space\",\n END = \"End\",\n HOME = \"Home\"\n}\n\nexport const enum KEY {\n ENTER = \"Enter\",\n ESCAPE = \"Escape\",\n ARROW_LEFT = \"ArrowLeft\",\n ARROW_UP = \"ArrowUp\",\n ARROW_RIGHT = \"ArrowRight\",\n ARROW_DOWN = \"ArrowDown\",\n END = \"End\",\n HOME = \"Home\",\n SPACE = \" \",\n /**\n * @deprecated\n * Used by old browers, see https://developer.mozilla.org/en-US/docs/Web/API/UI_Events/Keyboard_event_key_values#whitespace_keys\n */\n SPACEBAR = \"Spacebar\"\n}\n\nexport const enum KEY_CODE {\n ENTER = 13,\n ESCAPE = 27,\n ARROW_LEFT = 37,\n ARROW_UP = 38,\n ARROW_RIGHT = 39,\n ARROW_DOWN = 40,\n SPACE = 32,\n END = 35,\n HOME = 36\n}\n"],"names":["CODE","KEY","KEY_CODE"],"mappings":"
|
|
1
|
+
{"version":3,"file":"keyboard.constants.js","sources":["../../src/hooks/keyboard.constants.ts"],"sourcesContent":["export const enum CODE {\n ENTER = \"Enter\",\n ESCAPE = \"Escape\",\n ARROW_LEFT = \"ArrowLeft\",\n ARROW_UP = \"ArrowUp\",\n ARROW_RIGHT = \"ArrowRight\",\n ARROW_DOWN = \"ArrowDown\",\n SPACE = \"Space\",\n END = \"End\",\n HOME = \"Home\"\n}\n\nexport const enum KEY {\n ENTER = \"Enter\",\n ESCAPE = \"Escape\",\n ARROW_LEFT = \"ArrowLeft\",\n ARROW_UP = \"ArrowUp\",\n ARROW_RIGHT = \"ArrowRight\",\n ARROW_DOWN = \"ArrowDown\",\n END = \"End\",\n HOME = \"Home\",\n SPACE = \" \",\n /**\n * @deprecated\n * Used by old browers, see https://developer.mozilla.org/en-US/docs/Web/API/UI_Events/Keyboard_event_key_values#whitespace_keys\n */\n SPACEBAR = \"Spacebar\"\n}\n\nexport const enum KEY_CODE {\n ENTER = 13,\n ESCAPE = 27,\n ARROW_LEFT = 37,\n ARROW_UP = 38,\n ARROW_RIGHT = 39,\n ARROW_DOWN = 40,\n SPACE = 32,\n END = 35,\n HOME = 36\n}\n"],"names":["CODE","KEY","KEY_CODE"],"mappings":"AAAO,IAAWA,sBAAAA,OAChBA,EAAA,QAAQ,SACRA,EAAA,SAAS,UACTA,EAAA,aAAa,aACbA,EAAA,WAAW,WACXA,EAAA,cAAc,cACdA,EAAA,aAAa,aACbA,EAAA,QAAQ,SACRA,EAAA,MAAM,OACNA,EAAA,OAAO,QATSA,IAAAA,KAAA,CAAA,CAAA,GAYAC,sBAAAA,OAChBA,EAAA,QAAQ,SACRA,EAAA,SAAS,UACTA,EAAA,aAAa,aACbA,EAAA,WAAW,WACXA,EAAA,cAAc,cACdA,EAAA,aAAa,aACbA,EAAA,MAAM,OACNA,EAAA,OAAO,QACPA,EAAA,QAAQ,KAKRA,EAAA,WAAW,YAdKA,IAAAA,KAAA,CAAA,CAAA,GAiBAC,sBAAAA,OAChBA,EAAAA,EAAA,QAAQ,EAAA,IAAR,SACAA,EAAAA,EAAA,SAAS,EAAA,IAAT,UACAA,EAAAA,EAAA,aAAa,EAAA,IAAb,cACAA,EAAAA,EAAA,WAAW,EAAA,IAAX,YACAA,EAAAA,EAAA,cAAc,EAAA,IAAd,eACAA,EAAAA,EAAA,aAAa,EAAA,IAAb,cACAA,EAAAA,EAAA,QAAQ,EAAA,IAAR,SACAA,EAAAA,EAAA,MAAM,EAAA,IAAN,OACAA,EAAAA,EAAA,OAAO,EAAA,IAAP,QATgBA,IAAAA,KAAA,CAAA,CAAA;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useKeyboardControls.js","sources":["../../src/hooks/useKeyboardControls.ts"],"sourcesContent":["\"use client\";\n\nimport { type KeyboardEvent, useCallback } from \"react\";\n\nimport { CODE, KEY } from \"./keyboard.constants\";\n\ninterface Options {\n up?: VoidFunction;\n down?: VoidFunction;\n left?: VoidFunction;\n right?: VoidFunction;\n start?: VoidFunction;\n end?: VoidFunction;\n activate?: VoidFunction;\n}\n\nconst isActivateKey = (event: KeyboardEvent<HTMLDivElement | HTMLButtonElement>) => {\n return (\n event.key === KEY.ENTER ||\n event.key === KEY.SPACE ||\n event.key === KEY.SPACEBAR ||\n event.code === CODE.ENTER ||\n event.code === CODE.SPACE\n );\n};\n\nconst voidFn = () => {};\n\nexport const useKeyboardControls = ({\n up = voidFn,\n down = voidFn,\n left = voidFn,\n right = voidFn,\n start = voidFn,\n end = voidFn,\n activate = voidFn\n}: Options) => {\n const handleKeyDown = useCallback(\n (event: KeyboardEvent<HTMLDivElement | HTMLButtonElement>) => {\n if (isActivateKey(event)) {\n return activate();\n }\n\n if (event.code === CODE.HOME) {\n event.preventDefault();\n\n return start();\n }\n\n if (event.code === CODE.END) {\n event.preventDefault();\n\n return end();\n }\n\n if (event.code === CODE.ARROW_UP) {\n event.preventDefault();\n\n return up();\n }\n\n if (event.code === CODE.ARROW_DOWN) {\n event.preventDefault();\n\n return down();\n }\n\n if (event.code === CODE.ARROW_RIGHT) {\n event.preventDefault();\n\n return right();\n }\n\n if (event.code === CODE.ARROW_LEFT) {\n event.preventDefault();\n\n return left();\n }\n },\n [activate, down, end, left, right, start, up]\n );\n\n return handleKeyDown;\n};\n"],"names":["isActivateKey","event","KEY","CODE","voidFn","useKeyboardControls","up","down","left","right","start","end","activate","useCallback"],"mappings":";;;AAgBA,MAAMA,IAAgB,CAACC,MAEnBA,EAAM,QAAQC,EAAI,SAClBD,EAAM,QAAQC,EAAI,SAClBD,EAAM,QAAQC,EAAI,YAClBD,EAAM,SAASE,EAAK,SACpBF,EAAM,SAASE,EAAK,OAIlBC,IAAS,MAAM;AAAC,GAETC,IAAsB,CAAC;AAAA,EAClC,IAAAC,IAAKF;AAAA,EACL,MAAAG,IAAOH;AAAA,EACP,MAAAI,IAAOJ;AAAA,EACP,OAAAK,IAAQL;AAAA,EACR,OAAAM,IAAQN;AAAA,EACR,KAAAO,IAAMP;AAAA,EACN,UAAAQ,IAAWR;AACb,MACwBS;AAAA,EACpB,CAACZ,MAA6D;
|
|
1
|
+
{"version":3,"file":"useKeyboardControls.js","sources":["../../src/hooks/useKeyboardControls.ts"],"sourcesContent":["\"use client\";\n\nimport { type KeyboardEvent, useCallback } from \"react\";\n\nimport { CODE, KEY } from \"./keyboard.constants\";\n\ninterface Options {\n up?: VoidFunction;\n down?: VoidFunction;\n left?: VoidFunction;\n right?: VoidFunction;\n start?: VoidFunction;\n end?: VoidFunction;\n activate?: VoidFunction;\n}\n\nconst isActivateKey = (event: KeyboardEvent<HTMLDivElement | HTMLButtonElement>) => {\n return (\n event.key === KEY.ENTER ||\n event.key === KEY.SPACE ||\n event.key === KEY.SPACEBAR ||\n event.code === CODE.ENTER ||\n event.code === CODE.SPACE\n );\n};\n\nconst voidFn = () => {};\n\nexport const useKeyboardControls = ({\n up = voidFn,\n down = voidFn,\n left = voidFn,\n right = voidFn,\n start = voidFn,\n end = voidFn,\n activate = voidFn\n}: Options) => {\n const handleKeyDown = useCallback(\n (event: KeyboardEvent<HTMLDivElement | HTMLButtonElement>) => {\n if (isActivateKey(event)) {\n return activate();\n }\n\n if (event.code === CODE.HOME) {\n event.preventDefault();\n\n return start();\n }\n\n if (event.code === CODE.END) {\n event.preventDefault();\n\n return end();\n }\n\n if (event.code === CODE.ARROW_UP) {\n event.preventDefault();\n\n return up();\n }\n\n if (event.code === CODE.ARROW_DOWN) {\n event.preventDefault();\n\n return down();\n }\n\n if (event.code === CODE.ARROW_RIGHT) {\n event.preventDefault();\n\n return right();\n }\n\n if (event.code === CODE.ARROW_LEFT) {\n event.preventDefault();\n\n return left();\n }\n },\n [activate, down, end, left, right, start, up]\n );\n\n return handleKeyDown;\n};\n"],"names":["isActivateKey","event","KEY","CODE","voidFn","useKeyboardControls","up","down","left","right","start","end","activate","useCallback"],"mappings":";;;AAgBA,MAAMA,IAAgB,CAACC,MAEnBA,EAAM,QAAQC,EAAI,SAClBD,EAAM,QAAQC,EAAI,SAClBD,EAAM,QAAQC,EAAI,YAClBD,EAAM,SAASE,EAAK,SACpBF,EAAM,SAASE,EAAK,OAIlBC,IAAS,MAAM;AAAC,GAETC,IAAsB,CAAC;AAAA,EAClC,IAAAC,IAAKF;AAAA,EACL,MAAAG,IAAOH;AAAA,EACP,MAAAI,IAAOJ;AAAA,EACP,OAAAK,IAAQL;AAAA,EACR,OAAAM,IAAQN;AAAA,EACR,KAAAO,IAAMP;AAAA,EACN,UAAAQ,IAAWR;AACb,MACwBS;AAAA,EACpB,CAACZ,MAA6D;AAC5D,QAAID,EAAcC,CAAK;AACrB,aAAOW,EAAA;AAGT,QAAIX,EAAM,SAASE,EAAK;AACtB,aAAAF,EAAM,eAAA,GAECS,EAAA;AAGT,QAAIT,EAAM,SAASE,EAAK;AACtB,aAAAF,EAAM,eAAA,GAECU,EAAA;AAGT,QAAIV,EAAM,SAASE,EAAK;AACtB,aAAAF,EAAM,eAAA,GAECK,EAAA;AAGT,QAAIL,EAAM,SAASE,EAAK;AACtB,aAAAF,EAAM,eAAA,GAECM,EAAA;AAGT,QAAIN,EAAM,SAASE,EAAK;AACtB,aAAAF,EAAM,eAAA,GAECQ,EAAA;AAGT,QAAIR,EAAM,SAASE,EAAK;AACtB,aAAAF,EAAM,eAAA,GAECO,EAAA;AAAA,EAEX;AAAA,EACA,CAACI,GAAUL,GAAMI,GAAKH,GAAMC,GAAOC,GAAOJ,CAAE;AAAA;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useTooltip.js","sources":["../../src/hooks/useTooltip.ts"],"sourcesContent":["import { useEffect, useRef } from \"react\";\nimport Tooltip, { Options } from \"tooltip.js\";\n\nexport function useTooltip(options: Options) {\n const ref = useRef<any>();\n\n useEffect(() => {\n ref.current && new Tooltip(ref.current as any, options);\n }, [ref, options]);\n\n return ref;\n}\n"],"names":["useTooltip","options","ref","useRef","useEffect","Tooltip"],"mappings":";;AAGO,SAASA,EAAWC,GAAkB;AAC3C,QAAMC,IAAMC,
|
|
1
|
+
{"version":3,"file":"useTooltip.js","sources":["../../src/hooks/useTooltip.ts"],"sourcesContent":["import { useEffect, useRef } from \"react\";\nimport Tooltip, { Options } from \"tooltip.js\";\n\nexport function useTooltip(options: Options) {\n const ref = useRef<any>();\n\n useEffect(() => {\n ref.current && new Tooltip(ref.current as any, options);\n }, [ref, options]);\n\n return ref;\n}\n"],"names":["useTooltip","options","ref","useRef","useEffect","Tooltip"],"mappings":";;AAGO,SAASA,EAAWC,GAAkB;AAC3C,QAAMC,IAAMC,EAAA;AAEZ,SAAAC,EAAU,MAAM;AACd,IAAAF,EAAI,WAAW,IAAIG,EAAQH,EAAI,SAAgBD,CAAO;AAAA,EACxD,GAAG,CAACC,GAAKD,CAAO,CAAC,GAEVC;AACT;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Alert.js","sources":["../../../src/molecules/alert/Alert.tsx"],"sourcesContent":["import { PropsWithChildren } from \"react\";\n\nfunction formatError(error: any): any {\n if (!error || (Array.isArray(error) && !error.length)) {\n return \"\";\n }\n\n if (typeof error === \"string\") {\n return error;\n }\n\n if (Array.isArray(error)) {\n return error.map(formatError);\n }\n\n if (Object.prototype.hasOwnProperty.call(error, \"errors\")) {\n return Object.keys(error.errors).map((key, index) => {\n const item = error.errors[key];\n return (\n <div key={index}>\n <strong>\n {item.name} ({item.path})\n </strong>{\" \"}\n - {item.message}\n </div>\n );\n });\n }\n\n // If this is a standard error.\n if (Object.prototype.hasOwnProperty.call(error, \"message\")) {\n return error.message;\n }\n\n // If this is a joy validation error.\n if (Object.prototype.hasOwnProperty.call(error, \"name\") && error.name === \"ValidationError\") {\n return error.details.map((item: any, index: number) => {\n return <div key={index}>{item.message}</div>;\n });\n }\n\n // If a conflict error occurs on a form, the form is returned.\n if (Object.prototype.hasOwnProperty.call(error, \"_id\") && Object.prototype.hasOwnProperty.call(error, \"display\")) {\n return \"Another user has saved this form already. Please reload and re-apply your changes.\";\n }\n\n return \"An error occurred. See console logs for details.\";\n}\n\nexport interface AlertProps {\n message?: string | any | string[];\n type?: string;\n}\n\nexport function Alert({ children, message, type = \"danger\" }: PropsWithChildren<AlertProps>) {\n return (\n <div className={`alert alert-${type}`} role='alert'>\n {formatError(message)}\n {children}\n </div>\n );\n}\n"],"names":["formatError","error","key","index","item","jsxs","jsx","Alert","children","message","type"],"mappings":";AAEA,SAASA,EAAYC,GAAiB;
|
|
1
|
+
{"version":3,"file":"Alert.js","sources":["../../../src/molecules/alert/Alert.tsx"],"sourcesContent":["import { PropsWithChildren } from \"react\";\n\nfunction formatError(error: any): any {\n if (!error || (Array.isArray(error) && !error.length)) {\n return \"\";\n }\n\n if (typeof error === \"string\") {\n return error;\n }\n\n if (Array.isArray(error)) {\n return error.map(formatError);\n }\n\n if (Object.prototype.hasOwnProperty.call(error, \"errors\")) {\n return Object.keys(error.errors).map((key, index) => {\n const item = error.errors[key];\n return (\n <div key={index}>\n <strong>\n {item.name} ({item.path})\n </strong>{\" \"}\n - {item.message}\n </div>\n );\n });\n }\n\n // If this is a standard error.\n if (Object.prototype.hasOwnProperty.call(error, \"message\")) {\n return error.message;\n }\n\n // If this is a joy validation error.\n if (Object.prototype.hasOwnProperty.call(error, \"name\") && error.name === \"ValidationError\") {\n return error.details.map((item: any, index: number) => {\n return <div key={index}>{item.message}</div>;\n });\n }\n\n // If a conflict error occurs on a form, the form is returned.\n if (Object.prototype.hasOwnProperty.call(error, \"_id\") && Object.prototype.hasOwnProperty.call(error, \"display\")) {\n return \"Another user has saved this form already. Please reload and re-apply your changes.\";\n }\n\n return \"An error occurred. See console logs for details.\";\n}\n\nexport interface AlertProps {\n message?: string | any | string[];\n type?: string;\n}\n\nexport function Alert({ children, message, type = \"danger\" }: PropsWithChildren<AlertProps>) {\n return (\n <div className={`alert alert-${type}`} role='alert'>\n {formatError(message)}\n {children}\n </div>\n );\n}\n"],"names":["formatError","error","key","index","item","jsxs","jsx","Alert","children","message","type"],"mappings":";AAEA,SAASA,EAAYC,GAAiB;AACpC,SAAI,CAACA,KAAU,MAAM,QAAQA,CAAK,KAAK,CAACA,EAAM,SACrC,KAGL,OAAOA,KAAU,WACZA,IAGL,MAAM,QAAQA,CAAK,IACdA,EAAM,IAAID,CAAW,IAG1B,OAAO,UAAU,eAAe,KAAKC,GAAO,QAAQ,IAC/C,OAAO,KAAKA,EAAM,MAAM,EAAE,IAAI,CAACC,GAAKC,MAAU;AACnD,UAAMC,IAAOH,EAAM,OAAOC,CAAG;AAC7B,6BACG,OAAA,EACC,UAAA;AAAA,MAAA,gBAAAG,EAAC,UAAA,EACE,UAAA;AAAA,QAAAD,EAAK;AAAA,QAAK;AAAA,QAAGA,EAAK;AAAA,QAAK;AAAA,MAAA,GAC1B;AAAA,MAAU;AAAA,MAAI;AAAA,MACXA,EAAK;AAAA,IAAA,EAAA,GAJAD,CAKV;AAAA,EAEJ,CAAC,IAIC,OAAO,UAAU,eAAe,KAAKF,GAAO,SAAS,IAChDA,EAAM,UAIX,OAAO,UAAU,eAAe,KAAKA,GAAO,MAAM,KAAKA,EAAM,SAAS,oBACjEA,EAAM,QAAQ,IAAI,CAACG,GAAWD,MAC5B,gBAAAG,EAAC,OAAA,EAAiB,UAAAF,EAAK,QAAA,GAAbD,CAAqB,CACvC,IAIC,OAAO,UAAU,eAAe,KAAKF,GAAO,KAAK,KAAK,OAAO,UAAU,eAAe,KAAKA,GAAO,SAAS,IACtG,uFAGF;AACT;AAOO,SAASM,EAAM,EAAE,UAAAC,GAAU,SAAAC,GAAS,MAAAC,IAAO,YAA2C;AAC3F,2BACG,OAAA,EAAI,WAAW,eAAeA,CAAI,IAAI,MAAK,SACzC,UAAA;AAAA,IAAAV,EAAYS,CAAO;AAAA,IACnBD;AAAA,EAAA,GACH;AAEJ;"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { c } from "../../chunks/index.js";
|
|
3
|
-
import { forwardRef as
|
|
4
|
-
import { registerComponent as
|
|
5
|
-
const
|
|
1
|
+
import { jsx as d } from "react/jsx-runtime";
|
|
2
|
+
import { c as s } from "../../chunks/index.js";
|
|
3
|
+
import { forwardRef as u } from "react";
|
|
4
|
+
import { registerComponent as c } from "../../registries/components.js";
|
|
5
|
+
const k = [
|
|
6
6
|
"primary",
|
|
7
7
|
"secondary",
|
|
8
8
|
"success",
|
|
@@ -21,31 +21,28 @@ const y = [
|
|
|
21
21
|
"outline-light",
|
|
22
22
|
"outline-dark",
|
|
23
23
|
"outline-link"
|
|
24
|
-
],
|
|
25
|
-
|
|
24
|
+
], i = u(({ tag: t = "button", variant: e, className: o, children: a, ...n }, l) => /* @__PURE__ */ d(
|
|
25
|
+
t,
|
|
26
26
|
{
|
|
27
27
|
...n,
|
|
28
|
-
ref:
|
|
29
|
-
className:
|
|
28
|
+
ref: l,
|
|
29
|
+
className: s(
|
|
30
30
|
"btn flex gap-1",
|
|
31
31
|
{
|
|
32
32
|
disabled: n.disabled
|
|
33
33
|
},
|
|
34
|
-
`btn-${
|
|
35
|
-
|
|
34
|
+
`btn-${e}`,
|
|
35
|
+
o
|
|
36
36
|
),
|
|
37
37
|
disabled: n.disabled,
|
|
38
|
-
onClick: (
|
|
39
|
-
|
|
40
|
-
return !n.disabled && ((i = n.onClick) == null ? void 0 : i.call(n, d));
|
|
41
|
-
},
|
|
42
|
-
children: l
|
|
38
|
+
onClick: (r) => !n.disabled && n.onClick?.(r),
|
|
39
|
+
children: a
|
|
43
40
|
}
|
|
44
41
|
));
|
|
45
|
-
|
|
46
|
-
|
|
42
|
+
i.displayName = "Button";
|
|
43
|
+
c("Button", i);
|
|
47
44
|
export {
|
|
48
|
-
|
|
49
|
-
|
|
45
|
+
k as BUTTON_VARIANTS,
|
|
46
|
+
i as Button
|
|
50
47
|
};
|
|
51
48
|
//# sourceMappingURL=Button.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.js","sources":["../../../src/molecules/button/Button.tsx"],"sourcesContent":["import cx from \"classnames\";\nimport { type ButtonHTMLAttributes, forwardRef, type PropsWithChildren } from \"react\";\n\nimport { registerComponent } from \"../../registries/components\";\n\nexport const BUTTON_VARIANTS = [\n \"primary\",\n \"secondary\",\n \"success\",\n \"danger\",\n \"warning\",\n \"info\",\n \"light\",\n \"dark\",\n \"link\",\n \"outline-primary\",\n \"outline-secondary\",\n \"outline-success\",\n \"outline-danger\",\n \"outline-warning\",\n \"outline-info\",\n \"outline-light\",\n \"outline-dark\",\n \"outline-link\"\n];\n\ninterface BaseButtonProps<T extends HTMLElement> extends ButtonHTMLAttributes<T> {\n tag?: \"button\" | \"a\" | \"input\" | \"div\";\n variant?: (typeof BUTTON_VARIANTS)[keyof typeof BUTTON_VARIANTS] | string;\n}\n\ninterface HTMLAnchorProps extends BaseButtonProps<HTMLAnchorElement> {\n tag: \"a\";\n}\n\ninterface HTMLButtonProps extends BaseButtonProps<HTMLButtonElement> {\n tag?: \"button\";\n}\n\ninterface HTMLInputProps extends BaseButtonProps<HTMLInputElement> {\n tag: \"input\";\n}\n\ninterface HTMLDivProps extends BaseButtonProps<HTMLDivElement> {\n tag: \"div\";\n}\n\nexport type ButtonProps = HTMLAnchorProps | HTMLButtonProps | HTMLInputProps | HTMLDivProps;\n\nexport const Button = forwardRef(({ tag: Tag = \"button\", variant, className, children, ...props }: PropsWithChildren<ButtonProps>, ref) => {\n return (\n <Tag\n {...(props as any)}\n ref={ref as any}\n className={cx(\n \"btn flex gap-1\",\n {\n disabled: props.disabled\n },\n `btn-${variant}`,\n className\n )}\n disabled={props.disabled}\n onClick={(evt) => !props.disabled && props.onClick?.(evt as any)}\n >\n {children}\n </Tag>\n );\n});\n\nButton.displayName = \"Button\";\n\nregisterComponent(\"Button\", Button);\n"],"names":["BUTTON_VARIANTS","Button","forwardRef","Tag","variant","className","children","props","ref","jsx","cx","evt","
|
|
1
|
+
{"version":3,"file":"Button.js","sources":["../../../src/molecules/button/Button.tsx"],"sourcesContent":["import cx from \"classnames\";\nimport { type ButtonHTMLAttributes, forwardRef, type PropsWithChildren } from \"react\";\n\nimport { registerComponent } from \"../../registries/components\";\n\nexport const BUTTON_VARIANTS = [\n \"primary\",\n \"secondary\",\n \"success\",\n \"danger\",\n \"warning\",\n \"info\",\n \"light\",\n \"dark\",\n \"link\",\n \"outline-primary\",\n \"outline-secondary\",\n \"outline-success\",\n \"outline-danger\",\n \"outline-warning\",\n \"outline-info\",\n \"outline-light\",\n \"outline-dark\",\n \"outline-link\"\n];\n\ninterface BaseButtonProps<T extends HTMLElement> extends ButtonHTMLAttributes<T> {\n tag?: \"button\" | \"a\" | \"input\" | \"div\";\n variant?: (typeof BUTTON_VARIANTS)[keyof typeof BUTTON_VARIANTS] | string;\n}\n\ninterface HTMLAnchorProps extends BaseButtonProps<HTMLAnchorElement> {\n tag: \"a\";\n}\n\ninterface HTMLButtonProps extends BaseButtonProps<HTMLButtonElement> {\n tag?: \"button\";\n}\n\ninterface HTMLInputProps extends BaseButtonProps<HTMLInputElement> {\n tag: \"input\";\n}\n\ninterface HTMLDivProps extends BaseButtonProps<HTMLDivElement> {\n tag: \"div\";\n}\n\nexport type ButtonProps = HTMLAnchorProps | HTMLButtonProps | HTMLInputProps | HTMLDivProps;\n\nexport const Button = forwardRef(({ tag: Tag = \"button\", variant, className, children, ...props }: PropsWithChildren<ButtonProps>, ref) => {\n return (\n <Tag\n {...(props as any)}\n ref={ref as any}\n className={cx(\n \"btn flex gap-1\",\n {\n disabled: props.disabled\n },\n `btn-${variant}`,\n className\n )}\n disabled={props.disabled}\n onClick={(evt) => !props.disabled && props.onClick?.(evt as any)}\n >\n {children}\n </Tag>\n );\n});\n\nButton.displayName = \"Button\";\n\nregisterComponent(\"Button\", Button);\n"],"names":["BUTTON_VARIANTS","Button","forwardRef","Tag","variant","className","children","props","ref","jsx","cx","evt","registerComponent"],"mappings":";;;;AAKO,MAAMA,IAAkB;AAAA,EAC7B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAyBaC,IAASC,EAAW,CAAC,EAAE,KAAKC,IAAM,UAAU,SAAAC,GAAS,WAAAC,GAAW,UAAAC,GAAU,GAAGC,EAAA,GAAyCC,MAE/H,gBAAAC;AAAA,EAACN;AAAA,EAAA;AAAA,IACE,GAAII;AAAA,IACL,KAAAC;AAAA,IACA,WAAWE;AAAA,MACT;AAAA,MACA;AAAA,QACE,UAAUH,EAAM;AAAA,MAAA;AAAA,MAElB,OAAOH,CAAO;AAAA,MACdC;AAAA,IAAA;AAAA,IAEF,UAAUE,EAAM;AAAA,IAChB,SAAS,CAACI,MAAQ,CAACJ,EAAM,YAAYA,EAAM,UAAUI,CAAU;AAAA,IAE9D,UAAAL;AAAA,EAAA;AAAA,CAGN;AAEDL,EAAO,cAAc;AAErBW,EAAkB,UAAUX,CAAM;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Card.js","sources":["../../../src/molecules/card/Card.tsx"],"sourcesContent":["import classnames from \"classnames\";\nimport { PropsWithChildren } from \"react\";\n\nimport { registerComponent } from \"../../registries/components.js\";\n\nexport interface CardProps {\n label: string;\n className?: string;\n}\n\nexport function Card({ children, label, className }: PropsWithChildren<CardProps>) {\n return (\n <div className={classnames(\"card\", className)}>\n <div className={\"card-header \"}>\n <h4 className={\"card-title\"}>{label}</h4>\n </div>\n <div className={\"card-body\"} role={\"article\"}>\n {children}\n </div>\n </div>\n );\n}\n\nregisterComponent(\"Card\", Card);\n"],"names":["Card","children","label","className","classnames","jsx","registerComponent"],"mappings":";;;AAUO,SAASA,EAAK,EAAE,UAAAC,GAAU,OAAAC,GAAO,WAAAC,KAA2C;AACjF,2BACG,
|
|
1
|
+
{"version":3,"file":"Card.js","sources":["../../../src/molecules/card/Card.tsx"],"sourcesContent":["import classnames from \"classnames\";\nimport { PropsWithChildren } from \"react\";\n\nimport { registerComponent } from \"../../registries/components.js\";\n\nexport interface CardProps {\n label: string;\n className?: string;\n}\n\nexport function Card({ children, label, className }: PropsWithChildren<CardProps>) {\n return (\n <div className={classnames(\"card\", className)}>\n <div className={\"card-header \"}>\n <h4 className={\"card-title\"}>{label}</h4>\n </div>\n <div className={\"card-body\"} role={\"article\"}>\n {children}\n </div>\n </div>\n );\n}\n\nregisterComponent(\"Card\", Card);\n"],"names":["Card","children","label","className","classnames","jsx","registerComponent"],"mappings":";;;AAUO,SAASA,EAAK,EAAE,UAAAC,GAAU,OAAAC,GAAO,WAAAC,KAA2C;AACjF,2BACG,OAAA,EAAI,WAAWC,EAAW,QAAQD,CAAS,GAC1C,UAAA;AAAA,IAAA,gBAAAE,EAAC,OAAA,EAAI,WAAW,gBACd,UAAA,gBAAAA,EAAC,QAAG,WAAW,cAAe,aAAM,EAAA,CACtC;AAAA,sBACC,OAAA,EAAI,WAAW,aAAa,MAAM,WAChC,UAAAJ,EAAA,CACH;AAAA,EAAA,GACF;AAEJ;AAEAK,EAAkB,QAAQN,CAAI;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormControl.js","sources":["../../../../src/molecules/forms/form-control/FormControl.tsx"],"sourcesContent":["import classnames from \"classnames\";\nimport omit from \"lodash/omit\";\nimport { HTMLAttributes, InputHTMLAttributes, PropsWithChildren, ReactNode } from \"react\";\n\nimport { registerComponent } from \"../../../registries/components\";\n\nexport type BaseFormControlProps<Value = unknown> = {\n label?: string;\n description?: string | ReactNode;\n before?: ReactNode | string;\n after?: ReactNode | string;\n shadow?: boolean;\n value?: Value;\n onChange?: (name: string | undefined, value: Value) => void;\n /**\n * The input size\n */\n size?: \"small\" | string;\n};\nexport type FormControlProps<\n Value = unknown,\n Attributes extends HTMLAttributes<HTMLElement> = InputHTMLAttributes<HTMLInputElement>\n> = BaseFormControlProps<Value> & Omit<Attributes, \"onChange\" | \"value\" | \"size\">;\n\nexport function cleanFormControlProps(props: FormControlProps, omitted: string[] = []): any {\n return omit(props, [\"label\", \"description\", \"prefix\", \"suffix\", \"size\", \"shadow\", ...omitted]);\n}\n\nexport function FormControl<Value = unknown>({\n children,\n name = \"\",\n id = name,\n required,\n before,\n after,\n description,\n label,\n size,\n className\n}: PropsWithChildren<FormControlProps<Value>>) {\n return (\n <div\n data-testid={name && `form-group-${name}`}\n id={`form-group-${name || \"\"}`}\n className={classnames(\n \"form-group\",\n {\n \"-with-before\": !!before,\n \"-with-after\": !!after\n },\n size && `-size-${size}`,\n className\n )}\n >\n {label && (\n <label htmlFor={id} data-testid='form-control-label' className={`col-form-label ${required ? \" field-required\" : \"\"}`}>\n {label}\n </label>\n )}\n <div className={\"input-group\"}>\n {before && (\n <div className='input-group-prepend'>\n <span className='input-group-text' data-testid='form-control-prefix'>\n {before}\n </span>\n </div>\n )}\n {children}\n {after && (\n <div className='input-group-append'>\n <span className='input-group-text' data-testid='form-control-suffix'>\n {after}\n </span>\n </div>\n )}\n </div>\n {description && (\n <div data-testid='form-control-description' className='form-text text-muted'>\n {description}\n </div>\n )}\n </div>\n );\n}\n\nregisterComponent(\"FormControl\", FormControl);\n"],"names":["cleanFormControlProps","props","omitted","omit","FormControl","children","name","id","required","before","after","description","label","size","className","jsxs","classnames","jsx","registerComponent"],"mappings":";;;;AAwBO,SAASA,EAAsBC,GAAyBC,IAAoB,IAAS;
|
|
1
|
+
{"version":3,"file":"FormControl.js","sources":["../../../../src/molecules/forms/form-control/FormControl.tsx"],"sourcesContent":["import classnames from \"classnames\";\nimport omit from \"lodash/omit\";\nimport { HTMLAttributes, InputHTMLAttributes, PropsWithChildren, ReactNode } from \"react\";\n\nimport { registerComponent } from \"../../../registries/components\";\n\nexport type BaseFormControlProps<Value = unknown> = {\n label?: string;\n description?: string | ReactNode;\n before?: ReactNode | string;\n after?: ReactNode | string;\n shadow?: boolean;\n value?: Value;\n onChange?: (name: string | undefined, value: Value) => void;\n /**\n * The input size\n */\n size?: \"small\" | string;\n};\nexport type FormControlProps<\n Value = unknown,\n Attributes extends HTMLAttributes<HTMLElement> = InputHTMLAttributes<HTMLInputElement>\n> = BaseFormControlProps<Value> & Omit<Attributes, \"onChange\" | \"value\" | \"size\">;\n\nexport function cleanFormControlProps(props: FormControlProps, omitted: string[] = []): any {\n return omit(props, [\"label\", \"description\", \"prefix\", \"suffix\", \"size\", \"shadow\", ...omitted]);\n}\n\nexport function FormControl<Value = unknown>({\n children,\n name = \"\",\n id = name,\n required,\n before,\n after,\n description,\n label,\n size,\n className\n}: PropsWithChildren<FormControlProps<Value>>) {\n return (\n <div\n data-testid={name && `form-group-${name}`}\n id={`form-group-${name || \"\"}`}\n className={classnames(\n \"form-group\",\n {\n \"-with-before\": !!before,\n \"-with-after\": !!after\n },\n size && `-size-${size}`,\n className\n )}\n >\n {label && (\n <label htmlFor={id} data-testid='form-control-label' className={`col-form-label ${required ? \" field-required\" : \"\"}`}>\n {label}\n </label>\n )}\n <div className={\"input-group\"}>\n {before && (\n <div className='input-group-prepend'>\n <span className='input-group-text' data-testid='form-control-prefix'>\n {before}\n </span>\n </div>\n )}\n {children}\n {after && (\n <div className='input-group-append'>\n <span className='input-group-text' data-testid='form-control-suffix'>\n {after}\n </span>\n </div>\n )}\n </div>\n {description && (\n <div data-testid='form-control-description' className='form-text text-muted'>\n {description}\n </div>\n )}\n </div>\n );\n}\n\nregisterComponent(\"FormControl\", FormControl);\n"],"names":["cleanFormControlProps","props","omitted","omit","FormControl","children","name","id","required","before","after","description","label","size","className","jsxs","classnames","jsx","registerComponent"],"mappings":";;;;AAwBO,SAASA,EAAsBC,GAAyBC,IAAoB,IAAS;AAC1F,SAAOC,EAAKF,GAAO,CAAC,SAAS,eAAe,UAAU,UAAU,QAAQ,UAAU,GAAGC,CAAO,CAAC;AAC/F;AAEO,SAASE,EAA6B;AAAA,EAC3C,UAAAC;AAAA,EACA,MAAAC,IAAO;AAAA,EACP,IAAAC,IAAKD;AAAA,EACL,UAAAE;AAAA,EACA,QAAAC;AAAA,EACA,OAAAC;AAAA,EACA,aAAAC;AAAA,EACA,OAAAC;AAAA,EACA,MAAAC;AAAA,EACA,WAAAC;AACF,GAA+C;AAC7C,SACE,gBAAAC;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,eAAaT,KAAQ,cAAcA,CAAI;AAAA,MACvC,IAAI,cAAcA,KAAQ,EAAE;AAAA,MAC5B,WAAWU;AAAAA,QACT;AAAA,QACA;AAAA,UACE,gBAAgB,CAAC,CAACP;AAAA,UAClB,eAAe,CAAC,CAACC;AAAA,QAAA;AAAA,QAEnBG,KAAQ,SAASA,CAAI;AAAA,QACrBC;AAAA,MAAA;AAAA,MAGD,UAAA;AAAA,QAAAF,KACC,gBAAAK,EAAC,SAAA,EAAM,SAASV,GAAI,eAAY,sBAAqB,WAAW,kBAAkBC,IAAW,oBAAoB,EAAE,IAChH,UAAAI,GACH;AAAA,QAEF,gBAAAG,EAAC,OAAA,EAAI,WAAW,eACb,UAAA;AAAA,UAAAN,KACC,gBAAAQ,EAAC,OAAA,EAAI,WAAU,uBACb,UAAA,gBAAAA,EAAC,QAAA,EAAK,WAAU,oBAAmB,eAAY,uBAC5C,UAAAR,EAAA,CACH,GACF;AAAA,UAEDJ;AAAA,UACAK,KACC,gBAAAO,EAAC,OAAA,EAAI,WAAU,sBACb,UAAA,gBAAAA,EAAC,QAAA,EAAK,WAAU,oBAAmB,eAAY,uBAC5C,UAAAP,EAAA,CACH,EAAA,CACF;AAAA,QAAA,GAEJ;AAAA,QACCC,KACC,gBAAAM,EAAC,OAAA,EAAI,eAAY,4BAA2B,WAAU,wBACnD,UAAAN,EAAA,CACH;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAIR;AAEAO,EAAkB,eAAed,CAAW;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InputTags.js","sources":["../../../../src/molecules/forms/input-tags/InputTags.tsx"],"sourcesContent":["import { ComponentType } from \"react\";\n\nimport { getComponent, registerComponent } from \"../../../registries/components\";\nimport { type FormControl as DefaultFormControl } from \"../form-control/FormControl\";\nimport type { InputTagsProps } from \"./InputTags.interface\";\n\nexport function InputTags<Data = string>(props: InputTagsProps) {\n const { name, id = name, label, required, description, before, after, size, className, layout = \"choicesjs\", ...otherProps } = props;\n\n const FormControl = getComponent<typeof DefaultFormControl>(\"FormControl\");\n const Component = getComponent<ComponentType<InputTagsProps<Data>>>([`InputTags.${layout}`, \"Input\"]);\n\n return (\n <FormControl\n id={id}\n name={name}\n label={label}\n required={required}\n description={description}\n before={before}\n after={after}\n size={size}\n className={className}\n >\n <Component {...(otherProps as any)} id={id} name={name} required={required} />\n </FormControl>\n );\n}\n\nregisterComponent(\"InputTags\", InputTags);\n"],"names":["InputTags","props","name","id","label","required","description","before","after","size","className","layout","otherProps","FormControl","getComponent","Component","jsx","registerComponent"],"mappings":";;AAMO,SAASA,EAAyBC,GAAuB;AAC9D,QAAM,EAAE,MAAAC,GAAM,IAAAC,IAAKD,GAAM,OAAAE,GAAO,UAAAC,GAAU,aAAAC,GAAa,QAAAC,GAAQ,OAAAC,GAAO,MAAAC,GAAM,WAAAC,GAAW,QAAAC,IAAS,aAAa,GAAGC,MAAeX,GAEzHY,IAAcC,EAAwC,aAAa,GACnEC,IAAYD,EAAkD,CAAC,aAAaH,CAAM,IAAI,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"InputTags.js","sources":["../../../../src/molecules/forms/input-tags/InputTags.tsx"],"sourcesContent":["import { ComponentType } from \"react\";\n\nimport { getComponent, registerComponent } from \"../../../registries/components\";\nimport { type FormControl as DefaultFormControl } from \"../form-control/FormControl\";\nimport type { InputTagsProps } from \"./InputTags.interface\";\n\nexport function InputTags<Data = string>(props: InputTagsProps) {\n const { name, id = name, label, required, description, before, after, size, className, layout = \"choicesjs\", ...otherProps } = props;\n\n const FormControl = getComponent<typeof DefaultFormControl>(\"FormControl\");\n const Component = getComponent<ComponentType<InputTagsProps<Data>>>([`InputTags.${layout}`, \"Input\"]);\n\n return (\n <FormControl\n id={id}\n name={name}\n label={label}\n required={required}\n description={description}\n before={before}\n after={after}\n size={size}\n className={className}\n >\n <Component {...(otherProps as any)} id={id} name={name} required={required} />\n </FormControl>\n );\n}\n\nregisterComponent(\"InputTags\", InputTags);\n"],"names":["InputTags","props","name","id","label","required","description","before","after","size","className","layout","otherProps","FormControl","getComponent","Component","jsx","registerComponent"],"mappings":";;AAMO,SAASA,EAAyBC,GAAuB;AAC9D,QAAM,EAAE,MAAAC,GAAM,IAAAC,IAAKD,GAAM,OAAAE,GAAO,UAAAC,GAAU,aAAAC,GAAa,QAAAC,GAAQ,OAAAC,GAAO,MAAAC,GAAM,WAAAC,GAAW,QAAAC,IAAS,aAAa,GAAGC,MAAeX,GAEzHY,IAAcC,EAAwC,aAAa,GACnEC,IAAYD,EAAkD,CAAC,aAAaH,CAAM,IAAI,OAAO,CAAC;AAEpG,SACE,gBAAAK;AAAA,IAACH;AAAA,IAAA;AAAA,MACC,IAAAV;AAAA,MACA,MAAAD;AAAA,MACA,OAAAE;AAAA,MACA,UAAAC;AAAA,MACA,aAAAC;AAAA,MACA,QAAAC;AAAA,MACA,OAAAC;AAAA,MACA,MAAAC;AAAA,MACA,WAAAC;AAAA,MAEA,4BAACK,GAAA,EAAW,GAAIH,GAAoB,IAAAT,GAAQ,MAAAD,GAAY,UAAAG,EAAA,CAAoB;AAAA,IAAA;AAAA,EAAA;AAGlF;AAEAY,EAAkB,aAAajB,CAAS;"}
|
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import
|
|
3
|
-
import { useRef as u, useEffect as
|
|
1
|
+
import { jsx as h } from "react/jsx-runtime";
|
|
2
|
+
import C from "@formio/choices.js";
|
|
3
|
+
import { useRef as u, useEffect as I } from "react";
|
|
4
4
|
import { c as l } from "../../../../chunks/index.module.js";
|
|
5
|
-
import { registerComponent as
|
|
6
|
-
import { cleanFormControlProps as
|
|
7
|
-
function
|
|
8
|
-
const { value:
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
}, 100), d = l((
|
|
12
|
-
const
|
|
13
|
-
|
|
5
|
+
import { registerComponent as g } from "../../../../registries/components.js";
|
|
6
|
+
import { cleanFormControlProps as E } from "../../form-control/FormControl.js";
|
|
7
|
+
function P(s) {
|
|
8
|
+
const { value: r, onChange: o, name: c = "", delimiter: m, customProperties: a, ...p } = s, i = u(null), n = u(null), f = l((e) => {
|
|
9
|
+
const t = (r || []).concat(e);
|
|
10
|
+
o?.(c, [...t]);
|
|
11
|
+
}, 100), d = l((e) => {
|
|
12
|
+
const t = (r || []).filter((v) => v !== e);
|
|
13
|
+
o?.(c, [...t]);
|
|
14
14
|
});
|
|
15
|
-
return
|
|
15
|
+
return I(() => {
|
|
16
16
|
if (i.current) {
|
|
17
|
-
const
|
|
17
|
+
const e = new C(i.current, {
|
|
18
18
|
duplicateItemsAllowed: !1,
|
|
19
19
|
...a,
|
|
20
20
|
delimiter: m,
|
|
21
21
|
editItems: !0,
|
|
22
22
|
removeItemButton: !0
|
|
23
23
|
});
|
|
24
|
-
|
|
25
|
-
f(
|
|
26
|
-
}),
|
|
27
|
-
d(
|
|
24
|
+
e.setValue(r || []), n.current = e, e.passedElement.element.addEventListener("addItem", (t) => {
|
|
25
|
+
f(t.detail.value);
|
|
26
|
+
}), e.passedElement.element.addEventListener("removeItem", (t) => {
|
|
27
|
+
d(t.detail.value);
|
|
28
28
|
});
|
|
29
29
|
}
|
|
30
30
|
return () => {
|
|
31
|
-
|
|
31
|
+
n.current && n.current.destroy();
|
|
32
32
|
};
|
|
33
33
|
}, [m]), {
|
|
34
34
|
otherProps: {
|
|
@@ -36,16 +36,16 @@ function T(n) {
|
|
|
36
36
|
name: c
|
|
37
37
|
},
|
|
38
38
|
ref: i,
|
|
39
|
-
instanceRef:
|
|
39
|
+
instanceRef: n
|
|
40
40
|
};
|
|
41
41
|
}
|
|
42
|
-
function
|
|
43
|
-
const { ref:
|
|
44
|
-
return /* @__PURE__ */
|
|
42
|
+
function x(s) {
|
|
43
|
+
const { ref: r, otherProps: o } = P(s);
|
|
44
|
+
return /* @__PURE__ */ h("input", { type: "text", ...E(o), ref: r });
|
|
45
45
|
}
|
|
46
|
-
|
|
46
|
+
g("InputTags.choicesjs", x);
|
|
47
47
|
export {
|
|
48
|
-
|
|
49
|
-
|
|
48
|
+
x as ChoicesTags,
|
|
49
|
+
P as useChoiceTags
|
|
50
50
|
};
|
|
51
51
|
//# sourceMappingURL=ChoicesTags.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChoicesTags.js","sources":["../../../../../src/molecules/forms/input-tags/components/ChoicesTags.tsx"],"sourcesContent":["import Choices from \"@formio/choices.js\";\nimport { useEffect, useRef } from \"react\";\nimport { useDebouncedCallback } from \"use-debounce\";\n\nimport { registerComponent } from \"../../../../registries/components\";\nimport { cleanFormControlProps } from \"../../form-control/FormControl\";\nimport type { InputTagsProps } from \"../InputTags.interface\";\n\nexport function useChoiceTags<Data = string>(props: InputTagsProps<Data>) {\n const { value, onChange, name = \"\", delimiter, customProperties, ...otherProps } = props;\n const ref = useRef<HTMLInputElement | null>(null);\n const instanceRef = useRef<Choices | null>(null);\n\n const onAdd = useDebouncedCallback((add: Data) => {\n const values = ((value || []) as Data[]).concat(add);\n\n onChange?.(name, [...values]);\n }, 100);\n\n const onDelete = useDebouncedCallback((remove: Data) => {\n const values = (value || []).filter((v) => v !== remove);\n\n onChange?.(name, [...values]);\n });\n\n useEffect(() => {\n if (ref.current) {\n const instance = new Choices(ref.current!, {\n duplicateItemsAllowed: false,\n ...customProperties,\n delimiter,\n editItems: true,\n removeItemButton: true\n });\n\n instance.setValue((value || []) as string[]);\n\n instanceRef.current = instance;\n\n instance.passedElement.element.addEventListener(\"addItem\", (event: { detail: { value: unknown } }) => {\n onAdd(event.detail.value as Data);\n });\n\n instance.passedElement.element.addEventListener(\"removeItem\", (event: { detail: { value: unknown } }) => {\n onDelete(event.detail.value as Data);\n });\n }\n\n return () => {\n if (instanceRef.current) {\n instanceRef.current.destroy();\n }\n };\n }, [delimiter]);\n\n return {\n otherProps: {\n ...otherProps,\n name\n },\n ref,\n instanceRef\n };\n}\n\nexport function ChoicesTags<Data = string>(props: InputTagsProps<Data>) {\n const { ref, otherProps } = useChoiceTags<Data>(props);\n\n return <input type='text' {...cleanFormControlProps(otherProps)} ref={ref} />;\n}\n\nregisterComponent(\"InputTags.choicesjs\", ChoicesTags);\n"],"names":["useChoiceTags","props","value","onChange","name","delimiter","customProperties","otherProps","ref","useRef","instanceRef","onAdd","useDebouncedCallback","add","values","onDelete","remove","useEffect","instance","Choices","event","ChoicesTags","jsx","cleanFormControlProps","registerComponent"],"mappings":";;;;;;AAQO,SAASA,EAA6BC,GAA6B;
|
|
1
|
+
{"version":3,"file":"ChoicesTags.js","sources":["../../../../../src/molecules/forms/input-tags/components/ChoicesTags.tsx"],"sourcesContent":["import Choices from \"@formio/choices.js\";\nimport { useEffect, useRef } from \"react\";\nimport { useDebouncedCallback } from \"use-debounce\";\n\nimport { registerComponent } from \"../../../../registries/components\";\nimport { cleanFormControlProps } from \"../../form-control/FormControl\";\nimport type { InputTagsProps } from \"../InputTags.interface\";\n\nexport function useChoiceTags<Data = string>(props: InputTagsProps<Data>) {\n const { value, onChange, name = \"\", delimiter, customProperties, ...otherProps } = props;\n const ref = useRef<HTMLInputElement | null>(null);\n const instanceRef = useRef<Choices | null>(null);\n\n const onAdd = useDebouncedCallback((add: Data) => {\n const values = ((value || []) as Data[]).concat(add);\n\n onChange?.(name, [...values]);\n }, 100);\n\n const onDelete = useDebouncedCallback((remove: Data) => {\n const values = (value || []).filter((v) => v !== remove);\n\n onChange?.(name, [...values]);\n });\n\n useEffect(() => {\n if (ref.current) {\n const instance = new Choices(ref.current!, {\n duplicateItemsAllowed: false,\n ...customProperties,\n delimiter,\n editItems: true,\n removeItemButton: true\n });\n\n instance.setValue((value || []) as string[]);\n\n instanceRef.current = instance;\n\n instance.passedElement.element.addEventListener(\"addItem\", (event: { detail: { value: unknown } }) => {\n onAdd(event.detail.value as Data);\n });\n\n instance.passedElement.element.addEventListener(\"removeItem\", (event: { detail: { value: unknown } }) => {\n onDelete(event.detail.value as Data);\n });\n }\n\n return () => {\n if (instanceRef.current) {\n instanceRef.current.destroy();\n }\n };\n }, [delimiter]);\n\n return {\n otherProps: {\n ...otherProps,\n name\n },\n ref,\n instanceRef\n };\n}\n\nexport function ChoicesTags<Data = string>(props: InputTagsProps<Data>) {\n const { ref, otherProps } = useChoiceTags<Data>(props);\n\n return <input type='text' {...cleanFormControlProps(otherProps)} ref={ref} />;\n}\n\nregisterComponent(\"InputTags.choicesjs\", ChoicesTags);\n"],"names":["useChoiceTags","props","value","onChange","name","delimiter","customProperties","otherProps","ref","useRef","instanceRef","onAdd","useDebouncedCallback","add","values","onDelete","remove","useEffect","instance","Choices","event","ChoicesTags","jsx","cleanFormControlProps","registerComponent"],"mappings":";;;;;;AAQO,SAASA,EAA6BC,GAA6B;AACxE,QAAM,EAAE,OAAAC,GAAO,UAAAC,GAAU,MAAAC,IAAO,IAAI,WAAAC,GAAW,kBAAAC,GAAkB,GAAGC,EAAA,IAAeN,GAC7EO,IAAMC,EAAgC,IAAI,GAC1CC,IAAcD,EAAuB,IAAI,GAEzCE,IAAQC,EAAqB,CAACC,MAAc;AAChD,UAAMC,KAAWZ,KAAS,CAAA,GAAe,OAAOW,CAAG;AAEnD,IAAAV,IAAWC,GAAM,CAAC,GAAGU,CAAM,CAAC;AAAA,EAC9B,GAAG,GAAG,GAEAC,IAAWH,EAAqB,CAACI,MAAiB;AACtD,UAAMF,KAAUZ,KAAS,CAAA,GAAI,OAAO,CAAC,MAAM,MAAMc,CAAM;AAEvD,IAAAb,IAAWC,GAAM,CAAC,GAAGU,CAAM,CAAC;AAAA,EAC9B,CAAC;AAED,SAAAG,EAAU,MAAM;AACd,QAAIT,EAAI,SAAS;AACf,YAAMU,IAAW,IAAIC,EAAQX,EAAI,SAAU;AAAA,QACzC,uBAAuB;AAAA,QACvB,GAAGF;AAAA,QACH,WAAAD;AAAA,QACA,WAAW;AAAA,QACX,kBAAkB;AAAA,MAAA,CACnB;AAED,MAAAa,EAAS,SAAUhB,KAAS,EAAe,GAE3CQ,EAAY,UAAUQ,GAEtBA,EAAS,cAAc,QAAQ,iBAAiB,WAAW,CAACE,MAA0C;AACpG,QAAAT,EAAMS,EAAM,OAAO,KAAa;AAAA,MAClC,CAAC,GAEDF,EAAS,cAAc,QAAQ,iBAAiB,cAAc,CAACE,MAA0C;AACvG,QAAAL,EAASK,EAAM,OAAO,KAAa;AAAA,MACrC,CAAC;AAAA,IACH;AAEA,WAAO,MAAM;AACX,MAAIV,EAAY,WACdA,EAAY,QAAQ,QAAA;AAAA,IAExB;AAAA,EACF,GAAG,CAACL,CAAS,CAAC,GAEP;AAAA,IACL,YAAY;AAAA,MACV,GAAGE;AAAA,MACH,MAAAH;AAAA,IAAA;AAAA,IAEF,KAAAI;AAAA,IACA,aAAAE;AAAA,EAAA;AAEJ;AAEO,SAASW,EAA2BpB,GAA6B;AACtE,QAAM,EAAE,KAAAO,GAAK,YAAAD,MAAeP,EAAoBC,CAAK;AAErD,SAAO,gBAAAqB,EAAC,WAAM,MAAK,QAAQ,GAAGC,EAAsBhB,CAAU,GAAG,KAAAC,GAAU;AAC7E;AAEAgB,EAAkB,uBAAuBH,CAAW;"}
|