x-ui-design 1.0.31-gamma.1 → 1.0.31

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 (219) hide show
  1. package/.github/workflows/x-ui-design.yml +14 -0
  2. package/README.md +22 -1
  3. package/compile.sh +15 -0
  4. package/dist/{components → esm/types/components}/DatePicker/DatePicker.d.ts +2 -1
  5. package/dist/{components → esm/types/components}/DatePicker/RangePicker/RangePicker.d.ts +2 -1
  6. package/dist/{components → esm/types/components}/Dropdown/Dropdown.d.ts +2 -1
  7. package/dist/{components → esm/types/components}/Empty/Empty.d.ts +2 -1
  8. package/dist/{components → esm/types/components}/Form/Item/Item.d.ts +2 -1
  9. package/dist/esm/types/components/Icons/Icons.d.ts +19 -0
  10. package/dist/esm/types/components/Input/Input.d.ts +16 -0
  11. package/dist/{components → esm/types/components}/Input/Textarea/Textarea.d.ts +2 -1
  12. package/dist/{components → esm/types/components}/Popover/Popover.d.ts +2 -1
  13. package/dist/{components → esm/types/components}/Radio/Button/Button.d.ts +2 -1
  14. package/dist/{components → esm/types/components}/Radio/Group/Group.d.ts +2 -1
  15. package/dist/{components → esm/types/components}/Radio/Radio.d.ts +2 -1
  16. package/dist/{components → esm/types/components}/Result/Result.d.ts +2 -1
  17. package/dist/{components → esm/types/components}/Switch/Switch.d.ts +2 -1
  18. package/dist/{components → esm/types/components}/Upload/Upload.d.ts +2 -1
  19. package/dist/esm/types/index.d.ts +56 -0
  20. package/dist/index.d.ts +150 -1
  21. package/dist/index.esm.js +4209 -3779
  22. package/dist/index.esm.js.map +1 -1
  23. package/dist/index.js +4325 -3895
  24. package/dist/index.js.map +1 -1
  25. package/eslint.config.mjs +16 -0
  26. package/lib/components/Button/Button.tsx +136 -0
  27. package/lib/components/Button/index.ts +1 -0
  28. package/lib/components/Button/style.css +197 -0
  29. package/lib/components/Checkbox/Checkbox.tsx +131 -0
  30. package/lib/components/Checkbox/index.ts +1 -0
  31. package/lib/components/Checkbox/style.css +95 -0
  32. package/lib/components/ConditionalWrapper/index.tsx +12 -0
  33. package/lib/components/DatePicker/DatePicker.tsx +526 -0
  34. package/lib/components/DatePicker/RangePicker/RangePicker.tsx +500 -0
  35. package/lib/components/DatePicker/RangePicker/index.ts +1 -0
  36. package/lib/components/DatePicker/RangePicker/style.css +434 -0
  37. package/lib/components/DatePicker/TimePicker/TimePicker.tsx +497 -0
  38. package/lib/components/DatePicker/TimePicker/index.ts +1 -0
  39. package/lib/components/DatePicker/TimePicker/style.css +197 -0
  40. package/lib/components/DatePicker/index.ts +1 -0
  41. package/lib/components/DatePicker/style.css +318 -0
  42. package/lib/components/Dropdown/Dropdown.tsx +234 -0
  43. package/lib/components/Dropdown/index.ts +1 -0
  44. package/lib/components/Dropdown/style.css +124 -0
  45. package/lib/components/Empty/Empty.tsx +45 -0
  46. package/lib/components/Empty/index.ts +1 -0
  47. package/lib/components/Empty/style.css +13 -0
  48. package/lib/components/Form/Form.tsx +130 -0
  49. package/lib/components/Form/Item/Item.tsx +294 -0
  50. package/lib/components/Form/Item/index.ts +1 -0
  51. package/lib/components/Form/Item/style.css +61 -0
  52. package/lib/components/Form/index.ts +1 -0
  53. package/lib/components/Icons/Icons.tsx +433 -0
  54. package/lib/components/Icons/index.ts +15 -0
  55. package/lib/components/Input/Input.tsx +228 -0
  56. package/lib/components/Input/Textarea/Textarea.tsx +110 -0
  57. package/lib/components/Input/Textarea/index.ts +1 -0
  58. package/lib/components/Input/Textarea/style.css +104 -0
  59. package/lib/components/Input/index.ts +1 -0
  60. package/lib/components/Input/style.css +137 -0
  61. package/lib/components/Menu/Item/Item.tsx +65 -0
  62. package/lib/components/Menu/Menu.tsx +261 -0
  63. package/lib/components/Menu/SubMenu/SubMenu.tsx +68 -0
  64. package/lib/components/Menu/index.css +145 -0
  65. package/lib/components/Menu/index.ts +1 -0
  66. package/lib/components/Popover/Popover.tsx +135 -0
  67. package/lib/components/Popover/index.ts +1 -0
  68. package/lib/components/Popover/style.css +82 -0
  69. package/lib/components/Radio/Button/Button.tsx +42 -0
  70. package/lib/components/Radio/Button/index.ts +1 -0
  71. package/lib/components/Radio/Button/style.css +43 -0
  72. package/lib/components/Radio/Group/Group.tsx +105 -0
  73. package/lib/components/Radio/Group/index.ts +1 -0
  74. package/lib/components/Radio/Group/style.css +53 -0
  75. package/lib/components/Radio/Radio.tsx +83 -0
  76. package/lib/components/Radio/index.ts +1 -0
  77. package/lib/components/Radio/style.css +73 -0
  78. package/lib/components/Result/Result.tsx +39 -0
  79. package/lib/components/Result/index.ts +1 -0
  80. package/lib/components/Result/style.css +173 -0
  81. package/lib/components/Select/Option/Option.tsx +49 -0
  82. package/lib/components/Select/Option/index.ts +1 -0
  83. package/lib/components/Select/Option/style.css +50 -0
  84. package/lib/components/Select/Select.tsx +935 -0
  85. package/lib/components/Select/Tag/Tag.tsx +43 -0
  86. package/lib/components/Select/Tag/index.ts +1 -0
  87. package/lib/components/Select/Tag/style.css +87 -0
  88. package/lib/components/Select/index.ts +1 -0
  89. package/lib/components/Select/style.css +186 -0
  90. package/lib/components/Skeleton/Avatar/Avatar.tsx +61 -0
  91. package/lib/components/Skeleton/Avatar/index.ts +1 -0
  92. package/lib/components/Skeleton/Avatar/style.css +27 -0
  93. package/lib/components/Skeleton/Button/Button.tsx +44 -0
  94. package/lib/components/Skeleton/Button/index.ts +1 -0
  95. package/lib/components/Skeleton/Button/style.css +50 -0
  96. package/lib/components/Skeleton/Image/Image.tsx +45 -0
  97. package/lib/components/Skeleton/Image/index.ts +1 -0
  98. package/lib/components/Skeleton/Image/style.css +23 -0
  99. package/lib/components/Skeleton/Input/Input.tsx +42 -0
  100. package/lib/components/Skeleton/Input/index.ts +1 -0
  101. package/lib/components/Skeleton/Input/style.css +56 -0
  102. package/lib/components/Skeleton/Skeleton.tsx +97 -0
  103. package/lib/components/Skeleton/index.ts +1 -0
  104. package/lib/components/Skeleton/style.css +84 -0
  105. package/lib/components/Switch/Switch.tsx +68 -0
  106. package/lib/components/Switch/index.css +50 -0
  107. package/lib/components/Switch/index.ts +1 -0
  108. package/lib/components/Upload/Upload.tsx +291 -0
  109. package/lib/components/Upload/index.ts +1 -0
  110. package/lib/components/Upload/style.css +151 -0
  111. package/lib/global.d.ts +1 -0
  112. package/lib/helpers/flatten.ts +26 -0
  113. package/lib/helpers/index.ts +52 -0
  114. package/lib/helpers/mask.ts +52 -0
  115. package/lib/hooks/useForm.ts +548 -0
  116. package/lib/hooks/usePosition.ts +206 -0
  117. package/lib/hooks/useWatch.ts +41 -0
  118. package/lib/hooks/useWatchError.ts +20 -0
  119. package/lib/index.ts +184 -0
  120. package/lib/styles/global.css +57 -0
  121. package/lib/types/button.ts +83 -0
  122. package/lib/types/checkbox.ts +32 -0
  123. package/lib/types/datepicker.ts +165 -0
  124. package/lib/types/dropdown.ts +41 -0
  125. package/lib/types/empty.ts +8 -0
  126. package/lib/types/form.ts +179 -0
  127. package/lib/types/index.ts +38 -0
  128. package/lib/types/input.ts +72 -0
  129. package/lib/types/menu.ts +55 -0
  130. package/lib/types/popover.ts +16 -0
  131. package/lib/types/radio.ts +69 -0
  132. package/lib/types/result.ts +22 -0
  133. package/lib/types/select.ts +126 -0
  134. package/lib/types/skeleton.ts +62 -0
  135. package/lib/types/switch.ts +22 -0
  136. package/lib/types/upload.ts +67 -0
  137. package/lib/utils/index.ts +37 -0
  138. package/lib/utils/lazy.ts +17 -0
  139. package/next.config.ts +7 -0
  140. package/package.json +20 -22
  141. package/rollup.config.js +71 -0
  142. package/src/app/favicon.ico +0 -0
  143. package/src/app/globals.css +48 -0
  144. package/src/app/layout.d.ts +5 -0
  145. package/src/app/layout.tsx +16 -0
  146. package/src/app/page.d.ts +1 -0
  147. package/src/app/page.tsx +21 -0
  148. package/tsconfig.json +46 -0
  149. package/dist/components/Icons/Icons.d.ts +0 -18
  150. package/dist/components/Input/Input.d.ts +0 -11
  151. /package/dist/{components → esm/types/components}/Button/Button.d.ts +0 -0
  152. /package/dist/{components → esm/types/components}/Button/index.d.ts +0 -0
  153. /package/dist/{components → esm/types/components}/Checkbox/Checkbox.d.ts +0 -0
  154. /package/dist/{components → esm/types/components}/Checkbox/index.d.ts +0 -0
  155. /package/dist/{components → esm/types/components}/ConditionalWrapper/index.d.ts +0 -0
  156. /package/dist/{components → esm/types/components}/DatePicker/RangePicker/index.d.ts +0 -0
  157. /package/dist/{components → esm/types/components}/DatePicker/TimePicker/TimePicker.d.ts +0 -0
  158. /package/dist/{components → esm/types/components}/DatePicker/TimePicker/index.d.ts +0 -0
  159. /package/dist/{components → esm/types/components}/DatePicker/index.d.ts +0 -0
  160. /package/dist/{components → esm/types/components}/Dropdown/index.d.ts +0 -0
  161. /package/dist/{components → esm/types/components}/Empty/index.d.ts +0 -0
  162. /package/dist/{components → esm/types/components}/Form/Form.d.ts +0 -0
  163. /package/dist/{components → esm/types/components}/Form/Item/index.d.ts +0 -0
  164. /package/dist/{components → esm/types/components}/Form/index.d.ts +0 -0
  165. /package/dist/{components → esm/types/components}/Icons/index.d.ts +0 -0
  166. /package/dist/{components → esm/types/components}/Input/Textarea/index.d.ts +0 -0
  167. /package/dist/{components → esm/types/components}/Input/index.d.ts +0 -0
  168. /package/dist/{components → esm/types/components}/Menu/Item/Item.d.ts +0 -0
  169. /package/dist/{components → esm/types/components}/Menu/Menu.d.ts +0 -0
  170. /package/dist/{components → esm/types/components}/Menu/SubMenu/SubMenu.d.ts +0 -0
  171. /package/dist/{components → esm/types/components}/Menu/index.d.ts +0 -0
  172. /package/dist/{components → esm/types/components}/Popover/index.d.ts +0 -0
  173. /package/dist/{components → esm/types/components}/Radio/Button/index.d.ts +0 -0
  174. /package/dist/{components → esm/types/components}/Radio/Group/index.d.ts +0 -0
  175. /package/dist/{components → esm/types/components}/Radio/index.d.ts +0 -0
  176. /package/dist/{components → esm/types/components}/Result/index.d.ts +0 -0
  177. /package/dist/{components → esm/types/components}/Select/Option/Option.d.ts +0 -0
  178. /package/dist/{components → esm/types/components}/Select/Option/index.d.ts +0 -0
  179. /package/dist/{components → esm/types/components}/Select/Select.d.ts +0 -0
  180. /package/dist/{components → esm/types/components}/Select/Tag/Tag.d.ts +0 -0
  181. /package/dist/{components → esm/types/components}/Select/Tag/index.d.ts +0 -0
  182. /package/dist/{components → esm/types/components}/Select/index.d.ts +0 -0
  183. /package/dist/{components → esm/types/components}/Skeleton/Avatar/Avatar.d.ts +0 -0
  184. /package/dist/{components → esm/types/components}/Skeleton/Avatar/index.d.ts +0 -0
  185. /package/dist/{components → esm/types/components}/Skeleton/Button/Button.d.ts +0 -0
  186. /package/dist/{components → esm/types/components}/Skeleton/Button/index.d.ts +0 -0
  187. /package/dist/{components → esm/types/components}/Skeleton/Image/Image.d.ts +0 -0
  188. /package/dist/{components → esm/types/components}/Skeleton/Image/index.d.ts +0 -0
  189. /package/dist/{components → esm/types/components}/Skeleton/Input/Input.d.ts +0 -0
  190. /package/dist/{components → esm/types/components}/Skeleton/Input/index.d.ts +0 -0
  191. /package/dist/{components → esm/types/components}/Skeleton/Skeleton.d.ts +0 -0
  192. /package/dist/{components → esm/types/components}/Skeleton/index.d.ts +0 -0
  193. /package/dist/{components → esm/types/components}/Switch/index.d.ts +0 -0
  194. /package/dist/{components → esm/types/components}/Upload/index.d.ts +0 -0
  195. /package/dist/{helpers → esm/types/helpers}/flatten.d.ts +0 -0
  196. /package/dist/{helpers → esm/types/helpers}/index.d.ts +0 -0
  197. /package/dist/{helpers → esm/types/helpers}/mask.d.ts +0 -0
  198. /package/dist/{hooks → esm/types/hooks}/useForm.d.ts +0 -0
  199. /package/dist/{hooks → esm/types/hooks}/usePosition.d.ts +0 -0
  200. /package/dist/{hooks → esm/types/hooks}/useWatch.d.ts +0 -0
  201. /package/dist/{hooks → esm/types/hooks}/useWatchError.d.ts +0 -0
  202. /package/dist/{types → esm/types/types}/button.d.ts +0 -0
  203. /package/dist/{types → esm/types/types}/checkbox.d.ts +0 -0
  204. /package/dist/{types → esm/types/types}/datepicker.d.ts +0 -0
  205. /package/dist/{types → esm/types/types}/dropdown.d.ts +0 -0
  206. /package/dist/{types → esm/types/types}/empty.d.ts +0 -0
  207. /package/dist/{types → esm/types/types}/form.d.ts +0 -0
  208. /package/dist/{types → esm/types/types}/index.d.ts +0 -0
  209. /package/dist/{types → esm/types/types}/input.d.ts +0 -0
  210. /package/dist/{types → esm/types/types}/menu.d.ts +0 -0
  211. /package/dist/{types → esm/types/types}/popover.d.ts +0 -0
  212. /package/dist/{types → esm/types/types}/radio.d.ts +0 -0
  213. /package/dist/{types → esm/types/types}/result.d.ts +0 -0
  214. /package/dist/{types → esm/types/types}/select.d.ts +0 -0
  215. /package/dist/{types → esm/types/types}/skeleton.d.ts +0 -0
  216. /package/dist/{types → esm/types/types}/switch.d.ts +0 -0
  217. /package/dist/{types → esm/types/types}/upload.d.ts +0 -0
  218. /package/dist/{utils → esm/types/utils}/index.d.ts +0 -0
  219. /package/dist/{utils → esm/types/utils}/lazy.d.ts +0 -0
