@histoire/controls 0.7.0 → 0.7.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -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,25 @@
1
+ declare const _default: import("vue").DefineComponent<__VLS_TypePropsToRuntimeProps<{
2
+ title?: string;
3
+ modelValue: number;
4
+ min: number;
5
+ max: number;
6
+ }>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
7
+ 'update:modelValue': (newValue: number) => true;
8
+ }, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
9
+ title?: string;
10
+ modelValue: number;
11
+ min: number;
12
+ max: number;
13
+ }>>> & {
14
+ "onUpdate:modelValue"?: (newValue: number) => any;
15
+ }, {}>;
16
+ export default _default;
17
+ declare type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
18
+ declare type __VLS_TypePropsToRuntimeProps<T> = {
19
+ [K in keyof T]-?: {} extends Pick<T, K> ? {
20
+ type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
21
+ } : {
22
+ type: import('vue').PropType<T[K]>;
23
+ required: true;
24
+ };
25
+ };
package/dist/index.d.ts CHANGED
@@ -62,6 +62,43 @@ export declare const HstNumber: import("vue").DefineComponent<{
62
62
  }>> & {
63
63
  "onUpdate:modelValue"?: (newValue: number) => any;
64
64
  }, {}>;
65
+ export declare const HstSlider: import("vue").DefineComponent<{
66
+ title: {
67
+ type: import("vue").PropType<string>;
68
+ };
69
+ modelValue: {
70
+ type: import("vue").PropType<number>;
71
+ required: true;
72
+ };
73
+ min: {
74
+ type: import("vue").PropType<number>;
75
+ required: true;
76
+ };
77
+ max: {
78
+ type: import("vue").PropType<number>;
79
+ required: true;
80
+ };
81
+ }, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
82
+ 'update:modelValue': (newValue: number) => true;
83
+ }, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
84
+ title: {
85
+ type: import("vue").PropType<string>;
86
+ };
87
+ modelValue: {
88
+ type: import("vue").PropType<number>;
89
+ required: true;
90
+ };
91
+ min: {
92
+ type: import("vue").PropType<number>;
93
+ required: true;
94
+ };
95
+ max: {
96
+ type: import("vue").PropType<number>;
97
+ required: true;
98
+ };
99
+ }>> & {
100
+ "onUpdate:modelValue"?: (newValue: number) => any;
101
+ }, {}>;
65
102
  export declare const HstTextarea: import("vue").DefineComponent<{
66
103
  title: {
67
104
  type: import("vue").PropType<string>;
package/dist/index.es.js CHANGED
@@ -2525,7 +2525,7 @@ defineComponent(__spreadProps2(__spreadValues2({}, PrivatePopperWrapper), {
2525
2525
  name: "VTooltip",
2526
2526
  vPopperTheme: "tooltip"
2527
2527
  }));
2528
- const _sfc_main$b = defineComponent({
2528
+ const _sfc_main$c = defineComponent({
2529
2529
  name: "VTooltipDirective",
2530
2530
  components: {
2531
2531
  Popper: PrivatePopper(),
@@ -2616,8 +2616,8 @@ const _sfc_main$b = defineComponent({
2616
2616
  }
2617
2617
  }
2618
2618
  });
2619
- const _hoisted_1$8 = ["innerHTML"];
2620
- const _hoisted_2$6 = ["textContent"];
2619
+ const _hoisted_1$9 = ["innerHTML"];
2620
+ const _hoisted_2$7 = ["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$8)) : (openBlock(), createElementBlock("div", {
2663
+ }, null, 8, _hoisted_1$9)) : (openBlock(), createElementBlock("div", {
2664
2664
  key: 1,
2665
2665
  textContent: toDisplayString(_ctx.finalContent)
2666
- }, null, 8, _hoisted_2$6))
2666
+ }, null, 8, _hoisted_2$7))
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$b, [["render", _sfc_render]]);
2674
+ var PrivateTooltipDirective = /* @__PURE__ */ _export_sfc(_sfc_main$c, [["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$7 = { 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$5 = { class: "htw-w-28 htw-whitespace-nowrap htw-text-ellipsis htw-overflow-hidden htw-shrink-0" };
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
2802
  const _hoisted_3$5 = { 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__$a = {
2804
+ const __default__$b = {
2805
2805
  name: "HstWrapper"
2806
2806
  };
2807
- const _sfc_main$a = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$a), {
2807
+ const _sfc_main$b = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$b), {
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$7, [
2814
- withDirectives((openBlock(), createElementBlock("span", _hoisted_2$5, [
2813
+ return openBlock(), createElementBlock("label", _hoisted_1$8, [
2814
+ withDirectives((openBlock(), createElementBlock("span", _hoisted_2$6, [
2815
2815
  createTextVNode(toDisplayString(__props.title), 1)
2816
2816
  ])), [
2817
2817
  [unref(VTooltip), {
@@ -2830,18 +2830,18 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues
2830
2830
  };
2831
2831
  }
2832
2832
  }));
2833
- const _hoisted_1$6 = { class: "htw-text-white htw-w-[16px] htw-h-[16px] htw-relative" };
2834
- const _hoisted_2$4 = {
2833
+ const _hoisted_1$7 = { class: "htw-text-white htw-w-[16px] htw-h-[16px] htw-relative" };
2834
+ const _hoisted_2$5 = {
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
2840
  const _hoisted_3$4 = ["stroke-dasharray", "stroke-dashoffset"];
2841
- const __default__$9 = {
2841
+ const __default__$a = {
2842
2842
  name: "HstCheckbox"
2843
2843
  };
2844
- const _sfc_main$9 = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$9), {
2844
+ const _sfc_main$a = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$a), {
2845
2845
  props: {
2846
2846
  modelValue: { type: Boolean },
2847
2847
  title: null
@@ -2865,7 +2865,7 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues
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$a, {
2868
+ return openBlock(), createBlock(_sfc_main$b, {
2869
2869
  role: "checkbox",
2870
2870
  tabindex: "0",
2871
2871
  class: "htw-cursor-pointer htw-items-center",
@@ -2880,13 +2880,13 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues
2880
2880
  renderSlot(_ctx.$slots, "actions")
2881
2881
  ]),
2882
2882
  default: withCtx(() => [
2883
- createElementVNode("div", _hoisted_1$6, [
2883
+ createElementVNode("div", _hoisted_1$7, [
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$4, [
2889
+ (openBlock(), createElementBlock("svg", _hoisted_2$5, [
2890
2890
  createElementVNode("path", {
2891
2891
  ref_key: "path",
2892
2892
  ref: path,
@@ -2909,11 +2909,11 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues
2909
2909
  };
2910
2910
  }
2911
2911
  }));
2912
- const _hoisted_1$5 = ["value"];
2913
- const __default__$8 = {
2912
+ const _hoisted_1$6 = ["value"];
2913
+ const __default__$9 = {
2914
2914
  name: "HstText"
2915
2915
  };
2916
- const _sfc_main$8 = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$8), {
2916
+ const _sfc_main$9 = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$9), {
2917
2917
  props: {
2918
2918
  title: null,
2919
2919
  modelValue: null
@@ -2924,7 +2924,7 @@ const _sfc_main$8 = /* @__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$a, {
2927
+ return openBlock(), createBlock(_sfc_main$b, {
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$8 = /* @__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$5)
2945
+ }), null, 16, _hoisted_1$6)
2946
2946
  ]),
2947
2947
  _: 3
2948
2948
  }, 8, ["title", "class", "style"]);
2949
2949
  };
2950
2950
  }
2951
2951
  }));
2952
- const __default__$7 = {
2952
+ const __default__$8 = {
2953
2953
  name: "HstNumber",
2954
2954
  inheritAttrs: false
2955
2955
  };
2956
- const _sfc_main$7 = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$7), {
2956
+ const _sfc_main$8 = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$8), {
2957
2957
  props: {
2958
2958
  title: null,
2959
2959
  modelValue: null
@@ -3000,7 +3000,7 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues
3000
3000
  stopDragging();
3001
3001
  });
3002
3002
  return (_ctx, _cache) => {
3003
- return openBlock(), createBlock(_sfc_main$a, {
3003
+ return openBlock(), createBlock(_sfc_main$b, {
3004
3004
  class: normalizeClass(["htw-cursor-ew-resize htw-items-center", [
3005
3005
  _ctx.$attrs.class,
3006
3006
  { "htw-select-none": isDragging.value }
@@ -3037,6 +3037,88 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues
3037
3037
  };
3038
3038
  }
3039
3039
  }));
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" }, [
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
+ ], -1);
3045
+ const __default__$7 = {
3046
+ name: "HstSlider",
3047
+ inheritAttrs: false
3048
+ };
3049
+ const _sfc_main$7 = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$7), {
3050
+ props: {
3051
+ title: null,
3052
+ modelValue: null,
3053
+ min: null,
3054
+ max: null
3055
+ },
3056
+ emits: {
3057
+ "update:modelValue": (newValue) => true
3058
+ },
3059
+ setup(__props, { emit }) {
3060
+ const props = __props;
3061
+ const showTooltip = ref(false);
3062
+ const input = ref(null);
3063
+ const numberModel = computed({
3064
+ get: () => props.modelValue,
3065
+ set: (value) => {
3066
+ emit("update:modelValue", value);
3067
+ }
3068
+ });
3069
+ const percentage = computed(() => {
3070
+ return (props.modelValue - props.min) / (props.max - props.min);
3071
+ });
3072
+ const tooltipStyle = computed(() => {
3073
+ const gap = 8;
3074
+ if (input.value) {
3075
+ const position = gap + (input.value.clientWidth - 2 * gap) * percentage.value;
3076
+ return {
3077
+ left: position + "px"
3078
+ };
3079
+ }
3080
+ return {};
3081
+ });
3082
+ return (_ctx, _cache) => {
3083
+ return openBlock(), createBlock(_sfc_main$b, {
3084
+ class: normalizeClass(["htw-items-center", _ctx.$attrs.class]),
3085
+ title: __props.title,
3086
+ style: normalizeStyle(_ctx.$attrs.style)
3087
+ }, {
3088
+ default: withCtx(() => [
3089
+ createElementVNode("div", _hoisted_1$5, [
3090
+ _hoisted_2$4,
3091
+ withDirectives(createElementVNode("input", mergeProps({
3092
+ ref_key: "input",
3093
+ ref: input,
3094
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(numberModel) ? numberModel.value = $event : null),
3095
+ 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",
3096
+ type: "range"
3097
+ }, __spreadProps(__spreadValues({}, _ctx.$attrs), { class: null, style: null }), {
3098
+ onMouseover: _cache[1] || (_cache[1] = ($event) => showTooltip.value = true),
3099
+ onMouseleave: _cache[2] || (_cache[2] = ($event) => showTooltip.value = false)
3100
+ }), null, 16), [
3101
+ [
3102
+ vModelText,
3103
+ unref(numberModel),
3104
+ void 0,
3105
+ { number: true }
3106
+ ]
3107
+ ]),
3108
+ showTooltip.value ? withDirectives((openBlock(), createElementBlock("div", {
3109
+ key: 0,
3110
+ class: "htw-absolute",
3111
+ style: normalizeStyle(unref(tooltipStyle))
3112
+ }, null, 4)), [
3113
+ [unref(VTooltip), { content: __props.modelValue.toString(), shown: true, distance: 16, delay: 0 }]
3114
+ ]) : createCommentVNode("", true)
3115
+ ])
3116
+ ]),
3117
+ _: 1
3118
+ }, 8, ["title", "class", "style"]);
3119
+ };
3120
+ }
3121
+ }));
3040
3122
  const _hoisted_1$4 = ["value"];
3041
3123
  const __default__$6 = {
3042
3124
  name: "HstTextarea",
@@ -3053,7 +3135,7 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues
3053
3135
  setup(__props, { emit }) {
3054
3136
  const input = ref();
3055
3137
  return (_ctx, _cache) => {
3056
- return openBlock(), createBlock(_sfc_main$a, {
3138
+ return openBlock(), createBlock(_sfc_main$b, {
3057
3139
  title: __props.title,
3058
3140
  class: normalizeClass(["htw-cursor-text", _ctx.$attrs.class]),
3059
3141
  style: normalizeStyle(_ctx.$attrs.style),
@@ -4974,7 +5056,7 @@ const _sfc_main$4 = defineComponent(__spreadProps(__spreadValues({}, __default__
4974
5056
  setup(__props, { emit: emits }) {
4975
5057
  ref();
4976
5058
  return (_ctx, _cache) => {
4977
- return openBlock(), createBlock(_sfc_main$a, {
5059
+ return openBlock(), createBlock(_sfc_main$b, {
4978
5060
  title: __props.title,
4979
5061
  class: normalizeClass(["htw-cursor-text htw-items-center", _ctx.$attrs.class]),
4980
5062
  style: normalizeStyle(_ctx.$attrs.style)
@@ -5391,22 +5473,24 @@ const _sfc_main = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({
5391
5473
  };
5392
5474
  }
5393
5475
  }));
5394
- const HstCheckbox = _sfc_main$9;
5395
- const HstText = _sfc_main$8;
5396
- const HstNumber = _sfc_main$7;
5476
+ const HstCheckbox = _sfc_main$a;
5477
+ const HstText = _sfc_main$9;
5478
+ const HstNumber = _sfc_main$8;
5479
+ const HstSlider = _sfc_main$7;
5397
5480
  const HstTextarea = _sfc_main$6;
5398
5481
  const HstColorShades = _sfc_main$2;
5399
5482
  const HstTokenList = _sfc_main$1;
5400
5483
  const HstTokenGrid = _sfc_main;
5401
5484
  const HstCopyIcon = _sfc_main$3;
5402
5485
  function registerVueComponents(app) {
5403
- app.component("HstCheckbox", _sfc_main$9);
5404
- app.component("HstText", _sfc_main$8);
5405
- app.component("HstNumber", _sfc_main$7);
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);
5406
5490
  app.component("HstSelect", _sfc_main$4);
5407
5491
  app.component("HstTextarea", _sfc_main$6);
5408
5492
  app.component("HstColorShades", _sfc_main$2);
5409
5493
  app.component("HstTokenList", _sfc_main$1);
5410
5494
  app.component("HstTokenGrid", _sfc_main);
5411
5495
  }
5412
- export { HstCheckbox, HstColorShades, HstCopyIcon, HstNumber, HstText, HstTextarea, HstTokenGrid, HstTokenList, registerVueComponents };
5496
+ export { HstCheckbox, HstColorShades, HstCopyIcon, HstNumber, HstSlider, HstText, HstTextarea, HstTokenGrid, HstTokenList, registerVueComponents };
@@ -271,6 +271,10 @@
271
271
  margin:1rem
272
272
  }
273
273
 
274
+ .htw-m-0{
275
+ margin:0px
276
+ }
277
+
274
278
  .htw-my-0{
275
279
  margin-top:0px;
276
280
  margin-bottom:0px
@@ -343,6 +347,14 @@
343
347
  height:27px
344
348
  }
345
349
 
350
+ .htw-h-1{
351
+ height:0.25rem
352
+ }
353
+
354
+ .htw-h-3{
355
+ height:0.75rem
356
+ }
357
+
346
358
  .htw-min-h-\[26px\]{
347
359
  min-height:26px
348
360
  }
@@ -371,6 +383,10 @@
371
383
  width:100%
372
384
  }
373
385
 
386
+ .htw-w-3{
387
+ width:0.75rem
388
+ }
389
+
374
390
  .htw-flex-none{
375
391
  flex:none
376
392
  }
@@ -414,6 +430,12 @@
414
430
  resize:vertical
415
431
  }
416
432
 
433
+ .htw-appearance-none{
434
+ -webkit-appearance:none;
435
+ -moz-appearance:none;
436
+ appearance:none
437
+ }
438
+
417
439
  .htw-grid-cols-\[repeat\(auto-fill\,minmax\(200px\,1fr\)\)\]{
418
440
  grid-template-columns:repeat(auto-fill,minmax(200px,1fr))
419
441
  }
@@ -488,6 +510,10 @@
488
510
  border-width:2px
489
511
  }
490
512
 
513
+ .htw-border-0{
514
+ border-width:0px
515
+ }
516
+
491
517
  .htw-border-solid{
492
518
  border-style:solid
493
519
  }
@@ -538,6 +564,11 @@
538
564
  background-color:rgb(63 63 70 / var(--tw-bg-opacity))
539
565
  }
540
566
 
567
+ .\!htw-bg-primary-500{
568
+ --tw-bg-opacity:1 !important;
569
+ background-color:rgb(16 185 129 / var(--tw-bg-opacity)) !important
570
+ }
571
+
541
572
  .htw-stroke-white{
542
573
  stroke:#fff
543
574
  }
@@ -591,6 +622,11 @@
591
622
  color:inherit
592
623
  }
593
624
 
625
+ .htw-text-gray-700{
626
+ --tw-text-opacity:1;
627
+ color:rgb(63 63 70 / var(--tw-text-opacity))
628
+ }
629
+
594
630
  .htw-opacity-50{
595
631
  opacity:0.5
596
632
  }
@@ -637,7 +673,7 @@
637
673
  }
638
674
 
639
675
  body {
640
- font-size: 18px;
676
+ font-size: 1.125rem;
641
677
  }
642
678
 
643
679
  .htw-dark body{
@@ -647,7 +683,7 @@ body {
647
683
 
648
684
  @media (min-width: 640px) {
649
685
  body {
650
- font-size: 14px;
686
+ font-size: .875rem;
651
687
  }
652
688
  }
653
689
 
package/dist/style.css CHANGED
@@ -1 +1 @@
1
- .v-popper{line-height:0}.htw-dark .v-popper--theme-dropdown .v-popper__inner{--tw-border-opacity: 1;border-color:rgb(31 31 33 / var(--tw-border-opacity));--tw-bg-opacity: 1;background-color:rgb(63 63 70 / var(--tw-bg-opacity));--tw-text-opacity: 1;color:rgb(244 244 245 / var(--tw-text-opacity))}.htw-dark .v-popper--theme-dropdown .v-popper__arrow-inner{--tw-border-opacity: 1;border-color:rgb(63 63 70 / var(--tw-border-opacity))}.htw-dark .v-popper--theme-dropdown .v-popper__arrow-outer{--tw-border-opacity: 1;border-color:rgb(31 31 33 / var(--tw-border-opacity))}.v-popper--theme-dropdown.v-popper__popper--show-from .v-popper__wrapper{transform:scale(.75)}.v-popper--theme-dropdown.v-popper__popper--show-to .v-popper__wrapper{transform:none;transition:transform .15s cubic-bezier(0,1,.5,1)}.v-popper__popper:focus-visible{outline:none}.htw-bind-col-size{grid-template-columns:repeat(auto-fill,minmax(var(--histoire-col-size),1fr))}
1
+ .htw-range-input::-webkit-slider-thumb{height:.75rem;width:.75rem;-webkit-appearance:none;appearance:none;border-radius:9999px;border-width:1px;border-style:solid;border-color:#00000040;--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity))}.htw-dark .htw-range-input::-webkit-slider-thumb{border-color:#ffffff40;--tw-bg-opacity: 1;background-color:rgb(63 63 70 / var(--tw-bg-opacity))}.htw-range-input:hover::-webkit-slider-thumb{--tw-border-opacity: 1 !important;border-color:rgb(16 185 129 / var(--tw-border-opacity))!important;--tw-bg-opacity: 1 !important;background-color:rgb(16 185 129 / var(--tw-bg-opacity))!important}.htw-range-input::-moz-range-thumb{height:.75rem;width:.75rem;-moz-appearance:none;appearance:none;border-radius:9999px;border-width:1px;border-style:solid;border-color:#00000040;--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity))}.htw-dark .htw-range-input::-moz-range-thumb{border-color:#ffffff40;--tw-bg-opacity: 1;background-color:rgb(63 63 70 / var(--tw-bg-opacity))}.htw-range-input:hover::-moz-range-thumb{--tw-border-opacity: 1 !important;border-color:rgb(16 185 129 / var(--tw-border-opacity))!important;--tw-bg-opacity: 1 !important;background-color:rgb(16 185 129 / var(--tw-bg-opacity))!important}.v-popper{line-height:0}.htw-dark .v-popper--theme-dropdown .v-popper__inner{--tw-border-opacity: 1;border-color:rgb(31 31 33 / var(--tw-border-opacity));--tw-bg-opacity: 1;background-color:rgb(63 63 70 / var(--tw-bg-opacity));--tw-text-opacity: 1;color:rgb(244 244 245 / var(--tw-text-opacity))}.htw-dark .v-popper--theme-dropdown .v-popper__arrow-inner{--tw-border-opacity: 1;border-color:rgb(63 63 70 / var(--tw-border-opacity))}.htw-dark .v-popper--theme-dropdown .v-popper__arrow-outer{--tw-border-opacity: 1;border-color:rgb(31 31 33 / var(--tw-border-opacity))}.v-popper--theme-dropdown.v-popper__popper--show-from .v-popper__wrapper{transform:scale(.75)}.v-popper--theme-dropdown.v-popper__popper--show-to .v-popper__wrapper{transform:none;transition:transform .15s cubic-bezier(0,1,.5,1)}.v-popper__popper:focus-visible{outline:none}.htw-bind-col-size{grid-template-columns:repeat(auto-fill,minmax(var(--histoire-col-size),1fr))}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@histoire/controls",
3
- "version": "0.7.0",
3
+ "version": "0.7.3",
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.0",
47
+ "histoire": "0.7.3",
48
48
  "postcss": "^8.4.12",
49
49
  "postcss-import": "^14.1.0",
50
50
  "tailwindcss": "^3.0.23",
@@ -0,0 +1,35 @@
1
+ <script lang="ts" setup>
2
+ import { reactive } from 'vue'
3
+ import HstSlider from './HstSlider.vue'
4
+
5
+ const state = reactive({
6
+ value: 20,
7
+ min: 0,
8
+ max: 100,
9
+ step: 5,
10
+ })
11
+ </script>
12
+
13
+ <template>
14
+ <Story
15
+ title="HstSlider"
16
+ >
17
+ <HstSlider
18
+ v-model="state.value"
19
+ :step="state.step"
20
+ :min="state.min"
21
+ :max="state.max"
22
+ title="Slide"
23
+ />
24
+ <pre>{{ state }}</pre>
25
+ <template #controls>
26
+ <HstSlider
27
+ v-model="state.value"
28
+ :step="state.step"
29
+ :min="state.min"
30
+ :max="state.max"
31
+ title="Value"
32
+ />
33
+ </template>
34
+ </Story>
35
+ </template>
@@ -0,0 +1,103 @@
1
+ <script lang="ts">
2
+ export default {
3
+ name: 'HstSlider',
4
+ inheritAttrs: false,
5
+ }
6
+ </script>
7
+
8
+ <script lang="ts" setup>
9
+ import { computed, ref } from 'vue'
10
+ import type { CSSProperties } from 'vue'
11
+ import HstWrapper from '../HstWrapper.vue'
12
+ import { VTooltip as vTooltip } from 'floating-vue'
13
+
14
+ const props = defineProps<{
15
+ title?: string
16
+ modelValue: number
17
+ min: number
18
+ max: number
19
+ }>()
20
+
21
+ const emit = defineEmits({
22
+ 'update:modelValue': (newValue: number) => true,
23
+ })
24
+
25
+ const showTooltip = ref(false)
26
+ const input = ref<HTMLInputElement>(null)
27
+
28
+ const numberModel = computed({
29
+ get: () => props.modelValue,
30
+ set: value => {
31
+ emit('update:modelValue', value)
32
+ },
33
+ })
34
+
35
+ const percentage = computed(() => {
36
+ return (props.modelValue - props.min) / (props.max - props.min)
37
+ })
38
+
39
+ const tooltipStyle = computed<CSSProperties>(() => {
40
+ const gap = 8
41
+ if (input.value) {
42
+ const position = gap + ((input.value.clientWidth - 2 * gap) * percentage.value)
43
+ return {
44
+ left: position + 'px',
45
+ }
46
+ }
47
+ return {}
48
+ })
49
+ </script>
50
+
51
+ <template>
52
+ <HstWrapper
53
+ class="htw-items-center"
54
+ :title="title"
55
+ :class="$attrs.class"
56
+ :style="$attrs.style"
57
+ >
58
+ <div class="htw-relative htw-w-full htw-flex htw-items-center">
59
+ <div class="htw-absolute htw-inset-0 htw-flex htw-items-center">
60
+ <div class="htw-border htw-border-black/25 dark:htw-border-white/25 htw-h-1 htw-w-full htw-rounded-full" />
61
+ </div>
62
+ <input
63
+ ref="input"
64
+ v-model.number="numberModel"
65
+ 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"
66
+ type="range"
67
+ v-bind="{ ...$attrs, class: null, style: null }"
68
+ @mouseover="showTooltip = true"
69
+ @mouseleave="showTooltip = false"
70
+ >
71
+ <div
72
+ v-if="showTooltip"
73
+ v-tooltip="{ content: modelValue.toString(), shown: true, distance: 16, delay: 0 }"
74
+ class="htw-absolute"
75
+ :style="tooltipStyle"
76
+ />
77
+ </div>
78
+ </HstWrapper>
79
+ </template>
80
+
81
+ <style lang="pcss">
82
+ .htw-range-input {
83
+ &::-webkit-slider-thumb {
84
+ @apply htw-appearance-none htw-h-3 htw-w-3 htw-bg-white dark:htw-bg-gray-700 htw-border htw-border-solid htw-border-black/25 dark:htw-border-white/25 htw-rounded-full;
85
+ }
86
+
87
+ &:hover::-webkit-slider-thumb {
88
+ @apply !htw-bg-primary-500 !htw-border-primary-500;
89
+ }
90
+ }
91
+
92
+ /* Separate rules for -moz-range-thumb to prevent a bug with Safari that causes it to ignore custom style */
93
+
94
+ .htw-range-input {
95
+ &::-moz-range-thumb {
96
+ @apply htw-appearance-none htw-h-3 htw-w-3 htw-bg-white dark:htw-bg-gray-700 htw-border htw-border-solid htw-border-black/25 dark:htw-border-white/25 htw-rounded-full;
97
+ }
98
+
99
+ &:hover::-moz-range-thumb {
100
+ @apply !htw-bg-primary-500 !htw-border-primary-500;
101
+ }
102
+ }
103
+ </style>
package/src/index.ts CHANGED
@@ -2,6 +2,7 @@ import type { App } from 'vue'
2
2
  import HstCheckboxVue from './components/checkbox/HstCheckbox.vue'
3
3
  import HstTextVue from './components/text/HstText.vue'
4
4
  import HstNumberVue from './components/number/HstNumber.vue'
5
+ import HstSliderVue from './components/slider/HstSlider.vue'
5
6
  import HstTextareaVue from './components/textarea/HstTextarea.vue'
6
7
  import HstSelectVue from './components/select/HstSelect.vue'
7
8
  import HstColorShadesVue from './components/design-tokens/HstColorShades.vue'
@@ -12,6 +13,7 @@ import HstCopyIconVue from './components/HstCopyIcon.vue'
12
13
  export const HstCheckbox = HstCheckboxVue
13
14
  export const HstText = HstTextVue
14
15
  export const HstNumber = HstNumberVue
16
+ export const HstSlider = HstSliderVue
15
17
  export const HstTextarea = HstTextareaVue
16
18
  export const HstColorShades = HstColorShadesVue
17
19
  export const HstTokenList = HstTokenListVue
@@ -22,6 +24,7 @@ export function registerVueComponents (app: App) {
22
24
  app.component('HstCheckbox', HstCheckboxVue)
23
25
  app.component('HstText', HstTextVue)
24
26
  app.component('HstNumber', HstNumberVue)
27
+ app.component('HstSlider', HstSliderVue)
25
28
  app.component('HstSelect', HstSelectVue)
26
29
  app.component('HstTextarea', HstTextareaVue)
27
30
  app.component('HstColorShades', HstColorShadesVue)
@@ -6,12 +6,12 @@
6
6
 
7
7
 
8
8
  body {
9
- font-size: 18px;
9
+ font-size: 1.125rem;
10
10
  @apply dark:htw-text-gray-100;
11
11
  }
12
12
 
13
13
  @media (min-width: 640px) {
14
14
  body {
15
- font-size: 14px;
15
+ font-size: .875rem;
16
16
  }
17
17
  }