Skip to content

chore: bump trigger version #910

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Feb 24, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 7 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "rc-picker",
"name": "@rc-component/picker",
"version": "4.11.2",
"description": "React date & time picker",
"keywords": [
Expand Down Expand Up @@ -29,7 +29,7 @@
"build": "dumi build",
"compile": "father build && lessc assets/index.less assets/index.css",
"gh-pages": "npm run build && father doc deploy",
"prepublishOnly": "npm run compile && np --yolo --no-publish",
"prepublishOnly": "npm run compile && rc-np",
"lint": "eslint src/ --ext .ts,.tsx,.jsx,.js,.md",
"lint:tsc": "tsc -p tsconfig.json --noEmit",
"prettier": "prettier --write \"**/*.{ts,tsx,js,jsx,json,md}\"",
Expand All @@ -39,18 +39,18 @@
"prepare": "npx husky"
},
"dependencies": {
"@babel/runtime": "^7.24.7",
"@rc-component/trigger": "^2.0.0",
"@rc-component/resize-observer": "^1.0.0",
"@rc-component/trigger": "^3.0.0",
"@rc-component/util": "^1.2.1",
"classnames": "^2.2.1",
"rc-overflow": "^1.3.2",
"rc-resize-observer": "^1.4.0",
"rc-util": "^5.43.0"
"rc-overflow": "^1.3.2"
},
"engines": {
"node": ">=8.x"
},
"devDependencies": {
"@rc-component/father-plugin": "^1.0.0",
"@rc-component/np":"^1.0.3",
"@testing-library/react": "^16.0.0",
"@types/classnames": "^2.2.9",
"@types/jest": "^29.4.0",
Expand All @@ -76,7 +76,6 @@
"mockdate": "^3.0.2",
"moment": "^2.24.0",
"moment-timezone": "^0.5.45",
"np": "^10.0.2",
"prettier": "^3.1.0",
"rc-test": "^7.0.9",
"react": "^18.2.0",
Expand Down
2 changes: 1 addition & 1 deletion src/PickerInput/Popup/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import classNames from 'classnames';
import ResizeObserver, { type ResizeObserverProps } from 'rc-resize-observer';
import ResizeObserver, { type ResizeObserverProps } from '@rc-component/resize-observer';
import * as React from 'react';
import type {
RangeTimeProps,
Expand Down
10 changes: 5 additions & 5 deletions src/PickerInput/RangePicker.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { useEvent, useMergedState } from 'rc-util';
import useLayoutEffect from 'rc-util/lib/hooks/useLayoutEffect';
import omit from 'rc-util/lib/omit';
import pickAttrs from 'rc-util/lib/pickAttrs';
import warning from 'rc-util/lib/warning';
import { useEvent, useMergedState } from '@rc-component/util';
import useLayoutEffect from '@rc-component/util/lib/hooks/useLayoutEffect';
import omit from '@rc-component/util/lib/omit';
import pickAttrs from '@rc-component/util/lib/pickAttrs';
import warning from '@rc-component/util/lib/warning';
import * as React from 'react';
import type {
BaseInfo,
Expand Down
6 changes: 3 additions & 3 deletions src/PickerInput/Selector/Input.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import classNames from 'classnames';
import { useEvent } from 'rc-util';
import useLayoutEffect from 'rc-util/lib/hooks/useLayoutEffect';
import raf from 'rc-util/lib/raf';
import { useEvent } from '@rc-component/util';
import useLayoutEffect from '@rc-component/util/lib/hooks/useLayoutEffect';
import raf from '@rc-component/util/lib/raf';
import * as React from 'react';
import { leftPad } from '../../utils/miscUtil';
import PickerContext from '../context';
Expand Down
4 changes: 2 additions & 2 deletions src/PickerInput/Selector/RangeSelector.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import classNames from 'classnames';
import ResizeObserver from 'rc-resize-observer';
import { useEvent } from 'rc-util';
import ResizeObserver from '@rc-component/resize-observer';
import { useEvent } from '@rc-component/util';
import * as React from 'react';
import type { RangePickerRef, SelectorProps } from '../../interface';
import PickerContext from '../context';
Expand Down
3 changes: 1 addition & 2 deletions src/PickerInput/Selector/hooks/useClearIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import warning from 'rc-util/lib/warning';
import warning from '@rc-component/util/lib/warning';
import type { ReactNode } from 'react';
import * as React from 'react';

Expand All @@ -22,4 +22,3 @@ export function fillClearIcon(

return config.clearIcon || clearIcon || <span className={`${prefixCls}-clear-btn`} />;
}

28 changes: 7 additions & 21 deletions src/PickerInput/Selector/hooks/useInputProps.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { warning } from 'rc-util';
import pickAttrs from 'rc-util/lib/pickAttrs';
import { warning } from '@rc-component/util';
import pickAttrs from '@rc-component/util/lib/pickAttrs';
import * as React from 'react';
import type { SelectorProps } from '../../../interface';
import { formatValue } from '../../../utils/dateUtil';
Expand Down Expand Up @@ -86,12 +86,7 @@ export default function useInputProps<DateType extends object = any>(
const firstFormat = format[0];

const getText = React.useCallback(
(date: DateType) =>
formatValue(date, {
locale,
format: firstFormat,
generateConfig,
}),
(date: DateType) => formatValue(date, { locale, format: firstFormat, generateConfig }),
[locale, generateConfig, firstFormat],
);

Expand Down Expand Up @@ -131,10 +126,7 @@ export default function useInputProps<DateType extends object = any>(
return index !== undefined ? propValue[index] : propValue;
}

const pickedAttrs = pickAttrs(props, {
aria: true,
data: true,
});
const pickedAttrs = pickAttrs(props, { aria: true, data: true });

const inputProps = {
...pickedAttrs,
Expand Down Expand Up @@ -198,9 +190,7 @@ export default function useInputProps<DateType extends object = any>(
onInvalid(!!text, index);
},
onHelp: () => {
onOpenChange(true, {
index,
});
onOpenChange(true, { index });
},
onKeyDown: (event: React.KeyboardEvent<HTMLDivElement>) => {
let prevented = false;
Expand All @@ -218,9 +208,7 @@ export default function useInputProps<DateType extends object = any>(
if (!event.defaultPrevented && !prevented) {
switch (event.key) {
case 'Escape':
onOpenChange(false, {
index,
});
onOpenChange(false, { index });
break;
case 'Enter':
if (!open) {
Expand All @@ -232,9 +220,7 @@ export default function useInputProps<DateType extends object = any>(
},

// ============ Post Props ============
...postProps?.({
valueTexts,
}),
...postProps?.({ valueTexts }),
};

// ============== Clean Up ==============
Expand Down
8 changes: 4 additions & 4 deletions src/PickerInput/SinglePicker.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useEvent, useMergedState } from 'rc-util';
import useLayoutEffect from 'rc-util/lib/hooks/useLayoutEffect';
import omit from 'rc-util/lib/omit';
import pickAttrs from 'rc-util/lib/pickAttrs';
import { useEvent, useMergedState } from '@rc-component/util';
import useLayoutEffect from '@rc-component/util/lib/hooks/useLayoutEffect';
import omit from '@rc-component/util/lib/omit';
import pickAttrs from '@rc-component/util/lib/pickAttrs';
import * as React from 'react';
import useToggleDates from '../hooks/useToggleDates';
import type {
Expand Down
8 changes: 2 additions & 6 deletions src/PickerInput/hooks/useCellRender.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { warning } from 'rc-util';
import { warning } from '@rc-component/util';
import * as React from 'react';
import type { CellRender, CellRenderInfo, SharedPickerProps } from '../../interface';

Expand Down Expand Up @@ -36,11 +36,7 @@ export default function useCellRender<DateType extends object = any>(

// Cell render
const onInternalCellRender: CellRender<DateType> = React.useCallback(
(date, info) =>
mergedCellRender(date, {
...info,
range,
}),
(date, info) => mergedCellRender(date, { ...info, range }),
[mergedCellRender, range],
);

Expand Down
8 changes: 3 additions & 5 deletions src/PickerInput/hooks/useDelayState.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useEvent, useMergedState } from 'rc-util';
import raf from 'rc-util/lib/raf';
import { useEvent, useMergedState } from '@rc-component/util';
import raf from '@rc-component/util/lib/raf';
import React from 'react';

/**
Expand All @@ -11,9 +11,7 @@ export default function useDelayState<T>(
defaultValue?: T,
onChange?: (next: T) => void,
): [state: T, setState: (nextState: T, immediately?: boolean) => void] {
const [state, setState] = useMergedState<T>(defaultValue, {
value,
});
const [state, setState] = useMergedState<T>(defaultValue, { value });

const nextValueRef = React.useRef<T>(value);

Expand Down
2 changes: 1 addition & 1 deletion src/PickerInput/hooks/useDisabledBoundary.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useEvent } from 'rc-util';
import { useEvent } from '@rc-component/util';
import type { GenerateConfig } from '../../generate';
import { isSame } from '../../utils/dateUtil';
import type { DisabledDate, InternalMode, Locale } from '../../interface';
Expand Down
7 changes: 2 additions & 5 deletions src/PickerInput/hooks/useFilledProps.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { warning } from 'rc-util';
import { warning } from '@rc-component/util';
import * as React from 'react';
import useLocale from '../../hooks/useLocale';
import { fillShowTimeConfig, getTimeProps } from '../../hooks/useTimeConfig';
Expand Down Expand Up @@ -167,10 +167,7 @@ export default function useFilledProps<
styles,
classNames,
order,
components: {
input: inputRender,
...components,
},
components: { input: inputRender, ...components },
clearIcon: fillClearIcon(prefixCls, allowClear, clearIcon),
showTime: mergedShowTime,
value: values,
Expand Down
11 changes: 3 additions & 8 deletions src/PickerInput/hooks/useInvalidate.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useEvent } from 'rc-util';
import { useEvent } from '@rc-component/util';
import type { GenerateConfig } from '../../generate';
import type {
PanelMode,
Expand All @@ -19,10 +19,7 @@ export default function useInvalidate<DateType extends object = any>(
// Check disabled date
const isInvalidate = useEvent(
(date: DateType, info?: { from?: DateType; activeIndex: number }) => {
const outsideInfo = {
type: picker,
...info,
};
const outsideInfo = { type: picker, ...info };
delete outsideInfo.activeIndex;

if (
Expand All @@ -37,9 +34,7 @@ export default function useInvalidate<DateType extends object = any>(
if ((picker === 'date' || picker === 'time') && showTime) {
const range = info && info.activeIndex === 1 ? 'end' : 'start';
const { disabledHours, disabledMinutes, disabledSeconds, disabledMilliseconds } =
showTime.disabledTime?.(date, range, {
from: outsideInfo.from,
}) || {};
showTime.disabledTime?.(date, range, { from: outsideInfo.from }) || {};

const {
disabledHours: legacyDisabledHours,
Expand Down
4 changes: 2 additions & 2 deletions src/PickerInput/hooks/useLockEffect.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useLayoutUpdateEffect } from 'rc-util/lib/hooks/useLayoutEffect';
import raf from 'rc-util/lib/raf';
import { useLayoutUpdateEffect } from '@rc-component/util/lib/hooks/useLayoutEffect';
import raf from '@rc-component/util/lib/raf';
import * as React from 'react';

/**
Expand Down
7 changes: 2 additions & 5 deletions src/PickerInput/hooks/usePresets.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react';
import warning from 'rc-util/lib/warning';
import warning from '@rc-component/util/lib/warning';
import type { ValueDate } from '../../interface';

export default function usePresets<DateType = any>(
Expand All @@ -14,10 +14,7 @@ export default function usePresets<DateType = any>(
if (legacyRanges) {
warning(false, '`ranges` is deprecated. Please use `presets` instead.');

return Object.entries(legacyRanges).map(([label, value]) => ({
label,
value,
}));
return Object.entries(legacyRanges).map(([label, value]) => ({ label, value }));
}

return [];
Expand Down
8 changes: 3 additions & 5 deletions src/PickerInput/hooks/useRangePickerValue.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useMergedState } from 'rc-util';
import useLayoutEffect from 'rc-util/lib/hooks/useLayoutEffect';
import { useMergedState } from '@rc-component/util';
import useLayoutEffect from '@rc-component/util/lib/hooks/useLayoutEffect';
import * as React from 'react';
import type { GenerateConfig } from '../../generate';
import type { InternalMode, Locale, PanelMode } from '../../interface';
Expand Down Expand Up @@ -74,9 +74,7 @@ export default function useRangePickerValue<DateType extends object, ValueType e
// PickerValue state
const [mergedStartPickerValue, setStartPickerValue] = useMergedState(
() => getDefaultPickerValue(0),
{
value: startPickerValue,
},
{ value: startPickerValue },
);

const [mergedEndPickerValue, setEndPickerValue] = useMergedState(() => getDefaultPickerValue(1), {
Expand Down
10 changes: 3 additions & 7 deletions src/PickerInput/hooks/useRangeValue.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useEvent, useMergedState } from 'rc-util';
import { useEvent, useMergedState } from '@rc-component/util';
import * as React from 'react';
import type { GenerateConfig } from '../../generate';
import useSyncState from '../../hooks/useSyncState';
Expand Down Expand Up @@ -117,9 +117,7 @@ export function useInnerValue<ValueType extends DateType[], DateType extends obj
onOk?: (dates: ValueType) => void,
) {
// This is the root value which will sync with controlled or uncontrolled value
const [innerValue, setInnerValue] = useMergedState(defaultValue, {
value,
});
const [innerValue, setInnerValue] = useMergedState(defaultValue, { value });
const mergedValue = innerValue || (EMPTY_VALUE as ValueType);

// ========================= Inner Values =========================
Expand Down Expand Up @@ -148,9 +146,7 @@ export function useInnerValue<ValueType extends DateType[], DateType extends obj
// Trigger calendar change event
if (onCalendarChange) {
const cellTexts = getDateTexts(clone);
onCalendarChange(clone, cellTexts, {
range: isSameStart ? 'end' : 'start',
});
onCalendarChange(clone, cellTexts, { range: isSameStart ? 'end' : 'start' });
}
}
},
Expand Down
2 changes: 1 addition & 1 deletion src/PickerPanel/TimePanel/TimePanelBody/TimeColumn.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import classNames from 'classnames';
import useLayoutEffect from 'rc-util/lib/hooks/useLayoutEffect';
import useLayoutEffect from '@rc-component/util/lib/hooks/useLayoutEffect';
import * as React from 'react';
import { usePanelContext } from '../../context';
import useScrollTo from './useScrollTo';
Expand Down
6 changes: 3 additions & 3 deletions src/PickerPanel/TimePanel/TimePanelBody/useScrollTo.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useEvent } from 'rc-util';
import raf from 'rc-util/lib/raf';
import isVisible from 'rc-util/lib/Dom/isVisible';
import { useEvent } from '@rc-component/util';
import raf from '@rc-component/util/lib/raf';
import isVisible from '@rc-component/util/lib/Dom/isVisible';
import * as React from 'react';

const SPEED_PTG = 1 / 3;
Expand Down
2 changes: 1 addition & 1 deletion src/PickerPanel/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import classNames from 'classnames';
import { useEvent, useMergedState, warning } from 'rc-util';
import { useEvent, useMergedState, warning } from '@rc-component/util';
import * as React from 'react';
import useLocale from '../hooks/useLocale';
import { fillShowTimeConfig, getTimeProps } from '../hooks/useTimeConfig';
Expand Down
2 changes: 1 addition & 1 deletion src/PickerTrigger/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ function PickerTrigger({
popupPlacement={realPlacement}
builtinPlacements={builtinPlacements}
prefixCls={dropdownPrefixCls}
popupTransitionName={transitionName}
popupMotion={{ motionName: transitionName }}
popup={popupElement}
popupAlign={popupAlign}
popupVisible={visible}
Expand Down
2 changes: 1 addition & 1 deletion src/generate/moment.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { Moment } from 'moment';
import moment from 'moment';
import { noteOnce } from 'rc-util/lib/warning';
import { noteOnce } from '@rc-component/util/lib/warning';
import type { GenerateConfig } from '.';

const generateConfig: GenerateConfig<Moment> = {
Expand Down
2 changes: 1 addition & 1 deletion src/hooks/useTimeInfo.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { warning } from 'rc-util';
import { warning } from '@rc-component/util';
import * as React from 'react';
import type { GenerateConfig } from '../generate';
import type { DisabledTimes, SharedTimeProps } from '../interface';
Expand Down
2 changes: 1 addition & 1 deletion src/utils/warnUtil.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { DisabledTimes, PickerMode } from '../interface';
import warning from 'rc-util/lib/warning';
import warning from '@rc-component/util/lib/warning';

export interface WarningProps extends DisabledTimes {
picker?: PickerMode;
Expand Down
Loading