@rockshin/tao-ui 0.0.58 → 0.0.60
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 +18 -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.css +1 -1
- package/dist/components/color-picker/color-picker.js +386 -362
- package/dist/components/context-menu/context-menu.d.ts +3 -1
- package/dist/components/context-menu/context-menu.js +48 -43
- 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 +93 -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 +25 -14
- package/dist/components/date-picker/range-picker.d.ts +2 -0
- package/dist/components/date-picker/range-picker.js +132 -73
- 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.d.ts +1 -0
- package/dist/components/dropdown/dropdown.js +29 -21
- package/dist/components/float-button/float-button.js +6 -5
- package/dist/components/form/form-item.d.ts +1 -1
- package/dist/components/form/form-item.js +160 -120
- package/dist/components/form/use-form.js +2 -1
- 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/input-number/input-number.d.ts +2 -1
- package/dist/components/input-number/input-number.js +67 -52
- package/dist/components/mentions/mentions.js +4 -2
- package/dist/components/menu/menu-render.d.ts +6 -0
- package/dist/components/menu/menu-render.js +39 -26
- package/dist/components/modal/confirm-dialog.js +22 -10
- package/dist/components/modal/modal.js +320 -315
- package/dist/components/modal/use-modal.js +1 -1
- package/dist/components/pagination/pagination.d.ts +4 -2
- package/dist/components/pagination/pagination.js +128 -117
- package/dist/components/popover/popover.js +214 -351
- 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 +7 -4
- package/dist/components/select/select-model.js +3 -3
- package/dist/components/select/select.js +78 -39
- package/dist/components/select/use-select-selection.js +100 -92
- 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/statistic/statistic.js +38 -31
- package/dist/components/switch/switch.js +45 -39
- package/dist/components/table/table-filter.d.ts +3 -1
- package/dist/components/table/table-filter.js +100 -74
- package/dist/components/table/table.js +2 -0
- package/dist/components/table/use-table-data.js +2 -2
- package/dist/components/tabs/tabs.d.ts +3 -2
- package/dist/components/tabs/tabs.js +122 -112
- package/dist/components/time-picker/time-picker.js +35 -3
- package/dist/components/tooltip/tooltip.d.ts +1 -1
- package/dist/components/tooltip/tooltip.js +220 -124
- package/dist/components/tree/tree.js +31 -3
- package/dist/components/tree-select/tree-select.js +2 -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.d.ts +1 -0
- package/dist/number-input/use-number-input.js +170 -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 +66 -52
- package/dist/theme/control.css +5 -1
- package/dist/theme/theme.css +2 -2
- 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,14 +55,28 @@ 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
|
+
let resolved;
|
|
62
|
+
for(let ancestor = target; ancestor; ancestor = getComposedParent(ancestor)){
|
|
63
|
+
const inlineDir = ancestor.style?.direction;
|
|
64
|
+
if ("rtl" === inlineDir || "ltr" === inlineDir) {
|
|
65
|
+
resolved = inlineDir;
|
|
66
|
+
break;
|
|
67
|
+
}
|
|
68
|
+
const attrDir = ancestor.getAttribute("dir");
|
|
69
|
+
if ("rtl" === attrDir || "ltr" === attrDir) {
|
|
70
|
+
resolved = attrDir;
|
|
71
|
+
break;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
const computed = getComputedStyle(target).direction;
|
|
75
|
+
const value = resolved ?? ("rtl" === computed ? "rtl" : contextDirection ?? "ltr");
|
|
67
76
|
setInherited("rtl" === value ? "rtl" : "ltr");
|
|
68
|
-
for(let
|
|
69
|
-
const auto = "auto" ===
|
|
70
|
-
observer.observe(
|
|
77
|
+
for(let ancestor_0 = target; ancestor_0; ancestor_0 = getComposedParent(ancestor_0)){
|
|
78
|
+
const auto = "auto" === ancestor_0.getAttribute("dir");
|
|
79
|
+
observer.observe(ancestor_0, {
|
|
71
80
|
attributes: true,
|
|
72
81
|
attributeFilter: [
|
|
73
82
|
"dir",
|
|
@@ -124,8 +133,8 @@ function useTaoToken() {
|
|
|
124
133
|
} else t0 = $[0];
|
|
125
134
|
return t0;
|
|
126
135
|
}
|
|
127
|
-
|
|
128
|
-
const $ = c(
|
|
136
|
+
const tao_provider_TaoPortalScope = /*#__PURE__*/ forwardRef(function(t0, ref) {
|
|
137
|
+
const $ = c(33);
|
|
129
138
|
const { children, style, asChild, direction: directionProp } = t0;
|
|
130
139
|
const config = useTaoInternalConfig();
|
|
131
140
|
const { tokenStyle, mode, compact } = config;
|
|
@@ -171,8 +180,9 @@ function TaoPortalScope(t0) {
|
|
|
171
180
|
$[9] = t4;
|
|
172
181
|
} else t4 = $[9];
|
|
173
182
|
let t5;
|
|
174
|
-
if ($[10] !== children || $[11] !== densityAttr || $[12] !== direction || $[13] !==
|
|
183
|
+
if ($[10] !== children || $[11] !== densityAttr || $[12] !== direction || $[13] !== ref || $[14] !== t4 || $[15] !== themeAttr) {
|
|
175
184
|
t5 = /*#__PURE__*/ jsx(Slot, {
|
|
185
|
+
ref: ref,
|
|
176
186
|
dir: direction,
|
|
177
187
|
"data-tao-provider": "",
|
|
178
188
|
...themeAttr,
|
|
@@ -183,62 +193,66 @@ function TaoPortalScope(t0) {
|
|
|
183
193
|
$[10] = children;
|
|
184
194
|
$[11] = densityAttr;
|
|
185
195
|
$[12] = direction;
|
|
186
|
-
$[13] =
|
|
187
|
-
$[14] =
|
|
188
|
-
$[15] =
|
|
189
|
-
|
|
196
|
+
$[13] = ref;
|
|
197
|
+
$[14] = t4;
|
|
198
|
+
$[15] = themeAttr;
|
|
199
|
+
$[16] = t5;
|
|
200
|
+
} else t5 = $[16];
|
|
190
201
|
let t6;
|
|
191
|
-
if ($[
|
|
202
|
+
if ($[17] !== portalConfig || $[18] !== t5) {
|
|
192
203
|
t6 = /*#__PURE__*/ jsx(TaoConfigContext.Provider, {
|
|
193
204
|
value: portalConfig,
|
|
194
205
|
children: t5
|
|
195
206
|
});
|
|
196
|
-
$[
|
|
197
|
-
$[
|
|
198
|
-
$[
|
|
199
|
-
} else t6 = $[
|
|
207
|
+
$[17] = portalConfig;
|
|
208
|
+
$[18] = t5;
|
|
209
|
+
$[19] = t6;
|
|
210
|
+
} else t6 = $[19];
|
|
200
211
|
return t6;
|
|
201
212
|
}
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
213
|
+
const t4 = ref;
|
|
214
|
+
let t5;
|
|
215
|
+
if ($[20] !== style || $[21] !== tokenStyle) {
|
|
216
|
+
t5 = {
|
|
205
217
|
display: "contents",
|
|
206
218
|
...tokenStyle,
|
|
207
219
|
...style
|
|
208
220
|
};
|
|
209
|
-
$[
|
|
210
|
-
$[
|
|
211
|
-
$[
|
|
212
|
-
} else
|
|
213
|
-
let
|
|
214
|
-
if ($[
|
|
215
|
-
|
|
221
|
+
$[20] = style;
|
|
222
|
+
$[21] = tokenStyle;
|
|
223
|
+
$[22] = t5;
|
|
224
|
+
} else t5 = $[22];
|
|
225
|
+
let t6;
|
|
226
|
+
if ($[23] !== children || $[24] !== densityAttr || $[25] !== direction || $[26] !== t4 || $[27] !== t5 || $[28] !== themeAttr) {
|
|
227
|
+
t6 = /*#__PURE__*/ jsx("div", {
|
|
228
|
+
ref: t4,
|
|
216
229
|
dir: direction,
|
|
217
230
|
"data-tao-provider": "",
|
|
218
231
|
...themeAttr,
|
|
219
232
|
...densityAttr,
|
|
220
|
-
style:
|
|
233
|
+
style: t5,
|
|
221
234
|
children: children
|
|
222
235
|
});
|
|
223
|
-
$[
|
|
224
|
-
$[
|
|
225
|
-
$[
|
|
226
|
-
$[
|
|
227
|
-
$[26] = themeAttr;
|
|
236
|
+
$[23] = children;
|
|
237
|
+
$[24] = densityAttr;
|
|
238
|
+
$[25] = direction;
|
|
239
|
+
$[26] = t4;
|
|
228
240
|
$[27] = t5;
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
241
|
+
$[28] = themeAttr;
|
|
242
|
+
$[29] = t6;
|
|
243
|
+
} else t6 = $[29];
|
|
244
|
+
let t7;
|
|
245
|
+
if ($[30] !== portalConfig || $[31] !== t6) {
|
|
246
|
+
t7 = /*#__PURE__*/ jsx(TaoConfigContext.Provider, {
|
|
233
247
|
value: portalConfig,
|
|
234
|
-
children:
|
|
248
|
+
children: t6
|
|
235
249
|
});
|
|
236
|
-
$[
|
|
237
|
-
$[
|
|
238
|
-
$[
|
|
239
|
-
} else
|
|
240
|
-
return
|
|
241
|
-
}
|
|
250
|
+
$[30] = portalConfig;
|
|
251
|
+
$[31] = t6;
|
|
252
|
+
$[32] = t7;
|
|
253
|
+
} else t7 = $[32];
|
|
254
|
+
return t7;
|
|
255
|
+
});
|
|
242
256
|
const TOKEN_TO_VAR = {
|
|
243
257
|
colorPrimary: '--tao-color-primary',
|
|
244
258
|
colorSuccess: '--tao-color-success',
|
|
@@ -485,4 +499,4 @@ function TaoProvider(t0) {
|
|
|
485
499
|
} else t12 = $[36];
|
|
486
500
|
return t12;
|
|
487
501
|
}
|
|
488
|
-
export {
|
|
502
|
+
export { TaoProvider, enUS, tao_provider_TaoPortalScope as TaoPortalScope, useTaoConfig, useTaoDirection, useTaoInternalConfig, useTaoToken, zhCN };
|
package/dist/theme/control.css
CHANGED
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
[data-tao-control][data-tao-variant="outlined"][data-tao-warning]:hover:not([data-disabled]):not(:focus-within) {
|
|
50
|
-
border-color: color-mix(in
|
|
50
|
+
border-color: color-mix(in oklab, var(--tao-color-warning) 80%, white);
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
[data-tao-control][data-tao-variant="outlined"][data-tao-warning]:focus-within, [data-tao-control][data-tao-variant="outlined"][data-tao-warning][data-state="open"] {
|
|
@@ -134,6 +134,10 @@
|
|
|
134
134
|
border-block-end-color: var(--tao-error);
|
|
135
135
|
}
|
|
136
136
|
|
|
137
|
+
[data-tao-control][data-tao-variant="borderless"][data-tao-warning] {
|
|
138
|
+
border-block-end-color: var(--tao-warning);
|
|
139
|
+
}
|
|
140
|
+
|
|
137
141
|
[data-tao-control][data-tao-variant="borderless"][data-disabled], [data-tao-control][data-tao-variant="borderless"]:has(input:disabled) {
|
|
138
142
|
color: var(--tao-color-text-disabled);
|
|
139
143
|
cursor: not-allowed;
|
package/dist/theme/theme.css
CHANGED
|
@@ -47,8 +47,8 @@
|
|
|
47
47
|
var(--tao-color-bg-base));
|
|
48
48
|
--tao-primary-fg: var(--tao-color-bg-base);
|
|
49
49
|
--tao-error: var(--tao-color-error);
|
|
50
|
-
--tao-error-hover: color-mix(in
|
|
51
|
-
--tao-error-active: color-mix(in
|
|
50
|
+
--tao-error-hover: color-mix(in oklab, var(--tao-color-error) 80%, white);
|
|
51
|
+
--tao-error-active: color-mix(in oklab, var(--tao-color-error) 90%, black);
|
|
52
52
|
--tao-error-bg: color-mix(in oklab,
|
|
53
53
|
var(--tao-color-error) 6%,
|
|
54
54
|
var(--tao-color-bg-base));
|
|
@@ -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 };
|