windly-ui 1.0.8 → 1.1.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 (64) hide show
  1. package/dist/module.json +1 -1
  2. package/dist/runtime/components/Alert.d.vue.ts +18 -0
  3. package/dist/runtime/components/Alert.vue +21 -3
  4. package/dist/runtime/components/Alert.vue.d.ts +18 -0
  5. package/dist/runtime/components/Avatar.d.vue.ts +5 -5
  6. package/dist/runtime/components/Avatar.vue.d.ts +5 -5
  7. package/dist/runtime/components/Badge.d.vue.ts +5 -5
  8. package/dist/runtime/components/Badge.vue.d.ts +5 -5
  9. package/dist/runtime/components/Breadcrumbs.vue +2 -2
  10. package/dist/runtime/components/Button.d.vue.ts +5 -5
  11. package/dist/runtime/components/Button.vue +5 -5
  12. package/dist/runtime/components/Button.vue.d.ts +5 -5
  13. package/dist/runtime/components/Card.d.vue.ts +27 -0
  14. package/dist/runtime/components/Card.vue +12 -8
  15. package/dist/runtime/components/Card.vue.d.ts +27 -0
  16. package/dist/runtime/components/Checkbox.d.vue.ts +14 -5
  17. package/dist/runtime/components/Checkbox.vue +11 -4
  18. package/dist/runtime/components/Checkbox.vue.d.ts +14 -5
  19. package/dist/runtime/components/Chip.d.vue.ts +5 -5
  20. package/dist/runtime/components/Chip.vue +1 -1
  21. package/dist/runtime/components/Chip.vue.d.ts +5 -5
  22. package/dist/runtime/components/CodeBlock.vue +50 -8
  23. package/dist/runtime/components/Date.d.vue.ts +22 -4
  24. package/dist/runtime/components/Date.vue +39 -15
  25. package/dist/runtime/components/Date.vue.d.ts +22 -4
  26. package/dist/runtime/components/Dialog.d.vue.ts +7 -9
  27. package/dist/runtime/components/Dialog.vue +23 -4
  28. package/dist/runtime/components/Dialog.vue.d.ts +7 -9
  29. package/dist/runtime/components/Divider.vue +1 -1
  30. package/dist/runtime/components/Dropdown.d.vue.ts +2 -2
  31. package/dist/runtime/components/Dropdown.vue +71 -23
  32. package/dist/runtime/components/Dropdown.vue.d.ts +2 -2
  33. package/dist/runtime/components/FileUploader.d.vue.ts +1 -1
  34. package/dist/runtime/components/FileUploader.vue +11 -9
  35. package/dist/runtime/components/FileUploader.vue.d.ts +1 -1
  36. package/dist/runtime/components/Image.d.vue.ts +11 -1
  37. package/dist/runtime/components/Image.vue +15 -0
  38. package/dist/runtime/components/Image.vue.d.ts +11 -1
  39. package/dist/runtime/components/Input.d.vue.ts +5 -1
  40. package/dist/runtime/components/Input.vue +53 -14
  41. package/dist/runtime/components/Input.vue.d.ts +5 -1
  42. package/dist/runtime/components/Radio.d.vue.ts +2 -2
  43. package/dist/runtime/components/Radio.vue +9 -7
  44. package/dist/runtime/components/Radio.vue.d.ts +2 -2
  45. package/dist/runtime/components/ScrollArea.vue +4 -0
  46. package/dist/runtime/components/Select.d.vue.ts +1 -1
  47. package/dist/runtime/components/Select.vue +11 -9
  48. package/dist/runtime/components/Select.vue.d.ts +1 -1
  49. package/dist/runtime/components/Tabs.d.vue.ts +8 -1
  50. package/dist/runtime/components/Tabs.vue +21 -6
  51. package/dist/runtime/components/Tabs.vue.d.ts +8 -1
  52. package/dist/runtime/components/Textarea.d.vue.ts +39 -185
  53. package/dist/runtime/components/Textarea.vue +94 -71
  54. package/dist/runtime/components/Textarea.vue.d.ts +39 -185
  55. package/dist/runtime/components/Toggle.d.vue.ts +9 -3
  56. package/dist/runtime/components/Toggle.vue +70 -122
  57. package/dist/runtime/components/Toggle.vue.d.ts +9 -3
  58. package/dist/runtime/components/Tooltip.vue +3 -0
  59. package/dist/runtime/components/uiProps.d.ts +2 -2
  60. package/dist/runtime/components/uiProps.js +2 -2
  61. package/dist/runtime/components/useUiClasses.d.ts +3 -1
  62. package/dist/runtime/components/useUiClasses.js +7 -5
  63. package/dist/runtime/docs/index.vue +163 -72
  64. package/package.json +1 -1
