daisy-ui-kit 5.0.0-pre.9 → 5.0.0

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 (93) hide show
  1. package/app/components/Accordion.vue +8 -5
  2. package/app/components/Alert.vue +2 -1
  3. package/app/components/Avatar.vue +10 -7
  4. package/app/components/AvatarGroup.vue +6 -2
  5. package/app/components/Badge.vue +19 -1
  6. package/app/components/Button.vue +66 -46
  7. package/app/components/Calendar.vue +151 -42
  8. package/app/components/CalendarInput.vue +229 -130
  9. package/app/components/CalendarSkeleton.vue +51 -10
  10. package/app/components/Card.vue +20 -2
  11. package/app/components/CardActions.vue +1 -1
  12. package/app/components/CardBody.vue +1 -1
  13. package/app/components/CardTitle.vue +1 -1
  14. package/app/components/Carousel.vue +2 -1
  15. package/app/components/Chat.vue +6 -1
  16. package/app/components/Checkbox.vue +1 -1
  17. package/app/components/Collapse.vue +38 -5
  18. package/app/components/CollapseTitle.vue +11 -1
  19. package/app/components/Countdown.vue +3 -3
  20. package/app/components/CountdownTimers.vue +4 -7
  21. package/app/components/Counter.vue +14 -3
  22. package/app/components/DaisyLink.vue +33 -15
  23. package/app/components/Dock.vue +5 -6
  24. package/app/components/DockItem.vue +5 -3
  25. package/app/components/Drawer.vue +15 -12
  26. package/app/components/DrawerContent.vue +9 -6
  27. package/app/components/DrawerSide.vue +9 -6
  28. package/app/components/Dropdown.vue +61 -50
  29. package/app/components/DropdownButton.vue +11 -4
  30. package/app/components/DropdownContent.vue +90 -20
  31. package/app/components/DropdownTarget.vue +10 -3
  32. package/app/components/Fab.vue +16 -0
  33. package/app/components/FabClose.vue +18 -0
  34. package/app/components/FabMainAction.vue +5 -0
  35. package/app/components/FabTrigger.vue +117 -0
  36. package/app/components/Fieldset.vue +5 -4
  37. package/app/components/FileInput.vue +1 -1
  38. package/app/components/Filter.vue +45 -38
  39. package/app/components/Flex.vue +8 -1
  40. package/app/components/FlexItem.vue +30 -27
  41. package/app/components/Footer.vue +16 -12
  42. package/app/components/FooterTitle.vue +8 -5
  43. package/app/components/Hero.vue +9 -6
  44. package/app/components/HeroContent.vue +9 -6
  45. package/app/components/Hover3D.vue +22 -0
  46. package/app/components/HoverGallery.vue +11 -0
  47. package/app/components/Indicator.vue +12 -5
  48. package/app/components/IndicatorItem.vue +21 -14
  49. package/app/components/Input.vue +44 -47
  50. package/app/components/Kbd.vue +2 -1
  51. package/app/components/Label.vue +32 -29
  52. package/app/components/MenuExpand.vue +5 -13
  53. package/app/components/MenuExpandToggle.vue +7 -1
  54. package/app/components/MenuItem.vue +6 -4
  55. package/app/components/Modal.vue +23 -17
  56. package/app/components/Progress.vue +13 -1
  57. package/app/components/Prose.vue +7 -2
  58. package/app/components/RadialProgress.vue +8 -8
  59. package/app/components/Radio.vue +1 -1
  60. package/app/components/RadioGroup.vue +2 -2
  61. package/app/components/Range.vue +186 -46
  62. package/app/components/RangeMeasure.vue +33 -30
  63. package/app/components/RangeMeasureTick.vue +4 -5
  64. package/app/components/Rating.vue +70 -53
  65. package/app/components/Select.vue +44 -47
  66. package/app/components/SkeletonText.vue +11 -0
  67. package/app/components/Stack.vue +5 -0
  68. package/app/components/Steps.vue +7 -2
  69. package/app/components/Swap.vue +4 -10
  70. package/app/components/Tab.vue +23 -5
  71. package/app/components/Text.vue +47 -23
  72. package/app/components/TextArea.vue +75 -30
  73. package/app/components/TextRotate.vue +24 -0
  74. package/app/components/ThemeController.vue +3 -4
  75. package/app/components/ThemeProvider.vue +47 -32
  76. package/app/components/TimelineLine.vue +1 -1
  77. package/app/components/TimelineStart.vue +2 -1
  78. package/app/components/Toast.vue +3 -8
  79. package/app/components/Toggle.vue +2 -2
  80. package/app/components/Tooltip.vue +111 -21
  81. package/app/components/TooltipContent.vue +279 -1
  82. package/app/components/TooltipTarget.vue +20 -0
  83. package/app/composables/__tests__/use-calendar.test.ts +239 -0
  84. package/app/composables/use-calendar.ts +288 -0
  85. package/app/composables/use-daisy-theme.ts +140 -0
  86. package/app/composables/use-toast.ts +345 -0
  87. package/app/composables/useSearch.ts +22 -0
  88. package/app/utils/drawer-utils.ts +15 -13
  89. package/app/utils/position-area.ts +40 -0
  90. package/nuxt.d.ts +13 -0
  91. package/nuxt.js +12 -9
  92. package/package.json +40 -29
  93. package/app/utils/random-string.ts +0 -19
