@akinon/ui-time-picker 0.5.0 → 1.0.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.
@@ -1,5 +1,23 @@
1
1
  import type { TimePickerProps as AntTimePickerProps } from 'antd';
2
2
  import * as React from 'react';
3
3
  export type TimePickerProps = AntTimePickerProps;
4
+ /**
5
+ * TimePicker component for Akinon UI.
6
+ *
7
+ * The TimePicker component provides a robust and customizable solution for selecting time values.
8
+ * It supports various configurations, such as 12/24-hour formats, custom steps for hours, minutes, and seconds,
9
+ * and flexible placement and styles for popup panels.
10
+ *
11
+ * Key Features:
12
+ * - Multiple display formats including 12-hour and 24-hour clocks.
13
+ * - Customizable intervals for hours, minutes, and seconds.
14
+ * - Support for enabling/disabling specific time ranges or values.
15
+ * - Callback functions for value changes, panel open/close events, and validation.
16
+ * - Options for customizing clear icons, placeholder texts, and additional panel footers.
17
+ * - Fully integrated with the Akinon design system to ensure consistent styling and behavior.
18
+ *
19
+ * The TimePicker component is designed for both simple and advanced use cases, making it suitable for
20
+ * enterprise-grade applications requiring precise time input functionality.
21
+ */
4
22
  export declare const TimePicker: ({ ...restTimePickerProps }: TimePickerProps) => React.JSX.Element;
5
23
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,IAAI,kBAAkB,EAAE,MAAM,MAAM,CAAC;AAElE,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,MAAM,MAAM,eAAe,GAAG,kBAAkB,CAAC;AAEjD,eAAO,MAAM,UAAU,+BAAgC,eAAe,sBAMrE,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,IAAI,kBAAkB,EAAE,MAAM,MAAM,CAAC;AAElE,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,MAAM,MAAM,eAAe,GAAG,kBAAkB,CAAC;AAEjD;;;;;;;;;;;;;;;;;GAiBG;AAEH,eAAO,MAAM,UAAU,+BAAgC,eAAe,sBAMrE,CAAC"}
package/dist/cjs/index.js CHANGED
@@ -14,6 +14,24 @@ Object.defineProperty(exports, "__esModule", { value: true });
14
14
  exports.TimePicker = void 0;
15
15
  const antd_1 = require("antd");
16
16
  const React = require("react");
