@histoire/controls 0.17.15 → 0.17.17

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.
Files changed (56) hide show
  1. package/dist/components/HstCopyIcon.vue.d.ts +3 -3
  2. package/dist/components/HstWrapper.vue.d.ts +11 -11
  3. package/dist/components/button/HstButton.vue.d.ts +141 -10
  4. package/dist/components/button/HstButtonGroup.vue.d.ts +9 -9
  5. package/dist/components/checkbox/HstCheckbox.vue.d.ts +8 -8
  6. package/dist/components/checkbox/HstCheckboxList.vue.d.ts +9 -9
  7. package/dist/components/checkbox/HstSimpleCheckbox.vue.d.ts +3 -3
  8. package/dist/components/colorselect/HstColorSelect.vue.d.ts +8 -8
  9. package/dist/components/design-tokens/HstColorShades.vue.d.ts +8 -8
  10. package/dist/components/design-tokens/HstTokenGrid.vue.d.ts +12 -12
  11. package/dist/components/design-tokens/HstTokenList.vue.d.ts +9 -9
  12. package/dist/components/json/HstJson.vue.d.ts +8 -8
  13. package/dist/components/number/HstNumber.vue.d.ts +8 -8
  14. package/dist/components/radio/HstRadio.vue.d.ts +9 -9
  15. package/dist/components/select/CustomSelect.vue.d.ts +9 -9
  16. package/dist/components/select/HstSelect.vue.d.ts +9 -9
  17. package/dist/components/slider/HstSlider.vue.d.ts +3 -3
  18. package/dist/components/text/HstText.vue.d.ts +8 -8
  19. package/dist/components/textarea/HstTextarea.vue.d.ts +8 -8
  20. package/dist/index.d.ts +48 -48
  21. package/dist/index.es.js +69 -67
  22. package/dist/style.css +1 -1
  23. package/package.json +12 -12
  24. package/src/components/HstCopyIcon.vue +1 -1
  25. package/src/components/HstWrapper.vue +0 -1
  26. package/src/components/button/HstButton.story.vue +1 -1
  27. package/src/components/button/HstButtonGroup.story.vue +2 -2
  28. package/src/components/button/HstButtonGroup.vue +8 -5
  29. package/src/components/checkbox/HstCheckbox.spec.ts +3 -3
  30. package/src/components/checkbox/HstCheckbox.story.vue +1 -1
  31. package/src/components/checkbox/HstCheckbox.vue +2 -2
  32. package/src/components/checkbox/HstCheckboxList.story.vue +1 -1
  33. package/src/components/checkbox/HstCheckboxList.vue +9 -6
  34. package/src/components/checkbox/HstSimpleCheckbox.story.vue +1 -1
  35. package/src/components/checkbox/HstSimpleCheckbox.vue +2 -2
  36. package/src/components/checkbox/__snapshots__/HstCheckbox.spec.ts.snap +4 -0
  37. package/src/components/colorselect/HstColorSelect.vue +1 -4
  38. package/src/components/design-tokens/HstColorShades.story.vue +2 -2
  39. package/src/components/design-tokens/HstColorShades.vue +2 -2
  40. package/src/components/design-tokens/HstTokenGrid.story.vue +6 -6
  41. package/src/components/design-tokens/HstTokenList.story.vue +23 -23
  42. package/src/components/json/HstJson.story.vue +1 -1
  43. package/src/components/json/HstJson.vue +15 -12
  44. package/src/components/number/HstNumber.story.vue +1 -1
  45. package/src/components/number/HstNumber.vue +8 -8
  46. package/src/components/radio/HstRadio.story.vue +1 -1
  47. package/src/components/radio/HstRadio.vue +7 -5
  48. package/src/components/select/CustomSelect.vue +9 -7
  49. package/src/components/select/HstSelect.story.vue +1 -1
  50. package/src/components/select/HstSelect.vue +1 -1
  51. package/src/components/slider/HstSlider.vue +3 -3
  52. package/src/components/text/HstText.story.vue +1 -1
  53. package/src/components/textarea/HstTextarea.story.vue +1 -1
  54. package/tailwind.config.cjs +1 -1
  55. package/tsconfig.json +25 -25
  56. package/vite.config.ts +8 -8
package/dist/index.es.js CHANGED
@@ -1,4 +1,4 @@
1
- import { defineComponent as et, openBlock as D, createElementBlock as K, normalizeClass as dt, renderSlot as ht, createBlock as Q, resolveDynamicComponent as ma, withCtx as G, withDirectives as Et, createTextVNode as se, toDisplayString as Dt, unref as Ct, createElementVNode as B, computed as nt, Fragment as ge, renderList as Ve, watch as as, ref as rt, withKeys as Ue, withModifiers as Ye, createVNode as Ts, normalizeStyle as Pt, mergeProps as He, onUnmounted as wa, vModelText as qn, createCommentVNode as te, onMounted as ya, watchEffect as ba } from "@histoire/vendors/vue";
1
+ import { defineComponent as et, openBlock as D, createElementBlock as K, normalizeClass as dt, renderSlot as ht, createBlock as Q, resolveDynamicComponent as ma, withCtx as G, withDirectives as Et, createTextVNode as se, toDisplayString as Dt, unref as Ct, createElementVNode as B, computed as nt, Fragment as ge, renderList as Ve, watch as as, ref as lt, withKeys as Ue, withModifiers as Ye, createVNode as Ts, normalizeStyle as Pt, mergeProps as He, onUnmounted as wa, vModelText as qn, createCommentVNode as te, onMounted as ya, watchEffect as ba } from "@histoire/vendors/vue";
2
2
  import { VTooltip as me, Dropdown as ka } from "@histoire/vendors/floating-vue";
3
3
  import { Icon as Gn } from "@histoire/vendors/iconify";
4
4
  import { useClipboard as xa } from "@histoire/vendors/vue-use";
