windly-ui 1.0.1 → 1.0.3

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 (123) hide show
  1. package/dist/module.d.mts +3 -0
  2. package/dist/module.json +8 -0
  3. package/dist/module.mjs +26 -0
  4. package/dist/runtime/components/Accordion.d.vue.ts +39 -0
  5. package/{ui-library → dist/runtime}/components/Accordion.vue +44 -70
  6. package/dist/runtime/components/Accordion.vue.d.ts +39 -0
  7. package/dist/runtime/components/Avatar.d.vue.ts +141 -0
  8. package/dist/runtime/components/Avatar.vue +72 -0
  9. package/dist/runtime/components/Avatar.vue.d.ts +141 -0
  10. package/dist/runtime/components/Badge.d.vue.ts +133 -0
  11. package/dist/runtime/components/Badge.vue +99 -0
  12. package/dist/runtime/components/Badge.vue.d.ts +133 -0
  13. package/dist/runtime/components/Breadcrumbs.d.vue.ts +83 -0
  14. package/{ui-library → dist/runtime}/components/Breadcrumbs.vue +37 -59
  15. package/dist/runtime/components/Breadcrumbs.vue.d.ts +83 -0
  16. package/dist/runtime/components/Button.d.vue.ts +199 -0
  17. package/dist/runtime/components/Button.vue +125 -0
  18. package/dist/runtime/components/Button.vue.d.ts +199 -0
  19. package/dist/runtime/components/Card.d.vue.ts +83 -0
  20. package/{ui-library → dist/runtime}/components/Card.vue +26 -39
  21. package/dist/runtime/components/Card.vue.d.ts +83 -0
  22. package/dist/runtime/components/Checkbox.d.vue.ts +190 -0
  23. package/{ui-library → dist/runtime}/components/Checkbox.vue +45 -68
  24. package/dist/runtime/components/Checkbox.vue.d.ts +190 -0
  25. package/dist/runtime/components/CodeBlock.d.vue.ts +16 -0
  26. package/dist/runtime/components/CodeBlock.vue +75 -0
  27. package/dist/runtime/components/CodeBlock.vue.d.ts +16 -0
  28. package/dist/runtime/components/ColorPicker.d.vue.ts +91 -0
  29. package/dist/runtime/components/ColorPicker.vue +244 -0
  30. package/dist/runtime/components/ColorPicker.vue.d.ts +91 -0
  31. package/dist/runtime/components/Date.d.vue.ts +137 -0
  32. package/dist/runtime/components/Date.vue +201 -0
  33. package/dist/runtime/components/Date.vue.d.ts +137 -0
  34. package/dist/runtime/components/Dialog.d.vue.ts +103 -0
  35. package/{ui-library → dist/runtime}/components/Dialog.vue +30 -65
  36. package/dist/runtime/components/Dialog.vue.d.ts +103 -0
  37. package/dist/runtime/components/Divider.d.vue.ts +51 -0
  38. package/dist/runtime/components/Divider.vue +52 -0
  39. package/dist/runtime/components/Divider.vue.d.ts +51 -0
  40. package/dist/runtime/components/Drawer.d.vue.ts +30 -0
  41. package/dist/runtime/components/Drawer.vue +43 -0
  42. package/dist/runtime/components/Drawer.vue.d.ts +30 -0
  43. package/dist/runtime/components/Dropdown.d.vue.ts +34 -0
  44. package/dist/runtime/components/Dropdown.vue +127 -0
  45. package/dist/runtime/components/Dropdown.vue.d.ts +34 -0
  46. package/dist/runtime/components/FileUploader.d.vue.ts +58 -0
  47. package/dist/runtime/components/FileUploader.vue +202 -0
  48. package/dist/runtime/components/FileUploader.vue.d.ts +58 -0
  49. package/dist/runtime/components/Icon.d.vue.ts +41 -0
  50. package/dist/runtime/components/Icon.vue +66 -0
  51. package/dist/runtime/components/Icon.vue.d.ts +41 -0
  52. package/dist/runtime/components/Image.d.vue.ts +77 -0
  53. package/dist/runtime/components/Image.vue +61 -0
  54. package/dist/runtime/components/Image.vue.d.ts +77 -0
  55. package/dist/runtime/components/Input.d.vue.ts +66 -0
  56. package/dist/runtime/components/Input.vue +233 -0
  57. package/dist/runtime/components/Input.vue.d.ts +66 -0
  58. package/dist/runtime/components/Radio.d.vue.ts +41 -0
  59. package/dist/runtime/components/Radio.vue +222 -0
  60. package/dist/runtime/components/Radio.vue.d.ts +41 -0
  61. package/dist/runtime/components/ScrollArea.d.vue.ts +79 -0
  62. package/dist/runtime/components/ScrollArea.vue +36 -0
  63. package/dist/runtime/components/ScrollArea.vue.d.ts +79 -0
  64. package/dist/runtime/components/Select.d.vue.ts +43 -0
  65. package/dist/runtime/components/Select.vue +200 -0
  66. package/dist/runtime/components/Select.vue.d.ts +43 -0
  67. package/dist/runtime/components/Stepper.d.vue.ts +46 -0
  68. package/dist/runtime/components/Stepper.vue +218 -0
  69. package/dist/runtime/components/Stepper.vue.d.ts +46 -0
  70. package/dist/runtime/components/TabPanel.d.vue.ts +17 -0
  71. package/dist/runtime/components/TabPanel.vue +21 -0
  72. package/dist/runtime/components/TabPanel.vue.d.ts +17 -0
  73. package/dist/runtime/components/Table.d.vue.ts +40 -0
  74. package/dist/runtime/components/Table.vue +92 -0
  75. package/dist/runtime/components/Table.vue.d.ts +40 -0
  76. package/dist/runtime/components/Tabs.d.vue.ts +20 -0
  77. package/dist/runtime/components/Tabs.vue +62 -0
  78. package/dist/runtime/components/Tabs.vue.d.ts +20 -0
  79. package/dist/runtime/components/Textarea.d.vue.ts +208 -0
  80. package/dist/runtime/components/Textarea.vue +185 -0
  81. package/dist/runtime/components/Textarea.vue.d.ts +208 -0
  82. package/dist/runtime/components/Toggle.d.vue.ts +36 -0
  83. package/dist/runtime/components/Toggle.vue +173 -0
  84. package/dist/runtime/components/Toggle.vue.d.ts +36 -0
  85. package/dist/runtime/components/Tooltip.d.vue.ts +63 -0
  86. package/dist/runtime/components/Tooltip.vue +144 -0
  87. package/dist/runtime/components/Tooltip.vue.d.ts +63 -0
  88. package/dist/runtime/components/uiProps.d.ts +38 -0
  89. package/{ui-library/components/uiProps.ts → dist/runtime/components/uiProps.js} +2 -2
  90. package/dist/runtime/components/useUiClasses.d.ts +43 -0
  91. package/{ui-library/components/useUiClasses.ts → dist/runtime/components/useUiClasses.js} +25 -60
  92. package/dist/runtime/composables/plugin.d.ts +2 -0
  93. package/dist/runtime/composables/plugin.js +3 -0
  94. package/dist/runtime/tailwind-color.d.ts +2 -0
  95. package/dist/runtime/tailwind-color.js +5859 -0
  96. package/dist/types.d.mts +7 -0
  97. package/package.json +14 -16
  98. package/README.md +0 -208
  99. package/ui-library/components/Avatar.vue +0 -121
  100. package/ui-library/components/Badge.vue +0 -116
  101. package/ui-library/components/Button.vue +0 -154
  102. package/ui-library/components/CodeBlock.vue +0 -99
  103. package/ui-library/components/ColorPicker.vue +0 -302
  104. package/ui-library/components/Date.vue +0 -240
  105. package/ui-library/components/Divider.vue +0 -78
  106. package/ui-library/components/Drawer.vue +0 -67
  107. package/ui-library/components/Dropdown.vue +0 -248
  108. package/ui-library/components/FileUploader.vue +0 -330
  109. package/ui-library/components/Icon.vue +0 -82
  110. package/ui-library/components/Image.vue +0 -78
  111. package/ui-library/components/Input.vue +0 -531
  112. package/ui-library/components/Radio.vue +0 -356
  113. package/ui-library/components/ScrollArea.vue +0 -43
  114. package/ui-library/components/Select.vue +0 -309
  115. package/ui-library/components/Stepper.vue +0 -361
  116. package/ui-library/components/TabPanel.vue +0 -25
  117. package/ui-library/components/Table.vue +0 -152
  118. package/ui-library/components/Tabs.vue +0 -71
  119. package/ui-library/components/Textarea.vue +0 -233
  120. package/ui-library/components/Toggle.vue +0 -319
  121. package/ui-library/components/Tooltip.vue +0 -200
  122. package/ui-library/components/plugin.ts +0 -8
  123. package/ui-library/module.ts +0 -20
