@histoire/controls 0.7.6 → 0.7.9

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.
@@ -0,0 +1,2 @@
1
+ declare const _default: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
2
+ export default _default;
@@ -0,0 +1,24 @@
1
+ import { HstControlOption } from '../../types';
2
+ declare const _default: import("vue").DefineComponent<__VLS_TypePropsToRuntimeProps<{
3
+ title?: string;
4
+ modelValue: string;
5
+ options: HstControlOption[];
6
+ }>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
7
+ "update:modelValue": (value: string) => void;
8
+ }, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
9
+ title?: string;
10
+ modelValue: string;
11
+ options: HstControlOption[];
12
+ }>>> & {
13
+ "onUpdate:modelValue"?: (value: string) => any;
14
+ }, {}>;
15
+ export default _default;
16
+ declare type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
17
+ declare type __VLS_TypePropsToRuntimeProps<T> = {
18
+ [K in keyof T]-?: {} extends Pick<T, K> ? {
19
+ type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
20
+ } : {
21
+ type: import('vue').PropType<T[K]>;
22
+ required: true;
23
+ };
24
+ };
@@ -1,15 +1,12 @@
1
- export interface SelectOption {
2
- label: string;
3
- value: string;
4
- }
1
+ import { HstControlOption } from '../../types';
5
2
  declare const _default: import("vue").DefineComponent<__VLS_TypePropsToRuntimeProps<{
6
3
  modelValue: string;
7
- options: Record<string, string> | string[] | SelectOption[];
4
+ options: Record<string, string> | string[] | HstControlOption[];
8
5
  }>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
9
6
  "update:modelValue": (value: string) => void;
10
7
  }, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
11
8
  modelValue: string;
12
- options: Record<string, string> | string[] | SelectOption[];
9
+ options: Record<string, string> | string[] | HstControlOption[];
13
10
  }>>> & {
14
11
  "onUpdate:modelValue"?: (value: string) => any;
15
12
  }, {}>;
@@ -1,14 +1,14 @@
1
- import { SelectOption } from './CustomSelect.vue';
1
+ import { HstControlOption } from '../../types';
2
2
  declare const _default: import("vue").DefineComponent<__VLS_TypePropsToRuntimeProps<{
3
3
  title?: string;
4
4
  modelValue: string;
5
- options: Record<string, string> | string[] | SelectOption[];
5
+ options: Record<string, string> | string[] | HstControlOption[];
6
6
  }>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
7
7
  "update:modelValue": (value: string) => void;
8
8
  }, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
9
9
  title?: string;
10
10
  modelValue: string;
11
- options: Record<string, string> | string[] | SelectOption[];
11
+ options: Record<string, string> | string[] | HstControlOption[];
12
12
  }>>> & {
13
13
  "onUpdate:modelValue"?: (value: string) => any;
14
14
  }, {}>;
@@ -22,4 +22,3 @@ declare type __VLS_TypePropsToRuntimeProps<T> = {
22
22
  required: true;
23
23
  };
24
24
  };
25
- export type { SelectOption as HstSelectOption } from './CustomSelect.vue';
package/dist/index.d.ts CHANGED
@@ -205,4 +205,33 @@ export declare const HstCopyIcon: import("vue").DefineComponent<{
205
205
  required: true;
206
206
  };
207
207
  }>>, {}>;
208
+ export declare const HstRadio: import("vue").DefineComponent<{
209
+ title: {
210
+ type: import("vue").PropType<string>;
211
+ };
212
+ modelValue: {
213
+ type: import("vue").PropType<string>;
214
+ required: true;
215
+ };
216
+ options: {
217
+ type: import("vue").PropType<import("./types").HstControlOption[]>;
218
+ required: true;
219
+ };
220
+ }, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
221
+ "update:modelValue": (value: string) => void;
222
+ }, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
223
+ title: {
224
+ type: import("vue").PropType<string>;
225
+ };
226
+ modelValue: {
227
+ type: import("vue").PropType<string>;
228
+ required: true;
229
+ };
230
+ options: {
231
+ type: import("vue").PropType<import("./types").HstControlOption[]>;
232
+ required: true;
233
+ };
234
+ }>> & {
235
+ "onUpdate:modelValue"?: (value: string) => any;
236
+ }, {}>;
208
237
  export declare function registerVueComponents(app: App): void;
package/dist/index.es.js CHANGED
@@ -2343,10 +2343,10 @@ const _hoisted_2$1$1 = {
2343
2343
  ref: "inner",
2344
2344
  class: "v-popper__inner"
2345
2345
  };
2346
- const _hoisted_3$6 = /* @__PURE__ */ createElementVNode("div", { class: "v-popper__arrow-outer" }, null, -1);
2346
+ const _hoisted_3$7 = /* @__PURE__ */ createElementVNode("div", { class: "v-popper__arrow-outer" }, null, -1);
2347
2347
  const _hoisted_4$5 = /* @__PURE__ */ createElementVNode("div", { class: "v-popper__arrow-inner" }, null, -1);
2348
2348
  const _hoisted_5$3 = [
2349
- _hoisted_3$6,
2349
+ _hoisted_3$7,
2350
2350
  _hoisted_4$5
2351
2351
  ];
2352
2352
  function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
@@ -2525,7 +2525,7 @@ defineComponent(__spreadProps2(__spreadValues2({}, PrivatePopperWrapper), {
2525
2525
  name: "VTooltip",
2526
2526
  vPopperTheme: "tooltip"
2527
2527
  }));
2528
- const _sfc_main$c = defineComponent({
2528
+ const _sfc_main$d = defineComponent({
2529
2529
  name: "VTooltipDirective",
2530
2530
  components: {
2531
2531
  Popper: PrivatePopper(),
@@ -2616,8 +2616,8 @@ const _sfc_main$c = defineComponent({
2616
2616
  }
2617
2617
  }
2618
2618
  });
2619
- const _hoisted_1$9 = ["innerHTML"];
2620
- const _hoisted_2$7 = ["textContent"];
2619
+ const _hoisted_1$a = ["innerHTML"];
2620
+ const _hoisted_2$8 = ["textContent"];
2621
2621
  function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
2622
2622
  const _component_PopperContent = resolveComponent("PopperContent");
2623
2623
  const _component_Popper = resolveComponent("Popper");
@@ -2660,10 +2660,10 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
2660
2660
  _ctx.html ? (openBlock(), createElementBlock("div", {
2661
2661
  key: 0,
2662
2662
  innerHTML: _ctx.finalContent
2663
- }, null, 8, _hoisted_1$9)) : (openBlock(), createElementBlock("div", {
2663
+ }, null, 8, _hoisted_1$a)) : (openBlock(), createElementBlock("div", {
2664
2664
  key: 1,
2665
2665
  textContent: toDisplayString(_ctx.finalContent)
2666
- }, null, 8, _hoisted_2$7))
2666
+ }, null, 8, _hoisted_2$8))
2667
2667
  ]),
