@broxus/react-uikit 0.16.0 → 0.17.0
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 +11 -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/Select/index.d.ts +3 -2
- package/dist/cjs/components/Control/index.scss +1 -1
- package/dist/cjs/components/Control/types.d.ts +1 -0
- 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 +112 -85
- package/dist/cjs/components/DatePicker/types.d.ts +14 -3
- package/dist/cjs/components/Drop/index.d.ts +2 -1
- package/dist/cjs/styles/mixins.scss +23 -0
- 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 +11 -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/Select/index.d.ts +3 -2
- package/dist/esm/components/Control/index.scss +1 -1
- package/dist/esm/components/Control/types.d.ts +1 -0
- 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 +112 -85
- package/dist/esm/components/DatePicker/types.d.ts +14 -3
- package/dist/esm/components/Drop/index.d.ts +2 -1
- package/dist/esm/styles/mixins.scss +23 -0
- 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';
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { type ButtonProps } from '../../components/Button';
|
|
3
|
+
import { type PickerLocale } from '../../components/DatePicker';
|
|
3
4
|
import { type ColorMode } from '../../components/Inverse';
|
|
5
|
+
import { type TimePickerLocale } from '../../components/TimePicker';
|
|
4
6
|
import { type BreakpointsConfig, type Direction, type TooltipOptions } from '../../types';
|
|
5
7
|
type PropsWithMouseHandler = {
|
|
6
8
|
onClick: React.HTMLAttributes<HTMLElement>['onClick'];
|
|
@@ -21,16 +23,17 @@ export type ConfigContextConsumedProps = {
|
|
|
21
23
|
tertiaryColorMode?: ColorMode;
|
|
22
24
|
};
|
|
23
25
|
checkbox?: {
|
|
24
|
-
direction?: Direction
|
|
26
|
+
direction?: Direction;
|
|
25
27
|
prefixCls?: string;
|
|
26
28
|
};
|
|
27
29
|
control?: {
|
|
28
|
-
direction?: Direction
|
|
30
|
+
direction?: Direction;
|
|
29
31
|
prefixCls?: string;
|
|
30
32
|
clearIcon?: React.ReactNode | ((props: PropsWithMouseHandler) => React.ReactElement);
|
|
31
33
|
};
|
|
32
34
|
datePicker?: {
|
|
33
|
-
direction?: Direction
|
|
35
|
+
direction?: Direction;
|
|
36
|
+
locale?: PickerLocale;
|
|
34
37
|
prefixCls?: string;
|
|
35
38
|
clearIcon?: React.ReactNode | (() => React.ReactElement);
|
|
36
39
|
nextIcon?: React.ReactNode;
|
|
@@ -39,7 +42,7 @@ export type ConfigContextConsumedProps = {
|
|
|
39
42
|
superPrevIcon?: React.ReactNode;
|
|
40
43
|
superNextIcon?: React.ReactNode;
|
|
41
44
|
};
|
|
42
|
-
direction?: Direction
|
|
45
|
+
direction?: Direction;
|
|
43
46
|
getPopupContainer?: (triggerNode?: HTMLElement) => HTMLElement;
|
|
44
47
|
getRootPrefixCls: (prefix?: string, component?: string) => string;
|
|
45
48
|
getTooltipConfig: (props: string | TooltipOptions | undefined) => {
|
|
@@ -48,7 +51,7 @@ export type ConfigContextConsumedProps = {
|
|
|
48
51
|
inverseGlobalColorMode?: ColorMode;
|
|
49
52
|
prefixCls: string;
|
|
50
53
|
radio?: {
|
|
51
|
-
direction?: Direction
|
|
54
|
+
direction?: Direction;
|
|
52
55
|
prefixCls?: string;
|
|
53
56
|
};
|
|
54
57
|
section?: {
|
|
@@ -58,7 +61,7 @@ export type ConfigContextConsumedProps = {
|
|
|
58
61
|
tertiaryColorMode?: ColorMode;
|
|
59
62
|
};
|
|
60
63
|
select?: {
|
|
61
|
-
direction?: Direction
|
|
64
|
+
direction?: Direction;
|
|
62
65
|
prefixCls?: string;
|
|
63
66
|
addIcon?: React.ReactNode | ((props: PropsWithMouseHandler) => React.ReactElement);
|
|
64
67
|
arrowIcon?: React.ReactNode | ((props: {
|
|
@@ -70,7 +73,8 @@ export type ConfigContextConsumedProps = {
|
|
|
70
73
|
searchIcon?: React.ReactNode | (() => React.ReactElement);
|
|
71
74
|
};
|
|
72
75
|
timePicker?: {
|
|
73
|
-
direction?: Direction
|
|
76
|
+
direction?: Direction;
|
|
77
|
+
locale?: TimePickerLocale;
|
|
74
78
|
prefixCls?: string;
|
|
75
79
|
clearIcon?: React.ReactNode | (() => React.ReactElement);
|
|
76
80
|
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
|
]);
|
|
@@ -2,17 +2,18 @@ import { type BaseSelectRef, OptGroup, Option, type SelectProps as RcSelectProps
|
|
|
2
2
|
import { type OptionProps } from 'rc-select/lib/Option';
|
|
3
3
|
import { type BaseOptionType, type DefaultOptionType } from 'rc-select/lib/Select';
|
|
4
4
|
import * as React from 'react';
|
|
5
|
-
import { type ControlProps } from '../../../components/Control/types';
|
|
5
|
+
import { type ControlProps, type SelectPlacement } from '../../../components/Control/types';
|
|
6
6
|
import { type SizeType } from '../../../types';
|
|
7
7
|
import './index.scss';
|
|
8
8
|
import '../index.scss';
|
|
9
9
|
export type { BaseSelectRef, OptionProps };
|
|
10
|
-
export interface InternalSelectProps<ValueType = any, OptionType extends BaseOptionType | DefaultOptionType = DefaultOptionType> extends Omit<RcSelectProps<ValueType, OptionType>, 'allowClear' | 'mode'> {
|
|
10
|
+
export interface InternalSelectProps<ValueType = any, OptionType extends BaseOptionType | DefaultOptionType = DefaultOptionType> extends Omit<RcSelectProps<ValueType, OptionType>, 'allowClear' | 'mode' | 'placement'> {
|
|
11
11
|
mode?: 'multiple' | 'tags' | 'SECRET_COMBOBOX_MODE_DO_NOT_USE';
|
|
12
12
|
size?: SizeType;
|
|
13
13
|
}
|
|
14
14
|
export interface SelectProps<ValueType = any, OptionType extends BaseOptionType | DefaultOptionType = DefaultOptionType> extends Omit<ControlProps<ValueType>, 'value' | 'defaultValue'>, Omit<InternalSelectProps<ValueType, OptionType>, 'inputIcon' | 'mode' | 'getInputElement' | 'backfill'> {
|
|
15
15
|
mode?: 'multiple' | 'tags';
|
|
16
|
+
placement?: SelectPlacement;
|
|
16
17
|
showArrow?: boolean;
|
|
17
18
|
}
|
|
18
19
|
export declare const Select: (<ValueType = any, OptionType extends BaseOptionType | DefaultOptionType = DefaultOptionType>(props: SelectProps<ValueType, OptionType> & {
|
|
@@ -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);
|
|
@@ -16,7 +16,8 @@
|
|
|
16
16
|
|
|
17
17
|
@import '../../styles/variables.scss';
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
|
|
20
|
+
/* Picker
|
|
20
21
|
========================================================================== */
|
|
21
22
|
|
|
22
23
|
[class^='uk-datepicker'],
|
|
@@ -35,7 +36,7 @@
|
|
|
35
36
|
border-radius: var(--control-border-radius);
|
|
36
37
|
color: var(--control-color);
|
|
37
38
|
cursor: text;
|
|
38
|
-
display:
|
|
39
|
+
display: flex;
|
|
39
40
|
font-size: inherit;
|
|
40
41
|
min-height: var(--control-height);
|
|
41
42
|
padding-left: var(--control-padding-horizontal);
|
|
@@ -88,6 +89,9 @@
|
|
|
88
89
|
display: inline-flex;
|
|
89
90
|
position: relative;
|
|
90
91
|
width: 100%;
|
|
92
|
+
@if mixin-exists(hook-datepicker-input) {
|
|
93
|
+
@include hook-datepicker-input;
|
|
94
|
+
}
|
|
91
95
|
}
|
|
92
96
|
|
|
93
97
|
.uk-datepicker .uk-datepicker-input .uk-control {
|
|
@@ -95,7 +99,9 @@
|
|
|
95
99
|
padding: 0;
|
|
96
100
|
}
|
|
97
101
|
|
|
98
|
-
|
|
102
|
+
|
|
103
|
+
/* Panel
|
|
104
|
+
========================================================================== */
|
|
99
105
|
|
|
100
106
|
.uk-datepicker-panel-layout {
|
|
101
107
|
align-items: stretch;
|
|
@@ -147,6 +153,43 @@
|
|
|
147
153
|
}
|
|
148
154
|
}
|
|
149
155
|
|
|
156
|
+
.uk-datepicker-date-panel {
|
|
157
|
+
@if mixin-exists(hook-datepicker-date-panel) {
|
|
158
|
+
@include hook-datepicker-date-panel;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
.uk-datepicker-month-panel {
|
|
163
|
+
@if mixin-exists(hook-datepicker-month-panel) {
|
|
164
|
+
@include hook-datepicker-month-panel;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
.uk-datepicker-quarter-panel {
|
|
169
|
+
@if mixin-exists(hook-datepicker-quarter-panel) {
|
|
170
|
+
@include hook-datepicker-quarter-panel;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
.uk-datepicker-decade-panel {
|
|
175
|
+
@if mixin-exists(hook-datepicker-decade-panel) {
|
|
176
|
+
@include hook-datepicker-decade-panel;
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
.uk-datepicker-week-panel {
|
|
181
|
+
@if mixin-exists(hook-datepicker-week-panel) {
|
|
182
|
+
@include hook-datepicker-week-panel;
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
.uk-datepicker-year-panel {
|
|
187
|
+
@if mixin-exists(hook-datepicker-year-panel) {
|
|
188
|
+
@include hook-datepicker-year-panel;
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
/* Header */
|
|
150
193
|
.uk-datepicker-header {
|
|
151
194
|
align-items: center;
|
|
152
195
|
border-bottom: var(--datepicker-border-width) var(--datepicker-border-style) var(--datepicker-border);
|
|
@@ -171,6 +214,7 @@
|
|
|
171
214
|
}
|
|
172
215
|
}
|
|
173
216
|
|
|
217
|
+
/* Body and content */
|
|
174
218
|
.uk-datepicker-body {
|
|
175
219
|
padding: var(--datepicker-body-padding-vertical) var(--datepicker-body-padding-horizontal);
|
|
176
220
|
@if mixin-exists(hook-datepicker-body) {
|
|
@@ -188,14 +232,7 @@
|
|
|
188
232
|
}
|
|
189
233
|
}
|
|
190
234
|
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
.uk-datepicker-content th {
|
|
194
|
-
box-sizing: border-box;
|
|
195
|
-
height: var(--datepicker-cell-height);
|
|
196
|
-
padding: 0;
|
|
197
|
-
}
|
|
198
|
-
|
|
235
|
+
// Elements
|
|
199
236
|
.uk-datepicker-header button {
|
|
200
237
|
align-items: center;
|
|
201
238
|
appearance: none;
|
|
@@ -215,30 +252,18 @@
|
|
|
215
252
|
padding: 0 var(--datepicker-header-button-padding-horizontal);
|
|
216
253
|
text-align: center;
|
|
217
254
|
transition: color var(--transition-medium-fast-duration);
|
|
218
|
-
@if mixin-exists(hook-datepicker-header-button) {
|
|
219
|
-
@include hook-datepicker-header-button;
|
|
220
|
-
}
|
|
221
255
|
}
|
|
222
256
|
|
|
223
257
|
.uk-datepicker-header-view button {
|
|
224
258
|
color: inherit;
|
|
225
|
-
@if mixin-exists(hook-datepicker-header-view-button) {
|
|
226
|
-
@include hook-datepicker-header-view-button;
|
|
227
|
-
}
|
|
228
259
|
}
|
|
229
260
|
|
|
230
261
|
.uk-datepicker-header-view button:hover {
|
|
231
262
|
color: var(--datepicker-header-view-button-hover-color);
|
|
232
|
-
@if mixin-exists(hook-datepicker-header-view-button-hover) {
|
|
233
|
-
@include hook-datepicker-header-view-button-hover;
|
|
234
|
-
}
|
|
235
263
|
}
|
|
236
264
|
|
|
237
265
|
.uk-datepicker-header > button:hover {
|
|
238
266
|
color: var(--datepicker-header-button-hover-color);
|
|
239
|
-
@if mixin-exists(hook-datepicker-header-button-hover) {
|
|
240
|
-
@include hook-datepicker-header-button-hover;
|
|
241
|
-
}
|
|
242
267
|
}
|
|
243
268
|
|
|
244
269
|
.uk-datepicker-prev-icon,
|
|
@@ -291,48 +316,13 @@
|
|
|
291
316
|
width: 7px;
|
|
292
317
|
}
|
|
293
318
|
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
.uk-datepicker-time-panel .uk-datepicker-content {
|
|
299
|
-
display: flex;
|
|
300
|
-
flex: auto;
|
|
301
|
-
height: var(--datepicker-time-column-height);
|
|
302
|
-
@if mixin-exists(hook-datepicker-time-panel-content) {
|
|
303
|
-
@include hook-datepicker-time-panel-content;
|
|
304
|
-
}
|
|
305
|
-
}
|
|
306
|
-
|
|
307
|
-
.uk-datepicker-time-panel-column {
|
|
308
|
-
flex: 1 0 auto;
|
|
309
|
-
margin: var(--global-xsmall-margin) 0;
|
|
310
|
-
overflow: hidden;
|
|
311
|
-
padding: 0;
|
|
312
|
-
scrollbar-color: var(--global-scroll-background, var(--global-muted-backgrounf, rgba(#000, 0.15))) transparent;
|
|
313
|
-
scrollbar-width: thin;
|
|
314
|
-
text-align: start;
|
|
315
|
-
transition: background var(--transition-medium-fast-duration);
|
|
316
|
-
width: var(--datepicker-time-column-width);
|
|
317
|
-
@if mixin-exists(hook-datepicker-time-panel-column) {
|
|
318
|
-
@include hook-datepicker-time-panel-column;
|
|
319
|
-
}
|
|
320
|
-
}
|
|
321
|
-
|
|
322
|
-
.uk-datepicker-time-panel-column:hover {
|
|
323
|
-
overflow-y: auto;
|
|
324
|
-
}
|
|
325
|
-
|
|
326
|
-
.uk-datepicker-time-panel-column ul {
|
|
327
|
-
list-style: none;
|
|
328
|
-
margin: 0;
|
|
319
|
+
.uk-datepicker-content th {
|
|
320
|
+
box-sizing: border-box;
|
|
321
|
+
height: var(--datepicker-cell-height);
|
|
329
322
|
padding: 0;
|
|
330
323
|
}
|
|
331
324
|
|
|
332
|
-
/*
|
|
333
|
-
* Footer
|
|
334
|
-
*/
|
|
335
|
-
|
|
325
|
+
/* Footer */
|
|
336
326
|
.uk-datepicker-footer {
|
|
337
327
|
border-top: var(--datepicker-border-width) var(--datepicker-border-style) var(--datepicker-border);
|
|
338
328
|
padding: var(--datepicker-footer-padding-vertical) var(--datepicker-footer-padding-horizontal);
|
|
@@ -386,6 +376,10 @@
|
|
|
386
376
|
z-index: 1;
|
|
387
377
|
}
|
|
388
378
|
|
|
379
|
+
.uk-datepicker-cell-in-view {
|
|
380
|
+
color: var(--datepicker-cell-color);
|
|
381
|
+
}
|
|
382
|
+
|
|
389
383
|
.uk-datepicker-cell-inner {
|
|
390
384
|
border-radius: var(--datepicker-cell-border-radius);
|
|
391
385
|
display: inline-block;
|
|
@@ -394,13 +388,12 @@
|
|
|
394
388
|
min-width: var(--datepicker-cell-height);
|
|
395
389
|
position: relative;
|
|
396
390
|
z-index: 2;
|
|
391
|
+
@if mixin-exists(hook-datepicker-cell-inner) {
|
|
392
|
+
@include hook-datepicker-cell-inner;
|
|
393
|
+
}
|
|
397
394
|
}
|
|
398
395
|
|
|
399
|
-
|
|
400
|
-
color: var(--datepicker-cell-color);
|
|
401
|
-
}
|
|
402
|
-
|
|
403
|
-
/* Hover Cell */
|
|
396
|
+
/* Hover cell state */
|
|
404
397
|
.uk-datepicker-cell:hover:not(.uk-datepicker-cell-in-view, .uk-datepicker-cell-disabled) .uk-datepicker-cell-inner,
|
|
405
398
|
.uk-datepicker-cell:hover:not(
|
|
406
399
|
.uk-datepicker-cell-selected,
|
|
@@ -418,18 +411,8 @@
|
|
|
418
411
|
color: var(--datepicker-cell-active-color);
|
|
419
412
|
}
|
|
420
413
|
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
border-radius: var(--datepicker-cell-border-radius);
|
|
424
|
-
bottom: 0;
|
|
425
|
-
content: '';
|
|
426
|
-
inset-inline: 0;
|
|
427
|
-
position: absolute;
|
|
428
|
-
top: 0;
|
|
429
|
-
z-index: 1;
|
|
430
|
-
}
|
|
431
|
-
|
|
432
|
-
.uk-datepicker-cell-disabled {
|
|
414
|
+
/* Disabled cell state */
|
|
415
|
+
.uk-datepicker-cell-disabled:not(.uk-datepicker-cell-selected) {
|
|
433
416
|
color: var(--datepicker-cell-disabled-color);
|
|
434
417
|
cursor: not-allowed;
|
|
435
418
|
}
|
|
@@ -442,6 +425,18 @@
|
|
|
442
425
|
background: none;
|
|
443
426
|
}
|
|
444
427
|
|
|
428
|
+
/* Today */
|
|
429
|
+
.uk-datepicker-cell-in-view.uk-datepicker-cell-today .uk-datepicker-cell-inner::before {
|
|
430
|
+
border: var(--datepicker-border-width) var(--datepicker-border-style) var(--datepicker-border);
|
|
431
|
+
border-radius: var(--datepicker-cell-border-radius);
|
|
432
|
+
bottom: 0;
|
|
433
|
+
content: '';
|
|
434
|
+
inset-inline: 0;
|
|
435
|
+
position: absolute;
|
|
436
|
+
top: 0;
|
|
437
|
+
z-index: 1;
|
|
438
|
+
}
|
|
439
|
+
|
|
445
440
|
.uk-datepicker-cell-disabled.uk-datepicker-cell-today .uk-datepicker-cell-inner::before {
|
|
446
441
|
border-color: var(--datepicker-cell-disabled-border);
|
|
447
442
|
}
|
|
@@ -490,6 +485,39 @@
|
|
|
490
485
|
}
|
|
491
486
|
|
|
492
487
|
|
|
488
|
+
/* Time panel */
|
|
489
|
+
.uk-datepicker-time-panel .uk-datepicker-content {
|
|
490
|
+
display: flex;
|
|
491
|
+
flex: auto;
|
|
492
|
+
height: var(--datepicker-time-column-height);
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
.uk-datepicker-time-panel-column {
|
|
496
|
+
flex: 1 0 auto;
|
|
497
|
+
margin: var(--global-xsmall-margin) 0;
|
|
498
|
+
overflow: hidden;
|
|
499
|
+
padding: 0;
|
|
500
|
+
scrollbar-color: var(--global-scroll-background, var(--global-muted-backgrounf, rgba(#000, 0.15))) transparent;
|
|
501
|
+
scrollbar-width: thin;
|
|
502
|
+
text-align: start;
|
|
503
|
+
transition: background var(--transition-medium-fast-duration);
|
|
504
|
+
width: var(--datepicker-time-column-width);
|
|
505
|
+
@if mixin-exists(hook-datepicker-time-panel-column) {
|
|
506
|
+
@include hook-datepicker-time-panel-column;
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
.uk-datepicker-time-panel-column:hover {
|
|
511
|
+
overflow-y: auto;
|
|
512
|
+
}
|
|
513
|
+
|
|
514
|
+
.uk-datepicker-time-panel-column ul {
|
|
515
|
+
list-style: none;
|
|
516
|
+
margin: 0;
|
|
517
|
+
padding: 0;
|
|
518
|
+
}
|
|
519
|
+
|
|
520
|
+
|
|
493
521
|
/* Time
|
|
494
522
|
========================================================================== */
|
|
495
523
|
|
|
@@ -520,7 +548,7 @@
|
|
|
520
548
|
color: var(--datepicker-cell-active-color);
|
|
521
549
|
}
|
|
522
550
|
|
|
523
|
-
.uk-datepicker-time-panel-cell-disabled .uk-datepicker-time-panel-cell-inner {
|
|
551
|
+
.uk-datepicker-time-panel-cell-disabled:not(.uk-datepicker-time-panel-cell-selected) .uk-datepicker-time-panel-cell-inner {
|
|
524
552
|
color: var(--datepicker-cell-disabled-color);
|
|
525
553
|
cursor: not-allowed;
|
|
526
554
|
}
|
|
@@ -570,8 +598,7 @@
|
|
|
570
598
|
|
|
571
599
|
.uk-datepicker-dropdown {
|
|
572
600
|
background-color: var(--datepicker-dropdown-background);
|
|
573
|
-
border: var(--datepicker-dropdown-border-width) var(--datepicker-dropdown-border-style)
|
|
574
|
-
var(--datepicker-dropdown-border);
|
|
601
|
+
border: var(--datepicker-dropdown-border-width) var(--datepicker-dropdown-border-style) var(--datepicker-dropdown-border);
|
|
575
602
|
border-radius: var(--datepicker-dropdown-border-radius);
|
|
576
603
|
font-variant: initial;
|
|
577
604
|
left: -9999px;
|
|
@@ -618,13 +645,13 @@
|
|
|
618
645
|
--datepicker-header-padding-horizontal: var(--global-small-gutter);
|
|
619
646
|
--datepicker-header-font-size: var(--global-font-size);
|
|
620
647
|
--datepicker-header-font-weight: var(--global-bold-font-weight);
|
|
621
|
-
--datepicker-header-height: var(--global-control-height);
|
|
648
|
+
--datepicker-header-height: var(--global-control-large-height);
|
|
622
649
|
--datepicker-body-padding-horizontal: var(--global-gutter);
|
|
623
650
|
--datepicker-body-padding-vertical: var(--global-small-gutter);
|
|
624
651
|
--datepicker-header-button-color: var(--global-muted-color);
|
|
625
652
|
--datepicker-header-button-font-size: var(--global-font-size);
|
|
626
653
|
--datepicker-header-button-font-weight: var(--global-bold-font-weight);
|
|
627
|
-
--datepicker-header-button-line-height:
|
|
654
|
+
--datepicker-header-button-line-height: var(--global-control-large-height);
|
|
628
655
|
--datepicker-header-button-padding-horizontal: var(--global-small-gutter);
|
|
629
656
|
--datepicker-header-button-hover-color: var(--global-color);
|
|
630
657
|
--datepicker-header-view-button-hover-color: var(--global-primary-color);
|
|
@@ -633,7 +660,7 @@
|
|
|
633
660
|
--datepicker-footer-ranges-padding-horizontal: var(--global-small-gutter);
|
|
634
661
|
--datepicker-footer-ranges-padding-vertical: var(--global-small-gutter);
|
|
635
662
|
--datepicker-cell-border-radius: var(--global-small-border-radius);
|
|
636
|
-
--datepicker-cell-height:
|
|
663
|
+
--datepicker-cell-height: var(--global-control-height);
|
|
637
664
|
--datepicker-cell-width: #{$datepicker-cell-width};
|
|
638
665
|
--datepicker-cell-padding: var(--global-xsmall-gutter);
|
|
639
666
|
--datepicker-cell-color: var(--global-color);
|