@clayui/time-picker 3.156.0 → 3.158.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/LICENSE.md +3 -3
- package/README.md +4 -4
- package/lib/cjs/index.js +325 -231
- package/lib/esm/index.js +291 -219
- package/lib/index.d.ts +15 -15
- package/package.json +33 -34
package/lib/cjs/index.js
CHANGED
|
@@ -1,34 +1,54 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty
|
|
4
|
-
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var src_exports = {};
|
|
30
|
+
__export(src_exports, {
|
|
31
|
+
default: () => src_default
|
|
5
32
|
});
|
|
6
|
-
exports
|
|
7
|
-
var
|
|
8
|
-
var
|
|
9
|
-
var
|
|
10
|
-
var
|
|
11
|
-
var
|
|
12
|
-
var
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
var TimeType;
|
|
21
|
-
(function (TimeType) {
|
|
22
|
-
TimeType["minutes"] = "minutes";
|
|
23
|
-
TimeType["hours"] = "hours";
|
|
24
|
-
TimeType["ampm"] = "ampm";
|
|
25
|
-
})(TimeType || (TimeType = {}));
|
|
26
|
-
const DEFAULT_VALUE = '--';
|
|
33
|
+
module.exports = __toCommonJS(src_exports);
|
|
34
|
+
var import_button = __toESM(require("@clayui/button"));
|
|
35
|
+
var import_form = require("@clayui/form");
|
|
36
|
+
var import_icon = __toESM(require("@clayui/icon"));
|
|
37
|
+
var import_shared = require("@clayui/shared");
|
|
38
|
+
var import_classnames = __toESM(require("classnames"));
|
|
39
|
+
var import_react = __toESM(require("react"));
|
|
40
|
+
var TimeType = /* @__PURE__ */ ((TimeType2) => {
|
|
41
|
+
TimeType2["minutes"] = "minutes";
|
|
42
|
+
TimeType2["hours"] = "hours";
|
|
43
|
+
TimeType2["ampm"] = "ampm";
|
|
44
|
+
return TimeType2;
|
|
45
|
+
})(TimeType || {});
|
|
46
|
+
const DEFAULT_VALUE = "--";
|
|
27
47
|
const DEFAULT_CONFIG = {
|
|
28
48
|
use12Hours: {
|
|
29
49
|
ampm: {
|
|
30
|
-
am:
|
|
31
|
-
pm:
|
|
50
|
+
am: "AM",
|
|
51
|
+
pm: "PM"
|
|
32
52
|
},
|
|
33
53
|
hours: {
|
|
34
54
|
max: 12,
|
|
@@ -41,8 +61,8 @@ const DEFAULT_CONFIG = {
|
|
|
41
61
|
},
|
|
42
62
|
use24Hours: {
|
|
43
63
|
ampm: {
|
|
44
|
-
am:
|
|
45
|
-
pm:
|
|
64
|
+
am: "AM",
|
|
65
|
+
pm: "PM"
|
|
46
66
|
},
|
|
47
67
|
hours: {
|
|
48
68
|
max: 23,
|
|
@@ -55,116 +75,126 @@ const DEFAULT_CONFIG = {
|
|
|
55
75
|
}
|
|
56
76
|
};
|
|
57
77
|
const regex = /^\d+$/;
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
defaultName: 'defaultValue',
|
|
78
|
+
function TimePicker({
|
|
79
|
+
ariaLabels = {
|
|
80
|
+
ampm: "Select time of day (AM/PM) using up (PM) and down (AM) arrow keys",
|
|
81
|
+
clear: "Delete the entered time",
|
|
82
|
+
hours: "Enter the hour in 00:00 format",
|
|
83
|
+
minutes: "Enter the minutes in 00:00 format",
|
|
84
|
+
timeDown: "Time down",
|
|
85
|
+
timeUp: "Time up"
|
|
86
|
+
},
|
|
87
|
+
config = DEFAULT_CONFIG,
|
|
88
|
+
disabled = false,
|
|
89
|
+
defaultValue = {
|
|
90
|
+
hours: DEFAULT_VALUE,
|
|
91
|
+
minutes: DEFAULT_VALUE
|
|
92
|
+
},
|
|
93
|
+
icon = false,
|
|
94
|
+
id,
|
|
95
|
+
name,
|
|
96
|
+
onChange,
|
|
97
|
+
onInputChange,
|
|
98
|
+
spritemap,
|
|
99
|
+
timezone,
|
|
100
|
+
use12Hours = false,
|
|
101
|
+
value,
|
|
102
|
+
values
|
|
103
|
+
}) {
|
|
104
|
+
const [internalValue, setValue] = (0, import_shared.useControlledState)({
|
|
105
|
+
defaultName: "defaultValue",
|
|
87
106
|
defaultValue,
|
|
88
|
-
handleName:
|
|
89
|
-
name:
|
|
107
|
+
handleName: "onChange",
|
|
108
|
+
name: "value",
|
|
90
109
|
onChange: onChange ?? onInputChange,
|
|
91
110
|
value: value ?? values
|
|
92
111
|
});
|
|
93
|
-
const useConfig = config[use12Hours ?
|
|
94
|
-
const [actionVisible, setActionVisible] = (0,
|
|
95
|
-
const elementRef = (0,
|
|
112
|
+
const useConfig = config[use12Hours ? "use12Hours" : "use24Hours"];
|
|
113
|
+
const [actionVisible, setActionVisible] = (0, import_react.useState)(false);
|
|
114
|
+
const elementRef = (0, import_react.useRef)(null);
|
|
96
115
|
const defaultFocused = {
|
|
97
|
-
configName:
|
|
116
|
+
configName: "hours" /* hours */,
|
|
98
117
|
focused: false
|
|
99
118
|
};
|
|
100
|
-
const [currentInputFocused, setCurrentInputFocused] = (0,
|
|
101
|
-
const handleMaxAndMin = (
|
|
102
|
-
const newValue =
|
|
119
|
+
const [currentInputFocused, setCurrentInputFocused] = (0, import_react.useState)(defaultFocused);
|
|
120
|
+
const handleMaxAndMin = (value2, config2) => {
|
|
121
|
+
const newValue = value2.substring(value2.length - 2, value2.length);
|
|
103
122
|
const intrinsicValue = Number(newValue);
|
|
104
|
-
if (intrinsicValue >
|
|
105
|
-
return String(
|
|
106
|
-
} else if (intrinsicValue <
|
|
107
|
-
return String(
|
|
123
|
+
if (intrinsicValue > config2.max) {
|
|
124
|
+
return String(config2.min);
|
|
125
|
+
} else if (intrinsicValue < config2.min) {
|
|
126
|
+
return String(config2.max);
|
|
108
127
|
}
|
|
109
128
|
return newValue;
|
|
110
129
|
};
|
|
111
|
-
const handleKeyDown = (event,
|
|
112
|
-
const
|
|
113
|
-
const intrinsicValue = Number(
|
|
114
|
-
const onValue = newValue => {
|
|
115
|
-
const newVal = configName ===
|
|
130
|
+
const handleKeyDown = (event, value2, configName) => {
|
|
131
|
+
const config2 = useConfig[configName];
|
|
132
|
+
const intrinsicValue = Number(value2);
|
|
133
|
+
const onValue = (newValue) => {
|
|
134
|
+
const newVal = configName === "ampm" /* ampm */ ? newValue : handleMaxAndMin(String(newValue), config2);
|
|
116
135
|
return setValue({
|
|
117
136
|
...internalValue,
|
|
118
137
|
// eslint-disable-next-line sort-keys
|
|
119
|
-
[configName]: String(newVal).padStart(2,
|
|
138
|
+
[configName]: String(newVal).padStart(2, "0")
|
|
120
139
|
});
|
|
121
140
|
};
|
|
122
141
|
switch (event.key) {
|
|
123
|
-
case
|
|
142
|
+
case "Backspace":
|
|
124
143
|
onValue(DEFAULT_VALUE);
|
|
125
144
|
break;
|
|
126
|
-
case
|
|
145
|
+
case "ArrowUp":
|
|
127
146
|
event.preventDefault();
|
|
128
147
|
event.stopPropagation();
|
|
129
|
-
if (configName ===
|
|
130
|
-
onValue(
|
|
148
|
+
if (configName === "ampm" /* ampm */) {
|
|
149
|
+
onValue(config2.pm);
|
|
131
150
|
} else {
|
|
132
|
-
onValue(
|
|
151
|
+
onValue(
|
|
152
|
+
value2 !== DEFAULT_VALUE ? intrinsicValue + 1 : config2.min
|
|
153
|
+
);
|
|
133
154
|
}
|
|
134
155
|
break;
|
|
135
|
-
case
|
|
156
|
+
case "ArrowDown":
|
|
136
157
|
event.preventDefault();
|
|
137
158
|
event.stopPropagation();
|
|
138
|
-
if (configName ===
|
|
139
|
-
onValue(
|
|
159
|
+
if (configName === "ampm" /* ampm */) {
|
|
160
|
+
onValue(config2.am);
|
|
140
161
|
} else {
|
|
141
|
-
onValue(
|
|
162
|
+
onValue(
|
|
163
|
+
value2 !== DEFAULT_VALUE ? intrinsicValue - 1 : config2.max
|
|
164
|
+
);
|
|
142
165
|
}
|
|
143
166
|
break;
|
|
144
167
|
default:
|
|
145
|
-
if (regex.test(event.key) && configName !==
|
|
146
|
-
const maxSecondDigit = Math.floor(
|
|
147
|
-
|
|
168
|
+
if (regex.test(event.key) && configName !== "ampm" /* ampm */) {
|
|
169
|
+
const maxSecondDigit = Math.floor(
|
|
170
|
+
config2.max / 10
|
|
171
|
+
);
|
|
172
|
+
const minFirstDigit = config2.min;
|
|
148
173
|
const keyVal = intrinsicValue < minFirstDigit ? minFirstDigit : event.key;
|
|
149
|
-
const newVal = Number(
|
|
174
|
+
const newVal = Number(value2) > maxSecondDigit ? `0${keyVal}` : (value2 && value2 !== DEFAULT_VALUE ? value2 : "") + keyVal;
|
|
150
175
|
onValue(newVal);
|
|
151
|
-
} else if (configName ===
|
|
152
|
-
onValue(
|
|
176
|
+
} else if (configName === "ampm" /* ampm */ && (event.key === "a" || event.key === "p")) {
|
|
177
|
+
onValue(
|
|
178
|
+
event.key === "a" ? config2.am : config2.pm
|
|
179
|
+
);
|
|
153
180
|
}
|
|
154
181
|
break;
|
|
155
182
|
}
|
|
156
183
|
};
|
|
157
|
-
const handleAction = direction => {
|
|
158
|
-
const {
|
|
159
|
-
|
|
160
|
-
} = currentInputFocused;
|
|
161
|
-
const config = useConfig[configName];
|
|
184
|
+
const handleAction = (direction) => {
|
|
185
|
+
const { configName } = currentInputFocused;
|
|
186
|
+
const config2 = useConfig[configName];
|
|
162
187
|
const prevValue = internalValue[configName];
|
|
163
|
-
let
|
|
164
|
-
if (configName ===
|
|
165
|
-
|
|
188
|
+
let value2;
|
|
189
|
+
if (configName === "ampm" /* ampm */) {
|
|
190
|
+
value2 = direction === 1 ? config2.pm : config2.am;
|
|
166
191
|
} else {
|
|
167
|
-
|
|
192
|
+
value2 = handleMaxAndMin(
|
|
193
|
+
String(
|
|
194
|
+
prevValue !== DEFAULT_VALUE ? Number(prevValue) + direction : direction === -1 ? config2.max : 0
|
|
195
|
+
),
|
|
196
|
+
config2
|
|
197
|
+
);
|
|
168
198
|
}
|
|
169
199
|
setCurrentInputFocused({
|
|
170
200
|
configName,
|
|
@@ -173,152 +203,216 @@ const TimePicker = _ref => {
|
|
|
173
203
|
setValue({
|
|
174
204
|
...internalValue,
|
|
175
205
|
// eslint-disable-next-line sort-keys
|
|
176
|
-
[configName]: String(
|
|
206
|
+
[configName]: String(value2).padStart(2, "0")
|
|
177
207
|
});
|
|
178
208
|
};
|
|
179
|
-
const handleDocumentClick = event => {
|
|
209
|
+
const handleDocumentClick = (event) => {
|
|
180
210
|
if (elementRef.current && event.target !== null && !elementRef.current.contains(event.target)) {
|
|
181
211
|
setActionVisible(false);
|
|
182
212
|
setCurrentInputFocused(defaultFocused);
|
|
183
213
|
}
|
|
184
214
|
};
|
|
185
|
-
const handleInputFocus = configName => {
|
|
215
|
+
const handleInputFocus = (configName) => {
|
|
186
216
|
setActionVisible(true);
|
|
187
217
|
setCurrentInputFocused({
|
|
188
218
|
configName,
|
|
189
219
|
focused: true
|
|
190
220
|
});
|
|
191
221
|
};
|
|
192
|
-
(0,
|
|
193
|
-
document.addEventListener(
|
|
222
|
+
(0, import_react.useEffect)(() => {
|
|
223
|
+
document.addEventListener("click", handleDocumentClick);
|
|
194
224
|
return () => {
|
|
195
|
-
document.removeEventListener(
|
|
225
|
+
document.removeEventListener("click", handleDocumentClick);
|
|
196
226
|
};
|
|
197
227
|
}, []);
|
|
198
|
-
const visibleActionReset = actionVisible && (internalValue.ampm !== DEFAULT_VALUE && internalValue.ampm
|
|
199
|
-
return
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
228
|
+
const visibleActionReset = actionVisible && (internalValue.ampm !== DEFAULT_VALUE && internalValue.ampm !== null || internalValue.hours !== DEFAULT_VALUE || internalValue.minutes !== DEFAULT_VALUE);
|
|
229
|
+
return /* @__PURE__ */ import_react.default.createElement("div", { className: "clay-time" }, /* @__PURE__ */ import_react.default.createElement(import_form.ClayInput.Group, null, icon && /* @__PURE__ */ import_react.default.createElement(import_form.ClayInput.GroupItem, { shrink: true }, /* @__PURE__ */ import_react.default.createElement(import_form.ClayInput.GroupText, null, /* @__PURE__ */ import_react.default.createElement(import_icon.default, { spritemap, symbol: "time" }))), /* @__PURE__ */ import_react.default.createElement(import_shared.FocusScope, { arrowKeysLeftRight: true, arrowKeysUpDown: false }, /* @__PURE__ */ import_react.default.createElement(import_form.ClayInput.GroupItem, null, /* @__PURE__ */ import_react.default.createElement(
|
|
230
|
+
"div",
|
|
231
|
+
{
|
|
232
|
+
className: (0, import_classnames.default)("form-control", {
|
|
233
|
+
disabled
|
|
234
|
+
}),
|
|
235
|
+
"data-testid": "formControl",
|
|
236
|
+
onMouseEnter: () => {
|
|
237
|
+
if (!disabled) {
|
|
238
|
+
setActionVisible(true);
|
|
239
|
+
}
|
|
240
|
+
},
|
|
241
|
+
onMouseLeave: () => {
|
|
242
|
+
if (!currentInputFocused.focused && !disabled) {
|
|
243
|
+
setActionVisible(false);
|
|
244
|
+
}
|
|
245
|
+
},
|
|
246
|
+
ref: elementRef
|
|
217
247
|
},
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
248
|
+
/* @__PURE__ */ import_react.default.createElement("div", { className: "clay-time-edit" }, /* @__PURE__ */ import_react.default.createElement(
|
|
249
|
+
"input",
|
|
250
|
+
{
|
|
251
|
+
"aria-label": ariaLabels.hours,
|
|
252
|
+
className: (0, import_classnames.default)(
|
|
253
|
+
"clay-time-hours form-control-inset",
|
|
254
|
+
{
|
|
255
|
+
focus: currentInputFocused.configName === "hours" /* hours */ && currentInputFocused.focused
|
|
256
|
+
}
|
|
257
|
+
),
|
|
258
|
+
"data-testid": "hours",
|
|
259
|
+
disabled,
|
|
260
|
+
id,
|
|
261
|
+
maxLength: 2,
|
|
262
|
+
onFocus: () => handleInputFocus("hours" /* hours */),
|
|
263
|
+
onKeyDown: (event) => handleKeyDown(
|
|
264
|
+
event,
|
|
265
|
+
internalValue.hours,
|
|
266
|
+
"hours" /* hours */
|
|
267
|
+
),
|
|
268
|
+
readOnly: true,
|
|
269
|
+
type: "text",
|
|
270
|
+
value: internalValue.hours
|
|
221
271
|
}
|
|
222
|
-
},
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
272
|
+
), /* @__PURE__ */ import_react.default.createElement("span", { className: "clay-time-divider" }, ":"), /* @__PURE__ */ import_react.default.createElement(
|
|
273
|
+
"input",
|
|
274
|
+
{
|
|
275
|
+
"aria-label": ariaLabels.minutes,
|
|
276
|
+
className: (0, import_classnames.default)(
|
|
277
|
+
"clay-time-minutes form-control-inset",
|
|
278
|
+
{
|
|
279
|
+
focus: currentInputFocused.configName === "minutes" /* minutes */
|
|
280
|
+
}
|
|
281
|
+
),
|
|
282
|
+
"data-testid": "minutes",
|
|
283
|
+
disabled,
|
|
284
|
+
maxLength: 2,
|
|
285
|
+
onFocus: () => handleInputFocus("minutes" /* minutes */),
|
|
286
|
+
onKeyDown: (event) => handleKeyDown(
|
|
287
|
+
event,
|
|
288
|
+
internalValue.minutes,
|
|
289
|
+
"minutes" /* minutes */
|
|
290
|
+
),
|
|
291
|
+
readOnly: true,
|
|
292
|
+
type: "text",
|
|
293
|
+
value: internalValue.minutes
|
|
294
|
+
}
|
|
295
|
+
), use12Hours && /* @__PURE__ */ import_react.default.createElement(
|
|
296
|
+
"input",
|
|
297
|
+
{
|
|
298
|
+
"aria-label": ariaLabels.ampm,
|
|
299
|
+
className: (0, import_classnames.default)(
|
|
300
|
+
"clay-time-ampm form-control-inset",
|
|
301
|
+
{
|
|
302
|
+
focus: currentInputFocused.configName === "ampm" /* ampm */
|
|
303
|
+
}
|
|
304
|
+
),
|
|
305
|
+
"data-testid": "ampm",
|
|
306
|
+
disabled,
|
|
307
|
+
"max-length": "2",
|
|
308
|
+
onFocus: () => handleInputFocus("ampm" /* ampm */),
|
|
309
|
+
onKeyDown: (event) => handleKeyDown(
|
|
310
|
+
event,
|
|
311
|
+
internalValue.ampm,
|
|
312
|
+
"ampm" /* ampm */
|
|
313
|
+
),
|
|
314
|
+
readOnly: true,
|
|
315
|
+
type: "text",
|
|
316
|
+
value: internalValue.ampm || DEFAULT_VALUE
|
|
317
|
+
}
|
|
318
|
+
), name && /* @__PURE__ */ import_react.default.createElement(
|
|
319
|
+
"input",
|
|
320
|
+
{
|
|
321
|
+
name,
|
|
322
|
+
type: "hidden",
|
|
323
|
+
value: `${internalValue.hours}:${internalValue.minutes}`
|
|
324
|
+
}
|
|
325
|
+
)),
|
|
326
|
+
/* @__PURE__ */ import_react.default.createElement("div", { className: "clay-time-action-group" }, /* @__PURE__ */ import_react.default.createElement(
|
|
327
|
+
"div",
|
|
328
|
+
{
|
|
329
|
+
className: "clay-time-action-group-item",
|
|
330
|
+
"data-testid": "containerReset",
|
|
331
|
+
style: {
|
|
332
|
+
opacity: visibleActionReset ? 1 : 0,
|
|
333
|
+
pointerEvents: visibleActionReset ? "auto" : "none"
|
|
334
|
+
}
|
|
335
|
+
},
|
|
336
|
+
/* @__PURE__ */ import_react.default.createElement(
|
|
337
|
+
import_button.default,
|
|
338
|
+
{
|
|
339
|
+
"aria-label": ariaLabels.clear,
|
|
340
|
+
className: "clay-time-clear-btn",
|
|
341
|
+
disabled,
|
|
342
|
+
displayType: "unstyled",
|
|
343
|
+
onClick: () => setValue(
|
|
344
|
+
use12Hours ? {
|
|
345
|
+
ampm: DEFAULT_VALUE,
|
|
346
|
+
hours: DEFAULT_VALUE,
|
|
347
|
+
minutes: DEFAULT_VALUE
|
|
348
|
+
} : {
|
|
349
|
+
hours: DEFAULT_VALUE,
|
|
350
|
+
minutes: DEFAULT_VALUE
|
|
351
|
+
}
|
|
352
|
+
),
|
|
353
|
+
tabIndex: visibleActionReset ? 0 : -1
|
|
354
|
+
},
|
|
355
|
+
/* @__PURE__ */ import_react.default.createElement(
|
|
356
|
+
import_icon.default,
|
|
357
|
+
{
|
|
358
|
+
spritemap,
|
|
359
|
+
symbol: "times-circle"
|
|
360
|
+
}
|
|
361
|
+
)
|
|
362
|
+
)
|
|
363
|
+
), /* @__PURE__ */ import_react.default.createElement(
|
|
364
|
+
"div",
|
|
365
|
+
{
|
|
366
|
+
className: "clay-time-action-group-item",
|
|
367
|
+
"data-testid": "containerSpin",
|
|
368
|
+
style: {
|
|
369
|
+
opacity: actionVisible ? 1 : 0
|
|
370
|
+
}
|
|
371
|
+
},
|
|
372
|
+
/* @__PURE__ */ import_react.default.createElement(
|
|
373
|
+
"div",
|
|
374
|
+
{
|
|
375
|
+
className: "btn-group-vertical clay-time-inner-spin",
|
|
376
|
+
role: "group"
|
|
377
|
+
},
|
|
378
|
+
/* @__PURE__ */ import_react.default.createElement(
|
|
379
|
+
import_button.default,
|
|
380
|
+
{
|
|
381
|
+
"aria-label": ariaLabels.timeUp,
|
|
382
|
+
className: "clay-time-inner-spin-btn clay-time-inner-spin-btn-inc",
|
|
383
|
+
"data-testid": "spinInc",
|
|
384
|
+
disabled,
|
|
385
|
+
displayType: "secondary",
|
|
386
|
+
onClick: () => handleAction(1)
|
|
387
|
+
},
|
|
388
|
+
/* @__PURE__ */ import_react.default.createElement(
|
|
389
|
+
import_icon.default,
|
|
390
|
+
{
|
|
391
|
+
spritemap,
|
|
392
|
+
symbol: "angle-up"
|
|
393
|
+
}
|
|
394
|
+
)
|
|
395
|
+
),
|
|
396
|
+
/* @__PURE__ */ import_react.default.createElement(
|
|
397
|
+
import_button.default,
|
|
398
|
+
{
|
|
399
|
+
"aria-label": ariaLabels.timeDown,
|
|
400
|
+
className: "clay-time-inner-spin-btn clay-time-inner-spin-btn-dec",
|
|
401
|
+
"data-testid": "spinDec",
|
|
402
|
+
disabled,
|
|
403
|
+
displayType: "secondary",
|
|
404
|
+
onClick: () => handleAction(-1)
|
|
405
|
+
},
|
|
406
|
+
/* @__PURE__ */ import_react.default.createElement(
|
|
407
|
+
import_icon.default,
|
|
408
|
+
{
|
|
409
|
+
spritemap,
|
|
410
|
+
symbol: "angle-down"
|
|
411
|
+
}
|
|
412
|
+
)
|
|
413
|
+
)
|
|
414
|
+
)
|
|
415
|
+
))
|
|
416
|
+
))), timezone && /* @__PURE__ */ import_react.default.createElement(import_form.ClayInput.GroupItem, { shrink: true }, /* @__PURE__ */ import_react.default.createElement(import_form.ClayInput.GroupText, null, `(${timezone})`))));
|
|
417
|
+
}
|
|
418
|
+
var src_default = TimePicker;
|