daisy-ui-kit 5.0.0-pre.5 → 5.0.0-pre.6

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 (132) hide show
  1. package/app/components/Accordion.vue +26 -0
  2. package/app/components/Alert.vue +35 -0
  3. package/app/components/Avatar.vue +128 -0
  4. package/app/components/AvatarGroup.vue +18 -0
  5. package/app/components/Badge.vue +54 -0
  6. package/app/components/Breadcrumbs.vue +7 -0
  7. package/app/components/Button.vue +113 -0
  8. package/app/components/Calendar.vue +66 -0
  9. package/app/components/CalendarInput.vue +176 -0
  10. package/app/components/CalendarSkeleton.vue +46 -0
  11. package/app/components/Card.vue +33 -0
  12. package/app/components/CardActions.vue +13 -0
  13. package/app/components/CardBody.vue +13 -0
  14. package/app/components/CardTitle.vue +11 -0
  15. package/app/components/Carousel.vue +23 -0
  16. package/app/components/CarouselItem.vue +5 -0
  17. package/app/components/Chat.vue +21 -0
  18. package/app/components/ChatBubble.vue +31 -0
  19. package/app/components/ChatFooter.vue +5 -0
  20. package/app/components/ChatHeader.vue +5 -0
  21. package/app/components/ChatImage.vue +5 -0
  22. package/app/components/Checkbox.vue +49 -0
  23. package/app/components/Collapse.vue +43 -0
  24. package/app/components/CollapseContent.vue +5 -0
  25. package/app/components/CollapseTitle.vue +5 -0
  26. package/app/components/Countdown.vue +15 -0
  27. package/app/components/CountdownTimers.vue +72 -0
  28. package/app/components/Counter.vue +10 -0
  29. package/app/components/Crumb.vue +5 -0
  30. package/app/components/DaisyLink.vue +38 -0
  31. package/app/components/Diff.vue +11 -0
  32. package/app/components/Divider.vue +43 -0
  33. package/app/components/Dock.vue +58 -0
  34. package/app/components/DockItem.vue +25 -0
  35. package/app/components/DockLabel.vue +5 -0
  36. package/app/components/Drawer.vue +47 -0
  37. package/app/components/DrawerContent.vue +17 -0
  38. package/app/components/DrawerSide.vue +18 -0
  39. package/app/components/Dropdown.vue +95 -0
  40. package/app/components/DropdownButton.vue +16 -0
  41. package/app/components/DropdownContent.vue +57 -0
  42. package/app/components/DropdownTarget.vue +14 -0
  43. package/app/components/Fieldset.vue +19 -0
  44. package/app/components/FileInput.vue +53 -0
  45. package/app/components/Filter.vue +122 -0
  46. package/app/components/Flex.vue +82 -0
  47. package/app/components/FlexItem.vue +59 -0
  48. package/app/components/Footer.vue +27 -0
  49. package/app/components/FooterTitle.vue +15 -0
  50. package/app/components/FormControl.vue +5 -0
  51. package/app/components/Hero.vue +15 -0
  52. package/app/components/HeroContent.vue +15 -0
  53. package/app/components/HeroOverlay.vue +5 -0
  54. package/app/components/Indicator.vue +13 -0
  55. package/app/components/IndicatorItem.vue +36 -0
  56. package/app/components/Input.vue +102 -0
  57. package/app/components/Join.vue +5 -0
  58. package/app/components/Kbd.vue +24 -0
  59. package/app/components/Label.vue +61 -0
  60. package/app/components/List.vue +5 -0
  61. package/app/components/ListColGrow.vue +5 -0
  62. package/app/components/ListColWrap.vue +5 -0
  63. package/app/components/ListRow.vue +5 -0
  64. package/app/components/LoadingBall.vue +42 -0
  65. package/app/components/LoadingBars.vue +42 -0
  66. package/app/components/LoadingDots.vue +42 -0
  67. package/app/components/LoadingInfinity.vue +42 -0
  68. package/app/components/LoadingRing.vue +42 -0
  69. package/app/components/LoadingSpinner.vue +42 -0
  70. package/app/components/Mask.vue +49 -0
  71. package/app/components/Menu.vue +30 -0
  72. package/app/components/MenuExpand.vue +100 -0
  73. package/app/components/MenuExpandToggle.vue +14 -0
  74. package/app/components/MenuItem.vue +37 -0
  75. package/app/components/MenuTitle.vue +5 -0
  76. package/app/components/MockupBrowser.vue +5 -0
  77. package/app/components/MockupBrowserToolbar.vue +5 -0
  78. package/app/components/MockupCode.vue +4 -0
  79. package/app/components/MockupPhone.vue +8 -0
  80. package/app/components/MockupWindow.vue +5 -0
  81. package/app/components/Modal.vue +57 -0
  82. package/app/components/ModalAction.vue +5 -0
  83. package/app/components/ModalBox.vue +5 -0
  84. package/app/components/NavButton.vue +12 -0
  85. package/app/components/Navbar.vue +12 -0
  86. package/app/components/NavbarCenter.vue +11 -0
  87. package/app/components/NavbarEnd.vue +11 -0
  88. package/app/components/NavbarStart.vue +11 -0
  89. package/app/components/Progress.vue +34 -0
  90. package/app/components/Prose.vue +32 -0
  91. package/app/components/RadialProgress.vue +36 -0
  92. package/app/components/Radio.vue +67 -0
  93. package/app/components/RadioGroup.vue +47 -0
  94. package/app/components/Range.vue +61 -0
  95. package/app/components/RangeMeasure.vue +84 -0
  96. package/app/components/RangeMeasureTick.vue +70 -0
  97. package/app/components/Rating.vue +180 -0
  98. package/app/components/Select.vue +104 -0
  99. package/app/components/Skeleton.vue +5 -0
  100. package/app/components/Stack.vue +25 -0
  101. package/app/components/Stat.vue +19 -0
  102. package/app/components/StatActions.vue +5 -0
  103. package/app/components/StatDesc.vue +5 -0
  104. package/app/components/StatFigure.vue +5 -0
  105. package/app/components/StatTitle.vue +5 -0
  106. package/app/components/StatValue.vue +5 -0
  107. package/app/components/Stats.vue +5 -0
  108. package/app/components/Status.vue +43 -0
  109. package/app/components/Step.vue +34 -0
  110. package/app/components/StepIcon.vue +5 -0
  111. package/app/components/Steps.vue +18 -0
  112. package/app/components/Swap.vue +62 -0
  113. package/app/components/Tab.vue +38 -0
  114. package/app/components/TabContent.vue +29 -0
  115. package/app/components/Table.vue +32 -0
  116. package/app/components/Tabs.vue +53 -0
  117. package/app/components/Text.vue +142 -0
  118. package/app/components/TextArea.vue +61 -0
  119. package/app/components/Timeline.vue +22 -0
  120. package/app/components/TimelineEnd.vue +14 -0
  121. package/app/components/TimelineItem.vue +5 -0
  122. package/app/components/TimelineLine.vue +29 -0
  123. package/app/components/TimelineMiddle.vue +5 -0
  124. package/app/components/TimelineStart.vue +13 -0
  125. package/app/components/Toast.vue +29 -0
  126. package/app/components/Toggle.vue +58 -0
  127. package/app/components/Tooltip.vue +47 -0
  128. package/app/components/TooltipContent.vue +5 -0
  129. package/app/components/ValidatorHint.vue +5 -0
  130. package/app/utils/drawer-utils.ts +32 -0
  131. package/app/utils/random-string.ts +19 -0
  132. package/package.json +4 -4
