@histoire/controls 0.2.5 → 0.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.es.js CHANGED
@@ -29,7 +29,7 @@ var __objRest = (source, exclude) => {
29
29
  }
30
30
  return target;
31
31
  };
32
- import { pushScopeId, popScopeId, defineComponent, nextTick, openBlock, createBlock, withScopeId, resolveComponent, createElementBlock, normalizeClass, normalizeStyle, withKeys, createElementVNode, Fragment, renderSlot, createCommentVNode, mergeProps, withCtx, createVNode, ref, createApp, h, toDisplayString, withDirectives, createTextVNode, unref, computed, watch, withModifiers, onUnmounted, isRef, vModelText, getCurrentScope, onScopeDispose, renderList } from "vue";
32
+ import { pushScopeId, popScopeId, defineComponent, nextTick, openBlock, createBlock, withScopeId, resolveComponent, createElementBlock, normalizeClass, normalizeStyle, withKeys, createElementVNode, Fragment, renderSlot, createCommentVNode, mergeProps, withCtx, createVNode, ref, createApp, h, toDisplayString, withDirectives, createTextVNode, unref, computed, watch, withModifiers, onUnmounted, isRef, vModelText, renderList, getCurrentScope, onScopeDispose } from "vue";
33
33
  function getBasePlacement(placement) {
34
34
  return placement.split("-")[0];
35
35
  }
@@ -1358,7 +1358,7 @@ var PrivatePopper = () => defineComponent({
1358
1358
  default: defaultPropFactory("strategy")
1359
1359
  },
1360
1360
  autoHide: {
1361
- type: Boolean,
1361
+ type: [Boolean, Function],
1362
1362
  default: defaultPropFactory("autoHide")
1363
1363
  },
1364
1364
  handleResize: {
@@ -1461,7 +1461,8 @@ var PrivatePopper = () => defineComponent({
1461
1461
  },
1462
1462
  transformOrigin: null
1463
1463
  },
1464
- shownChildren: /* @__PURE__ */ new Set()
1464
+ shownChildren: /* @__PURE__ */ new Set(),
1465
+ lastAutoHide: true
1465
1466
  };
1466
1467
  },
1467
1468
  computed: {
@@ -1477,7 +1478,7 @@ var PrivatePopper = () => defineComponent({
1477
1478
  isShown: this.isShown,
1478
1479
  shouldMountContent: this.shouldMountContent,
1479
1480
  skipTransition: this.skipTransition,
1480
- autoHide: this.autoHide,
1481
+ autoHide: typeof this.autoHide === "function" ? this.lastAutoHide : this.autoHide,
1481
1482
  show: this.show,
1482
1483
  hide: this.hide,
1483
1484
  handleResize: this.handleResize,
@@ -2127,7 +2128,15 @@ function isContainingEventTarget(popper, event) {
2127
2128
  return popper.$_mouseDownContains || popperContent.contains(event.target);
2128
2129
  }
2129
2130
  function shouldAutoHide(popper, contains2, event) {
2130
- return event.closeAllPopover || event.closePopover && contains2 || popper.autoHide && !contains2;
2131
+ return event.closeAllPopover || event.closePopover && contains2 || getAutoHideResult(popper, event) && !contains2;
2132
+ }
2133
+ function getAutoHideResult(popper, event) {
2134
+ if (typeof popper.autoHide === "function") {
2135
+ const result = popper.autoHide(event);
2136
+ popper.lastAutoHide = result;
2137
+ return result;
2138
+ }
2139
+ return popper.autoHide;
2131
2140
  }
2132
2141
  function computePositionAllShownPoppers(event) {
2133
2142
  for (let i = 0; i < shownPoppers.length; i++) {
@@ -2317,11 +2326,11 @@ const _hoisted_2$1$1 = {
2317
2326
  ref: "inner",
2318
2327
  class: "v-popper__inner"
2319
2328
  };
2320
- const _hoisted_3$3 = /* @__PURE__ */ createElementVNode("div", { class: "v-popper__arrow-outer" }, null, -1);
2321
- const _hoisted_4$1 = /* @__PURE__ */ createElementVNode("div", { class: "v-popper__arrow-inner" }, null, -1);
2322
- const _hoisted_5$1 = [
2323
- _hoisted_3$3,
2324
- _hoisted_4$1
2329
+ const _hoisted_3$5 = /* @__PURE__ */ createElementVNode("div", { class: "v-popper__arrow-outer" }, null, -1);
2330
+ const _hoisted_4$3 = /* @__PURE__ */ createElementVNode("div", { class: "v-popper__arrow-inner" }, null, -1);
2331
+ const _hoisted_5$3 = [
2332
+ _hoisted_3$5,
2333
+ _hoisted_4$3
2325
2334
  ];
2326
2335
  function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
2327
2336
  const _component_ResizeObserver = resolveComponent("ResizeObserver");
@@ -2380,7 +2389,7 @@ function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
2380
2389
  left: _ctx.toPx(_ctx.result.arrow.x),
2381
2390
  top: _ctx.toPx(_ctx.result.arrow.y)
2382
2391
  } : void 0)
2383
- }, _hoisted_5$1, 4)
2392
+ }, _hoisted_5$3, 4)
2384
2393
  ], 4)
