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
@@ -0,0 +1,94 @@
1
+ <script setup lang="ts">
2
+ import type { Ref } from 'vue'
3
+
4
+ import { onClickOutside, useElementHover } from '@vueuse/core'
5
+ import { onMounted, provide, ref } from 'vue'
6
+ import { randomString } from '../utils/random-string'
7
+
8
+ // Define the MenuExpandState interface
9
+ export interface MenuExpandState {
10
+ id: string
11
+ isOpen: Ref<boolean>
12
+ toggle: () => void
13
+ open: () => void
14
+ close: () => void
15
+ }
16
+
17
+ // Props with defaults
18
+ const {
19
+ randomId = randomString(12),
20
+ hover = false,
21
+ delayLeave = 300,
22
+ closeOnClickOutside = false,
23
+ } = defineProps<{
24
+ randomId?: string
25
+ hover?: boolean
26
+ delayLeave?: number
27
+ closeOnClickOutside?: boolean
28
+ }>()
29
+
30
+ // v-model for open state
31
+ const isOpen = defineModel('open', { default: false, type: Boolean })
32
+
33
+ // Generate IDs for accessibility and targeting
34
+ const wrapperId = `expand-wrapper-${randomId}`
35
+ const id = `expand-${randomId}`
36
+
37
+ // Element reference for click outside detection
38
+ const expandEl = ref()
39
+
40
+ // Control functions
41
+ function toggle() {
42
+ setTimeout(() => {
43
+ isOpen.value = !isOpen.value
44
+ }, 50)
45
+ }
46
+
47
+ function open() {
48
+ isOpen.value = true
49
+ }
50
+
51
+ function close() {
52
+ isOpen.value = false
53
+ }
54
+
55
+ // Create and provide the menu expand state object
56
+ const menuExpandState: MenuExpandState = {
57
+ id,
58
+ isOpen,
59
+ toggle,
60
+ open,
61
+ close,
62
+ }
63
+
64
+ // Provide the state to child components
65
+ provide('menuExpandState', menuExpandState)
66
+
67
+ // Setup event handlers
68
+ onMounted(() => {
69
+ // Handle clicks outside the component
70
+ onClickOutside(expandEl, () => {
71
+ if (closeOnClickOutside) {
72
+ setTimeout(() => {
73
+ isOpen.value = false
74
+ }, 500)
75
+ }
76
+ })
77
+
78
+ // Setup hover behavior if enabled
79
+ if (hover) {
80
+ useElementHover(expandEl, {
81
+ delayLeave,
82
+ })
83
+ }
84
+ })
85
+
86
+ // Empty click handler for internal use
87
+ function handleClick(_ev: MouseEvent) {}
88
+ </script>
89
+
90
+ <template>
91
+ <details :id="wrapperId" ref="expandEl" class="dropdown menu-expand" :open="isOpen" @click="handleClick">
92
+ <slot v-bind="{ toggle, open, close }" />
93
+ </details>
94
+ </template>
@@ -0,0 +1,20 @@
1
+ <script setup lang="ts">
2
+ import type { MenuExpandState } from './MenuExpand.vue'
3
+
4
+ import { inject } from 'vue'
5
+
6
+ const menuExpandState = inject<MenuExpandState>('menuExpandState')
7
+ const { id, isOpen, toggle } = menuExpandState || {}
8
+ </script>
9
+
10
+ <template>
11
+ <summary
12
+ :id="id"
13
+ :aria-expanded="isOpen"
14
+ aria-haspopup="menu"
15
+ class="menu-expand-toggle"
16
+ @click.prevent.stop="toggle"
17
+ >
18
+ <slot />
19
+ </summary>
20
+ </template>
@@ -1,12 +1,11 @@
1
1
  <script setup lang="ts">
2
2
  defineProps<{
3
- active?: boolean
4
3
  disabled?: boolean
5
4
  }>()
6
5
  </script>
7
6
 
8
7
  <template>
9
- <li class="menu-item" :class="{ active, disabled }">
8
+ <li class="menu-item" :class="{ 'menu-disabled': disabled }">
10
9
  <slot />
11
10
  </li>
12
11
  </template>
