@histoire/controls 0.0.4
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/LICENSE +21 -0
- package/README.md +5 -0
- package/dist/components/checkbox/HstCheckbox.story.vue.d.ts +2 -0
- package/dist/components/checkbox/HstCheckbox.test.d.ts +1 -0
- package/dist/components/checkbox/HstCheckbox.vue.d.ts +18 -0
- package/dist/components/input/HstInput.story.vue.d.ts +2 -0
- package/dist/components/input/HstInput.vue.d.ts +18 -0
- package/dist/histoire-setup.d.ts +3 -0
- package/dist/histoire.svg +51 -0
- package/dist/index.d.ts +36 -0
- package/dist/index.es.js +144 -0
- package/dist/peeky-preview.d.ts +1 -0
- package/dist/style.css +678 -0
- package/histoire-dist/__sandbox.html +15 -0
- package/histoire-dist/assets/BaseEmpty.a84c14c8.js +1 -0
- package/histoire-dist/assets/HomeView.f524bd4b.js +1 -0
- package/histoire-dist/assets/HstCheckbox.story.9f622545.js +1 -0
- package/histoire-dist/assets/HstInput.story.945401ce.js +1 -0
- package/histoire-dist/assets/SearchModal.76c035f2.js +1 -0
- package/histoire-dist/assets/StoryView.e4c41518.js +15 -0
- package/histoire-dist/assets/global-components.84d0ab22.js +1 -0
- package/histoire-dist/assets/histoire-text-dark.a529813a.svg +89 -0
- package/histoire-dist/assets/histoire-text.1d4474b5.svg +89 -0
- package/histoire-dist/assets/histoire.8af7bd1f.svg +51 -0
- package/histoire-dist/assets/index.58f51dd0.js +1 -0
- package/histoire-dist/assets/preview-settings.a634d101.js +1 -0
- package/histoire-dist/assets/sandbox.2c60450a.js +1 -0
- package/histoire-dist/assets/style.7657d2ac.css +1 -0
- package/histoire-dist/assets/vendor.70a554f6.js +9 -0
- package/histoire-dist/index.html +15 -0
- package/package.json +63 -0
- package/postcss.config.cjs +8 -0
- package/public/histoire.svg +51 -0
- package/src/components/checkbox/HstCheckbox.story.vue +34 -0
- package/src/components/checkbox/HstCheckbox.test.ts +32 -0
- package/src/components/checkbox/HstCheckbox.vue +82 -0
- package/src/components/checkbox/__snapshots__/HstCheckbox.test.ts.snap +59 -0
- package/src/components/input/HstInput.story.vue +54 -0
- package/src/components/input/HstInput.vue +47 -0
- package/src/histoire-setup.ts +5 -0
- package/src/index.ts +11 -0
- package/src/peeky-preview.ts +1 -0
- package/src/style/main.css +7 -0
- package/tailwind.config.cjs +11 -0
- package/tsconfig.json +40 -0
- package/vite.config.ts +48 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2022 Guillaume Chau
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -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 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
declare const _default: import("vue").DefineComponent<{
|
|
2
|
+
modelValue: {
|
|
3
|
+
type: BooleanConstructor;
|
|
4
|
+
default: boolean;
|
|
5
|
+
};
|
|
6
|
+
}, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
7
|
+
'update:modelValue': (newValue: boolean) => true;
|
|
8
|
+
}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
9
|
+
modelValue: {
|
|
10
|
+
type: BooleanConstructor;
|
|
11
|
+
default: boolean;
|
|
12
|
+
};
|
|
13
|
+
}>> & {
|
|
14
|
+
"onUpdate:modelValue"?: (newValue: boolean) => any;
|
|
15
|
+
}, {
|
|
16
|
+
modelValue: boolean;
|
|
17
|
+
}>;
|
|
18
|
+
export default _default;
|
|
@@ -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,18 @@
|
|
|
1
|
+
declare const _default: import("vue").DefineComponent<{
|
|
2
|
+
modelValue: {
|
|
3
|
+
type: (StringConstructor | NumberConstructor)[];
|
|
4
|
+
default: string;
|
|
5
|
+
};
|
|
6
|
+
}, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
7
|
+
'update:modelValue': (newValue: string | number) => true;
|
|
8
|
+
}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
9
|
+
modelValue: {
|
|
10
|
+
type: (StringConstructor | NumberConstructor)[];
|
|
11
|
+
default: string;
|
|
12
|
+
};
|
|
13
|
+
}>> & {
|
|
14
|
+
"onUpdate:modelValue"?: (newValue: string | number) => any;
|
|
15
|
+
}, {
|
|
16
|
+
modelValue: string | number;
|
|
17
|
+
}>;
|
|
18
|
+
export default _default;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
|
2
|
+
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
|
3
|
+
|
|
4
|
+
<svg
|
|
5
|
+
width="512"
|
|
6
|
+
height="512"
|
|
7
|
+
viewBox="0 0 512 512"
|
|
8
|
+
version="1.1"
|
|
9
|
+
id="svg5"
|
|
10
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
11
|
+
xmlns:svg="http://www.w3.org/2000/svg">
|
|
12
|
+
<defs
|
|
13
|
+
id="defs2" />
|
|
14
|
+
<g
|
|
15
|
+
id="layer1">
|
|
16
|
+
<rect
|
|
17
|
+
style="opacity:0.5;fill:#34d399;fill-opacity:1;stroke-width:1.00375"
|
|
18
|
+
id="rect1372"
|
|
19
|
+
width="314.30923"
|
|
20
|
+
height="406.60901"
|
|
21
|
+
x="-26.565063"
|
|
22
|
+
y="134.75079"
|
|
23
|
+
transform="rotate(-23.821262)"
|
|
24
|
+
ry="8" />
|
|
25
|
+
<rect
|
|
26
|
+
style="fill:#34d399;fill-opacity:1;stroke-width:1.00375"
|
|
27
|
+
id="rect850"
|
|
28
|
+
width="314.30923"
|
|
29
|
+
height="406.60901"
|
|
30
|
+
x="77.571838"
|
|
31
|
+
y="72.808708"
|
|
32
|
+
ry="8"
|
|
33
|
+
transform="rotate(-4.5744534)" />
|
|
34
|
+
</g>
|
|
35
|
+
<g
|
|
36
|
+
id="layer3">
|
|
37
|
+
<path
|
|
38
|
+
id="path1657-3"
|
|
39
|
+
style="display:inline;fill:#b4fae2;fill-opacity:1;stroke:#b4fae2;stroke-width:8.34923;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
|
40
|
+
d="M 359.38947,355.95134 320.72935,176.52942 238.34613,238.94118 Z M 273.64124,273.06608 152.59788,156.05591 191.25804,335.47786 Z" />
|
|
41
|
+
</g>
|
|
42
|
+
<g
|
|
43
|
+
id="layer2"
|
|
44
|
+
style="display:none">
|
|
45
|
+
<path
|
|
46
|
+
id="path1657"
|
|
47
|
+
style="fill:#b4fae2;fill-opacity:1;stroke:#b4fae2;stroke-width:8;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
|
48
|
+
d="m 296,103.98242 -135.53125,177.9668 h 88.70117 z M 262.83008,230.05078 216,408.01758 351.53125,230.05078 Z"
|
|
49
|
+
transform="rotate(-4.156553,256,256.00691)" />
|
|
50
|
+
</g>
|
|
51
|
+
</svg>
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { App } from 'vue';
|
|
2
|
+
export declare const HstCheckbox: import("vue").DefineComponent<{
|
|
3
|
+
modelValue: {
|
|
4
|
+
type: BooleanConstructor;
|
|
5
|
+
default: boolean;
|
|
6
|
+
};
|
|
7
|
+
}, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
8
|
+
'update:modelValue': (newValue: boolean) => true;
|
|
9
|
+
}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
10
|
+
modelValue: {
|
|
11
|
+
type: BooleanConstructor;
|
|
12
|
+
default: boolean;
|
|
13
|
+
};
|
|
14
|
+
}>> & {
|
|
15
|
+
"onUpdate:modelValue"?: (newValue: boolean) => any;
|
|
16
|
+
}, {
|
|
17
|
+
modelValue: boolean;
|
|
18
|
+
}>;
|
|
19
|
+
export declare const HstInput: import("vue").DefineComponent<{
|
|
20
|
+
modelValue: {
|
|
21
|
+
type: (StringConstructor | NumberConstructor)[];
|
|
22
|
+
default: string;
|
|
23
|
+
};
|
|
24
|
+
}, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
25
|
+
'update:modelValue': (newValue: string | number) => true;
|
|
26
|
+
}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
27
|
+
modelValue: {
|
|
28
|
+
type: (StringConstructor | NumberConstructor)[];
|
|
29
|
+
default: string;
|
|
30
|
+
};
|
|
31
|
+
}>> & {
|
|
32
|
+
"onUpdate:modelValue"?: (newValue: string | number) => any;
|
|
33
|
+
}, {
|
|
34
|
+
modelValue: string | number;
|
|
35
|
+
}>;
|
|
36
|
+
export declare function registerVueComponents(app: App): void;
|
package/dist/index.es.js
ADDED
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defProps = Object.defineProperties;
|
|
3
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
+
var __spreadValues = (a, b) => {
|
|
9
|
+
for (var prop in b || (b = {}))
|
|
10
|
+
if (__hasOwnProp.call(b, prop))
|
|
11
|
+
__defNormalProp(a, prop, b[prop]);
|
|
12
|
+
if (__getOwnPropSymbols)
|
|
13
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
+
if (__propIsEnum.call(b, prop))
|
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16
|
+
}
|
|
17
|
+
return a;
|
|
18
|
+
};
|
|
19
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
+
import { defineComponent, ref, computed, watch, openBlock, createElementBlock, withKeys, withModifiers, createElementVNode, normalizeClass, unref, renderSlot, normalizeStyle, createCommentVNode, mergeProps } from "vue";
|
|
21
|
+
const _hoisted_1$1 = { class: "htw-text-white htw-w-[16px] htw-h-[16px] htw-relative" };
|
|
22
|
+
const _hoisted_2$1 = {
|
|
23
|
+
width: "16",
|
|
24
|
+
height: "16",
|
|
25
|
+
viewBox: "0 0 24 24",
|
|
26
|
+
class: "htw-relative htw-z-10"
|
|
27
|
+
};
|
|
28
|
+
const _hoisted_3 = ["stroke-dasharray", "stroke-dashoffset"];
|
|
29
|
+
const __default__$1 = {
|
|
30
|
+
name: "HstCheckbox"
|
|
31
|
+
};
|
|
32
|
+
const _sfc_main$1 = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$1), {
|
|
33
|
+
props: {
|
|
34
|
+
modelValue: {
|
|
35
|
+
type: Boolean,
|
|
36
|
+
default: false
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
emits: {
|
|
40
|
+
"update:modelValue": (newValue) => true
|
|
41
|
+
},
|
|
42
|
+
setup(__props, { emit }) {
|
|
43
|
+
const props = __props;
|
|
44
|
+
function toggle() {
|
|
45
|
+
emit("update:modelValue", !props.modelValue);
|
|
46
|
+
animationEnabled.value = true;
|
|
47
|
+
}
|
|
48
|
+
const path = ref();
|
|
49
|
+
const dasharray = ref(0);
|
|
50
|
+
const progress = computed(() => props.modelValue ? 1 : 0);
|
|
51
|
+
const dashoffset = computed(() => (1 - progress.value) * dasharray.value);
|
|
52
|
+
const animationEnabled = ref(false);
|
|
53
|
+
watch(path, (value) => {
|
|
54
|
+
var _a, _b, _c;
|
|
55
|
+
dasharray.value = (_c = (_b = (_a = path.value).getTotalLength) == null ? void 0 : _b.call(_a)) != null ? _c : 21.21;
|
|
56
|
+
});
|
|
57
|
+
return (_ctx, _cache) => {
|
|
58
|
+
return openBlock(), createElementBlock("div", {
|
|
59
|
+
role: "checkbox",
|
|
60
|
+
tabindex: "0",
|
|
61
|
+
class: "htw-flex htw-items-center htw-gap-2 htw-select-none htw-px-4 htw-py-3 htw-cursor-pointer hover:htw-bg-primary-100 dark:hover:htw-bg-primary-700",
|
|
62
|
+
onClick: _cache[0] || (_cache[0] = ($event) => toggle()),
|
|
63
|
+
onKeydown: [
|
|
64
|
+
_cache[1] || (_cache[1] = withKeys(withModifiers(($event) => toggle(), ["prevent"]), ["enter"])),
|
|
65
|
+
_cache[2] || (_cache[2] = withKeys(withModifiers(($event) => toggle(), ["prevent"]), ["space"]))
|
|
66
|
+
]
|
|
67
|
+
}, [
|
|
68
|
+
createElementVNode("div", _hoisted_1$1, [
|
|
69
|
+
createElementVNode("div", {
|
|
70
|
+
class: normalizeClass(["htw-border 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", [
|
|
71
|
+
__props.modelValue ? "htw-border-primary-500 htw-border-8" : "htw-border-gray-300 dark:htw-border-gray-500 htw-delay-150"
|
|
72
|
+
]])
|
|
73
|
+
}, null, 2),
|
|
74
|
+
(openBlock(), createElementBlock("svg", _hoisted_2$1, [
|
|
75
|
+
createElementVNode("path", {
|
|
76
|
+
ref_key: "path",
|
|
77
|
+
ref: path,
|
|
78
|
+
d: "m 4 12 l 5 5 l 10 -10",
|
|
79
|
+
fill: "none",
|
|
80
|
+
class: normalizeClass(["htw-stroke-white htw-stroke-2 htw-duration-200 htw-ease-in-out", [
|
|
81
|
+
animationEnabled.value ? "htw-transition-all" : "htw-transition-none",
|
|
82
|
+
{
|
|
83
|
+
"htw-delay-150": __props.modelValue
|
|
84
|
+
}
|
|
85
|
+
]]),
|
|
86
|
+
"stroke-dasharray": dasharray.value,
|
|
87
|
+
"stroke-dashoffset": unref(dashoffset)
|
|
88
|
+
}, null, 10, _hoisted_3)
|
|
89
|
+
]))
|
|
90
|
+
]),
|
|
91
|
+
renderSlot(_ctx.$slots, "default")
|
|
92
|
+
], 32);
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
}));
|
|
96
|
+
const _hoisted_1 = {
|
|
97
|
+
key: 0,
|
|
98
|
+
class: "htw-text-sm htw-px-2 htw-cursor-text"
|
|
99
|
+
};
|
|
100
|
+
const _hoisted_2 = ["value"];
|
|
101
|
+
const __default__ = {
|
|
102
|
+
name: "HstInput",
|
|
103
|
+
inheritAttrs: false
|
|
104
|
+
};
|
|
105
|
+
const _sfc_main = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__), {
|
|
106
|
+
props: {
|
|
107
|
+
modelValue: {
|
|
108
|
+
type: [String, Number],
|
|
109
|
+
default: ""
|
|
110
|
+
}
|
|
111
|
+
},
|
|
112
|
+
emits: {
|
|
113
|
+
"update:modelValue": (newValue) => true
|
|
114
|
+
},
|
|
115
|
+
setup(__props, { emit }) {
|
|
116
|
+
const input = ref();
|
|
117
|
+
return (_ctx, _cache) => {
|
|
118
|
+
return openBlock(), createElementBlock("div", {
|
|
119
|
+
class: normalizeClass(["htw-p-2 hover:htw-bg-primary-100 dark:hover:htw-bg-primary-700 htw-cursor-text", _ctx.$attrs.class]),
|
|
120
|
+
style: normalizeStyle(_ctx.$attrs.style),
|
|
121
|
+
onClick: _cache[1] || (_cache[1] = ($event) => input.value.focus())
|
|
122
|
+
}, [
|
|
123
|
+
_ctx.$slots.default ? (openBlock(), createElementBlock("label", _hoisted_1, [
|
|
124
|
+
renderSlot(_ctx.$slots, "default")
|
|
125
|
+
])) : createCommentVNode("", true),
|
|
126
|
+
createElementVNode("input", mergeProps({
|
|
127
|
+
ref_key: "input",
|
|
128
|
+
ref: input
|
|
129
|
+
}, __spreadProps(__spreadValues({}, _ctx.$attrs), { style: null, class: null }), {
|
|
130
|
+
value: __props.modelValue,
|
|
131
|
+
class: "htw-text-inherit htw-bg-transparent htw-w-full htw-outline-none htw-px-2 htw-py-0 htw-border htw-border-gray-300 dark:htw-border-gray-500 focus:htw-border-primary-500 dark:focus:htw-border-primary-500 htw-rounded-sm",
|
|
132
|
+
onInput: _cache[0] || (_cache[0] = ($event) => emit("update:modelValue", $event.target.value))
|
|
133
|
+
}), null, 16, _hoisted_2)
|
|
134
|
+
], 6);
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
}));
|
|
138
|
+
const HstCheckbox = _sfc_main$1;
|
|
139
|
+
const HstInput = _sfc_main;
|
|
140
|
+
function registerVueComponents(app) {
|
|
141
|
+
app.component("HstCheckbox", _sfc_main$1);
|
|
142
|
+
app.component("HstInput", _sfc_main);
|
|
143
|
+
}
|
|
144
|
+
export { HstCheckbox, HstInput, registerVueComponents };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import './style/main.css';
|