2385
2394
  ], 46, _hoisted_1$1$1);
2386
2395
  }
@@ -2514,7 +2523,7 @@ defineComponent(__spreadProps2(__spreadValues2({}, PrivatePopperWrapper), {
2514
2523
  name: "VTooltip",
2515
2524
  vPopperTheme: "tooltip"
2516
2525
  }));
2517
- const _sfc_main$7 = defineComponent({
2526
+ const _sfc_main$a = defineComponent({
2518
2527
  name: "VTooltipDirective",
2519
2528
  components: {
2520
2529
  Popper: PrivatePopper(),
@@ -2605,8 +2614,8 @@ const _sfc_main$7 = defineComponent({
2605
2614
  }
2606
2615
  }
2607
2616
  });
2608
- const _hoisted_1$5 = ["innerHTML"];
2609
- const _hoisted_2$3 = ["textContent"];
2617
+ const _hoisted_1$8 = ["innerHTML"];
2618
+ const _hoisted_2$6 = ["textContent"];
2610
2619
  function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
2611
2620
  const _component_PopperContent = resolveComponent("PopperContent");
2612
2621
  const _component_Popper = resolveComponent("Popper");
@@ -2649,10 +2658,10 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
2649
2658
  _ctx.html ? (openBlock(), createElementBlock("div", {
2650
2659
  key: 0,
2651
2660
  innerHTML: _ctx.finalContent
2652
- }, null, 8, _hoisted_1$5)) : (openBlock(), createElementBlock("div", {
2661
+ }, null, 8, _hoisted_1$8)) : (openBlock(), createElementBlock("div", {
2653
2662
  key: 1,
2654
2663
  textContent: toDisplayString(_ctx.finalContent)
2655
- }, null, 8, _hoisted_2$3))
2664
+ }, null, 8, _hoisted_2$6))
2656
2665
  ]),
2657
2666
  _: 2
2658
2667
  }, 1032, ["class", "popper-id", "theme", "shown", "mounted", "skip-transition", "auto-hide", "handle-resize", "classes", "result", "onHide", "onResize"])
@@ -2660,7 +2669,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
2660
2669
  _: 1
2661
2670
  }, 16, ["theme", "popper-node", "onApplyShow", "onApplyHide"]);
2662
2671
  }
2663
- var PrivateTooltipDirective = /* @__PURE__ */ _export_sfc(_sfc_main$7, [["render", _sfc_render]]);
2672
+ var PrivateTooltipDirective = /* @__PURE__ */ _export_sfc(_sfc_main$a, [["render", _sfc_render]]);
2664
2673
  const TARGET_CLASS = "v-popper--has-tooltip";
2665
2674
  function getPlacement(options2, modifiers) {
2666
2675
  let result = options2.placement;
@@ -2785,20 +2794,20 @@ var PrivateVTooltip = {
2785
2794
  }
2786
2795
  };
2787
2796
  const VTooltip = PrivateVTooltip;