@@ -16,12 +15,14 @@ defineProps<{
16
15
  Allow adding .active class to the MenuItem element.
17
16
  DaisyUI only supports adding it to the `a` element.
18
17
  */
19
- .menu-item.active > a, .menu-item.active > span {
18
+ .menu-item.menu-active > a,
19
+ .menu-item.menu-active > span {
20
20
  background-color: hsl(var(--n) / var(--tw-bg-opacity));
21
21
  color: hsl(var(--nc) / var(--tw-text-opacity));
22
22
  }
23
- .menu-item.disabled > a, .menu-item.disabled > span {
24
- background-color: var(--n)
23
+ .menu-item.menu-disabled > a,
24
+ .menu-item.menu-disabled > span {
25
+ background-color: var(--n);
25
26
  }
26
27
 
27
28
  /* Fix padding when putting a Dropdown inside of a menu */
@@ -33,6 +34,6 @@ defineProps<{
33
34
  padding-left: 1rem;
34
35
  padding-right: 1rem;
35
36
  padding-top: 0.5rem;
36
- padding-bottom: 0.5rem
37
+ padding-bottom: 0.5rem;
37
38
  }
38
39
  </style>
@@ -0,0 +1,14 @@
1
+ <script lang="ts" setup>
2
+ defineProps<{
3
+ displayClasses?: string
4
+ }>()
5
+ </script>
6
+
7
+ <template>
8
+ <div class="mockup-phone">
9
+ <div class="mockup-phone-camera" />
10
+ <div class="mockup-phone-display" :class="displayClasses">
11
+ <slot />
12
+ </div>
13
+ </div>
14
+ </template>
@@ -1,38 +1,51 @@
1
1
  <script setup lang="ts">
2
2
  import { computed, ref, watch } from 'vue'
3
3
 
4
- const props = defineProps<{
5
- modelValue?: boolean
6
- closeOnClickOutside?: boolean
7
- top?: boolean
8
- bottom?: boolean
9
- }>()
4
+ const props = withDefaults(
5
+ defineProps<{
6
+ modelValue?: boolean
7
+ closeOnClickOutside?: boolean
8
+ placement?: 'top' | 'bottom' | 'start' | 'end'
9
+ top?: boolean
10
+ bottom?: boolean
11
+ start?: boolean
12
+ end?: boolean
13
+ }>(),
14
+ {
15
+ closeOnClickOutside: true,
16
+ },
17
+ )
10
18
  const emit = defineEmits(['update:modelValue'])
11
19
 
12
20
  const is = 'div'
13
21
 
14
22
  // defineModel 'open'
15
23
  const _isOpen = ref(props.modelValue)
16
- watch(() => props.modelValue, (val) => {
17
- _isOpen.value = val
18
- })
24
+ watch(
25
+ () => props.modelValue,
26
+ val => {
27
+ _isOpen.value = val
28
+ },
29
+ )
19
30
  const isOpen = computed({
20
31
  get: () => _isOpen.value,
21
- set: (val) => {
32
+ set: val => {
22
33
  _isOpen.value = val
23
- if (props.modelValue !== val)
34
+ if (props.modelValue !== val) {
24
35
  emit('update:modelValue', val)
36
+ }
25
37
  },
26
38
  })
27
39
 
28
40
  function handleClick() {
29
- if (props.closeOnClickOutside)
41
+ if (props.closeOnClickOutside) {
30
42
  isOpen.value = false
43
+ }
31
44
  }
32
45
  </script>
33
46
 
34
47
  <template>
35
- <input v-model="isOpen" type="checkbox" class="modal-toggle">
48
+ <input v-model="isOpen" type="checkbox" class="modal-toggle" />
36
49
  <Component
37
50
  :is="is"
38
51
  v-bind="{ ...$attrs, ...$props }"
@@ -40,6 +53,8 @@ function handleClick() {
40
53
  :class="{
41
54
  'modal-top': props.top,
42
55
  'modal-bottom': props.bottom,
56
+ 'modal-start': props.start,
57
+ 'modal-end': props.end,
43
58
  }"
44
59
  @click.self="handleClick"
45
60
  >
@@ -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,46 @@
1
+ <script setup lang="ts">
2
+ const {
3
+ value = 0,
4
+ max = 100,
5
+ color,
6
+ neutral,
7
+ primary,
8
+ secondary,
9
+ accent,
10
+ success,
11
+ info,
12
+ warning,
13
+ error,
14
+ } = defineProps<{
15
+ value?: string | number
16
+ max?: string | number
17
+
18
+ color?: string
19
+ neutral?: boolean
20
+ primary?: boolean
21
+ secondary?: boolean
22
+ accent?: boolean
23
+ success?: boolean
24
+ info?: boolean
25
+ warning?: boolean
26
+ error?: boolean
27
+ }>()
28
+ </script>
29
+
30
+ <template>
31
+ <progress
32
+ :value="value"
33
+ :max="max"
34
+ class="progress"
35
+ :class="{
36
+ 'progress-neutral': neutral || color === 'neutral',
37
+ 'progress-primary': primary || color === 'primary',
38
+ 'progress-secondary': secondary || color === 'secondary',
39
+ 'progress-accent': accent || color === 'accent',
40
+ 'progress-success': success || color === 'success',
41
+ 'progress-info': info || color === 'info',
42
+ 'progress-warning': warning || color === 'warning',
43
+ 'progress-error': error || color === 'error',
44
+ }"
45
+ />
46
+ </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>
@@ -25,8 +25,13 @@
25
25
  @apply text-accent;
26
26
  }
27
27
 
28
- .prose h1 a, .prose h2 a, .prose h3 a, .prose h4 a, .prose h5 a, .prose h6 a {
28
+ .prose h1 a,
29
+ .prose h2 a,
30
+ .prose h3 a,
31
+ .prose h4 a,
32
+ .prose h5 a,
33
+ .prose h6 a {
29
34
  text-decoration: none;
30
- @apply font-bold
35
+ @apply font-bold;
31
36
  }
32
37
  </style>
@@ -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>
@@ -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
 
@@ -27,7 +28,7 @@ const currentValue = computed({
27
28
  get: () => {
28
29
  return props.modelValue
29
30
  },
30
- set: (val) => {
31
+ set: val => {
31
32
  emit('update:modelValue', val)
32
33
  },
33
34
  })
@@ -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>
@@ -0,0 +1,87 @@
1
+ <script setup lang="ts">
2
+ import { computed } from 'vue'
3
+
4
+ const props = withDefaults(
5
+ defineProps<{
6
+ modelValue?: number | string
7
+ min?: number | string
8
+ max?: number | string
9
+ step?: number | string
10
+
11
+ numbered?: boolean
12
+ asButtons?: boolean
13
+ disabled?: boolean
14
+
15
+ color?: string
16
+ neutral?: boolean
17
+ primary?: boolean
18
+ secondary?: boolean
19
+ accent?: boolean
20
+ success?: boolean
21
+ warning?: boolean
22
+ info?: boolean
23
+ error?: boolean
24
+
25
+ size?: 'xl' | 'lg' | 'md' | 'sm' | 'xs'
26
+ xl?: boolean
27
+ lg?: boolean
28
+ md?: boolean
29
+ sm?: boolean
30
+ xs?: boolean
31
+ }>(),
32
+ {
33
+ min: 0,
34
+ max: 100,
35
+ step: 1,
36
+ },
37
+ )
38
+ defineEmits(['update:modelValue'])
39
+
40
+ const values = computed(() => {
41
+ const vals = []
42
+ for (let index = Number.parseInt(props.min as string); index < Number.parseInt(props.max as string) + 1; index++) {
43
+ vals.push({
44
+ value: index,
45
+ isVisible: index % Number.parseInt(props.step as string) === 0,
46
+ })
47
+ }
48
+ return vals
49
+ })
50
+ // const count = computed(() => Number.parseInt(props.max as string) - Number.parseInt(props.min as string))
51
+ </script>
52
+
53
+ <template>
54
+ <div
55
+ class="flex justify-between select-none"
56
+ :class="{
57
+ 'text-neutral': neutral || color === 'neutral',
58
+ 'text-primary': primary || color === 'primary',
59
+ 'text-secondary': secondary || color === 'secondary',
60
+ 'text-accent': accent || color === 'accent',
61
+ 'text-success': success || color === 'success',
62
+ 'text-info': info || color === 'info',
63
+ 'text-warning': warning || color === 'warning',
64
+ 'text-error': error || color === 'error',
65
+ 'text-xl': xl || size === 'xl',
66
+ 'text-lg': lg || size === 'lg',
67
+ 'text-md': md || size === 'md',
68
+ 'text-sm': sm || size === 'sm',
69
+ 'text-xs': xs || size === 'xs',
70
+ 'opacity-50': disabled,
71
+ }"
72
+ >
73
+ <RangeMeasureTick
74
+ v-for="tick in values"
75
+ :key="tick.value"
76
+ :tick="tick.value"
77
+ :model-value="modelValue"
78
+ :numbered="numbered"
79
+ :as-button="asButtons"
80
+ :is-hidden="!tick.isVisible"
81
+ :disabled="disabled"
82
+ @update:model-value="val => !disabled && $emit('update:modelValue', val)"
83
+ >
84
+ {{ numbered ? tick : '|' }}
85
+ </RangeMeasureTick>
86
+ </div>
87
+ </template>