@@ -6,165 +6,113 @@ defineOptions({
6
6
  const props = defineProps({
7
7
  modelValue: { type: [Boolean, String, Number], required: false, default: false },
8
8
  label: { type: String, required: false, default: "" },
9
+ hint: { type: String, required: false, default: "" },
9
10
  labelPosition: { type: String, required: false, default: "right" },
10
11
  customClasses: { type: String, required: false, default: "" },
11
12
  trueColor: { type: String, required: false, default: "blue-500" },
12
13
  falseColor: { type: String, required: false, default: "gray-300" },
13
- size: { type: String, required: false, default: "medium" },
14
+ size: { type: String, required: false, default: "md" },
14
15
  activeValue: { type: [String, Number, Boolean], required: false, default: true },
15
16
  inactiveValue: { type: [String, Number, Boolean], required: false, default: false },
16
17
  activeIcon: { type: String, required: false, default: "" },
17
18
  inactiveIcon: { type: String, required: false, default: "" },
18
- disable: { type: Boolean, required: false, default: false }
19
+ disabled: { type: Boolean, required: false, default: false },
20
+ error: { type: Boolean, required: false, default: false },
21
+ errorMessage: { type: String, required: false, default: "" }
19
22
  });
20
23
  const emit = defineEmits(["update:modelValue"]);
21
- const isHex = (val) => {
22
- return val.startsWith("#") || val.startsWith("rgb") || val.startsWith("hsl");
23
- };
24
- const isActive = computed(
25
- () => props.modelValue === props.activeValue
26
- );
24
+ const isHex = (val) => val.startsWith("#") || val.startsWith("rgb") || val.startsWith("hsl");
25
+ const isActive = computed(() => props.modelValue === props.activeValue);
27
26
  const toggleSize = computed(() => {
28
27
  switch (props.size) {
29
- case "small":
30
- return {
31
- bg: "w-10 h-5",
32
- dot: "w-4 h-4 top-0.5 left-0.5",
33
- translate: "translate-x-5"
34
- };
35
- case "large":
36
- return {
37
- bg: "w-16 h-9",
38
- dot: "w-7 h-7 top-1 left-1",
39
- translate: "translate-x-7"
40
- };
41
- case "medium":
28
+ case "sm":
29
+ return { bg: "w-10 h-5", dot: "w-4 h-4 top-0.5 left-0.5", translate: "translate-x-5" };
30
+ case "lg":
31
+ return { bg: "w-16 h-9", dot: "w-7 h-7 top-1 left-1", translate: "translate-x-7" };
32
+ case "md":
42
33
  default:
43
- return {
44
- bg: "w-14 h-8",
45
- dot: "w-6 h-6 top-1 left-1",
46
- translate: "translate-x-6"
47
- };
34
+ return { bg: "w-14 h-8", dot: "w-6 h-6 top-1 left-1", translate: "translate-x-6" };
48
35
  }
49
36
  });
50
- const toggleBgClasses = computed(
51
- () => [
52
- !isHex(props.trueColor) && isActive.value ? `bg-${props.trueColor}` : "",
53
- !isHex(props.falseColor) && !isActive.value ? `bg-${props.falseColor}` : ""
54
- ]
55
- );
56
- const toggleBgStyle = computed(
57
- () => {
58
- const style = {};
59
- if (isActive.value && isHex(props.trueColor)) {
60
- style.backgroundColor = props.trueColor;
61
- }
62
- if (!isActive.value && isHex(props.falseColor)) {
63
- style.backgroundColor = props.falseColor;
64
- }
65
- return style;
66
- }
67
- );
37
+ const toggleBgClasses = computed(() => [
38
+ !isHex(props.trueColor) && isActive.value ? `bg-${props.trueColor}` : "",
39
+ !isHex(props.falseColor) && !isActive.value ? `bg-${props.falseColor}` : ""
40
+ ]);
41
+ const toggleBgStyle = computed(() => {
42
+ const style = {};
43
+ if (isActive.value && isHex(props.trueColor)) style.backgroundColor = props.trueColor;
44
+ if (!isActive.value && isHex(props.falseColor)) style.backgroundColor = props.falseColor;
45
+ return style;
46
+ });
68
47
  const toggle = () => {
69
- if (props.disable)
70
- return;
48
+ if (props.disabled) return;
71
49
  const newValue = isActive.value ? props.inactiveValue : props.activeValue;
72
- emit(
73
- "update:modelValue",
74
- newValue
75
- );
50
+ emit("update:modelValue", newValue);
76
51
  };
77
52
  </script>
78
53
 
79
54
  <template>
80
- <div
81
- :class="[
82
- 'toggle-container flex items-center',
83
- customClasses
84
- ]"
85
- :style="{
86
- flexDirection: labelPosition === 'top' || labelPosition === 'bottom' ? 'column' : 'row'
87
- }"
88
- >
89
- <!-- Top Label -->
90
- <span
91
- v-if="
92
- label && labelPosition === 'top'
93
- "
94
- class="mb-2 font-medium text-gray-700 dark:text-gray-300"
55
+ <div class="flex flex-col gap-1">
56
+ <div
57
+ :class="['toggle-container flex items-center', customClasses]"
58
+ :style="{ flexDirection: labelPosition === 'top' || labelPosition === 'bottom' ? 'column' : 'row' }"
95
59
  >
