@tidbcloud/uikit 2.3.0 → 2.3.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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @tidbcloud/uikit
2
2
 
3
+ ## 2.3.1
4
+
5
+ ### Patch Changes
6
+
7
+ - fix(TimePicker): change value types to string and update format handling ([#529](https://github.com/tidbcloud/tidbcloud-uikit/pull/529))
8
+
3
9
  ## 2.3.0
4
10
 
5
11
  ### Minor Changes
@@ -243,10 +243,10 @@ const TimePicker = ({
243
243
  ...rest
244
244
  }) => {
245
245
  const [currentValue, setCurrentValue] = useUncontrolled.useUncontrolled({
246
- value: value ? dayjs.dayjs(value) : void 0,
247
- defaultValue: defaultValue ? dayjs.dayjs(defaultValue) : dayjs.dayjs(),
246
+ value: value ? dayjs.dayjs(value, "HH:mm:ss") : void 0,
247
+ defaultValue: defaultValue ? dayjs.dayjs(defaultValue, "HH:mm:ss") : dayjs.dayjs(),
248
248
  onChange: (v) => {
249
- onChange == null ? void 0 : onChange(v.toDate());
249
+ onChange == null ? void 0 : onChange(v.format("HH:mm:ss"));
250
250
  }
251
251
  });
252
252
  const [currentValueChangedBy, setCurrentValueChangedBy] = React.useState(null);
@@ -15,9 +15,12 @@ export interface DateTimePickerProps extends Omit<TextInputProps, 'value' | 'onC
15
15
  }
16
16
  export declare const DateTimePicker: ({ placeholder, format, defaultValue, value, startDate, endDate, onChange, disable, utcOffset, withinPortal, sx, loading, size }: DateTimePickerProps) => import("react/jsx-runtime.js").JSX.Element;
17
17
  export interface TimePickerProps extends Omit<TimeInputProps, 'value' | 'onChange' | 'defaultValue'>, Pick<PopoverProps, 'withinPortal' | 'withArrow' | 'position' | 'shadow'> {
18
- defaultValue?: Date;
19
- value?: Date;
20
- onChange?: (val: Date) => void;
18
+ defaultValue?: string;
19
+ /**
20
+ * with format of `HH:mm:ss`
21
+ */
22
+ value?: string;
23
+ onChange?: (val: string) => void;
21
24
  disable?: boolean;
22
25
  size?: MantineSize;
23
26
  }
@@ -15,9 +15,12 @@ export interface DateTimePickerProps extends Omit<TextInputProps, 'value' | 'onC
15
15
  }
16
16
  export declare const DateTimePicker: ({ placeholder, format, defaultValue, value, startDate, endDate, onChange, disable, utcOffset, withinPortal, sx, loading, size }: DateTimePickerProps) => import("react/jsx-runtime.js").JSX.Element;
17
17
  export interface TimePickerProps extends Omit<TimeInputProps, 'value' | 'onChange' | 'defaultValue'>, Pick<PopoverProps, 'withinPortal' | 'withArrow' | 'position' | 'shadow'> {
18
- defaultValue?: Date;
19
- value?: Date;
20
- onChange?: (val: Date) => void;
18
+ defaultValue?: string;
19
+ /**
20
+ * with format of `HH:mm:ss`
21
+ */
22
+ value?: string;
23
+ onChange?: (val: string) => void;
21
24
  disable?: boolean;
22
25
  size?: MantineSize;
23
26
  }
@@ -241,10 +241,10 @@ const TimePicker = ({
241
241
  ...rest
242
242
  }) => {
243
243
  const [currentValue, setCurrentValue] = useUncontrolled({
244
- value: value ? dayjs(value) : void 0,
245
- defaultValue: defaultValue ? dayjs(defaultValue) : dayjs(),
244
+ value: value ? dayjs(value, "HH:mm:ss") : void 0,
245
+ defaultValue: defaultValue ? dayjs(defaultValue, "HH:mm:ss") : dayjs(),
246
246
  onChange: (v) => {
247
- onChange == null ? void 0 : onChange(v.toDate());
247
+ onChange == null ? void 0 : onChange(v.format("HH:mm:ss"));
248
248
  }
249
249
  });
250
250
  const [currentValueChangedBy, setCurrentValueChangedBy] = useState(null);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tidbcloud/uikit",
3
- "version": "2.3.0",
3
+ "version": "2.3.1",
4
4
  "description": "tidbcloud uikit",
5
5
  "type": "module",
6
6
  "main": "dist/primitive/index.cjs",