@mono-lit/helper 0.0.8 → 0.0.10

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 (161) hide show
  1. package/dist/accordion-core-DaNyPWRr.js +277 -0
  2. package/dist/alert-core-DWtHbX_-.js +134 -0
  3. package/dist/breadcrumb-list-core-Dh68T8Cf.js +747 -0
  4. package/dist/{mono-button-CLkHg3WW.js → button-core-DerXg84Q.js} +3 -276
  5. package/dist/button-dropdown-core-DKYEOyjy.js +654 -0
  6. package/dist/button-utils-D5-66M02.js +63 -0
  7. package/dist/card-utils-l80qAmrN.js +312 -0
  8. package/dist/chart-core-DV7hD3ZY.js +801 -0
  9. package/dist/checkbox-utils-DKdrhAzF.js +337 -0
  10. package/dist/chip-utils-DpRrd7Zj.js +403 -0
  11. package/dist/{data-source-controller-C6C4ej_M.js → data-source-controller-DS_JLrmS.js} +1 -1
  12. package/dist/{data-source-options-fxT5QIX4.js → data-source-options-DJUNU26C.js} +6 -6
  13. package/dist/{data-source-read-BL266IW0.js → data-source-read-uKJpRAzx.js} +2 -2
  14. package/dist/date-core-CyuSyvvG.js +734 -0
  15. package/dist/drawer-core-DbFWvNln.js +759 -0
  16. package/dist/dropdown-core-BCH1pK14.js +511 -0
  17. package/dist/dropdown-table-core-SfHUJVFq.js +1342 -0
  18. package/dist/export.js +1 -1
  19. package/dist/{field-path-BabiMrrA.js → field-path-DK2VBWHl.js} +1 -1
  20. package/dist/field-tooltip.css_raw-DVblekCl.js +5 -0
  21. package/dist/{field-validation.css_raw-Cx6SGrfP.js → field-validation.css_raw-BU7C6173.js} +1 -170
  22. package/dist/file-upload-core-Cz_dBQMx.js +624 -0
  23. package/dist/filter-builder-core-DyWjbBP7.js +381 -0
  24. package/dist/{filter-builder-B6Y2mmbM.js → filter-builder-vbqIuPhX.js} +1 -1
  25. package/dist/{filter-eval-ChDSaAUH.js → filter-eval-CqeBnMYh.js} +1 -1
  26. package/dist/{filter-odata-Bi27XUpQ.js → filter-odata-GsczYKNC.js} +1 -1
  27. package/dist/{hydration-flush-BaE9gN3C.js → hydration-flush-Volt9X7Q.js} +2 -1071
  28. package/dist/index.js +11 -11
  29. package/dist/{index.node-CLqE8F8P.js → index.node-Csy9zrr1.js} +4 -4
  30. package/dist/index.node.js +11 -11
  31. package/dist/input-utils-BglY-k0H.js +1145 -0
  32. package/dist/menu-core-DkAYuCZ2.js +831 -0
  33. package/dist/modal-core-CSBSPN_m.js +844 -0
  34. package/dist/mono-button-DVvZ03P-.js +280 -0
  35. package/dist/{mono-button.shadow-DqZMpcqY.js → mono-button.shadow-BANxMGln.js} +6 -594
  36. package/dist/{mono-data-chart-NKPdAgVq.js → mono-data-chart-ChF4J9RT.js} +6 -6
  37. package/dist/{mono-data-dropdown-DUXo_jxd.js → mono-data-dropdown-Bgj2PDfm.js} +1 -1
  38. package/dist/{mono-data-grid-Bb00QM72.js → mono-data-grid-DJkp96N-.js} +346 -51
  39. package/dist/{mono-event-BPku9HpS.js → mono-event-CAZf0F_k.js} +14 -9
  40. package/dist/{mono-form-controller-BrA10erm.js → mono-form-controller-DxZLvyg6.js} +2 -1
  41. package/dist/mono-table-checkbox-core-BKOMx8R5.js +5288 -0
  42. package/dist/nav-core-B5qU2dzn.js +225 -0
  43. package/dist/{normalize-error-D93O4q8g.js → normalize-error-BEcd1tmS.js} +2 -2
  44. package/dist/otp-core-DXg3vFLh.js +758 -0
  45. package/dist/radio-utils-Dk9Tl1jz.js +319 -0
  46. package/dist/rich-text-editor-core-Ddd_QaLn.js +1280 -0
  47. package/dist/select-utils-BgArYHk8.js +2140 -0
  48. package/dist/sidebar-core-CD6txDo3.js +583 -0
  49. package/dist/slider-core-vcWr321-.js +1014 -0
  50. package/dist/src/components/dropdown-table/dropdown-table-core.d.ts +2 -2
  51. package/dist/src/components/dropdown-table/dropdown-table-types.d.ts +1 -1
  52. package/dist/src/components/dropdown-table/index.d.ts +1 -1
  53. package/dist/src/components/dropdown-table/index.shadow.d.ts +1 -1
  54. package/dist/src/components/dropdown-table/mono-data-dropdown.d.ts +1 -1
  55. package/dist/src/components/form/form-types.d.ts +9 -3
  56. package/dist/src/components/input/input-core.d.ts +1 -1
  57. package/dist/src/components/input/input-types.d.ts +1 -1
  58. package/dist/src/components/otp/otp-core.d.ts +1 -1
  59. package/dist/src/components/select/select-core.d.ts +1 -1
  60. package/dist/src/components/select/select-types.d.ts +1 -1
  61. package/dist/src/components/slider/slider-core.d.ts +1 -1
  62. package/dist/src/components/slider/slider-types.d.ts +1 -1
  63. package/dist/src/components/table/filter-suggestion.d.ts +171 -0
  64. package/dist/src/components/table/index.d.ts +5 -4
  65. package/dist/src/components/table/index.shadow.d.ts +5 -4
  66. package/dist/src/components/table/mono-data-grid.d.ts +58 -3
  67. package/dist/src/components/table/mono-table-empty-core.d.ts +37 -0
  68. package/dist/src/components/table/mono-table-search-core.d.ts +22 -3
  69. package/dist/src/components/table/table-types.d.ts +74 -4
  70. package/dist/src/components/tag-input/tag-input-core.d.ts +1 -1
  71. package/dist/src/components/tag-input/tag-input-types.d.ts +1 -1
  72. package/dist/src/components/textarea/textarea-core.d.ts +1 -1
  73. package/dist/src/composables/mono-event.d.ts +7 -1
  74. package/dist/src/entries/index.d.ts +8 -6
  75. package/dist/src/entries/index.node.d.ts +8 -6
  76. package/dist/src/search/index.d.ts +1 -1
  77. package/dist/src/utils/group-count.d.ts +36 -0
  78. package/dist/switch-utils-CTZ4id2V.js +338 -0
  79. package/dist/tabs-core-r5-B8k_N.js +317 -0
  80. package/dist/tag-input-utils-D2JA90DQ.js +3060 -0
  81. package/dist/textarea-utils-VU1KeXm8.js +821 -0
  82. package/dist/ui/accordion.js +2 -274
  83. package/dist/ui/alert.js +2 -131
  84. package/dist/ui/breadcrumb.js +4 -745
  85. package/dist/ui/button-dropdown.js +4 -652
  86. package/dist/ui/button.js +2 -63
  87. package/dist/ui/card.js +2 -310
  88. package/dist/ui/chart.js +4 -800
  89. package/dist/ui/checkbox.js +4 -335
  90. package/dist/ui/chip.js +4 -402
  91. package/dist/ui/date.js +3 -732
  92. package/dist/ui/drawer.js +3 -757
  93. package/dist/ui/dropdown-table.js +5 -1341
  94. package/dist/ui/dropdown.js +4 -509
  95. package/dist/ui/file-upload.js +3 -622
  96. package/dist/ui/filter.js +5 -380
  97. package/dist/ui/form.js +1 -1
  98. package/dist/ui/index.css +130 -5
  99. package/dist/ui/input.js +3 -1141
  100. package/dist/ui/menu.js +4 -828
  101. package/dist/ui/modal.js +4 -843
  102. package/dist/ui/nav.js +4 -223
  103. package/dist/ui/otp.js +4 -756
  104. package/dist/ui/radio.js +4 -317
  105. package/dist/ui/rich-text-editor.js +4 -1278
  106. package/dist/ui/select.js +5 -2138
  107. package/dist/ui/shadow/accordion.js +4 -273
  108. package/dist/ui/shadow/alert.js +4 -130
  109. package/dist/ui/shadow/breadcrumb.js +5 -744
  110. package/dist/ui/shadow/button-dropdown.js +6 -652
  111. package/dist/ui/shadow/button.js +3 -63
  112. package/dist/ui/shadow/card.js +4 -309
  113. package/dist/ui/shadow/chart.js +6 -1576
  114. package/dist/ui/shadow/checkbox.js +4 -334
  115. package/dist/ui/shadow/chip.js +4 -396
  116. package/dist/ui/shadow/date.js +7 -731
  117. package/dist/ui/shadow/drawer.js +4 -756
  118. package/dist/ui/shadow/dropdown-table.js +8 -1762
  119. package/dist/ui/shadow/dropdown.js +4 -508
  120. package/dist/ui/shadow/file-upload.js +4 -620
  121. package/dist/ui/shadow/filter.js +7 -379
  122. package/dist/ui/shadow/input.js +6 -1140
  123. package/dist/ui/shadow/menu.js +5 -828
  124. package/dist/ui/shadow/modal.js +6 -1063
  125. package/dist/ui/shadow/nav.js +5 -223
  126. package/dist/ui/shadow/otp.js +6 -754
  127. package/dist/ui/shadow/radio.js +4 -316
  128. package/dist/ui/shadow/rich-text-editor.js +4 -1276
  129. package/dist/ui/shadow/select.js +6 -2136
  130. package/dist/ui/shadow/sidebar.js +5 -581
  131. package/dist/ui/shadow/slider.js +5 -1010
  132. package/dist/ui/shadow/switch.js +4 -335
  133. package/dist/ui/shadow/table.js +10 -4501
  134. package/dist/ui/shadow/tabs.js +6 -315
  135. package/dist/ui/shadow/tag-input.js +7 -3057
  136. package/dist/ui/shadow/textarea.js +6 -817
  137. package/dist/ui/sidebar.js +3 -581
  138. package/dist/ui/slider.js +4 -1012
  139. package/dist/ui/switch.js +4 -336
  140. package/dist/ui/table.js +9 -4502
  141. package/dist/ui/tabs.js +4 -315
  142. package/dist/ui/tag-input.js +5 -3058
  143. package/dist/ui/textarea.js +4 -819
  144. package/dist/vue.d.ts +3 -2
  145. package/package.json +3 -3
  146. package/dist/chip-strip-bNfLn52Z.js +0 -215
  147. package/dist/data-source-controller-Dx6IQ2CN.js +0 -243
  148. package/dist/data-source-options-BM4r4PRw.js +0 -558
  149. package/dist/data-source-read-HyBCRg1t.js +0 -242
  150. package/dist/excel-BXzr3uI1.js +0 -784
  151. package/dist/export-ixRdCS2y.js +0 -2388
  152. package/dist/field-tooltip-addon-CWCp19mJ.js +0 -702
  153. package/dist/field-tooltip.css_raw-U5UeTa2d.js +0 -269
  154. package/dist/filter-builder-C0T3pMx2.js +0 -208
  155. package/dist/form-control-core-BbiACMtL.js +0 -226
  156. package/dist/icon-ClxnYhBG.js +0 -19
  157. package/dist/import-Dc4eXC02.js +0 -612
  158. package/dist/light-slots-_no0r2Z-.js +0 -246
  159. package/dist/markdown-uGlE_OfJ.js +0 -20191
  160. package/dist/mono-data-grid-Bkr-e1-i.js +0 -4043
  161. package/dist/normalize-error-BmLbgANw.js +0 -1048
