@dolanske/vui 0.3.3 → 0.3.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.
Files changed (108) hide show
  1. package/LICENSE +673 -673
  2. package/README.md +40 -40
  3. package/dist/components/Avatar/Avatar.vue.d.ts +1 -0
  4. package/dist/style.css +1 -1
  5. package/dist/vui.js +710 -702
  6. package/package.json +68 -68
  7. package/src/App.vue +175 -165
  8. package/src/components/Accordion/Accordion.vue +91 -91
  9. package/src/components/Accordion/AccordionGroup.vue +43 -43
  10. package/src/components/Accordion/accordion.scss +80 -80
  11. package/src/components/Alert/Alert.vue +53 -53
  12. package/src/components/Alert/alert.scss +80 -80
  13. package/src/components/Avatar/Avatar.vue +50 -43
  14. package/src/components/Avatar/avatar.scss +52 -52
  15. package/src/components/Badge/Badge.vue +21 -21
  16. package/src/components/Badge/badge.scss +89 -89
  17. package/src/components/Breadcrumbs/BreadcrumbItem.vue +26 -26
  18. package/src/components/Breadcrumbs/Breadcrumbs.vue +33 -33
  19. package/src/components/Breadcrumbs/breadcrumbs.scss +30 -30
  20. package/src/components/Button/Button.vue +90 -90
  21. package/src/components/Button/button.scss +176 -176
  22. package/src/components/ButtonGroup/ButtonGroup.vue +25 -25
  23. package/src/components/ButtonGroup/button-group.scss +51 -51
  24. package/src/components/Calendar/Calendar.vue +60 -60
  25. package/src/components/Calendar/calendar.scss +56 -56
  26. package/src/components/Card/Card.vue +48 -48
  27. package/src/components/Card/card.scss +53 -53
  28. package/src/components/Checkbox/Checkbox.vue +52 -52
  29. package/src/components/Checkbox/checkbox.scss +66 -66
  30. package/src/components/CopyClipboard/CopyClipboard.vue +82 -82
  31. package/src/components/CopyClipboard/copy-clipboard.scss +17 -17
  32. package/src/components/Divider/Divider.vue +44 -44
  33. package/src/components/Divider/divider.scss +35 -35
  34. package/src/components/Drawer/Drawer.vue +97 -97
  35. package/src/components/Drawer/drawer.scss +36 -36
  36. package/src/components/Dropdown/Dropdown.vue +111 -110
  37. package/src/components/Dropdown/DropdownItem.vue +29 -29
  38. package/src/components/Dropdown/DropdownTitle.vue +8 -8
  39. package/src/components/Dropdown/dropdown.scss +117 -116
  40. package/src/components/Flex/Flex.vue +106 -106
  41. package/src/components/Grid/Grid.vue +54 -54
  42. package/src/components/Input/Counter.vue +70 -70
  43. package/src/components/Input/Dropzone.vue +65 -65
  44. package/src/components/Input/File.vue +15 -15
  45. package/src/components/Input/Input.vue +121 -121
  46. package/src/components/Input/Password.vue +47 -47
  47. package/src/components/Input/Textarea.vue +76 -76
  48. package/src/components/Input/input.scss +208 -208
  49. package/src/components/Kbd/Kbd.vue +48 -48
  50. package/src/components/Kbd/KbdGroup.vue +31 -31
  51. package/src/components/Kbd/kbd.scss +18 -18
  52. package/src/components/Modal/Confirm.vue +56 -56
  53. package/src/components/Modal/Modal.vue +91 -91
  54. package/src/components/Modal/modal.scss +49 -49
  55. package/src/components/OTP/OTP.vue +133 -133
  56. package/src/components/OTP/OTPItem.vue +37 -37
  57. package/src/components/OTP/otp.scss +83 -83
  58. package/src/components/Pagination/Pagination.vue +74 -74
  59. package/src/components/Pagination/pagination.ts +78 -78
  60. package/src/components/Popout/Popout.vue +42 -39
  61. package/src/components/Popout/popout.scss +8 -8
  62. package/src/components/Progress/Progress.vue +90 -90
  63. package/src/components/Progress/progress.scss +41 -41
  64. package/src/components/Radio/Radio.vue +36 -36
  65. package/src/components/Radio/RadioGroup.vue +40 -40
  66. package/src/components/Radio/radio.scss +59 -59
  67. package/src/components/Select/Select.vue +180 -180
  68. package/src/components/Select/select.scss +44 -44
  69. package/src/components/Sheet/Sheet.vue +92 -92
  70. package/src/components/Sheet/sheet.scss +60 -60
  71. package/src/components/Skeleton/Skeleton.vue +43 -43
  72. package/src/components/Skeleton/skeleton.scss +14 -14
  73. package/src/components/Spinner/Spinner.vue +42 -42
  74. package/src/components/Spinner/spinner.scss +46 -46
  75. package/src/components/Switch/Switch.vue +30 -30
  76. package/src/components/Switch/switch.scss +52 -52
  77. package/src/components/Table/Cell.vue +23 -23
  78. package/src/components/Table/Header.vue +59 -59
  79. package/src/components/Table/Row.vue +9 -9
  80. package/src/components/Table/SelectAll.vue +23 -23
  81. package/src/components/Table/SelectRow.vue +29 -29
  82. package/src/components/Table/Table.vue +66 -66
  83. package/src/components/Table/table.scss +134 -134
  84. package/src/components/Table/table.ts +244 -244
  85. package/src/components/Tabs/Tab.vue +27 -27
  86. package/src/components/Tabs/Tabs.vue +82 -82
  87. package/src/components/Tabs/tabs.scss +79 -79
  88. package/src/components/Toast/Toasts.vue +47 -47
  89. package/src/components/Toast/toast.scss +41 -41
  90. package/src/components/Toast/toast.ts +68 -68
  91. package/src/components/Tooltip/Tooltip.vue +86 -84
  92. package/src/components/Tooltip/tooltip.scss +4 -4
  93. package/src/index.scss +1 -1
  94. package/src/index.ts +119 -119
  95. package/src/internal/Backdrop/Backdrop.vue +22 -22
  96. package/src/internal/Backdrop/backdrop.scss +28 -28
  97. package/src/main.ts +5 -5
  98. package/src/shared/helpers.ts +74 -74
  99. package/src/shared/types.ts +29 -29
  100. package/src/style/animation.scss +21 -21
  101. package/src/style/core.scss +148 -146
  102. package/src/style/fonts.scss +53 -53
  103. package/src/style/layout.scss +136 -136
  104. package/src/style/media-query.scss +29 -29
  105. package/src/style/reset.scss +135 -135
  106. package/src/style/tooltip.scss +128 -128
  107. package/src/style/typography.scss +338 -338
  108. package/src/style/utils.scss +36 -36
