@10x-media/fields 0.1.0-beta.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.
Files changed (299) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/LICENSE +21 -0
  3. package/README.md +62 -0
  4. package/dist/exports/client.d.ts +7 -0
  5. package/dist/exports/client.js +8 -0
  6. package/dist/exports/color-utils.d.ts +9 -0
  7. package/dist/exports/color-utils.js +7 -0
  8. package/dist/exports/color.d.ts +6 -0
  9. package/dist/exports/color.js +5 -0
  10. package/dist/exports/encrypted.d.ts +12 -0
  11. package/dist/exports/encrypted.js +10 -0
  12. package/dist/exports/i18n.d.ts +3 -0
  13. package/dist/exports/i18n.js +3 -0
  14. package/dist/exports/icon-adapters/lucide.d.ts +5 -0
  15. package/dist/exports/icon-adapters/lucide.js +4 -0
  16. package/dist/exports/icon-adapters/radix.d.ts +5 -0
  17. package/dist/exports/icon-adapters/radix.js +4 -0
  18. package/dist/exports/icon-adapters/tabler.d.ts +5 -0
  19. package/dist/exports/icon-adapters/tabler.js +4 -0
  20. package/dist/exports/icon-codegen.d.ts +4 -0
  21. package/dist/exports/icon-codegen.js +2 -0
  22. package/dist/exports/icon-react.d.ts +4 -0
  23. package/dist/exports/icon-react.js +3 -0
  24. package/dist/exports/icon.d.ts +8 -0
  25. package/dist/exports/icon.js +7 -0
  26. package/dist/exports/rsc.d.ts +10 -0
  27. package/dist/exports/rsc.js +9 -0
  28. package/dist/exports/types.d.ts +4 -0
  29. package/dist/exports/types.js +1 -0
  30. package/dist/fields/color/client/ColorField.d.ts +13 -0
  31. package/dist/fields/color/client/ColorField.js +321 -0
  32. package/dist/fields/color/client/ColorField.js.map +1 -0
  33. package/dist/fields/color/client/ColorPickerPanel.d.ts +29 -0
  34. package/dist/fields/color/client/ColorPickerPanel.js +233 -0
  35. package/dist/fields/color/client/ColorPickerPanel.js.map +1 -0
  36. package/dist/fields/color/client/colorField.css +411 -0
  37. package/dist/fields/color/client/icons.js +38 -0
  38. package/dist/fields/color/client/icons.js.map +1 -0
  39. package/dist/fields/color/colorField.d.ts +20 -0
  40. package/dist/fields/color/colorField.js +102 -0
  41. package/dist/fields/color/colorField.js.map +1 -0
  42. package/dist/fields/color/commitValue.js +29 -0
  43. package/dist/fields/color/commitValue.js.map +1 -0
  44. package/dist/fields/color/engine/contrast.d.ts +10 -0
  45. package/dist/fields/color/engine/contrast.js +25 -0
  46. package/dist/fields/color/engine/contrast.js.map +1 -0
  47. package/dist/fields/color/engine/convert.d.ts +28 -0
  48. package/dist/fields/color/engine/convert.js +232 -0
  49. package/dist/fields/color/engine/convert.js.map +1 -0
  50. package/dist/fields/color/engine/format.d.ts +15 -0
  51. package/dist/fields/color/engine/format.js +53 -0
  52. package/dist/fields/color/engine/format.js.map +1 -0
  53. package/dist/fields/color/engine/index.d.ts +8 -0
  54. package/dist/fields/color/engine/namedColors.d.ts +9 -0
  55. package/dist/fields/color/engine/namedColors.js +159 -0
  56. package/dist/fields/color/engine/namedColors.js.map +1 -0
  57. package/dist/fields/color/engine/parse.d.ts +12 -0
  58. package/dist/fields/color/engine/parse.js +151 -0
  59. package/dist/fields/color/engine/parse.js.map +1 -0
  60. package/dist/fields/color/engine/salvage.d.ts +13 -0
  61. package/dist/fields/color/engine/salvage.js +75 -0
  62. package/dist/fields/color/engine/salvage.js.map +1 -0
  63. package/dist/fields/color/engine/types.d.ts +34 -0
  64. package/dist/fields/color/options.d.ts +55 -0
  65. package/dist/fields/color/options.js +8 -0
  66. package/dist/fields/color/options.js.map +1 -0
  67. package/dist/fields/color/presetChip.js +27 -0
  68. package/dist/fields/color/presetChip.js.map +1 -0
  69. package/dist/fields/color/presetsFromDoc.d.ts +27 -0
  70. package/dist/fields/color/presetsFromDoc.js +74 -0
  71. package/dist/fields/color/presetsFromDoc.js.map +1 -0
  72. package/dist/fields/color/resolveFormat.js +16 -0
  73. package/dist/fields/color/resolveFormat.js.map +1 -0
  74. package/dist/fields/color/resolvePresets.d.ts +29 -0
  75. package/dist/fields/color/resolvePresets.js +39 -0
  76. package/dist/fields/color/resolvePresets.js.map +1 -0
  77. package/dist/fields/color/server/ColorCell.d.ts +6 -0
  78. package/dist/fields/color/server/ColorCell.js +34 -0
  79. package/dist/fields/color/server/ColorCell.js.map +1 -0
  80. package/dist/fields/color/server/ColorFieldServer.d.ts +18 -0
  81. package/dist/fields/color/server/ColorFieldServer.js +69 -0
  82. package/dist/fields/color/server/ColorFieldServer.js.map +1 -0
  83. package/dist/fields/color/server/colorCell.css +32 -0
  84. package/dist/fields/encrypted/boot.d.ts +14 -0
  85. package/dist/fields/encrypted/boot.js +22 -0
  86. package/dist/fields/encrypted/boot.js.map +1 -0
  87. package/dist/fields/encrypted/components/EncryptedInput.js +89 -0
  88. package/dist/fields/encrypted/components/EncryptedInput.js.map +1 -0
  89. package/dist/fields/encrypted/components/EncryptedTextarea.js +86 -0
  90. package/dist/fields/encrypted/components/EncryptedTextarea.js.map +1 -0
  91. package/dist/fields/encrypted/components/EyeToggle.js +51 -0
  92. package/dist/fields/encrypted/components/EyeToggle.js.map +1 -0
  93. package/dist/fields/encrypted/components/MaskDots.js +20 -0
  94. package/dist/fields/encrypted/components/MaskDots.js.map +1 -0
  95. package/dist/fields/encrypted/components/ProtectedCell.d.ts +19 -0
  96. package/dist/fields/encrypted/components/ProtectedCell.js +44 -0
  97. package/dist/fields/encrypted/components/ProtectedCell.js.map +1 -0
  98. package/dist/fields/encrypted/components/ProtectedField.css +180 -0
  99. package/dist/fields/encrypted/components/ProtectedField.d.ts +30 -0
  100. package/dist/fields/encrypted/components/ProtectedField.js +95 -0
  101. package/dist/fields/encrypted/components/ProtectedField.js.map +1 -0
  102. package/dist/fields/encrypted/components/ProtectedRichText.d.ts +21 -0
  103. package/dist/fields/encrypted/components/ProtectedRichText.js +35 -0
  104. package/dist/fields/encrypted/components/ProtectedRichText.js.map +1 -0
  105. package/dist/fields/encrypted/components/RichTextRevealGate.d.ts +24 -0
  106. package/dist/fields/encrypted/components/RichTextRevealGate.js +87 -0
  107. package/dist/fields/encrypted/components/RichTextRevealGate.js.map +1 -0
  108. package/dist/fields/encrypted/components/StructuralField.js +64 -0
  109. package/dist/fields/encrypted/components/StructuralField.js.map +1 -0
  110. package/dist/fields/encrypted/components/facsimiles.js +219 -0
  111. package/dist/fields/encrypted/components/facsimiles.js.map +1 -0
  112. package/dist/fields/encrypted/components/placement.js +21 -0
  113. package/dist/fields/encrypted/components/placement.js.map +1 -0
  114. package/dist/fields/encrypted/crypto/aad.js +29 -0
  115. package/dist/fields/encrypted/crypto/aad.js.map +1 -0
  116. package/dist/fields/encrypted/crypto/bidx.js +26 -0
  117. package/dist/fields/encrypted/crypto/bidx.js.map +1 -0
  118. package/dist/fields/encrypted/crypto/keys.d.ts +31 -0
  119. package/dist/fields/encrypted/crypto/keys.js +113 -0
  120. package/dist/fields/encrypted/crypto/keys.js.map +1 -0
  121. package/dist/fields/encrypted/crypto/wire.d.ts +23 -0
  122. package/dist/fields/encrypted/crypto/wire.js +135 -0
  123. package/dist/fields/encrypted/crypto/wire.js.map +1 -0
  124. package/dist/fields/encrypted/encryptedField.d.ts +15 -0
  125. package/dist/fields/encrypted/encryptedField.js +187 -0
  126. package/dist/fields/encrypted/encryptedField.js.map +1 -0
  127. package/dist/fields/encrypted/hooks.d.ts +21 -0
  128. package/dist/fields/encrypted/hooks.js +326 -0
  129. package/dist/fields/encrypted/hooks.js.map +1 -0
  130. package/dist/fields/encrypted/maskDots.js +16 -0
  131. package/dist/fields/encrypted/maskDots.js.map +1 -0
  132. package/dist/fields/encrypted/plaintextStash.js +57 -0
  133. package/dist/fields/encrypted/plaintextStash.js.map +1 -0
  134. package/dist/fields/encrypted/queryRewrite.d.ts +12 -0
  135. package/dist/fields/encrypted/queryRewrite.js +134 -0
  136. package/dist/fields/encrypted/queryRewrite.js.map +1 -0
  137. package/dist/fields/encrypted/scan.js +36 -0
  138. package/dist/fields/encrypted/scan.js.map +1 -0
  139. package/dist/fields/encrypted/types.d.ts +35 -0
  140. package/dist/fields/encrypted/types.js +12 -0
  141. package/dist/fields/encrypted/types.js.map +1 -0
  142. package/dist/fields/encrypted/typescriptSchema.js +41 -0
  143. package/dist/fields/encrypted/typescriptSchema.js.map +1 -0
  144. package/dist/fields/encrypted/utils/decryptAllData.d.ts +17 -0
  145. package/dist/fields/encrypted/utils/decryptAllData.js +98 -0
  146. package/dist/fields/encrypted/utils/decryptAllData.js.map +1 -0
  147. package/dist/fields/encrypted/utils/encryptExistingData.d.ts +14 -0
  148. package/dist/fields/encrypted/utils/encryptExistingData.js +72 -0
  149. package/dist/fields/encrypted/utils/encryptExistingData.js.map +1 -0
  150. package/dist/fields/encrypted/utils/pageThrough.js +42 -0
  151. package/dist/fields/encrypted/utils/pageThrough.js.map +1 -0
  152. package/dist/fields/encrypted/utils/rotateEncryptedFields.d.ts +27 -0
  153. package/dist/fields/encrypted/utils/rotateEncryptedFields.js +92 -0
  154. package/dist/fields/encrypted/utils/rotateEncryptedFields.js.map +1 -0
  155. package/dist/fields/encrypted/validators.js +111 -0
  156. package/dist/fields/encrypted/validators.js.map +1 -0
  157. package/dist/fields/icon/adapters/lucide/adapter.d.ts +8 -0
  158. package/dist/fields/icon/adapters/lucide/adapter.js +15 -0
  159. package/dist/fields/icon/adapters/lucide/adapter.js.map +1 -0
  160. package/dist/fields/icon/adapters/lucide/client.d.ts +10 -0
  161. package/dist/fields/icon/adapters/lucide/client.js +41 -0
  162. package/dist/fields/icon/adapters/lucide/client.js.map +1 -0
  163. package/dist/fields/icon/adapters/lucide/generated/manifest.js +23338 -0
  164. package/dist/fields/icon/adapters/lucide/generated/manifest.js.map +1 -0
  165. package/dist/fields/icon/adapters/lucide/generated/nodes.js +14296 -0
  166. package/dist/fields/icon/adapters/lucide/generated/nodes.js.map +1 -0
  167. package/dist/fields/icon/adapters/lucide/renderer.d.ts +7 -0
  168. package/dist/fields/icon/adapters/lucide/renderer.js +13 -0
  169. package/dist/fields/icon/adapters/lucide/renderer.js.map +1 -0
  170. package/dist/fields/icon/adapters/radix/adapter.d.ts +8 -0
  171. package/dist/fields/icon/adapters/radix/adapter.js +14 -0
  172. package/dist/fields/icon/adapters/radix/adapter.js.map +1 -0
  173. package/dist/fields/icon/adapters/radix/client.d.ts +8 -0
  174. package/dist/fields/icon/adapters/radix/client.js +20 -0
  175. package/dist/fields/icon/adapters/radix/client.js.map +1 -0
  176. package/dist/fields/icon/adapters/radix/generated/imports.js +324 -0
  177. package/dist/fields/icon/adapters/radix/generated/imports.js.map +1 -0
  178. package/dist/fields/icon/adapters/radix/generated/manifest.js +1805 -0
  179. package/dist/fields/icon/adapters/radix/generated/manifest.js.map +1 -0
  180. package/dist/fields/icon/adapters/radix/renderer.d.ts +7 -0
  181. package/dist/fields/icon/adapters/radix/renderer.js +23 -0
  182. package/dist/fields/icon/adapters/radix/renderer.js.map +1 -0
  183. package/dist/fields/icon/adapters/tabler/adapter.d.ts +8 -0
  184. package/dist/fields/icon/adapters/tabler/adapter.js +15 -0
  185. package/dist/fields/icon/adapters/tabler/adapter.js.map +1 -0
  186. package/dist/fields/icon/adapters/tabler/client.d.ts +9 -0
  187. package/dist/fields/icon/adapters/tabler/client.js +18 -0
  188. package/dist/fields/icon/adapters/tabler/client.js.map +1 -0
  189. package/dist/fields/icon/adapters/tabler/generated/imports.js +4942 -0
  190. package/dist/fields/icon/adapters/tabler/generated/imports.js.map +1 -0
  191. package/dist/fields/icon/adapters/tabler/generated/manifest.js +61269 -0
  192. package/dist/fields/icon/adapters/tabler/generated/manifest.js.map +1 -0
  193. package/dist/fields/icon/adapters/tabler/generated/nodes.js +26749 -0
  194. package/dist/fields/icon/adapters/tabler/generated/nodes.js.map +1 -0
  195. package/dist/fields/icon/adapters/tabler/renderer.d.ts +7 -0
  196. package/dist/fields/icon/adapters/tabler/renderer.js +13 -0
  197. package/dist/fields/icon/adapters/tabler/renderer.js.map +1 -0
  198. package/dist/fields/icon/client/DrawerGlyph.js +32 -0
  199. package/dist/fields/icon/client/DrawerGlyph.js.map +1 -0
  200. package/dist/fields/icon/client/IconDrawerContent.js +294 -0
  201. package/dist/fields/icon/client/IconDrawerContent.js.map +1 -0
  202. package/dist/fields/icon/client/IconFieldClient.d.ts +19 -0
  203. package/dist/fields/icon/client/IconFieldClient.js +245 -0
  204. package/dist/fields/icon/client/IconFieldClient.js.map +1 -0
  205. package/dist/fields/icon/client/IconLibrarySelect.d.ts +14 -0
  206. package/dist/fields/icon/client/IconLibrarySelect.js +36 -0
  207. package/dist/fields/icon/client/IconLibrarySelect.js.map +1 -0
  208. package/dist/fields/icon/client/availableLibraries.js +25 -0
  209. package/dist/fields/icon/client/availableLibraries.js.map +1 -0
  210. package/dist/fields/icon/client/generatedAdapter.js +88 -0
  211. package/dist/fields/icon/client/generatedAdapter.js.map +1 -0
  212. package/dist/fields/icon/client/icon-field.css +524 -0
  213. package/dist/fields/icon/client/useRecentIcons.js +32 -0
  214. package/dist/fields/icon/client/useRecentIcons.js.map +1 -0
  215. package/dist/fields/icon/codegen/emit.js +81 -0
  216. package/dist/fields/icon/codegen/emit.js.map +1 -0
  217. package/dist/fields/icon/codegen/generate.d.ts +10 -0
  218. package/dist/fields/icon/codegen/generate.js +59 -0
  219. package/dist/fields/icon/codegen/generate.js.map +1 -0
  220. package/dist/fields/icon/codegen/sources/lucide.js +52 -0
  221. package/dist/fields/icon/codegen/sources/lucide.js.map +1 -0
  222. package/dist/fields/icon/codegen/sources/radix.js +33 -0
  223. package/dist/fields/icon/codegen/sources/radix.js.map +1 -0
  224. package/dist/fields/icon/codegen/sources/tabler.js +31 -0
  225. package/dist/fields/icon/codegen/sources/tabler.js.map +1 -0
  226. package/dist/fields/icon/codegen/types.d.ts +36 -0
  227. package/dist/fields/icon/defineIconAdapter.d.ts +8 -0
  228. package/dist/fields/icon/defineIconAdapter.js +10 -0
  229. package/dist/fields/icon/defineIconAdapter.js.map +1 -0
  230. package/dist/fields/icon/plugin.js +55 -0
  231. package/dist/fields/icon/plugin.js.map +1 -0
  232. package/dist/fields/icon/react/createIcon.d.ts +15 -0
  233. package/dist/fields/icon/react/createIcon.js +47 -0
  234. package/dist/fields/icon/react/createIcon.js.map +1 -0
  235. package/dist/fields/icon/react/createRscIcon.d.ts +12 -0
  236. package/dist/fields/icon/react/createRscIcon.js +27 -0
  237. package/dist/fields/icon/react/createRscIcon.js.map +1 -0
  238. package/dist/fields/icon/react/types.d.ts +24 -0
  239. package/dist/fields/icon/rsc/IconCell.d.ts +14 -0
  240. package/dist/fields/icon/rsc/IconCell.js +32 -0
  241. package/dist/fields/icon/rsc/IconCell.js.map +1 -0
  242. package/dist/fields/icon/rsc/IconFieldServer.d.ts +24 -0
  243. package/dist/fields/icon/rsc/IconFieldServer.js +74 -0
  244. package/dist/fields/icon/rsc/IconFieldServer.js.map +1 -0
  245. package/dist/fields/icon/rsc/IconLibrarySelectServer.d.ts +13 -0
  246. package/dist/fields/icon/rsc/IconLibrarySelectServer.js +24 -0
  247. package/dist/fields/icon/rsc/IconLibrarySelectServer.js.map +1 -0
  248. package/dist/fields/icon/rsc/resolveStaticLabel.js +16 -0
  249. package/dist/fields/icon/rsc/resolveStaticLabel.js.map +1 -0
  250. package/dist/fields/icon/server/availability.d.ts +32 -0
  251. package/dist/fields/icon/server/availability.js +58 -0
  252. package/dist/fields/icon/server/availability.js.map +1 -0
  253. package/dist/fields/icon/server/iconField.d.ts +32 -0
  254. package/dist/fields/icon/server/iconField.js +48 -0
  255. package/dist/fields/icon/server/iconField.js.map +1 -0
  256. package/dist/fields/icon/server/iconLibraryField.d.ts +23 -0
  257. package/dist/fields/icon/server/iconLibraryField.js +50 -0
  258. package/dist/fields/icon/server/iconLibraryField.js.map +1 -0
  259. package/dist/fields/icon/server/libraryOptions.d.ts +12 -0
  260. package/dist/fields/icon/server/libraryOptions.js +13 -0
  261. package/dist/fields/icon/server/libraryOptions.js.map +1 -0
  262. package/dist/fields/icon/server/manifestCache.js +17 -0
  263. package/dist/fields/icon/server/manifestCache.js.map +1 -0
  264. package/dist/fields/icon/server/validate.js +37 -0
  265. package/dist/fields/icon/server/validate.js.map +1 -0
  266. package/dist/fields/icon/shared/adapterComponents.d.ts +23 -0
  267. package/dist/fields/icon/shared/formatIconLabel.js +16 -0
  268. package/dist/fields/icon/shared/formatIconLabel.js.map +1 -0
  269. package/dist/fields/icon/shared/search.js +58 -0
  270. package/dist/fields/icon/shared/search.js.map +1 -0
  271. package/dist/fields/icon/shared/value.d.ts +16 -0
  272. package/dist/fields/icon/shared/value.js +27 -0
  273. package/dist/fields/icon/shared/value.js.map +1 -0
  274. package/dist/index.d.ts +39 -0
  275. package/dist/index.js +41 -0
  276. package/dist/index.js.map +1 -0
  277. package/dist/plugin/registerTranslations.js +19 -0
  278. package/dist/plugin/registerTranslations.js.map +1 -0
  279. package/dist/plugin/registry.d.ts +9 -0
  280. package/dist/plugin/registry.js +14 -0
  281. package/dist/plugin/registry.js.map +1 -0
  282. package/dist/translations/de.js +49 -0
  283. package/dist/translations/de.js.map +1 -0
  284. package/dist/translations/en.js +49 -0
  285. package/dist/translations/en.js.map +1 -0
  286. package/dist/translations/index.d.ts +15 -0
  287. package/dist/translations/index.js +30 -0
  288. package/dist/translations/index.js.map +1 -0
  289. package/dist/translations/keys.d.ts +48 -0
  290. package/dist/translations/keys.js +48 -0
  291. package/dist/translations/keys.js.map +1 -0
  292. package/dist/translations/server.js +13 -0
  293. package/dist/translations/server.js.map +1 -0
  294. package/dist/translations/useTranslation.js +12 -0
  295. package/dist/translations/useTranslation.js.map +1 -0
  296. package/dist/types.d.ts +105 -0
  297. package/dist/utils/memoForRequest.js +25 -0
  298. package/dist/utils/memoForRequest.js.map +1 -0
  299. package/package.json +196 -0
