@aglyn/shared-ui-jsx-forms 1.19.0 → 1.20.0
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aglyn/shared-ui-jsx-forms",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.20.0",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"homepage": "https://aglyn.com",
|
|
6
6
|
"repository": {
|
|
@@ -25,13 +25,13 @@
|
|
|
25
25
|
"./package.json": "./package.json"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@aglyn/shared-data-enums": "1.
|
|
29
|
-
"@aglyn/shared-data-mdi": "1.
|
|
30
|
-
"@aglyn/shared-ui-color-picker": "1.
|
|
31
|
-
"@aglyn/shared-ui-jsx": "1.
|
|
32
|
-
"@aglyn/shared-ui-theme": "1.
|
|
33
|
-
"@aglyn/shared-util-tools": "1.
|
|
34
|
-
"@aglyn/shared-util-vendor": "1.
|
|
28
|
+
"@aglyn/shared-data-enums": "1.20.0",
|
|
29
|
+
"@aglyn/shared-data-mdi": "1.20.0",
|
|
30
|
+
"@aglyn/shared-ui-color-picker": "1.20.0",
|
|
31
|
+
"@aglyn/shared-ui-jsx": "1.20.0",
|
|
32
|
+
"@aglyn/shared-ui-theme": "1.20.0",
|
|
33
|
+
"@aglyn/shared-util-tools": "1.20.0",
|
|
34
|
+
"@aglyn/shared-util-vendor": "1.20.0",
|
|
35
35
|
"@data-driven-forms/common": "^4.2.0",
|
|
36
36
|
"@data-driven-forms/react-form-renderer": "^4.2.0",
|
|
37
37
|
"@swc/helpers": "0.5.23",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type ReactNode } from 'react';
|
|
1
|
+
import { type ComponentType, type ReactNode } from 'react';
|
|
2
2
|
import { type FormTemplateRenderProps } from '../vendor/data-driven-forms';
|
|
3
3
|
/**
|
|
4
4
|
* THE naming step in front of Create (AGL-700), shared by every console list
|
|
@@ -57,6 +57,12 @@ export interface CreateArtifactDrawerProps {
|
|
|
57
57
|
FormTemplate?: any;
|
|
58
58
|
/** Label on the submit button. */
|
|
59
59
|
submitLabel?: string;
|
|
60
|
+
/**
|
|
61
|
+
* Field components beyond the shared ones, by the `component` name an extra
|
|
62
|
+
* field asks for. Merged over the drawer's own mapper, so a caller with one
|
|
63
|
+
* field the library has no component for keeps the shared drawer.
|
|
64
|
+
*/
|
|
65
|
+
componentMapper?: Record<string, ComponentType<any>>;
|
|
60
66
|
}
|
|
61
67
|
/**
|
|
62
68
|
* The default chrome: the fields in a grid and one submit button.
|
|
@@ -78,7 +78,7 @@ import { simpleComponentMapper } from "../constants/component-mappers.js";
|
|
|
78
78
|
ArtifactFormTemplate.displayName = 'ArtifactFormTemplate';
|
|
79
79
|
ArtifactFormTemplate.aglyn = true;
|
|
80
80
|
export function CreateArtifactDrawer(props) {
|
|
81
|
-
const { open, onClose, title, onSubmit, extraFields, errorSlot, includeDescription = true, FormTemplate = ArtifactFormTemplate, submitLabel } = props;
|
|
81
|
+
const { open, onClose, title, onSubmit, extraFields, errorSlot, includeDescription = true, FormTemplate = ArtifactFormTemplate, submitLabel, componentMapper } = props;
|
|
82
82
|
const schema = _extends({
|
|
83
83
|
fields: [
|
|
84
84
|
...includeDescription ? BASE_FIELDS : BASE_FIELDS.filter((field)=>field.name !== 'description'),
|
|
@@ -131,7 +131,7 @@ export function CreateArtifactDrawer(props) {
|
|
|
131
131
|
children: [
|
|
132
132
|
/*#__PURE__*/ _jsx(FormRenderer, {
|
|
133
133
|
FormTemplate: FormTemplate,
|
|
134
|
-
componentMapper: simpleComponentMapper,
|
|
134
|
+
componentMapper: componentMapper ? _extends({}, simpleComponentMapper, componentMapper) : simpleComponentMapper,
|
|
135
135
|
onSubmit: onSubmit,
|
|
136
136
|
schema: schema,
|
|
137
137
|
subscription: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../../../libs/shared/ui/jsx-forms/src/lib/components/create-artifact-drawer.component.tsx"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n'use client'\n\nimport { ICON_VARIANT_CLOSE } from '@aglyn/shared-data-enums'\nimport { Container, MdiIcon, SrOnly } from '@aglyn/shared-ui-jsx'\nimport { NavigationDrawerComponent } from '@aglyn/shared-ui-jsx/components/navigation-drawer.component'\nimport {\n Box,\n Button,\n FormControl,\n Grid,\n IconButton,\n Typography,\n} from '@mui/material'\nimport { forwardRef, type ReactNode } from 'react'\nimport {\n FormRenderer,\n FormSpy,\n type FormTemplateRenderProps,\n useFormApi,\n} from '../vendor/data-driven-forms'\nimport { simpleComponentMapper } from '../constants/component-mappers'\n\n/**\n * THE naming step in front of Create (AGL-700), shared by every console list\n * surface that creates a record.\n *\n * ## Why it lives in a library\n *\n * It began in `apps/console`, which put it out of reach of the console pages\n * that plugins ship — a plugin's console card cannot import from the app that\n * renders it. So a plugin adding a create button had two options, both bad:\n * an inline form stacked above its table, or a second drawer that looks\n * almost but not quite like this one. Both are how a console comes to have\n * three ways of creating a record.\n *\n * The console keeps a thin wrapper at its old path so its four existing call\n * sites are untouched; it passes its own auth form template through\n * {@link CreateArtifactDrawerProps.FormTemplate}.\n *\n * A drawer rather than a dialog on purpose: creating is a drawer, picking is\n * a dialog (AGL-699). Editing is neither — it is the record's own page.\n */\nexport interface CreateArtifactDrawerProps {\n open: boolean\n onClose: () => void\n /** Drawer heading, e.g. \"Create new component\". */\n title: string\n /** Receives the collected field values; closing is the caller's job. */\n onSubmit: (values: Record<string, any>) => void | Promise<void>\n /** Extra fields appended after name and description. */\n extraFields?: any[]\n /** Rendered under the form when a submit fails. */\n errorSlot?: ReactNode\n /**\n * Whether to offer the shared Description box (AGL-2498).\n *\n * True for every artifact whose document stores one. Content collections do\n * not: `/api/hosts/collections` filters `data` through a per-kind allowlist\n * of `displayName` + `slug`, so a description typed here would be dropped\n * without a word. A field the writer silently discards is worse than a field\n * that was never offered.\n */\n includeDescription?: boolean\n /**\n * The form's own chrome — the submit button and how the fields are laid out.\n *\n * Injectable because the console's version renders an auth-aware template\n * that lives in the app and depends on the console's session hook. Defaults\n * to {@link ArtifactFormTemplate}, which is the same layout without that\n * dependency.\n *\n * A template reads form state — `submitting`, `valid` — through a\n * `FormSpy`. The form does not draw its template again when that state\n * changes, so the `pristine` and `valid` on `useFormApi()` keep the values\n * they had when the drawer opened.\n */\n FormTemplate?: any\n /** Label on the submit button. */\n submitLabel?: string\n}\n\n/**\n * The default chrome: the fields in a grid and one submit button.\n *\n * No Cancel button of its own — the drawer's app bar already carries one, and\n * a second Cancel inside the form is the shape a reader has to think about.\n */\nexport const ArtifactFormTemplate = forwardRef<any, FormTemplateRenderProps>(\n (props, ref) => {\n const { formFields, schema, ...rest } = props\n const { handleSubmit } = useFormApi()\n return (\n <form ref={ref} onSubmit={handleSubmit} noValidate {...rest}>\n {schema.title}\n <Grid spacing={2} container>\n {formFields as any}\n </Grid>\n {/* `submitting` alone: it is all the button reads, and a spy with\n no subscription draws the button again on every keystroke. */}\n <FormSpy subscription={{ submitting: true }}>\n {({ submitting }) => (\n <Box sx={{ mt: 2 }}>\n <FormControl margin=\"normal\" fullWidth>\n <Button\n color=\"primary\"\n disabled={submitting}\n type=\"submit\"\n variant=\"contained\"\n fullWidth\n >\n {(schema as { submitLabel?: string }).submitLabel ?? 'Next'}\n </Button>\n </FormControl>\n </Box>\n )}\n </FormSpy>\n </form>\n )\n },\n)\nArtifactFormTemplate.displayName = 'ArtifactFormTemplate'\n;(ArtifactFormTemplate as any).aglyn = true\n\nexport function CreateArtifactDrawer(props: CreateArtifactDrawerProps) {\n const {\n open,\n onClose,\n title,\n onSubmit,\n extraFields,\n errorSlot,\n includeDescription = true,\n FormTemplate = ArtifactFormTemplate,\n submitLabel,\n } = props\n const schema = {\n fields: [\n ...(includeDescription\n ? BASE_FIELDS\n : BASE_FIELDS.filter((field) => field.name !== 'description')),\n ...(extraFields ?? []),\n ],\n ...(submitLabel ? { submitLabel } : {}),\n }\n return (\n <NavigationDrawerComponent\n open={open}\n anchor=\"right\"\n variant=\"temporary\"\n onClose={onClose}\n AppBarProps={{ color: 'surface' }}\n appBarLeft={\n <>\n <IconButton\n color=\"inherit\"\n edge=\"start\"\n onClick={onClose}\n sx={{ mr: 2 }}\n >\n <MdiIcon path={ICON_VARIANT_CLOSE.path} />\n <SrOnly>close drawer</SrOnly>\n </IconButton>\n <Typography variant=\"h6\" component=\"div\">\n {title}\n </Typography>\n </>\n }\n appBarRight={\n <Button variant=\"outlined\" color=\"inherit\" onClick={onClose}>\n {'Cancel'}\n </Button>\n }\n >\n <Container gutterY>\n {/*\n The form subscribes to nothing, so a keystroke draws the field it\n lands in and no other (AGL-3423). Each field reads its own state, a\n condition watches the fields it names, and the template's button\n watches `submitting` through its own FormSpy: nothing here is drawn\n from the form's state as a whole. The renderer's own defaults —\n pristine, submitting, valid — are switched off too: a change in any\n of them draws every field again, and the first letter of a required\n name changes two of them.\n */}\n <FormRenderer\n FormTemplate={FormTemplate}\n componentMapper={simpleComponentMapper}\n onSubmit={onSubmit}\n schema={schema}\n subscription={{ pristine: false, submitting: false, valid: false }}\n clearOnUnmount\n />\n {errorSlot}\n </Container>\n </NavigationDrawerComponent>\n )\n}\n\n/**\n * Same shape and limits the layouts drawer has used since AGL-473, so the\n * creates across the console validate identically.\n */\nexport const BASE_FIELDS = [\n {\n component: 'text-field',\n name: 'displayName',\n helperText: 'Friendly name for internal reference',\n type: 'text',\n label: 'Display name',\n isRequired: true,\n validate: [\n { type: 'required', message: 'Provide a display name' },\n {\n type: 'max-length',\n threshold: 25,\n message: 'Must not exceed 25 characters',\n },\n ],\n },\n {\n component: 'textarea',\n name: 'description',\n label: 'Description',\n helperText: 'Brief description for internal reference',\n validate: [\n {\n type: 'max-length',\n threshold: 80,\n message: 'Must not exceed 80 characters',\n },\n ],\n },\n]\n\nCreateArtifactDrawer.displayName = 'CreateArtifactDrawer'\n\nexport default CreateArtifactDrawer\n"],"names":["ICON_VARIANT_CLOSE","Container","MdiIcon","SrOnly","NavigationDrawerComponent","Box","Button","FormControl","Grid","IconButton","Typography","forwardRef","FormRenderer","FormSpy","useFormApi","simpleComponentMapper","ArtifactFormTemplate","props","ref","formFields","schema","rest","handleSubmit","form","onSubmit","noValidate","title","spacing","container","subscription","submitting","sx","mt","margin","fullWidth","color","disabled","type","variant","submitLabel","displayName","aglyn","CreateArtifactDrawer","open","onClose","extraFields","errorSlot","includeDescription","FormTemplate","fields","BASE_FIELDS","filter","field","name","anchor","AppBarProps","appBarLeft","edge","onClick","mr","path","component","appBarRight","gutterY","componentMapper","pristine","valid","clearOnUnmount","helperText","label","isRequired","validate","message","threshold"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GACD;;;;AAEA,SAASA,kBAAkB,QAAQ,2BAA0B;AAC7D,SAASC,SAAS,EAAEC,OAAO,EAAEC,MAAM,QAAQ,uBAAsB;AACjE,SAASC,yBAAyB,QAAQ,8DAA6D;AACvG,SACEC,GAAG,EACHC,MAAM,EACNC,WAAW,EACXC,IAAI,EACJC,UAAU,EACVC,UAAU,QACL,gBAAe;AACtB,SAASC,UAAU,QAAwB,QAAO;AAClD,SACEC,YAAY,EACZC,OAAO,EAEPC,UAAU,QACL,iCAA6B;AACpC,SAASC,qBAAqB,QAAQ,oCAAgC;AA6DtE;;;;;CAKC,GACD,OAAO,MAAMC,qCAAuBL,WAClC,CAACM,OAAOC;IACN,MAAM,EAAEC,UAAU,EAAEC,MAAM,E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;4BAAQ0D,MAAM5D,mBAAmB4D,IAAI;;sCACtC,KAACzD;sCAAO;;;;8BAEV,KAACO;oBAAW4B,SAAQ;oBAAKuB,WAAU;8BAChCnC;;;;QAIPoC,2BACE,KAACxD;YAAOgC,SAAQ;YAAWH,OAAM;YAAUuB,SAASd;sBACjD;;kBAIL,cAAA,MAAC3C;YAAU8D,OAAO;;8BAWhB,KAACnD;oBACCoC,cAAcA;oBACdgB,iBAAiBjD;oBACjBS,UAAUA;oBACVJ,QAAQA;oBACRS,cAAc;wBAAEoC,UAAU;wBAAOnC,YAAY;wBAAOoC,OAAO;oBAAM;oBACjEC,cAAc;;gBAEfrB;;;;AAIT;AAEA;;;CAGC,GACD,OAAO,MAAMI,cAAc;IACzB;QACEW,WAAW;QACXR,MAAM;QACNe,YAAY;QACZ/B,MAAM;QACNgC,OAAO;QACPC,YAAY;QACZC,UAAU;YACR;gBAAElC,MAAM;gBAAYmC,SAAS;YAAyB;YACtD;gBACEnC,MAAM;gBACNoC,WAAW;gBACXD,SAAS;YACX;SACD;IACH;IACA;QACEX,WAAW;QACXR,MAAM;QACNgB,OAAO;QACPD,YAAY;QACZG,UAAU;YACR;gBACElC,MAAM;gBACNoC,WAAW;gBACXD,SAAS;YACX;SACD;IACH;CACD,CAAA;AAED9B,qBAAqBF,WAAW,GAAG;AAEnC,eAAeE,qBAAoB"}
|
|
1
|
+
{"version":3,"sources":["../../../../../../../../libs/shared/ui/jsx-forms/src/lib/components/create-artifact-drawer.component.tsx"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n'use client'\n\nimport { ICON_VARIANT_CLOSE } from '@aglyn/shared-data-enums'\nimport { Container, MdiIcon, SrOnly } from '@aglyn/shared-ui-jsx'\nimport { NavigationDrawerComponent } from '@aglyn/shared-ui-jsx/components/navigation-drawer.component'\nimport {\n Box,\n Button,\n FormControl,\n Grid,\n IconButton,\n Typography,\n} from '@mui/material'\nimport { type ComponentType, forwardRef, type ReactNode } from 'react'\nimport {\n FormRenderer,\n FormSpy,\n type FormTemplateRenderProps,\n useFormApi,\n} from '../vendor/data-driven-forms'\nimport { simpleComponentMapper } from '../constants/component-mappers'\n\n/**\n * THE naming step in front of Create (AGL-700), shared by every console list\n * surface that creates a record.\n *\n * ## Why it lives in a library\n *\n * It began in `apps/console`, which put it out of reach of the console pages\n * that plugins ship — a plugin's console card cannot import from the app that\n * renders it. So a plugin adding a create button had two options, both bad:\n * an inline form stacked above its table, or a second drawer that looks\n * almost but not quite like this one. Both are how a console comes to have\n * three ways of creating a record.\n *\n * The console keeps a thin wrapper at its old path so its four existing call\n * sites are untouched; it passes its own auth form template through\n * {@link CreateArtifactDrawerProps.FormTemplate}.\n *\n * A drawer rather than a dialog on purpose: creating is a drawer, picking is\n * a dialog (AGL-699). Editing is neither — it is the record's own page.\n */\nexport interface CreateArtifactDrawerProps {\n open: boolean\n onClose: () => void\n /** Drawer heading, e.g. \"Create new component\". */\n title: string\n /** Receives the collected field values; closing is the caller's job. */\n onSubmit: (values: Record<string, any>) => void | Promise<void>\n /** Extra fields appended after name and description. */\n extraFields?: any[]\n /** Rendered under the form when a submit fails. */\n errorSlot?: ReactNode\n /**\n * Whether to offer the shared Description box (AGL-2498).\n *\n * True for every artifact whose document stores one. Content collections do\n * not: `/api/hosts/collections` filters `data` through a per-kind allowlist\n * of `displayName` + `slug`, so a description typed here would be dropped\n * without a word. A field the writer silently discards is worse than a field\n * that was never offered.\n */\n includeDescription?: boolean\n /**\n * The form's own chrome — the submit button and how the fields are laid out.\n *\n * Injectable because the console's version renders an auth-aware template\n * that lives in the app and depends on the console's session hook. Defaults\n * to {@link ArtifactFormTemplate}, which is the same layout without that\n * dependency.\n *\n * A template reads form state — `submitting`, `valid` — through a\n * `FormSpy`. The form does not draw its template again when that state\n * changes, so the `pristine` and `valid` on `useFormApi()` keep the values\n * they had when the drawer opened.\n */\n FormTemplate?: any\n /** Label on the submit button. */\n submitLabel?: string\n /**\n * Field components beyond the shared ones, by the `component` name an extra\n * field asks for. Merged over the drawer's own mapper, so a caller with one\n * field the library has no component for keeps the shared drawer.\n */\n componentMapper?: Record<string, ComponentType<any>>\n}\n\n/**\n * The default chrome: the fields in a grid and one submit button.\n *\n * No Cancel button of its own — the drawer's app bar already carries one, and\n * a second Cancel inside the form is the shape a reader has to think about.\n */\nexport const ArtifactFormTemplate = forwardRef<any, FormTemplateRenderProps>(\n (props, ref) => {\n const { formFields, schema, ...rest } = props\n const { handleSubmit } = useFormApi()\n return (\n <form ref={ref} onSubmit={handleSubmit} noValidate {...rest}>\n {schema.title}\n <Grid spacing={2} container>\n {formFields as any}\n </Grid>\n {/* `submitting` alone: it is all the button reads, and a spy with\n no subscription draws the button again on every keystroke. */}\n <FormSpy subscription={{ submitting: true }}>\n {({ submitting }) => (\n <Box sx={{ mt: 2 }}>\n <FormControl margin=\"normal\" fullWidth>\n <Button\n color=\"primary\"\n disabled={submitting}\n type=\"submit\"\n variant=\"contained\"\n fullWidth\n >\n {(schema as { submitLabel?: string }).submitLabel ?? 'Next'}\n </Button>\n </FormControl>\n </Box>\n )}\n </FormSpy>\n </form>\n )\n },\n)\nArtifactFormTemplate.displayName = 'ArtifactFormTemplate'\n;(ArtifactFormTemplate as any).aglyn = true\n\nexport function CreateArtifactDrawer(props: CreateArtifactDrawerProps) {\n const {\n open,\n onClose,\n title,\n onSubmit,\n extraFields,\n errorSlot,\n includeDescription = true,\n FormTemplate = ArtifactFormTemplate,\n submitLabel,\n componentMapper,\n } = props\n const schema = {\n fields: [\n ...(includeDescription\n ? BASE_FIELDS\n : BASE_FIELDS.filter((field) => field.name !== 'description')),\n ...(extraFields ?? []),\n ],\n ...(submitLabel ? { submitLabel } : {}),\n }\n return (\n <NavigationDrawerComponent\n open={open}\n anchor=\"right\"\n variant=\"temporary\"\n onClose={onClose}\n AppBarProps={{ color: 'surface' }}\n appBarLeft={\n <>\n <IconButton\n color=\"inherit\"\n edge=\"start\"\n onClick={onClose}\n sx={{ mr: 2 }}\n >\n <MdiIcon path={ICON_VARIANT_CLOSE.path} />\n <SrOnly>close drawer</SrOnly>\n </IconButton>\n <Typography variant=\"h6\" component=\"div\">\n {title}\n </Typography>\n </>\n }\n appBarRight={\n <Button variant=\"outlined\" color=\"inherit\" onClick={onClose}>\n {'Cancel'}\n </Button>\n }\n >\n <Container gutterY>\n {/*\n The form subscribes to nothing, so a keystroke draws the field it\n lands in and no other (AGL-3423). Each field reads its own state, a\n condition watches the fields it names, and the template's button\n watches `submitting` through its own FormSpy: nothing here is drawn\n from the form's state as a whole. The renderer's own defaults —\n pristine, submitting, valid — are switched off too: a change in any\n of them draws every field again, and the first letter of a required\n name changes two of them.\n */}\n <FormRenderer\n FormTemplate={FormTemplate}\n componentMapper={\n componentMapper\n ? { ...simpleComponentMapper, ...componentMapper }\n : simpleComponentMapper\n }\n onSubmit={onSubmit}\n schema={schema}\n subscription={{ pristine: false, submitting: false, valid: false }}\n clearOnUnmount\n />\n {errorSlot}\n </Container>\n </NavigationDrawerComponent>\n )\n}\n\n/**\n * Same shape and limits the layouts drawer has used since AGL-473, so the\n * creates across the console validate identically.\n */\nexport const BASE_FIELDS = [\n {\n component: 'text-field',\n name: 'displayName',\n helperText: 'Friendly name for internal reference',\n type: 'text',\n label: 'Display name',\n isRequired: true,\n validate: [\n { type: 'required', message: 'Provide a display name' },\n {\n type: 'max-length',\n threshold: 25,\n message: 'Must not exceed 25 characters',\n },\n ],\n },\n {\n component: 'textarea',\n name: 'description',\n label: 'Description',\n helperText: 'Brief description for internal reference',\n validate: [\n {\n type: 'max-length',\n threshold: 80,\n message: 'Must not exceed 80 characters',\n },\n ],\n },\n]\n\nCreateArtifactDrawer.displayName = 'CreateArtifactDrawer'\n\nexport default CreateArtifactDrawer\n"],"names":["ICON_VARIANT_CLOSE","Container","MdiIcon","SrOnly","NavigationDrawerComponent","Box","Button","FormControl","Grid","IconButton","Typography","forwardRef","FormRenderer","FormSpy","useFormApi","simpleComponentMapper","ArtifactFormTemplate","props","ref","formFields","schema","rest","handleSubmit","form","onSubmit","noValidate","title","spacing","container","subscription","submitting","sx","mt","margin","fullWidth","color","disabled","type","variant","submitLabel","displayName","aglyn","CreateArtifactDrawer","open","onClose","extraFields","errorSlot","includeDescription","FormTemplate","componentMapper","fields","BASE_FIELDS","filter","field","name","anchor","AppBarProps","appBarLeft","edge","onClick","mr","path","component","appBarRight","gutterY","pristine","valid","clearOnUnmount","helperText","label","isRequired","validate","message","threshold"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GACD;;;;AAEA,SAASA,kBAAkB,QAAQ,2BAA0B;AAC7D,SAASC,SAAS,EAAEC,OAAO,EAAEC,MAAM,QAAQ,uBAAsB;AACjE,SAASC,yBAAyB,QAAQ,8DAA6D;AACvG,SACEC,GAAG,EACHC,MAAM,EACNC,WAAW,EACXC,IAAI,EACJC,UAAU,EACVC,UAAU,QACL,gBAAe;AACtB,SAA6BC,UAAU,QAAwB,QAAO;AACtE,SACEC,YAAY,EACZC,OAAO,EAEPC,UAAU,QACL,iCAA6B;AACpC,SAASC,qBAAqB,QAAQ,oCAAgC;AAmEtE;;;;;CAKC,GACD,OAAO,MAAMC,qCAAuBL,WAClC,CAACM,OAAOC;IACN,MAAM,EAAEC,UAAU,EAAEC,MAAM,EAAW,GAAGH,OAATI,wCAASJ;;;;IACxC,MAAM,EAAEK,YAAY,EAAE,GAAGR;IACzB,qBACE,MAACS;QAAKL,KAAKA;QAAKM,UAAUF;QAAcG,UAAU;OAAKJ;;YACpDD,OAAOM,KAAK;0BACb,KAAClB;gBAAKmB,SAAS;gBAAGC,SAAS;0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