bonkers-ui 1.0.17 → 1.0.19
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 +28 -25
- package/src/_styles/classTypes/_spacing.json +2 -0
- package/src/_styles/variables/spacing.css +2 -0
- package/src/components/ui-alert/ui-alert.vue +1 -1
- package/src/components/ui-button/ui-button.test.ts +1 -1
- package/src/components/ui-card-cta/ui-card-cta.stories.ts +9 -6
- package/src/components/ui-card-cta/ui-card-cta.vue +6 -17
- package/src/components/ui-card-result/ui-card-result.stories.ts +3 -1
- package/src/components/ui-card-simple/ui-card-simple.stories.ts +2 -1
- package/src/components/ui-icon/index.ts +1 -0
- package/src/components/ui-icon/ui-icon.stories.ts +0 -5
- package/src/components/ui-icon/ui-icon.vue +0 -2
- package/src/components/ui-icon-wrapper/_typings.ts +10 -0
- package/src/components/ui-icon-wrapper/index.ts +1 -0
- package/src/components/ui-icon-wrapper/ui-icon-wrapper.stories.ts +57 -0
- package/src/components/ui-icon-wrapper/ui-icon-wrapper.vue +43 -0
- package/src/components/ui-input/ui-input.stories.ts +6 -5
- package/src/components/ui-input/ui-input.vue +7 -3
- package/src/components/ui-list-item/_types.ts +5 -0
- package/src/components/ui-list-item/index.ts +1 -0
- package/src/components/ui-list-item/ui-list-item.stories.ts +14 -16
- package/src/components/ui-list-item/ui-list-item.vue +40 -20
- package/src/components/ui-notification-badge/_types.ts +11 -0
- package/src/components/ui-notification-badge/index.ts +2 -0
- package/src/components/ui-notification-badge/ui-notification-badge.stories.ts +38 -0
- package/src/components/ui-notification-badge/ui-notification-badge.vue +28 -0
- package/src/components/ui-order-card/_types.ts +4 -0
- package/src/components/ui-order-card/index.ts +1 -0
- package/src/components/ui-order-card/ui-order-card.stories.ts +51 -0
- package/src/components/ui-order-card/ui-order-card.vue +83 -0
- package/src/components/ui-radio/ui-radio.vue +9 -9
- package/src/components/ui-radio-fancy/index.ts +1 -0
- package/src/components/ui-radio-fancy/ui-radio-fancy.stories.ts +32 -0
- package/src/components/ui-radio-fancy/ui-radio-fancy.vue +59 -0
- package/src/components/ui-select/ui-select.stories.ts +9 -2
- package/src/components/ui-select/ui-select.vue +12 -17
- package/src/components/ui-table/index.ts +4 -0
- package/src/components/ui-table/ui-table-cell/index.ts +1 -0
- package/src/components/ui-table/ui-table-cell/ui-table-cell.vue +33 -0
- package/src/components/ui-table/ui-table-row/_typings.ts +3 -0
- package/src/components/ui-table/ui-table-row/index.ts +2 -0
- package/src/components/ui-table/ui-table-row/ui-table-row.vue +31 -0
- package/src/components/ui-table/ui-table.stories.ts +83 -0
- package/src/components/ui-tabs/ui-tabs.vue +17 -15
- package/src/components/ui-typography/index.ts +1 -0
- package/src/components/ui-typography/ui-typography.vue +3 -3
- package/src/main.css +4 -4
- package/tailwind.config.js +8 -1
- package/src/components/ui-radio-list-fancy/index.ts +0 -1
- package/src/components/ui-radio-list-fancy/ui-radio-item/index.ts +0 -1
- package/src/components/ui-radio-list-fancy/ui-radio-item/ui-radio-item.vue +0 -65
- package/src/components/ui-radio-list-fancy/ui-radio-list-fancy.stories.ts +0 -32
- package/src/components/ui-radio-list-fancy/ui-radio-list-fancy.vue +0 -59
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import UiNotificationBadge from ".";
|
|
2
|
+
import type { Story } from "@storybook/vue3";
|
|
3
|
+
import { EBadgeOrigin } from "./_types";
|
|
4
|
+
|
|
5
|
+
export default {
|
|
6
|
+
title: "Components/ui-notification-badge",
|
|
7
|
+
component: UiNotificationBadge,
|
|
8
|
+
// More on argTypes: https://storybook.js.org/docs/vue/api/argtypes
|
|
9
|
+
argTypes: {
|
|
10
|
+
origin: {
|
|
11
|
+
control: { type: "select" },
|
|
12
|
+
options: Object.values(EBadgeOrigin),
|
|
13
|
+
description: "The Element origin",
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
args: {
|
|
17
|
+
slot: "1",
|
|
18
|
+
origin: EBadgeOrigin.OFFSET_TOP_RIGHT,
|
|
19
|
+
},
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
type TComponentProps = InstanceType<typeof UiNotificationBadge>["$props"];
|
|
23
|
+
|
|
24
|
+
const Template: Story<TComponentProps> = (args) => ({
|
|
25
|
+
components: { UiNotificationBadge },
|
|
26
|
+
setup() {
|
|
27
|
+
return { args };
|
|
28
|
+
},
|
|
29
|
+
template: /*html*/`
|
|
30
|
+
<div class="relative rounded-full bg-primary w-lg h-lg">
|
|
31
|
+
<ui-notification-badge :origin="args.origin">
|
|
32
|
+
{{args.slot}}
|
|
33
|
+
</ui-notification-badge>
|
|
34
|
+
</div>
|
|
35
|
+
`
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
export const Default = Template.bind({});
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
class="notification-badge absolute min-w-sm h-sm font-bold text-xxs rounded-full border border-white text-white bg-error text-center leading-none"
|
|
4
|
+
:class="[
|
|
5
|
+
origin === EBadgeOrigin.DEFAULT && 'top-0 right-0',
|
|
6
|
+
origin === EBadgeOrigin.OFFSET_TOP_RIGHT && '-top-xxs -right-xxs',
|
|
7
|
+
]"
|
|
8
|
+
>
|
|
9
|
+
<slot />
|
|
10
|
+
</div>
|
|
11
|
+
</template>
|
|
12
|
+
|
|
13
|
+
<script lang="ts" setup>
|
|
14
|
+
import { EBadgeOrigin } from "./_types";
|
|
15
|
+
|
|
16
|
+
withDefaults(defineProps<{
|
|
17
|
+
origin?: EBadgeOrigin,
|
|
18
|
+
}>(),{
|
|
19
|
+
origin: EBadgeOrigin.DEFAULT,
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
</script>
|
|
23
|
+
|
|
24
|
+
<style>
|
|
25
|
+
.notification-badge {
|
|
26
|
+
padding: 2px;
|
|
27
|
+
}
|
|
28
|
+
</style>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "./ui-order-card.vue";
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import UiOrderCard from "./ui-order-card.vue";
|
|
2
|
+
import type { Story } from "@storybook/vue3";
|
|
3
|
+
import { EOrderCardTypes } from "./_types";
|
|
4
|
+
|
|
5
|
+
export default {
|
|
6
|
+
title: "Components/ui-order-card",
|
|
7
|
+
component: UiOrderCard,
|
|
8
|
+
// More on argTypes: https://storybook.js.org/docs/vue/api/argtypes
|
|
9
|
+
argTypes: {
|
|
10
|
+
kind: {
|
|
11
|
+
control: { type: "select" },
|
|
12
|
+
options: Object.values(EOrderCardTypes),
|
|
13
|
+
description: "The Element kinds",
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
|
|
17
|
+
args: {
|
|
18
|
+
slot: "But we still need your gas and electricity meter readings before processing it.",
|
|
19
|
+
kind: EOrderCardTypes.DEFAULT
|
|
20
|
+
},
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
type TComponentProps = InstanceType<typeof UiOrderCard>["$props"];
|
|
24
|
+
|
|
25
|
+
const Template: Story<TComponentProps> = (args) => ({
|
|
26
|
+
components: { UiOrderCard },
|
|
27
|
+
setup() {
|
|
28
|
+
|
|
29
|
+
return { args };
|
|
30
|
+
},
|
|
31
|
+
|
|
32
|
+
template: /*html*/`
|
|
33
|
+
<ui-order-card v-bind="args" :iconName="['far', 'fa-face-smile']">
|
|
34
|
+
<template #title>
|
|
35
|
+
Thank you for your order!
|
|
36
|
+
</template>
|
|
37
|
+
|
|
38
|
+
<template #textBody>
|
|
39
|
+
{{args.slot}}
|
|
40
|
+
</template>
|
|
41
|
+
|
|
42
|
+
<template #footer>
|
|
43
|
+
We’ll send a confirmation email to william.moran@bonkers.ie
|
|
44
|
+
</template>
|
|
45
|
+
</ui-order-card>
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
`,
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
export const Default = Template.bind({});
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
class="ui-order-card relative text-center rounded-md pt-md mt-sm"
|
|
4
|
+
:class="[
|
|
5
|
+
kind === EOrderCardTypes.DEFAULT && 'text-white bg-primary-300',
|
|
6
|
+
kind === EOrderCardTypes.WARNING && 'bg-warning-300 text-warning-700'
|
|
7
|
+
]"
|
|
8
|
+
>
|
|
9
|
+
<ui-icon
|
|
10
|
+
:icon-name="iconName"
|
|
11
|
+
:size="ESize.LG"
|
|
12
|
+
class="absolute top-0 left-1/2 bg-primary-300 rounded-full -translate-x-1/2 -translate-y-1/2"
|
|
13
|
+
:class="[
|
|
14
|
+
kind === EOrderCardTypes.DEFAULT && 'text-white',
|
|
15
|
+
kind === EOrderCardTypes.WARNING && 'bg-warning-300 text-white'
|
|
16
|
+
]"
|
|
17
|
+
/>
|
|
18
|
+
<ui-typography
|
|
19
|
+
v-if="$slots.title"
|
|
20
|
+
class="pt-sm"
|
|
21
|
+
:class="[
|
|
22
|
+
kind === EOrderCardTypes.DEFAULT && 'text-primary-700',
|
|
23
|
+
kind === EOrderCardTypes.WARNING && 'text-warning-700'
|
|
24
|
+
]"
|
|
25
|
+
:kind="pickKind"
|
|
26
|
+
:size="ETypographySizes.XL"
|
|
27
|
+
:weight="ETextWeight.BOLD"
|
|
28
|
+
>
|
|
29
|
+
<slot name="title" />
|
|
30
|
+
</ui-typography>
|
|
31
|
+
|
|
32
|
+
<ui-typography
|
|
33
|
+
v-if="$slots.textBody"
|
|
34
|
+
class="mb-sm p-sm"
|
|
35
|
+
:class="[
|
|
36
|
+
kind === EOrderCardTypes.DEFAULT && 'text-primary-700',
|
|
37
|
+
kind === EOrderCardTypes.WARNING && 'text-warning-700'
|
|
38
|
+
]"
|
|
39
|
+
:size="ETypographySizes.MD"
|
|
40
|
+
:weight="ETextWeight.REGULAR"
|
|
41
|
+
>
|
|
42
|
+
<slot name="textBody" />
|
|
43
|
+
</ui-typography>
|
|
44
|
+
|
|
45
|
+
<ui-typography
|
|
46
|
+
v-if="$slots.footer"
|
|
47
|
+
class="py-sm text-white rounded-b-lg"
|
|
48
|
+
:class="[
|
|
49
|
+
kind === EOrderCardTypes.DEFAULT && 'bg-primary-700',
|
|
50
|
+
kind === EOrderCardTypes.WARNING && 'bg-warning-700'
|
|
51
|
+
]"
|
|
52
|
+
:size="ETypographySizes.XXS"
|
|
53
|
+
:weight="ETextWeight.REGULAR"
|
|
54
|
+
>
|
|
55
|
+
<slot name="footer" />
|
|
56
|
+
</ui-typography>
|
|
57
|
+
</div>
|
|
58
|
+
</template>
|
|
59
|
+
|
|
60
|
+
<script lang="ts" setup>
|
|
61
|
+
import { computed } from "vue";
|
|
62
|
+
import { ESize } from "../../_types/sizing";
|
|
63
|
+
import { EColors } from "../../_types/colors";
|
|
64
|
+
import UiTypography, { ETextWeight, ETypographySizes } from "../ui-typography";
|
|
65
|
+
import type { TIconName } from "../ui-icon";
|
|
66
|
+
import UiIcon from "../ui-icon";
|
|
67
|
+
import { EOrderCardTypes } from "./_types";
|
|
68
|
+
|
|
69
|
+
const props = withDefaults(defineProps<{
|
|
70
|
+
iconName: TIconName;
|
|
71
|
+
kind?: EOrderCardTypes;
|
|
72
|
+
}>(), {
|
|
73
|
+
kind: EOrderCardTypes.DEFAULT
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
const pickKind = computed(()=>{
|
|
77
|
+
switch(props.kind){
|
|
78
|
+
case EOrderCardTypes.WARNING: return EColors.WARNING_700;
|
|
79
|
+
default: return EColors.PRIMARY_700;
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
</script>
|
|
@@ -14,13 +14,12 @@
|
|
|
14
14
|
>
|
|
15
15
|
<input
|
|
16
16
|
:id="value"
|
|
17
|
-
v-model="
|
|
17
|
+
v-model="radioModel"
|
|
18
18
|
type="radio"
|
|
19
19
|
:name="name"
|
|
20
20
|
:value="value"
|
|
21
21
|
:disabled="disabled"
|
|
22
22
|
class="appearance-none absolute"
|
|
23
|
-
@input="$emit('update:modelValue', ($event.target as HTMLTextAreaElement)?.value)"
|
|
24
23
|
>
|
|
25
24
|
<span
|
|
26
25
|
class="ui-radio_custom block w-md h-md border border-secondary-alt rounded-full relative hover:border-secondary-alt-700 focus:border-secondary-alt-700"
|
|
@@ -33,7 +32,7 @@
|
|
|
33
32
|
</template>
|
|
34
33
|
|
|
35
34
|
<script lang="ts" setup>
|
|
36
|
-
import {
|
|
35
|
+
import { computed, useSlots } from "vue";
|
|
37
36
|
import { EJustify } from "../../_types/align";
|
|
38
37
|
const slots = useSlots();
|
|
39
38
|
const props = defineProps<{
|
|
@@ -45,13 +44,14 @@
|
|
|
45
44
|
disabled?: boolean;
|
|
46
45
|
}>();
|
|
47
46
|
|
|
48
|
-
defineEmits(["update:modelValue"]);
|
|
47
|
+
const emit = defineEmits(["update:modelValue"]);
|
|
49
48
|
|
|
50
|
-
const
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
49
|
+
const radioModel = computed({
|
|
50
|
+
get() {
|
|
51
|
+
return props.modelValue;
|
|
52
|
+
},
|
|
53
|
+
set(value) {
|
|
54
|
+
emit("update:modelValue", value);
|
|
55
55
|
}
|
|
56
56
|
});
|
|
57
57
|
</script>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "./ui-radio-fancy.vue";
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { ref } from "vue";
|
|
2
|
+
import UiRadioFancy from "./ui-radio-fancy.vue";
|
|
3
|
+
import type { Story } from "@storybook/vue3";
|
|
4
|
+
import { EIconType } from "../ui-icon/_typings";
|
|
5
|
+
|
|
6
|
+
export default {
|
|
7
|
+
title: "Components/ui-radio-fancy",
|
|
8
|
+
component: UiRadioFancy,
|
|
9
|
+
// More on argTypes: https://storybook.js.org/docs/vue/api/argtypes
|
|
10
|
+
argTypes: {},
|
|
11
|
+
args: {},
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
type TComponentProps = InstanceType<typeof UiRadioFancy>["$props"];
|
|
15
|
+
|
|
16
|
+
const Template: Story<TComponentProps> = () => ({
|
|
17
|
+
components: { UiRadioFancy },
|
|
18
|
+
setup() {
|
|
19
|
+
const modelValue = ref("1");
|
|
20
|
+
|
|
21
|
+
return { modelValue, EIconType };
|
|
22
|
+
},
|
|
23
|
+
template: /*html*/`
|
|
24
|
+
<div class="grid gap-sm" :style="{'grid-template-columns': 'repeat(auto-fit, minmax(160px, 1fr))'}">
|
|
25
|
+
<ui-radio-fancy v-for="item in 3" :key="item" :value="String(item)" v-model="modelValue" name="radio" title="title" :icon-name="[EIconType.FAR, 'face-smile']">
|
|
26
|
+
{{args.slot}}
|
|
27
|
+
</ui-radio-fancy>
|
|
28
|
+
</div>
|
|
29
|
+
`,
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
export const Default = Template.bind({});
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<label
|
|
3
|
+
class="ui-radio-item block p-sm border rounded-2xl hover:border-primary cursor-pointer bg-white"
|
|
4
|
+
:class="[
|
|
5
|
+
isActive ? 'border-primary pointer-events-none':'border-secondary-alt',
|
|
6
|
+
]"
|
|
7
|
+
>
|
|
8
|
+
<input
|
|
9
|
+
v-model="radioModel"
|
|
10
|
+
type="radio"
|
|
11
|
+
:name="name"
|
|
12
|
+
:value="value"
|
|
13
|
+
class="appearance-none absolute"
|
|
14
|
+
>
|
|
15
|
+
|
|
16
|
+
<ui-icon
|
|
17
|
+
:icon-name="iconName"
|
|
18
|
+
:size="ESize.MD"
|
|
19
|
+
class="mb-md"
|
|
20
|
+
:class="isActive && 'text-primary'"
|
|
21
|
+
/>
|
|
22
|
+
<ui-typography
|
|
23
|
+
:size="ETypographySizes.SM"
|
|
24
|
+
:kind="EColors.SECONDARY"
|
|
25
|
+
:weight="ETextWeight.SEMI_BOLD"
|
|
26
|
+
>
|
|
27
|
+
{{ title }}
|
|
28
|
+
</ui-typography>
|
|
29
|
+
</label>
|
|
30
|
+
</template>
|
|
31
|
+
|
|
32
|
+
<script lang="ts" setup>
|
|
33
|
+
import { computed } from "vue";
|
|
34
|
+
import UiTypography, { ETypographySizes, ETextWeight } from "../ui-typography";
|
|
35
|
+
import UiIcon, { type TIconName } from "../ui-icon";
|
|
36
|
+
import { ESize } from "../../_types/sizing";
|
|
37
|
+
import { EColors } from "../../_types/colors";
|
|
38
|
+
|
|
39
|
+
const props = defineProps<{
|
|
40
|
+
modelValue: string;
|
|
41
|
+
name: string;
|
|
42
|
+
value: string | number;
|
|
43
|
+
title: string;
|
|
44
|
+
iconName: TIconName;
|
|
45
|
+
}>();
|
|
46
|
+
|
|
47
|
+
const emit = defineEmits(["update:modelValue"]);
|
|
48
|
+
|
|
49
|
+
const radioModel = computed({
|
|
50
|
+
get() {
|
|
51
|
+
return props.modelValue;
|
|
52
|
+
},
|
|
53
|
+
set(value) {
|
|
54
|
+
emit("update:modelValue", value);
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
const isActive = computed(()=>props.modelValue === props.value);
|
|
59
|
+
</script>
|
|
@@ -12,7 +12,6 @@ export default {
|
|
|
12
12
|
}
|
|
13
13
|
},
|
|
14
14
|
args: {
|
|
15
|
-
slot: "default text",
|
|
16
15
|
disabled: false,
|
|
17
16
|
},
|
|
18
17
|
};
|
|
@@ -27,12 +26,20 @@ const Template: Story<TComponentProps> = (args) => ({
|
|
|
27
26
|
return { args, valueModel, list };
|
|
28
27
|
},
|
|
29
28
|
template: /*html*/`
|
|
30
|
-
<ui-select v-bind="args"
|
|
29
|
+
<ui-select v-bind="args" v-model="valueModel" heading="heading" subLabel="subLabel">
|
|
31
30
|
<template #postfix-icon>
|
|
32
31
|
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
33
32
|
<path d="M13.25 6.8125L8.5 11.2812C8.34375 11.4375 8.15625 11.5 8 11.5C7.8125 11.5 7.625 11.4375 7.46875 11.3125L2.71875 6.8125C2.40625 6.53125 2.40625 6.0625 2.6875 5.75C2.96875 5.4375 3.4375 5.4375 3.75 5.71875L8 9.71875L12.2188 5.71875C12.5312 5.4375 13 5.4375 13.2812 5.75C13.5625 6.0625 13.5625 6.53125 13.25 6.8125Z" fill="currentColor"/>
|
|
34
33
|
</svg>
|
|
35
34
|
</template>
|
|
35
|
+
|
|
36
|
+
<option
|
|
37
|
+
v-for="item in list"
|
|
38
|
+
:key="item"
|
|
39
|
+
:value="item"
|
|
40
|
+
>
|
|
41
|
+
{{ item }}
|
|
42
|
+
</option>
|
|
36
43
|
</ui-select>
|
|
37
44
|
`,
|
|
38
45
|
});
|
|
@@ -12,17 +12,10 @@
|
|
|
12
12
|
:class="[disabled && 'pointer-events-none bg-secondary-alt-200 border-secondary-alt-300']"
|
|
13
13
|
>
|
|
14
14
|
<select
|
|
15
|
-
v-model="
|
|
15
|
+
v-model="radioModel"
|
|
16
16
|
class="appearance-none bg-transparent border-0 m-0 outline-0 w-full p-sm cursor-pointer italic text-secondary-alt"
|
|
17
|
-
@change=" $emit('update:value', ($event.target as HTMLTextAreaElement)?.value)"
|
|
18
17
|
>
|
|
19
|
-
<
|
|
20
|
-
v-for="item in list"
|
|
21
|
-
:key="item"
|
|
22
|
-
:value="item"
|
|
23
|
-
>
|
|
24
|
-
{{ item }}
|
|
25
|
-
</option>
|
|
18
|
+
<slot />
|
|
26
19
|
</select>
|
|
27
20
|
|
|
28
21
|
<div class="ui-select__icon-wrapper absolute right-sm">
|
|
@@ -40,23 +33,25 @@
|
|
|
40
33
|
</template>
|
|
41
34
|
|
|
42
35
|
<script lang="ts" setup>
|
|
43
|
-
import {
|
|
36
|
+
import { computed } from "vue";
|
|
44
37
|
import UiTypography, { ETypographySizes, ETextWeight } from "../ui-typography";
|
|
45
38
|
|
|
46
39
|
const props = defineProps<{
|
|
47
|
-
|
|
48
|
-
value: string;
|
|
40
|
+
modelValue: string;
|
|
49
41
|
heading?: string;
|
|
50
42
|
subLabel?: string;
|
|
51
43
|
disabled?: boolean;
|
|
52
44
|
}>();
|
|
53
45
|
|
|
54
|
-
defineEmits(["update:
|
|
46
|
+
const emit = defineEmits(["update:modelValue"]);
|
|
55
47
|
|
|
56
|
-
const
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
48
|
+
const radioModel = computed({
|
|
49
|
+
get() {
|
|
50
|
+
return props.modelValue;
|
|
51
|
+
},
|
|
52
|
+
set(value) {
|
|
53
|
+
emit("update:modelValue", value);
|
|
54
|
+
}
|
|
60
55
|
});
|
|
61
56
|
</script>
|
|
62
57
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "./ui-table-cell.vue";
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<ui-typography
|
|
3
|
+
is="td"
|
|
4
|
+
:size="ETypographySizes.SM"
|
|
5
|
+
:align="align"
|
|
6
|
+
:weight="weight"
|
|
7
|
+
class="p-sm"
|
|
8
|
+
>
|
|
9
|
+
<slot />
|
|
10
|
+
|
|
11
|
+
<ui-typography
|
|
12
|
+
v-if="$slots.subtext"
|
|
13
|
+
:size="ETypographySizes.XXS"
|
|
14
|
+
:weight="ETextWeight.SEMI_BOLD"
|
|
15
|
+
class="flex flex-col gap-xxs"
|
|
16
|
+
:kind="EColors.PRIMARY_ALT_700"
|
|
17
|
+
:class="$slots.default && 'pt-sm'"
|
|
18
|
+
>
|
|
19
|
+
<slot name="subtext" />
|
|
20
|
+
</ui-typography>
|
|
21
|
+
</ui-typography>
|
|
22
|
+
</template>
|
|
23
|
+
|
|
24
|
+
<script lang="ts" setup>
|
|
25
|
+
import { EColors } from "../../../_types/colors";
|
|
26
|
+
import UiTypography, { ETypographySizes, ETextAlign, ETextWeight } from "../../ui-typography";
|
|
27
|
+
|
|
28
|
+
defineProps<{
|
|
29
|
+
align?: ETextAlign;
|
|
30
|
+
weight?: ETextWeight;
|
|
31
|
+
}>();
|
|
32
|
+
|
|
33
|
+
</script>
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<tr
|
|
3
|
+
class="ui-table-row text-center"
|
|
4
|
+
:class="[kind === ERowKind.SECONDARY && 'bg-secondary-alt-200']"
|
|
5
|
+
>
|
|
6
|
+
<slot />
|
|
7
|
+
</tr>
|
|
8
|
+
</template>
|
|
9
|
+
|
|
10
|
+
<script lang="ts" setup>
|
|
11
|
+
import { ERowKind } from "./_typings";
|
|
12
|
+
|
|
13
|
+
defineProps<{
|
|
14
|
+
kind?: ERowKind;
|
|
15
|
+
}>();
|
|
16
|
+
|
|
17
|
+
</script>
|
|
18
|
+
|
|
19
|
+
<style scoped>
|
|
20
|
+
.ui-table-row ::v-deep(td:first-child) {
|
|
21
|
+
border-top-left-radius: var(--xs);
|
|
22
|
+
border-bottom-left-radius: var(--xs);
|
|
23
|
+
text-align: left;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.ui-table-row ::v-deep(td:last-child) {
|
|
27
|
+
border-top-right-radius: var(--xs);
|
|
28
|
+
border-bottom-right-radius: var(--xs);
|
|
29
|
+
text-align: right;
|
|
30
|
+
}
|
|
31
|
+
</style>
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import UiTableRow, { ERowKind } from "./ui-table-row";
|
|
2
|
+
import UiTableCell from "./ui-table-cell";
|
|
3
|
+
import UiTypography, { ETextWeight, ETypographySizes } from "../ui-typography";
|
|
4
|
+
|
|
5
|
+
export default {
|
|
6
|
+
title: "Components/ui-table",
|
|
7
|
+
argTypes: {
|
|
8
|
+
kind: {
|
|
9
|
+
control: { type: "select" },
|
|
10
|
+
options: ["empty"].concat(Object.values(ERowKind)),
|
|
11
|
+
description: "The row kind",
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
args: {
|
|
15
|
+
kind: ERowKind.SECONDARY,
|
|
16
|
+
},
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
type MyComponentProps = InstanceType<typeof UiTableRow>["$props"];
|
|
20
|
+
|
|
21
|
+
const Template = (args: MyComponentProps) => ({
|
|
22
|
+
components:{
|
|
23
|
+
// UiTable,
|
|
24
|
+
UiTableRow,
|
|
25
|
+
UiTableCell,
|
|
26
|
+
UiTypography
|
|
27
|
+
},
|
|
28
|
+
setup(){
|
|
29
|
+
|
|
30
|
+
const defaultList = {
|
|
31
|
+
text1: "some text",
|
|
32
|
+
text2: "some text2",
|
|
33
|
+
text3: "some text3",
|
|
34
|
+
extraText: false
|
|
35
|
+
};
|
|
36
|
+
const list = [
|
|
37
|
+
defaultList,
|
|
38
|
+
defaultList,
|
|
39
|
+
defaultList,
|
|
40
|
+
defaultList,
|
|
41
|
+
defaultList,
|
|
42
|
+
{
|
|
43
|
+
...defaultList,
|
|
44
|
+
extraText: true
|
|
45
|
+
}
|
|
46
|
+
];
|
|
47
|
+
|
|
48
|
+
return{
|
|
49
|
+
ETextWeight,
|
|
50
|
+
ETypographySizes,
|
|
51
|
+
ERowKind,
|
|
52
|
+
args,
|
|
53
|
+
list
|
|
54
|
+
};
|
|
55
|
+
},
|
|
56
|
+
template:
|
|
57
|
+
/*html*/`
|
|
58
|
+
<table class='w-full'>
|
|
59
|
+
<ui-table-row v-for="(row, index) in list"
|
|
60
|
+
:key="index"
|
|
61
|
+
rounded
|
|
62
|
+
:kind="index % 2 === 0 && args.kind">
|
|
63
|
+
<ui-table-cell :weight='ETextWeight.SEMI_BOLD'>
|
|
64
|
+
{{row.text1}}
|
|
65
|
+
</ui-table-cell>
|
|
66
|
+
|
|
67
|
+
<ui-table-cell>
|
|
68
|
+
{{row.text2}}
|
|
69
|
+
</ui-table-cell>
|
|
70
|
+
|
|
71
|
+
<ui-table-cell :weight='ETextWeight.SEMI_BOLD'>
|
|
72
|
+
{{row.text3}}
|
|
73
|
+
<template #subtext v-if="row.extraText">
|
|
74
|
+
<p>23.620 cent x</p>
|
|
75
|
+
<p>4,200 kWh</p>
|
|
76
|
+
</template>
|
|
77
|
+
</ui-table-cell>
|
|
78
|
+
</ui-table-row>
|
|
79
|
+
</table>
|
|
80
|
+
`
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
export const Default = Template.bind({});
|
|
@@ -4,21 +4,20 @@
|
|
|
4
4
|
v-for="tab in tabs"
|
|
5
5
|
:key="tab"
|
|
6
6
|
class="rounded-full text-center"
|
|
7
|
-
:class="[
|
|
7
|
+
:class="[tabsModel === tab && 'bg-white']"
|
|
8
8
|
>
|
|
9
9
|
<label class="block cursor-pointer py-xs px-md">
|
|
10
10
|
<input
|
|
11
|
-
v-model="
|
|
11
|
+
v-model="tabsModel"
|
|
12
12
|
type="radio"
|
|
13
13
|
class="appearance-none absolute"
|
|
14
14
|
:value="tab"
|
|
15
|
-
:name="name
|
|
16
|
-
@input="$emit('update:modelValue', ($event.target as HTMLTextAreaElement)?.value)"
|
|
15
|
+
:name="name"
|
|
17
16
|
>
|
|
18
17
|
<ui-typography
|
|
19
18
|
is="span"
|
|
20
19
|
:size="ETypographySizes.XS"
|
|
21
|
-
:kind="
|
|
20
|
+
:kind="tabsModel === tab ? EColors.SECONDARY_500 : EColors.SECONDARY_400"
|
|
22
21
|
:weight="ETextWeight.SEMI_BOLD"
|
|
23
22
|
>
|
|
24
23
|
{{ tab }}
|
|
@@ -29,23 +28,26 @@
|
|
|
29
28
|
</template>
|
|
30
29
|
|
|
31
30
|
<script lang="ts" setup>
|
|
32
|
-
import {
|
|
31
|
+
import { computed } from "vue";
|
|
33
32
|
import UiTypography, { ETypographySizes, ETextWeight } from "../ui-typography";
|
|
34
33
|
import { EColors } from "../../_types/colors";
|
|
35
34
|
|
|
36
|
-
const props = defineProps<{
|
|
35
|
+
const props = withDefaults(defineProps<{
|
|
37
36
|
tabs: string[];
|
|
38
37
|
modelValue: string;
|
|
39
|
-
name
|
|
40
|
-
}>()
|
|
41
|
-
|
|
42
|
-
|
|
38
|
+
name?: string;
|
|
39
|
+
}>(), {
|
|
40
|
+
name: "default"
|
|
41
|
+
});
|
|
43
42
|
|
|
44
|
-
const
|
|
43
|
+
const emit = defineEmits(["update:modelValue"]);
|
|
45
44
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
45
|
+
const tabsModel = computed({
|
|
46
|
+
get() {
|
|
47
|
+
return props.modelValue;
|
|
48
|
+
},
|
|
49
|
+
set(value) {
|
|
50
|
+
emit("update:modelValue", value);
|
|
49
51
|
}
|
|
50
52
|
});
|
|
51
53
|
|