96
- {{ label }}
97
- </span>
60
+ <span v-if="label && labelPosition === 'top'" class="mb-2 font-medium text-gray-700 dark:text-gray-300">
61
+ {{ label }}
62
+ </span>
98
63
 
99
- <!-- Left Label -->
100
- <span
101
- v-if="
102
- label && labelPosition === 'left'
103
- "
104
- class="mr-3 font-medium text-gray-700 dark:text-gray-300"
105
- >
106
- {{ label }}
107
- </span>
64
+ <span v-if="label && labelPosition === 'left'" class="mr-3 font-medium text-gray-700 dark:text-gray-300">
65
+ {{ label }}
66
+ </span>
108
67
 
109
- <!-- Toggle -->
110
- <div
111
- :class="[
112
- 'relative inline-flex items-center cursor-pointer',
113
- {
114
- 'opacity-50 pointer-events-none': disable
115
- }
116
- ]"
117
- @click="toggle"
118
- >
119
- <!-- Background -->
120
- <span
68
+ <div
69
+ role="switch"
70
+ tabindex="0"
71
+ :aria-checked="isActive"
72
+ :aria-disabled="disabled"
121
73
  :class="[
74
+ 'relative inline-flex items-center cursor-pointer rounded-full focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-1',
75
+ error ? 'focus-visible:ring-red-500' : 'focus-visible:ring-blue-500',
76
+ { 'opacity-50 pointer-events-none': disabled }
77
+ ]"
78
+ @click="toggle"
79
+ @keydown.enter.prevent="toggle"
80
+ @keydown.space.prevent="toggle"
81
+ >
82
+ <span
83
+ :class="[
122
84
  'block rounded-full transition-colors duration-300 ease-in-out',
123
85
  toggleSize.bg,
124
- toggleBgClasses
86
+ toggleBgClasses,
87
+ error ? 'ring-2 ring-red-400' : ''
125
88
  ]"
126
- :style="toggleBgStyle"
127
- />
89
+ :style="toggleBgStyle"
90
+ />
128
91
 
