@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
|
@@ -492,7 +492,10 @@ class YumeInput extends HTMLElement {
|
|
|
492
492
|
: "default";
|
|
493
493
|
}
|
|
494
494
|
set variant(val) {
|
|
495
|
-
this.setAttribute(
|
|
495
|
+
this.setAttribute(
|
|
496
|
+
"variant",
|
|
497
|
+
val === "underline" ? "underline" : "default",
|
|
498
|
+
);
|
|
496
499
|
}
|
|
497
500
|
|
|
498
501
|
/** @type {string} Input type (default "text"). */
|
|
@@ -560,6 +563,13 @@ class YumeInput extends HTMLElement {
|
|
|
560
563
|
// -------------------------------------------------------------------------
|
|
561
564
|
|
|
562
565
|
_bindInputListeners() {
|
|
566
|
+
this.inputContainer.addEventListener("mousedown", (e) => {
|
|
567
|
+
if (e.target !== this.input) {
|
|
568
|
+
e.preventDefault();
|
|
569
|
+
this.input.focus();
|
|
570
|
+
}
|
|
571
|
+
});
|
|
572
|
+
|
|
563
573
|
this.input.addEventListener("input", (e) => {
|
|
564
574
|
this.setAttribute("value", e.target.value);
|
|
565
575
|
this.dispatchEvent(
|
|
@@ -896,8 +906,14 @@ class YumeCheckbox extends HTMLElement {
|
|
|
896
906
|
// -------------------------------------------------------------------------
|
|
897
907
|
|
|
898
908
|
_bindCheckboxListeners() {
|
|
909
|
+
const wrapper = this.shadowRoot.querySelector(".wrapper");
|
|
899
910
|
const box = this.shadowRoot.querySelector(".checkbox");
|
|
900
|
-
|
|
911
|
+
|
|
912
|
+
wrapper.addEventListener("click", () => {
|
|
913
|
+
if (this.disabled) return;
|
|
914
|
+
box.focus();
|
|
915
|
+
this.toggle();
|
|
916
|
+
});
|
|
901
917
|
box.addEventListener("keydown", (e) => {
|
|
902
918
|
if (e.key === " " || e.key === "Enter") {
|
|
903
919
|
e.preventDefault();
|
|
@@ -2009,7 +2025,7 @@ class YumeSelect extends HTMLElement {
|
|
|
2009
2025
|
tag.setAttribute("removable", "");
|
|
2010
2026
|
tag.setAttribute("size", "small");
|
|
2011
2027
|
tag.setAttribute("color", opt.color || "primary");
|
|
2012
|
-
tag.setAttribute("
|
|
2028
|
+
tag.setAttribute("variant", "filled");
|
|
2013
2029
|
tag.textContent = opt.label;
|
|
2014
2030
|
tag.dataset.value = opt.value;
|
|
2015
2031
|
|
|
@@ -2123,6 +2139,7 @@ class YumeButton extends HTMLElement {
|
|
|
2123
2139
|
"right-icon",
|
|
2124
2140
|
"color",
|
|
2125
2141
|
"size",
|
|
2142
|
+
"variant",
|
|
2126
2143
|
"style-type",
|
|
2127
2144
|
"type",
|
|
2128
2145
|
"padding-mode",
|
|
@@ -2175,9 +2192,13 @@ class YumeButton extends HTMLElement {
|
|
|
2175
2192
|
}
|
|
2176
2193
|
}
|
|
2177
2194
|
|
|
2195
|
+
if (name === "style-type" && newValue !== null) {
|
|
2196
|
+
this._warnStyleTypeDeprecated();
|
|
2197
|
+
}
|
|
2198
|
+
|
|
2178
2199
|
this._init();
|
|
2179
2200
|
|
|
2180
|
-
if (["color", "size", "style-type", "disabled"].includes(name)) {
|
|
2201
|
+
if (["color", "size", "variant", "style-type", "disabled"].includes(name)) {
|
|
2181
2202
|
this._updateStyles();
|
|
2182
2203
|
}
|
|
2183
2204
|
}
|
|
@@ -2259,9 +2280,12 @@ class YumeButton extends HTMLElement {
|
|
|
2259
2280
|
this.setAttribute("size", val);
|
|
2260
2281
|
}
|
|
2261
2282
|
|
|
2262
|
-
/**
|
|
2283
|
+
/**
|
|
2284
|
+
* Deprecated alias for `variant`. Use `variant` instead; retained for
|
|
2285
|
+
* backward compatibility and removed in a future major version.
|
|
2286
|
+
*/
|
|
2263
2287
|
get styleType() {
|
|
2264
|
-
return this.
|
|
2288
|
+
return this.variant;
|
|
2265
2289
|
}
|
|
2266
2290
|
set styleType(val) {
|
|
2267
2291
|
this.setAttribute("style-type", val);
|
|
@@ -2304,6 +2328,18 @@ class YumeButton extends HTMLElement {
|
|
|
2304
2328
|
this.setAttribute("value", newVal);
|
|
2305
2329
|
}
|
|
2306
2330
|
|
|
2331
|
+
/** Visual style: "filled" | "outlined" | "flat" (default "outlined"). */
|
|
2332
|
+
get variant() {
|
|
2333
|
+
return (
|
|
2334
|
+
this.getAttribute("variant") ||
|
|
2335
|
+
this.getAttribute("style-type") ||
|
|
2336
|
+
"outlined"
|
|
2337
|
+
);
|
|
2338
|
+
}
|
|
2339
|
+
set variant(val) {
|
|
2340
|
+
this.setAttribute("variant", val);
|
|
2341
|
+
}
|
|
2342
|
+
|
|
2307
2343
|
// -------------------------------------------------------------------------
|
|
2308
2344
|
// Public
|
|
2309
2345
|
// -------------------------------------------------------------------------
|
|
@@ -2358,7 +2394,7 @@ class YumeButton extends HTMLElement {
|
|
|
2358
2394
|
});
|
|
2359
2395
|
}
|
|
2360
2396
|
|
|
2361
|
-
_applyCustomColorStyles(color,
|
|
2397
|
+
_applyCustomColorStyles(color, variant, size) {
|
|
2362
2398
|
const text = contrastTextColor(color);
|
|
2363
2399
|
const hover = `color-mix(in srgb, ${color} 85%, black)`;
|
|
2364
2400
|
const active = `color-mix(in srgb, ${color} 70%, black)`;
|
|
@@ -2414,7 +2450,7 @@ class YumeButton extends HTMLElement {
|
|
|
2414
2450
|
},
|
|
2415
2451
|
};
|
|
2416
2452
|
|
|
2417
|
-
Object.entries(styles[
|
|
2453
|
+
Object.entries(styles[variant] || styles.outlined).forEach(
|
|
2418
2454
|
([key, val]) => this.button.style.setProperty(key, val),
|
|
2419
2455
|
);
|
|
2420
2456
|
|
|
@@ -2460,11 +2496,11 @@ class YumeButton extends HTMLElement {
|
|
|
2460
2496
|
);
|
|
2461
2497
|
}
|
|
2462
2498
|
|
|
2463
|
-
_applyInteractionStyles(vars,
|
|
2464
|
-
if (
|
|
2499
|
+
_applyInteractionStyles(vars, variant) {
|
|
2500
|
+
if (variant === "filled") {
|
|
2465
2501
|
this._applyFilledInteractionStyles(vars);
|
|
2466
2502
|
} else {
|
|
2467
|
-
this._applyUnfilledInteractionStyles(vars,
|
|
2503
|
+
this._applyUnfilledInteractionStyles(vars, variant);
|
|
2468
2504
|
}
|
|
2469
2505
|
}
|
|
2470
2506
|
|
|
@@ -2589,7 +2625,7 @@ class YumeButton extends HTMLElement {
|
|
|
2589
2625
|
this.shadowRoot.appendChild(style);
|
|
2590
2626
|
}
|
|
2591
2627
|
|
|
2592
|
-
_applyUnfilledInteractionStyles(vars,
|
|
2628
|
+
_applyUnfilledInteractionStyles(vars, variant) {
|
|
2593
2629
|
const borderColor = this._outlineBorderColor(
|
|
2594
2630
|
`var(${vars[7]}, var(${vars[0]}, #f7f7fa))`,
|
|
2595
2631
|
);
|
|
@@ -2619,7 +2655,7 @@ class YumeButton extends HTMLElement {
|
|
|
2619
2655
|
`var(${vars[6]}, #0c0c0d)`,
|
|
2620
2656
|
);
|
|
2621
2657
|
|
|
2622
|
-
if (
|
|
2658
|
+
if (variant === "outlined") {
|
|
2623
2659
|
// Outlined buttons keep their border color across all states
|
|
2624
2660
|
this.button.style.setProperty("--hover-border-color", borderColor);
|
|
2625
2661
|
this.button.style.setProperty("--focus-border-color", borderColor);
|
|
@@ -2907,11 +2943,11 @@ class YumeButton extends HTMLElement {
|
|
|
2907
2943
|
}
|
|
2908
2944
|
|
|
2909
2945
|
_updateStyles() {
|
|
2910
|
-
const { color, size,
|
|
2946
|
+
const { color, size, variant } = this;
|
|
2911
2947
|
const colorVars = this._getColorVarsMap();
|
|
2912
2948
|
|
|
2913
2949
|
if (!colorVars[color] && isSafeCssColor(color)) {
|
|
2914
|
-
this._applyCustomColorStyles(color,
|
|
2950
|
+
this._applyCustomColorStyles(color, variant, size);
|
|
2915
2951
|
return;
|
|
2916
2952
|
}
|
|
2917
2953
|
|
|
@@ -2940,14 +2976,23 @@ class YumeButton extends HTMLElement {
|
|
|
2940
2976
|
},
|
|
2941
2977
|
};
|
|
2942
2978
|
|
|
2943
|
-
const currentStyle = styleVars[
|
|
2979
|
+
const currentStyle = styleVars[variant] || styleVars.outlined;
|
|
2944
2980
|
Object.entries(currentStyle).forEach(([key, value]) => {
|
|
2945
2981
|
this.button.style.setProperty(key, value);
|
|
2946
2982
|
});
|
|
2947
2983
|
|
|
2948
|
-
this._applyInteractionStyles(vars,
|
|
2984
|
+
this._applyInteractionStyles(vars, variant);
|
|
2949
2985
|
this._applySizeStyles(size);
|
|
2950
2986
|
}
|
|
2987
|
+
|
|
2988
|
+
_warnStyleTypeDeprecated() {
|
|
2989
|
+
if (YumeButton._styleTypeDeprecationWarned) return;
|
|
2990
|
+
|
|
2991
|
+
YumeButton._styleTypeDeprecationWarned = true;
|
|
2992
|
+
console.warn(
|
|
2993
|
+
'y-button: the "style-type" attribute is deprecated and will be removed in a future major version. Use "variant" instead.',
|
|
2994
|
+
);
|
|
2995
|
+
}
|
|
2951
2996
|
}
|
|
2952
2997
|
|
|
2953
2998
|
if (!customElements.get("y-button")) {
|
|
@@ -3327,7 +3372,10 @@ class YumeDatepicker extends HTMLElement {
|
|
|
3327
3372
|
root.querySelectorAll(".month-btn").forEach((btn) => {
|
|
3328
3373
|
btn.addEventListener("click", () => {
|
|
3329
3374
|
const vd = this._viewDateForSide(btn.dataset.side);
|
|
3330
|
-
this._selectMonth(
|
|
3375
|
+
this._selectMonth(
|
|
3376
|
+
vd.getFullYear(),
|
|
3377
|
+
parseInt(btn.dataset.month),
|
|
3378
|
+
);
|
|
3331
3379
|
});
|
|
3332
3380
|
});
|
|
3333
3381
|
|
|
@@ -3403,20 +3451,20 @@ class YumeDatepicker extends HTMLElement {
|
|
|
3403
3451
|
const isSelected = this._sameDay(date, this._startDate);
|
|
3404
3452
|
const inRange = this._inRange(date);
|
|
3405
3453
|
|
|
3406
|
-
let
|
|
3454
|
+
let variant = "flat";
|
|
3407
3455
|
let color = "base";
|
|
3408
3456
|
|
|
3409
3457
|
if (isEdge || isSelected) {
|
|
3410
|
-
|
|
3458
|
+
variant = "filled";
|
|
3411
3459
|
color = this.color;
|
|
3412
3460
|
} else if (inRange) {
|
|
3413
|
-
|
|
3461
|
+
variant = "flat";
|
|
3414
3462
|
color = this.color;
|
|
3415
3463
|
}
|
|
3416
3464
|
|
|
3417
3465
|
return `<y-button
|
|
3418
3466
|
class="day-btn"
|
|
3419
|
-
|
|
3467
|
+
variant="${variant}"
|
|
3420
3468
|
color="${color}"
|
|
3421
3469
|
size="medium"
|
|
3422
3470
|
padding-mode="square"
|
|
@@ -3470,16 +3518,16 @@ class YumeDatepicker extends HTMLElement {
|
|
|
3470
3518
|
return `
|
|
3471
3519
|
<div class="cal-header">
|
|
3472
3520
|
<div class="nav-start">
|
|
3473
|
-
${showPrev ? `<y-button class="nav-btn" data-action="prev-year" padding-mode="square" data-side="${side}"
|
|
3474
|
-
${showPrev ? `<y-button class="nav-btn" data-action="prev-month" padding-mode="square"data-side="${side}"
|
|
3521
|
+
${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>` : ""}
|
|
3522
|
+
${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>` : ""}
|
|
3475
3523
|
</div>
|
|
3476
3524
|
<div class="header-selects">
|
|
3477
3525
|
${this.showMonths ? `<y-select class="month-sel" data-side="${side}" size="small" value="${month}" options='${monthOptions}'></y-select>` : ""}
|
|
3478
3526
|
${this.showYears ? `<y-select class="year-sel" data-side="${side}" size="small" value="${year}" options='${yearOptions}'></y-select>` : ""}
|
|
3479
3527
|
</div>
|
|
3480
3528
|
<div class="nav-end">
|
|
3481
|
-
${showNext ? `<y-button class="nav-btn" data-action="next-month" padding-mode="square" data-side="${side}"
|
|
3482
|
-
${showNext ? `<y-button class="nav-btn" data-action="next-year" padding-mode="square" data-side="${side}"
|
|
3529
|
+
${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>` : ""}
|
|
3530
|
+
${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>` : ""}
|
|
3483
3531
|
</div>
|
|
3484
3532
|
</div>
|
|
3485
3533
|
`;
|
|
@@ -3497,7 +3545,7 @@ class YumeDatepicker extends HTMLElement {
|
|
|
3497
3545
|
this._startDate.getMonth() === i;
|
|
3498
3546
|
return `<y-button
|
|
3499
3547
|
class="month-btn"
|
|
3500
|
-
|
|
3548
|
+
variant="${isSelected ? "filled" : "flat"}"
|
|
3501
3549
|
color="${isSelected ? this.color : "base"}"
|
|
3502
3550
|
size="small"
|
|
3503
3551
|
padding-mode="square"
|
|
@@ -3744,7 +3792,7 @@ class YumeDatepicker extends HTMLElement {
|
|
|
3744
3792
|
const sel = time.h === h;
|
|
3745
3793
|
return `<y-button
|
|
3746
3794
|
class="time-btn${sel ? " selected" : ""}"
|
|
3747
|
-
|
|
3795
|
+
variant="${sel ? "filled" : "flat"}"
|
|
3748
3796
|
color="${sel ? this.color : "base"}"
|
|
3749
3797
|
size="small"
|
|
3750
3798
|
data-hour="${h}"
|
|
@@ -3770,7 +3818,7 @@ class YumeDatepicker extends HTMLElement {
|
|
|
3770
3818
|
m;
|
|
3771
3819
|
return `<y-button
|
|
3772
3820
|
class="time-btn${sel ? " selected" : ""}"
|
|
3773
|
-
|
|
3821
|
+
variant="${sel ? "filled" : "flat"}"
|
|
3774
3822
|
color="${sel ? this.color : "base"}"
|
|
3775
3823
|
size="small"
|
|
3776
3824
|
data-minute="${m}"
|
|
@@ -3798,7 +3846,7 @@ class YumeDatepicker extends HTMLElement {
|
|
|
3798
3846
|
s;
|
|
3799
3847
|
return `<y-button
|
|
3800
3848
|
class="time-btn${sel ? " selected" : ""}"
|
|
3801
|
-
|
|
3849
|
+
variant="${sel ? "filled" : "flat"}"
|
|
3802
3850
|
color="${sel ? this.color : "base"}"
|
|
3803
3851
|
size="small"
|
|
3804
3852
|
data-second="${s}"
|
|
@@ -3846,7 +3894,7 @@ class YumeDatepicker extends HTMLElement {
|
|
|
3846
3894
|
const disabled = this._isYearDisabled(y);
|
|
3847
3895
|
return `<y-button
|
|
3848
3896
|
class="year-btn"
|
|
3849
|
-
|
|
3897
|
+
variant="${isSelected ? "filled" : "flat"}"
|
|
3850
3898
|
color="${isSelected ? this.color : "base"}"
|
|
3851
3899
|
size="small"
|
|
3852
3900
|
padding-mode="square"
|
|
@@ -5940,7 +5988,7 @@ class YumePaginator extends HTMLElement {
|
|
|
5940
5988
|
const attrs = {
|
|
5941
5989
|
class: `button${isCurrent ? " active" : ""}`,
|
|
5942
5990
|
part: parts.join(" "),
|
|
5943
|
-
"
|
|
5991
|
+
"variant": isCurrent ? "filled" : "flat",
|
|
5944
5992
|
color: isCurrent ? "primary" : "base",
|
|
5945
5993
|
size: this.size,
|
|
5946
5994
|
// Number buttons stay square/circular even in themes (e.g. Material)
|
|
@@ -6013,7 +6061,7 @@ class YumePaginator extends HTMLElement {
|
|
|
6013
6061
|
const attrs = {
|
|
6014
6062
|
class: `nav nav-${direction}`,
|
|
6015
6063
|
part: `${partName}${isDisabled ? " button--disabled" : ""}`,
|
|
6016
|
-
"
|
|
6064
|
+
"variant": "flat",
|
|
6017
6065
|
color: "base",
|
|
6018
6066
|
size: this.size,
|
|
6019
6067
|
"aria-label": cfg.ariaLabel,
|
|
@@ -10797,13 +10845,13 @@ class YumeDataGrid extends HTMLElement {
|
|
|
10797
10845
|
|
|
10798
10846
|
const actions = createElement("div", { class: "filter-actions" });
|
|
10799
10847
|
const clearBtn = createElement("y-button", {
|
|
10800
|
-
"
|
|
10848
|
+
"variant": "flat",
|
|
10801
10849
|
size: "small",
|
|
10802
10850
|
type: "button",
|
|
10803
10851
|
});
|
|
10804
10852
|
clearBtn.textContent = "Clear";
|
|
10805
10853
|
const applyBtn = createElement("y-button", {
|
|
10806
|
-
"
|
|
10854
|
+
"variant": "filled",
|
|
10807
10855
|
color: "primary",
|
|
10808
10856
|
size: "small",
|
|
10809
10857
|
type: "button",
|
|
@@ -7,6 +7,7 @@ class YumeButton extends HTMLElement {
|
|
|
7
7
|
"right-icon",
|
|
8
8
|
"color",
|
|
9
9
|
"size",
|
|
10
|
+
"variant",
|
|
10
11
|
"style-type",
|
|
11
12
|
"type",
|
|
12
13
|
"padding-mode",
|
|
@@ -59,9 +60,13 @@ class YumeButton extends HTMLElement {
|
|
|
59
60
|
}
|
|
60
61
|
}
|
|
61
62
|
|
|
63
|
+
if (name === "style-type" && newValue !== null) {
|
|
64
|
+
this._warnStyleTypeDeprecated();
|
|
65
|
+
}
|
|
66
|
+
|
|
62
67
|
this._init();
|
|
63
68
|
|
|
64
|
-
if (["color", "size", "style-type", "disabled"].includes(name)) {
|
|
69
|
+
if (["color", "size", "variant", "style-type", "disabled"].includes(name)) {
|
|
65
70
|
this._updateStyles();
|
|
66
71
|
}
|
|
67
72
|
}
|
|
@@ -143,9 +148,12 @@ class YumeButton extends HTMLElement {
|
|
|
143
148
|
this.setAttribute("size", val);
|
|
144
149
|
}
|
|
145
150
|
|
|
146
|
-
/**
|
|
151
|
+
/**
|
|
152
|
+
* Deprecated alias for `variant`. Use `variant` instead; retained for
|
|
153
|
+
* backward compatibility and removed in a future major version.
|
|
154
|
+
*/
|
|
147
155
|
get styleType() {
|
|
148
|
-
return this.
|
|
156
|
+
return this.variant;
|
|
149
157
|
}
|
|
150
158
|
set styleType(val) {
|
|
151
159
|
this.setAttribute("style-type", val);
|
|
@@ -188,6 +196,18 @@ class YumeButton extends HTMLElement {
|
|
|
188
196
|
this.setAttribute("value", newVal);
|
|
189
197
|
}
|
|
190
198
|
|
|
199
|
+
/** Visual style: "filled" | "outlined" | "flat" (default "outlined"). */
|
|
200
|
+
get variant() {
|
|
201
|
+
return (
|
|
202
|
+
this.getAttribute("variant") ||
|
|
203
|
+
this.getAttribute("style-type") ||
|
|
204
|
+
"outlined"
|
|
205
|
+
);
|
|
206
|
+
}
|
|
207
|
+
set variant(val) {
|
|
208
|
+
this.setAttribute("variant", val);
|
|
209
|
+
}
|
|
210
|
+
|
|
191
211
|
// -------------------------------------------------------------------------
|
|
192
212
|
// Public
|
|
193
213
|
// -------------------------------------------------------------------------
|
|
@@ -242,7 +262,7 @@ class YumeButton extends HTMLElement {
|
|
|
242
262
|
});
|
|
243
263
|
}
|
|
244
264
|
|
|
245
|
-
_applyCustomColorStyles(color,
|
|
265
|
+
_applyCustomColorStyles(color, variant, size) {
|
|
246
266
|
const text = contrastTextColor(color);
|
|
247
267
|
const hover = `color-mix(in srgb, ${color} 85%, black)`;
|
|
248
268
|
const active = `color-mix(in srgb, ${color} 70%, black)`;
|
|
@@ -298,7 +318,7 @@ class YumeButton extends HTMLElement {
|
|
|
298
318
|
},
|
|
299
319
|
};
|
|
300
320
|
|
|
301
|
-
Object.entries(styles[
|
|
321
|
+
Object.entries(styles[variant] || styles.outlined).forEach(
|
|
302
322
|
([key, val]) => this.button.style.setProperty(key, val),
|
|
303
323
|
);
|
|
304
324
|
|
|
@@ -344,11 +364,11 @@ class YumeButton extends HTMLElement {
|
|
|
344
364
|
);
|
|
345
365
|
}
|
|
346
366
|
|
|
347
|
-
_applyInteractionStyles(vars,
|
|
348
|
-
if (
|
|
367
|
+
_applyInteractionStyles(vars, variant) {
|
|
368
|
+
if (variant === "filled") {
|
|
349
369
|
this._applyFilledInteractionStyles(vars);
|
|
350
370
|
} else {
|
|
351
|
-
this._applyUnfilledInteractionStyles(vars,
|
|
371
|
+
this._applyUnfilledInteractionStyles(vars, variant);
|
|
352
372
|
}
|
|
353
373
|
}
|
|
354
374
|
|
|
@@ -473,7 +493,7 @@ class YumeButton extends HTMLElement {
|
|
|
473
493
|
this.shadowRoot.appendChild(style);
|
|
474
494
|
}
|
|
475
495
|
|
|
476
|
-
_applyUnfilledInteractionStyles(vars,
|
|
496
|
+
_applyUnfilledInteractionStyles(vars, variant) {
|
|
477
497
|
const borderColor = this._outlineBorderColor(
|
|
478
498
|
`var(${vars[7]}, var(${vars[0]}, #f7f7fa))`,
|
|
479
499
|
);
|
|
@@ -503,7 +523,7 @@ class YumeButton extends HTMLElement {
|
|
|
503
523
|
`var(${vars[6]}, #0c0c0d)`,
|
|
504
524
|
);
|
|
505
525
|
|
|
506
|
-
if (
|
|
526
|
+
if (variant === "outlined") {
|
|
507
527
|
// Outlined buttons keep their border color across all states
|
|
508
528
|
this.button.style.setProperty("--hover-border-color", borderColor);
|
|
509
529
|
this.button.style.setProperty("--focus-border-color", borderColor);
|
|
@@ -791,11 +811,11 @@ class YumeButton extends HTMLElement {
|
|
|
791
811
|
}
|
|
792
812
|
|
|
793
813
|
_updateStyles() {
|
|
794
|
-
const { color, size,
|
|
814
|
+
const { color, size, variant } = this;
|
|
795
815
|
const colorVars = this._getColorVarsMap();
|
|
796
816
|
|
|
797
817
|
if (!colorVars[color] && isSafeCssColor(color)) {
|
|
798
|
-
this._applyCustomColorStyles(color,
|
|
818
|
+
this._applyCustomColorStyles(color, variant, size);
|
|
799
819
|
return;
|
|
800
820
|
}
|
|
801
821
|
|
|
@@ -824,14 +844,23 @@ class YumeButton extends HTMLElement {
|
|
|
824
844
|
},
|
|
825
845
|
};
|
|
826
846
|
|
|
827
|
-
const currentStyle = styleVars[
|
|
847
|
+
const currentStyle = styleVars[variant] || styleVars.outlined;
|
|
828
848
|
Object.entries(currentStyle).forEach(([key, value]) => {
|
|
829
849
|
this.button.style.setProperty(key, value);
|
|
830
850
|
});
|
|
831
851
|
|
|
832
|
-
this._applyInteractionStyles(vars,
|
|
852
|
+
this._applyInteractionStyles(vars, variant);
|
|
833
853
|
this._applySizeStyles(size);
|
|
834
854
|
}
|
|
855
|
+
|
|
856
|
+
_warnStyleTypeDeprecated() {
|
|
857
|
+
if (YumeButton._styleTypeDeprecationWarned) return;
|
|
858
|
+
|
|
859
|
+
YumeButton._styleTypeDeprecationWarned = true;
|
|
860
|
+
console.warn(
|
|
861
|
+
'y-button: the "style-type" attribute is deprecated and will be removed in a future major version. Use "variant" instead.',
|
|
862
|
+
);
|
|
863
|
+
}
|
|
835
864
|
}
|
|
836
865
|
|
|
837
866
|
if (!customElements.get("y-button")) {
|
|
@@ -1330,7 +1359,10 @@ class YumeInput extends HTMLElement {
|
|
|
1330
1359
|
: "default";
|
|
1331
1360
|
}
|
|
1332
1361
|
set variant(val) {
|
|
1333
|
-
this.setAttribute(
|
|
1362
|
+
this.setAttribute(
|
|
1363
|
+
"variant",
|
|
1364
|
+
val === "underline" ? "underline" : "default",
|
|
1365
|
+
);
|
|
1334
1366
|
}
|
|
1335
1367
|
|
|
1336
1368
|
/** @type {string} Input type (default "text"). */
|
|
@@ -1398,6 +1430,13 @@ class YumeInput extends HTMLElement {
|
|
|
1398
1430
|
// -------------------------------------------------------------------------
|
|
1399
1431
|
|
|
1400
1432
|
_bindInputListeners() {
|
|
1433
|
+
this.inputContainer.addEventListener("mousedown", (e) => {
|
|
1434
|
+
if (e.target !== this.input) {
|
|
1435
|
+
e.preventDefault();
|
|
1436
|
+
this.input.focus();
|
|
1437
|
+
}
|
|
1438
|
+
});
|
|
1439
|
+
|
|
1401
1440
|
this.input.addEventListener("input", (e) => {
|
|
1402
1441
|
this.setAttribute("value", e.target.value);
|
|
1403
1442
|
this.dispatchEvent(
|
|
@@ -2588,7 +2627,7 @@ class YumeSelect extends HTMLElement {
|
|
|
2588
2627
|
tag.setAttribute("removable", "");
|
|
2589
2628
|
tag.setAttribute("size", "small");
|
|
2590
2629
|
tag.setAttribute("color", opt.color || "primary");
|
|
2591
|
-
tag.setAttribute("
|
|
2630
|
+
tag.setAttribute("variant", "filled");
|
|
2592
2631
|
tag.textContent = opt.label;
|
|
2593
2632
|
tag.dataset.value = opt.value;
|
|
2594
2633
|
|
|
@@ -3068,7 +3107,10 @@ class YumeDatepicker extends HTMLElement {
|
|
|
3068
3107
|
root.querySelectorAll(".month-btn").forEach((btn) => {
|
|
3069
3108
|
btn.addEventListener("click", () => {
|
|
3070
3109
|
const vd = this._viewDateForSide(btn.dataset.side);
|
|
3071
|
-
this._selectMonth(
|
|
3110
|
+
this._selectMonth(
|
|
3111
|
+
vd.getFullYear(),
|
|
3112
|
+
parseInt(btn.dataset.month),
|
|
3113
|
+
);
|
|
3072
3114
|
});
|
|
3073
3115
|
});
|
|
3074
3116
|
|
|
@@ -3144,20 +3186,20 @@ class YumeDatepicker extends HTMLElement {
|
|
|
3144
3186
|
const isSelected = this._sameDay(date, this._startDate);
|
|
3145
3187
|
const inRange = this._inRange(date);
|
|
3146
3188
|
|
|
3147
|
-
let
|
|
3189
|
+
let variant = "flat";
|
|
3148
3190
|
let color = "base";
|
|
3149
3191
|
|
|
3150
3192
|
if (isEdge || isSelected) {
|
|
3151
|
-
|
|
3193
|
+
variant = "filled";
|
|
3152
3194
|
color = this.color;
|
|
3153
3195
|
} else if (inRange) {
|
|
3154
|
-
|
|
3196
|
+
variant = "flat";
|
|
3155
3197
|
color = this.color;
|
|
3156
3198
|
}
|
|
3157
3199
|
|
|
3158
3200
|
return `<y-button
|
|
3159
3201
|
class="day-btn"
|
|
3160
|
-
|
|
3202
|
+
variant="${variant}"
|
|
3161
3203
|
color="${color}"
|
|
3162
3204
|
size="medium"
|
|
3163
3205
|
padding-mode="square"
|
|
@@ -3211,16 +3253,16 @@ class YumeDatepicker extends HTMLElement {
|
|
|
3211
3253
|
return `
|
|
3212
3254
|
<div class="cal-header">
|
|
3213
3255
|
<div class="nav-start">
|
|
3214
|
-
${showPrev ? `<y-button class="nav-btn" data-action="prev-year" padding-mode="square" data-side="${side}"
|
|
3215
|
-
${showPrev ? `<y-button class="nav-btn" data-action="prev-month" padding-mode="square"data-side="${side}"
|
|
3256
|
+
${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>` : ""}
|
|
3257
|
+
${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>` : ""}
|
|
3216
3258
|
</div>
|
|
3217
3259
|
<div class="header-selects">
|
|
3218
3260
|
${this.showMonths ? `<y-select class="month-sel" data-side="${side}" size="small" value="${month}" options='${monthOptions}'></y-select>` : ""}
|
|
3219
3261
|
${this.showYears ? `<y-select class="year-sel" data-side="${side}" size="small" value="${year}" options='${yearOptions}'></y-select>` : ""}
|
|
3220
3262
|
</div>
|
|
3221
3263
|
<div class="nav-end">
|
|
3222
|
-
${showNext ? `<y-button class="nav-btn" data-action="next-month" padding-mode="square" data-side="${side}"
|
|
3223
|
-
${showNext ? `<y-button class="nav-btn" data-action="next-year" padding-mode="square" data-side="${side}"
|
|
3264
|
+
${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>` : ""}
|
|
3265
|
+
${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>` : ""}
|
|
3224
3266
|
</div>
|
|
3225
3267
|
</div>
|
|
3226
3268
|
`;
|
|
@@ -3238,7 +3280,7 @@ class YumeDatepicker extends HTMLElement {
|
|
|
3238
3280
|
this._startDate.getMonth() === i;
|
|
3239
3281
|
return `<y-button
|
|
3240
3282
|
class="month-btn"
|
|
3241
|
-
|
|
3283
|
+
variant="${isSelected ? "filled" : "flat"}"
|
|
3242
3284
|
color="${isSelected ? this.color : "base"}"
|
|
3243
3285
|
size="small"
|
|
3244
3286
|
padding-mode="square"
|
|
@@ -3485,7 +3527,7 @@ class YumeDatepicker extends HTMLElement {
|
|
|
3485
3527
|
const sel = time.h === h;
|
|
3486
3528
|
return `<y-button
|
|
3487
3529
|
class="time-btn${sel ? " selected" : ""}"
|
|
3488
|
-
|
|
3530
|
+
variant="${sel ? "filled" : "flat"}"
|
|
3489
3531
|
color="${sel ? this.color : "base"}"
|
|
3490
3532
|
size="small"
|
|
3491
3533
|
data-hour="${h}"
|
|
@@ -3511,7 +3553,7 @@ class YumeDatepicker extends HTMLElement {
|
|
|
3511
3553
|
m;
|
|
3512
3554
|
return `<y-button
|
|
3513
3555
|
class="time-btn${sel ? " selected" : ""}"
|
|
3514
|
-
|
|
3556
|
+
variant="${sel ? "filled" : "flat"}"
|
|
3515
3557
|
color="${sel ? this.color : "base"}"
|
|
3516
3558
|
size="small"
|
|
3517
3559
|
data-minute="${m}"
|
|
@@ -3539,7 +3581,7 @@ class YumeDatepicker extends HTMLElement {
|
|
|
3539
3581
|
s;
|
|
3540
3582
|
return `<y-button
|
|
3541
3583
|
class="time-btn${sel ? " selected" : ""}"
|
|
3542
|
-
|
|
3584
|
+
variant="${sel ? "filled" : "flat"}"
|
|
3543
3585
|
color="${sel ? this.color : "base"}"
|
|
3544
3586
|
size="small"
|
|
3545
3587
|
data-second="${s}"
|
|
@@ -3587,7 +3629,7 @@ class YumeDatepicker extends HTMLElement {
|
|
|
3587
3629
|
const disabled = this._isYearDisabled(y);
|
|
3588
3630
|
return `<y-button
|
|
3589
3631
|
class="year-btn"
|
|
3590
|
-
|
|
3632
|
+
variant="${isSelected ? "filled" : "flat"}"
|
|
3591
3633
|
color="${isSelected ? this.color : "base"}"
|
|
3592
3634
|
size="small"
|
|
3593
3635
|
padding-mode="square"
|