@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.
@@ -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
- /** Visual style: "filled" | "outlined" | "flat" (default "outlined"). */
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.getAttribute("style-type") || "outlined";
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, styleType, size) {
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[styleType] || styles.outlined).forEach(
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, styleType) {
348
- if (styleType === "filled") {
367
+ _applyInteractionStyles(vars, variant) {
368
+ if (variant === "filled") {
349
369
  this._applyFilledInteractionStyles(vars);
350
370
  } else {
351
- this._applyUnfilledInteractionStyles(vars, styleType);
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, styleType) {
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 (styleType === "outlined") {
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, styleType } = this;
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, styleType, size);
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[styleType] || styleVars.outlined;
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, styleType);
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("variant", val === "underline" ? "underline" : "default");
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("style-type", "filled");
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(vd.getFullYear(), parseInt(btn.dataset.month));
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 styleType = "flat";
3189
+ let variant = "flat";
3148
3190
  let color = "base";
3149
3191
 
3150
3192
  if (isEdge || isSelected) {
3151
- styleType = "filled";
3193
+ variant = "filled";
3152
3194
  color = this.color;
3153
3195
  } else if (inRange) {
3154
- styleType = "flat";
3196
+ variant = "flat";
3155
3197
  color = this.color;
3156
3198
  }
3157
3199
 
3158
3200
  return `<y-button
3159
3201
  class="day-btn"
3160
- style-type="${styleType}"
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}" style-type="flat" size="small" aria-label="Previous year"><y-icon name="expand-left" size="small"></y-icon></y-button>` : ""}
3215
- ${showPrev ? `<y-button class="nav-btn" data-action="prev-month" padding-mode="square"data-side="${side}" style-type="flat" size="small" aria-label="Previous month"><y-icon name="chevron-left" size="small"></y-icon></y-button>` : ""}
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}" style-type="flat" size="small" aria-label="Next month"><y-icon name="chevron-right" size="small"></y-icon></y-button>` : ""}
3223
- ${showNext ? `<y-button class="nav-btn" data-action="next-year" padding-mode="square" data-side="${side}" style-type="flat" size="small" aria-label="Next year"><y-icon name="expand-right" size="small"></y-icon></y-button>` : ""}
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
- style-type="${isSelected ? "filled" : "flat"}"
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
- style-type="${sel ? "filled" : "flat"}"
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
- style-type="${sel ? "filled" : "flat"}"
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
- style-type="${sel ? "filled" : "flat"}"
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
- style-type="${isSelected ? "filled" : "flat"}"
3632
+ variant="${isSelected ? "filled" : "flat"}"
3591
3633
  color="${isSelected ? this.color : "base"}"
3592
3634
  size="small"
3593
3635
  padding-mode="square"