@@ -1,36 +1,49 @@
1
1
  <script setup lang="ts">
2
- import { syncRef } from '@vueuse/core'
3
- import { computed, inject, ref } from 'vue'
2
+ import { computed, inject } from 'vue'
4
3
 
5
4
  // Map input type to value type
6
5
  type InputType =
7
- | 'text' | 'password' | 'email' | 'number' | 'date' | 'datetime-local' | 'week' | 'month' | 'tel' | 'url' | 'search' | 'time'
6
+ | 'text'
7
+ | 'password'
8
+ | 'email'
9
+ | 'number'
10
+ | 'date'
11
+ | 'datetime-local'
12
+ | 'week'
13
+ | 'month'
14
+ | 'tel'
15
+ | 'url'
16
+ | 'search'
17
+ | 'time'
8
18
 
9
- const props = withDefaults(defineProps<{
10
- modelValue?: string | number | null
11
- type?: InputType
12
- placeholder?: string
13
- disabled?: boolean
14
- validator?: boolean
15
- join?: boolean
16
- color?: string
17
- primary?: boolean
18
- secondary?: boolean
19
- accent?: boolean
20
- info?: boolean
21
- success?: boolean
22
- warning?: boolean
23
- error?: boolean
24
- ghost?: boolean
25
- size?: 'xl' | 'lg' | 'md' | 'sm' | 'xs'
26
- xl?: boolean
27
- lg?: boolean
28
- md?: boolean
29
- sm?: boolean
30
- xs?: boolean
31
- }>(), {
32
- type: 'text',
33
- })
19
+ const props = withDefaults(
20
+ defineProps<{
21
+ modelValue?: string | number | null
22
+ type?: InputType
23
+ placeholder?: string
24
+ disabled?: boolean
25
+ validator?: boolean
26
+ join?: boolean
27
+ color?: string
28
+ primary?: boolean
29
+ secondary?: boolean
30
+ accent?: boolean
31
+ info?: boolean
32
+ success?: boolean
33
+ warning?: boolean
34
+ error?: boolean
35
+ ghost?: boolean
36
+ size?: 'xl' | 'lg' | 'md' | 'sm' | 'xs'
37
+ xl?: boolean
38
+ lg?: boolean
39
+ md?: boolean
40
+ sm?: boolean
41
+ xs?: boolean
42
+ }>(),
43
+ {
44
+ type: 'text',
45
+ },
46
+ )
34
47
  const emit = defineEmits(['update:modelValue'])
35
48
 
36
49
  // For slot context
@@ -38,28 +51,17 @@ function setValue(val: string | number | null) {
38
51
  emit('update:modelValue', val)
39
52
  }
40
53
 
41
- const labelCtx = inject('labelCtx')
54
+ const labelCtx = inject('labelCtx', null)
42
55
 
43
56
  function handleInput(event: Event) {
44
57
  let val: string | number | null
45
58
  if (props.type === 'number') {
46
59
  const inputVal = (event.target as HTMLInputElement).value
47
60
  val = inputVal === '' ? null : Number(inputVal)
48
- }
49
- else {
61
+ } else {
50
62
  val = (event.target as HTMLInputElement).value
51
63
  }
52
64
  emit('update:modelValue', val)
53
-
54
- // Sync checked only on input if it's a checkbox
55
- if (
56
- props.type === 'checkbox'
57
- && labelCtx
58
- && Object.prototype.hasOwnProperty.call(labelCtx, 'checked')
59
- && typeof labelCtx.checked.value === 'boolean'
60
- ) {
61
- labelCtx.checked.value = Boolean(event.target.checked)
62
- }
63
65
  }
64
66
 
