daisy-ui-kit 5.0.3 → 5.0.4

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 (157) hide show
  1. package/README.md +1 -1
  2. package/dist/index.css +1 -0
  3. package/dist/index.d.ts +4652 -0
  4. package/dist/index.js +5279 -0
  5. package/package.json +11 -21
  6. package/app/components/Accordion.vue +0 -29
  7. package/app/components/Alert.vue +0 -36
  8. package/app/components/Avatar.vue +0 -131
  9. package/app/components/AvatarGroup.vue +0 -22
  10. package/app/components/Badge.vue +0 -72
  11. package/app/components/Breadcrumbs.vue +0 -7
  12. package/app/components/Button.vue +0 -140
  13. package/app/components/Calendar.vue +0 -175
  14. package/app/components/CalendarInput.vue +0 -275
  15. package/app/components/CalendarSkeleton.vue +0 -87
  16. package/app/components/Card.vue +0 -51
  17. package/app/components/CardActions.vue +0 -13
  18. package/app/components/CardBody.vue +0 -13
  19. package/app/components/CardTitle.vue +0 -11
  20. package/app/components/Carousel.vue +0 -24
  21. package/app/components/CarouselItem.vue +0 -5
  22. package/app/components/Chat.vue +0 -26
  23. package/app/components/ChatBubble.vue +0 -31
  24. package/app/components/ChatFooter.vue +0 -5
  25. package/app/components/ChatHeader.vue +0 -5
  26. package/app/components/ChatImage.vue +0 -5
  27. package/app/components/Checkbox.vue +0 -51
  28. package/app/components/Collapse.vue +0 -76
  29. package/app/components/CollapseContent.vue +0 -5
  30. package/app/components/CollapseTitle.vue +0 -15
  31. package/app/components/Countdown.vue +0 -15
  32. package/app/components/CountdownTimers.vue +0 -69
  33. package/app/components/Counter.vue +0 -21
  34. package/app/components/Crumb.vue +0 -5
  35. package/app/components/DaisyLink.vue +0 -56
  36. package/app/components/Diff.vue +0 -11
  37. package/app/components/Divider.vue +0 -43
  38. package/app/components/Dock.vue +0 -57
  39. package/app/components/DockItem.vue +0 -27
  40. package/app/components/DockLabel.vue +0 -5
  41. package/app/components/Drawer.vue +0 -50
  42. package/app/components/DrawerContent.vue +0 -20
  43. package/app/components/DrawerSide.vue +0 -21
  44. package/app/components/Dropdown.vue +0 -106
  45. package/app/components/DropdownButton.vue +0 -23
  46. package/app/components/DropdownContent.vue +0 -127
  47. package/app/components/DropdownTarget.vue +0 -21
  48. package/app/components/Fab.vue +0 -16
  49. package/app/components/FabClose.vue +0 -18
  50. package/app/components/FabMainAction.vue +0 -5
  51. package/app/components/FabTrigger.vue +0 -117
  52. package/app/components/Fieldset.vue +0 -20
  53. package/app/components/FileInput.vue +0 -53
  54. package/app/components/Filter.vue +0 -129
  55. package/app/components/Flex.vue +0 -89
  56. package/app/components/FlexItem.vue +0 -62
  57. package/app/components/Footer.vue +0 -31
  58. package/app/components/FooterTitle.vue +0 -18
  59. package/app/components/FormControl.vue +0 -5
  60. package/app/components/Hero.vue +0 -18
  61. package/app/components/HeroContent.vue +0 -18
  62. package/app/components/HeroOverlay.vue +0 -5
  63. package/app/components/Hover3D.vue +0 -22
  64. package/app/components/HoverGallery.vue +0 -11
  65. package/app/components/Indicator.vue +0 -20
  66. package/app/components/IndicatorItem.vue +0 -43
  67. package/app/components/Input.vue +0 -116
  68. package/app/components/Join.vue +0 -5
  69. package/app/components/Kbd.vue +0 -25
  70. package/app/components/Label.vue +0 -100
  71. package/app/components/List.vue +0 -5
  72. package/app/components/ListColGrow.vue +0 -5
  73. package/app/components/ListColWrap.vue +0 -5
  74. package/app/components/ListRow.vue +0 -5
  75. package/app/components/LoadingBall.vue +0 -42
  76. package/app/components/LoadingBars.vue +0 -42
  77. package/app/components/LoadingDots.vue +0 -42
  78. package/app/components/LoadingInfinity.vue +0 -42
  79. package/app/components/LoadingRing.vue +0 -42
  80. package/app/components/LoadingSpinner.vue +0 -42
  81. package/app/components/Mask.vue +0 -49
  82. package/app/components/Menu.vue +0 -30
  83. package/app/components/MenuExpand.vue +0 -92
  84. package/app/components/MenuExpandToggle.vue +0 -20
  85. package/app/components/MenuItem.vue +0 -39
  86. package/app/components/MenuTitle.vue +0 -5
  87. package/app/components/MockupBrowser.vue +0 -5
  88. package/app/components/MockupBrowserToolbar.vue +0 -5
  89. package/app/components/MockupCode.vue +0 -4
  90. package/app/components/MockupPhone.vue +0 -14
  91. package/app/components/MockupWindow.vue +0 -5
  92. package/app/components/Modal.vue +0 -63
  93. package/app/components/ModalAction.vue +0 -5
  94. package/app/components/ModalBox.vue +0 -5
  95. package/app/components/NavButton.vue +0 -12
  96. package/app/components/Navbar.vue +0 -12
  97. package/app/components/NavbarCenter.vue +0 -11
  98. package/app/components/NavbarEnd.vue +0 -11
  99. package/app/components/NavbarStart.vue +0 -11
  100. package/app/components/Progress.vue +0 -46
  101. package/app/components/Prose.vue +0 -37
  102. package/app/components/RadialProgress.vue +0 -36
  103. package/app/components/Radio.vue +0 -69
  104. package/app/components/RadioGroup.vue +0 -47
  105. package/app/components/Range.vue +0 -201
  106. package/app/components/RangeMeasure.vue +0 -87
  107. package/app/components/RangeMeasureTick.vue +0 -69
  108. package/app/components/Rating.vue +0 -197
  109. package/app/components/Select.vue +0 -101
  110. package/app/components/Skeleton.vue +0 -5
  111. package/app/components/SkeletonText.vue +0 -11
  112. package/app/components/Stack.vue +0 -30
  113. package/app/components/Stat.vue +0 -19
  114. package/app/components/StatActions.vue +0 -5
  115. package/app/components/StatDesc.vue +0 -5
  116. package/app/components/StatFigure.vue +0 -5
  117. package/app/components/StatTitle.vue +0 -5
  118. package/app/components/StatValue.vue +0 -5
  119. package/app/components/Stats.vue +0 -5
  120. package/app/components/Status.vue +0 -43
  121. package/app/components/Step.vue +0 -34
  122. package/app/components/StepIcon.vue +0 -5
  123. package/app/components/Steps.vue +0 -23
  124. package/app/components/Swap.vue +0 -56
  125. package/app/components/Tab.vue +0 -56
  126. package/app/components/TabContent.vue +0 -29
  127. package/app/components/Table.vue +0 -32
  128. package/app/components/Tabs.vue +0 -53
  129. package/app/components/Text.vue +0 -166
  130. package/app/components/TextArea.vue +0 -106
  131. package/app/components/TextRotate.vue +0 -24
  132. package/app/components/ThemeController.vue +0 -45
  133. package/app/components/ThemeProvider.vue +0 -302
  134. package/app/components/ThemeTile.vue +0 -50
  135. package/app/components/Timeline.vue +0 -22
  136. package/app/components/TimelineEnd.vue +0 -14
  137. package/app/components/TimelineItem.vue +0 -5
  138. package/app/components/TimelineLine.vue +0 -29
  139. package/app/components/TimelineMiddle.vue +0 -5
  140. package/app/components/TimelineStart.vue +0 -14
  141. package/app/components/Toast.vue +0 -67
  142. package/app/components/Toggle.vue +0 -60
  143. package/app/components/Tooltip.vue +0 -137
  144. package/app/components/TooltipContent.vue +0 -283
  145. package/app/components/TooltipTarget.vue +0 -20
  146. package/app/components/ValidatorHint.vue +0 -5
  147. package/app/composables/__tests__/use-calendar.test.ts +0 -239
  148. package/app/composables/use-calendar.ts +0 -288
  149. package/app/composables/use-daisy-theme.ts +0 -140
  150. package/app/composables/use-toast.ts +0 -345
  151. package/app/composables/useSearch.ts +0 -22
  152. package/app/utils/drawer-utils.ts +0 -34
  153. package/app/utils/position-area.ts +0 -40
  154. package/components.d.ts +0 -145
  155. package/components.js +0 -141
  156. package/index.d.ts +0 -157
  157. package/index.js +0 -145
