@mono-lit/helper 0.0.4 → 0.0.6

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 (173) hide show
  1. package/dist/control-tooltip-7vegYmq3.js +678 -0
  2. package/dist/{tooltip-FCMRUSLi.js → control-tooltip-C3rA_nSH.js} +12 -119
  3. package/dist/{data-source-controller-Cf_sMxEh.js → data-source-controller-C6C4ej_M.js} +1 -1
  4. package/dist/{data-source-options-Bk-UoaZV.js → data-source-options-Cz9fVLK8.js} +3 -2
  5. package/dist/{data-source-read-Cuqw3LcP.js → data-source-read-i6CYSUEl.js} +2 -1
  6. package/dist/{excel-DtRpxmxs.js → excel-BPdDt06G.js} +1 -1
  7. package/dist/{export-B91P6J1y.js → export-DgomqI_3.js} +2 -2
  8. package/dist/export.js +2 -2
  9. package/dist/{field-icons-FmyBWa0g.js → field-icons-t8rXRCKs.js} +50 -1
  10. package/dist/field-tooltip-FyMi9vNM.js +266 -0
  11. package/dist/field-tooltip.css_raw-DEctHXKm.js +270 -0
  12. package/dist/field-validation-CHHQi1zl.js +170 -0
  13. package/dist/field-validation.css_raw-B3Iu33rS.js +178 -0
  14. package/dist/{form-control-core-CIdMLXMo.js → form-control-core-rW2WvOcb.js} +1 -1
  15. package/dist/{hydration-flush-DHrl4_KK.js → hydration-flush-9AJE8FRl.js} +398 -1
  16. package/dist/index.js +6 -5
  17. package/dist/{index.node-dvrNviMx.js → index.node-tTkISFn2.js} +2 -2
  18. package/dist/index.node.js +6 -5
  19. package/dist/input-format-GrRCJBqV.js +251 -0
  20. package/dist/input.css_raw-CQu2fAsU.js +5 -0
  21. package/dist/{light-slots-DdDdZ6zs.js → light-slots-BnBR29E7.js} +1 -1
  22. package/dist/{light-slots-4ZCjOcBg.js → light-slots-Cb6e-LU3.js} +1 -1
  23. package/dist/{mono-button-CeDB9khW.js → mono-button-Cy5-Y0At.js} +3 -3
  24. package/dist/{mono-button.shadow-D9NdMsmH.js → mono-button.shadow-CIBGisyo.js} +1 -2
  25. package/dist/{mono-data-grid-BHlo1IgR.js → mono-data-grid-KDpu4d4_.js} +5 -4
  26. package/dist/{mono-element-C7vCschg.js → mono-element-Bc9wElPy.js} +1 -1
  27. package/dist/{mono-form-controller-IYn0MuUQ.js → mono-form-controller-BkMR8g14.js} +18 -3
  28. package/dist/mono-ui-KOBJcnXk.js +758 -0
  29. package/dist/{reactive-DFCdZbH9.js → normalize-error-BmLbgANw.js} +1 -48
  30. package/dist/nuxt.js +1 -1
  31. package/dist/{popup-portal-HWhkd7oy.js → popup-portal-C8ttHDRX.js} +17 -1
  32. package/dist/{popup-stack-De05Y-mJ.js → popup-stack-C64WCuXq.js} +21 -1
  33. package/dist/src/components/accordion/accordion-core.d.ts +4 -1
  34. package/dist/src/components/accordion/mono-accordion.shadow.d.ts +4 -1
  35. package/dist/src/components/date/date-core.d.ts +3 -0
  36. package/dist/src/components/date/date-types.d.ts +36 -1
  37. package/dist/src/components/drawer/drawer-core.d.ts +1 -0
  38. package/dist/src/components/dropdown-table/dropdown-table-core.d.ts +3 -0
  39. package/dist/src/components/dropdown-table/dropdown-table-types.d.ts +31 -0
  40. package/dist/src/components/form/form-types.d.ts +23 -5
  41. package/dist/src/components/input/index.d.ts +2 -2
  42. package/dist/src/components/input/index.shadow.d.ts +2 -2
  43. package/dist/src/components/input/input-core.d.ts +23 -3
  44. package/dist/src/components/input/input-types.d.ts +84 -9
  45. package/dist/src/components/input/mono-input.d.ts +3 -2
  46. package/dist/src/components/input/mono-input.shadow.d.ts +3 -2
  47. package/dist/src/components/modal/modal-core.d.ts +1 -0
  48. package/dist/src/components/otp/index.d.ts +5 -0
  49. package/dist/src/components/otp/index.shadow.d.ts +6 -0
  50. package/dist/src/components/otp/mono-otp.d.ts +32 -0
  51. package/dist/src/components/otp/mono-otp.shadow.d.ts +30 -0
  52. package/dist/src/components/otp/otp-core.d.ts +91 -0
  53. package/dist/src/components/otp/otp-types.d.ts +161 -0
  54. package/dist/src/components/otp/otp-utils.d.ts +41 -0
  55. package/dist/src/components/select/select-core.d.ts +3 -0
  56. package/dist/src/components/select/select-types.d.ts +31 -0
  57. package/dist/src/components/slider/index.d.ts +5 -0
  58. package/dist/src/components/slider/index.shadow.d.ts +6 -0
  59. package/dist/src/components/slider/mono-slider.d.ts +33 -0
  60. package/dist/src/components/slider/mono-slider.shadow.d.ts +29 -0
  61. package/dist/src/components/slider/slider-core.d.ts +77 -0
  62. package/dist/src/components/slider/slider-math.d.ts +102 -0
  63. package/dist/src/components/slider/slider-types.d.ts +188 -0
  64. package/dist/src/components/table/column-autosize.d.ts +74 -0
  65. package/dist/src/components/table/mono-data-grid.d.ts +10 -0
  66. package/dist/src/components/table/mono-table-th-core.d.ts +3 -0
  67. package/dist/src/components/table/table-types.d.ts +8 -1
  68. package/dist/src/components/tag-input/mono-tag-input.d.ts +12 -0
  69. package/dist/src/components/tag-input/mono-tag-input.shadow.d.ts +9 -1
  70. package/dist/src/components/tag-input/tag-input-core.d.ts +12 -1
  71. package/dist/src/components/tag-input/tag-input-types.d.ts +33 -0
  72. package/dist/src/components/textarea/textarea-core.d.ts +3 -0
  73. package/dist/src/components/textarea/textarea-types.d.ts +31 -0
  74. package/dist/src/composables/field-bubble.d.ts +34 -0
  75. package/dist/src/composables/field-icons.d.ts +10 -0
  76. package/dist/src/composables/field-tooltip.d.ts +52 -0
  77. package/dist/src/composables/field-validation.d.ts +58 -0
  78. package/dist/src/composables/mono-size-attrs.d.ts +10 -0
  79. package/dist/src/composables/popup-portal.d.ts +12 -0
  80. package/dist/src/composables/popup-stack.d.ts +21 -0
  81. package/dist/src/entries/index.d.ts +3 -2
  82. package/dist/src/entries/index.node.d.ts +3 -2
  83. package/dist/ssr-lit/runtime/components/LitWrapper.vue +11 -11
  84. package/dist/ssr-lit/runtime/components/LitWrapperClient.vue +11 -11
  85. package/dist/ssr-lit/runtime/components/LitWrapperServer.vue +38 -38
  86. package/dist/ssr-lit/runtime/plugins/antiFouc.server.js +25 -25
  87. package/dist/ssr-lit/runtime/plugins/hydrateSupport.client.js +4 -4
  88. package/dist/ssr-lit/runtime/plugins/polyfill.client.js +9 -9
  89. package/dist/ssr-lit/runtime/utils/customElements.js +11 -11
  90. package/dist/ssr-lit/runtime/utils/litElementRenderer.js +28 -28
  91. package/dist/{styles-D-ergrfR.js → styles-BODNpZV1.js} +1 -1
  92. package/dist/tooltip-Drekihf5.js +102 -0
  93. package/dist/tooltip-loader-3U9FTOXj.js +20 -0
  94. package/dist/tooltip-loader-Dcp9AUZn.js +23 -0
  95. package/dist/tooltip.js +3 -1
  96. package/dist/ui/accordion.js +19 -6
  97. package/dist/ui/alert.js +3 -3
  98. package/dist/ui/breadcrumb.js +3 -3
  99. package/dist/ui/button-dropdown.js +3 -3
  100. package/dist/ui/button.js +1 -1
  101. package/dist/ui/card.js +3 -3
  102. package/dist/ui/chart.js +3 -4
  103. package/dist/ui/checkbox.js +3 -3
  104. package/dist/ui/chip.js +2 -2
  105. package/dist/ui/date.js +68 -7
  106. package/dist/ui/drawer.js +14 -5
  107. package/dist/ui/dropdown-table.js +63 -9
  108. package/dist/ui/dropdown.js +6 -5
  109. package/dist/ui/file-upload.js +3 -3
  110. package/dist/ui/filter.js +2 -2
  111. package/dist/ui/form.js +1 -1
  112. package/dist/ui/index.css +4276 -2543
  113. package/dist/ui/input.js +365 -264
  114. package/dist/ui/menu.js +3 -3
  115. package/dist/ui/modal.js +15 -6
  116. package/dist/ui/nav.js +3 -3
  117. package/dist/ui/otp.js +834 -0
  118. package/dist/ui/radio.js +3 -3
  119. package/dist/ui/rich-text-editor.js +3 -4
  120. package/dist/ui/select.js +70 -7
  121. package/dist/ui/shadow/accordion.js +31 -4
  122. package/dist/ui/shadow/alert.js +2 -2
  123. package/dist/ui/shadow/breadcrumb.js +1 -1
  124. package/dist/ui/shadow/button-dropdown.js +3 -3
  125. package/dist/ui/shadow/button.js +1 -1
  126. package/dist/ui/shadow/card.js +1 -2
  127. package/dist/ui/shadow/chart.js +5 -6
  128. package/dist/ui/shadow/checkbox.js +2 -2
  129. package/dist/ui/shadow/chip.js +1 -1
  130. package/dist/ui/shadow/date.js +69 -9
  131. package/dist/ui/shadow/drawer.js +12 -3
  132. package/dist/ui/shadow/dropdown-table.js +64 -10
  133. package/dist/ui/shadow/dropdown.js +4 -3
  134. package/dist/ui/shadow/file-upload.js +2 -2
  135. package/dist/ui/shadow/filter.js +1 -2
  136. package/dist/ui/shadow/input.js +369 -264
  137. package/dist/ui/shadow/menu.js +1 -1
  138. package/dist/ui/shadow/modal.js +13 -4
  139. package/dist/ui/shadow/nav.js +1 -1
  140. package/dist/ui/shadow/otp.js +841 -0
  141. package/dist/ui/shadow/radio.js +2 -2
  142. package/dist/ui/shadow/rich-text-editor.js +2 -3
  143. package/dist/ui/shadow/select.js +74 -10
  144. package/dist/ui/shadow/sidebar.js +3 -3
  145. package/dist/ui/shadow/slider.js +1081 -0
  146. package/dist/ui/shadow/switch.js +2 -2
  147. package/dist/ui/shadow/table.js +40 -11
  148. package/dist/ui/shadow/tabs.js +1 -1
  149. package/dist/ui/shadow/tag-input.js +160 -15
  150. package/dist/ui/shadow/textarea.js +65 -5
  151. package/dist/ui/sidebar.js +5 -5
  152. package/dist/ui/slider.js +1078 -0
  153. package/dist/ui/switch.js +3 -3
  154. package/dist/ui/table.js +36 -7
  155. package/dist/ui/tabs.js +3 -3
  156. package/dist/ui/tag-input.js +167 -7
  157. package/dist/ui/textarea.js +65 -5
  158. package/dist/ui/theme/luma.css +505 -466
  159. package/dist/ui/theme/lyra.css +505 -466
  160. package/dist/ui/theme/maia.css +501 -466
  161. package/dist/ui/theme/mira.css +505 -466
  162. package/dist/ui/theme/nova.css +503 -466
  163. package/dist/ui/theme/one.css +742 -699
  164. package/dist/ui/theme/rhea.css +506 -466
  165. package/dist/ui/theme/sera.css +507 -466
  166. package/dist/ui/theme/vega.css +495 -466
  167. package/dist/{vite-DcyRlTTf.js → vite-CivRCJaf.js} +2 -0
  168. package/dist/vite.js +1 -1
  169. package/dist/vue.d.ts +10 -0
  170. package/package.json +31 -13
  171. package/dist/css-size-DWAPgQdT.js +0 -38
  172. package/dist/input.css_raw-CGESifay.js +0 -5
  173. package/dist/mono-ui-BwUc0L6B.js +0 -360
