daisy-ui-kit 3.0.12 → 5.0.0-pre.11

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 (213) hide show
  1. package/README.md +62 -14
  2. package/app/components/Accordion.vue +29 -0
  3. package/app/components/Alert.vue +36 -0
  4. package/app/components/Avatar.vue +131 -0
  5. package/app/components/AvatarGroup.vue +22 -0
  6. package/app/components/Badge.vue +67 -0
  7. package/app/components/Button.vue +135 -0
  8. package/app/components/Calendar.vue +89 -0
  9. package/app/components/CalendarInput.vue +174 -0
  10. package/app/components/CalendarSkeleton.vue +87 -0
  11. package/app/components/Card.vue +46 -0
  12. package/{components → app/components}/CardActions.vue +2 -5
  13. package/{components → app/components}/CardBody.vue +2 -5
  14. package/{components → app/components}/CardTitle.vue +1 -6
  15. package/app/components/Carousel.vue +24 -0
  16. package/app/components/Chat.vue +26 -0
  17. package/app/components/ChatBubble.vue +31 -0
  18. package/app/components/Checkbox.vue +51 -0
  19. package/app/components/Collapse.vue +75 -0
  20. package/app/components/CollapseTitle.vue +15 -0
  21. package/{components → app/components}/Countdown.vue +1 -1
  22. package/app/components/CountdownTimers.vue +69 -0
  23. package/app/components/Counter.vue +21 -0
  24. package/app/components/DaisyLink.vue +52 -0
  25. package/app/components/Diff.vue +11 -0
  26. package/app/components/Divider.vue +43 -0
  27. package/app/components/Dock.vue +60 -0
  28. package/app/components/DockItem.vue +26 -0
  29. package/app/components/DockLabel.vue +5 -0
  30. package/{components → app/components}/Drawer.vue +17 -12
  31. package/{components → app/components}/DrawerContent.vue +8 -5
  32. package/{components → app/components}/DrawerSide.vue +8 -5
  33. package/app/components/Dropdown.vue +106 -0
  34. package/app/components/DropdownButton.vue +23 -0
  35. package/app/components/DropdownContent.vue +127 -0
  36. package/{components → app/components}/DropdownTarget.vue +9 -2
  37. package/app/components/Fab.vue +16 -0
  38. package/app/components/FabClose.vue +18 -0
  39. package/app/components/FabMainAction.vue +5 -0
  40. package/app/components/FabTrigger.vue +117 -0
  41. package/app/components/Fieldset.vue +16 -0
  42. package/app/components/FileInput.vue +53 -0
  43. package/app/components/Filter.vue +125 -0
  44. package/app/components/Flex.vue +84 -0
  45. package/{components → app/components}/FlexItem.vue +30 -27
  46. package/app/components/Footer.vue +31 -0
  47. package/{components → app/components}/FooterTitle.vue +8 -5
  48. package/app/components/FormControl.vue +5 -0
  49. package/{components → app/components}/Hero.vue +8 -5
  50. package/{components → app/components}/HeroContent.vue +8 -5
  51. package/app/components/Hover3D.vue +22 -0
  52. package/app/components/HoverGallery.vue +11 -0
  53. package/{components → app/components}/Indicator.vue +8 -5
  54. package/{components → app/components}/IndicatorItem.vue +16 -13
  55. package/app/components/Input.vue +126 -0
  56. package/app/components/Kbd.vue +25 -0
  57. package/app/components/Label.vue +100 -0
  58. package/{components/CollapseTitle.vue → app/components/List.vue} +1 -1
  59. package/{components/FormControl.vue → app/components/ListColGrow.vue} +1 -1
  60. package/app/components/ListColWrap.vue +5 -0
  61. package/{components/Stat.vue → app/components/ListRow.vue} +1 -1
  62. package/app/components/LoadingBall.vue +42 -0
  63. package/app/components/LoadingBars.vue +42 -0
  64. package/app/components/LoadingDots.vue +42 -0
  65. package/app/components/LoadingInfinity.vue +42 -0
  66. package/app/components/LoadingRing.vue +42 -0
  67. package/app/components/LoadingSpinner.vue +42 -0
  68. package/app/components/Mask.vue +49 -0
  69. package/app/components/Menu.vue +30 -0
  70. package/app/components/MenuExpand.vue +94 -0
  71. package/app/components/MenuExpandToggle.vue +20 -0
  72. package/{components → app/components}/MenuItem.vue +7 -6
  73. package/app/components/MockupPhone.vue +14 -0
  74. package/{components → app/components}/Modal.vue +28 -13
  75. package/app/components/NavButton.vue +12 -0
  76. package/{components → app/components}/Navbar.vue +3 -5
  77. package/{components → app/components}/NavbarCenter.vue +3 -5
  78. package/{components → app/components}/NavbarEnd.vue +3 -5
  79. package/{components → app/components}/NavbarStart.vue +3 -5
  80. package/app/components/Progress.vue +46 -0
  81. package/{components → app/components}/Prose.vue +8 -3
  82. package/app/components/RadialProgress.vue +36 -0
  83. package/app/components/Radio.vue +69 -0
  84. package/{components → app/components}/RadioGroup.vue +2 -1
  85. package/app/components/Range.vue +61 -0
  86. package/app/components/RangeMeasure.vue +87 -0
  87. package/{components → app/components}/RangeMeasureTick.vue +9 -14
  88. package/app/components/Rating.vue +197 -0
  89. package/app/components/Select.vue +101 -0
  90. package/app/components/Skeleton.vue +5 -0
  91. package/app/components/SkeletonText.vue +11 -0
  92. package/app/components/Stack.vue +25 -0
  93. package/app/components/Stat.vue +19 -0
  94. package/app/components/Status.vue +43 -0
  95. package/app/components/Step.vue +34 -0
  96. package/app/components/StepIcon.vue +5 -0
  97. package/app/components/Steps.vue +23 -0
  98. package/app/components/Swap.vue +56 -0
  99. package/app/components/Tab.vue +51 -0
  100. package/{components → app/components}/TabContent.vue +10 -10
  101. package/app/components/Table.vue +32 -0
  102. package/app/components/Tabs.vue +53 -0
  103. package/app/components/Text.vue +162 -0
  104. package/app/components/TextArea.vue +64 -0
  105. package/app/components/TextRotate.vue +24 -0
  106. package/app/components/ThemeController.vue +45 -0
  107. package/app/components/ThemeProvider.vue +302 -0
  108. package/app/components/ThemeTile.vue +50 -0
  109. package/app/components/Timeline.vue +22 -0
  110. package/app/components/TimelineEnd.vue +14 -0
  111. package/app/components/TimelineItem.vue +5 -0
  112. package/app/components/TimelineLine.vue +29 -0
  113. package/app/components/TimelineMiddle.vue +5 -0
  114. package/app/components/TimelineStart.vue +14 -0
  115. package/app/components/Toast.vue +67 -0
  116. package/app/components/Toggle.vue +60 -0
  117. package/app/components/Tooltip.vue +48 -0
  118. package/app/components/TooltipContent.vue +5 -0
  119. package/app/components/ValidatorHint.vue +5 -0
  120. package/{utils → app/utils}/drawer-utils.ts +15 -13
  121. package/app/utils/position-area.ts +41 -0
  122. package/nuxt.js +7 -1
  123. package/package.json +60 -61
  124. package/components/Accordion.vue +0 -29
  125. package/components/Alert.vue +0 -25
  126. package/components/Artboard.vue +0 -33
  127. package/components/Avatar.vue +0 -70
  128. package/components/AvatarGroup.vue +0 -19
  129. package/components/Badge.vue +0 -50
  130. package/components/BottomNav.vue +0 -25
  131. package/components/Button.vue +0 -111
  132. package/components/Card.vue +0 -30
  133. package/components/Carousel.vue +0 -25
  134. package/components/Chat.vue +0 -27
  135. package/components/ChatBubble.vue +0 -34
  136. package/components/Checkbox.vue +0 -55
  137. package/components/Code.vue +0 -92
  138. package/components/Collapse.vue +0 -54
  139. package/components/CountdownTimers.vue +0 -70
  140. package/components/Counter.vue +0 -14
  141. package/components/Divider.vue +0 -24
  142. package/components/Dropdown.vue +0 -95
  143. package/components/DropdownButton.vue +0 -16
  144. package/components/DropdownContent.vue +0 -56
  145. package/components/FileInput.vue +0 -59
  146. package/components/Flex.vue +0 -59
  147. package/components/Footer.vue +0 -24
  148. package/components/Kbd.vue +0 -25
  149. package/components/Label.vue +0 -15
  150. package/components/LabelText.vue +0 -15
  151. package/components/LabelTextAlt.vue +0 -15
  152. package/components/Link.vue +0 -40
  153. package/components/LoadingBall.vue +0 -43
  154. package/components/LoadingBars.vue +0 -43
  155. package/components/LoadingDots.vue +0 -43
  156. package/components/LoadingInfinity.vue +0 -43
  157. package/components/LoadingRing.vue +0 -43
  158. package/components/LoadingSpinner.vue +0 -43
  159. package/components/Mask.config.ts +0 -77
  160. package/components/Mask.vue +0 -14
  161. package/components/Menu.vue +0 -35
  162. package/components/MenuExpand.vue +0 -79
  163. package/components/MenuExpandToggle.vue +0 -13
  164. package/components/MockupPhone.vue +0 -8
  165. package/components/NavButton.vue +0 -20
  166. package/components/Progress.vue +0 -42
  167. package/components/RadialProgress.vue +0 -41
  168. package/components/Radio.vue +0 -76
  169. package/components/Range.vue +0 -60
  170. package/components/RangeMeasure.vue +0 -83
  171. package/components/Rating.vue +0 -167
  172. package/components/Select.vue +0 -100
  173. package/components/Stack.vue +0 -13
  174. package/components/Step.vue +0 -36
  175. package/components/Steps.vue +0 -21
  176. package/components/Swap.vue +0 -58
  177. package/components/Tab.vue +0 -48
  178. package/components/Tabs.vue +0 -77
  179. package/components/TabsManager.vue +0 -38
  180. package/components/Text.vue +0 -142
  181. package/components/TextArea.vue +0 -64
  182. package/components/TextInput.vue +0 -66
  183. package/components/Toast.vue +0 -31
  184. package/components/Toggle.vue +0 -59
  185. package/components/Tooltip.vue +0 -47
  186. package/index.ts +0 -108
  187. package/utils/-utils.ts +0 -41
  188. package/utils/Button.config.ts +0 -26
  189. package/utils/fixtures.ts +0 -62
  190. package/utils/types.ts +0 -7
  191. /package/{components → app/components}/Breadcrumbs.vue +0 -0
  192. /package/{components → app/components}/CarouselItem.vue +0 -0
  193. /package/{components → app/components}/ChatFooter.vue +0 -0
  194. /package/{components → app/components}/ChatHeader.vue +0 -0
  195. /package/{components → app/components}/ChatImage.vue +0 -0
  196. /package/{components → app/components}/CollapseContent.vue +0 -0
  197. /package/{components → app/components}/Crumb.vue +0 -0
  198. /package/{components → app/components}/HeroOverlay.vue +0 -0
  199. /package/{components → app/components}/Join.vue +0 -0
  200. /package/{components → app/components}/MenuTitle.vue +0 -0
  201. /package/{components → app/components}/MockupBrowser.vue +0 -0
  202. /package/{components → app/components}/MockupBrowserToolbar.vue +0 -0
  203. /package/{components → app/components}/MockupCode.vue +0 -0
  204. /package/{components → app/components}/MockupWindow.vue +0 -0
  205. /package/{components → app/components}/ModalAction.vue +0 -0
  206. /package/{components → app/components}/ModalBox.vue +0 -0
  207. /package/{components → app/components}/StatActions.vue +0 -0
  208. /package/{components → app/components}/StatDesc.vue +0 -0
  209. /package/{components → app/components}/StatFigure.vue +0 -0
  210. /package/{components → app/components}/StatTitle.vue +0 -0
  211. /package/{components → app/components}/StatValue.vue +0 -0
  212. /package/{components → app/components}/Stats.vue +0 -0
  213. /package/{utils → app/utils}/random-string.ts +0 -0
