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,12 @@
1
+ <script setup lang="ts">
2
+ const { active = false, disabled = false } = defineProps<{
3
+ active?: boolean
4
+ disabled?: boolean
5
+ }>()
6
+ </script>
7
+
8
+ <template>
9
+ <button class="nav-button" :class="{ active, disabled }">
10
+ <slot />
11
+ </button>
12
+ </template>
@@ -1,10 +1,8 @@
1
1
  <script setup lang="ts">
2
- withDefaults(defineProps<{
3
- is?: string | Object | Function
2
+ const { is = 'div', glass = false } = defineProps<{
3
+ is?: any
4
4
  glass?: boolean
5
- }>(), {
6
- is: 'div',
7
- })
5
+ }>()
8
6
  </script>
9
7
 
10
8
  <template>
@@ -1,9 +1,7 @@
1
1
  <script setup lang="ts">
2
- withDefaults(defineProps<{
3
- is?: string | Object | Function
4
- }>(), {
5
- is: 'div',
6
- })
2
+ const { is = 'div' } = defineProps<{
3
+ is?: any
4
+ }>()
7
5
  </script>
8
6
 
9
7
  <template>
@@ -1,9 +1,7 @@
1
1
  <script setup lang="ts">
2
- withDefaults(defineProps<{
3
- is?: string | Object | Function
4
- }>(), {
5
- is: 'div',
6
- })
2
+ const { is = 'div' } = defineProps<{
3
+ is?: any
4
+ }>()
7
5
  </script>
8
6
 
9
7
  <template>
@@ -1,9 +1,7 @@
1
1
  <script setup lang="ts">
2
- withDefaults(defineProps<{
3
- is?: string | Object | Function
4
- }>(), {
5
- is: 'div',
6
- })
2
+ const { is = 'div' } = defineProps<{
3
+ is?: any
4
+ }>()
7
5
  </script>
8
6
 
9
7
  <template>
@@ -0,0 +1,34 @@
1
+ <script setup lang="ts">
2
+ const { value = 0, max = 100, color, neutral, primary, secondary, accent, success, info, warning, error } = defineProps<{
3
+ value?: string | number
4
+ max?: string | number
5
+
6
+ color?: string
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
+ </script>
17
+
18
+ <template>
19
+ <progress
20
+ :value="value"
21
+ :max="max"
22
+ class="progress"
23
+ :class="{
24
+ 'progress-neutral': neutral || color === 'neutral',
25
+ 'progress-primary': primary || color === 'primary',
26
+ 'progress-secondary': secondary || color === 'secondary',
27
+ 'progress-accent': accent || color === 'accent',
28
+ 'progress-success': success || color === 'success',
29
+ 'progress-info': info || color === 'info',
30
+ 'progress-warning': warning || color === 'warning',
31
+ 'progress-error': error || color === 'error',
32
+ }"
33
+ />
34
+ </template>
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <article class="prose daisy-prose max-w-none">
2
+ <article class="prose daisy-prose">
3
3
  <slot />
4
4
  </article>
5
5
  </template>
