daisy-ui-kit 5.0.3 → 5.0.5

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 (158) 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/nuxt.js +161 -14
  6. package/package.json +11 -21
  7. package/app/components/Accordion.vue +0 -29
  8. package/app/components/Alert.vue +0 -36
  9. package/app/components/Avatar.vue +0 -131
  10. package/app/components/AvatarGroup.vue +0 -22
  11. package/app/components/Badge.vue +0 -72
  12. package/app/components/Breadcrumbs.vue +0 -7
  13. package/app/components/Button.vue +0 -140
  14. package/app/components/Calendar.vue +0 -175
  15. package/app/components/CalendarInput.vue +0 -275
  16. package/app/components/CalendarSkeleton.vue +0 -87
  17. package/app/components/Card.vue +0 -51
  18. package/app/components/CardActions.vue +0 -13
  19. package/app/components/CardBody.vue +0 -13
  20. package/app/components/CardTitle.vue +0 -11
  21. package/app/components/Carousel.vue +0 -24
  22. package/app/components/CarouselItem.vue +0 -5
  23. package/app/components/Chat.vue +0 -26
  24. package/app/components/ChatBubble.vue +0 -31
  25. package/app/components/ChatFooter.vue +0 -5
  26. package/app/components/ChatHeader.vue +0 -5
  27. package/app/components/ChatImage.vue +0 -5
  28. package/app/components/Checkbox.vue +0 -51
  29. package/app/components/Collapse.vue +0 -76
  30. package/app/components/CollapseContent.vue +0 -5
  31. package/app/components/CollapseTitle.vue +0 -15
  32. package/app/components/Countdown.vue +0 -15
  33. package/app/components/CountdownTimers.vue +0 -69
  34. package/app/components/Counter.vue +0 -21
  35. package/app/components/Crumb.vue +0 -5
  36. package/app/components/DaisyLink.vue +0 -56
  37. package/app/components/Diff.vue +0 -11
  38. package/app/components/Divider.vue +0 -43
  39. package/app/components/Dock.vue +0 -57
  40. package/app/components/DockItem.vue +0 -27
  41. package/app/components/DockLabel.vue +0 -5
  42. package/app/components/Drawer.vue +0 -50
  43. package/app/components/DrawerContent.vue +0 -20
  44. package/app/components/DrawerSide.vue +0 -21
  45. package/app/components/Dropdown.vue +0 -106
  46. package/app/components/DropdownButton.vue +0 -23
  47. package/app/components/DropdownContent.vue +0 -127
  48. package/app/components/DropdownTarget.vue +0 -21
  49. package/app/components/Fab.vue +0 -16
  50. package/app/components/FabClose.vue +0 -18
  51. package/app/components/FabMainAction.vue +0 -5
  52. package/app/components/FabTrigger.vue +0 -117
  53. package/app/components/Fieldset.vue +0 -20
  54. package/app/components/FileInput.vue +0 -53
  55. package/app/components/Filter.vue +0 -129
  56. package/app/components/Flex.vue +0 -89
  57. package/app/components/FlexItem.vue +0 -62
  58. package/app/components/Footer.vue +0 -31
  59. package/app/components/FooterTitle.vue +0 -18
  60. package/app/components/FormControl.vue +0 -5
  61. package/app/components/Hero.vue +0 -18
  62. package/app/components/HeroContent.vue +0 -18
  63. package/app/components/HeroOverlay.vue +0 -5
  64. package/app/components/Hover3D.vue +0 -22
  65. package/app/components/HoverGallery.vue +0 -11
  66. package/app/components/Indicator.vue +0 -20
  67. package/app/components/IndicatorItem.vue +0 -43
  68. package/app/components/Input.vue +0 -116
  69. package/app/components/Join.vue +0 -5
  70. package/app/components/Kbd.vue +0 -25
  71. package/app/components/Label.vue +0 -100
  72. package/app/components/List.vue +0 -5
  73. package/app/components/ListColGrow.vue +0 -5
  74. package/app/components/ListColWrap.vue +0 -5
  75. package/app/components/ListRow.vue +0 -5
  76. package/app/components/LoadingBall.vue +0 -42
  77. package/app/components/LoadingBars.vue +0 -42
  78. package/app/components/LoadingDots.vue +0 -42
  79. package/app/components/LoadingInfinity.vue +0 -42
  80. package/app/components/LoadingRing.vue +0 -42
  81. package/app/components/LoadingSpinner.vue +0 -42
  82. package/app/components/Mask.vue +0 -49
  83. package/app/components/Menu.vue +0 -30
  84. package/app/components/MenuExpand.vue +0 -92
  85. package/app/components/MenuExpandToggle.vue +0 -20
  86. package/app/components/MenuItem.vue +0 -39
  87. package/app/components/MenuTitle.vue +0 -5
  88. package/app/components/MockupBrowser.vue +0 -5
  89. package/app/components/MockupBrowserToolbar.vue +0 -5
  90. package/app/components/MockupCode.vue +0 -4
  91. package/app/components/MockupPhone.vue +0 -14
  92. package/app/components/MockupWindow.vue +0 -5
  93. package/app/components/Modal.vue +0 -63
  94. package/app/components/ModalAction.vue +0 -5
  95. package/app/components/ModalBox.vue +0 -5
  96. package/app/components/NavButton.vue +0 -12
  97. package/app/components/Navbar.vue +0 -12
  98. package/app/components/NavbarCenter.vue +0 -11
  99. package/app/components/NavbarEnd.vue +0 -11
  100. package/app/components/NavbarStart.vue +0 -11
  101. package/app/components/Progress.vue +0 -46
  102. package/app/components/Prose.vue +0 -37
  103. package/app/components/RadialProgress.vue +0 -36
  104. package/app/components/Radio.vue +0 -69
  105. package/app/components/RadioGroup.vue +0 -47
  106. package/app/components/Range.vue +0 -201
  107. package/app/components/RangeMeasure.vue +0 -87
  108. package/app/components/RangeMeasureTick.vue +0 -69
  109. package/app/components/Rating.vue +0 -197
  110. package/app/components/Select.vue +0 -101
  111. package/app/components/Skeleton.vue +0 -5
  112. package/app/components/SkeletonText.vue +0 -11
  113. package/app/components/Stack.vue +0 -30
  114. package/app/components/Stat.vue +0 -19
  115. package/app/components/StatActions.vue +0 -5
  116. package/app/components/StatDesc.vue +0 -5
  117. package/app/components/StatFigure.vue +0 -5
  118. package/app/components/StatTitle.vue +0 -5
  119. package/app/components/StatValue.vue +0 -5
  120. package/app/components/Stats.vue +0 -5
  121. package/app/components/Status.vue +0 -43
  122. package/app/components/Step.vue +0 -34
  123. package/app/components/StepIcon.vue +0 -5
  124. package/app/components/Steps.vue +0 -23
  125. package/app/components/Swap.vue +0 -56
  126. package/app/components/Tab.vue +0 -56
  127. package/app/components/TabContent.vue +0 -29
  128. package/app/components/Table.vue +0 -32
  129. package/app/components/Tabs.vue +0 -53
  130. package/app/components/Text.vue +0 -166
  131. package/app/components/TextArea.vue +0 -106
  132. package/app/components/TextRotate.vue +0 -24
  133. package/app/components/ThemeController.vue +0 -45
  134. package/app/components/ThemeProvider.vue +0 -302
  135. package/app/components/ThemeTile.vue +0 -50
  136. package/app/components/Timeline.vue +0 -22
  137. package/app/components/TimelineEnd.vue +0 -14
  138. package/app/components/TimelineItem.vue +0 -5
  139. package/app/components/TimelineLine.vue +0 -29
  140. package/app/components/TimelineMiddle.vue +0 -5
  141. package/app/components/TimelineStart.vue +0 -14
  142. package/app/components/Toast.vue +0 -67
  143. package/app/components/Toggle.vue +0 -60
  144. package/app/components/Tooltip.vue +0 -137
  145. package/app/components/TooltipContent.vue +0 -283
  146. package/app/components/TooltipTarget.vue +0 -20
  147. package/app/components/ValidatorHint.vue +0 -5
  148. package/app/composables/__tests__/use-calendar.test.ts +0 -239
  149. package/app/composables/use-calendar.ts +0 -288
  150. package/app/composables/use-daisy-theme.ts +0 -140
  151. package/app/composables/use-toast.ts +0 -345
  152. package/app/composables/useSearch.ts +0 -22
  153. package/app/utils/drawer-utils.ts +0 -34
  154. package/app/utils/position-area.ts +0 -40
  155. package/components.d.ts +0 -145
  156. package/components.js +0 -141
  157. package/index.d.ts +0 -157
  158. package/index.js +0 -145
