bonkers-ui 1.0.9 → 1.0.12
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/package.json +25 -25
- package/src/components/ui-alert/_types.ts +6 -0
- package/src/components/ui-alert/index.ts +2 -0
- package/src/components/ui-alert/ui-alert.stories.ts +38 -0
- package/src/components/ui-alert/ui-alert.vue +40 -0
- package/src/components/ui-badge/ui-badge.stories.ts +1 -1
- package/src/components/ui-badge/ui-badge.vue +7 -6
- package/src/components/ui-button/ui-button.vue +1 -1
- package/src/components/ui-card-result/ui-card-result.stories.ts +2 -3
- package/src/components/ui-checkbox/{intext.ts → index.ts} +0 -0
- package/src/components/ui-checkbox/ui-checkbox.stories.ts +1 -1
- package/src/components/ui-checkbox/ui-checkbox.vue +18 -7
- package/src/components/ui-input-range/ui-input-range.vue +70 -25
- package/src/components/ui-list-item/ui-list-item.stories.ts +19 -15
- package/src/components/ui-list-item/ui-list-item.vue +16 -9
- package/src/components/ui-select/ui-select.vue +1 -1
- package/src/components/ui-tabs/ui-tabs.vue +1 -1
- package/src/components/ui-toggle/ui-toggle.stories.ts +1 -1
- package/src/components/ui-toggle/ui-toggle.vue +17 -6
- package/src/main.css +14 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bonkers-ui",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.12",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"storybook": "start-storybook -p 6006",
|
|
6
6
|
"build-storybook": "build-storybook",
|
|
@@ -13,48 +13,48 @@
|
|
|
13
13
|
"i": "yarn install --frozen-lockfile"
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@fortawesome/fontawesome-svg-core": "^6.
|
|
17
|
-
"@fortawesome/free-brands-svg-icons": "^6.
|
|
18
|
-
"@fortawesome/free-regular-svg-icons": "^6.
|
|
19
|
-
"@fortawesome/free-solid-svg-icons": "^6.
|
|
16
|
+
"@fortawesome/fontawesome-svg-core": "^6.2.0",
|
|
17
|
+
"@fortawesome/free-brands-svg-icons": "^6.2.0",
|
|
18
|
+
"@fortawesome/free-regular-svg-icons": "^6.2.0",
|
|
19
|
+
"@fortawesome/free-solid-svg-icons": "^6.2.0",
|
|
20
20
|
"@fortawesome/vue-fontawesome": "^3.0.1",
|
|
21
|
-
"vue": "^3.2.
|
|
21
|
+
"vue": "^3.2.38"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
|
-
"@storybook/addon-actions": "^6.5.
|
|
25
|
-
"@storybook/addon-essentials": "^6.5.
|
|
26
|
-
"@storybook/addon-links": "^6.5.
|
|
24
|
+
"@storybook/addon-actions": "^6.5.10",
|
|
25
|
+
"@storybook/addon-essentials": "^6.5.10",
|
|
26
|
+
"@storybook/addon-links": "^6.5.10",
|
|
27
27
|
"@storybook/addon-postcss": "^2.0.0",
|
|
28
|
-
"@storybook/builder-vite": "^0.
|
|
29
|
-
"@storybook/vue3": "^6.5.
|
|
28
|
+
"@storybook/builder-vite": "^0.2.2",
|
|
29
|
+
"@storybook/vue3": "^6.5.10",
|
|
30
30
|
"@types/jest": "^28.1.3",
|
|
31
|
-
"@typescript-eslint/eslint-plugin": "^5.
|
|
32
|
-
"@typescript-eslint/parser": "^5.
|
|
33
|
-
"@vitejs/plugin-vue": "^
|
|
31
|
+
"@typescript-eslint/eslint-plugin": "^5.36.1",
|
|
32
|
+
"@typescript-eslint/parser": "^5.36.1",
|
|
33
|
+
"@vitejs/plugin-vue": "^3.0.3",
|
|
34
34
|
"@vue/eslint-config-typescript": "^11.0.0",
|
|
35
35
|
"@vue/test-utils": "^2.0.0",
|
|
36
36
|
"@vue/vue3-jest": "^27.0.0",
|
|
37
37
|
"babel-jest": "27",
|
|
38
|
-
"eslint": "^8.
|
|
39
|
-
"eslint-plugin-vue": "^9.
|
|
38
|
+
"eslint": "^8.23.0",
|
|
39
|
+
"eslint-plugin-vue": "^9.4.0",
|
|
40
40
|
"gh-pages": "^4.0.0",
|
|
41
41
|
"husky": "^8.0.1",
|
|
42
42
|
"jest": "27.3.1",
|
|
43
43
|
"lint-staged": "^13.0.2",
|
|
44
|
-
"postcss": "^8.4.
|
|
44
|
+
"postcss": "^8.4.16",
|
|
45
45
|
"postcss-html": "^1.4.1",
|
|
46
|
-
"storybook-tailwind-dark-mode": "^1.0.
|
|
47
|
-
"stylelint": "^14.
|
|
48
|
-
"stylelint-config-recommended": "^
|
|
46
|
+
"storybook-tailwind-dark-mode": "^1.0.13",
|
|
47
|
+
"stylelint": "^14.11.0",
|
|
48
|
+
"stylelint-config-recommended": "^9.0.0",
|
|
49
49
|
"stylelint-config-recommended-vue": "^1.4.0",
|
|
50
|
-
"stylelint-config-standard": "^
|
|
51
|
-
"tailwindcss": "^3.1.
|
|
50
|
+
"stylelint-config-standard": "^28.0.0",
|
|
51
|
+
"tailwindcss": "^3.1.8",
|
|
52
52
|
"ts-jest": "^27.0.7",
|
|
53
|
-
"typescript": "^4.
|
|
54
|
-
"vite": "^
|
|
53
|
+
"typescript": "^4.8.2",
|
|
54
|
+
"vite": "^3.0.9",
|
|
55
55
|
"vue-eslint-parser": "^9.0.3",
|
|
56
56
|
"vue-loader": "^17.0.0",
|
|
57
|
-
"vue-tsc": "^0.
|
|
57
|
+
"vue-tsc": "^0.40.5"
|
|
58
58
|
},
|
|
59
59
|
"jest": {
|
|
60
60
|
"preset": "ts-jest",
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import UiAlert from "./ui-alert.vue";
|
|
2
|
+
import type { Story } from "@storybook/vue3";
|
|
3
|
+
import { EAlertTypes } from "./_types";
|
|
4
|
+
|
|
5
|
+
export default {
|
|
6
|
+
title: "Components/ui-alert",
|
|
7
|
+
component: UiAlert,
|
|
8
|
+
argTypes: {
|
|
9
|
+
kind: {
|
|
10
|
+
control: { type: "select" },
|
|
11
|
+
options: Object.values(EAlertTypes),
|
|
12
|
+
description: "The button kinds",
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
args: {
|
|
16
|
+
slot: "some description text: lorem",
|
|
17
|
+
kind: EAlertTypes.WARNING
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
type TComponentProps = InstanceType<typeof UiAlert>["$props"];
|
|
22
|
+
|
|
23
|
+
const Template: Story<TComponentProps> = (args) => ({
|
|
24
|
+
components: { UiAlert },
|
|
25
|
+
setup() {
|
|
26
|
+
return { args };
|
|
27
|
+
},
|
|
28
|
+
template: `
|
|
29
|
+
<ui-alert
|
|
30
|
+
:kind="args.kind"
|
|
31
|
+
:icon="['far', 'face-smile']"
|
|
32
|
+
>
|
|
33
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt
|
|
34
|
+
</ui-alert>
|
|
35
|
+
`
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
export const Default = Template.bind({});
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
class="ui-alert flex gap-sm p-sm border rounded-lg"
|
|
4
|
+
:class="[
|
|
5
|
+
(!kind || kind === EAlertTypes.PRIMARY) && 'border-primary',
|
|
6
|
+
kind === EAlertTypes.WARNING && 'border-warning',
|
|
7
|
+
kind === EAlertTypes.ERROR && 'border-error',
|
|
8
|
+
kind === EAlertTypes.SECONDARY && 'border-secondary',
|
|
9
|
+
]"
|
|
10
|
+
>
|
|
11
|
+
<ui-icon
|
|
12
|
+
:icon-name="icon"
|
|
13
|
+
:size="ESize.SM"
|
|
14
|
+
:class="[
|
|
15
|
+
(!kind || kind === EAlertTypes.PRIMARY) && 'text-primary',
|
|
16
|
+
kind === EAlertTypes.WARNING && 'text-warning',
|
|
17
|
+
kind === EAlertTypes.ERROR && 'text-error',
|
|
18
|
+
kind === EAlertTypes.SECONDARY && 'text-secondary',
|
|
19
|
+
]"
|
|
20
|
+
/>
|
|
21
|
+
<ui-typography
|
|
22
|
+
:size="ETypographySizes.XS"
|
|
23
|
+
line-height
|
|
24
|
+
>
|
|
25
|
+
<slot />
|
|
26
|
+
</ui-typography>
|
|
27
|
+
</div>
|
|
28
|
+
</template>
|
|
29
|
+
|
|
30
|
+
<script lang="ts" setup>
|
|
31
|
+
import UiTypography, { ETypographySizes } from "../ui-typography";
|
|
32
|
+
import UiIcon, { type TIconName } from "../ui-icon";
|
|
33
|
+
import { ESize } from "../../_types/sizing";
|
|
34
|
+
import { EAlertTypes } from "./_types";
|
|
35
|
+
|
|
36
|
+
defineProps<{
|
|
37
|
+
icon: TIconName
|
|
38
|
+
kind?: EAlertTypes
|
|
39
|
+
}>();
|
|
40
|
+
</script>
|
|
@@ -32,7 +32,7 @@ const Template: Story<TComponentProps> = (args) => ({
|
|
|
32
32
|
return { args };
|
|
33
33
|
},
|
|
34
34
|
template: `
|
|
35
|
-
<ui-badge :icon="['far', 'face-smile']" v-bind="args">
|
|
35
|
+
<ui-badge :icon="['far', 'face-smile']" v-bind="args" class="inline-flex">
|
|
36
36
|
{{ args.slot }}
|
|
37
37
|
</ui-badge>
|
|
38
38
|
`,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
3
|
-
class="ui-badge rounded-full
|
|
2
|
+
<div
|
|
3
|
+
class="ui-badge rounded-full flex items-center content-center gap-xxs"
|
|
4
4
|
:class="[
|
|
5
5
|
(!size || size === EBadgeSize.SMALL) && 'px-xs py-xxs',
|
|
6
6
|
(!kind || kind === EBadgeKind.PRIMARY) && 'bg-primary-alt-300 text-primary-alt-700',
|
|
@@ -14,24 +14,23 @@
|
|
|
14
14
|
>
|
|
15
15
|
<ui-icon
|
|
16
16
|
v-if="icon"
|
|
17
|
-
class="mr-xxs"
|
|
18
17
|
:size="ESize.SM"
|
|
19
18
|
:icon-name="icon"
|
|
20
19
|
/>
|
|
21
20
|
|
|
22
21
|
<ui-typography
|
|
23
|
-
|
|
22
|
+
v-if="slots.default"
|
|
24
23
|
:size="getBadgeSize"
|
|
25
24
|
:weight="ETextWeight.SEMI_BOLD"
|
|
26
25
|
class="whitespace-nowrap"
|
|
27
26
|
>
|
|
28
27
|
<slot />
|
|
29
28
|
</ui-typography>
|
|
30
|
-
</
|
|
29
|
+
</div>
|
|
31
30
|
</template>
|
|
32
31
|
|
|
33
32
|
<script lang="ts" setup>
|
|
34
|
-
import { computed } from "vue";
|
|
33
|
+
import { computed, useSlots } from "vue";
|
|
35
34
|
import { EBadgeKind, EBadgeSize } from "./_typings";
|
|
36
35
|
import UiIcon, { type TIconName } from "../ui-icon";
|
|
37
36
|
import { ESize } from "../../_types/sizing";
|
|
@@ -43,6 +42,8 @@
|
|
|
43
42
|
icon?: TIconName;
|
|
44
43
|
}>();
|
|
45
44
|
|
|
45
|
+
const slots = useSlots();
|
|
46
|
+
|
|
46
47
|
const getBadgeSize = computed(()=>{
|
|
47
48
|
switch (props.size) {
|
|
48
49
|
case EBadgeSize.MEDIUM:
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
kind === EButtonTypes.LINK && 'text-accent-alt hover:text-accent-alt-600 active:text-accent-alt-700 disabled:text-accent-alt-300',
|
|
19
19
|
(!size || size === EButtonSizes.DEFAULT) && 'py-sm px-md',
|
|
20
20
|
size === EButtonSizes.SMALL && 'py-xs px-md',
|
|
21
|
-
size === EButtonSizes.MEDIUM && 'py-
|
|
21
|
+
size === EButtonSizes.MEDIUM && 'py-sm px-sm',
|
|
22
22
|
size === EButtonSizes.LARGE && 'py-md px-md',
|
|
23
23
|
fullWidth && 'w-full',
|
|
24
24
|
disabled && 'pointer-events-none',
|
|
File without changes
|
|
@@ -49,7 +49,7 @@ const Template: Story<TComponentProps> = (args) => ({
|
|
|
49
49
|
},
|
|
50
50
|
// And then the `args` are bound to your component with `v-bind="args"`
|
|
51
51
|
template: `
|
|
52
|
-
<ui-checkbox v-bind="args" v-model
|
|
52
|
+
<ui-checkbox v-bind="args" v-model="modelValue">
|
|
53
53
|
${args.slot}
|
|
54
54
|
</ui-checkbox>
|
|
55
55
|
`,
|
|
@@ -13,11 +13,11 @@
|
|
|
13
13
|
]"
|
|
14
14
|
>
|
|
15
15
|
<input
|
|
16
|
-
|
|
16
|
+
v-model="checkboxModel"
|
|
17
17
|
class="appearance-none absolute"
|
|
18
18
|
type="checkbox"
|
|
19
|
+
:value="value"
|
|
19
20
|
:disabled="disabled"
|
|
20
|
-
@input="$emit('update:modelValue', !!($event.target as HTMLInputElement)?.value)"
|
|
21
21
|
>
|
|
22
22
|
<span
|
|
23
23
|
class="ui-checkbox_custom w-md h-md flex items-center justify-center border border-secondary-alt-500 rounded relative hover:border-secondary-alt-700"
|
|
@@ -50,21 +50,32 @@
|
|
|
50
50
|
</template>
|
|
51
51
|
|
|
52
52
|
<script lang="ts" setup>
|
|
53
|
-
import { useSlots } from "vue";
|
|
53
|
+
import { useSlots, computed } from "vue";
|
|
54
54
|
import { EJustify } from "../../_types/align";
|
|
55
55
|
|
|
56
56
|
const slots = useSlots();
|
|
57
57
|
|
|
58
|
-
defineProps<{
|
|
59
|
-
modelValue: boolean;
|
|
58
|
+
const props = defineProps<{
|
|
59
|
+
modelValue: boolean | unknown[];
|
|
60
60
|
justify?: EJustify;
|
|
61
61
|
invertOrder?: boolean;
|
|
62
62
|
disabled?: boolean;
|
|
63
|
+
value?: string;
|
|
63
64
|
}>();
|
|
64
65
|
|
|
65
|
-
defineEmits<{
|
|
66
|
-
(e: "update:modelValue", state:
|
|
66
|
+
const emit = defineEmits<{
|
|
67
|
+
(e: "update:modelValue", state: unknown): void
|
|
67
68
|
}>();
|
|
69
|
+
|
|
70
|
+
const checkboxModel = computed({
|
|
71
|
+
get() {
|
|
72
|
+
return props.modelValue;
|
|
73
|
+
},
|
|
74
|
+
set(value) {
|
|
75
|
+
emit("update:modelValue", value);
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
|
|
68
79
|
</script>
|
|
69
80
|
|
|
70
81
|
<style scoped>
|
|
@@ -1,28 +1,36 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div
|
|
3
|
-
class="ui-input-range relative h-
|
|
3
|
+
class="ui-input-range relative h-xl mx-xs"
|
|
4
4
|
>
|
|
5
5
|
<input
|
|
6
|
-
|
|
6
|
+
ref="track"
|
|
7
|
+
v-model="rangeModel"
|
|
8
|
+
class="appearance-none absolute cursor-pointer bg-transparent w-full h-full"
|
|
7
9
|
type="range"
|
|
8
10
|
:min="min"
|
|
9
11
|
:max="max"
|
|
10
|
-
:value="modelValue"
|
|
11
12
|
:step="step"
|
|
12
|
-
@
|
|
13
|
+
@touchmove="moveHandler"
|
|
13
14
|
>
|
|
14
|
-
<div class="ui-input-range__line h-xs w-full bg-secondary-alt rounded absolute left-0 -z-10" />
|
|
15
15
|
<div
|
|
16
|
-
class="ui-input-range__line h-xs bg-
|
|
16
|
+
class="ui-input-range__line h-xs w-full bg-secondary-alt rounded absolute left-0 -z-10 -translate-y-1/2"
|
|
17
|
+
/>
|
|
18
|
+
<div
|
|
19
|
+
class="ui-input-range__line h-xs bg-primary rounded absolute left-0 -z-10 -translate-y-1/2"
|
|
17
20
|
:style="{
|
|
18
21
|
width: getPercentage + '%',
|
|
19
22
|
}"
|
|
20
23
|
/>
|
|
24
|
+
|
|
25
|
+
<div
|
|
26
|
+
class="ui-input-range__thumb bg-primary absolute border-8 border-white rounded-full box-content -translate-y-1/2 -translate-x-1/2"
|
|
27
|
+
:style="{left: getPercentage + '%'}"
|
|
28
|
+
/>
|
|
21
29
|
</div>
|
|
22
30
|
</template>
|
|
23
31
|
|
|
24
32
|
<script lang="ts" setup>
|
|
25
|
-
import { computed } from "vue";
|
|
33
|
+
import { computed, ref } from "vue";
|
|
26
34
|
|
|
27
35
|
const props = defineProps<{
|
|
28
36
|
modelValue: string | number;
|
|
@@ -31,42 +39,79 @@
|
|
|
31
39
|
step: string | number;
|
|
32
40
|
}>();
|
|
33
41
|
|
|
34
|
-
defineEmits<{
|
|
42
|
+
const emit = defineEmits<{
|
|
35
43
|
(e: "update:modelValue", state: string | number): void
|
|
36
44
|
}>();
|
|
37
45
|
|
|
46
|
+
const rangeModel = computed({
|
|
47
|
+
get() {
|
|
48
|
+
return props.modelValue;
|
|
49
|
+
},
|
|
50
|
+
set(value) {
|
|
51
|
+
emit("update:modelValue", value);
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
const track = ref();
|
|
56
|
+
|
|
38
57
|
const getPercentage = computed(() => {
|
|
39
58
|
return Math.round(((+props.modelValue - +props.min) / (+props.max - +props.min)) * 100);
|
|
40
59
|
});
|
|
60
|
+
|
|
61
|
+
const parseMouseMove = (e: MouseEvent | TouchEvent) => {
|
|
62
|
+
if(track.value){
|
|
63
|
+
const CLICK = "clientX";
|
|
64
|
+
|
|
65
|
+
const {
|
|
66
|
+
left: trackStart,
|
|
67
|
+
width: trackLength,
|
|
68
|
+
} = track.value.getBoundingClientRect();
|
|
69
|
+
|
|
70
|
+
const clickOffset = "touches" in e ? e.touches[0][CLICK] : e[CLICK];
|
|
71
|
+
|
|
72
|
+
// It is possible for left to be NaN, force to number
|
|
73
|
+
const clickPos = Math.min(Math.max((clickOffset - trackStart ) / trackLength, 0), 1) || 0;
|
|
74
|
+
|
|
75
|
+
const mousePositionInPercent = parseFloat(String(props.min)) + clickPos * (+props.max - +props.min);
|
|
76
|
+
|
|
77
|
+
const newValue = Math.round((mousePositionInPercent) / +props.step) * +props.step;
|
|
78
|
+
|
|
79
|
+
return parseFloat(Math.min(newValue, +props.max).toFixed(2));
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
const moveHandler = (e: MouseEvent | TouchEvent) => {
|
|
84
|
+
rangeModel.value = parseMouseMove(e) || 0;
|
|
85
|
+
};
|
|
86
|
+
|
|
41
87
|
</script>
|
|
42
88
|
|
|
43
89
|
<style scoped>
|
|
44
90
|
input[type="range"]::-webkit-slider-thumb {
|
|
45
91
|
appearance: none;
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
border:
|
|
51
|
-
box-shadow:
|
|
52
|
-
box-sizing: content-box;
|
|
53
|
-
z-index: 1;
|
|
92
|
+
height: 8px;
|
|
93
|
+
width: 8px;
|
|
94
|
+
transform: scale(5);
|
|
95
|
+
background-color: transparent;
|
|
96
|
+
border: 0;
|
|
97
|
+
box-shadow: none;
|
|
54
98
|
}
|
|
55
99
|
|
|
56
100
|
input[type="range"]::-moz-range-thumb {
|
|
57
101
|
appearance: none;
|
|
58
|
-
background-color:
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
border-radius: 50%;
|
|
62
|
-
border: var(--xs) solid var(--color-white);
|
|
63
|
-
box-shadow: 0 0 0 4px var(--color-primary);
|
|
64
|
-
box-sizing: content-box;
|
|
65
|
-
z-index: 1;
|
|
102
|
+
background-color: transparent;
|
|
103
|
+
border: 0;
|
|
104
|
+
box-shadow: none;
|
|
66
105
|
}
|
|
67
106
|
|
|
68
107
|
.ui-input-range__line {
|
|
69
108
|
top: 50%;
|
|
70
|
-
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
.ui-input-range__thumb {
|
|
112
|
+
top: 50%;
|
|
113
|
+
height: 13px;
|
|
114
|
+
width: 13px;
|
|
115
|
+
box-shadow: 0 0 0 4px var(--color-primary);
|
|
71
116
|
}
|
|
72
117
|
</style>
|
|
@@ -1,33 +1,37 @@
|
|
|
1
|
-
import
|
|
1
|
+
import UiListItem from "./ui-list-item.vue";
|
|
2
2
|
import type { Story } from "@storybook/vue3";
|
|
3
3
|
|
|
4
4
|
export default {
|
|
5
5
|
title: "Components/ui-list-item",
|
|
6
|
-
component:
|
|
7
|
-
argTypes: {
|
|
6
|
+
component: UiListItem,
|
|
7
|
+
argTypes: {
|
|
8
|
+
description: {
|
|
9
|
+
control: { type: "text" },
|
|
10
|
+
title: "The Element title",
|
|
11
|
+
}
|
|
12
|
+
},
|
|
8
13
|
args: {
|
|
9
|
-
slot: "
|
|
14
|
+
slot: "some description text: lorem",
|
|
15
|
+
title: "default text",
|
|
10
16
|
}
|
|
11
17
|
};
|
|
12
18
|
|
|
13
|
-
type TComponentProps = InstanceType<typeof
|
|
19
|
+
type TComponentProps = InstanceType<typeof UiListItem>["$props"];
|
|
14
20
|
|
|
15
21
|
const Template: Story<TComponentProps> = (args) => ({
|
|
16
|
-
components: {
|
|
22
|
+
components: { UiListItem },
|
|
17
23
|
setup() {
|
|
18
24
|
return { args };
|
|
19
25
|
},
|
|
20
26
|
template: `
|
|
21
|
-
<ul>
|
|
22
|
-
<ui-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
<ui-icon-list :icon="['far', 'face-smile']">
|
|
26
|
-
{{args.slot}}
|
|
27
|
-
</ui-icon-list>
|
|
28
|
-
<ui-icon-list :icon="['far', 'face-smile']">
|
|
27
|
+
<ul class="grid gap-sm">
|
|
28
|
+
<ui-list-item :icon="['far', 'face-smile']" :title="args.title">
|
|
29
|
+
</ui-list-item>
|
|
30
|
+
<ui-list-item :icon="['far', 'face-smile']" :title="args.title">
|
|
29
31
|
{{args.slot}}
|
|
30
|
-
</ui-
|
|
32
|
+
</ui-list-item>
|
|
33
|
+
<ui-list-item :icon="['far', 'face-smile']" :title="args.title">
|
|
34
|
+
</ui-list-item>
|
|
31
35
|
</ul>
|
|
32
36
|
`
|
|
33
37
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<li class="ui-icon-list">
|
|
2
|
+
<li class="ui-icon-list flex">
|
|
3
3
|
<ui-icon
|
|
4
4
|
v-if="icon"
|
|
5
5
|
class="mr-xs"
|
|
@@ -7,23 +7,30 @@
|
|
|
7
7
|
:icon-name="icon"
|
|
8
8
|
/>
|
|
9
9
|
|
|
10
|
-
<
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
10
|
+
<div>
|
|
11
|
+
<ui-typography
|
|
12
|
+
:weight="ETextWeight.SEMI_BOLD"
|
|
13
|
+
>
|
|
14
|
+
{{ title }}
|
|
15
|
+
</ui-typography>
|
|
16
|
+
<p
|
|
17
|
+
v-if="$slots.default"
|
|
18
|
+
class="mt-xs"
|
|
19
|
+
>
|
|
20
|
+
<slot />
|
|
21
|
+
</p>
|
|
22
|
+
</div>
|
|
17
23
|
</li>
|
|
18
24
|
</template>
|
|
19
25
|
|
|
20
26
|
<script lang="ts" setup>
|
|
21
27
|
import UiIcon, { type TIconName } from "../ui-icon";
|
|
22
28
|
import { ESize } from "../../_types/sizing";
|
|
23
|
-
import UiTypography, {
|
|
29
|
+
import UiTypography, { ETextWeight } from "../ui-typography";
|
|
24
30
|
|
|
25
31
|
defineProps<{
|
|
26
32
|
icon?: TIconName;
|
|
33
|
+
title?: string;
|
|
27
34
|
}>();
|
|
28
35
|
|
|
29
36
|
</script>
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
>
|
|
14
14
|
<select
|
|
15
15
|
v-model="localModel"
|
|
16
|
-
class="appearance-none bg-transparent border-0 m-0 outline-0 w-full p-sm cursor-pointer italic text-secondary-alt"
|
|
16
|
+
class="appearance-none absolute bg-transparent border-0 m-0 outline-0 w-full p-sm cursor-pointer italic text-secondary-alt"
|
|
17
17
|
@change=" $emit('update:value', ($event.target as HTMLTextAreaElement)?.value)"
|
|
18
18
|
>
|
|
19
19
|
<option
|
|
@@ -37,7 +37,7 @@ const Template: Story<TComponentProps> = (args) => ({
|
|
|
37
37
|
return { args, modelValue };
|
|
38
38
|
},
|
|
39
39
|
template: `
|
|
40
|
-
<ui-toggle v-bind="args" v-model
|
|
40
|
+
<ui-toggle v-bind="args" v-model="modelValue" header="Header" :title="args.slot" />
|
|
41
41
|
`,
|
|
42
42
|
});
|
|
43
43
|
|
|
@@ -21,10 +21,10 @@
|
|
|
21
21
|
class="ui-input__input-wrapper block relative h-md"
|
|
22
22
|
>
|
|
23
23
|
<input
|
|
24
|
+
v-model="checkboxModel"
|
|
24
25
|
type="checkbox"
|
|
25
26
|
class="appearance-none absolute w-0 h-0 border-0"
|
|
26
|
-
:
|
|
27
|
-
@input="$emit('update:modelValue', !!($event.target as HTMLInputElement)?.value)"
|
|
27
|
+
:value="value"
|
|
28
28
|
>
|
|
29
29
|
|
|
30
30
|
<span class="ui-toggle__bg-block w-lg h-md bg-secondary-alt block rounded-full" />
|
|
@@ -60,19 +60,30 @@
|
|
|
60
60
|
|
|
61
61
|
<script lang="ts" setup>
|
|
62
62
|
import UiTypography, { ETypographySizes, ETextWeight } from "../ui-typography";
|
|
63
|
+
import { computed } from "vue";
|
|
63
64
|
|
|
64
|
-
defineProps<{
|
|
65
|
+
const props = defineProps<{
|
|
65
66
|
header?: string;
|
|
66
67
|
title?: string;
|
|
67
|
-
modelValue: boolean;
|
|
68
|
+
modelValue: boolean | unknown[];
|
|
68
69
|
disabled?: boolean;
|
|
69
70
|
invertOrder?: boolean;
|
|
70
71
|
alignCenter?: boolean;
|
|
72
|
+
value?: string;
|
|
71
73
|
}>();
|
|
72
74
|
|
|
73
|
-
defineEmits<{
|
|
74
|
-
(e: "update:modelValue", state:
|
|
75
|
+
const emit = defineEmits<{
|
|
76
|
+
(e: "update:modelValue", state: unknown): void
|
|
75
77
|
}>();
|
|
78
|
+
|
|
79
|
+
const checkboxModel = computed({
|
|
80
|
+
get() {
|
|
81
|
+
return props.modelValue;
|
|
82
|
+
},
|
|
83
|
+
set(value) {
|
|
84
|
+
emit("update:modelValue", value);
|
|
85
|
+
}
|
|
86
|
+
});
|
|
76
87
|
</script>
|
|
77
88
|
|
|
78
89
|
<style scoped>
|
package/src/main.css
CHANGED