@@ -121,7 +121,7 @@ const va = {
121
121
  as(() => e.modelValue, () => {
122
122
  a.value = !0;
123
123
  });
124
- const r = rt(), o = rt(0), l = nt(() => e.modelValue ? 1 : 0), h = nt(() => (1 - l.value) * o.value), a = rt(!1);
124
+ const r = lt(), o = lt(0), l = nt(() => e.modelValue ? 1 : 0), h = nt(() => (1 - l.value) * o.value), a = lt(!1);
125
125
  return as(r, () => {
126
126
  var c, f;
127
127
  o.value = ((f = (c = r.value).getTotalLength) == null ? void 0 : f.call(c)) ?? 21.21;
@@ -253,7 +253,7 @@ const va = {
253
253
  "update:modelValue": (n) => !0
254
254
  },
255
255
  setup(n, { emit: t }) {
256
- const e = t, i = rt();
256
+ const e = t, i = lt();
257
257
  return (s, r) => (D(), Q(Vt, {
258
258
  title: s.title,
259
259
  class: dt(["histoire-text htw-cursor-text htw-items-center", s.$attrs.class]),
@@ -295,18 +295,18 @@ const va = {
295
295
  set: (d) => {
296
296
  i("update:modelValue", d);
297
297
  }
298
- }), r = rt();
298
+ }), r = lt();
299
299
  function o() {
300
300
  r.value.focus(), r.value.select();
301
301
  }
302
- const l = rt(!1);
302
+ const l = lt(!1);
303
303
  let h, a;
304
304
  function c(d) {
305
305
  l.value = !0, h = d.clientX, a = s.value, window.addEventListener("mousemove", f), window.addEventListener("mouseup", u);
306
306
  }
307
307
  function f(d) {
308
- let p = parseFloat(r.value.step);
309
- isNaN(p) && (p = 1), s.value = a + Math.round((d.clientX - h) / 10 / p) * p;
308
+ let p = Number.parseFloat(r.value.step);
309
+ Number.isNaN(p) && (p = 1), s.value = a + Math.round((d.clientX - h) / 10 / p) * p;
310
310
  }
311
311
  function u() {
312
312
  l.value = !1, window.removeEventListener("mousemove", f), window.removeEventListener("mouseup", u);
@@ -365,13 +365,13 @@ const va = {
365
365
  "update:modelValue": (n) => !0
366
366
  },
367
367
  setup(n, { emit: t }) {
368
- const e = n, i = t, s = rt(!1), r = rt(null), o = nt({
368
+ const e = n, i = t, s = lt(!1), r = lt(null), o = nt({
369
369
  get: () => e.modelValue,
370
370
  set: (a) => {
371
371
  i("update:modelValue", a);
372
372
  }
373
373
  }), l = nt(() => (e.modelValue - e.min) / (e.max - e.min)), h = nt(() => r.value ? {
374
- left: 8 + (r.value.clientWidth - 16) * l.value + "px"
374
+ left: `${8 + (r.value.clientWidth - 16) * l.value}px`
375
375
  } : {});
376
376
  return (a, c) => (D(), Q(Vt, {
377
377
  class: dt(["histoire-slider htw-items-center", a.$attrs.class]),
@@ -423,7 +423,7 @@ const va = {
423
423
  "update:modelValue": (n) => !0
424
424
  },
425
425
  setup(n, { emit: t }) {
426
- const e = t, i = rt();
426
+ const e = t, i = lt();
427
427
  return (s, r) => (D(), Q(Vt, {
428
428
  title: s.title,
429
429
  class: dt(["histoire-textarea htw-cursor-text", s.$attrs.class]),
@@ -532,10 +532,11 @@ const va = {
532
532
  content: { type: [String, Function] }
533
533
  },
534
534
  setup(n) {
535
- const t = n, { copy: e, copied: i } = xa(), s = async () => {
535
+ const t = n, { copy: e, copied: i } = xa();
536
+ async function s() {
536
537
  const r = typeof t.content == "function" ? await t.content() : t.content;
537
538
  e(r);
538
- };
539
+ }
539
540
  return (r, o) => Et((D(), Q(Ct(Gn), {
540
541
  icon: "carbon:copy-file",
541
542
  class: "htw-w-4 htw-h-4 htw-opacity-50 hover:htw-opacity-100 hover:htw-text-primary-500 htw-cursor-pointer",
@@ -563,10 +564,14 @@ const va = {
563
564
  search: {}
564
565
  },
565
566
  setup(n) {
566
- const t = n, e = (o, l = "") => Object.entries(o).reduce((h, [a, c]) => {
567
- const f = l ? a === "DEFAULT" ? l : `${l}-${a}` : a, u = typeof c == "object" ? e(c, f) : { [f]: c };
568
- return { ...h, ...u };
569
- }, {}), i = nt(() => {
567
+ const t = n;
568
+ function e(o, l = "") {
569
+ return Object.entries(o).reduce((h, [a, c]) => {
570
+ const f = l ? a === "DEFAULT" ? l : `${l}-${a}` : a, u = typeof c == "object" ? e(c, f) : { [f]: c };
571
+ return { ...h, ...u };
572
+ }, {});
573
+ }
574
+ const i = nt(() => {
570
575
  const o = t.shades, l = t.getName, h = e(o);
571
576
  return Object.entries(h).map(([a, c]) => {
572
577
  const f = l ? l(a, c) : a;
@@ -583,7 +588,7 @@ const va = {
583
588
  o = o.filter(({ name: h }) => l.test(h));
584
589
  }
585
590
  return o;
586
- }), r = rt(null);
591
+ }), r = lt(null);
587
592
  return (o, l) => s.value.length ? (D(), K("div", oc, [
588
593
  (D(!0), K(ge, null, Ve(s.value, (h) => (D(), K("div", {
589
594
  key: h.key,
@@ -649,7 +654,7 @@ const va = {
649
654
  value: typeof l == "number" ? l.toString() : l
650
655
  };
651
656
  });
652
- }), i = rt(null);
657
+ }), i = lt(null);
653
658
  return (s, r) => (D(!0), K(ge, null, Ve(e.value, (o) => (D(), K("div", {
654
659
  key: o.key,
655
660
  class: "histoire-token-list htw-flex htw-flex-col htw-gap-2 htw-my-8",
@@ -697,7 +702,7 @@ const va = {
697
702
  value: typeof h == "number" ? h.toString() : h
698
703
  };
699
704
  });
700
- }), i = nt(() => `${t.colSize}px`), s = rt(null);
705
+ }), i = nt(() => `${t.colSize}px`), s = lt(null);
701
706
  return (r, o) => (D(), K("div", {
702
707
  class: "histoire-token-grid htw-bind-col-size htw-grid htw-gap-4 htw-m-4",
703
708
  style: Pt({
@@ -755,7 +760,7 @@ const va = {
755
760
  function r(l) {
756
761
  s("update:modelValue", l), o.value = !0;
757
762
  }
758
- const o = rt(!1);
763
+ const o = lt(!1);
759
764
  return (l, h) => (D(), Q(Vt, {
760
765
  role: "group",
761
766
  title: l.title,
@@ -3627,12 +3632,12 @@ var ye = {
3627
3632
  221: "}",
3628
3633
  222: '"'
3629
3634
  }, Xc = typeof navigator < "u" && /Mac/.test(navigator.platform), Zc = typeof navigator < "u" && /MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);
3630
- for (var lt = 0; lt < 10; lt++)
3631
- ye[48 + lt] = ye[96 + lt] = String(lt);
3632
- for (var lt = 1; lt <= 24; lt++)
3633
- ye[lt + 111] = "F" + lt;
3634
- for (var lt = 65; lt <= 90; lt++)
3635
- ye[lt] = String.fromCharCode(lt + 32), yi[lt] = String.fromCharCode(lt);
3635
+ for (var ot = 0; ot < 10; ot++)
3636
+ ye[48 + ot] = ye[96 + ot] = String(ot);
3637
+ for (var ot = 1; ot <= 24; ot++)
3638
+ ye[ot + 111] = "F" + ot;
3639
+ for (var ot = 65; ot <= 90; ot++)
3640
+ ye[ot] = String.fromCharCode(ot + 32), yi[ot] = String.fromCharCode(ot);
3636
3641
  for (var $s in ye)
3637
3642
  yi.hasOwnProperty($s) || (yi[$s] = ye[$s]);
3638
3643
  function tf(n) {
@@ -6689,7 +6694,7 @@ class xt extends oh {
6689
6694
  }
6690
6695
  replace(t, e, i) {
6691
6696
  let s = i[0];
6692
- return i.length == 1 && (s instanceof xt || s instanceof ot && s.flags & 4) && Math.abs(this.length - s.length) < 10 ? (s instanceof ot ? s = new xt(s.length, this.height) : s.height = this.height, this.outdated || (s.outdated = !1), s) : pt.of(i);
6697
+ return i.length == 1 && (s instanceof xt || s instanceof rt && s.flags & 4) && Math.abs(this.length - s.length) < 10 ? (s instanceof rt ? s = new xt(s.length, this.height) : s.height = this.height, this.outdated || (s.outdated = !1), s) : pt.of(i);
6693
6698
  }
6694
6699
  updateHeight(t, e = 0, i = !1, s) {
6695
6700
  return s && s.from <= e && s.more ? this.setHeight(t, s.heights[s.index++]) : (i || this.outdated) && this.setHeight(t, Math.max(this.widgetHeight, t.heightForLine(this.length - this.collapsed)) + this.breaks * t.lineHeight), this.outdated = !1, this;
@@ -6698,7 +6703,7 @@ class xt extends oh {
6698
6703
  return `line(${this.length}${this.collapsed ? -this.collapsed : ""}${this.widgetHeight ? ":" + this.widgetHeight : ""})`;
6699
6704
  }
6700
6705
  }
6701
- class ot extends pt {
6706
+ class rt extends pt {
6702
6707
  constructor(t) {
6703
6708
  super(t, 0);
6704
6709
  }
@@ -6748,25 +6753,25 @@ class ot extends pt {
6748
6753
  let s = this.length - e;
6749
6754
  if (s > 0) {
6750
6755
  let r = i[i.length - 1];
6751
- r instanceof ot ? i[i.length - 1] = new ot(r.length + s) : i.push(null, new ot(s - 1));
6756
+ r instanceof rt ? i[i.length - 1] = new rt(r.length + s) : i.push(null, new rt(s - 1));
6752
6757
  }
6753
6758
  if (t > 0) {
6754
6759
  let r = i[0];
6755
- r instanceof ot ? i[0] = new ot(t + r.length) : i.unshift(new ot(t - 1), null);
6760
+ r instanceof rt ? i[0] = new rt(t + r.length) : i.unshift(new rt(t - 1), null);
6756
6761
  }
6757
6762
  return pt.of(i);
6758
6763
  }
6759
6764
  decomposeLeft(t, e) {
6760
- e.push(new ot(t - 1), null);
6765
+ e.push(new rt(t - 1), null);
6761
6766
  }
6762
6767
  decomposeRight(t, e) {
6763
- e.push(null, new ot(this.length - t - 1));
6768
+ e.push(null, new rt(this.length - t - 1));
6764
6769
  }
6765
6770
  updateHeight(t, e = 0, i = !1, s) {
6766
6771
  let r = e + this.length;
6767
6772
  if (s && s.from <= e + this.length && s.more) {
6768
6773
  let o = [], l = Math.max(e, s.from), h = -1;
6769
- for (s.from > e && o.push(new ot(s.from - e - 1).updateHeight(t, e)); l <= r && s.more; ) {
6774
+ for (s.from > e && o.push(new rt(s.from - e - 1).updateHeight(t, e)); l <= r && s.more; ) {
6770
6775
  let c = t.doc.lineAt(l).length;
6771
6776
  o.length && o.push(null);
6772
6777
  let f = s.heights[s.index++];
@@ -6774,7 +6779,7 @@ class ot extends pt {
6774
6779
  let u = new xt(c, f);
6775
6780
  u.outdated = !1, o.push(u), l += c + 1;
6776
6781
  }
6777
- l <= r && o.push(null, new ot(r - l).updateHeight(t, l));
6782
+ l <= r && o.push(null, new rt(r - l).updateHeight(t, l));
6778
6783
  let a = pt.of(o);
6779
6784
  return (h < 0 || Math.abs(a.height - this.height) >= is || Math.abs(h - this.heightMetrics(t, e).perLine) >= is) && (t.heightChanged = !0), a;
6780
6785
  } else
@@ -6854,7 +6859,7 @@ class ou extends pt {
6854
6859
  }
6855
6860
  function io(n, t) {
6856
6861
  let e, i;
6857
- n[t] == null && (e = n[t - 1]) instanceof ot && (i = n[t + 1]) instanceof ot && n.splice(t - 1, 3, new ot(e.length + 1 + i.length));
6862
+ n[t] == null && (e = n[t - 1]) instanceof rt && (i = n[t + 1]) instanceof rt && n.splice(t - 1, 3, new rt(e.length + 1 + i.length));
6858
6863
  }
6859
6864
  const lu = 5;
6860
6865
  class sr {
@@ -6888,7 +6893,7 @@ class sr {
6888
6893
  this.lineStart = t, this.lineEnd = e, this.writtenTo < t && ((this.writtenTo < t - 1 || this.nodes[this.nodes.length - 1] == null) && this.nodes.push(this.blankContent(this.writtenTo, t - 1)), this.nodes.push(null)), this.pos > t && this.nodes.push(new xt(this.pos - t, -1)), this.writtenTo = this.pos;
6889
6894
  }
6890
6895
  blankContent(t, e) {
6891
- let i = new ot(e - t);
6896
+ let i = new rt(e - t);
6892
6897
  return this.oracle.doc.lineAt(t).to == e && (i.flags |= 4), i;
6893
6898
  }
6894
6899
  ensureLine() {
@@ -15388,7 +15393,7 @@ const Gg = /* @__PURE__ */ T.baseTheme({
15388
15393
  tag: w.invalid,
15389
15394
  color: Jg
15390
15395
  }
15391
- ]), ga = rt(!1);
15396
+ ]), ga = lt(!1);
15392
15397
  window.__hst_controls_dark || (window.__hst_controls_dark = []);
15393
15398
  window.__hst_controls_dark.push(ga);
15394
15399
  var Xo;
@@ -15408,7 +15413,7 @@ const rm = {
15408
15413
  setup(n, { emit: t }) {
15409
15414
  const e = n, i = t;
15410
15415
  let s;
15411
- const r = rt(""), o = rt(!1), l = rt(), h = {
15416
+ const r = lt(""), o = lt(!1), l = lt(), h = {
15412
15417
  light: [T.baseTheme({}), Do(ap)],
15413
15418
  dark: [sm, Do(nm)]
15414
15419
  }, a = new Ai(), c = [
@@ -15486,7 +15491,7 @@ const rm = {
15486
15491
  for (const [i, s] of t)
15487
15492
  e[i] = s;
15488
15493
  return e;
15489
- }, hm = /* @__PURE__ */ lm(om, [["__scopeId", "data-v-9f3f2832"]]), am = { class: "htw-flex htw-flex-row htw-gap-1" }, cm = ["value"], fm = {
15494
+ }, hm = /* @__PURE__ */ lm(om, [["__scopeId", "data-v-935458a7"]]), am = { class: "htw-flex htw-flex-row htw-gap-1" }, cm = ["value"], fm = {
15490
15495
  name: "HstColorSelect",
15491
15496
  inheritAttrs: !1
15492
15497
  }, um = /* @__PURE__ */ et({
@@ -15499,55 +15504,52 @@ const rm = {
15499
15504
  "update:modelValue": (n) => !0
15500
15505
  },
15501
15506
  setup(n, { emit: t }) {
15502
- const e = n, i = t, s = rt(null), r = nt({
15507
+ const e = n, i = t, s = nt({
15503
15508
  get: () => e.modelValue,
15504
- set: (a) => {
15505
- i("update:modelValue", a);
15509
+ set: (h) => {
15510
+ i("update:modelValue", h);
15506
15511
  }
15507
15512
  });
15508
- function o(a, c = 15) {
15509
- let f = !1, u;
15510
- const d = () => {
15511
- u == null ? f = !1 : (a(...u), u = null, setTimeout(d, c));
15513
+ function r(h, a = 15) {
15514
+ let c = !1, f;
15515
+ const u = () => {
15516
+ f == null ? c = !1 : (h(...f), f = null, setTimeout(u, a));
15512
15517
  };
15513
- return (...p) => {
15514
- if (f) {
15515
- u = p;
15518
+ return (...d) => {
15519
+ if (c) {
15520
+ f = d;
15516
15521
  return;
15517
15522
  }
15518
- a(...p), f = !0, setTimeout(d, c);
15523
+ h(...d), c = !0, setTimeout(u, a);
15519
15524
  };
15520
15525
  }
15521
- const l = o((a) => {
15522
- i("update:modelValue", a);
15526
+ const o = r((h) => {
15527
+ i("update:modelValue", h);
15523
15528
  });
15524
- function h(a) {
15525
- l(a);
15529
+ function l(h) {
15530
+ o(h);
15526
15531
  }
15527
- return (a, c) => (D(), Q(Vt, {
15528
- title: a.title,
15529
- class: dt(["histoire-select htw-cursor-text htw-items-center", a.$attrs.class]),
15530
- style: Pt(a.$attrs.style)
15532
+ return (h, a) => (D(), Q(Vt, {
15533
+ title: h.title,
15534
+ class: dt(["histoire-select htw-cursor-text htw-items-center", h.$attrs.class]),
15535
+ style: Pt(h.$attrs.style)
15531
15536
  }, {
15532
15537
  actions: G(() => [
15533
- ht(a.$slots, "actions")
15538
+ ht(h.$slots, "actions")
15534
15539
  ]),
15535
15540
  default: G(() => [
15536
15541
  B("div", am, [
15537
- Et(B("input", He({
15538
- ref_key: "input",
15539
- ref: s
15540
- }, { ...a.$attrs, class: null, style: null }, {
15541
- "onUpdate:modelValue": c[0] || (c[0] = (f) => r.value = f),
15542
+ Et(B("input", He({ ...h.$attrs, class: null, style: null }, {
15543
+ "onUpdate:modelValue": a[0] || (a[0] = (c) => s.value = c),
15542
15544
  type: "text",
15543
15545
  class: "htw-text-inherit htw-bg-transparent htw-w-full htw-outline-none htw-px-2 htw-py-1 -htw-my-1 htw-border htw-border-solid htw-border-black/25 dark:htw-border-white/25 focus:htw-border-primary-500 dark:focus:htw-border-primary-500 htw-rounded-sm"
15544
15546
  }), null, 16), [
15545
- [qn, r.value]
15547
+ [qn, s.value]
15546
15548
  ]),
15547
15549
  B("input", {
15548
15550
  type: "color",
15549
- value: a.modelValue,
15550
- onInput: c[1] || (c[1] = (f) => h(f.target.value))
15551
+ value: h.modelValue,
15552
+ onInput: a[1] || (a[1] = (c) => l(c.target.value))
15551
15553
  }, null, 40, cm)
15552
15554
  ])
15553
15555
  ]),
package/dist/style.css CHANGED
@@ -1 +1 @@
1
- .htw-range-input::-webkit-slider-thumb{height:.75rem;width:.75rem;-webkit-appearance:none;-moz-appearance:none;appearance:none;border-radius:9999px;border-width:1px;border-style:solid;border-color:#00000040;--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity))}:is(.htw-dark .htw-range-input)::-webkit-slider-thumb{border-color:#ffffff40;--tw-bg-opacity: 1;background-color:rgb(63 63 70 / var(--tw-bg-opacity))}.htw-range-input:hover::-webkit-slider-thumb{--tw-border-opacity: 1 !important;border-color:rgb(16 185 129 / var(--tw-border-opacity))!important;--tw-bg-opacity: 1 !important;background-color:rgb(16 185 129 / var(--tw-bg-opacity))!important}.htw-range-input::-moz-range-thumb{height:.75rem;width:.75rem;-moz-appearance:none;-webkit-appearance:none;appearance:none;border-radius:9999px;border-width:1px;border-style:solid;border-color:#00000040;--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity))}:is(.htw-dark .htw-range-input)::-moz-range-thumb{border-color:#ffffff40;--tw-bg-opacity: 1;background-color:rgb(63 63 70 / var(--tw-bg-opacity))}.htw-range-input:hover::-moz-range-thumb{--tw-border-opacity: 1 !important;border-color:rgb(16 185 129 / var(--tw-border-opacity))!important;--tw-bg-opacity: 1 !important;background-color:rgb(16 185 129 / var(--tw-bg-opacity))!important}.v-popper{line-height:0}.htw-dark .v-popper--theme-dropdown .v-popper__inner{--tw-border-opacity: 1;border-color:rgb(31 31 33 / var(--tw-border-opacity));--tw-bg-opacity: 1;background-color:rgb(63 63 70 / var(--tw-bg-opacity));--tw-text-opacity: 1;color:rgb(244 244 245 / var(--tw-text-opacity))}.htw-dark .v-popper--theme-dropdown .v-popper__arrow-inner{--tw-border-opacity: 1;border-color:rgb(63 63 70 / var(--tw-border-opacity))}.htw-dark .v-popper--theme-dropdown .v-popper__arrow-outer{--tw-border-opacity: 1;border-color:rgb(31 31 33 / var(--tw-border-opacity))}.v-popper--theme-dropdown.v-popper__popper--show-from .v-popper__wrapper{transform:scale(.75)}.v-popper--theme-dropdown.v-popper__popper--show-to .v-popper__wrapper{transform:none;transition:transform .15s cubic-bezier(0,1,.5,1)}.v-popper__popper:focus-visible{outline:none}.htw-bind-col-size{grid-template-columns:repeat(auto-fill,minmax(var(--histoire-col-size),1fr))}.__histoire-json-code[data-v-9f3f2832] .cm-editor{height:100%;min-width:280px}
1
+ .htw-range-input::-webkit-slider-thumb{height:.75rem;width:.75rem;-webkit-appearance:none;-moz-appearance:none;appearance:none;border-radius:9999px;border-width:1px;border-style:solid;border-color:#00000040;--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity))}:is(.htw-dark .htw-range-input)::-webkit-slider-thumb{border-color:#ffffff40;--tw-bg-opacity: 1;background-color:rgb(63 63 70 / var(--tw-bg-opacity))}.htw-range-input:hover::-webkit-slider-thumb{--tw-border-opacity: 1 !important;border-color:rgb(16 185 129 / var(--tw-border-opacity))!important;--tw-bg-opacity: 1 !important;background-color:rgb(16 185 129 / var(--tw-bg-opacity))!important}.htw-range-input::-moz-range-thumb{height:.75rem;width:.75rem;-moz-appearance:none;-webkit-appearance:none;appearance:none;border-radius:9999px;border-width:1px;border-style:solid;border-color:#00000040;--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity))}:is(.htw-dark .htw-range-input)::-moz-range-thumb{border-color:#ffffff40;--tw-bg-opacity: 1;background-color:rgb(63 63 70 / var(--tw-bg-opacity))}.htw-range-input:hover::-moz-range-thumb{--tw-border-opacity: 1 !important;border-color:rgb(16 185 129 / var(--tw-border-opacity))!important;--tw-bg-opacity: 1 !important;background-color:rgb(16 185 129 / var(--tw-bg-opacity))!important}.v-popper{line-height:0}.htw-dark .v-popper--theme-dropdown .v-popper__inner{--tw-border-opacity: 1;border-color:rgb(31 31 33 / var(--tw-border-opacity));--tw-bg-opacity: 1;background-color:rgb(63 63 70 / var(--tw-bg-opacity));--tw-text-opacity: 1;color:rgb(244 244 245 / var(--tw-text-opacity))}.htw-dark .v-popper--theme-dropdown .v-popper__arrow-inner{--tw-border-opacity: 1;border-color:rgb(63 63 70 / var(--tw-border-opacity))}.htw-dark .v-popper--theme-dropdown .v-popper__arrow-outer{--tw-border-opacity: 1;border-color:rgb(31 31 33 / var(--tw-border-opacity))}.v-popper--theme-dropdown.v-popper__popper--show-from .v-popper__wrapper{transform:scale(.75)}.v-popper--theme-dropdown.v-popper__popper--show-to .v-popper__wrapper{transform:none;transition:transform .15s cubic-bezier(0,1,.5,1)}.v-popper__popper:focus-visible{outline:none}.htw-bind-col-size{grid-template-columns:repeat(auto-fill,minmax(var(--histoire-col-size),1fr))}.__histoire-json-code[data-v-935458a7] .cm-editor{height:100%;min-width:280px}
package/package.json CHANGED
@@ -1,11 +1,12 @@
1
1
  {
2
2
  "name": "@histoire/controls",
3
- "version": "0.17.15",
3
+ "type": "module",
4
+ "version": "0.17.17",
4
5
  "description": "Prebuilt controls components",
5
- "license": "MIT",
6
6
  "author": {
7
7
  "name": "Guillaume Chau"
8
8
  },
9
+ "license": "MIT",
9
10
  "repository": {
10
11
  "url": "https://github.com/Akryum/histoire.git",
11
12
  "type": "git",
@@ -14,7 +15,11 @@
14
15
  "publishConfig": {
15
16
  "access": "public"
16
17
  },
17
- "type": "module",
18
+ "sideEffects": [
19
+ "*.css",
20
+ "*.postcss",
21
+ "*.vue"
22
+ ],
18
23
  "exports": {
19
24
  ".": {
20
25
  "types": "./dist/index.d.ts",
@@ -25,11 +30,6 @@
25
30
  "main": "./dist/index.es.js",
26
31
  "module": "./dist/index.es.js",
27
32
  "types": "./dist/index.d.ts",
28
- "sideEffects": [
29
- "*.css",
30
- "*.postcss",
31
- "*.vue"
32
- ],
33
33
  "dependencies": {
34
34
  "@codemirror/commands": "^6.3.0",
35
35
  "@codemirror/lang-json": "^6.0.1",
@@ -38,8 +38,8 @@
38
38
  "@codemirror/state": "^6.3.1",
39
39
  "@codemirror/theme-one-dark": "^6.1.2",
40
40
  "@codemirror/view": "^6.22.0",
41
- "@histoire/shared": "^0.17.15",
42
- "@histoire/vendors": "^0.17.15"
41
+ "@histoire/shared": "^0.17.17",
42
+ "@histoire/vendors": "^0.17.17"
43
43
  },
44
44
  "devDependencies": {
45
45
  "@types/node": "^18.11.9",
@@ -54,11 +54,11 @@
54
54
  "postcss": "^8.4.31",
55
55
  "postcss-import": "^14.1.0",
56
56
  "tailwindcss": "^3.3.5",
57
- "typescript": "^4.9.5",
57
+ "typescript": "^5.4.4",
58
58
  "vite": "^5.0.11",
59
59
  "vitest": "^0.34.6",
60
60
  "vue": "^3.3.8",
61
- "vue-tsc": "^1.8.22"
61
+ "vue-tsc": "^2.0.11"
62
62
  },
63
63
  "scripts": {
64
64
  "build": "rimraf dist && pnpm run build:css && vite build && pnpm run build:types",
@@ -16,7 +16,7 @@ const props = defineProps<{
16
16
 
17
17
  const { copy, copied } = useClipboard()
18
18
 
19
- const action = async () => {
19
+ async function action() {
20
20
  const content = typeof props.content === 'function' ? await props.content() : props.content
21
21
  copy(content)
22
22
  }
@@ -15,7 +15,6 @@ withDefaults(defineProps<{
15
15
  title: undefined,
16
16
  tag: 'label',
17
17
  })
18
-
19
18
  </script>
20
19
 
21
20
  <template>
@@ -1,7 +1,7 @@
1
1
  <script lang="ts" setup>
2
2
  import HstButton from './HstButton.vue'
3
3
 
4
- const variants: Array<{name: string, bind?: unknown}> = [
4
+ const variants: Array<{ name: string, bind?: unknown }> = [
5
5
  { name: 'Default' },
6
6
  { name: 'Primary', bind: { color: 'primary' } },
7
7
  { name: 'Flat', bind: { color: 'flat' } },
@@ -15,7 +15,7 @@ const objectOptions = Object.keys(options).map(key => ({
15
15
  value: key,
16
16
  }))
17
17
 
18
- function initState () {
18
+ function initState() {
19
19
  return {
20
20
  speed: flatOptions[0],
21
21
  }
@@ -72,7 +72,7 @@ const count = ref('0')
72
72
  <pre>{{ { count } }}</pre>
73
73
  <HstButtonGroup
74
74
  v-model="count"
75
- :options="[{label: 'Low', value: '-25'},{label: 'Regular', value: '0'},{label: 'High', value: '200'}]"
75
+ :options="[{ label: 'Low', value: '-25' }, { label: 'Regular', value: '0' }, { label: 'High', value: '200' }]"
76
76
  />
77
77
  </Variant>
78
78
  </Story>
@@ -5,9 +5,10 @@ export default {
5
5
  </script>
6
6
 
7
7
  <script setup lang="ts">
8
- import { computed, ComputedRef } from 'vue'
8
+ import type { ComputedRef } from 'vue'
9
+ import { computed } from 'vue'
9
10
  import HstWrapper from '../HstWrapper.vue'
10
- import { HstControlOption } from '../../types'
11
+ import type { HstControlOption } from '../../types'
11
12
  import HstButton from './HstButton.vue'
12
13
 
13
14
  const props = defineProps<{
@@ -21,11 +22,13 @@ const formattedOptions: ComputedRef<HstControlOption[]> = computed(() => {
21
22
  return props.options.map((value: string | number | HstControlOption) => {
22
23
  if (typeof value === 'string' || typeof value === 'number') {
23
24
  return { value, label: String(value) }
24
- } else {
25
+ }
26
+ else {
25
27
  return value
26
28
  }
27
29
  })
28
- } else {
30
+ }
31
+ else {
29
32
  return Object.keys(props.options).map((value: string) => ({
30
33
  value,
31
34
  label: props.options[value],
@@ -37,7 +40,7 @@ const emit = defineEmits<{
37
40
  (e: 'update:modelValue', value: string): void
38
41
  }>()
39
42
 
40
- function selectOption (value: string) {
43
+ function selectOption(value: string) {
41
44
  emit('update:modelValue', value)
42
45
  }
43
46
  </script>
@@ -1,8 +1,8 @@
1
1
  import { mount } from '@vue/test-utils'
2
2
  import HstCheckbox from './HstCheckbox.vue'
3
3
 
4
- describe('HstCheckbox', () => {
5
- test('toggle to checked', async () => {
4
+ describe('hstCheckbox', () => {
5
+ it('toggle to checked', async () => {
6
6
  const wrapper = mount(HstCheckbox, {
7
7
  props: {
8
8
  modelValue: false,
@@ -14,7 +14,7 @@ describe('HstCheckbox', () => {
14
14
  expect(wrapper.html()).toMatchSnapshot()
15
15
  })
16
16
 
17
- test('toggle to unchecked', async () => {
17
+ it('toggle to unchecked', async () => {
18
18
  const wrapper = mount(HstCheckbox, {
19
19
  props: {
20
20
  modelValue: true,
@@ -1,7 +1,7 @@
1
1
  <script lang="ts" setup>
2
2
  import HstCheckbox from './HstCheckbox.vue'
3
3
 
4
- function initState () {
4
+ function initState() {
5
5
  return {
6
6
  booleanChecked: false,
7
7
  stringChecked: 'false',
@@ -5,9 +5,9 @@ export default {
5
5
  </script>
6
6
 
7
7
  <script lang="ts" setup>
8
+ import { computed } from 'vue'
8
9
  import HstWrapper from '../HstWrapper.vue'
9
10
  import HstSimpleCheckbox from './HstSimpleCheckbox.vue'
10
- import { computed } from 'vue'
11
11
 
12
12
  type Booleanish = boolean | 'true' | 'false'
13
13
 
@@ -20,7 +20,7 @@ const emit = defineEmits({
20
20
  'update:modelValue': (newValue: Booleanish) => true,
21
21
  })
22
22
 
23
- function toggle () {
23
+ function toggle() {
24
24
  if (typeof props.modelValue === 'string') {
25
25
  emit('update:modelValue', props.modelValue === 'false' ? 'true' : 'false')
26
26
  return
@@ -12,7 +12,7 @@ const objectOptions = Object.keys(options).map(key => ({
12
12
  value: key,
13
13
  }))
14
14
 
15
- function initState () {
15
+ function initState() {
16
16
  return {
17
17
  characters: [],
18
18
  }
@@ -5,9 +5,10 @@ export default {
5
5
  </script>
6
6
 
7
7
  <script lang="ts" setup>
8
- import { computed, ComputedRef } from 'vue'
8
+ import type { ComputedRef } from 'vue'
9
+ import { computed } from 'vue'
9
10
  import HstWrapper from '../HstWrapper.vue'
10
- import { HstControlOption } from '../../types'
11
+ import type { HstControlOption } from '../../types'
11
12
  import HstSimpleCheckbox from './HstSimpleCheckbox.vue'
12
13
 
13
14
  const props = defineProps<{
@@ -21,7 +22,8 @@ const formattedOptions: ComputedRef<Record<string, string>> = computed(() => {
21
22
  return Object.fromEntries(props.options.map((value: string | HstControlOption) => {
22
23
  if (typeof value === 'string') {
23
24
  return [value, value]
24
- } else {
25
+ }
26
+ else {
25
27
  return [value.value, value.label]
26
28
  }
27
29
  }))
@@ -33,10 +35,11 @@ const emit = defineEmits<{
33
35
  (e: 'update:modelValue', value: Array<string>): void
34
36
  }>()
35
37
 
36
- function toggleOption (value: string) {
38
+ function toggleOption(value: string) {
37
39
  if (props.modelValue.includes(value)) {
38
40
  emit('update:modelValue', props.modelValue.filter(element => element !== value))
39
- } else {
41
+ }
42
+ else {
40
43
  emit('update:modelValue', [...props.modelValue, value])
41
44
  }
42
45
  }
@@ -52,7 +55,7 @@ function toggleOption (value: string) {
52
55
  >
53
56
  <div class="-htw-my-1">
54
57
  <template
55
- v-for="( label, value ) in formattedOptions"
58
+ v-for="(label, value) in formattedOptions"
56
59
  :key="value"
57
60
  >
58
61
  <label
@@ -1,7 +1,7 @@
1
1
  <script lang="ts" setup>
2
2
  import HstSimpleCheckbox from './HstSimpleCheckbox.vue'
3
3
 
4
- function initState () {
4
+ function initState() {
5
5
  return {
6
6
  checked: true,
7
7
  }
@@ -16,7 +16,7 @@ const emit = defineEmits({
16
16
  'update:modelValue': (newValue: boolean) => true,
17
17
  })
18
18
 
19
- function toggle () {
19
+ function toggle() {
20
20
  if (!props.withToggle) {
21
21
  return
22
22
  }
@@ -46,7 +46,7 @@ watch(path, () => {
46
46
  <template>
47
47
  <div
48
48
  class="histoire-simple-checkbox htw-group htw-text-white htw-w-[16px] htw-h-[16px] htw-relative"
49
- :class="{'htw-cursor-pointer': withToggle}"
49
+ :class="{ 'htw-cursor-pointer': withToggle }"
50
50
  @click="toggle"
51
51
  >
52
52
  <div
@@ -3,3 +3,7 @@
3
3
  exports[`HstCheckbox > toggle to checked 1`] = `"<label class=\\"histoire-wrapper htw-p-2 hover:htw-bg-primary-100 dark:hover:htw-bg-primary-800 htw-flex htw-gap-2 htw-flex-wrap histoire-checkbox htw-cursor-pointer htw-items-center\\" role=\\"checkbox\\" tabindex=\\"0\\"><span class=\\"htw-w-28 htw-whitespace-nowrap htw-text-ellipsis htw-overflow-hidden htw-shrink-0 v-popper--has-tooltip\\">Label</span><span class=\\"htw-grow htw-max-w-full htw-flex htw-items-center htw-gap-1\\"><span class=\\"htw-block htw-grow htw-max-w-full\\"><div class=\\"histoire-simple-checkbox htw-group htw-text-white htw-w-[16px] htw-h-[16px] htw-relative\\"><div class=\\"htw-border htw-border-solid group-active:htw-bg-gray-500/20 htw-rounded-sm htw-box-border htw-absolute htw-inset-0 htw-transition-border htw-duration-150 htw-ease-out group-hover:htw-border-primary-500 group-hover:dark:htw-border-primary-500 htw-border-black/25 dark:htw-border-white/25 htw-delay-150\\"></div><svg width=\\"16\\" height=\\"16\\" viewBox=\\"0 0 24 24\\" class=\\"htw-relative htw-z-10\\"><path d=\\"m 4 12 l 5 5 l 10 -10\\" fill=\\"none\\" class=\\"htw-stroke-white htw-stroke-2 htw-duration-200 htw-ease-in-out htw-transition-none\\" stroke-dasharray=\\"21.21\\" stroke-dashoffset=\\"21.21\\"></path></svg></div></span></span></label>"`;
4
4
 
5
5
  exports[`HstCheckbox > toggle to unchecked 1`] = `"<label class=\\"histoire-wrapper htw-p-2 hover:htw-bg-primary-100 dark:hover:htw-bg-primary-800 htw-flex htw-gap-2 htw-flex-wrap histoire-checkbox htw-cursor-pointer htw-items-center\\" role=\\"checkbox\\" tabindex=\\"0\\"><span class=\\"htw-w-28 htw-whitespace-nowrap htw-text-ellipsis htw-overflow-hidden htw-shrink-0 v-popper--has-tooltip\\">Label</span><span class=\\"htw-grow htw-max-w-full htw-flex htw-items-center htw-gap-1\\"><span class=\\"htw-block htw-grow htw-max-w-full\\"><div class=\\"histoire-simple-checkbox htw-group htw-text-white htw-w-[16px] htw-h-[16px] htw-relative\\"><div class=\\"htw-border htw-border-solid group-active:htw-bg-gray-500/20 htw-rounded-sm htw-box-border htw-absolute htw-inset-0 htw-transition-border htw-duration-150 htw-ease-out group-hover:htw-border-primary-500 group-hover:dark:htw-border-primary-500 htw-border-primary-500 htw-border-8\\"></div><svg width=\\"16\\" height=\\"16\\" viewBox=\\"0 0 24 24\\" class=\\"htw-relative htw-z-10\\"><path d=\\"m 4 12 l 5 5 l 10 -10\\" fill=\\"none\\" class=\\"htw-stroke-white htw-stroke-2 htw-duration-200 htw-ease-in-out htw-transition-none htw-delay-150\\" stroke-dasharray=\\"21.21\\" stroke-dashoffset=\\"0\\"></path></svg></div></span></span></label>"`;
6
+
7
+ exports[`hstCheckbox > toggle to checked 1`] = `"<label class=\\"histoire-wrapper htw-p-2 hover:htw-bg-primary-100 dark:hover:htw-bg-primary-800 htw-flex htw-gap-2 htw-flex-wrap histoire-checkbox htw-cursor-pointer htw-items-center\\" role=\\"checkbox\\" tabindex=\\"0\\"><span class=\\"htw-w-28 htw-whitespace-nowrap htw-text-ellipsis htw-overflow-hidden htw-shrink-0 v-popper--has-tooltip\\">Label</span><span class=\\"htw-grow htw-max-w-full htw-flex htw-items-center htw-gap-1\\"><span class=\\"htw-block htw-grow htw-max-w-full\\"><div class=\\"histoire-simple-checkbox htw-group htw-text-white htw-w-[16px] htw-h-[16px] htw-relative\\"><div class=\\"htw-border htw-border-solid group-active:htw-bg-gray-500/20 htw-rounded-sm htw-box-border htw-absolute htw-inset-0 htw-transition-border htw-duration-150 htw-ease-out group-hover:htw-border-primary-500 group-hover:dark:htw-border-primary-500 htw-border-black/25 dark:htw-border-white/25 htw-delay-150\\"></div><svg width=\\"16\\" height=\\"16\\" viewBox=\\"0 0 24 24\\" class=\\"htw-relative htw-z-10\\"><path d=\\"m 4 12 l 5 5 l 10 -10\\" fill=\\"none\\" class=\\"htw-stroke-white htw-stroke-2 htw-duration-200 htw-ease-in-out htw-transition-none\\" stroke-dasharray=\\"21.21\\" stroke-dashoffset=\\"21.21\\"></path></svg></div></span></span></label>"`;
8
+
9
+ exports[`hstCheckbox > toggle to unchecked 1`] = `"<label class=\\"histoire-wrapper htw-p-2 hover:htw-bg-primary-100 dark:hover:htw-bg-primary-800 htw-flex htw-gap-2 htw-flex-wrap histoire-checkbox htw-cursor-pointer htw-items-center\\" role=\\"checkbox\\" tabindex=\\"0\\"><span class=\\"htw-w-28 htw-whitespace-nowrap htw-text-ellipsis htw-overflow-hidden htw-shrink-0 v-popper--has-tooltip\\">Label</span><span class=\\"htw-grow htw-max-w-full htw-flex htw-items-center htw-gap-1\\"><span class=\\"htw-block htw-grow htw-max-w-full\\"><div class=\\"histoire-simple-checkbox htw-group htw-text-white htw-w-[16px] htw-h-[16px] htw-relative\\"><div class=\\"htw-border htw-border-solid group-active:htw-bg-gray-500/20 htw-rounded-sm htw-box-border htw-absolute htw-inset-0 htw-transition-border htw-duration-150 htw-ease-out group-hover:htw-border-primary-500 group-hover:dark:htw-border-primary-500 htw-border-primary-500 htw-border-8\\"></div><svg width=\\"16\\" height=\\"16\\" viewBox=\\"0 0 24 24\\" class=\\"htw-relative htw-z-10\\"><path d=\\"m 4 12 l 5 5 l 10 -10\\" fill=\\"none\\" class=\\"htw-stroke-white htw-stroke-2 htw-duration-200 htw-ease-in-out htw-transition-none htw-delay-150\\" stroke-dasharray=\\"21.21\\" stroke-dashoffset=\\"0\\"></path></svg></div></span></span></label>"`;