2788
- const _hoisted_1$4 = { class: "htw-p-2 hover:htw-bg-primary-100 dark:hover:htw-bg-primary-800 htw-flex htw-gap-2 htw-flex-wrap" };
2789
- const _hoisted_2$2 = { class: "htw-w-28 htw-whitespace-nowrap htw-text-ellipsis htw-overflow-hidden htw-shrink-0" };
2790
- const _hoisted_3$2 = { class: "htw-block htw-grow" };
2791
- const __default__$6 = {
2797
+ const _hoisted_1$7 = { class: "htw-p-2 hover:htw-bg-primary-100 dark:hover:htw-bg-primary-800 htw-flex htw-gap-2 htw-flex-wrap" };
2798
+ const _hoisted_2$5 = { class: "htw-w-28 htw-whitespace-nowrap htw-text-ellipsis htw-overflow-hidden htw-shrink-0" };
2799
+ const _hoisted_3$4 = { class: "htw-block htw-grow" };
2800
+ const __default__$9 = {
2792
2801
  name: "HstWrapper"
2793
2802
  };
2794
- const _sfc_main$6 = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$6), {
2803
+ const _sfc_main$9 = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$9), {
2795
2804
  props: {
2796
2805
  title: null
2797
2806
  },
2798
2807
  setup(__props) {
2799
2808
  return (_ctx, _cache) => {
2800
- return openBlock(), createElementBlock("label", _hoisted_1$4, [
2801
- withDirectives((openBlock(), createElementBlock("span", _hoisted_2$2, [
2809
+ return openBlock(), createElementBlock("label", _hoisted_1$7, [
2810
+ withDirectives((openBlock(), createElementBlock("span", _hoisted_2$5, [
2802
2811
  createTextVNode(toDisplayString(__props.title), 1)
2803
2812
  ])), [
2804
2813
  [unref(VTooltip), {
@@ -2807,25 +2816,25 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues
2807
2816
  distance: 12
2808
2817
  }]
2809
2818
  ]),
2810
- createElementVNode("span", _hoisted_3$2, [
2819
+ createElementVNode("span", _hoisted_3$4, [
2811
2820
  renderSlot(_ctx.$slots, "default")
2812
2821
  ])
2813
2822
  ]);
2814
2823
  };
2815
2824
  }
2816
2825
  }));
2817
- const _hoisted_1$3 = { class: "htw-text-white htw-w-[16px] htw-h-[16px] htw-relative" };
2818
- const _hoisted_2$1 = {
2826
+ const _hoisted_1$6 = { class: "htw-text-white htw-w-[16px] htw-h-[16px] htw-relative" };
2827
+ const _hoisted_2$4 = {
2819
2828
  width: "16",
2820
2829
  height: "16",
2821
2830
  viewBox: "0 0 24 24",
2822
2831
  class: "htw-relative htw-z-10"
2823
2832
  };
2824
- const _hoisted_3$1 = ["stroke-dasharray", "stroke-dashoffset"];
2825
- const __default__$5 = {
2833
+ const _hoisted_3$3 = ["stroke-dasharray", "stroke-dashoffset"];
2834
+ const __default__$8 = {
2826
2835
  name: "HstCheckbox"
2827
2836
  };
2828
- const _sfc_main$5 = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$5), {
2837
+ const _sfc_main$8 = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$8), {
2829
2838
  props: {
2830
2839
  modelValue: { type: Boolean },
2831
2840
  title: null
@@ -2849,7 +2858,7 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues
2849
2858
  dasharray.value = (_c = (_b2 = (_a2 = path.value).getTotalLength) == null ? void 0 : _b2.call(_a2)) != null ? _c : 21.21;
2850
2859
  });
2851
2860
  return (_ctx, _cache) => {
2852
- return openBlock(), createBlock(_sfc_main$6, {
2861
+ return openBlock(), createBlock(_sfc_main$9, {
2853
2862
  role: "checkbox",
2854
2863
  tabindex: "0",
2855
2864
  class: "htw-cursor-pointer htw-items-center",
@@ -2861,13 +2870,13 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues
2861
2870
  ]
2862
2871
  }, {
2863
2872
  default: withCtx(() => [
2864
- createElementVNode("div", _hoisted_1$3, [
2873
+ createElementVNode("div", _hoisted_1$6, [
2865
2874
  createElementVNode("div", {
2866
2875
  class: normalizeClass(["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", [
2867
2876
  __props.modelValue ? "htw-border-primary-500 htw-border-8" : "htw-border-black/25 dark:htw-border-white/25 htw-delay-150"
2868
2877
  ]])
2869
2878
  }, null, 2),
2870
- (openBlock(), createElementBlock("svg", _hoisted_2$1, [
2879
+ (openBlock(), createElementBlock("svg", _hoisted_2$4, [
2871
2880
  createElementVNode("path", {
2872
2881
  ref_key: "path",
2873
2882
  ref: path,
@@ -2881,7 +2890,7 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues
2881
2890
  ]]),
2882
2891
  "stroke-dasharray": dasharray.value,
2883
2892
  "stroke-dashoffset": unref(dashoffset)
2884
- }, null, 10, _hoisted_3$1)
2893
+ }, null, 10, _hoisted_3$3)
2885
2894
  ]))
2886
2895
  ])
2887
2896
  ]),
@@ -2890,11 +2899,11 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues
2890
2899
  };
2891
2900
  }
2892
2901
  }));
2893
- const _hoisted_1$2 = ["value"];
2894
- const __default__$4 = {
2902
+ const _hoisted_1$5 = ["value"];
2903
+ const __default__$7 = {
2895
2904
  name: "HstText"
2896
2905
  };
2897
- const _sfc_main$4 = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$4), {
2906
+ const _sfc_main$7 = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$7), {
2898
2907
  props: {
2899
2908
  title: null,
2900
2909
  modelValue: null
@@ -2905,7 +2914,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues
2905
2914
  setup(__props, { emit }) {
2906
2915
  const input = ref();
2907
2916
  return (_ctx, _cache) => {
2908
- return openBlock(), createBlock(_sfc_main$6, {
2917
+ return openBlock(), createBlock(_sfc_main$9, {
2909
2918
  title: __props.title,
2910
2919
  class: normalizeClass(["htw-cursor-text htw-items-center", _ctx.$attrs.class]),
2911
2920
  style: normalizeStyle(_ctx.$attrs.style),
@@ -2920,18 +2929,18 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues
2920
2929
  value: __props.modelValue,
2921
2930
  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",
2922
2931
  onInput: _cache[0] || (_cache[0] = ($event) => emit("update:modelValue", $event.target.value))
2923
- }), null, 16, _hoisted_1$2)
2932
+ }), null, 16, _hoisted_1$5)
2924
2933
  ]),
2925
2934
  _: 1
2926
2935
  }, 8, ["title", "class", "style"]);
2927
2936
  };
2928
2937
  }
2929
2938
  }));
