@mono-lit/helper 0.0.9 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/accordion-core-DaNyPWRr.js +277 -0
- package/dist/alert-core-DWtHbX_-.js +134 -0
- package/dist/breadcrumb-list-core-Dh68T8Cf.js +747 -0
- package/dist/{mono-button-CLkHg3WW.js → button-core-DerXg84Q.js} +3 -276
- package/dist/button-dropdown-core-DKYEOyjy.js +654 -0
- package/dist/button-utils-D5-66M02.js +63 -0
- package/dist/card-utils-l80qAmrN.js +312 -0
- package/dist/chart-core-DV7hD3ZY.js +801 -0
- package/dist/checkbox-utils-DKdrhAzF.js +337 -0
- package/dist/chip-utils-DpRrd7Zj.js +403 -0
- package/dist/{data-source-controller-C6C4ej_M.js → data-source-controller-DS_JLrmS.js} +1 -1
- package/dist/{data-source-options-fxT5QIX4.js → data-source-options-DJUNU26C.js} +6 -6
- package/dist/{data-source-read-BL266IW0.js → data-source-read-uKJpRAzx.js} +2 -2
- package/dist/date-core-CyuSyvvG.js +734 -0
- package/dist/drawer-core-DbFWvNln.js +759 -0
- package/dist/dropdown-core-BCH1pK14.js +511 -0
- package/dist/dropdown-table-core-SfHUJVFq.js +1342 -0
- package/dist/export.js +1 -1
- package/dist/{field-path-BabiMrrA.js → field-path-DK2VBWHl.js} +1 -1
- package/dist/field-tooltip.css_raw-DVblekCl.js +5 -0
- package/dist/{field-validation.css_raw-Cx6SGrfP.js → field-validation.css_raw-BU7C6173.js} +1 -170
- package/dist/file-upload-core-Cz_dBQMx.js +624 -0
- package/dist/filter-builder-core-DyWjbBP7.js +381 -0
- package/dist/{filter-builder-B6Y2mmbM.js → filter-builder-vbqIuPhX.js} +1 -1
- package/dist/{filter-eval-ChDSaAUH.js → filter-eval-CqeBnMYh.js} +1 -1
- package/dist/{filter-odata-Bi27XUpQ.js → filter-odata-GsczYKNC.js} +1 -1
- package/dist/{hydration-flush-BaE9gN3C.js → hydration-flush-Volt9X7Q.js} +2 -1071
- package/dist/index.js +11 -11
- package/dist/{index.node-DTqDBca7.js → index.node-Csy9zrr1.js} +4 -4
- package/dist/index.node.js +11 -11
- package/dist/input-utils-BglY-k0H.js +1145 -0
- package/dist/menu-core-DkAYuCZ2.js +831 -0
- package/dist/modal-core-CSBSPN_m.js +844 -0
- package/dist/mono-button-DVvZ03P-.js +280 -0
- package/dist/{mono-button.shadow-DqZMpcqY.js → mono-button.shadow-BANxMGln.js} +6 -594
- package/dist/{mono-data-chart-NKPdAgVq.js → mono-data-chart-ChF4J9RT.js} +6 -6
- package/dist/{mono-data-dropdown-B2iRpJuI.js → mono-data-dropdown-Bgj2PDfm.js} +1 -1
- package/dist/{mono-data-grid-llJCX9MC.js → mono-data-grid-DJkp96N-.js} +144 -46
- package/dist/{mono-event-BPku9HpS.js → mono-event-CAZf0F_k.js} +14 -9
- package/dist/{mono-form-controller-BrA10erm.js → mono-form-controller-DxZLvyg6.js} +2 -1
- package/dist/mono-table-checkbox-core-BKOMx8R5.js +5288 -0
- package/dist/nav-core-B5qU2dzn.js +225 -0
- package/dist/{normalize-error-D93O4q8g.js → normalize-error-BEcd1tmS.js} +2 -2
- package/dist/nuxt.js +1 -1
- package/dist/otp-core-DXg3vFLh.js +758 -0
- package/dist/radio-utils-Dk9Tl1jz.js +319 -0
- package/dist/rich-text-editor-core-Ddd_QaLn.js +1280 -0
- package/dist/select-utils-BgArYHk8.js +2140 -0
- package/dist/sidebar-core-CD6txDo3.js +583 -0
- package/dist/slider-core-vcWr321-.js +1014 -0
- package/dist/src/components/dropdown-table/dropdown-table-core.d.ts +2 -2
- package/dist/src/components/dropdown-table/dropdown-table-types.d.ts +1 -1
- package/dist/src/components/dropdown-table/index.d.ts +1 -1
- package/dist/src/components/dropdown-table/index.shadow.d.ts +1 -1
- package/dist/src/components/dropdown-table/mono-data-dropdown.d.ts +1 -1
- package/dist/src/components/form/form-types.d.ts +9 -3
- package/dist/src/components/input/input-core.d.ts +1 -1
- package/dist/src/components/input/input-types.d.ts +1 -1
- package/dist/src/components/otp/otp-core.d.ts +1 -1
- package/dist/src/components/select/select-core.d.ts +1 -1
- package/dist/src/components/select/select-types.d.ts +1 -1
- package/dist/src/components/slider/slider-core.d.ts +1 -1
- package/dist/src/components/slider/slider-types.d.ts +1 -1
- package/dist/src/components/table/filter-suggestion.d.ts +171 -0
- package/dist/src/components/table/index.d.ts +5 -4
- package/dist/src/components/table/index.shadow.d.ts +5 -4
- package/dist/src/components/table/mono-data-grid.d.ts +22 -3
- package/dist/src/components/table/mono-table-empty-core.d.ts +37 -0
- package/dist/src/components/table/mono-table-search-core.d.ts +22 -3
- package/dist/src/components/table/table-types.d.ts +74 -4
- package/dist/src/components/tag-input/tag-input-core.d.ts +1 -1
- package/dist/src/components/tag-input/tag-input-types.d.ts +1 -1
- package/dist/src/components/textarea/textarea-core.d.ts +1 -1
- package/dist/src/composables/mono-event.d.ts +7 -1
- package/dist/src/entries/index.d.ts +8 -6
- package/dist/src/entries/index.node.d.ts +8 -6
- package/dist/src/search/index.d.ts +1 -1
- package/dist/src/utils/group-count.d.ts +36 -0
- package/dist/switch-utils-CTZ4id2V.js +338 -0
- package/dist/tabs-core-r5-B8k_N.js +317 -0
- package/dist/tag-input-utils-D2JA90DQ.js +3060 -0
- package/dist/textarea-utils-VU1KeXm8.js +821 -0
- package/dist/ui/accordion.js +2 -274
- package/dist/ui/alert.js +2 -131
- package/dist/ui/breadcrumb.js +4 -745
- package/dist/ui/button-dropdown.js +4 -652
- package/dist/ui/button.js +2 -63
- package/dist/ui/card.js +2 -310
- package/dist/ui/chart.js +4 -800
- package/dist/ui/checkbox.js +4 -335
- package/dist/ui/chip.js +4 -402
- package/dist/ui/date.js +3 -732
- package/dist/ui/drawer.js +3 -757
- package/dist/ui/dropdown-table.js +5 -1341
- package/dist/ui/dropdown.js +4 -509
- package/dist/ui/file-upload.js +3 -622
- package/dist/ui/filter.js +5 -380
- package/dist/ui/form.js +1 -1
- package/dist/ui/index.css +118 -1
- package/dist/ui/input.js +3 -1141
- package/dist/ui/menu.js +4 -828
- package/dist/ui/modal.js +4 -843
- package/dist/ui/nav.js +4 -223
- package/dist/ui/otp.js +4 -756
- package/dist/ui/radio.js +4 -317
- package/dist/ui/rich-text-editor.js +4 -1278
- package/dist/ui/select.js +5 -2138
- package/dist/ui/shadow/accordion.js +4 -273
- package/dist/ui/shadow/alert.js +4 -130
- package/dist/ui/shadow/breadcrumb.js +5 -744
- package/dist/ui/shadow/button-dropdown.js +6 -652
- package/dist/ui/shadow/button.js +3 -63
- package/dist/ui/shadow/card.js +4 -309
- package/dist/ui/shadow/chart.js +6 -1576
- package/dist/ui/shadow/checkbox.js +4 -334
- package/dist/ui/shadow/chip.js +4 -396
- package/dist/ui/shadow/date.js +7 -731
- package/dist/ui/shadow/drawer.js +4 -756
- package/dist/ui/shadow/dropdown-table.js +8 -1762
- package/dist/ui/shadow/dropdown.js +4 -508
- package/dist/ui/shadow/file-upload.js +4 -620
- package/dist/ui/shadow/filter.js +7 -379
- package/dist/ui/shadow/input.js +6 -1140
- package/dist/ui/shadow/menu.js +5 -828
- package/dist/ui/shadow/modal.js +6 -1063
- package/dist/ui/shadow/nav.js +5 -223
- package/dist/ui/shadow/otp.js +6 -754
- package/dist/ui/shadow/radio.js +4 -316
- package/dist/ui/shadow/rich-text-editor.js +4 -1276
- package/dist/ui/shadow/select.js +6 -2136
- package/dist/ui/shadow/sidebar.js +5 -581
- package/dist/ui/shadow/slider.js +5 -1010
- package/dist/ui/shadow/switch.js +4 -335
- package/dist/ui/shadow/table.js +10 -4501
- package/dist/ui/shadow/tabs.js +6 -315
- package/dist/ui/shadow/tag-input.js +7 -3057
- package/dist/ui/shadow/textarea.js +6 -817
- package/dist/ui/sidebar.js +3 -581
- package/dist/ui/slider.js +4 -1012
- package/dist/ui/switch.js +4 -336
- package/dist/ui/table.js +9 -4502
- package/dist/ui/tabs.js +4 -315
- package/dist/ui/tag-input.js +5 -3058
- package/dist/ui/textarea.js +4 -819
- package/dist/{vite-CivRCJaf.js → vite-CfW7z2wn.js} +21 -14
- package/dist/vite.js +1 -1
- package/dist/vue.d.ts +3 -2
- package/package.json +10 -11
- package/dist/chip-strip-bNfLn52Z.js +0 -215
- package/dist/data-source-controller-Dx6IQ2CN.js +0 -243
- package/dist/data-source-options-BM4r4PRw.js +0 -558
- package/dist/data-source-read-HyBCRg1t.js +0 -242
- package/dist/excel-BXzr3uI1.js +0 -784
- package/dist/export-ixRdCS2y.js +0 -2388
- package/dist/field-tooltip-addon-CWCp19mJ.js +0 -702
- package/dist/field-tooltip.css_raw-U5UeTa2d.js +0 -269
- package/dist/filter-builder-C0T3pMx2.js +0 -208
- package/dist/form-control-core-BbiACMtL.js +0 -226
- package/dist/icon-ClxnYhBG.js +0 -19
- package/dist/import-Dc4eXC02.js +0 -612
- package/dist/light-slots-_no0r2Z-.js +0 -246
- package/dist/markdown-uGlE_OfJ.js +0 -20191
- package/dist/mono-data-grid-e9ZVBlNN.js +0 -4240
- package/dist/normalize-error-BmLbgANw.js +0 -1048
package/dist/ui/chip.js
CHANGED
|
@@ -1,274 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { t as dispatchMonoEvent } from "../mono-event-BPku9HpS.js";
|
|
1
|
+
import { t as customElement } from "../mono-element-CKcT0rwv.js";
|
|
2
|
+
import { t as __decorate } from "../decorate-DbYFpi8R.js";
|
|
4
3
|
import { n as bucketHasContent, r as captureLightSlots, s as placeSlotNode } from "../light-slots-B5Ck0t_E.js";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
4
|
+
import { a as MonoChipCore, i as MonoStatusDot, n as isInteractive, r as validateChipProps, t as generateChipRootClasses } from "../chip-utils-DpRrd7Zj.js";
|
|
5
|
+
import { LitElement, html, nothing } from "lit";
|
|
7
6
|
import { ifDefined } from "lit/directives/if-defined.js";
|
|
8
7
|
import { when } from "lit/directives/when.js";
|
|
9
8
|
|
|
10
|
-
//#region src/components/chip/chip-core.ts
|
|
11
|
-
/**
|
|
12
|
-
* `MonoChipCore` — all render-mode-agnostic logic for `mono-chip`: reactive
|
|
13
|
-
* props, hybrid aliases (incl. the `ariaLabel`/`aria-label`/`arialabel` →
|
|
14
|
-
* `ariaLabelText` getters), camelCase attribute fallbacks, the `modelValue`↔
|
|
15
|
-
* `selected` sync + SSR boolean coercion in `willUpdate`, class computation,
|
|
16
|
-
* click/keyboard/close interactivity (`mno-click`/`mno-close`), and the imperative
|
|
17
|
-
* `focus/blur/click`. No `render()` — the light build keeps its `[data-mono-slot]`
|
|
18
|
-
* capture strategy and the shadow build uses native `<slot>` (mirrors `mono-button`).
|
|
19
|
-
*
|
|
20
|
-
* SSR-safe: no `document`/`window` access; `_chipElement` (`@query`) is lazy and
|
|
21
|
-
* `focus/blur/click` only run client-side.
|
|
22
|
-
*/
|
|
23
|
-
const MonoChipCore = (superClass) => {
|
|
24
|
-
class MonoChipCoreClass extends superClass {
|
|
25
|
-
constructor(...args) {
|
|
26
|
-
super(...args);
|
|
27
|
-
this.cssClass = {};
|
|
28
|
-
this._hasIcon = false;
|
|
29
|
-
defineHybridPropAliases(this, [
|
|
30
|
-
"modelValue",
|
|
31
|
-
"iconPosition",
|
|
32
|
-
"ariaLabelText",
|
|
33
|
-
"closeLabel",
|
|
34
|
-
"cssClass"
|
|
35
|
-
]);
|
|
36
|
-
for (const name of [
|
|
37
|
-
"ariaLabel",
|
|
38
|
-
"aria-label",
|
|
39
|
-
"arialabel"
|
|
40
|
-
]) Object.defineProperty(this, name, {
|
|
41
|
-
get: () => this.ariaLabelText,
|
|
42
|
-
set: (value) => {
|
|
43
|
-
this.ariaLabelText = value == null ? void 0 : String(value);
|
|
44
|
-
},
|
|
45
|
-
configurable: true,
|
|
46
|
-
enumerable: false
|
|
47
|
-
});
|
|
48
|
-
this.size = "md";
|
|
49
|
-
this.color = "primary";
|
|
50
|
-
this.variant = "soft";
|
|
51
|
-
this.label = void 0;
|
|
52
|
-
this.dot = false;
|
|
53
|
-
this.removable = false;
|
|
54
|
-
this.clickable = false;
|
|
55
|
-
this.disabled = false;
|
|
56
|
-
this.modelValue = false;
|
|
57
|
-
this.selected = false;
|
|
58
|
-
this.href = void 0;
|
|
59
|
-
this.target = void 0;
|
|
60
|
-
this.iconPosition = "left";
|
|
61
|
-
this.ariaLabelText = void 0;
|
|
62
|
-
this.closeLabel = "Remove";
|
|
63
|
-
this._isActive = false;
|
|
64
|
-
}
|
|
65
|
-
static get observedAttributes() {
|
|
66
|
-
return [
|
|
67
|
-
...super.observedAttributes ?? [],
|
|
68
|
-
"modelvalue",
|
|
69
|
-
"iconposition",
|
|
70
|
-
"closelabel",
|
|
71
|
-
"arialabeltext",
|
|
72
|
-
"arialabel"
|
|
73
|
-
];
|
|
74
|
-
}
|
|
75
|
-
attributeChangedCallback(name, oldValue, newValue) {
|
|
76
|
-
super.attributeChangedCallback(name, oldValue, newValue);
|
|
77
|
-
if (oldValue === newValue) return;
|
|
78
|
-
if (name === "modelvalue") {
|
|
79
|
-
this.modelValue = this._toBoolean(newValue);
|
|
80
|
-
return;
|
|
81
|
-
}
|
|
82
|
-
if (name === "iconposition") {
|
|
83
|
-
this.iconPosition = newValue ?? "left";
|
|
84
|
-
return;
|
|
85
|
-
}
|
|
86
|
-
if (name === "closelabel") {
|
|
87
|
-
this.closeLabel = newValue ?? "Remove";
|
|
88
|
-
return;
|
|
89
|
-
}
|
|
90
|
-
if (name === "arialabeltext" || name === "arialabel") this.ariaLabelText = newValue ?? void 0;
|
|
91
|
-
}
|
|
92
|
-
willUpdate(changed) {
|
|
93
|
-
for (const key of [
|
|
94
|
-
"dot",
|
|
95
|
-
"removable",
|
|
96
|
-
"clickable",
|
|
97
|
-
"disabled",
|
|
98
|
-
"modelValue",
|
|
99
|
-
"selected"
|
|
100
|
-
]) if (typeof this[key] === "string") this[key] = this._toBoolean(this[key]);
|
|
101
|
-
if (!this.hasUpdated) {
|
|
102
|
-
const on = this.selected || this.modelValue;
|
|
103
|
-
if (this.selected !== on) this.selected = on;
|
|
104
|
-
if (this.modelValue !== on) this.modelValue = on;
|
|
105
|
-
} else {
|
|
106
|
-
if (changed.has("modelValue") && this.selected !== this.modelValue) this.selected = this.modelValue;
|
|
107
|
-
if (changed.has("selected") && this.modelValue !== this.selected) this.modelValue = this.selected;
|
|
108
|
-
}
|
|
109
|
-
super.willUpdate?.(changed);
|
|
110
|
-
}
|
|
111
|
-
_toBoolean(value) {
|
|
112
|
-
if (typeof value === "boolean") return value;
|
|
113
|
-
if (typeof value === "string") {
|
|
114
|
-
const normalized = value.toLowerCase().trim();
|
|
115
|
-
return normalized === "" || normalized === "true";
|
|
116
|
-
}
|
|
117
|
-
return Boolean(value);
|
|
118
|
-
}
|
|
119
|
-
_cls(base, key) {
|
|
120
|
-
const extra = this.cssClass?.[key];
|
|
121
|
-
return extra ? `${base} ${extra}` : base;
|
|
122
|
-
}
|
|
123
|
-
get _isInteractive() {
|
|
124
|
-
return this.clickable || Boolean(this.href) || this.removable;
|
|
125
|
-
}
|
|
126
|
-
get _chipClasses() {
|
|
127
|
-
const classes = ["mono-chip"];
|
|
128
|
-
classes.push(this.size);
|
|
129
|
-
if (this.variant === "soft") classes.push(`soft-${this.color}`);
|
|
130
|
-
else if (this.variant === "solid") classes.push(`solid-${this.color}`);
|
|
131
|
-
else if (this.variant === "outline") classes.push(`outline-${this.color}`);
|
|
132
|
-
if (this.dot) classes.push("has-dot");
|
|
133
|
-
if (this.removable) classes.push("removable");
|
|
134
|
-
if (this.clickable || this.href) classes.push("clickable");
|
|
135
|
-
if (this.disabled) classes.push("disabled");
|
|
136
|
-
if (this.selected || this._isActive) classes.push("selected");
|
|
137
|
-
if (this.cssClass?.root) classes.push(this.cssClass.root);
|
|
138
|
-
return classes.join(" ");
|
|
139
|
-
}
|
|
140
|
-
_createModelDetail(args) {
|
|
141
|
-
return {
|
|
142
|
-
modelValue: args.modelValue,
|
|
143
|
-
currentValue: args.modelValue,
|
|
144
|
-
oldValue: args.oldValue,
|
|
145
|
-
value: args.modelValue,
|
|
146
|
-
selected: args.modelValue,
|
|
147
|
-
label: this.label ?? "",
|
|
148
|
-
sourceEvent: args.sourceEvent
|
|
149
|
-
};
|
|
150
|
-
}
|
|
151
|
-
_emitClick(detail) {
|
|
152
|
-
dispatchMonoEvent(this, "click", detail);
|
|
153
|
-
}
|
|
154
|
-
_emitClose(detail) {
|
|
155
|
-
dispatchMonoEvent(this, "close", detail);
|
|
156
|
-
}
|
|
157
|
-
_handleClick(event) {
|
|
158
|
-
if (this.disabled) {
|
|
159
|
-
event.preventDefault();
|
|
160
|
-
event.stopPropagation();
|
|
161
|
-
return;
|
|
162
|
-
}
|
|
163
|
-
const oldValue = this.modelValue;
|
|
164
|
-
let nextValue = this.modelValue;
|
|
165
|
-
if (this.clickable && !this.href) {
|
|
166
|
-
nextValue = !this.modelValue;
|
|
167
|
-
this.modelValue = nextValue;
|
|
168
|
-
this.selected = nextValue;
|
|
169
|
-
}
|
|
170
|
-
const detail = this._createModelDetail({
|
|
171
|
-
modelValue: nextValue,
|
|
172
|
-
oldValue,
|
|
173
|
-
sourceEvent: event
|
|
174
|
-
});
|
|
175
|
-
this._emitClick(detail);
|
|
176
|
-
}
|
|
177
|
-
_handleKeyDown(event) {
|
|
178
|
-
if (this.disabled) return;
|
|
179
|
-
if (event.key === "Enter" || event.key === " ") {
|
|
180
|
-
event.preventDefault();
|
|
181
|
-
this._chipElement?.click();
|
|
182
|
-
}
|
|
183
|
-
if ((event.key === "Backspace" || event.key === "Delete") && this.removable) {
|
|
184
|
-
event.preventDefault();
|
|
185
|
-
const detail = this._createModelDetail({
|
|
186
|
-
modelValue: this.modelValue,
|
|
187
|
-
oldValue: this.modelValue,
|
|
188
|
-
sourceEvent: event
|
|
189
|
-
});
|
|
190
|
-
this._emitClose(detail);
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
_handleFocus() {
|
|
194
|
-
this._isActive = true;
|
|
195
|
-
}
|
|
196
|
-
_handleBlur() {
|
|
197
|
-
this._isActive = false;
|
|
198
|
-
}
|
|
199
|
-
_handleClose(event) {
|
|
200
|
-
event.preventDefault();
|
|
201
|
-
event.stopPropagation();
|
|
202
|
-
if (this.disabled) return;
|
|
203
|
-
const detail = this._createModelDetail({
|
|
204
|
-
modelValue: this.modelValue,
|
|
205
|
-
oldValue: this.modelValue,
|
|
206
|
-
sourceEvent: event
|
|
207
|
-
});
|
|
208
|
-
this._emitClose(detail);
|
|
209
|
-
}
|
|
210
|
-
focus() {
|
|
211
|
-
this._chipElement?.focus();
|
|
212
|
-
}
|
|
213
|
-
blur() {
|
|
214
|
-
this._chipElement?.blur();
|
|
215
|
-
}
|
|
216
|
-
click() {
|
|
217
|
-
this._chipElement?.click();
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
|
-
__decorate([property({ type: String })], MonoChipCoreClass.prototype, "size", void 0);
|
|
221
|
-
__decorate([property({ type: String })], MonoChipCoreClass.prototype, "color", void 0);
|
|
222
|
-
__decorate([property({ type: String })], MonoChipCoreClass.prototype, "variant", void 0);
|
|
223
|
-
__decorate([property({ type: String })], MonoChipCoreClass.prototype, "rounded", void 0);
|
|
224
|
-
__decorate([property({ type: String })], MonoChipCoreClass.prototype, "label", void 0);
|
|
225
|
-
__decorate([property({
|
|
226
|
-
reflect: true,
|
|
227
|
-
converter: booleanStringConverter
|
|
228
|
-
})], MonoChipCoreClass.prototype, "dot", void 0);
|
|
229
|
-
__decorate([property({
|
|
230
|
-
reflect: true,
|
|
231
|
-
converter: booleanStringConverter
|
|
232
|
-
})], MonoChipCoreClass.prototype, "removable", void 0);
|
|
233
|
-
__decorate([property({
|
|
234
|
-
reflect: true,
|
|
235
|
-
converter: booleanStringConverter
|
|
236
|
-
})], MonoChipCoreClass.prototype, "clickable", void 0);
|
|
237
|
-
__decorate([property({
|
|
238
|
-
reflect: true,
|
|
239
|
-
converter: booleanStringConverter
|
|
240
|
-
})], MonoChipCoreClass.prototype, "disabled", void 0);
|
|
241
|
-
__decorate([property({
|
|
242
|
-
attribute: "model-value",
|
|
243
|
-
reflect: true,
|
|
244
|
-
converter: booleanStringConverter
|
|
245
|
-
})], MonoChipCoreClass.prototype, "modelValue", void 0);
|
|
246
|
-
__decorate([property({
|
|
247
|
-
reflect: true,
|
|
248
|
-
converter: booleanStringConverter
|
|
249
|
-
})], MonoChipCoreClass.prototype, "selected", void 0);
|
|
250
|
-
__decorate([property({ type: String })], MonoChipCoreClass.prototype, "href", void 0);
|
|
251
|
-
__decorate([property({ type: String })], MonoChipCoreClass.prototype, "target", void 0);
|
|
252
|
-
__decorate([property({
|
|
253
|
-
type: String,
|
|
254
|
-
attribute: "icon-position"
|
|
255
|
-
})], MonoChipCoreClass.prototype, "iconPosition", void 0);
|
|
256
|
-
__decorate([property({
|
|
257
|
-
type: String,
|
|
258
|
-
attribute: "aria-label"
|
|
259
|
-
})], MonoChipCoreClass.prototype, "ariaLabelText", void 0);
|
|
260
|
-
__decorate([property({
|
|
261
|
-
type: String,
|
|
262
|
-
attribute: "close-label"
|
|
263
|
-
})], MonoChipCoreClass.prototype, "closeLabel", void 0);
|
|
264
|
-
__decorate([property({ attribute: false })], MonoChipCoreClass.prototype, "cssClass", void 0);
|
|
265
|
-
__decorate([state()], MonoChipCoreClass.prototype, "_isActive", void 0);
|
|
266
|
-
__decorate([state()], MonoChipCoreClass.prototype, "_hasIcon", void 0);
|
|
267
|
-
__decorate([query("div > span, div > a")], MonoChipCoreClass.prototype, "_chipElement", void 0);
|
|
268
|
-
return MonoChipCoreClass;
|
|
269
|
-
};
|
|
270
|
-
|
|
271
|
-
//#endregion
|
|
272
9
|
//#region src/components/chip/mono-chip.ts
|
|
273
10
|
let MonoChip = class MonoChip extends MonoChipCore(LitElement) {
|
|
274
11
|
constructor(..._args) {
|
|
@@ -423,140 +160,5 @@ let MonoChip = class MonoChip extends MonoChipCore(LitElement) {
|
|
|
423
160
|
};
|
|
424
161
|
MonoChip = __decorate([customElement("mono-chip")], MonoChip);
|
|
425
162
|
|
|
426
|
-
//#endregion
|
|
427
|
-
//#region \0raw:C:\Users\VCT-DEV\Desktop\libs\packages\helper\src\components\chip\chip.css?raw.js
|
|
428
|
-
var chip_css_raw_default = "/* =========================================================================\r\n mono-chip — a port of Basecoat's `.badge` (basecoat-css@1.0.2, vega style).\r\n\r\n Styled by ATTRIBUTE, like Basecoat — and the attributes mirror the element's\r\n props one for one, so hand-written markup reads like the Lit / Vue tag:\r\n\r\n <mono-chip size=\"lg\" color=\"success\" variant=\"solid\" label=\"Active\" dot>\r\n <span mono-chip mono-size=\"lg\" mono-color=\"success\" mono-variant=\"solid\" mono-has-dot>\r\n <span mono-main>\r\n <span mono-content>\r\n <span mono-dot></span>\r\n <span mono-label>Active</span>\r\n <button mono-close><span mono-glyph class=\"i-mdi-close\"></span></button>\r\n </span>\r\n </span>\r\n </span>\r\n\r\n An absent attribute is the prop's default (`:not([mono-size])` = md,\r\n `:not([mono-color])` = primary, `:not([mono-variant])` = soft, no\r\n `mono-rounded` = the pill). The element renders these on its root (both\r\n builds) plus the states `mono-has-dot` (the dot PART is `mono-dot`, so the state\r\n spells itself out) / `mono-removable` / `mono-clickable` /\r\n `mono-disabled` / `mono-selected` and `mono-icon-position=\"right\"`. The old\r\n classes (`.mono-chip.md.soft-primary`, `.chip-label`, `.chip-close`) are\r\n still emitted as inert hooks until 2.0 but no rule here reads them — except\r\n `rounded-<step>`, which is GONE: that is Tailwind/UnoCSS's own utility\r\n namespace, so on a page shipping those it was never inert (it rounded the\r\n chip's outer box). Use `mono-rounded` / the `rounded` prop.\r\n\r\n Selector map (ours ≡ upstream):\r\n [mono-chip] ≡ the layout box only — NOT painted (see below)\r\n [mono-main] ≡ .badge (inline-flex w-fit shrink-0 items-center\r\n justify-center overflow-hidden whitespace-nowrap,\r\n h-5 gap-1 rounded-4xl border border-transparent\r\n px-2 py-0.5 text-xs font-medium transition-all,\r\n focus-visible:border-ring ring-[3px] ring-ring/50)\r\n [mono-variant=\"solid\"] ≡ .badge[data-variant='primary'] (bg-c text-c-foreground,\r\n [a]:hover:bg-c/80) — generalised to every hue\r\n [mono-variant=\"soft\"] ≡ .badge[data-variant='destructive'] (bg-c/10 text-c,\r\n [a]:hover:bg-c/20, dark bg-c/20) — generalised; the DEFAULT\r\n [mono-variant=\"outline\"] ≡ .badge[data-variant='outline'] (border-border text-foreground,\r\n [a]:hover:bg-muted) + the hue on the edge and the ink\r\n [mono-color=\"secondary\"] ≡ .badge[data-variant='secondary'] (the muted surface pair)\r\n [mono-size=\"md\"] ≡ .badge's own h-5 px-2 text-xs; the other five are EXTENSION\r\n (Basecoat ships one badge size)\r\n [mono-rounded=\"…\"] ≡ EXTENSION (the shared corner ladder; unset = rounded-4xl)\r\n [mono-close] ≡ .combobox-chip-remove (opacity-50 hover:opacity-100, svg size-3.5)\r\n [mono-has-dot] / [mono-dot] / [mono-selected] / [mono-clickable] ≡ EXTENSION\r\n [mono-disabled] ≡ .btn disabled:opacity-50\r\n [mono-status-dot] ≡ EXTENSION (the standalone status-dot helper)\r\n\r\n WHY THE ROOT PAINTS NOTHING. `[mono-chip]` is also what a FIELD's internal\r\n chip carries: `<mono-tag-input>` renders Basecoat combobox chips as\r\n `[mono-chip] > [mono-chip-main] > …` and paints them in tag-input.css. Those\r\n rules are `[mono-tag-input] [mono-chip]` = (0,2,0) and win over this sheet,\r\n but only where they overlap — so this sheet keeps the root to layout plus\r\n custom properties (which a field's rules simply don't read) and paints the\r\n badge on `[mono-main]`, a part name a field chip does not have. The two never\r\n collide, and a real `<mono-chip>` slotted INTO a field keeps its own look.\r\n\r\n Specificity contract (same as the pre-port class sheet): a part's RESTING\r\n rule is exactly one attribute strong — `:where([mono-chip]) [mono-label]` =\r\n (0,1,0) — so a utility class handed in through `cssClass` wins by source\r\n order, while the prop and state rules stay heavier and win over it.\r\n\r\n Inner parts: [mono-main] > [mono-content] > [mono-dot] / [data-mono-slot=icon]\r\n / [mono-label] / [mono-close] > [mono-glyph].\r\n\r\n FLAVORS set `--mono-chip-{radius,border-width,font-weight,letter-spacing,\r\n text-transform}` and the VARIANT-scoped paint knobs\r\n `--mono-chip-{soft,solid,outline}-{bg,color,border-color}` (the shared\r\n `--mono-chip-bg` / `-color` is the CONSUMER's blanket override and repaints\r\n all three looks at once)` and the per-size `-height-<size>` /\r\n `-padding-x-<size>` / `-gap-<size>` / `-font-size-<size>` /\r\n `-glyph-size-<size>` (the size-agnostic twin of each of those is the\r\n CONSUMER's override — a flavor writing it would flatten the whole ladder);\r\n every fallback here is vega's value\r\n (`node scripts/basecoat-styles.mjs --varying \"^\\.badge\"`).\r\n ========================================================================= */\r\n\r\nmono-chip {\r\n display: inline-block;\r\n}\r\n\r\n/* =========================================\r\n Root — layout and the palette. NOTHING here paints (see the header).\r\n ========================================= */\r\n\r\n[mono-chip] {\r\n /* ── the ten roles, each a public knob over a Basecoat token ──────────── */\r\n --_mono-chip-primary: var(--mono-chip-primary, var(--primary));\r\n --_mono-chip-primary-foreground: var(--mono-chip-primary-foreground, var(--primary-foreground));\r\n --_mono-chip-secondary: var(--mono-chip-secondary, var(--secondary));\r\n --_mono-chip-secondary-foreground: var(--mono-chip-secondary-foreground, var(--secondary-foreground));\r\n --_mono-chip-success: var(--mono-chip-success, var(--success));\r\n --_mono-chip-success-foreground: var(--mono-chip-success-foreground, var(--success-foreground));\r\n --_mono-chip-danger: var(--mono-chip-danger, var(--destructive));\r\n --_mono-chip-danger-foreground: var(--mono-chip-danger-foreground, var(--destructive-foreground));\r\n --_mono-chip-warning: var(--mono-chip-warning, var(--warning));\r\n --_mono-chip-warning-foreground: var(--mono-chip-warning-foreground, var(--warning-foreground));\r\n --_mono-chip-info: var(--mono-chip-info, var(--info));\r\n --_mono-chip-info-foreground: var(--mono-chip-info-foreground, var(--info-foreground));\r\n --_mono-chip-teal: var(--mono-chip-teal, var(--teal));\r\n --_mono-chip-teal-foreground: var(--mono-chip-teal-foreground, var(--teal-foreground));\r\n --_mono-chip-purple: var(--mono-chip-purple, var(--purple));\r\n --_mono-chip-purple-foreground: var(--mono-chip-purple-foreground, var(--purple-foreground));\r\n --_mono-chip-neutral: var(--mono-chip-neutral, var(--neutral));\r\n --_mono-chip-neutral-foreground: var(--mono-chip-neutral-foreground, var(--neutral-foreground));\r\n --_mono-chip-dark: var(--mono-chip-dark, var(--dark));\r\n --_mono-chip-dark-foreground: var(--mono-chip-dark-foreground, var(--dark-foreground));\r\n\r\n /* the colour in play — `primary` unless a [mono-color] rule re-points it */\r\n --_mono-chip-c: var(--_mono-chip-primary);\r\n --_mono-chip-c-foreground: var(--_mono-chip-primary-foreground);\r\n\r\n /* ── md metrics live on the unqualified root ON PURPOSE ────────────────────\r\n basecoat@1.0.2 styles/vega.css .badge — h-5 gap-1 rounded-4xl border\r\n border-transparent px-2 py-0.5 text-xs font-medium, [&>svg]:size-3 */\r\n --_mono-chip-height: var(--mono-chip-height, var(--_mono-chip-height-preset, var(--mono-chip-height-md, calc(var(--mono-spacing) * 5))));\r\n --_mono-chip-padding-x: var(--mono-chip-padding-x, var(--_mono-chip-padding-x-preset, var(--mono-chip-padding-x-md, calc(var(--mono-spacing) * 2))));\r\n --_mono-chip-gap: var(--mono-chip-gap, var(--_mono-chip-gap-preset, var(--mono-chip-gap-md, var(--mono-spacing))));\r\n --_mono-chip-font-size: var(--mono-chip-font-size, var(--_mono-chip-font-size-preset, var(--mono-chip-font-size-md, var(--mono-text-xs))));\r\n --_mono-chip-glyph-size: var(--mono-chip-glyph-size, var(--_mono-chip-glyph-size-preset, var(--mono-chip-glyph-size-md, calc(var(--mono-spacing) * 3))));\r\n /* `rounded-4xl` is the pill; a `rounded` step writes the preset tier, and an\r\n explicit --mono-chip-radius still wins over the prop */\r\n --_mono-chip-radius: var(--mono-chip-radius, var(--_mono-chip-radius-preset, var(--mono-radius-4xl)));\r\n --_mono-chip-border-width: var(--mono-chip-border-width, var(--mono-border-width));\r\n --_mono-chip-font-weight: var(--mono-chip-font-weight, var(--mono-font-weight-medium));\r\n\r\n --_mono-chip-ring-color: var(--mono-chip-ring-color, var(--ring));\r\n --_mono-chip-ring-width: var(--mono-chip-ring-width, var(--mono-ring-width));\r\n --_mono-chip-ring-alpha: var(--mono-chip-ring-alpha, var(--mono-ring-alpha));\r\n\r\n display: inline-flex;\r\n align-items: center;\r\n max-width: 100%;\r\n vertical-align: middle;\r\n line-height: 1;\r\n}\r\n\r\n/* =========================================\r\n The badge box — `.badge`\r\n ========================================= */\r\n\r\n/* basecoat@1.0.2 components/badge.css .badge — inline-flex w-fit shrink-0\r\n items-center justify-center overflow-hidden whitespace-nowrap\r\n [&>svg]:pointer-events-none */\r\n:where([mono-chip]) [mono-main] {\r\n display: inline-flex;\r\n width: fit-content;\r\n max-width: 100%;\r\n flex-shrink: 0;\r\n align-items: center;\r\n justify-content: center;\r\n overflow: hidden;\r\n white-space: nowrap;\r\n box-sizing: border-box;\r\n height: var(--_mono-chip-height);\r\n gap: var(--_mono-chip-gap);\r\n padding-inline: var(--_mono-chip-padding-x);\r\n border: var(--_mono-chip-border-width) solid transparent;\r\n border-radius: var(--_mono-chip-radius);\r\n font-family: inherit;\r\n font-size: var(--_mono-chip-font-size);\r\n font-weight: var(--_mono-chip-font-weight);\r\n letter-spacing: var(--mono-chip-letter-spacing, normal);\r\n text-transform: var(--mono-chip-text-transform, none);\r\n line-height: 1;\r\n text-decoration: none;\r\n user-select: none;\r\n vertical-align: middle;\r\n /* `transition-all`, narrowed to what a chip actually animates */\r\n transition:\r\n color var(--mono-duration) var(--mono-ease),\r\n background-color var(--mono-duration) var(--mono-ease),\r\n border-color var(--mono-duration) var(--mono-ease),\r\n box-shadow var(--mono-duration) var(--mono-ease),\r\n opacity var(--mono-duration) var(--mono-ease);\r\n box-shadow: var(--_mono-chip-ring, 0 0 #0000);\r\n}\r\n\r\n/* A LINK chip is a control, not prose. Host stylesheets routinely paint a bare\r\n `a` — VitePress's own `.vp-doc a` sets a weight and an underline at (0,1,1) —\r\n and that out-specifies the (0,1,0) part rule above, so the anchor form\r\n restates what such a rule hijacks, one attribute heavier. Measured: the docs'\r\n light link chip came out at weight 500 while the shadow one, beyond that\r\n sheet's reach, kept the component's own 600. The colour needs no restatement:\r\n every variant rule is already (0,2,0).\r\n\r\n DEVIATION from the specificity contract, for this form only — a `cssClass.main`\r\n utility that sets font-weight or text-decoration on a LINK chip now needs\r\n `!important` (or the `--mono-chip-font-weight` knob). */\r\n[mono-chip] a[mono-main] {\r\n font-weight: var(--_mono-chip-font-weight);\r\n text-decoration: none;\r\n}\r\n\r\n/* basecoat@1.0.2 components/badge.css .badge — focus-visible:border-ring\r\n focus-visible:ring-[3px] focus-visible:ring-ring/50 */\r\n:where([mono-chip]) [mono-main]:focus-visible {\r\n outline: none;\r\n border-color: var(--_mono-chip-ring-color);\r\n --_mono-chip-ring: 0 0 0 var(--_mono-chip-ring-width)\r\n color-mix(in oklab, var(--_mono-chip-ring-color) var(--_mono-chip-ring-alpha), transparent);\r\n}\r\n\r\n/* =========================================\r\n Sizes — EXTENSION: Basecoat ships ONE badge; md is its `.badge`\r\n ========================================= */\r\n\r\n/* The ladder steps the same way the control heights do: 4px of box and one type\r\n step per size, with md pinned to vega's h-5 / px-2 / text-xs. */\r\n[mono-chip][mono-size=\"xs\"] {\r\n --_mono-chip-height-preset: var(--mono-chip-height-xs, calc(var(--mono-spacing) * 4));\r\n --_mono-chip-padding-x-preset: var(--mono-chip-padding-x-xs, calc(var(--mono-spacing) * 1.5));\r\n --_mono-chip-gap-preset: var(--mono-chip-gap-xs, calc(var(--mono-spacing) * 0.75));\r\n --_mono-chip-font-size-preset: var(--mono-chip-font-size-xs, var(--mono-text-xs));\r\n --_mono-chip-glyph-size-preset: var(--mono-chip-glyph-size-xs, calc(var(--mono-spacing) * 2.5));\r\n}\r\n\r\n[mono-chip][mono-size=\"sm\"] {\r\n --_mono-chip-height-preset: var(--mono-chip-height-sm, calc(var(--mono-spacing) * 4.5));\r\n --_mono-chip-padding-x-preset: var(--mono-chip-padding-x-sm, calc(var(--mono-spacing) * 1.75));\r\n --_mono-chip-gap-preset: var(--mono-chip-gap-sm, calc(var(--mono-spacing) * 0.875));\r\n --_mono-chip-font-size-preset: var(--mono-chip-font-size-sm, var(--mono-text-xs));\r\n --_mono-chip-glyph-size-preset: var(--mono-chip-glyph-size-sm, calc(var(--mono-spacing) * 2.75));\r\n}\r\n\r\n[mono-chip][mono-size=\"lg\"] {\r\n --_mono-chip-height-preset: var(--mono-chip-height-lg, calc(var(--mono-spacing) * 6));\r\n --_mono-chip-padding-x-preset: var(--mono-chip-padding-x-lg, calc(var(--mono-spacing) * 2.5));\r\n --_mono-chip-gap-preset: var(--mono-chip-gap-lg, calc(var(--mono-spacing) * 1.25));\r\n --_mono-chip-font-size-preset: var(--mono-chip-font-size-lg, var(--mono-text-sm));\r\n --_mono-chip-glyph-size-preset: var(--mono-chip-glyph-size-lg, calc(var(--mono-spacing) * 3.5));\r\n}\r\n\r\n[mono-chip][mono-size=\"xl\"] {\r\n --_mono-chip-height-preset: var(--mono-chip-height-xl, calc(var(--mono-spacing) * 7));\r\n --_mono-chip-padding-x-preset: var(--mono-chip-padding-x-xl, calc(var(--mono-spacing) * 3));\r\n --_mono-chip-gap-preset: var(--mono-chip-gap-xl, calc(var(--mono-spacing) * 1.5));\r\n --_mono-chip-font-size-preset: var(--mono-chip-font-size-xl, var(--mono-text-sm));\r\n --_mono-chip-glyph-size-preset: var(--mono-chip-glyph-size-xl, calc(var(--mono-spacing) * 4));\r\n}\r\n\r\n[mono-chip][mono-size=\"xxl\"] {\r\n --_mono-chip-height-preset: var(--mono-chip-height-xxl, calc(var(--mono-spacing) * 8));\r\n --_mono-chip-padding-x-preset: var(--mono-chip-padding-x-xxl, calc(var(--mono-spacing) * 3.5));\r\n --_mono-chip-gap-preset: var(--mono-chip-gap-xxl, calc(var(--mono-spacing) * 1.75));\r\n --_mono-chip-font-size-preset: var(--mono-chip-font-size-xxl, var(--mono-text-base));\r\n --_mono-chip-glyph-size-preset: var(--mono-chip-glyph-size-xxl, calc(var(--mono-spacing) * 4.5));\r\n}\r\n\r\n/* =========================================\r\n Rounded — EXTENSION: the shared corner ladder. Unset is vega's rounded-4xl.\r\n ========================================= */\r\n\r\n[mono-chip][mono-rounded=\"none\"] { --_mono-chip-radius-preset: 0; }\r\n[mono-chip][mono-rounded=\"xs\"] { --_mono-chip-radius-preset: calc(var(--mono-radius-sm) / 2); }\r\n[mono-chip][mono-rounded=\"sm\"] { --_mono-chip-radius-preset: var(--mono-radius-sm); }\r\n[mono-chip][mono-rounded=\"md\"] { --_mono-chip-radius-preset: var(--mono-radius-md); }\r\n[mono-chip][mono-rounded=\"lg\"] { --_mono-chip-radius-preset: var(--mono-radius-lg); }\r\n[mono-chip][mono-rounded=\"xl\"] { --_mono-chip-radius-preset: var(--mono-radius-xl); }\r\n[mono-chip][mono-rounded=\"xxl\"] { --_mono-chip-radius-preset: var(--mono-radius-2xl); }\r\n[mono-chip][mono-rounded=\"full\"] { --_mono-chip-radius-preset: var(--mono-radius-full); }\r\n\r\n/* =========================================\r\n Colours — each publishes the pair the variants read\r\n ========================================= */\r\n\r\n[mono-chip][mono-color=\"primary\"] {\r\n --_mono-chip-c: var(--_mono-chip-primary);\r\n --_mono-chip-c-foreground: var(--_mono-chip-primary-foreground);\r\n}\r\n\r\n/* basecoat@1.0.2 styles/vega.css .badge[data-variant='secondary'] —\r\n bg-secondary text-secondary-foreground: a SURFACE pair, not a hue, so its\r\n `soft` and `solid` land on the same muted plate (shadcn's meaning). */\r\n[mono-chip][mono-color=\"secondary\"] {\r\n --_mono-chip-c: var(--_mono-chip-secondary);\r\n --_mono-chip-c-foreground: var(--_mono-chip-secondary-foreground);\r\n}\r\n\r\n[mono-chip][mono-color=\"success\"] {\r\n --_mono-chip-c: var(--_mono-chip-success);\r\n --_mono-chip-c-foreground: var(--_mono-chip-success-foreground);\r\n}\r\n\r\n[mono-chip][mono-color=\"danger\"] {\r\n --_mono-chip-c: var(--_mono-chip-danger);\r\n --_mono-chip-c-foreground: var(--_mono-chip-danger-foreground);\r\n}\r\n\r\n[mono-chip][mono-color=\"warning\"] {\r\n --_mono-chip-c: var(--_mono-chip-warning);\r\n --_mono-chip-c-foreground: var(--_mono-chip-warning-foreground);\r\n}\r\n\r\n[mono-chip][mono-color=\"info\"] {\r\n --_mono-chip-c: var(--_mono-chip-info);\r\n --_mono-chip-c-foreground: var(--_mono-chip-info-foreground);\r\n}\r\n\r\n[mono-chip][mono-color=\"teal\"] {\r\n --_mono-chip-c: var(--_mono-chip-teal);\r\n --_mono-chip-c-foreground: var(--_mono-chip-teal-foreground);\r\n}\r\n\r\n[mono-chip][mono-color=\"purple\"] {\r\n --_mono-chip-c: var(--_mono-chip-purple);\r\n --_mono-chip-c-foreground: var(--_mono-chip-purple-foreground);\r\n}\r\n\r\n[mono-chip][mono-color=\"neutral\"] {\r\n --_mono-chip-c: var(--_mono-chip-neutral);\r\n --_mono-chip-c-foreground: var(--_mono-chip-neutral-foreground);\r\n}\r\n\r\n[mono-chip][mono-color=\"dark\"] {\r\n --_mono-chip-c: var(--_mono-chip-dark);\r\n --_mono-chip-c-foreground: var(--_mono-chip-dark-foreground);\r\n}\r\n\r\n/* =========================================\r\n Variants\r\n ========================================= */\r\n\r\n/* `soft` is the DEFAULT and is Basecoat's tonal badge.\r\n basecoat@1.0.2 styles/vega.css .badge[data-variant='destructive'] —\r\n bg-destructive/10 text-destructive dark:bg-destructive/20 (the alpha pair\r\n travels as --mono-mode-tint, which is what makes it dark-mode correct). */\r\n[mono-chip]:is(:not([mono-variant]), [mono-variant=\"soft\"]) > [mono-main] {\r\n background-color: var(--mono-chip-bg, var(--mono-chip-soft-bg, color-mix(in oklab, var(--_mono-chip-c) var(--mono-mode-tint), transparent)));\r\n color: var(--mono-chip-color, var(--mono-chip-soft-color, var(--_mono-chip-c)));\r\n border-color: var(--mono-chip-border-color, var(--mono-chip-soft-border-color, transparent));\r\n}\r\n\r\n/* `secondary` is a surface, not a hue: tinting it would wash it out, so the\r\n soft chip wears the plate itself (`.badge[data-variant='secondary']`). */\r\n[mono-chip][mono-color=\"secondary\"]:is(:not([mono-variant]), [mono-variant=\"soft\"]) > [mono-main] {\r\n background-color: var(--mono-chip-bg, var(--mono-chip-soft-bg, var(--_mono-chip-secondary)));\r\n color: var(--mono-chip-color, var(--mono-chip-soft-color, var(--_mono-chip-secondary-foreground)));\r\n}\r\n\r\n/* basecoat@1.0.2 styles/vega.css .badge:not([data-variant]), .badge[data-variant='primary']\r\n — bg-primary text-primary-foreground */\r\n[mono-chip][mono-variant=\"solid\"] > [mono-main] {\r\n background-color: var(--mono-chip-bg, var(--mono-chip-solid-bg, var(--_mono-chip-c)));\r\n color: var(--mono-chip-color, var(--mono-chip-solid-color, var(--_mono-chip-c-foreground)));\r\n border-color: var(--mono-chip-border-color, var(--mono-chip-solid-border-color, transparent));\r\n}\r\n\r\n/* basecoat@1.0.2 styles/vega.css .badge[data-variant='outline'] — border-border\r\n text-foreground — EXTENSION: the edge and the ink take the role's colour so\r\n `outline` reads as the same family as the other two. */\r\n[mono-chip][mono-variant=\"outline\"] > [mono-main] {\r\n background-color: var(--mono-chip-bg, var(--mono-chip-outline-bg, transparent));\r\n color: var(--mono-chip-color, var(--mono-chip-outline-color, var(--_mono-chip-c)));\r\n border-color: var(--mono-chip-border-color, var(--mono-chip-outline-border-color, var(--_mono-chip-c)));\r\n}\r\n\r\n[mono-chip][mono-color=\"secondary\"][mono-variant=\"outline\"] > [mono-main] {\r\n color: var(--mono-chip-color, var(--foreground));\r\n border-color: var(--mono-chip-border-color, var(--border));\r\n}\r\n\r\n/* =========================================\r\n Interactive — a clickable / linked chip\r\n ========================================= */\r\n\r\n/* basecoat@1.0.2 styles/vega.css .badge:not([data-variant]), .badge[data-variant='primary']\r\n — [a]:hover:bg-primary/80: only a LINK badge reacts upstream; ours also\r\n reacts when `clickable` made it a button (same gesture, no href). */\r\n[mono-chip][mono-clickable] > [mono-main] {\r\n cursor: pointer;\r\n}\r\n\r\n@media (hover: hover) {\r\n [mono-chip][mono-clickable]:not([mono-disabled])[mono-variant=\"solid\"] > [mono-main]:hover {\r\n background-color: color-mix(in oklab, var(--_mono-chip-c) 80%, transparent);\r\n }\r\n\r\n /* .badge[data-variant='destructive'] — [a]:hover:bg-destructive/20 */\r\n [mono-chip][mono-clickable]:not([mono-disabled]):is(:not([mono-variant]), [mono-variant=\"soft\"]) > [mono-main]:hover {\r\n background-color: color-mix(in oklab, var(--_mono-chip-c) var(--mono-mode-tint-hover), transparent);\r\n }\r\n\r\n /* `secondary` is a plate, not a tint: darken it the way the secondary button\r\n does (basecoat@1.0.2 styles/vega.css .btn[data-variant='secondary']). */\r\n [mono-chip][mono-clickable]:not([mono-disabled])[mono-color=\"secondary\"]:is(:not([mono-variant]), [mono-variant=\"soft\"]) > [mono-main]:hover {\r\n background-color: color-mix(in oklch, var(--_mono-chip-secondary), var(--foreground) 5%);\r\n }\r\n\r\n /* .badge[data-variant='outline'] — [a]:hover:bg-muted */\r\n [mono-chip][mono-clickable]:not([mono-disabled])[mono-variant=\"outline\"] > [mono-main]:hover {\r\n background-color: var(--mono-mode-ghost-hover);\r\n }\r\n}\r\n\r\n/* EXTENSION — `selected` rings the chip in its own colour, the one state\r\n Basecoat's badge has no equivalent for (it is not a toggle upstream). */\r\n[mono-chip][mono-selected] > [mono-main] {\r\n --_mono-chip-ring: 0 0 0 var(--_mono-chip-ring-width)\r\n color-mix(in oklab, var(--_mono-chip-c) var(--_mono-chip-ring-alpha), transparent);\r\n border-color: var(--_mono-chip-c);\r\n}\r\n\r\n/* basecoat@1.0.2 components/button.css .btn — disabled:pointer-events-none\r\n disabled:opacity-50 */\r\n[mono-chip][mono-disabled] > [mono-main] {\r\n opacity: 0.5;\r\n cursor: not-allowed;\r\n pointer-events: none;\r\n}\r\n\r\n/* =========================================\r\n Inner content\r\n ========================================= */\r\n\r\n:where([mono-chip]) [mono-content] {\r\n display: inline-flex;\r\n align-items: center;\r\n justify-content: center;\r\n gap: inherit;\r\n min-width: 0;\r\n max-width: 100%;\r\n height: 100%;\r\n line-height: 1;\r\n}\r\n\r\n:where([mono-chip]) [mono-label] {\r\n display: inline-flex;\r\n align-items: center;\r\n justify-content: center;\r\n min-width: 0;\r\n max-width: 100%;\r\n overflow: hidden;\r\n text-overflow: ellipsis;\r\n line-height: 1;\r\n}\r\n\r\n/* EXTENSION — the leading status dot. It is the role's colour at full strength,\r\n which reads on both the tinted `soft` plate and the solid one (`currentColor`\r\n there). */\r\n:where([mono-chip]) [mono-dot] {\r\n flex: 0 0 auto;\r\n width: var(--mono-chip-dot-size, calc(var(--mono-spacing) * 1.5));\r\n height: var(--mono-chip-dot-size, calc(var(--mono-spacing) * 1.5));\r\n border-radius: var(--mono-radius-full);\r\n background: currentColor;\r\n}\r\n\r\n/* The shadow build renders the icon wrapper on every chip and marks the empty\r\n one; this hides it so both builds measure the same content box. */\r\n[mono-chip] [data-mono-slot=\"icon\"][mono-empty] {\r\n display: none;\r\n}\r\n\r\n/* `[&>svg]:size-3!` — our icon is a slotted element or a mask span, sized by\r\n the same token as the close glyph */\r\n:where([mono-chip]) [data-mono-slot=\"icon\"],\r\n:where([mono-chip]) [mono-main] > svg {\r\n display: inline-flex;\r\n flex: 0 0 auto;\r\n align-items: center;\r\n justify-content: center;\r\n width: var(--_mono-chip-glyph-size);\r\n height: var(--_mono-chip-glyph-size);\r\n line-height: 1;\r\n pointer-events: none;\r\n}\r\n\r\n:where([mono-chip]) [data-mono-slot=\"icon\"] > * {\r\n display: block;\r\n width: 100%;\r\n height: 100%;\r\n}\r\n\r\n/* basecoat@1.0.2 styles/vega.css .combobox-chip-remove — -ms-1 opacity-50\r\n hover:opacity-100, [&>svg]:size-3.5 — the same affordance a field chip uses */\r\n:where([mono-chip]) [mono-close] {\r\n appearance: none;\r\n display: inline-flex;\r\n flex: 0 0 auto;\r\n align-items: center;\r\n justify-content: center;\r\n width: var(--_mono-chip-glyph-size);\r\n height: var(--_mono-chip-glyph-size);\r\n margin: 0;\r\n padding: 0;\r\n border: 0;\r\n border-radius: var(--mono-radius-full);\r\n background: transparent;\r\n color: inherit;\r\n font: inherit;\r\n line-height: 1;\r\n cursor: pointer;\r\n opacity: 0.5;\r\n transition:\r\n opacity var(--mono-duration) var(--mono-ease),\r\n box-shadow var(--mono-duration) var(--mono-ease);\r\n box-shadow: var(--_mono-chip-close-ring, 0 0 #0000);\r\n}\r\n\r\n@media (hover: hover) {\r\n :where([mono-chip]) [mono-close]:hover {\r\n opacity: 1;\r\n }\r\n}\r\n\r\n:where([mono-chip]) [mono-close]:focus-visible {\r\n outline: none;\r\n opacity: 1;\r\n --_mono-chip-close-ring: 0 0 0 var(--_mono-chip-ring-width)\r\n color-mix(in oklab, currentColor var(--_mono-chip-ring-alpha), transparent);\r\n}\r\n\r\n:where([mono-chip]) [mono-close] :is([mono-glyph], svg) {\r\n display: block;\r\n width: 100%;\r\n height: 100%;\r\n flex-shrink: 0;\r\n}\r\n\r\n:where([mono-chip]) [mono-close] [mono-glyph] > svg {\r\n width: 100%;\r\n height: 100%;\r\n}\r\n\r\n/* =========================================\r\n Status dot — EXTENSION: `<mono-status-dot>`, a label with a state dot\r\n ========================================= */\r\n\r\nmono-status-dot {\r\n display: inline-block;\r\n}\r\n\r\n[mono-status-dot] {\r\n --_mono-status-dot-c: var(--mono-status-dot-color, var(--success));\r\n display: inline-flex;\r\n align-items: center;\r\n gap: var(--mono-status-dot-gap, calc(var(--mono-spacing) * 1.5));\r\n font-family: inherit;\r\n font-size: var(--mono-status-dot-font-size, var(--mono-text-xs));\r\n font-weight: var(--mono-status-dot-font-weight, var(--mono-font-weight-medium));\r\n line-height: 1;\r\n color: var(--_mono-status-dot-c);\r\n}\r\n\r\n[mono-status-dot][mono-status=\"offline\"] { --_mono-status-dot-c: var(--mono-status-dot-color, var(--neutral)); }\r\n[mono-status-dot][mono-status=\"busy\"] { --_mono-status-dot-c: var(--mono-status-dot-color, var(--destructive)); }\r\n[mono-status-dot][mono-status=\"away\"] { --_mono-status-dot-c: var(--mono-status-dot-color, var(--warning)); }\r\n/* `custom` takes the colour from the `color` prop, which the element writes\r\n inline as --mono-status-dot-color */\r\n[mono-status-dot][mono-status=\"custom\"] { --_mono-status-dot-c: var(--mono-status-dot-color, var(--primary)); }\r\n\r\n:where([mono-status-dot]) [mono-dot] {\r\n flex: 0 0 auto;\r\n width: var(--mono-status-dot-size, calc(var(--mono-spacing) * 2));\r\n height: var(--mono-status-dot-size, calc(var(--mono-spacing) * 2));\r\n border-radius: var(--mono-radius-full);\r\n background: currentColor;\r\n}\r\n\r\n[mono-status-dot][mono-pulse] [mono-dot] {\r\n animation: mono-status-pulse 1.8s var(--mono-ease) infinite;\r\n}\r\n\r\n@keyframes mono-status-pulse {\r\n 0%,\r\n 100% {\r\n box-shadow: 0 0 0 0 color-mix(in oklab, currentColor 40%, transparent);\r\n }\r\n\r\n 50% {\r\n box-shadow: 0 0 0 5px color-mix(in oklab, currentColor 0%, transparent);\r\n }\r\n}\r\n\r\n@media (prefers-reduced-motion: reduce) {\r\n :where([mono-chip]) :is([mono-main], [mono-close]) {\r\n transition: none;\r\n }\r\n\r\n [mono-status-dot][mono-pulse] [mono-dot] {\r\n animation: none;\r\n }\r\n}\r\n";
|
|
429
|
-
|
|
430
|
-
//#endregion
|
|
431
|
-
//#region src/components/chip/mono-status-dot.ts
|
|
432
|
-
/**
|
|
433
|
-
* `mono-status-dot` — a small status indicator. Already a real shadow-DOM
|
|
434
|
-
* LitElement (default render root + `static styles`, native `<slot>`), so it is
|
|
435
|
-
* SSR-compatible as-is and shared verbatim by BOTH the light (`@mono-lit/helper/ui/chip`)
|
|
436
|
-
* and shadow (`@mono-lit/helper/ui/shadow/chip`) chip builds. It lives in its own
|
|
437
|
-
* module so the shadow chip build can register it WITHOUT importing the light
|
|
438
|
-
* `mono-chip` (which would collide with the shadow `mono-chip` class).
|
|
439
|
-
*
|
|
440
|
-
* It keeps the SAME `mono-status-dot` tag in both builds (it has no light/shadow
|
|
441
|
-
* variant — it is always a shadow-DOM element), so its registration is guarded
|
|
442
|
-
* (see bottom of file): whichever chip build loads first wins, and a page that
|
|
443
|
-
* loads both light + shadow chip won't throw a "already defined" registry error.
|
|
444
|
-
*/
|
|
445
|
-
var MonoStatusDot = class extends LitElement {
|
|
446
|
-
static {
|
|
447
|
-
this.styles = [unsafeCSS(chip_css_raw_default)];
|
|
448
|
-
}
|
|
449
|
-
constructor() {
|
|
450
|
-
super();
|
|
451
|
-
this.state = "online";
|
|
452
|
-
this.pulse = false;
|
|
453
|
-
this.label = void 0;
|
|
454
|
-
this.color = void 0;
|
|
455
|
-
}
|
|
456
|
-
get _statusClasses() {
|
|
457
|
-
const classes = ["mono-status-dot", `sd-${this.state}`];
|
|
458
|
-
if (this.pulse) classes.push("pulse");
|
|
459
|
-
return classes.join(" ");
|
|
460
|
-
}
|
|
461
|
-
get _statusStyle() {
|
|
462
|
-
if (!this.color) return void 0;
|
|
463
|
-
return `--mono-status-dot-color:${this.color};`;
|
|
464
|
-
}
|
|
465
|
-
render() {
|
|
466
|
-
return html`
|
|
467
|
-
<span
|
|
468
|
-
class=${this._statusClasses}
|
|
469
|
-
mono-status-dot
|
|
470
|
-
mono-status=${this.state === "online" ? nothing : this.state}
|
|
471
|
-
?mono-pulse=${this.pulse}
|
|
472
|
-
style=${ifDefined(this._statusStyle)}
|
|
473
|
-
role="status"
|
|
474
|
-
aria-label=${ifDefined(this.label)}
|
|
475
|
-
>
|
|
476
|
-
<span class="sd-dot" mono-dot aria-hidden="true"></span>
|
|
477
|
-
<span class="sd-label">
|
|
478
|
-
${when(Boolean(this.label), () => this.label, () => html`<slot></slot>`)}
|
|
479
|
-
</span>
|
|
480
|
-
</span>
|
|
481
|
-
`;
|
|
482
|
-
}
|
|
483
|
-
focus() {
|
|
484
|
-
this._statusElement?.focus();
|
|
485
|
-
}
|
|
486
|
-
blur() {
|
|
487
|
-
this._statusElement?.blur();
|
|
488
|
-
}
|
|
489
|
-
};
|
|
490
|
-
__decorate([property({ type: String })], MonoStatusDot.prototype, "state", void 0);
|
|
491
|
-
__decorate([property({
|
|
492
|
-
reflect: true,
|
|
493
|
-
converter: booleanStringConverter
|
|
494
|
-
})], MonoStatusDot.prototype, "pulse", void 0);
|
|
495
|
-
__decorate([property({ type: String })], MonoStatusDot.prototype, "label", void 0);
|
|
496
|
-
__decorate([property({ type: String })], MonoStatusDot.prototype, "color", void 0);
|
|
497
|
-
__decorate([query("span")], MonoStatusDot.prototype, "_statusElement", void 0);
|
|
498
|
-
defineMonoElement("mono-status-dot", MonoStatusDot);
|
|
499
|
-
|
|
500
|
-
//#endregion
|
|
501
|
-
//#region src/components/chip/chip-utils.ts
|
|
502
|
-
function generateChipRootClasses(props) {
|
|
503
|
-
const classes = ["mono-chip"];
|
|
504
|
-
classes.push(props.size ?? "md");
|
|
505
|
-
if (props.rounded) classes.push(`rounded-${props.rounded}`);
|
|
506
|
-
const variant = props.variant ?? "soft";
|
|
507
|
-
const color = props.color ?? "primary";
|
|
508
|
-
classes.push(`${variant}-${color}`);
|
|
509
|
-
if (props.clickable) classes.push("clickable");
|
|
510
|
-
if (props.removable) classes.push("removable");
|
|
511
|
-
if (props.disabled) classes.push("disabled");
|
|
512
|
-
if (props.selected) classes.push("selected");
|
|
513
|
-
if (props.dot) classes.push("has-dot");
|
|
514
|
-
return classes.join(" ");
|
|
515
|
-
}
|
|
516
|
-
function isInteractive(props) {
|
|
517
|
-
return Boolean(!props.disabled && (props.clickable || props.href || props.removable));
|
|
518
|
-
}
|
|
519
|
-
function validateChipProps(props) {
|
|
520
|
-
const validSizes = [
|
|
521
|
-
"xs",
|
|
522
|
-
"sm",
|
|
523
|
-
"md",
|
|
524
|
-
"lg",
|
|
525
|
-
"xl",
|
|
526
|
-
"xxl"
|
|
527
|
-
];
|
|
528
|
-
const validColors = [
|
|
529
|
-
"primary",
|
|
530
|
-
"success",
|
|
531
|
-
"danger",
|
|
532
|
-
"warning",
|
|
533
|
-
"info",
|
|
534
|
-
"teal",
|
|
535
|
-
"purple",
|
|
536
|
-
"neutral",
|
|
537
|
-
"dark"
|
|
538
|
-
];
|
|
539
|
-
const validVariants = [
|
|
540
|
-
"soft",
|
|
541
|
-
"solid",
|
|
542
|
-
"outline"
|
|
543
|
-
];
|
|
544
|
-
const validRounded = [
|
|
545
|
-
"none",
|
|
546
|
-
"xs",
|
|
547
|
-
"sm",
|
|
548
|
-
"md",
|
|
549
|
-
"lg",
|
|
550
|
-
"xl",
|
|
551
|
-
"xxl",
|
|
552
|
-
"full"
|
|
553
|
-
];
|
|
554
|
-
if (props.size && !validSizes.includes(props.size)) return false;
|
|
555
|
-
if (props.color && !validColors.includes(props.color)) return false;
|
|
556
|
-
if (props.variant && !validVariants.includes(props.variant)) return false;
|
|
557
|
-
if (props.rounded && !validRounded.includes(props.rounded)) return false;
|
|
558
|
-
return true;
|
|
559
|
-
}
|
|
560
|
-
|
|
561
163
|
//#endregion
|
|
562
164
|
export { MonoChip, MonoStatusDot, generateChipRootClasses, isInteractive, validateChipProps };
|