129
- <!-- Dot -->
130
- <span
131
- :class="[
92
+ <span
93
+ :class="[
132
94
  'toggle-dot absolute rounded-full bg-white transition-transform duration-300 ease-in-out shadow-md hover:glow-effect flex items-center justify-center',
133
95
  toggleSize.dot,
134
- {
135
- [toggleSize.translate]: isActive
136
- }
96
+ { [toggleSize.translate]: isActive }
137
97
  ]"
138
- >
139
- <span
140
- class="material-icons text-sm"
141
98
  >
142
- {{
143
- isActive ? activeIcon : inactiveIcon
144
- }}
99
+ <span class="material-icons text-sm">
100
+ {{ isActive ? activeIcon : inactiveIcon }}
101
+ </span>
145
102
  </span>
103
+ </div>
104
+
105
+ <span v-if="label && labelPosition === 'bottom'" class="mt-2 font-medium text-gray-700 dark:text-gray-300">
106
+ {{ label }}
146
107
  </span>
147
- </div>
148
108
 
149
- <!-- Bottom Label -->
150
- <span
151
- v-if="
152
- label && labelPosition === 'bottom'
153
- "
154
- class="mt-2 font-medium text-gray-700 dark:text-gray-300"
155
- >
156
- {{ label }}
157
- </span>
109
+ <span v-if="label && labelPosition === 'right'" class="ml-3 font-medium text-gray-700 dark:text-gray-300">
110
+ {{ label }}
111
+ </span>
112
+ </div>
158
113
 
159
- <!-- Right Label -->
160
- <span
161
- v-if="
162
- label && labelPosition === 'right'
163
- "
164
- class="ml-3 font-medium text-gray-700 dark:text-gray-300"
165
- >
166
- {{ label }}
167
- </span>
114
+ <span v-if="error && errorMessage" class="text-xs text-red-500">{{ errorMessage }}</span>
115
+ <span v-else-if="hint" class="text-xs text-gray-400 dark:text-gray-500">{{ hint }}</span>
168
116
  </div>
169
117
  </template>
170
118
 
@@ -1,8 +1,9 @@
1
1
  type LabelPosition = 'top' | 'bottom' | 'left' | 'right';
