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

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 (198) hide show
  1. package/README.md +62 -14
  2. package/{components → app/components}/Accordion.vue +7 -10
  3. package/app/components/Alert.vue +35 -0
  4. package/app/components/Avatar.vue +128 -0
  5. package/app/components/AvatarGroup.vue +18 -0
  6. package/app/components/Badge.vue +54 -0
  7. package/app/components/Button.vue +120 -0
  8. package/app/components/Calendar.vue +66 -0
  9. package/app/components/CalendarInput.vue +174 -0
  10. package/app/components/CalendarSkeleton.vue +46 -0
  11. package/app/components/Card.vue +33 -0
  12. package/{components → app/components}/CardActions.vue +3 -6
  13. package/{components → app/components}/CardBody.vue +3 -6
  14. package/{components → app/components}/CardTitle.vue +2 -7
  15. package/app/components/Carousel.vue +23 -0
  16. package/app/components/Chat.vue +21 -0
  17. package/app/components/ChatBubble.vue +31 -0
  18. package/app/components/Checkbox.vue +51 -0
  19. package/app/components/Collapse.vue +43 -0
  20. package/app/components/Countdown.vue +15 -0
  21. package/app/components/CountdownTimers.vue +72 -0
  22. package/app/components/Counter.vue +10 -0
  23. package/app/components/DaisyLink.vue +38 -0
  24. package/app/components/Diff.vue +11 -0
  25. package/app/components/Divider.vue +43 -0
  26. package/app/components/Dock.vue +60 -0
  27. package/app/components/DockItem.vue +26 -0
  28. package/app/components/DockLabel.vue +5 -0
  29. package/{components → app/components}/Drawer.vue +6 -4
  30. package/{components → app/components}/DrawerContent.vue +1 -1
  31. package/{components → app/components}/DrawerSide.vue +1 -1
  32. package/{components → app/components}/Dropdown.vue +2 -2
  33. package/{components → app/components}/DropdownContent.vue +3 -3
  34. package/app/components/Fieldset.vue +19 -0
  35. package/app/components/FileInput.vue +53 -0
  36. package/app/components/Filter.vue +122 -0
  37. package/app/components/Flex.vue +82 -0
  38. package/{components → app/components}/FlexItem.vue +1 -1
  39. package/app/components/Footer.vue +27 -0
  40. package/app/components/FormControl.vue +5 -0
  41. package/{components → app/components}/Hero.vue +1 -1
  42. package/{components → app/components}/HeroContent.vue +1 -1
  43. package/app/components/Input.vue +119 -0
  44. package/app/components/Kbd.vue +24 -0
  45. package/app/components/Label.vue +97 -0
  46. package/app/components/List.vue +5 -0
  47. package/{components/FormControl.vue → app/components/ListColGrow.vue} +1 -1
  48. package/app/components/ListColWrap.vue +5 -0
  49. package/{components/Stat.vue → app/components/ListRow.vue} +1 -1
  50. package/app/components/LoadingBall.vue +42 -0
  51. package/app/components/LoadingBars.vue +42 -0
  52. package/app/components/LoadingDots.vue +42 -0
  53. package/app/components/LoadingInfinity.vue +42 -0
  54. package/app/components/LoadingRing.vue +42 -0
  55. package/app/components/LoadingSpinner.vue +42 -0
  56. package/app/components/Mask.vue +49 -0
  57. package/app/components/Menu.vue +30 -0
  58. package/app/components/MenuExpand.vue +100 -0
  59. package/{components → app/components}/MenuExpandToggle.vue +5 -4
  60. package/{components → app/components}/MenuItem.vue +3 -4
  61. package/app/components/MockupPhone.vue +14 -0
  62. package/{components → app/components}/Modal.vue +14 -5
  63. package/app/components/NavButton.vue +12 -0
  64. package/{components → app/components}/Navbar.vue +3 -5
  65. package/{components → app/components}/NavbarCenter.vue +3 -5
  66. package/{components → app/components}/NavbarEnd.vue +3 -5
  67. package/{components → app/components}/NavbarStart.vue +3 -5
  68. package/app/components/Progress.vue +34 -0
  69. package/{components → app/components}/Prose.vue +1 -1
  70. package/app/components/RadialProgress.vue +36 -0
  71. package/app/components/Radio.vue +69 -0
  72. package/{components → app/components}/RadioGroup.vue +2 -1
  73. package/app/components/Range.vue +61 -0
  74. package/{components → app/components}/RangeMeasure.vue +22 -21
  75. package/{components → app/components}/RangeMeasureTick.vue +9 -14
  76. package/app/components/Rating.vue +180 -0
  77. package/{components → app/components}/Select.vue +33 -29
  78. package/app/components/Skeleton.vue +5 -0
  79. package/app/components/Stack.vue +25 -0
  80. package/app/components/Stat.vue +19 -0
  81. package/app/components/Status.vue +43 -0
  82. package/app/components/Step.vue +34 -0
  83. package/app/components/StepIcon.vue +5 -0
  84. package/app/components/Steps.vue +18 -0
  85. package/app/components/Swap.vue +62 -0
  86. package/app/components/Tab.vue +38 -0
  87. package/{components → app/components}/TabContent.vue +10 -10
  88. package/app/components/Table.vue +32 -0
  89. package/app/components/Tabs.vue +53 -0
  90. package/app/components/Text.vue +142 -0
  91. package/app/components/TextArea.vue +61 -0
  92. package/app/components/ThemeController.vue +46 -0
  93. package/app/components/ThemeProvider.vue +287 -0
  94. package/app/components/ThemeTile.vue +50 -0
  95. package/app/components/Timeline.vue +22 -0
  96. package/app/components/TimelineEnd.vue +14 -0
  97. package/app/components/TimelineItem.vue +5 -0
  98. package/app/components/TimelineLine.vue +29 -0
  99. package/app/components/TimelineMiddle.vue +5 -0
  100. package/app/components/TimelineStart.vue +13 -0
  101. package/app/components/Toast.vue +72 -0
  102. package/app/components/Toggle.vue +60 -0
  103. package/app/components/Tooltip.vue +47 -0
  104. package/app/components/TooltipContent.vue +5 -0
  105. package/app/components/ValidatorHint.vue +5 -0
  106. package/nuxt.js +7 -1
  107. package/package.json +58 -61
  108. package/components/Alert.vue +0 -25
  109. package/components/Artboard.vue +0 -33
  110. package/components/Avatar.vue +0 -70
  111. package/components/AvatarGroup.vue +0 -19
  112. package/components/Badge.vue +0 -50
  113. package/components/BottomNav.vue +0 -25
  114. package/components/Button.vue +0 -111
  115. package/components/Card.vue +0 -30
  116. package/components/Carousel.vue +0 -25
  117. package/components/Chat.vue +0 -27
  118. package/components/ChatBubble.vue +0 -34
  119. package/components/Checkbox.vue +0 -55
  120. package/components/Code.vue +0 -92
  121. package/components/Collapse.vue +0 -54
  122. package/components/Countdown.vue +0 -15
  123. package/components/CountdownTimers.vue +0 -70
  124. package/components/Counter.vue +0 -14
  125. package/components/Divider.vue +0 -24
  126. package/components/FileInput.vue +0 -59
  127. package/components/Flex.vue +0 -59
  128. package/components/Footer.vue +0 -24
  129. package/components/Kbd.vue +0 -25
  130. package/components/Label.vue +0 -15
  131. package/components/LabelText.vue +0 -15
  132. package/components/LabelTextAlt.vue +0 -15
  133. package/components/Link.vue +0 -40
  134. package/components/LoadingBall.vue +0 -43
  135. package/components/LoadingBars.vue +0 -43
  136. package/components/LoadingDots.vue +0 -43
  137. package/components/LoadingInfinity.vue +0 -43
  138. package/components/LoadingRing.vue +0 -43
  139. package/components/LoadingSpinner.vue +0 -43
  140. package/components/Mask.config.ts +0 -77
  141. package/components/Mask.vue +0 -14
  142. package/components/Menu.vue +0 -35
  143. package/components/MenuExpand.vue +0 -79
  144. package/components/MockupPhone.vue +0 -8
  145. package/components/NavButton.vue +0 -20
  146. package/components/Progress.vue +0 -42
  147. package/components/RadialProgress.vue +0 -41
  148. package/components/Radio.vue +0 -76
  149. package/components/Range.vue +0 -60
  150. package/components/Rating.vue +0 -167
  151. package/components/Stack.vue +0 -13
  152. package/components/Step.vue +0 -36
  153. package/components/Steps.vue +0 -21
  154. package/components/Swap.vue +0 -58
  155. package/components/Tab.vue +0 -48
  156. package/components/Tabs.vue +0 -77
  157. package/components/TabsManager.vue +0 -38
  158. package/components/Text.vue +0 -142
  159. package/components/TextArea.vue +0 -64
  160. package/components/TextInput.vue +0 -66
  161. package/components/Toast.vue +0 -31
  162. package/components/Toggle.vue +0 -59
  163. package/components/Tooltip.vue +0 -47
  164. package/index.ts +0 -108
  165. package/utils/-utils.ts +0 -41
  166. package/utils/Button.config.ts +0 -26
  167. package/utils/fixtures.ts +0 -62
  168. package/utils/types.ts +0 -7
  169. /package/{components → app/components}/Breadcrumbs.vue +0 -0
  170. /package/{components → app/components}/CarouselItem.vue +0 -0
  171. /package/{components → app/components}/ChatFooter.vue +0 -0
  172. /package/{components → app/components}/ChatHeader.vue +0 -0
  173. /package/{components → app/components}/ChatImage.vue +0 -0
  174. /package/{components → app/components}/CollapseContent.vue +0 -0
  175. /package/{components → app/components}/CollapseTitle.vue +0 -0
  176. /package/{components → app/components}/Crumb.vue +0 -0
  177. /package/{components → app/components}/DropdownButton.vue +0 -0
  178. /package/{components → app/components}/DropdownTarget.vue +0 -0
  179. /package/{components → app/components}/FooterTitle.vue +0 -0
  180. /package/{components → app/components}/HeroOverlay.vue +0 -0
  181. /package/{components → app/components}/Indicator.vue +0 -0
  182. /package/{components → app/components}/IndicatorItem.vue +0 -0
  183. /package/{components → app/components}/Join.vue +0 -0
  184. /package/{components → app/components}/MenuTitle.vue +0 -0
  185. /package/{components → app/components}/MockupBrowser.vue +0 -0
  186. /package/{components → app/components}/MockupBrowserToolbar.vue +0 -0
  187. /package/{components → app/components}/MockupCode.vue +0 -0
  188. /package/{components → app/components}/MockupWindow.vue +0 -0
  189. /package/{components → app/components}/ModalAction.vue +0 -0
  190. /package/{components → app/components}/ModalBox.vue +0 -0
  191. /package/{components → app/components}/StatActions.vue +0 -0
  192. /package/{components → app/components}/StatDesc.vue +0 -0
  193. /package/{components → app/components}/StatFigure.vue +0 -0
  194. /package/{components → app/components}/StatTitle.vue +0 -0
  195. /package/{components → app/components}/StatValue.vue +0 -0
  196. /package/{components → app/components}/Stats.vue +0 -0
  197. /package/{utils → app/utils}/drawer-utils.ts +0 -0
  198. /package/{utils → app/utils}/random-string.ts +0 -0