@@ -0,0 +1,36 @@
1
+ <script setup lang="ts">
2
+ defineProps<{
3
+ value: number | string
4
+ size?: string
5
+ thickness?: 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
+ </script>
18
+
19
+ <template>
20
+ <div
21
+ class="radial-progress"
22
+ :class="{
23
+ 'text-neutral': (neutral || color === 'neutral'),
24
+ 'text-primary': (primary || color === 'primary'),
25
+ 'text-secondary': (secondary || color === 'secondary'),
26
+ 'text-accent': (accent || color === 'accent'),
27
+ 'text-info': (info || color === 'info'),
28
+ 'text-success': (success || color === 'success'),
29
+ 'text-warning': (warning || color === 'warning'),
30
+ 'text-error': (error || color === 'error'),
31
+ }"
32
+ :style="`--value:${value}; --size:${size || '4rem'}; --thickness:${thickness || 'calc(var(--size) / 10)'};`"
33
+ >
34
+ <slot />
35
+ </div>
36
+ </template>
@@ -0,0 +1,69 @@
1
+ <script setup lang="ts">
2
+ import { computed, inject } from 'vue'
3
+
4
+ const props = defineProps<{
5
+ modelValue?: any
6
+ value: any
7
+ disabled?: boolean
8
+ themeController?: boolean
9
+
10
+ color?: string
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
+ size?: string
21
+ xs?: boolean
22
+ sm?: boolean
23
+ md?: boolean
24
+ lg?: boolean
25
+ xl?: boolean
26
+ }>()
27
+ const emit = defineEmits(['update:modelValue'])
28
+
29
+ const radioGroup: any = inject('radio-group', null)
30
+
31
+ const currentValue = computed({
32
+ get() {
33
+ return radioGroup ? radioGroup.currentValue : props.modelValue
34
+ },
35
+ set(val: any) {
36
+ if (radioGroup) {
37
+ radioGroup.currentValue = val
38
+ }
39
+ emit('update:modelValue', val)
40
+ },
41
+ })
42
+ </script>
43
+
44
+ <template>
45
+ <input
46
+ v-model="currentValue"
47
+ type="radio"
48
+ v-bind="$attrs"
49
+ class="radio"
50
+ :class="{
51
+ 'radio-neutral': props.neutral || props.color === 'neutral',
52
+ 'radio-primary': props.primary || props.color === 'primary',
53
+ 'radio-secondary': props.secondary || props.color === 'secondary',
54
+ 'radio-accent': props.accent || props.color === 'accent',
55
+ 'radio-success': props.success || props.color === 'success',
56
+ 'radio-warning': props.warning || props.color === 'warning',
57
+ 'radio-info': props.info || props.color === 'info',
58
+ 'radio-error': props.error || props.color === 'error',
59
+ 'radio-xs': props.xs || props.size === 'xs',
60
+ 'radio-sm': props.sm || props.size === 'sm',
61
+ 'radio-md': props.md || props.size === 'md',
62
+ 'radio-lg': props.lg || props.size === 'lg',
63
+ 'radio-xl': props.xl || props.size === 'xl',
64
+ 'theme-controller': props.themeController,
65
+ }"
66
+ :disabled="props.disabled"
67
+ :value="props.value"
68
+ >
69
+ </template>
@@ -1,5 +1,5 @@
1
1
  <script setup lang="ts">
2
- import { computed, provide, reactive } from 'vue'
2
+ import { computed, provide, reactive } from 'vue';
3
3
 
4
4
  const props = defineProps<{
5
5
  modelValue?: any
@@ -20,6 +20,7 @@ const props = defineProps<{
20
20
  sm?: boolean
21
21
  md?: boolean
22
22
  lg?: boolean
23
+ xl?: boolean
23
24
  }>()
24
25
  const emit = defineEmits(['update:modelValue'])
25
26
 
@@ -0,0 +1,61 @@
1
+ <script setup lang="ts">
2
+ import { computed } from 'vue';
3
+
4
+ const props = defineProps<{
5
+ modelValue?: number | string
6
+ min?: number | string
7
+ max?: number | string
8
+ step?: number | string
9
+ disabled?: boolean
10
+
11
+ color?: string
12
+ neutral?: boolean
13
+ primary?: boolean
14
+ secondary?: boolean
15
+ accent?: boolean
16
+ success?: boolean
17
+ warning?: boolean
18
+ info?: boolean
19
+ error?: boolean
20
+
21
+ size?: 'xl' | 'lg' | 'md' | 'sm' | 'xs'
22
+ xl?: boolean
23
+ lg?: boolean
24
+ md?: boolean
25
+ sm?: boolean
26
+ xs?: boolean
27
+ }>()
28
+ const emit = defineEmits(['update:modelValue'])
29
+
30
+ const currentValue = computed({
31
+ get: () => props.modelValue,
32
+ set: val => emit('update:modelValue', val),
33
+ })
34
+ </script>
35
+
36
+ <template>
37
+ <input
38
+ v-model="currentValue"
39
+ type="range"
40
+ class="range"
41
+ :class="{
42
+ 'range-neutral': neutral || color === 'neutral',
43
+ 'range-primary': primary || color === 'primary',
44
+ 'range-secondary': secondary || color === 'secondary',
45
+ 'range-accent': accent || color === 'accent',
46
+ 'range-success': success || color === 'success',
47
+ 'range-info': info || color === 'info',
48
+ 'range-warning': warning || color === 'warning',
49
+ 'range-error': error || color === 'error',
50
+ 'range-xl': xl || size === 'xl',
51
+ 'range-lg': lg || size === 'lg',
52
+ 'range-md': md || size === 'md',
53
+ 'range-sm': sm || size === 'sm',
54
+ 'range-xs': xs || size === 'xs',
55
+ }"
56
+ :min="min"
57
+ :max="max"
58
+ :step="step"
59
+ :disabled="disabled"
60
+ >
61
+ </template>
@@ -1,5 +1,5 @@
1
1
  <script setup lang="ts">
2
- import { computed } from 'vue'
2
+ import { computed } from 'vue';
3
3
 