17
+ /**
18
+ * TimePicker component for Akinon UI.
19
+ *
20
+ * The TimePicker component provides a robust and customizable solution for selecting time values.
21
+ * It supports various configurations, such as 12/24-hour formats, custom steps for hours, minutes, and seconds,
22
+ * and flexible placement and styles for popup panels.
23
+ *
24
+ * Key Features:
25
+ * - Multiple display formats including 12-hour and 24-hour clocks.
26
+ * - Customizable intervals for hours, minutes, and seconds.
27
+ * - Support for enabling/disabling specific time ranges or values.
28
+ * - Callback functions for value changes, panel open/close events, and validation.
29
+ * - Options for customizing clear icons, placeholder texts, and additional panel footers.
30
+ * - Fully integrated with the Akinon design system to ensure consistent styling and behavior.
31
+ *
32
+ * The TimePicker component is designed for both simple and advanced use cases, making it suitable for
33
+ * enterprise-grade applications requiring precise time input functionality.
34
+ */
17
35
  const TimePicker = (_a) => {
18
36
  var restTimePickerProps = __rest(_a, []);
19
37
  return (React.createElement(antd_1.TimePicker, Object.assign({}, restTimePickerProps)));
@@ -0,0 +1,207 @@
1
+ import { DO_NOT_USE_OR_YOU_WILL_BE_FIRED_INTERNAL_STYLE } from '@akinon/ui-theme';
2
+ import type { Dayjs } from 'dayjs';
3
+ import { ReactNode } from 'react';
4
+
5
+ type DisabledTime = (now: Dayjs) => {
6
+ disabledHours?: () => number[];
7
+ disabledMinutes?: (selectedHour: number) => number[];
8
+ disabledSeconds?: (selectedHour: number, selectedMinute: number) => number[];
9
+ disabledMilliseconds?: (
10
+ selectedHour: number,
11
+ selectedMinute: number,
12
+ selectedSecond: number
13
+ ) => number[];
14
+ };
15
+
16
+ /**
17
+ * Interface representing the properties for the TimePicker component.
18
+ */
19
+ export interface ITimePickerProps extends React.HTMLAttributes<HTMLDivElement> {
20
+ /**
21
+ * Customize clear icon.
22
+ * @default true
23
+ */
24
+ allowClear?: boolean | { clearIcon?: ReactNode };
25
+
26
+ /**
27
+ * If get focus when component mounted.
28
+ * @default false
29
+ */
30
+ autoFocus?: boolean;
31
+
32
+ /**
33
+ * Custom rendering function for picker cells
34
+ */
35
+ cellRender?: (
36
+ current: number,
37
+ info: {
38
+ originNode: React.ReactElement;
39
+ today: dayjs;
40
+ range?: 'start' | 'end';
41
+ subType: 'hour' | 'minute' | 'second' | 'meridiem';
42
+ }
43
+ ) => React.ReactNode;
44
+
45
+ /**
46
+ * Trigger selection when scroll the column
47
+ * @default false
48
+ */
49
+ changeOnScroll?: boolean;
50
+
51
+ /**
52
+ * To set default time
53
+ */
54
+ defaultValue?: Dayjs;
55
+
56
+ /**
57
+ * Determine whether the TimePicker is disabled
58
+ * @default false
59
+ */
60
+ disabled?: boolean;
61
+
62
+ /**
63
+ * To specify the time that cannot be selected
64
+ */
65
+ disabledTime?: DisabledTime;
66
+
67
+ /**
68
+ * To set the time format
69
+ * @default 'HH:mm:ss'
70
+ */
71
+ format?: string;
72
+
73
+ /**
74
+ * To set the container of the floating layer, while the default is to create a div element in body
75
+ */
76
+ getPopupContainer?: (trigger: HTMLElement) => HTMLElement;
77
+
78
+ /**
79
+ * Whether hide the options that can not be selected
80
+ * @default false
81
+ */
82
+ hideDisabledOptions?: boolean;
83
+
84
+ /**
85
+ * Interval between hours in picker
86
+ * @default 1
87
+ */
88
+ hourStep?: number;
89
+
90
+ /**
91
+ * Set the readonly attribute of the input tag (avoids virtual keyboard on touch devices)
92
+ * @default false
93
+ */
94
+ inputReadOnly?: boolean;
95
+
96
+ /**
97
+ * Interval between minutes in picker
98
+ * @default 1
99
+ */
100
+ minuteStep?: number;
101
+
102
+ /**
103
+ * Need click confirm button to trigger value change
104
+ */
105
+ needConfirm?: boolean;
106
+
107
+ /**
108
+ * Whether to popup panel
109
+ * @default false
110
+ */
111
+ open?: boolean;
112
+
113
+ /**
114
+ * Display when there's no value
115
+ * @default 'Select a time'
116
+ */
117
+ placeholder?: string | [string, string];
118
+
119
+ /**
120
+ * The position where the selection box pops up
121
+ * @default 'bottomLeft'
122
+ */
123
+ placement: 'bottomLeft' | 'bottomRight' | 'topLeft' | 'topRight';
124
+
125
+ /**
126
+ * The className of panel
127
+ */
128
+ popupClassName?: string;
129
+
130
+ /**
131
+ * The style of panel
132
+ */
133
+ popupStyle?: React.CSSProperties;
134
+
135
+ /**
136
+ * Called from time picker panel to render some addon to its bottom
137
+ */
138
+ renderExtraFooter?: () => ReactNode;
139
+
140
+ /**
141
+ * Interval between seconds in picker
142
+ * @default 1
143
+ */
144
+ secondStep?: number;
145
+
146
+ /**
147
+ * Whether to show Now button on panel
148
+ */
149
+ showNow?: boolean;
150
+
151
+ /**
152
+ * To determine the size of the input box, the height of large and small, are 40px and 24px respectively, while default size is 32px
153
+ */
154
+ size?: 'small' | 'middle' | 'large';
155
+
156
+ /**
157
+ * Set validation status
158
+ */
159
+ status: 'error' | 'warning' | 'success' | 'validating';
160
+
161
+ /**
162
+ * The custom suffix icon
163
+ */
164
+ suffixIcon?: ReactNode;
165
+
166
+ /**
167
+ * Display as 12 hours format, with default format h:mm:ss a
168
+ * @default false
169
+ */
170
+ use12Hours?: boolean;
171
+
172
+ /**
173
+ * To set time
174
+ */
175
+ value?: Dayjs;
176
+
177
+ /**
178
+ * Variants of picker
179
+ * @default 'outlined'
180
+ */
181
+ variant: 'outlined' | 'borderless' | 'filled';
182
+
183
+ /**
184
+ * Callback function, can be executed when the start time or the end time of the range is changing. info argument is added in 4.4.0
185
+ */
186
+ onCalendarChange?: (
187
+ dates: [Dayjs, Dayjs],
188
+ dateStrings: [string, string],
189
+ info: { range: 'start' | 'end' }
190
+ ) => void;
191
+
192
+ /**
193
+ * A callback function, can be executed when the selected time is changing
194
+ */
195
+ onChange?: (time: Dayjs, timeString: string) => void;
196
+
197
+ /**
198
+ * A callback function which will be called while panel opening/closing
199
+ */
200
+ onOpenChange: (open: boolean) => void;
201
+
202
+ /**
203
+ * Never use this prop. Akinon design system does not allow custom styles.
204
+ * @ignore
205
+ */
206
+ style?: DO_NOT_USE_OR_YOU_WILL_BE_FIRED_INTERNAL_STYLE;
207
+ }
@@ -1,5 +1,23 @@
1
1
  import type { TimePickerProps as AntTimePickerProps } from 'antd';
2
2
  import * as React from 'react';
3
3
  export type TimePickerProps = AntTimePickerProps;
4
+ /**
5
+ * TimePicker component for Akinon UI.
6
+ *
7
+ * The TimePicker component provides a robust and customizable solution for selecting time values.
8
+ * It supports various configurations, such as 12/24-hour formats, custom steps for hours, minutes, and seconds,
9
+ * and flexible placement and styles for popup panels.
10
+ *
11
+ * Key Features:
12
+ * - Multiple display formats including 12-hour and 24-hour clocks.
13
+ * - Customizable intervals for hours, minutes, and seconds.
14
+ * - Support for enabling/disabling specific time ranges or values.
15
+ * - Callback functions for value changes, panel open/close events, and validation.
16
+ * - Options for customizing clear icons, placeholder texts, and additional panel footers.
17
+ * - Fully integrated with the Akinon design system to ensure consistent styling and behavior.
18
+ *
19
+ * The TimePicker component is designed for both simple and advanced use cases, making it suitable for
20
+ * enterprise-grade applications requiring precise time input functionality.
21
+ */
4
22
  export declare const TimePicker: ({ ...restTimePickerProps }: TimePickerProps) => React.JSX.Element;
5
23
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,IAAI,kBAAkB,EAAE,MAAM,MAAM,CAAC;AAElE,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,MAAM,MAAM,eAAe,GAAG,kBAAkB,CAAC;AAEjD,eAAO,MAAM,UAAU,+BAAgC,eAAe,sBAMrE,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,IAAI,kBAAkB,EAAE,MAAM,MAAM,CAAC;AAElE,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,MAAM,MAAM,eAAe,GAAG,kBAAkB,CAAC;AAEjD;;;;;;;;;;;;;;;;;GAiBG;AAEH,eAAO,MAAM,UAAU,+BAAgC,eAAe,sBAMrE,CAAC"}
package/dist/esm/index.js CHANGED
@@ -11,6 +11,24 @@ var __rest = (this && this.__rest) || function (s, e) {
11
11
  };
12
12
  import { TimePicker as AntTimePicker } from 'antd';
13
13
  import * as React from 'react';
14
+ /**
15
+ * TimePicker component for Akinon UI.
16
+ *
17
+ * The TimePicker component provides a robust and customizable solution for selecting time values.
18
+ * It supports various configurations, such as 12/24-hour formats, custom steps for hours, minutes, and seconds,
19
+ * and flexible placement and styles for popup panels.
20
+ *
21
+ * Key Features:
22
+ * - Multiple display formats including 12-hour and 24-hour clocks.
23
+ * - Customizable intervals for hours, minutes, and seconds.
24
+ * - Support for enabling/disabling specific time ranges or values.
25
+ * - Callback functions for value changes, panel open/close events, and validation.
26
+ * - Options for customizing clear icons, placeholder texts, and additional panel footers.
27
+ * - Fully integrated with the Akinon design system to ensure consistent styling and behavior.
28
+ *
29
+ * The TimePicker component is designed for both simple and advanced use cases, making it suitable for
30
+ * enterprise-grade applications requiring precise time input functionality.
31
+ */
14
32
  export const TimePicker = (_a) => {
15
33
  var restTimePickerProps = __rest(_a, []);
16
34
  return (React.createElement(AntTimePicker, Object.assign({}, restTimePickerProps)));
@@ -0,0 +1,207 @@
1
+ import { DO_NOT_USE_OR_YOU_WILL_BE_FIRED_INTERNAL_STYLE } from '@akinon/ui-theme';
2
+ import type { Dayjs } from 'dayjs';
3
+ import { ReactNode } from 'react';
4
+
5
+ type DisabledTime = (now: Dayjs) => {
6
+ disabledHours?: () => number[];
7
+ disabledMinutes?: (selectedHour: number) => number[];
8
+ disabledSeconds?: (selectedHour: number, selectedMinute: number) => number[];
9
+ disabledMilliseconds?: (
10
+ selectedHour: number,
11
+ selectedMinute: number,
12
+ selectedSecond: number
13
+ ) => number[];
14
+ };
15
+
16
+ /**
17
+ * Interface representing the properties for the TimePicker component.
18
+ */
19
+ export interface ITimePickerProps extends React.HTMLAttributes<HTMLDivElement> {
20
+ /**
21
+ * Customize clear icon.
22
+ * @default true
23
+ */
24
+ allowClear?: boolean | { clearIcon?: ReactNode };
25
+
26
+ /**
27
+ * If get focus when component mounted.
28
+ * @default false
29
+ */
30
+ autoFocus?: boolean;
31
+
32
+ /**
33
+ * Custom rendering function for picker cells
34
+ */
35
+ cellRender?: (
36
+ current: number,
37
+ info: {
38
+ originNode: React.ReactElement;
39
+ today: dayjs;
40
+ range?: 'start' | 'end';
41
+ subType: 'hour' | 'minute' | 'second' | 'meridiem';
42
+ }
43
+ ) => React.ReactNode;
44
+
45
+ /**
46
+ * Trigger selection when scroll the column
47
+ * @default false
48
+ */
49
+ changeOnScroll?: boolean;
50
+
51
+ /**
52
+ * To set default time
53
+ */
54
+ defaultValue?: Dayjs;
55
+
56
+ /**
57
+ * Determine whether the TimePicker is disabled
58
+ * @default false
59
+ */
60
+ disabled?: boolean;
61
+
62
+ /**
63
+ * To specify the time that cannot be selected
64
+ */
65
+ disabledTime?: DisabledTime;
66
+
67
+ /**
68
+ * To set the time format
69
+ * @default 'HH:mm:ss'
70
+ */
71
+ format?: string;
72
+
73
+ /**
74
+ * To set the container of the floating layer, while the default is to create a div element in body
75
+ */
76
+ getPopupContainer?: (trigger: HTMLElement) => HTMLElement;
77
+
78
+ /**
79
+ * Whether hide the options that can not be selected
80
+ * @default false
81
+ */
82
+ hideDisabledOptions?: boolean;
83
+
84
+ /**
85
+ * Interval between hours in picker
86
+ * @default 1
87
+ */
88
+ hourStep?: number;
89
+
90
+ /**
91
+ * Set the readonly attribute of the input tag (avoids virtual keyboard on touch devices)
92
+ * @default false
93
+ */
94
+ inputReadOnly?: boolean;
95
+
96
+ /**
97
+ * Interval between minutes in picker
98
+ * @default 1
99
+ */
100
+ minuteStep?: number;
101
+
102
+ /**
103
+ * Need click confirm button to trigger value change
104
+ */
105
+ needConfirm?: boolean;
106
+
107
+ /**
108
+ * Whether to popup panel
109
+ * @default false
110
+ */
111
+ open?: boolean;
112
+
113
+ /**
114
+ * Display when there's no value
115
+ * @default 'Select a time'
116
+ */
117
+ placeholder?: string | [string, string];
118
+
119
+ /**
120
+ * The position where the selection box pops up
121
+ * @default 'bottomLeft'
122
+ */
123
+ placement: 'bottomLeft' | 'bottomRight' | 'topLeft' | 'topRight';
124
+
125
+ /**
126
+ * The className of panel
127
+ */
128
+ popupClassName?: string;
129
+
130
+ /**
131
+ * The style of panel
132
+ */
133
+ popupStyle?: React.CSSProperties;
134
+
135
+ /**
136
+ * Called from time picker panel to render some addon to its bottom
137
+ */
138
+ renderExtraFooter?: () => ReactNode;
139
+
140
+ /**
141
+ * Interval between seconds in picker
142
+ * @default 1
143
+ */
144
+ secondStep?: number;
145
+
146
+ /**
147
+ * Whether to show Now button on panel
148
+ */
149
+ showNow?: boolean;
150
+
151
+ /**
152
+ * To determine the size of the input box, the height of large and small, are 40px and 24px respectively, while default size is 32px
153
+ */
154
+ size?: 'small' | 'middle' | 'large';
155
+
156
+ /**
157
+ * Set validation status
158
+ */
159
+ status: 'error' | 'warning' | 'success' | 'validating';
160
+
161
+ /**
162
+ * The custom suffix icon
163
+ */
164
+ suffixIcon?: ReactNode;
165
+
166
+ /**
167
+ * Display as 12 hours format, with default format h:mm:ss a
168
+ * @default false
169
+ */
170
+ use12Hours?: boolean;
171
+
172
+ /**
173
+ * To set time
174
+ */
175
+ value?: Dayjs;
176
+
177
+ /**
178
+ * Variants of picker
179
+ * @default 'outlined'
180
+ */
181
+ variant: 'outlined' | 'borderless' | 'filled';
182
+
183
+ /**
184
+ * Callback function, can be executed when the start time or the end time of the range is changing. info argument is added in 4.4.0
185
+ */
186
+ onCalendarChange?: (
187
+ dates: [Dayjs, Dayjs],
188
+ dateStrings: [string, string],
189
+ info: { range: 'start' | 'end' }
190
+ ) => void;
191
+
192
+ /**
193
+ * A callback function, can be executed when the selected time is changing
194
+ */
195
+ onChange?: (time: Dayjs, timeString: string) => void;
196
+
197
+ /**
198
+ * A callback function which will be called while panel opening/closing
199
+ */
200
+ onOpenChange: (open: boolean) => void;
201
+
202
+ /**
203
+ * Never use this prop. Akinon design system does not allow custom styles.
204
+ * @ignore
205
+ */
206
+ style?: DO_NOT_USE_OR_YOU_WILL_BE_FIRED_INTERNAL_STYLE;
207
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@akinon/ui-time-picker",
3
- "version": "0.5.0",
3
+ "version": "1.0.1",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "main": "dist/esm/index.js",
@@ -9,14 +9,14 @@
9
9
  "dist"
10
10
  ],
11
11
  "dependencies": {
12
- "antd": "5.17.0"
12
+ "antd": "5.22.6"
13
13
  },
14
14
  "devDependencies": {
15
15
  "clean-package": "2.2.0",
16
16
  "copyfiles": "^2.4.1",
17
17
  "rimraf": "^5.0.5",
18
- "typescript": "^5.2.2",
19
- "@akinon/typescript-config": "0.4.0"
18
+ "typescript": "*",
19
+ "@akinon/typescript-config": "1.0.1"
20
20
  },
21
21
  "peerDependencies": {
22
22
  "react": ">=18",