2668
2668
  _: 2
2669
2669
  }, 1032, ["class", "popper-id", "theme", "shown", "mounted", "skip-transition", "auto-hide", "handle-resize", "classes", "result", "onHide", "onResize"])
@@ -2671,7 +2671,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
2671
2671
  _: 1
2672
2672
  }, 16, ["theme", "popper-node", "onApplyShow", "onApplyHide"]);
2673
2673
  }
2674
- var PrivateTooltipDirective = /* @__PURE__ */ _export_sfc(_sfc_main$c, [["render", _sfc_render]]);
2674
+ var PrivateTooltipDirective = /* @__PURE__ */ _export_sfc(_sfc_main$d, [["render", _sfc_render]]);
2675
2675
  const TARGET_CLASS = "v-popper--has-tooltip";
2676
2676
  function getPlacement(options2, modifiers) {
2677
2677
  let result = options2.placement;
@@ -2797,21 +2797,21 @@ var PrivateVTooltip = {
2797
2797
  };
2798
2798
  const VTooltip = PrivateVTooltip;
2799
2799
  const Dropdown = _sfc_main$3$1;
2800
- const _hoisted_1$8 = { class: "htw-p-2 hover:htw-bg-primary-100 dark:hover:htw-bg-primary-800 htw-flex htw-gap-2 htw-flex-wrap" };
2801
- const _hoisted_2$6 = { class: "htw-w-28 htw-whitespace-nowrap htw-text-ellipsis htw-overflow-hidden htw-shrink-0" };
2802
- const _hoisted_3$5 = { class: "htw-grow htw-flex htw-items-center htw-gap-1" };
2800
+ 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" };
2801
+ const _hoisted_2$7 = { class: "htw-w-28 htw-whitespace-nowrap htw-text-ellipsis htw-overflow-hidden htw-shrink-0" };
2802
+ const _hoisted_3$6 = { class: "htw-grow htw-flex htw-items-center htw-gap-1" };
2803
2803
  const _hoisted_4$4 = { class: "htw-block htw-grow" };
2804
- const __default__$b = {
2804
+ const __default__$c = {
2805
2805
  name: "HstWrapper"
2806
2806
  };
2807
- const _sfc_main$b = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$b), {
2807
+ const _sfc_main$c = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$c), {
2808
2808
  props: {
2809
2809
  title: null
2810
2810
  },
2811
2811
  setup(__props) {
2812
2812
  return (_ctx, _cache) => {
2813
- return openBlock(), createElementBlock("label", _hoisted_1$8, [
2814
- withDirectives((openBlock(), createElementBlock("span", _hoisted_2$6, [
2813
+ return openBlock(), createElementBlock("label", _hoisted_1$9, [
2814
+ withDirectives((openBlock(), createElementBlock("span", _hoisted_2$7, [
2815
2815
  createTextVNode(toDisplayString(__props.title), 1)
2816
2816
  ])), [
2817
2817
  [unref(VTooltip), {
@@ -2820,7 +2820,7 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues
2820
2820
  distance: 12
2821
2821
  }]
2822
2822
  ]),
2823
- createElementVNode("span", _hoisted_3$5, [
2823
+ createElementVNode("span", _hoisted_3$6, [
2824
2824
  createElementVNode("span", _hoisted_4$4, [
2825
2825
  renderSlot(_ctx.$slots, "default")
2826
2826
  ]),
@@ -2830,18 +2830,18 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues
2830
2830
  };
2831
2831
  }
2832
2832
  }));
2833
- const _hoisted_1$7 = { class: "htw-text-white htw-w-[16px] htw-h-[16px] htw-relative" };
2834
- const _hoisted_2$5 = {
2833
+ const _hoisted_1$8 = { class: "htw-text-white htw-w-[16px] htw-h-[16px] htw-relative" };
2834
+ const _hoisted_2$6 = {
2835
2835
  width: "16",
2836
2836
  height: "16",
2837
2837
  viewBox: "0 0 24 24",
2838
2838
  class: "htw-relative htw-z-10"
2839
2839
  };
2840
- const _hoisted_3$4 = ["stroke-dasharray", "stroke-dashoffset"];
2841
- const __default__$a = {
2840
+ const _hoisted_3$5 = ["stroke-dasharray", "stroke-dashoffset"];
2841
+ const __default__$b = {
2842
2842
  name: "HstCheckbox"
2843
2843
  };
2844
- const _sfc_main$a = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$a), {
2844
+ const _sfc_main$b = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$b), {
2845
2845
  props: {
2846
2846
  modelValue: { type: Boolean },
2847
2847
  title: null
@@ -2860,12 +2860,12 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues
2860
2860
  const progress = computed(() => props.modelValue ? 1 : 0);
2861
2861
  const dashoffset = computed(() => (1 - progress.value) * dasharray.value);
2862
2862
  const animationEnabled = ref(false);
2863
- watch(path, (value) => {
2863
+ watch(path, () => {
2864
2864
  var _a2, _b, _c;
2865
2865
  dasharray.value = (_c = (_b = (_a2 = path.value).getTotalLength) == null ? void 0 : _b.call(_a2)) != null ? _c : 21.21;
2866
2866
  });
2867
2867
  return (_ctx, _cache) => {
2868
- return openBlock(), createBlock(_sfc_main$b, {
2868
+ return openBlock(), createBlock(_sfc_main$c, {
2869
2869
  role: "checkbox",
2870
2870
  tabindex: "0",
2871
2871
  class: "htw-cursor-pointer htw-items-center",
@@ -2880,13 +2880,13 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues
2880
2880
  renderSlot(_ctx.$slots, "actions")
2881
2881
  ]),
2882
2882
  default: withCtx(() => [
2883
- createElementVNode("div", _hoisted_1$7, [
2883
+ createElementVNode("div", _hoisted_1$8, [
2884
2884
  createElementVNode("div", {
2885
2885
  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", [
2886
2886
  __props.modelValue ? "htw-border-primary-500 htw-border-8" : "htw-border-black/25 dark:htw-border-white/25 htw-delay-150"
2887
2887
  ]])
2888
2888
  }, null, 2),
2889
- (openBlock(), createElementBlock("svg", _hoisted_2$5, [
2889
+ (openBlock(), createElementBlock("svg", _hoisted_2$6, [
2890
2890
  createElementVNode("path", {
2891
2891
  ref_key: "path",
2892
2892
  ref: path,
@@ -2900,7 +2900,7 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues
2900
2900
  ]]),
2901
2901
  "stroke-dasharray": dasharray.value,
2902
2902
  "stroke-dashoffset": unref(dashoffset)
2903
- }, null, 10, _hoisted_3$4)
2903
+ }, null, 10, _hoisted_3$5)
2904
2904
  ]))
2905
2905
  ])
2906
2906
  ]),
@@ -2909,11 +2909,11 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues
2909
2909
  };
2910
2910
  }
2911
2911
  }));
2912
- const _hoisted_1$6 = ["value"];
2913
- const __default__$9 = {
2912
+ const _hoisted_1$7 = ["value"];
2913
+ const __default__$a = {
2914
2914
  name: "HstText"
2915
2915
  };
2916
- const _sfc_main$9 = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$9), {
2916
+ const _sfc_main$a = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$a), {
2917
2917
  props: {
2918
2918
  title: null,
2919
2919
  modelValue: null
@@ -2924,7 +2924,7 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues
2924
2924
  setup(__props, { emit }) {
2925
2925
  const input = ref();
2926
2926
  return (_ctx, _cache) => {
2927
- return openBlock(), createBlock(_sfc_main$b, {
2927
+ return openBlock(), createBlock(_sfc_main$c, {
2928
2928
  title: __props.title,
2929
2929
  class: normalizeClass(["htw-cursor-text htw-items-center", _ctx.$attrs.class]),
2930
2930
  style: normalizeStyle(_ctx.$attrs.style),
@@ -2942,18 +2942,18 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues
2942
2942
  value: __props.modelValue,
2943
2943
  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",
2944
2944
  onInput: _cache[0] || (_cache[0] = ($event) => emit("update:modelValue", $event.target.value))
2945
- }), null, 16, _hoisted_1$6)
2945
+ }), null, 16, _hoisted_1$7)
2946
2946
  ]),
2947
2947
  _: 3
2948
2948
  }, 8, ["title", "class", "style"]);
2949
2949
  };
2950
2950
  }
2951
2951
  }));
2952
- const __default__$8 = {
2952
+ const __default__$9 = {
2953
2953
  name: "HstNumber",
2954
2954
  inheritAttrs: false
2955
2955
  };
2956
- const _sfc_main$8 = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$8), {
2956
+ const _sfc_main$9 = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$9), {
2957
2957
  props: {
2958
2958
  title: null,
2959
2959
  modelValue: null
@@ -3000,7 +3000,7 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues
3000
3000
  stopDragging();
3001
3001
  });
3002
3002
  return (_ctx, _cache) => {
3003
- return openBlock(), createBlock(_sfc_main$b, {
3003
+ return openBlock(), createBlock(_sfc_main$c, {
3004
3004
  class: normalizeClass(["htw-cursor-ew-resize htw-items-center", [
3005
3005
  _ctx.$attrs.class,
3006
3006
  { "htw-select-none": isDragging.value }
@@ -3038,15 +3038,15 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues
3038
3038
  }
3039
3039
  }));
3040
3040
  var HstSlider_vue_vue_type_style_index_0_lang = "";
3041
- const _hoisted_1$5 = { class: "htw-relative htw-w-full htw-flex htw-items-center" };
3042
- const _hoisted_2$4 = /* @__PURE__ */ createElementVNode("div", { class: "htw-absolute htw-inset-0 htw-flex htw-items-center" }, [
3041
+ const _hoisted_1$6 = { class: "htw-relative htw-w-full htw-flex htw-items-center" };
3042
+ const _hoisted_2$5 = /* @__PURE__ */ createElementVNode("div", { class: "htw-absolute htw-inset-0 htw-flex htw-items-center" }, [
3043
3043
  /* @__PURE__ */ createElementVNode("div", { class: "htw-border htw-border-black/25 dark:htw-border-white/25 htw-h-1 htw-w-full htw-rounded-full" })
3044
3044
  ], -1);
3045
- const __default__$7 = {
3045
+ const __default__$8 = {
3046
3046
  name: "HstSlider",
3047
3047
  inheritAttrs: false
3048
3048
  };
3049
- const _sfc_main$7 = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$7), {
3049
+ const _sfc_main$8 = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$8), {
3050
3050
  props: {
3051
3051
  title: null,
3052
3052
  modelValue: null,
@@ -3080,14 +3080,14 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues
3080
3080
  return {};
3081
3081
  });
3082
3082
  return (_ctx, _cache) => {
3083
- return openBlock(), createBlock(_sfc_main$b, {
3083
+ return openBlock(), createBlock(_sfc_main$c, {
3084
3084
  class: normalizeClass(["htw-items-center", _ctx.$attrs.class]),
3085
3085
  title: __props.title,
3086
3086
  style: normalizeStyle(_ctx.$attrs.style)
3087
3087
  }, {
3088
3088
  default: withCtx(() => [
3089
- createElementVNode("div", _hoisted_1$5, [
3090
- _hoisted_2$4,
3089
+ createElementVNode("div", _hoisted_1$6, [
3090
+ _hoisted_2$5,
3091
3091
  withDirectives(createElementVNode("input", mergeProps({
3092
3092
  ref_key: "input",
3093
3093
  ref: input,
@@ -3119,12 +3119,12 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues
3119
3119
  };
3120
3120
  }
3121
3121
  }));
3122
- const _hoisted_1$4 = ["value"];
3123
- const __default__$6 = {
3122
+ const _hoisted_1$5 = ["value"];
3123
+ const __default__$7 = {
3124
3124
  name: "HstTextarea",
3125
3125
  inheritAttrs: false
3126
3126
  };
3127
- const _sfc_main$6 = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$6), {
3127
+ const _sfc_main$7 = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$7), {
3128
3128
  props: {
3129
3129
  title: null,
3130
3130
  modelValue: null
@@ -3135,7 +3135,7 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues
3135
3135
  setup(__props, { emit }) {
3136
3136
  const input = ref();
3137
3137
  return (_ctx, _cache) => {
3138
- return openBlock(), createBlock(_sfc_main$b, {
3138
+ return openBlock(), createBlock(_sfc_main$c, {
3139
3139
  title: __props.title,
3140
3140
  class: normalizeClass(["htw-cursor-text", _ctx.$attrs.class]),
3141
3141
  style: normalizeStyle(_ctx.$attrs.style),
@@ -3152,7 +3152,7 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues
3152
3152
  value: __props.modelValue,
3153
3153
  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]",
3154
3154
  onInput: _cache[0] || (_cache[0] = ($event) => emit("update:modelValue", $event.target.value))
3155
- }), null, 16, _hoisted_1$4)
3155
+ }), null, 16, _hoisted_1$5)
3156
3156
  ]),
3157
3157
  _: 3
3158
3158
  }, 8, ["title", "class", "style"]);
@@ -4978,14 +4978,14 @@ const Icon = defineComponent({
4978
4978
  }
4979
4979
  });
4980
4980
  var CustomSelect_vue_vue_type_style_index_0_lang = "";
4981
- const _hoisted_1$3 = { 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" };
4982
- const _hoisted_2$3 = { class: "htw-flex-1 htw-truncate" };
4983
- const _hoisted_3$3 = { class: "htw-flex htw-flex-col htw-bg-gray-50 dark:htw-bg-gray-700" };
4981
+ 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" };
4982
+ const _hoisted_2$4 = { class: "htw-flex-1 htw-truncate" };
4983
+ const _hoisted_3$4 = { class: "htw-flex htw-flex-col htw-bg-gray-50 dark:htw-bg-gray-700" };
4984
4984
  const _hoisted_4$3 = ["onClick"];
4985
- const __default__$5 = {
4985
+ const __default__$6 = {
4986
4986
  name: "CustomSelect"
4987
4987
  };
4988
- const _sfc_main$5 = defineComponent(__spreadProps(__spreadValues({}, __default__$5), {
4988
+ const _sfc_main$6 = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$6), {
4989
4989
  props: {
4990
4990
  modelValue: null,
4991
4991
  options: null
@@ -5013,7 +5013,7 @@ const _sfc_main$5 = defineComponent(__spreadProps(__spreadValues({}, __default__
5013
5013
  return (_ctx, _cache) => {
5014
5014
  return openBlock(), createBlock(unref(Dropdown), { "auto-size": "" }, {
5015
5015
  popper: withCtx(({ hide }) => [
5016
- createElementVNode("div", _hoisted_3$3, [
5016
+ createElementVNode("div", _hoisted_3$4, [
5017
5017
  (openBlock(true), createElementBlock(Fragment, null, renderList(unref(formattedOptions), (label, value) => {
5018
5018
  return openBlock(), createElementBlock("div", mergeProps(__spreadProps(__spreadValues({}, _ctx.$attrs), { class: null, style: null }), {
5019
5019
  key: label,
@@ -5026,8 +5026,8 @@ const _sfc_main$5 = defineComponent(__spreadProps(__spreadValues({}, __default__
5026
5026
  ])
5027
5027
  ]),
5028
5028
  default: withCtx(() => [
5029
- createElementVNode("div", _hoisted_1$3, [
5030
- createElementVNode("div", _hoisted_2$3, [
5029
+ createElementVNode("div", _hoisted_1$4, [
5030
+ createElementVNode("div", _hoisted_2$4, [
5031
5031
  renderSlot(_ctx.$slots, "default", { label: unref(selectedLabel) }, () => [
5032
5032
  createTextVNode(toDisplayString(unref(selectedLabel)), 1)
5033
5033
  ])
@@ -5043,10 +5043,10 @@ const _sfc_main$5 = defineComponent(__spreadProps(__spreadValues({}, __default__
5043
5043
  };
5044
5044
  }
5045
5045
  }));
5046
- const __default__$4 = {
5046
+ const __default__$5 = {
5047
5047
  name: "HstSelect"
5048
5048
  };
5049
- const _sfc_main$4 = defineComponent(__spreadProps(__spreadValues({}, __default__$4), {
5049
+ const _sfc_main$5 = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$5), {
5050
5050
  props: {
5051
5051
  title: null,
5052
5052
  modelValue: null,
@@ -5054,9 +5054,8 @@ const _sfc_main$4 = defineComponent(__spreadProps(__spreadValues({}, __default__
5054
5054
  },
5055
5055
  emits: ["update:modelValue"],
5056
5056
  setup(__props, { emit: emits }) {
5057
- ref();
5058
5057
  return (_ctx, _cache) => {
5059
- return openBlock(), createBlock(_sfc_main$b, {
5058
+ return openBlock(), createBlock(_sfc_main$c, {
5060
5059
  title: __props.title,
5061
5060
  class: normalizeClass(["htw-cursor-text htw-items-center", _ctx.$attrs.class]),
5062
5061
  style: normalizeStyle(_ctx.$attrs.style)
@@ -5065,7 +5064,7 @@ const _sfc_main$4 = defineComponent(__spreadProps(__spreadValues({}, __default__
5065
5064
  renderSlot(_ctx.$slots, "actions")
5066
5065
  ]),
5067
5066
  default: withCtx(() => [
5068
- createVNode(_sfc_main$5, {
5067
+ createVNode(_sfc_main$6, {
5069
5068
  options: __props.options,
5070
5069
  "model-value": __props.modelValue,
5071
5070
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => emits("update:modelValue", $event))
@@ -5214,10 +5213,10 @@ var SwipeDirection;
5214
5213
  SwipeDirection2["LEFT"] = "LEFT";
5215
5214
  SwipeDirection2["NONE"] = "NONE";
5216
5215
  })(SwipeDirection || (SwipeDirection = {}));
5217
- const __default__$3 = {
5216
+ const __default__$4 = {
5218
5217
  name: "HstCopyIcon"
5219
5218
  };
5220
- const _sfc_main$3 = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$3), {
5219
+ const _sfc_main$4 = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$4), {
5221
5220
  props: {
5222
5221
  content: null
5223
5222
  },
@@ -5242,19 +5241,19 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues
5242
5241
  };
5243
5242
  }
5244
5243
  }));
5245
- const _hoisted_1$2 = {
5244
+ const _hoisted_1$3 = {
5246
5245
  key: 0,
5247
5246
  class: "htw-grid htw-gap-4 htw-grid-cols-[repeat(auto-fill,minmax(200px,1fr))] htw-m-4"
5248
5247
  };
5249
- const _hoisted_2$2 = ["onMouseenter"];
5250
- const _hoisted_3$2 = { class: "htw-flex htw-gap-1" };
5248
+ const _hoisted_2$3 = ["onMouseenter"];
5249
+ const _hoisted_3$3 = { class: "htw-flex htw-gap-1" };
5251
5250
  const _hoisted_4$2 = { class: "htw-my-0 htw-truncate htw-shrink" };
5252
5251
  const _hoisted_5$2 = { class: "htw-flex htw-gap-1" };
5253
5252
  const _hoisted_6$1 = { class: "htw-my-0 htw-opacity-50 htw-truncate htw-shrink" };
5254
- const __default__$2 = {
5253
+ const __default__$3 = {
5255
5254
  name: "HstColorShades"
5256
5255
  };
5257
- const _sfc_main$2 = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$2), {
5256
+ const _sfc_main$3 = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$3), {
5258
5257
  props: {
5259
5258
  shades: null,
5260
5259
  getName: null,
@@ -5284,7 +5283,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues
5284
5283
  });
5285
5284
  const hover = ref(null);
5286
5285
  return (_ctx, _cache) => {
5287
- return unref(displayedShades).length ? (openBlock(), createElementBlock("div", _hoisted_1$2, [
5286
+ return unref(displayedShades).length ? (openBlock(), createElementBlock("div", _hoisted_1$3, [
5288
5287
  (openBlock(true), createElementBlock(Fragment, null, renderList(unref(displayedShades), (shade) => {
5289
5288
  return openBlock(), createElementBlock("div", {
5290
5289
  key: shade.key,
@@ -5303,13 +5302,13 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues
5303
5302
  }, null, 4)
5304
5303
  ]),
5305
5304
  createElementVNode("div", null, [
5306
- createElementVNode("div", _hoisted_3$2, [
5305
+ createElementVNode("div", _hoisted_3$3, [
5307
5306
  withDirectives((openBlock(), createElementBlock("pre", _hoisted_4$2, [
5308
5307
  createTextVNode(toDisplayString(shade.name), 1)
5309
5308
  ])), [
5310
5309
  [unref(VTooltip), shade.name.length > 23 ? shade.name : ""]
5311
5310
  ]),
5312
- hover.value === shade.key ? (openBlock(), createBlock(_sfc_main$3, {
5311
+ hover.value === shade.key ? (openBlock(), createBlock(_sfc_main$4, {
5313
5312
  key: 0,
5314
5313
  content: shade.name,
5315
5314
  class: "htw-flex-none"
@@ -5321,29 +5320,29 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues
5321
5320
  ])), [
5322
5321
  [unref(VTooltip), shade.color.length > 23 ? shade.color : ""]
5323
5322
  ]),
5324
- hover.value === shade.key ? (openBlock(), createBlock(_sfc_main$3, {
5323
+ hover.value === shade.key ? (openBlock(), createBlock(_sfc_main$4, {
5325
5324
  key: 0,
5326
5325
  content: shade.color,
5327
5326
  class: "htw-flex-none"
5328
5327
  }, null, 8, ["content"])) : createCommentVNode("", true)
5329
5328
  ])
5330
5329
  ])
5331
- ], 40, _hoisted_2$2);
5330
+ ], 40, _hoisted_2$3);
5332
5331
  }), 128))
5333
5332
  ])) : createCommentVNode("", true);
5334
5333
  };
5335
5334
  }
5336
5335
  }));
5337
- const _hoisted_1$1 = ["onMouseenter"];
5338
- const _hoisted_2$1 = { class: "htw-mx-4" };
5339
- const _hoisted_3$1 = { class: "htw-flex htw-gap-1" };
5336
+ const _hoisted_1$2 = ["onMouseenter"];
5337
+ const _hoisted_2$2 = { class: "htw-mx-4" };
5338
+ const _hoisted_3$2 = { class: "htw-flex htw-gap-1" };
5340
5339
  const _hoisted_4$1 = { class: "htw-my-0 htw-truncate htw-shrink" };
5341
5340
  const _hoisted_5$1 = { class: "htw-flex htw-gap-1" };
5342
5341
  const _hoisted_6 = { class: "htw-my-0 htw-opacity-50 htw-truncate htw-shrink" };
5343
- const __default__$1 = {
5342
+ const __default__$2 = {
5344
5343
  name: "HstTokenList"
5345
5344
  };
5346
- const _sfc_main$1 = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$1), {
5345
+ const _sfc_main$2 = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$2), {
5347
5346
  props: {
5348
5347
  tokens: null,
5349
5348
  getName: null
@@ -5372,10 +5371,10 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues
5372
5371
  onMouseleave: _cache[0] || (_cache[0] = ($event) => hover.value = null)
5373
5372
  }, [
5374
5373
  renderSlot(_ctx.$slots, "default", { token }),
5375
- createElementVNode("div", _hoisted_2$1, [
5376
- createElementVNode("div", _hoisted_3$1, [
5374
+ createElementVNode("div", _hoisted_2$2, [
5375
+ createElementVNode("div", _hoisted_3$2, [
5377
5376
  createElementVNode("pre", _hoisted_4$1, toDisplayString(token.name), 1),
5378
- hover.value === token.key ? (openBlock(), createBlock(_sfc_main$3, {
5377
+ hover.value === token.key ? (openBlock(), createBlock(_sfc_main$4, {
5379
5378
  key: 0,
5380
5379
  content: token.name,
5381
5380
  class: "htw-flex-none"
@@ -5383,28 +5382,28 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues
5383
5382
  ]),
5384
5383
  createElementVNode("div", _hoisted_5$1, [
5385
5384
  createElementVNode("pre", _hoisted_6, toDisplayString(token.value), 1),
5386
- hover.value === token.key ? (openBlock(), createBlock(_sfc_main$3, {
5385
+ hover.value === token.key ? (openBlock(), createBlock(_sfc_main$4, {
5387
5386
  key: 0,
5388
5387
  content: typeof token.value === "string" ? token.value : JSON.stringify(token.value),
5389
5388
  class: "htw-flex-none"
5390
5389
  }, null, 8, ["content"])) : createCommentVNode("", true)
5391
5390
  ])
5392
5391
  ])
5393
- ], 40, _hoisted_1$1);
5392
+ ], 40, _hoisted_1$2);
5394
5393
  }), 128);
5395
5394
  };
5396
5395
  }
5397
5396
  }));
5398
5397
  var HstTokenGrid_vue_vue_type_style_index_0_lang = "";
5399
- const _hoisted_1 = ["onMouseenter"];
5400
- const _hoisted_2 = { class: "htw-flex htw-gap-1" };
5401
- const _hoisted_3 = { class: "htw-my-0 htw-truncate htw-shrink" };
5398
+ const _hoisted_1$1 = ["onMouseenter"];
5399
+ const _hoisted_2$1 = { class: "htw-flex htw-gap-1" };
5400
+ const _hoisted_3$1 = { class: "htw-my-0 htw-truncate htw-shrink" };
5402
5401
  const _hoisted_4 = { class: "htw-flex htw-gap-1" };
5403
5402
  const _hoisted_5 = { class: "htw-my-0 htw-opacity-50 htw-truncate htw-shrink" };
5404
- const __default__ = {
5403
+ const __default__$1 = {
5405
5404
  name: "HstTokenGrid"
5406
5405
  };
5407
- const _sfc_main = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__), {
5406
+ const _sfc_main$1 = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$1), {
5408
5407
  props: {
5409
5408
  tokens: null,
5410
5409
  colSize: { default: 180 },
@@ -5442,13 +5441,13 @@ const _sfc_main = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({
5442
5441
  }, [
5443
5442
  renderSlot(_ctx.$slots, "default", { token }),
5444
5443
  createElementVNode("div", null, [
5445
- createElementVNode("div", _hoisted_2, [
5446
- withDirectives((openBlock(), createElementBlock("pre", _hoisted_3, [
5444
+ createElementVNode("div", _hoisted_2$1, [
5445
+ withDirectives((openBlock(), createElementBlock("pre", _hoisted_3$1, [
5447
5446
  createTextVNode(toDisplayString(token.name), 1)
5448
5447
  ])), [
5449
5448
  [unref(VTooltip), token.name.length > __props.colSize / 8 ? token.name : ""]
5450
5449
  ]),
5451
- hover.value === token.key ? (openBlock(), createBlock(_sfc_main$3, {
5450
+ hover.value === token.key ? (openBlock(), createBlock(_sfc_main$4, {
5452
5451
  key: 0,
5453
5452
  content: token.name,
5454
5453
  class: "htw-flex-none"
@@ -5460,37 +5459,134 @@ const _sfc_main = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({
5460
5459
  ])), [
5461
5460
  [unref(VTooltip), token.value.length > __props.colSize / 8 ? token.value : ""]
5462
5461
  ]),
5463
- hover.value === token.key ? (openBlock(), createBlock(_sfc_main$3, {
5462
+ hover.value === token.key ? (openBlock(), createBlock(_sfc_main$4, {
5464
5463
  key: 0,
5465
5464
  content: typeof token.value === "string" ? token.value : JSON.stringify(token.value),
5466
5465
  class: "htw-flex-none"
5467
5466
  }, null, 8, ["content"])) : createCommentVNode("", true)
5468
5467
  ])
5469
5468
  ])
5470
- ], 40, _hoisted_1);
5469
+ ], 40, _hoisted_1$1);
5471
5470
  }), 128))
5472
5471
  ], 4);
5473
5472
  };
5474
5473
  }
5475
5474
  }));
5476
- const HstCheckbox = _sfc_main$a;
5477
- const HstText = _sfc_main$9;
5478
- const HstNumber = _sfc_main$8;
5479
- const HstSlider = _sfc_main$7;
5480
- const HstTextarea = _sfc_main$6;
5481
- const HstColorShades = _sfc_main$2;
5482
- const HstTokenList = _sfc_main$1;
5483
- const HstTokenGrid = _sfc_main;
5484
- const HstCopyIcon = _sfc_main$3;
5475
+ const _hoisted_1 = { class: "-htw-my-1" };
5476
+ const _hoisted_2 = ["id", "name", "value", "checked", "onChange"];
5477
+ const _hoisted_3 = ["for", "onKeydown"];
5478
+ const __default__ = {
5479
+ name: "HstRadio"
5480
+ };
5481
+ const _sfc_main = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__), {
5482
+ props: {
5483
+ title: null,
5484
+ modelValue: null,
5485
+ options: null
5486
+ },
5487
+ emits: ["update:modelValue"],
5488
+ setup(__props, { emit }) {
5489
+ const props = __props;
5490
+ const formattedOptions = computed(() => {
5491
+ if (Array.isArray(props.options)) {
5492
+ return Object.fromEntries(props.options.map((value) => {
5493
+ if (typeof value === "string") {
5494
+ return [value, value];
5495
+ } else {
5496
+ return [value.value, value.label];
5497
+ }
5498
+ }));
5499
+ }
5500
+ return props.options;
5501
+ });
5502
+ ref();
5503
+ function selectOption(value) {
5504
+ emit("update:modelValue", value);
5505
+ animationEnabled.value = true;
5506
+ }
5507
+ const animationEnabled = ref(false);
5508
+ return (_ctx, _cache) => {
5509
+ return openBlock(), createBlock(_sfc_main$c, {
5510
+ role: "group",
5511
+ title: __props.title,
5512
+ class: normalizeClass(["htw-cursor-text", _ctx.$attrs.class]),
5513
+ style: normalizeStyle(_ctx.$attrs.style)
5514
+ }, {
5515
+ actions: withCtx(() => [
5516
+ renderSlot(_ctx.$slots, "actions")
5517
+ ]),
5518
+ default: withCtx(() => [
5519
+ createElementVNode("div", _hoisted_1, [
5520
+ (openBlock(true), createElementBlock(Fragment, null, renderList(unref(formattedOptions), (label, value) => {
5521
+ return openBlock(), createElementBlock(Fragment, { key: value }, [
5522
+ createElementVNode("input", {
5523
+ id: `${value}-radio`,
5524
+ type: "radio",
5525
+ name: `${value}-radio`,
5526
+ value,
5527
+ checked: value === __props.modelValue,
5528
+ class: "htw-hidden",
5529
+ onChange: ($event) => selectOption(value)
5530
+ }, null, 40, _hoisted_2),
5531
+ createElementVNode("label", {
5532
+ tabindex: "0",
5533
+ for: `${value}-radio`,
5534
+ class: "htw-cursor-pointer htw-flex htw-items-center htw-relative htw-py-1 htw-group",
5535
+ onKeydown: [
5536
+ withKeys(withModifiers(($event) => selectOption(value), ["prevent"]), ["enter"]),
5537
+ withKeys(withModifiers(($event) => selectOption(value), ["prevent"]), ["space"])
5538
+ ]
5539
+ }, [
5540
+ (openBlock(), createElementBlock("svg", {
5541
+ width: "16",
5542
+ height: "16",
5543
+ viewBox: "-12 -12 24 24",
5544
+ 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", [
5545
+ __props.modelValue === value ? "htw-border-primary-500" : "htw-border-black/25 dark:htw-border-white/25"
5546
+ ]])
5547
+ }, [
5548
+ createElementVNode("circle", {
5549
+ r: "7",
5550
+ class: normalizeClass(["htw-will-change-transform", [
5551
+ animationEnabled.value ? "htw-transition-all" : "htw-transition-none",
5552
+ {
5553
+ "htw-delay-150": __props.modelValue === value
5554
+ },
5555
+ __props.modelValue === value ? "htw-fill-primary-500" : "htw-fill-transparent htw-scale-0"
5556
+ ]])
5557
+ }, null, 2)
5558
+ ], 2)),
5559
+ createTextVNode(" " + toDisplayString(label), 1)
5560
+ ], 40, _hoisted_3)
5561
+ ], 64);
5562
+ }), 128))
5563
+ ])
5564
+ ]),
5565
+ _: 3
5566
+ }, 8, ["title", "class", "style"]);
5567
+ };
5568
+ }
5569
+ }));
5570
+ const HstCheckbox = _sfc_main$b;
5571
+ const HstText = _sfc_main$a;
5572
+ const HstNumber = _sfc_main$9;
5573
+ const HstSlider = _sfc_main$8;
5574
+ const HstTextarea = _sfc_main$7;
5575
+ const HstColorShades = _sfc_main$3;
5576
+ const HstTokenList = _sfc_main$2;
5577
+ const HstTokenGrid = _sfc_main$1;
5578
+ const HstCopyIcon = _sfc_main$4;
5579
+ const HstRadio = _sfc_main;
5485
5580
  function registerVueComponents(app) {
5486
- app.component("HstCheckbox", _sfc_main$a);
5487
- app.component("HstText", _sfc_main$9);
5488
- app.component("HstNumber", _sfc_main$8);
5489
- app.component("HstSlider", _sfc_main$7);
5490
- app.component("HstSelect", _sfc_main$4);
5491
- app.component("HstTextarea", _sfc_main$6);
5492
- app.component("HstColorShades", _sfc_main$2);
5493
- app.component("HstTokenList", _sfc_main$1);
5494
- app.component("HstTokenGrid", _sfc_main);
5495
- }
5496
- export { HstCheckbox, HstColorShades, HstCopyIcon, HstNumber, HstSlider, HstText, HstTextarea, HstTokenGrid, HstTokenList, registerVueComponents };
5581
+ app.component("HstCheckbox", _sfc_main$b);
5582
+ app.component("HstText", _sfc_main$a);
5583
+ app.component("HstNumber", _sfc_main$9);
5584
+ app.component("HstSlider", _sfc_main$8);
5585
+ app.component("HstSelect", _sfc_main$5);
5586
+ app.component("HstTextarea", _sfc_main$7);
5587
+ app.component("HstColorShades", _sfc_main$3);
5588
+ app.component("HstTokenList", _sfc_main$2);
5589
+ app.component("HstTokenGrid", _sfc_main$1);
5590
+ app.component("HstRadio", _sfc_main);
5591
+ }
5592
+ export { HstCheckbox, HstColorShades, HstCopyIcon, HstNumber, HstRadio, HstSlider, HstText, HstTextarea, HstTokenGrid, HstTokenList, registerVueComponents };
@@ -299,6 +299,10 @@
299
299
  margin-bottom:0.5rem
300
300
  }
301
301
 
302
+ .htw-mr-2{
303
+ margin-right:0.5rem
304
+ }
305
+
302
306
  .htw-ml-auto{
303
307
  margin-left:auto
304
308
  }
@@ -319,6 +323,10 @@
319
323
  display:grid
320
324
  }
321
325
 
326
+ .htw-hidden{
327
+ display:none
328
+ }
329
+
322
330
  .htw-h-4{
323
331
  height:1rem
324
332
  }
@@ -407,6 +415,12 @@
407
415
  flex-grow:1
408
416
  }
409
417
 
418
+ .htw-scale-0{
419
+ --tw-scale-x:0;
420
+ --tw-scale-y:0;
421
+ transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))
422
+ }
423
+
410
424
  .htw-cursor-pointer{
411
425
  cursor:pointer
412
426
  }
@@ -569,6 +583,14 @@
569
583
  background-color:rgb(16 185 129 / var(--tw-bg-opacity)) !important
570
584
  }
571
585
 
586
+ .htw-fill-primary-500{
587
+ fill:#10b981
588
+ }
589
+
590
+ .htw-fill-transparent{
591
+ fill:transparent
592
+ }
593
+
572
594
  .htw-stroke-white{
573
595
  stroke:#fff
574
596
  }
@@ -672,6 +694,10 @@
672
694
  transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1)
673
695
  }
674
696
 
697
+ .htw-will-change-transform{
698
+ will-change:transform
699
+ }
700
+
675
701
  body {
676
702
  font-size: 1.125rem;
677
703
  }
@@ -711,6 +737,11 @@ body {
711
737
  border-color:rgb(16 185 129 / var(--tw-border-opacity))
712
738
  }
713
739
 
740
+ .htw-group:hover .group-hover\:htw-border-primary-500{
741
+ --tw-border-opacity:1;
742
+ border-color:rgb(16 185 129 / var(--tw-border-opacity))
743
+ }
744
+
714
745
  .htw-group:active .group-active\:htw-bg-gray-500\/20{
715
746
  background-color:rgb(113 113 122 / 0.2)
716
747
  }
@@ -0,0 +1,4 @@
1
+ export interface HstControlOption {
2
+ label: string;
3
+ value: string;
4
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@histoire/controls",
3
- "version": "0.7.6",
3
+ "version": "0.7.9",
4
4
  "description": "Prebuilt controls components",
5
5
  "license": "MIT",
6
6
  "author": {
@@ -44,7 +44,7 @@
44
44
  "autoprefixer": "^10.4.4",
45
45
  "concurrently": "^7.1.0",
46
46
  "floating-vue": "^2.0.0-beta.16",
47
- "histoire": "0.7.6",
47
+ "histoire": "0.7.9",
48
48
  "postcss": "^8.4.12",
49
49
  "postcss-import": "^14.1.0",
50
50
  "tailwindcss": "^3.0.23",
@@ -28,9 +28,11 @@ const path = ref<SVGPathElement>()
28
28
  const dasharray = ref(0)
29
29
  const progress = computed(() => props.modelValue ? 1 : 0)
30
30
  const dashoffset = computed(() => (1 - progress.value) * dasharray.value)
31
+
32
+ // animationEnabled prevents the animation from triggering on mounted
31
33
  const animationEnabled = ref(false)
32
34
 
33
- watch(path, value => {
35
+ watch(path, () => {
34
36
  dasharray.value = path.value.getTotalLength?.() ?? 21.21
35
37
  })
36
38
  </script>
@@ -0,0 +1,47 @@
1
+ <script lang="ts" setup>
2
+ import HstRadio from './HstRadio.vue'
3
+
4
+ const options = {
5
+ 'crash-bandicoot': 'Crash Bandicoot',
6
+ 'the-last-of-us': 'The Last of Us',
7
+ 'ghost-of-tsushima': 'Ghost of Tsushima',
8
+ }
9
+
10
+ const flatOptions = Object.keys(options)
11
+
12
+ const objectOptions = Object.keys(options).map(key => ({
13
+ label: options[key],
14
+ value: key,
15
+ }))
16
+
17
+ function initState () {
18
+ return {
19
+ character: flatOptions[0],
20
+ }
21
+ }
22
+ </script>
23
+
24
+ <template>
25
+ <Story title="HstRadio">
26
+ <Variant
27
+ title="playground"
28
+ :init-state="initState"
29
+ >
30
+ <template #default="{ state }">
31
+ <HstRadio
32
+ v-model="state.character"
33
+ title="Label"
34
+ :options="objectOptions"
35
+ />
36
+ </template>
37
+
38
+ <template #controls="{ state }">
39
+ <HstRadio
40
+ v-model="state.character"
41
+ title="Label"
42
+ :options="objectOptions"
43
+ />
44
+ </template>
45
+ </Variant>
46
+ </Story>
47
+ </template>
@@ -0,0 +1,109 @@
1
+ <script lang="ts">
2
+ export default {
3
+ name: 'HstRadio',
4
+ }
5
+ </script>
6
+
7
+ <script lang="ts" setup>
8
+ import { computed, ComputedRef, ref } from 'vue'
9
+ import HstWrapper from '../HstWrapper.vue'
10
+ import { HstControlOption } from '../../types'
11
+
12
+ const props = defineProps<{
13
+ title?: string
14
+ modelValue: string
15
+ options: HstControlOption[]
16
+ }>()
17
+
18
+ const formattedOptions: ComputedRef<Record<string, string>> = computed(() => {
19
+ if (Array.isArray(props.options)) {
20
+ return Object.fromEntries(props.options.map((value: string | HstControlOption) => {
21
+ if (typeof value === 'string') {
22
+ return [value, value]
23
+ } else {
24
+ return [value.value, value.label]
25
+ }
26
+ }))
27
+ }
28
+ return props.options
29
+ })
30
+
31
+ const emit = defineEmits<{
32
+ (e: 'update:modelValue', value: string): void
33
+ }>()
34
+
35
+ const input = ref<HTMLInputElement>()
36
+
37
+ function selectOption (value: string) {
38
+ emit('update:modelValue', value)
39
+ animationEnabled.value = true
40
+ }
41
+
42
+ // animationEnabled prevents the animation from triggering on mounted
43
+ const animationEnabled = ref(false)
44
+ </script>
45
+
46
+ <template>
47
+ <HstWrapper
48
+ role="group"
49
+ :title="title"
50
+ class="htw-cursor-text"
51
+ :class="$attrs.class"
52
+ :style="$attrs.style"
53
+ >
54
+ <div class="-htw-my-1">
55
+ <template
56
+ v-for="( label, value ) in formattedOptions"
57
+ :key="value"
58
+ >
59
+ <input
60
+ :id="`${value}-radio`"
61
+ type="radio"
62
+ :name="`${value}-radio`"
63
+ :value="value"
64
+ :checked="value === modelValue"
65
+ class="htw-hidden"
66
+ @change="selectOption(value)"
67
+ >
68
+ <label
69
+ tabindex="0"
70
+ :for="`${value}-radio`"
71
+ class="htw-cursor-pointer htw-flex htw-items-center htw-relative htw-py-1 htw-group"
72
+ @keydown.enter.prevent="selectOption(value)"
73
+ @keydown.space.prevent="selectOption(value)"
74
+ >
75
+ <svg
76
+ width="16"
77
+ height="16"
78
+ viewBox="-12 -12 24 24"
79
+ class="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"
80
+ :class="[
81
+ modelValue === value
82
+ ? 'htw-border-primary-500'
83
+ : 'htw-border-black/25 dark:htw-border-white/25',
84
+ ]"
85
+ >
86
+ <circle
87
+ r="7"
88
+ class="htw-will-change-transform"
89
+ :class="[
90
+ animationEnabled ? 'htw-transition-all' : 'htw-transition-none',
91
+ {
92
+ 'htw-delay-150': modelValue === value,
93
+ },
94
+ modelValue === value
95
+ ? 'htw-fill-primary-500'
96
+ : 'htw-fill-transparent htw-scale-0',
97
+ ]"
98
+ />
99
+ </svg>
100
+ {{ label }}
101
+ </label>
102
+ </template>
103
+ </div>
104
+
105
+ <template #actions>
106
+ <slot name="actions" />
107
+ </template>
108
+ </HstWrapper>
109
+ </template>
@@ -8,15 +8,11 @@ export default {
8
8
  import { Dropdown as VDropdown } from 'floating-vue'
9
9
  import { computed, ComputedRef } from 'vue'
10
10
  import { Icon } from '@iconify/vue'
11
-
12
- export interface SelectOption {
13
- label: string
14
- value: string
15
- }
11
+ import { HstControlOption } from '../../types'
16
12
 
17
13
  const props = defineProps<{
18
14
  modelValue: string
19
- options: Record<string, string> | string[] | SelectOption[]
15
+ options: Record<string, string> | string[] | HstControlOption[]
20
16
  }>()
21
17
 
22
18
  const emits = defineEmits<{
@@ -25,7 +21,7 @@ const emits = defineEmits<{
25
21
 
26
22
  const formattedOptions: ComputedRef<Record<string, string>> = computed(() => {
27
23
  if (Array.isArray(props.options)) {
28
- return Object.fromEntries(props.options.map((value: string | SelectOption) => {
24
+ return Object.fromEntries(props.options.map((value: string | HstControlOption) => {
29
25
  if (typeof value === 'string') {
30
26
  return [value, value]
31
27
  } else {
@@ -2,26 +2,22 @@
2
2
  export default {
3
3
  name: 'HstSelect',
4
4
  }
5
-
6
- export type { SelectOption as HstSelectOption } from './CustomSelect.vue'
7
5
  </script>
8
6
 
9
7
  <script lang="ts" setup>
10
- import { ref } from 'vue'
11
8
  import HstWrapper from '../HstWrapper.vue'
12
- import CustomSelect, { SelectOption } from './CustomSelect.vue'
9
+ import CustomSelect from './CustomSelect.vue'
10
+ import { HstControlOption } from '../../types'
13
11
 
14
- const props = defineProps<{
12
+ defineProps<{
15
13
  title?: string
16
14
  modelValue: string
17
- options: Record<string, string> | string[] | SelectOption[]
15
+ options: Record<string, string> | string[] | HstControlOption[]
18
16
  }>()
19
17
 
20
18
  const emits = defineEmits<{
21
19
  (e: 'update:modelValue', value: string): void
22
20
  }>()
23
-
24
- const select = ref<HTMLInputElement>()
25
21
  </script>
26
22
 
27
23
  <template>
package/src/index.ts CHANGED
@@ -9,6 +9,7 @@ import HstColorShadesVue from './components/design-tokens/HstColorShades.vue'
9
9
  import HstTokenListVue from './components/design-tokens/HstTokenList.vue'
10
10
  import HstTokenGridVue from './components/design-tokens/HstTokenGrid.vue'
11
11
  import HstCopyIconVue from './components/HstCopyIcon.vue'
12
+ import HstRadioVue from './components/radio/HstRadio.vue'
12
13
 
13
14
  export const HstCheckbox = HstCheckboxVue
14
15
  export const HstText = HstTextVue
@@ -19,6 +20,7 @@ export const HstColorShades = HstColorShadesVue
19
20
  export const HstTokenList = HstTokenListVue
20
21
  export const HstTokenGrid = HstTokenGridVue
21
22
  export const HstCopyIcon = HstCopyIconVue
23
+ export const HstRadio = HstRadioVue
22
24
 
23
25
  export function registerVueComponents (app: App) {
24
26
  app.component('HstCheckbox', HstCheckboxVue)
@@ -30,4 +32,5 @@ export function registerVueComponents (app: App) {
30
32
  app.component('HstColorShades', HstColorShadesVue)
31
33
  app.component('HstTokenList', HstTokenListVue)
32
34
  app.component('HstTokenGrid', HstTokenGridVue)
35
+ app.component('HstRadio', HstRadioVue)
33
36
  }
package/src/types.ts ADDED
@@ -0,0 +1,4 @@
1
+ export interface HstControlOption {
2
+ label: string
3
+ value: string
4
+ }