@@ -0,0 +1,318 @@
1
+ .xUi-datepicker-container {
2
+ position: relative;
3
+ font-family: Arial, sans-serif;
4
+ height: max-content;
5
+ }
6
+
7
+ .xUi-datepicker-input {
8
+ gap: 8px;
9
+ padding: 3px 7px;
10
+ display: flex;
11
+ justify-content: space-between;
12
+ align-items: center;
13
+ border: 1px solid var(--xui-border-color);
14
+ border-radius: 6px;
15
+ background-color: transparent;
16
+ color: var(--xui-text-color);
17
+ cursor: pointer;
18
+ transition: all 0.3s;
19
+ }
20
+
21
+ .xUi-datepicker-input.noBordered {
22
+ border: none !important;
23
+ }
24
+
25
+ .xUi-datepicker-input input {
26
+ font-size: var(--xui-font-size-sm);
27
+ border: none;
28
+ outline: none;
29
+ padding: 0;
30
+ color: var(--xui-text-color);
31
+ }
32
+
33
+ .xUi-datepicker-input:placeholder-shown {
34
+ text-overflow: ellipsis;
35
+ }
36
+
37
+ .xUi-datepicker-input:hover {
38
+ border-color: var(--xui-primary-color);
39
+ }
40
+
41
+ .xUi-datepicker-icon {
42
+ cursor: pointer;
43
+ opacity: 0.6;
44
+ width: 16px;
45
+ height: 16px;
46
+ transition: .3s ease;
47
+ color: var(--xui-text-color);
48
+ }
49
+
50
+ .xUi-datepicker-icon:hover {
51
+ opacity: 1;
52
+ color: var(--xui-primary-color);
53
+ }
54
+
55
+ .xUi-datepicker-selected-date {
56
+ border: none;
57
+ outline: none;
58
+ letter-spacing: 0.8px;
59
+ font-size: var(--xui-font-size-md);
60
+ color: var(--xui-text-color);
61
+ }
62
+
63
+ .xUi-datepicker-disabled {
64
+ background-color: var(--xui-color-disabled);
65
+ cursor: not-allowed;
66
+ opacity: 0.5;
67
+ border-color: var(--xui-border-color) !important;
68
+ }
69
+
70
+ .xUi-datepicker-disabled .xUi-datepicker-selected-date {
71
+ opacity: 0.6;
72
+ cursor: not-allowed;
73
+ }
74
+
75
+ .xUi-datepicker-disabled .xUi-datepicker-icon {
76
+ cursor: not-allowed;
77
+ }
78
+
79
+ .xUi-datepicker-icon {
80
+ font-size: 16px;
81
+ color: #8c8c8c;
82
+ display: flex;
83
+ align-items: center;
84
+ gap: 6px;
85
+ }
86
+
87
+ .xUi-datepicker-error {
88
+ border-color: var(--xui-error-color);
89
+ }
90
+
91
+ .xUi-datepicker-error .xUi-datepicker-icon,
92
+ .xUi-datepicker-icon .error-svg-icon,
93
+ .xUi-datepicker-error .error-svg-icon {
94
+ color: var(--xui-error-color);
95
+ }
96
+
97
+ .xUi-datepicker-input.sm {
98
+ padding: 4px 8px;
99
+ font-size: var(--xui-font-size-sm);
100
+ }
101
+
102
+ .xUi-datepicker-input.md {
103
+ padding: 8px 12px;
104
+ font-size: var(--xui-font-size-md);
105
+ }
106
+
107
+ .xUi-datepicker-input.lg {
108
+ padding: 10px 16px;
109
+ font-size: var(--xui-font-size-lg);
110
+ }
111
+
112
+ .xUi-datepicker-dropdown-wrapper {
113
+ transition:
114
+ opacity 0.3s ease,
115
+ transform 0.01s ease;
116
+ position: absolute;
117
+ z-index: 1000;
118
+ }
119
+
120
+ .xUi-datepicker-dropdown-wrapper.bottomLeft {
121
+ top: 100%;
122
+ left: 0;
123
+ margin-top: 4px;
124
+ }
125
+ .xUi-datepicker-dropdown-wrapper.bottomRight {
126
+ top: 100%;
127
+ right: 0;
128
+ margin-top: 4px;
129
+ }
130
+
131
+ .xUi-datepicker-dropdown-wrapper.topLeft {
132
+ bottom: 100%;
133
+ left: 0;
134
+ margin-bottom: 4px;
135
+ }
136
+
137
+ .xUi-datepicker-dropdown-wrapper.topRight {
138
+ bottom: 100%;
139
+ right: 0;
140
+ margin-bottom: 4px;
141
+ }
142
+
143
+ .xUi-datepicker-dropdown {
144
+ min-width: 250px;
145
+ padding: 12px;
146
+ background: var(--xui-background-color);
147
+ border: 1px solid var(--xui-border-color);
148
+ border-radius: 4px;
149
+ box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
150
+ }
151
+
152
+ .xUi-datepicker-header {
153
+ display: flex;
154
+ justify-content: space-between;
155
+ align-items: center;
156
+ gap: 8px;
157
+ margin-bottom: 8px;
158
+ padding-bottom: 12px;
159
+ border-bottom: 1px solid var(--xui-border-color);
160
+ }
161
+
162
+ .xUi-datepicker-day-footer {
163
+ width: 100%;
164
+ display: flex;
165
+ justify-content: center;
166
+ align-items: center;
167
+ margin-top: 8px;
168
+ padding-top: 12px;
169
+ border-top: 1px solid var(--xui-border-color);
170
+ }
171
+
172
+ .xUi-datepicker-nav-buttons {
173
+ display: flex;
174
+ gap: 4px;
175
+ }
176
+
177
+ .xUi-datepicker-nav-buttons button {
178
+ padding: 2px 6px;
179
+ border: none;
180
+ background: none;
181
+ border-radius: 4px;
182
+ cursor: pointer;
183
+ transition: all 0.3s;
184
+ font-size: 20px;
185
+ opacity: 0.7;
186
+ color: var(--xui-text-color);
187
+ }
188
+
189
+ .xUi-datepicker-nav-buttons button:not(:disabled):hover {
190
+ color: var(--xui-primary-color);
191
+ }
192
+
193
+ .xUi-datepicker-dropdown-selects {
194
+ display: flex;
195
+ gap: 6px;
196
+ align-items: center;
197
+ }
198
+
199
+ .xUi-datepicker-select,
200
+ .xUi-datepicker-dropdown-selects button {
201
+ padding: 4px 8px;
202
+ border-radius: 4px;
203
+ background: var(--xui-background-color);
204
+ color: var(--xui-text-color);
205
+ font-weight: 600;
206
+ cursor: pointer;
207
+ transition: all 0.3s;
208
+ border: none;
209
+ }
210
+
211
+ .xUi-datepicker-select:not(:disabled):hover,
212
+ .xUi-datepicker-dropdown-selects button:hover {
213
+ color: var(--xui-primary-color);
214
+ }
215
+
216
+ .xUi-datepicker-grid {
217
+ display: grid;
218
+ grid-template-columns: repeat(3, 1fr);
219
+ gap: 2px;
220
+ text-align: center;
221
+ }
222
+
223
+ .xUi-datepicker-grid.day {
224
+ grid-template-columns: repeat(7, 1fr);
225
+ }
226
+
227
+ .xUi-datepicker-day-header {
228
+ font-size: 14px;
229
+ user-select: none;
230
+ margin: 4px 0;
231
+ color: var(--xui-text-color);
232
+ }
233
+
234
+ .xUi-datepicker-day,
235
+ .xUi-datepicker-month,
236
+ .xUi-datepicker-year {
237
+ height: 30px;
238
+ min-width: 30px;
239
+ line-height: 30px;
240
+ border-radius: 4px;
241
+ background: none;
242
+ border: none;
243
+ color: var(--xui-text-color);
244
+ text-align: center;
245
+ cursor: pointer;
246
+ transition: all 0.2s;
247
+ }
248
+
249
+ .xUi-datepicker-month,
250
+ .xUi-datepicker-year {
251
+ margin: 7px;
252
+ }
253
+
254
+ .xUi-datepicker-select:disabled,
255
+ .xUi-datepicker-day:disabled,
256
+ .xUi-datepicker-month:disabled,
257
+ .xUi-datepicker-year:disabled {
258
+ cursor: not-allowed;
259
+ opacity: 0.5;
260
+ background-color: var(--xui-color-disabled);
261
+ }
262
+
263
+ .xUi-datepicker-day:not(:disabled):hover,
264
+ .xUi-datepicker-month:not(:disabled):hover,
265
+ .xUi-datepicker-year:not(:disabled):hover {
266
+ background: var(--xui-primary-color-light);
267
+ color: #fff;
268
+ }
269
+
270
+ .xUi-datepicker-selected {
271
+ background: var(--xui-primary-color) !important;
272
+ color: #fff !important;
273
+ font-weight: bold;
274
+ }
275
+
276
+ .xUi-datepicker-other-month {
277
+ opacity: 0.4;
278
+ color: var(--xui-text-color);
279
+ }
280
+
281
+ .xUi-datepicker-other-month:not(:disabled):hover {
282
+ color: var(--xui-text-color);
283
+ user-select: none;
284
+ background-color: var(--xui-color-hover);
285
+ }
286
+
287
+ .xUi-datepicker-footer {
288
+ margin-top: 12px;
289
+ text-align: right;
290
+ }
291
+
292
+ .xUi-datepicker-footer-today-btn {
293
+ padding: 4px 8px;
294
+ font-size: 13px;
295
+ background: none;
296
+ border-radius: 4px;
297
+ border: 1px solid var(--xui-border-color);
298
+ color: var(--xui-primary-color);
299
+ cursor: pointer;
300
+ transition: all 0.3s;
301
+ }
302
+
303
+ .xUi-datepicker-footer-today-btn:not(:disabled):hover {
304
+ background-color: var(--xui-primary-color-light);
305
+ color: white;
306
+ }
307
+
308
+ .xUi-datepicker-large .xUi-datepicker-selected-date {
309
+ font-size: 16px;
310
+ }
311
+
312
+ .xUi-datepicker-large .xUi-datepicker-input {
313
+ padding: 11px;
314
+ }
315
+
316
+ .xUi-datepicker-middle .xUi-datepicker-input {
317
+ padding: 6px 11px;
318
+ }
@@ -0,0 +1,234 @@
1
+ import React, {
2
+ useEffect,
3
+ useRef,
4
+ useState,
5
+ } from 'react';
6
+ import {
7
+ DropdownProps,
8
+ DropdownMenuInnerProps
9
+ } from '../../types/dropdown';
10
+ import { prefixClsDropdown } from '../../utils';
11
+ import { clsx } from '../../helpers';
12
+ import { usePosition } from '../../hooks/usePosition';
13
+ import { ConditionalWrapper } from '../ConditionalWrapper';
14
+ import { createPortal } from 'react-dom';
15
+ import './style.css';
16
+
17
+ const Dropdown = ({
18
+ children,
19
+ menu,
20
+ open: controlledOpen,
21
+ defaultOpen = false,
22
+ onVisibleChange,
23
+ trigger = 'hover',
24
+ placement = 'bottomLeft',
25
+ overlayClassName = '',
26
+ overlayStyle,
27
+ getPopupContainer,
28
+ destroyOnHidden = false,
29
+ disabled = false,
30
+ arrow = false,
31
+ autoFocus = false,
32
+ popupRender,
33
+ className = '',
34
+ overlay,
35
+ prefixCls = prefixClsDropdown,
36
+ }: DropdownProps) => {
37
+ const [open, setOpen] = useState<boolean>(controlledOpen ?? defaultOpen);
38
+ const [_hover, setHover] = useState<boolean>(controlledOpen ?? defaultOpen);
39
+ const isControlled = controlledOpen !== undefined;
40
+
41
+ const triggerRef = useRef<HTMLDivElement | null>(null);
42
+ const popupRef = useRef<HTMLDivElement | null>(null);
43
+ const menuRef = useRef<HTMLUListElement | null>(null);
44
+
45
+ const { showPlacement, dropdownPosition } = usePosition({
46
+ popupRef,
47
+ placement,
48
+ offset: 8,
49
+ isOpen: open,
50
+ triggerRef,
51
+ getPopupContainer: getPopupContainer?.(triggerRef.current as HTMLElement)
52
+ })
53
+
54
+ useEffect(() => {
55
+ if (isControlled) {
56
+ setOpen(Boolean(controlledOpen));
57
+ onVisibleChange?.(Boolean(controlledOpen))
58
+ }
59
+ }, [controlledOpen]);
60
+
61
+ useEffect(() => {
62
+ if (open && autoFocus) {
63
+ requestAnimationFrame(() => {
64
+ const first = menuRef.current?.querySelector(
65
+ "[role='menuitem']:not([aria-disabled='true'])"
66
+ ) as HTMLElement | null;
67
+
68
+ first?.focus();
69
+ });
70
+ }
71
+ }, [open]);
72
+
73
+ const setOpenInternal = (next: boolean) => {
74
+ if (disabled) {
75
+ return;
76
+ }
77
+
78
+ if (!isControlled) {
79
+ setOpen(next);
80
+ }
81
+
82
+ onVisibleChange?.(next);
83
+ onVisibleChange?.(next)
84
+ };
85
+
86
+ useEffect(() => {
87
+ const handleClick = (e: MouseEvent) => {
88
+ if (!open) {
89
+ return;
90
+ }
91
+
92
+ const target = e.target as Node;
93
+
94
+ if (
95
+ triggerRef.current &&
96
+ !triggerRef.current.contains(target) &&
97
+ !popupRef.current?.contains(target)
98
+ ) {
99
+ setOpenInternal(false);
100
+ }
101
+ };
102
+
103
+ document.addEventListener('mousedown', handleClick);
104
+
105
+ return () => document.removeEventListener('mousedown', handleClick);
106
+ }, [open]);
107
+
108
+ const triggers = Array.isArray(trigger) ? trigger : [trigger];
109
+
110
+ const onTriggerClick = () => {
111
+ if (triggers.includes('click')) {
112
+ setOpenInternal(!open);
113
+ }
114
+ };
115
+
116
+ const onTriggerMouseEnter = () => {
117
+ setHover(true);
118
+
119
+ if (triggers.includes('hover')) {
120
+ setOpenInternal(true);
121
+ }
122
+ };
123
+
124
+ const onTriggerMouseLeave = () => {
125
+ setHover(false);
126
+
127
+ if (triggers.includes('hover')) {
128
+ setOpenInternal(false);
129
+ }
130
+ };
131
+
132
+ const popup = (
133
+ <ConditionalWrapper
134
+ condition={getPopupContainer !== undefined}
135
+ wrapper={(element) => getPopupContainer ? createPortal(element, getPopupContainer(popupRef.current as HTMLElement)) : <>{element}</>}>
136
+ <div
137
+ ref={popupRef}
138
+ className={`${prefixCls}-overlay ${prefixCls}-${placement} ${overlayClassName}`}
139
+ style={{
140
+ zIndex: _hover ? 1000 : 0,
141
+ ...overlayStyle,
142
+ ...dropdownPosition
143
+ }}
144
+ >
145
+ {arrow && <div className={`${prefixCls}-arrow ${showPlacement ? 'bottom' : ''}`} />}
146
+
147
+ {overlay ? typeof overlay === 'function' ? overlay() : overlay : popupRender ? (
148
+ popupRender(
149
+ menu ? (
150
+ <MenuInner
151
+ prefixCls={prefixCls}
152
+ items={menu.items}
153
+ menuRef={menuRef}
154
+ onClose={() => setOpenInternal(false)}
155
+ />
156
+ ) : (
157
+ <div style={{ padding: 8 }}>Empty menu</div>
158
+ )
159
+ )
160
+ ) : menu ? (
161
+ <MenuInner
162
+ prefixCls={prefixCls}
163
+ items={menu.items}
164
+ menuRef={menuRef}
165
+ onClose={() => setOpenInternal(false)}
166
+ />
167
+ ) : (
168
+ <div style={{ padding: 8 }}>Empty menu</div>
169
+ )}
170
+ </div>
171
+ </ConditionalWrapper>
172
+ );
173
+
174
+ return (
175
+ <div
176
+ ref={triggerRef}
177
+ className={className}
178
+ >
179
+ <div
180
+ onClick={onTriggerClick}
181
+ onMouseEnter={onTriggerMouseEnter}
182
+ onMouseLeave={onTriggerMouseLeave}
183
+ tabIndex={disabled ? -1 : 0}
184
+ aria-haspopup='menu'
185
+ style={{ width: 'fit-content' }}
186
+ aria-expanded={open}
187
+ >
188
+ {children}
189
+
190
+ {open && popup}
191
+ {!open && !destroyOnHidden && null}
192
+ </div>
193
+ </div>
194
+ );
195
+ };
196
+
197
+ function MenuInner({
198
+ items,
199
+ menuRef,
200
+ onClose,
201
+ prefixCls,
202
+ }: DropdownMenuInnerProps) {
203
+ return (
204
+ <ul className={`${prefixCls}-menu`} ref={menuRef} role='menu'>
205
+ {items.map((it) => (
206
+ <li
207
+ key={it.key}
208
+ role='menuitem'
209
+ tabIndex={it.disabled ? -1 : 0}
210
+ aria-disabled={it.disabled ?? false}
211
+ onClick={(e) => {
212
+ if (it.disabled) {
213
+ return;
214
+ }
215
+
216
+ it.onClick?.(e as any);
217
+ onClose();
218
+ }}
219
+ className={clsx([
220
+ `${prefixCls}-item`,
221
+ {
222
+ 'disabled': it.disabled,
223
+ 'danger': it.danger
224
+ }
225
+ ])}
226
+ >
227
+ {it.label ?? it.key}
228
+ </li>
229
+ ))}
230
+ </ul>
231
+ );
232
+ }
233
+
234
+ export default Dropdown;
@@ -0,0 +1 @@
1
+ export { default as Dropdown } from '../Dropdown/Dropdown'
@@ -0,0 +1,124 @@
1
+ .xUi-dropdown-overlay {
2
+ background: var(--xui-menu-inline-bg);
3
+ border-radius: 8px;
4
+ border: 1px solid var(--xui-border-color);
5
+ box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
6
+ padding: 4px 0;
7
+ min-width: 160px;
8
+ position: absolute;
9
+
10
+ &::before {
11
+ content: "";
12
+ position: absolute;
13
+ top: -15px;
14
+ width: 100%;
15
+ height: 10px;
16
+ z-index: 1;
17
+ }
18
+ }
19
+
20
+ .xUi-dropdown-overlay > ul,
21
+ .xUi-dropdown-overlay > div,
22
+ .xUi-dropdown-overlay > select {
23
+ box-shadow: unset;
24
+ }
25
+
26
+ .xUi-dropdown-overlay .xUi-dropdown-menu {
27
+ padding: 0 4px;
28
+ margin: 0;
29
+ position: relative;
30
+
31
+ &::before {
32
+ content: "";
33
+ position: absolute;
34
+ top: -15px;
35
+ width: 100%;
36
+ height: 10px;
37
+ z-index: 1;
38
+ }
39
+ }
40
+
41
+ .xUi-dropdown-overlay .xUi-dropdown-item {
42
+ padding: 8px 12px;
43
+ border-radius: 8px;
44
+ cursor: pointer;
45
+ font-size: 14px;
46
+ user-select: none;
47
+ list-style: none;
48
+ color: var(--xui-text-color);
49
+ }
50
+
51
+ .xUi-dropdown-overlay .xUi-dropdown-item:hover,
52
+ .xUi-dropdown-overlay .xUi-dropdown-item:focus {
53
+ background: var(--xui-color-hover);
54
+ outline: none;
55
+ }
56
+
57
+ .xUi-dropdown-overlay .xUi-dropdown-item.disabled {
58
+ opacity: 0.5;
59
+ cursor: not-allowed;
60
+ }
61
+
62
+ .xUi-dropdown-overlay .xUi-dropdown-item.danger {
63
+ color: var(--xui-error-color-light);
64
+
65
+ &:hover {
66
+ color: var(--xui-background-color);
67
+ background-color: var(--xui-error-color-light);
68
+ }
69
+ }
70
+
71
+ .xUi-dropdown-arrow {
72
+ width: 10px;
73
+ height: 10px;
74
+ position: absolute;
75
+ top: -6px;
76
+ left: 12px;
77
+ background: var(--xui-background-color);
78
+ border-left: 0.5px solid var(--xui-border-color);
79
+ border-top: 0.5px solid var(--xui-border-color);
80
+ transform: rotate(45deg);
81
+ }
82
+
83
+ .xUi-dropdown-arrow.bottom {
84
+ top: unset;
85
+ bottom: -6px;
86
+ border-left: unset;
87
+ border-top: unset;
88
+ border-right: 0.5px solid var(--xui-border-color);
89
+ border-bottom: 0.5px solid var(--xui-border-color);
90
+ }
91
+
92
+ .xUi-dropdown-arrow {
93
+ width: 10px;
94
+ height: 10px;
95
+ position: absolute;
96
+ top: -6px;
97
+ left: 12px;
98
+ background: var(--xui-background-color);
99
+ border-left: 0.5px solid var(--xui-border-color);
100
+ border-top: 0.5px solid var(--xui-border-color);
101
+ transform: rotate(45deg);
102
+ }
103
+
104
+ .xUi-dropdown-right .xUi-dropdown-arrow,
105
+ .xUi-dropdown-topRight .xUi-dropdown-arrow,
106
+ .xUi-dropdown-bottomRight .xUi-dropdown-arrow {
107
+ left: unset;
108
+ right: 12px;
109
+ }
110
+
111
+ .xUi-dropdown-arrow.bottom {
112
+ top: unset;
113
+ bottom: -6px;
114
+ border-left: unset;
115
+ border-top: unset;
116
+ border-right: 0.5px solid var(--xui-border-color);
117
+ border-bottom: 0.5px solid var(--xui-border-color);
118
+ }
119
+
120
+ .xUi-dropdown-arrow.center {
121
+ left: 0;
122
+ right: 0;
123
+ margin: 0 auto;
124
+ }
@@ -0,0 +1,45 @@
1
+ import React from 'react';
2
+ import { EmptyContentProps } from '../../types/empty';
3
+ import { prefixClsEmpty, prefixClsEmptyV3 } from '../../utils';
4
+ import './style.css';
5
+
6
+ const EmptyContent = ({
7
+ icon,
8
+ style = {},
9
+ className = '',
10
+ title = 'No Data',
11
+ description = 'No data',
12
+ prefixCls = prefixClsEmpty,
13
+ prefixClsV3 = prefixClsEmptyV3
14
+ }: EmptyContentProps) => (
15
+ <div
16
+ style={style}
17
+ className={`${prefixCls} ${prefixClsV3} ${prefixCls}-normal ${prefixClsV3}--normal ${prefixCls}-small ${prefixClsV3}-small ${className}`}
18
+ >
19
+ <div className={`${prefixCls}-image`}>
20
+ {icon || (
21
+ <svg
22
+ width="64"
23
+ height="41"
24
+ viewBox="0 0 64 41"
25
+ xmlns="http://www.w3.org/2000/svg"
26
+ >
27
+ <title>{title}</title>
28
+ <g transform="translate(0 1)" fill="none">
29
+ <ellipse fill="#f5f5f5" cx="32" cy="33" rx="32" ry="7"></ellipse>
30
+ <g stroke="#d9d9d9">
31
+ <path d="M55 12.76L44.854 1.258C44.367.474 43.656 0 42.907 0H21.093c-.749 0-1.46.474-1.947 1.257L9 12.761V22h46v-9.24z"></path>
32
+ <path
33
+ d="M41.613 15.931c0-1.605.994-2.93 2.227-2.931H55v18.137C55 33.26 53.68 35 52.05 35h-40.1C10.32 35 9 33.259 9 31.137V13h11.16c1.233 0 2.227 1.323 2.227 2.928v.022c0 1.605 1.005 2.901 2.237 2.901h14.752c1.232 0 2.237-1.308 2.237-2.913v-.007z"
34
+ fill="#fafafa"
35
+ ></path>
36
+ </g>
37
+ </g>
38
+ </svg>
39
+ )}
40
+ </div>
41
+ <div className={`${prefixCls}-description`}>{description}</div>
42
+ </div>
43
+ );
44
+
45
+ export default EmptyContent;