@@ -0,0 +1,174 @@
1
+ <script setup lang="ts">
2
+ import { onMounted, ref, watch } from 'vue'
3
+ import type { ComponentPublicInstance, Ref } from 'vue'
4
+ import type { PikadayOptions } from 'pikaday'
5
+
6
+ import { usePikaday } from '~/composables/use-pikaday'
7
+
8
+ const props = defineProps<{
9
+ /** Bound value: Date object or ISO string or null */
10
+ modelValue: Date | string | number | null
11
+ /** All Pikaday options (except `field`) */
12
+ options?: Omit<PikadayOptions, 'field'>
13
+ /** If true, default to today when no value provided */
14
+ autoDefault?: boolean
15
+ placeholder?: string
16
+ disabled?: boolean
17
+ validator?: boolean
18
+ join?: boolean
19
+ color?: string
20
+ primary?: boolean
21
+ secondary?: boolean
22
+ accent?: boolean
23
+ info?: boolean
24
+ success?: boolean
25
+ warning?: boolean
26
+ error?: boolean
27
+ ghost?: boolean
28
+ size?: 'xl' | 'lg' | 'md' | 'sm' | 'xs'
29
+ xl?: boolean
30
+ lg?: boolean
31
+ md?: boolean
32
+ sm?: boolean
33
+ xs?: boolean
34
+ }>()
35
+ const emit = defineEmits<{
36
+ (e: 'update:modelValue', v: Date | null): void
37
+ (e: 'update:inputValue', v: string | null): void
38
+ }>()
39
+ const inputRef = ref<ComponentPublicInstance | null>(null)
40
+ const inputValue = ref<string | null>(null)
41
+ const visible = ref(false)
42
+
43
+ const defaultOptions: Partial<PikadayOptions> = {
44
+ format: 'D MMM YYYY',
45
+ }
46
+
47
+ const { picker, createPicker } = usePikaday(
48
+ {
49
+ ...defaultOptions,
50
+ ...props.options,
51
+ bound: true,
52
+ field: undefined, // will be set below
53
+ },
54
+ handleSelect,
55
+ handleOpen,
56
+ handleClose,
57
+ )
58
+
59
+ function handleSelect(date: Date) {
60
+ emit('update:modelValue', date)
61
+ inputValue.value = picker.value?.toString() ?? ''
62
+ emit('update:inputValue', inputValue.value)
63
+ }
64
+ function handleOpen() {
65
+ visible.value = true
66
+ }
67
+ function handleClose() {
68
+ visible.value = false
69
+ }
70
+
71
+ onMounted(async () => {
72
+ const inputEl = inputRef.value as HTMLInputElement | null
73
+ // Format and set the initial input value BEFORE initializing Pikaday
74
+ if (props.modelValue) {
75
+ let d: Date | null = null
76
+ if (props.modelValue instanceof Date) {
77
+ d = props.modelValue
78
+ } else if (typeof props.modelValue === 'string') {
79
+ const tmp = new Date(props.modelValue)
80
+ if (!Number.isNaN(tmp.getTime())) {
81
+ d = tmp
82
+ }
83
+ }
84
+ if (d) {
85
+ const day = d.getDate()
86
+ const month = d.toLocaleString('en-US', { month: 'short' })
87
+ const year = d.getFullYear()
88
+ inputValue.value = `${day} ${month} ${year}`
89
+ }
90
+ }
91
+ if (inputEl) {
92
+ picker.value = await createPicker(inputEl)
93
+ // Do not call setDate here
94
+ if (picker.value && (picker.value as any).config?.bound === false) {
95
+ picker.value.hide()
96
+ }
97
+ }
98
+ })
99
+
100
+ function onFocus() {
101
+ if (picker.value) {
102
+ let d: Date | null = null
103
+ if (props.modelValue instanceof Date) {
104
+ d = props.modelValue
105
+ } else if (typeof props.modelValue === 'string') {
106
+ const tmp = new Date(props.modelValue)
107
+ if (!Number.isNaN(tmp.getTime())) {
108
+ d = tmp
109
+ }
110
+ }
111
+ picker.value.setDate(d, true)
112
+ }
113
+ }
114
+
115
+ watch(
116
+ () => props.modelValue,
117
+ val => {
118
+ if (!picker.value) {
119
+ return
120
+ }
121
+ if (!visible.value) {
122
+ if (val instanceof Date) {
123
+ picker.value.setDate(val, true)
124
+ inputValue.value = picker.value.toString()
125
+ } else if (typeof val === 'string') {
126
+ const d = new Date(val)
127
+ if (!Number.isNaN(d.getTime())) {
128
+ picker.value.setDate(d, true)
129
+ inputValue.value = picker.value.toString()
130
+ }
131
+ } else {
132
+ picker.value.setDate(null, true)
133
+ inputValue.value = ''
134
+ }
135
+ }
136
+ },
137
+ )
138
+ </script>
139
+
140
+ <template>
141
+ <input
142
+ ref="inputRef"
143
+ type="text"
144
+ :value="inputValue"
145
+ :placeholder="props.placeholder"
146
+ :disabled="props.disabled"
147
+ class="input"
148
+ :class="[
149
+ { validator: props.validator },
150
+ { 'input-primary': props.primary || props.color === 'primary' },
151
+ { 'input-secondary': props.secondary || props.color === 'secondary' },
152
+ { 'input-accent': props.accent || props.color === 'accent' },
153
+ { 'input-info': props.info || props.color === 'info' },
154
+ { 'input-success': props.success || props.color === 'success' },
155
+ { 'input-warning': props.warning || props.color === 'warning' },
156
+ { 'input-error': props.error || props.color === 'error' },
157
+ { 'input-ghost': props.ghost },
158
+ { 'input-xl': props.xl || props.size === 'xl' },
159
+ { 'input-lg': props.lg || props.size === 'lg' },
160
+ { 'input-md': props.md || props.size === 'md' },
161
+ { 'input-sm': props.sm || props.size === 'sm' },
162
+ { 'input-xs': props.xs || props.size === 'xs' },
163
+ { 'join-item': props.join },
164
+ ]"
165
+ v-bind="$attrs"
166
+ @focus="onFocus"
167
+ @input="
168
+ e => {
169
+ const val = (e.target as HTMLInputElement).value
170
+ emit('update:inputValue', val)
171
+ }
172
+ "
173
+ />
174
+ </template>
@@ -0,0 +1,46 @@
1
+ <script setup lang="ts">
2
+ import Skeleton from './Skeleton.vue'
3
+
4
+ const { numberOfMonths = 1 } = defineProps<{
5
+ numberOfMonths?: number
6
+ }>()
7
+ </script>
8
+
9
+ <template>
10
+ <Skeleton col class="bg-base-200 rounded-box">
11
+ <div
12
+ v-for="(month, idx) in numberOfMonths"
13
+ :key="`calendar-${month}`"
14
+ class="w-[270px] h-[270px] p-3 mx-auto flex flex-col gap-2"
15
+ :class="{
16
+ '-mt-3.5': idx > 0,
17
+ }"
18
+ >
19
+ <Flex justify-between items-center class="mb-3 px-2">
20
+ <span
21
+ class="size-4 rounded-full bg-base-300 inline-block"
22
+ :class="{
23
+ 'bg-base-300': idx === 0,
24
+ 'bg-transparent': idx !== 0,
25
+ }"
26
+ />
27
+ <span class="h-5 w-20 rounded-full bg-base-300 inline-block" />
28
+ <span
29
+ class="size-4 rounded-full bg-base-300 inline-block"
30
+ :class="{
31
+ 'bg-base-300': idx === numberOfMonths - 1,
32
+ 'bg-transparent': idx !== numberOfMonths - 1,
33
+ }"
34
+ />
35
+ </Flex>
36
+ <Flex col grow justify-between class="h-full">
37
+ <div class="grid grid-cols-7 gap-[4px] mb-4 flex-shrink-0">
38
+ <span v-for="d in 7" :key="`dow-${d}`" class="size-4 rounded-full bg-base-300 mx-auto block" />
39
+ </div>
40
+ <div class="grid grid-cols-7 gap-[4px] flex-grow items-center">
41
+ <span v-for="i in 35" :key="`day-${i}`" class="size-7 rounded-full bg-base-300 block mx-auto" />
42
+ </div>
43
+ </Flex>
44
+ </div>
45
+ </Skeleton>
46
+ </template>
@@ -0,0 +1,33 @@
1
+ <script setup lang="ts">
2
+ const { is = 'div', ...props } = defineProps<{
3
+ is?: any
4
+ border?: boolean
5
+ dash?: boolean
6
+ side?: boolean
7
+ imageFull?: boolean
8
+ size?: 'xl' | 'lg' | 'md' | 'sm' | 'xs'
9
+ xl?: boolean
10
+ lg?: boolean
11
+ md?: boolean
12
+ sm?: boolean
13
+ xs?: boolean
14
+ }>()
15
+ </script>
16
+
17
+ <template>
18
+ <component
19
+ :is="is" class="card" :class="{
20
+ 'card-border': props.border,
21
+ 'card-side': props.side,
22
+ 'image-full': props.imageFull,
23
+
24
+ 'card-xl': props.xl || props.size === 'xl',
25
+ 'card-lg': props.lg || props.size === 'lg',
26
+ 'card-md': props.md || props.size === 'md',
27
+ 'card-sm': props.sm || props.size === 'sm',
28
+ 'card-xs': props.xs || props.size === 'xs',
29
+ }"
30
+ >
31
+ <slot />
32
+ </component>
33
+ </template>
@@ -1,12 +1,9 @@
1
1
  <script setup lang="ts">