@@ -1,46 +0,0 @@
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,37 +0,0 @@
1
- <template>
2
- <article class="prose daisy-prose">
3
- <slot />
4
- </article>
5
- </template>
6
-
7
- <style lang="postcss">
8
- .prose.full-width {
9
- width: 100%;
10
- max-width: 100%;
11
- }
12
- .prose.daisy-prose code:not(pre code) {
13
- @apply bg-base-300;
14
- }
15
- .prose .link-primary {
16
- @apply text-primary;
17
- }
18
- .prose .link-secondary {
19
- @apply text-secondary;
20
- }
21
- .prose .link-neutral {
22
- @apply text-neutral;
23
- }
24
- .prose .link-accent {
25
- @apply text-accent;
26
- }
27
-
28
- .prose h1 a,
29
- .prose h2 a,
30
- .prose h3 a,
31
- .prose h4 a,
32
- .prose h5 a,
33
- .prose h6 a {
34
- text-decoration: none;
35
- @apply font-bold;
36
- }
37
- </style>
@@ -1,36 +0,0 @@
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>
@@ -1,69 +0,0 @@
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,47 +0,0 @@
1
- <script setup lang="ts">
2
- import { computed, provide, reactive } from 'vue'
3
-
4
- const props = defineProps<{
5
- modelValue?: any
6
- name: string
7
-
8
- color?: string
9
- neutral?: boolean
10
- primary?: boolean
11
- secondary?: boolean
12
- accent?: boolean
13
- success?: boolean
14
- warning?: boolean
15
- info?: boolean
16
- error?: boolean
17
-
18
- size?: string
19
- xs?: boolean
20
- sm?: boolean
21
- md?: boolean
22
- lg?: boolean
23
- xl?: boolean
24
- }>()
25
- const emit = defineEmits(['update:modelValue'])
26
-
27
- const currentValue = computed({
28
- get: () => {
29
- return props.modelValue
30
- },
31
- set: val => {
32
- emit('update:modelValue', val)
33
- },
34
- })
35
-
36
- const state = reactive({
37
- currentValue,
38
- props,
39
- })
40
- provide('radio-group', state)
41
- </script>
42
-
43
- <template>
44
- <div class="radio-group">
45
- <slot />
46
- </div>
47
- </template>
@@ -1,201 +0,0 @@
1
- <script setup lang="ts">
2
- import { computed } from 'vue'
3
-
4
- const props = withDefaults(
5
- defineProps<{
6
- modelValue?: number | [number, number]
7
- min?: number
8
- max?: number
9
- step?: number
10
- disabled?: boolean
11
-
12
- color?: string
13
- neutral?: boolean
14
- primary?: boolean
15
- secondary?: boolean
16
- accent?: boolean
17
- success?: boolean
18
- warning?: boolean
19
- info?: boolean
20
- error?: boolean
21
-
22
- size?: 'xl' | 'lg' | 'md' | 'sm' | 'xs'
23
- xl?: boolean
24
- lg?: boolean
25
- md?: boolean
26
- sm?: boolean
27
- xs?: boolean
28
- }>(),
29
- {
30
- min: 0,
31
- max: 100,
32
- step: 1,
33
- },
34
- )
35
- const emit = defineEmits(['update:modelValue'])
36
-
37
- const isRange = computed(() => {
38
- return Array.isArray(props.modelValue)
39
- })
40
-
41
- const singleValue = computed({
42
- get: () => (isRange.value ? 0 : (props.modelValue as number)),
43
- set: val => emit('update:modelValue', Number(val)),
44
- })
45
-
46
- const lowValue = computed({
47
- get: () => (isRange.value ? (props.modelValue as [number, number])[0] : 0),
48
- set: val => {
49
- const v = Number(val)
50
- const high = (props.modelValue as [number, number])[1]
51
- emit('update:modelValue', [Math.min(v, high), high])
52
- },
53
- })
54
-
55
- const highValue = computed({
56
- get: () => (isRange.value ? (props.modelValue as [number, number])[1] : 100),
57
- set: val => {
58
- const v = Number(val)
59
- const low = (props.modelValue as [number, number])[0]
60
- emit('update:modelValue', [low, Math.max(v, low)])
61
- },
62
- })
63
-
64
- const rangeClasses = computed(() => ({
65
- 'range-neutral': props.neutral || props.color === 'neutral',
66
- 'range-primary': props.primary || props.color === 'primary',
67
- 'range-secondary': props.secondary || props.color === 'secondary',
68
- 'range-accent': props.accent || props.color === 'accent',
69
- 'range-success': props.success || props.color === 'success',
70
- 'range-info': props.info || props.color === 'info',
71
- 'range-warning': props.warning || props.color === 'warning',
72
- 'range-error': props.error || props.color === 'error',
73
- 'range-xl': props.xl || props.size === 'xl',
74
- 'range-lg': props.lg || props.size === 'lg',
75
- 'range-md': props.md || props.size === 'md',
76
- 'range-sm': props.sm || props.size === 'sm',
77
- 'range-xs': props.xs || props.size === 'xs',
78
- }))
79
-
80
- // Calculate percentage positions for the filled track
81
- const lowPercent = computed(() => {
82
- const range = props.max - props.min
83
- return ((lowValue.value - props.min) / range) * 100
84
- })
85
-
86
- const highPercent = computed(() => {
87
- const range = props.max - props.min
88
- return ((highValue.value - props.min) / range) * 100
89
- })
90
- </script>
91
-
92
- <template>
93
- <!-- Single value mode -->
94
- <input
95
- v-if="!isRange"
96
- v-model="singleValue"
97
- type="range"
98
- class="range"
99
- :class="rangeClasses"
100
- :min="min"
101
- :max="max"
102
- :step="step"
103
- :disabled="disabled"
104
- />
105
-
106
- <!-- Dual handle range mode -->
107
- <div v-else class="range range-slider-wrapper" :class="rangeClasses">
108
- <div class="range-slider-track" />
109
- <div
110
- class="range-slider-fill"
111
- :style="{
112
- left: `calc(${lowPercent}% + (var(--range-thumb-size, 1.5rem) / 2) - (${lowPercent} * var(--range-thumb-size, 1.5rem) / 100))`,
113
- width: `calc(${highPercent - lowPercent}% - (${highPercent - lowPercent} * var(--range-thumb-size, 1.5rem) / 100))`,
114
- }"
115
- />
116
- <input
117
- v-model="lowValue"
118
- type="range"
119
- class="range range-slider-input"
120
- :class="rangeClasses"
121
- :min="min"
122
- :max="max"
123
- :step="step"
124
- :disabled="disabled"
125
- />
126
- <input
127
- v-model="highValue"
128
- type="range"
129
- class="range range-slider-input"
130
- :class="rangeClasses"
131
- :min="min"
132
- :max="max"
133
- :step="step"
134
- :disabled="disabled"
135
- />
136
- </div>
137
- </template>
138
-
139
- <style>
140
- .range-slider-wrapper {
141
- position: relative;
142
- width: 100%;
143
- height: var(--range-thumb-size, 1.5rem);
144
- }
145
-
146
- .range-slider-track {
147
- position: absolute;
148
- top: 50%;
149
- left: 0;
150
- right: 0;
151
- height: calc(var(--range-thumb-size, 1.5rem) / 3);
152
- transform: translateY(-50%);
153
- background: color-mix(in oklab, currentColor 10%, transparent);
154
- border-radius: var(--radius-selector, 1rem);
155
- }
156
-
157
- .range-slider-fill {
158
- position: absolute;
159
- top: 50%;
160
- height: var(--range-thumb-size, 1.5rem);
161
- transform: translateY(-50%);
162
- background: currentColor;
163
- border-radius: 0;
164
- z-index: 1;
165
- }
166
-
167
- .range-slider-input {
168
- position: absolute;
169
- top: 0;
170
- left: 0;
171
- width: 100%;
172
- height: 100%;
173
- pointer-events: none;
174
- background: transparent;
175
- --range-fill: 0 !important;
176
- }
177
-
178
- /* Hide both tracks - we draw our own */
179
- .range-slider-input::-webkit-slider-runnable-track {
180
- background: transparent !important;
181
- box-shadow: none !important;
182
- }
183
-
184
- .range-slider-input::-moz-range-track {
185
- background: transparent !important;
186
- box-shadow: none !important;
187
- }
188
-
189
- /* Enable pointer events only on thumbs */
190
- .range-slider-input::-webkit-slider-thumb {
191
- pointer-events: auto;
192
- position: relative;
193
- z-index: 3;
194
- }
195
-
196
- .range-slider-input::-moz-range-thumb {
197
- pointer-events: auto;
198
- position: relative;
199
- z-index: 3;
200
- }
201
- </style>
@@ -1,87 +0,0 @@
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>
@@ -1,69 +0,0 @@
1
- <script setup lang="ts">
2
- import { useTimeoutFn } from '@vueuse/core'
3
- import { computed, ref, watch } from 'vue'
4
-
5
- const props = defineProps<{
6
- tick: number
7
- modelValue?: number | string
8
- numbered?: boolean
9
- asButton?: boolean
10
- isHidden?: boolean
11
- disabled?: boolean
12
- }>()
13
- defineEmits(['update:modelValue'])
14
-
15
- const hasChanged = ref(false)
16
- const { isPending, start, stop } = useTimeoutFn(() => {
17
- hasChanged.value = false
18
- }, 1000)
19
- watch(
20
- () => props.modelValue,
21
- val => {
22
- if (val) {
23
- start()
24
- hasChanged.value = true
25
- } else if (!isPending.value) {
26
- stop()
27
- }
28
- },
29
- )
30
-
31
- // eslint-disable-next-line eqeqeq
32
- const isCurrent = computed(() => props.modelValue == props.tick)
33
- </script>
34
-
35
- <template>
36
- <Button
37
- v-if="asButton && !isHidden"
38
- xs
39
- :ghost="!isCurrent"
40
- circle
41
- :class="{
42
- 'font-bold': isCurrent,
43
- 'opacity-50': props.disabled,
44
- 'cursor-pointer': !props.disabled,
45
- 'cursor-not-allowed': props.disabled,
46
- }"
47
- :disabled="disabled"
48
- @click="$emit('update:modelValue', tick)"
49
- >
50
- {{ numbered ? tick : '|' }}
51
- </Button>
52
- <Tooltip
53
- v-else
54
- :tip="tick"
55
- :open="hasChanged && isCurrent && !disabled"
56
- position="bottom"
57
- :class="{
58
- 'px-[2px]': !asButton,
59
- 'opacity-50': disabled,
60
- 'cursor-pointer': !disabled,
61
- 'cursor-not-allowed': disabled,
62
- }"
63
- @click="$emit('update:modelValue', tick)"
64
- >
65
- <Text v-if="!isHidden" :black="isCurrent">
66
- {{ numbered ? tick : '|' }}
67
- </Text>
68
- </Tooltip>
69
- </template>