bonkers-ui 1.0.35 → 1.0.36
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 +1 -1
- package/src/_styles/classTypes/_shadow.json +1 -0
- package/src/_styles/variables/shadow.css +1 -0
- package/src/components/ui-plain-radio/index.ts +1 -0
- package/src/components/ui-plain-radio/ui-plain-radio.stories.ts +59 -0
- package/src/components/ui-plain-radio/ui-plain-radio.vue +115 -0
- package/src/components/ui-radio-fancy/_typings.ts +4 -0
- package/src/components/ui-radio-fancy/ui-radio-fancy.stories.ts +12 -11
- package/src/components/ui-radio-fancy/ui-radio-fancy.vue +34 -8
- package/src/components/ui-typography/ui-typography.vue +1 -0
package/package.json
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
--shadow-border-primary: 0 0 0 4px rgb(69 158 74 / 50%);
|
|
6
6
|
--shadow-border-selected: 0 0 0 4px rgb(69 158 74 / 100%);
|
|
7
7
|
--shadow-selected-shadow: 0 0 0 4px var(--color-primary-500);
|
|
8
|
+
--shadow-selected-disabled: 0 0 0 4px var(--color-primary-300);
|
|
8
9
|
--shadow-border-secondary: 0 0 0 4px rgb(223 225 233 / 50%);
|
|
9
10
|
}
|
|
10
11
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "./ui-plain-radio.vue";
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import UiPlainRadio from "./ui-plain-radio.vue";
|
|
2
|
+
import { ETypographySizes } from "../ui-typography";
|
|
3
|
+
import EColors from "../ui-typography";
|
|
4
|
+
import type { Story } from "@storybook/vue3";
|
|
5
|
+
import { ref } from "vue";
|
|
6
|
+
|
|
7
|
+
export default {
|
|
8
|
+
title: "Components/ui-plain-radio",
|
|
9
|
+
component: UiPlainRadio, ETypographySizes, EColors,
|
|
10
|
+
// More on argTypes: https://storybook.js.org/docs/vue/api/argtypes
|
|
11
|
+
argTypes: {
|
|
12
|
+
disabled: {
|
|
13
|
+
control: { type: "boolean" },
|
|
14
|
+
},
|
|
15
|
+
header: {
|
|
16
|
+
control: { type: "text" },
|
|
17
|
+
},
|
|
18
|
+
subHeader: {
|
|
19
|
+
control: { type: "text" },
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
args: {
|
|
23
|
+
disabled: false,
|
|
24
|
+
header: "Header",
|
|
25
|
+
subHeader: "SubHeader"
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
type TComponentProps = InstanceType<typeof UiPlainRadio>["$props"];
|
|
30
|
+
|
|
31
|
+
const Template: Story<TComponentProps> = (args) => ({
|
|
32
|
+
components: { UiPlainRadio },
|
|
33
|
+
|
|
34
|
+
setup() {
|
|
35
|
+
const modelValue = ref("1");
|
|
36
|
+
|
|
37
|
+
return { modelValue, args, ETypographySizes, EColors };
|
|
38
|
+
|
|
39
|
+
},
|
|
40
|
+
|
|
41
|
+
template: /*html*/ `
|
|
42
|
+
<div :style="{display: 'grid', gridGap: '5px'}">
|
|
43
|
+
<ui-plain-radio
|
|
44
|
+
v-for="item in 2"
|
|
45
|
+
:name="String(item)"
|
|
46
|
+
:key="item"
|
|
47
|
+
:value="String(item)"
|
|
48
|
+
v-model="modelValue"
|
|
49
|
+
:header="args.header"
|
|
50
|
+
:sub-header="args.subHeader"
|
|
51
|
+
title="title"
|
|
52
|
+
:disabled="args.disabled"
|
|
53
|
+
>
|
|
54
|
+
</ui-plain-radio>
|
|
55
|
+
</div>
|
|
56
|
+
`,
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
export const Default = Template.bind({});
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<label
|
|
3
|
+
class="ui-plain-radio relative mb-sm"
|
|
4
|
+
:for="name + value"
|
|
5
|
+
>
|
|
6
|
+
|
|
7
|
+
<input
|
|
8
|
+
:id="name + value"
|
|
9
|
+
v-model="radioModel"
|
|
10
|
+
:value="value"
|
|
11
|
+
name="ui-plain-radio"
|
|
12
|
+
type="radio"
|
|
13
|
+
:disabled="disabled"
|
|
14
|
+
class="appearance-none absolute peer"
|
|
15
|
+
>
|
|
16
|
+
|
|
17
|
+
<div
|
|
18
|
+
class="ui-plain-radio__content
|
|
19
|
+
grid
|
|
20
|
+
grid-flow-col
|
|
21
|
+
justify-start
|
|
22
|
+
items-center
|
|
23
|
+
gap-sm
|
|
24
|
+
box-border
|
|
25
|
+
w-full
|
|
26
|
+
h-full
|
|
27
|
+
py-sm px-sm
|
|
28
|
+
border
|
|
29
|
+
border-secondary-alt-500
|
|
30
|
+
bg-white
|
|
31
|
+
hover:border-secondary-alt-700
|
|
32
|
+
cursor-pointer
|
|
33
|
+
rounded-xl
|
|
34
|
+
|
|
35
|
+
before:absolute
|
|
36
|
+
before:-z-10
|
|
37
|
+
before:box-border
|
|
38
|
+
before:rounded-[16px]
|
|
39
|
+
before:bg-primary-300
|
|
40
|
+
|
|
41
|
+
peer-checked:border-transparent
|
|
42
|
+
peer-checked:active:shadow-border-primary
|
|
43
|
+
peer-checked:active:before:-top-xs
|
|
44
|
+
peer-checked:active:before:-bottom-xs
|
|
45
|
+
peer-checked:active:before:-left-xs
|
|
46
|
+
peer-checked:active:before:-right-xs
|
|
47
|
+
|
|
48
|
+
peer-checked:hover:shadow-border-selected
|
|
49
|
+
peer-checked:shadow-selected-shadow
|
|
50
|
+
|
|
51
|
+
peer-active:before:-top-xxs
|
|
52
|
+
peer-active:before:-bottom-xxs
|
|
53
|
+
peer-active:before:-left-xxs
|
|
54
|
+
peer-active:before:-right-xxs
|
|
55
|
+
|
|
56
|
+
peer-focus:before:-top-xs
|
|
57
|
+
peer-focus:before:-bottom-xs
|
|
58
|
+
peer-focus:before:-left-xs
|
|
59
|
+
peer-focus:before:-right-xs
|
|
60
|
+
"
|
|
61
|
+
:class="disabled && 'pointer-events-none border-secondary-alt-400 peer-checked:shadow-border-primary-disabled'"
|
|
62
|
+
>
|
|
63
|
+
<ui-radio
|
|
64
|
+
v-model="radioModel"
|
|
65
|
+
:value="value"
|
|
66
|
+
:name="name"
|
|
67
|
+
:disabled="disabled"
|
|
68
|
+
class="pointer-events-none"
|
|
69
|
+
/>
|
|
70
|
+
|
|
71
|
+
<span>
|
|
72
|
+
<ui-typography
|
|
73
|
+
:size="ETypographySizes.SM"
|
|
74
|
+
:kind="EColors.SECONDARY"
|
|
75
|
+
:weight="ETextWeight.SEMI_BOLD"
|
|
76
|
+
line-height
|
|
77
|
+
>
|
|
78
|
+
{{ header }}
|
|
79
|
+
</ui-typography>
|
|
80
|
+
<ui-typography
|
|
81
|
+
:size="ETypographySizes.XS"
|
|
82
|
+
:kind="EColors.SECONDARY_ALT"
|
|
83
|
+
>
|
|
84
|
+
{{ subHeader }}
|
|
85
|
+
</ui-typography>
|
|
86
|
+
</span>
|
|
87
|
+
</div>
|
|
88
|
+
</label>
|
|
89
|
+
</template>
|
|
90
|
+
|
|
91
|
+
<script lang="ts" setup>
|
|
92
|
+
import { computed } from "vue";
|
|
93
|
+
import UiRadio from "../ui-radio";
|
|
94
|
+
import UiTypography, { ETypographySizes, EColors, ETextWeight } from "../ui-typography";
|
|
95
|
+
|
|
96
|
+
const props = defineProps<{
|
|
97
|
+
modelValue: string;
|
|
98
|
+
header: string;
|
|
99
|
+
subHeader: string;
|
|
100
|
+
name: string;
|
|
101
|
+
value: string;
|
|
102
|
+
disabled?: boolean;
|
|
103
|
+
}>();
|
|
104
|
+
|
|
105
|
+
const emit = defineEmits(["update:modelValue"]);
|
|
106
|
+
|
|
107
|
+
const radioModel = computed({
|
|
108
|
+
get() {
|
|
109
|
+
return props.modelValue;
|
|
110
|
+
},
|
|
111
|
+
set(value) {
|
|
112
|
+
emit ("update:modelValue", value);
|
|
113
|
+
}
|
|
114
|
+
});
|
|
115
|
+
</script>
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { ERadioSizes } from "./_typings";
|
|
1
2
|
import { ref } from "vue";
|
|
2
|
-
import UiRadioFancy from "
|
|
3
|
+
import UiRadioFancy from "../ui-radio-fancy";
|
|
3
4
|
import type { Story } from "@storybook/vue3";
|
|
4
5
|
import { EIconType } from "../ui-icon/_typings";
|
|
5
6
|
|
|
@@ -16,11 +17,17 @@ export default {
|
|
|
16
17
|
control: { type: "boolean" },
|
|
17
18
|
description: "The full width size",
|
|
18
19
|
},
|
|
20
|
+
radioSize: {
|
|
21
|
+
control: { type: "select" },
|
|
22
|
+
options: Object.values(ERadioSizes),
|
|
23
|
+
description: "The radio kinds",
|
|
24
|
+
},
|
|
19
25
|
},
|
|
20
26
|
args: {
|
|
21
27
|
slot: "Description",
|
|
22
28
|
invertOrder: false,
|
|
23
|
-
disabled: false
|
|
29
|
+
disabled: false,
|
|
30
|
+
radioSize: ERadioSizes.DEFAULT
|
|
24
31
|
},
|
|
25
32
|
};
|
|
26
33
|
|
|
@@ -31,18 +38,12 @@ const Template: Story<TComponentProps> = (args) => ({
|
|
|
31
38
|
setup() {
|
|
32
39
|
const modelValue = ref("1");
|
|
33
40
|
|
|
34
|
-
return { modelValue, EIconType, args };
|
|
41
|
+
return { modelValue, EIconType, args, ERadioSizes };
|
|
35
42
|
},
|
|
36
43
|
template: /*html*/`
|
|
37
44
|
<div class="grid gap-sm" :style="{'grid-template-columns': 'repeat(auto-fit, minmax(160px, 1fr))'}">
|
|
38
|
-
<ui-radio-fancy v-
|
|
39
|
-
|
|
40
|
-
</ui-radio-fancy>
|
|
41
|
-
<ui-radio-fancy v-bind="args" :key="key" value="2" v-model="modelValue" name="radio" :icon-name="[EIconType.FAR, 'face-smile']">
|
|
42
|
-
Apple
|
|
43
|
-
</ui-radio-fancy>
|
|
44
|
-
<ui-radio-fancy v-bind="args" :key="key" value="3" v-model="modelValue" name="radio" :icon-name="[EIconType.FAR, 'face-smile']">
|
|
45
|
-
Orange
|
|
45
|
+
<ui-radio-fancy v-for="item in 2" :key="item" :value="String(item)" v-model="modelValue" name="radio" title="title" :icon-name="[EIconType.FAR, 'face-smile']" :radioSize="args.radioSize" :disabled="args.disabled">
|
|
46
|
+
{{args.slot}}
|
|
46
47
|
</ui-radio-fancy>
|
|
47
48
|
</div>
|
|
48
49
|
`,
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
:name="name"
|
|
14
14
|
:value="value"
|
|
15
15
|
class="peer group appearance-none absolute"
|
|
16
|
+
:disabled="disabled"
|
|
16
17
|
>
|
|
17
18
|
<div
|
|
18
19
|
class="
|
|
@@ -54,18 +55,39 @@
|
|
|
54
55
|
peer-focus:before:-left-xs
|
|
55
56
|
peer-focus:before:-right-xs
|
|
56
57
|
"
|
|
57
|
-
:class="disabled && 'pointer-events-none'
|
|
58
|
+
:class="[disabled && 'pointer-events-none border-secondary-alt-400 peer-checked:shadow-border-primary-disabled',
|
|
59
|
+
radioSize === ERadioSizes.DEFAULT && 'default',
|
|
60
|
+
radioSize === ERadioSizes.MINIMAL && 'flex gap-sm align-middle']"
|
|
58
61
|
>
|
|
59
|
-
<
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
62
|
+
<div
|
|
63
|
+
v-if="radioSize === ERadioSizes.DEFAULT"
|
|
64
|
+
>
|
|
65
|
+
<ui-icon
|
|
66
|
+
:icon-name="iconName"
|
|
67
|
+
:size="ESize.MD"
|
|
68
|
+
class=" mb-md peer-checked:text-primary-500"
|
|
69
|
+
:class="[value === modelValue && 'text-primary',
|
|
70
|
+
disabled && 'text-secondary-alt-400',
|
|
71
|
+
disabled && value === modelValue && 'text-primary-300'
|
|
72
|
+
]"
|
|
73
|
+
/>
|
|
74
|
+
</div>
|
|
75
|
+
<div v-else-if="radioSize === ERadioSizes.MINIMAL">
|
|
76
|
+
<ui-icon
|
|
77
|
+
:icon-name="iconName"
|
|
78
|
+
:size="ESize.MD"
|
|
79
|
+
:class="[value === modelValue && 'text-primary',
|
|
80
|
+
disabled && 'text-secondary-alt-400',
|
|
81
|
+
disabled && value === modelValue && 'text-primary-300'
|
|
82
|
+
]"
|
|
83
|
+
/>
|
|
84
|
+
|
|
85
|
+
</div>
|
|
65
86
|
<ui-typography
|
|
66
87
|
:size="ETypographySizes.SM"
|
|
67
88
|
:kind="EColors.SECONDARY"
|
|
68
89
|
:weight="ETextWeight.SEMI_BOLD"
|
|
90
|
+
class="pt-xxs"
|
|
69
91
|
>
|
|
70
92
|
<slot />
|
|
71
93
|
</ui-typography>
|
|
@@ -76,15 +98,19 @@
|
|
|
76
98
|
<script lang="ts" setup>
|
|
77
99
|
import { computed } from "vue";
|
|
78
100
|
import UiTypography, { ETypographySizes, ETextWeight } from "../ui-typography";
|
|
79
|
-
import
|
|
101
|
+
import type { TIconName } from "../ui-icon";
|
|
80
102
|
import { ESize } from "../../_types/sizing";
|
|
81
103
|
import { EColors } from "../../_types/colors";
|
|
104
|
+
import { ERadioSizes } from "./_typings";
|
|
105
|
+
import uiIcon from "../ui-icon";
|
|
106
|
+
|
|
82
107
|
const props = defineProps<{
|
|
83
108
|
modelValue: string;
|
|
84
109
|
name: string;
|
|
85
110
|
value: string | number;
|
|
86
111
|
iconName: TIconName;
|
|
87
112
|
disabled?: boolean;
|
|
113
|
+
radioSize?: ERadioSizes;
|
|
88
114
|
}>();
|
|
89
115
|
const emit = defineEmits(["update:modelValue"]);
|
|
90
116
|
const radioModel = computed({
|