4
4
  const props = withDefaults(defineProps<{
5
5
  modelValue?: number | string
@@ -21,7 +21,8 @@ const props = withDefaults(defineProps<{
21
21
  info?: boolean
22
22
  error?: boolean
23
23
 
24
- size?: 'lg' | 'md' | 'sm' | 'xs'
24
+ size?: 'xl' | 'lg' | 'md' | 'sm' | 'xs'
25
+ xl?: boolean
25
26
  lg?: boolean
26
27
  md?: boolean
27
28
  sm?: boolean
@@ -33,24 +34,6 @@ const props = withDefaults(defineProps<{
33
34
  })
34
35
  defineEmits(['update:modelValue'])
35
36
 
36
- const classes = computed(() => {
37
- const { color, neutral, primary, secondary, accent, success, info, warning, error, size, lg, md, sm, xs, disabled } = props
38
- return {
39
- 'text-neutral': neutral || color === 'neutral',
40
- 'text-primary': primary || color === 'primary',
41
- 'text-secondary': secondary || color === 'secondary',
42
- 'text-accent': accent || color === 'accent',
43
- 'text-success': success || color === 'success',
44
- 'text-info': info || color === 'info',
45
- 'text-warning': warning || color === 'warning',
46
- 'text-error': error || color === 'error',
47
- 'text-lg': lg || size === 'lg',
48
- 'text-md': md || size === 'md',
49
- 'text-sm': sm || size === 'sm',
50
- 'text-xs': xs || size === 'xs',
51
- 'opacity-50': disabled,
52
- }
53
- })
54
37
  const values = computed(() => {
55
38
  const vals = []
56
39
  for (let index = Number.parseInt(props.min as string); index < Number.parseInt(props.max as string) + 1; index++) {
@@ -65,7 +48,25 @@ const values = computed(() => {
65
48
  </script>
66
49
 
67
50
  <template>
68
- <div class="flex justify-between select-none" :class="classes">
51
+ <div
52
+ class="flex justify-between select-none"
53
+ :class="{
54
+ 'text-neutral': neutral || color === 'neutral',
55
+ 'text-primary': primary || color === 'primary',
56
+ 'text-secondary': secondary || color === 'secondary',
57
+ 'text-accent': accent || color === 'accent',
58
+ 'text-success': success || color === 'success',
59
+ 'text-info': info || color === 'info',
60
+ 'text-warning': warning || color === 'warning',
61
+ 'text-error': error || color === 'error',
62
+ 'text-xl': xl || size === 'xl',
63
+ 'text-lg': lg || size === 'lg',
64
+ 'text-md': md || size === 'md',
65
+ 'text-sm': sm || size === 'sm',
66
+ 'text-xs': xs || size === 'xs',
67
+ 'opacity-50': disabled,
68
+ }"
69
+ >
69
70
  <RangeMeasureTick
70
71
  v-for="tick in values"
71
72
  :key="tick.value"
@@ -1,6 +1,6 @@
1
1
  <script setup lang="ts">
2
- import { computed, watch } from 'vue'
3
2
  import { useTimeoutFn } from '@vueuse/core'
3
+ import { computed, ref, watch } from 'vue'
4
4
 
5
5
  const props = defineProps<{
6
6
  tick: number
@@ -18,12 +18,11 @@ const { isPending, start, stop } = useTimeoutFn(() => {
18
18
  }, 1000)
19
19
  watch(
20
20
  () => props.modelValue,
21
- (val) => {
21
+ val => {
22
22
  if (val) {
23
23
  start()
24
24
  hasChanged.value = true
25
- }
26
- else if (!isPending.value) {
25
+ } else if (!isPending.value) {
27
26
  stop()
28
27
  }
29
28
  },
@@ -31,15 +30,6 @@ watch(
31
30
 
32
31
  // eslint-disable-next-line eqeqeq
33
32
  const isCurrent = computed(() => props.modelValue == props.tick)
34
-
35
- const classes = computed(() => {
36
- return {
37
- 'font-bold': isCurrent.value,
38
- 'opacity-50': props.disabled,
39
- 'cursor-pointer': !props.disabled,
40
- 'cursor-not-allowed': props.disabled,
41
- }
42
- })
43
33
  </script>
44
34
 
45
35
  <template>
@@ -48,7 +38,12 @@ const classes = computed(() => {
48
38
  xs
49
39
  :ghost="!isCurrent"
50
40
  circle
51
- :class="classes"
41
+ :class="{
42
+ 'font-bold': isCurrent,
43
+ 'opacity-50': props.disabled,
44
+ 'cursor-pointer': !props.disabled,
45
+ 'cursor-not-allowed': props.disabled,
46
+ }"
52
47
  :disabled="disabled"
53
48
  @click="$emit('update:modelValue', tick)"
54
49
  >
@@ -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>