@10x-media/fields 0.1.0-beta.9 → 4.0.0-alpha.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.
Files changed (74) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/README.md +8 -3
  3. package/dist/fields/color/client/ColorInput.js +17 -6
  4. package/dist/fields/color/client/ColorInput.js.map +1 -1
  5. package/dist/fields/color/client/ColorPickerPanel.js +18 -12
  6. package/dist/fields/color/client/ColorPickerPanel.js.map +1 -1
  7. package/dist/fields/color/client/colorField.css +131 -178
  8. package/dist/fields/color/client/icons.js +17 -24
  9. package/dist/fields/color/client/icons.js.map +1 -1
  10. package/dist/fields/color/colorField.js +5 -3
  11. package/dist/fields/color/colorField.js.map +1 -1
  12. package/dist/fields/color/server/colorCell.css +8 -9
  13. package/dist/fields/encrypted/components/EncryptedInput.js +44 -26
  14. package/dist/fields/encrypted/components/EncryptedInput.js.map +1 -1
  15. package/dist/fields/encrypted/components/EncryptedTextarea.js +29 -29
  16. package/dist/fields/encrypted/components/EncryptedTextarea.js.map +1 -1
  17. package/dist/fields/encrypted/components/EyeToggle.js +14 -35
  18. package/dist/fields/encrypted/components/EyeToggle.js.map +1 -1
  19. package/dist/fields/encrypted/components/ProtectedField.css +107 -159
  20. package/dist/fields/encrypted/components/ProtectedField.js +6 -2
  21. package/dist/fields/encrypted/components/ProtectedField.js.map +1 -1
  22. package/dist/fields/encrypted/components/RichTextRevealGate.js +3 -3
  23. package/dist/fields/encrypted/components/RichTextRevealGate.js.map +1 -1
  24. package/dist/fields/encrypted/components/WriteOnlyActions.js +58 -53
  25. package/dist/fields/encrypted/components/WriteOnlyActions.js.map +1 -1
  26. package/dist/fields/encrypted/components/WriteOnlyField.js +39 -21
  27. package/dist/fields/encrypted/components/WriteOnlyField.js.map +1 -1
  28. package/dist/fields/encrypted/components/facsimiles.js +70 -79
  29. package/dist/fields/encrypted/components/facsimiles.js.map +1 -1
  30. package/dist/fields/encrypted/components/placement.js.map +1 -1
  31. package/dist/fields/encrypted/encryptedField.js +25 -12
  32. package/dist/fields/encrypted/encryptedField.js.map +1 -1
  33. package/dist/fields/encrypted/{typescriptSchema.js → jsonSchema.js} +4 -4
  34. package/dist/fields/encrypted/jsonSchema.js.map +1 -0
  35. package/dist/fields/encrypted/queryRewrite.js +20 -0
  36. package/dist/fields/encrypted/queryRewrite.js.map +1 -1
  37. package/dist/fields/encrypted/validators.js +1 -1
  38. package/dist/fields/encrypted/validators.js.map +1 -1
  39. package/dist/fields/icon/adapters/tabler/generated/nodes.js +1 -1
  40. package/dist/fields/icon/adapters/tabler/generated/nodes.js.map +1 -1
  41. package/dist/fields/icon/client/IconDrawerContent.js +8 -6
  42. package/dist/fields/icon/client/IconDrawerContent.js.map +1 -1
  43. package/dist/fields/icon/client/IconFieldClient.js +15 -37
  44. package/dist/fields/icon/client/IconFieldClient.js.map +1 -1
  45. package/dist/fields/icon/client/icon-field.css +137 -233
  46. package/dist/fields/icon/codegen/sources/tabler.js +25 -6
  47. package/dist/fields/icon/codegen/sources/tabler.js.map +1 -1
  48. package/dist/fields/icon/layers/upload.js +3 -0
  49. package/dist/fields/icon/layers/upload.js.map +1 -1
  50. package/dist/fields/icon/react/createIcon.js +4 -4
  51. package/dist/fields/icon/react/createIcon.js.map +1 -1
  52. package/dist/fields/measurement/client/MeasurementInput.js +18 -32
  53. package/dist/fields/measurement/client/MeasurementInput.js.map +1 -1
  54. package/dist/fields/measurement/client/measurementField.css +58 -105
  55. package/dist/fields/measurement/server/getUserUnits.js +2 -1
  56. package/dist/fields/measurement/server/getUserUnits.js.map +1 -1
  57. package/dist/fields/phoneNumber/client/CountryPicker.js +14 -9
  58. package/dist/fields/phoneNumber/client/CountryPicker.js.map +1 -1
  59. package/dist/fields/phoneNumber/client/PhoneNumberField.d.ts +1 -1
  60. package/dist/fields/phoneNumber/client/PhoneNumberField.js +22 -4
  61. package/dist/fields/phoneNumber/client/PhoneNumberField.js.map +1 -1
  62. package/dist/fields/phoneNumber/client/phoneNumberField.css +109 -142
  63. package/dist/fields/phoneNumber/phoneNumberField.js +1 -1
  64. package/dist/fields/phoneNumber/phoneNumberField.js.map +1 -1
  65. package/dist/fields/phoneNumber/server/PhoneNumberCellServer.js +2 -1
  66. package/dist/fields/phoneNumber/server/PhoneNumberCellServer.js.map +1 -1
  67. package/dist/index.d.ts +3 -2
  68. package/dist/index.js +5 -4
  69. package/dist/index.js.map +1 -1
  70. package/dist/plugin/companionSelect.d.ts +12 -0
  71. package/dist/plugin/companionSelect.js +107 -0
  72. package/dist/plugin/companionSelect.js.map +1 -0
  73. package/package.json +15 -15
  74. package/dist/fields/encrypted/typescriptSchema.js.map +0 -1
@@ -9,7 +9,7 @@ import { applyBlur, applyClear, applyInput, applySave, applyUndo } from "./write
9
9
  import { FieldDescription, FieldError, FieldLabel, useDocumentEvents, useField, useFormFields, useFormSubmitted } from "@payloadcms/ui";
10
10
  import { mergeFieldStyles } from "@payloadcms/ui/shared";
11
11
  import { useCallback, useEffect, useMemo, useRef, useState } from "react";
12
- import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
12
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
13
13
  //#region src/fields/encrypted/components/WriteOnlyField.tsx
14
14
  /**
15
15
  * Editor for `protection: 'writeOnly'`. The plaintext never reaches the client
@@ -21,13 +21,14 @@ import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
21
21
  * value. Clear is the isClearable × inside the input; an undo arrow follows a
22
22
  * clear because the cleared secret cannot be retyped from memory. Every action
23
23
  * lives inside the input row (or the label row for structural types), so the
24
- * field never grows past its native height.
24
+ * field never grows past its native height. Read-only disables the input and
25
+ * drops every action, as a native read-only field offers no edit affordance.
25
26
  */
26
27
  const WriteOnlyField = (props) => {
27
28
  if (props.placement === "label-row") return /* @__PURE__ */ jsx(StructuralWriteOnly, { ...props });
28
29
  return /* @__PURE__ */ jsx(InlineWriteOnly, { ...props });
29
30
  };