@@ -0,0 +1,338 @@
1
+ import { a as defineHybridPropAliases, i as defineHybridPropAlias, r as booleanStringConverter, t as __decorate } from "./decorate-DbYFpi8R.js";
2
+ import { t as dispatchMonoEvent } from "./mono-event-CAZf0F_k.js";
3
+ import { t as MonoFormControlCore } from "./form-control-core-CRZPZ1ru.js";
4
+ import { html, nothing } from "lit";
5
+ import { property, state } from "lit/decorators.js";
6
+ import { ifDefined } from "lit/directives/if-defined.js";
7
+
8
+ //#region src/components/switch/switch-core.ts
9
+ /**
10
+ * `MonoSwitchCore` — all render-mode-agnostic logic for `mono-switch`: reactive
11
+ * props (incl. SSR boolean coercion), hybrid aliases, camelCase attribute
12
+ * fallbacks, the `modelValue`↔`checked` sync, class computation, change
13
+ * interactivity (`mno-change`), `focus`/`blur`, AND the shared `render()`
14
+ * skeleton (`<label><input role=switch><track><thumb></track><labelBlock></label>`).
15
+ * The slot-bearing label/description region is an overridable hook
16
+ * (`_renderLabelBlock()`) that defaults to the light build's `[data-mono-slot]`
17
+ * placeholders; the shadow build overrides it with native `<slot>` (mirrors
18
+ * `mono-checkbox`). SSR-safe: no `document`/`window`; `focus`/`blur` query
19
+ * `this.renderRoot`.
20
+ */
21
+ const MonoSwitchCore = (superClass) => {
22
+ class MonoSwitchCoreClass extends MonoFormControlCore(superClass) {
23
+ constructor(...args) {
24
+ super(...args);
25
+ this.size = "md";
26
+ this.color = "primary";
27
+ this.modelValue = false;
28
+ this.checked = false;
29
+ this.disabled = false;
30
+ this.loading = false;
31
+ this.label = "";
32
+ this.sublabel = "";
33
+ this.value = "";
34
+ this.name = "";
35
+ this.cssClass = {};
36
+ this.cssClassName = "";
37
+ this._hasLabelSlotState = false;
38
+ this._hasDescriptionSlotState = false;
39
+ defineHybridPropAliases(this, [
40
+ "modelValue",
41
+ "ariaLabelText",
42
+ "cssClass"
43
+ ]);
44
+ defineHybridPropAlias(this, "description", "sublabel");
45
+ Object.defineProperty(this, "css-class", {
46
+ get: () => this.cssClass,
47
+ set: (value) => this._setCssClass(value),
48
+ configurable: true,
49
+ enumerable: false
50
+ });
51
+ Object.defineProperty(this, "cssclass", {
52
+ get: () => this.cssClass,
53
+ set: (value) => this._setCssClass(value),
54
+ configurable: true,
55
+ enumerable: false
56
+ });
57
+ for (const alias of [
58
+ "ariaLabel",
59
+ "aria-label",
60
+ "arialabel"
61
+ ]) Object.defineProperty(this, alias, {
62
+ get: () => this.ariaLabelText,
63
+ set: (value) => {
64
+ this.ariaLabelText = value == null ? void 0 : String(value);
65
+ },
66
+ configurable: true,
67
+ enumerable: false
68
+ });
69
+ }
70
+ static get observedAttributes() {
71
+ return [
72
+ ...super.observedAttributes ?? [],
73
+ "modelvalue",
74
+ "arialabeltext",
75
+ "arialabel",
76
+ "description",
77
+ "css-class",
78
+ "cssclass"
79
+ ];
80
+ }
81
+ attributeChangedCallback(name, oldValue, newValue) {
82
+ super.attributeChangedCallback(name, oldValue, newValue);
83
+ if (oldValue === newValue) return;
84
+ if (name === "modelvalue") {
85
+ this.modelValue = this._toBoolean(newValue);
86
+ return;
87
+ }
88
+ if (name === "arialabeltext" || name === "arialabel") {
89
+ this.ariaLabelText = newValue ?? void 0;
90
+ return;
91
+ }
92
+ if (name === "description") {
93
+ this.sublabel = newValue ?? "";
94
+ return;
95
+ }
96
+ if (name === "css-class" || name === "cssclass") this._setCssClass(newValue);
97
+ }
98
+ willUpdate(changed) {
99
+ for (const key of [
100
+ "modelValue",
101
+ "checked",
102
+ "disabled",
103
+ "loading"
104
+ ]) if (typeof this[key] === "string") this[key] = this._toBoolean(this[key]);
105
+ if (changed.has("modelValue") && this.checked !== this.modelValue) this.checked = this.modelValue;
106
+ if (changed.has("checked") && this.modelValue !== this.checked) this.modelValue = this.checked;
107
+ super.willUpdate?.(changed);
108
+ }
109
+ _toBoolean(value) {
110
+ if (typeof value === "boolean") return value;
111
+ if (typeof value === "string") {
112
+ const normalized = value.toLowerCase().trim();
113
+ return normalized === "" || normalized === "true";
114
+ }
115
+ return Boolean(value);
116
+ }
117
+ _setCssClass(value) {
118
+ if (value == null) {
119
+ this.cssClass = {};
120
+ this.cssClassName = "";
121
+ return;
122
+ }
123
+ if (typeof value === "object") {
124
+ this.cssClass = value;
125
+ return;
126
+ }
127
+ if (typeof value === "string") {
128
+ const trimmed = value.trim();
129
+ if (!trimmed) {
130
+ this.cssClass = {};
131
+ this.cssClassName = "";
132
+ return;
133
+ }
134
+ if (trimmed.startsWith("{") && trimmed.endsWith("}")) try {
135
+ this.cssClass = JSON.parse(trimmed);
136
+ return;
137
+ } catch {}
138
+ this.cssClassName = trimmed;
139
+ }
140
+ }
141
+ _cls(base, key) {
142
+ const extra = this.cssClass?.[key];
143
+ return extra ? `${base} ${extra}` : base;
144
+ }
145
+ get _wrapperClasses() {
146
+ return [
147
+ "mono-switch",
148
+ this.size,
149
+ this.color,
150
+ this.disabled ? "disabled" : "",
151
+ this.loading ? "loading" : "",
152
+ this.checked ? "mono-switch-checked" : "",
153
+ this.cssClassName,
154
+ this.cssClass?.root
155
+ ].filter(Boolean).join(" ");
156
+ }
157
+ get _inputClasses() {
158
+ return this._cls("mono-switch-input", "input");
159
+ }
160
+ get _trackClasses() {
161
+ return [this._cls("mono-switch-track", "track"), this.size].filter(Boolean).join(" ");
162
+ }
163
+ get _thumbClasses() {
164
+ return [this._cls("mono-switch-thumb", "thumb"), this.size].filter(Boolean).join(" ");
165
+ }
166
+ _hasLabelContent() {
167
+ return Boolean(this.label) || this._hasLabelSlotState;
168
+ }
169
+ _hasDescriptionContent() {
170
+ return Boolean(this.sublabel) || this._hasDescriptionSlotState;
171
+ }
172
+ _createModelDetail(args) {
173
+ return {
174
+ modelValue: args.modelValue,
175
+ currentValue: args.modelValue,
176
+ oldValue: args.oldValue,
177
+ checked: args.modelValue,
178
+ value: this.value,
179
+ name: this.name,
180
+ sourceEvent: args.sourceEvent
181
+ };
182
+ }
183
+ _emitChange(detail) {
184
+ dispatchMonoEvent(this, "change", detail);
185
+ }
186
+ _handleChange(event) {
187
+ if (this.disabled || this.loading) return;
188
+ const input = event.currentTarget;
189
+ const oldValue = this.modelValue;
190
+ const nextValue = input.checked;
191
+ this.checked = nextValue;
192
+ this.modelValue = nextValue;
193
+ const detail = this._createModelDetail({
194
+ modelValue: nextValue,
195
+ oldValue,
196
+ sourceEvent: event
197
+ });
198
+ this._emitChange(detail);
199
+ }
200
+ /** Light-DOM label block (data-mono-slot). Shadow build overrides with `<slot>`. */
201
+ _renderLabelBlock() {
202
+ if (!this._hasLabelContent() && !this._hasDescriptionContent()) return nothing;
203
+ return html`
204
+ <span class=${this._cls("mono-switch-label", "label")} mono-label>
205
+ ${this._hasLabelContent() ? html`
206
+ <span class=${this._cls("mono-switch-label-text", "labelText")} mono-label-text>
207
+ ${this._hasLabelSlotState ? html`<span data-mono-slot="label"></span>` : this.label}
208
+ </span>
209
+ ` : nothing}
210
+
211
+ ${this._hasDescriptionContent() ? html`
212
+ <span class=${this._cls("mono-switch-label-description", "description")} mono-description>
213
+ ${this._hasDescriptionSlotState ? html`<span data-mono-slot="description"></span>` : this.sublabel}
214
+ </span>
215
+ ` : nothing}
216
+ </span>
217
+ `;
218
+ }
219
+ render() {
220
+ const ariaLabel = this.ariaLabelText || this.label || (this._hasLabelSlotState ? "Switch" : void 0);
221
+ return html`
222
+ <label
223
+ class=${this._wrapperClasses}
224
+ mono-switch
225
+ mono-size=${this.size === "md" ? nothing : this.size}
226
+ mono-color=${this.color === "primary" ? nothing : this.color}
227
+ ?mono-checked=${this.checked}
228
+ ?mono-disabled=${this.disabled}
229
+ ?mono-loading=${this.loading}
230
+ >
231
+ <input
232
+ class=${this._inputClasses}
233
+ mono-input
234
+ type="checkbox"
235
+ role="switch"
236
+ .checked=${this.checked}
237
+ .value=${this.value}
238
+ name=${ifDefined(this.name || void 0)}
239
+ ?disabled=${this.disabled || this.loading}
240
+ aria-checked=${String(this.checked)}
241
+ aria-label=${ifDefined(ariaLabel)}
242
+ @change=${this._handleChange}
243
+ />
244
+
245
+ <span class=${this._trackClasses} mono-track aria-hidden="true">
246
+ <span class=${this._thumbClasses} mono-thumb></span>
247
+ </span>
248
+
249
+ ${this._renderLabelBlock()}
250
+ </label>
251
+ `;
252
+ }
253
+ focus(options) {
254
+ this.renderRoot.querySelector(".mono-switch-input")?.focus(options);
255
+ }
256
+ blur() {
257
+ this.renderRoot.querySelector(".mono-switch-input")?.blur();
258
+ }
259
+ }
260
+ __decorate([property({ type: String })], MonoSwitchCoreClass.prototype, "size", void 0);
261
+ __decorate([property({ type: String })], MonoSwitchCoreClass.prototype, "color", void 0);
262
+ __decorate([property({
263
+ attribute: "model-value",
264
+ reflect: true,
265
+ converter: booleanStringConverter
266
+ })], MonoSwitchCoreClass.prototype, "modelValue", void 0);
267
+ __decorate([property({
268
+ reflect: true,
269
+ converter: booleanStringConverter
270
+ })], MonoSwitchCoreClass.prototype, "checked", void 0);
271
+ __decorate([property({
272
+ reflect: true,
273
+ converter: booleanStringConverter
274
+ })], MonoSwitchCoreClass.prototype, "disabled", void 0);
275
+ __decorate([property({
276
+ reflect: true,
277
+ converter: booleanStringConverter
278
+ })], MonoSwitchCoreClass.prototype, "loading", void 0);
279
+ __decorate([property({ type: String })], MonoSwitchCoreClass.prototype, "label", void 0);
280
+ __decorate([property({ type: String })], MonoSwitchCoreClass.prototype, "sublabel", void 0);
281
+ __decorate([property({ type: String })], MonoSwitchCoreClass.prototype, "value", void 0);
282
+ __decorate([property({ type: String })], MonoSwitchCoreClass.prototype, "name", void 0);
283
+ __decorate([property({
284
+ type: String,
285
+ attribute: "aria-label"
286
+ })], MonoSwitchCoreClass.prototype, "ariaLabelText", void 0);
287
+ __decorate([property({ attribute: false })], MonoSwitchCoreClass.prototype, "cssClass", void 0);
288
+ __decorate([property({ attribute: false })], MonoSwitchCoreClass.prototype, "cssClassName", void 0);
289
+ __decorate([state()], MonoSwitchCoreClass.prototype, "_hasLabelSlotState", void 0);
290
+ __decorate([state()], MonoSwitchCoreClass.prototype, "_hasDescriptionSlotState", void 0);
291
+ return MonoSwitchCoreClass;
292
+ };
293
+
294
+ //#endregion
295
+ //#region src/components/switch/switch-utils.ts
296
+ /**
297
+ * Validate switch props
298
+ */
299
+ function validateSwitchProps(props) {
300
+ const validSizes = [
301
+ "xs",
302
+ "sm",
303
+ "md",
304
+ "lg",
305
+ "xl",
306
+ "xxl"
307
+ ];
308
+ const validColors = [
309
+ "primary",
310
+ "secondary",
311
+ "success",
312
+ "danger",
313
+ "warning",
314
+ "info",
315
+ "teal",
316
+ "purple",
317
+ "neutral",
318
+ "dark"
319
+ ];
320
+ if (props.size && !validSizes.includes(props.size)) return false;
321
+ if (props.color && !validColors.includes(props.color)) return false;
322
+ return true;
323
+ }
324
+ /**
325
+ * Generate ARIA attributes for accessibility
326
+ */
327
+ function generateSwitchAttributes(disabled, loading, checked, label) {
328
+ return {
329
+ "aria-disabled": disabled || loading ? "true" : void 0,
330
+ "aria-busy": loading ? "true" : void 0,
331
+ "aria-checked": String(checked),
332
+ "role": "switch",
333
+ "aria-label": label || void 0
334
+ };
335
+ }
336
+
337
+ //#endregion
338
+ export { validateSwitchProps as n, MonoSwitchCore as r, generateSwitchAttributes as t };
@@ -0,0 +1,317 @@
1
+ import { a as defineHybridPropAliases, n as arrayHasChanged, r as booleanStringConverter, t as __decorate } from "./decorate-DbYFpi8R.js";
2
+ import { t as dispatchMonoEvent } from "./mono-event-CAZf0F_k.js";
3
+ import { html, nothing } from "lit";
4
+ import { ref } from "lit/directives/ref.js";
5
+ import { property } from "lit/decorators.js";
6
+
7
+ //#region src/components/tabs/tabs-core.ts
8
+ /**
9
+ * Coerce any `items` input to a `TabItem[]`. Accepts an array (pass-through), a
10
+ * JSON string (`items='[...]'` attribute, OR a string assigned to the PROPERTY —
11
+ * which is what nuxt-ssr-lit does forwarding a Vue `:items="<json>"` binding to
12
+ * the SSR renderer), or anything else (→ `[]`).
13
+ */
14
+ function coerceTabItems(value) {
15
+ if (Array.isArray(value)) return value;
16
+ if (typeof value === "string") {
17
+ if (!value) return [];
18
+ try {
19
+ const parsed = JSON.parse(value);
20
+ return Array.isArray(parsed) ? parsed : [];
21
+ } catch {
22
+ return [];
23
+ }
24
+ }
25
+ return [];
26
+ }
27
+ /**
28
+ * `MonoTabsCore` — all render-mode-agnostic logic for `mono-tabs`: reactive props
29
+ * (incl. the SSR `items` string→array coercion and `disabled` string→bool
30
+ * coercion), hybrid aliases, camelCase attribute fallbacks, the `modelValue`↔
31
+ * `value` sync, class computation, tab selection + `mno-click` events, keyboard
32
+ * navigation, and the `role="tablist"` `render()`. Per-tab icons render through a
33
+ * `_renderIcon()` hook: the light build uses `data-mono-slot` placeholders, the
34
+ * shadow build native `<slot name="icon-<id>">` (mirrors `mono-breadcrumb`).
35
+ *
36
+ * SSR-safe: no `document`/`window` access; `focus`/`blur` query `this.renderRoot`
37
+ * (the host in light, the shadow root in shadow) and only matter client-side.
38
+ */
39
+ const MonoTabsCore = (superClass) => {
40
+ class MonoTabsCoreClass extends superClass {
41
+ constructor(...args) {
42
+ super(...args);
43
+ this.items = [];
44
+ this.modelValue = "";
45
+ this.value = "";
46
+ this.size = "md";
47
+ this.color = "primary";
48
+ this.variant = "underline";
49
+ this.orientation = "horizontal";
50
+ this.disabled = false;
51
+ this.cssClass = {};
52
+ this.cssClassName = "";
53
+ this._rootEl = null;
54
+ this.bindRoot = (el) => {
55
+ this._rootEl = el ?? null;
56
+ this._applyRootAttrs(this._rootEl);
57
+ };
58
+ defineHybridPropAliases(this, ["modelValue", "cssClass"]);
59
+ Object.defineProperty(this, "css-class", {
60
+ get: () => this.cssClass,
61
+ set: (value) => this._setCssClass(value),
62
+ configurable: true,
63
+ enumerable: false
64
+ });
65
+ Object.defineProperty(this, "cssclass", {
66
+ get: () => this.cssClass,
67
+ set: (value) => this._setCssClass(value),
68
+ configurable: true,
69
+ enumerable: false
70
+ });
71
+ }
72
+ static get observedAttributes() {
73
+ return [
74
+ ...super.observedAttributes ?? [],
75
+ "modelvalue",
76
+ "css-class",
77
+ "cssclass"
78
+ ];
79
+ }
80
+ attributeChangedCallback(name, oldValue, newValue) {
81
+ super.attributeChangedCallback(name, oldValue, newValue);
82
+ if (oldValue === newValue) return;
83
+ if (name === "modelvalue") {
84
+ this.modelValue = newValue ?? "";
85
+ return;
86
+ }
87
+ if (name === "css-class" || name === "cssclass") this._setCssClass(newValue);
88
+ }
89
+ willUpdate(changed) {
90
+ if (typeof this.items === "string") this.items = coerceTabItems(this.items);
91
+ if (typeof this.disabled === "string") {
92
+ const normalized = this.disabled.toLowerCase().trim();
93
+ this.disabled = normalized === "" || normalized === "true";
94
+ }
95
+ if (changed.has("modelValue") && this.value !== this.modelValue) this.value = this.modelValue;
96
+ if (changed.has("value") && this.modelValue !== this.value) this.modelValue = this.value;
97
+ super.willUpdate?.(changed);
98
+ }
99
+ _setCssClass(value) {
100
+ if (value == null) {
101
+ this.cssClass = {};
102
+ this.cssClassName = "";
103
+ return;
104
+ }
105
+ if (typeof value === "object") {
106
+ this.cssClass = value;
107
+ return;
108
+ }
109
+ if (typeof value === "string") {
110
+ const trimmed = value.trim();
111
+ if (!trimmed) {
112
+ this.cssClass = {};
113
+ this.cssClassName = "";
114
+ return;
115
+ }
116
+ if (trimmed.startsWith("{") && trimmed.endsWith("}")) try {
117
+ this.cssClass = JSON.parse(trimmed);
118
+ return;
119
+ } catch {}
120
+ this.cssClassName = trimmed;
121
+ }
122
+ }
123
+ _cls(base, key) {
124
+ const extra = this.cssClass?.[key];
125
+ return extra ? `${base} ${extra}` : base;
126
+ }
127
+ /**
128
+ * The prop mirrors, each omitted at its default so `:not([mono-size])` means
129
+ * "md" for hand-written markup exactly as it does for the element.
130
+ *
131
+ * `aria-orientation` is ALWAYS written, and is not a `mono-` attribute:
132
+ * upstream styles the vertical strip from the ARIA state, and a tablist is
133
+ * supposed to carry it either way.
134
+ */
135
+ _computeRootAttrs() {
136
+ return {
137
+ "mono-size": this.size === "md" ? null : this.size,
138
+ "mono-color": this.color === "primary" ? null : this.color,
139
+ "mono-variant": this.variant === "underline" ? null : this.variant,
140
+ "mono-disabled": this.disabled ? "" : null,
141
+ "aria-orientation": this.orientation === "vertical" ? "vertical" : "horizontal"
142
+ };
143
+ }
144
+ _applyRootAttrs(root) {
145
+ if (!root) return;
146
+ if (!root.hasAttribute("mono-tabs")) root.setAttribute("mono-tabs", "");
147
+ for (const [name, value] of Object.entries(this._computeRootAttrs())) if (value === null) root.removeAttribute(name);
148
+ else if (root.getAttribute(name) !== value) root.setAttribute(name, value);
149
+ }
150
+ updated(changed) {
151
+ super.updated?.(changed);
152
+ this._applyRootAttrs(this._rootEl);
153
+ }
154
+ get _wrapperClasses() {
155
+ return [
156
+ "mono-tabs",
157
+ this.size,
158
+ this.color,
159
+ `variant-${this.variant}`,
160
+ this.disabled ? "disabled" : "",
161
+ this.cssClassName,
162
+ this.cssClass?.root
163
+ ].filter(Boolean).join(" ");
164
+ }
165
+ _isActive(item) {
166
+ return item.id === this.modelValue;
167
+ }
168
+ _tabClasses(item) {
169
+ const active = this._isActive(item);
170
+ return [
171
+ this._cls("mono-tabs-tab", "tab"),
172
+ active ? "on" : "",
173
+ active && this.cssClass?.tabActive ? this.cssClass.tabActive : "",
174
+ item.disabled ? "disabled" : "",
175
+ item.disabled && this.cssClass?.tabDisabled ? this.cssClass.tabDisabled : ""
176
+ ].filter(Boolean).join(" ");
177
+ }
178
+ _emitClick(detail) {
179
+ dispatchMonoEvent(this, "click", detail, { alias: "change" });
180
+ }
181
+ _selectItem(item, sourceEvent) {
182
+ if (this.disabled || item.disabled) return;
183
+ if (this.modelValue === item.id) return;
184
+ const oldValue = this.modelValue;
185
+ this.modelValue = item.id;
186
+ this.value = item.id;
187
+ this._emitClick({
188
+ modelValue: item.id,
189
+ currentValue: item.id,
190
+ oldValue,
191
+ value: item.id,
192
+ item,
193
+ sourceEvent
194
+ });
195
+ }
196
+ _handleClick(item, event) {
197
+ this._selectItem(item, event);
198
+ }
199
+ select(id) {
200
+ const item = this.items.find((entry) => entry.id === id);
201
+ if (item) this._selectItem(item);
202
+ }
203
+ next() {
204
+ this._step(1);
205
+ }
206
+ previous() {
207
+ this._step(-1);
208
+ }
209
+ _step(delta) {
210
+ if (this.disabled || !this.items.length) return;
211
+ const enabled = this.items.filter((item) => !item.disabled);
212
+ if (!enabled.length) return;
213
+ const currentIndex = enabled.findIndex((item) => item.id === this.modelValue);
214
+ const nextIndex = currentIndex < 0 ? 0 : (currentIndex + delta + enabled.length) % enabled.length;
215
+ this._selectItem(enabled[nextIndex]);
216
+ }
217
+ focus() {
218
+ const root = this.renderRoot;
219
+ const tab = root.querySelector(".mono-tabs-tab.on");
220
+ const fallback = root.querySelector(".mono-tabs-tab");
221
+ (tab ?? fallback)?.focus();
222
+ }
223
+ blur() {
224
+ this.renderRoot.querySelector(".mono-tabs-tab:focus")?.blur();
225
+ }
226
+ /** The items to render for THIS pass. Shadow overrides for the hydration gate. */
227
+ _itemsForRender() {
228
+ return this.items;
229
+ }
230
+ /** Whether per-tab icons render through a native `<slot>` (shadow) vs `data-mono-slot` (light). */
231
+ _useIconSlots() {
232
+ return false;
233
+ }
234
+ /** Whether tab `id` has a slotted icon. Light reads its capture map; shadow its scanned set. */
235
+ _iconHasContent(_id) {
236
+ return false;
237
+ }
238
+ _renderIcon(item) {
239
+ if (this._useIconSlots()) return html`
240
+ <span
241
+ class=${this._cls("mono-tabs-tab-icon", "icon")}
242
+ mono-icon
243
+ aria-hidden="true"
244
+ ?mono-empty=${!this._iconHasContent(item.id)}
245
+ >
246
+ <slot name=${`icon-${item.id}`}></slot>
247
+ </span>
248
+ `;
249
+ if (!this._iconHasContent(item.id)) return nothing;
250
+ return html`
251
+ <span class=${this._cls("mono-tabs-tab-icon", "icon")} mono-icon aria-hidden="true">
252
+ <span data-mono-slot=${`icon-${item.id}`}></span>
253
+ </span>
254
+ `;
255
+ }
256
+ _renderBadge(item) {
257
+ if (item.badge === void 0 || item.badge === null || item.badge === "") return nothing;
258
+ return html`
259
+ <span class=${this._cls("mono-tabs-tab-badge", "badge")} mono-badge>
260
+ ${item.badge}
261
+ </span>
262
+ `;
263
+ }
264
+ render() {
265
+ return html`
266
+ <div class=${this._wrapperClasses} mono-tabs role="tablist" ${ref(this.bindRoot)}>
267
+ ${this._itemsForRender().map((item) => html`
268
+ <button
269
+ type="button"
270
+ class=${this._tabClasses(item)}
271
+ mono-tab
272
+ role="tab"
273
+ aria-selected=${this._isActive(item) ? "true" : "false"}
274
+ ?disabled=${this.disabled || item.disabled}
275
+ data-tab-id=${item.id}
276
+ @click=${(event) => this._handleClick(item, event)}
277
+ >
278
+ ${this._renderIcon(item)}
279
+ <span class=${this._cls("mono-tabs-tab-label", "label")} mono-label>
280
+ ${item.label}
281
+ </span>
282
+ ${this._renderBadge(item)}
283
+ </button>
284
+ `)}
285
+ </div>
286
+ `;
287
+ }
288
+ }
289
+ __decorate([property({
290
+ attribute: "items",
291
+ converter: {
292
+ fromAttribute: (value) => coerceTabItems(value),
293
+ toAttribute: () => null
294
+ },
295
+ hasChanged: arrayHasChanged
296
+ })], MonoTabsCoreClass.prototype, "items", void 0);
297
+ __decorate([property({
298
+ type: String,
299
+ attribute: "model-value",
300
+ reflect: true
301
+ })], MonoTabsCoreClass.prototype, "modelValue", void 0);
302
+ __decorate([property({ type: String })], MonoTabsCoreClass.prototype, "value", void 0);
303
+ __decorate([property({ type: String })], MonoTabsCoreClass.prototype, "size", void 0);
304
+ __decorate([property({ type: String })], MonoTabsCoreClass.prototype, "color", void 0);
305
+ __decorate([property({ type: String })], MonoTabsCoreClass.prototype, "variant", void 0);
306
+ __decorate([property({ type: String })], MonoTabsCoreClass.prototype, "orientation", void 0);
307
+ __decorate([property({
308
+ reflect: true,
309
+ converter: booleanStringConverter
310
+ })], MonoTabsCoreClass.prototype, "disabled", void 0);
311
+ __decorate([property({ attribute: false })], MonoTabsCoreClass.prototype, "cssClass", void 0);
312
+ __decorate([property({ attribute: false })], MonoTabsCoreClass.prototype, "cssClassName", void 0);
313
+ return MonoTabsCoreClass;
314
+ };
315
+
316
+ //#endregion
317
+ export { coerceTabItems as n, MonoTabsCore as t };