2930
- const __default__$3 = {
2939
+ const __default__$6 = {
2931
2940
  name: "HstNumber",
2932
2941
  inheritAttrs: false
2933
2942
  };
2934
- const _sfc_main$3 = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$3), {
2943
+ const _sfc_main$6 = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$6), {
2935
2944
  props: {
2936
2945
  title: null,
2937
2946
  modelValue: null
@@ -2978,7 +2987,7 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues
2978
2987
  stopDragging();
2979
2988
  });
2980
2989
  return (_ctx, _cache) => {
2981
- return openBlock(), createBlock(_sfc_main$6, {
2990
+ return openBlock(), createBlock(_sfc_main$9, {
2982
2991
  class: normalizeClass(["htw-cursor-ew-resize htw-items-center", [
2983
2992
  _ctx.$attrs.class,
2984
2993
  { "htw-select-none": isDragging.value }
@@ -3012,12 +3021,12 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues
3012
3021
  };
3013
3022
  }
3014
3023
  }));
3015
- const _hoisted_1$1 = ["value"];
3016
- const __default__$2 = {
3024
+ const _hoisted_1$4 = ["value"];
3025
+ const __default__$5 = {
3017
3026
  name: "HstTextarea",
3018
3027
  inheritAttrs: false
3019
3028
  };
3020
- const _sfc_main$2 = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$2), {
3029
+ const _sfc_main$5 = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$5), {
3021
3030
  props: {
3022
3031
  title: null,
3023
3032
  modelValue: null
@@ -3028,7 +3037,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues
3028
3037
  setup(__props, { emit }) {
3029
3038
  const input = ref();
3030
3039
  return (_ctx, _cache) => {
3031
- return openBlock(), createBlock(_sfc_main$6, {
3040
+ return openBlock(), createBlock(_sfc_main$9, {
3032
3041
  title: __props.title,
3033
3042
  class: normalizeClass(["htw-cursor-text", _ctx.$attrs.class]),
3034
3043
  style: normalizeStyle(_ctx.$attrs.style),
@@ -3042,7 +3051,64 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues
3042
3051
  value: __props.modelValue,
3043
3052
  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 htw-box-border htw-resize-y htw-min-h-[26px]",
3044
3053
  onInput: _cache[0] || (_cache[0] = ($event) => emit("update:modelValue", $event.target.value))
3045
- }), null, 16, _hoisted_1$1)
3054
+ }), null, 16, _hoisted_1$4)
3055
+ ]),
3056
+ _: 1
3057
+ }, 8, ["title", "class", "style"]);
3058
+ };
3059
+ }
3060
+ }));
3061
+ const _hoisted_1$3 = ["value"];
3062
+ const _hoisted_2$3 = ["value"];
3063
+ const __default__$4 = {
3064
+ name: "HstSelect"
3065
+ };
3066
+ const _sfc_main$4 = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$4), {
3067
+ props: {
3068
+ title: {
3069
+ type: String,
3070
+ default: ""
3071
+ },
3072
+ modelValue: {
3073
+ type: String,
3074
+ default: null
3075
+ },
3076
+ options: {
3077
+ type: Array,
3078
+ required: true,
3079
+ default: () => []
3080
+ }
3081
+ },
3082
+ emits: {
3083
+ "update:modelValue": (newValue) => true
3084
+ },
3085
+ setup(__props, { emit }) {
3086
+ const props = __props;
3087
+ const formattedOtions = computed(() => props.options.map((option) => typeof option === "string" ? { label: option, value: option } : option));
3088
+ const select = ref();
3089
+ return (_ctx, _cache) => {
3090
+ return openBlock(), createBlock(_sfc_main$9, {
3091
+ title: __props.title,
3092
+ class: normalizeClass(["htw-cursor-text htw-items-center", _ctx.$attrs.class]),
3093
+ style: normalizeStyle(_ctx.$attrs.style),
3094
+ onClick: _cache[1] || (_cache[1] = ($event) => select.value.focus())
3095
+ }, {
3096
+ default: withCtx(() => [
3097
+ createElementVNode("select", {
3098
+ ref_key: "select",
3099
+ ref: select,
3100
+ 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",
3101
+ value: __props.modelValue,
3102
+ onInput: _cache[0] || (_cache[0] = ($event) => emit("update:modelValue", $event.target.value))
3103
+ }, [
3104
+ (openBlock(true), createElementBlock(Fragment, null, renderList(unref(formattedOtions), ({ label, value }) => {
3105
+ return openBlock(), createElementBlock("option", mergeProps(__spreadProps(__spreadValues({}, _ctx.$attrs), { class: null, style: null }), {
3106
+ key: label,
3107
+ class: "dark:htw-bg-gray-600",
3108
+ value
3109
+ }), toDisplayString(label), 17, _hoisted_2$3);
3110
+ }), 128))
3111
+ ], 40, _hoisted_1$3)
3046
3112
  ]),
3047
3113
  _: 1
3048
3114
  }, 8, ["title", "class", "style"]);
@@ -4997,10 +5063,10 @@ _global[globalKey] = _global[globalKey] || {};
4997
5063
  _global[globalKey];
4998
5064
  var _a, _b;
4999
5065
  isClient && (window == null ? void 0 : window.navigator) && ((_a = window == null ? void 0 : window.navigator) == null ? void 0 : _a.platform) && /iP(ad|hone|od)/.test((_b = window == null ? void 0 : window.navigator) == null ? void 0 : _b.platform);
5000
- const __default__$1 = {
5066
+ const __default__$3 = {
5001
5067
  name: "HstCopyIcon"
5002
5068
  };
5003
- const _sfc_main$1 = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$1), {
5069
+ const _sfc_main$3 = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$3), {
5004
5070
  props: {
5005
5071
  content: null
5006
5072
  },
@@ -5025,18 +5091,19 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues
5025
5091
  };
5026
5092
  }
5027
5093
  }));