2
- type ToggleSize = 'small' | 'medium' | 'large';
2
+ type ToggleSize = 'sm' | 'md' | 'lg';
3
3
  type __VLS_Props = {
4
4
  modelValue?: boolean | string | number;
5
5
  label?: string;
6
+ hint?: string;
6
7
  labelPosition?: LabelPosition;
7
8
  customClasses?: string;
8
9
  trueColor?: string;
@@ -12,7 +13,9 @@ type __VLS_Props = {
12
13
  inactiveValue?: string | number | boolean;
13
14
  activeIcon?: string;
14
15
  inactiveIcon?: string;
15
- disable?: boolean;
16
+ disabled?: boolean;
17
+ error?: boolean;
18
+ errorMessage?: string;
16
19
  };
17
20
  declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
18
21
  "update:modelValue": (value: string | number | boolean) => any;
@@ -20,9 +23,12 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {
20
23
  "onUpdate:modelValue"?: ((value: string | number | boolean) => any) | undefined;
21
24
  }>, {
22
25
  modelValue: boolean | string | number;
26
+ disabled: boolean;
23
27
  label: string;
24
28
  size: ToggleSize;
25
- disable: boolean;
29
+ hint: string;
30
+ error: boolean;
31
+ errorMessage: string;
26
32
  labelPosition: LabelPosition;
27
33
  customClasses: string;
28
34
  trueColor: string;
@@ -4,6 +4,7 @@ defineOptions({
4
4
  inheritAttrs: false
5
5
  });
6
6
  import { computed, ref } from "vue";
7
+ const tooltipId = `ui-tooltip-${Math.random().toString(36).slice(2, 10)}`;
7
8
  const props = defineProps({
8
9
  text: {
9
10
  type: String,
@@ -105,6 +106,7 @@ const arrowStyle = computed(() => {
105
106
  <div
106
107
  class="relative inline-block"
107
108
  tabindex="0"
109
+ :aria-describedby="visible ? tooltipId : void 0"
108
110
  @mouseenter="showTooltip"
109
111
  @mouseleave="hideTooltip"
110
112
  @focus="showTooltip"
@@ -117,6 +119,7 @@ const arrowStyle = computed(() => {
117
119
  <transition name="fade">
118
120
  <div
119
121
  v-if="visible"
122
+ :id="tooltipId"
120
123
  role="tooltip"
121
124
  class="absolute z-50"
122
125
  :class="[tooltipClasses, placementClasses]"
@@ -11,7 +11,7 @@ export declare const uiProps: {
11
11
  readonly type: StringConstructor;
12
12
  readonly default: "";
13
13
  };
14
- readonly disable: {
14
+ readonly disabled: {
15
15
  readonly type: BooleanConstructor;
16
16
  readonly default: false;
17
17
  };
@@ -21,7 +21,7 @@ export declare const uiProps: {
21
21
  };
22
22
  readonly color: {
23
23
  readonly type: StringConstructor;
24
- readonly default: "blue-900";
24
+ readonly default: "indigo-400";
25
25
  };
26
26
  readonly rounded: {
27
27
  readonly type: StringConstructor;
@@ -2,9 +2,9 @@ export const uiProps = {
2
2
  contentClass: { type: String, default: "" },
3
3
  contentStyle: { type: String, default: "" },
4
4
  textColor: { type: String, default: "" },
5
- disable: { type: Boolean, default: false },
5
+ disabled: { type: Boolean, default: false },
6
6
  loading: { type: Boolean, default: false },
7
- color: { type: String, default: "blue-900" },
7
+ color: { type: String, default: "indigo-400" },
8
8
  rounded: { type: String, default: "md" },
9
9
  size: { type: String, default: "md" },
10
10
  iconSize: { type: String, default: "lg" }
@@ -5,7 +5,7 @@ export declare function useUiClasses(props: Partial<UiProps>): {
5
5
  contentClass: any;
6
6
  contentStyle: any;
7
7
  textColor: any;
8
- disable: any;
8
+ disabled: any;
9
9
  loading: any;
10
10
  color: any;
11
11
  rounded: any;
@@ -21,9 +21,11 @@ export declare function useUiClasses(props: Partial<UiProps>): {
21
21
  full: string;
22
22
  };
23
23
  sizeClass: {
24
+ xs: string;
24
25
  sm: string;
25
26
  md: string;
26
27
  lg: string;
28
+ xl: string;
27
29
  };
28
30
  iconSizeClasses: {
29
31
  xs: string;
@@ -4,7 +4,7 @@ export function useUiClasses(props) {
4
4
  contentClass: "",
5
5
  contentStyle: "",
6
6
  textColor: "",
7
- disable: false,
7
+ disabled: false,
8
8
  loading: false,
9
9
  color: "",
10
10
  rounded: "md",
@@ -16,7 +16,7 @@ export function useUiClasses(props) {
16
16
  contentClass,
17
17
  contentStyle,
18
18
  textColor,
19
- disable,
19
+ disabled,
20
20
  loading,
21
21
  color,
22
22
  rounded,
@@ -33,9 +33,11 @@ export function useUiClasses(props) {
33
33
  full: "rounded-full"
34
34
  };
35
35
  const sizeClass = {
36
- sm: "text-xs",
36
+ xs: "text-xs",
37
+ sm: "text-sm",
37
38
  md: "text-base",
38
- lg: "text-xl"
39
+ lg: "text-lg",
40
+ xl: "text-xl"
39
41
  };
40
42
  const iconSizeClasses = {
41
43
  xs: "text-xs",
@@ -102,7 +104,7 @@ export function useUiClasses(props) {
102
104
  contentClass,
103
105
  contentStyle,
104
106
  textColor,
105
- disable,
107
+ disabled,
106
108
  loading,
107
109
  color,
108
110
  rounded,