30
- const InlineWriteOnly = ({ clearable, componentKey, field, generate, hintPath, maskDots, path, placement, setPath }) => {
31
+ const InlineWriteOnly = ({ clearable, componentKey, field, generate, hintPath, maskDots, path, placement, readOnly, setPath }) => {
31
32
  const { t } = useTranslation$1();
32
33
  const { setValue, value } = useField({ path });
33
34
  const isSet = useFormFields(([fields]) => fields?.[setPath]?.value === true);
@@ -110,7 +111,7 @@ const InlineWriteOnly = ({ clearable, componentKey, field, generate, hintPath, m
110
111
  const showClear = typed || clearable && isSet && !cleared;
111
112
  const inputId = `field-${path.replace(/\./g, "__")}`;
112
113
  const displayValue = typed ? String(value) : "";
113
- const actions = /* @__PURE__ */ jsxs(Fragment$1, { children: [generate ? /* @__PURE__ */ jsx(ActionButton, {
114
+ const actions = readOnly ? null : /* @__PURE__ */ jsxs(Fragment, { children: [generate ? /* @__PURE__ */ jsx(ActionButton, {
114
115
  attached: placement === "attached",
115
116
  kind: "generate",
116
117
  label: t(keys.generateValue),
@@ -130,7 +131,12 @@ const InlineWriteOnly = ({ clearable, componentKey, field, generate, hintPath, m
130
131
  const isTextarea = componentKey === "textarea";
131
132
  const inputProps = {
132
133
  autoComplete: "off",
133
- className: ["tenx-protected-field__wo-input", !typed && isSet && !cleared && "tenx-protected-field__wo-input--set"].filter(Boolean).join(" "),
134
+ className: [
135
+ "form-input",
136
+ "tenx-protected-field__wo-input",
137
+ !typed && isSet && !cleared && "tenx-protected-field__wo-input--set"
138
+ ].filter(Boolean).join(" "),
139
+ disabled: readOnly,
134
140
  id: inputId,
135
141
  name: path,
136
142
  onBlur: handleBlur,
@@ -144,7 +150,8 @@ const InlineWriteOnly = ({ clearable, componentKey, field, generate, hintPath, m
144
150
  componentKey,
145
151
  showFieldError && "error",
146
152
  "tenx-protected-field",
147
- placement === "attached" ? "tenx-protected-field--attached" : "tenx-protected-field--corner"
153
+ placement === "attached" ? "tenx-protected-field--attached" : "tenx-protected-field--corner",
154
+ readOnly && "read-only"
148
155
  ].filter(Boolean).join(" "),
149
156
  style: styles,
150
157
  children: [/* @__PURE__ */ jsx(FieldLabel, {
@@ -156,17 +163,24 @@ const InlineWriteOnly = ({ clearable, componentKey, field, generate, hintPath, m
156
163
  className: "field-type__wrap",
157
164
  children: [
158
165
  /* @__PURE__ */ jsx(FieldError, { path }),
159
- isTextarea ? /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("textarea", {
160
- ...inputProps,
161
- ref: (el) => {
162
- inputRef.current = el;
163
- },
164
- rows: field.admin?.rows ?? 4
165
- }), /* @__PURE__ */ jsx("div", {
166
- className: "tenx-protected-field__eye-wrap tenx-protected-field__eye-wrap--corner tenx-protected-field__actions--corner",
167
- children: actions
168
- })] }) : /* @__PURE__ */ jsxs("div", {
169
- className: "tenx-protected-field__attached-row",
166
+ isTextarea ? /* @__PURE__ */ jsxs("div", {
167
+ className: "textarea-outer",
168
+ children: [/* @__PURE__ */ jsx("textarea", {
169
+ ...inputProps,
170
+ ref: (el) => {
171
+ inputRef.current = el;
172
+ },
173
+ rows: field.admin?.rows ?? 4
174
+ }), /* @__PURE__ */ jsx("div", {
175
+ className: "tenx-protected-field__eye-wrap tenx-protected-field__eye-wrap--corner tenx-protected-field__actions--corner",
176
+ children: actions
177
+ })]
178
+ }) : /* @__PURE__ */ jsxs("div", {
179
+ className: [
180
+ "form-input-group",
181
+ showFieldError && "form-input-group-error",
182
+ "tenx-protected-field__attached-row"
183
+ ].filter(Boolean).join(" "),
170
184
  children: [/* @__PURE__ */ jsx("input", {
171
185
  ...inputProps,
172
186
  ref: (el) => {
@@ -194,7 +208,7 @@ const InlineWriteOnly = ({ clearable, componentKey, field, generate, hintPath, m
194
208
  * editor, with clear and undo beside it on the label line, exactly where the
195
209
  * masked eye sits.
196
210
  */
197
- const StructuralWriteOnly = ({ clearable, field, maskDots, Native, nativeProps, path, setPath }) => {
211
+ const StructuralWriteOnly = ({ clearable, field, maskDots, Native, nativeProps, path, readOnly, setPath }) => {
198
212
  const { t } = useTranslation$1();
199
213
  const { setValue, value } = useField({ path });
200
214
  const isSet = useFormFields(([fields]) => fields?.[setPath]?.value === true);
@@ -244,7 +258,11 @@ const StructuralWriteOnly = ({ clearable, field, maskDots, Native, nativeProps,
244
258
  children: [
245
259
  /* @__PURE__ */ jsx(FieldError, { path }),
246
260
  /* @__PURE__ */ jsx("div", {
247
- className: "tenx-protected-field__wo-face-box",
261
+ className: [
262
+ "form-input",
263
+ "tenx-protected-field__wo-face-box",
264
+ readOnly && "tenx-protected-field__wo-face-box--disabled"
265
+ ].filter(Boolean).join(" "),
248
266
  children: mode === "cleared" ? /* @__PURE__ */ jsx("span", {
249
267
  className: "tenx-protected-field__wo-face-msg",
250
268
  children: t(keys.clearedOnSave)
@@ -263,11 +281,11 @@ const StructuralWriteOnly = ({ clearable, field, maskDots, Native, nativeProps,
263
281
  })]
264
282
  }), /* @__PURE__ */ jsx("div", {
265
283
  className: "tenx-protected-field__eye-wrap tenx-protected-field__eye-wrap--label-row",
266
- children: mode === "cleared" ? /* @__PURE__ */ jsx(ActionButton, {
284
+ children: readOnly ? null : mode === "cleared" ? /* @__PURE__ */ jsx(ActionButton, {
267
285
  kind: "undo",
268
286
  label: t(keys.undoClear),
269
287
  onClick: undoClear
270
- }) : /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(ActionButton, {
288
+ }) : /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(ActionButton, {
271
289
  kind: "edit",
272
290
  label: t(keys.replaceValue),
273
291
  onClick: toggleEdit,
@@ -1 +1 @@
1
- {"version":3,"file":"WriteOnlyField.js","names":["useTranslation"],"sources":["../../../../src/fields/encrypted/components/WriteOnlyField.tsx"],"sourcesContent":["'use client'\nimport {\n\tFieldDescription,\n\tFieldError,\n\tFieldLabel,\n\tuseDocumentEvents,\n\tuseField,\n\tuseFormFields,\n\tuseFormSubmitted,\n} from '@payloadcms/ui'\nimport { mergeFieldStyles } from '@payloadcms/ui/shared'\nimport type React from 'react'\nimport { useCallback, useEffect, useMemo, useRef, useState } from 'react'\nimport { keys } from '../../../translations/keys'\nimport { useTranslation } from '../../../translations/useTranslation'\nimport { generateSecret, type NormalizedGenerate } from '../generateSecret'\nimport { formatHint } from '../hint'\nimport { dotString } from './MaskDots'\nimport type { EncryptedFieldConfig, Placement } from './placement'\nimport { ActionButton } from './WriteOnlyActions'\nimport { applyBlur, applyClear, applyInput, applySave, applyUndo } from './writeOnlyIntent'\n\ntype NativeComponent = React.ComponentType<Record<string, unknown>>\n\nexport interface WriteOnlyFieldProps {\n\tclearable: boolean\n\tcomponentKey: string\n\tfield: EncryptedFieldConfig\n\tgenerate?: NormalizedGenerate\n\thintPath: string\n\tmaskDots: number\n\tNative: NativeComponent\n\tnativeProps: Record<string, unknown>\n\tpath: string\n\tplacement: Placement\n\tsetPath: string\n}\n\n/**\n * Editor for `protection: 'writeOnly'`. The plaintext never reaches the client\n * (reads strip the field), so there is nothing to reveal and nothing to bind:\n * the control is one always-editable input. A stored value shows as a\n * placeholder (the identification hint when configured, dots otherwise), typing\n * stages a replacement that stays visible until save (the reveal-once window\n * for generated secrets), and emptying the input reverts to keeping the stored\n * value. Clear is the isClearable × inside the input; an undo arrow follows a\n * clear because the cleared secret cannot be retyped from memory. Every action\n * lives inside the input row (or the label row for structural types), so the\n * field never grows past its native height.\n */\nexport const WriteOnlyField: React.FC<WriteOnlyFieldProps> = (props) => {\n\tif (props.placement === 'label-row') {\n\t\treturn <StructuralWriteOnly {...props} />\n\t}\n\treturn <InlineWriteOnly {...props} />\n}\n\nconst InlineWriteOnly: React.FC<WriteOnlyFieldProps> = ({\n\tclearable,\n\tcomponentKey,\n\tfield,\n\tgenerate,\n\thintPath,\n\tmaskDots,\n\tpath,\n\tplacement,\n\tsetPath,\n}) => {\n\tconst { t } = useTranslation()\n\tconst { setValue, value } = useField<unknown>({ path })\n\tconst isSet = useFormFields(([fields]) => fields?.[setPath]?.value === true)\n\tconst hint = useFormFields(([fields]) => {\n\t\tconst stored = fields?.[hintPath]?.value\n\t\treturn typeof stored === 'string' && stored.length > 0 ? stored : undefined\n\t})\n\tconst submitted = useFormSubmitted()\n\tconst invalid = useFormFields(([fields]) => fields?.[path]?.valid === false)\n\tconst showFieldError = submitted && invalid\n\tconst [cleared, setCleared] = useState(false)\n\tconst inputRef = useRef<HTMLInputElement | HTMLTextAreaElement | null>(null)\n\n\t// A successful save ends the reveal-once window: the staged plaintext (typed\n\t// or generated) is dropped and the field returns to its concealed face\n\t// immediately, not on the next page load. The edit view fires reportUpdate\n\t// only on success, so a failed save keeps the user's input. This write is\n\t// housekeeping, not an edit: disableModifyingForm keeps it from re-dirtying\n\t// the form Payload just marked clean, which would resurrect the\n\t// leave-without-saving warning on every navigation after a save.\n\tconst { mostRecentUpdate } = useDocumentEvents()\n\tconst lastUpdateAt = useRef(mostRecentUpdate?.updatedAt)\n\tuseEffect(() => {\n\t\tif (!mostRecentUpdate?.updatedAt || mostRecentUpdate.updatedAt === lastUpdateAt.current) {\n\t\t\treturn\n\t\t}\n\t\tlastUpdateAt.current = mostRecentUpdate.updatedAt\n\t\tconst resolved = applySave()\n\t\tsetValue(resolved.value, true)\n\t\tsetCleared(resolved.cleared)\n\t}, [mostRecentUpdate?.updatedAt, setValue])\n\n\tconst isNumber = componentKey === 'number'\n\tconst typed = isNumber ? typeof value === 'number' : typeof value === 'string' && value !== ''\n\n\tconst commit = useCallback(\n\t\t(outcome: { cleared: boolean; value: unknown }) => {\n\t\t\tsetValue(outcome.value)\n\t\t\tsetCleared(outcome.cleared)\n\t\t},\n\t\t[setValue]\n\t)\n\n\tconst handleChange = useCallback(\n\t\t(event: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement>) => {\n\t\t\tcommit(applyInput(event.target.value, { cleared, isNumber }))\n\t\t},\n\t\t[cleared, commit, isNumber]\n\t)\n\n\tconst handleBlur = useCallback(() => {\n\t\tconst outcome = applyBlur(value, { cleared, isNumber })\n\t\tif (outcome) {\n\t\t\tcommit(outcome)\n\t\t}\n\t}, [cleared, commit, isNumber, value])\n\n\tconst handleClear = useCallback(() => {\n\t\tconst outcome = applyClear({ cleared, clearable, isSet, typed })\n\t\tif (outcome) {\n\t\t\tcommit(outcome)\n\t\t}\n\t}, [cleared, clearable, commit, isSet, typed])\n\n\tconst handleUndo = useCallback(() => {\n\t\tcommit(applyUndo())\n\t}, [commit])\n\n\tconst runGenerate = useCallback(async () => {\n\t\tif (!generate) return\n\t\tcommit({ cleared: false, value: await generateSecret(generate) })\n\t\t// Select the fresh secret so the reveal-once window is one Cmd+C away.\n\t\trequestAnimationFrame(() => {\n\t\t\tinputRef.current?.focus()\n\t\t\tinputRef.current?.select?.()\n\t\t})\n\t}, [commit, generate])\n\n\t// Three unmistakable staged states: concealed face (text-colored hint/dots)\n\t// means keep, visible plaintext means replace, and the muted removal notice\n\t// means clear. Erasing typed text returns to whichever of the first and\n\t// last the user was in when they started typing.\n\tconst placeholder = typed\n\t\t? undefined\n\t\t: cleared\n\t\t\t? t(keys.clearedOnSave)\n\t\t\t: !isSet\n\t\t\t\t? typeof field.admin?.placeholder === 'string'\n\t\t\t\t\t? field.admin.placeholder\n\t\t\t\t\t: undefined\n\t\t\t\t: hint\n\t\t\t\t\t? formatHint(hint, maskDots)\n\t\t\t\t\t: dotString(maskDots)\n\n\tconst showClear = typed || (clearable && isSet && !cleared)\n\tconst inputId = `field-${path.replace(/\\./g, '__')}`\n\tconst displayValue = typed ? String(value) : ''\n\n\tconst actions = (\n\t\t<>\n\t\t\t{generate ? (\n\t\t\t\t<ActionButton\n\t\t\t\t\tattached={placement === 'attached'}\n\t\t\t\t\tkind=\"generate\"\n\t\t\t\t\tlabel={t(keys.generateValue)}\n\t\t\t\t\tonClick={runGenerate}\n\t\t\t\t/>\n\t\t\t) : null}\n\t\t\t{cleared && !typed ? (\n\t\t\t\t<ActionButton\n\t\t\t\t\tattached={placement === 'attached'}\n\t\t\t\t\tkind=\"undo\"\n\t\t\t\t\tlabel={t(keys.undoClear)}\n\t\t\t\t\tonClick={handleUndo}\n\t\t\t\t/>\n\t\t\t) : showClear ? (\n\t\t\t\t<ActionButton\n\t\t\t\t\tattached={placement === 'attached'}\n\t\t\t\t\tkind=\"clear\"\n\t\t\t\t\tlabel={t(keys.clearValue)}\n\t\t\t\t\tonClick={handleClear}\n\t\t\t\t/>\n\t\t\t) : null}\n\t\t</>\n\t)\n\n\t// A custom Field component short-circuits the path where Payload applies\n\t// admin.width and admin.style, so the field has to carry them itself.\n\tconst styles = useMemo(() => mergeFieldStyles(field), [field])\n\tconst isTextarea = componentKey === 'textarea'\n\tconst inputProps = {\n\t\tautoComplete: 'off',\n\t\tclassName: [\n\t\t\t'tenx-protected-field__wo-input',\n\t\t\t!typed && isSet && !cleared && 'tenx-protected-field__wo-input--set',\n\t\t]\n\t\t\t.filter(Boolean)\n\t\t\t.join(' '),\n\t\tid: inputId,\n\t\tname: path,\n\t\tonBlur: handleBlur,\n\t\tonChange: handleChange,\n\t\tplaceholder,\n\t\tvalue: displayValue,\n\t}\n\n\treturn (\n\t\t<div\n\t\t\tclassName={[\n\t\t\t\t'field-type',\n\t\t\t\tcomponentKey,\n\t\t\t\tshowFieldError && 'error',\n\t\t\t\t'tenx-protected-field',\n\t\t\t\tplacement === 'attached'\n\t\t\t\t\t? 'tenx-protected-field--attached'\n\t\t\t\t\t: 'tenx-protected-field--corner',\n\t\t\t]\n\t\t\t\t.filter(Boolean)\n\t\t\t\t.join(' ')}\n\t\t\tstyle={styles}\n\t\t>\n\t\t\t<FieldLabel\n\t\t\t\tlabel={field.label}\n\t\t\t\tlocalized={field.localized}\n\t\t\t\tpath={path}\n\t\t\t\trequired={field.required}\n\t\t\t/>\n\t\t\t<div className=\"field-type__wrap\">\n\t\t\t\t<FieldError path={path} />\n\t\t\t\t{isTextarea ? (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<textarea\n\t\t\t\t\t\t\t{...inputProps}\n\t\t\t\t\t\t\tref={(el) => {\n\t\t\t\t\t\t\t\tinputRef.current = el\n\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\trows={field.admin?.rows ?? 4}\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<div className=\"tenx-protected-field__eye-wrap tenx-protected-field__eye-wrap--corner tenx-protected-field__actions--corner\">\n\t\t\t\t\t\t\t{actions}\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</>\n\t\t\t\t) : (\n\t\t\t\t\t<div className=\"tenx-protected-field__attached-row\">\n\t\t\t\t\t\t<input\n\t\t\t\t\t\t\t{...inputProps}\n\t\t\t\t\t\t\tref={(el) => {\n\t\t\t\t\t\t\t\tinputRef.current = el\n\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\tinputMode={isNumber ? 'decimal' : undefined}\n\t\t\t\t\t\t\ttype={isNumber ? 'number' : componentKey === 'email' && typed ? 'email' : 'text'}\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<div className=\"tenx-protected-field__eye-wrap tenx-protected-field__eye-wrap--attached\">\n\t\t\t\t\t\t\t{actions}\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t)}\n\t\t\t\t<FieldDescription description={field.admin?.description} path={path} />\n\t\t\t</div>\n\t\t</div>\n\t)\n}\n\n/**\n * Label-row variant for structural types (date, select, checkbox, code, json,\n * point, radio, and any hasMany surface): these have no single-line input to\n * type into, so replace goes through a pencil that mounts the real native\n * editor, with clear and undo beside it on the label line, exactly where the\n * masked eye sits.\n */\nconst StructuralWriteOnly: React.FC<WriteOnlyFieldProps> = ({\n\tclearable,\n\tfield,\n\tmaskDots,\n\tNative,\n\tnativeProps,\n\tpath,\n\tsetPath,\n}) => {\n\tconst { t } = useTranslation()\n\tconst { setValue, value } = useField<unknown>({ path })\n\tconst isSet = useFormFields(([fields]) => fields?.[setPath]?.value === true)\n\tconst [mode, setMode] = useState<'cleared' | 'editing' | 'idle'>('idle')\n\t// The concealed face stands in for the native field, so it has to carry the\n\t// same width; without it the field would change width as the mode changes.\n\tconst styles = useMemo(() => mergeFieldStyles(field), [field])\n\n\t// Mirror of the inline variant's save-conceal: a successful save drops any\n\t// staged edit and folds the field back to its concealed face, without\n\t// re-dirtying the form Payload just marked clean (disableModifyingForm).\n\tconst { mostRecentUpdate } = useDocumentEvents()\n\tconst lastUpdateAt = useRef(mostRecentUpdate?.updatedAt)\n\tuseEffect(() => {\n\t\tif (!mostRecentUpdate?.updatedAt || mostRecentUpdate.updatedAt === lastUpdateAt.current) {\n\t\t\treturn\n\t\t}\n\t\tlastUpdateAt.current = mostRecentUpdate.updatedAt\n\t\tsetValue(undefined, true)\n\t\tsetMode('idle')\n\t}, [mostRecentUpdate?.updatedAt, setValue])\n\n\tconst toggleEdit = useCallback(() => {\n\t\tif (mode === 'editing') {\n\t\t\t// Discard only what was staged: cancelling an untouched editor must not\n\t\t\t// mark the form modified.\n\t\t\tif (value !== undefined) {\n\t\t\t\tsetValue(undefined)\n\t\t\t}\n\t\t\tsetMode('idle')\n\t\t\treturn\n\t\t}\n\t\tsetMode('editing')\n\t}, [mode, setValue, value])\n\n\tconst clear = useCallback(() => {\n\t\tsetValue(null)\n\t\tsetMode('cleared')\n\t}, [setValue])\n\n\tconst undoClear = useCallback(() => {\n\t\tsetValue(undefined)\n\t\tsetMode('idle')\n\t}, [setValue])\n\n\tif (!isSet) {\n\t\treturn <Native {...nativeProps} />\n\t}\n\n\treturn (\n\t\t<div className=\"tenx-protected-field tenx-protected-field--label-row\">\n\t\t\t{mode === 'editing' ? (\n\t\t\t\t<Native {...nativeProps} />\n\t\t\t) : (\n\t\t\t\t<div className=\"field-type tenx-protected-field__wo-face\" style={styles}>\n\t\t\t\t\t<FieldLabel\n\t\t\t\t\t\tlabel={field.label}\n\t\t\t\t\t\tlocalized={field.localized}\n\t\t\t\t\t\tpath={path}\n\t\t\t\t\t\trequired={field.required}\n\t\t\t\t\t/>\n\t\t\t\t\t<div className=\"field-type__wrap\">\n\t\t\t\t\t\t<FieldError path={path} />\n\t\t\t\t\t\t<div className=\"tenx-protected-field__wo-face-box\">\n\t\t\t\t\t\t\t{mode === 'cleared' ? (\n\t\t\t\t\t\t\t\t<span className=\"tenx-protected-field__wo-face-msg\">{t(keys.clearedOnSave)}</span>\n\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\t<span\n\t\t\t\t\t\t\t\t\taria-label={t(keys.writeOnlyValue)}\n\t\t\t\t\t\t\t\t\tclassName=\"tenx-protected-field__dots\"\n\t\t\t\t\t\t\t\t\trole=\"img\"\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{dotString(maskDots)}\n\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<FieldDescription description={field.admin?.description} path={path} />\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t)}\n\t\t\t<div className=\"tenx-protected-field__eye-wrap tenx-protected-field__eye-wrap--label-row\">\n\t\t\t\t{mode === 'cleared' ? (\n\t\t\t\t\t<ActionButton kind=\"undo\" label={t(keys.undoClear)} onClick={undoClear} />\n\t\t\t\t) : (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<ActionButton\n\t\t\t\t\t\t\tkind=\"edit\"\n\t\t\t\t\t\t\tlabel={t(keys.replaceValue)}\n\t\t\t\t\t\t\tonClick={toggleEdit}\n\t\t\t\t\t\t\tpressed={mode === 'editing'}\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t{clearable && mode !== 'editing' ? (\n\t\t\t\t\t\t\t<ActionButton kind=\"clear\" label={t(keys.clearValue)} onClick={clear} />\n\t\t\t\t\t\t) : null}\n\t\t\t\t\t</>\n\t\t\t\t)}\n\t\t\t</div>\n\t\t</div>\n\t)\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAkDA,MAAa,kBAAiD,UAAU;CACvE,IAAI,MAAM,cAAc,aACvB,OAAO,oBAAC,qBAAD,EAAqB,GAAI,MAAQ,CAAA;CAEzC,OAAO,oBAAC,iBAAD,EAAi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BAAC,YAAD;IACC,OAAO,MAAM;IACb,WAAW,MAAM;IACX;IACN,UAAU,MAAM;GAChB,CAAA,GACD,qBAAC,OAAD;IAAK,WAAU;cAAf;KACC,oBAAC,YAAD,EAAkB,KAAO,CAAA;KACzB,oBAAC,OAAD;MAAK,WAAU;gBACb,SAAS,YACT,oBAAC,QAAD;OAAM,WAAU;iBAAqC,EAAE,KAAK,aAAa;MAAQ,CAAA,IAEjF,oBAAC,QAAD;OACC,cAAY,EAAE,KAAK,cAAc;OACjC,WAAU;OACV,MAAK;iBAEJ,UAAU,QAAQ;MACd,CAAA;KAEH,CAAA;KACL,oBAAC,kBAAD;MAAkB,aAAa,MAAM,OAAO;MAAmB;KAAO,CAAA;IAClE;KACD;MAEN,oBAAC,OAAD;GAAK,WAAU;aACb,SAAS,YACT,oBAAC,cAAD;IAAc,MAAK;IAAO,OAAO,EAAE,KAAK,SAAS;IAAG,SAAS;GAAY,CAAA,IAEzE,qBAAA,YAAA,EAAA,UAAA,CACC,oBAAC,cAAD;IACC,MAAK;IACL,OAAO,EAAE,KAAK,YAAY;IAC1B,SAAS;IACT,SAAS,SAAS;GAClB,CAAA,GACA,aAAa,SAAS,YACtB,oBAAC,cAAD;IAAc,MAAK;IAAQ,OAAO,EAAE,KAAK,UAAU;IAAG,SAAS;GAAQ,CAAA,IACpE,IACH,EAAA,CAAA;EAEC,CAAA,CACD;;AAEP"}
1
+ {"version":3,"file":"WriteOnlyField.js","names":["useTranslation"],"sources":["../../../../src/fields/encrypted/components/WriteOnlyField.tsx"],"sourcesContent":["'use client'\nimport {\n\tFieldDescription,\n\tFieldError,\n\tFieldLabel,\n\tuseDocumentEvents,\n\tuseField,\n\tuseFormFields,\n\tuseFormSubmitted,\n} from '@payloadcms/ui'\nimport { mergeFieldStyles } from '@payloadcms/ui/shared'\nimport type React from 'react'\nimport { useCallback, useEffect, useMemo, useRef, useState } from 'react'\nimport { keys } from '../../../translations/keys'\nimport { useTranslation } from '../../../translations/useTranslation'\nimport { generateSecret, type NormalizedGenerate } from '../generateSecret'\nimport { formatHint } from '../hint'\nimport { dotString } from './MaskDots'\nimport type { EncryptedFieldConfig, Placement } from './placement'\nimport { ActionButton } from './WriteOnlyActions'\nimport { applyBlur, applyClear, applyInput, applySave, applyUndo } from './writeOnlyIntent'\n\ntype NativeComponent = React.ComponentType<Record<string, unknown>>\n\nexport interface WriteOnlyFieldProps {\n\tclearable: boolean\n\tcomponentKey: string\n\tfield: EncryptedFieldConfig\n\tgenerate?: NormalizedGenerate\n\thintPath: string\n\tmaskDots: number\n\tNative: NativeComponent\n\tnativeProps: Record<string, unknown>\n\tpath: string\n\tplacement: Placement\n\treadOnly?: boolean\n\tsetPath: string\n}\n\n/**\n * Editor for `protection: 'writeOnly'`. The plaintext never reaches the client\n * (reads strip the field), so there is nothing to reveal and nothing to bind:\n * the control is one always-editable input. A stored value shows as a\n * placeholder (the identification hint when configured, dots otherwise), typing\n * stages a replacement that stays visible until save (the reveal-once window\n * for generated secrets), and emptying the input reverts to keeping the stored\n * value. Clear is the isClearable × inside the input; an undo arrow follows a\n * clear because the cleared secret cannot be retyped from memory. Every action\n * lives inside the input row (or the label row for structural types), so the\n * field never grows past its native height. Read-only disables the input and\n * drops every action, as a native read-only field offers no edit affordance.\n */\nexport const WriteOnlyField: React.FC<WriteOnlyFieldProps> = (props) => {\n\tif (props.placement === 'label-row') {\n\t\treturn <StructuralWriteOnly {...props} />\n\t}\n\treturn <InlineWriteOnly {...props} />\n}\n\nconst InlineWriteOnly: React.FC<WriteOnlyFieldProps> = ({\n\tclearable,\n\tcomponentKey,\n\tfield,\n\tgenerate,\n\thintPath,\n\tmaskDots,\n\tpath,\n\tplacement,\n\treadOnly,\n\tsetPath,\n}) => {\n\tconst { t } = useTranslation()\n\tconst { setValue, value } = useField<unknown>({ path })\n\tconst isSet = useFormFields(([fields]) => fields?.[setPath]?.value === true)\n\tconst hint = useFormFields(([fields]) => {\n\t\tconst stored = fields?.[hintPath]?.value\n\t\treturn typeof stored === 'string' && stored.length > 0 ? stored : undefined\n\t})\n\tconst submitted = useFormSubmitted()\n\tconst invalid = useFormFields(([fields]) => fields?.[path]?.valid === false)\n\tconst showFieldError = submitted && invalid\n\tconst [cleared, setCleared] = useState(false)\n\tconst inputRef = useRef<HTMLInputElement | HTMLTextAreaElement | null>(null)\n\n\t// A successful save ends the reveal-once window: the staged plaintext (typed\n\t// or generated) is dropped and the field returns to its concealed face\n\t// immediately, not on the next page load. The edit view fires reportUpdate\n\t// only on success, so a failed save keeps the user's input. This write is\n\t// housekeeping, not an edit: disableModifyingForm keeps it from re-dirtying\n\t// the form Payload just marked clean, which would resurrect the\n\t// leave-without-saving warning on every navigation after a save.\n\tconst { mostRecentUpdate } = useDocumentEvents()\n\tconst lastUpdateAt = useRef(mostRecentUpdate?.updatedAt)\n\tuseEffect(() => {\n\t\tif (!mostRecentUpdate?.updatedAt || mostRecentUpdate.updatedAt === lastUpdateAt.current) {\n\t\t\treturn\n\t\t}\n\t\tlastUpdateAt.current = mostRecentUpdate.updatedAt\n\t\tconst resolved = applySave()\n\t\tsetValue(resolved.value, true)\n\t\tsetCleared(resolved.cleared)\n\t}, [mostRecentUpdate?.updatedAt, setValue])\n\n\tconst isNumber = componentKey === 'number'\n\tconst typed = isNumber ? typeof value === 'number' : typeof value === 'string' && value !== ''\n\n\tconst commit = useCallback(\n\t\t(outcome: { cleared: boolean; value: unknown }) => {\n\t\t\tsetValue(outcome.value)\n\t\t\tsetCleared(outcome.cleared)\n\t\t},\n\t\t[setValue]\n\t)\n\n\tconst handleChange = useCallback(\n\t\t(event: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement>) => {\n\t\t\tcommit(applyInput(event.target.value, { cleared, isNumber }))\n\t\t},\n\t\t[cleared, commit, isNumber]\n\t)\n\n\tconst handleBlur = useCallback(() => {\n\t\tconst outcome = applyBlur(value, { cleared, isNumber })\n\t\tif (outcome) {\n\t\t\tcommit(outcome)\n\t\t}\n\t}, [cleared, commit, isNumber, value])\n\n\tconst handleClear = useCallback(() => {\n\t\tconst outcome = applyClear({ cleared, clearable, isSet, typed })\n\t\tif (outcome) {\n\t\t\tcommit(outcome)\n\t\t}\n\t}, [cleared, clearable, commit, isSet, typed])\n\n\tconst handleUndo = useCallback(() => {\n\t\tcommit(applyUndo())\n\t}, [commit])\n\n\tconst runGenerate = useCallback(async () => {\n\t\tif (!generate) return\n\t\tcommit({ cleared: false, value: await generateSecret(generate) })\n\t\t// Select the fresh secret so the reveal-once window is one Cmd+C away.\n\t\trequestAnimationFrame(() => {\n\t\t\tinputRef.current?.focus()\n\t\t\tinputRef.current?.select?.()\n\t\t})\n\t}, [commit, generate])\n\n\t// Three unmistakable staged states: concealed face (text-colored hint/dots)\n\t// means keep, visible plaintext means replace, and the muted removal notice\n\t// means clear. Erasing typed text returns to whichever of the first and\n\t// last the user was in when they started typing.\n\tconst placeholder = typed\n\t\t? undefined\n\t\t: cleared\n\t\t\t? t(keys.clearedOnSave)\n\t\t\t: !isSet\n\t\t\t\t? typeof field.admin?.placeholder === 'string'\n\t\t\t\t\t? field.admin.placeholder\n\t\t\t\t\t: undefined\n\t\t\t\t: hint\n\t\t\t\t\t? formatHint(hint, maskDots)\n\t\t\t\t\t: dotString(maskDots)\n\n\tconst showClear = typed || (clearable && isSet && !cleared)\n\tconst inputId = `field-${path.replace(/\\./g, '__')}`\n\tconst displayValue = typed ? String(value) : ''\n\n\tconst actions = readOnly ? null : (\n\t\t<>\n\t\t\t{generate ? (\n\t\t\t\t<ActionButton\n\t\t\t\t\tattached={placement === 'attached'}\n\t\t\t\t\tkind=\"generate\"\n\t\t\t\t\tlabel={t(keys.generateValue)}\n\t\t\t\t\tonClick={runGenerate}\n\t\t\t\t/>\n\t\t\t) : null}\n\t\t\t{cleared && !typed ? (\n\t\t\t\t<ActionButton\n\t\t\t\t\tattached={placement === 'attached'}\n\t\t\t\t\tkind=\"undo\"\n\t\t\t\t\tlabel={t(keys.undoClear)}\n\t\t\t\t\tonClick={handleUndo}\n\t\t\t\t/>\n\t\t\t) : showClear ? (\n\t\t\t\t<ActionButton\n\t\t\t\t\tattached={placement === 'attached'}\n\t\t\t\t\tkind=\"clear\"\n\t\t\t\t\tlabel={t(keys.clearValue)}\n\t\t\t\t\tonClick={handleClear}\n\t\t\t\t/>\n\t\t\t) : null}\n\t\t</>\n\t)\n\n\t// A custom Field component short-circuits the path where Payload applies\n\t// admin.width and admin.style, so the field has to carry them itself.\n\tconst styles = useMemo(() => mergeFieldStyles(field), [field])\n\tconst isTextarea = componentKey === 'textarea'\n\tconst inputProps = {\n\t\tautoComplete: 'off',\n\t\tclassName: [\n\t\t\t'form-input',\n\t\t\t'tenx-protected-field__wo-input',\n\t\t\t!typed && isSet && !cleared && 'tenx-protected-field__wo-input--set',\n\t\t]\n\t\t\t.filter(Boolean)\n\t\t\t.join(' '),\n\t\tdisabled: readOnly,\n\t\tid: inputId,\n\t\tname: path,\n\t\tonBlur: handleBlur,\n\t\tonChange: handleChange,\n\t\tplaceholder,\n\t\tvalue: displayValue,\n\t}\n\n\treturn (\n\t\t<div\n\t\t\tclassName={[\n\t\t\t\t'field-type',\n\t\t\t\tcomponentKey,\n\t\t\t\tshowFieldError && 'error',\n\t\t\t\t'tenx-protected-field',\n\t\t\t\tplacement === 'attached'\n\t\t\t\t\t? 'tenx-protected-field--attached'\n\t\t\t\t\t: 'tenx-protected-field--corner',\n\t\t\t\treadOnly && 'read-only',\n\t\t\t]\n\t\t\t\t.filter(Boolean)\n\t\t\t\t.join(' ')}\n\t\t\tstyle={styles}\n\t\t>\n\t\t\t<FieldLabel\n\t\t\t\tlabel={field.label}\n\t\t\t\tlocalized={field.localized}\n\t\t\t\tpath={path}\n\t\t\t\trequired={field.required}\n\t\t\t/>\n\t\t\t<div className=\"field-type__wrap\">\n\t\t\t\t<FieldError path={path} />\n\t\t\t\t{isTextarea ? (\n\t\t\t\t\t<div className=\"textarea-outer\">\n\t\t\t\t\t\t<textarea\n\t\t\t\t\t\t\t{...inputProps}\n\t\t\t\t\t\t\tref={(el) => {\n\t\t\t\t\t\t\t\tinputRef.current = el\n\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\trows={field.admin?.rows ?? 4}\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<div className=\"tenx-protected-field__eye-wrap tenx-protected-field__eye-wrap--corner tenx-protected-field__actions--corner\">\n\t\t\t\t\t\t\t{actions}\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t) : (\n\t\t\t\t\t<div\n\t\t\t\t\t\tclassName={[\n\t\t\t\t\t\t\t'form-input-group',\n\t\t\t\t\t\t\tshowFieldError && 'form-input-group-error',\n\t\t\t\t\t\t\t'tenx-protected-field__attached-row',\n\t\t\t\t\t\t]\n\t\t\t\t\t\t\t.filter(Boolean)\n\t\t\t\t\t\t\t.join(' ')}\n\t\t\t\t\t>\n\t\t\t\t\t\t<input\n\t\t\t\t\t\t\t{...inputProps}\n\t\t\t\t\t\t\tref={(el) => {\n\t\t\t\t\t\t\t\tinputRef.current = el\n\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\tinputMode={isNumber ? 'decimal' : undefined}\n\t\t\t\t\t\t\ttype={isNumber ? 'number' : componentKey === 'email' && typed ? 'email' : 'text'}\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<div className=\"tenx-protected-field__eye-wrap tenx-protected-field__eye-wrap--attached\">\n\t\t\t\t\t\t\t{actions}\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t)}\n\t\t\t\t<FieldDescription description={field.admin?.description} path={path} />\n\t\t\t</div>\n\t\t</div>\n\t)\n}\n\n/**\n * Label-row variant for structural types (date, select, checkbox, code, json,\n * point, radio, and any hasMany surface): these have no single-line input to\n * type into, so replace goes through a pencil that mounts the real native\n * editor, with clear and undo beside it on the label line, exactly where the\n * masked eye sits.\n */\nconst StructuralWriteOnly: React.FC<WriteOnlyFieldProps> = ({\n\tclearable,\n\tfield,\n\tmaskDots,\n\tNative,\n\tnativeProps,\n\tpath,\n\treadOnly,\n\tsetPath,\n}) => {\n\tconst { t } = useTranslation()\n\tconst { setValue, value } = useField<unknown>({ path })\n\tconst isSet = useFormFields(([fields]) => fields?.[setPath]?.value === true)\n\tconst [mode, setMode] = useState<'cleared' | 'editing' | 'idle'>('idle')\n\t// The concealed face stands in for the native field, so it has to carry the\n\t// same width; without it the field would change width as the mode changes.\n\tconst styles = useMemo(() => mergeFieldStyles(field), [field])\n\n\t// Mirror of the inline variant's save-conceal: a successful save drops any\n\t// staged edit and folds the field back to its concealed face, without\n\t// re-dirtying the form Payload just marked clean (disableModifyingForm).\n\tconst { mostRecentUpdate } = useDocumentEvents()\n\tconst lastUpdateAt = useRef(mostRecentUpdate?.updatedAt)\n\tuseEffect(() => {\n\t\tif (!mostRecentUpdate?.updatedAt || mostRecentUpdate.updatedAt === lastUpdateAt.current) {\n\t\t\treturn\n\t\t}\n\t\tlastUpdateAt.current = mostRecentUpdate.updatedAt\n\t\tsetValue(undefined, true)\n\t\tsetMode('idle')\n\t}, [mostRecentUpdate?.updatedAt, setValue])\n\n\tconst toggleEdit = useCallback(() => {\n\t\tif (mode === 'editing') {\n\t\t\t// Discard only what was staged: cancelling an untouched editor must not\n\t\t\t// mark the form modified.\n\t\t\tif (value !== undefined) {\n\t\t\t\tsetValue(undefined)\n\t\t\t}\n\t\t\tsetMode('idle')\n\t\t\treturn\n\t\t}\n\t\tsetMode('editing')\n\t}, [mode, setValue, value])\n\n\tconst clear = useCallback(() => {\n\t\tsetValue(null)\n\t\tsetMode('cleared')\n\t}, [setValue])\n\n\tconst undoClear = useCallback(() => {\n\t\tsetValue(undefined)\n\t\tsetMode('idle')\n\t}, [setValue])\n\n\tif (!isSet) {\n\t\treturn <Native {...nativeProps} />\n\t}\n\n\treturn (\n\t\t<div className=\"tenx-protected-field tenx-protected-field--label-row\">\n\t\t\t{mode === 'editing' ? (\n\t\t\t\t<Native {...nativeProps} />\n\t\t\t) : (\n\t\t\t\t<div className=\"field-type tenx-protected-field__wo-face\" style={styles}>\n\t\t\t\t\t<FieldLabel\n\t\t\t\t\t\tlabel={field.label}\n\t\t\t\t\t\tlocalized={field.localized}\n\t\t\t\t\t\tpath={path}\n\t\t\t\t\t\trequired={field.required}\n\t\t\t\t\t/>\n\t\t\t\t\t<div className=\"field-type__wrap\">\n\t\t\t\t\t\t<FieldError path={path} />\n\t\t\t\t\t\t<div\n\t\t\t\t\t\t\tclassName={[\n\t\t\t\t\t\t\t\t'form-input',\n\t\t\t\t\t\t\t\t'tenx-protected-field__wo-face-box',\n\t\t\t\t\t\t\t\treadOnly && 'tenx-protected-field__wo-face-box--disabled',\n\t\t\t\t\t\t\t]\n\t\t\t\t\t\t\t\t.filter(Boolean)\n\t\t\t\t\t\t\t\t.join(' ')}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{mode === 'cleared' ? (\n\t\t\t\t\t\t\t\t<span className=\"tenx-protected-field__wo-face-msg\">{t(keys.clearedOnSave)}</span>\n\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\t<span\n\t\t\t\t\t\t\t\t\taria-label={t(keys.writeOnlyValue)}\n\t\t\t\t\t\t\t\t\tclassName=\"tenx-protected-field__dots\"\n\t\t\t\t\t\t\t\t\trole=\"img\"\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{dotString(maskDots)}\n\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<FieldDescription description={field.admin?.description} path={path} />\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t)}\n\t\t\t<div className=\"tenx-protected-field__eye-wrap tenx-protected-field__eye-wrap--label-row\">\n\t\t\t\t{readOnly ? null : mode === 'cleared' ? (\n\t\t\t\t\t<ActionButton kind=\"undo\" label={t(keys.undoClear)} onClick={undoClear} />\n\t\t\t\t) : (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<ActionButton\n\t\t\t\t\t\t\tkind=\"edit\"\n\t\t\t\t\t\t\tlabel={t(keys.replaceValue)}\n\t\t\t\t\t\t\tonClick={toggleEdit}\n\t\t\t\t\t\t\tpressed={mode === 'editing'}\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t{clearable && mode !== 'editing' ? (\n\t\t\t\t\t\t\t<ActionButton kind=\"clear\" label={t(keys.clearValue)} onClick={clear} />\n\t\t\t\t\t\t) : null}\n\t\t\t\t\t</>\n\t\t\t\t)}\n\t\t\t</div>\n\t\t</div>\n\t)\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAoDA,MAAa,kBAAiD,UAAU;CACvE,IAAI,MAAM,cAAc,aACvB,OAAO,oBAAC,qBAAD,EAAqB,GAAI,MAAQ,CAAA;CAEzC,OAAO,oBAAC,iBAAD,EAAiB,GAAI,MAAQ,CAAA;AACrC;AAEA,MAAM,mBAAkD,EACvD,WACA,cACA,OACA,UACA,UACA,UACA,MACA,WACA,UACA,cACK;CACL,MAAM,EAAE,MAAMA,iBAAe;CAC7B,MAAM,EAAE,UAAU,UAAU,SAAkB,EAAE,KAAK,CAAC;CACtD,MAAM,QAAQ,eAAe,CAAC,YAAY,SAAS,UAAU,UAAU,IAAI;CAC3E,MAAM,OAAO,eAAe,CAAC,YAAY;EACxC,MAAM,SAAS,SAAS,WAAW;EACnC,OAAO,OAAO,WAAW,YAAY,OAAO,SAAS,IAAI,SAAS,KAAA;CACnE,CAAC;CACD,MAAM,YAAY,iBAAiB;CACnC,MAAM,UAAU,eAAe,CAAC,YAAY,SAAS,OAAO,UAAU,KAAK;CAC3E,MAAM,iBAAiB,aAAa;CACpC,MAAM,CAAC,SAAS,cAAc,SAAS,KAAK;CAC5C,MAAM,WAAW,OAAsD,IAAI;CAS3E,MAAM,EAAE,qBAAqB,kBAAkB;CAC/C,MAAM,eAAe,OAAO,kBAAkB,SAAS;CACvD,gBAAgB;EACf,IAAI,CAAC,kBAAkB,aAAa,iBAAiB,cAAc,aAAa,SAC/E;E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AAS;IAAG,SAAS;GAAY,CAAA,IAEzE,qBAAA,UAAA,EAAA,UAAA,CACC,oBAAC,cAAD;IACC,MAAK;IACL,OAAO,EAAE,KAAK,YAAY;IAC1B,SAAS;IACT,SAAS,SAAS;GAClB,CAAA,GACA,aAAa,SAAS,YACtB,oBAAC,cAAD;IAAc,MAAK;IAAQ,OAAO,EAAE,KAAK,UAAU;IAAG,SAAS;GAAQ,CAAA,IACpE,IACH,EAAA,CAAA;EAEC,CAAA,CACD;;AAEP"}
@@ -1,33 +1,15 @@
1
1
  "use client";
2
2
  import { MaskDots, dotString } from "./MaskDots.js";
3
- import { CheckboxInput, FieldDescription, FieldError, FieldLabel } from "@payloadcms/ui";
3
+ import { CalendarIcon, CheckboxInput, ChevronIcon, FieldDescription, FieldError, FieldLabel, InputStepper, useTranslation } from "@payloadcms/ui";
4
4
  import { jsx, jsxs } from "react/jsx-runtime";
5
5
  //#region src/fields/encrypted/components/facsimiles.tsx
6
- const noToggle = () => void 0;
7
- /** Chevron matching react-select's dropdown indicator (inherits `.icon--chevron`). */
8
- const ChevronGlyph = () => /* @__PURE__ */ jsx("svg", {
9
- "aria-hidden": "true",
10
- className: "icon icon--chevron",
11
- viewBox: "0 0 20 20",
12
- xmlns: "http://www.w3.org/2000/svg",
13
- children: /* @__PURE__ */ jsx("path", {
14
- className: "stroke",
15
- d: "M14 8L10 12L6 8",
16
- strokeLinecap: "square"
17
- })
18
- });
19
- /** Calendar glyph matching the datepicker (inherits `.icon--calendar` position). */
20
- const CalendarGlyph = () => /* @__PURE__ */ jsx("svg", {
21
- "aria-hidden": "true",
22
- className: "icon icon--calendar",
23
- viewBox: "0 0 20 20",
24
- xmlns: "http://www.w3.org/2000/svg",
25
- children: /* @__PURE__ */ jsx("path", {
26
- className: "stroke",
27
- d: "M7.33333 3.33334V6M12.6667 3.33334V6M4 8.66667H16M5.33333 4.66667H14.6667C15.403 4.66667 16 5.26362 16 6V15.3333C16 16.0697 15.403 16.6667 14.6667 16.6667H5.33333C4.59695 16.6667 4 16.0697 4 15.3333V6C4 5.26362 4.59695 4.66667 5.33333 4.66667Z",
28
- strokeLinecap: "square"
29
- })
30
- });
6
+ const noop = () => void 0;
7
+ /** A static label in the admin's language, the way Payload's own fields resolve one. */
8
+ const labelText = (label, language) => {
9
+ if (typeof label === "string") return label;
10
+ if (!label) return "";
11
+ return label[language] ?? Object.values(label)[0] ?? "";
12
+ };
31
13
  const CheckboxFace = ({ field, path }) => /* @__PURE__ */ jsxs("div", {
32
14
  className: "field-type checkbox tenx-protected-field__face",
33
15
  children: [
@@ -36,7 +18,7 @@ const CheckboxFace = ({ field, path }) => /* @__PURE__ */ jsxs("div", {
36
18
  checked: false,
37
19
  label: field.label,
38
20
  name: path,
39
- onToggle: noToggle,
21
+ onToggle: noop,
40
22
  partialChecked: true,
41
23
  readOnly: true,
42
24
  required: field.required
@@ -49,6 +31,7 @@ const CheckboxFace = ({ field, path }) => /* @__PURE__ */ jsxs("div", {
49
31
  });
50
32
  const SelectFace = ({ field, maskDots, path }) => /* @__PURE__ */ jsxs("div", {
51
33
  className: "field-type select tenx-protected-field__face",
34
+ "data-size": "large",
52
35
  children: [
53
36
  /* @__PURE__ */ jsx(FieldLabel, {
54
37
  label: field.label,
@@ -59,19 +42,29 @@ const SelectFace = ({ field, maskDots, path }) => /* @__PURE__ */ jsxs("div", {
59
42
  /* @__PURE__ */ jsxs("div", {
60
43
  className: "field-type__wrap",
61
44
  children: [/* @__PURE__ */ jsx(FieldError, { path }), /* @__PURE__ */ jsx("div", {
62
- className: "react-select-container react-select",
63
- children: /* @__PURE__ */ jsxs("div", {
64
- className: "rs__control tenx-protected-field__rs-control",
65
- children: [/* @__PURE__ */ jsx("div", {
66
- className: "rs__value-container",
67
- children: /* @__PURE__ */ jsx(MaskDots, { count: maskDots })
68
- }), /* @__PURE__ */ jsx("div", {
69
- className: "rs__indicators",
70
- children: /* @__PURE__ */ jsx("span", {
71
- className: "rs__indicator rs__dropdown-indicator",
72
- children: /* @__PURE__ */ jsx(ChevronGlyph, {})
73
- })
74
- })]
45
+ className: "react-select-container",
46
+ children: /* @__PURE__ */ jsx("div", {
47
+ className: "react-select",
48
+ children: /* @__PURE__ */ jsxs("div", {
49
+ className: "rs__control tenx-protected-field__rs-control",
50
+ children: [/* @__PURE__ */ jsx("div", {
51
+ className: "value-container",
52
+ children: /* @__PURE__ */ jsx("div", {
53
+ className: "rs__value-container",
54
+ children: /* @__PURE__ */ jsx(MaskDots, { count: maskDots })
55
+ })
56
+ }), /* @__PURE__ */ jsxs("div", {
57
+ className: "rs__indicators",
58
+ children: [/* @__PURE__ */ jsx("span", { className: "rs__indicator-separator" }), /* @__PURE__ */ jsx("div", {
59
+ "aria-hidden": "true",
60
+ className: "dropdown-indicator",
61
+ children: /* @__PURE__ */ jsx(ChevronIcon, {
62
+ className: "dropdown-indicator__icon",
63
+ size: 16
64
+ })
65
+ })]
66
+ })]
67
+ })
75
68
  })
76
69
  })]
77
70
  }),
@@ -85,12 +78,12 @@ const RadioFace = ({ field, maskDots, path }) => /* @__PURE__ */ jsxs("div", {
85
78
  className: "field-type radio-group radio-group--layout-horizontal tenx-protected-field__face",
86
79
  children: [
87
80
  /* @__PURE__ */ jsx(FieldError, { path }),
88
- /* @__PURE__ */ jsx(FieldLabel, {
81
+ /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(FieldLabel, {
89
82
  label: field.label,
90
83
  localized: field.localized,
91
84
  path,
92
85
  required: field.required
93
- }),
86
+ }) }),
94
87
  /* @__PURE__ */ jsxs("div", {
95
88
  className: "field-type__wrap",
96
89
  children: [/* @__PURE__ */ jsx("ul", {
@@ -120,14 +113,11 @@ const DateFace = ({ field, maskDots, path }) => /* @__PURE__ */ jsxs("div", {
120
113
  }),
121
114
  /* @__PURE__ */ jsxs("div", {
122
115
  className: "field-type__wrap",
123
- children: [/* @__PURE__ */ jsx(FieldError, { path }), /* @__PURE__ */ jsxs("div", {
116
+ children: [/* @__PURE__ */ jsx(FieldError, { path }), /* @__PURE__ */ jsx("div", {
124
117
  className: "date-time-picker date-time-picker__appearance--default",
125
- children: [/* @__PURE__ */ jsx("div", {
126
- className: "date-time-picker__icon-wrap",
127
- children: /* @__PURE__ */ jsx(CalendarGlyph, {})
128
- }), /* @__PURE__ */ jsx("div", {
118
+ children: /* @__PURE__ */ jsxs("div", {
129
119
  className: "date-time-picker__input-wrapper",
130
- children: /* @__PURE__ */ jsx("div", {
120
+ children: [/* @__PURE__ */ jsx("div", {
131
121
  className: "react-datepicker-wrapper",
132
122
  children: /* @__PURE__ */ jsx("div", {
133
123
  className: "react-datepicker__input-container",
@@ -138,8 +128,8 @@ const DateFace = ({ field, maskDots, path }) => /* @__PURE__ */ jsxs("div", {
138
128
  value: dotString(maskDots)
139
129
  })
140
130
  })
141
- })
142
- })]
131
+ }), /* @__PURE__ */ jsx(CalendarIcon, {})]
132
+ })
143
133
  })]
144
134
  }),
145
135
  /* @__PURE__ */ jsx(FieldDescription, {
@@ -178,41 +168,42 @@ const JsonFace = (props) => /* @__PURE__ */ jsx(EditorFace, {
178
168
  ...props,
179
169
  baseClass: "json-field"
180
170
  });
181
- const PointFace = ({ field, maskDots, path }) => /* @__PURE__ */ jsxs("div", {
182
- className: "field-type point tenx-protected-field__face",
183
- children: [
184
- /* @__PURE__ */ jsx(FieldLabel, {
185
- label: field.label,
186
- localized: field.localized,
187
- path,
188
- required: field.required
189
- }),
190
- /* @__PURE__ */ jsxs("ul", {
171
+ /**
172
+ * Point renders no field label of its own on v4: each coordinate carries
173
+ * "<label> - Longitude" / "<label> - Latitude", so the face does the same.
174
+ */
175
+ const PointFace = ({ field, maskDots, path }) => {
176
+ const { i18n, t } = useTranslation();
177
+ const fieldLabel = labelText(field.label, i18n.language);
178
+ const coordinate = (suffix) => `${fieldLabel}${fieldLabel ? " - " : ""}${suffix}`;
179
+ return /* @__PURE__ */ jsxs("div", {
180
+ className: "field-type point tenx-protected-field__face",
181
+ children: [/* @__PURE__ */ jsx("ul", {
191
182
  className: "point__wrap",
192
- children: [/* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx("div", {
193
- className: "input-wrapper",
194
- children: /* @__PURE__ */ jsx("input", {
195
- className: "tenx-protected-field__masked-input",
183
+ children: [t("fields:longitude"), t("fields:latitude")].map((suffix) => /* @__PURE__ */ jsxs("li", { children: [/* @__PURE__ */ jsx(FieldLabel, {
184
+ label: coordinate(suffix),
185
+ localized: field.localized,
186
+ path,
187
+ required: field.required
188
+ }), /* @__PURE__ */ jsxs("div", {
189
+ className: "form-input-group",
190
+ children: [/* @__PURE__ */ jsx("input", {
191
+ className: "form-input tenx-protected-field__masked-input",
196
192
  readOnly: true,
197
193
  tabIndex: -1,
198
194
  value: dotString(maskDots)
199
- })
200
- }) }), /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx("div", {
201
- className: "input-wrapper",
202
- children: /* @__PURE__ */ jsx("input", {
203
- className: "tenx-protected-field__masked-input",
204
- readOnly: true,
205
- tabIndex: -1,
206
- value: dotString(maskDots)
207
- })
208
- }) })]
209
- }),
210
- /* @__PURE__ */ jsx(FieldDescription, {
195
+ }), /* @__PURE__ */ jsx(InputStepper, {
196
+ disabled: true,
197
+ onDecrement: noop,
198
+ onIncrement: noop
199
+ })]
200
+ })] }, suffix))
201
+ }), /* @__PURE__ */ jsx(FieldDescription, {
211
202
  description: field.admin?.description,
212
203
  path
213
- })
214
- ]
215
- });
204
+ })]
205
+ });
206
+ };
216
207
  //#endregion
217
208
  export { CheckboxFace, CodeFace, DateFace, JsonFace, PointFace, RadioFace, SelectFace };
218
209
 
@@ -1 +1 @@
1
- {"version":3,"file":"facsimiles.js","names":[],"sources":["../../../../src/fields/encrypted/components/facsimiles.tsx"],"sourcesContent":["'use client'\nimport { CheckboxInput, FieldDescription, FieldError, FieldLabel } from '@payloadcms/ui'\nimport type React from 'react'\nimport { dotString, MaskDots } from './MaskDots'\nimport type { EncryptedFieldConfig } from './placement'\n\n/**\n * Display-only concealed faces. Each reuses real Payload field markup with a\n * fixed run of dots so the masked state is pixel-native and inherits the global\n * `payload-default` styles (40px inputs, icon strokes). None of them call\n * `useField` or hold `setValue`, so they are mechanically incapable of writing\n * the plaintext already sitting in form state.\n */\ninterface FaceProps {\n\tfield: EncryptedFieldConfig\n\tmaskDots: number\n\tpath: string\n}\n\nconst noToggle = (): undefined => undefined\n\n/** Chevron matching react-select's dropdown indicator (inherits `.icon--chevron`). */\nconst ChevronGlyph: React.FC = () => (\n\t<svg\n\t\taria-hidden=\"true\"\n\t\tclassName=\"icon icon--chevron\"\n\t\tviewBox=\"0 0 20 20\"\n\t\txmlns=\"http://www.w3.org/2000/svg\"\n\t>\n\t\t<path className=\"stroke\" d=\"M14 8L10 12L6 8\" strokeLinecap=\"square\" />\n\t</svg>\n)\n\n/** Calendar glyph matching the datepicker (inherits `.icon--calendar` position). */\nconst CalendarGlyph: React.FC = () => (\n\t<svg\n\t\taria-hidden=\"true\"\n\t\tclassName=\"icon icon--calendar\"\n\t\tviewBox=\"0 0 20 20\"\n\t\txmlns=\"http://www.w3.org/2000/svg\"\n\t>\n\t\t<path\n\t\t\tclassName=\"stroke\"\n\t\t\td=\"M7.33333 3.33334V6M12.6667 3.33334V6M4 8.66667H16M5.33333 4.66667H14.6667C15.403 4.66667 16 5.26362 16 6V15.3333C16 16.0697 15.403 16.6667 14.6667 16.6667H5.33333C4.59695 16.6667 4 16.0697 4 15.3333V6C4 5.26362 4.59695 4.66667 5.33333 4.66667Z\"\n\t\t\tstrokeLinecap=\"square\"\n\t\t/>\n\t</svg>\n)\n\nexport const CheckboxFace: React.FC<FaceProps> = ({ field, path }) => (\n\t<div className=\"field-type checkbox tenx-protected-field__face\">\n\t\t<FieldError path={path} />\n\t\t<CheckboxInput\n\t\t\tchecked={false}\n\t\t\tlabel={field.label}\n\t\t\tname={path}\n\t\t\tonToggle={noToggle}\n\t\t\tpartialChecked\n\t\t\treadOnly\n\t\t\trequired={field.required}\n\t\t/>\n\t\t<FieldDescription description={field.admin?.description} path={path} />\n\t</div>\n)\n\nexport const SelectFace: React.FC<FaceProps> = ({ field, maskDots, path }) => (\n\t<div className=\"field-type select tenx-protected-field__face\">\n\t\t<FieldLabel\n\t\t\tlabel={field.label}\n\t\t\tlocalized={field.localized}\n\t\t\tpath={path}\n\t\t\trequired={field.required}\n\t\t/>\n\t\t<div className=\"field-type__wrap\">\n\t\t\t<FieldError path={path} />\n\t\t\t<div className=\"react-select-container react-select\">\n\t\t\t\t<div className=\"rs__control tenx-protected-field__rs-control\">\n\t\t\t\t\t<div className=\"rs__value-container\">\n\t\t\t\t\t\t<MaskDots count={maskDots} />\n\t\t\t\t\t</div>\n\t\t\t\t\t<div className=\"rs__indicators\">\n\t\t\t\t\t\t<span className=\"rs__indicator rs__dropdown-indicator\">\n\t\t\t\t\t\t\t<ChevronGlyph />\n\t\t\t\t\t\t</span>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</div>\n\t\t<FieldDescription description={field.admin?.description} path={path} />\n\t</div>\n)\n\nexport const RadioFace: React.FC<FaceProps> = ({ field, maskDots, path }) => (\n\t<div className=\"field-type radio-group radio-group--layout-horizontal tenx-protected-field__face\">\n\t\t<FieldError path={path} />\n\t\t<FieldLabel\n\t\t\tlabel={field.label}\n\t\t\tlocalized={field.localized}\n\t\t\tpath={path}\n\t\t\trequired={field.required}\n\t\t/>\n\t\t<div className=\"field-type__wrap\">\n\t\t\t<ul className=\"radio-group--group\">\n\t\t\t\t<li>\n\t\t\t\t\t{/* biome-ignore lint/a11y/noLabelWithoutControl: display-only masked facsimile, no interactive input by design */}\n\t\t\t\t\t<label>\n\t\t\t\t\t\t<div className=\"radio-input\">\n\t\t\t\t\t\t\t<span className=\"radio-input__styled-radio\" />\n\t\t\t\t\t\t\t<span className=\"radio-input__label\">\n\t\t\t\t\t\t\t\t<MaskDots count={maskDots} />\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</label>\n\t\t\t\t</li>\n\t\t\t</ul>\n\t\t\t<FieldDescription description={field.admin?.description} path={path} />\n\t\t</div>\n\t</div>\n)\n\nexport const DateFace: React.FC<FaceProps> = ({ field, maskDots, path }) => (\n\t<div className=\"field-type date-time-field tenx-protected-field__face\">\n\t\t<FieldLabel\n\t\t\tlabel={field.label}\n\t\t\tlocalized={field.localized}\n\t\t\tpath={path}\n\t\t\trequired={field.required}\n\t\t/>\n\t\t<div className=\"field-type__wrap\">\n\t\t\t<FieldError path={path} />\n\t\t\t<div className=\"date-time-picker date-time-picker__appearance--default\">\n\t\t\t\t<div className=\"date-time-picker__icon-wrap\">\n\t\t\t\t\t<CalendarGlyph />\n\t\t\t\t</div>\n\t\t\t\t<div className=\"date-time-picker__input-wrapper\">\n\t\t\t\t\t<div className=\"react-datepicker-wrapper\">\n\t\t\t\t\t\t<div className=\"react-datepicker__input-container\">\n\t\t\t\t\t\t\t<input\n\t\t\t\t\t\t\t\tclassName=\"tenx-protected-field__masked-input\"\n\t\t\t\t\t\t\t\treadOnly\n\t\t\t\t\t\t\t\ttabIndex={-1}\n\t\t\t\t\t\t\t\tvalue={dotString(maskDots)}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</div>\n\t\t<FieldDescription description={field.admin?.description} path={path} />\n\t</div>\n)\n\nconst EditorFace: React.FC<FaceProps & { baseClass: string }> = ({\n\tbaseClass,\n\tfield,\n\tmaskDots,\n\tpath,\n}) => (\n\t<div className={`field-type ${baseClass} tenx-protected-field__face`}>\n\t\t<FieldLabel\n\t\t\tlabel={field.label}\n\t\t\tlocalized={field.localized}\n\t\t\tpath={path}\n\t\t\trequired={field.required}\n\t\t/>\n\t\t<div className=\"field-type__wrap\">\n\t\t\t<FieldError path={path} />\n\t\t\t<div className=\"tenx-protected-field__editor-box\">\n\t\t\t\t<MaskDots count={maskDots} />\n\t\t\t</div>\n\t\t</div>\n\t\t<FieldDescription description={field.admin?.description} path={path} />\n\t</div>\n)\n\nexport const CodeFace: React.FC<FaceProps> = (props) => (\n\t<EditorFace {...props} baseClass=\"code-field\" />\n)\n\nexport const JsonFace: React.FC<FaceProps> = (props) => (\n\t<EditorFace {...props} baseClass=\"json-field\" />\n)\n\nexport const PointFace: React.FC<FaceProps> = ({ field, maskDots, path }) => (\n\t<div className=\"field-type point tenx-protected-field__face\">\n\t\t<FieldLabel\n\t\t\tlabel={field.label}\n\t\t\tlocalized={field.localized}\n\t\t\tpath={path}\n\t\t\trequired={field.required}\n\t\t/>\n\t\t<ul className=\"point__wrap\">\n\t\t\t<li>\n\t\t\t\t<div className=\"input-wrapper\">\n\t\t\t\t\t<input\n\t\t\t\t\t\tclassName=\"tenx-protected-field__masked-input\"\n\t\t\t\t\t\treadOnly\n\t\t\t\t\t\ttabIndex={-1}\n\t\t\t\t\t\tvalue={dotString(maskDots)}\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t</li>\n\t\t\t<li>\n\t\t\t\t<div className=\"input-wrapper\">\n\t\t\t\t\t<input\n\t\t\t\t\t\tclassName=\"tenx-protected-field__masked-input\"\n\t\t\t\t\t\treadOnly\n\t\t\t\t\t\ttabIndex={-1}\n\t\t\t\t\t\tvalue={dotString(maskDots)}\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t</li>\n\t\t</ul>\n\t\t<FieldDescription description={field.admin?.description} path={path} />\n\t</div>\n)\n"],"mappings":";;;;;AAmBA,MAAM,iBAA4B,KAAA;;AAGlC,MAAM,qBACL,oBAAC,OAAD;CACC,eAAY;CACZ,WAAU;CACV,SAAQ;CACR,OAAM;WAEN,oBAAC,QAAD;EAAM,WAAU;EAAS,GAAE;EAAkB,eAAc;CAAU,CAAA;AACjE,CAAA;;AAIN,MAAM,sBACL,oBAAC,OAAD;CACC,eAAY;CACZ,WAAU;CACV,SAAQ;CACR,OAAM;WAEN,oBAAC,QAAD;EACC,WAAU;EACV,GAAE;EACF,eAAc;CACd,CA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AA;GACxB,CAAA,CACD;;EACL,oBAAC,kBAAD;GAAkB,aAAa,MAAM,OAAO;GAAmB;EAAO,CAAA;CAClE;;AAGN,MAAa,YAAiC,UAC7C,oBAAC,YAAD;CAAY,GAAI;CAAO,WAAU;AAAc,CAAA;AAGhD,MAAa,YAAiC,UAC7C,oBAAC,YAAD;CAAY,GAAI;CAAO,WAAU;AAAc,CAAA;AAGhD,MAAa,aAAkC,EAAE,OAAO,UAAU,WACjE,qBAAC,OAAD;CAAK,WAAU;WAAf;EACC,oBAAC,YAAD;GACC,OAAO,MAAM;GACb,WAAW,MAAM;GACX;GACN,UAAU,MAAM;EAChB,CAAA;EACD,qBAAC,MAAD;GAAI,WAAU;aAAd,CACC,oBAAC,MAAD,EAAA,UACC,oBAAC,OAAD;IAAK,WAAU;cACd,oBAAC,SAAD;KACC,WAAU;KACV,UAAA;KACA,UAAU;KACV,OAAO,UAAU,QAAQ;IACzB,CAAA;GACG,CAAA,EACF,CAAA,GACJ,oBAAC,MAAD,EAAA,UACC,oBAAC,OAAD;IAAK,WAAU;cACd,oBAAC,SAAD;KACC,WAAU;KACV,UAAA;KACA,UAAU;KACV,OAAO,UAAU,QAAQ;IACzB,CAAA;GACG,CAAA,EACF,CAAA,CACD;;EACJ,oBAAC,kBAAD;GAAkB,aAAa,MAAM,OAAO;GAAmB;EAAO,CAAA;CAClE"}
1
+ {"version":3,"file":"facsimiles.js","names":[],"sources":["../../../../src/fields/encrypted/components/facsimiles.tsx"],"sourcesContent":["'use client'\nimport {\n\tCalendarIcon,\n\tCheckboxInput,\n\tChevronIcon,\n\tFieldDescription,\n\tFieldError,\n\tFieldLabel,\n\tInputStepper,\n\tuseTranslation,\n} from '@payloadcms/ui'\nimport type { StaticLabel } from 'payload'\nimport type React from 'react'\nimport { dotString, MaskDots } from './MaskDots'\nimport type { EncryptedFieldConfig } from './placement'\n\n/**\n * Display-only concealed faces. Each reuses real Payload field markup with a\n * fixed run of dots so the masked state is pixel-native and inherits the global\n * `payload-default` styles (`.form-input` rows, Payload's own icons). None of them call\n * `useField` or hold `setValue`, so they are mechanically incapable of writing\n * the plaintext already sitting in form state.\n */\ninterface FaceProps {\n\tfield: EncryptedFieldConfig\n\tmaskDots: number\n\tpath: string\n}\n\nconst noop = (): undefined => undefined\n\n/** A static label in the admin's language, the way Payload's own fields resolve one. */\nconst labelText = (label: StaticLabel | undefined, language: string): string => {\n\tif (typeof label === 'string') {\n\t\treturn label\n\t}\n\tif (!label) {\n\t\treturn ''\n\t}\n\treturn label[language] ?? Object.values(label)[0] ?? ''\n}\n\nexport const CheckboxFace: React.FC<FaceProps> = ({ field, path }) => (\n\t<div className=\"field-type checkbox tenx-protected-field__face\">\n\t\t<FieldError path={path} />\n\t\t<CheckboxInput\n\t\t\tchecked={false}\n\t\t\tlabel={field.label}\n\t\t\tname={path}\n\t\t\tonToggle={noop}\n\t\t\tpartialChecked\n\t\t\treadOnly\n\t\t\trequired={field.required}\n\t\t/>\n\t\t<FieldDescription description={field.admin?.description} path={path} />\n\t</div>\n)\n\nexport const SelectFace: React.FC<FaceProps> = ({ field, maskDots, path }) => (\n\t<div className=\"field-type select tenx-protected-field__face\" data-size=\"large\">\n\t\t<FieldLabel\n\t\t\tlabel={field.label}\n\t\t\tlocalized={field.localized}\n\t\t\tpath={path}\n\t\t\trequired={field.required}\n\t\t/>\n\t\t<div className=\"field-type__wrap\">\n\t\t\t<FieldError path={path} />\n\t\t\t<div className=\"react-select-container\">\n\t\t\t\t<div className=\"react-select\">\n\t\t\t\t\t<div className=\"rs__control tenx-protected-field__rs-control\">\n\t\t\t\t\t\t<div className=\"value-container\">\n\t\t\t\t\t\t\t<div className=\"rs__value-container\">\n\t\t\t\t\t\t\t\t<MaskDots count={maskDots} />\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<div className=\"rs__indicators\">\n\t\t\t\t\t\t\t<span className=\"rs__indicator-separator\" />\n\t\t\t\t\t\t\t<div aria-hidden=\"true\" className=\"dropdown-indicator\">\n\t\t\t\t\t\t\t\t<ChevronIcon className=\"dropdown-indicator__icon\" size={16} />\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</div>\n\t\t<FieldDescription description={field.admin?.description} path={path} />\n\t</div>\n)\n\nexport const RadioFace: React.FC<FaceProps> = ({ field, maskDots, path }) => (\n\t<div className=\"field-type radio-group radio-group--layout-horizontal tenx-protected-field__face\">\n\t\t<FieldError path={path} />\n\t\t<div>\n\t\t\t<FieldLabel\n\t\t\t\tlabel={field.label}\n\t\t\t\tlocalized={field.localized}\n\t\t\t\tpath={path}\n\t\t\t\trequired={field.required}\n\t\t\t/>\n\t\t</div>\n\t\t<div className=\"field-type__wrap\">\n\t\t\t<ul className=\"radio-group--group\">\n\t\t\t\t<li>\n\t\t\t\t\t{/* biome-ignore lint/a11y/noLabelWithoutControl: display-only masked facsimile, no interactive input by design */}\n\t\t\t\t\t<label>\n\t\t\t\t\t\t<div className=\"radio-input\">\n\t\t\t\t\t\t\t<span className=\"radio-input__styled-radio\" />\n\t\t\t\t\t\t\t<span className=\"radio-input__label\">\n\t\t\t\t\t\t\t\t<MaskDots count={maskDots} />\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</label>\n\t\t\t\t</li>\n\t\t\t</ul>\n\t\t\t<FieldDescription description={field.admin?.description} path={path} />\n\t\t</div>\n\t</div>\n)\n\nexport const DateFace: React.FC<FaceProps> = ({ field, maskDots, path }) => (\n\t<div className=\"field-type date-time-field tenx-protected-field__face\">\n\t\t<FieldLabel\n\t\t\tlabel={field.label}\n\t\t\tlocalized={field.localized}\n\t\t\tpath={path}\n\t\t\trequired={field.required}\n\t\t/>\n\t\t<div className=\"field-type__wrap\">\n\t\t\t<FieldError path={path} />\n\t\t\t<div className=\"date-time-picker date-time-picker__appearance--default\">\n\t\t\t\t<div className=\"date-time-picker__input-wrapper\">\n\t\t\t\t\t<div className=\"react-datepicker-wrapper\">\n\t\t\t\t\t\t<div className=\"react-datepicker__input-container\">\n\t\t\t\t\t\t\t<input\n\t\t\t\t\t\t\t\tclassName=\"tenx-protected-field__masked-input\"\n\t\t\t\t\t\t\t\treadOnly\n\t\t\t\t\t\t\t\ttabIndex={-1}\n\t\t\t\t\t\t\t\tvalue={dotString(maskDots)}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t\t<CalendarIcon />\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</div>\n\t\t<FieldDescription description={field.admin?.description} path={path} />\n\t</div>\n)\n\nconst EditorFace: React.FC<FaceProps & { baseClass: string }> = ({\n\tbaseClass,\n\tfield,\n\tmaskDots,\n\tpath,\n}) => (\n\t<div className={`field-type ${baseClass} tenx-protected-field__face`}>\n\t\t<FieldLabel\n\t\t\tlabel={field.label}\n\t\t\tlocalized={field.localized}\n\t\t\tpath={path}\n\t\t\trequired={field.required}\n\t\t/>\n\t\t<div className=\"field-type__wrap\">\n\t\t\t<FieldError path={path} />\n\t\t\t<div className=\"tenx-protected-field__editor-box\">\n\t\t\t\t<MaskDots count={maskDots} />\n\t\t\t</div>\n\t\t</div>\n\t\t<FieldDescription description={field.admin?.description} path={path} />\n\t</div>\n)\n\nexport const CodeFace: React.FC<FaceProps> = (props) => (\n\t<EditorFace {...props} baseClass=\"code-field\" />\n)\n\nexport const JsonFace: React.FC<FaceProps> = (props) => (\n\t<EditorFace {...props} baseClass=\"json-field\" />\n)\n\n/**\n * Point renders no field label of its own on v4: each coordinate carries\n * \"<label> - Longitude\" / \"<label> - Latitude\", so the face does the same.\n */\nexport const PointFace: React.FC<FaceProps> = ({ field, maskDots, path }) => {\n\tconst { i18n, t } = useTranslation()\n\tconst fieldLabel = labelText(field.label, i18n.language)\n\tconst coordinate = (suffix: string): string => `${fieldLabel}${fieldLabel ? ' - ' : ''}${suffix}`\n\treturn (\n\t\t<div className=\"field-type point tenx-protected-field__face\">\n\t\t\t<ul className=\"point__wrap\">\n\t\t\t\t{[t('fields:longitude'), t('fields:latitude')].map((suffix) => (\n\t\t\t\t\t<li key={suffix}>\n\t\t\t\t\t\t<FieldLabel\n\t\t\t\t\t\t\tlabel={coordinate(suffix)}\n\t\t\t\t\t\t\tlocalized={field.localized}\n\t\t\t\t\t\t\tpath={path}\n\t\t\t\t\t\t\trequired={field.required}\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<div className=\"form-input-group\">\n\t\t\t\t\t\t\t<input\n\t\t\t\t\t\t\t\tclassName=\"form-input tenx-protected-field__masked-input\"\n\t\t\t\t\t\t\t\treadOnly\n\t\t\t\t\t\t\t\ttabIndex={-1}\n\t\t\t\t\t\t\t\tvalue={dotString(maskDots)}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<InputStepper disabled onDecrement={noop} onIncrement={noop} />\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</li>\n\t\t\t\t))}\n\t\t\t</ul>\n\t\t\t<FieldDescription description={field.admin?.description} path={path} />\n\t\t</div>\n\t)\n}\n"],"mappings":";;;;;AA6BA,MAAM,aAAwB,KAAA;;AAG9B,MAAM,aAAa,OAAgC,aAA6B;CAC/E,IAAI,OAAO,UAAU,UACpB,OAAO;CAER,IAAI,CAAC,OACJ,OAAO;CAER,OAAO,MAAM,aAAa,OAAO,OAAO,KAAK,EAAE,MAAM;AACtD;AAEA,MAAa,gBAAqC,EAAE,OAAO,WAC1D,qBAAC,OAAD;CAAK,WAAU;WAAf;EACC,oBAAC,YAAD,EAAkB,KAAO,CAAA;EACzB,oBAAC,eAAD;GACC,SAAS;GACT,OAAO,MAAM;GACb,MAAM;GACN,UAAU;GACV,gBAAA;GACA,UAAA;GACA,UAAU,MAAM;EAChB,CAAA;EACD,oBAAC,kBAAD;GAAkB,aAAa,MAAM,OAAO;GAAmB;EAAO,CAAA;CAClE;;AAGN,MAAa,cAAmC,EAAE,OAAO,UAAU,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D,MAAa,YAAiC,UAC7C,oBAAC,YAAD;CAAY,GAAI;CAAO,WAAU;AAAc,CAAA;;;;;AAOhD,MAAa,aAAkC,EAAE,OAAO,UAAU,WAAW;CAC5E,MAAM,EAAE,MAAM,MAAM,eAAe;CACnC,MAAM,aAAa,UAAU,MAAM,OAAO,KAAK,QAAQ;CACvD,MAAM,cAAc,WAA2B,GAAG,aAAa,aAAa,QAAQ,KAAK;CACzF,OACC,qBAAC,OAAD;EAAK,WAAU;YAAf,CACC,oBAAC,MAAD;GAAI,WAAU;aACZ,CAAC,EAAE,kBAAkB,GAAG,EAAE,iBAAiB,CAAC,EAAE,KAAK,WACnD,qBAAC,MAAD,EAAA,UAAA,CACC,oBAAC,YAAD;IACC,OAAO,WAAW,MAAM;IACxB,WAAW,MAAM;IACX;IACN,UAAU,MAAM;GAChB,CAAA,GACD,qBAAC,OAAD;IAAK,WAAU;cAAf,CACC,oBAAC,SAAD;KACC,WAAU;KACV,UAAA;KACA,UAAU;KACV,OAAO,UAAU,QAAQ;IACzB,CAAA,GACD,oBAAC,cAAD;KAAc,UAAA;KAAS,aAAa;KAAM,aAAa;IAAO,CAAA,CAC1D;KACF,EAAA,GAhBK,MAgBL,CACJ;EACE,CAAA,GACJ,oBAAC,kBAAD;GAAkB,aAAa,MAAM,OAAO;GAAmB;EAAO,CAAA,CAClE;;AAEP"}
@@ -1 +1 @@
1
- {"version":3,"file":"placement.js","names":[],"sources":["../../../../src/fields/encrypted/components/placement.ts"],"sourcesContent":["import type { StaticDescription, StaticLabel } from 'payload'\n\n/**\n * Where the reveal eye sits relative to a concealed field's native markup:\n * - `attached`: a flex-appended segment inside the input row (Payload's API-key\n * pattern), used by single text/email/number.\n * - `corner`: absolutely positioned in the top-right of the field wrap, used by\n * textarea.\n * - `label-row`: absolutely positioned on the label line, used by every\n * structural type (checkbox/select/radio/date/code/json/point) and, because\n * they have no single-line input to attach to, every `hasMany` field.\n */\nexport type Placement = 'attached' | 'corner' | 'label-row'\n\nconst ATTACHED_KEYS: ReadonlySet<string> = new Set(['text', 'email', 'number'])\n\n/**\n * Resolves the eye placement for a concealed field. `hasMany` always wins to\n * `label-row` because the react-select chip surface has no single input the\n * segment could attach to.\n */\nexport const placementFor = (componentKey: string, hasMany: boolean): Placement => {\n\tif (hasMany) {\n\t\treturn 'label-row'\n\t}\n\tif (componentKey === 'textarea') {\n\t\treturn 'corner'\n\t}\n\tif (ATTACHED_KEYS.has(componentKey)) {\n\t\treturn 'attached'\n\t}\n\treturn 'label-row'\n}\n\n/**\n * The serializable slice of a client field config the concealed facsimiles and\n * revealed bound inputs read. The patched field the dispatcher builds is a\n * superset of this; components take this narrow view so masked markup never\n * depends on server-only field internals.\n */\nexport interface EncryptedFieldConfig {\n\tadmin?: {\n\t\tautoComplete?: string\n\t\tdescription?: StaticDescription\n\t\tplaceholder?: unknown\n\t\trows?: number\n\t\tstep?: number\n\t}\n\tlabel?: StaticLabel\n\tlocalized?: boolean\n\toptions?: { label: string; value: string }[]\n\trequired?: boolean\n}\n"],"mappings":";AAcA,MAAM,gBAAqC,IAAI,IAAI;CAAC;CAAQ;CAAS;AAAQ,CAAC;;;;;;AAO9E,MAAa,gBAAgB,cAAsB,YAAgC;CAClF,IAAI,SACH,OAAO;CAER,IAAI,iBAAiB,YACpB,OAAO;CAER,IAAI,cAAc,IAAI,YAAY,GACjC,OAAO;CAER,OAAO;AACR"}
1
+ {"version":3,"file":"placement.js","names":[],"sources":["../../../../src/fields/encrypted/components/placement.ts"],"sourcesContent":["import type { StaticDescription, StaticLabel } from 'payload'\n\n/**\n * Where the reveal eye sits relative to a concealed field's native markup:\n * - `attached`: a flex-appended segment inside the input row (Payload's API-key\n * pattern), used by single text/email/number.\n * - `corner`: absolutely positioned in the top-right of the field wrap, used by\n * textarea.\n * - `label-row`: absolutely positioned on the label line, used by every\n * structural type (checkbox/select/radio/date/code/json/point) and, because\n * they have no single-line input to attach to, every `hasMany` field.\n */\nexport type Placement = 'attached' | 'corner' | 'label-row'\n\nconst ATTACHED_KEYS: ReadonlySet<string> = new Set(['text', 'email', 'number'])\n\n/**\n * Resolves the eye placement for a concealed field. `hasMany` always wins to\n * `label-row` because the react-select chip surface has no single input the\n * segment could attach to.\n */\nexport const placementFor = (componentKey: string, hasMany: boolean): Placement => {\n\tif (hasMany) {\n\t\treturn 'label-row'\n\t}\n\tif (componentKey === 'textarea') {\n\t\treturn 'corner'\n\t}\n\tif (ATTACHED_KEYS.has(componentKey)) {\n\t\treturn 'attached'\n\t}\n\treturn 'label-row'\n}\n\n/**\n * The serializable slice of a client field config the concealed facsimiles and\n * revealed bound inputs read. The patched field the dispatcher builds is a\n * superset of this; components take this narrow view so masked markup never\n * depends on server-only field internals.\n */\nexport interface EncryptedFieldConfig {\n\tadmin?: {\n\t\tautoComplete?: string\n\t\tdescription?: StaticDescription\n\t\tplaceholder?: unknown\n\t\treadOnly?: boolean\n\t\trows?: number\n\t\tstep?: number\n\t}\n\tlabel?: StaticLabel\n\tlocalized?: boolean\n\toptions?: { label: string; value: string }[]\n\trequired?: boolean\n}\n"],"mappings":";AAcA,MAAM,gBAAqC,IAAI,IAAI;CAAC;CAAQ;CAAS;AAAQ,CAAC;;;;;;AAO9E,MAAa,gBAAgB,cAAsB,YAAgC;CAClF,IAAI,SACH,OAAO;CAER,IAAI,iBAAiB,YACpB,OAAO;CAER,IAAI,cAAc,IAAI,YAAY,GACjC,OAAO;CAER,OAAO;AACR"}
@@ -4,9 +4,14 @@ import { normalizeHint } from "./hint.js";
4
4
  import { makeAfterReadHook, makeBeforeChangeHook, makeRichTextCiphertextHook, makeRichTextDecryptHook, makeRichTextSealHook, makeRichTextValidate, makeSetIndicatorHook } from "./hooks.js";
5
5
  import { clampMaskDots } from "./maskDots.js";
6
6
  import { normalizeGenerate } from "./generateSecret.js";
7
- import { typescriptSchemaFor } from "./typescriptSchema.js";
7
+ import { jsonSchemaFor } from "./jsonSchema.js";
8
8
  import { makeComposedValidate, makeEffectiveValidator } from "./validators.js";
9
9
  //#region src/fields/encrypted/encryptedField.ts
10
+ /** Adds `filter` to a field's `admin.disabled`, keeping whatever the source already disabled. */
11
+ const withFilterDisabled = (disabled) => disabled === true ? true : {
12
+ ...disabled || {},
13
+ filter: true
14
+ };
10
15
  /** Admin keys forwarded to the client patch so native components render correctly. */
11
16
  const PATCH_ADMIN_KEYS = [
12
17
  "autoComplete",
@@ -86,8 +91,10 @@ const buildRichTextFields = (args) => {
86
91
  name: storedName,
87
92
  type: "text",
88
93
  admin: {
89
- disableListColumn: true,
90
- disableListFilter: true,
94
+ disabled: {
95
+ column: true,
96
+ filter: true
97
+ },
91
98
  hidden: true
92
99
  },
93
100
  custom: { [FIELDS_CUSTOM_KEY]: { encrypted: marker } },
@@ -148,14 +155,14 @@ const encryptedField = (source, options = {}) => {
148
155
  const effective = makeEffectiveValidator(source);
149
156
  const fieldPatch = buildFieldPatch(source);
150
157
  const sourceAdmin = source.admin;
151
- const { defaultValue: _defaultValue, editor: _editor, hooks: sourceHooks, index: _index, max: _max, maxLength: _maxLength, min: _min, minLength: _minLength, options: _options, typescriptSchema: _ts, unique: _unique, validate: _validate, ...rest } = source;
158
+ const { defaultValue: _defaultValue, editor: _editor, hooks: sourceHooks, index: _index, max: _max, maxLength: _maxLength, min: _min, minLength: _minLength, options: _options, jsonSchema: _jsonSchema, unique: _unique, validate: _validate, ...rest } = source;
152
159
  let stored = {
153
160
  ...rest,
154
161
  type: "text",
155
162
  ...hasMany ? { hasMany: true } : {},
156
163
  admin: {
157
164
  ...sourceAdmin,
158
- ...queryable ? {} : { disableListFilter: true },
165
+ ...queryable ? {} : { disabled: withFilterDisabled(sourceAdmin?.disabled) },
159
166
  components: {
160
167
  ...sourceAdmin?.components ?? {},
161
168
  Field: {
@@ -190,7 +197,7 @@ const encryptedField = (source, options = {}) => {
190
197
  afterRead: [makeAfterReadHook(marker), ...sourceHooks?.afterRead ?? []],
191
198
  beforeChange: [...sourceHooks?.beforeChange ?? [], makeBeforeChangeHook(marker)]
192
199
  },
193
- typescriptSchema: typescriptSchemaFor(source),
200
+ jsonSchema: jsonSchemaFor(source),
194
201
  validate: makeComposedValidate(effective)
195
202
  };
196
203
  if (overrides) stored = overrides({ field: stored });
@@ -199,8 +206,10 @@ const encryptedField = (source, options = {}) => {
199
206
  name: marker.setName,
200
207
  type: "checkbox",
201
208
  admin: {
202
- disableListColumn: true,
203
- disableListFilter: true,
209
+ disabled: {
210
+ column: true,
211
+ filter: true
212
+ },
204
213
  hidden: true
205
214
  },
206
215
  hooks: { afterRead: [makeSetIndicatorHook(marker.fieldName)] },
@@ -211,8 +220,10 @@ const encryptedField = (source, options = {}) => {
211
220
  name: marker.hintName,
212
221
  type: "text",
213
222
  admin: {
214
- disableListColumn: true,
215
- disableListFilter: true,
223
+ disabled: {
224
+ column: true,
225
+ filter: true
226
+ },
216
227
  hidden: true
217
228
  },
218
229
  ...marker.localized ? { localized: true } : {}
@@ -228,8 +239,10 @@ const encryptedField = (source, options = {}) => {
228
239
  name: marker.bidxName,
229
240
  type: "text",
230
241
  admin: {
231
- disableListColumn: true,
232
- disableListFilter: true,
242
+ disabled: {
243
+ column: true,
244
+ filter: true
245
+ },
233
246
  hidden: true
234
247
  },
235
248
  index: true,