@histoire/controls 0.10.7 → 0.11.0

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
@@ -1,262 +1,215 @@
1
- import { defineComponent, openBlock, createElementBlock, withDirectives, createTextVNode, toDisplayString, unref, createElementVNode, renderSlot, ref, computed, watch, createBlock, withKeys, withModifiers, withCtx, normalizeClass, normalizeStyle, mergeProps, onUnmounted, isRef, vModelText, createCommentVNode, Fragment, renderList, createVNode } from "@histoire/vendors/vue";
2
- import { VTooltip, Dropdown } from "@histoire/vendors/floating-vue";
3
- import { Icon } from "@histoire/vendors/iconify";
4
- import { useClipboard } from "@histoire/vendors/vue-use";
5
- const _hoisted_1$9 = { class: "htw-p-2 hover:htw-bg-primary-100 dark:hover:htw-bg-primary-800 htw-flex htw-gap-2 htw-flex-wrap" };
6
- const _hoisted_2$7 = { class: "htw-w-28 htw-whitespace-nowrap htw-text-ellipsis htw-overflow-hidden htw-shrink-0" };
7
- const _hoisted_3$6 = { class: "htw-grow htw-flex htw-items-center htw-gap-1" };
8
- const _hoisted_4$4 = { class: "htw-block htw-grow" };
9
- const __default__$c = {
1
+ import { defineComponent as _, openBlock as i, createElementBlock as m, withDirectives as V, createTextVNode as M, toDisplayString as k, unref as w, createElementVNode as c, renderSlot as g, ref as b, computed as y, watch as K, createBlock as f, withKeys as A, withModifiers as j, withCtx as v, normalizeClass as x, normalizeStyle as S, mergeProps as O, onUnmounted as R, isRef as D, vModelText as B, createCommentVNode as H, Fragment as E, renderList as L, createVNode as I } from "@histoire/vendors/vue";
2
+ import { VTooltip as N, Dropdown as G } from "@histoire/vendors/floating-vue";
3
+ import { Icon as U } from "@histoire/vendors/iconify";
4
+ import { useClipboard as P } from "@histoire/vendors/vue-use";
5
+ const W = { class: "htw-p-2 hover:htw-bg-primary-100 dark:hover:htw-bg-primary-800 htw-flex htw-gap-2 htw-flex-wrap" }, X = { class: "htw-w-28 htw-whitespace-nowrap htw-text-ellipsis htw-overflow-hidden htw-shrink-0" }, J = { class: "htw-grow htw-flex htw-items-center htw-gap-1" }, q = { class: "htw-block htw-grow" }, Q = {
10
6
  name: "HstWrapper"
11
- };
12
- const _sfc_main$c = /* @__PURE__ */ defineComponent({
13
- ...__default__$c,
7
+ }, z = /* @__PURE__ */ _({
8
+ ...Q,
14
9
  props: {
15
10
  title: null
16
11
  },
17
- setup(__props) {
18
- return (_ctx, _cache) => {
19
- return openBlock(), createElementBlock("label", _hoisted_1$9, [
20
- withDirectives((openBlock(), createElementBlock("span", _hoisted_2$7, [
21
- createTextVNode(toDisplayString(__props.title), 1)
22
- ])), [
23
- [unref(VTooltip), {
24
- content: __props.title,
25
- placement: "left",
26
- distance: 12
27
- }]
12
+ setup(s) {
13
+ return (h, a) => (i(), m("label", W, [
14
+ V((i(), m("span", X, [
15
+ M(k(s.title), 1)
16
+ ])), [
17
+ [w(N), {
18
+ content: s.title,
19
+ placement: "left",
20
+ distance: 12
21
+ }]
22
+ ]),
23
+ c("span", J, [
24
+ c("span", q, [
25
+ g(h.$slots, "default")
28
26
  ]),
29
- createElementVNode("span", _hoisted_3$6, [
30
- createElementVNode("span", _hoisted_4$4, [
31
- renderSlot(_ctx.$slots, "default")
32
- ]),
33
- renderSlot(_ctx.$slots, "actions")
34
- ])
35
- ]);
36
- };
27
+ g(h.$slots, "actions")
28
+ ])
29
+ ]));
37
30
  }
38
- });
39
- const _hoisted_1$8 = { class: "htw-text-white htw-w-[16px] htw-h-[16px] htw-relative" };
40
- const _hoisted_2$6 = {
31
+ }), Y = { class: "htw-text-white htw-w-[16px] htw-h-[16px] htw-relative" }, Z = {
41
32
  width: "16",
42
33
  height: "16",
43
34
  viewBox: "0 0 24 24",
44
35
  class: "htw-relative htw-z-10"
45
- };
46
- const _hoisted_3$5 = ["stroke-dasharray", "stroke-dashoffset"];
47
- const __default__$b = {
36
+ }, tt = ["stroke-dasharray", "stroke-dashoffset"], et = {
48
37
  name: "HstCheckbox"
49
- };
50
- const _sfc_main$b = /* @__PURE__ */ defineComponent({
51
- ...__default__$b,
38
+ }, st = /* @__PURE__ */ _({
39
+ ...et,
52
40
  props: {
53
41
  modelValue: { type: Boolean },
54
42
  title: null
55
43
  },
56
44
  emits: {
57
- "update:modelValue": (newValue) => true
45
+ "update:modelValue": (s) => !0
58
46
  },
59
- setup(__props, { emit }) {
60
- const props = __props;
61
- function toggle() {
62
- emit("update:modelValue", !props.modelValue);
63
- animationEnabled.value = true;
47
+ setup(s, { emit: h }) {
48
+ const a = s;
49
+ function o() {
50
+ h("update:modelValue", !a.modelValue), l.value = !0;
64
51
  }
65
- const path = ref();
66
- const dasharray = ref(0);
67
- const progress = computed(() => props.modelValue ? 1 : 0);
68
- const dashoffset = computed(() => (1 - progress.value) * dasharray.value);
69
- const animationEnabled = ref(false);
70
- watch(path, () => {
71
- var _a, _b, _c;
72
- dasharray.value = (_c = (_b = (_a = path.value).getTotalLength) == null ? void 0 : _b.call(_a)) != null ? _c : 21.21;
73
- });
74
- return (_ctx, _cache) => {
75
- return openBlock(), createBlock(_sfc_main$c, {
76
- role: "checkbox",
77
- tabindex: "0",
78
- class: "htw-cursor-pointer htw-items-center",
79
- title: __props.title,
80
- onClick: _cache[0] || (_cache[0] = ($event) => toggle()),
81
- onKeydown: [
82
- _cache[1] || (_cache[1] = withKeys(withModifiers(($event) => toggle(), ["prevent"]), ["enter"])),
83
- _cache[2] || (_cache[2] = withKeys(withModifiers(($event) => toggle(), ["prevent"]), ["space"]))
84
- ]
85
- }, {
86
- actions: withCtx(() => [
87
- renderSlot(_ctx.$slots, "actions")
88
- ]),
89
- default: withCtx(() => [
90
- createElementVNode("div", _hoisted_1$8, [
91
- createElementVNode("div", {
92
- 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", [
93
- __props.modelValue ? "htw-border-primary-500 htw-border-8" : "htw-border-black/25 dark:htw-border-white/25 htw-delay-150"
94
- ]])
95
- }, null, 2),
96
- (openBlock(), createElementBlock("svg", _hoisted_2$6, [
97
- createElementVNode("path", {
98
- ref_key: "path",
99
- ref: path,
100
- d: "m 4 12 l 5 5 l 10 -10",
101
- fill: "none",
102
- class: normalizeClass(["htw-stroke-white htw-stroke-2 htw-duration-200 htw-ease-in-out", [
103
- animationEnabled.value ? "htw-transition-all" : "htw-transition-none",
104
- {
105
- "htw-delay-150": __props.modelValue
106
- }
107
- ]]),
108
- "stroke-dasharray": dasharray.value,
109
- "stroke-dashoffset": unref(dashoffset)
110
- }, null, 10, _hoisted_3$5)
111
- ]))
112
- ])
113
- ]),
114
- _: 3
115
- }, 8, ["title"]);
116
- };
52
+ const n = b(), u = b(0), t = y(() => a.modelValue ? 1 : 0), e = y(() => (1 - t.value) * u.value), l = b(!1);
53
+ return K(n, () => {
54
+ var r, d, p;
55
+ u.value = (p = (d = (r = n.value).getTotalLength) == null ? void 0 : d.call(r)) != null ? p : 21.21;
56
+ }), (r, d) => (i(), f(z, {
57
+ role: "checkbox",
58
+ tabindex: "0",
59
+ class: "htw-cursor-pointer htw-items-center",
60
+ title: s.title,
61
+ onClick: d[0] || (d[0] = (p) => o()),
62
+ onKeydown: [
63
+ d[1] || (d[1] = A(j((p) => o(), ["prevent"]), ["enter"])),
64
+ d[2] || (d[2] = A(j((p) => o(), ["prevent"]), ["space"]))
65
+ ]
66
+ }, {
67
+ actions: v(() => [
68
+ g(r.$slots, "actions")
69
+ ]),
70
+ default: v(() => [
71
+ c("div", Y, [
72
+ c("div", {
73
+ class: x(["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", [
74
+ s.modelValue ? "htw-border-primary-500 htw-border-8" : "htw-border-black/25 dark:htw-border-white/25 htw-delay-150"
75
+ ]])
76
+ }, null, 2),
77
+ (i(), m("svg", Z, [
78
+ c("path", {
79
+ ref_key: "path",
80
+ ref: n,
81
+ d: "m 4 12 l 5 5 l 10 -10",
82
+ fill: "none",
83
+ class: x(["htw-stroke-white htw-stroke-2 htw-duration-200 htw-ease-in-out", [
84
+ l.value ? "htw-transition-all" : "htw-transition-none",
85
+ {
86
+ "htw-delay-150": s.modelValue
87
+ }
88
+ ]]),
89
+ "stroke-dasharray": u.value,
90
+ "stroke-dashoffset": w(e)
91
+ }, null, 10, tt)
92
+ ]))
93
+ ])
94
+ ]),
95
+ _: 3
96
+ }, 8, ["title"]));
117
97
  }
118
- });
119
- const _hoisted_1$7 = ["value"];
120
- const __default__$a = {
98
+ }), lt = ["value"], nt = {
121
99
  name: "HstText"
122
- };
123
- const _sfc_main$a = /* @__PURE__ */ defineComponent({
124
- ...__default__$a,
100
+ }, ot = /* @__PURE__ */ _({
101
+ ...nt,
125
102
  props: {
126
103
  title: null,
127
104
  modelValue: null
128
105
  },
129
106
  emits: {
130
- "update:modelValue": (newValue) => true
107
+ "update:modelValue": (s) => !0
131
108
  },
132
- setup(__props, { emit }) {
133
- const input = ref();
134
- return (_ctx, _cache) => {
135
- return openBlock(), createBlock(_sfc_main$c, {
136
- title: __props.title,
137
- class: normalizeClass(["htw-cursor-text htw-items-center", _ctx.$attrs.class]),
138
- style: normalizeStyle(_ctx.$attrs.style),
139
- onClick: _cache[1] || (_cache[1] = ($event) => input.value.focus())
140
- }, {
141
- actions: withCtx(() => [
142
- renderSlot(_ctx.$slots, "actions")
143
- ]),
144
- default: withCtx(() => [
145
- createElementVNode("input", mergeProps({
146
- ref_key: "input",
147
- ref: input
148
- }, { ..._ctx.$attrs, class: null, style: null }, {
149
- type: "text",
150
- value: __props.modelValue,
151
- 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",
152
- onInput: _cache[0] || (_cache[0] = ($event) => emit("update:modelValue", $event.target.value))
153
- }), null, 16, _hoisted_1$7)
154
- ]),
155
- _: 3
156
- }, 8, ["title", "class", "style"]);
157
- };
109
+ setup(s, { emit: h }) {
110
+ const a = b();
111
+ return (o, n) => (i(), f(z, {
112
+ title: s.title,
113
+ class: x(["htw-cursor-text htw-items-center", o.$attrs.class]),
114
+ style: S(o.$attrs.style),
115
+ onClick: n[1] || (n[1] = (u) => a.value.focus())
116
+ }, {
117
+ actions: v(() => [
118
+ g(o.$slots, "actions")
119
+ ]),
120
+ default: v(() => [
121
+ c("input", O({
122
+ ref_key: "input",
123
+ ref: a
124
+ }, { ...o.$attrs, class: null, style: null }, {
125
+ type: "text",
126
+ value: s.modelValue,
127
+ 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",
128
+ onInput: n[0] || (n[0] = (u) => h("update:modelValue", u.target.value))
129
+ }), null, 16, lt)
130
+ ]),
131
+ _: 3
132
+ }, 8, ["title", "class", "style"]));
158
133
  }
159
- });
160
- const __default__$9 = {
134
+ }), rt = {
161
135
  name: "HstNumber",
162
- inheritAttrs: false
163
- };
164
- const _sfc_main$9 = /* @__PURE__ */ defineComponent({
165
- ...__default__$9,
136
+ inheritAttrs: !1
137
+ }, at = /* @__PURE__ */ _({
138
+ ...rt,
166
139
  props: {
167
140
  title: null,
168
141
  modelValue: null
169
142
  },
170
143
  emits: {
171
- "update:modelValue": (newValue) => true
144
+ "update:modelValue": (s) => !0
172
145
  },
173
- setup(__props, { emit }) {
174
- const props = __props;
175
- const numberModel = computed({
176
- get: () => props.modelValue,
177
- set: (value) => {
178
- emit("update:modelValue", value);
146
+ setup(s, { emit: h }) {
147
+ const a = s, o = y({
148
+ get: () => a.modelValue,
149
+ set: ($) => {
150
+ h("update:modelValue", $);
179
151
  }
180
- });
181
- const input = ref();
182
- function focusAndSelect() {
183
- input.value.focus();
184
- input.value.select();
152
+ }), n = b();
153
+ function u() {
154
+ n.value.focus(), n.value.select();
185
155
  }
186
- const isDragging = ref(false);
187
- let startX;
188
- let startValue;
189
- function onMouseDown(event) {
190
- isDragging.value = true;
191
- startX = event.clientX;
192
- startValue = numberModel.value;
193
- window.addEventListener("mousemove", onMouseMove);
194
- window.addEventListener("mouseup", stopDragging);
156
+ const t = b(!1);
157
+ let e, l;
158
+ function r($) {
159
+ t.value = !0, e = $.clientX, l = o.value, window.addEventListener("mousemove", d), window.addEventListener("mouseup", p);
195
160
  }
196
- function onMouseMove(event) {
197
- let step = parseFloat(input.value.step);
198
- if (isNaN(step)) {
199
- step = 1;
200
- }
201
- numberModel.value = startValue + Math.round((event.clientX - startX) / 10 / step) * step;
161
+ function d($) {
162
+ let C = parseFloat(n.value.step);
163
+ isNaN(C) && (C = 1), o.value = l + Math.round(($.clientX - e) / 10 / C) * C;
202
164
  }
203
- function stopDragging() {
204
- isDragging.value = false;
205
- window.removeEventListener("mousemove", onMouseMove);
206
- window.removeEventListener("mouseup", stopDragging);
165
+ function p() {
166
+ t.value = !1, window.removeEventListener("mousemove", d), window.removeEventListener("mouseup", p);
207
167
  }
208
- onUnmounted(() => {
209
- stopDragging();
210
- });
211
- return (_ctx, _cache) => {
212
- return openBlock(), createBlock(_sfc_main$c, {
213
- class: normalizeClass(["htw-cursor-ew-resize htw-items-center", [
214
- _ctx.$attrs.class,
215
- { "htw-select-none": isDragging.value }
216
- ]]),
217
- title: __props.title,
218
- style: normalizeStyle(_ctx.$attrs.style),
219
- onClick: focusAndSelect,
220
- onMousedown: onMouseDown
221
- }, {
222
- actions: withCtx(() => [
223
- renderSlot(_ctx.$slots, "actions")
224
- ]),
225
- default: withCtx(() => [
226
- withDirectives(createElementVNode("input", mergeProps({
227
- ref_key: "input",
228
- ref: input
229
- }, { ..._ctx.$attrs, class: null, style: null }, {
230
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(numberModel) ? numberModel.value = $event : null),
231
- type: "number",
232
- class: [{
233
- "htw-select-none": isDragging.value
234
- }, "htw-text-inherit htw-bg-transparent htw-w-full htw-outline-none htw-pl-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-cursor-ew-resize"]
235
- }), null, 16), [
236
- [
237
- vModelText,
238
- unref(numberModel),
239
- void 0,
240
- { number: true }
241
- ]
242
- ])
243
- ]),
244
- _: 3
245
- }, 8, ["title", "class", "style"]);
246
- };
168
+ return R(() => {
169
+ p();
170
+ }), ($, C) => (i(), f(z, {
171
+ class: x(["htw-cursor-ew-resize htw-items-center", [
172
+ $.$attrs.class,
173
+ { "htw-select-none": t.value }
174
+ ]]),
175
+ title: s.title,
176
+ style: S($.$attrs.style),
177
+ onClick: u,
178
+ onMousedown: r
179
+ }, {
180
+ actions: v(() => [
181
+ g($.$slots, "actions")
182
+ ]),
183
+ default: v(() => [
184
+ V(c("input", O({
185
+ ref_key: "input",
186
+ ref: n
187
+ }, { ...$.$attrs, class: null, style: null }, {
188
+ "onUpdate:modelValue": C[0] || (C[0] = (F) => D(o) ? o.value = F : null),
189
+ type: "number",
190
+ class: [{
191
+ "htw-select-none": t.value
192
+ }, "htw-text-inherit htw-bg-transparent htw-w-full htw-outline-none htw-pl-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-cursor-ew-resize"]
193
+ }), null, 16), [
194
+ [
195
+ B,
196
+ w(o),
197
+ void 0,
198
+ { number: !0 }
199
+ ]
200
+ ])
201
+ ]),
202
+ _: 3
203
+ }, 8, ["title", "class", "style"]));
247
204
  }
248
205
  });
249
- var HstSlider_vue_vue_type_style_index_0_lang = "";
250
- const _hoisted_1$6 = { class: "htw-relative htw-w-full htw-flex htw-items-center" };
251
- const _hoisted_2$5 = /* @__PURE__ */ createElementVNode("div", { class: "htw-absolute htw-inset-0 htw-flex htw-items-center" }, [
252
- /* @__PURE__ */ createElementVNode("div", { class: "htw-border htw-border-black/25 dark:htw-border-white/25 htw-h-1 htw-w-full htw-rounded-full" })
253
- ], -1);
254
- const __default__$8 = {
206
+ const ut = { class: "htw-relative htw-w-full htw-flex htw-items-center" }, it = /* @__PURE__ */ c("div", { class: "htw-absolute htw-inset-0 htw-flex htw-items-center" }, [
207
+ /* @__PURE__ */ c("div", { class: "htw-border htw-border-black/25 dark:htw-border-white/25 htw-h-1 htw-w-full htw-rounded-full" })
208
+ ], -1), ht = {
255
209
  name: "HstSlider",
256
- inheritAttrs: false
257
- };
258
- const _sfc_main$8 = /* @__PURE__ */ defineComponent({
259
- ...__default__$8,
210
+ inheritAttrs: !1
211
+ }, ct = /* @__PURE__ */ _({
212
+ ...ht,
260
213
  props: {
261
214
  title: null,
262
215
  modelValue: null,
@@ -264,604 +217,476 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
264
217
  max: null
265
218
  },
266
219
  emits: {
267
- "update:modelValue": (newValue) => true
220
+ "update:modelValue": (s) => !0
268
221
  },
269
- setup(__props, { emit }) {
270
- const props = __props;
271
- const showTooltip = ref(false);
272
- const input = ref(null);
273
- const numberModel = computed({
274
- get: () => props.modelValue,
275
- set: (value) => {
276
- emit("update:modelValue", value);
277
- }
278
- });
279
- const percentage = computed(() => {
280
- return (props.modelValue - props.min) / (props.max - props.min);
281
- });
282
- const tooltipStyle = computed(() => {
283
- const gap = 8;
284
- if (input.value) {
285
- const position = gap + (input.value.clientWidth - 2 * gap) * percentage.value;
286
- return {
287
- left: position + "px"
288
- };
222
+ setup(s, { emit: h }) {
223
+ const a = s, o = b(!1), n = b(null), u = y({
224
+ get: () => a.modelValue,
225
+ set: (l) => {
226
+ h("update:modelValue", l);
289
227
  }
290
- return {};
291
- });
292
- return (_ctx, _cache) => {
293
- return openBlock(), createBlock(_sfc_main$c, {
294
- class: normalizeClass(["htw-items-center", _ctx.$attrs.class]),
295
- title: __props.title,
296
- style: normalizeStyle(_ctx.$attrs.style)
297
- }, {
298
- default: withCtx(() => [
299
- createElementVNode("div", _hoisted_1$6, [
300
- _hoisted_2$5,
301
- withDirectives(createElementVNode("input", mergeProps({
302
- ref_key: "input",
303
- ref: input,
304
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(numberModel) ? numberModel.value = $event : null),
305
- class: "htw-range-input htw-appearance-none htw-border-0 htw-bg-transparent htw-cursor-pointer htw-relative htw-w-full htw-m-0 htw-text-gray-700",
306
- type: "range"
307
- }, { ..._ctx.$attrs, class: null, style: null, min: __props.min, max: __props.max }, {
308
- onMouseover: _cache[1] || (_cache[1] = ($event) => showTooltip.value = true),
309
- onMouseleave: _cache[2] || (_cache[2] = ($event) => showTooltip.value = false)
310
- }), null, 16), [
311
- [
312
- vModelText,
313
- unref(numberModel),
314
- void 0,
315
- { number: true }
316
- ]
317
- ]),
318
- showTooltip.value ? withDirectives((openBlock(), createElementBlock("div", {
319
- key: 0,
320
- class: "htw-absolute",
321
- style: normalizeStyle(unref(tooltipStyle))
322
- }, null, 4)), [
323
- [unref(VTooltip), { content: __props.modelValue.toString(), shown: true, distance: 16, delay: 0 }]
324
- ]) : createCommentVNode("", true)
325
- ])
326
- ]),
327
- _: 1
328
- }, 8, ["title", "class", "style"]);
329
- };
228
+ }), t = y(() => (a.modelValue - a.min) / (a.max - a.min)), e = y(() => n.value ? {
229
+ left: 8 + (n.value.clientWidth - 16) * t.value + "px"
230
+ } : {});
231
+ return (l, r) => (i(), f(z, {
232
+ class: x(["htw-items-center", l.$attrs.class]),
233
+ title: s.title,
234
+ style: S(l.$attrs.style)
235
+ }, {
236
+ default: v(() => [
237
+ c("div", ut, [
238
+ it,
239
+ V(c("input", O({
240
+ ref_key: "input",
241
+ ref: n,
242
+ "onUpdate:modelValue": r[0] || (r[0] = (d) => D(u) ? u.value = d : null),
243
+ class: "htw-range-input htw-appearance-none htw-border-0 htw-bg-transparent htw-cursor-pointer htw-relative htw-w-full htw-m-0 htw-text-gray-700",
244
+ type: "range"
245
+ }, { ...l.$attrs, class: null, style: null, min: s.min, max: s.max }, {
246
+ onMouseover: r[1] || (r[1] = (d) => o.value = !0),
247
+ onMouseleave: r[2] || (r[2] = (d) => o.value = !1)
248
+ }), null, 16), [
249
+ [
250
+ B,
251
+ w(u),
252
+ void 0,
253
+ { number: !0 }
254
+ ]
255
+ ]),
256
+ o.value ? V((i(), m("div", {
257
+ key: 0,
258
+ class: "htw-absolute",
259
+ style: S(w(e))
260
+ }, null, 4)), [
261
+ [w(N), { content: s.modelValue.toString(), shown: !0, distance: 16, delay: 0 }]
262
+ ]) : H("", !0)
263
+ ])
264
+ ]),
265
+ _: 1
266
+ }, 8, ["title", "class", "style"]));
330
267
  }
331
- });
332
- const _hoisted_1$5 = ["value"];
333
- const __default__$7 = {
268
+ }), dt = ["value"], wt = {
334
269
  name: "HstTextarea",
335
- inheritAttrs: false
336
- };
337
- const _sfc_main$7 = /* @__PURE__ */ defineComponent({
338
- ...__default__$7,
270
+ inheritAttrs: !1
271
+ }, mt = /* @__PURE__ */ _({
272
+ ...wt,
339
273
  props: {
340
274
  title: null,
341
275
  modelValue: null
342
276
  },
343
277
  emits: {
344
- "update:modelValue": (newValue) => true
278
+ "update:modelValue": (s) => !0
345
279
  },
346
- setup(__props, { emit }) {
347
- const input = ref();
348
- return (_ctx, _cache) => {
349
- return openBlock(), createBlock(_sfc_main$c, {
350
- title: __props.title,
351
- class: normalizeClass(["htw-cursor-text", _ctx.$attrs.class]),
352
- style: normalizeStyle(_ctx.$attrs.style),
353
- onClick: _cache[1] || (_cache[1] = ($event) => input.value.focus())
354
- }, {
355
- actions: withCtx(() => [
356
- renderSlot(_ctx.$slots, "actions")
357
- ]),
358
- default: withCtx(() => [
359
- createElementVNode("textarea", mergeProps({
360
- ref_key: "input",
361
- ref: input
362
- }, { ..._ctx.$attrs, class: null, style: null }, {
363
- value: __props.modelValue,
364
- 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]",
365
- onInput: _cache[0] || (_cache[0] = ($event) => emit("update:modelValue", $event.target.value))
366
- }), null, 16, _hoisted_1$5)
367
- ]),
368
- _: 3
369
- }, 8, ["title", "class", "style"]);
370
- };
280
+ setup(s, { emit: h }) {
281
+ const a = b();
282
+ return (o, n) => (i(), f(z, {
283
+ title: s.title,
284
+ class: x(["htw-cursor-text", o.$attrs.class]),
285
+ style: S(o.$attrs.style),
286
+ onClick: n[1] || (n[1] = (u) => a.value.focus())
287
+ }, {
288
+ actions: v(() => [
289
+ g(o.$slots, "actions")
290
+ ]),
291
+ default: v(() => [
292
+ c("textarea", O({
293
+ ref_key: "input",
294
+ ref: a
295
+ }, { ...o.$attrs, class: null, style: null }, {
296
+ value: s.modelValue,
297
+ 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]",
298
+ onInput: n[0] || (n[0] = (u) => h("update:modelValue", u.target.value))
299
+ }), null, 16, dt)
300
+ ]),
301
+ _: 3
302
+ }, 8, ["title", "class", "style"]));
371
303
  }
372
304
  });
373
- var CustomSelect_vue_vue_type_style_index_0_lang = "";
374
- const _hoisted_1$4 = { class: "htw-cursor-pointer htw-w-full htw-outline-none htw-px-2 htw-h-[27px] -htw-my-1 htw-border htw-border-solid htw-border-black/25 dark:htw-border-white/25 hover:htw-border-primary-500 dark:hover:htw-border-primary-500 htw-rounded-sm htw-flex htw-gap-2 htw-items-center htw-leading-normal" };
375
- const _hoisted_2$4 = { class: "htw-flex-1 htw-truncate" };
376
- const _hoisted_3$4 = { class: "htw-flex htw-flex-col htw-bg-gray-50 dark:htw-bg-gray-700" };
377
- const _hoisted_4$3 = ["onClick"];
378
- const __default__$6 = {
305
+ const pt = { class: "htw-cursor-pointer htw-w-full htw-outline-none htw-px-2 htw-h-[27px] -htw-my-1 htw-border htw-border-solid htw-border-black/25 dark:htw-border-white/25 hover:htw-border-primary-500 dark:hover:htw-border-primary-500 htw-rounded-sm htw-flex htw-gap-2 htw-items-center htw-leading-normal" }, ft = { class: "htw-flex-1 htw-truncate" }, vt = { class: "htw-flex htw-flex-col htw-bg-gray-50 dark:htw-bg-gray-700" }, yt = ["onClick"], bt = {
379
306
  name: "CustomSelect"
380
- };
381
- const _sfc_main$6 = /* @__PURE__ */ defineComponent({
382
- ...__default__$6,
307
+ }, _t = /* @__PURE__ */ _({
308
+ ...bt,
383
309
  props: {
384
310
  modelValue: null,
385
311
  options: null
386
312
  },
387
313
  emits: ["update:modelValue"],
388
- setup(__props, { emit: emits }) {
389
- const props = __props;
390
- const formattedOptions = computed(() => {
391
- if (Array.isArray(props.options)) {
392
- return props.options.map((option) => {
393
- if (typeof option === "string") {
394
- return [option, option];
395
- } else {
396
- return [option.value, option.label];
397
- }
398
- });
399
- } else {
400
- return Object.entries(props.options);
401
- }
314
+ setup(s, { emit: h }) {
315
+ const a = s, o = y(() => Array.isArray(a.options) ? a.options.map((t) => typeof t == "string" ? [t, t] : [t.value, t.label]) : Object.entries(a.options)), n = y(() => {
316
+ var t;
317
+ return (t = o.value.find(([e]) => e === a.modelValue)) == null ? void 0 : t[1];
402
318
  });
403
- const selectedLabel = computed(() => {
404
- var _a;
405
- return (_a = formattedOptions.value.find(([value]) => value === props.modelValue)) == null ? void 0 : _a[1];
406
- });
407
- function selectValue(value, hide) {
408
- emits("update:modelValue", value);
409
- hide();
319
+ function u(t, e) {
320
+ h("update:modelValue", t), e();
410
321
  }
411
- return (_ctx, _cache) => {
412
- return openBlock(), createBlock(unref(Dropdown), { "auto-size": "" }, {
413
- popper: withCtx(({ hide }) => [
414
- createElementVNode("div", _hoisted_3$4, [
415
- (openBlock(true), createElementBlock(Fragment, null, renderList(unref(formattedOptions), ([value, label]) => {
416
- return openBlock(), createElementBlock("div", mergeProps({ ..._ctx.$attrs, class: null, style: null }, {
417
- key: label,
418
- class: ["htw-px-2 htw-py-1 htw-cursor-pointer hover:htw-bg-primary-100 dark:hover:htw-bg-primary-700", {
419
- "htw-bg-primary-200 dark:htw-bg-primary-800": props.modelValue === value
420
- }],
421
- onClick: ($event) => selectValue(value, hide)
422
- }), toDisplayString(label), 17, _hoisted_4$3);
423
- }), 128))
424
- ])
425
- ]),
426
- default: withCtx(() => [
427
- createElementVNode("div", _hoisted_1$4, [
428
- createElementVNode("div", _hoisted_2$4, [
429
- renderSlot(_ctx.$slots, "default", { label: unref(selectedLabel) }, () => [
430
- createTextVNode(toDisplayString(unref(selectedLabel)), 1)
431
- ])
432
- ]),
433
- createVNode(unref(Icon), {
434
- icon: "carbon:chevron-sort",
435
- class: "htw-w-4 htw-h-4 htw-flex-none htw-ml-auto"
436
- })
437
- ])
438
- ]),
439
- _: 3
440
- });
441
- };
322
+ return (t, e) => (i(), f(w(G), { "auto-size": "" }, {
323
+ popper: v(({ hide: l }) => [
324
+ c("div", vt, [
325
+ (i(!0), m(E, null, L(w(o), ([r, d]) => (i(), m("div", O({ ...t.$attrs, class: null, style: null }, {
326
+ key: d,
327
+ class: ["htw-px-2 htw-py-1 htw-cursor-pointer hover:htw-bg-primary-100 dark:hover:htw-bg-primary-700", {
328
+ "htw-bg-primary-200 dark:htw-bg-primary-800": a.modelValue === r
329
+ }],
330
+ onClick: (p) => u(r, l)
331
+ }), k(d), 17, yt))), 128))
332
+ ])
333
+ ]),
334
+ default: v(() => [
335
+ c("div", pt, [
336
+ c("div", ft, [
337
+ g(t.$slots, "default", { label: w(n) }, () => [
338
+ M(k(w(n)), 1)
339
+ ])
340
+ ]),
341
+ I(w(U), {
342
+ icon: "carbon:chevron-sort",
343
+ class: "htw-w-4 htw-h-4 htw-flex-none htw-ml-auto"
344
+ })
345
+ ])
346
+ ]),
347
+ _: 3
348
+ }));
442
349
  }
443
- });
444
- const __default__$5 = {
350
+ }), $t = {
445
351
  name: "HstSelect"
446
- };
447
- const _sfc_main$5 = /* @__PURE__ */ defineComponent({
448
- ...__default__$5,
352
+ }, gt = /* @__PURE__ */ _({
353
+ ...$t,
449
354
  props: {
450
355
  title: null,
451
356
  modelValue: null,
452
357
  options: null
453
358
  },
454
359
  emits: ["update:modelValue"],
455
- setup(__props, { emit: emits }) {
456
- return (_ctx, _cache) => {
457
- return openBlock(), createBlock(_sfc_main$c, {
458
- title: __props.title,
459
- class: normalizeClass(["htw-cursor-text htw-items-center", _ctx.$attrs.class]),
460
- style: normalizeStyle(_ctx.$attrs.style)
461
- }, {
462
- actions: withCtx(() => [
463
- renderSlot(_ctx.$slots, "actions")
464
- ]),
465
- default: withCtx(() => [
466
- createVNode(_sfc_main$6, {
467
- options: __props.options,
468
- "model-value": __props.modelValue,
469
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => emits("update:modelValue", $event))
470
- }, null, 8, ["options", "model-value"])
471
- ]),
472
- _: 3
473
- }, 8, ["title", "class", "style"]);
474
- };
360
+ setup(s, { emit: h }) {
361
+ return (a, o) => (i(), f(z, {
362
+ title: s.title,
363
+ class: x(["htw-cursor-text htw-items-center", a.$attrs.class]),
364
+ style: S(a.$attrs.style)
365
+ }, {
366
+ actions: v(() => [
367
+ g(a.$slots, "actions")
368
+ ]),
369
+ default: v(() => [
370
+ I(_t, {
371
+ options: s.options,
372
+ "model-value": s.modelValue,
373
+ "onUpdate:modelValue": o[0] || (o[0] = (n) => h("update:modelValue", n))
374
+ }, null, 8, ["options", "model-value"])
375
+ ]),
376
+ _: 3
377
+ }, 8, ["title", "class", "style"]));
475
378
  }
476
- });
477
- const __default__$4 = {
379
+ }), xt = {
478
380
  name: "HstCopyIcon"
479
- };
480
- const _sfc_main$4 = /* @__PURE__ */ defineComponent({
481
- ...__default__$4,
381
+ }, T = /* @__PURE__ */ _({
382
+ ...xt,
482
383
  props: {
483
384
  content: null
484
385
  },
485
- setup(__props) {
486
- const props = __props;
487
- const { copy, copied } = useClipboard();
488
- const action = () => copy(props.content);
489
- return (_ctx, _cache) => {
490
- return withDirectives((openBlock(), createBlock(unref(Icon), {
491
- icon: "carbon:copy-file",
492
- class: "htw-w-4 htw-h-4 htw-opacity-50 hover:htw-opacity-100 hover:htw-text-primary-500 htw-cursor-pointer",
493
- onClick: _cache[0] || (_cache[0] = ($event) => action())
494
- }, null, 512)), [
495
- [unref(VTooltip), {
496
- content: "Copied!",
497
- triggers: [],
498
- shown: unref(copied),
499
- distance: 12,
500
- delay: 0
501
- }]
502
- ]);
503
- };
386
+ setup(s) {
387
+ const h = s, { copy: a, copied: o } = P(), n = () => a(h.content);
388
+ return (u, t) => V((i(), f(w(U), {
389
+ icon: "carbon:copy-file",
390
+ class: "htw-w-4 htw-h-4 htw-opacity-50 hover:htw-opacity-100 hover:htw-text-primary-500 htw-cursor-pointer",
391
+ onClick: t[0] || (t[0] = (e) => n())
392
+ }, null, 512)), [
393
+ [w(N), {
394
+ content: "Copied!",
395
+ triggers: [],
396
+ shown: w(o),
397
+ distance: 12,
398
+ delay: 0
399
+ }]
400
+ ]);
504
401
  }
505
- });
506
- const _hoisted_1$3 = {
402
+ }), kt = {
507
403
  key: 0,
508
404
  class: "htw-grid htw-gap-4 htw-grid-cols-[repeat(auto-fill,minmax(200px,1fr))] htw-m-4"
509
- };
510
- const _hoisted_2$3 = ["onMouseenter"];
511
- const _hoisted_3$3 = { class: "htw-flex htw-gap-1" };
512
- const _hoisted_4$2 = { class: "htw-my-0 htw-truncate htw-shrink" };
513
- const _hoisted_5$2 = { class: "htw-flex htw-gap-1" };
514
- const _hoisted_6$1 = { class: "htw-my-0 htw-opacity-50 htw-truncate htw-shrink" };
515
- const __default__$3 = {
405
+ }, Vt = ["onMouseenter"], St = { class: "htw-flex htw-gap-1" }, Ht = { class: "htw-my-0 htw-truncate htw-shrink" }, Ct = { class: "htw-flex htw-gap-1" }, Mt = { class: "htw-my-0 htw-opacity-50 htw-truncate htw-shrink" }, Nt = {
516
406
  name: "HstColorShades"
517
- };
518
- const _sfc_main$3 = /* @__PURE__ */ defineComponent({
519
- ...__default__$3,
407
+ }, Tt = /* @__PURE__ */ _({
408
+ ...Nt,
520
409
  props: {
521
410
  shades: null,
522
411
  getName: null,
523
412
  search: null
524
413
  },
525
- setup(__props) {
526
- const props = __props;
527
- const flattenShades = (shades, path = "") => {
528
- return Object.entries(shades).reduce((acc, [key, color]) => {
529
- const nextPath = path ? key === "DEFAULT" ? path : `${path}-${key}` : key;
530
- const obj = typeof color === "object" ? flattenShades(color, nextPath) : { [nextPath]: color };
531
- return { ...acc, ...obj };
532
- }, {});
533
- };
534
- const shadesWithName = computed(() => {
535
- const shades = props.shades;
536
- const getName = props.getName;
537
- const flatShades = flattenShades(shades);
538
- return Object.entries(flatShades).map(([key, color]) => {
539
- const name = getName ? getName(key, color) : key;
414
+ setup(s) {
415
+ const h = s, a = (t, e = "") => Object.entries(t).reduce((l, [r, d]) => {
416
+ const p = e ? r === "DEFAULT" ? e : `${e}-${r}` : r, $ = typeof d == "object" ? a(d, p) : { [p]: d };
417
+ return { ...l, ...$ };
418
+ }, {}), o = y(() => {
419
+ const t = h.shades, e = h.getName, l = a(t);
420
+ return Object.entries(l).map(([r, d]) => {
421
+ const p = e ? e(r, d) : r;
540
422
  return {
541
- key,
542
- color,
543
- name
423
+ key: r,
424
+ color: d,
425
+ name: p
544
426
  };
545
427
  });
546
- });
547
- const displayedShades = computed(() => {
548
- let list = shadesWithName.value;
549
- if (props.search) {
550
- const reg = new RegExp(props.search, "i");
551
- list = list.filter(({ name }) => reg.test(name));
428
+ }), n = y(() => {
429
+ let t = o.value;
430
+ if (h.search) {
431
+ const e = new RegExp(h.search, "i");
432
+ t = t.filter(({ name: l }) => e.test(l));
552
433
  }
553
- return list;
554
- });
555
- const hover = ref(null);
556
- return (_ctx, _cache) => {
557
- return unref(displayedShades).length ? (openBlock(), createElementBlock("div", _hoisted_1$3, [
558
- (openBlock(true), createElementBlock(Fragment, null, renderList(unref(displayedShades), (shade) => {
559
- return openBlock(), createElementBlock("div", {
560
- key: shade.key,
561
- class: "htw-flex htw-flex-col htw-gap-2",
562
- onMouseenter: ($event) => hover.value = shade.key,
563
- onMouseleave: _cache[0] || (_cache[0] = ($event) => hover.value = null)
564
- }, [
565
- renderSlot(_ctx.$slots, "default", {
566
- color: shade.color
567
- }, () => [
568
- createElementVNode("div", {
569
- class: "htw-rounded-full htw-w-16 htw-h-16",
570
- style: normalizeStyle({
571
- backgroundColor: shade.color
572
- })
573
- }, null, 4)
434
+ return t;
435
+ }), u = b(null);
436
+ return (t, e) => w(n).length ? (i(), m("div", kt, [
437
+ (i(!0), m(E, null, L(w(n), (l) => (i(), m("div", {
438
+ key: l.key,
439
+ class: "htw-flex htw-flex-col htw-gap-2",
440
+ onMouseenter: (r) => u.value = l.key,
441
+ onMouseleave: e[0] || (e[0] = (r) => u.value = null)
442
+ }, [
443
+ g(t.$slots, "default", {
444
+ color: l.color
445
+ }, () => [
446
+ c("div", {
447
+ class: "htw-rounded-full htw-w-16 htw-h-16",
448
+ style: S({
449
+ backgroundColor: l.color
450
+ })
451
+ }, null, 4)
452
+ ]),
453
+ c("div", null, [
454
+ c("div", St, [
455
+ V((i(), m("pre", Ht, [
456
+ M(k(l.name), 1)
457
+ ])), [
458
+ [w(N), l.name.length > 23 ? l.name : ""]
574
459
  ]),
575
- createElementVNode("div", null, [
576
- createElementVNode("div", _hoisted_3$3, [
577
- withDirectives((openBlock(), createElementBlock("pre", _hoisted_4$2, [
578
- createTextVNode(toDisplayString(shade.name), 1)
579
- ])), [
580
- [unref(VTooltip), shade.name.length > 23 ? shade.name : ""]
581
- ]),
582
- hover.value === shade.key ? (openBlock(), createBlock(_sfc_main$4, {
583
- key: 0,
584
- content: shade.name,
585
- class: "htw-flex-none"
586
- }, null, 8, ["content"])) : createCommentVNode("", true)
587
- ]),
588
- createElementVNode("div", _hoisted_5$2, [
589
- withDirectives((openBlock(), createElementBlock("pre", _hoisted_6$1, [
590
- createTextVNode(toDisplayString(shade.color), 1)
591
- ])), [
592
- [unref(VTooltip), shade.color.length > 23 ? shade.color : ""]
593
- ]),
594
- hover.value === shade.key ? (openBlock(), createBlock(_sfc_main$4, {
595
- key: 0,
596
- content: shade.color,
597
- class: "htw-flex-none"
598
- }, null, 8, ["content"])) : createCommentVNode("", true)
599
- ])
600
- ])
601
- ], 40, _hoisted_2$3);
602
- }), 128))
603
- ])) : createCommentVNode("", true);
604
- };
460
+ u.value === l.key ? (i(), f(T, {
461
+ key: 0,
462
+ content: l.name,
463
+ class: "htw-flex-none"
464
+ }, null, 8, ["content"])) : H("", !0)
465
+ ]),
466
+ c("div", Ct, [
467
+ V((i(), m("pre", Mt, [
468
+ M(k(l.color), 1)
469
+ ])), [
470
+ [w(N), l.color.length > 23 ? l.color : ""]
471
+ ]),
472
+ u.value === l.key ? (i(), f(T, {
473
+ key: 0,
474
+ content: l.color,
475
+ class: "htw-flex-none"
476
+ }, null, 8, ["content"])) : H("", !0)
477
+ ])
478
+ ])
479
+ ], 40, Vt))), 128))
480
+ ])) : H("", !0);
605
481
  }
606
- });
607
- const _hoisted_1$2 = ["onMouseenter"];
608
- const _hoisted_2$2 = { class: "htw-mx-4" };
609
- const _hoisted_3$2 = { class: "htw-flex htw-gap-1" };
610
- const _hoisted_4$1 = { class: "htw-my-0 htw-truncate htw-shrink" };
611
- const _hoisted_5$1 = { class: "htw-flex htw-gap-1" };
612
- const _hoisted_6 = { class: "htw-my-0 htw-opacity-50 htw-truncate htw-shrink" };
613
- const __default__$2 = {
482
+ }), zt = ["onMouseenter"], Et = { class: "htw-mx-4" }, Ot = { class: "htw-flex htw-gap-1" }, Lt = { class: "htw-my-0 htw-truncate htw-shrink" }, At = { class: "htw-flex htw-gap-1" }, jt = { class: "htw-my-0 htw-opacity-50 htw-truncate htw-shrink" }, Dt = {
614
483
  name: "HstTokenList"
615
- };
616
- const _sfc_main$2 = /* @__PURE__ */ defineComponent({
617
- ...__default__$2,
484
+ }, Bt = /* @__PURE__ */ _({
485
+ ...Dt,
618
486
  props: {
619
487
  tokens: null,
620
488
  getName: null
621
489
  },
622
- setup(__props) {
623
- const props = __props;
624
- const processedTokens = computed(() => {
625
- const list = props.tokens;
626
- const getName = props.getName;
627
- return Object.entries(list).map(([key, value]) => {
628
- const name = getName ? getName(key, value) : key;
490
+ setup(s) {
491
+ const h = s, a = y(() => {
492
+ const n = h.tokens, u = h.getName;
493
+ return Object.entries(n).map(([t, e]) => {
494
+ const l = u ? u(t, e) : t;
629
495
  return {
630
- key,
631
- name,
632
- value: typeof value === "number" ? value.toString() : value
496
+ key: t,
497
+ name: l,
498
+ value: typeof e == "number" ? e.toString() : e
633
499
  };
634
500
  });
635
- });
636
- const hover = ref(null);
637
- return (_ctx, _cache) => {
638
- return openBlock(true), createElementBlock(Fragment, null, renderList(unref(processedTokens), (token) => {
639
- return openBlock(), createElementBlock("div", {
640
- key: token.key,
641
- class: "htw-flex htw-flex-col htw-gap-2 htw-my-8",
642
- onMouseenter: ($event) => hover.value = token.key,
643
- onMouseleave: _cache[0] || (_cache[0] = ($event) => hover.value = null)
644
- }, [
645
- renderSlot(_ctx.$slots, "default", { token }),
646
- createElementVNode("div", _hoisted_2$2, [
647
- createElementVNode("div", _hoisted_3$2, [
648
- createElementVNode("pre", _hoisted_4$1, toDisplayString(token.name), 1),
649
- hover.value === token.key ? (openBlock(), createBlock(_sfc_main$4, {
650
- key: 0,
651
- content: token.name,
652
- class: "htw-flex-none"
653
- }, null, 8, ["content"])) : createCommentVNode("", true)
654
- ]),
655
- createElementVNode("div", _hoisted_5$1, [
656
- createElementVNode("pre", _hoisted_6, toDisplayString(token.value), 1),
657
- hover.value === token.key ? (openBlock(), createBlock(_sfc_main$4, {
658
- key: 0,
659
- content: typeof token.value === "string" ? token.value : JSON.stringify(token.value),
660
- class: "htw-flex-none"
661
- }, null, 8, ["content"])) : createCommentVNode("", true)
662
- ])
663
- ])
664
- ], 40, _hoisted_1$2);
665
- }), 128);
666
- };
501
+ }), o = b(null);
502
+ return (n, u) => (i(!0), m(E, null, L(w(a), (t) => (i(), m("div", {
503
+ key: t.key,
504
+ class: "htw-flex htw-flex-col htw-gap-2 htw-my-8",
505
+ onMouseenter: (e) => o.value = t.key,
506
+ onMouseleave: u[0] || (u[0] = (e) => o.value = null)
507
+ }, [
508
+ g(n.$slots, "default", { token: t }),
509
+ c("div", Et, [
510
+ c("div", Ot, [
511
+ c("pre", Lt, k(t.name), 1),
512
+ o.value === t.key ? (i(), f(T, {
513
+ key: 0,
514
+ content: t.name,
515
+ class: "htw-flex-none"
516
+ }, null, 8, ["content"])) : H("", !0)
517
+ ]),
518
+ c("div", At, [
519
+ c("pre", jt, k(t.value), 1),
520
+ o.value === t.key ? (i(), f(T, {
521
+ key: 0,
522
+ content: typeof t.value == "string" ? t.value : JSON.stringify(t.value),
523
+ class: "htw-flex-none"
524
+ }, null, 8, ["content"])) : H("", !0)
525
+ ])
526
+ ])
527
+ ], 40, zt))), 128));
667
528
  }
668
529
  });
669
- var HstTokenGrid_vue_vue_type_style_index_0_lang = "";
670
- const _hoisted_1$1 = ["onMouseenter"];
671
- const _hoisted_2$1 = { class: "htw-flex htw-gap-1" };
672
- const _hoisted_3$1 = { class: "htw-my-0 htw-truncate htw-shrink" };
673
- const _hoisted_4 = { class: "htw-flex htw-gap-1" };
674
- const _hoisted_5 = { class: "htw-my-0 htw-opacity-50 htw-truncate htw-shrink" };
675
- const __default__$1 = {
530
+ const It = ["onMouseenter"], Ut = { class: "htw-flex htw-gap-1" }, Ft = { class: "htw-my-0 htw-truncate htw-shrink" }, Kt = { class: "htw-flex htw-gap-1" }, Rt = { class: "htw-my-0 htw-opacity-50 htw-truncate htw-shrink" }, Gt = {
676
531
  name: "HstTokenGrid"
677
- };
678
- const _sfc_main$1 = /* @__PURE__ */ defineComponent({
679
- ...__default__$1,
532
+ }, Pt = /* @__PURE__ */ _({
533
+ ...Gt,
680
534
  props: {
681
535
  tokens: null,
682
536
  colSize: { default: 180 },
683
537
  getName: { type: Function, default: null }
684
538
  },
685
- setup(__props) {
686
- const props = __props;
687
- const processedTokens = computed(() => {
688
- const list = props.tokens;
689
- const getName = props.getName;
690
- return Object.entries(list).map(([key, value]) => {
691
- const name = getName ? getName(key, value) : key;
539
+ setup(s) {
540
+ const h = s, a = y(() => {
541
+ const u = h.tokens, t = h.getName;
542
+ return Object.entries(u).map(([e, l]) => {
543
+ const r = t ? t(e, l) : e;
692
544
  return {
693
- key,
694
- name,
695
- value: typeof value === "number" ? value.toString() : value
545
+ key: e,
546
+ name: r,
547
+ value: typeof l == "number" ? l.toString() : l
696
548
  };
697
549
  });
698
- });
699
- const colSizePx = computed(() => `${props.colSize}px`);
700
- const hover = ref(null);
701
- return (_ctx, _cache) => {
702
- return openBlock(), createElementBlock("div", {
703
- class: "htw-bind-col-size htw-grid htw-gap-4 htw-m-4",
704
- style: normalizeStyle({
705
- "--histoire-col-size": unref(colSizePx)
706
- })
550
+ }), o = y(() => `${h.colSize}px`), n = b(null);
551
+ return (u, t) => (i(), m("div", {
552
+ class: "htw-bind-col-size htw-grid htw-gap-4 htw-m-4",
553
+ style: S({
554
+ "--histoire-col-size": w(o)
555
+ })
556
+ }, [
557
+ (i(!0), m(E, null, L(w(a), (e) => (i(), m("div", {
558
+ key: e.key,
559
+ class: "htw-flex htw-flex-col htw-gap-2",
560
+ onMouseenter: (l) => n.value = e.key,
561
+ onMouseleave: t[0] || (t[0] = (l) => n.value = null)
707
562
  }, [
708
- (openBlock(true), createElementBlock(Fragment, null, renderList(unref(processedTokens), (token) => {
709
- return openBlock(), createElementBlock("div", {
710
- key: token.key,
711
- class: "htw-flex htw-flex-col htw-gap-2",
712
- onMouseenter: ($event) => hover.value = token.key,
713
- onMouseleave: _cache[0] || (_cache[0] = ($event) => hover.value = null)
714
- }, [
715
- renderSlot(_ctx.$slots, "default", { token }),
716
- createElementVNode("div", null, [
717
- createElementVNode("div", _hoisted_2$1, [
718
- withDirectives((openBlock(), createElementBlock("pre", _hoisted_3$1, [
719
- createTextVNode(toDisplayString(token.name), 1)
720
- ])), [
721
- [unref(VTooltip), token.name.length > __props.colSize / 8 ? token.name : ""]
722
- ]),
723
- hover.value === token.key ? (openBlock(), createBlock(_sfc_main$4, {
724
- key: 0,
725
- content: token.name,
726
- class: "htw-flex-none"
727
- }, null, 8, ["content"])) : createCommentVNode("", true)
728
- ]),
729
- createElementVNode("div", _hoisted_4, [
730
- withDirectives((openBlock(), createElementBlock("pre", _hoisted_5, [
731
- createTextVNode(toDisplayString(token.value), 1)
732
- ])), [
733
- [unref(VTooltip), token.value.length > __props.colSize / 8 ? token.value : ""]
734
- ]),
735
- hover.value === token.key ? (openBlock(), createBlock(_sfc_main$4, {
736
- key: 0,
737
- content: typeof token.value === "string" ? token.value : JSON.stringify(token.value),
738
- class: "htw-flex-none"
739
- }, null, 8, ["content"])) : createCommentVNode("", true)
740
- ])
741
- ])
742
- ], 40, _hoisted_1$1);
743
- }), 128))
744
- ], 4);
745
- };
563
+ g(u.$slots, "default", { token: e }),
564
+ c("div", null, [
565
+ c("div", Ut, [
566
+ V((i(), m("pre", Ft, [
567
+ M(k(e.name), 1)
568
+ ])), [
569
+ [w(N), e.name.length > s.colSize / 8 ? e.name : ""]
570
+ ]),
571
+ n.value === e.key ? (i(), f(T, {
572
+ key: 0,
573
+ content: e.name,
574
+ class: "htw-flex-none"
575
+ }, null, 8, ["content"])) : H("", !0)
576
+ ]),
577
+ c("div", Kt, [
578
+ V((i(), m("pre", Rt, [
579
+ M(k(e.value), 1)
580
+ ])), [
581
+ [w(N), e.value.length > s.colSize / 8 ? e.value : ""]
582
+ ]),
583
+ n.value === e.key ? (i(), f(T, {
584
+ key: 0,
585
+ content: typeof e.value == "string" ? e.value : JSON.stringify(e.value),
586
+ class: "htw-flex-none"
587
+ }, null, 8, ["content"])) : H("", !0)
588
+ ])
589
+ ])
590
+ ], 40, It))), 128))
591
+ ], 4));
746
592
  }
747
- });
748
- const _hoisted_1 = { class: "-htw-my-1" };
749
- const _hoisted_2 = ["id", "name", "value", "checked", "onChange"];
750
- const _hoisted_3 = ["for", "onKeydown"];
751
- const __default__ = {
593
+ }), Wt = { class: "-htw-my-1" }, Xt = ["id", "name", "value", "checked", "onChange"], Jt = ["for", "onKeydown"], qt = {
752
594
  name: "HstRadio"
753
- };
754
- const _sfc_main = /* @__PURE__ */ defineComponent({
755
- ...__default__,
595
+ }, Qt = /* @__PURE__ */ _({
596
+ ...qt,
756
597
  props: {
757
598
  title: null,
758
599
  modelValue: null,
759
600
  options: null
760
601
  },
761
602
  emits: ["update:modelValue"],
762
- setup(__props, { emit }) {
763
- const props = __props;
764
- const formattedOptions = computed(() => {
765
- if (Array.isArray(props.options)) {
766
- return Object.fromEntries(props.options.map((value) => {
767
- if (typeof value === "string") {
768
- return [value, value];
769
- } else {
770
- return [value.value, value.label];
771
- }
772
- }));
773
- }
774
- return props.options;
775
- });
776
- function selectOption(value) {
777
- emit("update:modelValue", value);
778
- animationEnabled.value = true;
603
+ setup(s, { emit: h }) {
604
+ const a = s, o = y(() => Array.isArray(a.options) ? Object.fromEntries(a.options.map((t) => typeof t == "string" ? [t, t] : [t.value, t.label])) : a.options);
605
+ function n(t) {
606
+ h("update:modelValue", t), u.value = !0;
779
607
  }
780
- const animationEnabled = ref(false);
781
- return (_ctx, _cache) => {
782
- return openBlock(), createBlock(_sfc_main$c, {
783
- role: "group",
784
- title: __props.title,
785
- class: normalizeClass(["htw-cursor-text", _ctx.$attrs.class]),
786
- style: normalizeStyle(_ctx.$attrs.style)
787
- }, {
788
- actions: withCtx(() => [
789
- renderSlot(_ctx.$slots, "actions")
790
- ]),
791
- default: withCtx(() => [
792
- createElementVNode("div", _hoisted_1, [
793
- (openBlock(true), createElementBlock(Fragment, null, renderList(unref(formattedOptions), (label, value) => {
794
- return openBlock(), createElementBlock(Fragment, { key: value }, [
795
- createElementVNode("input", {
796
- id: `${value}-radio`,
797
- type: "radio",
798
- name: `${value}-radio`,
799
- value,
800
- checked: value === __props.modelValue,
801
- class: "htw-hidden",
802
- onChange: ($event) => selectOption(value)
803
- }, null, 40, _hoisted_2),
804
- createElementVNode("label", {
805
- tabindex: "0",
806
- for: `${value}-radio`,
807
- class: "htw-cursor-pointer htw-flex htw-items-center htw-relative htw-py-1 htw-group",
808
- onKeydown: [
809
- withKeys(withModifiers(($event) => selectOption(value), ["prevent"]), ["enter"]),
810
- withKeys(withModifiers(($event) => selectOption(value), ["prevent"]), ["space"])
811
- ]
812
- }, [
813
- (openBlock(), createElementBlock("svg", {
814
- width: "16",
815
- height: "16",
816
- viewBox: "-12 -12 24 24",
817
- class: normalizeClass(["htw-relative htw-z-10 htw-border htw-border-solid htw-text-inherit htw-rounded-full htw-box-border htw-inset-0 htw-transition-border htw-duration-150 htw-ease-out htw-mr-2 group-hover:htw-border-primary-500", [
818
- __props.modelValue === value ? "htw-border-primary-500" : "htw-border-black/25 dark:htw-border-white/25"
819
- ]])
820
- }, [
821
- createElementVNode("circle", {
822
- r: "7",
823
- class: normalizeClass(["htw-will-change-transform", [
824
- animationEnabled.value ? "htw-transition-all" : "htw-transition-none",
825
- {
826
- "htw-delay-150": __props.modelValue === value
827
- },
828
- __props.modelValue === value ? "htw-fill-primary-500" : "htw-fill-transparent htw-scale-0"
829
- ]])
830
- }, null, 2)
831
- ], 2)),
832
- createTextVNode(" " + toDisplayString(label), 1)
833
- ], 40, _hoisted_3)
834
- ], 64);
835
- }), 128))
836
- ])
837
- ]),
838
- _: 3
839
- }, 8, ["title", "class", "style"]);
840
- };
608
+ const u = b(!1);
609
+ return (t, e) => (i(), f(z, {
610
+ role: "group",
611
+ title: s.title,
612
+ class: x(["htw-cursor-text", t.$attrs.class]),
613
+ style: S(t.$attrs.style)
614
+ }, {
615
+ actions: v(() => [
616
+ g(t.$slots, "actions")
617
+ ]),
618
+ default: v(() => [
619
+ c("div", Wt, [
620
+ (i(!0), m(E, null, L(w(o), (l, r) => (i(), m(E, { key: r }, [
621
+ c("input", {
622
+ id: `${r}-radio`,
623
+ type: "radio",
624
+ name: `${r}-radio`,
625
+ value: r,
626
+ checked: r === s.modelValue,
627
+ class: "htw-hidden",
628
+ onChange: (d) => n(r)
629
+ }, null, 40, Xt),
630
+ c("label", {
631
+ tabindex: "0",
632
+ for: `${r}-radio`,
633
+ class: "htw-cursor-pointer htw-flex htw-items-center htw-relative htw-py-1 htw-group",
634
+ onKeydown: [
635
+ A(j((d) => n(r), ["prevent"]), ["enter"]),
636
+ A(j((d) => n(r), ["prevent"]), ["space"])
637
+ ]
638
+ }, [
639
+ (i(), m("svg", {
640
+ width: "16",
641
+ height: "16",
642
+ viewBox: "-12 -12 24 24",
643
+ class: x(["htw-relative htw-z-10 htw-border htw-border-solid htw-text-inherit htw-rounded-full htw-box-border htw-inset-0 htw-transition-border htw-duration-150 htw-ease-out htw-mr-2 group-hover:htw-border-primary-500", [
644
+ s.modelValue === r ? "htw-border-primary-500" : "htw-border-black/25 dark:htw-border-white/25"
645
+ ]])
646
+ }, [
647
+ c("circle", {
648
+ r: "7",
649
+ class: x(["htw-will-change-transform", [
650
+ u.value ? "htw-transition-all" : "htw-transition-none",
651
+ {
652
+ "htw-delay-150": s.modelValue === r
653
+ },
654
+ s.modelValue === r ? "htw-fill-primary-500" : "htw-fill-transparent htw-scale-0"
655
+ ]])
656
+ }, null, 2)
657
+ ], 2)),
658
+ M(" " + k(l), 1)
659
+ ], 40, Jt)
660
+ ], 64))), 128))
661
+ ])
662
+ ]),
663
+ _: 3
664
+ }, 8, ["title", "class", "style"]));
841
665
  }
842
- });
843
- const HstCheckbox = _sfc_main$b;
844
- const HstText = _sfc_main$a;
845
- const HstNumber = _sfc_main$9;
846
- const HstSlider = _sfc_main$8;
847
- const HstTextarea = _sfc_main$7;
848
- const HstSelect = _sfc_main$5;
849
- const HstColorShades = _sfc_main$3;
850
- const HstTokenList = _sfc_main$2;
851
- const HstTokenGrid = _sfc_main$1;
852
- const HstCopyIcon = _sfc_main$4;
853
- const HstRadio = _sfc_main;
854
- const components = {
855
- HstCheckbox,
856
- HstText,
857
- HstNumber,
858
- HstSlider,
859
- HstTextarea,
860
- HstSelect,
861
- HstColorShades,
862
- HstTokenList,
863
- HstTokenGrid,
864
- HstCopyIcon,
865
- HstRadio
666
+ }), Yt = st, Zt = ot, te = at, ee = ct, se = mt, le = gt, ne = Tt, oe = Bt, re = Pt, ae = T, ue = Qt, we = {
667
+ HstCheckbox: Yt,
668
+ HstText: Zt,
669
+ HstNumber: te,
670
+ HstSlider: ee,
671
+ HstTextarea: se,
672
+ HstSelect: le,
673
+ HstColorShades: ne,
674
+ HstTokenList: oe,
675
+ HstTokenGrid: re,
676
+ HstCopyIcon: ae,
677
+ HstRadio: ue
678
+ };
679
+ export {
680
+ Yt as HstCheckbox,
681
+ ne as HstColorShades,
682
+ ae as HstCopyIcon,
683
+ te as HstNumber,
684
+ ue as HstRadio,
685
+ le as HstSelect,
686
+ ee as HstSlider,
687
+ Zt as HstText,
688
+ se as HstTextarea,
689
+ re as HstTokenGrid,
690
+ oe as HstTokenList,
691
+ we as components
866
692
  };
867
- export { HstCheckbox, HstColorShades, HstCopyIcon, HstNumber, HstRadio, HstSelect, HstSlider, HstText, HstTextarea, HstTokenGrid, HstTokenList, components };