@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
@@ -1,145 +1,95 @@
1
- /* Eyeball masking (all structural types, including the richText reveal gate). */
2
-
3
- .tenx-protected-field__eye-icon .stroke {
4
- fill: none;
5
- stroke: currentColor;
6
- stroke-width: 0.75;
7
- vector-effect: non-scaling-stroke;
1
+ /* The reveal eye and every write-only action: a plain icon button drawn like
2
+ Payload's password toggle (24px icon box, no chrome, secondary icon tone). */
3
+ .tenx-protected-field {
4
+ --tenx-protected-icon-size: 24px;
5
+ /* Payload's offset for an icon inside an input: the 8px input padding less the
6
+ 5px of empty space inside a 24px icon's viewBox. */
7
+ --tenx-protected-icon-inset: calc(var(--field-padding-inline) - 5px);
8
8
  }
9
9
 
10
10
  .tenx-protected-field__eye {
11
- cursor: pointer;
12
- --btn-icon-size: var(--base);
13
- }
14
-
15
- /* Floating eye for corner (textarea) and label-row (structural) placements. */
16
- .tenx-protected-field__eye--floating {
17
- color: var(--theme-elevation-500);
18
- }
19
-
20
- .tenx-protected-field__eye--floating:hover {
21
- color: var(--theme-elevation-800);
22
- }
23
-
24
- /* Attached action buttons (eye and write-only actions): borderless indicators
25
- inside the bordered cluster wrap (below), react-select style, muted until
26
- hovered. The doubled class outranks Payload's own `.btn { height: base(2) }`,
27
- which otherwise wins by cascade order. */
28
- .tenx-protected-field__eye.tenx-protected-field__eye--attached {
29
- height: 100%;
11
+ display: flex;
12
+ flex-shrink: 0;
13
+ align-items: center;
14
+ justify-content: center;
15
+ width: var(--tenx-protected-icon-size);
16
+ height: var(--tenx-protected-icon-size);
30
17
  margin: 0;
31
- padding: 0 calc(var(--base) / 2);
18
+ padding: 0;
32
19
  border: 0;
33
- border-radius: 0;
34
- background: none;
35
- box-shadow: none;
36
- color: var(--theme-elevation-500);
37
- transition: color 100ms cubic-bezier(0, 0.2, 0.2, 1);
38
- }
20
+ border-radius: var(--radius-small);
21
+ background: transparent;
22
+ color: var(--color-icon-secondary);
23
+ cursor: pointer;
39
24
 
40
- .tenx-protected-field__eye--attached:hover {
41
- background: none;
42
- color: var(--theme-elevation-800);
43
- }
25
+ &:hover {
26
+ color: var(--color-icon-secondary-hover);
27
+ }
44
28
 
45
- /* Neighbouring actions halve their facing paddings: icons sit close while
46
- every pixel of the cluster stays clickable, the hit boundary just moves to
47
- the midpoint. Outer edges keep the full padding. */
48
- .tenx-protected-field__eye-wrap--attached .tenx-protected-field__eye:not(:first-child) {
49
- padding-left: calc(var(--base) / 4);
29
+ &:disabled {
30
+ color: var(--color-icon-disabled);
31
+ cursor: not-allowed;
32
+ }
50
33
  }
51
34
 
52
- .tenx-protected-field__eye-wrap--attached .tenx-protected-field__eye:not(:last-child) {
53
- padding-right: calc(var(--base) / 4);
35
+ /* A pressed action (the replace pencil while its editor is open) keeps the
36
+ hover tone; the eye needs no such cue, its glyph already flips. */
37
+ .tenx-protected-field__action[aria-pressed="true"] {
38
+ color: var(--color-icon-secondary-hover);
54
39
  }
55
40
 
56
- /* The cluster is a plain flex container: no border, no background of its own.
57
- ALL chrome lives on the row (below), so the icons literally sit inside the
58
- input's box and no state can ever render them behind a different border. */
41
+ /* Attached placement: the row is a native `.form-input-group` (one border around
42
+ the chrome-less `input.form-input` and the action cluster), so input text and
43
+ icons can never sit behind different borders. The cluster ends where the
44
+ password toggle does: the shared inset, measured from the row's outer edge. */
59
45
  .tenx-protected-field__eye-wrap--attached {
60
46
  display: flex;
61
- align-self: stretch;
62
- align-items: center;
63
- }
64
-
65
- /* Attached placement: the ROW is the input. It carries the single border,
66
- radius, background, shadow, and formInput's exact transition set; the
67
- native input inside is stripped of all chrome (rule below), so there is
68
- exactly one border around input text and action icons alike, and no
69
- combination of states can ever make them differ. */
70
- .tenx-protected-field__attached-row {
71
- display: flex;
47
+ flex-shrink: 0;
72
48
  align-items: center;
73
- height: 40px;
74
- border: 1px solid var(--theme-elevation-150);
75
- border-radius: var(--style-radius-s);
76
- background: var(--theme-input-bg);
77
- box-shadow: 0 2px 2px -1px rgba(0, 0, 0, 0.1);
78
- transition-property: border, box-shadow, background-color;
79
- transition-duration: 100ms, 100ms, 500ms;
80
- transition-timing-function: cubic-bezier(0, 0.2, 0.2, 1);
81
- }
82
-
83
- /* The row border follows the input's states, replicating formInput's own
84
- precedence: hover lights it (the browser sets :hover on the input while
85
- its <label> is hovered, and :has() reads that off the input, so hovering
86
- an action never lights the border), focus outranks hover (declared later,
87
- specificity flattened by :where), and focus-within keeps the control lit
88
- while an action button holds focus, the way a clearable select keeps its
89
- ring through an indicator click. The row's own shadow deepens on input
90
- hover exactly as formInput's inputShadow does. */
91
- .tenx-protected-field__attached-row:where(:has(input:hover)) {
92
- border-color: var(--theme-elevation-250);
93
- box-shadow: 0 2px 2px -1px rgba(0, 0, 0, 0.2);
49
+ padding-inline-end: calc(var(--tenx-protected-icon-inset) - var(--stroke-width-small));
94
50
  }
95
51
 
96
- .tenx-protected-field__attached-row:where(:focus-within) {
97
- border-color: var(--theme-elevation-400);
52
+ /* `.form-input-group` does not light its border while its input is read-only,
53
+ which is every concealed state here. A concealed field is still a live
54
+ control (the eye reveals it), so it hovers like an editable native input. */
55
+ .tenx-protected-field__attached-row:where(
56
+ :hover:not(:focus-within):not(.form-input-group-error):not(:has(input:disabled))
57
+ ) {
58
+ border-color: var(--field-color-border-hover);
98
59
  }
99
60
 
100
- /* The native input inside the row loses every piece of its own chrome; its
101
- hover/focus/active styles from formInput now paint nothing, so they cannot
102
- disagree with the row. height 100% (38px inside the bordered 40px row)
103
- keeps the control at native input height. */
104
- .tenx-protected-field--attached .tenx-protected-field__attached-row input {
105
- height: 100%;
106
- border: 0;
107
- border-radius: 0;
108
- background: transparent;
109
- box-shadow: none;
110
- }
111
-
112
- /* Validation error, mirrored from Payload's light/darkInputError mixins onto
113
- the row (the input's own error chrome is stripped with the rest). Declared
114
- last and more specific than the state rules, so error wins over hover and
115
- focus exactly as it does on a native input. */
116
- html[data-theme="light"] .tenx-protected-field--attached.error .tenx-protected-field__attached-row {
117
- border-color: var(--theme-error-500);
118
- background-color: var(--theme-error-50);
119
- }
120
-
121
- html[data-theme="dark"] .tenx-protected-field--attached.error .tenx-protected-field__attached-row {
122
- border-color: var(--theme-error-400);
123
- background-color: var(--theme-error-100);
124
- }
125
-
126
- /* Corner placement: eye pinned to the top-right of the textarea wrap. */
127
- .tenx-protected-field--corner .field-type__wrap {
61
+ /* Corner placement (textarea): the icons sit in the textarea's top end corner,
62
+ centred on its first line, and the text keeps clear of them. */
63
+ .tenx-protected-field--corner .textarea-outer {
128
64
  position: relative;
129
65
  }
130
66
 
131
67
  .tenx-protected-field__eye-wrap--corner {
132
68
  position: absolute;
133
- top: 6px;
134
- right: 6px;
69
+ inset-block-start: calc(
70
+ var(--stroke-width-small) +
71
+ var(--field-padding-inline) +
72
+ (var(--text-body-medium-line-height) - var(--tenx-protected-icon-size)) /
73
+ 2
74
+ );
75
+ inset-inline-end: var(--tenx-protected-icon-inset);
135
76
  z-index: 1;
77
+ display: flex;
78
+ }
79
+
80
+ .tenx-protected-field--corner textarea {
81
+ padding-inline-end: calc(var(--tenx-protected-icon-inset) + var(--tenx-protected-icon-size));
136
82
  }
137
83
 
138
- /* Label-row placement: eye pinned to the label line. The wrapper (not the
139
- nested native face) is the direct child of .render-fields, so it must carry
140
- the native field rhythm itself; the attached/corner types get it free because
141
- their root IS a .field-type. --spacing-field collapses to 0 inside a row, so
142
- row layouts stay correct. */
84
+ .tenx-protected-field--corner:has(.tenx-protected-field__eye-wrap--corner > :nth-child(2))
85
+ textarea {
86
+ padding-inline-end: calc(var(--tenx-protected-icon-inset) + var(--tenx-protected-icon-size) * 2);
87
+ }
88
+
89
+ /* Label-row placement: icons pinned to the label line, at the same inline
90
+ inset as the attached ones, so every eye on a form lines up. The wrapper (not
91
+ the nested native face) is the direct child of .render-fields, so it carries
92
+ the native field rhythm itself; --spacing-field collapses inside a row. */
143
93
  .tenx-protected-field--label-row {
144
94
  position: relative;
145
95
  margin-bottom: var(--spacing-field);
@@ -147,8 +97,11 @@ html[data-theme="dark"] .tenx-protected-field--attached.error .tenx-protected-fi
147
97
 
148
98
  .tenx-protected-field__eye-wrap--label-row {
149
99
  position: absolute;
150
- top: 0;
151
- right: 0;
100
+ inset-block-start: calc(
101
+ (var(--text-body-medium-bold-line-height) - var(--tenx-protected-icon-size)) /
102
+ 2
103
+ );
104
+ inset-inline-end: var(--tenx-protected-icon-inset);
152
105
  z-index: 1;
153
106
  display: flex;
154
107
  align-items: center;
@@ -163,14 +116,9 @@ html[data-theme="dark"] .tenx-protected-field--attached.error .tenx-protected-fi
163
116
  }
164
117
 
165
118
  /* Write-only: one always-editable input; a stored value is only a placeholder
166
- (hint or dots), and every action is an attached segment or label-row icon,
167
- so the field never grows past its native height. */
119
+ (hint or dots), and every action is an attached icon or label-row icon, so
120
+ the field never grows past its native height. */
168
121
  .tenx-protected-field__wo-input {
169
- flex: 1 1 auto;
170
- width: 100%;
171
- /* Flex min-width:auto would refuse to shrink below the placeholder's width
172
- and push the attached actions out of narrow containers. */
173
- min-width: 0;
174
122
  /* A rendered hint can be wider than a narrow field; browsers clip the
175
123
  placeholder flush by default, which reads as a value that ends there.
176
124
  On the input, not ::placeholder: that is where browsers read it from
@@ -179,43 +127,39 @@ html[data-theme="dark"] .tenx-protected-field--attached.error .tenx-protected-fi
179
127
  }
180
128
 
181
129
  /* With a stored value, the "placeholder" is not a prompt but the concealed
182
- face of real data, so it renders in the input's TEXT color, exactly as
183
- typed characters would. Only the unset state shows a true placeholder,
184
- which keeps formInput's native muted styling untouched. */
130
+ face of real data, so it renders in the input's text color, exactly as
131
+ typed characters would. Only the unset state shows a true placeholder. */
185
132
  .tenx-protected-field__wo-input--set::placeholder {
186
- color: var(--theme-elevation-800);
187
- font-size: 1rem;
133
+ color: var(--field-color-text);
188
134
  letter-spacing: 0.15em;
189
135
  }
190
136
 
191
- /* Corner placement (textarea) rows its actions horizontally where the eye sits. */
192
- .tenx-protected-field__actions--corner {
193
- display: flex;
194
- gap: 2px;
137
+ .tenx-protected-field__wo-input--set:disabled::placeholder {
138
+ color: var(--field-color-text-disabled);
195
139
  }
196
140
 
197
141
  /* Staged-removal notice in the structural face: a prompt about a pending
198
142
  action, so it carries placeholder tone, unmistakably distinct from the
199
143
  text-colored concealed dots. */
200
144
  .tenx-protected-field__wo-face-msg {
201
- color: var(--theme-elevation-400);
145
+ color: var(--field-color-placeholder);
202
146
  }
203
147
 
204
- /* Structural face box: an input-rhythm well the label-row dots sit in. */
148
+ /* Structural write-only face: a static `.form-input` well the dots sit in. */
205
149
  .tenx-protected-field__wo-face-box {
206
150
  display: flex;
207
151
  align-items: center;
208
- min-height: 40px;
209
- padding: 0 calc(var(--base) * 0.75);
210
- border: 1px solid var(--theme-elevation-150);
211
- border-radius: var(--style-radius-s);
212
- background: var(--theme-input-bg);
152
+ }
153
+
154
+ .tenx-protected-field__wo-face-box--disabled {
155
+ border-color: var(--field-color-border-disabled);
156
+ background: var(--field-color-bg-disabled);
157
+ color: var(--field-color-text-disabled);
213
158
  }
214
159
 
215
160
  /* Concealed dots stand in for real stored data, so they carry the input's
216
161
  text color, not a muted placeholder tone. */
217
162
  .tenx-protected-field__dots {
218
- color: var(--theme-elevation-800);
219
163
  letter-spacing: 0.15em;
220
164
  user-select: none;
221
165
  white-space: nowrap;
@@ -223,7 +167,6 @@ html[data-theme="dark"] .tenx-protected-field--attached.error .tenx-protected-fi
223
167
 
224
168
  .tenx-protected-field__masked-input,
225
169
  .tenx-protected-field__masked-textarea {
226
- color: var(--theme-elevation-800);
227
170
  letter-spacing: 0.15em;
228
171
  cursor: default;
229
172
  }
@@ -239,15 +182,6 @@ html[data-theme="dark"] .tenx-protected-field--attached.error .tenx-protected-fi
239
182
  align-items: center;
240
183
  }
241
184
 
242
- /* A 40px floor on both the concealed face control and the revealed react-select
243
- control, so toggling a select never changes height. Payload's react-select is
244
- height:auto (single-value ~40px, multi-value chips ~38px), so without the floor
245
- a hasMany field shrinks 2px on reveal; the floor keeps both states on the 40px
246
- input rhythm. */
247
- .tenx-protected-field--label-row .rs__control {
248
- min-height: 40px;
249
- }
250
-
251
185
  .tenx-protected-field__face .rs__value-container {
252
186
  display: flex;
253
187
  align-items: center;
@@ -261,15 +195,29 @@ html[data-theme="dark"] .tenx-protected-field--attached.error .tenx-protected-fi
261
195
  align-self: stretch;
262
196
  }
263
197
 
264
- /* Static code/json face: an editor-styled box of dot lines, no Monaco. */
198
+ /* Static code/json face: a code-editor-styled box of dots, no Monaco, as tall
199
+ as a one-line Monaco editor (46px), so revealing a one-liner never jumps. */
265
200
  .tenx-protected-field__editor-box {
266
- min-height: calc(var(--base) * 4);
267
- padding: calc(var(--base) * 0.5) calc(var(--base) * 0.75);
268
- border: 1px solid var(--theme-elevation-150);
269
- border-radius: var(--style-radius-s);
270
- background: var(--theme-elevation-50);
201
+ min-height: calc(
202
+ var(--field-min-height-large) +
203
+ var(--spacer-2-5) +
204
+ var(--stroke-width-small) *
205
+ 2
206
+ );
207
+ padding: var(--spacer-2) var(--field-padding-inline);
208
+ border: var(--stroke-width-small) solid var(--field-color-border);
209
+ border-radius: var(--field-border-radius);
210
+ background: var(--field-color-bg);
211
+ color: var(--field-color-text);
271
212
  font-family: var(--font-mono);
272
- color: var(--theme-elevation-500);
273
213
  white-space: pre-wrap;
274
214
  word-break: break-all;
275
215
  }
216
+
217
+ /* The richText face takes the Lexical editor box instead: its opaque border
218
+ token and the 90px of a one-paragraph editor. */
219
+ .tenx-protected-field__editor-box--rich-text {
220
+ min-height: calc(var(--spacer-6) * 2 + var(--spacer-2) + var(--stroke-width-small) * 2);
221
+ border-color: var(--color-border);
222
+ font-family: inherit;
223
+ }
@@ -62,6 +62,7 @@ const ProtectedField = (props) => {
62
62
  ...fieldPatch.admin
63
63
  }
64
64
  }), [field, fieldPatch]);
65
+ const readOnly = props.readOnly === true || patchedField.admin?.readOnly === true;
65
66
  const Native = NATIVE[componentKey] ?? TextField;
66
67
  const nativeProps = {
67
68
  ...props,
@@ -78,6 +79,7 @@ const ProtectedField = (props) => {
78
79
  nativeProps,
79
80
  path,
80
81
  placement: placementFor(componentKey, fieldPatch.hasMany === true),
82
+ readOnly,
81
83
  setPath: `${path}_set`
82
84
  });
83
85
  if (protection === "none" || startedEmpty) return /* @__PURE__ */ jsx(Native, { ...nativeProps });
@@ -87,12 +89,14 @@ const ProtectedField = (props) => {
87
89
  field: faceField,
88
90
  kind: componentKey,
89
91
  maskDots,
90
- path
92
+ path,
93
+ readOnly
91
94
  });
92
95
  if (placement === "corner") return /* @__PURE__ */ jsx(EncryptedTextarea, {
93
96
  field: faceField,
94
97
  maskDots,
95
- path
98
+ path,
99
+ readOnly
96
100
  });
97
101
  return /* @__PURE__ */ jsx(StructuralField, {
98
102
  componentKey,
@@ -1 +1 @@
1
- {"version":3,"file":"ProtectedField.js","names":[],"sources":["../../../../src/fields/encrypted/components/ProtectedField.tsx"],"sourcesContent":["'use client'\nimport {\n\tCheckboxField,\n\tCodeField,\n\tDateTimeField,\n\tEmailField,\n\tJSONField,\n\tNumberField,\n\tPointField,\n\tRadioGroupField,\n\tSelectField,\n\tTextareaField,\n\tTextField,\n\tuseFormFields,\n} from '@payloadcms/ui'\nimport type { TextFieldClientProps } from 'payload'\nimport type React from 'react'\nimport { useMemo, useState } from 'react'\nimport type { NormalizedGenerate } from '../generateSecret'\nimport { clampMaskDots } from '../maskDots'\nimport type { EncryptedFieldPatch, EncryptedProtection } from '../types'\nimport { EncryptedInput } from './EncryptedInput'\nimport { EncryptedTextarea } from './EncryptedTextarea'\nimport type { EncryptedFieldConfig } from './placement'\nimport { placementFor } from './placement'\nimport { StructuralField } from './StructuralField'\nimport { WriteOnlyField } from './WriteOnlyField'\nimport './ProtectedField.css'\n\n/**\n * Native components accept per-type client props; dispatch is by runtime\n * componentKey, so the map is typed at the erased component boundary.\n */\ntype AnyFieldComponent = React.ComponentType<Record<string, unknown>>\n\nconst NATIVE: Record<string, AnyFieldComponent> = {\n\tcheckbox: CheckboxField as AnyFieldComponent,\n\tcode: CodeField as AnyFieldComponent,\n\tdate: DateTimeField as AnyFieldComponent,\n\temail: EmailField as AnyFieldComponent,\n\tjson: JSONField as AnyFieldComponent,\n\tnumber: NumberField as AnyFieldComponent,\n\tpoint: PointField as AnyFieldComponent,\n\tradio: RadioGroupField as AnyFieldComponent,\n\tselect: SelectField as AnyFieldComponent,\n\ttext: TextField as AnyFieldComponent,\n\ttextarea: TextareaField as AnyFieldComponent,\n}\n\nexport interface ProtectedFieldProps extends TextFieldClientProps {\n\tclearable?: boolean\n\tcomponentKey: string\n\tfieldPatch: EncryptedFieldPatch\n\tgenerate?: NormalizedGenerate\n\tmaskDots?: number\n\tprotection: EncryptedProtection\n}\n\n/**\n * A field with no stored content has nothing to conceal, so it renders unmasked\n * (the plain native control). Captured once at mount, so characters typed into a\n * field that started empty stay visible and the field never flips to masked\n * mid-entry; a field that already holds content is masked until revealed.\n */\nconst isEmptyValue = (value: unknown): boolean => {\n\tif (value == null || value === '') {\n\t\treturn true\n\t}\n\tif (Array.isArray(value)) {\n\t\treturn value.length === 0 || value.every((item) => item == null)\n\t}\n\treturn false\n}\n\n/**\n * Single admin dispatcher for scalar and structural encrypted fields (richText\n * is its own virtual-editor field pair, wired to ProtectedRichText). Each type\n * renders as its native variant with a fixed run of dots while concealed, and an\n * inline eye toggle that swaps to the real editable native component on reveal.\n * The fieldPatch restores type-specific config (options, hasMany, date admin) on\n * the revealed component.\n *\n * Masking is visual-only by design. afterRead decrypts server-side, so the\n * field's form value is already plaintext regardless of the mask, and no masked\n * facsimile binds to that value. Two accepted consequences: (a) the plaintext\n * reaches an authorized admin's browser, since that admin already has field read\n * access and masking only stops casual over-the-shoulder display; (b) saving an\n * unchanged document re-seals with a fresh IV (version churn), because the form\n * holds plaintext, not the stored ciphertext.\n */\nexport const ProtectedField: React.FC<ProtectedFieldProps> = (props) => {\n\tconst { componentKey, field, fieldPatch, path, protection } = props\n\tconst maskDots = clampMaskDots(props.maskDots)\n\tconst startedEmptyNow = useFormFields(([fields]) => isEmptyValue(fields?.[path]?.value))\n\tconst [startedEmpty] = useState(startedEmptyNow)\n\n\tconst patchedField = useMemo(\n\t\t() => ({\n\t\t\t...field,\n\t\t\t...fieldPatch,\n\t\t\tadmin: { ...field.admin, ...fieldPatch.admin },\n\t\t}),\n\t\t[field, fieldPatch]\n\t)\n\n\tconst Native = NATIVE[componentKey] ?? (TextField as AnyFieldComponent)\n\tconst nativeProps = { ...(props as unknown as Record<string, unknown>), field: patchedField }\n\n\tif (protection === 'writeOnly') {\n\t\treturn (\n\t\t\t<WriteOnlyField\n\t\t\t\tclearable={props.clearable !== false}\n\t\t\t\tcomponentKey={componentKey}\n\t\t\t\tfield={patchedField as unknown as EncryptedFieldConfig}\n\t\t\t\tgenerate={props.generate}\n\t\t\t\thintPath={`${path}_hint`}\n\t\t\t\tmaskDots={maskDots}\n\t\t\t\tNative={Native}\n\t\t\t\tnativeProps={nativeProps}\n\t\t\t\tpath={path}\n\t\t\t\tplacement={placementFor(componentKey, fieldPatch.hasMany === true)}\n\t\t\t\tsetPath={`${path}_set`}\n\t\t\t/>\n\t\t)\n\t}\n\n\tif (protection === 'none' || startedEmpty) {\n\t\treturn <Native {...nativeProps} />\n\t}\n\n\tconst faceField = patchedField as unknown as EncryptedFieldConfig\n\tconst hasMany = fieldPatch.hasMany === true\n\tconst placement = placementFor(componentKey, hasMany)\n\n\tif (placement === 'attached') {\n\t\treturn (\n\t\t\t<EncryptedInput\n\t\t\t\tfield={faceField}\n\t\t\t\tkind={componentKey as 'email' | 'number' | 'text'}\n\t\t\t\tmaskDots={maskDots}\n\t\t\t\tpath={path}\n\t\t\t/>\n\t\t)\n\t}\n\n\tif (placement === 'corner') {\n\t\treturn <EncryptedTextarea field={faceField} maskDots={maskDots} path={path} />\n\t}\n\n\treturn (\n\t\t<StructuralField\n\t\t\tcomponentKey={componentKey}\n\t\t\tfield={faceField}\n\t\t\tmaskDots={maskDots}\n\t\t\tNative={Native}\n\t\t\tnativeProps={nativeProps}\n\t\t\tpath={path}\n\t\t/>\n\t)\n}\n"],"mappings":";;;;;;;;;;;;AAmCA,MAAM,SAA4C;CACjD,UAAU;CACV,MAAM;CACN,MAAM;CACN,OAAO;CACP,MAAM;CACN,QAAQ;CACR,OAAO;CACP,OAAO;CACP,QAAQ;CACR,MAAM;CACN,UAAU;AACX;;;;;;;AAiBA,MAAM,gBAAgB,UAA4B;CACjD,IAAI,SAAS,QAAQ,UAAU,IAC9B,OAAO;CAER,IAAI,MAAM,QAAQ,KAAK,GACtB,OAAO,MAAM,WAAW,KAAK,MAAM,OAAO,SAAS,QAAQ,IAAI;CAEhE,OAAO;AACR;;;;;;;;;;;;;;;;;AAkBA,MAAa,kBAAiD,UAAU;CACvE,MAAM,EAAE,cAAc,OAAO,YAAY,MAAM,eAAe;CAC9D,MAAM,WAAW,cAAc,MAAM,QAAQ;CAE7C,MAAM,CAAC,gBAAgB,SADC,eAAe,CAAC,YAAY,aAAa,SAAS,OAAO,KAAK,CACxC,CAAC;CAE/C,MAAM,eAAe,eACb;EACN,GAAG;EACH,GAAG;EACH,OAAO;GAAE,GAAG,MAAM;GAAO,GAAG,WAAW;EAAM;CAC9C,IACA,CAAC,OAAO,UAAU,CACnB;CAEA,MAAM,SAAS,OAAO,iBAAkB;CACxC,MAAM,cAAc;EAAE,GAAI;EAA8C,OAAO;CAAa;CAE5F,IAAI,eAAe,aAClB,OACC,oBAAC,gBAAD;EACC,WAAW,MAAM,cAAc;EACjB;EACd,OAAO;EACP,UAAU,MAAM;EAChB,UAAU,GAAG,KAAK;EACR;EACF;EACK;EACP;EACN,WAAW,aAAa,cAAc,WAAW,YAAY,IAAI;EACjE,SAAS,GAAG,KAAK;CACjB,CAAA;CAIH,IAAI,eAAe,UAAU,cAC5B,OAAO,oBAAC,QAAD,EAAQ,GAAI,YAAc,CAAA;CAGlC,MAAM,YAAY;CAElB,MAAM,YAAY,aAAa,cADf,WAAW,YAAY,IACa;CAEpD,IAAI,cAAc,YACjB,OACC,oBAAC,gBAAD;EACC,OAAO;EACP,MAAM;EACI;EACJ;CACN,CAAA;CAIH,IAAI,cAAc,UACjB,OAAO,oBAAC,mBAAD;EAAmB,OAAO;EAAqB;EAAgB;CAAO,CAAA;CAG9E,OACC,oBAAC,iBAAD;EACe;EACd,OAAO;EACG;EACF;EACK;EACP;CACN,CAAA;AAEH"}
1
+ {"version":3,"file":"ProtectedField.js","names":[],"sources":["../../../../src/fields/encrypted/components/ProtectedField.tsx"],"sourcesContent":["'use client'\nimport {\n\tCheckboxField,\n\tCodeField,\n\tDateTimeField,\n\tEmailField,\n\tJSONField,\n\tNumberField,\n\tPointField,\n\tRadioGroupField,\n\tSelectField,\n\tTextareaField,\n\tTextField,\n\tuseFormFields,\n} from '@payloadcms/ui'\nimport type { TextFieldClientProps } from 'payload'\nimport type React from 'react'\nimport { useMemo, useState } from 'react'\nimport type { NormalizedGenerate } from '../generateSecret'\nimport { clampMaskDots } from '../maskDots'\nimport type { EncryptedFieldPatch, EncryptedProtection } from '../types'\nimport { EncryptedInput } from './EncryptedInput'\nimport { EncryptedTextarea } from './EncryptedTextarea'\nimport type { EncryptedFieldConfig } from './placement'\nimport { placementFor } from './placement'\nimport { StructuralField } from './StructuralField'\nimport { WriteOnlyField } from './WriteOnlyField'\nimport './ProtectedField.css'\n\n/**\n * Native components accept per-type client props; dispatch is by runtime\n * componentKey, so the map is typed at the erased component boundary.\n */\ntype AnyFieldComponent = React.ComponentType<Record<string, unknown>>\n\nconst NATIVE: Record<string, AnyFieldComponent> = {\n\tcheckbox: CheckboxField as AnyFieldComponent,\n\tcode: CodeField as AnyFieldComponent,\n\tdate: DateTimeField as AnyFieldComponent,\n\temail: EmailField as AnyFieldComponent,\n\tjson: JSONField as AnyFieldComponent,\n\tnumber: NumberField as AnyFieldComponent,\n\tpoint: PointField as AnyFieldComponent,\n\tradio: RadioGroupField as AnyFieldComponent,\n\tselect: SelectField as AnyFieldComponent,\n\ttext: TextField as AnyFieldComponent,\n\ttextarea: TextareaField as AnyFieldComponent,\n}\n\nexport interface ProtectedFieldProps extends TextFieldClientProps {\n\tclearable?: boolean\n\tcomponentKey: string\n\tfieldPatch: EncryptedFieldPatch\n\tgenerate?: NormalizedGenerate\n\tmaskDots?: number\n\tprotection: EncryptedProtection\n}\n\n/**\n * A field with no stored content has nothing to conceal, so it renders unmasked\n * (the plain native control). Captured once at mount, so characters typed into a\n * field that started empty stay visible and the field never flips to masked\n * mid-entry; a field that already holds content is masked until revealed.\n */\nconst isEmptyValue = (value: unknown): boolean => {\n\tif (value == null || value === '') {\n\t\treturn true\n\t}\n\tif (Array.isArray(value)) {\n\t\treturn value.length === 0 || value.every((item) => item == null)\n\t}\n\treturn false\n}\n\n/**\n * Single admin dispatcher for scalar and structural encrypted fields (richText\n * is its own virtual-editor field pair, wired to ProtectedRichText). Each type\n * renders as its native variant with a fixed run of dots while concealed, and an\n * inline eye toggle that swaps to the real editable native component on reveal.\n * The fieldPatch restores type-specific config (options, hasMany, date admin) on\n * the revealed component.\n *\n * Masking is visual-only by design. afterRead decrypts server-side, so the\n * field's form value is already plaintext regardless of the mask, and no masked\n * facsimile binds to that value. Two accepted consequences: (a) the plaintext\n * reaches an authorized admin's browser, since that admin already has field read\n * access and masking only stops casual over-the-shoulder display; (b) saving an\n * unchanged document re-seals with a fresh IV (version churn), because the form\n * holds plaintext, not the stored ciphertext.\n */\nexport const ProtectedField: React.FC<ProtectedFieldProps> = (props) => {\n\tconst { componentKey, field, fieldPatch, path, protection } = props\n\tconst maskDots = clampMaskDots(props.maskDots)\n\tconst startedEmptyNow = useFormFields(([fields]) => isEmptyValue(fields?.[path]?.value))\n\tconst [startedEmpty] = useState(startedEmptyNow)\n\n\tconst patchedField = useMemo(\n\t\t() => ({\n\t\t\t...field,\n\t\t\t...fieldPatch,\n\t\t\tadmin: { ...field.admin, ...fieldPatch.admin },\n\t\t}),\n\t\t[field, fieldPatch]\n\t)\n\n\tconst readOnly = props.readOnly === true || patchedField.admin?.readOnly === true\n\n\tconst Native = NATIVE[componentKey] ?? (TextField as AnyFieldComponent)\n\tconst nativeProps = { ...(props as unknown as Record<string, unknown>), field: patchedField }\n\n\tif (protection === 'writeOnly') {\n\t\treturn (\n\t\t\t<WriteOnlyField\n\t\t\t\tclearable={props.clearable !== false}\n\t\t\t\tcomponentKey={componentKey}\n\t\t\t\tfield={patchedField as unknown as EncryptedFieldConfig}\n\t\t\t\tgenerate={props.generate}\n\t\t\t\thintPath={`${path}_hint`}\n\t\t\t\tmaskDots={maskDots}\n\t\t\t\tNative={Native}\n\t\t\t\tnativeProps={nativeProps}\n\t\t\t\tpath={path}\n\t\t\t\tplacement={placementFor(componentKey, fieldPatch.hasMany === true)}\n\t\t\t\treadOnly={readOnly}\n\t\t\t\tsetPath={`${path}_set`}\n\t\t\t/>\n\t\t)\n\t}\n\n\tif (protection === 'none' || startedEmpty) {\n\t\treturn <Native {...nativeProps} />\n\t}\n\n\tconst faceField = patchedField as unknown as EncryptedFieldConfig\n\tconst hasMany = fieldPatch.hasMany === true\n\tconst placement = placementFor(componentKey, hasMany)\n\n\tif (placement === 'attached') {\n\t\treturn (\n\t\t\t<EncryptedInput\n\t\t\t\tfield={faceField}\n\t\t\t\tkind={componentKey as 'email' | 'number' | 'text'}\n\t\t\t\tmaskDots={maskDots}\n\t\t\t\tpath={path}\n\t\t\t\treadOnly={readOnly}\n\t\t\t/>\n\t\t)\n\t}\n\n\tif (placement === 'corner') {\n\t\treturn (\n\t\t\t<EncryptedTextarea field={faceField} maskDots={maskDots} path={path} readOnly={readOnly} />\n\t\t)\n\t}\n\n\treturn (\n\t\t<StructuralField\n\t\t\tcomponentKey={componentKey}\n\t\t\tfield={faceField}\n\t\t\tmaskDots={maskDots}\n\t\t\tNative={Native}\n\t\t\tnativeProps={nativeProps}\n\t\t\tpath={path}\n\t\t/>\n\t)\n}\n"],"mappings":";;;;;;;;;;;;AAmCA,MAAM,SAA4C;CACjD,UAAU;CACV,MAAM;CACN,MAAM;CACN,OAAO;CACP,MAAM;CACN,QAAQ;CACR,OAAO;CACP,OAAO;CACP,QAAQ;CACR,MAAM;CACN,UAAU;AACX;;;;;;;AAiBA,MAAM,gBAAgB,UAA4B;CACjD,IAAI,SAAS,QAAQ,UAAU,IAC9B,OAAO;CAER,IAAI,MAAM,QAAQ,KAAK,GACtB,OAAO,MAAM,WAAW,KAAK,MAAM,OAAO,SAAS,QAAQ,IAAI;CAEhE,OAAO;AACR;;;;;;;;;;;;;;;;;AAkBA,MAAa,kBAAiD,UAAU;CACvE,MAAM,EAAE,cAAc,OAAO,YAAY,MAAM,eAAe;CAC9D,MAAM,WAAW,cAAc,MAAM,QAAQ;CAE7C,MAAM,CAAC,gBAAgB,SADC,eAAe,CAAC,YAAY,aAAa,SAAS,OAAO,KAAK,CACxC,CAAC;CAE/C,MAAM,eAAe,eACb;EACN,GAAG;EACH,GAAG;EACH,OAAO;GAAE,GAAG,MAAM;GAAO,GAAG,WAAW;EAAM;CAC9C,IACA,CAAC,OAAO,UAAU,CACnB;CAEA,MAAM,WAAW,MAAM,aAAa,QAAQ,aAAa,OAAO,aAAa;CAE7E,MAAM,SAAS,OAAO,iBAAkB;CACxC,MAAM,cAAc;EAAE,GAAI;EAA8C,OAAO;CAAa;CAE5F,IAAI,eAAe,aAClB,OACC,oBAAC,gBAAD;EACC,WAAW,MAAM,cAAc;EACjB;EACd,OAAO;EACP,UAAU,MAAM;EAChB,UAAU,GAAG,KAAK;EACR;EACF;EACK;EACP;EACN,WAAW,aAAa,cAAc,WAAW,YAAY,IAAI;EACvD;EACV,SAAS,GAAG,KAAK;CACjB,CAAA;CAIH,IAAI,eAAe,UAAU,cAC5B,OAAO,oBAAC,QAAD,EAAQ,GAAI,YAAc,CAAA;CAGlC,MAAM,YAAY;CAElB,MAAM,YAAY,aAAa,cADf,WAAW,YAAY,IACa;CAEpD,IAAI,cAAc,YACjB,OACC,oBAAC,gBAAD;EACC,OAAO;EACP,MAAM;EACI;EACJ;EACI;CACV,CAAA;CAIH,IAAI,cAAc,UACjB,OACC,oBAAC,mBAAD;EAAmB,OAAO;EAAqB;EAAgB;EAAgB;CAAW,CAAA;CAI5F,OACC,oBAAC,iBAAD;EACe;EACd,OAAO;EACG;EACF;EACK;EACP;CACN,CAAA;AAEH"}
@@ -5,7 +5,7 @@ import { EyeToggle } from "./EyeToggle.js";
5
5
  import { MaskDots } from "./MaskDots.js";
6
6
  import { FieldLabel, useField } from "@payloadcms/ui";
7
7
  import { useCallback, useState } from "react";
8
- import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
8
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
9
9
  import "./ProtectedField.css";
10
10
  //#region src/fields/encrypted/components/RichTextRevealGate.tsx
11
11
  const MASK_DOTS = 8;
@@ -45,7 +45,7 @@ const RichTextRevealGate = ({ children, label, localized, path, required }) => {
45
45
  setRevealed((prev) => !prev);
46
46
  setMounted(true);
47
47
  }, []);
48
- if (startedEmpty) return /* @__PURE__ */ jsx(Fragment$1, { children });
48
+ if (startedEmpty) return /* @__PURE__ */ jsx(Fragment, { children });
49
49
  return /* @__PURE__ */ jsxs("div", {
50
50
  className: "tenx-protected-field tenx-protected-field--label-row",
51
51
  children: [
@@ -64,7 +64,7 @@ const RichTextRevealGate = ({ children, label, localized, path, required }) => {
64
64
  className: "field-type__wrap",
65
65
  children: /* @__PURE__ */ jsx("div", {
66
66
  "aria-label": t(keys.encryptedValue),
67
- className: "tenx-protected-field__editor-box",
67
+ className: "tenx-protected-field__editor-box tenx-protected-field__editor-box--rich-text",
68
68
  role: "img",
69
69
  children: /* @__PURE__ */ jsx(MaskDots, { count: MASK_DOTS })
70
70
  })
@@ -1 +1 @@
1
- {"version":3,"file":"RichTextRevealGate.js","names":["useTranslation"],"sources":["../../../../src/fields/encrypted/components/RichTextRevealGate.tsx"],"sourcesContent":["'use client'\nimport { FieldLabel, useField } from '@payloadcms/ui'\nimport type { StaticLabel } from 'payload'\nimport type React from 'react'\nimport { useCallback, useState } from 'react'\nimport { keys } from '../../../translations/keys'\nimport { useTranslation } from '../../../translations/useTranslation'\nimport { EyeToggle } from './EyeToggle'\nimport { MaskDots } from './MaskDots'\nimport './ProtectedField.css'\n\nconst MASK_DOTS = 8\n\n/**\n * Empty rich text has nothing to conceal, so it renders the editor directly (no\n * mask, no eye), matching how empty scalar fields render native. Null, an empty\n * root, and the default single-empty-paragraph state all count as empty.\n */\nconst isEmptyRichText = (value: unknown): boolean => {\n\tif (value == null) {\n\t\treturn true\n\t}\n\tconst children = (value as { root?: { children?: unknown[] } }).root?.children\n\tif (!Array.isArray(children) || children.length === 0) {\n\t\treturn true\n\t}\n\treturn children.every((node) => {\n\t\tconst n = node as { children?: unknown[]; text?: string }\n\t\tif (typeof n.text === 'string') {\n\t\t\treturn n.text.trim() === ''\n\t\t}\n\t\treturn !n.children || n.children.length === 0\n\t})\n}\n\n/**\n * Reveal gate for the encrypted richText editor. The server-passed editor subtree\n * mounts on first reveal and then stays mounted; concealing only sets\n * display:none on its slot, so re-revealing never re-initialises Lexical (that\n * remount was the toggle flicker). Until the first reveal the editor is absent,\n * so the decrypted value only enters the DOM once the admin reveals it. The\n * concealed face is a static, form-unbound mask (the decrypted value is already\n * in form state from the field's afterRead hook, so a concealed submit reseals\n * the untouched plaintext). The eye is pinned to the label line in both states so\n * toggling never moves focus or shifts layout.\n */\nexport const RichTextRevealGate: React.FC<{\n\tchildren: React.ReactNode\n\tlabel?: StaticLabel\n\tlocalized?: boolean\n\tpath: string\n\trequired?: boolean\n}> = ({ children, label, localized, path, required }) => {\n\tconst { t } = useTranslation()\n\tconst { value } = useField<unknown>({ path })\n\tconst [startedEmpty] = useState(() => isEmptyRichText(value))\n\tconst [revealed, setRevealed] = useState(false)\n\tconst [mounted, setMounted] = useState(false)\n\tconst toggle = useCallback(() => {\n\t\tsetRevealed((prev) => !prev)\n\t\tsetMounted(true)\n\t}, [])\n\n\tif (startedEmpty) {\n\t\treturn <>{children}</>\n\t}\n\n\treturn (\n\t\t<div className=\"tenx-protected-field tenx-protected-field--label-row\">\n\t\t\t{mounted ? (\n\t\t\t\t<div className={revealed ? undefined : 'tenx-protected-field__reveal-slot--hidden'}>\n\t\t\t\t\t{children}\n\t\t\t\t</div>\n\t\t\t) : null}\n\t\t\t{revealed ? null : (\n\t\t\t\t<div className=\"field-type tenx-protected-field__face\">\n\t\t\t\t\t<FieldLabel label={label} localized={localized} path={path} required={required} />\n\t\t\t\t\t<div className=\"field-type__wrap\">\n\t\t\t\t\t\t<div\n\t\t\t\t\t\t\taria-label={t(keys.encryptedValue)}\n\t\t\t\t\t\t\tclassName=\"tenx-protected-field__editor-box\"\n\t\t\t\t\t\t\trole=\"img\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<MaskDots count={MASK_DOTS} />\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)}\n\t\t\t<div className=\"tenx-protected-field__eye-wrap tenx-protected-field__eye-wrap--label-row\">\n\t\t\t\t<EyeToggle\n\t\t\t\t\tclassName=\"tenx-protected-field__eye--floating\"\n\t\t\t\t\tonToggle={toggle}\n\t\t\t\t\trevealed={revealed}\n\t\t\t\t/>\n\t\t\t</div>\n\t\t</div>\n\t)\n}\n"],"mappings":";;;;;;;;;;AAWA,MAAM,YAAY;;;;;;AAOlB,MAAM,mBAAmB,UAA4B;CACpD,IAAI,SAAS,MACZ,OAAO;CAER,MAAM,WAAY,MAA8C,MAAM;CACtE,IAAI,CAAC,MAAM,QAAQ,QAAQ,KAAK,SAAS,WAAW,GACnD,OAAO;CAER,OAAO,SAAS,OAAO,SAAS;EAC/B,MAAM,IAAI;EACV,IAAI,OAAO,EAAE,SAAS,UACrB,OAAO,EAAE,KAAK,KAAK,MAAM;EAE1B,OAAO,CAAC,EAAE,YAAY,EAAE,SAAS,WAAW;CAC7C,CAAC;AACF;;;;;;;;;;;;AAaA,MAAa,sBAMP,EAAE,UAAU,OAAO,WAAW,MAAM,eAAe;CACxD,MAAM,EAAE,MAAMA,iBAAe;CAC7B,MAAM,EAAE,UAAU,SAAkB,EAAE,KAAK,CAAC;CAC5C,MAAM,CAAC,gBAAgB,eAAe,gBAAgB,KAAK,CAAC;CAC5D,MAAM,CAAC,UAAU,eAAe,SAAS,KAAK;CAC9C,MAAM,CAAC,SAAS,cAAc,SAAS,KAAK;CAC5C,MAAM,SAAS,kBAAkB;EAChC,aAAa,SAAS,CAAC,IAAI;EAC3B,WAAW,IAAI;CAChB,GAAG,CAAC,CAAC;CAEL,IAAI,cACH,OAAO,oBAAA,YAAA,EAAG,SAAW,CAAA;CAGtB,OACC,qBAAC,OAAD;EAAK,WAAU;YAAf;GACE,UACA,oBAAC,OAAD;IAAK,WAAW,WAAW,KAAA,IAAY;IACrC;GACG,CAAA,IACF;GACH,WAAW,OACX,qBAAC,OAAD;IAAK,WAAU;cAAf,CACC,oBAAC,YAAD;KAAmB;KAAkB;KAAiB;KAAgB;IAAW,CAAA,GACjF,oBAAC,OAAD;KAAK,WAAU;eACd,oBAAC,OAAD;MACC,cAAY,EAAE,KAAK,cAAc;MACjC,WAAU;MACV,MAAK;gBAEL,oBAAC,UAAD,EAAU,OAAO,UAAY,CAAA;KACzB,CAAA;IACD,CAAA,CACD;;GAEN,oBAAC,OAAD;IAAK,WAAU;cACd,oBAAC,WAAD;KACC,WAAU;KACV,UAAU;KACA;IACV,CAAA;GACG,CAAA;EACD;;AAEP"}
1
+ {"version":3,"file":"RichTextRevealGate.js","names":["useTranslation"],"sources":["../../../../src/fields/encrypted/components/RichTextRevealGate.tsx"],"sourcesContent":["'use client'\nimport { FieldLabel, useField } from '@payloadcms/ui'\nimport type { StaticLabel } from 'payload'\nimport type React from 'react'\nimport { useCallback, useState } from 'react'\nimport { keys } from '../../../translations/keys'\nimport { useTranslation } from '../../../translations/useTranslation'\nimport { EyeToggle } from './EyeToggle'\nimport { MaskDots } from './MaskDots'\nimport './ProtectedField.css'\n\nconst MASK_DOTS = 8\n\n/**\n * Empty rich text has nothing to conceal, so it renders the editor directly (no\n * mask, no eye), matching how empty scalar fields render native. Null, an empty\n * root, and the default single-empty-paragraph state all count as empty.\n */\nconst isEmptyRichText = (value: unknown): boolean => {\n\tif (value == null) {\n\t\treturn true\n\t}\n\tconst children = (value as { root?: { children?: unknown[] } }).root?.children\n\tif (!Array.isArray(children) || children.length === 0) {\n\t\treturn true\n\t}\n\treturn children.every((node) => {\n\t\tconst n = node as { children?: unknown[]; text?: string }\n\t\tif (typeof n.text === 'string') {\n\t\t\treturn n.text.trim() === ''\n\t\t}\n\t\treturn !n.children || n.children.length === 0\n\t})\n}\n\n/**\n * Reveal gate for the encrypted richText editor. The server-passed editor subtree\n * mounts on first reveal and then stays mounted; concealing only sets\n * display:none on its slot, so re-revealing never re-initialises Lexical (that\n * remount was the toggle flicker). Until the first reveal the editor is absent,\n * so the decrypted value only enters the DOM once the admin reveals it. The\n * concealed face is a static, form-unbound mask (the decrypted value is already\n * in form state from the field's afterRead hook, so a concealed submit reseals\n * the untouched plaintext). The eye is pinned to the label line in both states so\n * toggling never moves focus or shifts layout.\n */\nexport const RichTextRevealGate: React.FC<{\n\tchildren: React.ReactNode\n\tlabel?: StaticLabel\n\tlocalized?: boolean\n\tpath: string\n\trequired?: boolean\n}> = ({ children, label, localized, path, required }) => {\n\tconst { t } = useTranslation()\n\tconst { value } = useField<unknown>({ path })\n\tconst [startedEmpty] = useState(() => isEmptyRichText(value))\n\tconst [revealed, setRevealed] = useState(false)\n\tconst [mounted, setMounted] = useState(false)\n\tconst toggle = useCallback(() => {\n\t\tsetRevealed((prev) => !prev)\n\t\tsetMounted(true)\n\t}, [])\n\n\tif (startedEmpty) {\n\t\treturn <>{children}</>\n\t}\n\n\treturn (\n\t\t<div className=\"tenx-protected-field tenx-protected-field--label-row\">\n\t\t\t{mounted ? (\n\t\t\t\t<div className={revealed ? undefined : 'tenx-protected-field__reveal-slot--hidden'}>\n\t\t\t\t\t{children}\n\t\t\t\t</div>\n\t\t\t) : null}\n\t\t\t{revealed ? null : (\n\t\t\t\t<div className=\"field-type tenx-protected-field__face\">\n\t\t\t\t\t<FieldLabel label={label} localized={localized} path={path} required={required} />\n\t\t\t\t\t<div className=\"field-type__wrap\">\n\t\t\t\t\t\t<div\n\t\t\t\t\t\t\taria-label={t(keys.encryptedValue)}\n\t\t\t\t\t\t\tclassName=\"tenx-protected-field__editor-box tenx-protected-field__editor-box--rich-text\"\n\t\t\t\t\t\t\trole=\"img\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<MaskDots count={MASK_DOTS} />\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)}\n\t\t\t<div className=\"tenx-protected-field__eye-wrap tenx-protected-field__eye-wrap--label-row\">\n\t\t\t\t<EyeToggle\n\t\t\t\t\tclassName=\"tenx-protected-field__eye--floating\"\n\t\t\t\t\tonToggle={toggle}\n\t\t\t\t\trevealed={revealed}\n\t\t\t\t/>\n\t\t\t</div>\n\t\t</div>\n\t)\n}\n"],"mappings":";;;;;;;;;;AAWA,MAAM,YAAY;;;;;;AAOlB,MAAM,mBAAmB,UAA4B;CACpD,IAAI,SAAS,MACZ,OAAO;CAER,MAAM,WAAY,MAA8C,MAAM;CACtE,IAAI,CAAC,MAAM,QAAQ,QAAQ,KAAK,SAAS,WAAW,GACnD,OAAO;CAER,OAAO,SAAS,OAAO,SAAS;EAC/B,MAAM,IAAI;EACV,IAAI,OAAO,EAAE,SAAS,UACrB,OAAO,EAAE,KAAK,KAAK,MAAM;EAE1B,OAAO,CAAC,EAAE,YAAY,EAAE,SAAS,WAAW;CAC7C,CAAC;AACF;;;;;;;;;;;;AAaA,MAAa,sBAMP,EAAE,UAAU,OAAO,WAAW,MAAM,eAAe;CACxD,MAAM,EAAE,MAAMA,iBAAe;CAC7B,MAAM,EAAE,UAAU,SAAkB,EAAE,KAAK,CAAC;CAC5C,MAAM,CAAC,gBAAgB,eAAe,gBAAgB,KAAK,CAAC;CAC5D,MAAM,CAAC,UAAU,eAAe,SAAS,KAAK;CAC9C,MAAM,CAAC,SAAS,cAAc,SAAS,KAAK;CAC5C,MAAM,SAAS,kBAAkB;EAChC,aAAa,SAAS,CAAC,IAAI;EAC3B,WAAW,IAAI;CAChB,GAAG,CAAC,CAAC;CAEL,IAAI,cACH,OAAO,oBAAA,UAAA,EAAG,SAAW,CAAA;CAGtB,OACC,qBAAC,OAAD;EAAK,WAAU;YAAf;GACE,UACA,oBAAC,OAAD;IAAK,WAAW,WAAW,KAAA,IAAY;IACrC;GACG,CAAA,IACF;GACH,WAAW,OACX,qBAAC,OAAD;IAAK,WAAU;cAAf,CACC,oBAAC,YAAD;KAAmB;KAAkB;KAAiB;KAAgB;IAAW,CAAA,GACjF,oBAAC,OAAD;KAAK,WAAU;eACd,oBAAC,OAAD;MACC,cAAY,EAAE,KAAK,cAAc;MACjC,WAAU;MACV,MAAK;gBAEL,oBAAC,UAAD,EAAU,OAAO,UAAY,CAAA;KACzB,CAAA;IACD,CAAA,CACD;;GAEN,oBAAC,OAAD;IAAK,WAAU;cACd,oBAAC,WAAD;KACC,WAAU;KACV,UAAU;KACA;IACV,CAAA;GACG,CAAA;EACD;;AAEP"}
@@ -1,64 +1,69 @@
1
1
  "use client";
2
- import { Button } from "@payloadcms/ui";
3
- import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
+ import { CircledXIcon, RefreshIcon, Tooltip, WriteIcon } from "@payloadcms/ui";
3
+ import { useState } from "react";
4
+ import { jsx, jsxs } from "react/jsx-runtime";
4
5
  //#region src/fields/encrypted/components/WriteOnlyActions.tsx
5
6
  /**
6
- * Thin-stroke glyphs on the eye's 16x12 canvas, each drawn centered on
7
- * (8, 6) so the mark sits in the middle of its clickable area, matching the
8
- * eye beside which they render.
7
+ * Payload's upload-editor reset arrow, which `@payloadcms/ui` draws but does not
8
+ * export (beta.6), redrawn from its 24px path.
9
+ *
10
+ * @todo Import `ResetIcon` from `@payloadcms/ui` once it is exported, and drop this copy.
11
+ */
12
+ const UndoIcon = () => /* @__PURE__ */ jsx("svg", {
13
+ "aria-hidden": "true",
14
+ className: "icon icon--reset",
15
+ fill: "none",
16
+ height: "24",
17
+ viewBox: "0 0 24 24",
18
+ width: "24",
19
+ xmlns: "http://www.w3.org/2000/svg",
20
+ children: /* @__PURE__ */ jsx("path", {
21
+ clipRule: "evenodd",
22
+ d: "M8.14658 5.14631C8.34183 4.95119 8.65839 4.95113 8.85361 5.14631C9.04882 5.34152 9.04873 5.65806 8.85361 5.85334L7.70712 6.99982H12.0001C15.3137 6.99987 18 9.68623 18.0001 12.9998C18.0001 16.3135 15.3138 18.9998 12.0001 18.9998C8.68638 18.9998 6.00009 16.3135 6.00009 12.9998C6.00019 12.7238 6.22401 12.4998 6.50009 12.4998C6.77613 12.4999 6.99999 12.7238 7.00009 12.9998C7.00009 15.7612 9.23867 17.9998 12.0001 17.9998C14.7615 17.9998 17.0001 15.7612 17.0001 12.9998C17 10.2385 14.7614 7.99987 12.0001 7.99982H7.70712L8.85361 9.14631C9.04882 9.34152 9.04873 9.65806 8.85361 9.85334C8.65835 10.0486 8.34184 10.0486 8.14658 9.85334L6.14658 7.85334C5.95136 7.65807 5.95133 7.34155 6.14658 7.14631L8.14658 5.14631Z",
23
+ fill: "currentColor",
24
+ fillRule: "evenodd"
25
+ })
26
+ });
27
+ /**
28
+ * Payload's own 24px glyph for each action, picked where Payload uses it for the
29
+ * same job: the select clear indicator, the relationship edit pencil, the API key
30
+ * regenerate arrows, and the upload editor's reset.
9
31
  */
10
32
  const GLYPHS = {
11
- clear: /* @__PURE__ */ jsx("path", {
12
- className: "stroke",
13
- d: "M4.5 2.5L11.5 9.5M11.5 2.5L4.5 9.5"
14
- }),
15
- edit: /* @__PURE__ */ jsx("path", {
16
- className: "stroke",
17
- d: "M3.2 11.5L3.7 9L10.2 2.5C10.75 1.95 11.65 1.95 12.2 2.5C12.75 3.05 12.75 3.95 12.2 4.5L5.7 11L3.2 11.5Z",
18
- strokeLinejoin: "round"
19
- }),
20
- generate: /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("path", {
21
- className: "stroke",
22
- d: "M13 6A5 5 0 0 0 4.5 2.8M3 6A5 5 0 0 0 11.5 9.2"
23
- }), /* @__PURE__ */ jsx("path", {
24
- className: "stroke",
25
- d: "M4.5 0.8V3H6.7M11.5 11.2V9H9.3",
26
- strokeLinejoin: "round"
27
- })] }),
28
- undo: /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("path", {
29
- className: "stroke",
30
- d: "M3.5 3.75H9A3.5 3.5 0 0 1 9 10.75H5"
31
- }), /* @__PURE__ */ jsx("path", {
32
- className: "stroke",
33
- d: "M6 1.25L3.5 3.75L6 6.25",
34
- strokeLinejoin: "round"
35
- })] })
33
+ clear: /* @__PURE__ */ jsx(CircledXIcon, { size: 24 }),
34
+ edit: /* @__PURE__ */ jsx(WriteIcon, { size: 24 }),
35
+ generate: /* @__PURE__ */ jsx(RefreshIcon, { size: 24 }),
36
+ undo: /* @__PURE__ */ jsx(UndoIcon, {})
36
37
  };
37
38
  /**
38
- * One write-only action, rendered with the same Button shell, icon canvas, and
39
- * (for attached placement) input-segment chrome as the reveal eye, so a row of
40
- * actions reads as part of the input and never changes the field's height.
39
+ * One write-only action, drawn with the same plain-button shell and 24px icon box
40
+ * as the reveal eye, so a row of actions reads as part of the input and never
41
+ * changes the field's height. The label doubles as a hover tooltip, as on
42
+ * Payload's icon-only buttons.
41
43
  */
42
- const ActionButton = ({ attached, kind, label, onClick, pressed }) => /* @__PURE__ */ jsx(Button, {
43
- "aria-label": label,
44
- buttonStyle: "none",
45
- className: [
46
- "tenx-protected-field__eye",
47
- attached ? "tenx-protected-field__eye--attached" : "tenx-protected-field__eye--floating",
48
- "tenx-protected-field__action"
49
- ].filter(Boolean).join(" "),
50
- extraButtonProps: pressed === void 0 ? void 0 : { "aria-pressed": pressed },
51
- icon: /* @__PURE__ */ jsx("svg", {
52
- "aria-hidden": "true",
53
- className: "tenx-protected-field__eye-icon",
54
- viewBox: "0 0 16 12",
55
- xmlns: "http://www.w3.org/2000/svg",
56
- children: GLYPHS[kind]
57
- }),
58
- margin: false,
59
- onClick,
60
- tooltip: label
61
- });
44
+ const ActionButton = ({ attached, kind, label, onClick, pressed }) => {
45
+ const [showTooltip, setShowTooltip] = useState(false);
46
+ return /* @__PURE__ */ jsxs("button", {
47
+ "aria-label": label,
48
+ "aria-pressed": pressed,
49
+ className: [
50
+ "tenx-protected-field__eye",
51
+ attached ? "tenx-protected-field__eye--attached" : "tenx-protected-field__eye--floating",
52
+ "tenx-protected-field__action"
53
+ ].join(" "),
54
+ onClick: () => {
55
+ setShowTooltip(false);
56
+ onClick();
57
+ },
58
+ onPointerEnter: () => setShowTooltip(true),
59
+ onPointerLeave: () => setShowTooltip(false),
60
+ type: "button",
61
+ children: [/* @__PURE__ */ jsx(Tooltip, {
62
+ show: showTooltip,
63
+ children: label
64
+ }), GLYPHS[kind]]
65
+ });
66
+ };
62
67
  //#endregion
63
68
  export { ActionButton };
64
69
 
@@ -1 +1 @@
1
- {"version":3,"file":"WriteOnlyActions.js","names":[],"sources":["../../../../src/fields/encrypted/components/WriteOnlyActions.tsx"],"sourcesContent":["'use client'\nimport { Button } from '@payloadcms/ui'\nimport type React from 'react'\n\nexport type ActionKind = 'clear' | 'edit' | 'generate' | 'undo'\n\n/**\n * Thin-stroke glyphs on the eye's 16x12 canvas, each drawn centered on\n * (8, 6) so the mark sits in the middle of its clickable area, matching the\n * eye beside which they render.\n */\nconst GLYPHS: Record<ActionKind, React.ReactNode> = {\n\t// × matching react-select's clear indicator.\n\tclear: <path className=\"stroke\" d=\"M4.5 2.5L11.5 9.5M11.5 2.5L4.5 9.5\" />,\n\t// Pencil.\n\tedit: (\n\t\t<path\n\t\t\tclassName=\"stroke\"\n\t\t\td=\"M3.2 11.5L3.7 9L10.2 2.5C10.75 1.95 11.65 1.95 12.2 2.5C12.75 3.05 12.75 3.95 12.2 4.5L5.7 11L3.2 11.5Z\"\n\t\t\tstrokeLinejoin=\"round\"\n\t\t/>\n\t),\n\t// Circular arrows, the rotate/regenerate convention.\n\tgenerate: (\n\t\t<>\n\t\t\t<path className=\"stroke\" d=\"M13 6A5 5 0 0 0 4.5 2.8M3 6A5 5 0 0 0 11.5 9.2\" />\n\t\t\t<path className=\"stroke\" d=\"M4.5 0.8V3H6.7M11.5 11.2V9H9.3\" strokeLinejoin=\"round\" />\n\t\t</>\n\t),\n\t// Counter-clockwise undo arrow.\n\tundo: (\n\t\t<>\n\t\t\t<path className=\"stroke\" d=\"M3.5 3.75H9A3.5 3.5 0 0 1 9 10.75H5\" />\n\t\t\t<path className=\"stroke\" d=\"M6 1.25L3.5 3.75L6 6.25\" strokeLinejoin=\"round\" />\n\t\t</>\n\t),\n}\n\n/**\n * One write-only action, rendered with the same Button shell, icon canvas, and\n * (for attached placement) input-segment chrome as the reveal eye, so a row of\n * actions reads as part of the input and never changes the field's height.\n */\nexport const ActionButton: React.FC<{\n\tattached?: boolean\n\tkind: ActionKind\n\tlabel: string\n\tonClick: () => void\n\tpressed?: boolean\n}> = ({ attached, kind, label, onClick, pressed }) => (\n\t<Button\n\t\taria-label={label}\n\t\tbuttonStyle=\"none\"\n\t\tclassName={[\n\t\t\t'tenx-protected-field__eye',\n\t\t\tattached ? 'tenx-protected-field__eye--attached' : 'tenx-protected-field__eye--floating',\n\t\t\t'tenx-protected-field__action',\n\t\t]\n\t\t\t.filter(Boolean)\n\t\t\t.join(' ')}\n\t\textraButtonProps={pressed === undefined ? undefined : { 'aria-pressed': pressed }}\n\t\ticon={\n\t\t\t<svg\n\t\t\t\taria-hidden=\"true\"\n\t\t\t\tclassName=\"tenx-protected-field__eye-icon\"\n\t\t\t\tviewBox=\"0 0 16 12\"\n\t\t\t\txmlns=\"http://www.w3.org/2000/svg\"\n\t\t\t>\n\t\t\t\t{GLYPHS[kind]}\n\t\t\t</svg>\n\t\t}\n\t\tmargin={false}\n\t\tonClick={onClick}\n\t\ttooltip={label}\n\t/>\n)\n"],"mappings":";;;;;;;;;AAWA,MAAM,SAA8C;CAEnD,OAAO,oBAAC,QAAD;EAAM,WAAU;EAAS,GAAE;CAAsC,CAAA;CAExE,MACC,oBAAC,QAAD;EACC,WAAU;EACV,GAAE;EACF,gBAAe;CACf,CAAA;CAGF,UACC,qBAAA,UAAA,EAAA,UAAA,CACC,oBAAC,QAAD;EAAM,WAAU;EAAS,GAAE;CAAkD,CAAA,GAC7E,oBAAC,QAAD;EAAM,WAAU;EAAS,GAAE;EAAiC,gBAAe;CAAS,CAAA,CACnF,EAAA,CAAA;CAGH,MACC,qBAAA,UAAA,EAAA,UAAA,CACC,oBAAC,QAAD;EAAM,WAAU;EAAS,GAAE;CAAuC,CAAA,GAClE,oBAAC,QAAD;EAAM,WAAU;EAAS,GAAE;EAA0B,gBAAe;CAAS,CAAA,CAC5E,EAAA,CAAA;AAEJ;;;;;;AAOA,MAAa,gBAMP,EAAE,UAAU,MAAM,OAAO,SAAS,cACvC,oBAAC,QAAD;CACC,cAAY;CACZ,aAAY;CACZ,WAAW;EACV;EACA,WAAW,wCAAwC;EACnD;CACD,EACE,OAAO,OAAO,EACd,KAAK,GAAG;CACV,kBAAkB,YAAY,KAAA,IAAY,KAAA,IAAY,EAAE,gBAAgB,QAAQ;CAChF,MACC,oBAAC,OAAD;EACC,eAAY;EACZ,WAAU;EACV,SAAQ;EACR,OAAM;YAEL,OAAO;CACJ,CAAA;CAEN,QAAQ;CACC;CACT,SAAS;AACT,CAAA"}
1
+ {"version":3,"file":"WriteOnlyActions.js","names":[],"sources":["../../../../src/fields/encrypted/components/WriteOnlyActions.tsx"],"sourcesContent":["'use client'\nimport { CircledXIcon, RefreshIcon, Tooltip, WriteIcon } from '@payloadcms/ui'\nimport type React from 'react'\nimport { useState } from 'react'\n\nexport type ActionKind = 'clear' | 'edit' | 'generate' | 'undo'\n\n/**\n * Payload's upload-editor reset arrow, which `@payloadcms/ui` draws but does not\n * export (beta.6), redrawn from its 24px path.\n *\n * @todo Import `ResetIcon` from `@payloadcms/ui` once it is exported, and drop this copy.\n */\nconst UndoIcon: React.FC = () => (\n\t<svg\n\t\taria-hidden=\"true\"\n\t\tclassName=\"icon icon--reset\"\n\t\tfill=\"none\"\n\t\theight=\"24\"\n\t\tviewBox=\"0 0 24 24\"\n\t\twidth=\"24\"\n\t\txmlns=\"http://www.w3.org/2000/svg\"\n\t>\n\t\t<path\n\t\t\tclipRule=\"evenodd\"\n\t\t\td=\"M8.14658 5.14631C8.34183 4.95119 8.65839 4.95113 8.85361 5.14631C9.04882 5.34152 9.04873 5.65806 8.85361 5.85334L7.70712 6.99982H12.0001C15.3137 6.99987 18 9.68623 18.0001 12.9998C18.0001 16.3135 15.3138 18.9998 12.0001 18.9998C8.68638 18.9998 6.00009 16.3135 6.00009 12.9998C6.00019 12.7238 6.22401 12.4998 6.50009 12.4998C6.77613 12.4999 6.99999 12.7238 7.00009 12.9998C7.00009 15.7612 9.23867 17.9998 12.0001 17.9998C14.7615 17.9998 17.0001 15.7612 17.0001 12.9998C17 10.2385 14.7614 7.99987 12.0001 7.99982H7.70712L8.85361 9.14631C9.04882 9.34152 9.04873 9.65806 8.85361 9.85334C8.65835 10.0486 8.34184 10.0486 8.14658 9.85334L6.14658 7.85334C5.95136 7.65807 5.95133 7.34155 6.14658 7.14631L8.14658 5.14631Z\"\n\t\t\tfill=\"currentColor\"\n\t\t\tfillRule=\"evenodd\"\n\t\t/>\n\t</svg>\n)\n\n/**\n * Payload's own 24px glyph for each action, picked where Payload uses it for the\n * same job: the select clear indicator, the relationship edit pencil, the API key\n * regenerate arrows, and the upload editor's reset.\n */\nconst GLYPHS: Record<ActionKind, React.ReactNode> = {\n\tclear: <CircledXIcon size={24} />,\n\tedit: <WriteIcon size={24} />,\n\tgenerate: <RefreshIcon size={24} />,\n\tundo: <UndoIcon />,\n}\n\n/**\n * One write-only action, drawn with the same plain-button shell and 24px icon box\n * as the reveal eye, so a row of actions reads as part of the input and never\n * changes the field's height. The label doubles as a hover tooltip, as on\n * Payload's icon-only buttons.\n */\nexport const ActionButton: React.FC<{\n\tattached?: boolean\n\tkind: ActionKind\n\tlabel: string\n\tonClick: () => void\n\tpressed?: boolean\n}> = ({ attached, kind, label, onClick, pressed }) => {\n\tconst [showTooltip, setShowTooltip] = useState(false)\n\treturn (\n\t\t<button\n\t\t\taria-label={label}\n\t\t\taria-pressed={pressed}\n\t\t\tclassName={[\n\t\t\t\t'tenx-protected-field__eye',\n\t\t\t\tattached ? 'tenx-protected-field__eye--attached' : 'tenx-protected-field__eye--floating',\n\t\t\t\t'tenx-protected-field__action',\n\t\t\t].join(' ')}\n\t\t\tonClick={() => {\n\t\t\t\tsetShowTooltip(false)\n\t\t\t\tonClick()\n\t\t\t}}\n\t\t\tonPointerEnter={() => setShowTooltip(true)}\n\t\t\tonPointerLeave={() => setShowTooltip(false)}\n\t\t\ttype=\"button\"\n\t\t>\n\t\t\t<Tooltip show={showTooltip}>{label}</Tooltip>\n\t\t\t{GLYPHS[kind]}\n\t\t</button>\n\t)\n}\n"],"mappings":";;;;;;;;;;;AAaA,MAAM,iBACL,oBAAC,OAAD;CACC,eAAY;CACZ,WAAU;CACV,MAAK;CACL,QAAO;CACP,SAAQ;CACR,OAAM;CACN,OAAM;WAEN,oBAAC,QAAD;EACC,UAAS;EACT,GAAE;EACF,MAAK;EACL,UAAS;CACT,CAAA;AACG,CAAA;;;;;;AAQN,MAAM,SAA8C;CACnD,OAAO,oBAAC,cAAD,EAAc,MAAM,GAAK,CAAA;CAChC,MAAM,oBAAC,WAAD,EAAW,MAAM,GAAK,CAAA;CAC5B,UAAU,oBAAC,aAAD,EAAa,MAAM,GAAK,CAAA;CAClC,MAAM,oBAAC,UAAD,CAAW,CAAA;AAClB;;;;;;;AAQA,MAAa,gBAMP,EAAE,UAAU,MAAM,OAAO,SAAS,cAAc;CACrD,MAAM,CAAC,aAAa,kBAAkB,SAAS,KAAK;CACpD,OACC,qBAAC,UAAD;EACC,cAAY;EACZ,gBAAc;EACd,WAAW;GACV;GACA,WAAW,wCAAwC;GACnD;EACD,EAAE,KAAK,GAAG;EACV,eAAe;GACd,eAAe,KAAK;GACpB,QAAQ;EACT;EACA,sBAAsB,eAAe,IAAI;EACzC,sBAAsB,eAAe,KAAK;EAC1C,MAAK;YAdN,CAgBC,oBAAC,SAAD;GAAS,MAAM;aAAc;EAAe,CAAA,GAC3C,OAAO,KACD;;AAEV"}