5028
- const _hoisted_1 = {
5094
+ const _hoisted_1$2 = {
5029
5095
  key: 0,
5030
5096
  class: "htw-grid htw-gap-4 htw-grid-cols-[repeat(auto-fill,minmax(200px,1fr))] htw-m-4"
5031
5097
  };
5032
- const _hoisted_2 = { class: "htw-flex htw-gap-1" };
5033
- const _hoisted_3 = { class: "htw-my-0 htw-truncate htw-shrink" };
5034
- const _hoisted_4 = { class: "htw-flex htw-gap-1" };
5035
- const _hoisted_5 = { class: "htw-my-0 htw-opacity-50 htw-truncate htw-shrink" };
5036
- const __default__ = {
5098
+ const _hoisted_2$2 = ["onMouseenter"];
5099
+ const _hoisted_3$2 = { class: "htw-flex htw-gap-1" };
5100
+ const _hoisted_4$2 = { class: "htw-my-0 htw-truncate htw-shrink" };
5101
+ const _hoisted_5$2 = { class: "htw-flex htw-gap-1" };
5102
+ const _hoisted_6$1 = { class: "htw-my-0 htw-opacity-50 htw-truncate htw-shrink" };
5103
+ const __default__$2 = {
5037
5104
  name: "HstColorShades"
5038
5105
  };
5039
- const _sfc_main = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__), {
5106
+ const _sfc_main$2 = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$2), {
5040
5107
  props: {
5041
5108
  shades: null,
5042
5109
  getName: null,
@@ -5064,12 +5131,15 @@ const _sfc_main = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({
5064
5131
  }
5065
5132
  return list;
5066
5133
  });
5134
+ const hover = ref(null);
5067
5135
  return (_ctx, _cache) => {
5068
- return unref(displayedShades).length ? (openBlock(), createElementBlock("div", _hoisted_1, [
5136
+ return unref(displayedShades).length ? (openBlock(), createElementBlock("div", _hoisted_1$2, [
5069
5137
  (openBlock(true), createElementBlock(Fragment, null, renderList(unref(displayedShades), (shade) => {
5070
5138
  return openBlock(), createElementBlock("div", {
5071
5139
  key: shade.key,
5072
- class: "htw-flex htw-flex-col htw-gap-2 htw-group"
5140
+ class: "htw-flex htw-flex-col htw-gap-2",
5141
+ onMouseenter: ($event) => hover.value = shade.key,
5142
+ onMouseleave: _cache[0] || (_cache[0] = ($event) => hover.value = null)
5073
5143
  }, [
5074
5144
  renderSlot(_ctx.$slots, "default", {
5075
5145
  color: shade.color
@@ -5082,45 +5152,192 @@ const _sfc_main = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({
5082
5152
  }, null, 4)
5083
5153
  ]),
5084
5154
  createElementVNode("div", null, [
5085
- createElementVNode("div", _hoisted_2, [
5086
- withDirectives((openBlock(), createElementBlock("pre", _hoisted_3, [
5155
+ createElementVNode("div", _hoisted_3$2, [
5156
+ withDirectives((openBlock(), createElementBlock("pre", _hoisted_4$2, [
5087
5157
  createTextVNode(toDisplayString(shade.name), 1)
5088
5158
  ])), [
5089
5159
  [unref(VTooltip), shade.name.length > 23 ? shade.name : ""]
5090
5160
  ]),
5091
- createVNode(_sfc_main$1, {
5161
+ hover.value === shade.key ? (openBlock(), createBlock(_sfc_main$3, {
5162
+ key: 0,
5092
5163
  content: shade.name,
5093
- class: "htw-hidden group-hover:htw-block htw-flex-none"
5094
- }, null, 8, ["content"])
5164
+ class: "htw-flex-none"
5165
+ }, null, 8, ["content"])) : createCommentVNode("", true)
5095
5166
  ]),
5096
- createElementVNode("div", _hoisted_4, [
5097
- withDirectives((openBlock(), createElementBlock("pre", _hoisted_5, [
5167
+ createElementVNode("div", _hoisted_5$2, [
5168
+ withDirectives((openBlock(), createElementBlock("pre", _hoisted_6$1, [
5098
5169
  createTextVNode(toDisplayString(shade.color), 1)
5099
5170
  ])), [
5100
5171
  [unref(VTooltip), shade.color.length > 23 ? shade.color : ""]
5101
5172
  ]),
5102
- createVNode(_sfc_main$1, {
5173
+ hover.value === shade.key ? (openBlock(), createBlock(_sfc_main$3, {
5174
+ key: 0,
5103
5175
  content: shade.color,
5104
- class: "htw-hidden group-hover:htw-block htw-flex-none"
5105
- }, null, 8, ["content"])
5176
+ class: "htw-flex-none"
5177
+ }, null, 8, ["content"])) : createCommentVNode("", true)
5106
5178
  ])
5107
5179
  ])
5108
- ]);
5180
+ ], 40, _hoisted_2$2);
5109
5181
  }), 128))
5110
5182
  ])) : createCommentVNode("", true);
5111
5183
  };
5112
5184
  }
5113
5185
  }));
5114
- const HstCheckbox = _sfc_main$5;
5115
- const HstText = _sfc_main$4;
5116
- const HstNumber = _sfc_main$3;
5117
- const HstTextarea = _sfc_main$2;
5118
- const HstColorShades = _sfc_main;
5119
- const HstCopyIcon = _sfc_main$1;
5186
+ const _hoisted_1$1 = ["onMouseenter"];
5187
+ const _hoisted_2$1 = { class: "htw-mx-4" };
5188
+ const _hoisted_3$1 = { class: "htw-flex htw-gap-1" };
5189
+ const _hoisted_4$1 = { class: "htw-my-0 htw-truncate htw-shrink" };
5190
+ const _hoisted_5$1 = { class: "htw-flex htw-gap-1" };
5191
+ const _hoisted_6 = { class: "htw-my-0 htw-opacity-50 htw-truncate htw-shrink" };
5192
+ const __default__$1 = {
5193
+ name: "HstTokenList"
5194
+ };
5195
+ const _sfc_main$1 = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$1), {
5196
+ props: {
5197
+ tokens: null,
5198
+ getName: null
5199
+ },
5200
+ setup(__props) {
5201
+ const props = __props;
5202
+ const processedTokens = computed(() => {
5203
+ const list = props.tokens;
5204
+ const getName = props.getName;
5205
+ return Object.entries(list).map(([key, value]) => {
5206
+ const name = getName ? getName(key, value) : key;
5207
+ return {
5208
+ key,
5209
+ name,
5210
+ value: typeof value === "number" ? value.toString() : value
5211
+ };
5212
+ });
5213
+ });
5214
+ const hover = ref(null);
5215
+ return (_ctx, _cache) => {
5216
+ return openBlock(true), createElementBlock(Fragment, null, renderList(unref(processedTokens), (token) => {
5217
+ return openBlock(), createElementBlock("div", {
5218
+ key: token.key,
5219
+ class: "htw-flex htw-flex-col htw-gap-2 htw-my-8",
5220
+ onMouseenter: ($event) => hover.value = token.key,
5221
+ onMouseleave: _cache[0] || (_cache[0] = ($event) => hover.value = null)
5222
+ }, [
5223
+ renderSlot(_ctx.$slots, "default", { token }),
5224
+ createElementVNode("div", _hoisted_2$1, [
5225
+ createElementVNode("div", _hoisted_3$1, [
5226
+ createElementVNode("pre", _hoisted_4$1, toDisplayString(token.name), 1),
5227
+ hover.value === token.key ? (openBlock(), createBlock(_sfc_main$3, {
5228
+ key: 0,
5229
+ content: token.name,
5230
+ class: "htw-flex-none"
5231
+ }, null, 8, ["content"])) : createCommentVNode("", true)
5232
+ ]),
5233
+ createElementVNode("div", _hoisted_5$1, [
5234
+ createElementVNode("pre", _hoisted_6, toDisplayString(token.value), 1),
5235
+ hover.value === token.key ? (openBlock(), createBlock(_sfc_main$3, {
5236
+ key: 0,
5237
+ content: typeof token.value === "string" ? token.value : JSON.stringify(token.value),
5238
+ class: "htw-flex-none"
5239
+ }, null, 8, ["content"])) : createCommentVNode("", true)
5240
+ ])
5241
+ ])
5242
+ ], 40, _hoisted_1$1);
5243
+ }), 128);
5244
+ };
5245
+ }
5246
+ }));
5247
+ var HstTokenGrid_vue_vue_type_style_index_0_lang = "";
5248
+ const _hoisted_1 = ["onMouseenter"];
5249
+ const _hoisted_2 = { class: "htw-flex htw-gap-1" };
5250
+ const _hoisted_3 = { class: "htw-my-0 htw-truncate htw-shrink" };
5251
+ const _hoisted_4 = { class: "htw-flex htw-gap-1" };
5252
+ const _hoisted_5 = { class: "htw-my-0 htw-opacity-50 htw-truncate htw-shrink" };
5253
+ const __default__ = {
5254
+ name: "HstTokenGrid"
5255
+ };
5256
+ const _sfc_main = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__), {
5257
+ props: {
5258
+ tokens: null,
5259
+ colSize: { default: 180 },
5260
+ getName: { type: Function, default: null }
5261
+ },
5262
+ setup(__props) {
5263
+ const props = __props;
5264
+ const processedTokens = computed(() => {
5265
+ const list = props.tokens;
5266
+ const getName = props.getName;
5267
+ return Object.entries(list).map(([key, value]) => {
5268
+ const name = getName ? getName(key, value) : key;
5269
+ return {
5270
+ key,
5271
+ name,
5272
+ value: typeof value === "number" ? value.toString() : value
5273
+ };
5274
+ });
5275
+ });
5276
+ const colSizePx = computed(() => `${props.colSize}px`);
5277
+ const hover = ref(null);
5278
+ return (_ctx, _cache) => {
5279
+ return openBlock(), createElementBlock("div", {
5280
+ class: "htw-bind-col-size htw-grid htw-gap-4 htw-m-4",
5281
+ style: normalizeStyle({
5282
+ "--histoire-col-size": unref(colSizePx)
5283
+ })
5284
+ }, [
5285
+ (openBlock(true), createElementBlock(Fragment, null, renderList(unref(processedTokens), (token) => {
5286
+ return openBlock(), createElementBlock("div", {
5287
+ key: token.key,
5288
+ class: "htw-flex htw-flex-col htw-gap-2",
5289
+ onMouseenter: ($event) => hover.value = token.key,
5290
+ onMouseleave: _cache[0] || (_cache[0] = ($event) => hover.value = null)
5291
+ }, [
5292
+ renderSlot(_ctx.$slots, "default", { token }),
5293
+ createElementVNode("div", null, [
5294
+ createElementVNode("div", _hoisted_2, [
5295
+ withDirectives((openBlock(), createElementBlock("pre", _hoisted_3, [
5296
+ createTextVNode(toDisplayString(token.name), 1)
5297
+ ])), [
5298
+ [unref(VTooltip), token.name.length > __props.colSize / 8 ? token.name : ""]
5299
+ ]),
5300
+ hover.value === token.key ? (openBlock(), createBlock(_sfc_main$3, {
5301
+ key: 0,
5302
+ content: token.name,
5303
+ class: "htw-flex-none"
5304
+ }, null, 8, ["content"])) : createCommentVNode("", true)
5305
+ ]),
5306
+ createElementVNode("div", _hoisted_4, [
5307
+ withDirectives((openBlock(), createElementBlock("pre", _hoisted_5, [
5308
+ createTextVNode(toDisplayString(token.value), 1)
5309
+ ])), [
5310
+ [unref(VTooltip), token.value.length > __props.colSize / 8 ? token.value : ""]
5311
+ ]),
5312
+ hover.value === token.key ? (openBlock(), createBlock(_sfc_main$3, {
5313
+ key: 0,
5314
+ content: typeof token.value === "string" ? token.value : JSON.stringify(token.value),
5315
+ class: "htw-flex-none"
5316
+ }, null, 8, ["content"])) : createCommentVNode("", true)
5317
+ ])
5318
+ ])
5319
+ ], 40, _hoisted_1);
5320
+ }), 128))
5321
+ ], 4);
5322
+ };
5323
+ }
5324
+ }));
5325
+ const HstCheckbox = _sfc_main$8;
5326
+ const HstText = _sfc_main$7;
5327
+ const HstNumber = _sfc_main$6;
5328
+ const HstTextarea = _sfc_main$5;
5329
+ const HstColorShades = _sfc_main$2;
5330
+ const HstTokenList = _sfc_main$1;
5331
+ const HstTokenGrid = _sfc_main;
5332
+ const HstCopyIcon = _sfc_main$3;
5120
5333
  function registerVueComponents(app) {
5121
- app.component("HstCheckbox", _sfc_main$5);
5122
- app.component("HstText", _sfc_main$4);
5123
- app.component("HstNumber", _sfc_main$3);
5124
- app.component("HstTextarea", _sfc_main$2);
5125
- }
5126
- export { HstCheckbox, HstColorShades, HstCopyIcon, HstNumber, HstText, HstTextarea, registerVueComponents };
5334
+ app.component("HstCheckbox", _sfc_main$8);
5335
+ app.component("HstText", _sfc_main$7);
5336
+ app.component("HstNumber", _sfc_main$6);
5337
+ app.component("HstSelect", _sfc_main$4);
5338
+ app.component("HstTextarea", _sfc_main$5);
5339
+ app.component("HstColorShades", _sfc_main$2);
5340
+ app.component("HstTokenList", _sfc_main$1);
5341
+ app.component("HstTokenGrid", _sfc_main);
5342
+ }
5343
+ export { HstCheckbox, HstColorShades, HstCopyIcon, HstNumber, HstText, HstTextarea, HstTokenGrid, HstTokenList, registerVueComponents };