bonkers-ui 1.0.1 → 1.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/.eslintrc.js +2 -1
- package/.husky/pre-commit +1 -0
- package/.storybook/preview.js +17 -1
- package/.stylelintrc +24 -22
- package/README.md +1 -1
- package/package.json +15 -7
- package/postcss.config.js +1 -1
- package/src/_colors.json +66 -5
- package/src/_font-sizes.json +10 -1
- package/src/_samples/check-icon.vue +22 -0
- package/src/_samples/icon.vue +19 -0
- package/src/_shadow.json +4 -0
- package/src/_spacing.json +9 -0
- package/src/_styles/colors.css +70 -0
- package/src/_styles/font-sizes.css +15 -0
- package/src/_styles/shadow.css +7 -0
- package/src/_styles/spacing.css +12 -0
- package/src/_types/align.ts +8 -0
- package/src/_types/colors.ts +58 -0
- package/src/_types/sizing.ts +9 -0
- package/src/components/ui-button/_typings.ts +5 -0
- package/src/components/ui-button/index.ts +2 -3
- package/src/components/ui-button/ui-button.stories.ts +58 -10
- package/src/components/ui-button/ui-button.test.ts +6 -6
- package/src/components/ui-button/ui-button.vue +29 -12
- package/src/components/ui-card-cta/index.ts +1 -0
- package/src/components/ui-card-cta/ui-card-cta.stories.ts +62 -0
- package/src/components/ui-card-cta/ui-card-cta.vue +85 -0
- package/src/components/ui-card-simple/index.ts +1 -0
- package/src/components/ui-card-simple/ui-card-simple.stories.ts +41 -0
- package/src/components/ui-card-simple/ui-card-simple.vue +35 -0
- package/src/components/ui-checkbox/intext.ts +1 -0
- package/src/components/ui-checkbox/ui-checkbox.stories.ts +62 -0
- package/src/components/ui-checkbox/ui-checkbox.vue +152 -0
- package/src/components/ui-icon/_typings.ts +3 -0
- package/src/components/ui-icon/index.ts +2 -0
- package/src/components/ui-icon/ui-icon.stories.ts +46 -0
- package/src/components/ui-icon/ui-icon.vue +29 -0
- package/src/components/ui-input/_typings.ts +6 -0
- package/src/components/ui-input/index.ts +1 -0
- package/src/components/ui-input/ui-input.stories.ts +90 -0
- package/src/components/ui-input/ui-input.vue +45 -0
- package/src/components/ui-radio/index.ts +1 -0
- package/src/components/ui-radio/ui-radio.stories.ts +62 -0
- package/src/components/ui-radio/ui-radio.vue +71 -0
- package/src/components/ui-radio-list-fancy/index.ts +1 -0
- package/src/components/ui-radio-list-fancy/ui-radio-item/index.ts +1 -0
- package/src/components/ui-radio-list-fancy/ui-radio-item/ui-radio-item.vue +66 -0
- package/src/components/ui-radio-list-fancy/ui-radio-list-fancy.stories.ts +38 -0
- package/src/components/ui-radio-list-fancy/ui-radio-list-fancy.vue +60 -0
- package/src/components/ui-ripple/index.ts +1 -0
- package/src/components/ui-ripple/ui-ripple.stories.ts +59 -0
- package/src/components/ui-ripple/ui-ripple.vue +88 -0
- package/src/components/ui-typography/_typings.ts +56 -0
- package/src/components/ui-typography/index.ts +2 -0
- package/src/components/ui-typography/ui-typography.stories.ts +80 -0
- package/src/components/ui-typography/ui-typography.vue +117 -0
- package/src/components/ui-verification-input/index.ts +1 -0
- package/src/components/ui-verification-input/ui-verification-input.stories.ts +46 -0
- package/src/components/ui-verification-input/ui-verification-input.vue +128 -0
- package/src/main.css +7 -12
- package/src/stories/assets/code-brackets.svg +1 -1
- package/src/stories/colors/colors.stories.ts +1 -1
- package/src/stories/colors/ui-colors.vue +78 -24
- package/src/stories/helper.ts +5 -0
- package/src/stories/spacings/spacings.stories.ts +13 -0
- package/src/stories/spacings/ui-spacings.vue +50 -0
- package/tailwind.config.js +5 -1
- package/tsconfig.json +6 -7
- package/vite.config.ts +4 -7
- package/src/assets/logo.png +0 -0
|
@@ -1,28 +1,45 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<button
|
|
3
|
-
class="text-base text-white rounded-md"
|
|
3
|
+
class="text-base text-white rounded-md whitespace-nowrap font-bold leading-none"
|
|
4
|
+
:disabled="disabled"
|
|
4
5
|
:class="[
|
|
5
|
-
(!kind || kind === EButtonTypes.PRIMARY) && '
|
|
6
|
-
kind === EButtonTypes.SECONDARY && 'bg-secondary',
|
|
7
|
-
kind === EButtonTypes.WARNING && 'bg-warning',
|
|
8
|
-
kind === EButtonTypes.ERROR && 'bg-error',
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
6
|
+
(!kind || kind === EButtonTypes.PRIMARY) && [primaryColor, primaryColorHover, primaryColorActive].join(' '),
|
|
7
|
+
kind === EButtonTypes.SECONDARY && 'bg-secondary hover:bg-secondary-600 active:bg-secondary-700 disabled:bg-secondary-300',
|
|
8
|
+
kind === EButtonTypes.WARNING && 'bg-warning hover:bg-warning-600 active:bg-warning-700 disabled:bg-warning-300',
|
|
9
|
+
kind === EButtonTypes.ERROR && 'bg-error hover:bg-error-600 active:bg-error-700 disabled:bg-error-300',
|
|
10
|
+
kind === EButtonTypes.PRIMARY_OVERLAY
|
|
11
|
+
&& 'text-primary border border-primary hover:bg-primary-600 hover:border-transparent hover:text-white active:bg-primary-700 active:border-transparent active:text-white disabled:text-primary-300 disabled:border-primary-300',
|
|
12
|
+
kind === EButtonTypes.SECONDARY_OVERLAY
|
|
13
|
+
&& 'text-secondary border border-secondary hover:bg-secondary-600 hover:border-transparent hover:text-white active:bg-secondary-700 active:border-transparent active:text-white disabled:text-secondary-300 disabled:border-secondary-300',
|
|
14
|
+
kind === EButtonTypes.WARNING_OVERLAY
|
|
15
|
+
&& 'text-warning border border-warning hover:bg-warning-600 hover:border-transparent hover:text-white active:bg-warning-700 active:border-transparent active:text-white disabled:text-warning-300 disabled:border-warning-300',
|
|
16
|
+
kind === EButtonTypes.ERROR_OVERLAY
|
|
17
|
+
&& 'text-error border border-error hover:bg-error-600 hover:border-transparent hover:text-white active:bg-error-700 active:border-transparent active:text-white disabled:text-error-300 disabled:border-error-300',
|
|
18
|
+
kind === EButtonTypes.LINK && 'text-accent-alt hover:text-accent-alt-600 active:text-accent-alt-700 disabled:text-accent-alt-300',
|
|
19
|
+
(!size || size === EButtonSizes.MEDIUM) && 'py-sm px-md',
|
|
20
|
+
size === EButtonSizes.SMALL && 'py-xs px-md',
|
|
21
|
+
size === EButtonSizes.LARGE && 'py-md px-md',
|
|
22
|
+
fullWidth && 'w-full',
|
|
23
|
+
disabled && 'pointer-events-none',
|
|
24
|
+
className
|
|
12
25
|
]"
|
|
13
26
|
>
|
|
14
|
-
{{ kind }}
|
|
15
27
|
<slot />
|
|
16
28
|
</button>
|
|
17
29
|
</template>
|
|
18
30
|
|
|
19
31
|
<script lang="ts" setup>
|
|
20
32
|
import { EButtonSizes, EButtonTypes } from "./_typings";
|
|
21
|
-
|
|
22
33
|
type TProps = {
|
|
23
|
-
|
|
34
|
+
className?: string;
|
|
24
35
|
kind?: EButtonTypes;
|
|
25
|
-
size?: EButtonSizes
|
|
36
|
+
size?: EButtonSizes;
|
|
37
|
+
fullWidth?: boolean;
|
|
38
|
+
disabled?: boolean;
|
|
26
39
|
}
|
|
40
|
+
|
|
41
|
+
const primaryColor = "bg-primary disabled:bg-primary-300";
|
|
42
|
+
const primaryColorHover = "hover:bg-primary-600 ";
|
|
43
|
+
const primaryColorActive = "active:bg-primary-700 ";
|
|
27
44
|
defineProps<TProps>();
|
|
28
45
|
</script>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "./ui-card-cta.vue";
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import UiCardCta from "./ui-card-cta.vue";
|
|
2
|
+
import UiIcon from "../ui-icon";
|
|
3
|
+
import { ESize } from "../../_types/sizing";
|
|
4
|
+
import UiTypography from "../ui-typography";
|
|
5
|
+
import { Story } from "@storybook/vue3";
|
|
6
|
+
|
|
7
|
+
export default {
|
|
8
|
+
title: "Components/ui-card-cta",
|
|
9
|
+
component: UiCardCta,
|
|
10
|
+
// More on argTypes: https://storybook.js.org/docs/vue/api/argtypes
|
|
11
|
+
argTypes: {
|
|
12
|
+
className: {
|
|
13
|
+
control: { type: "text" },
|
|
14
|
+
description: "The Element classes",
|
|
15
|
+
},
|
|
16
|
+
|
|
17
|
+
invertOrder: {
|
|
18
|
+
control: { type: "boolean" },
|
|
19
|
+
description: "The Element order",
|
|
20
|
+
},
|
|
21
|
+
fullWidth: {
|
|
22
|
+
control: { type: "boolean" },
|
|
23
|
+
description: "The full width size",
|
|
24
|
+
},
|
|
25
|
+
disabled: {
|
|
26
|
+
control: { type: "boolean" },
|
|
27
|
+
description: "The full width size",
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
args: {
|
|
31
|
+
slot: "Description",
|
|
32
|
+
invertOrder: false,
|
|
33
|
+
fullWidth: false,
|
|
34
|
+
disabled: false
|
|
35
|
+
},
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
type TComponentProps = InstanceType<typeof UiCardCta>["$props"];
|
|
39
|
+
|
|
40
|
+
const Template: Story<TComponentProps> = (args) => ({
|
|
41
|
+
components: { UiCardCta, UiIcon, UiTypography },
|
|
42
|
+
setup() {
|
|
43
|
+
return { args, ESize };
|
|
44
|
+
},
|
|
45
|
+
template: `
|
|
46
|
+
<ui-card-cta v-bind="args">
|
|
47
|
+
<template v-slot:icon>
|
|
48
|
+
<ui-icon :size="ESize.MD" has-wrapper class-name="text-white" :icon-name="['fas', 'fa-user-secret']" />
|
|
49
|
+
</template>
|
|
50
|
+
|
|
51
|
+
<template v-slot:title>
|
|
52
|
+
Title
|
|
53
|
+
</template>
|
|
54
|
+
|
|
55
|
+
<template v-slot:description>
|
|
56
|
+
{{args.slot}}
|
|
57
|
+
</template>
|
|
58
|
+
</ui-card-cta>
|
|
59
|
+
`
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
export const Default = Template.bind({});
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<button
|
|
3
|
+
class="ui-card-cta outline-0 border border-secondary-alt-500 rounded-2xl p-sm shadow-m hover:border-secondary-700 focus:shadow-border-primary active:bg-secondary-alt-200 disabled:bg-secondary-alt-200"
|
|
4
|
+
:disabled="disabled"
|
|
5
|
+
:class="[!fullWidth && 'ui-card-cta_cropped', className]"
|
|
6
|
+
>
|
|
7
|
+
<span
|
|
8
|
+
class="ui-card-cta__wrapper grid gap-sm items-center"
|
|
9
|
+
:class="[
|
|
10
|
+
invertOrder && 'ui-card-cta_inverted',
|
|
11
|
+
]"
|
|
12
|
+
>
|
|
13
|
+
<slot name="icon" />
|
|
14
|
+
<span
|
|
15
|
+
v-if="slots.title && slots.description"
|
|
16
|
+
class="ui-card-cta__text-wrapper"
|
|
17
|
+
:class="invertOrder && 'order-first'"
|
|
18
|
+
>
|
|
19
|
+
<ui-typography
|
|
20
|
+
:kind="EColors.SECONDARY"
|
|
21
|
+
:weight="ETextWeight.SEMI_BOLD"
|
|
22
|
+
class-name="mb-xxs"
|
|
23
|
+
>
|
|
24
|
+
<slot name="title" />
|
|
25
|
+
</ui-typography>
|
|
26
|
+
|
|
27
|
+
<ui-typography
|
|
28
|
+
:kind="EColors.SECONDARY_300"
|
|
29
|
+
:size="ETypographySizes.SM"
|
|
30
|
+
>
|
|
31
|
+
<slot name="description" />
|
|
32
|
+
</ui-typography>
|
|
33
|
+
</span>
|
|
34
|
+
</span>
|
|
35
|
+
</button>
|
|
36
|
+
</template>
|
|
37
|
+
|
|
38
|
+
<script lang="ts" setup>
|
|
39
|
+
import { useSlots } from "vue";
|
|
40
|
+
import UiTypography from "../ui-typography";
|
|
41
|
+
import { ETypographyColors, ETypographySizes, ETextWeight } from "../ui-typography/_typings";
|
|
42
|
+
import { EColors } from "../../_types/colors";
|
|
43
|
+
|
|
44
|
+
const slots = useSlots();
|
|
45
|
+
|
|
46
|
+
defineProps<{
|
|
47
|
+
className?: string;
|
|
48
|
+
invertOrder?: boolean;
|
|
49
|
+
fullWidth?: boolean;
|
|
50
|
+
disabled?: boolean;
|
|
51
|
+
}>();
|
|
52
|
+
|
|
53
|
+
</script>
|
|
54
|
+
|
|
55
|
+
<style scoped>
|
|
56
|
+
.ui-card-cta {
|
|
57
|
+
text-align: unset;
|
|
58
|
+
width: 100%;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.ui-card-cta:disabled {
|
|
62
|
+
pointer-events: none;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.ui-card-cta__wrapper {
|
|
66
|
+
grid-template-columns: auto 1fr;
|
|
67
|
+
width: 100%;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.ui-card-cta:disabled .ui-card-cta__wrapper {
|
|
71
|
+
opacity: 0.5;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.ui-card-cta__text-wrapper {
|
|
75
|
+
width: 100%;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.ui-card-cta_cropped {
|
|
79
|
+
max-width: 382px;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.ui-card-cta_inverted {
|
|
83
|
+
grid-template-columns: 1fr auto;
|
|
84
|
+
}
|
|
85
|
+
</style>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "./ui-card-simple.vue";
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import UiCardSimple from "./ui-card-simple.vue";
|
|
2
|
+
import { Story } from "@storybook/vue3";
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
title: "Components/ui-card-simple",
|
|
6
|
+
component: UiCardSimple,
|
|
7
|
+
argTypes: {
|
|
8
|
+
className: {
|
|
9
|
+
control: { type: "text" },
|
|
10
|
+
description: "The Element classes",
|
|
11
|
+
},
|
|
12
|
+
|
|
13
|
+
},
|
|
14
|
+
args: {
|
|
15
|
+
slot: "Lorem ipsum dolor sit amet, consectetur adipiscing elit.",
|
|
16
|
+
},
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
type TComponentProps = InstanceType<typeof UiCardSimple>["$props"];
|
|
20
|
+
|
|
21
|
+
const Template: Story<TComponentProps> = (args) => ({
|
|
22
|
+
components: { UiCardSimple },
|
|
23
|
+
setup() {
|
|
24
|
+
return { args };
|
|
25
|
+
},
|
|
26
|
+
template: `
|
|
27
|
+
<ui-card-simple>
|
|
28
|
+
<template v-slot:title>
|
|
29
|
+
I want to borrow for
|
|
30
|
+
</template>
|
|
31
|
+
<p class="mb-md text-center">
|
|
32
|
+
{{args.slot}}
|
|
33
|
+
</p>
|
|
34
|
+
<template v-slot:footerSubtitle>
|
|
35
|
+
Type in or adjust the amount
|
|
36
|
+
</template>
|
|
37
|
+
</ui-card-simple>
|
|
38
|
+
`,
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
export const Default = Template.bind({});
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
class="ui-card-simple rounded-3xl shadow-m py-md px-sm"
|
|
4
|
+
:class="className"
|
|
5
|
+
>
|
|
6
|
+
<ui-typography
|
|
7
|
+
v-if="slots.title"
|
|
8
|
+
:weight="ETextWeight.BOLD"
|
|
9
|
+
:align="ETextAlign.CENTER"
|
|
10
|
+
class="pb-md"
|
|
11
|
+
>
|
|
12
|
+
<slot name="title" />
|
|
13
|
+
</ui-typography>
|
|
14
|
+
|
|
15
|
+
<slot />
|
|
16
|
+
|
|
17
|
+
<ui-typography
|
|
18
|
+
v-if="slots.footerSubtitle"
|
|
19
|
+
:align="ETextAlign.CENTER"
|
|
20
|
+
>
|
|
21
|
+
<slot name="footerSubtitle" />
|
|
22
|
+
</ui-typography>
|
|
23
|
+
</div>
|
|
24
|
+
</template>
|
|
25
|
+
|
|
26
|
+
<script lang="ts" setup>
|
|
27
|
+
import UiTypography, { ETextWeight, ETextAlign } from "../ui-typography";
|
|
28
|
+
import { useSlots } from "vue";
|
|
29
|
+
|
|
30
|
+
const slots = useSlots();
|
|
31
|
+
|
|
32
|
+
defineProps<{
|
|
33
|
+
className? : string;
|
|
34
|
+
}>();
|
|
35
|
+
</script>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "./ui-checkbox.vue";
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import UiCheckbox from "./ui-checkbox.vue";
|
|
2
|
+
import { Story } from "@storybook/vue3";
|
|
3
|
+
import { ref } from "vue";
|
|
4
|
+
import { EJustify } from "../../_types/align";
|
|
5
|
+
|
|
6
|
+
export default {
|
|
7
|
+
title: "Components/ui-checkbox",
|
|
8
|
+
component: UiCheckbox,
|
|
9
|
+
// More on argTypes: https://storybook.js.org/docs/vue/api/argtypes
|
|
10
|
+
argTypes: {
|
|
11
|
+
className: {
|
|
12
|
+
control: { type: "text" },
|
|
13
|
+
description: "The Element classes",
|
|
14
|
+
},
|
|
15
|
+
justify: {
|
|
16
|
+
control: { type: "select" },
|
|
17
|
+
options: Object.values(EJustify),
|
|
18
|
+
description: "The Element justify",
|
|
19
|
+
},
|
|
20
|
+
invertOrder: {
|
|
21
|
+
control: { type: "boolean" },
|
|
22
|
+
description: "The Element order",
|
|
23
|
+
},
|
|
24
|
+
disabled: {
|
|
25
|
+
control: { type: "boolean" },
|
|
26
|
+
description: "The Element disabled state",
|
|
27
|
+
},
|
|
28
|
+
modelValue: {
|
|
29
|
+
control: { type: "boolean" },
|
|
30
|
+
description: "The Element disabled state",
|
|
31
|
+
},
|
|
32
|
+
|
|
33
|
+
},
|
|
34
|
+
args: {
|
|
35
|
+
slot: "Some text",
|
|
36
|
+
justify: EJustify.START,
|
|
37
|
+
invertOrder: false,
|
|
38
|
+
disabled: false,
|
|
39
|
+
modelValue: false,
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
type TComponentProps = InstanceType<typeof UiCheckbox>["$props"];
|
|
44
|
+
|
|
45
|
+
const Template: Story<TComponentProps> = (args) => ({
|
|
46
|
+
// Components used in your story `template` are defined in the `components` object
|
|
47
|
+
components: { UiCheckbox },
|
|
48
|
+
// The story's `args` need to be mapped into the template through the `setup()` method
|
|
49
|
+
setup() {
|
|
50
|
+
const modelValue = ref(true);
|
|
51
|
+
|
|
52
|
+
return { args, modelValue };
|
|
53
|
+
},
|
|
54
|
+
// And then the `args` are bound to your component with `v-bind="args"`
|
|
55
|
+
template: `
|
|
56
|
+
<ui-checkbox v-bind="args" v-model:modelValue="args.modelValue">
|
|
57
|
+
${args.slot}
|
|
58
|
+
</ui-checkbox>
|
|
59
|
+
`,
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
export const Default = Template.bind({});
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<label
|
|
3
|
+
class="ui-checkbox grid cursor-pointer"
|
|
4
|
+
:class="[
|
|
5
|
+
slots.default && 'items-center gap-sm',
|
|
6
|
+
(!justify || justify === EJustify.START) && 'justify-start',
|
|
7
|
+
justify === EJustify.END && 'justify-end',
|
|
8
|
+
justify === EJustify.AROUND && 'justify-around',
|
|
9
|
+
justify === EJustify.BETWEEN && 'justify-between',
|
|
10
|
+
justify === EJustify.EVENLY && 'justify-evenly',
|
|
11
|
+
justify === EJustify.CENTER && 'justify-center',
|
|
12
|
+
disabled && 'ui-checkbox_disabled',
|
|
13
|
+
className
|
|
14
|
+
]"
|
|
15
|
+
>
|
|
16
|
+
<input
|
|
17
|
+
:checked="modelValue"
|
|
18
|
+
class="appearance-none absolute"
|
|
19
|
+
type="checkbox"
|
|
20
|
+
:disabled="disabled"
|
|
21
|
+
@input="$emit('update:modelValue', !!($event.target as HTMLInputElement)?.value)"
|
|
22
|
+
>
|
|
23
|
+
<span
|
|
24
|
+
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"
|
|
25
|
+
:class="invertOrder && 'order-last'"
|
|
26
|
+
>
|
|
27
|
+
<svg
|
|
28
|
+
class="ui-checkbox__icon text-white"
|
|
29
|
+
width="16"
|
|
30
|
+
height="12"
|
|
31
|
+
viewBox="0 0 16 12"
|
|
32
|
+
fill="none"
|
|
33
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
34
|
+
>
|
|
35
|
+
<path
|
|
36
|
+
d="M1 4.40106L6.60071 10.1135L15.1694 1.71245"
|
|
37
|
+
stroke="currentColor"
|
|
38
|
+
stroke-width="1.6"
|
|
39
|
+
stroke-linecap="round"
|
|
40
|
+
/>
|
|
41
|
+
</svg>
|
|
42
|
+
|
|
43
|
+
</span>
|
|
44
|
+
<span
|
|
45
|
+
v-if="slots.default"
|
|
46
|
+
class="ui-checkbox__slot-wrapper"
|
|
47
|
+
>
|
|
48
|
+
<slot />
|
|
49
|
+
</span>
|
|
50
|
+
</label>
|
|
51
|
+
</template>
|
|
52
|
+
|
|
53
|
+
<script lang="ts" setup>
|
|
54
|
+
import { useSlots } from "vue";
|
|
55
|
+
import { EJustify } from "../../_types/align";
|
|
56
|
+
|
|
57
|
+
const slots = useSlots();
|
|
58
|
+
|
|
59
|
+
defineProps<{
|
|
60
|
+
modelValue: boolean;
|
|
61
|
+
className?: string;
|
|
62
|
+
justify?: EJustify;
|
|
63
|
+
invertOrder?: boolean;
|
|
64
|
+
disabled?: boolean;
|
|
65
|
+
}>();
|
|
66
|
+
|
|
67
|
+
defineEmits<{
|
|
68
|
+
(e: "update:modelValue", state: boolean): void
|
|
69
|
+
}>();
|
|
70
|
+
</script>
|
|
71
|
+
|
|
72
|
+
<style scoped>
|
|
73
|
+
.ui-checkbox {
|
|
74
|
+
grid-template-columns: auto auto;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.ui-checkbox_custom {
|
|
78
|
+
transition: background-color ease-in-out 0.3s 0.3s, border-width ease-in-out 0.2s;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.ui-checkbox__icon {
|
|
82
|
+
stroke-dasharray: 70;
|
|
83
|
+
stroke-dashoffset: 70;
|
|
84
|
+
transition: stroke-dashoffset 0.3s ease-in-out;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
input + .ui-checkbox_custom:active {
|
|
88
|
+
transition: background-color ease-in-out 0.1s;
|
|
89
|
+
background-color: var(--color-secondary-alt-200);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
input + .ui-checkbox_custom:active,
|
|
93
|
+
input:focus + .ui-checkbox_custom {
|
|
94
|
+
box-shadow: var(--shadow-border-primary);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
input:disabled + .ui-checkbox_custom {
|
|
98
|
+
background-color: var(--color-secondary-alt-200);
|
|
99
|
+
border-color: var(--color-secondary-alt-400);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
input:checked + .ui-checkbox_custom .ui-checkbox__icon {
|
|
103
|
+
stroke-dashoffset: 0;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
input:checked + .ui-checkbox_custom > svg {
|
|
107
|
+
opacity: 1;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
input:checked + .ui-checkbox_custom {
|
|
111
|
+
border-width: 0;
|
|
112
|
+
background-color: var(--color-primary);
|
|
113
|
+
transition: background-color ease-in-out 0.1s, border-width ease-in-out 0.1s, box-shadow ease-in-out 0.2s;
|
|
114
|
+
animation: cb-pop 0.5s ease-in-out;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
input:checked + .ui-checkbox_custom:hover {
|
|
118
|
+
background-color: var(--color-primary-600);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
input:checked + .ui-checkbox_custom:active {
|
|
122
|
+
background-color: var(--color-primary-700);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
input:checked:disabled + .ui-checkbox_custom {
|
|
126
|
+
background-color: var(--color-primary-300);
|
|
127
|
+
border: 1px solid var(--color-primary-400);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
.ui-checkbox_disabled {
|
|
131
|
+
pointer-events: none;
|
|
132
|
+
cursor: default;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
@keyframes cb-pop {
|
|
136
|
+
0% {
|
|
137
|
+
transform: scale(1);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
33% {
|
|
141
|
+
transform: scale(0.95);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
66% {
|
|
145
|
+
transform: scale(1.05);
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
100% {
|
|
149
|
+
transform: scale(1);
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
</style>
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import UiIcon from "./ui-icon.vue";
|
|
2
|
+
import { Story } from "@storybook/vue3";
|
|
3
|
+
import { ESize } from "../../_types/sizing";
|
|
4
|
+
|
|
5
|
+
export default {
|
|
6
|
+
title: "Components/ui-icon",
|
|
7
|
+
component: UiIcon,
|
|
8
|
+
// More on argTypes: https://storybook.js.org/docs/vue/api/argtypes
|
|
9
|
+
argTypes: {
|
|
10
|
+
className: {
|
|
11
|
+
control: { type: "text" },
|
|
12
|
+
description: "The Element classes",
|
|
13
|
+
},
|
|
14
|
+
hasWrapper:{
|
|
15
|
+
control: { type: "boolean" },
|
|
16
|
+
description: "The Icon show wrapper",
|
|
17
|
+
},
|
|
18
|
+
size: {
|
|
19
|
+
control: { type: "select" },
|
|
20
|
+
options: Object.values(ESize),
|
|
21
|
+
description: "The Element size",
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
},
|
|
25
|
+
args: {
|
|
26
|
+
size: ESize.LG,
|
|
27
|
+
hasWrapper: false,
|
|
28
|
+
},
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
type TComponentProps = InstanceType<typeof UiIcon>["$props"];
|
|
32
|
+
|
|
33
|
+
const Template: Story<TComponentProps> = (args) => ({
|
|
34
|
+
// Components used in your story `template` are defined in the `components` object
|
|
35
|
+
components: { UiIcon },
|
|
36
|
+
// The story's `args` need to be mapped into the template through the `setup()` method
|
|
37
|
+
setup() {
|
|
38
|
+
return { args };
|
|
39
|
+
},
|
|
40
|
+
// And then the `args` are bound to your component with `v-bind="args"`
|
|
41
|
+
template: `
|
|
42
|
+
<ui-icon v-bind="args" :icon-name="['fas', 'fa-user-secret']" />
|
|
43
|
+
`,
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
export const Default = Template.bind({});
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<font-awesome-icon
|
|
3
|
+
class="ui-icon"
|
|
4
|
+
:icon="iconName"
|
|
5
|
+
:class="[
|
|
6
|
+
size === ESize.XXS && 'h-xxs w-xxs',
|
|
7
|
+
size === ESize.XS && 'h-xs w-xs',
|
|
8
|
+
size === ESize.SM && 'h-sm w-sm',
|
|
9
|
+
size === ESize.MD && 'h-md w-md',
|
|
10
|
+
size === ESize.LG && 'h-lg w-lg',
|
|
11
|
+
size === ESize.XL && 'h-xl w-xl',
|
|
12
|
+
size === ESize.XXL && 'h-xxl w-xxl',
|
|
13
|
+
hasWrapper && 'p-sm bg-primary rounded-2xl',
|
|
14
|
+
className
|
|
15
|
+
]"
|
|
16
|
+
/>
|
|
17
|
+
</template>
|
|
18
|
+
|
|
19
|
+
<script lang="ts" setup>
|
|
20
|
+
import { ESize } from "../../_types/sizing";
|
|
21
|
+
import type { TIconName } from "./_typings";
|
|
22
|
+
|
|
23
|
+
defineProps<{
|
|
24
|
+
className?: string;
|
|
25
|
+
hasWrapper?: boolean;
|
|
26
|
+
size: ESize;
|
|
27
|
+
iconName: TIconName;
|
|
28
|
+
}>();
|
|
29
|
+
</script>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default, } from "./ui-input.vue";
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { Story } from "@storybook/vue3";
|
|
2
|
+
import UiInput from "./ui-input.vue";
|
|
3
|
+
import Icon from "../../_samples/icon.vue";
|
|
4
|
+
import { ref } from "vue";
|
|
5
|
+
import { EInputTypes } from "./_typings";
|
|
6
|
+
|
|
7
|
+
export default {
|
|
8
|
+
title: "Components/ui-input",
|
|
9
|
+
component: UiInput,
|
|
10
|
+
// More on argTypes: https://storybook.js.org/docs/vue/api/argtypes
|
|
11
|
+
argTypes: {
|
|
12
|
+
className: {
|
|
13
|
+
control: { type: "text" },
|
|
14
|
+
description: "Custom class",
|
|
15
|
+
},
|
|
16
|
+
placeholder: {
|
|
17
|
+
control: { type: "text" },
|
|
18
|
+
description: "Placeholder",
|
|
19
|
+
},
|
|
20
|
+
kind: {
|
|
21
|
+
control: { type: "select" },
|
|
22
|
+
options: Object.values(EInputTypes),
|
|
23
|
+
description: "The input kinds",
|
|
24
|
+
},
|
|
25
|
+
fullWidth: {
|
|
26
|
+
control: { type: "boolean" },
|
|
27
|
+
description: "The full width size",
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
args: {
|
|
31
|
+
placeholder: "Placeholder",
|
|
32
|
+
fullWidth: false
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
type MyComponentProps = InstanceType<typeof UiInput>["$props"];
|
|
37
|
+
|
|
38
|
+
const Template: Story<MyComponentProps> = (args: MyComponentProps) => ({
|
|
39
|
+
components:{
|
|
40
|
+
UiInput
|
|
41
|
+
},
|
|
42
|
+
setup(){
|
|
43
|
+
const valueModel = ref("");
|
|
44
|
+
return{
|
|
45
|
+
args,
|
|
46
|
+
valueModel
|
|
47
|
+
};
|
|
48
|
+
},
|
|
49
|
+
template: `
|
|
50
|
+
<ui-input v-bind="args" v-model="valueModel" />
|
|
51
|
+
`
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
const TemplateAll: Story<MyComponentProps> = (args: MyComponentProps) => ({
|
|
55
|
+
components:{
|
|
56
|
+
UiInput,
|
|
57
|
+
Icon
|
|
58
|
+
},
|
|
59
|
+
setup(){
|
|
60
|
+
const valueModel = ref("");
|
|
61
|
+
|
|
62
|
+
return{
|
|
63
|
+
args,
|
|
64
|
+
valueModel
|
|
65
|
+
};
|
|
66
|
+
},
|
|
67
|
+
template: `
|
|
68
|
+
<div :style="{
|
|
69
|
+
display: 'grid',
|
|
70
|
+
gridGap: '12px'
|
|
71
|
+
}">
|
|
72
|
+
<ui-input v-bind="args" v-model="valueModel">
|
|
73
|
+
<template v-slot:prefix-icon> € </template>
|
|
74
|
+
</ui-input>
|
|
75
|
+
<ui-input v-bind="args" v-model="valueModel">
|
|
76
|
+
<template v-slot:prefix-icon>
|
|
77
|
+
<icon :size="16" />
|
|
78
|
+
</template>
|
|
79
|
+
</ui-input>
|
|
80
|
+
<ui-input v-bind="args" v-model="valueModel">
|
|
81
|
+
<template v-slot:postfix-icon>
|
|
82
|
+
<icon :size="16" />
|
|
83
|
+
</template>
|
|
84
|
+
</ui-input>
|
|
85
|
+
</div>
|
|
86
|
+
`
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
export const Default = Template.bind({});
|
|
90
|
+
export const AllInputs = TemplateAll.bind({});
|