@@ -0,0 +1,841 @@
1
+ import { _ as buildSizeStyle, a as __decorate, c as defineHybridPropAlias, f as customElement, i as withShadowUtilityStyles, l as defineHybridPropAliases, r as toShadowCss, s as booleanStringConverter, t as flushSsrHydration } from "../../hydration-flush-9AJE8FRl.js";
2
+ import { t as dispatchMonoEvent } from "../../mono-event-BPku9HpS.js";
3
+ import { n as cssPart } from "../../css-class-B6Tc_MAx.js";
4
+ import { t as MonoFormControlCore } from "../../form-control-core-rW2WvOcb.js";
5
+ import { n as FieldTooltipController, t as field_tooltip_css_raw_default } from "../../field-tooltip.css_raw-DEctHXKm.js";
6
+ import { n as label_position_css_raw_default, r as FieldValidationController, t as field_validation_css_raw_default } from "../../field-validation.css_raw-B3Iu33rS.js";
7
+ import { LitElement, html, isServer, nothing, unsafeCSS } from "lit";
8
+ import { property, state } from "lit/decorators.js";
9
+ import { ifDefined } from "lit/directives/if-defined.js";
10
+ import { styleMap } from "lit/directives/style-map.js";
11
+ import { live } from "lit/directives/live.js";
12
+
13
+ //#region src/components/otp/otp-utils.ts
14
+ /**
15
+ * Pure helpers behind `mono-otp`. The value is always a CONTIGUOUS prefix of the boxes — box i
16
+ * holds `value[i]` — so every edit is a string operation and the boxes are just its characters.
17
+ */
18
+ const OTP_DEFAULT_LENGTH = 6;
19
+ /** One character cleaned for `type`; `''` when it is not accepted. */
20
+ function sanitizeOtpChar(ch, type = "numeric") {
21
+ if (!ch) return "";
22
+ if (type === "numeric") return /^[0-9]$/.test(ch) ? ch : "";
23
+ if (type === "alphanumeric") return /^[A-Za-z0-9]$/.test(ch) ? ch.toUpperCase() : "";
24
+ return /^\S$/u.test(ch) ? ch : "";
25
+ }
26
+ /** A whole string cleaned for `type` — rejected characters are dropped, not kept as holes. */
27
+ function sanitizeOtpText(text, type = "numeric") {
28
+ if (text == null) return "";
29
+ let out = "";
30
+ for (const ch of Array.from(String(text))) out += sanitizeOtpChar(ch, type);
31
+ return out;
32
+ }
33
+ /** `length` from a prop or attribute: a whole number ≥ 1, else the default. */
34
+ function resolveOtpLength(length) {
35
+ const n = Math.floor(Number(length));
36
+ return Number.isFinite(n) && n >= 1 ? n : 6;
37
+ }
38
+ /** The model for `length` boxes: cleaned and cut to fit. */
39
+ function normaliseOtpValue(value, length, type = "numeric") {
40
+ return Array.from(sanitizeOtpText(value, type)).slice(0, length).join("");
41
+ }
42
+ /**
43
+ * Group sizes → the box indexes a separator goes BEFORE. `3` repeats (6 boxes → 3-3, 8 → 3-3-2);
44
+ * a list is taken as given and any boxes past it form one last group.
45
+ */
46
+ function parseOtpGroups(groups, length) {
47
+ if (groups == null || groups === "") return [];
48
+ let sizes;
49
+ if (typeof groups === "number") sizes = [groups];
50
+ else if (Array.isArray(groups)) sizes = groups.map(Number);
51
+ else sizes = String(groups).replace(/[[\]\s]/g, "").split(/[,\-|]/).filter(Boolean).map(Number);
52
+ sizes = sizes.filter((n) => Number.isFinite(n) && n >= 1).map(Math.floor);
53
+ if (!sizes.length) return [];
54
+ const repeat = sizes.length === 1;
55
+ const breaks = [];
56
+ let at = 0;
57
+ for (let k = 0;; k++) {
58
+ const size = repeat ? sizes[0] : sizes[k];
59
+ if (size == null) break;
60
+ at += size;
61
+ if (at >= length) break;
62
+ breaks.push(at);
63
+ }
64
+ return breaks;
65
+ }
66
+ /**
67
+ * Put `text` at box `index`. One character replaces that box; several (a paste, an SMS
68
+ * autofill) overwrite from `index` onwards. Rejected characters are dropped first, so pasting
69
+ * `"123-456"` into a numeric field fills six boxes.
70
+ */
71
+ function spliceOtpValue(value, index, text, length, type = "numeric") {
72
+ const chars = Array.from(value);
73
+ const clean = Array.from(sanitizeOtpText(text, type));
74
+ if (!clean.length) return {
75
+ value,
76
+ caret: clampCaret(index, chars.length, length)
77
+ };
78
+ const at = Math.min(Math.max(0, index), chars.length);
79
+ let next;
80
+ if (clean.length === 1) {
81
+ next = chars.slice();
82
+ next[at] = clean[0];
83
+ } else next = chars.slice(0, at).concat(clean);
84
+ next = next.slice(0, length);
85
+ return {
86
+ value: next.join(""),
87
+ caret: clampCaret(at + clean.length, next.length, length)
88
+ };
89
+ }
90
+ /** Remove the character in box `index`; the boxes after it move left. */
91
+ function removeOtpChar(value, index, length) {
92
+ const chars = Array.from(value);
93
+ if (index < 0 || index >= chars.length) return {
94
+ value,
95
+ caret: clampCaret(index, chars.length, length)
96
+ };
97
+ chars.splice(index, 1);
98
+ return {
99
+ value: chars.join(""),
100
+ caret: clampCaret(index, chars.length, length)
101
+ };
102
+ }
103
+ /**
104
+ * Backspace in box `index`: clear it when it holds a character, otherwise step back and clear
105
+ * the one before.
106
+ */
107
+ function backspaceOtp(value, index, length) {
108
+ const filled = Array.from(value).length;
109
+ if (index < filled) return removeOtpChar(value, index, length);
110
+ if (filled === 0) return {
111
+ value,
112
+ caret: 0
113
+ };
114
+ return removeOtpChar(value, filled - 1, length);
115
+ }
116
+ /** The furthest box that can take focus: the first empty one, or the last box when full. */
117
+ function clampCaret(index, filled, length) {
118
+ return Math.max(0, Math.min(index, filled, length - 1));
119
+ }
120
+
121
+ //#endregion
122
+ //#region src/components/otp/otp-core.ts
123
+ /**
124
+ * `MonoOtpCore` — all render-mode-agnostic logic for `mono-otp`: N single-character boxes that
125
+ * behave as ONE field. The value is a contiguous prefix of the boxes (box i holds `value[i]`), so
126
+ * focus can never land past the first empty box, Backspace / Delete shift the rest left, and a
127
+ * paste or an SMS autofill overwrites from the focused box on (see `otp-utils.ts`).
128
+ *
129
+ * Same prop surface as mono-input (size / color / variant / label-position / validation-position
130
+ * / tooltip / messages / states / sizing), wired to `controlMonoForm` through
131
+ * `MonoFormControlCore`: `input` per edit (live rules), `change` when focus leaves the group
132
+ * (change rules, marks touched), plus `complete` once every box is filled.
133
+ *
134
+ * Each build supplies `createRenderRoot()`, the slot strategy (the `_render*` hooks below) and
135
+ * `renderIcon()` — light captures `slot="…"` children into `[data-mono-slot]` placeholders,
136
+ * shadow uses native `<slot>`s.
137
+ */
138
+ const MonoOtpCore = (superClass) => {
139
+ class MonoOtpCoreClass extends MonoFormControlCore(superClass) {
140
+ constructor(...args) {
141
+ super(...args);
142
+ this.cssClass = {};
143
+ this.cssClassName = "";
144
+ this.type = "numeric";
145
+ this.length = 6;
146
+ this.separator = "-";
147
+ this.mask = false;
148
+ this.size = "md";
149
+ this.color = "primary";
150
+ this.variant = "outlined";
151
+ this.labelPosition = "top";
152
+ this.validationPosition = "bottom";
153
+ this.modelValue = "";
154
+ this.value = "";
155
+ this.name = "";
156
+ this.placeholder = "";
157
+ this.label = "";
158
+ this.helperText = "";
159
+ this.tooltip = null;
160
+ this._tooltip = new FieldTooltipController(this, () => this.tooltip);
161
+ this._validation = new FieldValidationController(this, () => ({
162
+ position: this.validationPosition,
163
+ ...this._validationNotice ?? {
164
+ state: void 0,
165
+ text: void 0
166
+ }
167
+ }), () => this.renderRoot?.querySelector?.("[mono-otp] > [mono-field]"));
168
+ this.validationState = "default";
169
+ this.validationMessage = "";
170
+ this.error = false;
171
+ this.errorMessage = "";
172
+ this.success = false;
173
+ this.successMessage = "";
174
+ this.autocomplete = "one-time-code";
175
+ this.inputmode = "";
176
+ this.disabled = false;
177
+ this.readonly = false;
178
+ this.required = false;
179
+ this.clearable = false;
180
+ this.autofocus = false;
181
+ this._code = "";
182
+ this._focusIndex = -1;
183
+ this._hasPrefixSlotState = false;
184
+ this._hasSuffixSlotState = false;
185
+ this._hasLabelSlotState = false;
186
+ this._hasHelperSlotState = false;
187
+ this._committed = null;
188
+ this._otpId = `mono-otp-${Math.random().toString(36).slice(2)}`;
189
+ this._messageId = `${this._otpId}-message`;
190
+ this._onCellInput = (event) => {
191
+ const el = event.currentTarget;
192
+ const i = this._indexOf(event);
193
+ const old = Array.from(this._code)[i] ?? "";
194
+ const raw = el.value;
195
+ if (!this._editable) {
196
+ el.value = old;
197
+ event.stopPropagation();
198
+ return;
199
+ }
200
+ if (raw === "") {
201
+ el.value = old;
202
+ const edit = removeOtpChar(this._code, i, this._length);
203
+ if (edit.value === this._code) event.stopPropagation();
204
+ this._apply(edit, i, event);
205
+ return;
206
+ }
207
+ let text = raw;
208
+ if (old && Array.from(raw).length === 2 && raw.includes(old)) text = raw.startsWith(old) ? raw.slice(old.length) : raw.slice(0, raw.length - old.length);
209
+ const edit = spliceOtpValue(this._code, i, text, this._length, this.type);
210
+ el.value = Array.from(edit.value)[i] ?? "";
211
+ if (edit.value === this._code) event.stopPropagation();
212
+ this._apply(edit, i, event);
213
+ };
214
+ this._onCellKeydown = (event) => {
215
+ const i = this._indexOf(event);
216
+ const n = this._length;
217
+ const last = clampCaret(n, this._filled, n);
218
+ switch (event.key) {
219
+ case "Backspace":
220
+ event.preventDefault();
221
+ if (this._editable) this._apply(backspaceOtp(this._code, i, n), i, event);
222
+ return;
223
+ case "Delete":
224
+ event.preventDefault();
225
+ if (this._editable) this._apply(removeOtpChar(this._code, i, n), i, event);
226
+ return;
227
+ case "ArrowLeft":
228
+ case "ArrowUp":
229
+ event.preventDefault();
230
+ this._focusCell(Math.max(0, i - 1));
231
+ return;
232
+ case "ArrowRight":
233
+ case "ArrowDown":
234
+ event.preventDefault();
235
+ this._focusCell(Math.min(last, i + 1));
236
+ return;
237
+ case "Home":
238
+ event.preventDefault();
239
+ this._focusCell(0);
240
+ return;
241
+ case "End":
242
+ event.preventDefault();
243
+ this._focusCell(last);
244
+ return;
245
+ }
246
+ if (this._editable && event.key.length === 1 && !event.ctrlKey && !event.metaKey && !event.altKey) {
247
+ const edit = spliceOtpValue(this._code, i, event.key, n, this.type);
248
+ if (edit.value === this._code && i < this._filled && sanitizeOtpChar(event.key, this.type)) {
249
+ event.preventDefault();
250
+ this._focusCell(edit.caret);
251
+ }
252
+ }
253
+ };
254
+ this._onCellPaste = (event) => {
255
+ event.preventDefault();
256
+ if (!this._editable) return;
257
+ const text = event.clipboardData?.getData("text") ?? "";
258
+ this._apply(spliceOtpValue(this._code, this._indexOf(event), text, this._length, this.type), this._indexOf(event), event);
259
+ };
260
+ this._onCellFocus = (event) => {
261
+ const i = this._indexOf(event);
262
+ const allowed = clampCaret(i, this._filled, this._length);
263
+ if (allowed !== i) {
264
+ this._focusCell(allowed);
265
+ return;
266
+ }
267
+ this._focusIndex = i;
268
+ event.currentTarget.select?.();
269
+ };
270
+ this._onCellClick = (event) => {
271
+ event.currentTarget.select?.();
272
+ };
273
+ this._onFieldFocusIn = () => {
274
+ if (this._committed === null) this._committed = this._code;
275
+ };
276
+ this._onFieldFocusOut = (event) => {
277
+ const next = event.relatedTarget;
278
+ if (next && this.renderRoot.contains(next)) return;
279
+ this._focusIndex = -1;
280
+ const before = this._committed;
281
+ this._committed = null;
282
+ if (before !== null && before !== this._code) dispatchMonoEvent(this, "change", this._detail(before, -1, event));
283
+ };
284
+ this._swallow = (event) => {
285
+ event.stopPropagation();
286
+ };
287
+ this._onClear = () => {
288
+ if (!this._editable) return;
289
+ this.clear();
290
+ this._focusCell(0);
291
+ };
292
+ defineHybridPropAliases(this, [
293
+ "labelPosition",
294
+ "validationPosition",
295
+ "modelValue",
296
+ "helperText",
297
+ "validationState",
298
+ "validationMessage",
299
+ "errorMessage",
300
+ "successMessage",
301
+ "ariaLabelText",
302
+ "cssClass",
303
+ "minWidth",
304
+ "maxWidth",
305
+ "minHeight",
306
+ "maxHeight"
307
+ ]);
308
+ for (const alias of [
309
+ "ariaLabel",
310
+ "aria-label",
311
+ "arialabel"
312
+ ]) Object.defineProperty(this, alias, {
313
+ get: () => this.ariaLabelText,
314
+ set: (value) => {
315
+ this.ariaLabelText = value == null ? void 0 : String(value);
316
+ },
317
+ configurable: true,
318
+ enumerable: false
319
+ });
320
+ defineHybridPropAlias(this, "maxlength", "length");
321
+ }
322
+ static get observedAttributes() {
323
+ return [
324
+ ...super.observedAttributes ?? [],
325
+ "modelvalue",
326
+ "helpertext",
327
+ "validationstate",
328
+ "validationmessage",
329
+ "errormessage",
330
+ "successmessage",
331
+ "arialabeltext",
332
+ "arialabel",
333
+ "maxlength",
334
+ "css-class",
335
+ "cssclass"
336
+ ];
337
+ }
338
+ attributeChangedCallback(name, oldValue, newValue) {
339
+ super.attributeChangedCallback(name, oldValue, newValue);
340
+ if (oldValue === newValue) return;
341
+ switch (name) {
342
+ case "css-class":
343
+ case "cssclass":
344
+ this.cssClassName = newValue ?? "";
345
+ return;
346
+ case "modelvalue":
347
+ this.modelValue = newValue ?? "";
348
+ return;
349
+ case "helpertext":
350
+ this.helperText = newValue ?? "";
351
+ return;
352
+ case "validationstate":
353
+ this.validationState = newValue ?? "default";
354
+ return;
355
+ case "validationmessage":
356
+ this.validationMessage = newValue ?? "";
357
+ return;
358
+ case "errormessage":
359
+ this.errorMessage = newValue ?? "";
360
+ return;
361
+ case "successmessage":
362
+ this.successMessage = newValue ?? "";
363
+ return;
364
+ case "arialabeltext":
365
+ case "arialabel":
366
+ this.ariaLabelText = newValue ?? void 0;
367
+ return;
368
+ case "maxlength":
369
+ if (newValue != null) this.length = newValue;
370
+ return;
371
+ }
372
+ }
373
+ get complete() {
374
+ return Array.from(this._code).length === this._length;
375
+ }
376
+ get _length() {
377
+ return resolveOtpLength(this.length);
378
+ }
379
+ get _filled() {
380
+ return Array.from(this._code).length;
381
+ }
382
+ willUpdate(changed) {
383
+ if (changed.has("value") && !changed.has("modelValue") && String(this.value ?? "") !== this._code) this.modelValue = String(this.value ?? "");
384
+ if (changed.has("modelValue") || changed.has("length") || changed.has("type")) {
385
+ this._code = normaliseOtpValue(this.modelValue, this._length, this.type);
386
+ if (this.value !== this._code) this.value = this._code;
387
+ }
388
+ super.willUpdate?.(changed);
389
+ }
390
+ firstUpdated(changed) {
391
+ super.firstUpdated?.(changed);
392
+ if (this.autofocus) this.focus();
393
+ }
394
+ _cellEl(i) {
395
+ return this.renderRoot?.querySelector?.(`[mono-otp-cell][data-index="${i}"]`) ?? null;
396
+ }
397
+ _indexOf(event) {
398
+ return Number(event.currentTarget.dataset.index ?? 0);
399
+ }
400
+ get _editable() {
401
+ return !this.disabled && !this.readonly;
402
+ }
403
+ _focusCell(i) {
404
+ const el = this._cellEl(i);
405
+ if (!el) return;
406
+ el.focus();
407
+ el.select?.();
408
+ }
409
+ _detail(oldValue, index, sourceEvent) {
410
+ return {
411
+ modelValue: this._code,
412
+ currentValue: this._code,
413
+ oldValue,
414
+ value: this._code,
415
+ complete: this.complete,
416
+ index,
417
+ name: this.name,
418
+ sourceEvent
419
+ };
420
+ }
421
+ /** Commit an edit: write the model, fire `input` (+ `complete`), then move the caret. */
422
+ _apply(edit, index, event) {
423
+ const old = this._code;
424
+ if (edit.value !== old) {
425
+ this._code = edit.value;
426
+ this.value = edit.value;
427
+ this.modelValue = edit.value;
428
+ dispatchMonoEvent(this, "input", this._detail(old, index, event));
429
+ if (this.complete) dispatchMonoEvent(this, "complete", this._detail(old, index));
430
+ }
431
+ this._focusCell(edit.caret);
432
+ this.updateComplete.then(() => {
433
+ const el = this._cellEl(edit.caret);
434
+ if (el && this._focusIndex === edit.caret) el.select?.();
435
+ });
436
+ }
437
+ clear() {
438
+ if (!this._code) return;
439
+ const old = this._code;
440
+ this._code = "";
441
+ this.value = "";
442
+ this.modelValue = "";
443
+ const detail = this._detail(old, -1);
444
+ dispatchMonoEvent(this, "input", detail);
445
+ dispatchMonoEvent(this, "change", detail);
446
+ dispatchMonoEvent(this, "clear", detail);
447
+ if (this._committed !== null) this._committed = "";
448
+ }
449
+ focus(index) {
450
+ const i = typeof index === "number" ? index : clampCaret(this._length, this._filled, this._length);
451
+ this._focusCell(clampCaret(i, this._filled, this._length));
452
+ }
453
+ blur() {
454
+ this._cellEl(this._focusIndex)?.blur();
455
+ }
456
+ get _resolvedValidationState() {
457
+ if (this.validationState && this.validationState !== "default") return this.validationState;
458
+ if (this.error || this.errorMessage) return "invalid";
459
+ if (this.success || this.successMessage) return "valid";
460
+ return "default";
461
+ }
462
+ get _validationNotice() {
463
+ if (this.validationMessage) return {
464
+ state: this._resolvedValidationState,
465
+ text: this.validationMessage
466
+ };
467
+ if (this.errorMessage) return {
468
+ state: "invalid",
469
+ text: this.errorMessage
470
+ };
471
+ if (this.successMessage) return {
472
+ state: "valid",
473
+ text: this.successMessage
474
+ };
475
+ return null;
476
+ }
477
+ _cls(base, key) {
478
+ return cssPart(this.cssClass, base, key);
479
+ }
480
+ get _hasLabel() {
481
+ return !!(this.label || this._hasLabelSlotState);
482
+ }
483
+ get _describedBy() {
484
+ return this.validationMessage || this.errorMessage || this.successMessage || this.helperText || this._hasHelperSlotState ? this._messageId : void 0;
485
+ }
486
+ get _inputMode() {
487
+ return this.inputmode || (this.type === "numeric" ? "numeric" : "text");
488
+ }
489
+ _placeholderAt(i) {
490
+ const chars = Array.from(this.placeholder ?? "");
491
+ if (!chars.length) return void 0;
492
+ return chars.length === this._length ? chars[i] : chars[0];
493
+ }
494
+ _cellLabel(i) {
495
+ const base = this.ariaLabelText || this.label;
496
+ const own = `${this.type === "numeric" ? "Digit" : "Character"} ${i + 1} of ${this._length}`;
497
+ return base ? `${base} – ${own}` : own;
498
+ }
499
+ /** Label text — light: placeholder for the captured slot; shadow overrides with `<slot>`. */
500
+ _renderLabelText() {
501
+ return this._hasLabelSlotState ? html`<span data-mono-slot="label"></span>` : this.label;
502
+ }
503
+ _renderLabel() {
504
+ if (!this._hasLabel) return nothing;
505
+ return html`
506
+ <label class=${this._cls("mono-otp-label", "label")} mono-label id=${`${this._otpId}-label`} for=${`${this._otpId}-0`}>
507
+ ${this._renderLabelText()}
508
+ ${this.required ? html`<span class=${this._cls("mono-otp-required", "required")} mono-required-mark>*</span>` : nothing}
509
+ ${this._tooltip.render()}
510
+ </label>
511
+ `;
512
+ }
513
+ _renderHelperText(base) {
514
+ if (!this.helperText && !this._hasHelperSlotState) return nothing;
515
+ return html`<div class=${`${base} helper`} mono-message="helper">${this._hasHelperSlotState ? html`<span data-mono-slot="helper"></span>` : this.helperText}</div>`;
516
+ }
517
+ _renderMessage() {
518
+ const base = this._cls("mono-otp-message", "message");
519
+ if (this._validation.moved) {
520
+ const notice = this._validationNotice;
521
+ return html`${this._renderHelperText(base)}<div
522
+ class=${`${base} ${notice.state}`}
523
+ mono-message=${notice.state}
524
+ mono-sr-only
525
+ role=${notice.state === "invalid" ? "alert" : nothing}
526
+ >${notice.text}</div>`;
527
+ }
528
+ if (this.validationMessage) {
529
+ const s = this._resolvedValidationState;
530
+ return html`<div class=${`${base} ${s}`} mono-message=${s} role=${s === "invalid" ? "alert" : nothing}>${this.validationMessage}</div>`;
531
+ }
532
+ if (this.errorMessage) return html`<div class=${`${base} invalid`} mono-message="invalid" role="alert">${this.errorMessage}</div>`;
533
+ if (this.successMessage) return html`<div class=${`${base} valid`} mono-message="valid">${this.successMessage}</div>`;
534
+ return this._renderHelperText(base);
535
+ }
536
+ /** Prefix / suffix inside the row — light: captured-slot placeholder; shadow overrides with `<slot>`. */
537
+ _renderAffix(name) {
538
+ if (!(name === "prefix" ? this._hasPrefixSlotState : this._hasSuffixSlotState)) return nothing;
539
+ return html`<span class=${this._cls(`mono-otp-${name}`, name)} mono-otp-affix=${name}><span data-mono-slot=${name}></span></span>`;
540
+ }
541
+ _renderCell(i, chars, invalid) {
542
+ return html`<input
543
+ id=${`${this._otpId}-${i}`}
544
+ class=${this._cls("mono-otp-cell", "cell")}
545
+ mono-otp-cell
546
+ data-index=${i}
547
+ type=${this.mask ? "password" : "text"}
548
+ .value=${live(chars[i] ?? "")}
549
+ inputmode=${this._inputMode}
550
+ pattern=${ifDefined(this.type === "numeric" ? "[0-9]*" : void 0)}
551
+ autocomplete=${i === 0 ? this.autocomplete || "one-time-code" : "off"}
552
+ autocapitalize=${this.type === "alphanumeric" ? "characters" : "off"}
553
+ autocorrect="off"
554
+ spellcheck="false"
555
+ placeholder=${ifDefined(this._placeholderAt(i))}
556
+ ?disabled=${this.disabled}
557
+ ?readonly=${this.readonly}
558
+ ?mono-filled=${i < chars.length}
559
+ ?mono-active=${i === this._focusIndex}
560
+ aria-label=${this._cellLabel(i)}
561
+ aria-invalid=${invalid ? "true" : "false"}
562
+ aria-describedby=${ifDefined(this._describedBy)}
563
+ @input=${this._onCellInput}
564
+ @change=${this._swallow}
565
+ @keydown=${this._onCellKeydown}
566
+ @paste=${this._onCellPaste}
567
+ @focus=${this._onCellFocus}
568
+ @click=${this._onCellClick}
569
+ />`;
570
+ }
571
+ _renderCells() {
572
+ const n = this._length;
573
+ const chars = Array.from(this._code);
574
+ const breaks = new Set(parseOtpGroups(this.groups, n));
575
+ const invalid = this._resolvedValidationState === "invalid";
576
+ const groups = [[]];
577
+ for (let i = 0; i < n; i++) {
578
+ if (breaks.has(i)) groups.push([]);
579
+ groups[groups.length - 1].push(i);
580
+ }
581
+ return html`${groups.map((group, g) => html`${g > 0 ? html`<span class=${this._cls("mono-otp-separator", "separator")} mono-otp-separator aria-hidden="true">${this.separator}</span>` : nothing}<div class=${this._cls("mono-otp-group", "group")} mono-otp-group>${group.map((i) => this._renderCell(i, chars, invalid))}</div>`)}`;
582
+ }
583
+ _renderClear() {
584
+ if (!(this.clearable && this._code && this._editable)) return nothing;
585
+ return html`<button type="button" class=${this._cls("mono-otp-clear", "clear")} mono-clear aria-label="Clear code" @click=${this._onClear}>
586
+ ${this.renderIcon("close")}
587
+ </button>`;
588
+ }
589
+ /** Icon hook — light: UnoCSS `i-mdi-*`; shadow: inline SVG. */
590
+ renderIcon(_name) {
591
+ return html``;
592
+ }
593
+ render() {
594
+ const state = this._resolvedValidationState;
595
+ const lp = this.labelPosition === "left" || this.labelPosition === "right" ? this.labelPosition : nothing;
596
+ return html`<div
597
+ class=${[
598
+ "mono-otp",
599
+ this.size,
600
+ this.color,
601
+ this.variant,
602
+ this.disabled ? "disabled" : "",
603
+ this.cssClassName,
604
+ this.cssClass?.root
605
+ ].filter(Boolean).join(" ")}
606
+ style=${styleMap(buildSizeStyle(this))}
607
+ mono-otp
608
+ mono-size=${this.size === "md" ? nothing : this.size}
609
+ mono-color=${this.color === "primary" ? nothing : this.color}
610
+ mono-variant=${this.variant === "outlined" ? nothing : this.variant}
611
+ mono-label-position=${lp}
612
+ mono-validation-position=${this.validationPosition === "bottom" ? nothing : this.validationPosition}
613
+ mono-validation-state=${state === "default" ? nothing : state}
614
+ mono-type=${this.type === "numeric" ? nothing : this.type}
615
+ ?mono-mask=${this.mask}
616
+ ?mono-complete=${this.complete}
617
+ ?mono-disabled=${this.disabled}
618
+ ?mono-readonly=${this.readonly}
619
+ ?mono-required=${this.required}
620
+ ?mono-clearable=${this.clearable}
621
+ >
622
+ ${this._renderLabel()}
623
+ <div
624
+ class=${this._cls("mono-otp-field", "field")}
625
+ mono-field
626
+ role="group"
627
+ aria-labelledby=${ifDefined(!this.ariaLabelText && this._hasLabel ? `${this._otpId}-label` : void 0)}
628
+ aria-label=${ifDefined(this.ariaLabelText || (!this._hasLabel ? "One-time code" : void 0))}
629
+ aria-required=${ifDefined(this.required ? "true" : void 0)}
630
+ @focusin=${this._onFieldFocusIn}
631
+ @focusout=${this._onFieldFocusOut}
632
+ >
633
+ ${this._renderAffix("prefix")}
634
+ ${this._renderCells()}
635
+ ${this._validation.renderIcon()}
636
+ ${this._renderClear()}
637
+ ${this._renderAffix("suffix")}
638
+ </div>
639
+ ${this.name ? html`<input type="hidden" mono-otp-hidden name=${this.name} .value=${this._code} ?disabled=${this.disabled} />` : nothing}
640
+ <div id=${this._messageId} class=${this.cssClass?.messageWrap ?? ""} mono-message-wrap>${this._renderMessage()}</div>
641
+ ${this._validation.renderFloat()}
642
+ </div>`;
643
+ }
644
+ }
645
+ __decorate([property({ attribute: false })], MonoOtpCoreClass.prototype, "cssClass", void 0);
646
+ __decorate([property({
647
+ type: String,
648
+ attribute: "css-class"
649
+ })], MonoOtpCoreClass.prototype, "cssClassName", void 0);
650
+ __decorate([property({ type: String })], MonoOtpCoreClass.prototype, "type", void 0);
651
+ __decorate([property()], MonoOtpCoreClass.prototype, "length", void 0);
652
+ __decorate([property()], MonoOtpCoreClass.prototype, "groups", void 0);
653
+ __decorate([property({ type: String })], MonoOtpCoreClass.prototype, "separator", void 0);
654
+ __decorate([property({
655
+ reflect: true,
656
+ converter: booleanStringConverter
657
+ })], MonoOtpCoreClass.prototype, "mask", void 0);
658
+ __decorate([property({ type: String })], MonoOtpCoreClass.prototype, "size", void 0);
659
+ __decorate([property({ type: String })], MonoOtpCoreClass.prototype, "color", void 0);
660
+ __decorate([property({ type: String })], MonoOtpCoreClass.prototype, "variant", void 0);
661
+ __decorate([property({
662
+ type: String,
663
+ attribute: "label-position"
664
+ })], MonoOtpCoreClass.prototype, "labelPosition", void 0);
665
+ __decorate([property({
666
+ type: String,
667
+ attribute: "validation-position"
668
+ })], MonoOtpCoreClass.prototype, "validationPosition", void 0);
669
+ __decorate([property({ attribute: "model-value" })], MonoOtpCoreClass.prototype, "modelValue", void 0);
670
+ __decorate([property({ type: String })], MonoOtpCoreClass.prototype, "value", void 0);
671
+ __decorate([property({ type: String })], MonoOtpCoreClass.prototype, "name", void 0);
672
+ __decorate([property({ type: String })], MonoOtpCoreClass.prototype, "placeholder", void 0);
673
+ __decorate([property({ type: String })], MonoOtpCoreClass.prototype, "label", void 0);
674
+ __decorate([property({
675
+ type: String,
676
+ attribute: "helper-text"
677
+ })], MonoOtpCoreClass.prototype, "helperText", void 0);
678
+ __decorate([property()], MonoOtpCoreClass.prototype, "tooltip", void 0);
679
+ __decorate([property({
680
+ type: String,
681
+ attribute: "validation-state"
682
+ })], MonoOtpCoreClass.prototype, "validationState", void 0);
683
+ __decorate([property({
684
+ type: String,
685
+ attribute: "validation-message"
686
+ })], MonoOtpCoreClass.prototype, "validationMessage", void 0);
687
+ __decorate([property({
688
+ reflect: true,
689
+ converter: booleanStringConverter
690
+ })], MonoOtpCoreClass.prototype, "error", void 0);
691
+ __decorate([property({
692
+ type: String,
693
+ attribute: "error-message"
694
+ })], MonoOtpCoreClass.prototype, "errorMessage", void 0);
695
+ __decorate([property({
696
+ reflect: true,
697
+ converter: booleanStringConverter
698
+ })], MonoOtpCoreClass.prototype, "success", void 0);
699
+ __decorate([property({
700
+ type: String,
701
+ attribute: "success-message"
702
+ })], MonoOtpCoreClass.prototype, "successMessage", void 0);
703
+ __decorate([property({ type: String })], MonoOtpCoreClass.prototype, "autocomplete", void 0);
704
+ __decorate([property({ type: String })], MonoOtpCoreClass.prototype, "inputmode", void 0);
705
+ __decorate([property({
706
+ type: String,
707
+ attribute: "aria-label"
708
+ })], MonoOtpCoreClass.prototype, "ariaLabelText", void 0);
709
+ __decorate([property({
710
+ reflect: true,
711
+ converter: booleanStringConverter
712
+ })], MonoOtpCoreClass.prototype, "disabled", void 0);
713
+ __decorate([property({
714
+ reflect: true,
715
+ converter: booleanStringConverter
716
+ })], MonoOtpCoreClass.prototype, "readonly", void 0);
717
+ __decorate([property({
718
+ reflect: true,
719
+ converter: booleanStringConverter
720
+ })], MonoOtpCoreClass.prototype, "required", void 0);
721
+ __decorate([property({
722
+ reflect: true,
723
+ converter: booleanStringConverter
724
+ })], MonoOtpCoreClass.prototype, "clearable", void 0);
725
+ __decorate([property({
726
+ reflect: true,
727
+ converter: booleanStringConverter
728
+ })], MonoOtpCoreClass.prototype, "autofocus", void 0);
729
+ __decorate([property({ type: String })], MonoOtpCoreClass.prototype, "width", void 0);
730
+ __decorate([property({ type: String })], MonoOtpCoreClass.prototype, "height", void 0);
731
+ __decorate([property({
732
+ type: String,
733
+ attribute: "min-width"
734
+ })], MonoOtpCoreClass.prototype, "minWidth", void 0);
735
+ __decorate([property({
736
+ type: String,
737
+ attribute: "max-width"
738
+ })], MonoOtpCoreClass.prototype, "maxWidth", void 0);
739
+ __decorate([property({
740
+ type: String,
741
+ attribute: "min-height"
742
+ })], MonoOtpCoreClass.prototype, "minHeight", void 0);
743
+ __decorate([property({
744
+ type: String,
745
+ attribute: "max-height"
746
+ })], MonoOtpCoreClass.prototype, "maxHeight", void 0);
747
+ __decorate([state()], MonoOtpCoreClass.prototype, "_code", void 0);
748
+ __decorate([state()], MonoOtpCoreClass.prototype, "_focusIndex", void 0);
749
+ __decorate([state()], MonoOtpCoreClass.prototype, "_hasPrefixSlotState", void 0);
750
+ __decorate([state()], MonoOtpCoreClass.prototype, "_hasSuffixSlotState", void 0);
751
+ __decorate([state()], MonoOtpCoreClass.prototype, "_hasLabelSlotState", void 0);
752
+ __decorate([state()], MonoOtpCoreClass.prototype, "_hasHelperSlotState", void 0);
753
+ return MonoOtpCoreClass;
754
+ };
755
+
756
+ //#endregion
757
+ //#region \0raw:C:\Users\VCT-DEV\Desktop\libs\packages\helper\src\components\otp\otp.css?raw.js
758
+ var otp_css_raw_default = "/* =========================================================================\n mono-otp — a one-time-code field: N single-character boxes that act as one\n input. Same look as mono-input (Basecoat `.input-group`, vega) applied to\n EACH box, and the same attribute contract:\n\n <mono-otp length=\"6\" groups=\"3\" size=\"sm\" color=\"success\" label=\"Code\">\n <div mono-otp mono-size=\"sm\" mono-color=\"success\">\n <label mono-label>Code</label>\n <div mono-field>\n <div mono-otp-group><input mono-otp-cell>…</div>\n <span mono-otp-separator>-</span>\n <div mono-otp-group><input mono-otp-cell>…</div>\n </div>\n <div mono-message-wrap><div mono-message=\"helper\">…</div></div>\n </div>\n\n An absent attribute is the prop's default (md / primary / outlined /\n default state). Parts:\n [mono-field] the ROW (no border — every box is its own field)\n [mono-otp-group] one run of boxes\n [mono-otp-cell] a box (a native <input>); [mono-filled] holds a char,\n [mono-active] has focus (the element sets both;\n hand-written markup gets :focus / :placeholder-shown)\n [mono-otp-separator] the text between groups\n [mono-otp-affix] prefix / suffix (=\"prefix\" | \"suffix\")\n [mono-clear] the clear button\n\n Knobs — every one falls back to the matching mono-input knob, so a theme\n flavor that restyles the input restyles the code field too:\n --mono-otp-cell-size-<size> / --mono-otp-cell-width box height / width\n --mono-otp-font-<size>, --mono-otp-font-weight character type\n --mono-otp-gap, --mono-otp-group-gap spacing\n --mono-otp-radius, --mono-otp-bg, --mono-otp-border-color, --mono-otp-shadow\n --mono-otp-ring-color, --mono-otp-ring-width, --mono-otp-ring-alpha\n --mono-otp-filled-bg, --mono-otp-separator-color, --mono-otp-placeholder\n --mono-otp-<color> (primary … dark, valid, invalid)\n --mono-otp-label-width / -label-side-gap label-position left/right\n\n Specificity contract as input.css: a part's resting rule is\n `:where([mono-otp]) [mono-part]` (0,1,0) so `cssClass` utilities win;\n state rules stay heavier.\n ========================================================================= */\n\nmono-otp {\n display: block;\n}\n\n[mono-otp] {\n /* ── palette ── */\n --_mono-otp-text: var(--mono-otp-color, var(--mono-input-color, var(--mono-input-text, var(--foreground))));\n --_mono-otp-placeholder: var(--mono-otp-placeholder, var(--mono-input-placeholder, var(--muted-foreground)));\n --_mono-otp-muted: var(--mono-otp-muted, var(--mono-input-muted, var(--muted-foreground)));\n --_mono-otp-primary: var(--mono-otp-primary, var(--mono-input-primary, var(--ring)));\n --_mono-otp-secondary: var(--mono-otp-secondary, var(--mono-input-secondary, var(--muted-foreground)));\n --_mono-otp-success: var(--mono-otp-success, var(--mono-input-success, var(--success)));\n --_mono-otp-danger: var(--mono-otp-danger, var(--mono-input-danger, var(--destructive)));\n --_mono-otp-warning: var(--mono-otp-warning, var(--mono-input-warning, var(--warning)));\n --_mono-otp-info: var(--mono-otp-info, var(--mono-input-info, var(--info)));\n --_mono-otp-teal: var(--mono-otp-teal, var(--mono-input-teal, var(--teal)));\n --_mono-otp-purple: var(--mono-otp-purple, var(--mono-input-purple, var(--purple)));\n --_mono-otp-neutral: var(--mono-otp-neutral, var(--mono-input-neutral, var(--neutral)));\n --_mono-otp-dark: var(--mono-otp-dark, var(--mono-input-dark, var(--dark)));\n --_mono-otp-valid: var(--mono-otp-valid, var(--mono-input-valid, var(--success)));\n --_mono-otp-invalid: var(--mono-otp-invalid, var(--mono-input-invalid, var(--destructive)));\n\n /* ── the painted box — public knob → variant preset → input knob → token ── */\n --_mono-otp-ring-color: var(--mono-otp-ring-color, var(--mono-otp-focus-color, var(--_mono-otp-ring-color-preset, var(--_mono-otp-primary))));\n --_mono-otp-ring-width: var(--mono-otp-ring-width, var(--_mono-otp-ring-width-preset, var(--mono-input-ring-width, var(--mono-ring-width))));\n --_mono-otp-ring-alpha: var(--mono-otp-ring-alpha, var(--mono-input-ring-alpha, var(--mono-ring-alpha)));\n --_mono-otp-border-color: var(--mono-otp-border-color, var(--_mono-otp-border-color-preset, var(--mono-input-rest-border, var(--mono-input-border-color, var(--input)))));\n --_mono-otp-bg: var(--mono-otp-bg, var(--_mono-otp-bg-preset, var(--mono-input-bg, var(--mono-input-surface, var(--mono-mode-surface)))));\n --_mono-otp-shadow: var(--mono-otp-shadow, var(--_mono-otp-shadow-preset, 0 0 #0000));\n --_mono-otp-radius: var(--mono-otp-radius, var(--_mono-otp-radius-preset, var(--mono-input-radius, var(--mono-radius-md))));\n\n /* ── md metrics on the unqualified root (hand-written markup = md) ── */\n --_mono-otp-size: var(--mono-otp-cell-size-md, var(--mono-input-height-md, var(--mono-control-height-md)));\n --_mono-otp-font-size: var(--mono-otp-font-md, var(--mono-text-base));\n --_mono-otp-clear: calc(var(--mono-spacing) * 6);\n --_mono-otp-clear-glyph: calc(var(--mono-spacing) * 3.5);\n\n display: flex;\n flex-direction: column;\n gap: var(--mono-otp-label-gap, var(--mono-input-gap, calc(var(--mono-spacing) * 3)));\n width: 100%;\n font-family: inherit;\n color: var(--_mono-otp-text);\n}\n\n[mono-otp],\n:where([mono-otp]) *,\n:where([mono-otp]) *::before,\n:where([mono-otp]) *::after {\n box-sizing: border-box;\n}\n\n/* shadow build: unassigned slot wrappers carry `mono-empty` */\n:where([mono-otp]) :is([mono-label], [mono-otp-affix], [mono-message])[mono-empty] {\n display: none;\n}\n\n/* =========================================\n Sizes — box height IS the control token\n ========================================= */\n\n[mono-otp][mono-size=\"xs\"] {\n --_mono-otp-size: var(--mono-otp-cell-size-xs, var(--mono-input-height-xs, var(--mono-control-height-xs)));\n --_mono-otp-font-size: var(--mono-otp-font-xs, var(--mono-text-xs));\n --_mono-otp-clear: calc(var(--mono-spacing) * 4);\n --_mono-otp-clear-glyph: calc(var(--mono-spacing) * 3);\n}\n[mono-otp][mono-size=\"sm\"] {\n --_mono-otp-size: var(--mono-otp-cell-size-sm, var(--mono-input-height-sm, var(--mono-control-height-sm)));\n --_mono-otp-font-size: var(--mono-otp-font-sm, var(--mono-text-sm));\n --_mono-otp-clear: calc(var(--mono-spacing) * 5);\n}\n[mono-otp][mono-size=\"lg\"] {\n --_mono-otp-size: var(--mono-otp-cell-size-lg, var(--mono-input-height-lg, var(--mono-control-height-lg)));\n --_mono-otp-font-size: var(--mono-otp-font-lg, var(--mono-text-lg));\n}\n[mono-otp][mono-size=\"xl\"] {\n --_mono-otp-size: var(--mono-otp-cell-size-xl, var(--mono-input-height-xl, var(--mono-control-height-xl)));\n --_mono-otp-font-size: var(--mono-otp-font-xl, var(--mono-text-xl));\n --_mono-otp-clear: calc(var(--mono-spacing) * 7);\n --_mono-otp-clear-glyph: calc(var(--mono-spacing) * 4);\n}\n[mono-otp][mono-size=\"xxl\"] {\n --_mono-otp-size: var(--mono-otp-cell-size-xxl, var(--mono-input-height-xxl, var(--mono-control-height-xxl)));\n --_mono-otp-font-size: var(--mono-otp-font-xxl, calc(var(--mono-text-xl) * 1.25));\n --_mono-otp-clear: calc(var(--mono-spacing) * 8);\n --_mono-otp-clear-glyph: calc(var(--mono-spacing) * 4);\n}\n\n/* =========================================\n Variants — write `*-preset` slots only (same as input.css)\n ========================================= */\n\n[mono-otp]:is(:not([mono-variant]), [mono-variant=\"outlined\"]) {\n --_mono-otp-bg-preset: var(--mono-input-outline-bg);\n --_mono-otp-border-color-preset: var(--mono-input-outline-border-color);\n --_mono-otp-side-border-color-preset: var(--mono-input-outline-side-border-color);\n --_mono-otp-shadow-preset: var(--mono-input-outline-shadow, var(--mono-shadow-xs));\n --_mono-otp-ring-width-preset: var(--mono-input-outline-ring-width);\n --_mono-otp-radius-preset: var(--mono-input-outline-radius);\n}\n\n[mono-otp][mono-variant=\"filled\"] {\n --_mono-otp-bg-preset: var(--mono-otp-filled-bg, var(--mono-input-filled-bg, color-mix(in oklab, var(--input) 50%, transparent)));\n --_mono-otp-border-color-preset: transparent;\n --_mono-otp-shadow-preset: 0 0 #0000;\n}\n\n[mono-otp][mono-variant=\"underlined\"] {\n --_mono-otp-bg-preset: transparent;\n --_mono-otp-side-border-color-preset: transparent;\n --_mono-otp-shadow-preset: 0 0 #0000;\n --_mono-otp-ring-width-preset: 0px;\n --_mono-otp-radius-preset: 0;\n}\n\n/* =========================================\n Colours — the focus colour\n ========================================= */\n\n[mono-otp]:is(:not([mono-color]), [mono-color=\"primary\"]) { --_mono-otp-ring-color-preset: var(--_mono-otp-primary); }\n[mono-otp][mono-color=\"secondary\"] { --_mono-otp-ring-color-preset: var(--_mono-otp-secondary); }\n[mono-otp][mono-color=\"success\"] { --_mono-otp-ring-color-preset: var(--_mono-otp-success); }\n[mono-otp][mono-color=\"danger\"] { --_mono-otp-ring-color-preset: var(--_mono-otp-danger); }\n[mono-otp][mono-color=\"warning\"] { --_mono-otp-ring-color-preset: var(--_mono-otp-warning); }\n[mono-otp][mono-color=\"info\"] { --_mono-otp-ring-color-preset: var(--_mono-otp-info); }\n[mono-otp][mono-color=\"teal\"] { --_mono-otp-ring-color-preset: var(--_mono-otp-teal); }\n[mono-otp][mono-color=\"purple\"] { --_mono-otp-ring-color-preset: var(--_mono-otp-purple); }\n[mono-otp][mono-color=\"neutral\"] { --_mono-otp-ring-color-preset: var(--_mono-otp-neutral); }\n[mono-otp][mono-color=\"dark\"] { --_mono-otp-ring-color-preset: var(--_mono-otp-dark); }\n\n/* =========================================\n Label (same rules as input's)\n ========================================= */\n\n:where([mono-otp]) > [mono-label] {\n display: flex;\n align-items: center;\n width: fit-content;\n gap: var(--mono-otp-label-gap, var(--mono-input-label-gap, calc(var(--mono-spacing) * 2)));\n font-size: var(--mono-otp-label-font-size, var(--mono-input-label-font-size, var(--mono-text-sm)));\n line-height: var(--mono-otp-label-line-height, var(--mono-input-label-line-height, 1));\n font-weight: var(--mono-otp-label-font-weight, var(--mono-input-label-font-weight, var(--mono-label-font-weight, var(--mono-font-weight-medium))));\n text-transform: var(--mono-otp-label-text-transform, var(--mono-input-label-text-transform, none));\n letter-spacing: var(--mono-otp-label-letter-spacing, var(--mono-input-label-letter-spacing, normal));\n color: var(--_mono-otp-text);\n user-select: none;\n}\n\n[mono-otp][mono-disabled] > [mono-label] {\n opacity: 0.5;\n pointer-events: none;\n}\n\n[mono-otp][mono-validation-state=\"invalid\"] > [mono-label] {\n color: var(--_mono-otp-invalid);\n}\n\n:where([mono-otp]) [mono-required-mark] {\n color: var(--_mono-otp-danger);\n}\n\n:where([mono-otp]) > [mono-label] > [mono-label-tooltip] {\n display: inline-flex;\n flex: none;\n align-items: center;\n justify-content: center;\n font-size: var(--mono-otp-label-tooltip-size, var(--mono-input-label-tooltip-size, 1.1em));\n color: var(--mono-otp-label-tooltip-color, var(--mono-input-label-tooltip-color, currentColor));\n opacity: var(--mono-otp-label-tooltip-opacity, var(--mono-input-label-tooltip-opacity, 0.6));\n border-radius: 9999px;\n cursor: help;\n pointer-events: auto;\n outline: none;\n transition: opacity 150ms ease;\n}\n:where([mono-otp]) > [mono-label] > [mono-label-tooltip]:is(:hover, :focus-visible) {\n opacity: 1;\n}\n:where([mono-otp]) > [mono-label] > [mono-label-tooltip]:focus-visible {\n outline: 2px solid currentColor;\n outline-offset: 2px;\n}\n:where([mono-otp]) > [mono-label] > [mono-label-tooltip] > [mono-icon] {\n width: 1em;\n height: 1em;\n}\n\n/* =========================================\n The row, groups and separators\n ========================================= */\n\n:where([mono-otp]) > [mono-field] {\n position: relative;\n display: flex;\n flex-wrap: wrap;\n align-items: center;\n gap: var(--mono-otp-group-gap, calc(var(--mono-spacing) * 2));\n min-width: 0;\n}\n\n:where([mono-otp]) [mono-otp-group] {\n display: flex;\n align-items: center;\n gap: var(--mono-otp-gap, calc(var(--mono-spacing) * 2));\n}\n\n:where([mono-otp]) [mono-otp-separator] {\n flex: none;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n font-size: var(--_mono-otp-font-size);\n line-height: 1;\n color: var(--mono-otp-separator-color, var(--_mono-otp-muted));\n user-select: none;\n}\n\n/* =========================================\n The box — input.css's [mono-field], per character\n ========================================= */\n\n:where([mono-otp]) [mono-otp-cell] {\n --_mono-otp-bc: var(--_mono-otp-border-color);\n --_mono-otp-side-bc: var(--mono-otp-side-border-color, var(--_mono-otp-side-border-color-preset, var(--_mono-otp-bc)));\n --_mono-otp-ring: 0 0 #0000;\n\n display: block;\n flex: none;\n width: var(--mono-otp-cell-width, var(--_mono-otp-size));\n height: var(--_mono-otp-size);\n min-width: 0;\n margin: 0;\n padding: 0;\n appearance: none;\n outline: none;\n border: var(--mono-border-width) solid var(--_mono-otp-bc);\n border-top-color: var(--_mono-otp-side-bc);\n border-inline-color: var(--_mono-otp-side-bc);\n border-radius: var(--_mono-otp-radius);\n background: var(--_mono-otp-bg);\n box-shadow: var(--_mono-otp-ring), var(--_mono-otp-shadow);\n color: var(--_mono-otp-text);\n caret-color: var(--_mono-otp-ring-color);\n font-family: inherit;\n font-size: var(--_mono-otp-font-size);\n font-weight: var(--mono-otp-font-weight, var(--mono-font-weight-semibold));\n font-variant-numeric: tabular-nums;\n line-height: 1;\n text-align: center;\n transition-property: color, box-shadow, border-color, background-color;\n transition-timing-function: var(--mono-ease);\n transition-duration: var(--mono-duration);\n\n &::placeholder {\n color: var(--_mono-otp-placeholder);\n font-weight: var(--mono-font-weight-normal);\n }\n\n /* The box is selected on focus so a keystroke replaces it; the ring already\n marks the active box, so the selection highlight would only be noise. */\n &::selection {\n background: transparent;\n color: inherit;\n }\n\n &:focus,\n &:focus-visible {\n outline: none !important;\n }\n\n /* focus:border-ring focus:ring-3 focus:ring-ring/50 — the box with the caret */\n &:focus,\n &[mono-active] {\n --_mono-otp-bc: var(--_mono-otp-ring-color);\n --_mono-otp-side-bc: var(--mono-otp-side-border-color, var(--_mono-otp-side-border-color-preset, var(--_mono-otp-ring-color)));\n --_mono-otp-ring: 0 0 0 var(--_mono-otp-ring-width) color-mix(in oklab, var(--_mono-otp-ring-color) var(--_mono-otp-ring-alpha), transparent);\n }\n\n &:disabled {\n cursor: not-allowed;\n }\n\n &:read-only {\n cursor: default;\n }\n}\n\n/* ── validation states (same tokens as input's box) ── */\n[mono-otp][mono-validation-state=\"invalid\"] [mono-otp-cell],\n:where([mono-otp]) [mono-otp-cell][aria-invalid=\"true\"] {\n --_mono-otp-bc: var(--mono-mode-invalid-border);\n --_mono-otp-ring: 0 0 0 var(--_mono-otp-ring-width) var(--mono-mode-invalid-ring);\n}\n[mono-otp][mono-validation-state=\"valid\"] [mono-otp-cell] {\n --_mono-otp-bc: color-mix(in oklab, var(--_mono-otp-valid) var(--mono-mode-state-border-alpha), transparent);\n --_mono-otp-ring: 0 0 0 var(--_mono-otp-ring-width) color-mix(in oklab, var(--_mono-otp-valid) var(--mono-mode-state-ring-alpha), transparent);\n}\n[mono-otp][mono-validation-state=\"warning\"] [mono-otp-cell] {\n --_mono-otp-bc: color-mix(in oklab, var(--_mono-otp-warning) var(--mono-mode-state-border-alpha), transparent);\n --_mono-otp-ring: 0 0 0 var(--_mono-otp-ring-width) color-mix(in oklab, var(--_mono-otp-warning) var(--mono-mode-state-ring-alpha), transparent);\n}\n\n/* ── readonly / disabled ── */\n[mono-otp][mono-readonly] [mono-otp-cell] {\n background: var(--mono-otp-readonly-bg, var(--mono-input-readonly-bg, var(--muted)));\n}\n\n[mono-otp][mono-disabled] > [mono-field],\n:where([mono-otp]) > [mono-field]:has([mono-otp-cell]:disabled) {\n opacity: 0.5;\n cursor: not-allowed;\n}\n[mono-otp][mono-disabled] [mono-otp-cell] {\n background: var(--mono-otp-disabled-bg, var(--mono-input-disabled-bg, var(--_mono-otp-bg)));\n}\n\n/* =========================================\n Prefix / suffix / clear\n ========================================= */\n\n:where([mono-otp]) [mono-otp-affix] {\n flex: 0 0 auto;\n display: inline-flex;\n align-items: center;\n gap: calc(var(--mono-spacing) * 2);\n font-size: var(--mono-text-sm);\n font-weight: var(--mono-font-weight-medium);\n color: var(--_mono-otp-muted);\n user-select: none;\n}\n\n:where([mono-otp]) [mono-otp-affix] > [data-mono-slot] {\n display: inline-flex;\n align-items: center;\n gap: inherit;\n}\n\n:where([mono-otp]) [mono-otp-affix] :is(svg, .mono-icon, [mono-icon]),\n:where([mono-otp]) [mono-otp-affix] ::slotted(svg),\n:where([mono-otp]) [mono-otp-affix] ::slotted(.mono-icon),\n:where([mono-otp]) [mono-otp-affix] ::slotted([mono-icon]) {\n display: block;\n width: var(--mono-input-affix-icon-size, calc(var(--mono-spacing) * 4));\n height: var(--mono-input-affix-icon-size, calc(var(--mono-spacing) * 4));\n flex-shrink: 0;\n pointer-events: none;\n}\n\n:where([mono-otp]) [mono-clear] {\n flex: 0 0 auto;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: var(--_mono-otp-clear);\n height: var(--_mono-otp-clear);\n padding: 0;\n margin: 0;\n border: 0;\n border-radius: var(--mono-otp-clear-radius, var(--mono-input-clear-radius, calc(var(--radius) - 5px)));\n background: transparent;\n box-shadow: none;\n color: var(--_mono-otp-muted);\n font: inherit;\n line-height: 1;\n cursor: pointer;\n outline-style: none;\n transition-property: color, background-color, box-shadow;\n transition-timing-function: var(--mono-ease);\n transition-duration: var(--mono-duration);\n\n &:focus-visible {\n box-shadow: 0 0 0 var(--_mono-otp-ring-width) color-mix(in oklab, var(--_mono-otp-ring-color) var(--_mono-otp-ring-alpha), transparent);\n }\n}\n\n@media (hover: hover) {\n :where([mono-otp]) [mono-clear]:hover {\n background: var(--mono-mode-ghost-hover);\n color: var(--_mono-otp-text);\n }\n}\n\n:where([mono-otp]) [mono-clear] > :is(svg, .mono-icon, [mono-icon]) {\n display: block;\n width: var(--_mono-otp-clear-glyph);\n height: var(--_mono-otp-clear-glyph);\n pointer-events: none;\n}\n\n/* =========================================\n Message\n ========================================= */\n\n:where([mono-otp]) > [mono-message-wrap] {\n display: block;\n}\n:where([mono-otp]) > [mono-message-wrap]:not(:has([mono-message]:not([mono-empty]))) {\n display: none;\n}\n\n:where([mono-otp]) [mono-message] {\n font-size: var(--mono-otp-message-font-size, var(--mono-input-message-font-size, var(--mono-text-sm)));\n line-height: var(--mono-otp-message-line-height, var(--mono-input-message-line-height, var(--mono-leading-normal)));\n font-weight: var(--mono-font-weight-normal);\n text-align: start;\n color: var(--_mono-otp-muted);\n}\n:where([mono-otp]) [mono-message=\"invalid\"] { color: var(--_mono-otp-invalid); }\n:where([mono-otp]) [mono-message=\"valid\"] { color: var(--_mono-otp-valid); }\n:where([mono-otp]) [mono-message=\"warning\"] { color: var(--_mono-otp-warning); }\n\n/* hidden form value */\n:where([mono-otp]) [mono-otp-hidden] {\n display: none;\n}\n\n@media (prefers-reduced-motion: reduce) {\n :where([mono-otp]) :is([mono-otp-cell], [mono-clear]) {\n transition: none;\n }\n}\n\n/* =========================================\n label-position — left / right (form/label-position.css).\n `notched` renders as top: there is no single box to notch.\n ========================================= */\n\n[mono-otp][mono-label-position] {\n --_mono-lp-width: var(--mono-otp-label-width, var(--mono-input-label-width, auto));\n --_mono-lp-gap: var(--mono-otp-label-side-gap, var(--mono-input-label-side-gap, calc(var(--mono-spacing) * 3)));\n --_mono-lp-height: var(--_mono-otp-size);\n --_mono-lp-box-min: var(--_mono-otp-size);\n --_mono-lp-padding-x: 0px;\n --_mono-lp-padding-y: 0px;\n --_mono-lp-font: var(--mono-text-xs);\n --_mono-lp-notch-bg: var(--background);\n --_mono-lp-field-bg: var(--_mono-otp-bg);\n}\n";
759
+
760
+ //#endregion
761
+ //#region src/components/otp/mono-otp.shadow.ts
762
+ let MonoOtpShadow = class MonoOtpShadow extends withShadowUtilityStyles(MonoOtpCore(LitElement)) {
763
+ static {
764
+ this.disableWarning?.("change-in-update");
765
+ }
766
+ static {
767
+ this.styles = [unsafeCSS(toShadowCss(otp_css_raw_default + label_position_css_raw_default + field_tooltip_css_raw_default + field_validation_css_raw_default, { host: "mono-otp" }))];
768
+ }
769
+ connectedCallback() {
770
+ super.connectedCallback();
771
+ if (isServer) return;
772
+ flushSsrHydration(this);
773
+ }
774
+ firstUpdated(changed) {
775
+ super.firstUpdated(changed);
776
+ for (const name of [
777
+ "prefix",
778
+ "suffix",
779
+ "label",
780
+ "helper"
781
+ ]) {
782
+ const slot = this.renderRoot.querySelector(`slot[name="${name}"]`);
783
+ this._setSlotState(name, this._slotHasContent(slot));
784
+ }
785
+ }
786
+ _slotHasContent(slot) {
787
+ return !!slot && slot.assignedNodes({ flatten: true }).some((n) => n.nodeType === Node.ELEMENT_NODE || !!(n.textContent ?? "").trim());
788
+ }
789
+ _setSlotState(name, has) {
790
+ if (name === "prefix" && this._hasPrefixSlotState !== has) this._hasPrefixSlotState = has;
791
+ else if (name === "suffix" && this._hasSuffixSlotState !== has) this._hasSuffixSlotState = has;
792
+ else if (name === "label" && this._hasLabelSlotState !== has) this._hasLabelSlotState = has;
793
+ else if (name === "helper" && this._hasHelperSlotState !== has) this._hasHelperSlotState = has;
794
+ }
795
+ _onSlotChange(name, event) {
796
+ this._setSlotState(name, this._slotHasContent(event.target));
797
+ }
798
+ _renderLabelText() {
799
+ return html`<slot name="label" @slotchange=${(e) => this._onSlotChange("label", e)}>${this.label}</slot>`;
800
+ }
801
+ /** Always rendered (the slot must exist to be scanned); hidden with `mono-empty` when empty. */
802
+ _renderLabel() {
803
+ return html`
804
+ <label
805
+ class=${this._cls("mono-otp-label", "label")}
806
+ mono-label
807
+ id=${`${this._otpId}-label`}
808
+ for=${`${this._otpId}-0`}
809
+ ?mono-empty=${!this.label && !this._hasLabelSlotState}
810
+ >
811
+ ${this._renderLabelText()}
812
+ ${this.required ? html`<span class=${this._cls("mono-otp-required", "required")} mono-required-mark>*</span>` : nothing}
813
+ ${this._tooltip.render()}
814
+ </label>
815
+ `;
816
+ }
817
+ _renderHelperText(base) {
818
+ return html`
819
+ <div class=${`${base} helper`} mono-message="helper" ?mono-empty=${!this.helperText && !this._hasHelperSlotState}>
820
+ <slot name="helper" @slotchange=${(e) => this._onSlotChange("helper", e)}>${this.helperText}</slot>
821
+ </div>
822
+ `;
823
+ }
824
+ _renderAffix(name) {
825
+ const has = name === "prefix" ? this._hasPrefixSlotState : this._hasSuffixSlotState;
826
+ return html`<span class=${this._cls(`mono-otp-${name}`, name)} mono-otp-affix=${name} ?mono-empty=${!has}>
827
+ <slot name=${name} @slotchange=${(e) => this._onSlotChange(name, e)}></slot>
828
+ </span>`;
829
+ }
830
+ renderIcon(_name) {
831
+ return html`
832
+ <svg viewBox="0 0 24 24" mono-icon fill="currentColor" aria-hidden="true">
833
+ <path d="M19,6.41L17.59,5L12,10.59L6.41,5L5,6.41L10.59,12L5,17.59L6.41,19L12,13.41L17.59,19L19,17.59L13.41,12L19,6.41Z" />
834
+ </svg>
835
+ `;
836
+ }
837
+ };
838
+ MonoOtpShadow = __decorate([customElement("mono-shadow-otp")], MonoOtpShadow);
839
+
840
+ //#endregion
841
+ export { MonoOtpCore, MonoOtpShadow, OTP_DEFAULT_LENGTH, backspaceOtp, clampCaret, normaliseOtpValue, parseOtpGroups, removeOtpChar, resolveOtpLength, sanitizeOtpChar, sanitizeOtpText, spliceOtpValue };