@dolanske/vui 0.3.4 → 0.5.0
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 +673 -673
- package/README.md +41 -40
- package/dist/components/Dropdown/DropdownItem.vue.d.ts +1 -0
- package/dist/components/Flex/Flex.vue.d.ts +3 -1
- package/dist/components/Grid/Grid.vue.d.ts +3 -1
- package/dist/components/Tabs/Tabs.vue.d.ts +4 -0
- package/dist/style.css +1 -1
- package/dist/vui.js +1547 -1534
- package/package.json +68 -68
- package/src/App.vue +176 -175
- package/src/components/Accordion/Accordion.vue +91 -91
- package/src/components/Accordion/AccordionGroup.vue +43 -43
- package/src/components/Accordion/accordion.scss +81 -80
- package/src/components/Alert/Alert.vue +53 -53
- package/src/components/Alert/alert.scss +80 -80
- package/src/components/Avatar/Avatar.vue +50 -50
- package/src/components/Avatar/avatar.scss +52 -52
- package/src/components/Badge/Badge.vue +21 -21
- package/src/components/Badge/badge.scss +89 -89
- package/src/components/Breadcrumbs/BreadcrumbItem.vue +26 -26
- package/src/components/Breadcrumbs/Breadcrumbs.vue +33 -33
- package/src/components/Breadcrumbs/breadcrumbs.scss +30 -30
- package/src/components/Button/Button.vue +90 -90
- package/src/components/Button/button.scss +178 -176
- package/src/components/ButtonGroup/ButtonGroup.vue +25 -25
- package/src/components/ButtonGroup/button-group.scss +51 -51
- package/src/components/Calendar/Calendar.vue +63 -60
- package/src/components/Calendar/calendar.scss +60 -56
- package/src/components/Card/Card.vue +48 -48
- package/src/components/Card/card.scss +53 -53
- package/src/components/Checkbox/Checkbox.vue +51 -52
- package/src/components/Checkbox/checkbox.scss +75 -66
- package/src/components/CopyClipboard/CopyClipboard.vue +82 -82
- package/src/components/CopyClipboard/copy-clipboard.scss +17 -17
- package/src/components/Divider/Divider.vue +44 -44
- package/src/components/Divider/divider.scss +35 -35
- package/src/components/Drawer/Drawer.vue +97 -97
- package/src/components/Drawer/drawer.scss +36 -36
- package/src/components/Dropdown/Dropdown.vue +111 -111
- package/src/components/Dropdown/DropdownItem.vue +33 -29
- package/src/components/Dropdown/DropdownTitle.vue +8 -8
- package/src/components/Dropdown/dropdown-item.scss +77 -0
- package/src/components/Dropdown/dropdown.scss +39 -117
- package/src/components/Flex/Flex.vue +113 -106
- package/src/components/Grid/Grid.vue +60 -54
- package/src/components/Input/Counter.vue +70 -70
- package/src/components/Input/Dropzone.vue +65 -65
- package/src/components/Input/File.vue +15 -15
- package/src/components/Input/Input.vue +121 -121
- package/src/components/Input/Password.vue +47 -47
- package/src/components/Input/Textarea.vue +76 -76
- package/src/components/Input/input.scss +208 -208
- package/src/components/Kbd/Kbd.vue +48 -48
- package/src/components/Kbd/KbdGroup.vue +31 -31
- package/src/components/Kbd/kbd.scss +18 -18
- package/src/components/Modal/Confirm.vue +56 -56
- package/src/components/Modal/Modal.vue +91 -91
- package/src/components/Modal/modal.scss +49 -49
- package/src/components/OTP/OTP.vue +133 -133
- package/src/components/OTP/OTPItem.vue +37 -37
- package/src/components/OTP/otp.scss +83 -83
- package/src/components/Pagination/Pagination.vue +74 -74
- package/src/components/Pagination/pagination.ts +78 -78
- package/src/components/Popout/Popout.vue +42 -42
- package/src/components/Popout/popout.scss +8 -8
- package/src/components/Progress/Progress.vue +90 -90
- package/src/components/Progress/progress.scss +41 -41
- package/src/components/Radio/Radio.vue +36 -36
- package/src/components/Radio/RadioGroup.vue +40 -40
- package/src/components/Radio/radio.scss +68 -59
- package/src/components/Select/Select.vue +180 -180
- package/src/components/Select/select.scss +44 -44
- package/src/components/Sheet/Sheet.vue +92 -92
- package/src/components/Sheet/sheet.scss +60 -60
- package/src/components/Sidebar/Sidebar.vue +102 -0
- package/src/components/Sidebar/sidebar.scss +123 -0
- package/src/components/Skeleton/Skeleton.vue +43 -43
- package/src/components/Skeleton/skeleton.scss +14 -14
- package/src/components/Spinner/Spinner.vue +42 -42
- package/src/components/Spinner/spinner.scss +46 -46
- package/src/components/Switch/Switch.vue +30 -30
- package/src/components/Switch/switch.scss +60 -52
- package/src/components/Table/Cell.vue +23 -23
- package/src/components/Table/Header.vue +59 -59
- package/src/components/Table/Row.vue +9 -9
- package/src/components/Table/SelectAll.vue +23 -23
- package/src/components/Table/SelectRow.vue +29 -29
- package/src/components/Table/Table.vue +66 -66
- package/src/components/Table/table.scss +134 -134
- package/src/components/Table/table.ts +244 -244
- package/src/components/Tabs/Tab.vue +27 -27
- package/src/components/Tabs/Tabs.vue +89 -82
- package/src/components/Tabs/tabs.scss +80 -79
- package/src/components/Toast/Toasts.vue +47 -47
- package/src/components/Toast/toast.scss +41 -41
- package/src/components/Toast/toast.ts +68 -68
- package/src/components/Tooltip/Tooltip.vue +86 -86
- package/src/components/Tooltip/tooltip.scss +4 -4
- package/src/index.scss +1 -1
- package/src/index.ts +119 -119
- package/src/internal/Backdrop/Backdrop.vue +22 -22
- package/src/internal/Backdrop/backdrop.scss +28 -28
- package/src/main.ts +5 -5
- package/src/shared/helpers.ts +74 -74
- package/src/shared/types.ts +29 -29
- package/src/style/animation.scss +21 -21
- package/src/style/core.scss +150 -148
- package/src/style/layout.scss +168 -136
- package/src/style/media-query.scss +29 -29
- package/src/style/reset.scss +135 -135
- package/src/style/{fonts.scss → text.scss} +74 -53
- package/src/style/tooltip.scss +128 -128
- package/src/style/typography.scss +338 -338
- package/src/style/utils.scss +36 -36
|
@@ -1,90 +1,90 @@
|
|
|
1
|
-
<script setup lang='ts'>
|
|
2
|
-
import { computed, onMounted, useTemplateRef, watchEffect } from 'vue'
|
|
3
|
-
import { delay, formatUnitValue, isNil, randomMinMax } from '../../shared/helpers'
|
|
4
|
-
import './progress.scss'
|
|
5
|
-
|
|
6
|
-
interface Props {
|
|
7
|
-
/**
|
|
8
|
-
* Will randomly increment but never actually reach the end
|
|
9
|
-
*/
|
|
10
|
-
fake?: boolean
|
|
11
|
-
/**
|
|
12
|
-
* Indicator color. Use CSS color values or variables
|
|
13
|
-
*/
|
|
14
|
-
color?: string
|
|
15
|
-
/**
|
|
16
|
-
* Displays loader at the top of the page. It is only displayed when the
|
|
17
|
-
* progress is between 0 and 100 (exclusive).
|
|
18
|
-
*/
|
|
19
|
-
fixed?: boolean
|
|
20
|
-
/**
|
|
21
|
-
* Height
|
|
22
|
-
*/
|
|
23
|
-
height?: number | string
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
const {
|
|
27
|
-
fake,
|
|
28
|
-
color = 'var(--color-accent)',
|
|
29
|
-
fixed,
|
|
30
|
-
height,
|
|
31
|
-
} = defineProps<Props>()
|
|
32
|
-
|
|
33
|
-
const progressAmount = defineModel<number>({
|
|
34
|
-
default: 0,
|
|
35
|
-
set(value) {
|
|
36
|
-
return Math.min(value, 100)
|
|
37
|
-
},
|
|
38
|
-
})
|
|
39
|
-
|
|
40
|
-
// Set height programatically
|
|
41
|
-
const progressRef = useTemplateRef('progress')
|
|
42
|
-
|
|
43
|
-
watchEffect(() => {
|
|
44
|
-
if (progressRef.value && !isNil(height)) {
|
|
45
|
-
progressRef.value.style.setProperty(
|
|
46
|
-
'--vui-progress-height',
|
|
47
|
-
formatUnitValue(height),
|
|
48
|
-
)
|
|
49
|
-
}
|
|
50
|
-
})
|
|
51
|
-
|
|
52
|
-
// Automatically / randomly increment but never reach 100% until
|
|
53
|
-
async function fakeIncrement() {
|
|
54
|
-
if (fake && progressAmount.value < 100) {
|
|
55
|
-
if (progressAmount.value > 90) {
|
|
56
|
-
// Only in crement by the fraction of the remaining amount
|
|
57
|
-
progressAmount.value += (100 - progressAmount.value) * 0.05
|
|
58
|
-
await delay(randomMinMax(500, 3000))
|
|
59
|
-
}
|
|
60
|
-
else {
|
|
61
|
-
progressAmount.value += randomMinMax(1, 10)
|
|
62
|
-
await delay(randomMinMax(200, 1000))
|
|
63
|
-
}
|
|
64
|
-
fakeIncrement()
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
onMounted(fakeIncrement)
|
|
69
|
-
|
|
70
|
-
const w = computed(() => `${progressAmount.value}%`)
|
|
71
|
-
const bC = computed(() => color)
|
|
72
|
-
</script>
|
|
73
|
-
|
|
74
|
-
<template>
|
|
75
|
-
<div
|
|
76
|
-
ref="progress"
|
|
77
|
-
class="vui-progress"
|
|
78
|
-
:class="{
|
|
79
|
-
fixed,
|
|
80
|
-
'fixed-active': progressAmount > 0 && progressAmount < 100,
|
|
81
|
-
}"
|
|
82
|
-
>
|
|
83
|
-
<div
|
|
84
|
-
class="vui-progress-indicator" :style="{
|
|
85
|
-
width: w,
|
|
86
|
-
backgroundColor: bC,
|
|
87
|
-
}"
|
|
88
|
-
/>
|
|
89
|
-
</div>
|
|
90
|
-
</template>
|
|
1
|
+
<script setup lang='ts'>
|
|
2
|
+
import { computed, onMounted, useTemplateRef, watchEffect } from 'vue'
|
|
3
|
+
import { delay, formatUnitValue, isNil, randomMinMax } from '../../shared/helpers'
|
|
4
|
+
import './progress.scss'
|
|
5
|
+
|
|
6
|
+
interface Props {
|
|
7
|
+
/**
|
|
8
|
+
* Will randomly increment but never actually reach the end
|
|
9
|
+
*/
|
|
10
|
+
fake?: boolean
|
|
11
|
+
/**
|
|
12
|
+
* Indicator color. Use CSS color values or variables
|
|
13
|
+
*/
|
|
14
|
+
color?: string
|
|
15
|
+
/**
|
|
16
|
+
* Displays loader at the top of the page. It is only displayed when the
|
|
17
|
+
* progress is between 0 and 100 (exclusive).
|
|
18
|
+
*/
|
|
19
|
+
fixed?: boolean
|
|
20
|
+
/**
|
|
21
|
+
* Height
|
|
22
|
+
*/
|
|
23
|
+
height?: number | string
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const {
|
|
27
|
+
fake,
|
|
28
|
+
color = 'var(--color-accent)',
|
|
29
|
+
fixed,
|
|
30
|
+
height,
|
|
31
|
+
} = defineProps<Props>()
|
|
32
|
+
|
|
33
|
+
const progressAmount = defineModel<number>({
|
|
34
|
+
default: 0,
|
|
35
|
+
set(value) {
|
|
36
|
+
return Math.min(value, 100)
|
|
37
|
+
},
|
|
38
|
+
})
|
|
39
|
+
|
|
40
|
+
// Set height programatically
|
|
41
|
+
const progressRef = useTemplateRef('progress')
|
|
42
|
+
|
|
43
|
+
watchEffect(() => {
|
|
44
|
+
if (progressRef.value && !isNil(height)) {
|
|
45
|
+
progressRef.value.style.setProperty(
|
|
46
|
+
'--vui-progress-height',
|
|
47
|
+
formatUnitValue(height),
|
|
48
|
+
)
|
|
49
|
+
}
|
|
50
|
+
})
|
|
51
|
+
|
|
52
|
+
// Automatically / randomly increment but never reach 100% until
|
|
53
|
+
async function fakeIncrement() {
|
|
54
|
+
if (fake && progressAmount.value < 100) {
|
|
55
|
+
if (progressAmount.value > 90) {
|
|
56
|
+
// Only in crement by the fraction of the remaining amount
|
|
57
|
+
progressAmount.value += (100 - progressAmount.value) * 0.05
|
|
58
|
+
await delay(randomMinMax(500, 3000))
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
progressAmount.value += randomMinMax(1, 10)
|
|
62
|
+
await delay(randomMinMax(200, 1000))
|
|
63
|
+
}
|
|
64
|
+
fakeIncrement()
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
onMounted(fakeIncrement)
|
|
69
|
+
|
|
70
|
+
const w = computed(() => `${progressAmount.value}%`)
|
|
71
|
+
const bC = computed(() => color)
|
|
72
|
+
</script>
|
|
73
|
+
|
|
74
|
+
<template>
|
|
75
|
+
<div
|
|
76
|
+
ref="progress"
|
|
77
|
+
class="vui-progress"
|
|
78
|
+
:class="{
|
|
79
|
+
fixed,
|
|
80
|
+
'fixed-active': progressAmount > 0 && progressAmount < 100,
|
|
81
|
+
}"
|
|
82
|
+
>
|
|
83
|
+
<div
|
|
84
|
+
class="vui-progress-indicator" :style="{
|
|
85
|
+
width: w,
|
|
86
|
+
backgroundColor: bC,
|
|
87
|
+
}"
|
|
88
|
+
/>
|
|
89
|
+
</div>
|
|
90
|
+
</template>
|
|
@@ -1,41 +1,41 @@
|
|
|
1
|
-
.vui-progress {
|
|
2
|
-
--vui-progress-height: 3px;
|
|
3
|
-
|
|
4
|
-
display: block;
|
|
5
|
-
width: 100%;
|
|
6
|
-
position: relative;
|
|
7
|
-
border-radius: 999px;
|
|
8
|
-
background-color: var(--color-bg-lowered);
|
|
9
|
-
overflow: hidden;
|
|
10
|
-
height: var(--vui-progress-height);
|
|
11
|
-
|
|
12
|
-
&.fixed {
|
|
13
|
-
transition: var(--transition-slow);
|
|
14
|
-
transition-property: height;
|
|
15
|
-
position: fixed;
|
|
16
|
-
inset: 0;
|
|
17
|
-
bottom: unset;
|
|
18
|
-
height: 0;
|
|
19
|
-
border-radius: none !important;
|
|
20
|
-
|
|
21
|
-
&.fixed-active {
|
|
22
|
-
height: var(--vui-progress-height);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
.vui-progress-indicator {
|
|
26
|
-
border-top-left-radius: unset !important;
|
|
27
|
-
border-bottom-left-radius: unset !important;
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
.vui-progress-indicator {
|
|
32
|
-
position: absolute;
|
|
33
|
-
z-index: 4;
|
|
34
|
-
inset: 0;
|
|
35
|
-
right: unset;
|
|
36
|
-
width: 0;
|
|
37
|
-
border-radius: 999px;
|
|
38
|
-
background-color: var(--color-text-lighter);
|
|
39
|
-
transition: var(--transition-slow);
|
|
40
|
-
}
|
|
41
|
-
}
|
|
1
|
+
.vui-progress {
|
|
2
|
+
--vui-progress-height: 3px;
|
|
3
|
+
|
|
4
|
+
display: block;
|
|
5
|
+
width: 100%;
|
|
6
|
+
position: relative;
|
|
7
|
+
border-radius: 999px;
|
|
8
|
+
background-color: var(--color-bg-lowered);
|
|
9
|
+
overflow: hidden;
|
|
10
|
+
height: var(--vui-progress-height);
|
|
11
|
+
|
|
12
|
+
&.fixed {
|
|
13
|
+
transition: var(--transition-slow);
|
|
14
|
+
transition-property: height;
|
|
15
|
+
position: fixed;
|
|
16
|
+
inset: 0;
|
|
17
|
+
bottom: unset;
|
|
18
|
+
height: 0;
|
|
19
|
+
border-radius: none !important;
|
|
20
|
+
|
|
21
|
+
&.fixed-active {
|
|
22
|
+
height: var(--vui-progress-height);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.vui-progress-indicator {
|
|
26
|
+
border-top-left-radius: unset !important;
|
|
27
|
+
border-bottom-left-radius: unset !important;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.vui-progress-indicator {
|
|
32
|
+
position: absolute;
|
|
33
|
+
z-index: 4;
|
|
34
|
+
inset: 0;
|
|
35
|
+
right: unset;
|
|
36
|
+
width: 0;
|
|
37
|
+
border-radius: 999px;
|
|
38
|
+
background-color: var(--color-text-lighter);
|
|
39
|
+
transition: var(--transition-slow);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
@@ -1,36 +1,36 @@
|
|
|
1
|
-
<script setup lang='ts'>
|
|
2
|
-
import { Icon } from '@iconify/vue'
|
|
3
|
-
import { computed, useId } from 'vue'
|
|
4
|
-
import './radio.scss'
|
|
5
|
-
|
|
6
|
-
export interface RadioProps {
|
|
7
|
-
label?: string
|
|
8
|
-
disabled?: boolean
|
|
9
|
-
value: any
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
const {
|
|
13
|
-
label,
|
|
14
|
-
disabled,
|
|
15
|
-
value,
|
|
16
|
-
} = defineProps<RadioProps>()
|
|
17
|
-
const slots = defineSlots()
|
|
18
|
-
const checked = defineModel()
|
|
19
|
-
const id = useId()
|
|
20
|
-
const isChecked = computed(() => value === checked.value)
|
|
21
|
-
</script>
|
|
22
|
-
|
|
23
|
-
<template>
|
|
24
|
-
<div class="vui-radio" :class="{ disabled: !!disabled, checked: isChecked }">
|
|
25
|
-
<input :id v-model="checked" type="radio" :value :checked="isChecked">
|
|
26
|
-
<label :for="id">
|
|
27
|
-
<span class="vui-radio-icon">
|
|
28
|
-
<Icon :icon="isChecked ? 'ph:radio-button-fill' : 'ph:circle'" />
|
|
29
|
-
</span>
|
|
30
|
-
<p v-if="!slots.default" class="vui-radio-content">{{ label || value }}</p>
|
|
31
|
-
<div v-else class="vui-radio-content">
|
|
32
|
-
<slot />
|
|
33
|
-
</div>
|
|
34
|
-
</label>
|
|
35
|
-
</div>
|
|
36
|
-
</template>
|
|
1
|
+
<script setup lang='ts'>
|
|
2
|
+
import { Icon } from '@iconify/vue'
|
|
3
|
+
import { computed, useId } from 'vue'
|
|
4
|
+
import './radio.scss'
|
|
5
|
+
|
|
6
|
+
export interface RadioProps {
|
|
7
|
+
label?: string
|
|
8
|
+
disabled?: boolean
|
|
9
|
+
value: any
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const {
|
|
13
|
+
label,
|
|
14
|
+
disabled,
|
|
15
|
+
value,
|
|
16
|
+
} = defineProps<RadioProps>()
|
|
17
|
+
const slots = defineSlots()
|
|
18
|
+
const checked = defineModel()
|
|
19
|
+
const id = useId()
|
|
20
|
+
const isChecked = computed(() => value === checked.value)
|
|
21
|
+
</script>
|
|
22
|
+
|
|
23
|
+
<template>
|
|
24
|
+
<div class="vui-radio" :class="{ disabled: !!disabled, checked: isChecked }">
|
|
25
|
+
<input :id v-model="checked" type="radio" :value :checked="isChecked">
|
|
26
|
+
<label :for="id">
|
|
27
|
+
<span class="vui-radio-icon">
|
|
28
|
+
<Icon :icon="isChecked ? 'ph:radio-button-fill' : 'ph:circle'" />
|
|
29
|
+
</span>
|
|
30
|
+
<p v-if="!slots.default" class="vui-radio-content">{{ label || value }}</p>
|
|
31
|
+
<div v-else class="vui-radio-content">
|
|
32
|
+
<slot />
|
|
33
|
+
</div>
|
|
34
|
+
</label>
|
|
35
|
+
</div>
|
|
36
|
+
</template>
|
|
@@ -1,40 +1,40 @@
|
|
|
1
|
-
<script setup lang='ts'>
|
|
2
|
-
import type { FlexProps } from '../Flex/Flex.vue'
|
|
3
|
-
import type Radio from './Radio.vue'
|
|
4
|
-
import { watchEffect } from 'vue'
|
|
5
|
-
import Flex from '../Flex/Flex.vue'
|
|
6
|
-
|
|
7
|
-
interface Props extends FlexProps {
|
|
8
|
-
disabled?: boolean
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
const {
|
|
12
|
-
disabled,
|
|
13
|
-
...flexProps
|
|
14
|
-
} = defineProps<Props>()
|
|
15
|
-
|
|
16
|
-
const slots = defineSlots<{
|
|
17
|
-
default: () => Array<typeof Radio>
|
|
18
|
-
}>()
|
|
19
|
-
|
|
20
|
-
const checked = defineModel()
|
|
21
|
-
|
|
22
|
-
watchEffect(() => {
|
|
23
|
-
if (slots.default().some(s => s.type.__name !== 'Radio')) {
|
|
24
|
-
console.error('You can only pass `<Radio />` components as children.')
|
|
25
|
-
}
|
|
26
|
-
})
|
|
27
|
-
</script>
|
|
28
|
-
|
|
29
|
-
<template>
|
|
30
|
-
<Flex v-bind="flexProps">
|
|
31
|
-
<Component
|
|
32
|
-
:is="vnode"
|
|
33
|
-
v-for="vnode of slots.default()"
|
|
34
|
-
:key="vnode.props.value"
|
|
35
|
-
v-bind="vnode.props"
|
|
36
|
-
v-model="checked"
|
|
37
|
-
:class="{ disabled: disabled || vnode.props.disabled }"
|
|
38
|
-
/>
|
|
39
|
-
</Flex>
|
|
40
|
-
</template>
|
|
1
|
+
<script setup lang='ts'>
|
|
2
|
+
import type { FlexProps } from '../Flex/Flex.vue'
|
|
3
|
+
import type Radio from './Radio.vue'
|
|
4
|
+
import { watchEffect } from 'vue'
|
|
5
|
+
import Flex from '../Flex/Flex.vue'
|
|
6
|
+
|
|
7
|
+
interface Props extends FlexProps {
|
|
8
|
+
disabled?: boolean
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const {
|
|
12
|
+
disabled,
|
|
13
|
+
...flexProps
|
|
14
|
+
} = defineProps<Props>()
|
|
15
|
+
|
|
16
|
+
const slots = defineSlots<{
|
|
17
|
+
default: () => Array<typeof Radio>
|
|
18
|
+
}>()
|
|
19
|
+
|
|
20
|
+
const checked = defineModel()
|
|
21
|
+
|
|
22
|
+
watchEffect(() => {
|
|
23
|
+
if (slots.default().some(s => s.type.__name !== 'Radio')) {
|
|
24
|
+
console.error('You can only pass `<Radio />` components as children.')
|
|
25
|
+
}
|
|
26
|
+
})
|
|
27
|
+
</script>
|
|
28
|
+
|
|
29
|
+
<template>
|
|
30
|
+
<Flex v-bind="flexProps">
|
|
31
|
+
<Component
|
|
32
|
+
:is="vnode"
|
|
33
|
+
v-for="vnode of slots.default()"
|
|
34
|
+
:key="vnode.props.value"
|
|
35
|
+
v-bind="vnode.props"
|
|
36
|
+
v-model="checked"
|
|
37
|
+
:class="{ disabled: disabled || vnode.props.disabled }"
|
|
38
|
+
/>
|
|
39
|
+
</Flex>
|
|
40
|
+
</template>
|
|
@@ -1,59 +1,68 @@
|
|
|
1
|
-
.vui-radio {
|
|
2
|
-
--radio-size: 24px;
|
|
3
|
-
|
|
4
|
-
&.checked {
|
|
5
|
-
.vui-radio-icon svg {
|
|
6
|
-
color: var(--color-text);
|
|
7
|
-
}
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
&.disabled {
|
|
11
|
-
cursor: not-allowed;
|
|
12
|
-
pointer-events: none;
|
|
13
|
-
|
|
14
|
-
.vui-radio-icon svg path {
|
|
15
|
-
color: var(--color-text-lighter) !important;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
input + label p {
|
|
19
|
-
color: var(--color-text-lighter);
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
.vui-radio-icon {
|
|
24
|
-
cursor: pointer;
|
|
25
|
-
width: var(--radio-size);
|
|
26
|
-
height: var(--radio-size);
|
|
27
|
-
|
|
28
|
-
svg {
|
|
29
|
-
width: 100%;
|
|
30
|
-
height: 100%;
|
|
31
|
-
color: var(--color-text);
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
input {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
1
|
+
.vui-radio {
|
|
2
|
+
--radio-size: 24px;
|
|
3
|
+
|
|
4
|
+
&.checked {
|
|
5
|
+
.vui-radio-icon svg {
|
|
6
|
+
color: var(--color-text);
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
&.disabled {
|
|
11
|
+
cursor: not-allowed;
|
|
12
|
+
pointer-events: none;
|
|
13
|
+
|
|
14
|
+
.vui-radio-icon svg path {
|
|
15
|
+
color: var(--color-text-lighter) !important;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
input + label p {
|
|
19
|
+
color: var(--color-text-lighter);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.vui-radio-icon {
|
|
24
|
+
cursor: pointer;
|
|
25
|
+
width: var(--radio-size);
|
|
26
|
+
height: var(--radio-size);
|
|
27
|
+
|
|
28
|
+
svg {
|
|
29
|
+
width: 100%;
|
|
30
|
+
height: 100%;
|
|
31
|
+
color: var(--color-text);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
input {
|
|
36
|
+
width: 1px;
|
|
37
|
+
height: 1px;
|
|
38
|
+
position: absolute;
|
|
39
|
+
overflow: hidden;
|
|
40
|
+
outline: none !important;
|
|
41
|
+
|
|
42
|
+
&:focus-visible + label .vui-radio-icon {
|
|
43
|
+
outline: 2px solid var(--color-text);
|
|
44
|
+
border-radius: 999px;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
& + label {
|
|
48
|
+
display: grid;
|
|
49
|
+
grid-template-columns: 20px 1fr;
|
|
50
|
+
gap: 10px;
|
|
51
|
+
font-size: var(--font-size-s);
|
|
52
|
+
color: var(--color-text);
|
|
53
|
+
user-select: none;
|
|
54
|
+
|
|
55
|
+
.vui-radio-content {
|
|
56
|
+
display: block;
|
|
57
|
+
|
|
58
|
+
&:is(p) {
|
|
59
|
+
display: flex;
|
|
60
|
+
align-items: center;
|
|
61
|
+
min-height: var(--radio-size);
|
|
62
|
+
font-size: var(--font-size-ms);
|
|
63
|
+
// line-height: var(--radio-size);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|