@@ -1,78 +1,78 @@
1
- import { createArray } from '../../shared/helpers'
2
-
3
- export interface Pagination {
4
- totalItems: number
5
- currentPage: number
6
- perPage: number
7
- totalPages: number
8
- startPage: number
9
- endPage: number
10
- startIndex: number
11
- endIndex: number
12
- pages: number[]
13
- }
14
-
15
- export function paginate(
16
- totalItems: number,
17
- currentPage: number = 1,
18
- perPage: number = 15,
19
- maxPages: number = 5,
20
- ): Pagination {
21
- // calculate total pages
22
- const totalPages = Math.ceil(totalItems / perPage)
23
-
24
- // ensure current page isn't out of range
25
- if (currentPage < 1) {
26
- currentPage = 1
27
- }
28
- else if (currentPage > totalPages) {
29
- currentPage = totalPages
30
- }
31
-
32
- let startPage: number, endPage: number
33
- if (totalPages <= maxPages) {
34
- // total pages less than max so show all pages
35
- startPage = 1
36
- endPage = totalPages
37
- }
38
- else {
39
- // total pages more than max so calculate start and end pages
40
- const maxPagesBeforeCurrentPage = Math.floor(maxPages / 2)
41
- const maxPagesAfterCurrentPage = Math.ceil(maxPages / 2) - 1
42
- if (currentPage <= maxPagesBeforeCurrentPage) {
43
- // current page near the start
44
- startPage = 1
45
- endPage = maxPages
46
- }
47
- else if (currentPage + maxPagesAfterCurrentPage >= totalPages) {
48
- // current page near the end
49
- startPage = totalPages - maxPages + 1
50
- endPage = totalPages
51
- }
52
- else {
53
- // current page somewhere in the middle
54
- startPage = currentPage - maxPagesBeforeCurrentPage
55
- endPage = currentPage + maxPagesAfterCurrentPage
56
- }
57
- }
58
-
59
- // calculate start and end item indexes
60
- const startIndex = (currentPage - 1) * perPage
61
- const endIndex = Math.min(startIndex + perPage - 1, totalItems - 1)
62
-
63
- // create an array of pages to ng-repeat in the pager control
64
- const pages = createArray((endPage + 1) - startPage).map(i => startPage + i)
65
-
66
- // return object with all pager properties required by the view
67
- return {
68
- totalItems,
69
- currentPage,
70
- perPage,
71
- totalPages,
72
- startPage,
73
- endPage,
74
- startIndex,
75
- endIndex,
76
- pages,
77
- }
78
- }
1
+ import { createArray } from '../../shared/helpers'
2
+
3
+ export interface Pagination {
4
+ totalItems: number
5
+ currentPage: number
6
+ perPage: number
7
+ totalPages: number
8
+ startPage: number
9
+ endPage: number
10
+ startIndex: number
11
+ endIndex: number
12
+ pages: number[]
13
+ }
14
+
15
+ export function paginate(
16
+ totalItems: number,
17
+ currentPage: number = 1,
18
+ perPage: number = 15,
19
+ maxPages: number = 5,
20
+ ): Pagination {
21
+ // calculate total pages
22
+ const totalPages = Math.ceil(totalItems / perPage)
23
+
24
+ // ensure current page isn't out of range
25
+ if (currentPage < 1) {
26
+ currentPage = 1
27
+ }
28
+ else if (currentPage > totalPages) {
29
+ currentPage = totalPages
30
+ }
31
+
32
+ let startPage: number, endPage: number
33
+ if (totalPages <= maxPages) {
34
+ // total pages less than max so show all pages
35
+ startPage = 1
36
+ endPage = totalPages
37
+ }
38
+ else {
39
+ // total pages more than max so calculate start and end pages
40
+ const maxPagesBeforeCurrentPage = Math.floor(maxPages / 2)
41
+ const maxPagesAfterCurrentPage = Math.ceil(maxPages / 2) - 1
42
+ if (currentPage <= maxPagesBeforeCurrentPage) {
43
+ // current page near the start
44
+ startPage = 1
45
+ endPage = maxPages
46
+ }
47
+ else if (currentPage + maxPagesAfterCurrentPage >= totalPages) {
48
+ // current page near the end
49
+ startPage = totalPages - maxPages + 1
50
+ endPage = totalPages
51
+ }
52
+ else {
53
+ // current page somewhere in the middle
54
+ startPage = currentPage - maxPagesBeforeCurrentPage
55
+ endPage = currentPage + maxPagesAfterCurrentPage
56
+ }
57
+ }
58
+
59
+ // calculate start and end item indexes
60
+ const startIndex = (currentPage - 1) * perPage
61
+ const endIndex = Math.min(startIndex + perPage - 1, totalItems - 1)
62
+
63
+ // create an array of pages to ng-repeat in the pager control
64
+ const pages = createArray((endPage + 1) - startPage).map(i => startPage + i)
65
+
66
+ // return object with all pager properties required by the view
67
+ return {
68
+ totalItems,
69
+ currentPage,
70
+ perPage,
71
+ totalPages,
72
+ startPage,
73
+ endPage,
74
+ startIndex,
75
+ endIndex,
76
+ pages,
77
+ }
78
+ }
@@ -1,39 +1,42 @@
1
- <script setup lang='ts'>
2
- import type { Placement, PopoutMaybeElement } from '../../shared/types'
3
- import { autoPlacement, offset, useFloating } from '@floating-ui/vue'
4
- import { toRef, useTemplateRef } from 'vue'
5
- import './popout.scss'
6
-
7
- export interface Props {
8
- anchor: PopoutMaybeElement<HTMLElement>
9
- /**
10
- * Override the autoPlacement option
11
- */
12
- placement?: Placement
13
- /**
14
- * Distance between the anchor and the rendered tooltip
15
- */
16
- offset?: number
17
- }
18
-
19
- const props = withDefaults(defineProps<Props>(), {
20
- offset: 8,
21
- })
22
-
23
- const popoutRef = useTemplateRef('popout')
24
- const anchorRef = toRef(props.anchor)
25
-
26
- const { floatingStyles } = useFloating(anchorRef, popoutRef, {
27
- placement: props.placement,
28
- middleware: [
29
- ...(props.placement ? [] : [autoPlacement()]),
30
- offset(props.offset),
31
- ],
32
- })
33
- </script>
34
-
35
- <template>
36
- <div ref="popout" :style="floatingStyles" class="vui-popout">
37
- <slot />
38
- </div>
39
- </template>
1
+ <script setup lang='ts'>
2
+ import type { Placement, PopoutMaybeElement } from '../../shared/types'
3
+ import { autoPlacement, offset, shift, useFloating } from '@floating-ui/vue'
4
+ import { toRef, useTemplateRef } from 'vue'
5
+ import './popout.scss'
6
+
7
+ export interface Props {
8
+ anchor: PopoutMaybeElement<HTMLElement>
9
+ /**
10
+ * Override the autoPlacement option
11
+ */
12
+ placement?: Placement
13
+ /**
14
+ * Distance between the anchor and the rendered tooltip
15
+ */
16
+ offset?: number
17
+ }
18
+
19
+ const props = withDefaults(defineProps<Props>(), {
20
+ offset: 8,
21
+ })
22
+
23
+ const popoutRef = useTemplateRef('popout')
24
+ const anchorRef = toRef(props.anchor)
25
+
26
+ const { floatingStyles } = useFloating(anchorRef, popoutRef, {
27
+ placement: props.placement,
28
+ middleware: [
29
+ ...(props.placement ? [] : [autoPlacement()]),
30
+ offset(props.offset),
31
+ shift({
32
+ padding: 8,
33
+ }),
34
+ ],
35
+ })
36
+ </script>
37
+
38
+ <template>
39
+ <div ref="popout" :style="floatingStyles" class="vui-popout">
40
+ <slot />
41
+ </div>
42
+ </template>
@@ -1,8 +1,8 @@
1
- .vui-popout {
2
- border-radius: var(--border-radius);
3
- box-shadow: var(--box-shadow);
4
- min-width: 80px;
5
- background-color: var(--color-bg-raised);
6
- border-radius: var(--border-radius-m);
7
- z-index: 1000;
8
- }
1
+ .vui-popout {
2
+ border-radius: var(--border-radius);
3
+ box-shadow: var(--box-shadow);
4
+ min-width: 80px;
5
+ background-color: var(--color-bg-raised);
6
+ border-radius: var(--border-radius-m);
7
+ z-index: 1000;
8
+ }
@@ -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>