@waggylabs/yumekit 0.2.1 → 0.2.2
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/components/y-appbar.d.ts +21 -0
- package/dist/components/y-appbar.js +310 -22
- package/dist/components/y-badge.d.ts +5 -0
- package/dist/components/y-badge.js +5 -0
- package/dist/components/y-button.d.ts +6 -1
- package/dist/components/y-button.js +5 -0
- package/dist/components/y-checkbox.d.ts +7 -1
- package/dist/components/y-checkbox.js +6 -0
- package/dist/components/y-dialog.d.ts +7 -0
- package/dist/components/y-dialog.js +14 -24
- package/dist/components/y-drawer.js +1 -2
- package/dist/components/y-icon.d.ts +5 -0
- package/dist/components/y-icon.js +16 -8
- package/dist/components/y-input.d.ts +5 -0
- package/dist/components/y-input.js +6 -0
- package/dist/components/y-menu.d.ts +1 -0
- package/dist/components/y-menu.js +28 -1
- package/dist/components/y-panel.d.ts +10 -1
- package/dist/components/y-panel.js +21 -0
- package/dist/components/y-progress.d.ts +11 -0
- package/dist/components/y-progress.js +14 -0
- package/dist/components/y-radio.d.ts +11 -2
- package/dist/components/y-radio.js +3 -0
- package/dist/components/y-select.d.ts +19 -5
- package/dist/components/y-select.js +19 -0
- package/dist/components/y-slider.d.ts +11 -2
- package/dist/components/y-slider.js +10 -0
- package/dist/components/y-switch.d.ts +3 -0
- package/dist/components/y-switch.js +8 -2
- package/dist/components/y-table.d.ts +3 -0
- package/dist/components/y-table.js +4 -1
- package/dist/components/y-tabs.d.ts +14 -7
- package/dist/components/y-tabs.js +9 -0
- package/dist/components/y-theme.d.ts +6 -1
- package/dist/components/y-theme.js +11 -4
- package/dist/components/y-toast.d.ts +4 -0
- package/dist/components/y-toast.js +7 -0
- package/dist/components/y-tooltip.d.ts +6 -0
- package/dist/components/y-tooltip.js +8 -0
- package/dist/icons/all.js +3 -0
- package/dist/icons/index.d.ts +1 -0
- package/dist/index.js +459 -55
- package/dist/styles/variables.css +7 -4
- package/dist/yumekit.min.js +1 -1
- package/package.json +1 -1
|
@@ -34,6 +34,7 @@ class YumeProgress extends HTMLElement {
|
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
+
/** Current progress value, or null if unset. */
|
|
37
38
|
get value() {
|
|
38
39
|
const val = parseFloat(this.getAttribute("value"));
|
|
39
40
|
return Number.isNaN(val) ? null : val;
|
|
@@ -47,6 +48,7 @@ class YumeProgress extends HTMLElement {
|
|
|
47
48
|
}
|
|
48
49
|
}
|
|
49
50
|
|
|
51
|
+
/** Minimum value (default 0). */
|
|
50
52
|
get min() {
|
|
51
53
|
return parseFloat(this.getAttribute("min")) || 0;
|
|
52
54
|
}
|
|
@@ -55,6 +57,7 @@ class YumeProgress extends HTMLElement {
|
|
|
55
57
|
this.setAttribute("min", String(val));
|
|
56
58
|
}
|
|
57
59
|
|
|
60
|
+
/** Maximum value (default 100). */
|
|
58
61
|
get max() {
|
|
59
62
|
return parseFloat(this.getAttribute("max")) || 100;
|
|
60
63
|
}
|
|
@@ -63,6 +66,7 @@ class YumeProgress extends HTMLElement {
|
|
|
63
66
|
this.setAttribute("max", String(val));
|
|
64
67
|
}
|
|
65
68
|
|
|
69
|
+
/** Step increment for snapping, or null if continuous. */
|
|
66
70
|
get step() {
|
|
67
71
|
const s = parseFloat(this.getAttribute("step"));
|
|
68
72
|
return Number.isNaN(s) || s <= 0 ? null : s;
|
|
@@ -76,6 +80,7 @@ class YumeProgress extends HTMLElement {
|
|
|
76
80
|
}
|
|
77
81
|
}
|
|
78
82
|
|
|
83
|
+
/** Bar thickness: "small" | "medium" | "large" (default "medium"). */
|
|
79
84
|
get size() {
|
|
80
85
|
return this.getAttribute("size") || "medium";
|
|
81
86
|
}
|
|
@@ -84,6 +89,7 @@ class YumeProgress extends HTMLElement {
|
|
|
84
89
|
this.setAttribute("size", val);
|
|
85
90
|
}
|
|
86
91
|
|
|
92
|
+
/** Color theme for the progress bar (default "primary"). */
|
|
87
93
|
get color() {
|
|
88
94
|
return this.getAttribute("color") || "primary";
|
|
89
95
|
}
|
|
@@ -92,6 +98,7 @@ class YumeProgress extends HTMLElement {
|
|
|
92
98
|
this.setAttribute("color", val);
|
|
93
99
|
}
|
|
94
100
|
|
|
101
|
+
/** Whether to show the value label on the bar (default true). */
|
|
95
102
|
get labelDisplay() {
|
|
96
103
|
return this.getAttribute("label-display") !== "false";
|
|
97
104
|
}
|
|
@@ -100,6 +107,7 @@ class YumeProgress extends HTMLElement {
|
|
|
100
107
|
this.setAttribute("label-display", val ? "true" : "false");
|
|
101
108
|
}
|
|
102
109
|
|
|
110
|
+
/** Label format: "percent" | "value" | "fraction" (default "percent"). */
|
|
103
111
|
get labelFormat() {
|
|
104
112
|
return this.getAttribute("label-format") || "percent";
|
|
105
113
|
}
|
|
@@ -108,6 +116,7 @@ class YumeProgress extends HTMLElement {
|
|
|
108
116
|
this.setAttribute("label-format", val);
|
|
109
117
|
}
|
|
110
118
|
|
|
119
|
+
/** Whether the progress bar shows an indeterminate animation. */
|
|
111
120
|
get indeterminate() {
|
|
112
121
|
return this.hasAttribute("indeterminate");
|
|
113
122
|
}
|
|
@@ -117,6 +126,7 @@ class YumeProgress extends HTMLElement {
|
|
|
117
126
|
else this.removeAttribute("indeterminate");
|
|
118
127
|
}
|
|
119
128
|
|
|
129
|
+
/** Whether the progress bar is disabled. */
|
|
120
130
|
get disabled() {
|
|
121
131
|
return this.hasAttribute("disabled");
|
|
122
132
|
}
|
|
@@ -144,6 +154,7 @@ class YumeProgress extends HTMLElement {
|
|
|
144
154
|
this.value = Math.max(this.value - s, this.min);
|
|
145
155
|
}
|
|
146
156
|
|
|
157
|
+
/** Computed fill percentage (0–100), accounting for min, max, and step. */
|
|
147
158
|
get percentage() {
|
|
148
159
|
if (this.value === null) return 0;
|
|
149
160
|
const range = this.max - this.min;
|
|
@@ -303,7 +314,9 @@ class YumeProgress extends HTMLElement {
|
|
|
303
314
|
_autoHideHeader() {
|
|
304
315
|
const header = this.shadowRoot.querySelector(".progress-header");
|
|
305
316
|
const slot = header?.querySelector("slot");
|
|
317
|
+
|
|
306
318
|
if (!slot || !header) return;
|
|
319
|
+
|
|
307
320
|
const update = () => {
|
|
308
321
|
const hasContent = slot
|
|
309
322
|
.assignedNodes({ flatten: true })
|
|
@@ -316,6 +329,7 @@ class YumeProgress extends HTMLElement {
|
|
|
316
329
|
);
|
|
317
330
|
header.style.display = hasContent ? "" : "none";
|
|
318
331
|
};
|
|
332
|
+
|
|
319
333
|
slot.addEventListener("slotchange", update);
|
|
320
334
|
update();
|
|
321
335
|
}
|
|
@@ -6,10 +6,19 @@ export class YumeRadio extends HTMLElement {
|
|
|
6
6
|
connectedCallback(): void;
|
|
7
7
|
attributeChangedCallback(name: any, oldVal: any, newVal: any): void;
|
|
8
8
|
set value(val: string);
|
|
9
|
+
/** @type {string} The currently selected radio value. */
|
|
9
10
|
get value(): string;
|
|
11
|
+
/** @type {string} The form name of the radio group. */
|
|
10
12
|
get name(): string;
|
|
11
|
-
set options(val:
|
|
12
|
-
|
|
13
|
+
set options(val: Array<{
|
|
14
|
+
value: string;
|
|
15
|
+
label: string;
|
|
16
|
+
}>);
|
|
17
|
+
/** @type {Array<{value: string, label: string}>} The radio options parsed from the "options" attribute. */
|
|
18
|
+
get options(): Array<{
|
|
19
|
+
value: string;
|
|
20
|
+
label: string;
|
|
21
|
+
}>;
|
|
13
22
|
updateChecked(): void;
|
|
14
23
|
handleKey(e: any, index: any, radios: any): void;
|
|
15
24
|
render(): void;
|
|
@@ -28,6 +28,7 @@ class YumeRadio extends HTMLElement {
|
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
+
/** @type {string} The currently selected radio value. */
|
|
31
32
|
get value() {
|
|
32
33
|
return this._value;
|
|
33
34
|
}
|
|
@@ -39,10 +40,12 @@ class YumeRadio extends HTMLElement {
|
|
|
39
40
|
this.updateChecked();
|
|
40
41
|
}
|
|
41
42
|
|
|
43
|
+
/** @type {string} The form name of the radio group. */
|
|
42
44
|
get name() {
|
|
43
45
|
return this.getAttribute("name") || "";
|
|
44
46
|
}
|
|
45
47
|
|
|
48
|
+
/** @type {Array<{value: string, label: string}>} The radio options parsed from the "options" attribute. */
|
|
46
49
|
get options() {
|
|
47
50
|
try {
|
|
48
51
|
return JSON.parse(this.getAttribute("options") || "[]");
|
|
@@ -7,13 +7,27 @@ export class YumeSelect extends HTMLElement {
|
|
|
7
7
|
connectedCallback(): void;
|
|
8
8
|
disconnectedCallback(): void;
|
|
9
9
|
attributeChangedCallback(name: any, oldValue: any, newValue: any): void;
|
|
10
|
-
set value(val:
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
10
|
+
set value(val: string);
|
|
11
|
+
/** @type {string} The current selected value, or comma-separated values when multiple. */
|
|
12
|
+
get value(): string;
|
|
13
|
+
_value: string;
|
|
14
|
+
/**
|
|
15
|
+
* Returns the parsed options array from the "options" attribute.
|
|
16
|
+
* @returns {Array<{value: string, label: string}>}
|
|
17
|
+
*/
|
|
18
|
+
getOptions(): Array<{
|
|
19
|
+
value: string;
|
|
20
|
+
label: string;
|
|
21
|
+
}>;
|
|
22
|
+
/**
|
|
23
|
+
* Returns the display text for the current selection.
|
|
24
|
+
* @returns {string}
|
|
25
|
+
*/
|
|
26
|
+
getDisplayText(): string;
|
|
27
|
+
/** Toggles the dropdown open or closed. */
|
|
15
28
|
toggleDropdown(): void;
|
|
16
29
|
_onScrollOrResize: any;
|
|
30
|
+
/** Closes the dropdown. */
|
|
17
31
|
closeDropdown(): void;
|
|
18
32
|
_positionDropdown(): void;
|
|
19
33
|
queryRefs(): void;
|
|
@@ -42,6 +42,7 @@ class YumeSelect extends HTMLElement {
|
|
|
42
42
|
if (!this.hasAttribute("label-position")) {
|
|
43
43
|
this.setAttribute("label-position", "top");
|
|
44
44
|
}
|
|
45
|
+
|
|
45
46
|
this.updateValidation();
|
|
46
47
|
this._internals.setFormValue(this.value);
|
|
47
48
|
}
|
|
@@ -52,7 +53,9 @@ class YumeSelect extends HTMLElement {
|
|
|
52
53
|
|
|
53
54
|
_onDocumentClick(e) {
|
|
54
55
|
if (this.getAttribute("close-on-click-outside") === "false") return;
|
|
56
|
+
|
|
55
57
|
const path = e.composedPath();
|
|
58
|
+
|
|
56
59
|
if (!path.includes(this) && this.dropdown?.classList.contains("open")) {
|
|
57
60
|
this.closeDropdown();
|
|
58
61
|
}
|
|
@@ -86,6 +89,7 @@ class YumeSelect extends HTMLElement {
|
|
|
86
89
|
}
|
|
87
90
|
}
|
|
88
91
|
|
|
92
|
+
/** @type {string} The current selected value, or comma-separated values when multiple. */
|
|
89
93
|
get value() {
|
|
90
94
|
if (this.hasAttribute("multiple")) {
|
|
91
95
|
return Array.from(this.selectedValues).join(",");
|
|
@@ -112,6 +116,10 @@ class YumeSelect extends HTMLElement {
|
|
|
112
116
|
this.updateSelectedStyles();
|
|
113
117
|
}
|
|
114
118
|
|
|
119
|
+
/**
|
|
120
|
+
* Returns the parsed options array from the "options" attribute.
|
|
121
|
+
* @returns {Array<{value: string, label: string}>}
|
|
122
|
+
*/
|
|
115
123
|
getOptions() {
|
|
116
124
|
try {
|
|
117
125
|
return JSON.parse(this.getAttribute("options") || "[]");
|
|
@@ -120,6 +128,10 @@ class YumeSelect extends HTMLElement {
|
|
|
120
128
|
}
|
|
121
129
|
}
|
|
122
130
|
|
|
131
|
+
/**
|
|
132
|
+
* Returns the display text for the current selection.
|
|
133
|
+
* @returns {string}
|
|
134
|
+
*/
|
|
123
135
|
getDisplayText() {
|
|
124
136
|
const options = this.getOptions();
|
|
125
137
|
const isMulti = this.hasAttribute("multiple");
|
|
@@ -146,6 +158,7 @@ class YumeSelect extends HTMLElement {
|
|
|
146
158
|
}
|
|
147
159
|
}
|
|
148
160
|
|
|
161
|
+
/** Toggles the dropdown open or closed. */
|
|
149
162
|
toggleDropdown() {
|
|
150
163
|
const isOpen = this.dropdown.classList.contains("open");
|
|
151
164
|
if (isOpen) {
|
|
@@ -155,16 +168,19 @@ class YumeSelect extends HTMLElement {
|
|
|
155
168
|
this.selectContainer.classList.add("open");
|
|
156
169
|
this._positionDropdown();
|
|
157
170
|
this._onScrollOrResize = this._positionDropdown.bind(this);
|
|
171
|
+
|
|
158
172
|
window.addEventListener("scroll", this._onScrollOrResize, true);
|
|
159
173
|
window.addEventListener("resize", this._onScrollOrResize);
|
|
160
174
|
document.addEventListener("click", this._onDocumentClick, true);
|
|
161
175
|
}
|
|
162
176
|
}
|
|
163
177
|
|
|
178
|
+
/** Closes the dropdown. */
|
|
164
179
|
closeDropdown() {
|
|
165
180
|
this.dropdown?.classList.remove("open");
|
|
166
181
|
this.selectContainer?.classList.remove("open");
|
|
167
182
|
document.removeEventListener("click", this._onDocumentClick, true);
|
|
183
|
+
|
|
168
184
|
if (this._onScrollOrResize) {
|
|
169
185
|
window.removeEventListener("scroll", this._onScrollOrResize, true);
|
|
170
186
|
window.removeEventListener("resize", this._onScrollOrResize);
|
|
@@ -175,11 +191,13 @@ class YumeSelect extends HTMLElement {
|
|
|
175
191
|
_positionDropdown() {
|
|
176
192
|
const rect = this.selectContainer.getBoundingClientRect();
|
|
177
193
|
const gap = 4;
|
|
194
|
+
|
|
178
195
|
this.dropdown.style.left = `${rect.left}px`;
|
|
179
196
|
this.dropdown.style.width = `${rect.width}px`;
|
|
180
197
|
|
|
181
198
|
const spaceBelow = window.innerHeight - rect.bottom - gap;
|
|
182
199
|
const maxH = 200;
|
|
200
|
+
|
|
183
201
|
if (spaceBelow >= maxH || spaceBelow >= rect.top) {
|
|
184
202
|
this.dropdown.style.top = `${rect.bottom + gap}px`;
|
|
185
203
|
this.dropdown.style.bottom = "auto";
|
|
@@ -247,6 +265,7 @@ class YumeSelect extends HTMLElement {
|
|
|
247
265
|
renderTags() {
|
|
248
266
|
const isMulti = this.hasAttribute("multiple");
|
|
249
267
|
const isTagMode = this.getAttribute("display-mode") === "tag";
|
|
268
|
+
|
|
250
269
|
if (!isMulti || !isTagMode || !this.displayElement) return;
|
|
251
270
|
|
|
252
271
|
const options = this.getOptions();
|
|
@@ -6,21 +6,30 @@ export class YumeSlider extends HTMLElement {
|
|
|
6
6
|
connectedCallback(): void;
|
|
7
7
|
attributeChangedCallback(name: any, oldValue: any, newValue: any): void;
|
|
8
8
|
set value(val: number);
|
|
9
|
+
/** @type {number} The current slider value, clamped between min and max. */
|
|
9
10
|
get value(): number;
|
|
10
11
|
set min(val: number);
|
|
12
|
+
/** @type {number} The minimum allowed value. Defaults to 0. */
|
|
11
13
|
get min(): number;
|
|
12
14
|
set max(val: number);
|
|
15
|
+
/** @type {number} The maximum allowed value. Defaults to 100. */
|
|
13
16
|
get max(): number;
|
|
14
|
-
set step(val: number);
|
|
15
|
-
|
|
17
|
+
set step(val: number | null);
|
|
18
|
+
/** @type {number|null} The step increment, or null for continuous. */
|
|
19
|
+
get step(): number | null;
|
|
16
20
|
set size(val: string);
|
|
21
|
+
/** @type {string} The size variant ("small", "medium", or "large"). */
|
|
17
22
|
get size(): string;
|
|
18
23
|
set color(val: string);
|
|
24
|
+
/** @type {string} The color theme for the slider track and thumb. */
|
|
19
25
|
get color(): string;
|
|
20
26
|
set disabled(val: boolean);
|
|
27
|
+
/** @type {boolean} Whether the slider is disabled. */
|
|
21
28
|
get disabled(): boolean;
|
|
22
29
|
set orientation(val: string);
|
|
30
|
+
/** @type {string} The slider orientation ("horizontal" or "vertical"). */
|
|
23
31
|
get orientation(): string;
|
|
32
|
+
/** @type {number} The current value as a percentage of the min-max range. */
|
|
24
33
|
get percentage(): number;
|
|
25
34
|
_snapToStep(val: any): any;
|
|
26
35
|
getTrackColor(color: any): any;
|
|
@@ -54,6 +54,7 @@ class YumeSlider extends HTMLElement {
|
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
+
/** @type {number} The current slider value, clamped between min and max. */
|
|
57
58
|
get value() {
|
|
58
59
|
const val = parseFloat(this.getAttribute("value"));
|
|
59
60
|
return Number.isNaN(val) ? 0 : val;
|
|
@@ -65,6 +66,7 @@ class YumeSlider extends HTMLElement {
|
|
|
65
66
|
this.setAttribute("value", String(stepped));
|
|
66
67
|
}
|
|
67
68
|
|
|
69
|
+
/** @type {number} The minimum allowed value. Defaults to 0. */
|
|
68
70
|
get min() {
|
|
69
71
|
return parseFloat(this.getAttribute("min")) || 0;
|
|
70
72
|
}
|
|
@@ -73,6 +75,7 @@ class YumeSlider extends HTMLElement {
|
|
|
73
75
|
this.setAttribute("min", String(val));
|
|
74
76
|
}
|
|
75
77
|
|
|
78
|
+
/** @type {number} The maximum allowed value. Defaults to 100. */
|
|
76
79
|
get max() {
|
|
77
80
|
return parseFloat(this.getAttribute("max")) || 100;
|
|
78
81
|
}
|
|
@@ -81,6 +84,7 @@ class YumeSlider extends HTMLElement {
|
|
|
81
84
|
this.setAttribute("max", String(val));
|
|
82
85
|
}
|
|
83
86
|
|
|
87
|
+
/** @type {number|null} The step increment, or null for continuous. */
|
|
84
88
|
get step() {
|
|
85
89
|
const s = parseFloat(this.getAttribute("step"));
|
|
86
90
|
return Number.isNaN(s) || s <= 0 ? null : s;
|
|
@@ -94,6 +98,7 @@ class YumeSlider extends HTMLElement {
|
|
|
94
98
|
}
|
|
95
99
|
}
|
|
96
100
|
|
|
101
|
+
/** @type {string} The size variant ("small", "medium", or "large"). */
|
|
97
102
|
get size() {
|
|
98
103
|
return this.getAttribute("size") || "medium";
|
|
99
104
|
}
|
|
@@ -102,6 +107,7 @@ class YumeSlider extends HTMLElement {
|
|
|
102
107
|
this.setAttribute("size", val);
|
|
103
108
|
}
|
|
104
109
|
|
|
110
|
+
/** @type {string} The color theme for the slider track and thumb. */
|
|
105
111
|
get color() {
|
|
106
112
|
return this.getAttribute("color") || "primary";
|
|
107
113
|
}
|
|
@@ -110,6 +116,7 @@ class YumeSlider extends HTMLElement {
|
|
|
110
116
|
this.setAttribute("color", val);
|
|
111
117
|
}
|
|
112
118
|
|
|
119
|
+
/** @type {boolean} Whether the slider is disabled. */
|
|
113
120
|
get disabled() {
|
|
114
121
|
return this.hasAttribute("disabled");
|
|
115
122
|
}
|
|
@@ -119,6 +126,7 @@ class YumeSlider extends HTMLElement {
|
|
|
119
126
|
else this.removeAttribute("disabled");
|
|
120
127
|
}
|
|
121
128
|
|
|
129
|
+
/** @type {string} The slider orientation ("horizontal" or "vertical"). */
|
|
122
130
|
get orientation() {
|
|
123
131
|
return this.getAttribute("orientation") || "horizontal";
|
|
124
132
|
}
|
|
@@ -127,6 +135,7 @@ class YumeSlider extends HTMLElement {
|
|
|
127
135
|
this.setAttribute("orientation", val);
|
|
128
136
|
}
|
|
129
137
|
|
|
138
|
+
/** @type {number} The current value as a percentage of the min-max range. */
|
|
130
139
|
get percentage() {
|
|
131
140
|
const range = this.max - this.min;
|
|
132
141
|
if (range <= 0) return 0;
|
|
@@ -259,6 +268,7 @@ class YumeSlider extends HTMLElement {
|
|
|
259
268
|
Math.min(1, (e.clientX - rect.left) / rect.width),
|
|
260
269
|
);
|
|
261
270
|
const rawValue = this.min + ratio * (this.max - this.min);
|
|
271
|
+
|
|
262
272
|
this.value = rawValue;
|
|
263
273
|
this.dispatchEvent(
|
|
264
274
|
new Event("input", { bubbles: true, composed: true }),
|
|
@@ -5,9 +5,12 @@ declare class YumeSwitch extends HTMLElement {
|
|
|
5
5
|
connectedCallback(): void;
|
|
6
6
|
attributeChangedCallback(name: any, oldValue: any, newValue: any): void;
|
|
7
7
|
set checked(val: boolean);
|
|
8
|
+
/** @type {boolean} Whether the switch is on. */
|
|
8
9
|
get checked(): boolean;
|
|
9
10
|
set value(val: string);
|
|
11
|
+
/** @type {string} The form value submitted when checked. Defaults to "on". */
|
|
10
12
|
get value(): string;
|
|
13
|
+
/** Toggles the checked state and dispatches a "change" event. */
|
|
11
14
|
toggle(): void;
|
|
12
15
|
labelTag(pos: any): "" | "<label class=\"label-wrapper\"><slot name=\"label\"></slot></label>";
|
|
13
16
|
_autoHideLabel(): void;
|
|
@@ -44,6 +44,7 @@ class YumeSwitch extends HTMLElement {
|
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
+
/** @type {boolean} Whether the switch is on. */
|
|
47
48
|
get checked() {
|
|
48
49
|
return this.hasAttribute("checked");
|
|
49
50
|
}
|
|
@@ -54,6 +55,7 @@ class YumeSwitch extends HTMLElement {
|
|
|
54
55
|
this.update();
|
|
55
56
|
}
|
|
56
57
|
|
|
58
|
+
/** @type {string} The form value submitted when checked. Defaults to "on". */
|
|
57
59
|
get value() {
|
|
58
60
|
return this.getAttribute("value") || "on";
|
|
59
61
|
}
|
|
@@ -63,8 +65,10 @@ class YumeSwitch extends HTMLElement {
|
|
|
63
65
|
this.update();
|
|
64
66
|
}
|
|
65
67
|
|
|
68
|
+
/** Toggles the checked state and dispatches a "change" event. */
|
|
66
69
|
toggle() {
|
|
67
70
|
if (this.hasAttribute("disabled")) return;
|
|
71
|
+
|
|
68
72
|
this.checked = !this.checked;
|
|
69
73
|
this.dispatchEvent(
|
|
70
74
|
new Event("change", { bubbles: true, composed: true }),
|
|
@@ -84,9 +88,10 @@ class YumeSwitch extends HTMLElement {
|
|
|
84
88
|
|
|
85
89
|
_autoHideLabel() {
|
|
86
90
|
const slot = this.shadowRoot.querySelector('slot[name="label"]');
|
|
87
|
-
if (!slot) return;
|
|
88
91
|
const wrapper = slot.closest(".label-wrapper");
|
|
89
|
-
|
|
92
|
+
|
|
93
|
+
if (!slot || !wrapper) return;
|
|
94
|
+
|
|
90
95
|
const update = () => {
|
|
91
96
|
const hasContent = slot
|
|
92
97
|
.assignedNodes({ flatten: true })
|
|
@@ -99,6 +104,7 @@ class YumeSwitch extends HTMLElement {
|
|
|
99
104
|
);
|
|
100
105
|
wrapper.style.display = hasContent ? "" : "none";
|
|
101
106
|
};
|
|
107
|
+
|
|
102
108
|
slot.addEventListener("slotchange", update);
|
|
103
109
|
update();
|
|
104
110
|
}
|
|
@@ -7,10 +7,13 @@ export class YumeTable extends HTMLElement {
|
|
|
7
7
|
connectedCallback(): void;
|
|
8
8
|
attributeChangedCallback(name: any, oldVal: any, newVal: any): void;
|
|
9
9
|
set columns(val: string);
|
|
10
|
+
/** Column definitions as a JSON string or array of { field, header?, sortable? } objects. */
|
|
10
11
|
get columns(): string;
|
|
11
12
|
set data(val: string);
|
|
13
|
+
/** Row data as a JSON string or array of objects keyed by column field names. */
|
|
12
14
|
get data(): string;
|
|
13
15
|
set striped(val: boolean);
|
|
16
|
+
/** Whether to show alternating row backgrounds. */
|
|
14
17
|
get striped(): boolean;
|
|
15
18
|
set size(val: string);
|
|
16
19
|
/**
|
|
@@ -29,7 +29,7 @@ class YumeTable extends HTMLElement {
|
|
|
29
29
|
super();
|
|
30
30
|
this.attachShadow({ mode: "open" });
|
|
31
31
|
this._sortField = null;
|
|
32
|
-
this._sortDir = "none";
|
|
32
|
+
this._sortDir = "none";
|
|
33
33
|
this._parsedData = [];
|
|
34
34
|
this._parsedColumns = [];
|
|
35
35
|
}
|
|
@@ -45,6 +45,7 @@ class YumeTable extends HTMLElement {
|
|
|
45
45
|
this.render();
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
+
/** Column definitions as a JSON string or array of { field, header?, sortable? } objects. */
|
|
48
49
|
get columns() {
|
|
49
50
|
return this.getAttribute("columns");
|
|
50
51
|
}
|
|
@@ -55,6 +56,7 @@ class YumeTable extends HTMLElement {
|
|
|
55
56
|
);
|
|
56
57
|
}
|
|
57
58
|
|
|
59
|
+
/** Row data as a JSON string or array of objects keyed by column field names. */
|
|
58
60
|
get data() {
|
|
59
61
|
return this.getAttribute("data");
|
|
60
62
|
}
|
|
@@ -65,6 +67,7 @@ class YumeTable extends HTMLElement {
|
|
|
65
67
|
);
|
|
66
68
|
}
|
|
67
69
|
|
|
70
|
+
/** Whether to show alternating row backgrounds. */
|
|
68
71
|
get striped() {
|
|
69
72
|
return this.hasAttribute("striped");
|
|
70
73
|
}
|
|
@@ -3,13 +3,20 @@ export class YumeTabs extends HTMLElement {
|
|
|
3
3
|
_activeTab: string;
|
|
4
4
|
connectedCallback(): void;
|
|
5
5
|
attributeChangedCallback(name: any, oldVal: any, newVal: any): void;
|
|
6
|
-
set options(val: any);
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
get
|
|
12
|
-
|
|
6
|
+
set options(val: Array<any>);
|
|
7
|
+
/** @type {Array<Object>} Tab definitions with id, label, slot, and optional disabled flag. */
|
|
8
|
+
get options(): Array<any>;
|
|
9
|
+
set size(val: "small" | "medium" | "large");
|
|
10
|
+
/** @type {"small"|"medium"|"large"} Controls tab button padding and gap. */
|
|
11
|
+
get size(): "small" | "medium" | "large";
|
|
12
|
+
set position(val: "top" | "bottom" | "left" | "right");
|
|
13
|
+
/** @type {"top"|"bottom"|"left"|"right"} Which edge the tab strip is placed on. */
|
|
14
|
+
get position(): "top" | "bottom" | "left" | "right";
|
|
15
|
+
/**
|
|
16
|
+
* Activates a tab by its id.
|
|
17
|
+
* @param {string} id - The id of the tab to activate.
|
|
18
|
+
*/
|
|
19
|
+
activateTab(id: string): void;
|
|
13
20
|
_setupEvents(): void;
|
|
14
21
|
_handleTabKeydown(e: any, buttons: any): void;
|
|
15
22
|
_findSiblingButton(buttons: any, fromIndex: any, direction: any): any;
|
|
@@ -25,6 +25,7 @@ class YumeTabs extends HTMLElement {
|
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
+
/** @type {Array<Object>} Tab definitions with id, label, slot, and optional disabled flag. */
|
|
28
29
|
get options() {
|
|
29
30
|
try {
|
|
30
31
|
return JSON.parse(this.getAttribute("options") || "[]");
|
|
@@ -38,6 +39,7 @@ class YumeTabs extends HTMLElement {
|
|
|
38
39
|
this.render();
|
|
39
40
|
}
|
|
40
41
|
|
|
42
|
+
/** @type {"small"|"medium"|"large"} Controls tab button padding and gap. */
|
|
41
43
|
get size() {
|
|
42
44
|
const sz = this.getAttribute("size");
|
|
43
45
|
return ["small", "medium", "large"].includes(sz) ? sz : "medium";
|
|
@@ -49,6 +51,7 @@ class YumeTabs extends HTMLElement {
|
|
|
49
51
|
else this.setAttribute("size", "medium");
|
|
50
52
|
}
|
|
51
53
|
|
|
54
|
+
/** @type {"top"|"bottom"|"left"|"right"} Which edge the tab strip is placed on. */
|
|
52
55
|
get position() {
|
|
53
56
|
const pos = this.getAttribute("position");
|
|
54
57
|
return ["top", "bottom", "left", "right"].includes(pos) ? pos : "top";
|
|
@@ -60,6 +63,10 @@ class YumeTabs extends HTMLElement {
|
|
|
60
63
|
else this.setAttribute("position", "top");
|
|
61
64
|
}
|
|
62
65
|
|
|
66
|
+
/**
|
|
67
|
+
* Activates a tab by its id.
|
|
68
|
+
* @param {string} id - The id of the tab to activate.
|
|
69
|
+
*/
|
|
63
70
|
activateTab(id) {
|
|
64
71
|
const tab = this.options.find((t) => t.id === id);
|
|
65
72
|
if (!tab || tab.disabled) return;
|
|
@@ -208,6 +215,7 @@ class YumeTabs extends HTMLElement {
|
|
|
208
215
|
const isActive = tab.id === this._activeTab;
|
|
209
216
|
const isDisabled = !!tab.disabled;
|
|
210
217
|
const btn = document.createElement("button");
|
|
218
|
+
|
|
211
219
|
btn.id = `tab-${tab.id}`;
|
|
212
220
|
btn.setAttribute("role", "tab");
|
|
213
221
|
btn.setAttribute("part", "tab");
|
|
@@ -251,6 +259,7 @@ class YumeTabs extends HTMLElement {
|
|
|
251
259
|
const contentSlot = document.createElement("slot");
|
|
252
260
|
contentSlot.name = slotName;
|
|
253
261
|
panel.appendChild(contentSlot);
|
|
262
|
+
|
|
254
263
|
return panel;
|
|
255
264
|
}
|
|
256
265
|
|
|
@@ -3,8 +3,13 @@ export class YumeTheme extends HTMLElement {
|
|
|
3
3
|
connectedCallback(): void;
|
|
4
4
|
attributeChangedCallback(name: any, oldValue: any, newValue: any): void;
|
|
5
5
|
_applyTheme(): Promise<void>;
|
|
6
|
-
|
|
6
|
+
/**
|
|
7
|
+
* Parses CSS custom properties from the given text and sets them on the host element.
|
|
8
|
+
* @param {string} cssText - Raw CSS containing custom property declarations.
|
|
9
|
+
*/
|
|
10
|
+
applyVariablesToHost(cssText: string): void;
|
|
7
11
|
_themeProps: any[];
|
|
12
|
+
/** Removes all theme custom properties previously applied to the host element. */
|
|
8
13
|
clearThemeProperties(): void;
|
|
9
14
|
_injectPageStyles(): void;
|
|
10
15
|
}
|