@festo-ui/react 6.0.0-dev.215 → 6.0.0-dev.217
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/lib/components/buttons/button/Button.d.ts +3 -5
- package/lib/components/buttons/button/Button.js +7 -4
- package/lib/components/link-button/LinkButton.d.ts +4 -5
- package/lib/components/link-button/LinkButton.js +18 -6
- package/lib/forms/time-picker/TimePicker.js +2 -6
- package/lib/forms/time-picker/time-picker-dropdown/TimePickerDropdown.d.ts +2 -1
- package/lib/forms/time-picker/time-picker-dropdown/TimePickerDropdown.js +61 -75
- package/lib/forms/time-picker/time-picker-dropdown/TimePickerInput.d.ts +10 -0
- package/lib/forms/time-picker/time-picker-dropdown/TimePickerInput.js +23 -0
- package/node/lib/components/buttons/button/Button.js +7 -4
- package/node/lib/components/link-button/LinkButton.js +18 -6
- package/node/lib/forms/time-picker/TimePicker.js +1 -5
- package/node/lib/forms/time-picker/time-picker-dropdown/TimePickerDropdown.js +61 -75
- package/node/lib/forms/time-picker/time-picker-dropdown/TimePickerInput.js +29 -0
- package/package.json +1 -1
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
interface ButtonProps extends ClassNamePropsWithChildren {
|
|
1
|
+
import { ComponentPropsWithoutRef } from 'react';
|
|
2
|
+
interface ButtonProps extends ComponentPropsWithoutRef<'button'> {
|
|
4
3
|
icon?: string;
|
|
5
4
|
disabled?: boolean;
|
|
6
5
|
primary?: boolean;
|
|
7
6
|
iconOnly?: boolean;
|
|
8
7
|
large?: boolean;
|
|
9
|
-
onClick: (event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;
|
|
10
8
|
}
|
|
11
|
-
declare
|
|
9
|
+
declare const Button: (props: ButtonProps & import("react").RefAttributes<HTMLButtonElement>) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | null;
|
|
12
10
|
export default Button;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import classNames from 'classnames';
|
|
2
|
-
import
|
|
2
|
+
import { forwardRef } from 'react';
|
|
3
3
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
4
4
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
5
|
-
|
|
5
|
+
const Button = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
6
6
|
let {
|
|
7
7
|
icon,
|
|
8
8
|
disabled = false,
|
|
@@ -11,7 +11,8 @@ function Button(_ref) {
|
|
|
11
11
|
onClick,
|
|
12
12
|
primary = false,
|
|
13
13
|
className,
|
|
14
|
-
children
|
|
14
|
+
children,
|
|
15
|
+
...props
|
|
15
16
|
} = _ref;
|
|
16
17
|
const classes = classNames('fwe-btn', 'fr-button', {
|
|
17
18
|
'fwe-btn-icon': iconOnly
|
|
@@ -27,11 +28,13 @@ function Button(_ref) {
|
|
|
27
28
|
onClick: onClick,
|
|
28
29
|
className: classes,
|
|
29
30
|
disabled: disabled,
|
|
31
|
+
ref: ref,
|
|
32
|
+
...props,
|
|
30
33
|
children: [icon && /*#__PURE__*/_jsx("i", {
|
|
31
34
|
className: `fwe-icon fwe-icon-${icon}`
|
|
32
35
|
}), !iconOnly && /*#__PURE__*/_jsx("div", {
|
|
33
36
|
children: children
|
|
34
37
|
})]
|
|
35
38
|
});
|
|
36
|
-
}
|
|
39
|
+
});
|
|
37
40
|
export default Button;
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
interface LinkButtonProps extends ClassNamePropsWithChildren {
|
|
1
|
+
import { ComponentPropsWithoutRef } from 'react';
|
|
2
|
+
interface LinkButtonProps extends ComponentPropsWithoutRef<'button'> {
|
|
4
3
|
disabled?: boolean;
|
|
5
|
-
icon?:
|
|
4
|
+
icon?: React.ReactNode;
|
|
6
5
|
onClick?: (event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;
|
|
7
6
|
iconOnly?: boolean;
|
|
8
7
|
}
|
|
9
|
-
declare
|
|
8
|
+
declare const LinkButton: (props: LinkButtonProps & import("react").RefAttributes<HTMLButtonElement>) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | null;
|
|
10
9
|
export default LinkButton;
|
|
@@ -1,26 +1,38 @@
|
|
|
1
1
|
import classNames from 'classnames';
|
|
2
|
+
import { forwardRef } from 'react';
|
|
2
3
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
4
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
4
|
-
|
|
5
|
+
const LinkButton = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
5
6
|
let {
|
|
6
7
|
icon,
|
|
7
8
|
onClick,
|
|
8
9
|
disabled = false,
|
|
9
10
|
children,
|
|
10
11
|
iconOnly = false,
|
|
11
|
-
className
|
|
12
|
+
className,
|
|
13
|
+
...props
|
|
12
14
|
} = _ref;
|
|
13
15
|
const classes = classNames('fwe-btn', 'fwe-btn-link', {
|
|
14
16
|
'fwe-disabled': disabled
|
|
15
17
|
}, className);
|
|
18
|
+
let innerIcon;
|
|
19
|
+
if (icon) {
|
|
20
|
+
if (typeof icon === 'string') {
|
|
21
|
+
innerIcon = /*#__PURE__*/_jsx("i", {
|
|
22
|
+
className: `fwe-icon fwe-icon-${icon}`
|
|
23
|
+
});
|
|
24
|
+
} else {
|
|
25
|
+
innerIcon = icon;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
16
28
|
return /*#__PURE__*/_jsxs("button", {
|
|
17
29
|
onClick: onClick,
|
|
18
30
|
type: "button",
|
|
19
31
|
className: classes,
|
|
20
32
|
disabled: disabled,
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
33
|
+
ref: ref,
|
|
34
|
+
...props,
|
|
35
|
+
children: [innerIcon, !iconOnly && children]
|
|
24
36
|
});
|
|
25
|
-
}
|
|
37
|
+
});
|
|
26
38
|
export default LinkButton;
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import cn from 'classnames';
|
|
2
|
-
import React, { forwardRef,
|
|
2
|
+
import React, { forwardRef, useMemo, useRef, useState, useEffect } from 'react';
|
|
3
3
|
import ReactDOM from 'react-dom';
|
|
4
4
|
import { usePopper } from 'react-popper';
|
|
5
5
|
import useForkRef from '../../helper/useForkRef';
|
|
6
6
|
import useId from '../../helper/useId';
|
|
7
|
-
import useOnClickOutside from '../../helper/useOnClickOutside';
|
|
8
7
|
import TimePickerDropdown from './time-picker-dropdown/TimePickerDropdown';
|
|
9
8
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
10
9
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
@@ -61,10 +60,6 @@ export const TimePicker = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
61
60
|
const timePickerRef = useRef(null);
|
|
62
61
|
const combinedTimePickerRef = useForkRef(timePickerRef, r => setPopperElement(r));
|
|
63
62
|
const [open, setOpen] = useState(false);
|
|
64
|
-
const closeDropdown = useCallback(() => {
|
|
65
|
-
setOpen(false);
|
|
66
|
-
}, []);
|
|
67
|
-
useOnClickOutside(labelRef, closeDropdown, timePickerRef);
|
|
68
63
|
const controlled = value !== undefined;
|
|
69
64
|
const initialValue = controlled ? value : defaultValue;
|
|
70
65
|
const [innerValue, setInnerValue] = useState(initialValue ?? new Date());
|
|
@@ -144,6 +139,7 @@ export const TimePicker = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
144
139
|
})]
|
|
145
140
|
})
|
|
146
141
|
}), open && /*#__PURE__*/ReactDOM.createPortal( /*#__PURE__*/_jsx(TimePickerDropdown, {
|
|
142
|
+
labelRef: labelRef,
|
|
147
143
|
ref: combinedTimePickerRef,
|
|
148
144
|
onClose: handleClose,
|
|
149
145
|
onDateChange: handleDateChange,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import './TimePickerDropdown.scss';
|
|
2
|
-
import React from 'react';
|
|
2
|
+
import React, { RefObject } from 'react';
|
|
3
3
|
interface TimePickerDropdownProps {
|
|
4
4
|
timeFormat: '12' | '24';
|
|
5
5
|
date: Date;
|
|
@@ -7,6 +7,7 @@ interface TimePickerDropdownProps {
|
|
|
7
7
|
showSeconds?: boolean;
|
|
8
8
|
onClose: (date?: Date) => void;
|
|
9
9
|
style?: React.CSSProperties;
|
|
10
|
+
labelRef: RefObject<HTMLDivElement>;
|
|
10
11
|
}
|
|
11
12
|
declare const TimePickerDropdown: (props: TimePickerDropdownProps & React.RefAttributes<HTMLDivElement>) => React.ReactElement<any, string | React.JSXElementConstructor<any>> | null;
|
|
12
13
|
export default TimePickerDropdown;
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import cn from 'classnames';
|
|
2
2
|
import React, { forwardRef, useEffect, useRef, useState } from 'react';
|
|
3
3
|
import useForkRef from '../../../helper/useForkRef';
|
|
4
|
+
import LinkButton from '../../../components/link-button/LinkButton';
|
|
5
|
+
import TimePickerInput from './TimePickerInput';
|
|
6
|
+
import useOnClickOutside from '../../../helper/useOnClickOutside';
|
|
4
7
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
5
8
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
6
9
|
const TimePickerDropdown = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
@@ -10,7 +13,8 @@ const TimePickerDropdown = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
10
13
|
onDateChange,
|
|
11
14
|
showSeconds,
|
|
12
15
|
onClose,
|
|
13
|
-
style
|
|
16
|
+
style,
|
|
17
|
+
labelRef
|
|
14
18
|
} = _ref;
|
|
15
19
|
const innerRef = useRef(null);
|
|
16
20
|
const combinedRef = useForkRef(ref, innerRef);
|
|
@@ -19,6 +23,7 @@ const TimePickerDropdown = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
19
23
|
const [tmpMinutes, setTmpMinutes] = useState(null);
|
|
20
24
|
const [tmpSeconds, setTmpSeconds] = useState(null);
|
|
21
25
|
const [innerDate, setInnerDate] = useState(date);
|
|
26
|
+
useOnClickOutside(labelRef, () => onClose(innerDate), innerRef);
|
|
22
27
|
const min = 0;
|
|
23
28
|
const hourMax = timeFormat === '12' ? 12 : 23;
|
|
24
29
|
const minutesSecondsMax = 59;
|
|
@@ -32,16 +37,9 @@ const TimePickerDropdown = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
32
37
|
onClose(e.key === 'Enter' ? innerDate : undefined);
|
|
33
38
|
}
|
|
34
39
|
}
|
|
35
|
-
function
|
|
40
|
+
function handleHourIncrement(increment) {
|
|
36
41
|
const newDate = new Date(innerDate);
|
|
37
|
-
newDate.setHours(innerDate.getHours() +
|
|
38
|
-
setInnerDate(newDate);
|
|
39
|
-
onDateChange(newDate);
|
|
40
|
-
setTmpHours(null);
|
|
41
|
-
}
|
|
42
|
-
function handleHourDown() {
|
|
43
|
-
const newDate = new Date(innerDate);
|
|
44
|
-
newDate.setHours(innerDate.getHours() - 1);
|
|
42
|
+
newDate.setHours(innerDate.getHours() + increment);
|
|
45
43
|
setInnerDate(newDate);
|
|
46
44
|
onDateChange(newDate);
|
|
47
45
|
setTmpHours(null);
|
|
@@ -53,16 +51,9 @@ const TimePickerDropdown = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
53
51
|
setInnerDate(newDate);
|
|
54
52
|
setTmpHours(e.target.value);
|
|
55
53
|
}
|
|
56
|
-
function
|
|
57
|
-
const newDate = new Date(innerDate);
|
|
58
|
-
newDate.setMinutes(innerDate.getMinutes() + 1);
|
|
59
|
-
setInnerDate(newDate);
|
|
60
|
-
onDateChange(newDate);
|
|
61
|
-
setTmpMinutes(null);
|
|
62
|
-
}
|
|
63
|
-
function handleMinuteDown() {
|
|
54
|
+
function handleMinuteIncrement(increment) {
|
|
64
55
|
const newDate = new Date(innerDate);
|
|
65
|
-
newDate.setMinutes(innerDate.getMinutes()
|
|
56
|
+
newDate.setMinutes(innerDate.getMinutes() + increment);
|
|
66
57
|
setInnerDate(newDate);
|
|
67
58
|
onDateChange(newDate);
|
|
68
59
|
setTmpMinutes(null);
|
|
@@ -74,16 +65,9 @@ const TimePickerDropdown = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
74
65
|
setInnerDate(newDate);
|
|
75
66
|
setTmpMinutes(e.target.value);
|
|
76
67
|
}
|
|
77
|
-
function
|
|
68
|
+
function handleSecondIncrement(increment) {
|
|
78
69
|
const newDate = new Date(innerDate);
|
|
79
|
-
newDate.setSeconds(innerDate.getSeconds() +
|
|
80
|
-
setInnerDate(newDate);
|
|
81
|
-
onDateChange(newDate);
|
|
82
|
-
setTmpSeconds(null);
|
|
83
|
-
}
|
|
84
|
-
function handleSecondDown() {
|
|
85
|
-
const newDate = new Date(innerDate);
|
|
86
|
-
newDate.setSeconds(innerDate.getSeconds() - 1);
|
|
70
|
+
newDate.setSeconds(innerDate.getSeconds() + increment);
|
|
87
71
|
setInnerDate(newDate);
|
|
88
72
|
onDateChange(newDate);
|
|
89
73
|
setTmpSeconds(null);
|
|
@@ -96,6 +80,21 @@ const TimePickerDropdown = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
96
80
|
setTmpSeconds(e.target.value);
|
|
97
81
|
}
|
|
98
82
|
const hours = timeFormat === '12' ? (innerDate.getHours() + 11) % 12 + 1 : innerDate.getHours();
|
|
83
|
+
function toggleAmPm() {
|
|
84
|
+
const newDate = new Date(innerDate);
|
|
85
|
+
// Get the current hour in 24-hour format
|
|
86
|
+
const currentHours = innerDate.getHours();
|
|
87
|
+
if (currentHours >= 0 && currentHours < 12) {
|
|
88
|
+
// Switching from AM to PM
|
|
89
|
+
newDate.setHours(currentHours + 12);
|
|
90
|
+
} else {
|
|
91
|
+
// Switching from PM to AM
|
|
92
|
+
newDate.setHours(currentHours - 12);
|
|
93
|
+
}
|
|
94
|
+
setInnerDate(newDate);
|
|
95
|
+
onDateChange(newDate);
|
|
96
|
+
}
|
|
97
|
+
const formatNumberWithLeadingZero = number => (number < 10 ? '0' : '') + number;
|
|
99
98
|
return (
|
|
100
99
|
/*#__PURE__*/
|
|
101
100
|
// should not be an issue with dialog
|
|
@@ -113,98 +112,85 @@ const TimePickerDropdown = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
113
112
|
className: "fwe-timepicker-spinners",
|
|
114
113
|
children: [/*#__PURE__*/_jsxs("div", {
|
|
115
114
|
className: "fwe-timepicker-spinners-hours",
|
|
116
|
-
children: [/*#__PURE__*/_jsx(
|
|
117
|
-
type: "button",
|
|
115
|
+
children: [/*#__PURE__*/_jsx(LinkButton, {
|
|
118
116
|
"aria-label": "hour up",
|
|
119
|
-
className: "fwe-
|
|
120
|
-
onClick: () =>
|
|
121
|
-
|
|
117
|
+
className: "fwe-dark",
|
|
118
|
+
onClick: () => handleHourIncrement(1),
|
|
119
|
+
icon: /*#__PURE__*/_jsx("i", {
|
|
122
120
|
"aria-hidden": true,
|
|
123
121
|
className: "fwe-icon fwe-icon-arrows-expand"
|
|
124
122
|
})
|
|
125
|
-
}), /*#__PURE__*/_jsx(
|
|
123
|
+
}), /*#__PURE__*/_jsx(TimePickerInput, {
|
|
126
124
|
"aria-label": "hours value",
|
|
127
|
-
className: "fwe-timepicker-hide-spinners",
|
|
128
|
-
type: "number",
|
|
129
125
|
min: min,
|
|
130
|
-
step: 1,
|
|
131
|
-
value: tmpHours ?? (hours < 10 ? '0' : '') + hours,
|
|
132
126
|
max: hourMax,
|
|
127
|
+
value: tmpHours ?? formatNumberWithLeadingZero(hours),
|
|
133
128
|
onInput: handleHourChange,
|
|
134
129
|
ref: hoursRef
|
|
135
|
-
}), /*#__PURE__*/_jsx(
|
|
136
|
-
type: "button",
|
|
130
|
+
}), /*#__PURE__*/_jsx(LinkButton, {
|
|
137
131
|
"aria-label": "hour down",
|
|
138
|
-
className: "fwe-
|
|
139
|
-
onClick: () =>
|
|
140
|
-
|
|
132
|
+
className: "fwe-dark",
|
|
133
|
+
onClick: () => handleHourIncrement(-1),
|
|
134
|
+
icon: /*#__PURE__*/_jsx("i", {
|
|
141
135
|
"aria-hidden": true,
|
|
142
136
|
className: "fwe-icon fwe-icon-arrows-collapse"
|
|
143
137
|
})
|
|
144
138
|
})]
|
|
145
139
|
}), /*#__PURE__*/_jsxs("div", {
|
|
146
140
|
className: "fwe-timepicker-spinners-minutes",
|
|
147
|
-
children: [/*#__PURE__*/_jsx(
|
|
148
|
-
type: "button",
|
|
141
|
+
children: [/*#__PURE__*/_jsx(LinkButton, {
|
|
149
142
|
"aria-label": "minute up",
|
|
150
|
-
className: "fwe-
|
|
151
|
-
onClick: () =>
|
|
152
|
-
|
|
143
|
+
className: "fwe-dark",
|
|
144
|
+
onClick: () => handleMinuteIncrement(1),
|
|
145
|
+
icon: /*#__PURE__*/_jsx("i", {
|
|
153
146
|
"aria-hidden": true,
|
|
154
147
|
className: "fwe-icon fwe-icon-arrows-expand"
|
|
155
148
|
})
|
|
156
|
-
}), /*#__PURE__*/_jsx(
|
|
149
|
+
}), /*#__PURE__*/_jsx(TimePickerInput, {
|
|
157
150
|
"aria-label": "minutes value",
|
|
158
|
-
className: "fwe-timepicker-hide-spinners",
|
|
159
|
-
type: "number",
|
|
160
151
|
min: min,
|
|
161
|
-
step: 1,
|
|
162
|
-
value: tmpMinutes ?? (innerDate.getMinutes() < 10 ? '0' : '') + innerDate.getMinutes(),
|
|
163
152
|
max: minutesSecondsMax,
|
|
153
|
+
value: tmpMinutes ?? formatNumberWithLeadingZero(innerDate.getMinutes()),
|
|
164
154
|
onInput: handleMinuteChange
|
|
165
|
-
}), /*#__PURE__*/_jsx(
|
|
166
|
-
type: "button",
|
|
155
|
+
}), /*#__PURE__*/_jsx(LinkButton, {
|
|
167
156
|
"aria-label": "minute down",
|
|
168
|
-
className: "fwe-
|
|
169
|
-
onClick: () =>
|
|
170
|
-
|
|
157
|
+
className: "fwe-dark",
|
|
158
|
+
onClick: () => handleMinuteIncrement(-1),
|
|
159
|
+
icon: /*#__PURE__*/_jsx("i", {
|
|
171
160
|
"aria-hidden": true,
|
|
172
161
|
className: "fwe-icon fwe-icon-arrows-collapse"
|
|
173
162
|
})
|
|
174
163
|
})]
|
|
175
164
|
}), showSeconds && /*#__PURE__*/_jsxs("div", {
|
|
176
165
|
className: "fwe-timepicker-spinners-seconds",
|
|
177
|
-
children: [/*#__PURE__*/_jsx(
|
|
178
|
-
type: "button",
|
|
166
|
+
children: [/*#__PURE__*/_jsx(LinkButton, {
|
|
179
167
|
"aria-label": "seconds up",
|
|
180
|
-
className: "fwe-
|
|
181
|
-
onClick: () =>
|
|
182
|
-
|
|
168
|
+
className: "fwe-dark",
|
|
169
|
+
onClick: () => handleSecondIncrement(1),
|
|
170
|
+
icon: /*#__PURE__*/_jsx("i", {
|
|
183
171
|
"aria-hidden": true,
|
|
184
172
|
className: "fwe-icon fwe-icon-arrows-expand"
|
|
185
173
|
})
|
|
186
|
-
}), /*#__PURE__*/_jsx(
|
|
174
|
+
}), /*#__PURE__*/_jsx(TimePickerInput, {
|
|
187
175
|
"aria-label": "seconds value",
|
|
188
|
-
className: "fwe-timepicker-hide-spinners",
|
|
189
|
-
type: "number",
|
|
190
176
|
min: min,
|
|
191
|
-
step: 1,
|
|
192
|
-
value: tmpSeconds ?? (innerDate.getSeconds() < 10 ? '0' : '') + innerDate.getSeconds(),
|
|
193
177
|
max: minutesSecondsMax,
|
|
178
|
+
value: tmpSeconds ?? formatNumberWithLeadingZero(innerDate.getSeconds()),
|
|
194
179
|
onInput: handleSecondChange
|
|
195
|
-
}), /*#__PURE__*/_jsx(
|
|
196
|
-
type: "button",
|
|
180
|
+
}), /*#__PURE__*/_jsx(LinkButton, {
|
|
197
181
|
"aria-label": "minute down",
|
|
198
|
-
className: "fwe-
|
|
199
|
-
onClick: () =>
|
|
200
|
-
|
|
182
|
+
className: "fwe-dark",
|
|
183
|
+
onClick: () => handleSecondIncrement(-1),
|
|
184
|
+
icon: /*#__PURE__*/_jsx("i", {
|
|
201
185
|
"aria-hidden": true,
|
|
202
186
|
className: "fwe-icon fwe-icon-arrows-collapse"
|
|
203
187
|
})
|
|
204
188
|
})]
|
|
205
189
|
})]
|
|
206
|
-
}), timeFormat === '12' && /*#__PURE__*/_jsx("
|
|
207
|
-
|
|
190
|
+
}), timeFormat === '12' && /*#__PURE__*/_jsx("button", {
|
|
191
|
+
onClick: toggleAmPm,
|
|
192
|
+
type: "button",
|
|
193
|
+
className: "fwe-btn fwe-ml-m",
|
|
208
194
|
children: innerDate.getHours() >= 12 ? 'PM' : 'AM'
|
|
209
195
|
})]
|
|
210
196
|
})
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
interface TimePickerInputProps {
|
|
3
|
+
min: number;
|
|
4
|
+
value: string | number;
|
|
5
|
+
max: number;
|
|
6
|
+
onInput: React.FormEventHandler<HTMLInputElement>;
|
|
7
|
+
'aria-label': string;
|
|
8
|
+
}
|
|
9
|
+
declare const TimePickerInput: (props: TimePickerInputProps & import("react").RefAttributes<HTMLInputElement>) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | null;
|
|
10
|
+
export default TimePickerInput;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { forwardRef } from 'react';
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
const TimePickerInput = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
4
|
+
let {
|
|
5
|
+
min,
|
|
6
|
+
max,
|
|
7
|
+
value,
|
|
8
|
+
onInput,
|
|
9
|
+
'aria-label': ariaLabel
|
|
10
|
+
} = _ref;
|
|
11
|
+
return /*#__PURE__*/_jsx("input", {
|
|
12
|
+
"aria-label": ariaLabel,
|
|
13
|
+
className: "fwe-timepicker-hide-spinners",
|
|
14
|
+
type: "number",
|
|
15
|
+
min: min,
|
|
16
|
+
step: 1,
|
|
17
|
+
value: value,
|
|
18
|
+
max: max,
|
|
19
|
+
onInput: onInput,
|
|
20
|
+
ref: ref
|
|
21
|
+
});
|
|
22
|
+
});
|
|
23
|
+
export default TimePickerInput;
|
|
@@ -5,10 +5,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
8
|
-
var _react =
|
|
8
|
+
var _react = require("react");
|
|
9
9
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
10
10
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
-
|
|
11
|
+
const Button = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
12
12
|
let {
|
|
13
13
|
icon,
|
|
14
14
|
disabled = false,
|
|
@@ -17,7 +17,8 @@ function Button(_ref) {
|
|
|
17
17
|
onClick,
|
|
18
18
|
primary = false,
|
|
19
19
|
className,
|
|
20
|
-
children
|
|
20
|
+
children,
|
|
21
|
+
...props
|
|
21
22
|
} = _ref;
|
|
22
23
|
const classes = (0, _classnames.default)('fwe-btn', 'fr-button', {
|
|
23
24
|
'fwe-btn-icon': iconOnly
|
|
@@ -33,11 +34,13 @@ function Button(_ref) {
|
|
|
33
34
|
onClick: onClick,
|
|
34
35
|
className: classes,
|
|
35
36
|
disabled: disabled,
|
|
37
|
+
ref: ref,
|
|
38
|
+
...props,
|
|
36
39
|
children: [icon && /*#__PURE__*/(0, _jsxRuntime.jsx)("i", {
|
|
37
40
|
className: `fwe-icon fwe-icon-${icon}`
|
|
38
41
|
}), !iconOnly && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
39
42
|
children: children
|
|
40
43
|
})]
|
|
41
44
|
});
|
|
42
|
-
}
|
|
45
|
+
});
|
|
43
46
|
var _default = exports.default = Button;
|
|
@@ -5,28 +5,40 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
8
|
+
var _react = require("react");
|
|
8
9
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
9
10
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
10
|
-
|
|
11
|
+
const LinkButton = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
11
12
|
let {
|
|
12
13
|
icon,
|
|
13
14
|
onClick,
|
|
14
15
|
disabled = false,
|
|
15
16
|
children,
|
|
16
17
|
iconOnly = false,
|
|
17
|
-
className
|
|
18
|
+
className,
|
|
19
|
+
...props
|
|
18
20
|
} = _ref;
|
|
19
21
|
const classes = (0, _classnames.default)('fwe-btn', 'fwe-btn-link', {
|
|
20
22
|
'fwe-disabled': disabled
|
|
21
23
|
}, className);
|
|
24
|
+
let innerIcon;
|
|
25
|
+
if (icon) {
|
|
26
|
+
if (typeof icon === 'string') {
|
|
27
|
+
innerIcon = /*#__PURE__*/(0, _jsxRuntime.jsx)("i", {
|
|
28
|
+
className: `fwe-icon fwe-icon-${icon}`
|
|
29
|
+
});
|
|
30
|
+
} else {
|
|
31
|
+
innerIcon = icon;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
22
34
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("button", {
|
|
23
35
|
onClick: onClick,
|
|
24
36
|
type: "button",
|
|
25
37
|
className: classes,
|
|
26
38
|
disabled: disabled,
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
39
|
+
ref: ref,
|
|
40
|
+
...props,
|
|
41
|
+
children: [innerIcon, !iconOnly && children]
|
|
30
42
|
});
|
|
31
|
-
}
|
|
43
|
+
});
|
|
32
44
|
var _default = exports.default = LinkButton;
|
|
@@ -10,7 +10,6 @@ var _reactDom = _interopRequireDefault(require("react-dom"));
|
|
|
10
10
|
var _reactPopper = require("react-popper");
|
|
11
11
|
var _useForkRef = _interopRequireDefault(require("../../helper/useForkRef"));
|
|
12
12
|
var _useId = _interopRequireDefault(require("../../helper/useId"));
|
|
13
|
-
var _useOnClickOutside = _interopRequireDefault(require("../../helper/useOnClickOutside"));
|
|
14
13
|
var _TimePickerDropdown = _interopRequireDefault(require("./time-picker-dropdown/TimePickerDropdown"));
|
|
15
14
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
16
15
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
@@ -68,10 +67,6 @@ const TimePicker = exports.TimePicker = /*#__PURE__*/(0, _react.forwardRef)((_re
|
|
|
68
67
|
const timePickerRef = (0, _react.useRef)(null);
|
|
69
68
|
const combinedTimePickerRef = (0, _useForkRef.default)(timePickerRef, r => setPopperElement(r));
|
|
70
69
|
const [open, setOpen] = (0, _react.useState)(false);
|
|
71
|
-
const closeDropdown = (0, _react.useCallback)(() => {
|
|
72
|
-
setOpen(false);
|
|
73
|
-
}, []);
|
|
74
|
-
(0, _useOnClickOutside.default)(labelRef, closeDropdown, timePickerRef);
|
|
75
70
|
const controlled = value !== undefined;
|
|
76
71
|
const initialValue = controlled ? value : defaultValue;
|
|
77
72
|
const [innerValue, setInnerValue] = (0, _react.useState)(initialValue ?? new Date());
|
|
@@ -151,6 +146,7 @@ const TimePicker = exports.TimePicker = /*#__PURE__*/(0, _react.forwardRef)((_re
|
|
|
151
146
|
})]
|
|
152
147
|
})
|
|
153
148
|
}), open && /*#__PURE__*/_reactDom.default.createPortal( /*#__PURE__*/(0, _jsxRuntime.jsx)(_TimePickerDropdown.default, {
|
|
149
|
+
labelRef: labelRef,
|
|
154
150
|
ref: combinedTimePickerRef,
|
|
155
151
|
onClose: handleClose,
|
|
156
152
|
onDateChange: handleDateChange,
|
|
@@ -7,6 +7,9 @@ exports.default = void 0;
|
|
|
7
7
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
8
8
|
var _react = _interopRequireWildcard(require("react"));
|
|
9
9
|
var _useForkRef = _interopRequireDefault(require("../../../helper/useForkRef"));
|
|
10
|
+
var _LinkButton = _interopRequireDefault(require("../../../components/link-button/LinkButton"));
|
|
11
|
+
var _TimePickerInput = _interopRequireDefault(require("./TimePickerInput"));
|
|
12
|
+
var _useOnClickOutside = _interopRequireDefault(require("../../../helper/useOnClickOutside"));
|
|
10
13
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
11
14
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
12
15
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
@@ -18,7 +21,8 @@ const TimePickerDropdown = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
|
18
21
|
onDateChange,
|
|
19
22
|
showSeconds,
|
|
20
23
|
onClose,
|
|
21
|
-
style
|
|
24
|
+
style,
|
|
25
|
+
labelRef
|
|
22
26
|
} = _ref;
|
|
23
27
|
const innerRef = (0, _react.useRef)(null);
|
|
24
28
|
const combinedRef = (0, _useForkRef.default)(ref, innerRef);
|
|
@@ -27,6 +31,7 @@ const TimePickerDropdown = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
|
27
31
|
const [tmpMinutes, setTmpMinutes] = (0, _react.useState)(null);
|
|
28
32
|
const [tmpSeconds, setTmpSeconds] = (0, _react.useState)(null);
|
|
29
33
|
const [innerDate, setInnerDate] = (0, _react.useState)(date);
|
|
34
|
+
(0, _useOnClickOutside.default)(labelRef, () => onClose(innerDate), innerRef);
|
|
30
35
|
const min = 0;
|
|
31
36
|
const hourMax = timeFormat === '12' ? 12 : 23;
|
|
32
37
|
const minutesSecondsMax = 59;
|
|
@@ -40,16 +45,9 @@ const TimePickerDropdown = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
|
40
45
|
onClose(e.key === 'Enter' ? innerDate : undefined);
|
|
41
46
|
}
|
|
42
47
|
}
|
|
43
|
-
function
|
|
48
|
+
function handleHourIncrement(increment) {
|
|
44
49
|
const newDate = new Date(innerDate);
|
|
45
|
-
newDate.setHours(innerDate.getHours() +
|
|
46
|
-
setInnerDate(newDate);
|
|
47
|
-
onDateChange(newDate);
|
|
48
|
-
setTmpHours(null);
|
|
49
|
-
}
|
|
50
|
-
function handleHourDown() {
|
|
51
|
-
const newDate = new Date(innerDate);
|
|
52
|
-
newDate.setHours(innerDate.getHours() - 1);
|
|
50
|
+
newDate.setHours(innerDate.getHours() + increment);
|
|
53
51
|
setInnerDate(newDate);
|
|
54
52
|
onDateChange(newDate);
|
|
55
53
|
setTmpHours(null);
|
|
@@ -61,16 +59,9 @@ const TimePickerDropdown = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
|
61
59
|
setInnerDate(newDate);
|
|
62
60
|
setTmpHours(e.target.value);
|
|
63
61
|
}
|
|
64
|
-
function
|
|
65
|
-
const newDate = new Date(innerDate);
|
|
66
|
-
newDate.setMinutes(innerDate.getMinutes() + 1);
|
|
67
|
-
setInnerDate(newDate);
|
|
68
|
-
onDateChange(newDate);
|
|
69
|
-
setTmpMinutes(null);
|
|
70
|
-
}
|
|
71
|
-
function handleMinuteDown() {
|
|
62
|
+
function handleMinuteIncrement(increment) {
|
|
72
63
|
const newDate = new Date(innerDate);
|
|
73
|
-
newDate.setMinutes(innerDate.getMinutes()
|
|
64
|
+
newDate.setMinutes(innerDate.getMinutes() + increment);
|
|
74
65
|
setInnerDate(newDate);
|
|
75
66
|
onDateChange(newDate);
|
|
76
67
|
setTmpMinutes(null);
|
|
@@ -82,16 +73,9 @@ const TimePickerDropdown = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
|
82
73
|
setInnerDate(newDate);
|
|
83
74
|
setTmpMinutes(e.target.value);
|
|
84
75
|
}
|
|
85
|
-
function
|
|
76
|
+
function handleSecondIncrement(increment) {
|
|
86
77
|
const newDate = new Date(innerDate);
|
|
87
|
-
newDate.setSeconds(innerDate.getSeconds() +
|
|
88
|
-
setInnerDate(newDate);
|
|
89
|
-
onDateChange(newDate);
|
|
90
|
-
setTmpSeconds(null);
|
|
91
|
-
}
|
|
92
|
-
function handleSecondDown() {
|
|
93
|
-
const newDate = new Date(innerDate);
|
|
94
|
-
newDate.setSeconds(innerDate.getSeconds() - 1);
|
|
78
|
+
newDate.setSeconds(innerDate.getSeconds() + increment);
|
|
95
79
|
setInnerDate(newDate);
|
|
96
80
|
onDateChange(newDate);
|
|
97
81
|
setTmpSeconds(null);
|
|
@@ -104,6 +88,21 @@ const TimePickerDropdown = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
|
104
88
|
setTmpSeconds(e.target.value);
|
|
105
89
|
}
|
|
106
90
|
const hours = timeFormat === '12' ? (innerDate.getHours() + 11) % 12 + 1 : innerDate.getHours();
|
|
91
|
+
function toggleAmPm() {
|
|
92
|
+
const newDate = new Date(innerDate);
|
|
93
|
+
// Get the current hour in 24-hour format
|
|
94
|
+
const currentHours = innerDate.getHours();
|
|
95
|
+
if (currentHours >= 0 && currentHours < 12) {
|
|
96
|
+
// Switching from AM to PM
|
|
97
|
+
newDate.setHours(currentHours + 12);
|
|
98
|
+
} else {
|
|
99
|
+
// Switching from PM to AM
|
|
100
|
+
newDate.setHours(currentHours - 12);
|
|
101
|
+
}
|
|
102
|
+
setInnerDate(newDate);
|
|
103
|
+
onDateChange(newDate);
|
|
104
|
+
}
|
|
105
|
+
const formatNumberWithLeadingZero = number => (number < 10 ? '0' : '') + number;
|
|
107
106
|
return (
|
|
108
107
|
/*#__PURE__*/
|
|
109
108
|
// should not be an issue with dialog
|
|
@@ -121,98 +120,85 @@ const TimePickerDropdown = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
|
121
120
|
className: "fwe-timepicker-spinners",
|
|
122
121
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
123
122
|
className: "fwe-timepicker-spinners-hours",
|
|
124
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
125
|
-
type: "button",
|
|
123
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_LinkButton.default, {
|
|
126
124
|
"aria-label": "hour up",
|
|
127
|
-
className: "fwe-
|
|
128
|
-
onClick: () =>
|
|
129
|
-
|
|
125
|
+
className: "fwe-dark",
|
|
126
|
+
onClick: () => handleHourIncrement(1),
|
|
127
|
+
icon: /*#__PURE__*/(0, _jsxRuntime.jsx)("i", {
|
|
130
128
|
"aria-hidden": true,
|
|
131
129
|
className: "fwe-icon fwe-icon-arrows-expand"
|
|
132
130
|
})
|
|
133
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
131
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_TimePickerInput.default, {
|
|
134
132
|
"aria-label": "hours value",
|
|
135
|
-
className: "fwe-timepicker-hide-spinners",
|
|
136
|
-
type: "number",
|
|
137
133
|
min: min,
|
|
138
|
-
step: 1,
|
|
139
|
-
value: tmpHours ?? (hours < 10 ? '0' : '') + hours,
|
|
140
134
|
max: hourMax,
|
|
135
|
+
value: tmpHours ?? formatNumberWithLeadingZero(hours),
|
|
141
136
|
onInput: handleHourChange,
|
|
142
137
|
ref: hoursRef
|
|
143
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
144
|
-
type: "button",
|
|
138
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_LinkButton.default, {
|
|
145
139
|
"aria-label": "hour down",
|
|
146
|
-
className: "fwe-
|
|
147
|
-
onClick: () =>
|
|
148
|
-
|
|
140
|
+
className: "fwe-dark",
|
|
141
|
+
onClick: () => handleHourIncrement(-1),
|
|
142
|
+
icon: /*#__PURE__*/(0, _jsxRuntime.jsx)("i", {
|
|
149
143
|
"aria-hidden": true,
|
|
150
144
|
className: "fwe-icon fwe-icon-arrows-collapse"
|
|
151
145
|
})
|
|
152
146
|
})]
|
|
153
147
|
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
154
148
|
className: "fwe-timepicker-spinners-minutes",
|
|
155
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
156
|
-
type: "button",
|
|
149
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_LinkButton.default, {
|
|
157
150
|
"aria-label": "minute up",
|
|
158
|
-
className: "fwe-
|
|
159
|
-
onClick: () =>
|
|
160
|
-
|
|
151
|
+
className: "fwe-dark",
|
|
152
|
+
onClick: () => handleMinuteIncrement(1),
|
|
153
|
+
icon: /*#__PURE__*/(0, _jsxRuntime.jsx)("i", {
|
|
161
154
|
"aria-hidden": true,
|
|
162
155
|
className: "fwe-icon fwe-icon-arrows-expand"
|
|
163
156
|
})
|
|
164
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
157
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_TimePickerInput.default, {
|
|
165
158
|
"aria-label": "minutes value",
|
|
166
|
-
className: "fwe-timepicker-hide-spinners",
|
|
167
|
-
type: "number",
|
|
168
159
|
min: min,
|
|
169
|
-
step: 1,
|
|
170
|
-
value: tmpMinutes ?? (innerDate.getMinutes() < 10 ? '0' : '') + innerDate.getMinutes(),
|
|
171
160
|
max: minutesSecondsMax,
|
|
161
|
+
value: tmpMinutes ?? formatNumberWithLeadingZero(innerDate.getMinutes()),
|
|
172
162
|
onInput: handleMinuteChange
|
|
173
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
174
|
-
type: "button",
|
|
163
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_LinkButton.default, {
|
|
175
164
|
"aria-label": "minute down",
|
|
176
|
-
className: "fwe-
|
|
177
|
-
onClick: () =>
|
|
178
|
-
|
|
165
|
+
className: "fwe-dark",
|
|
166
|
+
onClick: () => handleMinuteIncrement(-1),
|
|
167
|
+
icon: /*#__PURE__*/(0, _jsxRuntime.jsx)("i", {
|
|
179
168
|
"aria-hidden": true,
|
|
180
169
|
className: "fwe-icon fwe-icon-arrows-collapse"
|
|
181
170
|
})
|
|
182
171
|
})]
|
|
183
172
|
}), showSeconds && /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
184
173
|
className: "fwe-timepicker-spinners-seconds",
|
|
185
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
186
|
-
type: "button",
|
|
174
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_LinkButton.default, {
|
|
187
175
|
"aria-label": "seconds up",
|
|
188
|
-
className: "fwe-
|
|
189
|
-
onClick: () =>
|
|
190
|
-
|
|
176
|
+
className: "fwe-dark",
|
|
177
|
+
onClick: () => handleSecondIncrement(1),
|
|
178
|
+
icon: /*#__PURE__*/(0, _jsxRuntime.jsx)("i", {
|
|
191
179
|
"aria-hidden": true,
|
|
192
180
|
className: "fwe-icon fwe-icon-arrows-expand"
|
|
193
181
|
})
|
|
194
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
182
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_TimePickerInput.default, {
|
|
195
183
|
"aria-label": "seconds value",
|
|
196
|
-
className: "fwe-timepicker-hide-spinners",
|
|
197
|
-
type: "number",
|
|
198
184
|
min: min,
|
|
199
|
-
step: 1,
|
|
200
|
-
value: tmpSeconds ?? (innerDate.getSeconds() < 10 ? '0' : '') + innerDate.getSeconds(),
|
|
201
185
|
max: minutesSecondsMax,
|
|
186
|
+
value: tmpSeconds ?? formatNumberWithLeadingZero(innerDate.getSeconds()),
|
|
202
187
|
onInput: handleSecondChange
|
|
203
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
204
|
-
type: "button",
|
|
188
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_LinkButton.default, {
|
|
205
189
|
"aria-label": "minute down",
|
|
206
|
-
className: "fwe-
|
|
207
|
-
onClick: () =>
|
|
208
|
-
|
|
190
|
+
className: "fwe-dark",
|
|
191
|
+
onClick: () => handleSecondIncrement(-1),
|
|
192
|
+
icon: /*#__PURE__*/(0, _jsxRuntime.jsx)("i", {
|
|
209
193
|
"aria-hidden": true,
|
|
210
194
|
className: "fwe-icon fwe-icon-arrows-collapse"
|
|
211
195
|
})
|
|
212
196
|
})]
|
|
213
197
|
})]
|
|
214
|
-
}), timeFormat === '12' && /*#__PURE__*/(0, _jsxRuntime.jsx)("
|
|
215
|
-
|
|
198
|
+
}), timeFormat === '12' && /*#__PURE__*/(0, _jsxRuntime.jsx)("button", {
|
|
199
|
+
onClick: toggleAmPm,
|
|
200
|
+
type: "button",
|
|
201
|
+
className: "fwe-btn fwe-ml-m",
|
|
216
202
|
children: innerDate.getHours() >= 12 ? 'PM' : 'AM'
|
|
217
203
|
})]
|
|
218
204
|
})
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = require("react");
|
|
8
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
9
|
+
const TimePickerInput = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
10
|
+
let {
|
|
11
|
+
min,
|
|
12
|
+
max,
|
|
13
|
+
value,
|
|
14
|
+
onInput,
|
|
15
|
+
'aria-label': ariaLabel
|
|
16
|
+
} = _ref;
|
|
17
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)("input", {
|
|
18
|
+
"aria-label": ariaLabel,
|
|
19
|
+
className: "fwe-timepicker-hide-spinners",
|
|
20
|
+
type: "number",
|
|
21
|
+
min: min,
|
|
22
|
+
step: 1,
|
|
23
|
+
value: value,
|
|
24
|
+
max: max,
|
|
25
|
+
onInput: onInput,
|
|
26
|
+
ref: ref
|
|
27
|
+
});
|
|
28
|
+
});
|
|
29
|
+
var _default = exports.default = TimePickerInput;
|