@rainbow-oh/yee-c 0.7.0 → 0.8.1
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/LICENSE +1 -1
- package/README.md +40 -25
- package/dist/cjs/Card/card.js +7 -3
- package/dist/cjs/Carousel/carousel-item.js +7 -2
- package/dist/cjs/Carousel/carousel.js +31 -4
- package/dist/cjs/Cascader/cascader.js +1 -1
- package/dist/cjs/Cascader/column.js +1 -1
- package/dist/cjs/Cascader/node.js +16 -4
- package/dist/cjs/Cascader/search-list.js +13 -4
- package/dist/cjs/Checkbox/checkbox-group.js +1 -1
- package/dist/cjs/Checkbox/checkbox.js +6 -3
- package/dist/cjs/Collapse/panel.js +10 -1
- package/dist/cjs/Dialog/dialog.js +22 -7
- package/dist/cjs/Drawer/drawer.js +14 -5
- package/dist/cjs/Form/form-store.d.ts +2 -1
- package/dist/cjs/Form/form-store.js +32 -17
- package/dist/cjs/Menu/menu-item.js +14 -5
- package/dist/cjs/Menu/menu.js +10 -2
- package/dist/cjs/Pagination/items.js +10 -5
- package/dist/cjs/Pagination/pagination.js +9 -3
- package/dist/cjs/Radio/radio-group.js +6 -5
- package/dist/cjs/Radio/radio.js +39 -29
- package/dist/cjs/Rate/rate.js +6 -1
- package/dist/cjs/Rate/star.js +7 -3
- package/dist/cjs/Steps/step.js +7 -5
- package/dist/cjs/Steps/steps.js +1 -1
- package/dist/cjs/Table/hooks/useColumns.js +1 -1
- package/dist/cjs/Table/style/index.less +35 -11
- package/dist/cjs/Table/table.js +57 -7
- package/dist/cjs/Table/tbody/cell.js +1 -1
- package/dist/cjs/Table/util/header.d.ts +3 -1
- package/dist/cjs/Table/util/header.js +30 -3
- package/dist/cjs/Tabs/tab-content.js +3 -1
- package/dist/cjs/Tabs/tab-header/index.js +3 -1
- package/dist/cjs/Tabs/tab-header/tab-header-title.js +3 -1
- package/dist/cjs/hooks/useDelayState.js +3 -2
- package/dist/cjs/hooks/useFocusManage.d.ts +1 -1
- package/dist/cjs/hooks/useFocusManage.js +27 -22
- package/dist/cjs/style/color.css +2 -0
- package/dist/cjs/style/themes.css +1 -1
- package/dist/cjs/style/variables.css +3 -1
- package/dist/cjs/utils/focusStack.d.ts +6 -2
- package/dist/cjs/utils/focusStack.js +40 -11
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/Card/card.js +7 -3
- package/dist/esm/Carousel/carousel-item.js +7 -2
- package/dist/esm/Carousel/carousel.js +31 -4
- package/dist/esm/Cascader/cascader.js +3 -1
- package/dist/esm/Cascader/column.js +2 -1
- package/dist/esm/Cascader/node.js +18 -4
- package/dist/esm/Cascader/search-list.js +18 -4
- package/dist/esm/Checkbox/checkbox-group.js +3 -1
- package/dist/esm/Checkbox/checkbox.js +6 -3
- package/dist/esm/Collapse/panel.js +11 -2
- package/dist/esm/Dialog/dialog.js +26 -9
- package/dist/esm/Drawer/drawer.js +16 -7
- package/dist/esm/Form/form-store.d.ts +2 -1
- package/dist/esm/Form/form-store.js +40 -19
- package/dist/esm/Menu/menu-item.js +16 -5
- package/dist/esm/Menu/menu.js +11 -5
- package/dist/esm/Pagination/items.js +14 -5
- package/dist/esm/Pagination/pagination.js +16 -4
- package/dist/esm/Radio/radio-group.js +5 -4
- package/dist/esm/Radio/radio.js +5 -4
- package/dist/esm/Rate/rate.js +6 -1
- package/dist/esm/Rate/star.js +12 -4
- package/dist/esm/Steps/step.js +12 -6
- package/dist/esm/Steps/steps.js +3 -1
- package/dist/esm/Table/hooks/useColumns.js +1 -1
- package/dist/esm/Table/style/index.less +35 -11
- package/dist/esm/Table/table.js +54 -2
- package/dist/esm/Table/tbody/cell.js +1 -1
- package/dist/esm/Table/util/header.d.ts +3 -1
- package/dist/esm/Table/util/header.js +30 -2
- package/dist/esm/Tabs/tab-content.js +3 -1
- package/dist/esm/Tabs/tab-header/index.js +3 -1
- package/dist/esm/Tabs/tab-header/tab-header-title.js +3 -1
- package/dist/esm/hooks/useDelayState.js +5 -2
- package/dist/esm/hooks/useFocusManage.d.ts +1 -1
- package/dist/esm/hooks/useFocusManage.js +31 -13
- package/dist/esm/style/color.css +2 -0
- package/dist/esm/style/themes.css +1 -1
- package/dist/esm/style/variables.css +3 -1
- package/dist/esm/utils/focusStack.d.ts +6 -2
- package/dist/esm/utils/focusStack.js +37 -14
- package/dist/esm/version.d.ts +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/umd/yee-c.min.css +3 -3
- package/dist/umd/yee-c.min.js +1 -1
- package/package.json +10 -6
- package/src/Card/card.tsx +5 -1
- package/src/Carousel/carousel-item.tsx +7 -1
- package/src/Carousel/carousel.tsx +30 -3
- package/src/Cascader/cascader.tsx +1 -1
- package/src/Cascader/column.tsx +1 -1
- package/src/Cascader/node.tsx +14 -2
- package/src/Cascader/search-list.tsx +11 -2
- package/src/Checkbox/checkbox-group.tsx +1 -1
- package/src/Checkbox/checkbox.tsx +3 -0
- package/src/Collapse/panel.tsx +11 -1
- package/src/Dialog/dialog.tsx +31 -6
- package/src/Drawer/drawer.tsx +12 -3
- package/src/Form/form-store.ts +42 -15
- package/src/Menu/menu-item.tsx +12 -3
- package/src/Menu/menu.tsx +11 -5
- package/src/Pagination/items.tsx +9 -4
- package/src/Pagination/pagination.tsx +10 -4
- package/src/Radio/radio-group.tsx +2 -1
- package/src/Radio/radio.tsx +7 -2
- package/src/Rate/rate.tsx +5 -0
- package/src/Rate/star.tsx +8 -4
- package/src/Steps/step.tsx +15 -5
- package/src/Steps/steps.tsx +1 -1
- package/src/Table/hooks/useColumns.ts +1 -1
- package/src/Table/style/index.less +35 -11
- package/src/Table/table.tsx +60 -1
- package/src/Table/tbody/cell.tsx +1 -1
- package/src/Table/util/header.ts +48 -2
- package/src/Tabs/tab-content.tsx +2 -0
- package/src/Tabs/tab-header/index.tsx +2 -0
- package/src/Tabs/tab-header/tab-header-title.tsx +3 -1
- package/src/hooks/useDelayState.ts +4 -2
- package/src/hooks/useFocusManage.ts +33 -17
- package/src/style/color.css +2 -0
- package/src/utils/focusStack.ts +55 -12
- package/src/version.ts +1 -1
package/dist/cjs/Table/table.js
CHANGED
|
@@ -189,6 +189,28 @@ var Table = import_react.default.forwardRef((baseprops, ref) => {
|
|
|
189
189
|
onChange: onSelectionChange
|
|
190
190
|
} = (0, import_useSelection.default)({ pageData, dataSource, getRowKey, rowSelection, allKeys });
|
|
191
191
|
const prevSortersRef = (0, import_react.useRef)({});
|
|
192
|
+
const contentWrapperRef = (0, import_react.useRef)(null);
|
|
193
|
+
const contentRef = (0, import_react.useRef)(null);
|
|
194
|
+
const [horizontalScroll, setHorizontalScroll] = import_react.default.useState({
|
|
195
|
+
left: false,
|
|
196
|
+
right: false
|
|
197
|
+
});
|
|
198
|
+
const updateHorizontalScroll = import_react.default.useCallback(() => {
|
|
199
|
+
const wrapper = contentWrapperRef.current;
|
|
200
|
+
const content = contentRef.current;
|
|
201
|
+
if (!wrapper || !content)
|
|
202
|
+
return;
|
|
203
|
+
const scrollContainer = content.scrollWidth - content.clientWidth > 1 ? content : wrapper;
|
|
204
|
+
const maxScrollLeft = scrollContainer.scrollWidth - scrollContainer.clientWidth;
|
|
205
|
+
const hasHorizontalScroll = maxScrollLeft > 1;
|
|
206
|
+
const next = {
|
|
207
|
+
left: hasHorizontalScroll && scrollContainer.scrollLeft > 1,
|
|
208
|
+
right: hasHorizontalScroll && scrollContainer.scrollLeft < maxScrollLeft - 1
|
|
209
|
+
};
|
|
210
|
+
setHorizontalScroll(
|
|
211
|
+
(current2) => current2.left === next.left && current2.right === next.right ? current2 : next
|
|
212
|
+
);
|
|
213
|
+
}, []);
|
|
192
214
|
const onFilter = import_react.default.useCallback(
|
|
193
215
|
(...args) => {
|
|
194
216
|
onFilterInternal(...args);
|
|
@@ -229,6 +251,21 @@ var Table = import_react.default.forwardRef((baseprops, ref) => {
|
|
|
229
251
|
return;
|
|
230
252
|
}
|
|
231
253
|
}, [sorters, current, pageSize, pageData, sortedData, onChange]);
|
|
254
|
+
(0, import_react.useEffect)(() => {
|
|
255
|
+
updateHorizontalScroll();
|
|
256
|
+
const wrapper = contentWrapperRef.current;
|
|
257
|
+
const content = contentRef.current;
|
|
258
|
+
if (!wrapper || !content)
|
|
259
|
+
return void 0;
|
|
260
|
+
if (typeof ResizeObserver === "undefined") {
|
|
261
|
+
window.addEventListener("resize", updateHorizontalScroll);
|
|
262
|
+
return () => window.removeEventListener("resize", updateHorizontalScroll);
|
|
263
|
+
}
|
|
264
|
+
const resizeObserver = new ResizeObserver(updateHorizontalScroll);
|
|
265
|
+
resizeObserver.observe(wrapper);
|
|
266
|
+
resizeObserver.observe(content);
|
|
267
|
+
return () => resizeObserver.disconnect();
|
|
268
|
+
}, [updateHorizontalScroll, wrapedColumns, pageData, scroll == null ? void 0 : scroll.x]);
|
|
232
269
|
const renderHeader = () => {
|
|
233
270
|
return /* @__PURE__ */ import_react.default.createElement(
|
|
234
271
|
import_header.default,
|
|
@@ -305,17 +342,30 @@ var Table = import_react.default.forwardRef((baseprops, ref) => {
|
|
|
305
342
|
},
|
|
306
343
|
/* @__PURE__ */ import_react.default.createElement("table", __spreadValues({}, tableProps), /* @__PURE__ */ import_react.default.createElement(import_col_group.default, { columns: wrapedColumns }), renderTHeader(), renderTBody(), renderTFooter())
|
|
307
344
|
);
|
|
308
|
-
return /* @__PURE__ */ import_react.default.createElement(
|
|
345
|
+
return /* @__PURE__ */ import_react.default.createElement(
|
|
309
346
|
"div",
|
|
310
347
|
{
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
[`${prefixCls}-
|
|
348
|
+
ref: contentWrapperRef,
|
|
349
|
+
className: (0, import_clsx.default)(`${prefixCls}-content-wrapper`, {
|
|
350
|
+
[`${prefixCls}-content-wrapper-scroll-left`]: horizontalScroll.left,
|
|
351
|
+
[`${prefixCls}-content-wrapper-scroll-right`]: horizontalScroll.right
|
|
314
352
|
}),
|
|
315
|
-
|
|
353
|
+
onScroll: updateHorizontalScroll
|
|
316
354
|
},
|
|
317
|
-
|
|
318
|
-
|
|
355
|
+
/* @__PURE__ */ import_react.default.createElement(
|
|
356
|
+
"div",
|
|
357
|
+
{
|
|
358
|
+
ref: contentRef,
|
|
359
|
+
className: (0, import_clsx.default)(`${prefixCls}-content`, {
|
|
360
|
+
[`${prefixCls}-${size}-size`]: size,
|
|
361
|
+
[`${prefixCls}-fixed-header`]: scroll == null ? void 0 : scroll.y
|
|
362
|
+
}),
|
|
363
|
+
style: { height: scroll == null ? void 0 : scroll.y, width: scroll == null ? void 0 : scroll.x },
|
|
364
|
+
onScroll: updateHorizontalScroll
|
|
365
|
+
},
|
|
366
|
+
table2
|
|
367
|
+
)
|
|
368
|
+
);
|
|
319
369
|
};
|
|
320
370
|
const renderFooter = () => {
|
|
321
371
|
return /* @__PURE__ */ import_react.default.createElement(
|
|
@@ -95,7 +95,7 @@ var TableCell = (props) => {
|
|
|
95
95
|
{
|
|
96
96
|
[`${prefixCls}-cell-fixed-${fixed}`]: fixed,
|
|
97
97
|
[`${prefixCls}-cell-fixed-${fixed}-first`]: isFixedRightFirst,
|
|
98
|
-
[`${prefixCls}-fixed-${fixed}-last`]: isFixedLeftLast
|
|
98
|
+
[`${prefixCls}-cell-fixed-${fixed}-last`]: isFixedLeftLast
|
|
99
99
|
},
|
|
100
100
|
className
|
|
101
101
|
);
|
|
@@ -11,10 +11,12 @@ export declare function flattenLeafColumns(columns: WrapedColumnProps[], parentF
|
|
|
11
11
|
*
|
|
12
12
|
* - Pass 1 (DFS): place each column into the row matching its depth; a group's
|
|
13
13
|
* colSpan equals the sum of its children's colSpans.
|
|
14
|
+
* - Fixed metadata from the resolved leaf columns is reused by leaf cells and
|
|
15
|
+
* aggregated for group cells whose descendants share the same fixed side.
|
|
14
16
|
* - Pass 2: leaf cells (no sub-columns) get rowSpan = rowCount - rowIndex so
|
|
15
17
|
* they stretch down to the last header row; group cells keep rowSpan = 1.
|
|
16
18
|
*/
|
|
17
|
-
export declare function parseHeaderRows(rootColumns: WrapedColumnProps[]): HeaderCell[][];
|
|
19
|
+
export declare function parseHeaderRows(rootColumns: WrapedColumnProps[], resolvedLeafColumns?: WrapedColumnProps[]): HeaderCell[][];
|
|
18
20
|
/**
|
|
19
21
|
* Inject selection / expand columns into the top level of the column tree.
|
|
20
22
|
* `index` is a 1-based position among the top-level columns.
|
|
@@ -52,21 +52,48 @@ function flattenLeafColumns(columns, parentFixed) {
|
|
|
52
52
|
return [...list, __spreadProps(__spreadValues({}, column), { fixed })];
|
|
53
53
|
}, []);
|
|
54
54
|
}
|
|
55
|
-
function parseHeaderRows(rootColumns) {
|
|
55
|
+
function parseHeaderRows(rootColumns, resolvedLeafColumns = flattenLeafColumns(rootColumns)) {
|
|
56
56
|
const rows = [];
|
|
57
|
+
let leafIndex = 0;
|
|
57
58
|
const fillRowCells = (columns, rowIndex) => {
|
|
58
59
|
rows[rowIndex] = rows[rowIndex] || [];
|
|
59
60
|
let colSpanTotal = 0;
|
|
60
|
-
columns.filter(Boolean).forEach((
|
|
61
|
+
columns.filter(Boolean).forEach((sourceColumn) => {
|
|
62
|
+
var _a, _b;
|
|
63
|
+
let column = sourceColumn;
|
|
64
|
+
const subColumns = sourceColumn.children;
|
|
65
|
+
const leafStartIndex = leafIndex;
|
|
61
66
|
const cell = {
|
|
62
67
|
column,
|
|
63
68
|
colSpan: 1,
|
|
64
69
|
rowSpan: 1
|
|
65
70
|
};
|
|
66
|
-
const subColumns = column.children;
|
|
67
71
|
if (subColumns && subColumns.length > 0) {
|
|
68
72
|
cell.colSpan = fillRowCells(subColumns, rowIndex + 1);
|
|
69
73
|
cell.hasSubColumns = true;
|
|
74
|
+
const groupLeaves = resolvedLeafColumns.slice(
|
|
75
|
+
leafStartIndex,
|
|
76
|
+
leafIndex
|
|
77
|
+
);
|
|
78
|
+
const fixed = (_a = groupLeaves[0]) == null ? void 0 : _a.fixed;
|
|
79
|
+
const isFixedGroup = (fixed === "left" || fixed === "right") && groupLeaves.every((leaf) => leaf.fixed === fixed);
|
|
80
|
+
if (isFixedGroup) {
|
|
81
|
+
const offsetLeaf = fixed === "left" ? groupLeaves[0] : groupLeaves[groupLeaves.length - 1];
|
|
82
|
+
const boundaryLeaf = fixed === "left" ? groupLeaves[groupLeaves.length - 1] : groupLeaves[0];
|
|
83
|
+
column = __spreadProps(__spreadValues({}, sourceColumn), {
|
|
84
|
+
fixed,
|
|
85
|
+
style: __spreadProps(__spreadValues({}, sourceColumn.style), {
|
|
86
|
+
[fixed]: (_b = offsetLeaf.style) == null ? void 0 : _b[fixed]
|
|
87
|
+
}),
|
|
88
|
+
isFixedLeftLast: fixed === "left" && boundaryLeaf.isFixedLeftLast,
|
|
89
|
+
isFixedRightFirst: fixed === "right" && boundaryLeaf.isFixedRightFirst
|
|
90
|
+
});
|
|
91
|
+
cell.column = column;
|
|
92
|
+
}
|
|
93
|
+
} else {
|
|
94
|
+
column = resolvedLeafColumns[leafIndex] || sourceColumn;
|
|
95
|
+
cell.column = column;
|
|
96
|
+
leafIndex += 1;
|
|
70
97
|
}
|
|
71
98
|
rows[rowIndex].push(cell);
|
|
72
99
|
colSpanTotal += cell.colSpan;
|
|
@@ -70,9 +70,11 @@ var TabContent = ({
|
|
|
70
70
|
className: `${prefixCls}-tab-content`,
|
|
71
71
|
style: { display: activeKey === key ? "block" : "none" },
|
|
72
72
|
key,
|
|
73
|
+
id: `tabpanel-${key}`,
|
|
73
74
|
role: "tabpanel",
|
|
74
75
|
"aria-labelledby": `tab-${key}`,
|
|
75
|
-
"aria-hidden": activeKey !== key
|
|
76
|
+
"aria-hidden": activeKey !== key,
|
|
77
|
+
tabIndex: activeKey === key ? 0 : -1
|
|
76
78
|
},
|
|
77
79
|
children
|
|
78
80
|
);
|
|
@@ -157,7 +157,9 @@ var TabHeader = (props) => {
|
|
|
157
157
|
{
|
|
158
158
|
className: (0, import_clsx.default)(`${prefixCls}-nav-list`, classNames == null ? void 0 : classNames.list),
|
|
159
159
|
style: styles == null ? void 0 : styles.list,
|
|
160
|
-
ref: navList
|
|
160
|
+
ref: navList,
|
|
161
|
+
role: "tablist",
|
|
162
|
+
"aria-orientation": direction
|
|
161
163
|
},
|
|
162
164
|
items == null ? void 0 : items.map((item, index) => /* @__PURE__ */ import_react.default.createElement(
|
|
163
165
|
import_tab_header_title.default,
|
|
@@ -223,10 +223,12 @@ var TabHeaderTitle = (props) => {
|
|
|
223
223
|
__spreadProps(__spreadValues({}, rest), {
|
|
224
224
|
ref: tabRef,
|
|
225
225
|
role: "tab",
|
|
226
|
+
id: `tab-${$key}`,
|
|
226
227
|
"aria-selected": activeKey === $key,
|
|
227
228
|
"aria-disabled": disabled,
|
|
229
|
+
"aria-controls": `tabpanel-${$key}`,
|
|
228
230
|
className: cls,
|
|
229
|
-
tabIndex: disabled ? -1 : 0,
|
|
231
|
+
tabIndex: disabled ? -1 : activeKey === $key ? 0 : -1,
|
|
230
232
|
onClick: handleTabClick,
|
|
231
233
|
onKeyDown: handleKeyDown
|
|
232
234
|
}),
|
|
@@ -26,9 +26,10 @@ var import_react = require("react");
|
|
|
26
26
|
function useDelayState(state, delay = 0) {
|
|
27
27
|
const [delayState, setDelayState] = (0, import_react.useState)();
|
|
28
28
|
(0, import_react.useEffect)(() => {
|
|
29
|
-
setTimeout(() => {
|
|
29
|
+
const timer = window.setTimeout(() => {
|
|
30
30
|
setDelayState(state);
|
|
31
31
|
}, delay * 1e3);
|
|
32
|
-
|
|
32
|
+
return () => window.clearTimeout(timer);
|
|
33
|
+
}, [delay, state]);
|
|
33
34
|
return delayState;
|
|
34
35
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export default function useFocusManage(
|
|
1
|
+
export default function useFocusManage(element: HTMLElement | null, open: boolean): void;
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
var __create = Object.create;
|
|
2
1
|
var __defProp = Object.defineProperty;
|
|
3
2
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
3
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
6
4
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
5
|
var __export = (target, all) => {
|
|
8
6
|
for (var name in all)
|
|
@@ -16,14 +14,6 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
14
|
}
|
|
17
15
|
return to;
|
|
18
16
|
};
|
|
19
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
-
mod
|
|
26
|
-
));
|
|
27
17
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
18
|
|
|
29
19
|
// src/hooks/useFocusManage.ts
|
|
@@ -34,19 +24,34 @@ __export(useFocusManage_exports, {
|
|
|
34
24
|
module.exports = __toCommonJS(useFocusManage_exports);
|
|
35
25
|
var import_react = require("react");
|
|
36
26
|
var import_focusStack = require("../utils/focusStack");
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
const
|
|
27
|
+
function useFocusManage(element, open) {
|
|
28
|
+
const entryRef = (0, import_react.useRef)(null);
|
|
29
|
+
const previousFocusRef = (0, import_react.useRef)(null);
|
|
30
|
+
const openCycleRef = (0, import_react.useRef)(false);
|
|
31
|
+
const releaseEntry = () => {
|
|
32
|
+
if (entryRef.current) {
|
|
33
|
+
(0, import_focusStack.popFocus)(entryRef.current);
|
|
34
|
+
entryRef.current = null;
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
const endOpenCycle = () => {
|
|
38
|
+
releaseEntry();
|
|
39
|
+
previousFocusRef.current = null;
|
|
40
|
+
openCycleRef.current = false;
|
|
41
|
+
};
|
|
42
|
+
(0, import_react.useEffect)(() => {
|
|
43
|
+
if (open && !openCycleRef.current) {
|
|
44
|
+
openCycleRef.current = true;
|
|
45
|
+
previousFocusRef.current = document.activeElement;
|
|
46
|
+
} else if (!open && openCycleRef.current) {
|
|
47
|
+
endOpenCycle();
|
|
48
|
+
}
|
|
49
|
+
}, [open]);
|
|
40
50
|
(0, import_react.useEffect)(() => {
|
|
41
|
-
if (!
|
|
51
|
+
if (!open || !openCycleRef.current || !element || entryRef.current) {
|
|
42
52
|
return;
|
|
43
|
-
if (delayOpen) {
|
|
44
|
-
(0, import_focusStack.pushFocus)(ele);
|
|
45
|
-
} else {
|
|
46
|
-
(0, import_focusStack.popFocus)();
|
|
47
53
|
}
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
}, [ele, delayOpen]);
|
|
54
|
+
entryRef.current = (0, import_focusStack.pushFocus)(element, previousFocusRef.current);
|
|
55
|
+
}, [element, open]);
|
|
56
|
+
(0, import_react.useEffect)(() => releaseEntry, []);
|
|
52
57
|
}
|
package/dist/cjs/style/color.css
CHANGED
|
@@ -848,6 +848,7 @@
|
|
|
848
848
|
--yee-table-thead-stripe-borderbottom-color: var(
|
|
849
849
|
--yee-table-thead-borderbottom-color
|
|
850
850
|
);
|
|
851
|
+
--yee-table-row-bg-color: var(--yee-color-bg-container);
|
|
851
852
|
--yee-table-odd-row-bg-color: var(--yee-color-bg-container);
|
|
852
853
|
--yee-table-even-row-bg-color: var(--yee-color-bg-head);
|
|
853
854
|
--yee-table-elevated-thead-stripe-borderbottom-color: var(
|
|
@@ -870,6 +871,7 @@
|
|
|
870
871
|
--yee-table-head-filter-active-color: var(--yee-primary-color);
|
|
871
872
|
--yee-table-fixed-left-after-bs-color: var(--yee-box-shadow-color);
|
|
872
873
|
--yee-table-fixed-right-after-bs-color: var(--yee-box-shadow-color);
|
|
874
|
+
--yee-table-fixed-column-bg-color: inherit;
|
|
873
875
|
--yee-table-filter-list-bg-color: var(--yee-color-bg-elevated);
|
|
874
876
|
--yee-table-tbody-tr-expanded-bg-color: var(--yee-color-bg-container);
|
|
875
877
|
--yee-table-elevated-tbody-tr-expanded-bg-color: var(
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* @rainbow-oh/yee-c CSS Variables
|
|
3
3
|
* Auto-generated, do not edit manually
|
|
4
|
-
* Generated on 2026-07-
|
|
4
|
+
* Generated on 2026-07-23T07:06:10.927Z
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
/* ========== color.css ========== */
|
|
@@ -855,6 +855,7 @@
|
|
|
855
855
|
--yee-table-thead-stripe-borderbottom-color: var(
|
|
856
856
|
--yee-table-thead-borderbottom-color
|
|
857
857
|
);
|
|
858
|
+
--yee-table-row-bg-color: var(--yee-color-bg-container);
|
|
858
859
|
--yee-table-odd-row-bg-color: var(--yee-color-bg-container);
|
|
859
860
|
--yee-table-even-row-bg-color: var(--yee-color-bg-head);
|
|
860
861
|
--yee-table-elevated-thead-stripe-borderbottom-color: var(
|
|
@@ -877,6 +878,7 @@
|
|
|
877
878
|
--yee-table-head-filter-active-color: var(--yee-primary-color);
|
|
878
879
|
--yee-table-fixed-left-after-bs-color: var(--yee-box-shadow-color);
|
|
879
880
|
--yee-table-fixed-right-after-bs-color: var(--yee-box-shadow-color);
|
|
881
|
+
--yee-table-fixed-column-bg-color: inherit;
|
|
880
882
|
--yee-table-filter-list-bg-color: var(--yee-color-bg-elevated);
|
|
881
883
|
--yee-table-tbody-tr-expanded-bg-color: var(--yee-color-bg-container);
|
|
882
884
|
--yee-table-elevated-tbody-tr-expanded-bg-color: var(
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
type Focusable = HTMLElement | null;
|
|
2
|
-
export
|
|
3
|
-
|
|
2
|
+
export interface FocusStackEntry {
|
|
3
|
+
container: HTMLElement;
|
|
4
|
+
previous: Focusable;
|
|
5
|
+
}
|
|
6
|
+
export declare const pushFocus: (container: HTMLElement, previous?: Focusable) => FocusStackEntry;
|
|
7
|
+
export declare const popFocus: (entry: FocusStackEntry) => void;
|
|
4
8
|
export {};
|
|
@@ -23,21 +23,50 @@ __export(focusStack_exports, {
|
|
|
23
23
|
pushFocus: () => pushFocus
|
|
24
24
|
});
|
|
25
25
|
module.exports = __toCommonJS(focusStack_exports);
|
|
26
|
+
var focusableSelector = [
|
|
27
|
+
"a[href]",
|
|
28
|
+
"button:not([disabled])",
|
|
29
|
+
"textarea:not([disabled])",
|
|
30
|
+
"input:not([disabled])",
|
|
31
|
+
"select:not([disabled])",
|
|
32
|
+
"details",
|
|
33
|
+
'[tabindex]:not([tabindex="-1"])'
|
|
34
|
+
].join(",");
|
|
26
35
|
var stack = [];
|
|
27
36
|
var raf = 0;
|
|
28
|
-
var schedule = (
|
|
37
|
+
var schedule = (callback) => {
|
|
29
38
|
cancelAnimationFrame(raf);
|
|
30
|
-
raf = requestAnimationFrame(
|
|
39
|
+
raf = requestAnimationFrame(callback);
|
|
31
40
|
};
|
|
32
|
-
var
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
41
|
+
var focusInitialElement = (entry) => {
|
|
42
|
+
if (stack[stack.length - 1] !== entry || !entry.container.isConnected) {
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
const activeElement = document.activeElement;
|
|
46
|
+
if (activeElement && entry.container.contains(activeElement)) {
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
const firstFocusable = entry.container.querySelector(focusableSelector);
|
|
50
|
+
(firstFocusable != null ? firstFocusable : entry.container).focus();
|
|
51
|
+
};
|
|
52
|
+
var pushFocus = (container, previous = document.activeElement) => {
|
|
53
|
+
const entry = { container, previous };
|
|
54
|
+
stack.push(entry);
|
|
55
|
+
schedule(() => focusInitialElement(entry));
|
|
56
|
+
return entry;
|
|
37
57
|
};
|
|
38
|
-
var popFocus = () => {
|
|
39
|
-
const
|
|
40
|
-
if (
|
|
58
|
+
var popFocus = (entry) => {
|
|
59
|
+
const index = stack.lastIndexOf(entry);
|
|
60
|
+
if (index === -1)
|
|
61
|
+
return;
|
|
62
|
+
const isTopEntry = index === stack.length - 1;
|
|
63
|
+
stack.splice(index, 1);
|
|
64
|
+
if (!isTopEntry)
|
|
41
65
|
return;
|
|
42
|
-
schedule(
|
|
66
|
+
schedule(() => {
|
|
67
|
+
var _a;
|
|
68
|
+
if ((_a = entry.previous) == null ? void 0 : _a.isConnected) {
|
|
69
|
+
entry.previous.focus();
|
|
70
|
+
}
|
|
71
|
+
});
|
|
43
72
|
};
|
package/dist/cjs/version.d.ts
CHANGED
package/dist/cjs/version.js
CHANGED
package/dist/esm/Card/card.js
CHANGED
|
@@ -79,8 +79,8 @@ var Card = function Card(baseprops) {
|
|
|
79
79
|
className: clsx("".concat(prefixCls, "-header-expand-icon"), classNames === null || classNames === void 0 ? void 0 : classNames.expandIcon),
|
|
80
80
|
style: styles === null || styles === void 0 ? void 0 : styles.expandIcon,
|
|
81
81
|
"aria-expanded": mergedExpanded,
|
|
82
|
+
"aria-label": mergedExpanded ? 'Collapse content' : 'Expand content',
|
|
82
83
|
icon: icon ? icon : /*#__PURE__*/React.createElement(ChevronUp, {
|
|
83
|
-
"aria-label": "expanded",
|
|
84
84
|
strokeWidth: 1.5,
|
|
85
85
|
size: 16,
|
|
86
86
|
style: {
|
|
@@ -110,7 +110,8 @@ var Card = function Card(baseprops) {
|
|
|
110
110
|
onClick: headerClickable ? handleExpand : undefined,
|
|
111
111
|
onKeyDown: handleKeyDown,
|
|
112
112
|
tabIndex: headerClickable ? 0 : undefined,
|
|
113
|
-
role: headerClickable ? 'button' : undefined
|
|
113
|
+
role: headerClickable ? 'button' : undefined,
|
|
114
|
+
"aria-expanded": headerClickable ? mergedExpanded : undefined
|
|
114
115
|
}, iconPosition === 'left' ? renderExpandIcon() : null, title ? /*#__PURE__*/React.createElement("div", {
|
|
115
116
|
id: headerId,
|
|
116
117
|
className: clsx("".concat(prefixCls, "-header-title"), classNames === null || classNames === void 0 ? void 0 : classNames.title),
|
|
@@ -131,7 +132,10 @@ var Card = function Card(baseprops) {
|
|
|
131
132
|
},
|
|
132
133
|
transition: {
|
|
133
134
|
duration: animationDuration
|
|
134
|
-
}
|
|
135
|
+
},
|
|
136
|
+
role: "region",
|
|
137
|
+
"aria-labelledby": title ? headerId : undefined,
|
|
138
|
+
"aria-hidden": !mergedExpanded
|
|
135
139
|
}, children));
|
|
136
140
|
};
|
|
137
141
|
export default Card;
|
|
@@ -13,10 +13,15 @@ var CarouselItem = function CarouselItem(props) {
|
|
|
13
13
|
var _React$useContext = React.useContext(CarouselCtx),
|
|
14
14
|
prefixCls = _React$useContext.prefixCls,
|
|
15
15
|
current = _React$useContext.current;
|
|
16
|
+
var isActive = index === current - 1;
|
|
16
17
|
return /*#__PURE__*/React.createElement("div", {
|
|
17
|
-
className: clsx("".concat(prefixCls, "-item"), _defineProperty({}, "".concat(prefixCls, "-item-active"),
|
|
18
|
+
className: clsx("".concat(prefixCls, "-item"), _defineProperty({}, "".concat(prefixCls, "-item-active"), isActive), className),
|
|
18
19
|
"data-index": index,
|
|
19
|
-
style: style
|
|
20
|
+
style: style,
|
|
21
|
+
role: "tabpanel",
|
|
22
|
+
"aria-roledescription": "slide",
|
|
23
|
+
"aria-label": "Slide ".concat((index !== null && index !== void 0 ? index : 0) + 1),
|
|
24
|
+
"aria-hidden": !isActive
|
|
20
25
|
}, children);
|
|
21
26
|
};
|
|
22
27
|
export default CarouselItem;
|
|
@@ -166,6 +166,9 @@ var Carousel = /*#__PURE__*/React.forwardRef(function (baseprops, ref) {
|
|
|
166
166
|
};
|
|
167
167
|
var carouselProps = _objectSpread(_objectSpread({}, rest), {}, {
|
|
168
168
|
className: clsx(prefixCls, ["".concat(prefixCls, "-").concat(direction)], ["".concat(prefixCls, "-").concat(effect)], _defineProperty({}, "".concat(prefixCls, "-arrows-visible"), showArrow), className),
|
|
169
|
+
role: 'region',
|
|
170
|
+
'aria-roledescription': 'carousel',
|
|
171
|
+
'aria-live': autoplay ? 'off' : 'polite',
|
|
169
172
|
onMouseEnter: handleMouseEnter,
|
|
170
173
|
onMouseLeave: handleMouseLeave
|
|
171
174
|
});
|
|
@@ -181,24 +184,48 @@ var Carousel = /*#__PURE__*/React.forwardRef(function (baseprops, ref) {
|
|
|
181
184
|
show: infinite || current > 1
|
|
182
185
|
}, classNames === null || classNames === void 0 ? void 0 : classNames.prev),
|
|
183
186
|
style: styles === null || styles === void 0 ? void 0 : styles.prev,
|
|
184
|
-
onClick: prev
|
|
187
|
+
onClick: prev,
|
|
188
|
+
role: "button",
|
|
189
|
+
"aria-label": "Previous slide",
|
|
190
|
+
tabIndex: 0,
|
|
191
|
+
onKeyDown: function onKeyDown(e) {
|
|
192
|
+
if (e.key === 'Enter' || e.key === ' ') {
|
|
193
|
+
e.preventDefault();
|
|
194
|
+
prev();
|
|
195
|
+
}
|
|
196
|
+
}
|
|
185
197
|
}, direction === 'vertical' ? /*#__PURE__*/React.createElement(ChevronUp, null) : /*#__PURE__*/React.createElement(ChevronLeft, null)), /*#__PURE__*/React.createElement("div", {
|
|
186
198
|
className: clsx("".concat(prefixCls, "-next"), {
|
|
187
199
|
show: infinite || current !== count
|
|
188
200
|
}, classNames === null || classNames === void 0 ? void 0 : classNames.next),
|
|
189
201
|
style: styles === null || styles === void 0 ? void 0 : styles.next,
|
|
190
|
-
onClick: next
|
|
202
|
+
onClick: next,
|
|
203
|
+
role: "button",
|
|
204
|
+
"aria-label": "Next slide",
|
|
205
|
+
tabIndex: 0,
|
|
206
|
+
onKeyDown: function onKeyDown(e) {
|
|
207
|
+
if (e.key === 'Enter' || e.key === ' ') {
|
|
208
|
+
e.preventDefault();
|
|
209
|
+
next();
|
|
210
|
+
}
|
|
211
|
+
}
|
|
191
212
|
}, direction === 'vertical' ? /*#__PURE__*/React.createElement(ChevronDown, null) : /*#__PURE__*/React.createElement(ChevronRight, null)));
|
|
192
213
|
};
|
|
193
214
|
var renderDots = function renderDots() {
|
|
194
215
|
return dots ? /*#__PURE__*/React.createElement("ul", {
|
|
195
216
|
className: clsx("".concat(prefixCls, "-bar"), ["".concat(prefixCls, "-bar-").concat(dotShape)], ["".concat(prefixCls, "-bar-").concat(dotPosition)], classNames === null || classNames === void 0 ? void 0 : classNames.dot),
|
|
196
|
-
style: styles === null || styles === void 0 ? void 0 : styles.dot
|
|
217
|
+
style: styles === null || styles === void 0 ? void 0 : styles.dot,
|
|
218
|
+
role: "tablist",
|
|
219
|
+
"aria-label": "Slide controls"
|
|
197
220
|
}, new Array(React.Children.count(children)).fill(0).map(function (i, index) {
|
|
221
|
+
var isActive = current === index + 1 || current === 0 && index === count - 1;
|
|
198
222
|
return /*#__PURE__*/React.createElement("li", {
|
|
199
223
|
className: clsx({
|
|
200
|
-
active:
|
|
224
|
+
active: isActive
|
|
201
225
|
}),
|
|
226
|
+
role: "tab",
|
|
227
|
+
"aria-selected": isActive,
|
|
228
|
+
"aria-label": "Slide ".concat(index + 1),
|
|
202
229
|
tabIndex: 0,
|
|
203
230
|
onClick: function onClick() {
|
|
204
231
|
return handleIndicator(index + 1, 'click');
|
|
@@ -425,7 +425,9 @@ var Cascader = function Cascader(baseprops) {
|
|
|
425
425
|
};
|
|
426
426
|
var renderPopup = function renderPopup() {
|
|
427
427
|
return /*#__PURE__*/React.createElement("div", {
|
|
428
|
-
className: clsx(prefixCls)
|
|
428
|
+
className: clsx(prefixCls),
|
|
429
|
+
role: "group",
|
|
430
|
+
"aria-label": "Cascader options"
|
|
429
431
|
}, isFilter ? /*#__PURE__*/React.createElement(SearchList, {
|
|
430
432
|
prefixCls: prefixCls,
|
|
431
433
|
items: filteredList,
|
|
@@ -7,7 +7,8 @@ var Column = function Column(props) {
|
|
|
7
7
|
index = props.index;
|
|
8
8
|
return /*#__PURE__*/React.createElement("ul", {
|
|
9
9
|
className: "".concat(prefixCls, "-menu"),
|
|
10
|
-
role: "
|
|
10
|
+
role: "listbox",
|
|
11
|
+
"aria-label": "Level ".concat(index + 1, " options")
|
|
11
12
|
}, Array.isArray(data) && data.map(function (item, idx) {
|
|
12
13
|
return /*#__PURE__*/React.createElement(Node, _extends({}, item, {
|
|
13
14
|
index: idx,
|
|
@@ -17,7 +17,7 @@ import isEqual from "../utils/isEqual";
|
|
|
17
17
|
import { CascaderCtx } from "./cascader";
|
|
18
18
|
import { getChildren, isHalfChecked } from "./utils";
|
|
19
19
|
var Node = function Node(props) {
|
|
20
|
-
var _expandedPath$level;
|
|
20
|
+
var _expandedPath$level, _expandedPath$level2, _expandedPath$level3;
|
|
21
21
|
var uid = props.uid,
|
|
22
22
|
value = props.value,
|
|
23
23
|
disabled = props.disabled,
|
|
@@ -95,22 +95,36 @@ var Node = function Node(props) {
|
|
|
95
95
|
onMouseEnter: handleMouseEnter,
|
|
96
96
|
onClick: function onClick(e) {
|
|
97
97
|
return handleClick(false, e);
|
|
98
|
+
},
|
|
99
|
+
role: "option",
|
|
100
|
+
"aria-disabled": disabled || undefined,
|
|
101
|
+
"aria-selected": checked || ((_expandedPath$level2 = expandedPath[level]) === null || _expandedPath$level2 === void 0 ? void 0 : _expandedPath$level2.key) === uid,
|
|
102
|
+
"aria-expanded": isParent ? ((_expandedPath$level3 = expandedPath[level]) === null || _expandedPath$level3 === void 0 ? void 0 : _expandedPath$level3.key) === uid : undefined,
|
|
103
|
+
tabIndex: disabled ? -1 : 0,
|
|
104
|
+
onKeyDown: function onKeyDown(e) {
|
|
105
|
+
if (e.key === 'Enter' || e.key === ' ') {
|
|
106
|
+
e.preventDefault();
|
|
107
|
+
handleClick(false, e);
|
|
108
|
+
}
|
|
98
109
|
}
|
|
99
110
|
}, multiple && /*#__PURE__*/React.createElement(Checkbox, {
|
|
100
111
|
checked: isParent ? checkedAll : checked,
|
|
101
112
|
onChange: isParent ? function () {
|
|
102
113
|
return handleClick(true);
|
|
103
114
|
} : undefined,
|
|
104
|
-
indeterminate: indeterminate
|
|
115
|
+
indeterminate: indeterminate,
|
|
116
|
+
"aria-label": "Select ".concat(typeof label === 'string' ? label : String(label))
|
|
105
117
|
}), /*#__PURE__*/React.createElement("span", {
|
|
106
118
|
className: clsx("".concat(prefixCls, "-menu-item-label"), {
|
|
107
119
|
loaded: load === 2
|
|
108
120
|
}),
|
|
109
121
|
title: typeof label === 'string' ? label : String(label)
|
|
110
122
|
}, label), load === 1 ? /*#__PURE__*/React.createElement(Spin, {
|
|
111
|
-
size: "small"
|
|
123
|
+
size: "small",
|
|
124
|
+
"aria-label": "Loading"
|
|
112
125
|
}) : isLeaf === false ? /*#__PURE__*/React.createElement(ChevronRight, {
|
|
113
|
-
size: 20
|
|
126
|
+
size: 20,
|
|
127
|
+
"aria-hidden": "true"
|
|
114
128
|
}) : null);
|
|
115
129
|
};
|
|
116
130
|
export default /*#__PURE__*/memo(Node);
|