65
67
  const inputAttrs = computed(() => {
@@ -110,10 +112,5 @@ const inputModel = computed({
110
112
  :input-model="inputModel"
111
113
  />
112
114
  </div>
113
- <input
114
- v-else
115
- v-bind="inputAttrs"
116
- :value="inputModel"
117
- @input="handleInput"
118
- >
115
+ <input v-else v-bind="inputAttrs" :value="inputModel" @input="handleInput" />
119
116
  </template>
@@ -11,7 +11,8 @@ defineProps<{
11
11
 
12
12
  <template>
13
13
  <kbd
14
- class="kbd" :class="{
14
+ class="kbd"
15
+ :class="{
15
16
  'kbd-xl': xl || size === 'xl',
16
17
  'kbd-lg': lg || size === 'lg',
17
18
  'kbd-md': md || size === 'md',
@@ -2,34 +2,37 @@
2
2
  import { provide, ref } from 'vue'
3
3
  import Text from './Text.vue'
4
4
 
5
- withDefaults(defineProps<{
6
- is?: string
7
- floating?: boolean
5
+ withDefaults(
6
+ defineProps<{
7
+ is?: string
8
+ floating?: boolean
8
9
 
9
- input?: boolean
10
- select?: boolean
11
- toggle?: boolean
10
+ input?: boolean
11
+ select?: boolean
12
+ toggle?: boolean
12
13
 
13
- join?: boolean
14
- color?: string
15
- neutral?: boolean
16
- primary?: boolean
17
- secondary?: boolean
18
- accent?: boolean
19
- info?: boolean
20
- success?: boolean
21
- warning?: boolean
22
- error?: boolean
23
- ghost?: boolean
24
- size?: 'xl' | 'lg' | 'md' | 'sm' | 'xs'
25
- xl?: boolean
26
- lg?: boolean
27
- md?: boolean
28
- sm?: boolean
29
- xs?: boolean
30
- }>(), {
31
- is: 'label',
32
- })
14
+ join?: boolean
15
+ color?: string
16
+ neutral?: boolean
17
+ primary?: boolean
18
+ secondary?: boolean
19
+ accent?: boolean
20
+ info?: boolean
21
+ success?: boolean
22
+ warning?: boolean
23
+ error?: boolean
24
+ ghost?: boolean
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
+ is: 'label',
34
+ },
35
+ )
33
36
 
34
37
  // Provide label context for child inputs
35
38
  const checked = ref(false)
@@ -41,9 +44,9 @@ provide('labelCtx', { checked })
41
44
  :is="is"
42
45
  :class="[
43
46
  {
44
- 'input': input,
45
- 'select': select,
46
- 'toggle': toggle,
47
+ input,
48
+ select,
49
+ toggle,
47
50
  'join-item': (input || select || toggle) && join,
48
51
  'input-neutral': input && (neutral || color === 'neutral'),
49
52
  'input-primary': input && (primary || color === 'primary'),
@@ -2,8 +2,7 @@
2
2
  import type { Ref } from 'vue'
3
3
 
4
4
  import { onClickOutside, useElementHover } from '@vueuse/core'
5
- import { onMounted, provide, ref } from 'vue'
6
- import { randomString } from '../utils/random-string'
5
+ import { onMounted, provide, ref, useId } from 'vue'
7
6
 
8
7
  // Define the MenuExpandState interface
9
8
  export interface MenuExpandState {
@@ -16,12 +15,10 @@ export interface MenuExpandState {
16
15
 
17
16
  // Props with defaults
18
17
  const {
19
- randomId = randomString(12),
20
18
  hover = false,
21
19
  delayLeave = 300,
22
20
  closeOnClickOutside = false,
23
21
  } = defineProps<{
24
- randomId?: string
25
22
  hover?: boolean
26
23
  delayLeave?: number
27
24
  closeOnClickOutside?: boolean
@@ -31,8 +28,9 @@ const {
31
28
  const isOpen = defineModel('open', { default: false, type: Boolean })
32
29
 
33
30
  // Generate IDs for accessibility and targeting
34
- const wrapperId = `expand-wrapper-${randomId}`
35
- const id = `expand-${randomId}`
31
+ const uniqueId = useId()
32
+ const wrapperId = `expand-wrapper-${uniqueId}`
33
+ const id = `expand-${uniqueId}`
36
34
 
37
35
  // Element reference for click outside detection
38
36
  const expandEl = ref()
@@ -88,13 +86,7 @@ function handleClick(_ev: MouseEvent) {}
88
86
  </script>
89
87
 
90
88
  <template>
91
- <details
92
- :id="wrapperId"
93
- ref="expandEl"
94
- class="dropdown menu-expand"
95
- :open="isOpen"
96
- @click="handleClick"
97
- >
89
+ <details :id="wrapperId" ref="expandEl" class="dropdown menu-expand" :open="isOpen" @click="handleClick">
98
90
  <slot v-bind="{ toggle, open, close }" />
99
91
  </details>
100
92
  </template>
@@ -8,7 +8,13 @@ const { id, isOpen, toggle } = menuExpandState || {}
8
8
  </script>
9
9
 
10
10
  <template>
11
- <summary :id="id" :aria-expanded="isOpen" aria-haspopup="menu" class="menu-expand-toggle" @click.prevent.stop="toggle">
11
+ <summary
12
+ :id="id"
13
+ :aria-expanded="isOpen"
14
+ aria-haspopup="menu"
15
+ class="menu-expand-toggle"
16
+ @click.prevent.stop="toggle"
17
+ >
12
18
  <slot />
13
19
  </summary>
14
20
  </template>
@@ -15,12 +15,14 @@ defineProps<{
15
15
  Allow adding .active class to the MenuItem element.
16
16
  DaisyUI only supports adding it to the `a` element.
17
17
  */
18
- .menu-item.menu-active > a, .menu-item.menu-active > span {
18
+ .menu-item.menu-active > a,
19
+ .menu-item.menu-active > span {
19
20
  background-color: hsl(var(--n) / var(--tw-bg-opacity));
20
21
  color: hsl(var(--nc) / var(--tw-text-opacity));
21
22
  }
22
- .menu-item.menu-disabled > a, .menu-item.menu-disabled > span {
23
- background-color: var(--n)
23
+ .menu-item.menu-disabled > a,
24
+ .menu-item.menu-disabled > span {
25
+ background-color: var(--n);
24
26
  }
25
27
 
26
28
  /* Fix padding when putting a Dropdown inside of a menu */
@@ -32,6 +34,6 @@ defineProps<{
32
34
  padding-left: 1rem;
33
35
  padding-right: 1rem;
34
36
  padding-top: 0.5rem;
35
- padding-bottom: 0.5rem
37
+ padding-bottom: 0.5rem;
36
38
  }
37
39
  </style>
@@ -1,29 +1,35 @@
1
1
  <script setup lang="ts">
2
- import { computed, ref, watch } from 'vue';
2
+ import { computed, ref, watch } from 'vue'
3
3
 
4
- const props = withDefaults(defineProps<{
5
- modelValue?: boolean
6
- closeOnClickOutside?: boolean
7
- placement?: 'top' | 'bottom' | 'start' | 'end'
8
- top?: boolean
9
- bottom?: boolean
10
- start?: boolean
11
- end?: boolean
12
- }>(), {
13
- closeOnClickOutside: true,
14
- })
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
+ )
15
18
  const emit = defineEmits(['update:modelValue'])
16
19
 
17
20
  const is = 'div'
18
21
 
19
22
  // defineModel 'open'
20
23
  const _isOpen = ref(props.modelValue)
21
- watch(() => props.modelValue, (val) => {
22
- _isOpen.value = val
23
- })
24
+ watch(
25
+ () => props.modelValue,
26
+ val => {
27
+ _isOpen.value = val
28
+ },
29
+ )
24
30
  const isOpen = computed({
25
31
  get: () => _isOpen.value,
26
- set: (val) => {
32
+ set: val => {
27
33
  _isOpen.value = val
28
34
  if (props.modelValue !== val) {
29
35
  emit('update:modelValue', val)
@@ -39,7 +45,7 @@ function handleClick() {
39
45
  </script>
40
46
 
41
47
  <template>
42
- <input v-model="isOpen" type="checkbox" class="modal-toggle">
48
+ <input v-model="isOpen" type="checkbox" class="modal-toggle" />
43
49
  <Component
44
50
  :is="is"
45
51
  v-bind="{ ...$attrs, ...$props }"
@@ -1,5 +1,17 @@
1
1
  <script setup lang="ts">
2
- const { value = 0, max = 100, color, neutral, primary, secondary, accent, success, info, warning, error } = defineProps<{
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<{
3
15
  value?: string | number
4
16
  max?: string | number
5
17
 
@@ -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>
@@ -20,14 +20,14 @@ defineProps<{
20
20
  <div
21
21
  class="radial-progress"
22
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'),
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
31
  }"
32
32
  :style="`--value:${value}; --size:${size || '4rem'}; --thickness:${thickness || 'calc(var(--size) / 10)'};`"
33
33
  >
@@ -65,5 +65,5 @@ const currentValue = computed({
65
65
  }"
66
66
  :disabled="props.disabled"
67
67
  :value="props.value"
68
- >
68
+ />
69
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
@@ -28,7 +28,7 @@ const currentValue = computed({
28
28
  get: () => {
29
29
  return props.modelValue
30
30
  },
31
- set: (val) => {
31
+ set: val => {
32
32
  emit('update:modelValue', val)
33
33
  },
34
34
  })