@@ -1,233 +0,0 @@
1
- <script setup lang="ts">
2
- defineOptions({
3
- inheritAttrs: false,
4
- })
5
-
6
- import { computed, ref, watch, nextTick } from 'vue'
7
- import { useUiClasses } from './useUiClasses'
8
- import { uiProps } from './uiProps'
9
-
10
- const props = defineProps({
11
- modelValue: {
12
- type: String,
13
- default: '',
14
- },
15
-
16
- label: {
17
- type: String,
18
- default: '',
19
- },
20
-
21
- placeholder: {
22
- type: String,
23
- default: '',
24
- },
25
-
26
- rows: {
27
- type: Number,
28
- default: 3,
29
- },
30
-
31
- maxRows: {
32
- type: Number,
33
- default: 10,
34
- },
35
-
36
- autoGrow: {
37
- type: Boolean,
38
- default: false,
39
- },
40
-
41
- readonly: {
42
- type: Boolean,
43
- default: false,
44
- },
45
-
46
- error: {
47
- type: Boolean,
48
- default: false,
49
- },
50
-
51
- errorMessage: {
52
- type: String,
53
- default: '',
54
- },
55
-
56
- hint: {
57
- type: String,
58
- default: '',
59
- },
60
-
61
- showWordCount: {
62
- type: Boolean,
63
- default: false,
64
- },
65
-
66
- showCharCount: {
67
- type: Boolean,
68
- default: false,
69
- },
70
-
71
- maxlength: {
72
- type: Number,
73
- default: undefined,
74
- },
75
-
76
- ...uiProps,
77
- })
78
-
79
- const emit = defineEmits([
80
- 'update:modelValue',
81
- ])
82
-
83
- const textareaRef = ref<HTMLTextAreaElement>()
84
-
85
- const {
86
- contentClass,
87
- contentStyle,
88
-
89
- color,
90
- textColor,
91
-
92
- rounded,
93
- size,
94
-
95
- disable,
96
-
97
- roundedClass,
98
- sizeClass,
99
-
100
- computedContentClass,
101
-
102
- isHex,
103
- } = useUiClasses(props)
104
-
105
- const paddingClass = {
106
- sm: 'px-3 py-2',
107
- md: 'px-4 py-3',
108
- lg: 'px-5 py-4',
109
- }
110
-
111
- const textareaStyle = computed(() => {
112
- const style: Record<string, any> = {
113
- ...(typeof contentStyle.value === 'object' && contentStyle.value !== null ? contentStyle.value : {}),
114
- }
115
-
116
- if (isHex(color.value)) {
117
- style.borderColor = color.value
118
- }
119
-
120
- if (isHex(textColor.value)) {
121
- style.color = textColor.value
122
- }
123
-
124
- return style
125
- })
126
-
127
- const textareaClass = computed(() => {
128
- // cast keys to the exact key types for the maps so TS can validate indexing
129
- const rKey = rounded.value as keyof typeof roundedClass
130
- const sKey = size.value as keyof typeof sizeClass
131
- const pKey = size.value as keyof typeof paddingClass
132
-
133
- const rClass = roundedClass[rKey] ?? ''
134
- const sClass = sizeClass[sKey] ?? ''
135
- const pClass = paddingClass[pKey] ?? ''
136
-
137
- let cls = `
138
- w-full
139
- border
140
- transition-all
141
- duration-300
142
- focus:outline-none
143
- focus:ring-2
144
- ${rClass}
145
- ${sClass}
146
- ${pClass}
147
- `
148
-
149
- if (disable.value) {
150
- cls += ' opacity-50 cursor-not-allowed'
151
- }
152
-
153
- if (props.error) {
154
- cls += ' border-red-500'
155
- } else if (!isHex(color.value)) {
156
- cls += ` border-${color.value}`
157
- }
158
-
159
- if (textColor.value && !isHex(textColor.value)) {
160
- cls += ` text-${textColor.value}`
161
- }
162
-
163
- cls += ` ${computedContentClass.value}`
164
- cls += ` ${contentClass.value || ''}`
165
-
166
- return cls
167
- })
168
-
169
- const wordCount = computed(() => {
170
- return props.modelValue
171
- .trim()
172
- .split(/\s+/)
173
- .filter(Boolean)
174
- .length
175
- })
176
-
177
- const charCount = computed(() => {
178
- return props.modelValue.length
179
- })
180
-
181
- function updateValue(event: Event) {
182
- emit(
183
- 'update:modelValue',
184
- (event.target as HTMLTextAreaElement).value
185
- )
186
- }
187
-
188
- function resizeTextarea() {
189
- if (!props.autoGrow) return
190
- if (!textareaRef.value) return
191
-
192
- textareaRef.value.style.height = 'auto'
193
- textareaRef.value.style.height =
194
- textareaRef.value.scrollHeight + 'px'
195
- }
196
-
197
- watch(
198
- () => props.modelValue,
199
- async () => {
200
- await nextTick()
201
- resizeTextarea()
202
- },
203
- { immediate: true }
204
- )
205
- </script>
206
- <template>
207
- <div class="flex flex-col gap-1">
208
- <label v-if="label" class="font-medium">
209
- {{ label }}
210
- </label>
211
-
212
- <textarea ref="textareaRef" :value="modelValue" :rows="rows" :placeholder="placeholder" :disabled="disable"
213
- :readonly="readonly" :maxlength="maxlength" :class="textareaClass" :style="textareaStyle"
214
- @input="updateValue" v-bind="$attrs" />
215
- <div class="flex justify-between text-xs text-gray-500">
216
- <span>
217
- {{ error ? errorMessage : hint }}
218
- </span>
219
- <span class="flex gap-3">
220
- <span v-if="showWordCount">
221
- {{ wordCount }} words
222
- </span>
223
-
224
- <span v-if="showCharCount">
225
- {{ charCount }}
226
- <template v-if="maxlength">
227
- / {{ maxlength }}
228
- </template>
229
- </span>
230
- </span>
231
- </div>
232
- </div>
233
- </template>
@@ -1,319 +0,0 @@
1
- <script setup lang="ts">
2
- import { computed } from 'vue'
3
-
4
- defineOptions({
5
- name: 'UIToggle',
6
- })
7
-
8
- type LabelPosition =
9
- | 'top'
10
- | 'bottom'
11
- | 'left'
12
- | 'right'
13
-
14
- type ToggleSize =
15
- | 'small'
16
- | 'medium'
17
- | 'large'
18
-
19
- const props = withDefaults(
20
- defineProps<{
21
- modelValue?: boolean | string | number
22
-
23
- label?: string
24
-
25
- labelPosition?: LabelPosition
26
-
27
- customClasses?: string
28
-
29
- trueColor?: string
30
-
31
- falseColor?: string
32
-
33
- size?: ToggleSize
34
-
35
- activeValue?: string | number | boolean
36
-
37
- inactiveValue?: string | number | boolean
38
-
39
- activeIcon?: string
40
-
41
- inactiveIcon?: string
42
-
43
- disable?: boolean
44
- }>(),
45
- {
46
- modelValue: false,
47
-
48
- label: '',
49
-
50
- labelPosition: 'right',
51
-
52
- customClasses: '',
53
-
54
- trueColor: 'blue-500',
55
-
56
- falseColor: 'gray-300',
57
-
58
- size: 'medium',
59
-
60
- activeValue: true,
61
-
62
- inactiveValue: false,
63
-
64
- activeIcon: '',
65
-
66
- inactiveIcon: '',
67
-
68
- disable: false,
69
- },
70
- )
71
-
72
- const emit = defineEmits<{
73
- (
74
- e: 'update:modelValue',
75
- value:
76
- | boolean
77
- | string
78
- | number,
79
- ): void
80
- }>()
81
-
82
- const isHex = (val: string) => {
83
- return (
84
- val.startsWith('#') ||
85
- val.startsWith('rgb') ||
86
- val.startsWith('hsl')
87
- )
88
- }
89
-
90
- const isActive = computed(
91
- () =>
92
- props.modelValue ===
93
- props.activeValue,
94
- )
95
-
96
- const toggleSize = computed(() => {
97
- switch (props.size) {
98
- case 'small':
99
- return {
100
- bg: 'w-10 h-5',
101
-
102
- dot: 'w-4 h-4 top-0.5 left-0.5',
103
-
104
- translate:
105
- 'translate-x-5',
106
- }
107
-
108
- case 'large':
109
- return {
110
- bg: 'w-16 h-9',
111
-
112
- dot: 'w-7 h-7 top-1 left-1',
113
-
114
- translate:
115
- 'translate-x-7',
116
- }
117
-
118
- case 'medium':
119
- default:
120
- return {
121
- bg: 'w-14 h-8',
122
-
123
- dot: 'w-6 h-6 top-1 left-1',
124
-
125
- translate:
126
- 'translate-x-6',
127
- }
128
- }
129
- })
130
-
131
- const toggleBgClasses = computed(
132
- () => [
133
- !isHex(props.trueColor) &&
134
- isActive.value
135
- ? `bg-${props.trueColor}`
136
- : '',
137
-
138
- !isHex(props.falseColor) &&
139
- !isActive.value
140
- ? `bg-${props.falseColor}`
141
- : '',
142
- ],
143
- )
144
-
145
- const toggleBgStyle = computed(
146
- () => {
147
- const style: Record<
148
- string,
149
- string
150
- > = {}
151
-
152
- if (
153
- isActive.value &&
154
- isHex(props.trueColor)
155
- ) {
156
- style.backgroundColor =
157
- props.trueColor
158
- }
159
-
160
- if (
161
- !isActive.value &&
162
- isHex(props.falseColor)
163
- ) {
164
- style.backgroundColor =
165
- props.falseColor
166
- }
167
-
168
- return style
169
- },
170
- )
171
-
172
- const toggle = () => {
173
- if (props.disable)
174
- return
175
-
176
- const newValue =
177
- isActive.value
178
- ? props.inactiveValue
179
- : props.activeValue
180
-
181
- emit(
182
- 'update:modelValue',
183
- newValue,
184
- )
185
- }
186
- </script>
187
-
188
- <template>
189
- <div
190
- :class="[
191
- 'toggle-container flex items-center',
192
- customClasses,
193
- ]"
194
- :style="{
195
- flexDirection:
196
- labelPosition ===
197
- 'top' ||
198
- labelPosition ===
199
- 'bottom'
200
- ? 'column'
201
- : 'row',
202
- }"
203
- >
204
- <!-- Top Label -->
205
- <span
206
- v-if="
207
- label &&
208
- labelPosition ===
209
- 'top'
210
- "
211
- class="mb-2 font-medium text-gray-700 dark:text-gray-300"
212
- >
213
- {{ label }}
214
- </span>
215
-
216
- <!-- Left Label -->
217
- <span
218
- v-if="
219
- label &&
220
- labelPosition ===
221
- 'left'
222
- "
223
- class="mr-3 font-medium text-gray-700 dark:text-gray-300"
224
- >
225
- {{ label }}
226
- </span>
227
-
228
- <!-- Toggle -->
229
- <div
230
- :class="[
231
- 'relative inline-flex items-center cursor-pointer',
232
- {
233
- 'opacity-50 pointer-events-none':
234
- disable,
235
- },
236
- ]"
237
- @click="toggle"
238
- >
239
- <!-- Background -->
240
- <span
241
- :class="[
242
- 'block rounded-full transition-colors duration-300 ease-in-out',
243
- toggleSize.bg,
244
- toggleBgClasses,
245
- ]"
246
- :style="toggleBgStyle"
247
- />
248
-
249
- <!-- Dot -->
250
- <span
251
- :class="[
252
- 'toggle-dot absolute rounded-full bg-white transition-transform duration-300 ease-in-out shadow-md hover:glow-effect flex items-center justify-center',
253
-
254
- toggleSize.dot,
255
-
256
- {
257
- [toggleSize.translate]:
258
- isActive,
259
- },
260
- ]"
261
- >
262
- <span
263
- class="material-icons text-sm"
264
- >
265
- {{
266
- isActive
267
- ? activeIcon
268
- : inactiveIcon
269
- }}
270
- </span>
271
- </span>
272
- </div>
273
-
274
- <!-- Bottom Label -->
275
- <span
276
- v-if="
277
- label &&
278
- labelPosition ===
279
- 'bottom'
280
- "
281
- class="mt-2 font-medium text-gray-700 dark:text-gray-300"
282
- >
283
- {{ label }}
284
- </span>
285
-
286
- <!-- Right Label -->
287
- <span
288
- v-if="
289
- label &&
290
- labelPosition ===
291
- 'right'
292
- "
293
- class="ml-3 font-medium text-gray-700 dark:text-gray-300"
294
- >
295
- {{ label }}
296
- </span>
297
- </div>
298
- </template>
299
-
300
- <style scoped>
301
- .toggle-container {
302
- user-select: none;
303
- }
304
-
305
- .glow-effect {
306
- transition:
307
- box-shadow 0.3s ease-in-out;
308
- box-shadow:
309
- 0 0 10px
310
- rgba(0, 0, 0, 0.15),
311
- 0 0 10px
312
- rgba(0, 0, 255, 0.3);
313
- }
314
-
315
- .material-icons {
316
- font-size: 1rem;
317
- color: currentColor;
318
- }
319
- </style>