@@ -0,0 +1,180 @@
1
+ <script setup lang="ts">
2
+ import { computed } from 'vue'
3
+
4
+ const props = withDefaults(defineProps<{
5
+ modelValue?: number | string
6
+ count?: number | string
7
+ half?: boolean
8
+
9
+ disabled?: boolean
10
+
11
+ color?: string
12
+ neutral?: boolean
13
+ primary?: boolean
14
+ secondary?: boolean
15
+ accent?: boolean
16
+ info?: boolean
17
+ success?: boolean
18
+ warning?: boolean
19
+ error?: boolean
20
+
21
+ bg?: string
22
+
23
+ shape?: string
24
+ squircle?: boolean
25
+ heart?: boolean
26
+ hexagon?: boolean
27
+ hexagon2?: boolean
28
+ decagon?: boolean
29
+ pentagon?: boolean
30
+ diamond?: boolean
31
+ square?: boolean
32
+ circle?: boolean
33
+
34
+ star?: boolean
35
+ star2?: boolean
36
+ triangle?: boolean
37
+ triangle2?: boolean
38
+ triangle3?: boolean
39
+ triangle4?: boolean
40
+
41
+ size?: 'lg' | 'md' | 'sm' | 'xs' | 'xl'
42
+ xl?: boolean
43
+ lg?: boolean
44
+ md?: boolean
45
+ sm?: boolean
46
+ xs?: boolean
47
+ }>(), {
48
+ count: 5,
49
+ })
50
+ const emit = defineEmits(['update:modelValue'])
51
+
52
+ const max = computed(() => Number.parseInt(props.count as string))
53
+
54
+ function handleValue(digit: number, half = false) {
55
+ if (props.disabled) {
56
+ return
57
+ }
58
+
59
+ if (props.half) {
60
+ emit('update:modelValue', half ? digit - 0.5 : digit)
61
+ return
62
+ }
63
+
64
+ emit('update:modelValue', digit)
65
+ }
66
+
67
+ // Check if any shape prop is set
68
+ const hasShape = computed(() => {
69
+ return props.shape || props.squircle || props.heart || props.hexagon
70
+ || props.hexagon2 || props.decagon || props.pentagon || props.diamond
71
+ || props.square || props.circle || props.star || props.star2
72
+ || props.triangle || props.triangle2 || props.triangle3 || props.triangle4
73
+ })
74
+ </script>
75
+
76
+ <template>
77
+ <div
78
+ class="rating"
79
+ :class="{
80
+ 'rating-half': half,
81
+ 'rating-xl': xl || size === 'xl',
82
+ 'rating-lg': lg || size === 'lg',
83
+ 'rating-md': md || size === 'md',
84
+ 'rating-sm': sm || size === 'sm',
85
+ 'rating-xs': xs || size === 'xs',
86
+ 'opacity-60': disabled,
87
+ 'cursor-not-allowed': disabled,
88
+ }"
89
+ >
90
+ <input
91
+ type="radio"
92
+ :value="0"
93
+ class="rating-hidden"
94
+ :checked="modelValue === 0"
95
+ @change="$emit('update:modelValue', 0)"
96
+ >
97
+ <template v-for="digit in max" :key="digit">
98
+ <input
99
+ type="radio"
100
+ :value="half ? digit - 0.5 : digit"
101
+ :disabled="disabled"
102
+ class="mask"
103
+ :class="[
104
+ bg,
105
+ { 'mask-half-1': half },
106
+ { 'cursor-not-allowed opacity-50': disabled },
107
+
108
+ // Color classes
109
+ { 'bg-neutral': neutral || color === 'neutral' },
110
+ { 'bg-primary': primary || color === 'primary' },
111
+ { 'bg-secondary': secondary || color === 'secondary' },
112
+ { 'bg-accent': accent || color === 'accent' },
113
+ { 'bg-info': info || color === 'info' },
114
+ { 'bg-success': success || color === 'success' },
115
+ { 'bg-warning': warning || color === 'warning' },
116
+ { 'bg-error': error || color === 'error' },
117
+
118
+ // Shape classes
119
+ { 'mask-squircle': squircle || shape === 'squircle' },
120
+ { 'mask-heart': heart || shape === 'heart' },
121
+ { 'mask-hexagon': hexagon || shape === 'hexagon' },
122
+ { 'mask-hexagon-2': hexagon2 || shape === 'hexagon-2' },
123
+ { 'mask-decagon': decagon || shape === 'decagon' },
124
+ { 'mask-pentagon': pentagon || shape === 'pentagon' },
125
+ { 'mask-diamond': diamond || shape === 'diamond' },
126
+ { 'mask-square': square || shape === 'square' },
127
+ { 'mask-circle': circle || shape === 'circle' },
128
+ { 'mask-star': star || shape === 'star' },
129
+ { 'mask-star-2': star2 || shape === 'star-2' || !hasShape },
130
+ { 'mask-triangle': triangle || shape === 'triangle' },
131
+ { 'mask-triangle-2': triangle2 || shape === 'triangle-2' },
132
+ { 'mask-triangle-3': triangle3 || shape === 'triangle-3' },
133
+ { 'mask-triangle-4': triangle4 || shape === 'triangle-4' },
134
+ ]"
135
+ :checked="half ? modelValue === digit - 0.5 : modelValue === digit"
136
+ @change="() => handleValue(digit, true)"
137
+ >
138
+ <input
139
+ v-if="half"
140
+ type="radio"
141
+ :value="digit"
142
+ class="mask mask-half-2"
143
+ :disabled="disabled"
144
+ :class="[
145
+ bg,
146
+ { 'cursor-not-allowed opacity-50': disabled },
147
+
148
+ // Color classes
149
+ { 'bg-neutral': neutral || color === 'neutral' },
150
+ { 'bg-primary': primary || color === 'primary' },
151
+ { 'bg-secondary': secondary || color === 'secondary' },
152
+ { 'bg-accent': accent || color === 'accent' },
153
+ { 'bg-info': info || color === 'info' },
154
+ { 'bg-success': success || color === 'success' },
155
+ { 'bg-warning': warning || color === 'warning' },
156
+ { 'bg-error': error || color === 'error' },
157
+
158
+ // Shape classes
159
+ { 'mask-squircle': squircle || shape === 'squircle' },
160
+ { 'mask-heart': heart || shape === 'heart' },
161
+ { 'mask-hexagon': hexagon || shape === 'hexagon' },
162
+ { 'mask-hexagon-2': hexagon2 || shape === 'hexagon-2' },
163
+ { 'mask-decagon': decagon || shape === 'decagon' },
164
+ { 'mask-pentagon': pentagon || shape === 'pentagon' },
165
+ { 'mask-diamond': diamond || shape === 'diamond' },
166
+ { 'mask-square': square || shape === 'square' },
167
+ { 'mask-circle': circle || shape === 'circle' },
168
+ { 'mask-star': star || shape === 'star' },
169
+ { 'mask-star-2': star2 || shape === 'star-2' || !hasShape },
170
+ { 'mask-triangle': triangle || shape === 'triangle' },
171
+ { 'mask-triangle-2': triangle2 || shape === 'triangle-2' },
172
+ { 'mask-triangle-3': triangle3 || shape === 'triangle-3' },
173
+ { 'mask-triangle-4': triangle4 || shape === 'triangle-4' },
174
+ ]"
175
+ :checked="modelValue === digit"
176
+ @change="() => handleValue(digit)"
177
+ >
178
+ </template>
179
+ </div>
180
+ </template>
@@ -0,0 +1,104 @@
1
+ <script setup lang="ts">
2
+ import { computed } from 'vue';
3
+
4
+ type Color = | 'primary' | 'secondary' | 'accent' | 'info' | 'success' | 'warning' | 'error'
5
+
6
+ const props = withDefaults(defineProps<{
7
+ modelValue: any
8
+ options: Record<string, any>[] | any[]
9
+ value?: (val: any) => any
10
+ label?: (val: any) => any
11
+ resultAsObject?: boolean
12
+ join?: boolean
13
+
14
+ ghost?: boolean
15
+ disabled?: boolean
16
+ validator?: boolean
17
+
18
+ color?: Color
19
+ primary?: boolean
20
+ secondary?: boolean
21
+ accent?: boolean
22
+ info?: boolean
23
+ success?: boolean
24
+ warning?: boolean
25
+ error?: boolean
26
+
27
+ size?: 'xl' | 'lg' | 'md' | 'sm' | 'xs'
28
+ xl?: boolean
29
+ lg?: boolean
30
+ md?: boolean
31
+ sm?: boolean
32
+ xs?: boolean
33
+ }>(), {
34
+ value: (val: any) => {
35
+ if (!val) {
36
+ return null
37
+ }
38
+
39
+ return typeof val === 'string'
40
+ ? (val as string)
41
+ : (val?.value || val?.id || val?._id || val)
42
+ },
43
+ label: (val: any) =>
44
+ typeof val === 'string'
45
+ ? (val as string)
46
+ : (val.label || val.name || val.title),
47
+ resultAsObject: false,
48
+ })
49
+ const emit = defineEmits(['update:modelValue'])
50
+
51
+ const computedVModel = computed({
52
+ get: () => {
53
+ if (props.resultAsObject && props.modelValue != null) {
54
+ return props.value(props.modelValue)
55
+ }
56
+
57
+ return props.modelValue
58
+ },
59
+ set: (val) => {
60
+ if (val === undefined) {
61
+ val = null
62
+ }
63
+ if (props.resultAsObject && val != null) {
64
+ val = props.options.find(o => props.value(o) === val)
65
+ }
66
+
67
+ emit('update:modelValue', val)
68
+ },
69
+ })
70
+ </script>
71
+
72
+ <template>
73
+ <select
74
+ v-model="computedVModel"
75
+ class="select"
76
+ :class="{
77
+ 'join-item': props.join,
78
+ 'validator': props.validator,
79
+ 'select-ghost': props.ghost,
80
+ 'select-primary': props.primary || props.color === 'primary',
81
+ 'select-secondary': props.secondary || props.color === 'secondary',
82
+ 'select-accent': props.accent || props.color === 'accent',
83
+ 'select-info': props.info || props.color === 'info',
84
+ 'select-success': props.success || props.color === 'success',
85
+ 'select-warning': props.warning || props.color === 'warning',
86
+ 'select-error': props.error || props.color === 'error',
87
+ 'select-xl': props.xl || props.size === 'xl',
88
+ 'select-lg': props.lg || props.size === 'lg',
89
+ 'select-md': props.md || props.size === 'md',
90
+ 'select-sm': props.sm || props.size === 'sm',
91
+ 'select-xs': props.xs || props.size === 'xs',
92
+ }"
93
+ :disabled="disabled"
94
+ >
95
+ <option
96
+ v-for="option in options"
97
+ :key="value(option)"
98
+ :value="value(option)"
99
+ :disabled="option.disabled"
100
+ >
101
+ {{ label(option) }}
102
+ </option>
103
+ </select>
104
+ </template>
@@ -0,0 +1,5 @@
1
+ <template>
2
+ <div class="skeleton">
3
+ <slot />
4
+ </div>
5
+ </template>
@@ -0,0 +1,25 @@
1
+ <script setup lang="ts">
2
+ const { is = 'div' } = defineProps<{
3
+ is?: string
4
+ direction?: 'top' | 'end' | 'bottom' | 'start'
5
+ top?: boolean
6
+ end?: boolean
7
+ bottom?: boolean
8
+ start?: boolean
9
+ }>()
10
+ </script>
11
+
12
+ <template>
13
+ <component
14
+ :is="is"
15
+ class="stack"
16
+ :class="{
17
+ 'stack-top': top || direction === 'top',
18
+ 'stack-end': end || direction === 'end',
19
+ 'stack-bottom': bottom || direction === 'bottom',
20
+ 'stack-start': start || direction === 'start',
21
+ }"
22
+ >
23
+ <slot />
24
+ </component>
25
+ </template>
@@ -0,0 +1,19 @@
1
+ <script setup lang="ts">
2
+ defineProps<{
3
+ orientation?: 'vertical' | 'horizontal'
4
+ vertical?: boolean
5
+ horizontal?: boolean
6
+ }>()
7
+ </script>
8
+
9
+ <template>
10
+ <div
11
+ class="stat"
12
+ :class="{
13
+ 'stat-vertical': vertical || orientation === 'vertical',
14
+ 'stat-horizontal': horizontal || orientation === 'horizontal',
15
+ }"
16
+ >
17
+ <slot />
18
+ </div>
19
+ </template>
@@ -0,0 +1,5 @@
1
+ <template>
2
+ <div class="stat-actions">
3
+ <slot />
4
+ </div>
5
+ </template>
@@ -0,0 +1,5 @@
1
+ <template>
2
+ <div class="stat-desc">
3
+ <slot />
4
+ </div>
5
+ </template>
@@ -0,0 +1,5 @@
1
+ <template>
2
+ <div class="stat-figure">
3
+ <slot />
4
+ </div>
5
+ </template>
@@ -0,0 +1,5 @@
1
+ <template>
2
+ <div class="stat-title">
3
+ <slot />
4
+ </div>
5
+ </template>
@@ -0,0 +1,5 @@
1
+ <template>
2
+ <div class="stat-value">
3
+ <slot />
4
+ </div>
5
+ </template>
@@ -0,0 +1,5 @@
1
+ <template>
2
+ <div class="stats">
3
+ <slot />
4
+ </div>
5
+ </template>
@@ -0,0 +1,43 @@
1
+ <script setup lang="ts">
2
+ defineProps<{
3
+ color?: 'neutral' | 'primary' | 'secondary' | 'accent' | 'info' | 'success' | 'warning' | 'error'
4
+ neutral?: boolean
5
+ primary?: boolean
6
+ secondary?: boolean
7
+ accent?: boolean
8
+ info?: boolean
9
+ success?: boolean
10
+ warning?: boolean
11
+ error?: boolean
12
+
13
+ size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl'
14
+ xs?: boolean
15
+ sm?: boolean
16
+ md?: boolean
17
+ lg?: boolean
18
+ xl?: boolean
19
+ }>()
20
+ </script>
21
+
22
+ <template>
23
+ <span
24
+ class="status"
25
+ :class="[
26
+ neutral || color === 'neutral' ? 'status-neutral' : '',
27
+ primary || color === 'primary' ? 'status-primary' : '',
28
+ secondary || color === 'secondary' ? 'status-secondary' : '',
29
+ accent || color === 'accent' ? 'status-accent' : '',
30
+ info || color === 'info' ? 'status-info' : '',
31
+ success || color === 'success' ? 'status-success' : '',
32
+ warning || color === 'warning' ? 'status-warning' : '',
33
+ error || color === 'error' ? 'status-error' : '',
34
+ xs || size === 'xs' ? 'status-xs' : '',
35
+ sm || size === 'sm' ? 'status-sm' : '',
36
+ md || size === 'md' || (!xs && !sm && !lg && !xl && !size) ? 'status-md' : '',
37
+ lg || size === 'lg' ? 'status-lg' : '',
38
+ xl || size === 'xl' ? 'status-xl' : '',
39
+ ]"
40
+ >
41
+ <slot />
42
+ </span>
43
+ </template>
@@ -0,0 +1,34 @@
1
+ <script setup lang="ts">
2
+ const props = defineProps<{
3
+ glyph?: string
4
+
5
+ color?: string
6
+ neutral?: boolean
7
+ primary?: boolean
8
+ secondary?: boolean
9
+ accent?: boolean
10
+ info?: boolean
11
+ success?: boolean
12
+ warning?: boolean
13
+ error?: boolean
14
+ }>()
15
+ </script>
16
+
17
+ <template>
18
+ <li
19
+ class="step"
20
+ :class="{
21
+ 'step-neutral': props.neutral || props.color === 'neutral',
22
+ 'step-primary': props.primary || props.color === 'primary',
23
+ 'step-secondary': props.secondary || props.color === 'secondary',
24
+ 'step-accent': props.accent || props.color === 'accent',
25
+ 'step-info': props.info || props.color === 'info',
26
+ 'step-success': props.success || props.color === 'success',
27
+ 'step-warning': props.warning || props.color === 'warning',
28
+ 'step-error': props.error || props.color === 'error',
29
+ }"
30
+ :data-content="glyph"
31
+ >
32
+ <slot />
33
+ </li>
34
+ </template>
@@ -0,0 +1,5 @@
1
+ <template>
2
+ <span class="step-icon">
3
+ <slot />
4
+ </span>
5
+ </template>
@@ -0,0 +1,18 @@
1
+ <script setup lang="ts">
2
+ const { orientation, vertical = false, horizontal = false } = defineProps<{
3
+ orientation?: 'vertical' | 'horizontal'
4
+ vertical?: boolean
5
+ horizontal?: boolean
6
+ }>()
7
+ </script>
8
+
9
+ <template>
10
+ <ul
11
+ class="steps" :class="{
12
+ 'steps-vertical': orientation === 'vertical' || vertical,
13
+ 'steps-horizontal': orientation === 'horizontal' || horizontal,
14
+ }"
15
+ >
16
+ <slot />
17
+ </ul>
18
+ </template>
@@ -0,0 +1,62 @@
1
+ <script setup lang="ts">
2
+ import { nextTick, ref, watch } from 'vue';
3
+
4
+ const props = defineProps<{
5
+ modelValue?: boolean | null
6
+ rotate?: boolean
7
+ flip?: boolean
8
+ }>()
9
+ const emit = defineEmits(['update:modelValue'])
10
+
11
+ const checkbox = ref<HTMLInputElement | null>(null)
12
+
13
+ // Keep the checkbox's indeterminate property in sync with modelValue
14
+ watch(
15
+ () => props.modelValue,
16
+ (val) => {
17
+ nextTick(() => {
18
+ if (checkbox.value) {
19
+ checkbox.value.indeterminate = val === null
20
+ }
21
+ })
22
+ },
23
+ { immediate: true },
24
+ )
25
+
26
+ function updateValue(event: Event) {
27
+ const input = event.target as HTMLInputElement
28
+ // If indeterminate, toggle to checked
29
+ if (props.modelValue === null) {
30
+ emit('update:modelValue', true)
31
+ }
32
+ else {
33
+ emit('update:modelValue', input.checked)
34
+ }
35
+ }
36
+ </script>
37
+
38
+ <template>
39
+ <label
40
+ class="swap"
41
+ :class="{
42
+ 'swap-rotate': rotate,
43
+ 'swap-flip': flip,
44
+ }"
45
+ >
46
+ <input
47
+ ref="checkbox"
48
+ type="checkbox"
49
+ :checked="modelValue === true"
50
+ @change="updateValue"
51
+ >
52
+ <div class="swap-indeterminate">
53
+ <slot name="indeterminate" />
54
+ </div>
55
+ <div class="swap-on">
56
+ <slot name="swap" />
57
+ </div>
58
+ <div class="swap-off">
59
+ <slot />
60
+ </div>
61
+ </label>
62
+ </template>
@@ -0,0 +1,38 @@
1
+ <script setup lang="ts">
2
+ import { inject } from 'vue'
3
+
4
+ const { is = 'label', name, ...props } = defineProps<{
5
+ is?: any
6
+ name?: string
7
+ active?: boolean
8
+ disabled?: boolean
9
+ }>()
10
+
11
+ const tabManager: any = inject('tabManager')
12
+ if (!tabManager.currentTab.value) {
13
+ tabManager.currentTab.value = name
14
+ }
15
+ </script>
16
+
17
+ <template>
18
+ <component
19
+ :is="is"
20
+ class="tab"
21
+ :class="{
22
+ 'tab-active': props.active || tabManager.currentTab.value === name,
23
+ 'tab-disabled': props.disabled,
24
+ }"
25
+ @keypress.enter="() => (tabManager.currentTab.value = name)"
26
+ >
27
+ <input
28
+ type="radio"
29
+ :name="tabManager.name"
30
+ :value="name"
31
+ :checked="tabManager.currentTab.value === name"
32
+ @change="() => (tabManager.currentTab.value = name)"
33
+ >
34
+
35
+ <slot v-if="$slots.default" />
36
+ <span v-else>{{ name }}</span>
37
+ </component>
38
+ </template>
@@ -0,0 +1,29 @@
1
+ <script setup lang="ts">
2
+ import { computed, inject } from 'vue'
3
+
4
+ const { is = 'div', name } = defineProps<{
5
+ is?: any
6
+ name: string
7
+ }>()
8
+
9
+ const tabManager: any = inject('tabManager')
10
+
11
+ const isCurrentTab = computed(() => {
12
+ return tabManager.currentTab.value === name
13
+ })
14
+
15
+ if (!tabManager?.currentTab.value) {
16
+ tabManager.currentTab.value = name
17
+ }
18
+
19
+ const existing = tabManager?.tabs?.find((t: string) => t === name)
20
+ if (!existing) {
21
+ tabManager.tabs.push(name)
22
+ }
23
+ </script>
24
+
25
+ <template>
26
+ <component :is="is" v-show="isCurrentTab" class="tab-content">
27
+ <slot />
28
+ </component>
29
+ </template>
@@ -0,0 +1,32 @@
1
+ <script setup lang="ts">
2
+ defineProps<{
3
+ zebra?: boolean
4
+ pinRows?: boolean
5
+ pinCols?: boolean
6
+
7
+ size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl'
8
+ xs?: boolean
9
+ sm?: boolean
10
+ md?: boolean
11
+ lg?: boolean
12
+ xl?: boolean
13
+ }>()
14
+ </script>
15
+
16
+ <template>
17
+ <table
18
+ class="table"
19
+ :class="[
20
+ zebra ? 'table-zebra' : '',
21
+ pinRows ? 'table-pin-rows' : '',
22
+ pinCols ? 'table-pin-cols' : '',
23
+ xs || size === 'xs' ? 'table-xs' : '',
24
+ sm || size === 'sm' ? 'table-sm' : '',
25
+ md || size === 'md' || (!xs && !sm && !lg && !xl && !size) ? 'table-md' : '',
26
+ lg || size === 'lg' ? 'table-lg' : '',
27
+ xl || size === 'xl' ? 'table-xl' : '',
28
+ ]"
29
+ >
30
+ <slot />
31
+ </table>
32
+ </template>