@@ -1,167 +0,0 @@
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
- parallelogram?: boolean
34
- parallelogram2?: boolean
35
- parallelogram3?: boolean
36
- parallelogram4?: boolean
37
- star?: boolean
38
- star2?: boolean
39
- triangle?: boolean
40
- triangle2?: boolean
41
- triangle3?: boolean
42
- triangle4?: boolean
43
-
44
- size?: 'lg' | 'md' | 'sm' | 'xs'
45
- lg?: boolean
46
- md?: boolean
47
- sm?: boolean
48
- xs?: boolean
49
- }>(), {
50
- count: 5,
51
- })
52
- const emit = defineEmits(['update:modelValue'])
53
-
54
- const shapes = [
55
- 'squircle',
56
- 'heart',
57
- 'hexagon',
58
- 'hexagon2',
59
- 'decagon',
60
- 'pentagon',
61
- 'diamond',
62
- 'square',
63
- 'circle',
64
- 'parallelogram',
65
- 'parallelogram2',
66
- 'parallelogram3',
67
- 'parallelogram4',
68
- 'star',
69
- 'star2',
70
- 'triangle',
71
- 'triangle2',
72
- 'triangle3',
73
- 'triangle4',
74
- ]
75
-
76
- const ratingClasses = computed(() => {
77
- return {
78
- 'rating-half': props.half,
79
- 'rating-lg': props.lg || props.size === 'lg',
80
- 'rating-md': props.md || props.size === 'md',
81
- 'rating-sm': props.sm || props.size === 'sm',
82
- 'rating-xs': props.xs || props.size === 'xs',
83
- }
84
- })
85
-
86
- const maskClasses = computed(() => {
87
- const hasShape = shapes.reduce((acc, current) => {
88
- return acc || props.shape || (props as any)[current]
89
- }, false)
90
- const { color, shape, disabled } = props
91
- return {
92
- 'bg-neutral': props.neutral || color === 'neutral',
93
- 'bg-primary': props.primary || color === 'primary',
94
- 'bg-secondary': props.secondary || color === 'secondary',
95
- 'bg-accent': props.accent || color === 'accent',
96
- 'bg-info': props.info || color === 'info',
97
- 'bg-success': props.success || color === 'success',
98
- 'bg-warning': props.warning || color === 'warning',
99
- 'bg-error': props.error || color === 'error',
100
-
101
- 'cursor-not-allowed': disabled,
102
- 'opacity-50': disabled,
103
-
104
- 'mask-squircle': props.squircle || shape === 'squircle',
105
- 'mask-heart': props.heart || shape === 'heart',
106
- 'mask-hexagon': props.hexagon || shape === 'hexagon',
107
- 'mask-hexagon-2': props.hexagon2 || shape === 'hexagon-2',
108
- 'mask-decagon': props.decagon || shape === 'decagon',
109
- 'mask-pentagon': props.pentagon || shape === 'pentagon',
110
- 'mask-diamond': props.diamond || shape === 'diamond',
111
- 'mask-square': props.square || shape === 'square',
112
- 'mask-circle': props.circle || shape === 'circle',
113
- 'mask-parallelogram': props.parallelogram || shape === 'parallelogram',
114
- 'mask-parallelogram-2': props.parallelogram2 || shape === 'parallelogram-2',
115
- 'mask-parallelogram-3': props.parallelogram3 || shape === 'parallelogram-3',
116
- 'mask-parallelogram-4': props.parallelogram4 || shape === 'parallelogram-4',
117
- 'mask-star': props.star || shape === 'star',
118
- 'mask-star-2': props.star2 || shape === 'star-2' || !hasShape,
119
- 'mask-triangle': props.triangle || shape === 'triangle',
120
- 'mask-triangle-2': props.triangle2 || shape === 'triangle-2',
121
- 'mask-triangle-3': props.triangle3 || shape === 'triangle-3',
122
- 'mask-triangle-4': props.triangle4 || shape === 'triangle-4',
123
- }
124
- })
125
- const max = computed(() => Number.parseInt(props.count as string))
126
-
127
- function handleValue(digit: number, half = false) {
128
- if (props.disabled)
129
- return
130
-
131
- if (props.half)
132
- return emit('update:modelValue', half ? digit - 0.5 : digit)
133
-
134
- return emit('update:modelValue', digit)
135
- }
136
- </script>
137
-
138
- <template>
139
- <div class="rating" :class="ratingClasses">
140
- <input
141
- type="radio"
142
- :value="0"
143
- class="rating-hidden"
144
- :checked="modelValue === 0"
145
- @change="$emit('update:modelValue', 0)"
146
- >
147
- <template v-for="digit in max" :key="digit">
148
- <input
149
- type="radio"
150
- :value="half ? digit - 0.5 : digit"
151
- class="mask"
152
- :class="[maskClasses, bg, { 'mask-half-1': half }]"
153
- :checked="half ? modelValue === digit - 0.5 : modelValue === digit"
154
- @change="() => handleValue(digit, true)"
155
- >
156
- <input
157
- v-if="half"
158
- type="radio"
159
- :value="digit"
160
- class="mask mask-half-2"
161
- :class="[maskClasses, bg]"
162
- :checked="modelValue === digit"
163
- @change="() => handleValue(digit)"
164
- >
165
- </template>
166
- </div>
167
- </template>
@@ -1,100 +0,0 @@
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
- bordered?: boolean
15
- ghost?: boolean
16
- disabled?: 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?: 'lg' | 'md' | 'sm' | 'xs'
28
- lg?: boolean
29
- md?: boolean
30
- sm?: boolean
31
- xs?: boolean
32
- }>(), {
33
- value: (val: any) => {
34
- if (!val)
35
- return null
36
-
37
- return typeof val === 'string'
38
- ? (val as string)
39
- : (val?.value || val?.id || val?._id || val)
40
- },
41
- label: (val: any) =>
42
- typeof val === 'string'
43
- ? (val as string)
44
- : (val.label || val.name || val.title),
45
- resultAsObject: false,
46
- })
47
- const emit = defineEmits(['update:modelValue'])
48
-
49
- const computedVModel = computed({
50
- get: () => {
51
- if (props.resultAsObject && props.modelValue != null)
52
- return props.value(props.modelValue)
53
-
54
- return props.modelValue
55
- },
56
- set: (val) => {
57
- if (val === undefined)
58
- val = null
59
- if (props.resultAsObject && val != null)
60
- val = props.options.find(o => props.value(o) === val)
61
-
62
- emit('update:modelValue', val)
63
- },
64
- })
65
-
66
- const classes = computed(() => {
67
- return {
68
- 'join-item': props.join,
69
-
70
- 'select-primary': props.primary || props.color === 'primary',
71
- 'select-secondary': props.secondary || props.color === 'secondary',
72
- 'select-accent': props.accent || props.color === 'accent',
73
- 'select-info': props.info || props.color === 'info',
74
- 'select-success': props.success || props.color === 'success',
75
- 'select-warning': props.warning || props.color === 'warning',
76
- 'select-error': props.error || props.color === 'error',
77
-
78
- 'select-lg': props.lg || props.size === 'lg',
79
- 'select-md': props.md || props.size === 'md',
80
- 'select-sm': props.sm || props.size === 'sm',
81
- 'select-xs': props.xs || props.size === 'xs',
82
-
83
- 'select-bordered': props.bordered,
84
- 'select-ghost': props.ghost,
85
- }
86
- })
87
- </script>
88
-
89
- <template>
90
- <select v-model="computedVModel" class="select" :class="classes" :disabled="disabled">
91
- <option
92
- v-for="option in options"
93
- :key="value(option)"
94
- :value="value(option)"
95
- :disabled="option.disabled"
96
- >
97
- {{ label(option) }}
98
- </option>
99
- </select>
100
- </template>
@@ -1,13 +0,0 @@
1
- <script setup lang="ts">
2
- withDefaults(defineProps<{
3
- is?: string
4
- }>(), {
5
- is: 'div',
6
- })
7
- </script>
8
-
9
- <template>
10
- <component :is="is" class="stack">
11
- <slot />
12
- </component>
13
- </template>
@@ -1,36 +0,0 @@
1
- <script setup lang="ts">
2
- import { computed } from 'vue'
3
-
4
- const props = defineProps<{
5
- glyph?: string
6
-
7
- color?: string
8
- neutral?: boolean
9
- primary?: boolean
10
- secondary?: boolean
11
- accent?: boolean
12
- info?: boolean
13
- success?: boolean
14
- warning?: boolean
15
- error?: boolean
16
- }>()
17
-
18
- const classes = computed(() => {
19
- return {
20
- 'step-neutral': props.neutral || props.color === 'neutral',
21
- 'step-primary': props.primary || props.color === 'primary',
22
- 'step-secondary': props.secondary || props.color === 'secondary',
23
- 'step-accent': props.accent || props.color === 'accent',
24
- 'step-info': props.info || props.color === 'info',
25
- 'step-success': props.success || props.color === 'success',
26
- 'step-warning': props.warning || props.color === 'warning',
27
- 'step-error': props.error || props.color === 'error',
28
- }
29
- })
30
- </script>
31
-
32
- <template>
33
- <li class="step" :class="classes" :data-content="glyph">
34
- <slot />
35
- </li>
36
- </template>
@@ -1,21 +0,0 @@
1
- <script setup lang="ts">
2
- import { computed } from 'vue'
3
-
4
- const props = defineProps<{
5
- vertical?: boolean
6
- horizontal?: boolean
7
- }>()
8
-
9
- const classes = computed(() => {
10
- return {
11
- 'steps-vertical': props.vertical,
12
- 'steps-horizontal': props.horizontal,
13
- }
14
- })
15
- </script>
16
-
17
- <template>
18
- <ul class="steps" :class="classes">
19
- <slot />
20
- </ul>
21
- </template>
@@ -1,58 +0,0 @@
1
- <script setup lang="ts">
2
- import { computed, nextTick, ref, watch } from 'vue'
3
-
4
- const props = defineProps<{
5
- modelValue?: boolean | null
6
- indeterminate?: boolean
7
- rotate?: boolean
8
- flip?: boolean
9
- }>()
10
- const emit = defineEmits(['update:modelValue'])
11
- const classes = computed(() => {
12
- return {
13
- 'swap-rotate': props.rotate,
14
- 'swap-flip': props.flip,
15
- }
16
- })
17
-
18
- const checkbox = ref(null)
19
-
20
- // Allow internal or external control
21
- const isChecked = ref<any>(props.modelValue)
22
- watch(isChecked, val => emit('update:modelValue', val))
23
- watch(
24
- () => props.modelValue,
25
- (val) => {
26
- if (isChecked.value !== val)
27
- isChecked.value = val
28
- },
29
- )
30
-
31
- // When the indeterminate prop updates, manually update the checkbox element.
32
- watch(
33
- () => [props.indeterminate, checkbox.value],
34
- ([val]) => {
35
- nextTick(() => {
36
- if (checkbox.value != null)
37
- (checkbox.value as any).indeterminate = val
38
- isChecked.value = null
39
- })
40
- },
41
- { immediate: true },
42
- )
43
- </script>
44
-
45
- <template>
46
- <label class="swap" :class="classes">
47
- <input ref="checkbox" v-model="isChecked" type="checkbox">
48
- <div class="swap-off">
49
- <slot />
50
- </div>
51
- <div class="swap-on">
52
- <slot name="swap" />
53
- </div>
54
- <div v-if="indeterminate" class="swap-indeterminate">
55
- <slot name="indeterminate" />
56
- </div>
57
- </label>
58
- </template>
@@ -1,48 +0,0 @@
1
- <script setup lang="ts">
2
- import { computed, inject } from 'vue'
3
-
4
- const props = withDefaults(defineProps<{
5
- is?: string | Object | Function
6
- name?: string
7
- active?: boolean
8
-
9
- variant?: 'bordered' | 'lifted'
10
- bordered?: boolean
11
- lifted?: boolean
12
-
13
- size?: 'lg' | 'md' | 'sm' | 'xs'
14
- lg?: boolean
15
- md?: boolean
16
- sm?: boolean
17
- xs?: boolean
18
- }>(), {
19
- is: 'a',
20
- })
21
-
22
- const manager: any = inject('tabManager')
23
-
24
- const classes = computed(() => {
25
- return {
26
- 'tab-active': props.active || manager.currentTab === props.name,
27
-
28
- 'tab-lg': props.size === 'lg' || props.lg,
29
- 'tab-md': props.size === 'md' || props.md,
30
- 'tab-sm': props.size === 'sm' || props.sm,
31
- 'tab-xs': props.size === 'xs' || props.xs,
32
-
33
- 'tab-bordered': props.variant === 'bordered' || props.bordered,
34
- 'tab-lifted': props.variant === 'lifted' || props.lifted,
35
- }
36
- })
37
- </script>
38
-
39
- <template>
40
- <component
41
- :is="is" class="tab" :class="classes" tabindex="0"
42
- @click="() => (manager.currentTab = name)"
43
- @keypress.enter="() => (manager.currentTab = name)"
44
- >
45
- <slot v-if="$slots.default" />
46
- <span v-else>{{ name }}</span>
47
- </component>
48
- </template>
@@ -1,77 +0,0 @@
1
- <script setup lang="ts">
2
- import { computed, inject } from 'vue'
3
- import Tab from './Tab.vue'
4
-
5
- const props = withDefaults(defineProps<{
6
- is?: string | Object | Function
7
- tabs?: string[]
8
-
9
- variant?: 'bordered' | 'lifted' | 'boxed' | 'inline-boxed'
10
- bordered?: boolean
11
- lifted?: boolean
12
- boxed?: boolean
13
- inlineBoxed?: boolean
14
-
15
- size?: 'lg' | 'md' | 'sm' | 'xs'
16
- lg?: boolean
17
- md?: boolean
18
- sm?: boolean
19
- xs?: boolean
20
- }>(), {
21
- is: 'a',
22
- tabs: [] as any,
23
- })
24
-
25
- const tabManager: any = inject('tabManager')
26
-
27
- const _variant = computed(() => {
28
- if (props.bordered || props.variant === 'bordered')
29
- return 'bordered'
30
- if (props.lifted || props.variant === 'lifted')
31
- return 'lifted'
32
- return undefined
33
- })
34
- const _size = computed(() => {
35
- if (props.size)
36
- return props.size
37
- if (props.lg)
38
- return 'lg'
39
- if (props.md)
40
- return 'md'
41
- if (props.sm)
42
- return 'sm'
43
- if (props.xs)
44
- return 'xs'
45
- return 'md'
46
- })
47
-
48
- const classes = computed(() => {
49
- return {
50
- 'tabs-boxed':
51
- props.variant === 'boxed'
52
- || props.variant === 'inline-boxed'
53
- || props.boxed
54
- || props.inlineBoxed,
55
- 'inline-block': props.variant === 'inline-boxed' || props.inlineBoxed,
56
- }
57
- })
58
- </script>
59
-
60
- <template>
61
- <div class="tabs" :class="classes">
62
- <slot v-if="$slots.default" />
63
- <template v-for="tabName in tabs" v-else :key="tabName">
64
- <Tab
65
- :is="is"
66
- :name="tabName"
67
- :variant="_variant"
68
- :size="_size"
69
- :active="tabManager.currentTab === tabName"
70
- @click="() => (tabManager.currentTab = tabName)"
71
- >
72
- {{ tabName }}
73
- </Tab>
74
- </template>
75
- <div v-if="variant === 'lifted' || lifted" class="flex-1 cursor-default tab tab-lifted" />
76
- </div>
77
- </template>
@@ -1,38 +0,0 @@
1
- <script setup lang="ts">
2
- import { provide, reactive, watch } from 'vue'
3
-
4
- const props = defineProps<{
5
- tab?: string
6
- }>()
7
- const emit = defineEmits(['update:tab'])
8
-
9
- const manager = reactive({
10
- currentTab: props.tab,
11
- tabs: [],
12
- })
13
- provide('tabManager', manager)
14
-
15
- // If the tab changes from outside, update the internal value.
16
- watch(
17
- () => props.tab,
18
- (val) => {
19
- if (val !== manager.currentTab)
20
- manager.currentTab = val
21
- },
22
- )
23
-
24
- // If the internal tab value changes, update the tab
25
- watch(
26
- () => manager.currentTab,
27
- (val) => {
28
- if (val !== props.tab)
29
- emit('update:tab', val)
30
- },
31
- )
32
- </script>
33
-
34
- <template>
35
- <div class="tabs-manager">
36
- <slot />
37
- </div>
38
- </template>