@payloadcms/ui 3.12.0 → 3.12.1-canary.b1b1cbf

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.
@@ -2,6 +2,7 @@ import React from 'react';
2
2
  import './index.scss';
3
3
  export declare const CodeField: React.FC<{
4
4
  readonly autoComplete?: string;
5
+ readonly onMount?: import("@monaco-editor/react").EditorProps["onMount"];
5
6
  readonly path: string;
6
7
  readonly validate?: import("payload").CodeFieldValidation;
7
8
  } & {
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/fields/Code/index.tsx"],"names":[],"mappings":"AAGA,OAAO,KAA+B,MAAM,OAAO,CAAA;AAUnD,OAAO,cAAc,CAAA;AAuFrB,eAAO,MAAM,SAAS;;;;;;+EAAoC,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/fields/Code/index.tsx"],"names":[],"mappings":"AAGA,OAAO,KAA+B,MAAM,OAAO,CAAA;AAUnD,OAAO,cAAc,CAAA;AAyFrB,eAAO,MAAM,SAAS;;;;;;;+EAAoC,CAAA"}
@@ -31,6 +31,7 @@ const CodeFieldComponent = props => {
31
31
  localized,
32
32
  required
33
33
  },
34
+ onMount,
34
35
  path,
35
36
  readOnly,
36
37
  validate
@@ -81,6 +82,7 @@ const CodeFieldComponent = props => {
81
82
  }), BeforeInput, /*#__PURE__*/_jsx(CodeEditor, {
82
83
  defaultLanguage: prismToMonacoLanguageMap[language] || language,
83
84
  onChange: readOnly ? () => null : val => setValue(val),
85
+ onMount: onMount,
84
86
  options: editorOptions,
85
87
  readOnly: readOnly,
86
88
  value: value_0 || ''
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["React","useCallback","useMemo","CodeEditor","RenderCustomComponent","FieldDescription","FieldError","FieldLabel","useField","withCondition","mergeFieldStyles","fieldBaseClass","prismToMonacoLanguageMap","js","ts","baseClass","CodeFieldComponent","props","field","admin","className","description","editorOptions","language","label","localized","required","path","readOnly","validate","memoizedValidate","value","options","customComponents","AfterInput","BeforeInput","Description","Error","Label","setValue","showError","styles","_jsxs","filter","Boolean","join","style","_jsx","CustomComponent","Fallback","defaultLanguage","onChange","val","CodeField"],"sources":["../../../src/fields/Code/index.tsx"],"sourcesContent":["'use client'\nimport type { CodeFieldClientComponent } from 'payload'\n\nimport React, { useCallback, useMemo } from 'react'\n\nimport { CodeEditor } from '../../elements/CodeEditor/index.js'\nimport { RenderCustomComponent } from '../../elements/RenderCustomComponent/index.js'\nimport { FieldDescription } from '../../fields/FieldDescription/index.js'\nimport { FieldError } from '../../fields/FieldError/index.js'\nimport { FieldLabel } from '../../fields/FieldLabel/index.js'\nimport { useField } from '../../forms/useField/index.js'\nimport { withCondition } from '../../forms/withCondition/index.js'\nimport { mergeFieldStyles } from '../mergeFieldStyles.js'\nimport './index.scss'\nimport { fieldBaseClass } from '../shared/index.js'\n\nconst prismToMonacoLanguageMap = {\n js: 'javascript',\n ts: 'typescript',\n}\n\nconst baseClass = 'code-field'\n\nconst CodeFieldComponent: CodeFieldClientComponent = (props) => {\n const {\n field,\n field: {\n admin: { className, description, editorOptions = {}, language = 'javascript' } = {},\n label,\n localized,\n required,\n },\n path,\n readOnly,\n validate,\n } = props\n\n const memoizedValidate = useCallback(\n (value, options) => {\n if (typeof validate === 'function') {\n return validate(value, { ...options, required })\n }\n },\n [validate, required],\n )\n\n const {\n customComponents: { AfterInput, BeforeInput, Description, Error, Label } = {},\n setValue,\n showError,\n value,\n } = useField({\n path,\n validate: memoizedValidate,\n })\n\n const styles = useMemo(() => mergeFieldStyles(field), [field])\n\n return (\n <div\n className={[\n fieldBaseClass,\n baseClass,\n className,\n showError && 'error',\n readOnly && 'read-only',\n ]\n .filter(Boolean)\n .join(' ')}\n style={styles}\n >\n <RenderCustomComponent\n CustomComponent={Label}\n Fallback={\n <FieldLabel label={label} localized={localized} path={path} required={required} />\n }\n />\n <div className={`${fieldBaseClass}__wrap`}>\n <RenderCustomComponent\n CustomComponent={Error}\n Fallback={<FieldError path={path} showError={showError} />}\n />\n {BeforeInput}\n <CodeEditor\n defaultLanguage={prismToMonacoLanguageMap[language] || language}\n onChange={readOnly ? () => null : (val) => setValue(val)}\n options={editorOptions}\n readOnly={readOnly}\n value={(value as string) || ''}\n />\n {AfterInput}\n </div>\n <RenderCustomComponent\n CustomComponent={Description}\n Fallback={<FieldDescription description={description} path={path} />}\n />\n </div>\n )\n}\n\nexport const CodeField = withCondition(CodeFieldComponent)\n"],"mappings":"AAAA;;;AAGA,OAAOA,KAAA,IAASC,WAAW,EAAEC,OAAO,QAAQ;AAE5C,SAASC,UAAU,QAAQ;AAC3B,SAASC,qBAAqB,QAAQ;AACtC,SAASC,gBAAgB,QAAQ;AACjC,SAASC,UAAU,QAAQ;AAC3B,SAASC,UAAU,QAAQ;AAC3B,SAASC,QAAQ,QAAQ;AACzB,SAASC,aAAa,QAAQ;AAC9B,SAASC,gBAAgB,QAAQ;AACjC,OAAO;AACP,SAASC,cAAc,QAAQ;AAE/B,MAAMC,wBAAA,GAA2B;EAC/BC,EAAA,EAAI;EACJC,EAAA,EAAI;AACN;AAEA,MAAMC,SAAA,GAAY;AAElB,MAAMC,kBAAA,GAAgDC,KAAA;EACpD,MAAM;IACJC,KAAK;IACLA,KAAA,EAAO;MACLC,KAAA,EAAO;QAAEC,SAAS;QAAEC,WAAW;QAAEC,aAAA,GAAgB,CAAC,CAAC;QAAEC,QAAA,GAAW;MAAY,CAAE,GAAG,CAAC,CAAC;MACnFC,KAAK;MACLC,SAAS;MACTC;IAAQ,CACT;IACDC,IAAI;IACJC,QAAQ;IACRC;EAAQ,CACT,GAAGZ,KAAA;EAEJ,MAAMa,gBAAA,GAAmB7B,WAAA,CACvB,CAAC8B,KAAA,EAAOC,OAAA;IACN,IAAI,OAAOH,QAAA,KAAa,YAAY;MAClC,OAAOA,QAAA,CAASE,KAAA,EAAO;QAAE,GAAGC,OAAO;QAAEN;MAAS;IAChD;EACF,GACA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C,IAAoB;UAE7BG,UAAA;qBAEHa,IAAA,CAAC3C,qBAAA;MACC4C,eAAA,EAAiBZ,WAAA;MACjBa,QAAA,eAAUF,IAAA,CAAC1C,gBAAA;QAAiBgB,WAAA,EAAaA,WAAA;QAAaM,IAAA,EAAMA;;;;AAIpE;AAEA,OAAO,MAAM0B,SAAA,GAAY5C,aAAA,CAAcO,kBAAA","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["React","useCallback","useMemo","CodeEditor","RenderCustomComponent","FieldDescription","FieldError","FieldLabel","useField","withCondition","mergeFieldStyles","fieldBaseClass","prismToMonacoLanguageMap","js","ts","baseClass","CodeFieldComponent","props","field","admin","className","description","editorOptions","language","label","localized","required","onMount","path","readOnly","validate","memoizedValidate","value","options","customComponents","AfterInput","BeforeInput","Description","Error","Label","setValue","showError","styles","_jsxs","filter","Boolean","join","style","_jsx","CustomComponent","Fallback","defaultLanguage","onChange","val","CodeField"],"sources":["../../../src/fields/Code/index.tsx"],"sourcesContent":["'use client'\nimport type { CodeFieldClientComponent } from 'payload'\n\nimport React, { useCallback, useMemo } from 'react'\n\nimport { CodeEditor } from '../../elements/CodeEditor/index.js'\nimport { RenderCustomComponent } from '../../elements/RenderCustomComponent/index.js'\nimport { FieldDescription } from '../../fields/FieldDescription/index.js'\nimport { FieldError } from '../../fields/FieldError/index.js'\nimport { FieldLabel } from '../../fields/FieldLabel/index.js'\nimport { useField } from '../../forms/useField/index.js'\nimport { withCondition } from '../../forms/withCondition/index.js'\nimport { mergeFieldStyles } from '../mergeFieldStyles.js'\nimport './index.scss'\nimport { fieldBaseClass } from '../shared/index.js'\n\nconst prismToMonacoLanguageMap = {\n js: 'javascript',\n ts: 'typescript',\n}\n\nconst baseClass = 'code-field'\n\nconst CodeFieldComponent: CodeFieldClientComponent = (props) => {\n const {\n field,\n field: {\n admin: { className, description, editorOptions = {}, language = 'javascript' } = {},\n label,\n localized,\n required,\n },\n onMount,\n path,\n readOnly,\n validate,\n } = props\n\n const memoizedValidate = useCallback(\n (value, options) => {\n if (typeof validate === 'function') {\n return validate(value, { ...options, required })\n }\n },\n [validate, required],\n )\n\n const {\n customComponents: { AfterInput, BeforeInput, Description, Error, Label } = {},\n setValue,\n showError,\n value,\n } = useField({\n path,\n validate: memoizedValidate,\n })\n\n const styles = useMemo(() => mergeFieldStyles(field), [field])\n\n return (\n <div\n className={[\n fieldBaseClass,\n baseClass,\n className,\n showError && 'error',\n readOnly && 'read-only',\n ]\n .filter(Boolean)\n .join(' ')}\n style={styles}\n >\n <RenderCustomComponent\n CustomComponent={Label}\n Fallback={\n <FieldLabel label={label} localized={localized} path={path} required={required} />\n }\n />\n <div className={`${fieldBaseClass}__wrap`}>\n <RenderCustomComponent\n CustomComponent={Error}\n Fallback={<FieldError path={path} showError={showError} />}\n />\n {BeforeInput}\n <CodeEditor\n defaultLanguage={prismToMonacoLanguageMap[language] || language}\n onChange={readOnly ? () => null : (val) => setValue(val)}\n onMount={onMount}\n options={editorOptions}\n readOnly={readOnly}\n value={(value as string) || ''}\n />\n {AfterInput}\n </div>\n <RenderCustomComponent\n CustomComponent={Description}\n Fallback={<FieldDescription description={description} path={path} />}\n />\n </div>\n )\n}\n\nexport const CodeField = withCondition(CodeFieldComponent)\n"],"mappings":"AAAA;;;AAGA,OAAOA,KAAA,IAASC,WAAW,EAAEC,OAAO,QAAQ;AAE5C,SAASC,UAAU,QAAQ;AAC3B,SAASC,qBAAqB,QAAQ;AACtC,SAASC,gBAAgB,QAAQ;AACjC,SAASC,UAAU,QAAQ;AAC3B,SAASC,UAAU,QAAQ;AAC3B,SAASC,QAAQ,QAAQ;AACzB,SAASC,aAAa,QAAQ;AAC9B,SAASC,gBAAgB,QAAQ;AACjC,OAAO;AACP,SAASC,cAAc,QAAQ;AAE/B,MAAMC,wBAAA,GAA2B;EAC/BC,EAAA,EAAI;EACJC,EAAA,EAAI;AACN;AAEA,MAAMC,SAAA,GAAY;AAElB,MAAMC,kBAAA,GAAgDC,KAAA;EACpD,MAA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iB,KAAA,CAAC;MAAIvB,SAAA,EAAW,GAAGT,cAAA,QAAsB;8BACvCqC,IAAA,CAAC5C,qBAAA;QACC6C,eAAA,EAAiBX,KAAA;QACjBY,QAAA,eAAUF,IAAA,CAAC1C,UAAA;UAAWsB,IAAA,EAAMA,IAAA;UAAMa,SAAA,EAAWA;;UAE9CL,WAAA,E,aACDY,IAAA,CAAC7C,UAAA;QACCgD,eAAA,EAAiBvC,wBAAwB,CAACW,QAAA,CAAS,IAAIA,QAAA;QACvD6B,QAAA,EAAUvB,QAAA,GAAW,MAAM,OAAQwB,GAAA,IAAQb,QAAA,CAASa,GAAA;QACpD1B,OAAA,EAASA,OAAA;QACTM,OAAA,EAASX,aAAA;QACTO,QAAA,EAAUA,QAAA;QACVG,KAAA,EAAOA,OAAC,IAAoB;UAE7BG,UAAA;qBAEHa,IAAA,CAAC5C,qBAAA;MACC6C,eAAA,EAAiBZ,WAAA;MACjBa,QAAA,eAAUF,IAAA,CAAC3C,gBAAA;QAAiBgB,WAAA,EAAaA,WAAA;QAAaO,IAAA,EAAMA;;;;AAIpE;AAEA,OAAO,MAAM0B,SAAA,GAAY7C,aAAA,CAAcO,kBAAA","ignoreList":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@payloadcms/ui",
3
- "version": "3.12.0",
3
+ "version": "3.12.1-canary.b1b1cbf",
4
4
  "homepage": "https://payloadcms.com",
5
5
  "repository": {
6
6
  "type": "git",
@@ -132,7 +132,7 @@
132
132
  "ts-essentials": "10.0.3",
133
133
  "use-context-selector": "2.0.0",
134
134
  "uuid": "10.0.0",
135
- "@payloadcms/translations": "3.12.0"
135
+ "@payloadcms/translations": "3.12.1-canary.b1b1cbf"
136
136
  },
137
137
  "devDependencies": {
138
138
  "@babel/cli": "7.25.9",
@@ -149,14 +149,14 @@
149
149
  "esbuild": "0.24.0",
150
150
  "esbuild-sass-plugin": "3.3.1",
151
151
  "eslint-plugin-react-compiler": "19.0.0-beta-df7b47d-20241124",
152
- "payload": "3.12.0",
153
- "@payloadcms/eslint-config": "3.9.0"
152
+ "@payloadcms/eslint-config": "3.9.0",
153
+ "payload": "3.12.1-canary.b1b1cbf"
154
154
  },
155
155
  "peerDependencies": {
156
156
  "next": "^15.0.0",
157
157
  "react": "^19.0.0 || ^19.0.0-rc-65a56d0e-20241020",
158
158
  "react-dom": "^19.0.0 || ^19.0.0-rc-65a56d0e-20241020",
159
- "payload": "3.12.0"
159
+ "payload": "3.12.1-canary.b1b1cbf"
160
160
  },
161
161
  "engines": {
162
162
  "node": "^18.20.2 || >=20.9.0"