@rainbow-oh/yee-c 0.8.1 → 0.8.2
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/cjs/Cascader/cascader.js +38 -30
- package/dist/cjs/Cascader/column.js +17 -9
- package/dist/cjs/Cascader/search-list.js +30 -22
- package/dist/cjs/Cascader/utils/index.js +1 -5
- package/dist/cjs/Checkbox/checkbox-group.js +23 -14
- package/dist/cjs/Dialog/dialog.js +1 -1
- package/dist/cjs/Dialog/interface.d.ts +1 -1
- package/dist/cjs/Dialog/style/index.less +2 -1
- package/dist/cjs/Drawer/drawer.js +9 -1
- package/dist/cjs/Form/Group.js +1 -1
- package/dist/cjs/Form/demo/tooltip.js +1 -3
- package/dist/cjs/List/hooks/useListKeyboard.js +3 -1
- package/dist/cjs/Menu/menu.js +18 -2
- package/dist/cjs/Pagination/items.js +54 -26
- package/dist/cjs/Pagination/pagination.js +25 -9
- package/dist/cjs/PickerPanel/panels/DateTimePanel/index.d.ts +1 -1
- package/dist/cjs/PickerPanel/panels/MonthPanel/MonthHeader.js +7 -1
- package/dist/cjs/Rate/star.js +27 -3
- package/dist/cjs/Segmented/demo/variant.js +15 -1
- package/dist/cjs/Segmented/index.d.ts +1 -1
- package/dist/cjs/Segmented/segmented.js +12 -15
- package/dist/cjs/Select/option.js +8 -1
- package/dist/cjs/Select/options.js +9 -1
- package/dist/cjs/Select/select.js +3 -1
- package/dist/cjs/Steps/step.js +14 -2
- package/dist/cjs/Steps/steps.js +11 -1
- package/dist/cjs/Table/demo/components-override.js +31 -2
- package/dist/cjs/Table/demo/grouping.js +7 -1
- package/dist/cjs/Table/hooks/useColumns.d.ts +3 -3
- package/dist/cjs/Table/hooks/useColumns.js +11 -14
- package/dist/cjs/Table/index.d.ts +1 -1
- package/dist/cjs/Table/style/index.less +2 -4
- package/dist/cjs/Table/tbody/row.js +1 -4
- package/dist/cjs/Table/theader/index.js +12 -4
- package/dist/cjs/Tour/index.d.ts +1 -1
- package/dist/cjs/Tree/style/index.less +1 -5
- package/dist/cjs/Tree/tree.js +38 -35
- package/dist/cjs/hooks/useEvent.js +1 -4
- package/dist/cjs/style/size.css +2 -0
- package/dist/cjs/style/themes.css +1 -1
- package/dist/cjs/style/variables.css +3 -1
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/Dialog/dialog.js +2 -2
- package/dist/esm/Dialog/interface.d.ts +1 -1
- package/dist/esm/Dialog/style/index.less +2 -1
- package/dist/esm/Form/Group.js +1 -1
- package/dist/esm/PickerPanel/panels/DateTimePanel/index.d.ts +1 -1
- package/dist/esm/Segmented/index.d.ts +1 -1
- package/dist/esm/Segmented/segmented.js +1 -1
- package/dist/esm/Table/demo/components-override.js +1 -0
- package/dist/esm/Table/hooks/useColumns.d.ts +3 -3
- package/dist/esm/Table/hooks/useColumns.js +13 -16
- package/dist/esm/Table/index.d.ts +1 -1
- package/dist/esm/Table/style/index.less +2 -4
- package/dist/esm/Tour/index.d.ts +1 -1
- package/dist/esm/Tree/style/index.less +1 -5
- package/dist/esm/Tree/tree.js +1 -1
- package/dist/esm/style/size.css +2 -0
- package/dist/esm/style/themes.css +1 -1
- package/dist/esm/style/variables.css +3 -1
- package/dist/esm/version.d.ts +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/umd/yee-c.min.css +2 -2
- package/dist/umd/yee-c.min.js +1 -1
- package/package.json +1 -1
- package/src/Anchor/anchor.tsx +2 -2
- package/src/Carousel/carousel.tsx +1 -2
- package/src/Cascader/cascader.tsx +5 -1
- package/src/Cascader/column.tsx +5 -1
- package/src/Cascader/search-list.tsx +10 -3
- package/src/Cascader/utils/index.ts +3 -6
- package/src/Checkbox/checkbox-group.tsx +6 -1
- package/src/Dialog/dialog.tsx +7 -3
- package/src/Dialog/interface.ts +1 -1
- package/src/Dialog/style/index.less +2 -1
- package/src/Drawer/drawer.tsx +7 -1
- package/src/Form/Group.tsx +2 -4
- package/src/Form/demo/tooltip.tsx +2 -11
- package/src/Form/utils/validate.ts +1 -4
- package/src/List/hooks/useListKeyboard.ts +3 -3
- package/src/List/list.tsx +2 -1
- package/src/Menu/menu.tsx +14 -3
- package/src/Pagination/items.tsx +16 -4
- package/src/Pagination/pagination.tsx +18 -4
- package/src/PickerPanel/panels/DatePanel/DateBody.tsx +1 -1
- package/src/PickerPanel/panels/DateTimePanel/index.tsx +1 -1
- package/src/PickerPanel/panels/MonthPanel/MonthHeader.tsx +7 -2
- package/src/PickerPanel/panels/PanelBody.tsx +1 -1
- package/src/PickerPanel/panels/QuarterPanel/QuarterHeader.tsx +1 -1
- package/src/PickerPanel/panels/RangePanel/index.tsx +1 -1
- package/src/PickerPanel/panels/TimePanel/TimeBody.tsx +1 -1
- package/src/PickerPanel/panels/YearPanel/YearHeader.tsx +1 -1
- package/src/PickerPanel/utils/pickerUtils.ts +2 -1
- package/src/RangePicker/range-picker-mobile.tsx +1 -3
- package/src/Rate/star.tsx +16 -4
- package/src/Segmented/demo/variant.tsx +10 -2
- package/src/Segmented/index.ts +2 -2
- package/src/Segmented/segmented.tsx +4 -11
- package/src/Select/interface.ts +0 -1
- package/src/Select/option.tsx +8 -2
- package/src/Select/options.tsx +11 -4
- package/src/Select/select.tsx +4 -4
- package/src/Steps/step.tsx +11 -3
- package/src/Steps/steps.tsx +8 -1
- package/src/Table/demo/components-override.tsx +34 -7
- package/src/Table/demo/grouping.tsx +8 -4
- package/src/Table/hooks/useColumns.ts +14 -18
- package/src/Table/index.ts +3 -3
- package/src/Table/style/index.less +2 -4
- package/src/Table/table.tsx +2 -4
- package/src/Table/tbody/row.tsx +1 -3
- package/src/Table/theader/index.tsx +9 -10
- package/src/Tour/demo/placement.tsx +2 -1
- package/src/Tour/index.ts +1 -1
- package/src/Tree/style/index.less +1 -5
- package/src/Tree/tree.tsx +16 -11
- package/src/Tree/utils/tree-tools.ts +4 -1
- package/src/hooks/useEvent.ts +1 -3
- package/src/locale/context.tsx +5 -1
- package/src/locale/interface.ts +3 -1
- package/src/style/size.css +2 -0
- package/src/utils/debounce.ts +1 -3
- package/src/version.ts +1 -1
package/package.json
CHANGED
package/src/Anchor/anchor.tsx
CHANGED
|
@@ -139,8 +139,8 @@ const Anchor = forwardRef<HTMLDivElement, AnchorProps>((baseprops, ref) => {
|
|
|
139
139
|
|
|
140
140
|
// Scrolled above the first anchor — reset to the top item.
|
|
141
141
|
if (nextActiveKey === undefined) {
|
|
142
|
-
const first = currentItems.find(
|
|
143
|
-
|
|
142
|
+
const first = currentItems.find((item) =>
|
|
143
|
+
document.getElementById(item.key),
|
|
144
144
|
);
|
|
145
145
|
nextActiveKey = first?.key;
|
|
146
146
|
}
|
|
@@ -256,8 +256,7 @@ const Carousel = React.forwardRef(
|
|
|
256
256
|
.fill(0)
|
|
257
257
|
.map((i, index: number) => {
|
|
258
258
|
const isActive =
|
|
259
|
-
current === index + 1 ||
|
|
260
|
-
(current === 0 && index === count - 1);
|
|
259
|
+
current === index + 1 || (current === 0 && index === count - 1);
|
|
261
260
|
return (
|
|
262
261
|
<li
|
|
263
262
|
className={clsx({
|
|
@@ -446,7 +446,11 @@ const Cascader = (baseprops: CascaderProps) => {
|
|
|
446
446
|
|
|
447
447
|
const renderPopup = () => {
|
|
448
448
|
return (
|
|
449
|
-
<div
|
|
449
|
+
<div
|
|
450
|
+
className={clsx(prefixCls)}
|
|
451
|
+
role="group"
|
|
452
|
+
aria-label="Cascader options"
|
|
453
|
+
>
|
|
450
454
|
{isFilter ? (
|
|
451
455
|
<SearchList
|
|
452
456
|
prefixCls={prefixCls}
|
package/src/Cascader/column.tsx
CHANGED
|
@@ -11,7 +11,11 @@ export interface ColumnProps {
|
|
|
11
11
|
const Column = (props: ColumnProps) => {
|
|
12
12
|
const { prefixCls, data, index } = props;
|
|
13
13
|
return (
|
|
14
|
-
<ul
|
|
14
|
+
<ul
|
|
15
|
+
className={`${prefixCls}-menu`}
|
|
16
|
+
role="listbox"
|
|
17
|
+
aria-label={`Level ${index + 1} options`}
|
|
18
|
+
>
|
|
15
19
|
{Array.isArray(data) &&
|
|
16
20
|
data.map((item, idx: number) => {
|
|
17
21
|
return (
|
|
@@ -32,10 +32,15 @@ const SearchList = (props: SearchListProps) => {
|
|
|
32
32
|
const { prefixCls, items, onClick } = props;
|
|
33
33
|
|
|
34
34
|
return (
|
|
35
|
-
<ul
|
|
35
|
+
<ul
|
|
36
|
+
className={`${prefixCls}-filter-menu`}
|
|
37
|
+
role="listbox"
|
|
38
|
+
aria-label="Search results"
|
|
39
|
+
>
|
|
36
40
|
{items.length ? (
|
|
37
41
|
items.map((item) => {
|
|
38
|
-
const title =
|
|
42
|
+
const title =
|
|
43
|
+
item.data.$source?.title || item.data.labelPath.join(' / ');
|
|
39
44
|
|
|
40
45
|
return (
|
|
41
46
|
<li
|
|
@@ -58,7 +63,9 @@ const SearchList = (props: SearchListProps) => {
|
|
|
58
63
|
);
|
|
59
64
|
})
|
|
60
65
|
) : (
|
|
61
|
-
<li role="option" aria-disabled="true">
|
|
66
|
+
<li role="option" aria-disabled="true">
|
|
67
|
+
{'No result'}
|
|
68
|
+
</li>
|
|
62
69
|
)}
|
|
63
70
|
</ul>
|
|
64
71
|
);
|
|
@@ -340,7 +340,8 @@ export const changeToView = (
|
|
|
340
340
|
* conversions share one collision-safe format.
|
|
341
341
|
* @param val - The path array
|
|
342
342
|
*/
|
|
343
|
-
export const formatKey = (val: Array<string | number>): string =>
|
|
343
|
+
export const formatKey = (val: Array<string | number>): string =>
|
|
344
|
+
pathToUid(val);
|
|
344
345
|
|
|
345
346
|
/**
|
|
346
347
|
* Check if a path has the same prefix as another path
|
|
@@ -441,11 +442,7 @@ export const flattenOptions = (
|
|
|
441
442
|
});
|
|
442
443
|
if (hasChild(node, children)) {
|
|
443
444
|
seen.add(node);
|
|
444
|
-
dfs(
|
|
445
|
-
node[children] as Array<Record<string, unknown>>,
|
|
446
|
-
path,
|
|
447
|
-
labelPath,
|
|
448
|
-
);
|
|
445
|
+
dfs(node[children] as Array<Record<string, unknown>>, path, labelPath);
|
|
449
446
|
seen.delete(node);
|
|
450
447
|
}
|
|
451
448
|
});
|
|
@@ -63,7 +63,12 @@ const CheckboxGroup = (baseprops: CheckboxGroupProps) => {
|
|
|
63
63
|
};
|
|
64
64
|
|
|
65
65
|
return (
|
|
66
|
-
<div
|
|
66
|
+
<div
|
|
67
|
+
className={cls}
|
|
68
|
+
style={style}
|
|
69
|
+
role="group"
|
|
70
|
+
aria-disabled={disabled || undefined}
|
|
71
|
+
>
|
|
67
72
|
<CheckboxGroupCtx.Provider
|
|
68
73
|
value={{ name, buttonStyle, onChange: handleChange }}
|
|
69
74
|
>
|
package/src/Dialog/dialog.tsx
CHANGED
|
@@ -197,9 +197,13 @@ const Dialog = (baseprops: DialogProps) => {
|
|
|
197
197
|
className={clsx(`${prefixCls}-header`, classNames?.header)}
|
|
198
198
|
style={styles?.header}
|
|
199
199
|
>
|
|
200
|
-
|
|
201
|
-
{title}
|
|
202
|
-
|
|
200
|
+
{typeof title === 'string' ? (
|
|
201
|
+
<div className={`${prefixCls}-title`} id={titleId}>
|
|
202
|
+
{title}
|
|
203
|
+
</div>
|
|
204
|
+
) : (
|
|
205
|
+
title
|
|
206
|
+
)}
|
|
203
207
|
</div>
|
|
204
208
|
) : null}
|
|
205
209
|
<div
|
package/src/Dialog/interface.ts
CHANGED
package/src/Drawer/drawer.tsx
CHANGED
|
@@ -206,7 +206,13 @@ const Drawer = (baseprops: DrawerProps) => {
|
|
|
206
206
|
className={clsx(`${prefixCls}-header`, classNames?.header)}
|
|
207
207
|
style={styles?.header}
|
|
208
208
|
>
|
|
209
|
-
<div
|
|
209
|
+
<div
|
|
210
|
+
className={clsx(`${prefixCls}-title`, classNames?.title)}
|
|
211
|
+
style={styles?.title}
|
|
212
|
+
id={titleId}
|
|
213
|
+
>
|
|
214
|
+
{title}
|
|
215
|
+
</div>
|
|
210
216
|
</div>
|
|
211
217
|
) : null}
|
|
212
218
|
<div
|
package/src/Form/Group.tsx
CHANGED
|
@@ -9,10 +9,10 @@ import React, {
|
|
|
9
9
|
useRef,
|
|
10
10
|
} from 'react';
|
|
11
11
|
import Grid from '../Grid';
|
|
12
|
-
import { runValidator } from './utils/validate';
|
|
13
12
|
import FieldContext from './FieldContext';
|
|
14
13
|
import FormContext from './FormContext';
|
|
15
14
|
import type { FieldGroupProps, NamePath, ValidateMessage } from './interface';
|
|
15
|
+
import { runValidator } from './utils/validate';
|
|
16
16
|
|
|
17
17
|
const Group: React.FC<FieldGroupProps> = (props) => {
|
|
18
18
|
const { label, required, rules, cols, children, style, className } = props;
|
|
@@ -39,9 +39,7 @@ const Group: React.FC<FieldGroupProps> = (props) => {
|
|
|
39
39
|
const [, forceValidate] = useReducer((x) => x + 1, 0); // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
40
40
|
|
|
41
41
|
// Group validation
|
|
42
|
-
const validate = async (
|
|
43
|
-
force: boolean,
|
|
44
|
-
): Promise<ValidateMessage[]> => {
|
|
42
|
+
const validate = async (force: boolean): Promise<ValidateMessage[]> => {
|
|
45
43
|
if (!required && (!rules || rules.length === 0)) return [];
|
|
46
44
|
|
|
47
45
|
// Skip if not touched and not forced validation
|
|
@@ -1,11 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Button,
|
|
3
|
-
Form,
|
|
4
|
-
Grid,
|
|
5
|
-
Input,
|
|
6
|
-
Space,
|
|
7
|
-
TextArea,
|
|
8
|
-
} from '@rainbow-oh/yee-c';
|
|
1
|
+
import { Button, Form, Grid, Input, Space, TextArea } from '@rainbow-oh/yee-c';
|
|
9
2
|
import { Info } from 'lucide-react';
|
|
10
3
|
import React from 'react';
|
|
11
4
|
|
|
@@ -29,9 +22,7 @@ export default () => {
|
|
|
29
22
|
name="username"
|
|
30
23
|
label="Username"
|
|
31
24
|
tooltip="Used for login. 4-20 characters."
|
|
32
|
-
rules={[
|
|
33
|
-
{ required: true, message: 'Please input your username!' },
|
|
34
|
-
]}
|
|
25
|
+
rules={[{ required: true, message: 'Please input your username!' }]}
|
|
35
26
|
>
|
|
36
27
|
<Input placeholder="Please input your username" />
|
|
37
28
|
</Form.Field>
|
|
@@ -134,10 +134,7 @@ export async function runValidator(
|
|
|
134
134
|
* Returns { passed, message? }. Sync rules short-circuit; the custom validator
|
|
135
135
|
* is awaited so async validators are supported.
|
|
136
136
|
*/
|
|
137
|
-
async function validate(
|
|
138
|
-
rule: Rule,
|
|
139
|
-
value: unknown,
|
|
140
|
-
): Promise<ValidateResult> {
|
|
137
|
+
async function validate(rule: Rule, value: unknown): Promise<ValidateResult> {
|
|
141
138
|
if (rule.required && isEmpty(value)) {
|
|
142
139
|
return { passed: false };
|
|
143
140
|
}
|
|
@@ -31,9 +31,9 @@ export default function useListKeyboard({
|
|
|
31
31
|
onFocusChange,
|
|
32
32
|
onClick,
|
|
33
33
|
}: UseListKeyboardParams) {
|
|
34
|
-
const [internalFocusedKey, setInternalFocusedKey] = useState<
|
|
35
|
-
|
|
36
|
-
|
|
34
|
+
const [internalFocusedKey, setInternalFocusedKey] = useState<string | number>(
|
|
35
|
+
'',
|
|
36
|
+
);
|
|
37
37
|
|
|
38
38
|
const isControlled = controlledFocusedKey !== undefined;
|
|
39
39
|
const focusedKey = isControlled ? controlledFocusedKey : internalFocusedKey;
|
package/src/List/list.tsx
CHANGED
|
@@ -33,7 +33,8 @@ const List = forwardRef<HTMLUListElement, ListProps>((baseprops, ref) => {
|
|
|
33
33
|
} = props;
|
|
34
34
|
|
|
35
35
|
const multiColumn = columns > 1;
|
|
36
|
-
const useVirtual =
|
|
36
|
+
const useVirtual =
|
|
37
|
+
virtual && height !== null && height !== undefined && Array.isArray(items);
|
|
37
38
|
const safeItems = Array.isArray(items) ? items : [];
|
|
38
39
|
|
|
39
40
|
// Keyboard navigation
|
package/src/Menu/menu.tsx
CHANGED
|
@@ -41,7 +41,11 @@ const MenuGroup = ({
|
|
|
41
41
|
renderItems: (items: MenuItemType[]) => React.ReactNode[];
|
|
42
42
|
}) => (
|
|
43
43
|
<li className={`${prefixCls}-item-group`} role="none">
|
|
44
|
-
<div
|
|
44
|
+
<div
|
|
45
|
+
className={`${prefixCls}-item-group-title`}
|
|
46
|
+
role="presentation"
|
|
47
|
+
id={`${prefixCls}-group-${String(item.label)}`}
|
|
48
|
+
>
|
|
45
49
|
{item.label}
|
|
46
50
|
</div>
|
|
47
51
|
<ul
|
|
@@ -118,11 +122,18 @@ const Menu = (props: InnerMenuProps) => {
|
|
|
118
122
|
const rootStyle = root ? { ...style } : {};
|
|
119
123
|
|
|
120
124
|
return (
|
|
121
|
-
<ul
|
|
125
|
+
<ul
|
|
126
|
+
{...dataAttrs}
|
|
127
|
+
className={cls}
|
|
128
|
+
style={rootStyle}
|
|
129
|
+
role={root && mode === 'horizontal' ? 'menubar' : 'menu'}
|
|
130
|
+
>
|
|
122
131
|
<MenuCtx.Provider value={{ level, mode, classNames, styles }}>
|
|
123
132
|
{getChildFromItems(items)}
|
|
124
133
|
{level === 0 && footer && (
|
|
125
|
-
<li className={`${prefixCls}-footer`} role="none">
|
|
134
|
+
<li className={`${prefixCls}-footer`} role="none">
|
|
135
|
+
{footer}
|
|
136
|
+
</li>
|
|
126
137
|
)}
|
|
127
138
|
</MenuCtx.Provider>
|
|
128
139
|
</ul>
|
package/src/Pagination/items.tsx
CHANGED
|
@@ -86,14 +86,20 @@ const Items: React.FC<PaginationItemsProps> = (props) => {
|
|
|
86
86
|
>
|
|
87
87
|
{components?.jumpPrev ?? (
|
|
88
88
|
<>
|
|
89
|
-
<span
|
|
89
|
+
<span
|
|
90
|
+
className={`${prefixCls}-jump-prev-ellipsis`}
|
|
91
|
+
aria-hidden="true"
|
|
92
|
+
>
|
|
90
93
|
<Ellipsis
|
|
91
94
|
className="ellipsis"
|
|
92
95
|
size={18}
|
|
93
96
|
strokeWidth={1.5}
|
|
94
97
|
/>
|
|
95
98
|
</span>
|
|
96
|
-
<span
|
|
99
|
+
<span
|
|
100
|
+
className={`${prefixCls}-jump-prev-icon`}
|
|
101
|
+
aria-hidden="true"
|
|
102
|
+
>
|
|
97
103
|
<ChevronsLeft
|
|
98
104
|
className="turn"
|
|
99
105
|
size={18}
|
|
@@ -122,14 +128,20 @@ const Items: React.FC<PaginationItemsProps> = (props) => {
|
|
|
122
128
|
>
|
|
123
129
|
{components?.jumpNext ?? (
|
|
124
130
|
<>
|
|
125
|
-
<span
|
|
131
|
+
<span
|
|
132
|
+
className={`${prefixCls}-jump-next-ellipsis`}
|
|
133
|
+
aria-hidden="true"
|
|
134
|
+
>
|
|
126
135
|
<Ellipsis
|
|
127
136
|
className="ellipsis"
|
|
128
137
|
size={18}
|
|
129
138
|
strokeWidth={1.5}
|
|
130
139
|
/>
|
|
131
140
|
</span>
|
|
132
|
-
<span
|
|
141
|
+
<span
|
|
142
|
+
className={`${prefixCls}-jump-next-icon`}
|
|
143
|
+
aria-hidden="true"
|
|
144
|
+
>
|
|
133
145
|
<ChevronsRight
|
|
134
146
|
className="turn"
|
|
135
147
|
size={18}
|
|
@@ -184,7 +184,9 @@ const Pagination = React.forwardRef(
|
|
|
184
184
|
aria-disabled={mergedCurrent === 1 || undefined}
|
|
185
185
|
key="prev"
|
|
186
186
|
>
|
|
187
|
-
{components?.prev ??
|
|
187
|
+
{components?.prev ?? (
|
|
188
|
+
<ChevronLeft size={20} strokeWidth={1.5} aria-hidden="true" />
|
|
189
|
+
)}
|
|
188
190
|
</li>
|
|
189
191
|
);
|
|
190
192
|
};
|
|
@@ -212,7 +214,9 @@ const Pagination = React.forwardRef(
|
|
|
212
214
|
aria-disabled={mergedCurrent === pageCount || undefined}
|
|
213
215
|
key="next"
|
|
214
216
|
>
|
|
215
|
-
{components?.next ??
|
|
217
|
+
{components?.next ?? (
|
|
218
|
+
<ChevronRight size={20} strokeWidth={1.5} aria-hidden="true" />
|
|
219
|
+
)}
|
|
216
220
|
</li>
|
|
217
221
|
);
|
|
218
222
|
};
|
|
@@ -255,13 +259,23 @@ const Pagination = React.forwardRef(
|
|
|
255
259
|
}
|
|
256
260
|
|
|
257
261
|
return (
|
|
258
|
-
<ul
|
|
262
|
+
<ul
|
|
263
|
+
{...rest}
|
|
264
|
+
className={cls}
|
|
265
|
+
style={style}
|
|
266
|
+
ref={ref}
|
|
267
|
+
role="navigation"
|
|
268
|
+
aria-label="Pagination"
|
|
269
|
+
aria-disabled={disabled || undefined}
|
|
270
|
+
>
|
|
259
271
|
{renderTotal()}
|
|
260
272
|
{renderPrevious()}
|
|
261
273
|
{simple ? (
|
|
262
274
|
<li className={`${prefixCls}-simple`}>
|
|
263
275
|
{renderNumber(false)}
|
|
264
|
-
<span className="split" aria-hidden="true"
|
|
276
|
+
<span className="split" aria-hidden="true">
|
|
277
|
+
/
|
|
278
|
+
</span>
|
|
265
279
|
<span className="total-page">{pageCount}</span>
|
|
266
280
|
</li>
|
|
267
281
|
) : (
|
|
@@ -2,8 +2,8 @@ import clsx from 'clsx';
|
|
|
2
2
|
import { Dayjs } from 'dayjs';
|
|
3
3
|
import React from 'react';
|
|
4
4
|
import useEvent from '../../../hooks/useEvent';
|
|
5
|
-
import type { PanelSharedProps } from '../../interface';
|
|
6
5
|
import panelConfig from '../../configs';
|
|
6
|
+
import type { PanelSharedProps } from '../../interface';
|
|
7
7
|
import pickerUtils from '../../utils/pickerUtils';
|
|
8
8
|
import PanelBody from '../PanelBody';
|
|
9
9
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Dayjs } from 'dayjs';
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
import type {
|
|
3
|
+
import type { PanelSharedProps, PickerType } from '../../interface';
|
|
4
4
|
import DatePanel from '../DatePanel';
|
|
5
5
|
import TimePanel from '../TimePanel';
|
|
6
6
|
|
|
@@ -6,8 +6,13 @@ import pickerUtils from '../../utils/pickerUtils';
|
|
|
6
6
|
import Header from '../Header';
|
|
7
7
|
|
|
8
8
|
export default function MonthHeader(props: PanelSharedProps) {
|
|
9
|
-
const {
|
|
10
|
-
|
|
9
|
+
const {
|
|
10
|
+
prefixCls,
|
|
11
|
+
viewDate,
|
|
12
|
+
offsetYear = 0,
|
|
13
|
+
onViewDateChange,
|
|
14
|
+
onPanelChange,
|
|
15
|
+
} = props;
|
|
11
16
|
|
|
12
17
|
const year = pickerUtils.getYear(viewDate) + offsetYear;
|
|
13
18
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import clsx from 'clsx';
|
|
2
2
|
import { Dayjs } from 'dayjs';
|
|
3
3
|
import * as React from 'react';
|
|
4
|
-
import pickerUtils from '../utils/pickerUtils';
|
|
5
4
|
import type { PickerType } from '../interface';
|
|
5
|
+
import pickerUtils from '../utils/pickerUtils';
|
|
6
6
|
|
|
7
7
|
export interface PanelBodyProps {
|
|
8
8
|
prefixCls?: string;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import Button from '../../../Button';
|
|
3
3
|
import useEvent from '../../../hooks/useEvent';
|
|
4
|
-
import Header from '../Header';
|
|
5
4
|
import type { PanelSharedProps } from '../../interface';
|
|
5
|
+
import Header from '../Header';
|
|
6
6
|
|
|
7
7
|
import pickerUtils from '../../utils/pickerUtils';
|
|
8
8
|
|
|
@@ -2,9 +2,9 @@ import React from 'react';
|
|
|
2
2
|
|
|
3
3
|
import { Dayjs } from 'dayjs';
|
|
4
4
|
import type { PickerPanelProps } from '../../interface';
|
|
5
|
-
import type { RangePanelProps } from './interface';
|
|
6
5
|
import PickerPanel from '../../picker-panel';
|
|
7
6
|
import pickerUtils from '../../utils/pickerUtils';
|
|
7
|
+
import type { RangePanelProps } from './interface';
|
|
8
8
|
|
|
9
9
|
function RangePanel(props: RangePanelProps) {
|
|
10
10
|
const {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Dayjs } from 'dayjs';
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
import type { PanelSharedProps, TimeUnit } from '../../interface';
|
|
4
3
|
import panelConfig from '../../configs';
|
|
4
|
+
import type { PanelSharedProps, TimeUnit } from '../../interface';
|
|
5
5
|
import pickerUtils from '../../utils/pickerUtils';
|
|
6
6
|
import TimeColumn from './TimeColumn';
|
|
7
7
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import Button from '../../../Button';
|
|
3
3
|
import useEvent from '../../../hooks/useEvent';
|
|
4
|
-
import Header from '../Header';
|
|
5
4
|
import type { PanelSharedProps } from '../../interface';
|
|
5
|
+
import Header from '../Header';
|
|
6
6
|
|
|
7
7
|
import pickerUtils from '../../utils/pickerUtils';
|
|
8
8
|
|
|
@@ -26,7 +26,8 @@ type PickerType =
|
|
|
26
26
|
|
|
27
27
|
const d = {
|
|
28
28
|
dayjs: dayjs,
|
|
29
|
-
init: (date?: dayjs.ConfigType, option?: dayjs.OptionType) =>
|
|
29
|
+
init: (date?: dayjs.ConfigType, option?: dayjs.OptionType) =>
|
|
30
|
+
dayjs(date, option),
|
|
30
31
|
getNow: () => {
|
|
31
32
|
return d.init(undefined);
|
|
32
33
|
},
|
|
@@ -306,9 +306,7 @@ const RangePickerMobile: FC<RangePickerProps> = (props) => {
|
|
|
306
306
|
</Space>
|
|
307
307
|
)}
|
|
308
308
|
<Button block type="primary" onClick={handleTabConfirm}>
|
|
309
|
-
{activeTab === 'start'
|
|
310
|
-
? rangepicker.next
|
|
311
|
-
: rangepicker.confirm}
|
|
309
|
+
{activeTab === 'start' ? rangepicker.next : rangepicker.confirm}
|
|
312
310
|
</Button>
|
|
313
311
|
</div>
|
|
314
312
|
}
|
package/src/Rate/star.tsx
CHANGED
|
@@ -66,7 +66,10 @@ const Star: React.FC<StarProps> = (props) => {
|
|
|
66
66
|
{renderCharacter()}
|
|
67
67
|
</span>
|
|
68
68
|
) : (
|
|
69
|
-
<StarHalf
|
|
69
|
+
<StarHalf
|
|
70
|
+
className={`${prefixCls}-star-half`}
|
|
71
|
+
aria-hidden="true"
|
|
72
|
+
/>
|
|
70
73
|
)}
|
|
71
74
|
</div>
|
|
72
75
|
<div
|
|
@@ -87,7 +90,10 @@ const Star: React.FC<StarProps> = (props) => {
|
|
|
87
90
|
{renderCharacter()}
|
|
88
91
|
</span>
|
|
89
92
|
) : (
|
|
90
|
-
<StarFull
|
|
93
|
+
<StarFull
|
|
94
|
+
className={`${prefixCls}-star-full`}
|
|
95
|
+
aria-hidden="true"
|
|
96
|
+
/>
|
|
91
97
|
)}
|
|
92
98
|
</div>
|
|
93
99
|
</li>
|
|
@@ -114,9 +120,15 @@ const Star: React.FC<StarProps> = (props) => {
|
|
|
114
120
|
{renderCharacter()}
|
|
115
121
|
</span>
|
|
116
122
|
) : active ? (
|
|
117
|
-
<StarFull
|
|
123
|
+
<StarFull
|
|
124
|
+
className={`${prefixCls}-star-active`}
|
|
125
|
+
aria-hidden="true"
|
|
126
|
+
/>
|
|
118
127
|
) : (
|
|
119
|
-
<StarFull
|
|
128
|
+
<StarFull
|
|
129
|
+
className={`${prefixCls}-star-inactive`}
|
|
130
|
+
aria-hidden="true"
|
|
131
|
+
/>
|
|
120
132
|
)}
|
|
121
133
|
</li>
|
|
122
134
|
)}
|
|
@@ -9,8 +9,16 @@ export default () => (
|
|
|
9
9
|
<Segmented variant="pill" options={['Daily', 'Weekly', 'Monthly']} />
|
|
10
10
|
</Space>
|
|
11
11
|
<Space block>
|
|
12
|
-
<Segmented
|
|
13
|
-
|
|
12
|
+
<Segmented
|
|
13
|
+
variant="pill"
|
|
14
|
+
size="small"
|
|
15
|
+
options={['Small', 'Default', 'Large']}
|
|
16
|
+
/>
|
|
17
|
+
<Segmented
|
|
18
|
+
variant="pill"
|
|
19
|
+
size="large"
|
|
20
|
+
options={['Small', 'Default', 'Large']}
|
|
21
|
+
/>
|
|
14
22
|
</Space>
|
|
15
23
|
<div style={{ width: 480 }}>
|
|
16
24
|
<Segmented
|
package/src/Segmented/index.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import InternalSegmented from './segmented';
|
|
2
2
|
|
|
3
3
|
export type {
|
|
4
|
-
SegmentedOption,
|
|
5
4
|
SegmentedLabeledOption,
|
|
5
|
+
SegmentedOption,
|
|
6
|
+
SegmentedProps,
|
|
6
7
|
SegmentedRawOption,
|
|
7
8
|
SegmentedSemanticDOM,
|
|
8
9
|
SegmentedValue,
|
|
9
|
-
SegmentedProps,
|
|
10
10
|
} from './interface';
|
|
11
11
|
|
|
12
12
|
export default InternalSegmented;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import clsx from 'clsx';
|
|
2
|
-
import React, { useContext, useId, useMemo } from 'react';
|
|
3
2
|
import { motion } from 'motion/react';
|
|
3
|
+
import React, { useContext, useId, useMemo } from 'react';
|
|
4
4
|
import { GlobalContext } from '../Config-Provider';
|
|
5
5
|
import useMergedState from '../hooks/useMergedState';
|
|
6
6
|
import mergeContextToProps from '../utils/mergeContextToProps';
|
|
@@ -13,9 +13,7 @@ import type {
|
|
|
13
13
|
|
|
14
14
|
import './style/index.less';
|
|
15
15
|
|
|
16
|
-
const normalizeOption = (
|
|
17
|
-
option: SegmentedOption,
|
|
18
|
-
): SegmentedLabeledOption => {
|
|
16
|
+
const normalizeOption = (option: SegmentedOption): SegmentedLabeledOption => {
|
|
19
17
|
if (typeof option === 'string' || typeof option === 'number') {
|
|
20
18
|
return { label: String(option), value: option };
|
|
21
19
|
}
|
|
@@ -47,10 +45,7 @@ const Segmented = React.forwardRef<HTMLDivElement, SegmentedProps>(
|
|
|
47
45
|
...rest
|
|
48
46
|
} = props;
|
|
49
47
|
|
|
50
|
-
const items = useMemo(
|
|
51
|
-
() => options.map(normalizeOption),
|
|
52
|
-
[options],
|
|
53
|
-
);
|
|
48
|
+
const items = useMemo(() => options.map(normalizeOption), [options]);
|
|
54
49
|
|
|
55
50
|
const firstValue = items[0]?.value;
|
|
56
51
|
|
|
@@ -104,9 +99,7 @@ const Segmented = React.forwardRef<HTMLDivElement, SegmentedProps>(
|
|
|
104
99
|
) : null}
|
|
105
100
|
<span className={`${prefixCls}-item-inner`}>
|
|
106
101
|
{item.icon ? (
|
|
107
|
-
<span className={`${prefixCls}-item-icon`}>
|
|
108
|
-
{item.icon}
|
|
109
|
-
</span>
|
|
102
|
+
<span className={`${prefixCls}-item-icon`}>{item.icon}</span>
|
|
110
103
|
) : null}
|
|
111
104
|
{item.label !== undefined && item.label !== null ? (
|
|
112
105
|
<span className={`${prefixCls}-item-label`}>
|
package/src/Select/interface.ts
CHANGED