2
- import Text from './Text.vue'
2
+ import Text from './Text.vue';
3
3
 
4
- interface Props {
4
+ const { is = 'div' } = defineProps<{
5
5
  is?: string
6
- }
7
- withDefaults(defineProps<Props>(), {
8
- is: 'div',
9
- })
6
+ }>()
10
7
  </script>
11
8
 
12
9
  <template>
@@ -1,12 +1,9 @@
1
1
  <script setup lang="ts">
2
- import Text from './Text.vue'
2
+ import Text from './Text.vue';
3
3
 
4
- interface Props {
4
+ const { is = 'div' } = defineProps<{
5
5
  is?: string
6
- }
7
- withDefaults(defineProps<Props>(), {
8
- is: 'div',
9
- })
6
+ }>()
10
7
  </script>
11
8
 
12
9
  <template>
@@ -1,12 +1,7 @@
1
1
  <script setup lang="ts">
2
- import Text from './Text.vue'
2
+ import Text from './Text.vue';
3
3
 
4
- interface Props {
5
- is?: string
6
- }
7
- withDefaults(defineProps<Props>(), {
8
- is: 'div',
9
- })
4
+ const { is = 'div' } = defineProps<{ is?: string }>()
10
5
  </script>
11
6
 
12
7
  <template>