package/package.json CHANGED
@@ -4,43 +4,31 @@
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
7
- "version": "5.0.3",
7
+ "version": "5.0.4",
8
8
  "packageManager": "pnpm@10.10.0",
9
9
  "author": "feathers.dev",
10
10
  "exports": {
11
11
  ".": {
12
- "types": "./index.d.ts",
13
- "import": "./index.js"
12
+ "types": "./dist/index.d.ts",
13
+ "import": "./dist/index.js"
14
14
  },
15
15
  "./nuxt": {
16
16
  "types": "./nuxt.d.ts",
17
17
  "import": "./nuxt.js"
18
- },
19
- "./components": {
20
- "types": "./components.d.ts",
21
- "import": "./components.js"
22
- },
23
- "./components/*": "./app/components/*",
24
- "./composables/*": "./app/composables/*",
25
- "./utils/*": "./app/utils/*"
18
+ }
26
19
  },
27
- "main": "./index.js",
28
- "module": "./index.js",
29
- "types": "./index.d.ts",
20
+ "main": "./dist/index.js",
21
+ "module": "./dist/index.js",
22
+ "types": "./dist/index.d.ts",
30
23
  "files": [
31
- "app/components/*.vue",
32
- "app/composables/*",
33
- "app/utils/*",
34
- "index.js",
35
- "index.d.ts",
24
+ "dist",
36
25
  "nuxt.js",
37
26
  "nuxt.d.ts",
38
- "components.js",
39
- "components.d.ts",
40
27
  "README.md"
41
28
  ],
