@waggylabs/yumekit 0.5.2 → 0.5.3
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/CHANGELOG.md +14 -0
- package/README.md +1 -1
- package/dist/ai/llm.txt +13 -11
- package/dist/ai/skill/examples/nav-layout.html +5 -5
- package/dist/ai/skill/examples/themed-app.html +6 -6
- package/dist/ai/skill/patterns.md +7 -7
- package/dist/ai/skill/reference.md +20 -18
- package/dist/components/y-appbar.js +45 -16
- package/dist/components/y-banner.js +44 -15
- package/dist/components/y-button/y-button.d.ts +11 -4
- package/dist/components/y-button.d.ts +11 -4
- package/dist/components/y-button.js +43 -14
- package/dist/components/y-checkbox.js +7 -1
- package/dist/components/y-color.js +12 -2
- package/dist/components/y-colorpicker.js +12 -2
- package/dist/components/y-data-grid.js +83 -35
- package/dist/components/y-date.js +72 -30
- package/dist/components/y-datepicker.js +72 -30
- package/dist/components/y-dialog.js +1 -1
- package/dist/components/y-help.js +46 -17
- package/dist/components/y-input.js +11 -1
- package/dist/components/y-paginator.js +46 -17
- package/dist/components/y-select.js +1 -1
- package/dist/components/y-sidebar.js +45 -16
- package/dist/components/y-tag/y-tag.d.ts +9 -2
- package/dist/components/y-tag.d.ts +9 -2
- package/dist/components/y-tag.js +36 -8
- package/dist/components/y-textarea.js +11 -1
- package/dist/index.js +139 -53
- package/dist/react.d.ts +4 -0
- package/dist/yumekit.min.js +1 -1
- package/llm.txt +13 -11
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2001,6 +2001,7 @@ class YumeButton extends HTMLElement {
|
|
|
2001
2001
|
"right-icon",
|
|
2002
2002
|
"color",
|
|
2003
2003
|
"size",
|
|
2004
|
+
"variant",
|
|
2004
2005
|
"style-type",
|
|
2005
2006
|
"type",
|
|
2006
2007
|
"padding-mode",
|
|
@@ -2053,9 +2054,13 @@ class YumeButton extends HTMLElement {
|
|
|
2053
2054
|
}
|
|
2054
2055
|
}
|
|
2055
2056
|
|
|
2057
|
+
if (name === "style-type" && newValue !== null) {
|
|
2058
|
+
this._warnStyleTypeDeprecated();
|
|
2059
|
+
}
|
|
2060
|
+
|
|
2056
2061
|
this._init();
|
|
2057
2062
|
|
|
2058
|
-
if (["color", "size", "style-type", "disabled"].includes(name)) {
|
|
2063
|
+
if (["color", "size", "variant", "style-type", "disabled"].includes(name)) {
|
|
2059
2064
|
this._updateStyles();
|
|
2060
2065
|
}
|
|
2061
2066
|
}
|
|
@@ -2137,9 +2142,12 @@ class YumeButton extends HTMLElement {
|
|
|
2137
2142
|
this.setAttribute("size", val);
|
|
2138
2143
|
}
|
|
2139
2144
|
|
|
2140
|
-
/**
|
|
2145
|
+
/**
|
|
2146
|
+
* Deprecated alias for `variant`. Use `variant` instead; retained for
|
|
2147
|
+
* backward compatibility and removed in a future major version.
|
|
2148
|
+
*/
|
|
2141
2149
|
get styleType() {
|
|
2142
|
-
return this.
|
|
2150
|
+
return this.variant;
|
|
2143
2151
|
}
|
|
2144
2152
|
set styleType(val) {
|
|
2145
2153
|
this.setAttribute("style-type", val);
|
|
@@ -2182,6 +2190,18 @@ class YumeButton extends HTMLElement {
|
|
|
2182
2190
|
this.setAttribute("value", newVal);
|
|
2183
2191
|
}
|
|
2184
2192
|
|
|
2193
|
+
/** Visual style: "filled" | "outlined" | "flat" (default "outlined"). */
|
|
2194
|
+
get variant() {
|
|
2195
|
+
return (
|
|
2196
|
+
this.getAttribute("variant") ||
|
|
2197
|
+
this.getAttribute("style-type") ||
|
|
2198
|
+
"outlined"
|
|
2199
|
+
);
|
|
2200
|
+
}
|
|
2201
|
+
set variant(val) {
|
|
2202
|
+
this.setAttribute("variant", val);
|
|
2203
|
+
}
|
|
2204
|
+
|
|
2185
2205
|
// -------------------------------------------------------------------------
|
|
2186
2206
|
// Public
|
|
2187
2207
|
// -------------------------------------------------------------------------
|
|
@@ -2236,7 +2256,7 @@ class YumeButton extends HTMLElement {
|
|
|
2236
2256
|
});
|
|
2237
2257
|
}
|
|
2238
2258
|
|
|
2239
|
-
_applyCustomColorStyles(color,
|
|
2259
|
+
_applyCustomColorStyles(color, variant, size) {
|
|
2240
2260
|
const text = contrastTextColor(color);
|
|
2241
2261
|
const hover = `color-mix(in srgb, ${color} 85%, black)`;
|
|
2242
2262
|
const active = `color-mix(in srgb, ${color} 70%, black)`;
|
|
@@ -2292,7 +2312,7 @@ class YumeButton extends HTMLElement {
|
|
|
2292
2312
|
},
|
|
2293
2313
|
};
|
|
2294
2314
|
|
|
2295
|
-
Object.entries(styles[
|
|
2315
|
+
Object.entries(styles[variant] || styles.outlined).forEach(
|
|
2296
2316
|
([key, val]) => this.button.style.setProperty(key, val),
|
|
2297
2317
|
);
|
|
2298
2318
|
|
|
@@ -2338,11 +2358,11 @@ class YumeButton extends HTMLElement {
|
|
|
2338
2358
|
);
|
|
2339
2359
|
}
|
|
2340
2360
|
|
|
2341
|
-
_applyInteractionStyles(vars,
|
|
2342
|
-
if (
|
|
2361
|
+
_applyInteractionStyles(vars, variant) {
|
|
2362
|
+
if (variant === "filled") {
|
|
2343
2363
|
this._applyFilledInteractionStyles(vars);
|
|
2344
2364
|
} else {
|
|
2345
|
-
this._applyUnfilledInteractionStyles(vars,
|
|
2365
|
+
this._applyUnfilledInteractionStyles(vars, variant);
|
|
2346
2366
|
}
|
|
2347
2367
|
}
|
|
2348
2368
|
|
|
@@ -2467,7 +2487,7 @@ class YumeButton extends HTMLElement {
|
|
|
2467
2487
|
this.shadowRoot.appendChild(style);
|
|
2468
2488
|
}
|
|
2469
2489
|
|
|
2470
|
-
_applyUnfilledInteractionStyles(vars,
|
|
2490
|
+
_applyUnfilledInteractionStyles(vars, variant) {
|
|
2471
2491
|
const borderColor = this._outlineBorderColor(
|
|
2472
2492
|
`var(${vars[7]}, var(${vars[0]}, #f7f7fa))`,
|
|
2473
2493
|
);
|
|
@@ -2497,7 +2517,7 @@ class YumeButton extends HTMLElement {
|
|
|
2497
2517
|
`var(${vars[6]}, #0c0c0d)`,
|
|
2498
2518
|
);
|
|
2499
2519
|
|
|
2500
|
-
if (
|
|
2520
|
+
if (variant === "outlined") {
|
|
2501
2521
|
// Outlined buttons keep their border color across all states
|
|
2502
2522
|
this.button.style.setProperty("--hover-border-color", borderColor);
|
|
2503
2523
|
this.button.style.setProperty("--focus-border-color", borderColor);
|
|
@@ -2785,11 +2805,11 @@ class YumeButton extends HTMLElement {
|
|
|
2785
2805
|
}
|
|
2786
2806
|
|
|
2787
2807
|
_updateStyles() {
|
|
2788
|
-
const { color, size,
|
|
2808
|
+
const { color, size, variant } = this;
|
|
2789
2809
|
const colorVars = this._getColorVarsMap();
|
|
2790
2810
|
|
|
2791
2811
|
if (!colorVars[color] && isSafeCssColor(color)) {
|
|
2792
|
-
this._applyCustomColorStyles(color,
|
|
2812
|
+
this._applyCustomColorStyles(color, variant, size);
|
|
2793
2813
|
return;
|
|
2794
2814
|
}
|
|
2795
2815
|
|
|
@@ -2818,14 +2838,23 @@ class YumeButton extends HTMLElement {
|
|
|
2818
2838
|
},
|
|
2819
2839
|
};
|
|
2820
2840
|
|
|
2821
|
-
const currentStyle = styleVars[
|
|
2841
|
+
const currentStyle = styleVars[variant] || styleVars.outlined;
|
|
2822
2842
|
Object.entries(currentStyle).forEach(([key, value]) => {
|
|
2823
2843
|
this.button.style.setProperty(key, value);
|
|
2824
2844
|
});
|
|
2825
2845
|
|
|
2826
|
-
this._applyInteractionStyles(vars,
|
|
2846
|
+
this._applyInteractionStyles(vars, variant);
|
|
2827
2847
|
this._applySizeStyles(size);
|
|
2828
2848
|
}
|
|
2849
|
+
|
|
2850
|
+
_warnStyleTypeDeprecated() {
|
|
2851
|
+
if (YumeButton._styleTypeDeprecationWarned) return;
|
|
2852
|
+
|
|
2853
|
+
YumeButton._styleTypeDeprecationWarned = true;
|
|
2854
|
+
console.warn(
|
|
2855
|
+
'y-button: the "style-type" attribute is deprecated and will be removed in a future major version. Use "variant" instead.',
|
|
2856
|
+
);
|
|
2857
|
+
}
|
|
2829
2858
|
}
|
|
2830
2859
|
|
|
2831
2860
|
if (!customElements.get("y-button")) {
|
|
@@ -4143,7 +4172,7 @@ class YumeAppbar extends HTMLElement {
|
|
|
4143
4172
|
{
|
|
4144
4173
|
id,
|
|
4145
4174
|
color: "base",
|
|
4146
|
-
"
|
|
4175
|
+
"variant": "flat",
|
|
4147
4176
|
size: cfg.buttonSize,
|
|
4148
4177
|
"aria-label": "Open menu",
|
|
4149
4178
|
"aria-controls": panelId,
|
|
@@ -4295,7 +4324,7 @@ class YumeAppbar extends HTMLElement {
|
|
|
4295
4324
|
const btn = createElement("y-button", {
|
|
4296
4325
|
id: btnId,
|
|
4297
4326
|
color: isActive ? "primary" : "base",
|
|
4298
|
-
"
|
|
4327
|
+
"variant": "flat",
|
|
4299
4328
|
size: cfg.buttonSize,
|
|
4300
4329
|
"aria-current": isActive ? "page" : false,
|
|
4301
4330
|
});
|
|
@@ -5133,7 +5162,7 @@ class YumeSidebar extends HTMLElement {
|
|
|
5133
5162
|
{
|
|
5134
5163
|
class: "collapse-btn",
|
|
5135
5164
|
color: "base",
|
|
5136
|
-
"
|
|
5165
|
+
"variant": "flat",
|
|
5137
5166
|
size: cfg.buttonSize,
|
|
5138
5167
|
"aria-label": isCollapsed
|
|
5139
5168
|
? "Expand sidebar"
|
|
@@ -5181,7 +5210,7 @@ class YumeSidebar extends HTMLElement {
|
|
|
5181
5210
|
const btn = createElement("y-button", {
|
|
5182
5211
|
id: btnId,
|
|
5183
5212
|
color: isActive ? "primary" : "base",
|
|
5184
|
-
"
|
|
5213
|
+
"variant": "flat",
|
|
5185
5214
|
size: cfg.buttonSize,
|
|
5186
5215
|
"aria-current": isActive ? "page" : false,
|
|
5187
5216
|
});
|
|
@@ -5648,7 +5677,7 @@ class YumeBanner extends HTMLElement {
|
|
|
5648
5677
|
part: "close-btn",
|
|
5649
5678
|
"aria-label": "Dismiss banner",
|
|
5650
5679
|
color,
|
|
5651
|
-
"
|
|
5680
|
+
"variant": "filled",
|
|
5652
5681
|
size,
|
|
5653
5682
|
},
|
|
5654
5683
|
[createElement("y-icon", { name: "x", size: iconSize })],
|
|
@@ -7163,8 +7192,14 @@ class YumeCheckbox extends HTMLElement {
|
|
|
7163
7192
|
// -------------------------------------------------------------------------
|
|
7164
7193
|
|
|
7165
7194
|
_bindCheckboxListeners() {
|
|
7195
|
+
const wrapper = this.shadowRoot.querySelector(".wrapper");
|
|
7166
7196
|
const box = this.shadowRoot.querySelector(".checkbox");
|
|
7167
|
-
|
|
7197
|
+
|
|
7198
|
+
wrapper.addEventListener("click", () => {
|
|
7199
|
+
if (this.disabled) return;
|
|
7200
|
+
box.focus();
|
|
7201
|
+
this.toggle();
|
|
7202
|
+
});
|
|
7168
7203
|
box.addEventListener("keydown", (e) => {
|
|
7169
7204
|
if (e.key === " " || e.key === "Enter") {
|
|
7170
7205
|
e.preventDefault();
|
|
@@ -9611,7 +9646,10 @@ class YumeInput extends HTMLElement {
|
|
|
9611
9646
|
: "default";
|
|
9612
9647
|
}
|
|
9613
9648
|
set variant(val) {
|
|
9614
|
-
this.setAttribute(
|
|
9649
|
+
this.setAttribute(
|
|
9650
|
+
"variant",
|
|
9651
|
+
val === "underline" ? "underline" : "default",
|
|
9652
|
+
);
|
|
9615
9653
|
}
|
|
9616
9654
|
|
|
9617
9655
|
/** @type {string} Input type (default "text"). */
|
|
@@ -9679,6 +9717,13 @@ class YumeInput extends HTMLElement {
|
|
|
9679
9717
|
// -------------------------------------------------------------------------
|
|
9680
9718
|
|
|
9681
9719
|
_bindInputListeners() {
|
|
9720
|
+
this.inputContainer.addEventListener("mousedown", (e) => {
|
|
9721
|
+
if (e.target !== this.input) {
|
|
9722
|
+
e.preventDefault();
|
|
9723
|
+
this.input.focus();
|
|
9724
|
+
}
|
|
9725
|
+
});
|
|
9726
|
+
|
|
9682
9727
|
this.input.addEventListener("input", (e) => {
|
|
9683
9728
|
this.setAttribute("value", e.target.value);
|
|
9684
9729
|
this.dispatchEvent(
|
|
@@ -10869,7 +10914,7 @@ class YumeSelect extends HTMLElement {
|
|
|
10869
10914
|
tag.setAttribute("removable", "");
|
|
10870
10915
|
tag.setAttribute("size", "small");
|
|
10871
10916
|
tag.setAttribute("color", opt.color || "primary");
|
|
10872
|
-
tag.setAttribute("
|
|
10917
|
+
tag.setAttribute("variant", "filled");
|
|
10873
10918
|
tag.textContent = opt.label;
|
|
10874
10919
|
tag.dataset.value = opt.value;
|
|
10875
10920
|
|
|
@@ -12995,7 +13040,10 @@ class YumeDatepicker extends HTMLElement {
|
|
|
12995
13040
|
root.querySelectorAll(".month-btn").forEach((btn) => {
|
|
12996
13041
|
btn.addEventListener("click", () => {
|
|
12997
13042
|
const vd = this._viewDateForSide(btn.dataset.side);
|
|
12998
|
-
this._selectMonth(
|
|
13043
|
+
this._selectMonth(
|
|
13044
|
+
vd.getFullYear(),
|
|
13045
|
+
parseInt(btn.dataset.month),
|
|
13046
|
+
);
|
|
12999
13047
|
});
|
|
13000
13048
|
});
|
|
13001
13049
|
|
|
@@ -13071,20 +13119,20 @@ class YumeDatepicker extends HTMLElement {
|
|
|
13071
13119
|
const isSelected = this._sameDay(date, this._startDate);
|
|
13072
13120
|
const inRange = this._inRange(date);
|
|
13073
13121
|
|
|
13074
|
-
let
|
|
13122
|
+
let variant = "flat";
|
|
13075
13123
|
let color = "base";
|
|
13076
13124
|
|
|
13077
13125
|
if (isEdge || isSelected) {
|
|
13078
|
-
|
|
13126
|
+
variant = "filled";
|
|
13079
13127
|
color = this.color;
|
|
13080
13128
|
} else if (inRange) {
|
|
13081
|
-
|
|
13129
|
+
variant = "flat";
|
|
13082
13130
|
color = this.color;
|
|
13083
13131
|
}
|
|
13084
13132
|
|
|
13085
13133
|
return `<y-button
|
|
13086
13134
|
class="day-btn"
|
|
13087
|
-
|
|
13135
|
+
variant="${variant}"
|
|
13088
13136
|
color="${color}"
|
|
13089
13137
|
size="medium"
|
|
13090
13138
|
padding-mode="square"
|
|
@@ -13138,16 +13186,16 @@ class YumeDatepicker extends HTMLElement {
|
|
|
13138
13186
|
return `
|
|
13139
13187
|
<div class="cal-header">
|
|
13140
13188
|
<div class="nav-start">
|
|
13141
|
-
${showPrev ? `<y-button class="nav-btn" data-action="prev-year" padding-mode="square" data-side="${side}"
|
|
13142
|
-
${showPrev ? `<y-button class="nav-btn" data-action="prev-month" padding-mode="square"data-side="${side}"
|
|
13189
|
+
${showPrev ? `<y-button class="nav-btn" data-action="prev-year" padding-mode="square" data-side="${side}" variant="flat" size="small" aria-label="Previous year"><y-icon name="expand-left" size="small"></y-icon></y-button>` : ""}
|
|
13190
|
+
${showPrev ? `<y-button class="nav-btn" data-action="prev-month" padding-mode="square" data-side="${side}" variant="flat" size="small" aria-label="Previous month"><y-icon name="chevron-left" size="small"></y-icon></y-button>` : ""}
|
|
13143
13191
|
</div>
|
|
13144
13192
|
<div class="header-selects">
|
|
13145
13193
|
${this.showMonths ? `<y-select class="month-sel" data-side="${side}" size="small" value="${month}" options='${monthOptions}'></y-select>` : ""}
|
|
13146
13194
|
${this.showYears ? `<y-select class="year-sel" data-side="${side}" size="small" value="${year}" options='${yearOptions}'></y-select>` : ""}
|
|
13147
13195
|
</div>
|
|
13148
13196
|
<div class="nav-end">
|
|
13149
|
-
${showNext ? `<y-button class="nav-btn" data-action="next-month" padding-mode="square" data-side="${side}"
|
|
13150
|
-
${showNext ? `<y-button class="nav-btn" data-action="next-year" padding-mode="square" data-side="${side}"
|
|
13197
|
+
${showNext ? `<y-button class="nav-btn" data-action="next-month" padding-mode="square" data-side="${side}" variant="flat" size="small" aria-label="Next month"><y-icon name="chevron-right" size="small"></y-icon></y-button>` : ""}
|
|
13198
|
+
${showNext ? `<y-button class="nav-btn" data-action="next-year" padding-mode="square" data-side="${side}" variant="flat" size="small" aria-label="Next year"><y-icon name="expand-right" size="small"></y-icon></y-button>` : ""}
|
|
13151
13199
|
</div>
|
|
13152
13200
|
</div>
|
|
13153
13201
|
`;
|
|
@@ -13165,7 +13213,7 @@ class YumeDatepicker extends HTMLElement {
|
|
|
13165
13213
|
this._startDate.getMonth() === i;
|
|
13166
13214
|
return `<y-button
|
|
13167
13215
|
class="month-btn"
|
|
13168
|
-
|
|
13216
|
+
variant="${isSelected ? "filled" : "flat"}"
|
|
13169
13217
|
color="${isSelected ? this.color : "base"}"
|
|
13170
13218
|
size="small"
|
|
13171
13219
|
padding-mode="square"
|
|
@@ -13412,7 +13460,7 @@ class YumeDatepicker extends HTMLElement {
|
|
|
13412
13460
|
const sel = time.h === h;
|
|
13413
13461
|
return `<y-button
|
|
13414
13462
|
class="time-btn${sel ? " selected" : ""}"
|
|
13415
|
-
|
|
13463
|
+
variant="${sel ? "filled" : "flat"}"
|
|
13416
13464
|
color="${sel ? this.color : "base"}"
|
|
13417
13465
|
size="small"
|
|
13418
13466
|
data-hour="${h}"
|
|
@@ -13438,7 +13486,7 @@ class YumeDatepicker extends HTMLElement {
|
|
|
13438
13486
|
m;
|
|
13439
13487
|
return `<y-button
|
|
13440
13488
|
class="time-btn${sel ? " selected" : ""}"
|
|
13441
|
-
|
|
13489
|
+
variant="${sel ? "filled" : "flat"}"
|
|
13442
13490
|
color="${sel ? this.color : "base"}"
|
|
13443
13491
|
size="small"
|
|
13444
13492
|
data-minute="${m}"
|
|
@@ -13466,7 +13514,7 @@ class YumeDatepicker extends HTMLElement {
|
|
|
13466
13514
|
s;
|
|
13467
13515
|
return `<y-button
|
|
13468
13516
|
class="time-btn${sel ? " selected" : ""}"
|
|
13469
|
-
|
|
13517
|
+
variant="${sel ? "filled" : "flat"}"
|
|
13470
13518
|
color="${sel ? this.color : "base"}"
|
|
13471
13519
|
size="small"
|
|
13472
13520
|
data-second="${s}"
|
|
@@ -13514,7 +13562,7 @@ class YumeDatepicker extends HTMLElement {
|
|
|
13514
13562
|
const disabled = this._isYearDisabled(y);
|
|
13515
13563
|
return `<y-button
|
|
13516
13564
|
class="year-btn"
|
|
13517
|
-
|
|
13565
|
+
variant="${isSelected ? "filled" : "flat"}"
|
|
13518
13566
|
color="${isSelected ? this.color : "base"}"
|
|
13519
13567
|
size="small"
|
|
13520
13568
|
padding-mode="square"
|
|
@@ -15608,7 +15656,7 @@ class YumePaginator extends HTMLElement {
|
|
|
15608
15656
|
const attrs = {
|
|
15609
15657
|
class: `button${isCurrent ? " active" : ""}`,
|
|
15610
15658
|
part: parts.join(" "),
|
|
15611
|
-
"
|
|
15659
|
+
"variant": isCurrent ? "filled" : "flat",
|
|
15612
15660
|
color: isCurrent ? "primary" : "base",
|
|
15613
15661
|
size: this.size,
|
|
15614
15662
|
// Number buttons stay square/circular even in themes (e.g. Material)
|
|
@@ -15681,7 +15729,7 @@ class YumePaginator extends HTMLElement {
|
|
|
15681
15729
|
const attrs = {
|
|
15682
15730
|
class: `nav nav-${direction}`,
|
|
15683
15731
|
part: `${partName}${isDisabled ? " button--disabled" : ""}`,
|
|
15684
|
-
"
|
|
15732
|
+
"variant": "flat",
|
|
15685
15733
|
color: "base",
|
|
15686
15734
|
size: this.size,
|
|
15687
15735
|
"aria-label": cfg.ariaLabel,
|
|
@@ -20465,13 +20513,13 @@ class YumeDataGrid extends HTMLElement {
|
|
|
20465
20513
|
|
|
20466
20514
|
const actions = createElement("div", { class: "filter-actions" });
|
|
20467
20515
|
const clearBtn = createElement("y-button", {
|
|
20468
|
-
"
|
|
20516
|
+
"variant": "flat",
|
|
20469
20517
|
size: "small",
|
|
20470
20518
|
type: "button",
|
|
20471
20519
|
});
|
|
20472
20520
|
clearBtn.textContent = "Clear";
|
|
20473
20521
|
const applyBtn = createElement("y-button", {
|
|
20474
|
-
"
|
|
20522
|
+
"variant": "filled",
|
|
20475
20523
|
color: "primary",
|
|
20476
20524
|
size: "small",
|
|
20477
20525
|
type: "button",
|
|
@@ -22867,7 +22915,7 @@ class YumeDialog extends HTMLElement {
|
|
|
22867
22915
|
_buildCloseButton() {
|
|
22868
22916
|
const btn = document.createElement("y-button");
|
|
22869
22917
|
btn.setAttribute("size", "small");
|
|
22870
|
-
btn.setAttribute("
|
|
22918
|
+
btn.setAttribute("variant", "flat");
|
|
22871
22919
|
btn.setAttribute("aria-label", "Close");
|
|
22872
22920
|
btn.textContent = "\u2715";
|
|
22873
22921
|
btn.addEventListener("click", () => { this.visible = false; });
|
|
@@ -26900,7 +26948,7 @@ class YumeHelp extends HTMLElement {
|
|
|
26900
26948
|
{
|
|
26901
26949
|
class: "y-help-tooltip-close",
|
|
26902
26950
|
part: "close-button",
|
|
26903
|
-
"
|
|
26951
|
+
"variant": "flat",
|
|
26904
26952
|
size: "small",
|
|
26905
26953
|
"aria-label": this.closeLabel,
|
|
26906
26954
|
},
|
|
@@ -26937,7 +26985,7 @@ class YumeHelp extends HTMLElement {
|
|
|
26937
26985
|
{
|
|
26938
26986
|
class: "y-help-tooltip-btn",
|
|
26939
26987
|
part: "prev-button",
|
|
26940
|
-
"
|
|
26988
|
+
"variant": "outlined",
|
|
26941
26989
|
size: "small",
|
|
26942
26990
|
"aria-label": this.prevLabel,
|
|
26943
26991
|
},
|
|
@@ -26949,7 +26997,7 @@ class YumeHelp extends HTMLElement {
|
|
|
26949
26997
|
{
|
|
26950
26998
|
class: "y-help-tooltip-btn",
|
|
26951
26999
|
part: "next-button",
|
|
26952
|
-
"
|
|
27000
|
+
"variant": "filled",
|
|
26953
27001
|
color: "primary",
|
|
26954
27002
|
size: "small",
|
|
26955
27003
|
"aria-label": this.nextLabel,
|
|
@@ -28759,7 +28807,10 @@ class YumeTextarea extends HTMLElement {
|
|
|
28759
28807
|
: "default";
|
|
28760
28808
|
}
|
|
28761
28809
|
set variant(val) {
|
|
28762
|
-
this.setAttribute(
|
|
28810
|
+
this.setAttribute(
|
|
28811
|
+
"variant",
|
|
28812
|
+
val === "underline" ? "underline" : "default",
|
|
28813
|
+
);
|
|
28763
28814
|
}
|
|
28764
28815
|
|
|
28765
28816
|
/** @type {string} The current textarea value. */
|
|
@@ -28816,6 +28867,13 @@ class YumeTextarea extends HTMLElement {
|
|
|
28816
28867
|
// -------------------------------------------------------------------------
|
|
28817
28868
|
|
|
28818
28869
|
_bindTextareaListeners() {
|
|
28870
|
+
this.inputContainer.addEventListener("mousedown", (e) => {
|
|
28871
|
+
if (e.target !== this.textarea) {
|
|
28872
|
+
e.preventDefault();
|
|
28873
|
+
this.textarea.focus();
|
|
28874
|
+
}
|
|
28875
|
+
});
|
|
28876
|
+
|
|
28819
28877
|
this.textarea.addEventListener("input", (e) => {
|
|
28820
28878
|
this.setAttribute("value", e.target.value);
|
|
28821
28879
|
this._internals.setFormValue(
|
|
@@ -34381,7 +34439,7 @@ if (!customElements.get("y-table")) {
|
|
|
34381
34439
|
|
|
34382
34440
|
class YumeTag extends HTMLElement {
|
|
34383
34441
|
static get observedAttributes() {
|
|
34384
|
-
return ["removable", "color", "style-type", "shape", "size"];
|
|
34442
|
+
return ["removable", "color", "variant", "style-type", "shape", "size"];
|
|
34385
34443
|
}
|
|
34386
34444
|
|
|
34387
34445
|
// -------------------------------------------------------------------------
|
|
@@ -34399,6 +34457,10 @@ class YumeTag extends HTMLElement {
|
|
|
34399
34457
|
}
|
|
34400
34458
|
|
|
34401
34459
|
attributeChangedCallback(name, oldValue, newValue) {
|
|
34460
|
+
if (name === "style-type" && newValue !== null) {
|
|
34461
|
+
this._warnStyleTypeDeprecated();
|
|
34462
|
+
}
|
|
34463
|
+
|
|
34402
34464
|
if (oldValue !== newValue) this.render();
|
|
34403
34465
|
}
|
|
34404
34466
|
|
|
@@ -34439,14 +34501,29 @@ class YumeTag extends HTMLElement {
|
|
|
34439
34501
|
this.setAttribute("size", val);
|
|
34440
34502
|
}
|
|
34441
34503
|
|
|
34442
|
-
/**
|
|
34504
|
+
/**
|
|
34505
|
+
* Deprecated alias for `variant`. Use `variant` instead; retained for
|
|
34506
|
+
* backward compatibility and removed in a future major version.
|
|
34507
|
+
*/
|
|
34443
34508
|
get styleType() {
|
|
34444
|
-
return this.
|
|
34509
|
+
return this.variant;
|
|
34445
34510
|
}
|
|
34446
34511
|
set styleType(val) {
|
|
34447
34512
|
this.setAttribute("style-type", val);
|
|
34448
34513
|
}
|
|
34449
34514
|
|
|
34515
|
+
/** Visual style: "filled" (default) | "outlined" | "flat". */
|
|
34516
|
+
get variant() {
|
|
34517
|
+
return (
|
|
34518
|
+
this.getAttribute("variant") ||
|
|
34519
|
+
this.getAttribute("style-type") ||
|
|
34520
|
+
"filled"
|
|
34521
|
+
);
|
|
34522
|
+
}
|
|
34523
|
+
set variant(val) {
|
|
34524
|
+
this.setAttribute("variant", val);
|
|
34525
|
+
}
|
|
34526
|
+
|
|
34450
34527
|
// -------------------------------------------------------------------------
|
|
34451
34528
|
// Public
|
|
34452
34529
|
// -------------------------------------------------------------------------
|
|
@@ -34481,7 +34558,7 @@ class YumeTag extends HTMLElement {
|
|
|
34481
34558
|
});
|
|
34482
34559
|
}
|
|
34483
34560
|
|
|
34484
|
-
_getCustomColorVariant(color,
|
|
34561
|
+
_getCustomColorVariant(color, variant) {
|
|
34485
34562
|
const textColor = contrastTextColor(color);
|
|
34486
34563
|
const variants = {
|
|
34487
34564
|
filled: `
|
|
@@ -34497,11 +34574,11 @@ class YumeTag extends HTMLElement {
|
|
|
34497
34574
|
.remove { color: ${color}; }
|
|
34498
34575
|
`,
|
|
34499
34576
|
};
|
|
34500
|
-
return variants[
|
|
34577
|
+
return variants[variant] || variants.filled;
|
|
34501
34578
|
}
|
|
34502
34579
|
|
|
34503
34580
|
_getStyle() {
|
|
34504
|
-
const { color,
|
|
34581
|
+
const { color, variant, shape, size } = this;
|
|
34505
34582
|
|
|
34506
34583
|
const vars = {
|
|
34507
34584
|
primary: [
|
|
@@ -34603,7 +34680,7 @@ class YumeTag extends HTMLElement {
|
|
|
34603
34680
|
`;
|
|
34604
34681
|
|
|
34605
34682
|
if (isCustomColor)
|
|
34606
|
-
return baseStyle + this._getCustomColorVariant(color,
|
|
34683
|
+
return baseStyle + this._getCustomColorVariant(color, variant);
|
|
34607
34684
|
|
|
34608
34685
|
const [content, inverse, flatBackground] = varEntry || vars.base;
|
|
34609
34686
|
|
|
@@ -34622,7 +34699,16 @@ class YumeTag extends HTMLElement {
|
|
|
34622
34699
|
`,
|
|
34623
34700
|
};
|
|
34624
34701
|
|
|
34625
|
-
return baseStyle + (styleVariants[
|
|
34702
|
+
return baseStyle + (styleVariants[variant] || styleVariants.filled);
|
|
34703
|
+
}
|
|
34704
|
+
|
|
34705
|
+
_warnStyleTypeDeprecated() {
|
|
34706
|
+
if (YumeTag._styleTypeDeprecationWarned) return;
|
|
34707
|
+
|
|
34708
|
+
YumeTag._styleTypeDeprecationWarned = true;
|
|
34709
|
+
console.warn(
|
|
34710
|
+
'y-tag: the "style-type" attribute is deprecated and will be removed in a future major version. Use "variant" instead.',
|
|
34711
|
+
);
|
|
34626
34712
|
}
|
|
34627
34713
|
}
|
|
34628
34714
|
|
package/dist/react.d.ts
CHANGED
|
@@ -98,6 +98,8 @@ declare module "react" {
|
|
|
98
98
|
"right-icon"?: string;
|
|
99
99
|
color?: string;
|
|
100
100
|
size?: "small" | "medium" | "large";
|
|
101
|
+
variant?: "outlined" | "filled" | "flat";
|
|
102
|
+
/** @deprecated Use `variant` instead. */
|
|
101
103
|
"style-type"?: "outlined" | "filled" | "flat";
|
|
102
104
|
"padding-mode"?: "auto" | "square" | "wide";
|
|
103
105
|
type?: string;
|
|
@@ -724,6 +726,8 @@ declare module "react" {
|
|
|
724
726
|
color?: string;
|
|
725
727
|
size?: "small" | "medium" | "large";
|
|
726
728
|
removable?: boolean | string;
|
|
729
|
+
variant?: "filled" | "outlined" | "flat";
|
|
730
|
+
/** @deprecated Use `variant` instead. */
|
|
727
731
|
"style-type"?: "filled" | "outlined" | "flat";
|
|
728
732
|
shape?: "square" | "round";
|
|
729
733
|
}>;
|