@@ -106,7 +106,7 @@ class YumeDialog extends HTMLElement {
106
106
  _buildCloseButton() {
107
107
  const btn = document.createElement("y-button");
108
108
  btn.setAttribute("size", "small");
109
- btn.setAttribute("style-type", "flat");
109
+ btn.setAttribute("variant", "flat");
110
110
  btn.setAttribute("aria-label", "Close");
111
111
  btn.textContent = "\u2715";
112
112
  btn.addEventListener("click", () => { this.visible = false; });
@@ -367,6 +367,7 @@ class YumeButton extends HTMLElement {
367
367
  "right-icon",
368
368
  "color",
369
369
  "size",
370
+ "variant",
370
371
  "style-type",
371
372
  "type",
372
373
  "padding-mode",
@@ -419,9 +420,13 @@ class YumeButton extends HTMLElement {
419
420
  }
420
421
  }
421
422
 
423
+ if (name === "style-type" && newValue !== null) {
424
+ this._warnStyleTypeDeprecated();
425
+ }
426
+
422
427
  this._init();
423
428
 
424
- if (["color", "size", "style-type", "disabled"].includes(name)) {
429
+ if (["color", "size", "variant", "style-type", "disabled"].includes(name)) {
425
430
  this._updateStyles();
426
431
  }
427
432
  }
@@ -503,9 +508,12 @@ class YumeButton extends HTMLElement {
503
508
  this.setAttribute("size", val);
504
509
  }
505
510
 
506
- /** Visual style: "filled" | "outlined" | "flat" (default "outlined"). */
511
+ /**
512
+ * Deprecated alias for `variant`. Use `variant` instead; retained for
513
+ * backward compatibility and removed in a future major version.
514
+ */
507
515
  get styleType() {
508
- return this.getAttribute("style-type") || "outlined";
516
+ return this.variant;
509
517
  }
510
518
  set styleType(val) {
511
519
  this.setAttribute("style-type", val);
@@ -548,6 +556,18 @@ class YumeButton extends HTMLElement {
548
556
  this.setAttribute("value", newVal);
549
557
  }
550
558
 
559
+ /** Visual style: "filled" | "outlined" | "flat" (default "outlined"). */
560
+ get variant() {
561
+ return (
562
+ this.getAttribute("variant") ||
563
+ this.getAttribute("style-type") ||
564
+ "outlined"
565
+ );
566
+ }
567
+ set variant(val) {
568
+ this.setAttribute("variant", val);
569
+ }
570
+
551
571
  // -------------------------------------------------------------------------
552
572
  // Public
553
573
  // -------------------------------------------------------------------------
@@ -602,7 +622,7 @@ class YumeButton extends HTMLElement {
602
622
  });
603
623
  }
604
624
 
605
- _applyCustomColorStyles(color, styleType, size) {
625
+ _applyCustomColorStyles(color, variant, size) {
606
626
  const text = contrastTextColor(color);
607
627
  const hover = `color-mix(in srgb, ${color} 85%, black)`;
608
628
  const active = `color-mix(in srgb, ${color} 70%, black)`;
@@ -658,7 +678,7 @@ class YumeButton extends HTMLElement {
658
678
  },
659
679
  };
660
680
 
661
- Object.entries(styles[styleType] || styles.outlined).forEach(
681
+ Object.entries(styles[variant] || styles.outlined).forEach(
662
682
  ([key, val]) => this.button.style.setProperty(key, val),
663
683
  );
664
684
 
@@ -704,11 +724,11 @@ class YumeButton extends HTMLElement {
704
724
  );
705
725
  }
706
726
 
707
- _applyInteractionStyles(vars, styleType) {
708
- if (styleType === "filled") {
727
+ _applyInteractionStyles(vars, variant) {
728
+ if (variant === "filled") {
709
729
  this._applyFilledInteractionStyles(vars);
710
730
  } else {
711
- this._applyUnfilledInteractionStyles(vars, styleType);
731
+ this._applyUnfilledInteractionStyles(vars, variant);
712
732
  }
713
733
  }
714
734
 
@@ -833,7 +853,7 @@ class YumeButton extends HTMLElement {
833
853
  this.shadowRoot.appendChild(style);
834
854
  }
835
855
 
836
- _applyUnfilledInteractionStyles(vars, styleType) {
856
+ _applyUnfilledInteractionStyles(vars, variant) {
837
857
  const borderColor = this._outlineBorderColor(
838
858
  `var(${vars[7]}, var(${vars[0]}, #f7f7fa))`,
839
859
  );
@@ -863,7 +883,7 @@ class YumeButton extends HTMLElement {
863
883
  `var(${vars[6]}, #0c0c0d)`,
864
884
  );
865
885
 
866
- if (styleType === "outlined") {
886
+ if (variant === "outlined") {
867
887
  // Outlined buttons keep their border color across all states
868
888
  this.button.style.setProperty("--hover-border-color", borderColor);
869
889
  this.button.style.setProperty("--focus-border-color", borderColor);
@@ -1151,11 +1171,11 @@ class YumeButton extends HTMLElement {
1151
1171
  }
1152
1172
 
1153
1173
  _updateStyles() {
1154
- const { color, size, styleType } = this;
1174
+ const { color, size, variant } = this;
1155
1175
  const colorVars = this._getColorVarsMap();
1156
1176
 
1157
1177
  if (!colorVars[color] && isSafeCssColor(color)) {
1158
- this._applyCustomColorStyles(color, styleType, size);
1178
+ this._applyCustomColorStyles(color, variant, size);
1159
1179
  return;
1160
1180
  }
1161
1181
 
@@ -1184,14 +1204,23 @@ class YumeButton extends HTMLElement {
1184
1204
  },
1185
1205
  };
1186
1206
 
1187
- const currentStyle = styleVars[styleType] || styleVars.outlined;
1207
+ const currentStyle = styleVars[variant] || styleVars.outlined;
1188
1208
  Object.entries(currentStyle).forEach(([key, value]) => {
1189
1209
  this.button.style.setProperty(key, value);
1190
1210
  });
1191
1211
 
1192
- this._applyInteractionStyles(vars, styleType);
1212
+ this._applyInteractionStyles(vars, variant);
1193
1213
  this._applySizeStyles(size);
1194
1214
  }
1215
+
1216
+ _warnStyleTypeDeprecated() {
1217
+ if (YumeButton._styleTypeDeprecationWarned) return;
1218
+
1219
+ YumeButton._styleTypeDeprecationWarned = true;
1220
+ console.warn(
1221
+ 'y-button: the "style-type" attribute is deprecated and will be removed in a future major version. Use "variant" instead.',
1222
+ );
1223
+ }
1195
1224
  }
1196
1225
 
1197
1226
  if (!customElements.get("y-button")) {
@@ -3682,7 +3711,7 @@ class YumeHelp extends HTMLElement {
3682
3711
  {
3683
3712
  class: "y-help-tooltip-close",
3684
3713
  part: "close-button",
3685
- "style-type": "flat",
3714
+ "variant": "flat",
3686
3715
  size: "small",
3687
3716
  "aria-label": this.closeLabel,
3688
3717
  },
@@ -3719,7 +3748,7 @@ class YumeHelp extends HTMLElement {
3719
3748
  {
3720
3749
  class: "y-help-tooltip-btn",
3721
3750
  part: "prev-button",
3722
- "style-type": "outlined",
3751
+ "variant": "outlined",
3723
3752
  size: "small",
3724
3753
  "aria-label": this.prevLabel,
3725
3754
  },
@@ -3731,7 +3760,7 @@ class YumeHelp extends HTMLElement {
3731
3760
  {
3732
3761
  class: "y-help-tooltip-btn",
3733
3762
  part: "next-button",
3734
- "style-type": "filled",
3763
+ "variant": "filled",
3735
3764
  color: "primary",
3736
3765
  size: "small",
3737
3766
  "aria-label": this.nextLabel,
@@ -132,7 +132,10 @@ class YumeInput extends HTMLElement {
132
132
  : "default";
133
133
  }
134
134
  set variant(val) {
135
- this.setAttribute("variant", val === "underline" ? "underline" : "default");
135
+ this.setAttribute(
136
+ "variant",
137
+ val === "underline" ? "underline" : "default",
138
+ );
136
139
  }
137
140
 
138
141
  /** @type {string} Input type (default "text"). */
@@ -200,6 +203,13 @@ class YumeInput extends HTMLElement {
200
203
  // -------------------------------------------------------------------------
201
204
 
202
205
  _bindInputListeners() {
206
+ this.inputContainer.addEventListener("mousedown", (e) => {
207
+ if (e.target !== this.input) {
208
+ e.preventDefault();
209
+ this.input.focus();
210
+ }
211
+ });
212
+
203
213
  this.input.addEventListener("input", (e) => {
204
214
  this.setAttribute("value", e.target.value);
205
215
  this.dispatchEvent(
@@ -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
- /** Visual style: "filled" | "outlined" | "flat" (default "outlined"). */
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.getAttribute("style-type") || "outlined";
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, styleType, size) {
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[styleType] || styles.outlined).forEach(
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, styleType) {
348
- if (styleType === "filled") {
367
+ _applyInteractionStyles(vars, variant) {
368
+ if (variant === "filled") {
349
369
  this._applyFilledInteractionStyles(vars);
350
370
  } else {
351
- this._applyUnfilledInteractionStyles(vars, styleType);
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, styleType) {
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 (styleType === "outlined") {
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, styleType } = this;
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, styleType, size);
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[styleType] || styleVars.outlined;
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, styleType);
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")) {
@@ -2197,7 +2226,7 @@ class YumeSelect extends HTMLElement {
2197
2226
  tag.setAttribute("removable", "");
2198
2227
  tag.setAttribute("size", "small");
2199
2228
  tag.setAttribute("color", opt.color || "primary");
2200
- tag.setAttribute("style-type", "filled");
2229
+ tag.setAttribute("variant", "filled");
2201
2230
  tag.textContent = opt.label;
2202
2231
  tag.dataset.value = opt.value;
2203
2232
 
@@ -2586,7 +2615,7 @@ class YumePaginator extends HTMLElement {
2586
2615
  const attrs = {
2587
2616
  class: `button${isCurrent ? " active" : ""}`,
2588
2617
  part: parts.join(" "),
2589
- "style-type": isCurrent ? "filled" : "flat",
2618
+ "variant": isCurrent ? "filled" : "flat",
2590
2619
  color: isCurrent ? "primary" : "base",
2591
2620
  size: this.size,
2592
2621
  // Number buttons stay square/circular even in themes (e.g. Material)
@@ -2659,7 +2688,7 @@ class YumePaginator extends HTMLElement {
2659
2688
  const attrs = {
2660
2689
  class: `nav nav-${direction}`,
2661
2690
  part: `${partName}${isDisabled ? " button--disabled" : ""}`,
2662
- "style-type": "flat",
2691
+ "variant": "flat",
2663
2692
  color: "base",
2664
2693
  size: this.size,
2665
2694
  "aria-label": cfg.ariaLabel,
@@ -1359,7 +1359,7 @@ class YumeSelect extends HTMLElement {
1359
1359
  tag.setAttribute("removable", "");
1360
1360
  tag.setAttribute("size", "small");
1361
1361
  tag.setAttribute("color", opt.color || "primary");
1362
- tag.setAttribute("style-type", "filled");
1362
+ tag.setAttribute("variant", "filled");
1363
1363
  tag.textContent = opt.label;
1364
1364
  tag.dataset.value = opt.value;
1365
1365