@semcore/time-picker 16.2.0 → 16.2.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 +1 -1
- package/lib/cjs/PickerFormat.js +81 -0
- package/lib/cjs/PickerFormat.js.map +1 -0
- package/lib/cjs/{component/PickerInput/PickerInput.js → PickerInput.js} +82 -72
- package/lib/cjs/PickerInput.js.map +1 -0
- package/lib/cjs/TimePicker.js +348 -0
- package/lib/cjs/TimePicker.js.map +1 -0
- package/lib/cjs/index.d.js +2 -0
- package/lib/cjs/index.d.js.map +1 -0
- package/lib/cjs/index.js +5 -6
- package/lib/cjs/index.js.map +1 -1
- package/lib/cjs/{component/PickerFormat/picker-format.shadow.css → style/time-picker.shadow.css} +56 -1
- package/lib/es6/PickerFormat.js +75 -0
- package/lib/es6/PickerFormat.js.map +1 -0
- package/lib/es6/{component/PickerInput/PickerInput.js → PickerInput.js} +82 -73
- package/lib/es6/PickerInput.js.map +1 -0
- package/lib/es6/TimePicker.js +339 -0
- package/lib/es6/TimePicker.js.map +1 -0
- package/lib/es6/index.d.js +2 -0
- package/lib/es6/index.d.js.map +1 -0
- package/lib/es6/index.js +2 -2
- package/lib/es6/index.js.map +1 -1
- package/lib/{esm/component/PickerFormat/picker-format.shadow.css → es6/style/time-picker.shadow.css} +56 -1
- package/lib/esm/PickerFormat.mjs +67 -0
- package/lib/esm/{component/PickerInput/PickerInput.mjs → PickerInput.mjs} +76 -75
- package/lib/esm/TimePicker.mjs +297 -0
- package/lib/esm/index.mjs +7 -3
- package/lib/{es6/component/PickerFormat/picker-format.shadow.css → esm/style/time-picker.shadow.css} +56 -1
- package/lib/types/index.d.ts +63 -2
- package/package.json +5 -5
- package/lib/cjs/component/PickerFormat/PickerFormat.js +0 -93
- package/lib/cjs/component/PickerFormat/PickerFormat.js.map +0 -1
- package/lib/cjs/component/PickerFormat/PickerFormat.type.js +0 -2
- package/lib/cjs/component/PickerFormat/PickerFormat.type.js.map +0 -1
- package/lib/cjs/component/PickerInput/PickerInput.js.map +0 -1
- package/lib/cjs/component/PickerInput/PickerInput.type.js +0 -2
- package/lib/cjs/component/PickerInput/PickerInput.type.js.map +0 -1
- package/lib/cjs/component/PickerInput/picker-input.shadow.css +0 -11
- package/lib/cjs/component/TimePicker/TimePicker.js +0 -254
- package/lib/cjs/component/TimePicker/TimePicker.js.map +0 -1
- package/lib/cjs/component/TimePicker/TimePicker.type.js +0 -2
- package/lib/cjs/component/TimePicker/TimePicker.type.js.map +0 -1
- package/lib/cjs/component/TimePicker/time-picker.shadow.css +0 -34
- package/lib/cjs/entity/TimePickerEntity.js +0 -101
- package/lib/cjs/entity/TimePickerEntity.js.map +0 -1
- package/lib/es6/component/PickerFormat/PickerFormat.js +0 -88
- package/lib/es6/component/PickerFormat/PickerFormat.js.map +0 -1
- package/lib/es6/component/PickerFormat/PickerFormat.type.js +0 -2
- package/lib/es6/component/PickerFormat/PickerFormat.type.js.map +0 -1
- package/lib/es6/component/PickerInput/PickerInput.js.map +0 -1
- package/lib/es6/component/PickerInput/PickerInput.type.js +0 -2
- package/lib/es6/component/PickerInput/PickerInput.type.js.map +0 -1
- package/lib/es6/component/PickerInput/picker-input.shadow.css +0 -11
- package/lib/es6/component/TimePicker/TimePicker.js +0 -250
- package/lib/es6/component/TimePicker/TimePicker.js.map +0 -1
- package/lib/es6/component/TimePicker/TimePicker.type.js +0 -2
- package/lib/es6/component/TimePicker/TimePicker.type.js.map +0 -1
- package/lib/es6/component/TimePicker/time-picker.shadow.css +0 -34
- package/lib/es6/entity/TimePickerEntity.js +0 -94
- package/lib/es6/entity/TimePickerEntity.js.map +0 -1
- package/lib/esm/component/PickerFormat/PickerFormat.mjs +0 -86
- package/lib/esm/component/PickerInput/picker-input.shadow.css +0 -11
- package/lib/esm/component/TimePicker/TimePicker.mjs +0 -233
- package/lib/esm/component/TimePicker/TimePicker.type.mjs +0 -1
- package/lib/esm/component/TimePicker/time-picker.shadow.css +0 -34
- package/lib/esm/entity/TimePickerEntity.mjs +0 -90
- package/lib/types/component/PickerFormat/PickerFormat.d.ts +0 -17
- package/lib/types/component/PickerFormat/PickerFormat.type.d.ts +0 -16
- package/lib/types/component/PickerInput/PickerInput.d.ts +0 -54
- package/lib/types/component/PickerInput/PickerInput.type.d.ts +0 -13
- package/lib/types/component/TimePicker/TimePicker.d.ts +0 -3
- package/lib/types/component/TimePicker/TimePicker.type.d.ts +0 -50
- package/lib/types/entity/TimePickerEntity.d.ts +0 -22
- package/lib/types/translations/__intergalactic-dynamic-locales.d.ts +0 -114
|
@@ -1,78 +1,72 @@
|
|
|
1
1
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
3
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
3
4
|
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
4
5
|
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
5
6
|
import _callSuper from "@babel/runtime/helpers/esm/callSuper";
|
|
6
7
|
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
7
8
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
8
|
-
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
9
9
|
import { sstyled, assignProps, Component } from "@semcore/core";
|
|
10
10
|
import { callAllEventHandlers } from "@semcore/core/lib/utils/assignProps";
|
|
11
11
|
import Input from "@semcore/input";
|
|
12
12
|
import Select from "@semcore/select";
|
|
13
13
|
import React from "react";
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
var
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
"_size_m": "_size_m_p1g8c_gg_",
|
|
27
|
-
"_size_l": "_size_l_p1g8c_gg_"
|
|
28
|
-
})
|
|
29
|
-
);
|
|
30
|
-
function getOptions(minMax) {
|
|
31
|
-
var step = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 1;
|
|
32
|
-
var _minMax = _slicedToArray(minMax, 2), min = _minMax[0], max = _minMax[1];
|
|
14
|
+
import { withLeadingZero, intOrDefault } from "./TimePicker.mjs";
|
|
15
|
+
var _excluded = ["styles", "step", "onSelect", "time", "size", "disabled", "onVisibleChange"];
|
|
16
|
+
var MAP_FIELD_TO_TIME = {
|
|
17
|
+
hours: 0,
|
|
18
|
+
minutes: 1
|
|
19
|
+
};
|
|
20
|
+
var MAP_SIZE_SELECT = {
|
|
21
|
+
m: "m",
|
|
22
|
+
l: "l"
|
|
23
|
+
};
|
|
24
|
+
function getOptions(min, max) {
|
|
25
|
+
var step = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : 1;
|
|
33
26
|
var length = Number(((max + 1 - min) / step).toFixed(0));
|
|
34
27
|
var options = Array(length).fill("");
|
|
35
28
|
var numValue = min;
|
|
36
29
|
return options.map(function(_i, index) {
|
|
37
30
|
numValue = index === 0 ? numValue : numValue + step;
|
|
38
|
-
var value = String(numValue)
|
|
31
|
+
var value = withLeadingZero(String(numValue));
|
|
39
32
|
return /* @__PURE__ */ React.createElement(Select.Option, {
|
|
40
33
|
value,
|
|
41
34
|
key: value
|
|
42
35
|
}, value);
|
|
43
36
|
});
|
|
44
37
|
}
|
|
45
|
-
var
|
|
46
|
-
|
|
38
|
+
var defaultPopperOffset = [-8, 4];
|
|
39
|
+
var ItemPicker = /* @__PURE__ */ (function(_Component) {
|
|
40
|
+
function ItemPicker2() {
|
|
47
41
|
var _this;
|
|
48
|
-
_classCallCheck(this,
|
|
42
|
+
_classCallCheck(this, ItemPicker2);
|
|
49
43
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
50
44
|
args[_key] = arguments[_key];
|
|
51
45
|
}
|
|
52
|
-
_this = _callSuper(this,
|
|
46
|
+
_this = _callSuper(this, ItemPicker2, [].concat(args));
|
|
47
|
+
_defineProperty(_this, "inputRef", /* @__PURE__ */ React.createRef());
|
|
53
48
|
_defineProperty(_this, "state", {
|
|
54
49
|
dirtyValue: void 0,
|
|
55
50
|
visible: false
|
|
56
51
|
});
|
|
57
|
-
_defineProperty(_this, "inputRef", /* @__PURE__ */ React.createRef());
|
|
58
52
|
_defineProperty(_this, "parseValueWithMinMax", function(value) {
|
|
59
|
-
var _this$minMax = _slicedToArray(_this
|
|
60
|
-
|
|
61
|
-
return String(Math.max(min, Math.min(max, numberValue)));
|
|
53
|
+
var _this$minMax = _this.minMax(), _this$minMax2 = _slicedToArray(_this$minMax, 2), min = _this$minMax2[0], max = _this$minMax2[1];
|
|
54
|
+
return String(Math.max(min, Math.min(max, value)));
|
|
62
55
|
});
|
|
63
56
|
_defineProperty(_this, "handleChange", function(value, event) {
|
|
64
57
|
event.stopPropagation();
|
|
65
|
-
var
|
|
66
|
-
var numberValue = Number(inputValue);
|
|
58
|
+
var numberValue = intOrDefault(Number(value), Number.NaN);
|
|
67
59
|
if (!Number.isNaN(numberValue)) {
|
|
68
60
|
_this.setState({
|
|
69
|
-
dirtyValue:
|
|
61
|
+
dirtyValue: value.slice(-2)
|
|
70
62
|
});
|
|
71
63
|
}
|
|
72
64
|
});
|
|
73
65
|
_defineProperty(_this, "handleBlur", function(event) {
|
|
74
66
|
return _this.submitChanges(event);
|
|
75
67
|
});
|
|
68
|
+
_defineProperty(_this, "handleKeyDown", function() {
|
|
69
|
+
});
|
|
76
70
|
_defineProperty(_this, "handleSelect", function(value, event) {
|
|
77
71
|
_this.dispatchOnChange(value, event);
|
|
78
72
|
});
|
|
@@ -81,10 +75,21 @@ var AbstractPickerInput = /* @__PURE__ */ (function(_Component) {
|
|
|
81
75
|
visible
|
|
82
76
|
});
|
|
83
77
|
});
|
|
78
|
+
_defineProperty(_this, "getAriaLabel", function() {
|
|
79
|
+
var getI18nText = _this.asProps._getI18nText;
|
|
80
|
+
if (_this.field === "hours") return getI18nText("hours");
|
|
81
|
+
if (_this.field === "minutes") return getI18nText("minutes");
|
|
82
|
+
return void 0;
|
|
83
|
+
});
|
|
84
84
|
return _this;
|
|
85
85
|
}
|
|
86
|
-
_inherits(
|
|
87
|
-
return _createClass(
|
|
86
|
+
_inherits(ItemPicker2, _Component);
|
|
87
|
+
return _createClass(ItemPicker2, [{
|
|
88
|
+
key: "minMax",
|
|
89
|
+
value: function minMax() {
|
|
90
|
+
return [];
|
|
91
|
+
}
|
|
92
|
+
}, {
|
|
88
93
|
key: "dispatchOnChange",
|
|
89
94
|
value: function dispatchOnChange(value, event) {
|
|
90
95
|
this.setState({
|
|
@@ -106,17 +111,18 @@ var AbstractPickerInput = /* @__PURE__ */ (function(_Component) {
|
|
|
106
111
|
value: function render() {
|
|
107
112
|
var _ref = this.asProps, _ref2;
|
|
108
113
|
var SPickerInput = Select.Trigger;
|
|
109
|
-
var _this$asProps = this.asProps, styles = _this$asProps.styles, step = _this$asProps.step, onSelect = _this$asProps.onSelect, time = _this$asProps.time, size = _this$asProps.size, disabled = _this$asProps.disabled, onVisibleChange = _this$asProps.onVisibleChange,
|
|
114
|
+
var _this$asProps = this.asProps, styles = _this$asProps.styles, step = _this$asProps.step, onSelect = _this$asProps.onSelect, time = _this$asProps.time, size = _this$asProps.size, disabled = _this$asProps.disabled, onVisibleChange = _this$asProps.onVisibleChange, other = _objectWithoutProperties(_this$asProps, _excluded);
|
|
110
115
|
var _this$state = this.state, dirtyValue = _this$state.dirtyValue, visible = _this$state.visible;
|
|
111
|
-
var
|
|
116
|
+
var timeValue = time[MAP_FIELD_TO_TIME[this.field]];
|
|
117
|
+
var value = dirtyValue === void 0 ? timeValue : dirtyValue;
|
|
118
|
+
var _this$minMax3 = this.minMax(), _this$minMax4 = _slicedToArray(_this$minMax3, 2), min = _this$minMax4[0], max = _this$minMax4[1];
|
|
112
119
|
return _ref2 = sstyled(styles), /* @__PURE__ */ React.createElement(Select, _ref2.cn("Select", _objectSpread(_objectSpread({}, other), {}, {
|
|
113
120
|
"interaction": "focus",
|
|
114
|
-
"size": size,
|
|
121
|
+
"size": size ? MAP_SIZE_SELECT[size] : false,
|
|
115
122
|
"onChange": callAllEventHandlers(onSelect, this.handleSelect),
|
|
116
123
|
"onVisibleChange": callAllEventHandlers(onVisibleChange, this.handleVisibleChange),
|
|
117
124
|
"visible": visible,
|
|
118
|
-
"value":
|
|
119
|
-
"defaultHighlightedIndex": time ? null : 0
|
|
125
|
+
"value": timeValue
|
|
120
126
|
})), /* @__PURE__ */ React.createElement(SPickerInput, _ref2.cn("SPickerInput", _objectSpread({}, assignProps({
|
|
121
127
|
"tag": Input.Value,
|
|
122
128
|
"ref": this.inputRef,
|
|
@@ -125,24 +131,21 @@ var AbstractPickerInput = /* @__PURE__ */ (function(_Component) {
|
|
|
125
131
|
"disabled": disabled,
|
|
126
132
|
"neighborLocation": false,
|
|
127
133
|
"value": value,
|
|
128
|
-
"aria-label":
|
|
134
|
+
"aria-label": this.getAriaLabel(),
|
|
129
135
|
"onChange": this.handleChange,
|
|
130
136
|
"onBlur": this.handleBlur,
|
|
131
137
|
"onKeyDown": this.handleKeyDown
|
|
132
138
|
}, _ref)))), /* @__PURE__ */ React.createElement(Select.Menu, {
|
|
133
139
|
hMax: 180
|
|
134
|
-
}, getOptions(
|
|
140
|
+
}, getOptions(min, max, step)));
|
|
135
141
|
}
|
|
136
142
|
}]);
|
|
137
143
|
})(Component);
|
|
138
|
-
_defineProperty(
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
placeholder: "00",
|
|
142
|
-
offset: [-8, 4]
|
|
143
|
-
};
|
|
144
|
+
_defineProperty(ItemPicker, "defaultProps", {
|
|
145
|
+
placeholder: "00",
|
|
146
|
+
offset: defaultPopperOffset
|
|
144
147
|
});
|
|
145
|
-
var Hours = /* @__PURE__ */ (function(
|
|
148
|
+
var Hours = /* @__PURE__ */ (function(_ItemPicker2) {
|
|
146
149
|
function Hours2() {
|
|
147
150
|
var _this2;
|
|
148
151
|
_classCallCheck(this, Hours2);
|
|
@@ -150,13 +153,14 @@ var Hours = /* @__PURE__ */ (function(_AbstractPickerInput2) {
|
|
|
150
153
|
args[_key2] = arguments[_key2];
|
|
151
154
|
}
|
|
152
155
|
_this2 = _callSuper(this, Hours2, [].concat(args));
|
|
156
|
+
_defineProperty(_this2, "field", "hours");
|
|
153
157
|
_defineProperty(_this2, "handleKeyDown", function(event) {
|
|
154
158
|
var currentTarget = event.currentTarget;
|
|
155
159
|
if (event.key === "Enter") {
|
|
156
160
|
_this2.submitChanges(event);
|
|
157
161
|
}
|
|
158
162
|
if (event.key === "ArrowRight") {
|
|
159
|
-
if (currentTarget.selectionStart
|
|
163
|
+
if (currentTarget.selectionStart >= currentTarget.value.length && currentTarget.selectionStart === currentTarget.selectionEnd) {
|
|
160
164
|
event.preventDefault();
|
|
161
165
|
_this2.focusNext();
|
|
162
166
|
}
|
|
@@ -164,17 +168,16 @@ var Hours = /* @__PURE__ */ (function(_AbstractPickerInput2) {
|
|
|
164
168
|
});
|
|
165
169
|
return _this2;
|
|
166
170
|
}
|
|
167
|
-
_inherits(Hours2,
|
|
171
|
+
_inherits(Hours2, _ItemPicker2);
|
|
168
172
|
return _createClass(Hours2, [{
|
|
169
|
-
key: "field",
|
|
170
|
-
get: function get() {
|
|
171
|
-
return "hours";
|
|
172
|
-
}
|
|
173
|
-
}, {
|
|
174
173
|
key: "minMax",
|
|
175
|
-
|
|
174
|
+
value: function minMax() {
|
|
176
175
|
var is12Hour = this.asProps.is12Hour;
|
|
177
|
-
|
|
176
|
+
if (is12Hour) {
|
|
177
|
+
return [1, 12];
|
|
178
|
+
} else {
|
|
179
|
+
return [0, 23];
|
|
180
|
+
}
|
|
178
181
|
}
|
|
179
182
|
}, {
|
|
180
183
|
key: "focusNext",
|
|
@@ -188,7 +191,7 @@ var Hours = /* @__PURE__ */ (function(_AbstractPickerInput2) {
|
|
|
188
191
|
}
|
|
189
192
|
}, {
|
|
190
193
|
key: "componentDidUpdate",
|
|
191
|
-
value: function componentDidUpdate(
|
|
194
|
+
value: function componentDidUpdate(_prevProps, prevState) {
|
|
192
195
|
var dirtyValue = this.state.dirtyValue;
|
|
193
196
|
if (prevState.dirtyValue === void 0 || dirtyValue === void 0) return;
|
|
194
197
|
if (prevState.dirtyValue.length === 1 && dirtyValue.length === 2) {
|
|
@@ -196,13 +199,14 @@ var Hours = /* @__PURE__ */ (function(_AbstractPickerInput2) {
|
|
|
196
199
|
}
|
|
197
200
|
}
|
|
198
201
|
}]);
|
|
199
|
-
})(
|
|
200
|
-
_defineProperty(Hours, "defaultProps", function(
|
|
201
|
-
|
|
202
|
-
|
|
202
|
+
})(ItemPicker);
|
|
203
|
+
_defineProperty(Hours, "defaultProps", function(_ref3) {
|
|
204
|
+
var size = _ref3.size;
|
|
205
|
+
return _objectSpread(_objectSpread({}, ItemPicker.defaultProps), {}, {
|
|
206
|
+
ml: size === "l" ? 3 : void 0
|
|
203
207
|
});
|
|
204
208
|
});
|
|
205
|
-
var Minutes = /* @__PURE__ */ (function(
|
|
209
|
+
var Minutes = /* @__PURE__ */ (function(_ItemPicker3) {
|
|
206
210
|
function Minutes2() {
|
|
207
211
|
var _this3;
|
|
208
212
|
_classCallCheck(this, Minutes2);
|
|
@@ -210,10 +214,11 @@ var Minutes = /* @__PURE__ */ (function(_AbstractPickerInput3) {
|
|
|
210
214
|
args[_key3] = arguments[_key3];
|
|
211
215
|
}
|
|
212
216
|
_this3 = _callSuper(this, Minutes2, [].concat(args));
|
|
217
|
+
_defineProperty(_this3, "field", "minutes");
|
|
213
218
|
_defineProperty(_this3, "handleKeyDown", function(event) {
|
|
214
219
|
var currentTarget = event.currentTarget;
|
|
215
220
|
if (event.key === "ArrowLeft") {
|
|
216
|
-
if (currentTarget.selectionStart
|
|
221
|
+
if (currentTarget.selectionStart <= 0 && currentTarget.selectionStart === currentTarget.selectionEnd) {
|
|
217
222
|
event.preventDefault();
|
|
218
223
|
_this3.focusPrev();
|
|
219
224
|
}
|
|
@@ -228,15 +233,10 @@ var Minutes = /* @__PURE__ */ (function(_AbstractPickerInput3) {
|
|
|
228
233
|
});
|
|
229
234
|
return _this3;
|
|
230
235
|
}
|
|
231
|
-
_inherits(Minutes2,
|
|
236
|
+
_inherits(Minutes2, _ItemPicker3);
|
|
232
237
|
return _createClass(Minutes2, [{
|
|
233
|
-
key: "field",
|
|
234
|
-
get: function get() {
|
|
235
|
-
return "minutes";
|
|
236
|
-
}
|
|
237
|
-
}, {
|
|
238
238
|
key: "minMax",
|
|
239
|
-
|
|
239
|
+
value: function minMax() {
|
|
240
240
|
return [0, 59];
|
|
241
241
|
}
|
|
242
242
|
}, {
|
|
@@ -250,10 +250,11 @@ var Minutes = /* @__PURE__ */ (function(_AbstractPickerInput3) {
|
|
|
250
250
|
}
|
|
251
251
|
}
|
|
252
252
|
}]);
|
|
253
|
-
})(
|
|
254
|
-
_defineProperty(Minutes, "defaultProps", function(
|
|
255
|
-
|
|
256
|
-
|
|
253
|
+
})(ItemPicker);
|
|
254
|
+
_defineProperty(Minutes, "defaultProps", function(_ref4) {
|
|
255
|
+
var size = _ref4.size;
|
|
256
|
+
return _objectSpread(_objectSpread({}, ItemPicker.defaultProps), {}, {
|
|
257
|
+
mr: size === "l" ? 3 : void 0
|
|
257
258
|
});
|
|
258
259
|
});
|
|
259
260
|
export {
|
|
@@ -0,0 +1,297 @@
|
|
|
1
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
3
|
+
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
4
|
+
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
5
|
+
import _callSuper from "@babel/runtime/helpers/esm/callSuper";
|
|
6
|
+
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
7
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
8
|
+
import { sstyled, createComponent, assignProps, Component } from "@semcore/core";
|
|
9
|
+
import i18nEnhance from "@semcore/core/lib/utils/enhances/i18nEnhance";
|
|
10
|
+
import { Box } from "@semcore/flex-box";
|
|
11
|
+
import Input from "@semcore/input";
|
|
12
|
+
import React from "react";
|
|
13
|
+
import TimePickerFormat from "./PickerFormat.mjs";
|
|
14
|
+
import { Minutes, Hours } from "./PickerInput.mjs";
|
|
15
|
+
import { localizedMessages } from "./translations/__intergalactic-dynamic-locales.mjs";
|
|
16
|
+
/*!__reshadow-styles__:"./style/time-picker.shadow.css"*/
|
|
17
|
+
var style = (
|
|
18
|
+
/*__reshadow_css_start__*/
|
|
19
|
+
(sstyled.insert(
|
|
20
|
+
/*__inner_css_start__*/
|
|
21
|
+
".___STimePicker_16fpm_gg_{position:relative;width:auto;outline:0}.___STimePicker_16fpm_gg_ .___SPickerInput_16fpm_gg_{box-sizing:content-box;text-align:center;z-index:1;height:1.5em}.___STimePicker_16fpm_gg_ .___SPickerInput_16fpm_gg_.__placeholder_16fpm_gg_{text-overflow:initial}.___STimePicker_16fpm_gg_ .___SPickerInput_16fpm_gg_:focus{outline:0;background-color:var(--intergalactic-bg-highlight-focus, rgba(1, 79, 255, 0.116))}@supports (color:color(display-p3 0 0 0%)){.___STimePicker_16fpm_gg_ .___SPickerInput_16fpm_gg_:focus{background-color:var(--intergalactic-bg-highlight-focus, rgba(1, 79, 255, 0.116))}@media (color-gamut:p3){.___STimePicker_16fpm_gg_ .___SPickerInput_16fpm_gg_:focus{background-color:var(--intergalactic-bg-highlight-focus, color(display-p3 0.12361 0.30547 0.96332 / 0.116))}}}.___SPickerFormat_16fpm_gg_,.___STimePicker_16fpm_gg_.__disabled_16fpm_gg_{color:var(--intergalactic-text-secondary, rgba(0, 3, 0, 0.583));cursor:default}@supports (color:color(display-p3 0 0 0%)){.___STimePicker_16fpm_gg_.__disabled_16fpm_gg_{color:var(--intergalactic-text-secondary, rgba(0, 3, 0, 0.583))}@media (color-gamut:p3){.___STimePicker_16fpm_gg_.__disabled_16fpm_gg_{color:var(--intergalactic-text-secondary, color(display-p3 0.00228 0.01289 0.00252 / 0.583))}}}.___SPickerInput_16fpm_gg_._size_l_16fpm_gg_,.___SPickerInput_16fpm_gg_._size_m_16fpm_gg_{width:19px;margin:0 var(--intergalactic-spacing-2x, 8px);padding:0}.___SPickerInput_16fpm_gg_._size_l_16fpm_gg_{width:21px}.___SPickerFormat_16fpm_gg_{flex-shrink:0;position:relative;display:inline-flex;padding:0;white-space:nowrap;font-family:inherit;font-weight:var(--intergalactic-medium, 500);line-height:normal;-webkit-text-decoration:none;text-decoration:none;align-items:center;border:1px solid var(--intergalactic-border-primary, rgba(0, 12, 8, 0.161));border-radius:0 var(--intergalactic-control-rounded, 6px) var(--intergalactic-control-rounded, 6px)0;box-shadow:none;cursor:pointer;box-sizing:border-box;overflow:visible;-webkit-user-select:none;-moz-user-select:none;user-select:none;touch-action:manipulation;-webkit-tap-highlight-color:transparent;background-color:var(--intergalactic-bg-secondary-neutral, rgb(248, 249, 248))}@supports (color:color(display-p3 0 0 0%)){.___SPickerFormat_16fpm_gg_{border:1px solid var(--intergalactic-border-primary, rgba(0, 12, 8, 0.161));color:var(--intergalactic-text-secondary, rgba(0, 3, 0, 0.583))}@media (color-gamut:p3){.___SPickerFormat_16fpm_gg_{border:1px solid var(--intergalactic-border-primary, color(display-p3 0.00798 0.04498 0.03219 / 0.161));color:var(--intergalactic-text-secondary, color(display-p3 0.00228 0.01289 0.00252 / 0.583))}}}@media (hover:hover){.___SPickerFormat_16fpm_gg_:hover{color:var(--intergalactic-text-secondary, rgba(0, 3, 0, 0.583));background-color:var(--intergalactic-bg-secondary-neutral-hover, rgb(241, 242, 242))}@supports (color:color(display-p3 0 0 0%)){.___SPickerFormat_16fpm_gg_:hover{color:var(--intergalactic-text-secondary, rgba(0, 3, 0, 0.583))}@media (color-gamut:p3){.___SPickerFormat_16fpm_gg_:hover{color:var(--intergalactic-text-secondary, color(display-p3 0.00228 0.01289 0.00252 / 0.583))}}}}.___SPickerFormat_16fpm_gg_.__active_16fpm_gg_,.___SPickerFormat_16fpm_gg_:active{color:var(--intergalactic-text-secondary, rgba(0, 3, 0, 0.583));background-color:var(--intergalactic-bg-secondary-neutral-active, rgb(234, 235, 235))}@supports (color:color(display-p3 0 0 0%)){.___SPickerFormat_16fpm_gg_.__active_16fpm_gg_,.___SPickerFormat_16fpm_gg_:active{color:var(--intergalactic-text-secondary, rgba(0, 3, 0, 0.583))}@media (color-gamut:p3){.___SPickerFormat_16fpm_gg_.__active_16fpm_gg_,.___SPickerFormat_16fpm_gg_:active{color:var(--intergalactic-text-secondary, color(display-p3 0.00228 0.01289 0.00252 / 0.583))}}}.___SPickerFormat_16fpm_gg_._size_m_16fpm_gg_{height:var(--intergalactic-form-control-m, 28px);font-size:var(--intergalactic-fs-200, 14px);margin:0-1px 0 0}.___SPickerFormat_16fpm_gg_._size_m_16fpm_gg_ .___SPickerFormatText_16fpm_gg_{margin:0 var(--intergalactic-spacing-2x, 8px)}.___SPickerFormat_16fpm_gg_._size_l_16fpm_gg_{height:var(--intergalactic-form-control-l, 40px);font-size:var(--intergalactic-fs-300, 16px);margin:0-1px 0 0}.___SPickerFormat_16fpm_gg_._size_l_16fpm_gg_ .___SPickerFormatText_16fpm_gg_{margin:0 var(--intergalactic-spacing-3x, 12px)}.___SPickerFormat_16fpm_gg_.__disabled_16fpm_gg_{opacity:var(--intergalactic-disabled-opacity, 0.4);cursor:default;pointer-events:none;border-color:transparent transparent transparent var(--intergalactic-border-primary, rgba(0, 12, 8, 0.161))}@supports (color:color(display-p3 0 0 0%)){.___SPickerFormat_16fpm_gg_.__disabled_16fpm_gg_{border-color:transparent transparent transparent var(--intergalactic-border-primary, rgba(0, 12, 8, 0.161))}@media (color-gamut:p3){.___SPickerFormat_16fpm_gg_.__disabled_16fpm_gg_{border-color:transparent transparent transparent var(--intergalactic-border-primary, color(display-p3 0.00798 0.04498 0.03219 / 0.161))}}}.___STimePickerSeparator_16fpm_gg_{color:var(--intergalactic-text-primary, rgba(1, 5, 0, 0.899))}.___STimePickerSeparator_16fpm_gg_.__disabled_16fpm_gg_{opacity:var(--intergalactic-disabled-opacity, 0.4);pointer-events:none}",
|
|
22
|
+
/*__inner_css_end__*/
|
|
23
|
+
"16fpm_gg_"
|
|
24
|
+
), /*__reshadow_css_end__*/
|
|
25
|
+
{
|
|
26
|
+
"__STimePicker": "___STimePicker_16fpm_gg_",
|
|
27
|
+
"_disabled": "__disabled_16fpm_gg_",
|
|
28
|
+
"__SPickerInput": "___SPickerInput_16fpm_gg_",
|
|
29
|
+
"_size_m": "_size_m_16fpm_gg_",
|
|
30
|
+
"_size_l": "_size_l_16fpm_gg_",
|
|
31
|
+
"__SPickerFormat": "___SPickerFormat_16fpm_gg_",
|
|
32
|
+
"__STimePickerSeparator": "___STimePickerSeparator_16fpm_gg_",
|
|
33
|
+
"_placeholder": "__placeholder_16fpm_gg_",
|
|
34
|
+
"_active": "__active_16fpm_gg_",
|
|
35
|
+
"__SPickerFormatText": "___SPickerFormatText_16fpm_gg_"
|
|
36
|
+
})
|
|
37
|
+
);
|
|
38
|
+
var MAP_MERIDIEM = {
|
|
39
|
+
AM: "PM",
|
|
40
|
+
PM: "AM"
|
|
41
|
+
};
|
|
42
|
+
var MAP_FIELD_TO_TIME = {
|
|
43
|
+
hours: 0,
|
|
44
|
+
minutes: 1
|
|
45
|
+
};
|
|
46
|
+
function intOrDefault(value) {
|
|
47
|
+
var def = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0;
|
|
48
|
+
var number = Number.parseInt(value);
|
|
49
|
+
return Number.isNaN(number) ? def : number;
|
|
50
|
+
}
|
|
51
|
+
function withLeadingZero(value) {
|
|
52
|
+
value = String(value);
|
|
53
|
+
if (value.length === 1) return "0".concat(value);
|
|
54
|
+
return String(value);
|
|
55
|
+
}
|
|
56
|
+
function meridiemByHours(hours) {
|
|
57
|
+
return hours >= 12 ? "PM" : "AM";
|
|
58
|
+
}
|
|
59
|
+
function formatHoursTo12(hours) {
|
|
60
|
+
var nHours = intOrDefault(hours, Number.NaN);
|
|
61
|
+
if (Number.isNaN(nHours)) return hours;
|
|
62
|
+
if (nHours === 0) return 12;
|
|
63
|
+
if (nHours > 12) return nHours - 12;
|
|
64
|
+
return hours;
|
|
65
|
+
}
|
|
66
|
+
function formatHoursTo24(hours, meridiem) {
|
|
67
|
+
var nHours = intOrDefault(hours, Number.NaN);
|
|
68
|
+
if (Number.isNaN(nHours)) return hours;
|
|
69
|
+
if (meridiem === "AM") {
|
|
70
|
+
if (nHours === 12) return 0;
|
|
71
|
+
}
|
|
72
|
+
if (meridiem === "PM") {
|
|
73
|
+
if (nHours < 12) return nHours + 12;
|
|
74
|
+
}
|
|
75
|
+
return hours;
|
|
76
|
+
}
|
|
77
|
+
var TimePickerRoot = /* @__PURE__ */ (function(_Component) {
|
|
78
|
+
function TimePickerRoot2() {
|
|
79
|
+
var _this;
|
|
80
|
+
_classCallCheck(this, TimePickerRoot2);
|
|
81
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
82
|
+
args[_key] = arguments[_key];
|
|
83
|
+
}
|
|
84
|
+
_this = _callSuper(this, TimePickerRoot2, [].concat(args));
|
|
85
|
+
_defineProperty(_this, "hoursInputRef", /* @__PURE__ */ React.createRef());
|
|
86
|
+
_defineProperty(_this, "minutesInputRef", /* @__PURE__ */ React.createRef());
|
|
87
|
+
_defineProperty(_this, "_lastMeridiem", "AM");
|
|
88
|
+
_defineProperty(_this, "handleValueChange", function(value, field, event) {
|
|
89
|
+
var is12Hour = _this.asProps.is12Hour;
|
|
90
|
+
var _this2 = _this, meridiem = _this2.meridiem;
|
|
91
|
+
var time;
|
|
92
|
+
if (field) {
|
|
93
|
+
time = _this.value.split(":");
|
|
94
|
+
time[MAP_FIELD_TO_TIME[field]] = value;
|
|
95
|
+
} else {
|
|
96
|
+
time = value.split(":");
|
|
97
|
+
}
|
|
98
|
+
var _time = time, _time2 = _slicedToArray(_time, 2), _time2$ = _time2[0], hours = _time2$ === void 0 ? "" : _time2$, _time2$2 = _time2[1], minutes = _time2$2 === void 0 ? "" : _time2$2;
|
|
99
|
+
if (is12Hour) hours = String(formatHoursTo12(hours));
|
|
100
|
+
value = _this.timeToValue([hours, minutes], meridiem);
|
|
101
|
+
_this.handlers.value(value, event);
|
|
102
|
+
});
|
|
103
|
+
_defineProperty(_this, "handleMeridiemClick", function(event) {
|
|
104
|
+
var is12Hour = _this.asProps.is12Hour;
|
|
105
|
+
var _this3 = _this, value = _this3.value, meridiem = _this3.meridiem;
|
|
106
|
+
var _value$split = value.split(":"), _value$split2 = _slicedToArray(_value$split, 2), _value$split2$ = _value$split2[0], hours = _value$split2$ === void 0 ? "" : _value$split2$, _value$split2$2 = _value$split2[1], minutes = _value$split2$2 === void 0 ? "" : _value$split2$2;
|
|
107
|
+
if (is12Hour) hours = String(formatHoursTo12(hours));
|
|
108
|
+
value = _this.timeToValue([hours, minutes], MAP_MERIDIEM[meridiem]);
|
|
109
|
+
_this.handlers.value(value, event);
|
|
110
|
+
});
|
|
111
|
+
_defineProperty(_this, "_getHoursAndMinutesProps", function() {
|
|
112
|
+
var _this$asProps = _this.asProps, is12Hour = _this$asProps.is12Hour, size = _this$asProps.size, disabled = _this$asProps.disabled, getI18nText = _this$asProps.getI18nText;
|
|
113
|
+
var time = _this.valueToTime(_this.value);
|
|
114
|
+
return {
|
|
115
|
+
time,
|
|
116
|
+
size,
|
|
117
|
+
is12Hour,
|
|
118
|
+
disabled,
|
|
119
|
+
$onValueChange: _this.handleValueChange,
|
|
120
|
+
minutesInputRef: _this.minutesInputRef,
|
|
121
|
+
hoursInputRef: _this.hoursInputRef,
|
|
122
|
+
_getI18nText: getI18nText
|
|
123
|
+
};
|
|
124
|
+
});
|
|
125
|
+
_defineProperty(_this, "getHoursProps", function() {
|
|
126
|
+
return _objectSpread(_objectSpread({}, _this._getHoursAndMinutesProps()), {}, {
|
|
127
|
+
ref: _this.hoursInputRef
|
|
128
|
+
});
|
|
129
|
+
});
|
|
130
|
+
_defineProperty(_this, "getMinutesProps", function() {
|
|
131
|
+
return _objectSpread(_objectSpread({}, _this._getHoursAndMinutesProps()), {}, {
|
|
132
|
+
ref: _this.minutesInputRef
|
|
133
|
+
});
|
|
134
|
+
});
|
|
135
|
+
return _this;
|
|
136
|
+
}
|
|
137
|
+
_inherits(TimePickerRoot2, _Component);
|
|
138
|
+
return _createClass(TimePickerRoot2, [{
|
|
139
|
+
key: "uncontrolledProps",
|
|
140
|
+
value: (
|
|
141
|
+
// default AM
|
|
142
|
+
(function uncontrolledProps() {
|
|
143
|
+
return {
|
|
144
|
+
value: null,
|
|
145
|
+
title: null
|
|
146
|
+
};
|
|
147
|
+
})
|
|
148
|
+
)
|
|
149
|
+
}, {
|
|
150
|
+
key: "componentDidMount",
|
|
151
|
+
value: function componentDidMount() {
|
|
152
|
+
var _document$querySelect;
|
|
153
|
+
var _this$asProps2 = this.asProps, id = _this$asProps2.id, ariaDescribedBy = _this$asProps2["aria-describedby"];
|
|
154
|
+
var selector = "[for=".concat(id, "]");
|
|
155
|
+
var titleElement = (_document$querySelect = document.querySelector(selector)) !== null && _document$querySelect !== void 0 ? _document$querySelect : document.querySelector("#".concat(ariaDescribedBy));
|
|
156
|
+
if (titleElement) {
|
|
157
|
+
this.handlers.title(titleElement.textContent);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
}, {
|
|
161
|
+
key: "value",
|
|
162
|
+
get: function get() {
|
|
163
|
+
var value = this.asProps.value;
|
|
164
|
+
return value === null || value === void 0 ? ":" : value;
|
|
165
|
+
}
|
|
166
|
+
}, {
|
|
167
|
+
key: "meridiem",
|
|
168
|
+
get: function get() {
|
|
169
|
+
var value = this.asProps.value;
|
|
170
|
+
var _value$split3 = value.split(":"), _value$split4 = _slicedToArray(_value$split3, 1), _value$split4$ = _value$split4[0], hours = _value$split4$ === void 0 ? "" : _value$split4$;
|
|
171
|
+
var nHours = intOrDefault(hours, Number.NaN);
|
|
172
|
+
if (!Number.isNaN(nHours)) {
|
|
173
|
+
this._lastMeridiem = meridiemByHours(nHours);
|
|
174
|
+
}
|
|
175
|
+
return this._lastMeridiem;
|
|
176
|
+
}
|
|
177
|
+
}, {
|
|
178
|
+
key: "valueToTime",
|
|
179
|
+
value: function valueToTime(value) {
|
|
180
|
+
var is12Hour = this.asProps.is12Hour;
|
|
181
|
+
var _value$split5 = value.split(":"), _value$split6 = _slicedToArray(_value$split5, 2), _value$split6$ = _value$split6[0], hours = _value$split6$ === void 0 ? "" : _value$split6$, _value$split6$2 = _value$split6[1], minutes = _value$split6$2 === void 0 ? "" : _value$split6$2;
|
|
182
|
+
if (is12Hour) hours = formatHoursTo12(hours);
|
|
183
|
+
hours = withLeadingZero(hours);
|
|
184
|
+
minutes = withLeadingZero(minutes);
|
|
185
|
+
return [hours, minutes];
|
|
186
|
+
}
|
|
187
|
+
}, {
|
|
188
|
+
key: "timeToValue",
|
|
189
|
+
value: function timeToValue(time, meridiem) {
|
|
190
|
+
var is12Hour = this.asProps.is12Hour;
|
|
191
|
+
var _time3 = _slicedToArray(time, 2), _time3$ = _time3[0], hours = _time3$ === void 0 ? "" : _time3$, _time3$2 = _time3[1], minutes = _time3$2 === void 0 ? "" : _time3$2;
|
|
192
|
+
hours = intOrDefault(hours, hours);
|
|
193
|
+
minutes = intOrDefault(minutes, minutes);
|
|
194
|
+
if (is12Hour) hours = formatHoursTo24(hours, meridiem);
|
|
195
|
+
return "".concat(hours, ":").concat(minutes);
|
|
196
|
+
}
|
|
197
|
+
}, {
|
|
198
|
+
key: "getSeparatorProps",
|
|
199
|
+
value: function getSeparatorProps() {
|
|
200
|
+
return {
|
|
201
|
+
disabled: this.asProps.disabled,
|
|
202
|
+
hoursInputRef: this.hoursInputRef
|
|
203
|
+
};
|
|
204
|
+
}
|
|
205
|
+
}, {
|
|
206
|
+
key: "getFormatProps",
|
|
207
|
+
value: function getFormatProps() {
|
|
208
|
+
var _this$asProps3 = this.asProps, size = _this$asProps3.size, disabled = _this$asProps3.disabled, disablePortal = _this$asProps3.disablePortal, getI18nText = _this$asProps3.getI18nText;
|
|
209
|
+
return {
|
|
210
|
+
size,
|
|
211
|
+
disabled,
|
|
212
|
+
disablePortal,
|
|
213
|
+
meridiem: this.meridiem,
|
|
214
|
+
onClick: this.handleMeridiemClick,
|
|
215
|
+
getI18nText
|
|
216
|
+
};
|
|
217
|
+
}
|
|
218
|
+
}, {
|
|
219
|
+
key: "render",
|
|
220
|
+
value: function render() {
|
|
221
|
+
var _ref = this.asProps, _ref3;
|
|
222
|
+
var STimePicker = Input;
|
|
223
|
+
var _this$asProps4 = this.asProps, styles = _this$asProps4.styles, Children = _this$asProps4.Children, value = _this$asProps4.value, is12Hour = _this$asProps4.is12Hour, getI18nText = _this$asProps4.getI18nText, title = _this$asProps4.title;
|
|
224
|
+
var _this$valueToTime = this.valueToTime(this.value), _this$valueToTime2 = _slicedToArray(_this$valueToTime, 2), hours = _this$valueToTime2[0], minutes = _this$valueToTime2[1];
|
|
225
|
+
var label = value ? "".concat(title, " ").concat(getI18nText("title", {
|
|
226
|
+
time: "".concat(hours, ":").concat(withLeadingZero(minutes)),
|
|
227
|
+
meridiem: is12Hour ? this.meridiem : ""
|
|
228
|
+
})) : "".concat(title, " ").concat(getI18nText("titleEmpty"));
|
|
229
|
+
return _ref3 = sstyled(styles), /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(STimePicker, _ref3.cn("STimePicker", _objectSpread({}, assignProps({
|
|
230
|
+
"role": "group",
|
|
231
|
+
"aria-label": label,
|
|
232
|
+
"__excludeProps": ["value", "title"]
|
|
233
|
+
}, _ref))), /* @__PURE__ */ React.createElement(Children, _ref3.cn("Children", {}))));
|
|
234
|
+
}
|
|
235
|
+
}]);
|
|
236
|
+
})(Component);
|
|
237
|
+
_defineProperty(TimePickerRoot, "displayName", "TimePicker");
|
|
238
|
+
_defineProperty(TimePickerRoot, "style", style);
|
|
239
|
+
_defineProperty(TimePickerRoot, "enhance", [i18nEnhance(localizedMessages)]);
|
|
240
|
+
_defineProperty(TimePickerRoot, "defaultProps", function(_ref5) {
|
|
241
|
+
var is12Hour = _ref5.is12Hour;
|
|
242
|
+
return {
|
|
243
|
+
defaultValue: "",
|
|
244
|
+
size: "m",
|
|
245
|
+
children: /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(TimePicker.Hours, null), /* @__PURE__ */ React.createElement(TimePicker.Separator, null), /* @__PURE__ */ React.createElement(TimePicker.Minutes, null), is12Hour && /* @__PURE__ */ React.createElement(TimePicker.Format, null)),
|
|
246
|
+
i18n: localizedMessages,
|
|
247
|
+
locale: "en",
|
|
248
|
+
defaultTitle: ""
|
|
249
|
+
};
|
|
250
|
+
});
|
|
251
|
+
var Separator = /* @__PURE__ */ (function(_Component2) {
|
|
252
|
+
function Separator2() {
|
|
253
|
+
var _this4;
|
|
254
|
+
_classCallCheck(this, Separator2);
|
|
255
|
+
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
256
|
+
args[_key2] = arguments[_key2];
|
|
257
|
+
}
|
|
258
|
+
_this4 = _callSuper(this, Separator2, [].concat(args));
|
|
259
|
+
_defineProperty(_this4, "handlerClick", function() {
|
|
260
|
+
if (_this4.asProps.hoursInputRef.current) {
|
|
261
|
+
var _this4$asProps$hoursI;
|
|
262
|
+
(_this4$asProps$hoursI = _this4.asProps.hoursInputRef.current) === null || _this4$asProps$hoursI === void 0 || _this4$asProps$hoursI.focus();
|
|
263
|
+
}
|
|
264
|
+
});
|
|
265
|
+
return _this4;
|
|
266
|
+
}
|
|
267
|
+
_inherits(Separator2, _Component2);
|
|
268
|
+
return _createClass(Separator2, [{
|
|
269
|
+
key: "render",
|
|
270
|
+
value: function render() {
|
|
271
|
+
var _ref2 = this.asProps, _ref4;
|
|
272
|
+
var STimePickerSeparator = Box;
|
|
273
|
+
var styles = this.asProps.styles;
|
|
274
|
+
return _ref4 = sstyled(styles), /* @__PURE__ */ React.createElement(STimePickerSeparator, _ref4.cn("STimePickerSeparator", _objectSpread({}, assignProps({
|
|
275
|
+
"onClick": this.handlerClick,
|
|
276
|
+
"aria-hidden": "true"
|
|
277
|
+
}, _ref2))));
|
|
278
|
+
}
|
|
279
|
+
}]);
|
|
280
|
+
})(Component);
|
|
281
|
+
_defineProperty(Separator, "defaultProps", {
|
|
282
|
+
children: ":"
|
|
283
|
+
});
|
|
284
|
+
var TimePicker = createComponent(TimePickerRoot, {
|
|
285
|
+
Hours,
|
|
286
|
+
Minutes,
|
|
287
|
+
Separator,
|
|
288
|
+
Format: TimePickerFormat
|
|
289
|
+
});
|
|
290
|
+
export {
|
|
291
|
+
TimePicker as default,
|
|
292
|
+
formatHoursTo12,
|
|
293
|
+
formatHoursTo24,
|
|
294
|
+
intOrDefault,
|
|
295
|
+
meridiemByHours,
|
|
296
|
+
withLeadingZero
|
|
297
|
+
};
|
package/lib/esm/index.mjs
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
|
-
import { default as default2 } from "./
|
|
2
|
-
import "./component/TimePicker/TimePicker.type.mjs";
|
|
1
|
+
import { default as default2, formatHoursTo12, formatHoursTo24, intOrDefault, meridiemByHours, withLeadingZero } from "./TimePicker.mjs";
|
|
3
2
|
export {
|
|
4
|
-
default2 as default
|
|
3
|
+
default2 as default,
|
|
4
|
+
formatHoursTo12,
|
|
5
|
+
formatHoursTo24,
|
|
6
|
+
intOrDefault,
|
|
7
|
+
meridiemByHours,
|
|
8
|
+
withLeadingZero
|
|
5
9
|
};
|