42
29
  "scripts": {
43
30
  "import-d1-dumps": "./import-d1-dumps.sh",
31
+ "build:lib": "vite build --config vite.lib.config.ts",
44
32
  "prebuild": "cp CHANGELOG.md content/docs/changelog.md",
45
33
  "build": "NODE_OPTIONS='--max-old-space-size=7168' nuxt build",
46
34
  "predev": "cp CHANGELOG.md content/docs/changelog.md",
@@ -95,6 +83,8 @@
95
83
  "eslint-plugin-vue": "^10.5.1",
96
84
  "happy-dom": "^20.0.11",
97
85
  "tailwindcss": "^4.1.5",
86
+ "vite": "^7.3.1",
87
+ "vite-plugin-dts": "^4.5.4",
98
88
  "vitest": "^4.0.16"
99
89
  }
100
90
  }
@@ -1,29 +0,0 @@
1
- <script setup lang="ts">
2
- import { provide, ref, watch } from 'vue'
3
-
4
- const props = defineProps<{
5
- modelValue?: string | number
6
- }>()
7
- const emit = defineEmits(['update:modelValue'])
8
-
9
- const value = ref(props.modelValue)
10
- watch(
11
- () => props.modelValue,
12
- val => {
13
- value.value = val
14
- },
15
- )
16
- watch(value, val => {
17
- if (props.modelValue !== val) {
18
- emit('update:modelValue', val)
19
- }
20
- })
21
-
22
- provide('accordion-value', value)
23
- </script>
24
-
25
- <template>
26
- <div class="daisy-ui-kit-accordion">
27
- <slot />
28
- </div>
29
- </template>
@@ -1,36 +0,0 @@
1
- <script setup lang="ts">
2
- const props = defineProps<{
3
- outline?: boolean
4
- dash?: boolean
5
- soft?: boolean
6
- type?: 'info' | 'success' | 'warning' | 'error'
7
- info?: boolean
8
- success?: boolean
9
- warning?: boolean
10
- error?: boolean
11
- orientation?: 'vertical' | 'horizontal'
12
- vertical?: boolean
13
- horizontal?: boolean
14
- }>()
15
- </script>
16
-
17
- <template>
18
- <div
19
- class="alert"
20
- :class="{
21
- 'alert-outline': props.outline,
22
- 'alert-dash': props.dash,
23
- 'alert-soft': props.soft,
24
-
25
- 'alert-info': props.info || props.type === 'info',
26
- 'alert-success': props.success || props.type === 'success',
27
- 'alert-warning': props.warning || props.type === 'warning',
28
- 'alert-error': props.error || props.type === 'error',
29
-
30
- 'alert-vertical': props.vertical || props.orientation === 'vertical',
31
- 'alert-horizontal': props.horizontal || props.orientation === 'horizontal',
32
- }"
33
- >
34
- <slot />
35
- </div>
36
- </template>
@@ -1,131 +0,0 @@
1
- <script setup lang="ts">
2
- import { computed } from 'vue'
3
- import Mask from './Mask.vue'
4
-
5
- const props = defineProps({
6
- backgroundColor: { type: String, default: '#BBB' },
7
- maskClasses: String,
8
- showStatus: Boolean,
9
- // Presence props
10
- presence: String,
11
- online: Boolean,
12
- offline: Boolean,
13
- // Mask shape props (self-contained, no Mask.config.ts dependency)
14
- shape: String,
15
- squircle: Boolean,
16
- heart: Boolean,
17
- hexagon: Boolean,
18
- hexagon2: Boolean,
19
- decagon: Boolean,
20
- pentagon: Boolean,
21
- diamond: Boolean,
22
- square: Boolean,
23
- circle: Boolean,
24
- star: Boolean,
25
- star2: Boolean,
26
- triangle: Boolean,
27
- triangle2: Boolean,
28
- triangle3: Boolean,
29
- triangle4: Boolean,
30
- half1: Boolean,
31
- half2: Boolean,
32
- })
33
-
34
- const maskShapeKeys = [
35
- 'mask-squircle',
36
- 'mask-heart',
37
- 'mask-hexagon',
38
- 'mask-hexagon-2',
39
- 'mask-decagon',
40
- 'mask-pentagon',
41
- 'mask-diamond',
42
- 'mask-square',
43
- 'mask-circle',
44
- 'mask-star',
45
- 'mask-star-2',
46
- 'mask-triangle',
47
- 'mask-triangle-2',
48
- 'mask-triangle-3',
49
- 'mask-triangle-4',
50
- 'mask-half-1',
51
- 'mask-half-2',
52
- ] as const
53
-
54
- type AvatarClassKey = (typeof maskShapeKeys)[number] | 'rounded-box' | 'avatar-online' | 'avatar-offline'
55
-
56
- const avatarClasses = computed<Record<AvatarClassKey, boolean>>(() => {
57
- const mask: Record<AvatarClassKey, boolean> = {
58
- 'mask-squircle': props.squircle || props.shape === 'squircle',
59
- 'mask-heart': props.heart || props.shape === 'heart',
60
- 'mask-hexagon': props.hexagon || props.shape === 'hexagon',
61
- 'mask-hexagon-2': props.hexagon2 || props.shape === 'hexagon-2',
62
- 'mask-decagon': props.decagon || props.shape === 'decagon',
63
- 'mask-pentagon': props.pentagon || props.shape === 'pentagon',
64
- 'mask-diamond': props.diamond || props.shape === 'diamond',
65
- 'mask-square': props.square || props.shape === 'square',
66
- 'mask-circle': props.circle || props.shape === 'circle',
67
- 'mask-star': props.star || props.shape === 'star',
68
- 'mask-star-2': props.star2 || props.shape === 'star-2',
69
- 'mask-triangle': props.triangle || props.shape === 'triangle',
70
- 'mask-triangle-2': props.triangle2 || props.shape === 'triangle-2',
71
- 'mask-triangle-3': props.triangle3 || props.shape === 'triangle-3',
72
- 'mask-triangle-4': props.triangle4 || props.shape === 'triangle-4',
73
- 'mask-half-1': props.half1 || props.shape === 'half-1',
74
- 'mask-half-2': props.half2 || props.shape === 'half-2',
75
- 'rounded-box': false,
76
- 'avatar-online': props.presence === 'online' || props.online,
77
- 'avatar-offline': props.presence === 'offline' || props.offline,
78
- }
79
- const hasMask = maskShapeKeys.some(k => mask[k])
80
- mask['rounded-box'] = !hasMask
81
- return mask
82
- })
83
-
84
- const color = computed(() => {
85
- return `#${contrastingColor(props.backgroundColor.replace('#', ''))}`
86
- })
87
-
88
- function contrastingColor(color: any) {
89
- return luma(color) >= 155 ? '000' : 'fff'
90
- }
91
- // color can be a hx string or an array of RGB values 0-255
92
- function luma(color: any) {
93
- const rgb = typeof color === 'string' ? hexToRGBArray(color) : color
94
- return 0.2126 * rgb[0] + 0.7152 * rgb[1] + 0.0722 * rgb[2] // SMPTE C, Rec. 709 weightings
95
- }
96
- function hexToRGBArray(color: any) {
97
- if (color.length === 3) {
98
- color = color.charAt(0) + color.charAt(0) + color.charAt(1) + color.charAt(1) + color.charAt(2) + color.charAt(2)
99
- } else if (color.length !== 6) {
100
- throw new Error(`Invalid hex color: ${color}`)
101
- }
102
- const rgb = []
103
- for (let i = 0; i <= 2; i++) {
104
- rgb[i] = Number.parseInt(color.substr(i * 2, 2), 16)
105
- }
106
- return rgb
107
- }
108
- </script>
109
-
110
- <template>
111
- <div class="avatar">
112
- <Mask
113
- :style="{ backgroundColor, color }"
114
- class="w-full h-full avatar-mask aspect-square"
115
- :class="[avatarClasses, maskClasses]"
116
- >
117
- <slot />
118
- </Mask>
119
- </div>
120
- </template>
121
-
122
- <style lang="postcss">
123
- .avatar-mask > * {
124
- aspect-ratio: 1/1;
125
- width: 100%;
126
- height: 100%;
127
- display: flex;
128
- align-items: center;
129
- justify-content: center;
130
- }
131
- </style>
@@ -1,22 +0,0 @@
1
- <script setup lang="ts">
2
- const props = defineProps<{
3
- orientation: string
4
- horizontal: boolean
5
- vertical: boolean
6
- }>()
7
- </script>
8
-
9
- <template>
10
- <div
11
- class="avatar-group"
12
- :class="{
13
- 'flex-row':
14
- props.orientation === 'horizontal' ||
15
- props.horizontal ||
16
- (!props.orientation && !props.vertical && !props.horizontal),
17
- 'flex-col': props.orientation === 'vertical' || props.vertical,
18
- }"
19
- >
20
- <slot />
21
- </div>
22
- </template>
@@ -1,72 +0,0 @@
1
- <script setup lang="ts">
2
- import { computed, resolveComponent } from 'vue'
3
-
4
- defineOptions({
5
- inheritAttrs: false,
6
- })
7
-
8
- const { is = 'div', ...props } = defineProps<{
9
- is?: string
10
- outline?: boolean
11
- soft?: boolean
12
- dash?: boolean
13
- ghost?: boolean
14
-
15
- size?: string
16
- xl?: boolean
17
- lg?: boolean
18
- md?: boolean
19
- sm?: boolean
20
- xs?: boolean
21
-
22
- color?: string
23
- neutral?: boolean
24
- primary?: boolean
25
- secondary?: boolean
26
- accent?: boolean
27
- info?: boolean
28
- success?: boolean
29
- warning?: boolean
30
- error?: boolean
31
- }>()
32
-
33
- const NuxtLink = resolveComponent('NuxtLink')
34
- const RouterLink = resolveComponent('RouterLink')
35
-
36
- const resolvedComponent = computed(() => {
37
- if (is === 'NuxtLink') return NuxtLink
38
- if (is === 'RouterLink') return RouterLink
39
- return is
40
- })
41
- </script>
42
-
43
- <template>
44
- <component
45
- :is="resolvedComponent"
46
- v-bind="$attrs"
47
- class="badge"
48
- :class="{
49
- 'badge-outline': props.outline,
50
- 'badge-ghost': props.ghost,
51
- 'badge-soft': props.soft,
52
- 'badge-dash': props.dash,
53
-
54
- 'badge-xl': props.xl || props.size === 'xl',
55
- 'badge-lg': props.lg || props.size === 'lg',
56
- 'badge-md': props.md || props.size === 'md',
57
- 'badge-sm': props.sm || props.size === 'sm',
58
- 'badge-xs': props.xs || props.size === 'xs',
59
-
60
- 'badge-neutral': props.neutral || props.color === 'neutral',
61
- 'badge-primary': props.primary || props.color === 'primary',
62
- 'badge-secondary': props.secondary || props.color === 'secondary',
63
- 'badge-accent': props.accent || props.color === 'accent',
64
- 'badge-info': props.info || props.color === 'info',
65
- 'badge-success': props.success || props.color === 'success',
66
- 'badge-warning': props.warning || props.color === 'warning',
67
- 'badge-error': props.error || props.color === 'error',
68
- }"
69
- >
70
- <slot />
71
- </component>
72
- </template>
@@ -1,7 +0,0 @@
1
- <template>
2
- <div class="breadcrumbs">
3
- <ul>
4
- <slot />
5
- </ul>
6
- </div>
7
- </template>
@@ -1,140 +0,0 @@
1
- <script setup lang="ts">
2
- import { computed, resolveComponent } from 'vue'
3
-
4
- defineOptions({
5
- inheritAttrs: false,
6
- })
7
-
8
- const props = withDefaults(
9
- defineProps<{
10
- is?: string
11
- join?: boolean
12
-
13
- color?: string
14
- neutral?: boolean
15
- primary?: boolean
16
- secondary?: boolean
17
- accent?: boolean
18
- info?: boolean
19
- success?: boolean
20
- warning?: boolean
21
- error?: boolean
22
-
23
- ghost?: boolean
24
- link?: boolean
25
- glass?: boolean
26
- outline?: boolean
27
- dash?: boolean
28
- soft?: boolean
29
- disabled?: boolean
30
-
31
- shape?: 'circle' | 'square' | 'wide' | 'block'
32
- circle?: boolean
33
- square?: boolean
34
- wide?: boolean
35
- block?: boolean
36
-
37
- noAnimation?: boolean
38
- active?: boolean
39
-
40
- size?: 'lg' | 'md' | 'sm' | 'xs' | 'xl'
41
- xl?: boolean
42
- lg?: boolean
43
- md?: boolean
44
- sm?: boolean
45
- xs?: boolean
46
-
47
- type?: 'button' | 'submit' | 'reset'
48
- }>(),
49
- {
50
- type: 'button',
51
- },
52
- )
53
- const NuxtLink = resolveComponent('NuxtLink')
54
- const RouterLink = resolveComponent('RouterLink')
55
-
56
- // Accessibility: Determine if rendering a native button
57
- const isButton = computed(() => (props.is || 'button') === 'button')
58
-
59
- // Resolve the component to render
60
- const resolvedComponent = computed(() => {
61
- if (!props.is || props.is === 'button' || props.is === 'a') {
62
- return props.is || 'button'
63
- }
64
- if (props.is === 'NuxtLink') return NuxtLink
65
- if (props.is === 'RouterLink') return RouterLink
66
- return props.is
67
- })
68
-
69
- // Accessibility: Keyboard event handler for custom elements
70
- function onKeydown(e: KeyboardEvent) {
71
- if (props.disabled) {
72
- return
73
- }
74
- if (e.code === 'Space' || e.code === 'Enter' || e.key === ' ' || e.key === 'Enter') {
75
- e.preventDefault()
76
- // @ts-expect-error: $el may not exist yet
77
- e.currentTarget?.click?.()
78
- }
79
- }
80
- </script>
81
-
82
- <template>
83
- <component
84
- :is="resolvedComponent"
85
- v-bind="$attrs"
86
- :type="isButton ? type : undefined"
87
- :disabled="isButton && disabled ? true : undefined"
88
- :aria-disabled="!isButton && disabled ? true : undefined"
89
- :tabindex="!isButton ? (disabled ? -1 : 0) : undefined"
90
- :role="!isButton ? 'button' : undefined"
91
- class="btn"
92
- :class="{
93
- 'join-item': join,
94
-
95
- 'btn-neutral': !disabled && (neutral || color === 'neutral'),
96
- 'btn-primary': !disabled && (primary || color === 'primary'),
97
- 'btn-secondary': !disabled && (secondary || color === 'secondary'),
98
- 'btn-accent': !disabled && (accent || color === 'accent'),
99
- 'btn-info': !disabled && (info || color === 'info'),
100
- 'btn-success': !disabled && (success || color === 'success'),
101
- 'btn-warning': !disabled && (warning || color === 'warning'),
102
- 'btn-error': !disabled && (error || color === 'error'),
103
-
104
- 'text-primary': !disabled && (primary || color === 'primary') && link,
105
- 'text-secondary': !disabled && (secondary || color === 'secondary') && link,
106
- 'text-neutral': !disabled && (neutral || color === 'neutral') && link,
107
- 'text-accent': !disabled && (accent || color === 'accent') && link,
108
- 'text-info': !disabled && (info || color === 'info') && link,
109
- 'text-success': !disabled && (success || color === 'success') && link,
110
- 'text-warning': !disabled && (warning || color === 'warning') && link,
111
- 'text-error': !disabled && (error || color === 'error') && link,
112
-
113
- glass: !disabled && glass,
114
-
115
- 'btn-circle': circle || shape === 'circle',
116
- 'btn-square': square || shape === 'square',
117
- 'btn-wide': wide || shape === 'wide',
118
- 'btn-block': block || shape === 'block',
119
-
120
- 'btn-xl': xl || size === 'xl',
121
- 'btn-lg': lg || size === 'lg',
122
- 'btn-md': md || size === 'md',
123
- 'btn-sm': sm || size === 'sm',
124
- 'btn-xs': xs || size === 'xs',
125
-
126
- 'btn-outline': !disabled && outline,
127
- 'btn-dash': !disabled && dash,
128
- 'btn-ghost': !disabled && ghost,
129
- 'btn-soft': !disabled && soft,
130
- 'btn-link': !disabled && link,
131
- 'btn-disabled': disabled,
132
-
133
- 'no-animation': noAnimation,
134
- 'btn-active': !disabled && active,
135
- }"
136
- @keydown="!isButton ? onKeydown : undefined"
137
- >
138
- <slot />
139
- </component>
140
- </template>
@@ -1,175 +0,0 @@
1
- <script setup lang="ts">
2
- import type { CalendarOptions } from '../composables/use-calendar'
3
- import { computed, watch } from 'vue'
4
- import { useCalendar } from '../composables/use-calendar'
5
-
6
- const props = defineProps<{
7
- /** Bound value: Date object or ISO string or null */
8
- modelValue?: Date | string | null
9
- /** Calendar options */
10
- options?: CalendarOptions
11
- /** If true, default to today when no value provided */
12
- autoDefault?: boolean
13
- }>()
14
-
15
- const emit = defineEmits<{
16
- (e: 'update:modelValue', v: Date | null): void
17
- }>()
18
-
19
- // Parse initial date from modelValue
20
- function parseDate(value: Date | string | null | undefined): Date | null {
21
- if (!value) return null
22
- if (value instanceof Date) return value
23
- const d = new Date(value)
24
- return Number.isNaN(d.getTime()) ? null : d
25
- }
26
-
27
- const initialDate = computed(() => {
28
- const parsed = parseDate(props.modelValue)
29
- if (parsed) return parsed
30
- if (props.autoDefault) return new Date()
31
- return null
32
- })
33
-
34
- const {
35
- selectedDate,
36
- viewMonth,
37
- viewYear,
38
- monthName,
39
- weekdayHeaders,
40
- weekdayHeadersFull,
41
- calendarDays,
42
- prevMonth,
43
- nextMonth,
44
- selectDate,
45
- goToDate,
46
- } = useCalendar(initialDate.value, props.options)
47
-
48
- // Sync selectedDate back to modelValue
49
- watch(selectedDate, date => {
50
- emit('update:modelValue', date)
51
- })
52
-
53
- // Watch for external modelValue changes
54
- watch(
55
- () => props.modelValue,
56
- newValue => {
57
- const parsed = parseDate(newValue)
58
- if (parsed && (!selectedDate.value || parsed.getTime() !== selectedDate.value.getTime())) {
59
- selectDate(parsed)
60
- goToDate(parsed)
61
- }
62
- },
63
- )
64
-
65
- function handleDayClick(day: (typeof calendarDays.value)[0]) {
66
- if (day.isDisabled) return
67
- selectDate(day.date)
68
- }
69
- </script>
70
-
71
- <template>
72
- <div class="pika-single">
73
- <div class="pika-lendar">
74
- <!-- Header with navigation -->
75
- <div class="pika-title">
76
- <div class="pika-label">
77
- {{ monthName }}
78
- <select
79
- class="pika-select pika-select-month"
80
- :value="viewMonth"
81
- @change="
82
- e => {
83
- const target = e.target as HTMLSelectElement
84
- const newMonth = parseInt(target.value, 10)
85
- const d = new Date(viewYear, newMonth, 1)
86
- goToDate(d)
87
- }
88
- "
89
- >
90
- <option
91
- v-for="(m, i) in [
92
- 'January',
93
- 'February',
94
- 'March',
95
- 'April',
96
- 'May',
97
- 'June',
98
- 'July',
99
- 'August',
100
- 'September',
101
- 'October',
102
- 'November',
103
- 'December',
104
- ]"
105
- :key="i"
106
- :value="i"
107
- >
108
- {{ m }}
109
- </option>
110
- </select>
111
- </div>
112
- <div class="pika-label">
113
- {{ viewYear }}
114
- <select
115
- class="pika-select pika-select-year"
116
- :value="viewYear"
117
- @change="
118
- e => {
119
- const target = e.target as HTMLSelectElement
120
- const newYear = parseInt(target.value, 10)
121
- const d = new Date(newYear, viewMonth, 1)
122
- goToDate(d)
123
- }
124
- "
125
- >
126
- <option v-for="y in Array.from({ length: 21 }, (_, i) => viewYear - 10 + i)" :key="y" :value="y">
127
- {{ y }}
128
- </option>
129
- </select>
130
- </div>
131
- <button type="button" class="pika-prev" @click="prevMonth">Previous Month</button>
132
- <button type="button" class="pika-next" @click="nextMonth">Next Month</button>
133
- </div>
134
-
135
- <!-- Calendar grid -->
136
- <table class="pika-table" role="grid">
137
- <thead>
138
- <tr>
139
- <th v-for="(day, i) in weekdayHeaders" :key="i" scope="col">
140
- <abbr :title="weekdayHeadersFull[i]">{{ day }}</abbr>
141
- </th>
142
- </tr>
143
- </thead>
144
- <tbody>
145
- <tr v-for="week in 6" :key="week" class="pika-row">
146
- <td
147
- v-for="dayIndex in 7"
148
- :key="dayIndex"
149
- :class="{
150
- 'is-today': calendarDays[(week - 1) * 7 + dayIndex - 1]?.isToday,
151
- 'is-selected': calendarDays[(week - 1) * 7 + dayIndex - 1]?.isSelected,
152
- 'is-disabled': calendarDays[(week - 1) * 7 + dayIndex - 1]?.isDisabled,
153
- 'is-outside-current-month': calendarDays[(week - 1) * 7 + dayIndex - 1]?.isOutsideMonth,
154
- }"
155
- :aria-selected="calendarDays[(week - 1) * 7 + dayIndex - 1]?.isSelected"
156
- :data-day="calendarDays[(week - 1) * 7 + dayIndex - 1]?.day"
157
- >
158
- <button
159
- type="button"
160
- class="pika-button pika-day"
161
- :disabled="calendarDays[(week - 1) * 7 + dayIndex - 1]?.isDisabled"
162
- :data-pika-year="calendarDays[(week - 1) * 7 + dayIndex - 1]?.year"
163
- :data-pika-month="calendarDays[(week - 1) * 7 + dayIndex - 1]?.month"
164
- :data-pika-day="calendarDays[(week - 1) * 7 + dayIndex - 1]?.day"
165
- @click="handleDayClick(calendarDays[(week - 1) * 7 + dayIndex - 1]!)"
166
- >
167
- {{ calendarDays[(week - 1) * 7 + dayIndex - 1]?.day }}
168
- </button>
169
- </td>
170
- </tr>
171
- </tbody>
172
- </table>
173
- </div>
174
- </div>
175
- </template>