@broxus/react-uikit 0.16.0 → 0.16.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/dist/cjs/components/Button/Button.js +4 -4
- package/dist/cjs/components/ConfigProvider/index.d.ts +7 -7
- package/dist/cjs/components/Control/Input/Password/index.js +2 -2
- package/dist/cjs/components/Control/Input/useInput.js +7 -8
- package/dist/cjs/components/Control/index.scss +1 -1
- package/dist/cjs/components/DatePicker/generatePurePicker.d.ts +24 -0
- package/dist/cjs/components/DatePicker/generatePurePicker.js +78 -0
- package/dist/cjs/components/DatePicker/generateSinglePicker.js +3 -3
- package/dist/cjs/components/DatePicker/index.d.ts +3 -0
- package/dist/cjs/components/DatePicker/index.js +3 -0
- package/dist/cjs/components/DatePicker/index.scss +5 -5
- package/dist/cjs/components/DatePicker/types.d.ts +14 -3
- package/dist/cjs/styles/variables.scss +8 -8
- package/dist/cjs/tsconfig.cjs.tsbuildinfo +1 -1
- package/dist/esm/components/Button/Button.js +4 -4
- package/dist/esm/components/ConfigProvider/index.d.ts +7 -7
- package/dist/esm/components/Control/Input/Password/index.js +2 -2
- package/dist/esm/components/Control/Input/useInput.js +7 -8
- package/dist/esm/components/Control/index.scss +1 -1
- package/dist/esm/components/DatePicker/generatePurePicker.d.ts +24 -0
- package/dist/esm/components/DatePicker/generatePurePicker.js +38 -0
- package/dist/esm/components/DatePicker/generateSinglePicker.js +3 -3
- package/dist/esm/components/DatePicker/index.d.ts +3 -0
- package/dist/esm/components/DatePicker/index.js +3 -0
- package/dist/esm/components/DatePicker/index.scss +5 -5
- package/dist/esm/components/DatePicker/types.d.ts +14 -3
- package/dist/esm/styles/variables.scss +8 -8
- package/dist/esm/tsconfig.esm.tsbuildinfo +1 -1
- package/package.json +2 -2
|
@@ -6,7 +6,7 @@ import { Link } from '../../components/Link';
|
|
|
6
6
|
const defaultElement = 'button';
|
|
7
7
|
export const Button = React.forwardRef((props, ref) => {
|
|
8
8
|
const config = useConfig();
|
|
9
|
-
const { component = defaultElement,
|
|
9
|
+
const { component = defaultElement, ghost, htmlType = 'button', prefixCls = config.button?.prefixCls ?? config.prefixCls, shape = config.button?.shape ?? config.buttonShape, size = config.button?.size ?? config.buttonSize, type, ...restProps } = props;
|
|
10
10
|
const buttonRef = React.useRef(null);
|
|
11
11
|
const onClick = React.useCallback(event => {
|
|
12
12
|
if (restProps.disabled) {
|
|
@@ -15,7 +15,7 @@ export const Button = React.forwardRef((props, ref) => {
|
|
|
15
15
|
}
|
|
16
16
|
restProps.onClick?.(event);
|
|
17
17
|
}, [restProps]);
|
|
18
|
-
const rootCls = React.useMemo(() => config.getRootPrefixCls(prefixCls
|
|
18
|
+
const rootCls = React.useMemo(() => config.getRootPrefixCls(prefixCls, 'button'), [config, prefixCls]);
|
|
19
19
|
const className = React.useMemo(() => classNames(rootCls, {
|
|
20
20
|
[`${rootCls}-${type}`]: type !== undefined,
|
|
21
21
|
[`${rootCls}-ghost`]: ghost === true,
|
|
@@ -23,9 +23,9 @@ export const Button = React.forwardRef((props, ref) => {
|
|
|
23
23
|
[`${rootCls}-${shape}`]: shape !== undefined && ['circle', 'round'].includes(shape),
|
|
24
24
|
}, restProps.className), [rootCls, type, ghost, size, shape, restProps.className]);
|
|
25
25
|
if (restProps.href !== undefined) {
|
|
26
|
-
return (React.createElement(Component, { ref: ref || buttonRef, component: Link, href: restProps.href, ...restProps, className: className, onClick: onClick }
|
|
26
|
+
return (React.createElement(Component, { ref: ref || buttonRef, component: Link, href: restProps.href, ...restProps, className: className, onClick: onClick }));
|
|
27
27
|
}
|
|
28
|
-
return (React.createElement(Component, { ref: ref || buttonRef, component: component, type: htmlType, ...restProps, className: className, onClick: onClick }
|
|
28
|
+
return (React.createElement(Component, { ref: ref || buttonRef, component: component, type: htmlType, ...restProps, className: className, onClick: onClick }));
|
|
29
29
|
});
|
|
30
30
|
if (process.env.NODE_ENV !== 'production') {
|
|
31
31
|
Button.displayName = 'Button';
|
|
@@ -21,16 +21,16 @@ export type ConfigContextConsumedProps = {
|
|
|
21
21
|
tertiaryColorMode?: ColorMode;
|
|
22
22
|
};
|
|
23
23
|
checkbox?: {
|
|
24
|
-
direction?: Direction
|
|
24
|
+
direction?: Direction;
|
|
25
25
|
prefixCls?: string;
|
|
26
26
|
};
|
|
27
27
|
control?: {
|
|
28
|
-
direction?: Direction
|
|
28
|
+
direction?: Direction;
|
|
29
29
|
prefixCls?: string;
|
|
30
30
|
clearIcon?: React.ReactNode | ((props: PropsWithMouseHandler) => React.ReactElement);
|
|
31
31
|
};
|
|
32
32
|
datePicker?: {
|
|
33
|
-
direction?: Direction
|
|
33
|
+
direction?: Direction;
|
|
34
34
|
prefixCls?: string;
|
|
35
35
|
clearIcon?: React.ReactNode | (() => React.ReactElement);
|
|
36
36
|
nextIcon?: React.ReactNode;
|
|
@@ -39,7 +39,7 @@ export type ConfigContextConsumedProps = {
|
|
|
39
39
|
superPrevIcon?: React.ReactNode;
|
|
40
40
|
superNextIcon?: React.ReactNode;
|
|
41
41
|
};
|
|
42
|
-
direction?: Direction
|
|
42
|
+
direction?: Direction;
|
|
43
43
|
getPopupContainer?: (triggerNode?: HTMLElement) => HTMLElement;
|
|
44
44
|
getRootPrefixCls: (prefix?: string, component?: string) => string;
|
|
45
45
|
getTooltipConfig: (props: string | TooltipOptions | undefined) => {
|
|
@@ -48,7 +48,7 @@ export type ConfigContextConsumedProps = {
|
|
|
48
48
|
inverseGlobalColorMode?: ColorMode;
|
|
49
49
|
prefixCls: string;
|
|
50
50
|
radio?: {
|
|
51
|
-
direction?: Direction
|
|
51
|
+
direction?: Direction;
|
|
52
52
|
prefixCls?: string;
|
|
53
53
|
};
|
|
54
54
|
section?: {
|
|
@@ -58,7 +58,7 @@ export type ConfigContextConsumedProps = {
|
|
|
58
58
|
tertiaryColorMode?: ColorMode;
|
|
59
59
|
};
|
|
60
60
|
select?: {
|
|
61
|
-
direction?: Direction
|
|
61
|
+
direction?: Direction;
|
|
62
62
|
prefixCls?: string;
|
|
63
63
|
addIcon?: React.ReactNode | ((props: PropsWithMouseHandler) => React.ReactElement);
|
|
64
64
|
arrowIcon?: React.ReactNode | ((props: {
|
|
@@ -70,7 +70,7 @@ export type ConfigContextConsumedProps = {
|
|
|
70
70
|
searchIcon?: React.ReactNode | (() => React.ReactElement);
|
|
71
71
|
};
|
|
72
72
|
timePicker?: {
|
|
73
|
-
direction?: Direction
|
|
73
|
+
direction?: Direction;
|
|
74
74
|
prefixCls?: string;
|
|
75
75
|
clearIcon?: React.ReactNode | (() => React.ReactElement);
|
|
76
76
|
suffixIcon?: React.ReactNode;
|
|
@@ -7,11 +7,11 @@ import './index.scss';
|
|
|
7
7
|
import '../../index.scss';
|
|
8
8
|
export const Password = React.forwardRef((props, ref) => {
|
|
9
9
|
const config = useConfig();
|
|
10
|
-
const { prefixCls = config.control?.prefixCls
|
|
10
|
+
const { prefixCls = config.control?.prefixCls ?? config.prefixCls, onBlur: onBlurCallback, onChange: onChangeCallback, ...restProps } = props;
|
|
11
11
|
const inputRef = React.useRef(null);
|
|
12
12
|
const removePasswordTimeout = React.useRef(null);
|
|
13
13
|
const [visible, setVisible] = React.useState(false);
|
|
14
|
-
const controlCls = React.useMemo(() => config.getRootPrefixCls(prefixCls
|
|
14
|
+
const controlCls = React.useMemo(() => config.getRootPrefixCls(prefixCls, 'control'), [config, prefixCls]);
|
|
15
15
|
const removePasswordValueAttribute = React.useCallback(() => {
|
|
16
16
|
removePasswordTimeout.current = setTimeout(() => {
|
|
17
17
|
const input = inputRef?.current?.getInputRef()?.current;
|
|
@@ -10,7 +10,7 @@ export function fixControlledValue(value) {
|
|
|
10
10
|
export function useInput(props) {
|
|
11
11
|
const config = useConfig();
|
|
12
12
|
const inputRef = React.useRef(null);
|
|
13
|
-
const { className, direction = config.control?.direction || config.direction, prefixCls = config.control?.prefixCls
|
|
13
|
+
const { className, direction = config.control?.direction || config.direction, prefixCls = config.control?.prefixCls ?? config.prefixCls, size, state, useInternalValueState = true, onChange: onChangeCallback, onClear: onClearCallback, onPressEnter, ...restProps } = props;
|
|
14
14
|
const [focused, setFocused] = React.useState(false);
|
|
15
15
|
const [internalValue, setInternalValue] = React.useState(useInternalValueState ? restProps.value || restProps.defaultValue : undefined);
|
|
16
16
|
const onChange = React.useCallback((event) => {
|
|
@@ -47,6 +47,7 @@ export function useInput(props) {
|
|
|
47
47
|
}, [onPressEnter, restProps]);
|
|
48
48
|
const inputProps = React.useMemo(() => ({
|
|
49
49
|
...restProps,
|
|
50
|
+
prefixCls,
|
|
50
51
|
value: fixControlledValue(internalValue || restProps.value),
|
|
51
52
|
// eslint-disable-next-line sort-keys
|
|
52
53
|
onBlur,
|
|
@@ -54,16 +55,16 @@ export function useInput(props) {
|
|
|
54
55
|
onClear,
|
|
55
56
|
onFocus,
|
|
56
57
|
onKeyDown,
|
|
57
|
-
}), [restProps, internalValue, onBlur, onChange, onClear, onFocus, onKeyDown]);
|
|
58
|
-
const controlCls = React.useMemo(() => config.getRootPrefixCls(prefixCls
|
|
58
|
+
}), [restProps, prefixCls, internalValue, onBlur, onChange, onClear, onFocus, onKeyDown]);
|
|
59
|
+
const controlCls = React.useMemo(() => config.getRootPrefixCls(prefixCls, 'control'), [config, prefixCls]);
|
|
59
60
|
const wrapperClasses = React.useMemo(() => classNames(controlCls, {
|
|
60
61
|
[`${controlCls}-${restProps.type}`]: restProps.type,
|
|
61
62
|
[`${controlCls}-${size}`]: size,
|
|
62
63
|
[`${controlCls}-${state}`]: state,
|
|
63
64
|
[`${controlCls}-rtl`]: direction === 'rtl',
|
|
64
|
-
[`${prefixCls
|
|
65
|
-
[`${prefixCls
|
|
66
|
-
[`${prefixCls
|
|
65
|
+
[`${prefixCls}-disabled`]: restProps.disabled,
|
|
66
|
+
[`${prefixCls}-focused`]: focused,
|
|
67
|
+
[`${prefixCls}-readonly`]: restProps.readOnly,
|
|
67
68
|
}, className), [
|
|
68
69
|
controlCls,
|
|
69
70
|
restProps.type,
|
|
@@ -73,8 +74,6 @@ export function useInput(props) {
|
|
|
73
74
|
state,
|
|
74
75
|
direction,
|
|
75
76
|
prefixCls,
|
|
76
|
-
config.control?.prefixCls,
|
|
77
|
-
config.prefixCls,
|
|
78
77
|
focused,
|
|
79
78
|
className,
|
|
80
79
|
]);
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { type GenerateConfig } from 'rc-picker/lib/generate';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { type GenericTimePickerProps, type PickerPanelProps, type PickerPanelPropsWithMultiple } from '../../components/DatePicker/types';
|
|
4
|
+
import { type AnyObject } from '../../types';
|
|
5
|
+
export declare const generatePurePicker: <DateType extends AnyObject = AnyObject>(generateConfig: GenerateConfig<DateType>) => {
|
|
6
|
+
DatePicker: (<ValueType = DateType>(props: PickerPanelPropsWithMultiple<DateType, PickerPanelProps<DateType>, ValueType>) => React.ReactElement) & {
|
|
7
|
+
displayName?: string;
|
|
8
|
+
};
|
|
9
|
+
MonthPicker: (<ValueType = DateType>(props: PickerPanelPropsWithMultiple<DateType, Omit<PickerPanelProps<DateType>, "picker">, ValueType>) => React.ReactElement) & {
|
|
10
|
+
displayName?: string;
|
|
11
|
+
};
|
|
12
|
+
QuarterPicker: (<ValueType = DateType>(props: PickerPanelPropsWithMultiple<DateType, Omit<PickerPanelProps<DateType>, "picker">, ValueType>) => React.ReactElement) & {
|
|
13
|
+
displayName?: string;
|
|
14
|
+
};
|
|
15
|
+
TimePicker: (<ValueType = DateType>(props: PickerPanelPropsWithMultiple<DateType, Omit<GenericTimePickerProps<DateType>, "picker">, ValueType>) => React.ReactElement) & {
|
|
16
|
+
displayName?: string;
|
|
17
|
+
};
|
|
18
|
+
WeekPicker: (<ValueType = DateType>(props: PickerPanelPropsWithMultiple<DateType, Omit<PickerPanelProps<DateType>, "picker">, ValueType>) => React.ReactElement) & {
|
|
19
|
+
displayName?: string;
|
|
20
|
+
};
|
|
21
|
+
YearPicker: (<ValueType = DateType>(props: PickerPanelPropsWithMultiple<DateType, Omit<PickerPanelProps<DateType>, "picker">, ValueType>) => React.ReactElement) & {
|
|
22
|
+
displayName?: string;
|
|
23
|
+
};
|
|
24
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { PickerPanel } from 'rc-picker';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { useConfig } from '../../components/ConfigProvider';
|
|
4
|
+
import { MONTH, MONTHPICKER, QUARTER, QUARTERPICKER, TIME, TIMEPICKER, WEEK, WEEKPICKER, YEAR, YEARPICKER, } from '../../components/DatePicker/constants';
|
|
5
|
+
// eslint-disable-next-line camelcase
|
|
6
|
+
import en_US from '../../components/DatePicker/locale/en_US';
|
|
7
|
+
import { useComponents } from '../../components/DatePicker/useComponents';
|
|
8
|
+
import { getMotionName } from '../../utils';
|
|
9
|
+
export const generatePurePicker = (generateConfig) => {
|
|
10
|
+
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type,@typescript-eslint/explicit-module-boundary-types
|
|
11
|
+
const getPanel = (picker, displayName) => {
|
|
12
|
+
const consumerName = displayName === TIMEPICKER ? 'timePicker' : 'datePicker';
|
|
13
|
+
const Picker = React.forwardRef((props, ref) => {
|
|
14
|
+
const config = useConfig();
|
|
15
|
+
const ctxPickerConfig = React.useMemo(() => config[consumerName] || {}, [config]);
|
|
16
|
+
const { components, direction = ctxPickerConfig.direction || config.direction, locale = en_US, prefixCls = `${config.prefixCls}-datepicker`, ...restProps } = props;
|
|
17
|
+
const pickerRef = React.useRef(null);
|
|
18
|
+
const mergedPicker = picker || restProps.picker;
|
|
19
|
+
const mergedComponents = useComponents(components);
|
|
20
|
+
React.useImperativeHandle(ref, () => pickerRef.current, []);
|
|
21
|
+
return (
|
|
22
|
+
// @ts-ignore
|
|
23
|
+
React.createElement(PickerPanel, { ref: pickerRef, components: mergedComponents, direction: direction, generateConfig: generateConfig, locale: locale.lang, picker: mergedPicker, prefixCls: prefixCls, nextIcon: React.createElement("span", { className: `${prefixCls}-next-icon` }), prevIcon: React.createElement("span", { className: `${prefixCls}-prev-icon` }), superPrevIcon: React.createElement("span", { className: `${prefixCls}-super-prev-icon` }), superNextIcon: React.createElement("span", { className: `${prefixCls}-super-next-icon` }), transitionName: getMotionName(config.prefixCls, 'slide-bottom-small'), ...restProps }));
|
|
24
|
+
});
|
|
25
|
+
if (process.env.NODE_ENV !== 'production' && displayName) {
|
|
26
|
+
Picker.displayName = displayName;
|
|
27
|
+
}
|
|
28
|
+
return Picker;
|
|
29
|
+
};
|
|
30
|
+
const DatePicker = getPanel();
|
|
31
|
+
const MonthPicker = getPanel(MONTH, MONTHPICKER);
|
|
32
|
+
const QuarterPicker = getPanel(QUARTER, QUARTERPICKER);
|
|
33
|
+
// @ts-ignore
|
|
34
|
+
const TimePicker = getPanel(TIME, TIMEPICKER);
|
|
35
|
+
const WeekPicker = getPanel(WEEK, WEEKPICKER);
|
|
36
|
+
const YearPicker = getPanel(YEAR, YEARPICKER);
|
|
37
|
+
return { DatePicker, MonthPicker, QuarterPicker, TimePicker, WeekPicker, YearPicker };
|
|
38
|
+
};
|
|
@@ -17,8 +17,8 @@ export const generateSinglePicker = (generateConfig) => {
|
|
|
17
17
|
const consumerName = displayName === TIMEPICKER ? 'timePicker' : 'datePicker';
|
|
18
18
|
const Picker = React.forwardRef((props, ref) => {
|
|
19
19
|
const config = useConfig();
|
|
20
|
-
const ctxPickerConfig = config[consumerName] || {};
|
|
21
|
-
const { allowClear = true, builtinPlacements = placements, className, components, direction = ctxPickerConfig.direction
|
|
20
|
+
const ctxPickerConfig = React.useMemo(() => config[consumerName] || {}, [config]);
|
|
21
|
+
const { allowClear = true, builtinPlacements = placements, className, components, direction = ctxPickerConfig.direction ?? config.direction, getPopupContainer = config.getPopupContainer, locale = en_US, placeholder, placement = 'bottom-left', popupClassName, prefixCls = `${config.prefixCls}-datepicker`, rootClassName, size, state, style, onCalendarChange, ...restProps } = props;
|
|
22
22
|
const pickerRef = React.useRef(null);
|
|
23
23
|
const mergedPicker = picker || restProps.picker;
|
|
24
24
|
const mergedComponents = useComponents(components);
|
|
@@ -50,7 +50,7 @@ export const generateSinglePicker = (generateConfig) => {
|
|
|
50
50
|
[`${prefixCls}-rtl`]: direction === 'rtl',
|
|
51
51
|
}, className), classNames: {
|
|
52
52
|
popup: classNames(popupClassName),
|
|
53
|
-
}, components: mergedComponents,
|
|
53
|
+
}, components: mergedComponents, direction: direction, generateConfig: generateConfig, getPopupContainer: getPopupContainer, locale: locale.lang, picker: mergedPicker, placeholder: getPlaceholder(locale, mergedPicker, placeholder), placement: placement, prefixCls: prefixCls, suffixIcon: suffixIcon, nextIcon: React.createElement("span", { className: `${prefixCls}-next-icon` }), prevIcon: React.createElement("span", { className: `${prefixCls}-prev-icon` }), superPrevIcon: React.createElement("span", { className: `${prefixCls}-super-prev-icon` }), superNextIcon: React.createElement("span", { className: `${prefixCls}-super-next-icon` }), style: style, transitionName: getMotionName(config.prefixCls, 'slide-bottom-small'), onCalendarChange: onCalendarChange, ...restProps, allowClear: mergedAllowClear, styles: {
|
|
54
54
|
popup: { ...restProps.styles },
|
|
55
55
|
} })));
|
|
56
56
|
});
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import { type DateTime } from 'luxon';
|
|
2
2
|
import { generatePicker } from '../../components/DatePicker/generatePicker';
|
|
3
|
+
import { generatePurePicker } from '../../components/DatePicker/generatePurePicker';
|
|
3
4
|
import './index.scss';
|
|
4
5
|
export * from '../../components/DatePicker/locale';
|
|
5
6
|
export * from '../../components/DatePicker/types';
|
|
6
7
|
export interface DatePicker extends ReturnType<typeof generatePicker<DateTime>> {
|
|
7
8
|
generatePicker: typeof generatePicker;
|
|
9
|
+
generatePurePicker: typeof generatePurePicker;
|
|
10
|
+
Panel: ReturnType<typeof generatePurePicker<DateTime>>;
|
|
8
11
|
}
|
|
9
12
|
export declare const DatePicker: DatePicker;
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import dayjsGenerateConfig from 'rc-picker/lib/generate/luxon';
|
|
2
2
|
import { generatePicker } from '../../components/DatePicker/generatePicker';
|
|
3
|
+
import { generatePurePicker } from '../../components/DatePicker/generatePurePicker';
|
|
3
4
|
import './index.scss';
|
|
4
5
|
export * from '../../components/DatePicker/locale';
|
|
5
6
|
export * from '../../components/DatePicker/types';
|
|
6
7
|
const InternalDatePicker = generatePicker(dayjsGenerateConfig);
|
|
7
8
|
export const DatePicker = InternalDatePicker;
|
|
8
9
|
DatePicker.generatePicker = generatePicker;
|
|
10
|
+
DatePicker.generatePurePicker = generatePurePicker;
|
|
11
|
+
DatePicker.Panel = generatePurePicker(dayjsGenerateConfig);
|
|
@@ -429,7 +429,7 @@
|
|
|
429
429
|
z-index: 1;
|
|
430
430
|
}
|
|
431
431
|
|
|
432
|
-
.uk-datepicker-cell-disabled {
|
|
432
|
+
.uk-datepicker-cell-disabled:not(.uk-datepicker-cell-selected) {
|
|
433
433
|
color: var(--datepicker-cell-disabled-color);
|
|
434
434
|
cursor: not-allowed;
|
|
435
435
|
}
|
|
@@ -520,7 +520,7 @@
|
|
|
520
520
|
color: var(--datepicker-cell-active-color);
|
|
521
521
|
}
|
|
522
522
|
|
|
523
|
-
.uk-datepicker-time-panel-cell-disabled .uk-datepicker-time-panel-cell-inner {
|
|
523
|
+
.uk-datepicker-time-panel-cell-disabled:not(.uk-datepicker-time-panel-cell-selected) .uk-datepicker-time-panel-cell-inner {
|
|
524
524
|
color: var(--datepicker-cell-disabled-color);
|
|
525
525
|
cursor: not-allowed;
|
|
526
526
|
}
|
|
@@ -618,13 +618,13 @@
|
|
|
618
618
|
--datepicker-header-padding-horizontal: var(--global-small-gutter);
|
|
619
619
|
--datepicker-header-font-size: var(--global-font-size);
|
|
620
620
|
--datepicker-header-font-weight: var(--global-bold-font-weight);
|
|
621
|
-
--datepicker-header-height: var(--global-control-height);
|
|
621
|
+
--datepicker-header-height: var(--global-control-large-height);
|
|
622
622
|
--datepicker-body-padding-horizontal: var(--global-gutter);
|
|
623
623
|
--datepicker-body-padding-vertical: var(--global-small-gutter);
|
|
624
624
|
--datepicker-header-button-color: var(--global-muted-color);
|
|
625
625
|
--datepicker-header-button-font-size: var(--global-font-size);
|
|
626
626
|
--datepicker-header-button-font-weight: var(--global-bold-font-weight);
|
|
627
|
-
--datepicker-header-button-line-height:
|
|
627
|
+
--datepicker-header-button-line-height: var(--global-control-large-height);
|
|
628
628
|
--datepicker-header-button-padding-horizontal: var(--global-small-gutter);
|
|
629
629
|
--datepicker-header-button-hover-color: var(--global-color);
|
|
630
630
|
--datepicker-header-view-button-hover-color: var(--global-primary-color);
|
|
@@ -633,7 +633,7 @@
|
|
|
633
633
|
--datepicker-footer-ranges-padding-horizontal: var(--global-small-gutter);
|
|
634
634
|
--datepicker-footer-ranges-padding-vertical: var(--global-small-gutter);
|
|
635
635
|
--datepicker-cell-border-radius: var(--global-small-border-radius);
|
|
636
|
-
--datepicker-cell-height:
|
|
636
|
+
--datepicker-cell-height: var(--global-control-height);
|
|
637
637
|
--datepicker-cell-width: #{$datepicker-cell-width};
|
|
638
638
|
--datepicker-cell-padding: var(--global-xsmall-gutter);
|
|
639
639
|
--datepicker-cell-color: var(--global-color);
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import { type PickerRef, type PickerProps as RcPickerProps, type RangePickerProps as RcRangePickerProps } from 'rc-picker';
|
|
1
|
+
import { type PickerRef, type PickerPanelProps as RcPickerPanelProps, type PickerProps as RcPickerProps, type RangePickerProps as RcRangePickerProps } from 'rc-picker';
|
|
2
2
|
import { type Locale as RcPickerLocale } from 'rc-picker/lib/interface';
|
|
3
3
|
import type * as React from 'react';
|
|
4
|
+
import { type TimePickerLocale } from '../../components/TimePicker';
|
|
4
5
|
import { type AnyObject, type SizeType, type StateType } from '../../types';
|
|
6
|
+
import { PickerPanelRef } from 'rc-picker/lib/PickerPanel';
|
|
5
7
|
export interface AdditionalPickerLocaleProps {
|
|
6
8
|
dateFormat?: string;
|
|
7
9
|
dateTimeFormat?: string;
|
|
@@ -22,7 +24,7 @@ export interface AdditionalPickerLocaleLangProps {
|
|
|
22
24
|
}
|
|
23
25
|
export interface PickerLocale extends AdditionalPickerLocaleProps {
|
|
24
26
|
lang: RcPickerLocale & AdditionalPickerLocaleLangProps;
|
|
25
|
-
timePickerLocale:
|
|
27
|
+
timePickerLocale: TimePickerLocale;
|
|
26
28
|
}
|
|
27
29
|
declare const DatePickerPlacements: readonly ["bottomLeft", "bottomRight", "topLeft", "topRight"];
|
|
28
30
|
type DatePickerPlacement = (typeof DatePickerPlacements)[number];
|
|
@@ -35,7 +37,10 @@ type InjectDefaultProps<Props> = Omit<Props, 'locale' | 'generateConfig' | 'hide
|
|
|
35
37
|
size?: SizeType;
|
|
36
38
|
state?: StateType;
|
|
37
39
|
};
|
|
38
|
-
export interface PickerProps<DateType extends AnyObject =
|
|
40
|
+
export interface PickerProps<DateType extends AnyObject = AnyObject> extends InjectDefaultProps<RcPickerProps<DateType>> {
|
|
41
|
+
}
|
|
42
|
+
export interface PickerPanelProps<DateType extends AnyObject = AnyObject> extends Omit<RcPickerPanelProps<DateType>, 'locale' | 'generateConfig' | 'hideHeader'> {
|
|
43
|
+
locale?: PickerLocale;
|
|
39
44
|
}
|
|
40
45
|
export interface RangePickerProps<DateType extends AnyObject = AnyObject> extends InjectDefaultProps<RcRangePickerProps<DateType>> {
|
|
41
46
|
}
|
|
@@ -47,4 +52,10 @@ export type PickerPropsWithMultiple<DateType extends AnyObject = any, InnerPicke
|
|
|
47
52
|
onChange?: (date: ValueType, dateString: string | string[]) => void;
|
|
48
53
|
onConfirm?: (date: ValueType) => void;
|
|
49
54
|
};
|
|
55
|
+
export type PickerPanelPropsWithMultiple<DateType extends AnyObject = any, InnerPickerProps extends PickerProps<DateType> = PickerProps<DateType>, ValueType = DateType> = Omit<InnerPickerProps, 'defaultValue' | 'value' | 'onChange' | 'onOk'> & React.RefAttributes<PickerPanelRef> & {
|
|
56
|
+
defaultValue?: ValueType | null;
|
|
57
|
+
value?: ValueType | null;
|
|
58
|
+
onChange?: (date: ValueType, dateString: string | string[]) => void;
|
|
59
|
+
onConfirm?: (date: ValueType) => void;
|
|
60
|
+
};
|
|
50
61
|
export {};
|
|
@@ -623,19 +623,14 @@ $countdown-separator-font-size-m: 3rem !default; /
|
|
|
623
623
|
// DatePicker
|
|
624
624
|
// ========================================================================
|
|
625
625
|
|
|
626
|
-
$datepicker-dropdown-background: $global-muted-background !default;
|
|
627
|
-
$datepicker-dropdown-border: $global-border !default;
|
|
628
|
-
$datepicker-dropdown-border-style: $global-border-style !default;
|
|
629
|
-
$datepicker-dropdown-border-width: $global-border-width !default;
|
|
630
|
-
$datepicker-dropdown-border-radius: $global-border-radius !default;
|
|
631
626
|
$datepicker-button-font-size: $global-font-size !default;
|
|
632
|
-
$datepicker-button-line-height:
|
|
627
|
+
$datepicker-button-line-height: $global-control-large-height !default;
|
|
633
628
|
$datepicker-button-padding-horizontal: $global-small-gutter !default;
|
|
634
629
|
$datepicker-body-padding-vertical: $global-small-gutter !default;
|
|
635
630
|
$datepicker-body-padding-horizontal: $global-gutter !default;
|
|
636
631
|
$datepicker-cell-border-radius: $global-small-border-radius !default;
|
|
637
|
-
$datepicker-cell-height:
|
|
638
|
-
$datepicker-cell-width:
|
|
632
|
+
$datepicker-cell-height: $global-control-height !default;
|
|
633
|
+
$datepicker-cell-width: $global-control-height * 1.05 !default;
|
|
639
634
|
$datepicker-cell-padding: $global-xsmall-gutter !default;
|
|
640
635
|
$datepicker-cell-color: $global-color !default;
|
|
641
636
|
$datepicker-cell-hover-background: $global-secondary-background !default;
|
|
@@ -646,6 +641,11 @@ $datepicker-cell-disabled-color: $global-muted-co
|
|
|
646
641
|
$datepicker-time-column-height: 252px !default;
|
|
647
642
|
$datepicker-time-column-width: 60px !default;
|
|
648
643
|
$datepicker-time-cell-height: 28px !default;
|
|
644
|
+
$datepicker-dropdown-background: $global-muted-background !default;
|
|
645
|
+
$datepicker-dropdown-border: $global-border !default;
|
|
646
|
+
$datepicker-dropdown-border-style: $global-border-style !default;
|
|
647
|
+
$datepicker-dropdown-border-width: $global-border-width !default;
|
|
648
|
+
$datepicker-dropdown-border-radius: $global-border-radius !default;
|
|
649
649
|
|
|
650
650
|
|
|
651
651
|
// Description list
|