@@ -0,0 +1,23 @@
1
+ <script setup lang="ts">
2
+ const { snapTo, center, end, vertical } = defineProps<{
3
+ snapTo?: 'center' | 'end'
4
+ center?: boolean
5
+ end?: boolean
6
+ orientation?: 'horizontal' | 'vertical'
7
+ horizontal?: boolean
8
+ vertical?: boolean
9
+ }>()
10
+ </script>
11
+
12
+ <template>
13
+ <div
14
+ class="carousel" :class="{
15
+ 'carousel-center': center || snapTo === 'center',
16
+ 'carousel-end': end || snapTo === 'end',
17
+ 'carousel-horizontal': horizontal || orientation === 'horizontal',
18
+ 'carousel-vertical': vertical || orientation === 'vertical',
19
+ }"
20
+ >
21
+ <slot />
22
+ </div>
23
+ </template>
@@ -0,0 +1,21 @@
1
+ <script setup lang="ts">
2
+ const { pre, align = 'start', start, end } = defineProps<{
3
+ pre?: boolean
4
+ align?: string
5
+ start?: boolean
6
+ end?: boolean
7
+ }>()
8
+ </script>
9
+
10
+ <template>
11
+ <div
12
+ class="chat"
13
+ :class="{
14
+ 'chat-start': start || (!end && align === 'start'),
15
+ 'chat-end': end || align === 'end',
16
+ 'whitespace-pre': pre,
17
+ }"
18
+ >
19
+ <slot />
20
+ </div>
21
+ </template>
@@ -0,0 +1,31 @@
1
+ <script setup lang="ts">
2
+ const { color, neutral, primary, secondary, accent, info, success, warning, error } = defineProps<{
3
+ color?: string
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
+ </script>
14
+
15
+ <template>
16
+ <div
17
+ class="chat-bubble"
18
+ :class="{
19
+ 'chat-bubble-neutral': neutral || color === 'neutral',
20
+ 'chat-bubble-primary': primary || color === 'primary',
21
+ 'chat-bubble-secondary': secondary || color === 'secondary',
22
+ 'chat-bubble-accent': accent || color === 'accent',
23
+ 'chat-bubble-info': info || color === 'info',
24
+ 'chat-bubble-success': success || color === 'success',
25
+ 'chat-bubble-warning': warning || color === 'warning',
26
+ 'chat-bubble-error': error || color === 'error',
27
+ }"
28
+ >
29
+ <slot />
30
+ </div>
31
+ </template>
@@ -0,0 +1,51 @@
1
+ <script setup lang="ts">
2
+ import { computed } from 'vue'
3
+
4
+ const props = defineProps<{
5
+ modelValue?: any
6
+ themeController?: boolean
7
+
8
+ color?: string
9
+ primary?: boolean
10
+ secondary?: boolean
11
+ accent?: boolean
12
+ success?: boolean
13
+ warning?: boolean
14
+ info?: boolean
15
+ error?: boolean
16
+
17
+ size?: string
18
+ lg?: boolean
19
+ md?: boolean
20
+ sm?: boolean
21
+ xs?: boolean
22
+ }>()
23
+ const emit = defineEmits(['update:modelValue'])
24
+
25
+ const currentValue = computed({
26
+ get: () => props.modelValue,
27
+ set: (val: string) => emit('update:modelValue', val),
28
+ })
29
+ </script>
30
+
31
+ <template>
32
+ <input
33
+ v-model="currentValue"
34
+ type="checkbox"
35
+ class="checkbox"
36
+ :class="{
37
+ 'checkbox-primary': primary || color === 'primary',
38
+ 'checkbox-secondary': secondary || color === 'secondary',
39
+ 'checkbox-accent': accent || color === 'accent',
40
+ 'checkbox-success': success || color === 'success',
41
+ 'checkbox-warning': warning || color === 'warning',
42
+ 'checkbox-info': info || color === 'info',
43
+ 'checkbox-error': error || color === 'error',
44
+ 'checkbox-xs': xs || size === 'xs',
45
+ 'checkbox-sm': sm || size === 'sm',
46
+ 'checkbox-md': md || size === 'md',
47
+ 'checkbox-lg': lg || size === 'lg',
48
+ 'theme-controller': themeController,
49
+ }"
50
+ >
51
+ </template>
@@ -0,0 +1,43 @@
1
+ <script setup lang="ts">
2
+ import { inject, ref } from 'vue'
3
+
4
+ const props = defineProps<{
5
+ variant?: 'arrow' | 'plus'
6
+ arrow?: boolean
7
+ plus?: boolean
8
+ open?: boolean
9
+ close?: boolean
10
+ toggle?: boolean
11
+ value?: any
12
+ }>()
13
+
14
+ const accordionValue = inject('accordion-value', ref(null))
15
+ const useAccordion = accordionValue.value !== null
16
+
17
+ function handleClick() {
18
+ if (useAccordion) {
19
+ accordionValue.value = props.value
20
+ }
21
+ }
22
+ </script>
23
+
24
+ <template>
25
+ <div
26
+ tabindex="0"
27
+ class="collapse"
28
+ :class="[
29
+ { 'collapse-arrow': props.arrow || props.variant === 'arrow' },
30
+ { 'collapse-plus': props.plus || props.variant === 'plus' },
31
+ { 'collapse-open': (props.open && !props.close) || (useAccordion && accordionValue === props.value) },
32
+ { 'collapse-close': props.close },
33
+ ]"
34
+ @click="handleClick"
35
+ >
36
+ <input
37
+ v-if="props.toggle || useAccordion"
38
+ :type="useAccordion ? 'radio' : 'checkbox'"
39
+ :checked="useAccordion ? accordionValue === props.value : undefined"
40
+ >
41
+ <slot />
42
+ </div>
43
+ </template>
@@ -0,0 +1,15 @@
1
+ <script setup lang="ts">
2
+ import { computed } from 'vue';
3
+
4
+ const { is = 'span' } = defineProps<{
5
+ is?: any
6
+ }>()
7
+
8
+ const tag = computed(() => is)
9
+ </script>
10
+
11
+ <template>
12
+ <component :is="tag" class="countdown">
13
+ <slot />
14
+ </component>
15
+ </template>
@@ -0,0 +1,72 @@
1
+ <script setup lang="ts">
2
+ import { useIntervalFn } from '@vueuse/core';
3
+ import { computed, ref, watch } from 'vue';
4
+
5
+ const { durationInSeconds = 0, untilDate } = defineProps<{
6
+ durationInSeconds?: number
7
+ untilDate?: Date
8
+ }>()
9
+ const emit = defineEmits(['done'])
10
+
11
+ function getTargetDate() {
12
+ return untilDate || new Date(Date.now() + durationInSeconds * 1000)
13
+ }
14
+
15
+ const targetDate = ref(getTargetDate())
16
+
17
+ watch(
18
+ () => [durationInSeconds, untilDate],
19
+ () => {
20
+ targetDate.value = getTargetDate()
21
+ },
22
+ { immediate: true },
23
+ )
24
+
25
+ const timeLeft = ref(0)
26
+ const calcTimeLeft = () => Math.max(0, targetDate.value.getTime() - Date.now())
27
+
28
+ useIntervalFn(() => {
29
+ timeLeft.value = calcTimeLeft()
30
+ }, 1000)
31
+
32
+ watch(timeLeft, (val) => {
33
+ if (val === 0) {
34
+ emit('done')
35
+ }
36
+ })
37
+
38
+ const totalSeconds = computed(() => Math.round(timeLeft.value / 1000))
39
+ const totalMinutes = computed(() => Math.floor(totalSeconds.value / 60))
40
+ const totalHours = computed(() => Math.floor(totalMinutes.value / 60))
41
+ const totalDays = computed(() => Math.floor(totalHours.value / 24))
42
+ const totalWeeks = computed(() => Math.floor(totalDays.value / 7))
43
+ const totalMonths = computed(() => {
44
+ const now = new Date()
45
+ return (
46
+ (targetDate.value.getFullYear() - now.getFullYear()) * 12
47
+ + (targetDate.value.getMonth() - now.getMonth())
48
+ )
49
+ })
50
+ const split = computed(() => {
51
+ const days = totalDays.value
52
+ const hours = totalHours.value - days * 24
53
+ const minutes = totalMinutes.value - totalHours.value * 60
54
+ const seconds = totalSeconds.value - totalMinutes.value * 60
55
+ return { days, hours, minutes, seconds }
56
+ })
57
+ </script>
58
+
59
+ <template>
60
+ <slot
61
+ v-bind="{
62
+ totalSeconds,
63
+ totalMinutes,
64
+ totalHours,
65
+ totalDays,
66
+ totalWeeks,
67
+ totalMonths,
68
+ targetDate,
69
+ split,
70
+ }"
71
+ />
72
+ </template>
@@ -0,0 +1,10 @@
1
+ <script setup lang="ts">
2
+ const { is = 'span' } = defineProps<{
3
+ value: number
4
+ is?: any
5
+ }>()
6
+ </script>
7
+
8
+ <template>
9
+ <component :is="is" v-bind="$attrs" :style="`--value:${value};`" />
10
+ </template>
@@ -0,0 +1,38 @@
1
+ <script setup lang="ts">
2
+ withDefaults(defineProps<{
3
+ is?: string
4
+ hover?: boolean
5
+
6
+ color?: 'neutral' | 'primary' | 'secondary' | 'accent' | 'success' | 'info' | 'warning' | 'error'
7
+ neutral?: boolean
8
+ primary?: boolean
9
+ secondary?: boolean
10
+ accent?: boolean
11
+ success?: boolean
12
+ info?: boolean
13
+ warning?: boolean
14
+ error?: boolean
15
+ }>(), {
16
+ is: 'a',
17
+ })
18
+ </script>
19
+
20
+ <template>
21
+ <component
22
+ :is="is"
23
+ class="link"
24
+ :class="{
25
+ 'link-neutral': neutral || color === 'neutral',
26
+ 'link-primary': primary || color === 'primary',
27
+ 'link-secondary': secondary || color === 'secondary',
28
+ 'link-accent': accent || color === 'accent',
29
+ 'link-success': success || color === 'success',
30
+ 'link-info': info || color === 'info',
31
+ 'link-warning': warning || color === 'warning',
32
+ 'link-error': error || color === 'error',
33
+ 'link-hover': hover,
34
+ }"
35
+ >
36
+ <slot />
37
+ </component>
38
+ </template>
@@ -0,0 +1,11 @@
1
+ <template>
2
+ <figure class="diff" tabindex="0">
3
+ <div class="diff-item-1" role="img" tabindex="0">
4
+ <slot name="one" />
5
+ </div>
6
+ <div class="diff-item-2" role="img">
7
+ <slot name="two" />
8
+ </div>
9
+ <div class="diff-resizer" />
10
+ </figure>
11
+ </template>
@@ -0,0 +1,43 @@
1
+ <script setup lang="ts">
2
+ defineProps<{
3
+ orientation?: 'horizontal' | 'vertical'
4
+ horizontal?: boolean
5
+ vertical?: boolean
6
+ align?: 'center' | 'start' | 'end'
7
+ center?: boolean
8
+ start?: boolean
9
+ end?: boolean
10
+ color?: 'neutral' | 'primary' | 'secondary' | 'accent' | 'success' | 'warning' | 'info' | 'error'
11
+ neutral?: boolean
12
+ primary?: boolean
13
+ secondary?: boolean
14
+ accent?: boolean
15
+ success?: boolean
16
+ warning?: boolean
17
+ info?: boolean
18
+ error?: boolean
19
+ }>()
20
+ </script>
21
+
22
+ <template>
23
+ <div
24
+ class="divider"
25
+ :class="{
26
+ 'divider-vertical': orientation === 'vertical' || vertical,
27
+ 'divider-horizontal': orientation !== 'vertical' || horizontal,
28
+ 'divider-neutral': color === 'neutral' || neutral,
29
+ 'divider-primary': color === 'primary' || primary,
30
+ 'divider-secondary': color === 'secondary' || secondary,
31
+ 'divider-accent': color === 'accent' || accent,
32
+ 'divider-success': color === 'success' || success,
33
+ 'divider-warning': color === 'warning' || warning,
34
+ 'divider-info': color === 'info' || info,
35
+ 'divider-error': color === 'error' || error,
36
+ 'divider-start': align === 'start' || start,
37
+ 'divider-center': align === 'center' || center,
38
+ 'divider-end': align === 'end' || end,
39
+ }"
40
+ >
41
+ <slot />
42
+ </div>
43
+ </template>