@@ -0,0 +1,34 @@
1
+ import { keys } from "../../../translations/keys.js";
2
+ import { PRESET_PREFIX } from "../options.js";
3
+ import { asTranslate } from "../../../translations/server.js";
4
+ import { jsx, jsxs } from "react/jsx-runtime";
5
+ import "./colorCell.css";
6
+ //#region src/fields/color/server/ColorCell.tsx
7
+ const ColorCell = (props) => {
8
+ const { cellData, field, i18n, rowData } = props;
9
+ if (typeof cellData !== "string" || cellData === "") return null;
10
+ const isPreset = cellData.startsWith(PRESET_PREFIX);
11
+ const name = "name" in field ? String(field.name) : "";
12
+ const resolvedRaw = isPreset ? rowData?.[`${name}Resolved`] : cellData;
13
+ const swatch = typeof resolvedRaw === "string" && resolvedRaw !== "" ? resolvedRaw : null;
14
+ const label = isPreset ? cellData.slice(PRESET_PREFIX.length) : cellData;
15
+ return /* @__PURE__ */ jsxs("span", {
16
+ className: "fields-color-cell",
17
+ children: [
18
+ /* @__PURE__ */ jsx("span", {
19
+ "aria-hidden": "true",
20
+ className: "fields-color-cell__swatch",
21
+ children: swatch ? /* @__PURE__ */ jsx("span", { style: { background: swatch } }) : null
22
+ }),
23
+ /* @__PURE__ */ jsx("span", { children: label }),
24
+ isPreset && !swatch ? /* @__PURE__ */ jsx("span", {
25
+ className: "fields-color-cell__missing",
26
+ children: asTranslate(i18n.t)(keys.missingPreset)
27
+ }) : null
28
+ ]
29
+ });
30
+ };
31
+ //#endregion
32
+ export { ColorCell };
33
+
34
+ //# sourceMappingURL=ColorCell.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ColorCell.js","names":[],"sources":["../../../../src/fields/color/server/ColorCell.tsx"],"sourcesContent":["import type { DefaultServerCellComponentProps } from 'payload'\nimport { keys } from '../../../translations/keys'\nimport { asTranslate } from '../../../translations/server'\nimport { PRESET_PREFIX } from '../options'\nimport './colorCell.css'\n\nexport const ColorCell = (props: DefaultServerCellComponentProps) => {\n\tconst { cellData, field, i18n, rowData } = props\n\tif (typeof cellData !== 'string' || cellData === '') return null\n\tconst isPreset = cellData.startsWith(PRESET_PREFIX)\n\tconst name = 'name' in field ? String(field.name) : ''\n\tconst resolvedRaw = isPreset\n\t\t? (rowData as Record<string, unknown>)?.[`${name}Resolved`]\n\t\t: cellData\n\tconst swatch = typeof resolvedRaw === 'string' && resolvedRaw !== '' ? resolvedRaw : null\n\tconst label = isPreset ? cellData.slice(PRESET_PREFIX.length) : cellData\n\treturn (\n\t\t<span className=\"fields-color-cell\">\n\t\t\t<span aria-hidden=\"true\" className=\"fields-color-cell__swatch\">\n\t\t\t\t{swatch ? <span style={{ background: swatch }} /> : null}\n\t\t\t</span>\n\t\t\t<span>{label}</span>\n\t\t\t{isPreset && !swatch ? (\n\t\t\t\t<span className=\"fields-color-cell__missing\">\n\t\t\t\t\t{asTranslate(i18n.t)(keys.missingPreset)}\n\t\t\t\t</span>\n\t\t\t) : null}\n\t\t</span>\n\t)\n}\n"],"mappings":";;;;;;AAMA,MAAa,aAAa,UAA2C;CACpE,MAAM,EAAE,UAAU,OAAO,MAAM,YAAY;CAC3C,IAAI,OAAO,aAAa,YAAY,aAAa,IAAI,OAAO;CAC5D,MAAM,WAAW,SAAS,WAAW,aAAa;CAClD,MAAM,OAAO,UAAU,QAAQ,OAAO,MAAM,IAAI,IAAI;CACpD,MAAM,cAAc,WAChB,UAAsC,GAAG,KAAK,aAC/C;CACH,MAAM,SAAS,OAAO,gBAAgB,YAAY,gBAAgB,KAAK,cAAc;CACrF,MAAM,QAAQ,WAAW,SAAS,MAAM,cAAc,MAAM,IAAI;CAChE,OACC,qBAAC,QAAD;EAAM,WAAU;YAAhB;GACC,oBAAC,QAAD;IAAM,eAAY;IAAO,WAAU;cACjC,SAAS,oBAAC,QAAD,EAAM,OAAO,EAAE,YAAY,OAAO,EAAI,CAAA,IAAI;GAC/C,CAAA;GACN,oBAAC,QAAD,EAAA,UAAO,MAAY,CAAA;GAClB,YAAY,CAAC,SACb,oBAAC,QAAD;IAAM,WAAU;cACd,YAAY,KAAK,CAAC,EAAE,KAAK,aAAa;GAClC,CAAA,IACH;EACC;;AAER"}
@@ -0,0 +1,18 @@
1
+ import { ColorFieldServerOptions } from "../options.js";
2
+ import { TextFieldServerProps } from "payload";
3
+
4
+ //#region src/fields/color/server/ColorFieldServer.d.ts
5
+ type ColorFieldServerComponentProps = {
6
+ colorOptions: ColorFieldServerOptions;
7
+ } & TextFieldServerProps;
8
+ /**
9
+ * Resolves presets server-side (static arrays, async resolvers from
10
+ * field.custom, or the plugin registry) and renders the client ColorField
11
+ * with only serializable props. renderField supplies data/siblingData/req
12
+ * as serverProps; they reflect the doc at render time, so data-dependent
13
+ * resolvers refresh on save/reload, not live with sibling edits.
14
+ */
15
+ declare const ColorFieldServer: (props: ColorFieldServerComponentProps) => Promise<import("react/jsx-runtime").JSX.Element>;
16
+ //#endregion
17
+ export { ColorFieldServer };
18
+ //# sourceMappingURL=ColorFieldServer.d.ts.map
@@ -0,0 +1,69 @@
1
+ import { keys } from "../../../translations/keys.js";
2
+ import "../options.js";
3
+ import { ColorField } from "../client/ColorField.js";
4
+ import { asTranslate } from "../../../translations/server.js";
5
+ import { resolveColorFormat } from "../resolveFormat.js";
6
+ import { resolvePresets } from "../resolvePresets.js";
7
+ import { jsx } from "react/jsx-runtime";
8
+ //#region src/fields/color/server/ColorFieldServer.tsx
9
+ const FALLBACK_MEMO_KEY = Symbol("colorField:presets");
10
+ const fallbackMemoKeys = /* @__PURE__ */ new WeakMap();
11
+ const fallbackMemoKey = (source) => {
12
+ if (typeof source !== "function") return FALLBACK_MEMO_KEY;
13
+ let key = fallbackMemoKeys.get(source);
14
+ if (!key) {
15
+ key = Symbol("colorField:presets");
16
+ fallbackMemoKeys.set(source, key);
17
+ }
18
+ return key;
19
+ };
20
+ const resolveStaticLabel = (label, language) => {
21
+ if (label === void 0 || typeof label === "string") return label;
22
+ return label[language] ?? label.en ?? Object.values(label)[0];
23
+ };
24
+ /**
25
+ * Resolves presets server-side (static arrays, async resolvers from
26
+ * field.custom, or the plugin registry) and renders the client ColorField
27
+ * with only serializable props. renderField supplies data/siblingData/req
28
+ * as serverProps; they reflect the doc at render time, so data-dependent
29
+ * resolvers refresh on save/reload, not live with sibling edits.
30
+ */
31
+ const ColorFieldServer = async (props) => {
32
+ const { clientField, colorOptions, data, field, path, permissions, readOnly, req, siblingData } = props;
33
+ const custom = field.custom?.["@10x-media/fields"] ?? {};
34
+ let presets = [];
35
+ try {
36
+ presets = await resolvePresets({
37
+ data,
38
+ memoKey: custom.memoKey ?? fallbackMemoKey(custom.presets),
39
+ req,
40
+ siblingData,
41
+ source: custom.presets
42
+ });
43
+ } catch (error) {
44
+ req.payload.logger.error({ err: error }, `[fields] colorField preset resolver failed for ${field.name}; rendering without dynamic presets`);
45
+ }
46
+ const language = req.i18n.language;
47
+ const resolvedPresets = presets.map((preset) => ({
48
+ key: preset.key,
49
+ label: resolveStaticLabel(preset.label, language) ?? preset.key,
50
+ value: preset.value
51
+ }));
52
+ const presetsLabel = resolveStaticLabel(custom.presetsLabel, language) ?? asTranslate(req.i18n.t)(keys.presets);
53
+ return /* @__PURE__ */ jsx(ColorField, {
54
+ colorOptions: {
55
+ ...colorOptions,
56
+ format: resolveColorFormat(colorOptions.format, req)
57
+ },
58
+ field: clientField,
59
+ path,
60
+ permissions,
61
+ presetsLabel,
62
+ readOnly,
63
+ resolvedPresets
64
+ });
65
+ };
66
+ //#endregion
67
+ export { ColorFieldServer };
68
+
69
+ //# sourceMappingURL=ColorFieldServer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ColorFieldServer.js","names":[],"sources":["../../../../src/fields/color/server/ColorFieldServer.tsx"],"sourcesContent":["import type { StaticLabel, TextFieldServerProps } from 'payload'\nimport { keys } from '../../../translations/keys'\nimport { asTranslate } from '../../../translations/server'\nimport { ColorField } from '../client/ColorField'\nimport {\n\tCOLOR_CUSTOM_KEY,\n\ttype ColorFieldCustom,\n\ttype ColorFieldServerOptions,\n\ttype ColorPresetsResolver,\n\ttype ColorPresetsSource,\n\ttype ResolvedColorPreset,\n} from '../options'\nimport { resolveColorFormat } from '../resolveFormat'\nimport { type NormalizedColorPreset, resolvePresets } from '../resolvePresets'\n\n// Standalone fields built outside colorField() (hand-written config) have no memoKey;\n// keyed per resolver so two standalone fields never share each other's cached presets\nconst FALLBACK_MEMO_KEY = Symbol('colorField:presets')\nconst fallbackMemoKeys = new WeakMap<ColorPresetsResolver, symbol>()\n\nconst fallbackMemoKey = (source: ColorPresetsSource | undefined): symbol => {\n\tif (typeof source !== 'function') return FALLBACK_MEMO_KEY\n\tlet key = fallbackMemoKeys.get(source)\n\tif (!key) {\n\t\tkey = Symbol('colorField:presets')\n\t\tfallbackMemoKeys.set(source, key)\n\t}\n\treturn key\n}\n\nconst resolveStaticLabel = (\n\tlabel: StaticLabel | undefined,\n\tlanguage: string\n): string | undefined => {\n\tif (label === undefined || typeof label === 'string') return label\n\treturn label[language] ?? label.en ?? Object.values(label)[0]\n}\n\ntype ColorFieldServerComponentProps = {\n\tcolorOptions: ColorFieldServerOptions\n} & TextFieldServerProps\n\n/**\n * Resolves presets server-side (static arrays, async resolvers from\n * field.custom, or the plugin registry) and renders the client ColorField\n * with only serializable props. renderField supplies data/siblingData/req\n * as serverProps; they reflect the doc at render time, so data-dependent\n * resolvers refresh on save/reload, not live with sibling edits.\n */\nexport const ColorFieldServer = async (props: ColorFieldServerComponentProps) => {\n\tconst { clientField, colorOptions, data, field, path, permissions, readOnly, req, siblingData } =\n\t\tprops\n\n\tconst custom = (field.custom?.[COLOR_CUSTOM_KEY] ?? {}) as Partial<ColorFieldCustom>\n\tlet presets: NormalizedColorPreset[] = []\n\ttry {\n\t\tpresets = await resolvePresets({\n\t\t\tdata,\n\t\t\tmemoKey: custom.memoKey ?? fallbackMemoKey(custom.presets),\n\t\t\treq,\n\t\t\tsiblingData,\n\t\t\tsource: custom.presets,\n\t\t})\n\t} catch (error) {\n\t\t// A throwing preset resolver must not 500 the edit view; render the picker\n\t\t// without dynamic presets. The afterRead resolve hook logs and degrades reads\n\t\t// separately (be8d91e); this guards the field's own server render.\n\t\treq.payload.logger.error(\n\t\t\t{ err: error },\n\t\t\t`[fields] colorField preset resolver failed for ${field.name}; rendering without dynamic presets`\n\t\t)\n\t}\n\n\tconst language = req.i18n.language\n\tconst resolvedPresets: ResolvedColorPreset[] = presets.map((preset) => ({\n\t\tkey: preset.key,\n\t\tlabel: resolveStaticLabel(preset.label, language) ?? preset.key,\n\t\tvalue: preset.value,\n\t}))\n\tconst presetsLabel =\n\t\tresolveStaticLabel(custom.presetsLabel, language) ?? asTranslate(req.i18n.t)(keys.presets)\n\n\treturn (\n\t\t<ColorField\n\t\t\tcolorOptions={{ ...colorOptions, format: resolveColorFormat(colorOptions.format, req) }}\n\t\t\tfield={clientField}\n\t\t\tpath={path}\n\t\t\tpermissions={permissions}\n\t\t\tpresetsLabel={presetsLabel}\n\t\t\treadOnly={readOnly}\n\t\t\tresolvedPresets={resolvedPresets}\n\t\t/>\n\t)\n}\n"],"mappings":";;;;;;;;AAiBA,MAAM,oBAAoB,OAAO,oBAAoB;AACrD,MAAM,mCAAmB,IAAI,QAAsC;AAEnE,MAAM,mBAAmB,WAAmD;CAC3E,IAAI,OAAO,WAAW,YAAY,OAAO;CACzC,IAAI,MAAM,iBAAiB,IAAI,MAAM;CACrC,IAAI,CAAC,KAAK;EACT,MAAM,OAAO,oBAAoB;EACjC,iBAAiB,IAAI,QAAQ,GAAG;CACjC;CACA,OAAO;AACR;AAEA,MAAM,sBACL,OACA,aACwB;CACxB,IAAI,UAAU,KAAA,KAAa,OAAO,UAAU,UAAU,OAAO;CAC7D,OAAO,MAAM,aAAa,MAAM,MAAM,OAAO,OAAO,KAAK,EAAE;AAC5D;;;;;;;;AAaA,MAAa,mBAAmB,OAAO,UAA0C;CAChF,MAAM,EAAE,aAAa,cAAc,MAAM,OAAO,MAAM,aAAa,UAAU,KAAK,gBACjF;CAED,MAAM,SAAU,MAAM,SAAA,wBAA8B,CAAC;CACrD,IAAI,UAAmC,CAAC;CACxC,IAAI;EACH,UAAU,MAAM,eAAe;GAC9B;GACA,SAAS,OAAO,WAAW,gBAAgB,OAAO,OAAO;GACzD;GACA;GACA,QAAQ,OAAO;EAChB,CAAC;CACF,SAAS,OAAO;EAIf,IAAI,QAAQ,OAAO,MAClB,EAAE,KAAK,MAAM,GACb,kDAAkD,MAAM,KAAK,oCAC9D;CACD;CAEA,MAAM,WAAW,IAAI,KAAK;CAC1B,MAAM,kBAAyC,QAAQ,KAAK,YAAY;EACvE,KAAK,OAAO;EACZ,OAAO,mBAAmB,OAAO,OAAO,QAAQ,KAAK,OAAO;EAC5D,OAAO,OAAO;CACf,EAAE;CACF,MAAM,eACL,mBAAmB,OAAO,cAAc,QAAQ,KAAK,YAAY,IAAI,KAAK,CAAC,EAAE,KAAK,OAAO;CAE1F,OACC,oBAAC,YAAD;EACC,cAAc;GAAE,GAAG;GAAc,QAAQ,mBAAmB,aAAa,QAAQ,GAAG;EAAE;EACtF,OAAO;EACD;EACO;EACC;EACJ;EACO;CACjB,CAAA;AAEH"}
@@ -0,0 +1,32 @@
1
+ .fields-color-cell {
2
+ display: inline-flex;
3
+ align-items: center;
4
+ gap: 8px;
5
+ }
6
+
7
+ .fields-color-cell__swatch {
8
+ position: relative;
9
+ width: 16px;
10
+ height: 16px;
11
+ overflow: hidden;
12
+ border: 1px solid var(--theme-elevation-150);
13
+ border-radius: var(--style-radius-s);
14
+ background-image: conic-gradient(
15
+ var(--theme-elevation-150) 0 25%,
16
+ transparent 0 50%,
17
+ var(--theme-elevation-150) 0 75%,
18
+ transparent 0
19
+ );
20
+ background-size: 8px 8px;
21
+ }
22
+
23
+ .fields-color-cell__swatch > span {
24
+ position: absolute;
25
+ inset: 0;
26
+ display: block;
27
+ }
28
+
29
+ .fields-color-cell__missing {
30
+ color: var(--theme-error-500);
31
+ font-size: 0.75rem;
32
+ }
@@ -0,0 +1,14 @@
1
+ import { resolveKeys } from "./crypto/keys.js";
2
+ import { Payload } from "payload";
3
+
4
+ //#region src/fields/encrypted/boot.d.ts
5
+ /**
6
+ * Fail-fast key validation at boot: resolves every distinct KeysConfig used by
7
+ * encrypted fields (plus the default ring when any field falls back to it) so
8
+ * missing secrets, broken providers, and empty material surface as startup
9
+ * errors, not as runtime surprises on first write.
10
+ */
11
+ declare const validateEncryptedBoot: (payload: Payload, pluginKeys?: Parameters<typeof resolveKeys>[0]) => Promise<void>;
12
+ //#endregion
13
+ export { validateEncryptedBoot };
14
+ //# sourceMappingURL=boot.d.ts.map
@@ -0,0 +1,22 @@
1
+ import { resolveKeys } from "./crypto/keys.js";
2
+ import { scanEncryptedFields } from "./scan.js";
3
+ //#region src/fields/encrypted/boot.ts
4
+ /**
5
+ * Fail-fast key validation at boot: resolves every distinct KeysConfig used by
6
+ * encrypted fields (plus the default ring when any field falls back to it) so
7
+ * missing secrets, broken providers, and empty material surface as startup
8
+ * errors, not as runtime surprises on first write.
9
+ */
10
+ const validateEncryptedBoot = async (payload, pluginKeys) => {
11
+ const configs = /* @__PURE__ */ new Set();
12
+ if (pluginKeys) configs.add(pluginKeys);
13
+ let usesDefault = false;
14
+ for (const collection of payload.config.collections) for (const [, marker] of scanEncryptedFields(collection.fields)) if (marker.keys) configs.add(marker.keys);
15
+ else if (!pluginKeys) usesDefault = true;
16
+ await Promise.all([...configs].map((config) => resolveKeys(config, payload.config.secret)));
17
+ if (usesDefault) await resolveKeys(void 0, payload.config.secret);
18
+ };
19
+ //#endregion
20
+ export { validateEncryptedBoot };
21
+
22
+ //# sourceMappingURL=boot.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"boot.js","names":[],"sources":["../../../src/fields/encrypted/boot.ts"],"sourcesContent":["import type { Payload } from 'payload'\nimport { resolveKeys } from './crypto/keys'\nimport { scanEncryptedFields } from './scan'\n\n/**\n * Fail-fast key validation at boot: resolves every distinct KeysConfig used by\n * encrypted fields (plus the default ring when any field falls back to it) so\n * missing secrets, broken providers, and empty material surface as startup\n * errors, not as runtime surprises on first write.\n */\nexport const validateEncryptedBoot = async (\n\tpayload: Payload,\n\tpluginKeys?: Parameters<typeof resolveKeys>[0]\n): Promise<void> => {\n\tconst configs = new Set<NonNullable<Parameters<typeof resolveKeys>[0]>>()\n\tif (pluginKeys) {\n\t\tconfigs.add(pluginKeys)\n\t}\n\t// The default ring is only reached when a field has no per-field keys AND the\n\t// plugin declared no keys; ringForRequest resolves marker.keys ?? pluginKeys\n\t// and falls back to the secret-derived ring only when both are absent.\n\tlet usesDefault = false\n\tfor (const collection of payload.config.collections) {\n\t\tfor (const [, marker] of scanEncryptedFields(collection.fields)) {\n\t\t\tif (marker.keys) {\n\t\t\t\tconfigs.add(marker.keys)\n\t\t\t} else if (!pluginKeys) {\n\t\t\t\tusesDefault = true\n\t\t\t}\n\t\t}\n\t}\n\tawait Promise.all([...configs].map((config) => resolveKeys(config, payload.config.secret)))\n\tif (usesDefault) {\n\t\tawait resolveKeys(undefined, payload.config.secret)\n\t}\n}\n"],"mappings":";;;;;;;;;AAUA,MAAa,wBAAwB,OACpC,SACA,eACmB;CACnB,MAAM,0BAAU,IAAI,IAAoD;CACxE,IAAI,YACH,QAAQ,IAAI,UAAU;CAKvB,IAAI,cAAc;CAClB,KAAK,MAAM,cAAc,QAAQ,OAAO,aACvC,KAAK,MAAM,GAAG,WAAW,oBAAoB,WAAW,MAAM,GAC7D,IAAI,OAAO,MACV,QAAQ,IAAI,OAAO,IAAI;MACjB,IAAI,CAAC,YACX,cAAc;CAIjB,MAAM,QAAQ,IAAI,CAAC,GAAG,OAAO,EAAE,KAAK,WAAW,YAAY,QAAQ,QAAQ,OAAO,MAAM,CAAC,CAAC;CAC1F,IAAI,aACH,MAAM,YAAY,KAAA,GAAW,QAAQ,OAAO,MAAM;AAEpD"}
@@ -0,0 +1,89 @@
1
+ "use client";
2
+ import { EyeToggle } from "./EyeToggle.js";
3
+ import { dotString } from "./MaskDots.js";
4
+ import { FieldDescription, FieldError, FieldLabel, useField, useFormFields, useFormSubmitted } from "@payloadcms/ui";
5
+ import { useCallback, useState } from "react";
6
+ import { jsx, jsxs } from "react/jsx-runtime";
7
+ //#region src/fields/encrypted/components/EncryptedInput.tsx
8
+ /**
9
+ * Attached-placement field for single text, email, and number. One input is
10
+ * mounted in both states and only morphs on toggle: a readOnly dots facsimile
11
+ * while concealed, the bound editable input while revealed. Reusing the same
12
+ * element means revealing never remounts the control and never shifts layout.
13
+ * Concealed, the input is readOnly and its value is the dot run, so the decrypted
14
+ * plaintext (already in form state from afterRead) never reaches the DOM and
15
+ * masking cannot mutate form state; setValue only runs while revealed. The eye is
16
+ * a sibling flex segment that stays put across toggles.
17
+ */
18
+ const EncryptedInput = ({ field, kind, maskDots, path }) => {
19
+ const [revealed, setRevealed] = useState(false);
20
+ const { setValue, showError, value } = useField({ path });
21
+ const submitted = useFormSubmitted();
22
+ const invalid = useFormFields(([fields]) => fields?.[path]?.valid === false);
23
+ const showFieldError = submitted && invalid;
24
+ const toggle = useCallback(() => setRevealed((prev) => !prev), []);
25
+ const inputId = `field-${path.replace(/\./g, "__")}`;
26
+ const isNumber = kind === "number";
27
+ const handleChange = (event) => {
28
+ if (isNumber) {
29
+ const parsed = Number.parseFloat(event.target.value);
30
+ setValue(Number.isNaN(parsed) ? null : parsed);
31
+ return;
32
+ }
33
+ setValue(event.target.value);
34
+ };
35
+ const revealedValue = isNumber ? typeof value === "number" ? value : "" : typeof value === "string" ? value : "";
36
+ return /* @__PURE__ */ jsxs("div", {
37
+ className: [
38
+ "field-type",
39
+ kind,
40
+ showFieldError && "error",
41
+ "tenx-protected-field",
42
+ "tenx-protected-field--attached"
43
+ ].filter(Boolean).join(" "),
44
+ children: [/* @__PURE__ */ jsx(FieldLabel, {
45
+ label: field.label,
46
+ localized: field.localized,
47
+ path,
48
+ required: field.required
49
+ }), /* @__PURE__ */ jsxs("div", {
50
+ className: "field-type__wrap",
51
+ children: [
52
+ /* @__PURE__ */ jsx(FieldError, { path }),
53
+ /* @__PURE__ */ jsxs("div", {
54
+ className: "tenx-protected-field__attached-row",
55
+ children: [/* @__PURE__ */ jsx("input", {
56
+ "aria-invalid": revealed ? showError : void 0,
57
+ autoComplete: revealed && !isNumber ? field.admin?.autoComplete : void 0,
58
+ className: revealed ? "tenx-protected-field__revealed-input" : "tenx-protected-field__masked-input",
59
+ id: inputId,
60
+ inputMode: revealed && isNumber ? "decimal" : void 0,
61
+ name: path,
62
+ onChange: revealed ? handleChange : void 0,
63
+ placeholder: revealed && !isNumber && typeof field.admin?.placeholder === "string" ? field.admin.placeholder : void 0,
64
+ readOnly: !revealed,
65
+ step: revealed && isNumber ? field.admin?.step : void 0,
66
+ tabIndex: revealed ? void 0 : -1,
67
+ type: revealed ? isNumber ? "number" : kind === "email" ? "email" : "text" : "text",
68
+ value: revealed ? revealedValue : dotString(maskDots)
69
+ }), /* @__PURE__ */ jsx("div", {
70
+ className: "tenx-protected-field__eye-wrap tenx-protected-field__eye-wrap--attached",
71
+ children: /* @__PURE__ */ jsx(EyeToggle, {
72
+ className: "tenx-protected-field__eye--attached",
73
+ onToggle: toggle,
74
+ revealed
75
+ })
76
+ })]
77
+ }),
78
+ /* @__PURE__ */ jsx(FieldDescription, {
79
+ description: field.admin?.description,
80
+ path
81
+ })
82
+ ]
83
+ })]
84
+ });
85
+ };
86
+ //#endregion
87
+ export { EncryptedInput };
88
+
89
+ //# sourceMappingURL=EncryptedInput.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EncryptedInput.js","names":[],"sources":["../../../../src/fields/encrypted/components/EncryptedInput.tsx"],"sourcesContent":["'use client'\nimport {\n\tFieldDescription,\n\tFieldError,\n\tFieldLabel,\n\tuseField,\n\tuseFormFields,\n\tuseFormSubmitted,\n} from '@payloadcms/ui'\nimport type React from 'react'\nimport { useCallback, useState } from 'react'\nimport { EyeToggle } from './EyeToggle'\nimport { dotString } from './MaskDots'\nimport type { EncryptedFieldConfig } from './placement'\n\ntype InputKind = 'email' | 'number' | 'text'\n\ninterface EncryptedInputProps {\n\tfield: EncryptedFieldConfig\n\tkind: InputKind\n\tmaskDots: number\n\tpath: string\n}\n\n/**\n * Attached-placement field for single text, email, and number. One input is\n * mounted in both states and only morphs on toggle: a readOnly dots facsimile\n * while concealed, the bound editable input while revealed. Reusing the same\n * element means revealing never remounts the control and never shifts layout.\n * Concealed, the input is readOnly and its value is the dot run, so the decrypted\n * plaintext (already in form state from afterRead) never reaches the DOM and\n * masking cannot mutate form state; setValue only runs while revealed. The eye is\n * a sibling flex segment that stays put across toggles.\n */\nexport const EncryptedInput: React.FC<EncryptedInputProps> = ({ field, kind, maskDots, path }) => {\n\tconst [revealed, setRevealed] = useState(false)\n\tconst { setValue, showError, value } = useField<number | string>({ path })\n\tconst submitted = useFormSubmitted()\n\tconst invalid = useFormFields(([fields]) => fields?.[path]?.valid === false)\n\tconst showFieldError = submitted && invalid\n\tconst toggle = useCallback(() => setRevealed((prev) => !prev), [])\n\tconst inputId = `field-${path.replace(/\\./g, '__')}`\n\tconst isNumber = kind === 'number'\n\n\tconst handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {\n\t\tif (isNumber) {\n\t\t\tconst parsed = Number.parseFloat(event.target.value)\n\t\t\tsetValue(Number.isNaN(parsed) ? null : parsed)\n\t\t\treturn\n\t\t}\n\t\tsetValue(event.target.value)\n\t}\n\n\tconst revealedValue = isNumber\n\t\t? typeof value === 'number'\n\t\t\t? value\n\t\t\t: ''\n\t\t: typeof value === 'string'\n\t\t\t? value\n\t\t\t: ''\n\n\treturn (\n\t\t<div\n\t\t\tclassName={[\n\t\t\t\t'field-type',\n\t\t\t\tkind,\n\t\t\t\tshowFieldError && 'error',\n\t\t\t\t'tenx-protected-field',\n\t\t\t\t'tenx-protected-field--attached',\n\t\t\t]\n\t\t\t\t.filter(Boolean)\n\t\t\t\t.join(' ')}\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<div className=\"tenx-protected-field__attached-row\">\n\t\t\t\t\t<input\n\t\t\t\t\t\taria-invalid={revealed ? showError : undefined}\n\t\t\t\t\t\tautoComplete={revealed && !isNumber ? field.admin?.autoComplete : undefined}\n\t\t\t\t\t\tclassName={\n\t\t\t\t\t\t\trevealed\n\t\t\t\t\t\t\t\t? 'tenx-protected-field__revealed-input'\n\t\t\t\t\t\t\t\t: 'tenx-protected-field__masked-input'\n\t\t\t\t\t\t}\n\t\t\t\t\t\tid={inputId}\n\t\t\t\t\t\tinputMode={revealed && isNumber ? 'decimal' : undefined}\n\t\t\t\t\t\tname={path}\n\t\t\t\t\t\tonChange={revealed ? handleChange : undefined}\n\t\t\t\t\t\tplaceholder={\n\t\t\t\t\t\t\trevealed && !isNumber && typeof field.admin?.placeholder === 'string'\n\t\t\t\t\t\t\t\t? field.admin.placeholder\n\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t}\n\t\t\t\t\t\treadOnly={!revealed}\n\t\t\t\t\t\tstep={revealed && isNumber ? field.admin?.step : undefined}\n\t\t\t\t\t\ttabIndex={revealed ? undefined : -1}\n\t\t\t\t\t\ttype={revealed ? (isNumber ? 'number' : kind === 'email' ? 'email' : 'text') : 'text'}\n\t\t\t\t\t\tvalue={revealed ? revealedValue : dotString(maskDots)}\n\t\t\t\t\t/>\n\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<EyeToggle\n\t\t\t\t\t\t\tclassName=\"tenx-protected-field__eye--attached\"\n\t\t\t\t\t\t\tonToggle={toggle}\n\t\t\t\t\t\t\trevealed={revealed}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\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"],"mappings":";;;;;;;;;;;;;;;;;AAkCA,MAAa,kBAAiD,EAAE,OAAO,MAAM,UAAU,WAAW;CACjG,MAAM,CAAC,UAAU,eAAe,SAAS,KAAK;CAC9C,MAAM,EAAE,UAAU,WAAW,UAAU,SAA0B,EAAE,KAAK,CAAC;CACzE,MAAM,YAAY,iBAAiB;CACnC,MAAM,UAAU,eAAe,CAAC,YAAY,SAAS,OAAO,UAAU,KAAK;CAC3E,MAAM,iBAAiB,aAAa;CACpC,MAAM,SAAS,kBAAkB,aAAa,SAAS,CAAC,IAAI,GAAG,CAAC,CAAC;CACjE,MAAM,UAAU,SAAS,KAAK,QAAQ,OAAO,IAAI;CACjD,MAAM,WAAW,SAAS;CAE1B,MAAM,gBAAgB,UAA+C;EACpE,IAAI,UAAU;GACb,MAAM,SAAS,OAAO,WAAW,MAAM,OAAO,KAAK;GACnD,SAAS,OAAO,MAAM,MAAM,IAAI,OAAO,MAAM;GAC7C;EACD;EACA,SAAS,MAAM,OAAO,KAAK;CAC5B;CAEA,MAAM,gBAAgB,WACnB,OAAO,UAAU,WAChB,QACA,KACD,OAAO,UAAU,WAChB,QACA;CAEJ,OACC,qBAAC,OAAD;EACC,WAAW;GACV;GACA;GACA,kBAAkB;GAClB;GACA;EACD,EACE,OAAO,OAAO,EACd,KAAK,GAAG;YATX,CAWC,oBAAC,YAAD;GACC,OAAO,MAAM;GACb,WAAW,MAAM;GACX;GACN,UAAU,MAAM;EAChB,CAAA,GACD,qBAAC,OAAD;GAAK,WAAU;aAAf;IACC,oBAAC,YAAD,EAAkB,KAAO,CAAA;IACzB,qBAAC,OAAD;KAAK,WAAU;eAAf,CACC,oBAAC,SAAD;MACC,gBAAc,WAAW,YAAY,KAAA;MACrC,cAAc,YAAY,CAAC,WAAW,MAAM,OAAO,eAAe,KAAA;MAClE,WACC,WACG,yCACA;MAEJ,IAAI;MACJ,WAAW,YAAY,WAAW,YAAY,KAAA;MAC9C,MAAM;MACN,UAAU,WAAW,eAAe,KAAA;MACpC,aACC,YAAY,CAAC,YAAY,OAAO,MAAM,OAAO,gBAAgB,WAC1D,MAAM,MAAM,cACZ,KAAA;MAEJ,UAAU,CAAC;MACX,MAAM,YAAY,WAAW,MAAM,OAAO,OAAO,KAAA;MACjD,UAAU,WAAW,KAAA,IAAY;MACjC,MAAM,WAAY,WAAW,WAAW,SAAS,UAAU,UAAU,SAAU;MAC/E,OAAO,WAAW,gBAAgB,UAAU,QAAQ;KACpD,CAAA,GACD,oBAAC,OAAD;MAAK,WAAU;gBACd,oBAAC,WAAD;OACC,WAAU;OACV,UAAU;OACA;MACV,CAAA;KACG,CAAA,CACD;;IACL,oBAAC,kBAAD;KAAkB,aAAa,MAAM,OAAO;KAAmB;IAAO,CAAA;GAClE;IACD;;AAEP"}
@@ -0,0 +1,86 @@
1
+ "use client";
2
+ import { EyeToggle } from "./EyeToggle.js";
3
+ import { dotString } from "./MaskDots.js";
4
+ import { FieldDescription, FieldError, FieldLabel, useField, useFormFields, useFormSubmitted } from "@payloadcms/ui";
5
+ import { useState } from "react";
6
+ import { jsx, jsxs } from "react/jsx-runtime";
7
+ //#region src/fields/encrypted/components/EncryptedTextarea.tsx
8
+ /**
9
+ * The revealed, bound textarea. The only part that calls `useField`; the
10
+ * concealed state renders a readOnly dots textarea instead, so masking cannot
11
+ * write form state. Validation stays server-side.
12
+ */
13
+ const BoundTextarea = ({ field, path }) => {
14
+ const { setValue, value } = useField({ path });
15
+ return /* @__PURE__ */ jsx("div", {
16
+ className: "textarea-outer",
17
+ children: /* @__PURE__ */ jsx("textarea", {
18
+ className: "tenx-protected-field__revealed-textarea",
19
+ id: `field-${path.replace(/\./g, "__")}`,
20
+ name: path,
21
+ onChange: (event) => setValue(event.target.value),
22
+ rows: field.admin?.rows,
23
+ value: typeof value === "string" ? value : ""
24
+ })
25
+ });
26
+ };
27
+ /**
28
+ * Corner-placement wrapper for textarea. Renders the stable native chrome with
29
+ * the eye pinned to the top-right corner of the field wrap; only the textarea
30
+ * swaps between the concealed dots facsimile and the bound textarea. The wrapper
31
+ * only reads form state (no `useField`, no `setValue`).
32
+ */
33
+ const EncryptedTextarea = ({ field, maskDots, path }) => {
34
+ const [revealed, setRevealed] = useState(false);
35
+ const submitted = useFormSubmitted();
36
+ const invalid = useFormFields(([fields]) => fields?.[path]?.valid === false);
37
+ return /* @__PURE__ */ jsxs("div", {
38
+ className: [
39
+ "field-type",
40
+ "textarea",
41
+ submitted && invalid && "error",
42
+ "tenx-protected-field",
43
+ "tenx-protected-field--corner"
44
+ ].filter(Boolean).join(" "),
45
+ children: [/* @__PURE__ */ jsx(FieldLabel, {
46
+ label: field.label,
47
+ localized: field.localized,
48
+ path,
49
+ required: field.required
50
+ }), /* @__PURE__ */ jsxs("div", {
51
+ className: "field-type__wrap",
52
+ children: [
53
+ /* @__PURE__ */ jsx(FieldError, { path }),
54
+ revealed ? /* @__PURE__ */ jsx(BoundTextarea, {
55
+ field,
56
+ path
57
+ }) : /* @__PURE__ */ jsx("div", {
58
+ className: "textarea-outer",
59
+ children: /* @__PURE__ */ jsx("textarea", {
60
+ className: "tenx-protected-field__masked-textarea",
61
+ readOnly: true,
62
+ rows: field.admin?.rows,
63
+ tabIndex: -1,
64
+ value: dotString(maskDots)
65
+ })
66
+ }),
67
+ /* @__PURE__ */ jsx("div", {
68
+ className: "tenx-protected-field__eye-wrap tenx-protected-field__eye-wrap--corner",
69
+ children: /* @__PURE__ */ jsx(EyeToggle, {
70
+ className: "tenx-protected-field__eye--floating",
71
+ onToggle: () => setRevealed((prev) => !prev),
72
+ revealed
73
+ })
74
+ }),
75
+ /* @__PURE__ */ jsx(FieldDescription, {
76
+ description: field.admin?.description,
77
+ path
78
+ })
79
+ ]
80
+ })]
81
+ });
82
+ };
83
+ //#endregion
84
+ export { EncryptedTextarea };
85
+
86
+ //# sourceMappingURL=EncryptedTextarea.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EncryptedTextarea.js","names":[],"sources":["../../../../src/fields/encrypted/components/EncryptedTextarea.tsx"],"sourcesContent":["'use client'\nimport {\n\tFieldDescription,\n\tFieldError,\n\tFieldLabel,\n\tuseField,\n\tuseFormFields,\n\tuseFormSubmitted,\n} from '@payloadcms/ui'\nimport type React from 'react'\nimport { useState } from 'react'\nimport { EyeToggle } from './EyeToggle'\nimport { dotString } from './MaskDots'\nimport type { EncryptedFieldConfig } from './placement'\n\ninterface EncryptedTextareaProps {\n\tfield: EncryptedFieldConfig\n\tmaskDots: number\n\tpath: string\n}\n\n/**\n * The revealed, bound textarea. The only part that calls `useField`; the\n * concealed state renders a readOnly dots textarea instead, so masking cannot\n * write form state. Validation stays server-side.\n */\nconst BoundTextarea: React.FC<{ field: EncryptedFieldConfig; path: string }> = ({\n\tfield,\n\tpath,\n}) => {\n\tconst { setValue, value } = useField<string>({ path })\n\treturn (\n\t\t<div className=\"textarea-outer\">\n\t\t\t<textarea\n\t\t\t\tclassName=\"tenx-protected-field__revealed-textarea\"\n\t\t\t\tid={`field-${path.replace(/\\./g, '__')}`}\n\t\t\t\tname={path}\n\t\t\t\tonChange={(event) => setValue(event.target.value)}\n\t\t\t\trows={field.admin?.rows}\n\t\t\t\tvalue={typeof value === 'string' ? value : ''}\n\t\t\t/>\n\t\t</div>\n\t)\n}\n\n/**\n * Corner-placement wrapper for textarea. Renders the stable native chrome with\n * the eye pinned to the top-right corner of the field wrap; only the textarea\n * swaps between the concealed dots facsimile and the bound textarea. The wrapper\n * only reads form state (no `useField`, no `setValue`).\n */\nexport const EncryptedTextarea: React.FC<EncryptedTextareaProps> = ({ field, maskDots, path }) => {\n\tconst [revealed, setRevealed] = useState(false)\n\tconst submitted = useFormSubmitted()\n\tconst invalid = useFormFields(([fields]) => fields?.[path]?.valid === false)\n\tconst showError = submitted && invalid\n\treturn (\n\t\t<div\n\t\t\tclassName={[\n\t\t\t\t'field-type',\n\t\t\t\t'textarea',\n\t\t\t\tshowError && 'error',\n\t\t\t\t'tenx-protected-field',\n\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>\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{revealed ? (\n\t\t\t\t\t<BoundTextarea field={field} path={path} />\n\t\t\t\t) : (\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\tclassName=\"tenx-protected-field__masked-textarea\"\n\t\t\t\t\t\t\treadOnly\n\t\t\t\t\t\t\trows={field.admin?.rows}\n\t\t\t\t\t\t\ttabIndex={-1}\n\t\t\t\t\t\t\tvalue={dotString(maskDots)}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</div>\n\t\t\t\t)}\n\t\t\t\t<div className=\"tenx-protected-field__eye-wrap tenx-protected-field__eye-wrap--corner\">\n\t\t\t\t\t<EyeToggle\n\t\t\t\t\t\tclassName=\"tenx-protected-field__eye--floating\"\n\t\t\t\t\t\tonToggle={() => setRevealed((prev) => !prev)}\n\t\t\t\t\t\trevealed={revealed}\n\t\t\t\t\t/>\n\t\t\t\t</div>\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"],"mappings":";;;;;;;;;;;;AA0BA,MAAM,iBAA0E,EAC/E,OACA,WACK;CACL,MAAM,EAAE,UAAU,UAAU,SAAiB,EAAE,KAAK,CAAC;CACrD,OACC,oBAAC,OAAD;EAAK,WAAU;YACd,oBAAC,YAAD;GACC,WAAU;GACV,IAAI,SAAS,KAAK,QAAQ,OAAO,IAAI;GACrC,MAAM;GACN,WAAW,UAAU,SAAS,MAAM,OAAO,KAAK;GAChD,MAAM,MAAM,OAAO;GACnB,OAAO,OAAO,UAAU,WAAW,QAAQ;EAC3C,CAAA;CACG,CAAA;AAEP;;;;;;;AAQA,MAAa,qBAAuD,EAAE,OAAO,UAAU,WAAW;CACjG,MAAM,CAAC,UAAU,eAAe,SAAS,KAAK;CAC9C,MAAM,YAAY,iBAAiB;CACnC,MAAM,UAAU,eAAe,CAAC,YAAY,SAAS,OAAO,UAAU,KAAK;CAE3E,OACC,qBAAC,OAAD;EACC,WAAW;GACV;GACA;GALe,aAAa,WAMf;GACb;GACA;EACD,EACE,OAAO,OAAO,EACd,KAAK,GAAG;YATX,CAWC,oBAAC,YAAD;GACC,OAAO,MAAM;GACb,WAAW,MAAM;GACX;GACN,UAAU,MAAM;EAChB,CAAA,GACD,qBAAC,OAAD;GAAK,WAAU;aAAf;IACC,oBAAC,YAAD,EAAkB,KAAO,CAAA;IACxB,WACA,oBAAC,eAAD;KAAsB;KAAa;IAAO,CAAA,IAE1C,oBAAC,OAAD;KAAK,WAAU;eACd,oBAAC,YAAD;MACC,WAAU;MACV,UAAA;MACA,MAAM,MAAM,OAAO;MACnB,UAAU;MACV,OAAO,UAAU,QAAQ;KACzB,CAAA;IACG,CAAA;IAEN,oBAAC,OAAD;KAAK,WAAU;eACd,oBAAC,WAAD;MACC,WAAU;MACV,gBAAgB,aAAa,SAAS,CAAC,IAAI;MACjC;KACV,CAAA;IACG,CAAA;IACL,oBAAC,kBAAD;KAAkB,aAAa,MAAM,OAAO;KAAmB;IAAO,CAAA;GAClE;IACD;;AAEP"}
@@ -0,0 +1,51 @@
1
+ "use client";
2
+ import { keys } from "../../../translations/keys.js";
3
+ import { useTranslation as useTranslation$1 } from "../../../translations/useTranslation.js";
4
+ import { Button } from "@payloadcms/ui";
5
+ import { Fragment } from "react";
6
+ import { jsx, jsxs } from "react/jsx-runtime";
7
+ //#region src/fields/encrypted/components/EyeToggle.tsx
8
+ /**
9
+ * Reimplemented Payload eye glyph (`@payloadcms/ui` does not export one). `active`
10
+ * true draws the struck-through eye (value shown, click to hide); false draws the
11
+ * open eye (value concealed, click to reveal). Sized by the host button's
12
+ * `--btn-icon-size`; only `.stroke` needs styling.
13
+ */
14
+ const EyeGlyph = ({ active }) => /* @__PURE__ */ jsx("svg", {
15
+ "aria-hidden": "true",
16
+ className: "tenx-protected-field__eye-icon",
17
+ viewBox: "0 0 16 12",
18
+ xmlns: "http://www.w3.org/2000/svg",
19
+ children: active ? /* @__PURE__ */ jsx("path", {
20
+ className: "stroke",
21
+ d: "M2 11.5L4.35141 9.51035M15 0.5L12.6486 2.48965M10.915 6.64887C10.6493 7.64011 9.78959 8.38832 8.7408 8.48855M10.4085 4.38511C9.94992 3.84369 9.2651 3.5 8.5 3.5C7.11929 3.5 6 4.61929 6 6C6 6.61561 6.22251 7.17926 6.59149 7.61489M10.4085 4.38511L6.59149 7.61489M10.4085 4.38511L12.6486 2.48965M6.59149 7.61489L4.35141 9.51035M14.1292 3.92915C15.0431 5.02085 15.5 6 15.5 6C15.5 6 13.1667 11 8.5 11C7.67995 11 6.93195 10.8456 6.256 10.5911M4.35141 9.51035C2.45047 8.03672 1.5 6 1.5 6C1.5 6 3.83333 1 8.5 1C10.1882 1 11.5711 1.65437 12.6486 2.48965"
22
+ }) : /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("circle", {
23
+ className: "stroke",
24
+ cx: "8.5",
25
+ cy: "6",
26
+ r: "2.5"
27
+ }), /* @__PURE__ */ jsx("path", {
28
+ className: "stroke",
29
+ d: "M8.5 1C3.83333 1 1.5 6 1.5 6C1.5 6 3.83333 11 8.5 11C13.1667 11 15.5 6 15.5 6C15.5 6 13.1667 1 8.5 1Z"
30
+ })] })
31
+ });
32
+ /**
33
+ * The reveal toggle shared by every concealed field. Present in both masked and
34
+ * revealed states so toggling never removes the focused control from the tree.
35
+ */
36
+ const EyeToggle = ({ className, onToggle, revealed }) => {
37
+ const { t } = useTranslation$1();
38
+ return /* @__PURE__ */ jsx(Button, {
39
+ "aria-label": revealed ? t(keys.hideValue) : t(keys.showValue),
40
+ buttonStyle: "none",
41
+ className: ["tenx-protected-field__eye", className].filter(Boolean).join(" "),
42
+ extraButtonProps: { "aria-pressed": revealed },
43
+ icon: /* @__PURE__ */ jsx(EyeGlyph, { active: revealed }),
44
+ margin: false,
45
+ onClick: onToggle
46
+ });
47
+ };
48
+ //#endregion
49
+ export { EyeToggle };
50
+
51
+ //# sourceMappingURL=EyeToggle.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EyeToggle.js","names":["useTranslation"],"sources":["../../../../src/fields/encrypted/components/EyeToggle.tsx"],"sourcesContent":["'use client'\nimport { Button } from '@payloadcms/ui'\nimport type React from 'react'\nimport { Fragment } from 'react'\nimport { keys } from '../../../translations/keys'\nimport { useTranslation } from '../../../translations/useTranslation'\n\n/**\n * Reimplemented Payload eye glyph (`@payloadcms/ui` does not export one). `active`\n * true draws the struck-through eye (value shown, click to hide); false draws the\n * open eye (value concealed, click to reveal). Sized by the host button's\n * `--btn-icon-size`; only `.stroke` needs styling.\n */\nconst EyeGlyph: React.FC<{ active: boolean }> = ({ active }) => (\n\t<svg\n\t\taria-hidden=\"true\"\n\t\tclassName=\"tenx-protected-field__eye-icon\"\n\t\tviewBox=\"0 0 16 12\"\n\t\txmlns=\"http://www.w3.org/2000/svg\"\n\t>\n\t\t{active ? (\n\t\t\t<path\n\t\t\t\tclassName=\"stroke\"\n\t\t\t\td=\"M2 11.5L4.35141 9.51035M15 0.5L12.6486 2.48965M10.915 6.64887C10.6493 7.64011 9.78959 8.38832 8.7408 8.48855M10.4085 4.38511C9.94992 3.84369 9.2651 3.5 8.5 3.5C7.11929 3.5 6 4.61929 6 6C6 6.61561 6.22251 7.17926 6.59149 7.61489M10.4085 4.38511L6.59149 7.61489M10.4085 4.38511L12.6486 2.48965M6.59149 7.61489L4.35141 9.51035M14.1292 3.92915C15.0431 5.02085 15.5 6 15.5 6C15.5 6 13.1667 11 8.5 11C7.67995 11 6.93195 10.8456 6.256 10.5911M4.35141 9.51035C2.45047 8.03672 1.5 6 1.5 6C1.5 6 3.83333 1 8.5 1C10.1882 1 11.5711 1.65437 12.6486 2.48965\"\n\t\t\t/>\n\t\t) : (\n\t\t\t<Fragment>\n\t\t\t\t<circle className=\"stroke\" cx=\"8.5\" cy=\"6\" r=\"2.5\" />\n\t\t\t\t<path\n\t\t\t\t\tclassName=\"stroke\"\n\t\t\t\t\td=\"M8.5 1C3.83333 1 1.5 6 1.5 6C1.5 6 3.83333 11 8.5 11C13.1667 11 15.5 6 15.5 6C15.5 6 13.1667 1 8.5 1Z\"\n\t\t\t\t/>\n\t\t\t</Fragment>\n\t\t)}\n\t</svg>\n)\n\n/**\n * The reveal toggle shared by every concealed field. Present in both masked and\n * revealed states so toggling never removes the focused control from the tree.\n */\nexport const EyeToggle: React.FC<{\n\tclassName?: string\n\tonToggle: () => void\n\trevealed: boolean\n}> = ({ className, onToggle, revealed }) => {\n\tconst { t } = useTranslation()\n\tconst label = revealed ? t(keys.hideValue) : t(keys.showValue)\n\treturn (\n\t\t<Button\n\t\t\taria-label={label}\n\t\t\tbuttonStyle=\"none\"\n\t\t\tclassName={['tenx-protected-field__eye', className].filter(Boolean).join(' ')}\n\t\t\textraButtonProps={{ 'aria-pressed': revealed }}\n\t\t\ticon={<EyeGlyph active={revealed} />}\n\t\t\tmargin={false}\n\t\t\tonClick={onToggle}\n\t\t/>\n\t)\n}\n"],"mappings":";;;;;;;;;;;;;AAaA,MAAM,YAA2C,EAAE,aAClD,oBAAC,OAAD;CACC,eAAY;CACZ,WAAU;CACV,SAAQ;CACR,OAAM;WAEL,SACA,oBAAC,QAAD;EACC,WAAU;EACV,GAAE;CACF,CAAA,IAED,qBAAC,UAAD,EAAA,UAAA,CACC,oBAAC,UAAD;EAAQ,WAAU;EAAS,IAAG;EAAM,IAAG;EAAI,GAAE;CAAO,CAAA,GACpD,oBAAC,QAAD;EACC,WAAU;EACV,GAAE;CACF,CAAA,CACQ,EAAA,CAAA;AAEP,CAAA;;;;;AAON,MAAa,aAIP,EAAE,WAAW,UAAU,eAAe;CAC3C,MAAM,EAAE,MAAMA,iBAAe;CAE7B,OACC,oBAAC,QAAD;EACC,cAHY,WAAW,EAAE,KAAK,SAAS,IAAI,EAAE,KAAK,SAAS;EAI3D,aAAY;EACZ,WAAW,CAAC,6BAA6B,SAAS,EAAE,OAAO,OAAO,EAAE,KAAK,GAAG;EAC5E,kBAAkB,EAAE,gBAAgB,SAAS;EAC7C,MAAM,oBAAC,UAAD,EAAU,QAAQ,SAAW,CAAA;EACnC,QAAQ;EACR,SAAS;CACT,CAAA;AAEH"}
@@ -0,0 +1,20 @@
1
+ "use client";
2
+ import { jsx } from "react/jsx-runtime";
3
+ //#region src/fields/encrypted/components/MaskDots.tsx
4
+ const BULLET = "•";
5
+ /** A run of `count` bullet characters, for input `value` attributes. */
6
+ const dotString = (count) => BULLET.repeat(Math.max(0, Math.trunc(count)));
7
+ /**
8
+ * Decorative dot run for non-input concealed faces (select value, radio label,
9
+ * code/json boxes). Hidden from assistive tech: the surrounding native markup
10
+ * already carries the field label, and the eye carries the action.
11
+ */
12
+ const MaskDots = ({ className, count }) => /* @__PURE__ */ jsx("span", {
13
+ "aria-hidden": "true",
14
+ className: ["tenx-protected-field__dots", className].filter(Boolean).join(" "),
15
+ children: dotString(count)
16
+ });
17
+ //#endregion
18
+ export { MaskDots, dotString };
19
+
20
+ //# sourceMappingURL=MaskDots.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MaskDots.js","names":[],"sources":["../../../../src/fields/encrypted/components/MaskDots.tsx"],"sourcesContent":["'use client'\nimport type React from 'react'\n\nconst BULLET = '•'\n\n/** A run of `count` bullet characters, for input `value` attributes. */\nexport const dotString = (count: number): string => BULLET.repeat(Math.max(0, Math.trunc(count)))\n\n/**\n * Decorative dot run for non-input concealed faces (select value, radio label,\n * code/json boxes). Hidden from assistive tech: the surrounding native markup\n * already carries the field label, and the eye carries the action.\n */\nexport const MaskDots: React.FC<{ className?: string; count: number }> = ({ className, count }) => (\n\t<span\n\t\taria-hidden=\"true\"\n\t\tclassName={['tenx-protected-field__dots', className].filter(Boolean).join(' ')}\n\t>\n\t\t{dotString(count)}\n\t</span>\n)\n"],"mappings":";;;AAGA,MAAM,SAAS;;AAGf,MAAa,aAAa,UAA0B,OAAO,OAAO,KAAK,IAAI,GAAG,KAAK,MAAM,KAAK,CAAC,CAAC;;;;;;AAOhG,MAAa,YAA6D,EAAE,WAAW,YACtF,oBAAC,QAAD;CACC,eAAY;CACZ,WAAW,CAAC,8BAA8B,SAAS,EAAE,OAAO,OAAO,EAAE,KAAK,GAAG;WAE5E,UAAU,KAAK;AACX,CAAA"}
@@ -0,0 +1,19 @@
1
+ import { DefaultServerCellComponentProps } from "payload";
2
+
3
+ //#region src/fields/encrypted/components/ProtectedCell.d.ts
4
+ /**
5
+ * List cell for masked encrypted fields. Never renders cellData: list data has
6
+ * been decrypted by afterRead, and the list surface must not leak it. Server
7
+ * cell, so it translates the accessible label per the admin's locale. The dot
8
+ * count mirrors the field's `maskDots` (forwarded via clientProps) for list
9
+ * consistency, defaulting to the same 8 as the field.
10
+ */
11
+ declare const ProtectedCell: ({
12
+ i18n,
13
+ maskDots
14
+ }: DefaultServerCellComponentProps & {
15
+ maskDots?: number;
16
+ }) => import("react/jsx-runtime").JSX.Element;
17
+ //#endregion
18
+ export { ProtectedCell };
19
+ //# sourceMappingURL=ProtectedCell.d.ts.map
@@ -0,0 +1,44 @@
1
+ import { keys } from "../../../translations/keys.js";
2
+ import { clampMaskDots } from "../maskDots.js";
3
+ import { asTranslate } from "../../../translations/server.js";
4
+ import { jsx, jsxs } from "react/jsx-runtime";
5
+ //#region src/fields/encrypted/components/ProtectedCell.tsx
6
+ /**
7
+ * List cell for masked encrypted fields. Never renders cellData: list data has
8
+ * been decrypted by afterRead, and the list surface must not leak it. Server
9
+ * cell, so it translates the accessible label per the admin's locale. The dot
10
+ * count mirrors the field's `maskDots` (forwarded via clientProps) for list
11
+ * consistency, defaulting to the same 8 as the field.
12
+ */
13
+ const ProtectedCell = ({ i18n, maskDots }) => /* @__PURE__ */ jsxs("span", {
14
+ className: "tenx-protected-cell",
15
+ style: {
16
+ alignItems: "center",
17
+ display: "inline-flex",
18
+ gap: "0.4em"
19
+ },
20
+ children: [/* @__PURE__ */ jsxs("svg", {
21
+ "aria-hidden": "true",
22
+ fill: "none",
23
+ height: "12",
24
+ stroke: "currentColor",
25
+ strokeWidth: "2",
26
+ viewBox: "0 0 24 24",
27
+ width: "12",
28
+ children: [/* @__PURE__ */ jsx("rect", {
29
+ height: "10",
30
+ rx: "2",
31
+ width: "14",
32
+ x: "5",
33
+ y: "11"
34
+ }), /* @__PURE__ */ jsx("path", { d: "M8 11V7a4 4 0 0 1 8 0v4" })]
35
+ }), /* @__PURE__ */ jsx("span", {
36
+ "aria-label": asTranslate(i18n.t)(keys.encryptedValue),
37
+ role: "img",
38
+ children: "•".repeat(clampMaskDots(maskDots))
39
+ })]
40
+ });
41
+ //#endregion
42
+ export { ProtectedCell };
43
+
44
+ //# sourceMappingURL=ProtectedCell.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ProtectedCell.js","names":[],"sources":["../../../../src/fields/encrypted/components/ProtectedCell.tsx"],"sourcesContent":["import type { DefaultServerCellComponentProps } from 'payload'\nimport { keys } from '../../../translations/keys'\nimport { asTranslate } from '../../../translations/server'\nimport { clampMaskDots } from '../maskDots'\n\n/**\n * List cell for masked encrypted fields. Never renders cellData: list data has\n * been decrypted by afterRead, and the list surface must not leak it. Server\n * cell, so it translates the accessible label per the admin's locale. The dot\n * count mirrors the field's `maskDots` (forwarded via clientProps) for list\n * consistency, defaulting to the same 8 as the field.\n */\nexport const ProtectedCell = ({\n\ti18n,\n\tmaskDots,\n}: DefaultServerCellComponentProps & { maskDots?: number }) => (\n\t<span\n\t\tclassName=\"tenx-protected-cell\"\n\t\tstyle={{ alignItems: 'center', display: 'inline-flex', gap: '0.4em' }}\n\t>\n\t\t<svg\n\t\t\taria-hidden=\"true\"\n\t\t\tfill=\"none\"\n\t\t\theight=\"12\"\n\t\t\tstroke=\"currentColor\"\n\t\t\tstrokeWidth=\"2\"\n\t\t\tviewBox=\"0 0 24 24\"\n\t\t\twidth=\"12\"\n\t\t>\n\t\t\t<rect height=\"10\" rx=\"2\" width=\"14\" x=\"5\" y=\"11\" />\n\t\t\t<path d=\"M8 11V7a4 4 0 0 1 8 0v4\" />\n\t\t</svg>\n\t\t<span aria-label={asTranslate(i18n.t)(keys.encryptedValue)} role=\"img\">\n\t\t\t{'•'.repeat(clampMaskDots(maskDots))}\n\t\t</span>\n\t</span>\n)\n"],"mappings":";;;;;;;;;;;;AAYA,MAAa,iBAAiB,EAC7B,MACA,eAEA,qBAAC,QAAD;CACC,WAAU;CACV,OAAO;EAAE,YAAY;EAAU,SAAS;EAAe,KAAK;CAAQ;WAFrE,CAIC,qBAAC,OAAD;EACC,eAAY;EACZ,MAAK;EACL,QAAO;EACP,QAAO;EACP,aAAY;EACZ,SAAQ;EACR,OAAM;YAPP,CASC,oBAAC,QAAD;GAAM,QAAO;GAAK,IAAG;GAAI,OAAM;GAAK,GAAE;GAAI,GAAE;EAAM,CAAA,GAClD,oBAAC,QAAD,EAAM,GAAE,0BAA2B,CAAA,CAC/B;KACL,oBAAC,QAAD;EAAM,cAAY,YAAY,KAAK,CAAC,EAAE,KAAK,cAAc;EAAG,MAAK;YAC/D,IAAI,OAAO,cAAc,QAAQ,CAAC;CAC9B,CAAA,CACD"}