@onesy/ui-react 1.0.196 → 1.0.198
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/Button/Button.js +3 -2
- package/CardButton/CardButton.js +3 -2
- package/Checkbox/Checkbox.js +3 -2
- package/DatePicker/DatePicker.js +40 -40
- package/DateTimePicker/DateTimePicker.js +28 -28
- package/NavigationItem/NavigationItem.js +3 -2
- package/Radio/Radio.js +3 -2
- package/Tab/Tab.js +3 -2
- package/TimePicker/TimePicker.js +44 -44
- package/esm/Button/Button.js +3 -2
- package/esm/CardButton/CardButton.js +3 -2
- package/esm/Checkbox/Checkbox.js +3 -2
- package/esm/DatePicker/DatePicker.js +40 -40
- package/esm/DateTimePicker/DateTimePicker.js +28 -28
- package/esm/NavigationItem/NavigationItem.js +3 -2
- package/esm/Radio/Radio.js +3 -2
- package/esm/Tab/Tab.js +3 -2
- package/esm/TimePicker/TimePicker.js +44 -44
- package/esm/index.js +1 -1
- package/index.js +1 -1
- package/package.json +1 -1
|
@@ -69,14 +69,14 @@ const DateTimePicker = props__ => {
|
|
|
69
69
|
ref,
|
|
70
70
|
tonal,
|
|
71
71
|
color = 'primary',
|
|
72
|
-
version:
|
|
73
|
-
value:
|
|
72
|
+
version: versionProps = 'auto',
|
|
73
|
+
value: valueProps,
|
|
74
74
|
valueDefault,
|
|
75
75
|
onChange,
|
|
76
76
|
label,
|
|
77
77
|
range,
|
|
78
78
|
now,
|
|
79
|
-
static:
|
|
79
|
+
static: staticProps,
|
|
80
80
|
min,
|
|
81
81
|
max,
|
|
82
82
|
validate,
|
|
@@ -85,7 +85,7 @@ const DateTimePicker = props__ => {
|
|
|
85
85
|
headingTextTimeRange,
|
|
86
86
|
headingTextDate,
|
|
87
87
|
headingTextDateRange,
|
|
88
|
-
useHelperText:
|
|
88
|
+
useHelperText: useHelperTextProps,
|
|
89
89
|
format = '12',
|
|
90
90
|
hour = true,
|
|
91
91
|
minute = true,
|
|
@@ -93,16 +93,16 @@ const DateTimePicker = props__ => {
|
|
|
93
93
|
today,
|
|
94
94
|
clear = true,
|
|
95
95
|
size,
|
|
96
|
-
placeholder:
|
|
96
|
+
placeholder: placeholderProps,
|
|
97
97
|
fullWidth,
|
|
98
98
|
readOnly,
|
|
99
99
|
disabled,
|
|
100
|
-
valid:
|
|
101
|
-
onClose:
|
|
102
|
-
onToday:
|
|
103
|
-
onClear:
|
|
104
|
-
onCancel:
|
|
105
|
-
onOk:
|
|
100
|
+
valid: validProps,
|
|
101
|
+
onClose: onCloseProps,
|
|
102
|
+
onToday: onTodayProps,
|
|
103
|
+
onClear: onClearProps,
|
|
104
|
+
onCancel: onCancelProps,
|
|
105
|
+
onOk: onOkProps,
|
|
106
106
|
Icon: Icon_ = IconMaterialDateRange,
|
|
107
107
|
IconDate = IconMaterialCalendarToday,
|
|
108
108
|
IconTime = IconMaterialSchedule,
|
|
@@ -116,7 +116,7 @@ const DateTimePicker = props__ => {
|
|
|
116
116
|
ModeDesktopProps,
|
|
117
117
|
ModeMobileProps,
|
|
118
118
|
ButtonProps,
|
|
119
|
-
PickerProps:
|
|
119
|
+
PickerProps: PickerPropsProps,
|
|
120
120
|
MiddleProps,
|
|
121
121
|
MainProps,
|
|
122
122
|
IconProps,
|
|
@@ -132,19 +132,19 @@ const DateTimePicker = props__ => {
|
|
|
132
132
|
};
|
|
133
133
|
const keys = React.useMemo(() => {
|
|
134
134
|
const result = [];
|
|
135
|
-
const items = [
|
|
135
|
+
const items = [useHelperTextProps];
|
|
136
136
|
items.forEach(item => {
|
|
137
137
|
if (is('object', item)) Object.keys(item).filter(key => theme.breakpoints.media[key]).forEach(key_0 => result.push(key_0));
|
|
138
138
|
});
|
|
139
139
|
return unique(result);
|
|
140
|
-
}, [
|
|
140
|
+
}, [useHelperTextProps]);
|
|
141
141
|
const breakpoints = {};
|
|
142
142
|
keys.forEach(key_1 => {
|
|
143
143
|
breakpoints[key_1] = useMediaQuery(theme.breakpoints.media[key_1], {
|
|
144
144
|
element: refs.root.current
|
|
145
145
|
});
|
|
146
146
|
});
|
|
147
|
-
const useHelperText = valueBreakpoints(
|
|
147
|
+
const useHelperText = valueBreakpoints(useHelperTextProps, undefined, breakpoints, theme);
|
|
148
148
|
const touch = useMediaQuery('(pointer: coarse)', {
|
|
149
149
|
element: refs.root.current
|
|
150
150
|
});
|
|
@@ -154,7 +154,7 @@ const DateTimePicker = props__ => {
|
|
|
154
154
|
return sorted;
|
|
155
155
|
};
|
|
156
156
|
const [value, setValue] = React.useState(() => {
|
|
157
|
-
const valueResult = (valueDefault !== undefined ? valueDefault :
|
|
157
|
+
const valueResult = (valueDefault !== undefined ? valueDefault : valueProps) || now && (range ? [new OnesyDate(), new OnesyDate()] : [new OnesyDate()]);
|
|
158
158
|
return onResolveValue(valueResult);
|
|
159
159
|
});
|
|
160
160
|
const [calendar, setCalendar] = React.useState(value[0]);
|
|
@@ -186,7 +186,7 @@ const DateTimePicker = props__ => {
|
|
|
186
186
|
return result_0;
|
|
187
187
|
};
|
|
188
188
|
const [input, setInput] = React.useState(valueToInput());
|
|
189
|
-
let version =
|
|
189
|
+
let version = versionProps;
|
|
190
190
|
if (version === 'auto') {
|
|
191
191
|
if (touch) version = 'mobile';else version = 'desktop';
|
|
192
192
|
}
|
|
@@ -210,8 +210,8 @@ const DateTimePicker = props__ => {
|
|
|
210
210
|
|
|
211
211
|
// Value
|
|
212
212
|
React.useEffect(() => {
|
|
213
|
-
if (
|
|
214
|
-
}, [
|
|
213
|
+
if (valueProps !== undefined && valueProps !== value) onUpdateValue(valueProps);
|
|
214
|
+
}, [valueProps]);
|
|
215
215
|
const onUpdate = (valueNew_3, triggerOnChange = true) => {
|
|
216
216
|
// Inner update
|
|
217
217
|
if (!props.hasOwnProperty('value') || !triggerOnChange) setValue(valueNew_3);
|
|
@@ -318,7 +318,7 @@ const DateTimePicker = props__ => {
|
|
|
318
318
|
// Update input
|
|
319
319
|
setInput(valueToInput(valueNew_10));
|
|
320
320
|
onClose(event);
|
|
321
|
-
if (is('function',
|
|
321
|
+
if (is('function', onTodayProps)) onTodayProps(event);
|
|
322
322
|
};
|
|
323
323
|
const onClear = event_0 => {
|
|
324
324
|
const valueNew_11 = [];
|
|
@@ -329,7 +329,7 @@ const DateTimePicker = props__ => {
|
|
|
329
329
|
// Update input
|
|
330
330
|
setInput(valueToInput(valueNew_11));
|
|
331
331
|
onClose(event_0);
|
|
332
|
-
if (is('function',
|
|
332
|
+
if (is('function', onClearProps)) onClearProps(event_0);
|
|
333
333
|
};
|
|
334
334
|
const onOk = event_1 => {
|
|
335
335
|
// Error
|
|
@@ -341,22 +341,22 @@ const DateTimePicker = props__ => {
|
|
|
341
341
|
// Update input
|
|
342
342
|
setInput(valueToInput(value));
|
|
343
343
|
onClose(event_1);
|
|
344
|
-
if (is('function',
|
|
344
|
+
if (is('function', onOkProps)) onOkProps(event_1);
|
|
345
345
|
};
|
|
346
346
|
const onCancel = event_2 => {
|
|
347
347
|
onReset();
|
|
348
348
|
onClose(event_2);
|
|
349
|
-
if (is('function',
|
|
349
|
+
if (is('function', onCancelProps)) onCancelProps(event_2);
|
|
350
350
|
};
|
|
351
351
|
const onOpen = () => {
|
|
352
352
|
setOpen(previous_0 => !previous_0);
|
|
353
353
|
};
|
|
354
354
|
const onClose = event_3 => {
|
|
355
355
|
setOpen(false);
|
|
356
|
-
if (is('function',
|
|
356
|
+
if (is('function', onCloseProps)) onCloseProps(event_3);
|
|
357
357
|
};
|
|
358
358
|
const valid = (...args) => {
|
|
359
|
-
if (is('function',
|
|
359
|
+
if (is('function', validProps)) return validProps(...args);
|
|
360
360
|
const onesyDate_0 = args[0];
|
|
361
361
|
if (min || max || validate) {
|
|
362
362
|
let response = true;
|
|
@@ -496,7 +496,7 @@ const DateTimePicker = props__ => {
|
|
|
496
496
|
}
|
|
497
497
|
placeholder += `${SEPARATOR}${placeholder}`;
|
|
498
498
|
}
|
|
499
|
-
placeholder =
|
|
499
|
+
placeholder = placeholderProps || placeholder;
|
|
500
500
|
const buttonProps = _objectSpread({
|
|
501
501
|
tonal,
|
|
502
502
|
color,
|
|
@@ -571,7 +571,7 @@ const DateTimePicker = props__ => {
|
|
|
571
571
|
heading: false,
|
|
572
572
|
readOnly,
|
|
573
573
|
disabled
|
|
574
|
-
},
|
|
574
|
+
}, PickerPropsProps), tab === 'date' && DatePickerProps), tab === 'time' && TimePickerProps);
|
|
575
575
|
const element = /*#__PURE__*/_jsxs(Surface, {
|
|
576
576
|
gap: 0,
|
|
577
577
|
direction: "column",
|
|
@@ -614,7 +614,7 @@ const DateTimePicker = props__ => {
|
|
|
614
614
|
if (version === 'mobile') {
|
|
615
615
|
if (!(readOnly || disabled)) moreProps.onClick = onOpen;
|
|
616
616
|
}
|
|
617
|
-
if (
|
|
617
|
+
if (staticProps) return element;
|
|
618
618
|
return /*#__PURE__*/_jsxs(Line, _objectSpread(_objectSpread({
|
|
619
619
|
gap: 0,
|
|
620
620
|
direction: "column",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
2
2
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
|
-
const _excluded = ["ref", "tonal", "color", "version", "value", "name", "nameTooltip", "vertical", "icon", "iconSelected", "selected", "disabled", "IconWrapperComponent", "onFocus", "onBlur", "onKeyDown", "onMouseDown", "onMouseEnter", "onMouseLeave", "onTouchStart", "TooltipProps", "LabelProps", "IconWrapperProps", "className", "style", "children"];
|
|
3
|
+
const _excluded = ["ref", "tonal", "color", "version", "value", "name", "nameTooltip", "vertical", "icon", "iconSelected", "selected", "readOnly", "disabled", "IconWrapperComponent", "onFocus", "onBlur", "onKeyDown", "onMouseDown", "onMouseEnter", "onMouseLeave", "onTouchStart", "TooltipProps", "LabelProps", "IconWrapperProps", "className", "style", "children"];
|
|
4
4
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
5
5
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
6
6
|
import React from 'react';
|
|
@@ -121,6 +121,7 @@ const NavigationItem = props_ => {
|
|
|
121
121
|
icon,
|
|
122
122
|
iconSelected,
|
|
123
123
|
selected,
|
|
124
|
+
readOnly,
|
|
124
125
|
disabled,
|
|
125
126
|
IconWrapperComponent = 'span',
|
|
126
127
|
onFocus: onFocus_,
|
|
@@ -229,7 +230,7 @@ const NavigationItem = props_ => {
|
|
|
229
230
|
focus: false
|
|
230
231
|
}, TooltipProps), {}, {
|
|
231
232
|
children: /*#__PURE__*/_jsx("span", _objectSpread(_objectSpread({
|
|
232
|
-
tabIndex: !disabled ? 0 : undefined,
|
|
233
|
+
tabIndex: !(readOnly || disabled) ? 0 : undefined,
|
|
233
234
|
onFocus: onFocus,
|
|
234
235
|
onBlur: onBlur,
|
|
235
236
|
onKeyDown: onKeyDown,
|
package/esm/Radio/Radio.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
3
|
const _excluded = ["size", "Component", "className", "style", "children"],
|
|
4
|
-
_excluded2 = ["tonal", "color", "version", "size", "render", "inputRef", "colorUnchecked", "valueDefault", "checkedDefault", "value", "checked", "onChange", "disabled", "Component", "className", "children"];
|
|
4
|
+
_excluded2 = ["tonal", "color", "version", "size", "render", "inputRef", "colorUnchecked", "valueDefault", "checkedDefault", "value", "checked", "onChange", "readOnly", "disabled", "Component", "className", "children"];
|
|
5
5
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
6
6
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
7
7
|
import { c as _c } from "react/compiler-runtime";
|
|
@@ -173,6 +173,7 @@ const Radio = props_ => {
|
|
|
173
173
|
value: value_,
|
|
174
174
|
checked: checked_,
|
|
175
175
|
onChange,
|
|
176
|
+
readOnly,
|
|
176
177
|
disabled,
|
|
177
178
|
Component = 'span',
|
|
178
179
|
className,
|
|
@@ -227,7 +228,7 @@ const Radio = props_ => {
|
|
|
227
228
|
let colorValue = color;
|
|
228
229
|
if (!value) colorValue = colorUnchecked;
|
|
229
230
|
return /*#__PURE__*/_jsx(IconButton, _objectSpread(_objectSpread({
|
|
230
|
-
tabIndex: !disabled ? 0 : -1,
|
|
231
|
+
tabIndex: !(readOnly || disabled) ? 0 : -1,
|
|
231
232
|
tonal: tonal,
|
|
232
233
|
color: colorValue,
|
|
233
234
|
version: version,
|
package/esm/Tab/Tab.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
2
2
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
|
-
const _excluded = ["tonal", "color", "version", "size", "value", "onChange", "active", "index", "name", "label", "icon", "iconPosition", "activateOnFocus", "tooltip", "disabled", "onBlur", "onFocus", "LineProps", "TooltipProps", "Component", "className", "children"];
|
|
3
|
+
const _excluded = ["tonal", "color", "version", "size", "value", "onChange", "active", "index", "name", "label", "icon", "iconPosition", "activateOnFocus", "tooltip", "readOnly", "disabled", "onBlur", "onFocus", "LineProps", "TooltipProps", "Component", "className", "children"];
|
|
4
4
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
5
5
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
6
6
|
import { c as _c } from "react/compiler-runtime";
|
|
@@ -97,6 +97,7 @@ const Tab = props_ => {
|
|
|
97
97
|
iconPosition: t4,
|
|
98
98
|
activateOnFocus,
|
|
99
99
|
tooltip,
|
|
100
|
+
readOnly,
|
|
100
101
|
disabled,
|
|
101
102
|
onBlur: onBlur_,
|
|
102
103
|
onFocus: onFocus_,
|
|
@@ -154,7 +155,7 @@ const Tab = props_ => {
|
|
|
154
155
|
const wrapperProps = hasTooltip ? _objectSpread({
|
|
155
156
|
name: tooltip
|
|
156
157
|
}, TooltipProps) : undefined;
|
|
157
|
-
const t7 = !disabled ? 0 : -1;
|
|
158
|
+
const t7 = !(readOnly || disabled) ? 0 : -1;
|
|
158
159
|
const t8 = "tab";
|
|
159
160
|
const t9 = classNames([staticClassName("Tab", theme) && ["onesy-Tab-root", `onesy-Tab-version-${version}`, `onesy-Tab-size-${size}`, active && "onesy-Tab-active", disabled && "onesy-Tab-disabled"], className, classes.root, classes[`size_${size}`], active && classes.active, disabled && classes.disabled]);
|
|
160
161
|
let t10;
|
|
@@ -230,11 +230,11 @@ const TimePicker = props__ => {
|
|
|
230
230
|
ref,
|
|
231
231
|
tonal,
|
|
232
232
|
color = 'primary',
|
|
233
|
-
version:
|
|
234
|
-
value:
|
|
233
|
+
version: versionProps = 'auto',
|
|
234
|
+
value: valueProps,
|
|
235
235
|
valueDefault,
|
|
236
236
|
onChange,
|
|
237
|
-
selecting:
|
|
237
|
+
selecting: selectingProps,
|
|
238
238
|
selectingDefault,
|
|
239
239
|
onChangeSelecting,
|
|
240
240
|
size = 'regular',
|
|
@@ -244,37 +244,37 @@ const TimePicker = props__ => {
|
|
|
244
244
|
min,
|
|
245
245
|
max,
|
|
246
246
|
validate,
|
|
247
|
-
autoNext:
|
|
248
|
-
autoCloseOnLast:
|
|
247
|
+
autoNext: autoNextProps,
|
|
248
|
+
autoCloseOnLast: autoCloseOnLastProps,
|
|
249
249
|
openMobile = 'select',
|
|
250
250
|
openDesktop = 'select',
|
|
251
251
|
selectModalSubHeadingText = l('Select time'),
|
|
252
252
|
selectModalSubHeadingTextRange = `${l('Select from')}${SEPARATOR}${l('to time')}`,
|
|
253
253
|
inputModalSubHeadingText = l('Enter time'),
|
|
254
254
|
inputModalSubHeadingTextRange = `${l('Enter from')}${SEPARATOR}${l('to time')}`,
|
|
255
|
-
orientation:
|
|
255
|
+
orientation: orientationProps,
|
|
256
256
|
format = '12',
|
|
257
257
|
hour = true,
|
|
258
258
|
minute = true,
|
|
259
259
|
second = false,
|
|
260
|
-
switch:
|
|
261
|
-
static:
|
|
260
|
+
switch: switchProps,
|
|
261
|
+
static: staticProps,
|
|
262
262
|
today,
|
|
263
263
|
clear = true,
|
|
264
|
-
placeholder:
|
|
265
|
-
heading:
|
|
266
|
-
actions:
|
|
264
|
+
placeholder: placeholderProps,
|
|
265
|
+
heading: headingProps = true,
|
|
266
|
+
actions: actionsProps = true,
|
|
267
267
|
fullWidth,
|
|
268
268
|
readOnly,
|
|
269
269
|
disabled,
|
|
270
|
-
valid:
|
|
271
|
-
onClick:
|
|
272
|
-
onClose:
|
|
273
|
-
onCancel:
|
|
274
|
-
onNow:
|
|
275
|
-
onToday:
|
|
276
|
-
onClear:
|
|
277
|
-
onOk:
|
|
270
|
+
valid: validProps,
|
|
271
|
+
onClick: onClickProps,
|
|
272
|
+
onClose: onCloseProps,
|
|
273
|
+
onCancel: onCancelProps,
|
|
274
|
+
onNow: onNowProps,
|
|
275
|
+
onToday: onTodayProps,
|
|
276
|
+
onClear: onClearProps,
|
|
277
|
+
onOk: onOkProps,
|
|
278
278
|
renderValue,
|
|
279
279
|
Icon: Icon_ = IconMaterialSchedule,
|
|
280
280
|
IconEnter = IconMaterialKeyboardAlt,
|
|
@@ -308,22 +308,22 @@ const TimePicker = props__ => {
|
|
|
308
308
|
};
|
|
309
309
|
const keys = React.useMemo(() => {
|
|
310
310
|
const result = [];
|
|
311
|
-
const items = [
|
|
311
|
+
const items = [switchProps, orientationProps, autoNextProps, autoCloseOnLastProps];
|
|
312
312
|
items.forEach(item => {
|
|
313
313
|
if (is('object', item)) Object.keys(item).filter(key => theme.breakpoints.media[key]).forEach(key_0 => result.push(key_0));
|
|
314
314
|
});
|
|
315
315
|
return unique(result);
|
|
316
|
-
}, [
|
|
316
|
+
}, [switchProps, orientationProps, autoNextProps, autoCloseOnLastProps]);
|
|
317
317
|
const breakpoints = {};
|
|
318
318
|
keys.forEach(key_1 => {
|
|
319
319
|
breakpoints[key_1] = useMediaQuery(theme.breakpoints.media[key_1], {
|
|
320
320
|
element: refs.root.current
|
|
321
321
|
});
|
|
322
322
|
});
|
|
323
|
-
const switch_ = valueBreakpoints(
|
|
324
|
-
const orientation = valueBreakpoints(
|
|
325
|
-
const autoNext = valueBreakpoints(
|
|
326
|
-
const autoCloseOnLast = valueBreakpoints(
|
|
323
|
+
const switch_ = valueBreakpoints(switchProps, true, breakpoints, theme);
|
|
324
|
+
const orientation = valueBreakpoints(orientationProps, 'vertical', breakpoints, theme);
|
|
325
|
+
const autoNext = valueBreakpoints(autoNextProps, undefined, breakpoints, theme);
|
|
326
|
+
const autoCloseOnLast = valueBreakpoints(autoCloseOnLastProps, undefined, breakpoints, theme);
|
|
327
327
|
const touch = useMediaQuery('(pointer: coarse)', {
|
|
328
328
|
element: refs.root.current
|
|
329
329
|
});
|
|
@@ -333,11 +333,11 @@ const TimePicker = props__ => {
|
|
|
333
333
|
return sorted;
|
|
334
334
|
};
|
|
335
335
|
const [value, setValue] = React.useState(() => {
|
|
336
|
-
const valueResult = (valueDefault !== undefined ? valueDefault :
|
|
336
|
+
const valueResult = (valueDefault !== undefined ? valueDefault : valueProps) || now && (range ? [new OnesyDate(), new OnesyDate()] : [new OnesyDate()]);
|
|
337
337
|
return onResolveValue(valueResult);
|
|
338
338
|
});
|
|
339
339
|
const [selecting, setSelecting] = React.useState(() => {
|
|
340
|
-
const valueResult_0 = (selectingDefault !== undefined ? selectingDefault :
|
|
340
|
+
const valueResult_0 = (selectingDefault !== undefined ? selectingDefault : selectingProps) || ['hour', 'hour'];
|
|
341
341
|
return (is('array', valueResult_0) ? valueResult_0 : [valueResult_0]).filter(Boolean);
|
|
342
342
|
});
|
|
343
343
|
const [open, setOpen] = React.useState(false);
|
|
@@ -367,7 +367,7 @@ const TimePicker = props__ => {
|
|
|
367
367
|
return result_0;
|
|
368
368
|
};
|
|
369
369
|
const [input, setInput] = React.useState(valueToInput());
|
|
370
|
-
let version =
|
|
370
|
+
let version = versionProps;
|
|
371
371
|
if (version === 'auto') {
|
|
372
372
|
if (touch) version = 'mobile';else version = 'desktop';
|
|
373
373
|
}
|
|
@@ -396,8 +396,8 @@ const TimePicker = props__ => {
|
|
|
396
396
|
|
|
397
397
|
// Value
|
|
398
398
|
React.useEffect(() => {
|
|
399
|
-
if (
|
|
400
|
-
}, [
|
|
399
|
+
if (valueProps !== undefined && valueProps !== value) onUpdateValue(valueProps);
|
|
400
|
+
}, [valueProps]);
|
|
401
401
|
const onUpdate = (valueNew__0, triggerOnChange = true) => {
|
|
402
402
|
const valueNew_3 = resolve(valueNew__0);
|
|
403
403
|
|
|
@@ -414,7 +414,7 @@ const TimePicker = props__ => {
|
|
|
414
414
|
if (is('function', onChangeSelecting)) onChangeSelecting(valueNew_4);
|
|
415
415
|
};
|
|
416
416
|
const valid = (...args) => {
|
|
417
|
-
if (is('function',
|
|
417
|
+
if (is('function', validProps)) return validProps(...args);
|
|
418
418
|
const onesyDate = args[0];
|
|
419
419
|
if (min || max || validate) {
|
|
420
420
|
let response = true;
|
|
@@ -455,7 +455,7 @@ const TimePicker = props__ => {
|
|
|
455
455
|
if (is('string', valueTime_0) && valueTime_0.startsWith('0')) valueTime_0 = valueTime_0.slice(1);
|
|
456
456
|
valueTime_0 = +valueTime_0;
|
|
457
457
|
value[index_1] = set(valueTime_0, unit || selecting[index_1], value[index_1]);
|
|
458
|
-
(!
|
|
458
|
+
(!actionsProps ? onUpdate : setValue)(resolve(value));
|
|
459
459
|
};
|
|
460
460
|
const resolve = (valueNew_7 = refs.value.current, dayTimeNew = refs.dayTime.current) => {
|
|
461
461
|
const values_0 = onResolveValue(valueNew_7).map((item_4, index_2) => {
|
|
@@ -477,7 +477,7 @@ const TimePicker = props__ => {
|
|
|
477
477
|
dayTimeNew_0[index_3] = valueNew_8;
|
|
478
478
|
refs.dayTime.current = dayTimeNew_0;
|
|
479
479
|
setDayTime(dayTimeNew_0);
|
|
480
|
-
(!
|
|
480
|
+
(!actionsProps ? onUpdate : setValue)(resolve(refs.value.current));
|
|
481
481
|
};
|
|
482
482
|
const inputToValue = (valueNew__3 = input) => {
|
|
483
483
|
let valueNew_9 = valueNew__3;
|
|
@@ -511,7 +511,7 @@ const TimePicker = props__ => {
|
|
|
511
511
|
const valueNew_11 = [...value];
|
|
512
512
|
if (valueNew__5 !== value[index_4]) {
|
|
513
513
|
valueNew_11[index_4] = valueNew__5;
|
|
514
|
-
(!
|
|
514
|
+
(!actionsProps ? onUpdate : setValue)(resolve(valueNew_11));
|
|
515
515
|
|
|
516
516
|
// Error
|
|
517
517
|
errorCheck(valueNew_11);
|
|
@@ -542,7 +542,7 @@ const TimePicker = props__ => {
|
|
|
542
542
|
};
|
|
543
543
|
const onClose = event => {
|
|
544
544
|
setOpen(false);
|
|
545
|
-
if (is('function',
|
|
545
|
+
if (is('function', onCloseProps)) onCloseProps(event);
|
|
546
546
|
};
|
|
547
547
|
const onReset = () => {
|
|
548
548
|
const valueNew_14 = inputToValue();
|
|
@@ -566,7 +566,7 @@ const TimePicker = props__ => {
|
|
|
566
566
|
// Update dayTime
|
|
567
567
|
setDayTime(valueNew_15.map(item_8 => formatDate(item_8, 'a')));
|
|
568
568
|
onClose(event_0);
|
|
569
|
-
if (is('function',
|
|
569
|
+
if (is('function', onTodayProps)) onTodayProps(event_0);
|
|
570
570
|
};
|
|
571
571
|
const onClear = event_1 => {
|
|
572
572
|
const valueNew_16 = [];
|
|
@@ -580,7 +580,7 @@ const TimePicker = props__ => {
|
|
|
580
580
|
// Update dayTime
|
|
581
581
|
setDayTime(valueNew_16.map(item_9 => formatDate(item_9, 'a')));
|
|
582
582
|
onClose(event_1);
|
|
583
|
-
if (is('function',
|
|
583
|
+
if (is('function', onClearProps)) onClearProps(event_1);
|
|
584
584
|
};
|
|
585
585
|
const onOk = event_2 => {
|
|
586
586
|
// Error
|
|
@@ -595,12 +595,12 @@ const TimePicker = props__ => {
|
|
|
595
595
|
// Update dayTime
|
|
596
596
|
setDayTime(refs.value.current.map(item_10 => formatDate(item_10, 'a')));
|
|
597
597
|
onClose(event_2);
|
|
598
|
-
if (is('function',
|
|
598
|
+
if (is('function', onOkProps)) onOkProps(event_2);
|
|
599
599
|
};
|
|
600
600
|
const onCancel = event_3 => {
|
|
601
601
|
onReset();
|
|
602
602
|
onClose(event_3);
|
|
603
|
-
if (is('function',
|
|
603
|
+
if (is('function', onCancelProps)) onCancelProps(event_3);
|
|
604
604
|
};
|
|
605
605
|
const mask = [];
|
|
606
606
|
let placeholder = '';
|
|
@@ -653,7 +653,7 @@ const TimePicker = props__ => {
|
|
|
653
653
|
mask.push(' ', SEPARATOR_SYMBOL, ' ', ...mask);
|
|
654
654
|
placeholder += `${SEPARATOR}${placeholder}`;
|
|
655
655
|
}
|
|
656
|
-
placeholder =
|
|
656
|
+
placeholder = placeholderProps || placeholder;
|
|
657
657
|
const buttonProps = _objectSpread({
|
|
658
658
|
color: 'inherit',
|
|
659
659
|
version: 'text',
|
|
@@ -907,7 +907,7 @@ const TimePicker = props__ => {
|
|
|
907
907
|
Component: Line
|
|
908
908
|
}, MainProps), {}, {
|
|
909
909
|
className: classNames([staticClassName('TimePicker', theme) && ['onesy-TimePicker-main'], MainProps?.className, classes.main, classes[`main_size_${size}`]]),
|
|
910
|
-
children: [
|
|
910
|
+
children: [headingProps && /*#__PURE__*/_jsx(Type, {
|
|
911
911
|
version: size === 'large' ? 'l1' : size === 'regular' ? 'l2' : 'l3',
|
|
912
912
|
className: classNames([staticClassName('TimePicker', theme) && ['onesy-TimePicker-heading'], classes.heading, classes[`heading_size_${size}`]]),
|
|
913
913
|
children: heading
|
|
@@ -918,7 +918,7 @@ const TimePicker = props__ => {
|
|
|
918
918
|
valueDefault: tab,
|
|
919
919
|
onChange: setTab
|
|
920
920
|
}, TabsProps), {}, {
|
|
921
|
-
className: classNames([staticClassName('TimePicker', theme) && ['onesy-TimePicker-tabs'], TabsProps?.className, classes.tabs,
|
|
921
|
+
className: classNames([staticClassName('TimePicker', theme) && ['onesy-TimePicker-tabs'], TabsProps?.className, classes.tabs, headingProps && classes.tabs_padding]),
|
|
922
922
|
children: [/*#__PURE__*/_jsx(Tab, _objectSpread({
|
|
923
923
|
value: 0,
|
|
924
924
|
name: l('From')
|
|
@@ -930,12 +930,12 @@ const TimePicker = props__ => {
|
|
|
930
930
|
gap: 0,
|
|
931
931
|
className: classNames([staticClassName('TimePicker', theme) && ['onesy-TimePicker-middle'], MiddleProps?.className, classes.middle, classes[`middle_size_${size}`]]),
|
|
932
932
|
children: elementValues[tab]
|
|
933
|
-
}),
|
|
933
|
+
}), actionsProps && actions]
|
|
934
934
|
}));
|
|
935
935
|
if (version === 'mobile') {
|
|
936
936
|
if (!(readOnly || disabled)) moreProps.onClick = onOpen;
|
|
937
937
|
}
|
|
938
|
-
if (
|
|
938
|
+
if (staticProps) return element;
|
|
939
939
|
return /*#__PURE__*/_jsxs(Line, _objectSpread(_objectSpread({
|
|
940
940
|
gap: 0,
|
|
941
941
|
direction: "column",
|
package/esm/index.js
CHANGED
package/index.js
CHANGED