@rockshin/tao-ui 0.0.58 → 0.0.59
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.
- package/dist/components/affix/affix.js +38 -4
- package/dist/components/app/app-modals.js +11 -6
- package/dist/components/app/app-notices.js +105 -47
- package/dist/components/auto-complete/auto-complete.js +9 -2
- package/dist/components/calendar/calendar.js +22 -18
- package/dist/components/carousel/carousel.js +27 -14
- package/dist/components/cascader/cascader.js +17 -12
- package/dist/components/checkbox/checkbox.d.ts +3 -1
- package/dist/components/checkbox/checkbox.js +65 -58
- package/dist/components/color-picker/color-picker.js +383 -360
- package/dist/components/date-picker/calendar/calendar-grid.d.ts +5 -3
- package/dist/components/date-picker/calendar/calendar-grid.js +9 -4
- package/dist/components/date-picker/calendar/month-grid.d.ts +2 -1
- package/dist/components/date-picker/calendar/month-grid.js +61 -45
- package/dist/components/date-picker/calendar/time-panel.d.ts +8 -1
- package/dist/components/date-picker/calendar/time-panel.js +89 -88
- package/dist/components/date-picker/calendar/year-grid.d.ts +2 -1
- package/dist/components/date-picker/calendar/year-grid.js +60 -44
- package/dist/components/date-picker/date-picker.css +9 -0
- package/dist/components/date-picker/date-picker.js +22 -13
- package/dist/components/date-picker/range-picker.d.ts +2 -0
- package/dist/components/date-picker/range-picker.js +127 -70
- package/dist/components/date-picker/types.js +1 -1
- package/dist/components/drawer/drawer.d.ts +1 -1
- package/dist/components/drawer/drawer.js +4 -3
- package/dist/components/dropdown/dropdown.js +11 -9
- package/dist/components/float-button/float-button.js +4 -4
- package/dist/components/form/form-item.d.ts +1 -1
- package/dist/components/form/form-item.js +160 -120
- package/dist/components/form-field/form-field-view.d.ts +2 -1
- package/dist/components/form-field/form-field-view.js +173 -108
- package/dist/components/input/input-shared.js +3 -2
- package/dist/components/input/otp.js +114 -110
- package/dist/components/input/password.js +55 -61
- package/dist/components/input/search.js +8 -4
- package/dist/components/mentions/mentions.js +1 -0
- package/dist/components/menu/menu-render.js +1 -0
- package/dist/components/modal/confirm-dialog.js +11 -4
- package/dist/components/modal/modal.js +320 -315
- package/dist/components/pagination/pagination.d.ts +1 -0
- package/dist/components/pagination/pagination.js +1 -0
- package/dist/components/popover/popover.js +325 -289
- package/dist/components/qr-code/qr-code.js +157 -150
- package/dist/components/radio/radio.d.ts +3 -1
- package/dist/components/radio/radio.js +73 -64
- package/dist/components/select/mobile-select.js +6 -3
- package/dist/components/select/select-model.js +2 -2
- package/dist/components/select/select.js +78 -39
- package/dist/components/select/use-select-selection.js +58 -58
- package/dist/components/slider/slider.d.ts +2 -2
- package/dist/components/slider/slider.js +13 -2
- package/dist/components/sonner/sonner.js +2 -2
- package/dist/components/splitter/splitter.css +1 -0
- package/dist/components/splitter/splitter.js +152 -126
- package/dist/components/switch/switch.js +45 -39
- package/dist/components/table/table.js +1 -0
- package/dist/components/table/use-table-data.js +2 -2
- package/dist/components/time-picker/time-picker.js +31 -1
- package/dist/components/tooltip/tooltip.js +237 -99
- package/dist/components/tree/tree.js +31 -3
- package/dist/components/tree-select/tree-select.js +1 -1
- package/dist/components/upload/upload.js +67 -40
- package/dist/locales/ar-EG.js +2 -0
- package/dist/locales/de-DE.js +2 -0
- package/dist/locales/en-US.js +2 -0
- package/dist/locales/es-ES.js +2 -0
- package/dist/locales/fr-FR.js +2 -0
- package/dist/locales/hi-IN.js +2 -0
- package/dist/locales/id-ID.js +2 -0
- package/dist/locales/it-IT.js +2 -0
- package/dist/locales/ja-JP.js +2 -0
- package/dist/locales/ko-KR.js +2 -0
- package/dist/locales/pt-BR.js +2 -0
- package/dist/locales/ru-RU.js +2 -0
- package/dist/locales/th-TH.js +2 -0
- package/dist/locales/tr-TR.js +2 -0
- package/dist/locales/types.d.ts +2 -0
- package/dist/locales/vi-VN.js +2 -0
- package/dist/locales/zh-CN.js +2 -0
- package/dist/locales/zh-TW.js +2 -0
- package/dist/number-input/format.js +1 -1
- package/dist/number-input/use-number-input.js +166 -321
- package/dist/number-input/validate.d.ts +1 -0
- package/dist/number-input/validate.js +1 -1
- package/dist/provider/tao-provider.d.ts +2 -2
- package/dist/provider/tao-provider.js +49 -49
- package/dist/utils/composed-parent.d.ts +1 -0
- package/dist/utils/composed-parent.js +7 -0
- package/dist/utils/portal.d.ts +5 -0
- package/dist/utils/portal.js +7 -1
- package/dist/utils/refs.d.ts +3 -1
- package/dist/utils/refs.js +25 -1
- package/package.json +1 -1
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { c } from "react-compiler-runtime";
|
|
3
3
|
import { Slot } from "@radix-ui/react-slot";
|
|
4
|
-
import { createContext, useContext, useLayoutEffect, useRef, useState } from "react";
|
|
4
|
+
import { createContext, forwardRef, useContext, useLayoutEffect, useRef, useState } from "react";
|
|
5
5
|
import { taoTokenVars } from "../theme/tokens.js";
|
|
6
|
+
import { getComposedParent } from "../utils/composed-parent.js";
|
|
6
7
|
import { enUS, zhCN } from "./locale.js";
|
|
7
8
|
import { mergeLocale } from "./merge-locale.js";
|
|
8
9
|
const TaoConfigContext = /*#__PURE__*/ createContext({
|
|
@@ -43,12 +44,6 @@ function useTaoConfig() {
|
|
|
43
44
|
function useTaoInternalConfig() {
|
|
44
45
|
return useContext(TaoConfigContext);
|
|
45
46
|
}
|
|
46
|
-
function directionParent(element) {
|
|
47
|
-
if (element.assignedSlot) return element.assignedSlot;
|
|
48
|
-
if (element.parentElement) return element.parentElement;
|
|
49
|
-
const root = element.getRootNode();
|
|
50
|
-
return 'host' in root ? root.host : null;
|
|
51
|
-
}
|
|
52
47
|
function useTaoDirection(explicit, t0) {
|
|
53
48
|
const $ = c(8);
|
|
54
49
|
const source = void 0 === t0 ? "parent" : t0;
|
|
@@ -60,12 +55,12 @@ function useTaoDirection(explicit, t0) {
|
|
|
60
55
|
if ($[0] !== contextDirection || $[1] !== element || $[2] !== explicit || $[3] !== source) {
|
|
61
56
|
t1 = ()=>{
|
|
62
57
|
if (explicit && "auto" !== explicit || !element) return;
|
|
63
|
-
const target = "self" === source || "auto" === explicit ? element :
|
|
58
|
+
const target = "self" === source || "auto" === explicit ? element : getComposedParent(element);
|
|
64
59
|
if (!target) return;
|
|
65
60
|
const update = ()=>{
|
|
66
61
|
const value = getComputedStyle(target).direction || target.closest("[dir]")?.getAttribute("dir") || contextDirection;
|
|
67
62
|
setInherited("rtl" === value ? "rtl" : "ltr");
|
|
68
|
-
for(let ancestor = target; ancestor; ancestor =
|
|
63
|
+
for(let ancestor = target; ancestor; ancestor = getComposedParent(ancestor)){
|
|
69
64
|
const auto = "auto" === ancestor.getAttribute("dir");
|
|
70
65
|
observer.observe(ancestor, {
|
|
71
66
|
attributes: true,
|
|
@@ -124,8 +119,8 @@ function useTaoToken() {
|
|
|
124
119
|
} else t0 = $[0];
|
|
125
120
|
return t0;
|
|
126
121
|
}
|
|
127
|
-
|
|
128
|
-
const $ = c(
|
|
122
|
+
const tao_provider_TaoPortalScope = /*#__PURE__*/ forwardRef(function(t0, ref) {
|
|
123
|
+
const $ = c(33);
|
|
129
124
|
const { children, style, asChild, direction: directionProp } = t0;
|
|
130
125
|
const config = useTaoInternalConfig();
|
|
131
126
|
const { tokenStyle, mode, compact } = config;
|
|
@@ -171,8 +166,9 @@ function TaoPortalScope(t0) {
|
|
|
171
166
|
$[9] = t4;
|
|
172
167
|
} else t4 = $[9];
|
|
173
168
|
let t5;
|
|
174
|
-
if ($[10] !== children || $[11] !== densityAttr || $[12] !== direction || $[13] !==
|
|
169
|
+
if ($[10] !== children || $[11] !== densityAttr || $[12] !== direction || $[13] !== ref || $[14] !== t4 || $[15] !== themeAttr) {
|
|
175
170
|
t5 = /*#__PURE__*/ jsx(Slot, {
|
|
171
|
+
ref: ref,
|
|
176
172
|
dir: direction,
|
|
177
173
|
"data-tao-provider": "",
|
|
178
174
|
...themeAttr,
|
|
@@ -183,62 +179,66 @@ function TaoPortalScope(t0) {
|
|
|
183
179
|
$[10] = children;
|
|
184
180
|
$[11] = densityAttr;
|
|
185
181
|
$[12] = direction;
|
|
186
|
-
$[13] =
|
|
187
|
-
$[14] =
|
|
188
|
-
$[15] =
|
|
189
|
-
|
|
182
|
+
$[13] = ref;
|
|
183
|
+
$[14] = t4;
|
|
184
|
+
$[15] = themeAttr;
|
|
185
|
+
$[16] = t5;
|
|
186
|
+
} else t5 = $[16];
|
|
190
187
|
let t6;
|
|
191
|
-
if ($[
|
|
188
|
+
if ($[17] !== portalConfig || $[18] !== t5) {
|
|
192
189
|
t6 = /*#__PURE__*/ jsx(TaoConfigContext.Provider, {
|
|
193
190
|
value: portalConfig,
|
|
194
191
|
children: t5
|
|
195
192
|
});
|
|
196
|
-
$[
|
|
197
|
-
$[
|
|
198
|
-
$[
|
|
199
|
-
} else t6 = $[
|
|
193
|
+
$[17] = portalConfig;
|
|
194
|
+
$[18] = t5;
|
|
195
|
+
$[19] = t6;
|
|
196
|
+
} else t6 = $[19];
|
|
200
197
|
return t6;
|
|
201
198
|
}
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
199
|
+
const t4 = ref;
|
|
200
|
+
let t5;
|
|
201
|
+
if ($[20] !== style || $[21] !== tokenStyle) {
|
|
202
|
+
t5 = {
|
|
205
203
|
display: "contents",
|
|
206
204
|
...tokenStyle,
|
|
207
205
|
...style
|
|
208
206
|
};
|
|
209
|
-
$[
|
|
210
|
-
$[
|
|
211
|
-
$[
|
|
212
|
-
} else
|
|
213
|
-
let
|
|
214
|
-
if ($[
|
|
215
|
-
|
|
207
|
+
$[20] = style;
|
|
208
|
+
$[21] = tokenStyle;
|
|
209
|
+
$[22] = t5;
|
|
210
|
+
} else t5 = $[22];
|
|
211
|
+
let t6;
|
|
212
|
+
if ($[23] !== children || $[24] !== densityAttr || $[25] !== direction || $[26] !== t4 || $[27] !== t5 || $[28] !== themeAttr) {
|
|
213
|
+
t6 = /*#__PURE__*/ jsx("div", {
|
|
214
|
+
ref: t4,
|
|
216
215
|
dir: direction,
|
|
217
216
|
"data-tao-provider": "",
|
|
218
217
|
...themeAttr,
|
|
219
218
|
...densityAttr,
|
|
220
|
-
style:
|
|
219
|
+
style: t5,
|
|
221
220
|
children: children
|
|
222
221
|
});
|
|
223
|
-
$[
|
|
224
|
-
$[
|
|
225
|
-
$[
|
|
226
|
-
$[
|
|
227
|
-
$[26] = themeAttr;
|
|
222
|
+
$[23] = children;
|
|
223
|
+
$[24] = densityAttr;
|
|
224
|
+
$[25] = direction;
|
|
225
|
+
$[26] = t4;
|
|
228
226
|
$[27] = t5;
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
227
|
+
$[28] = themeAttr;
|
|
228
|
+
$[29] = t6;
|
|
229
|
+
} else t6 = $[29];
|
|
230
|
+
let t7;
|
|
231
|
+
if ($[30] !== portalConfig || $[31] !== t6) {
|
|
232
|
+
t7 = /*#__PURE__*/ jsx(TaoConfigContext.Provider, {
|
|
233
233
|
value: portalConfig,
|
|
234
|
-
children:
|
|
234
|
+
children: t6
|
|
235
235
|
});
|
|
236
|
-
$[
|
|
237
|
-
$[
|
|
238
|
-
$[
|
|
239
|
-
} else
|
|
240
|
-
return
|
|
241
|
-
}
|
|
236
|
+
$[30] = portalConfig;
|
|
237
|
+
$[31] = t6;
|
|
238
|
+
$[32] = t7;
|
|
239
|
+
} else t7 = $[32];
|
|
240
|
+
return t7;
|
|
241
|
+
});
|
|
242
242
|
const TOKEN_TO_VAR = {
|
|
243
243
|
colorPrimary: '--tao-color-primary',
|
|
244
244
|
colorSuccess: '--tao-color-success',
|
|
@@ -485,4 +485,4 @@ function TaoProvider(t0) {
|
|
|
485
485
|
} else t12 = $[36];
|
|
486
486
|
return t12;
|
|
487
487
|
}
|
|
488
|
-
export {
|
|
488
|
+
export { TaoProvider, enUS, tao_provider_TaoPortalScope as TaoPortalScope, useTaoConfig, useTaoDirection, useTaoInternalConfig, useTaoToken, zhCN };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function getComposedParent(element: Element): Element | null;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
function getComposedParent(element) {
|
|
2
|
+
if (element.assignedSlot) return element.assignedSlot;
|
|
3
|
+
if (element.parentElement) return element.parentElement;
|
|
4
|
+
const root = element.getRootNode();
|
|
5
|
+
return 'host' in root ? root.host : null;
|
|
6
|
+
}
|
|
7
|
+
export { getComposedParent };
|
package/dist/utils/portal.d.ts
CHANGED
|
@@ -2,3 +2,8 @@
|
|
|
2
2
|
export declare function preventParentOutsideDismiss(event: {
|
|
3
3
|
preventDefault: () => void;
|
|
4
4
|
}): void;
|
|
5
|
+
/**
|
|
6
|
+
* Dialogs see Escape first (document capture). An expanded combobox inside
|
|
7
|
+
* them owns that key: it closes its popup and leaves the dialog open.
|
|
8
|
+
*/
|
|
9
|
+
export declare function isEscapeForOpenCombobox(event: KeyboardEvent): boolean;
|
package/dist/utils/portal.js
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
function preventParentOutsideDismiss(event) {
|
|
2
2
|
event.preventDefault();
|
|
3
3
|
}
|
|
4
|
-
|
|
4
|
+
function isEscapeForOpenCombobox(event) {
|
|
5
|
+
const target = event.target;
|
|
6
|
+
if (!(target instanceof Element) || 'true' !== target.getAttribute('aria-expanded')) return false;
|
|
7
|
+
const popup = target.getAttribute('aria-haspopup');
|
|
8
|
+
return 'combobox' === target.getAttribute('role') || null != popup && 'false' !== popup;
|
|
9
|
+
}
|
|
10
|
+
export { isEscapeForOpenCombobox, preventParentOutsideDismiss };
|
package/dist/utils/refs.d.ts
CHANGED
|
@@ -1,2 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type Ref } from 'react';
|
|
2
|
+
/** Timers and document listeners only see values from committed renders. */
|
|
3
|
+
export declare function useCommittedRef<T>(value: T): import("react").RefObject<T>;
|
|
2
4
|
export declare function mergeRefs<T>(...refs: Array<Ref<T> | undefined>): (value: T | null) => void;
|
package/dist/utils/refs.js
CHANGED
|
@@ -1,3 +1,27 @@
|
|
|
1
|
+
import { c } from "react-compiler-runtime";
|
|
2
|
+
import { useLayoutEffect, useRef } from "react";
|
|
3
|
+
function useCommittedRef(value) {
|
|
4
|
+
const $ = c(3);
|
|
5
|
+
const ref = useRef(value);
|
|
6
|
+
let t0;
|
|
7
|
+
let t1;
|
|
8
|
+
if ($[0] !== value) {
|
|
9
|
+
t0 = ()=>{
|
|
10
|
+
ref.current = value;
|
|
11
|
+
};
|
|
12
|
+
t1 = [
|
|
13
|
+
value
|
|
14
|
+
];
|
|
15
|
+
$[0] = value;
|
|
16
|
+
$[1] = t0;
|
|
17
|
+
$[2] = t1;
|
|
18
|
+
} else {
|
|
19
|
+
t0 = $[1];
|
|
20
|
+
t1 = $[2];
|
|
21
|
+
}
|
|
22
|
+
useLayoutEffect(t0, t1);
|
|
23
|
+
return ref;
|
|
24
|
+
}
|
|
1
25
|
function mergeRefs(...refs) {
|
|
2
26
|
let cleanups = [];
|
|
3
27
|
return (value)=>{
|
|
@@ -19,4 +43,4 @@ function mergeRefs(...refs) {
|
|
|
19
43
|
}
|
|
20
44
|
};
|
|
21
45
|
}
|
|
22
|
-
export { mergeRefs };
|
|
46
|
+
export { mergeRefs, useCommittedRef };
|