@contentful/field-editor-date 2.3.5-canary.28 → 2.3.5-canary.30
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/dist/cjs/DateEditor.js +10 -10
- package/dist/cjs/DatepickerInput.js +1 -1
- package/dist/cjs/TimepickerInput.js +2 -2
- package/dist/cjs/TimepickerInput.spec.js +17 -17
- package/dist/cjs/TimezonePickerInput.js +2 -2
- package/dist/cjs/index.js +3 -3
- package/dist/cjs/utils/date.js +5 -5
- package/dist/cjs/utils/zoneOffsets.js +3 -3
- package/dist/esm/DateEditor.js +10 -10
- package/dist/esm/DatepickerInput.js +1 -1
- package/dist/esm/TimepickerInput.js +2 -2
- package/dist/esm/TimepickerInput.spec.js +17 -17
- package/dist/esm/TimezonePickerInput.js +2 -2
- package/package.json +4 -4
package/dist/cjs/DateEditor.js
CHANGED
|
@@ -89,10 +89,10 @@ function DateEditorContainer({ initialValue, usesTime, usesTimezone, uses12hCloc
|
|
|
89
89
|
}, [
|
|
90
90
|
value
|
|
91
91
|
]);
|
|
92
|
-
return
|
|
92
|
+
return _react.createElement("div", {
|
|
93
93
|
"data-test-id": "date-editor",
|
|
94
94
|
className: styles.root
|
|
95
|
-
},
|
|
95
|
+
}, _react.createElement(_DatepickerInput.DatepickerInput, {
|
|
96
96
|
disabled: disabled,
|
|
97
97
|
value: value.date,
|
|
98
98
|
onChange: (date)=>{
|
|
@@ -101,9 +101,9 @@ function DateEditorContainer({ initialValue, usesTime, usesTimezone, uses12hCloc
|
|
|
101
101
|
date
|
|
102
102
|
}));
|
|
103
103
|
}
|
|
104
|
-
}), usesTime &&
|
|
104
|
+
}), usesTime && _react.createElement(_react.Fragment, null, _react.createElement("div", {
|
|
105
105
|
className: styles.separator
|
|
106
|
-
}),
|
|
106
|
+
}), _react.createElement(_TimepickerInput.TimepickerInput, {
|
|
107
107
|
disabled: disabled,
|
|
108
108
|
time: value.time,
|
|
109
109
|
ampm: value.ampm,
|
|
@@ -115,9 +115,9 @@ function DateEditorContainer({ initialValue, usesTime, usesTimezone, uses12hCloc
|
|
|
115
115
|
}));
|
|
116
116
|
},
|
|
117
117
|
uses12hClock: uses12hClock
|
|
118
|
-
})), usesTimezone &&
|
|
118
|
+
})), usesTimezone && _react.createElement(_react.Fragment, null, _react.createElement("div", {
|
|
119
119
|
className: styles.separator
|
|
120
|
-
}),
|
|
120
|
+
}), _react.createElement(_TimezonePickerInput.TimezonepickerInput, {
|
|
121
121
|
disabled: disabled,
|
|
122
122
|
value: value.utcOffset,
|
|
123
123
|
onChange: (utcOffset)=>{
|
|
@@ -126,9 +126,9 @@ function DateEditorContainer({ initialValue, usesTime, usesTimezone, uses12hCloc
|
|
|
126
126
|
utcOffset
|
|
127
127
|
}));
|
|
128
128
|
}
|
|
129
|
-
})), hasClear &&
|
|
129
|
+
})), hasClear && _react.createElement(_react.Fragment, null, _react.createElement("div", {
|
|
130
130
|
className: styles.separator
|
|
131
|
-
}),
|
|
131
|
+
}), _react.createElement(_f36components.TextLink, {
|
|
132
132
|
as: "button",
|
|
133
133
|
isDisabled: disabled,
|
|
134
134
|
testId: "date-clear",
|
|
@@ -149,7 +149,7 @@ function DateEditor(props) {
|
|
|
149
149
|
const usesTime = formatParam !== 'dateonly';
|
|
150
150
|
const usesTimezone = formatParam === 'timeZ';
|
|
151
151
|
const uses12hClock = ampmParam === '12';
|
|
152
|
-
return
|
|
152
|
+
return _react.createElement(_fieldeditorshared.FieldConnector, {
|
|
153
153
|
field: field,
|
|
154
154
|
isInitiallyDisabled: props.isInitiallyDisabled,
|
|
155
155
|
isDisabled: props.isDisabled,
|
|
@@ -159,7 +159,7 @@ function DateEditor(props) {
|
|
|
159
159
|
value,
|
|
160
160
|
uses12hClock
|
|
161
161
|
});
|
|
162
|
-
return
|
|
162
|
+
return _react.createElement(DateEditorContainer, {
|
|
163
163
|
initialValue: datetimeValue,
|
|
164
164
|
uses12hClock: uses12hClock,
|
|
165
165
|
usesTimezone: usesTimezone,
|
|
@@ -70,7 +70,7 @@ const DatepickerInput = (props)=>{
|
|
|
70
70
|
];
|
|
71
71
|
}, []);
|
|
72
72
|
const selectedDate = props.value;
|
|
73
|
-
return
|
|
73
|
+
return _react.default.createElement(_f36components.Datepicker, {
|
|
74
74
|
className: styles.root,
|
|
75
75
|
selected: selectedDate,
|
|
76
76
|
onSelect: (day)=>{
|
|
@@ -115,11 +115,11 @@ const TimepickerInput = ({ disabled, uses12hClock, time = '00:00', ampm = 'AM',
|
|
|
115
115
|
uses12hClock,
|
|
116
116
|
onChange
|
|
117
117
|
]);
|
|
118
|
-
return
|
|
118
|
+
return _react.default.createElement(_f36components.Flex, {
|
|
119
119
|
className: (0, _css.css)({
|
|
120
120
|
width: '145px'
|
|
121
121
|
})
|
|
122
|
-
},
|
|
122
|
+
}, _react.default.createElement(_f36components.TextInput, {
|
|
123
123
|
"aria-label": "Select time",
|
|
124
124
|
placeholder: uses12hClock ? '12:00 AM' : '00:00',
|
|
125
125
|
"date-time-type": uses12hClock ? '12' : '24',
|
|
@@ -59,7 +59,7 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
59
59
|
(0, _vitest.describe)('TimepickerInput', ()=>{
|
|
60
60
|
(0, _vitest.afterEach)(_react1.cleanup);
|
|
61
61
|
(0, _vitest.it)('renders midnight (00:00) in 24h mode without crashing', ()=>{
|
|
62
|
-
const { getByTestId } = (0, _react1.render)(
|
|
62
|
+
const { getByTestId } = (0, _react1.render)(_react.createElement(_TimepickerInput.TimepickerInput, {
|
|
63
63
|
disabled: false,
|
|
64
64
|
uses12hClock: false,
|
|
65
65
|
time: "00:00",
|
|
@@ -69,7 +69,7 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
69
69
|
(0, _vitest.expect)(getByTestId('time-input')).toHaveValue('00:00');
|
|
70
70
|
});
|
|
71
71
|
(0, _vitest.it)('defaults to 00:00 in 24h mode when no time prop is provided', ()=>{
|
|
72
|
-
const { getByTestId } = (0, _react1.render)(
|
|
72
|
+
const { getByTestId } = (0, _react1.render)(_react.createElement(_TimepickerInput.TimepickerInput, {
|
|
73
73
|
disabled: false,
|
|
74
74
|
uses12hClock: false,
|
|
75
75
|
onChange: _vitest.vi.fn()
|
|
@@ -77,7 +77,7 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
77
77
|
(0, _vitest.expect)(getByTestId('time-input')).toHaveValue('00:00');
|
|
78
78
|
});
|
|
79
79
|
(0, _vitest.it)('defaults to 12:00 AM in 12h mode when no time prop is provided', ()=>{
|
|
80
|
-
const { getByTestId } = (0, _react1.render)(
|
|
80
|
+
const { getByTestId } = (0, _react1.render)(_react.createElement(_TimepickerInput.TimepickerInput, {
|
|
81
81
|
disabled: false,
|
|
82
82
|
uses12hClock: true,
|
|
83
83
|
onChange: _vitest.vi.fn()
|
|
@@ -85,7 +85,7 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
85
85
|
(0, _vitest.expect)(getByTestId('time-input')).toHaveValue('12:00 AM');
|
|
86
86
|
});
|
|
87
87
|
(0, _vitest.it)('renders late-night hours (e.g. 23:00) in 24h mode without crashing', ()=>{
|
|
88
|
-
const { getByTestId } = (0, _react1.render)(
|
|
88
|
+
const { getByTestId } = (0, _react1.render)(_react.createElement(_TimepickerInput.TimepickerInput, {
|
|
89
89
|
disabled: false,
|
|
90
90
|
uses12hClock: false,
|
|
91
91
|
time: "23:00",
|
|
@@ -97,7 +97,7 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
97
97
|
(0, _vitest.describe)('onChange on blur — 24h mode', ()=>{
|
|
98
98
|
(0, _vitest.it)('emits 19:00 (not 07:00) when user types 19:00 in 24h mode', ()=>{
|
|
99
99
|
const onChange = _vitest.vi.fn();
|
|
100
|
-
const { getByTestId } = (0, _react1.render)(
|
|
100
|
+
const { getByTestId } = (0, _react1.render)(_react.createElement(_TimepickerInput.TimepickerInput, {
|
|
101
101
|
disabled: false,
|
|
102
102
|
uses12hClock: false,
|
|
103
103
|
time: "19:00",
|
|
@@ -114,7 +114,7 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
114
114
|
});
|
|
115
115
|
(0, _vitest.it)('emits 23:59 (not 11:59) when user types 23:59 in 24h mode', ()=>{
|
|
116
116
|
const onChange = _vitest.vi.fn();
|
|
117
|
-
const { getByTestId } = (0, _react1.render)(
|
|
117
|
+
const { getByTestId } = (0, _react1.render)(_react.createElement(_TimepickerInput.TimepickerInput, {
|
|
118
118
|
disabled: false,
|
|
119
119
|
uses12hClock: false,
|
|
120
120
|
time: "23:59",
|
|
@@ -131,7 +131,7 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
131
131
|
});
|
|
132
132
|
(0, _vitest.it)('emits 00:00 when user types 00:00 in 24h mode', ()=>{
|
|
133
133
|
const onChange = _vitest.vi.fn();
|
|
134
|
-
const { getByTestId } = (0, _react1.render)(
|
|
134
|
+
const { getByTestId } = (0, _react1.render)(_react.createElement(_TimepickerInput.TimepickerInput, {
|
|
135
135
|
disabled: false,
|
|
136
136
|
uses12hClock: false,
|
|
137
137
|
time: "00:00",
|
|
@@ -148,7 +148,7 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
148
148
|
});
|
|
149
149
|
(0, _vitest.it)('emits 12:00 (noon) correctly in 24h mode', ()=>{
|
|
150
150
|
const onChange = _vitest.vi.fn();
|
|
151
|
-
const { getByTestId } = (0, _react1.render)(
|
|
151
|
+
const { getByTestId } = (0, _react1.render)(_react.createElement(_TimepickerInput.TimepickerInput, {
|
|
152
152
|
disabled: false,
|
|
153
153
|
uses12hClock: false,
|
|
154
154
|
time: "12:00",
|
|
@@ -165,7 +165,7 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
165
165
|
});
|
|
166
166
|
(0, _vitest.it)('emits 13:00 (not 01:00) when user types 13:00 in 24h mode', ()=>{
|
|
167
167
|
const onChange = _vitest.vi.fn();
|
|
168
|
-
const { getByTestId } = (0, _react1.render)(
|
|
168
|
+
const { getByTestId } = (0, _react1.render)(_react.createElement(_TimepickerInput.TimepickerInput, {
|
|
169
169
|
disabled: false,
|
|
170
170
|
uses12hClock: false,
|
|
171
171
|
time: "13:00",
|
|
@@ -184,7 +184,7 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
184
184
|
(0, _vitest.describe)('shorthand input without colon', ()=>{
|
|
185
185
|
(0, _vitest.it)('parses 1005 as 10:05 in 24h mode', ()=>{
|
|
186
186
|
const onChange = _vitest.vi.fn();
|
|
187
|
-
const { getByTestId } = (0, _react1.render)(
|
|
187
|
+
const { getByTestId } = (0, _react1.render)(_react.createElement(_TimepickerInput.TimepickerInput, {
|
|
188
188
|
disabled: false,
|
|
189
189
|
uses12hClock: false,
|
|
190
190
|
time: "00:00",
|
|
@@ -201,7 +201,7 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
201
201
|
});
|
|
202
202
|
(0, _vitest.it)('parses 1900 as 19:00 in 24h mode', ()=>{
|
|
203
203
|
const onChange = _vitest.vi.fn();
|
|
204
|
-
const { getByTestId } = (0, _react1.render)(
|
|
204
|
+
const { getByTestId } = (0, _react1.render)(_react.createElement(_TimepickerInput.TimepickerInput, {
|
|
205
205
|
disabled: false,
|
|
206
206
|
uses12hClock: false,
|
|
207
207
|
time: "00:00",
|
|
@@ -218,7 +218,7 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
218
218
|
});
|
|
219
219
|
(0, _vitest.it)('parses 0700 as 07:00 AM in 12h mode', ()=>{
|
|
220
220
|
const onChange = _vitest.vi.fn();
|
|
221
|
-
const { getByTestId } = (0, _react1.render)(
|
|
221
|
+
const { getByTestId } = (0, _react1.render)(_react.createElement(_TimepickerInput.TimepickerInput, {
|
|
222
222
|
disabled: false,
|
|
223
223
|
uses12hClock: true,
|
|
224
224
|
time: "12:00",
|
|
@@ -237,7 +237,7 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
237
237
|
(0, _vitest.describe)('am/pm without space separator', ()=>{
|
|
238
238
|
(0, _vitest.it)('parses 1:15pm (no space) correctly in 12h mode', ()=>{
|
|
239
239
|
const onChange = _vitest.vi.fn();
|
|
240
|
-
const { getByTestId } = (0, _react1.render)(
|
|
240
|
+
const { getByTestId } = (0, _react1.render)(_react.createElement(_TimepickerInput.TimepickerInput, {
|
|
241
241
|
disabled: false,
|
|
242
242
|
uses12hClock: true,
|
|
243
243
|
time: "12:00",
|
|
@@ -254,7 +254,7 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
254
254
|
});
|
|
255
255
|
(0, _vitest.it)('parses 1:15PM (no space, uppercase) correctly in 12h mode', ()=>{
|
|
256
256
|
const onChange = _vitest.vi.fn();
|
|
257
|
-
const { getByTestId } = (0, _react1.render)(
|
|
257
|
+
const { getByTestId } = (0, _react1.render)(_react.createElement(_TimepickerInput.TimepickerInput, {
|
|
258
258
|
disabled: false,
|
|
259
259
|
uses12hClock: true,
|
|
260
260
|
time: "12:00",
|
|
@@ -271,7 +271,7 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
271
271
|
});
|
|
272
272
|
(0, _vitest.it)('parses 1pm (no space, no minutes) correctly in 12h mode', ()=>{
|
|
273
273
|
const onChange = _vitest.vi.fn();
|
|
274
|
-
const { getByTestId } = (0, _react1.render)(
|
|
274
|
+
const { getByTestId } = (0, _react1.render)(_react.createElement(_TimepickerInput.TimepickerInput, {
|
|
275
275
|
disabled: false,
|
|
276
276
|
uses12hClock: true,
|
|
277
277
|
time: "12:00",
|
|
@@ -290,7 +290,7 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
290
290
|
(0, _vitest.describe)('onChange on blur — 12h mode', ()=>{
|
|
291
291
|
(0, _vitest.it)('emits 07:00 AM correctly in 12h mode', ()=>{
|
|
292
292
|
const onChange = _vitest.vi.fn();
|
|
293
|
-
const { getByTestId } = (0, _react1.render)(
|
|
293
|
+
const { getByTestId } = (0, _react1.render)(_react.createElement(_TimepickerInput.TimepickerInput, {
|
|
294
294
|
disabled: false,
|
|
295
295
|
uses12hClock: true,
|
|
296
296
|
time: "07:00",
|
|
@@ -307,7 +307,7 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
307
307
|
});
|
|
308
308
|
(0, _vitest.it)('emits 07:00 PM correctly in 12h mode', ()=>{
|
|
309
309
|
const onChange = _vitest.vi.fn();
|
|
310
|
-
const { getByTestId } = (0, _react1.render)(
|
|
310
|
+
const { getByTestId } = (0, _react1.render)(_react.createElement(_TimepickerInput.TimepickerInput, {
|
|
311
311
|
disabled: false,
|
|
312
312
|
uses12hClock: true,
|
|
313
313
|
time: "07:00",
|
|
@@ -17,7 +17,7 @@ function _interop_require_default(obj) {
|
|
|
17
17
|
};
|
|
18
18
|
}
|
|
19
19
|
const TimezonepickerInput = ({ disabled, onChange, value = _zoneOffsets.defaultZoneOffset })=>{
|
|
20
|
-
return
|
|
20
|
+
return _react.default.createElement(_f36components.Select, {
|
|
21
21
|
"aria-label": "Select timezone",
|
|
22
22
|
testId: "timezone-input",
|
|
23
23
|
value: value,
|
|
@@ -25,7 +25,7 @@ const TimezonepickerInput = ({ disabled, onChange, value = _zoneOffsets.defaultZ
|
|
|
25
25
|
onChange: (e)=>{
|
|
26
26
|
onChange(e.currentTarget.value);
|
|
27
27
|
}
|
|
28
|
-
}, _zoneOffsets.zoneOffsets.map((offset)
|
|
28
|
+
}, _zoneOffsets.zoneOffsets.map((offset)=>_react.default.createElement(_f36components.Select.Option, {
|
|
29
29
|
key: offset,
|
|
30
30
|
value: offset
|
|
31
31
|
}, "UTC", offset)));
|
package/dist/cjs/index.js
CHANGED
|
@@ -5,14 +5,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
function _export(target, all) {
|
|
6
6
|
for(var name in all)Object.defineProperty(target, name, {
|
|
7
7
|
enumerable: true,
|
|
8
|
-
get: all
|
|
8
|
+
get: Object.getOwnPropertyDescriptor(all, name).get
|
|
9
9
|
});
|
|
10
10
|
}
|
|
11
11
|
_export(exports, {
|
|
12
|
-
DateEditor
|
|
12
|
+
get DateEditor () {
|
|
13
13
|
return _DateEditor.DateEditor;
|
|
14
14
|
},
|
|
15
|
-
zoneOffsets
|
|
15
|
+
get zoneOffsets () {
|
|
16
16
|
return _zoneOffsets.zoneOffsets;
|
|
17
17
|
}
|
|
18
18
|
});
|
package/dist/cjs/utils/date.js
CHANGED
|
@@ -5,20 +5,20 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
function _export(target, all) {
|
|
6
6
|
for(var name in all)Object.defineProperty(target, name, {
|
|
7
7
|
enumerable: true,
|
|
8
|
-
get: all
|
|
8
|
+
get: Object.getOwnPropertyDescriptor(all, name).get
|
|
9
9
|
});
|
|
10
10
|
}
|
|
11
11
|
_export(exports, {
|
|
12
|
-
buildFieldValue
|
|
12
|
+
get buildFieldValue () {
|
|
13
13
|
return buildFieldValue;
|
|
14
14
|
},
|
|
15
|
-
getDefaultAMPM
|
|
15
|
+
get getDefaultAMPM () {
|
|
16
16
|
return getDefaultAMPM;
|
|
17
17
|
},
|
|
18
|
-
getDefaultUtcOffset
|
|
18
|
+
get getDefaultUtcOffset () {
|
|
19
19
|
return getDefaultUtcOffset;
|
|
20
20
|
},
|
|
21
|
-
userInputFromDatetime
|
|
21
|
+
get userInputFromDatetime () {
|
|
22
22
|
return userInputFromDatetime;
|
|
23
23
|
}
|
|
24
24
|
});
|
|
@@ -5,14 +5,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
function _export(target, all) {
|
|
6
6
|
for(var name in all)Object.defineProperty(target, name, {
|
|
7
7
|
enumerable: true,
|
|
8
|
-
get: all
|
|
8
|
+
get: Object.getOwnPropertyDescriptor(all, name).get
|
|
9
9
|
});
|
|
10
10
|
}
|
|
11
11
|
_export(exports, {
|
|
12
|
-
defaultZoneOffset
|
|
12
|
+
get defaultZoneOffset () {
|
|
13
13
|
return defaultZoneOffset;
|
|
14
14
|
},
|
|
15
|
-
zoneOffsets
|
|
15
|
+
get zoneOffsets () {
|
|
16
16
|
return zoneOffsets;
|
|
17
17
|
}
|
|
18
18
|
});
|
package/dist/esm/DateEditor.js
CHANGED
|
@@ -33,10 +33,10 @@ function DateEditorContainer({ initialValue, usesTime, usesTimezone, uses12hCloc
|
|
|
33
33
|
}, [
|
|
34
34
|
value
|
|
35
35
|
]);
|
|
36
|
-
return
|
|
36
|
+
return React.createElement("div", {
|
|
37
37
|
"data-test-id": "date-editor",
|
|
38
38
|
className: styles.root
|
|
39
|
-
},
|
|
39
|
+
}, React.createElement(DatepickerInput, {
|
|
40
40
|
disabled: disabled,
|
|
41
41
|
value: value.date,
|
|
42
42
|
onChange: (date)=>{
|
|
@@ -45,9 +45,9 @@ function DateEditorContainer({ initialValue, usesTime, usesTimezone, uses12hCloc
|
|
|
45
45
|
date
|
|
46
46
|
}));
|
|
47
47
|
}
|
|
48
|
-
}), usesTime &&
|
|
48
|
+
}), usesTime && React.createElement(React.Fragment, null, React.createElement("div", {
|
|
49
49
|
className: styles.separator
|
|
50
|
-
}),
|
|
50
|
+
}), React.createElement(TimepickerInput, {
|
|
51
51
|
disabled: disabled,
|
|
52
52
|
time: value.time,
|
|
53
53
|
ampm: value.ampm,
|
|
@@ -59,9 +59,9 @@ function DateEditorContainer({ initialValue, usesTime, usesTimezone, uses12hCloc
|
|
|
59
59
|
}));
|
|
60
60
|
},
|
|
61
61
|
uses12hClock: uses12hClock
|
|
62
|
-
})), usesTimezone &&
|
|
62
|
+
})), usesTimezone && React.createElement(React.Fragment, null, React.createElement("div", {
|
|
63
63
|
className: styles.separator
|
|
64
|
-
}),
|
|
64
|
+
}), React.createElement(TimezonepickerInput, {
|
|
65
65
|
disabled: disabled,
|
|
66
66
|
value: value.utcOffset,
|
|
67
67
|
onChange: (utcOffset)=>{
|
|
@@ -70,9 +70,9 @@ function DateEditorContainer({ initialValue, usesTime, usesTimezone, uses12hCloc
|
|
|
70
70
|
utcOffset
|
|
71
71
|
}));
|
|
72
72
|
}
|
|
73
|
-
})), hasClear &&
|
|
73
|
+
})), hasClear && React.createElement(React.Fragment, null, React.createElement("div", {
|
|
74
74
|
className: styles.separator
|
|
75
|
-
}),
|
|
75
|
+
}), React.createElement(TextLink, {
|
|
76
76
|
as: "button",
|
|
77
77
|
isDisabled: disabled,
|
|
78
78
|
testId: "date-clear",
|
|
@@ -93,7 +93,7 @@ export function DateEditor(props) {
|
|
|
93
93
|
const usesTime = formatParam !== 'dateonly';
|
|
94
94
|
const usesTimezone = formatParam === 'timeZ';
|
|
95
95
|
const uses12hClock = ampmParam === '12';
|
|
96
|
-
return
|
|
96
|
+
return React.createElement(FieldConnector, {
|
|
97
97
|
field: field,
|
|
98
98
|
isInitiallyDisabled: props.isInitiallyDisabled,
|
|
99
99
|
isDisabled: props.isDisabled,
|
|
@@ -103,7 +103,7 @@ export function DateEditor(props) {
|
|
|
103
103
|
value,
|
|
104
104
|
uses12hClock
|
|
105
105
|
});
|
|
106
|
-
return
|
|
106
|
+
return React.createElement(DateEditorContainer, {
|
|
107
107
|
initialValue: datetimeValue,
|
|
108
108
|
uses12hClock: uses12hClock,
|
|
109
109
|
usesTimezone: usesTimezone,
|
|
@@ -19,7 +19,7 @@ export const DatepickerInput = (props)=>{
|
|
|
19
19
|
];
|
|
20
20
|
}, []);
|
|
21
21
|
const selectedDate = props.value;
|
|
22
|
-
return
|
|
22
|
+
return React.createElement(Datepicker, {
|
|
23
23
|
className: styles.root,
|
|
24
24
|
selected: selectedDate,
|
|
25
25
|
onSelect: (day)=>{
|
|
@@ -64,11 +64,11 @@ export const TimepickerInput = ({ disabled, uses12hClock, time = '00:00', ampm =
|
|
|
64
64
|
uses12hClock,
|
|
65
65
|
onChange
|
|
66
66
|
]);
|
|
67
|
-
return
|
|
67
|
+
return React.createElement(Flex, {
|
|
68
68
|
className: css({
|
|
69
69
|
width: '145px'
|
|
70
70
|
})
|
|
71
|
-
},
|
|
71
|
+
}, React.createElement(TextInput, {
|
|
72
72
|
"aria-label": "Select time",
|
|
73
73
|
placeholder: uses12hClock ? '12:00 AM' : '00:00',
|
|
74
74
|
"date-time-type": uses12hClock ? '12' : '24',
|
|
@@ -9,7 +9,7 @@ configure({
|
|
|
9
9
|
describe('TimepickerInput', ()=>{
|
|
10
10
|
afterEach(cleanup);
|
|
11
11
|
it('renders midnight (00:00) in 24h mode without crashing', ()=>{
|
|
12
|
-
const { getByTestId } = render(
|
|
12
|
+
const { getByTestId } = render(React.createElement(TimepickerInput, {
|
|
13
13
|
disabled: false,
|
|
14
14
|
uses12hClock: false,
|
|
15
15
|
time: "00:00",
|
|
@@ -19,7 +19,7 @@ describe('TimepickerInput', ()=>{
|
|
|
19
19
|
expect(getByTestId('time-input')).toHaveValue('00:00');
|
|
20
20
|
});
|
|
21
21
|
it('defaults to 00:00 in 24h mode when no time prop is provided', ()=>{
|
|
22
|
-
const { getByTestId } = render(
|
|
22
|
+
const { getByTestId } = render(React.createElement(TimepickerInput, {
|
|
23
23
|
disabled: false,
|
|
24
24
|
uses12hClock: false,
|
|
25
25
|
onChange: vi.fn()
|
|
@@ -27,7 +27,7 @@ describe('TimepickerInput', ()=>{
|
|
|
27
27
|
expect(getByTestId('time-input')).toHaveValue('00:00');
|
|
28
28
|
});
|
|
29
29
|
it('defaults to 12:00 AM in 12h mode when no time prop is provided', ()=>{
|
|
30
|
-
const { getByTestId } = render(
|
|
30
|
+
const { getByTestId } = render(React.createElement(TimepickerInput, {
|
|
31
31
|
disabled: false,
|
|
32
32
|
uses12hClock: true,
|
|
33
33
|
onChange: vi.fn()
|
|
@@ -35,7 +35,7 @@ describe('TimepickerInput', ()=>{
|
|
|
35
35
|
expect(getByTestId('time-input')).toHaveValue('12:00 AM');
|
|
36
36
|
});
|
|
37
37
|
it('renders late-night hours (e.g. 23:00) in 24h mode without crashing', ()=>{
|
|
38
|
-
const { getByTestId } = render(
|
|
38
|
+
const { getByTestId } = render(React.createElement(TimepickerInput, {
|
|
39
39
|
disabled: false,
|
|
40
40
|
uses12hClock: false,
|
|
41
41
|
time: "23:00",
|
|
@@ -47,7 +47,7 @@ describe('TimepickerInput', ()=>{
|
|
|
47
47
|
describe('onChange on blur — 24h mode', ()=>{
|
|
48
48
|
it('emits 19:00 (not 07:00) when user types 19:00 in 24h mode', ()=>{
|
|
49
49
|
const onChange = vi.fn();
|
|
50
|
-
const { getByTestId } = render(
|
|
50
|
+
const { getByTestId } = render(React.createElement(TimepickerInput, {
|
|
51
51
|
disabled: false,
|
|
52
52
|
uses12hClock: false,
|
|
53
53
|
time: "19:00",
|
|
@@ -64,7 +64,7 @@ describe('TimepickerInput', ()=>{
|
|
|
64
64
|
});
|
|
65
65
|
it('emits 23:59 (not 11:59) when user types 23:59 in 24h mode', ()=>{
|
|
66
66
|
const onChange = vi.fn();
|
|
67
|
-
const { getByTestId } = render(
|
|
67
|
+
const { getByTestId } = render(React.createElement(TimepickerInput, {
|
|
68
68
|
disabled: false,
|
|
69
69
|
uses12hClock: false,
|
|
70
70
|
time: "23:59",
|
|
@@ -81,7 +81,7 @@ describe('TimepickerInput', ()=>{
|
|
|
81
81
|
});
|
|
82
82
|
it('emits 00:00 when user types 00:00 in 24h mode', ()=>{
|
|
83
83
|
const onChange = vi.fn();
|
|
84
|
-
const { getByTestId } = render(
|
|
84
|
+
const { getByTestId } = render(React.createElement(TimepickerInput, {
|
|
85
85
|
disabled: false,
|
|
86
86
|
uses12hClock: false,
|
|
87
87
|
time: "00:00",
|
|
@@ -98,7 +98,7 @@ describe('TimepickerInput', ()=>{
|
|
|
98
98
|
});
|
|
99
99
|
it('emits 12:00 (noon) correctly in 24h mode', ()=>{
|
|
100
100
|
const onChange = vi.fn();
|
|
101
|
-
const { getByTestId } = render(
|
|
101
|
+
const { getByTestId } = render(React.createElement(TimepickerInput, {
|
|
102
102
|
disabled: false,
|
|
103
103
|
uses12hClock: false,
|
|
104
104
|
time: "12:00",
|
|
@@ -115,7 +115,7 @@ describe('TimepickerInput', ()=>{
|
|
|
115
115
|
});
|
|
116
116
|
it('emits 13:00 (not 01:00) when user types 13:00 in 24h mode', ()=>{
|
|
117
117
|
const onChange = vi.fn();
|
|
118
|
-
const { getByTestId } = render(
|
|
118
|
+
const { getByTestId } = render(React.createElement(TimepickerInput, {
|
|
119
119
|
disabled: false,
|
|
120
120
|
uses12hClock: false,
|
|
121
121
|
time: "13:00",
|
|
@@ -134,7 +134,7 @@ describe('TimepickerInput', ()=>{
|
|
|
134
134
|
describe('shorthand input without colon', ()=>{
|
|
135
135
|
it('parses 1005 as 10:05 in 24h mode', ()=>{
|
|
136
136
|
const onChange = vi.fn();
|
|
137
|
-
const { getByTestId } = render(
|
|
137
|
+
const { getByTestId } = render(React.createElement(TimepickerInput, {
|
|
138
138
|
disabled: false,
|
|
139
139
|
uses12hClock: false,
|
|
140
140
|
time: "00:00",
|
|
@@ -151,7 +151,7 @@ describe('TimepickerInput', ()=>{
|
|
|
151
151
|
});
|
|
152
152
|
it('parses 1900 as 19:00 in 24h mode', ()=>{
|
|
153
153
|
const onChange = vi.fn();
|
|
154
|
-
const { getByTestId } = render(
|
|
154
|
+
const { getByTestId } = render(React.createElement(TimepickerInput, {
|
|
155
155
|
disabled: false,
|
|
156
156
|
uses12hClock: false,
|
|
157
157
|
time: "00:00",
|
|
@@ -168,7 +168,7 @@ describe('TimepickerInput', ()=>{
|
|
|
168
168
|
});
|
|
169
169
|
it('parses 0700 as 07:00 AM in 12h mode', ()=>{
|
|
170
170
|
const onChange = vi.fn();
|
|
171
|
-
const { getByTestId } = render(
|
|
171
|
+
const { getByTestId } = render(React.createElement(TimepickerInput, {
|
|
172
172
|
disabled: false,
|
|
173
173
|
uses12hClock: true,
|
|
174
174
|
time: "12:00",
|
|
@@ -187,7 +187,7 @@ describe('TimepickerInput', ()=>{
|
|
|
187
187
|
describe('am/pm without space separator', ()=>{
|
|
188
188
|
it('parses 1:15pm (no space) correctly in 12h mode', ()=>{
|
|
189
189
|
const onChange = vi.fn();
|
|
190
|
-
const { getByTestId } = render(
|
|
190
|
+
const { getByTestId } = render(React.createElement(TimepickerInput, {
|
|
191
191
|
disabled: false,
|
|
192
192
|
uses12hClock: true,
|
|
193
193
|
time: "12:00",
|
|
@@ -204,7 +204,7 @@ describe('TimepickerInput', ()=>{
|
|
|
204
204
|
});
|
|
205
205
|
it('parses 1:15PM (no space, uppercase) correctly in 12h mode', ()=>{
|
|
206
206
|
const onChange = vi.fn();
|
|
207
|
-
const { getByTestId } = render(
|
|
207
|
+
const { getByTestId } = render(React.createElement(TimepickerInput, {
|
|
208
208
|
disabled: false,
|
|
209
209
|
uses12hClock: true,
|
|
210
210
|
time: "12:00",
|
|
@@ -221,7 +221,7 @@ describe('TimepickerInput', ()=>{
|
|
|
221
221
|
});
|
|
222
222
|
it('parses 1pm (no space, no minutes) correctly in 12h mode', ()=>{
|
|
223
223
|
const onChange = vi.fn();
|
|
224
|
-
const { getByTestId } = render(
|
|
224
|
+
const { getByTestId } = render(React.createElement(TimepickerInput, {
|
|
225
225
|
disabled: false,
|
|
226
226
|
uses12hClock: true,
|
|
227
227
|
time: "12:00",
|
|
@@ -240,7 +240,7 @@ describe('TimepickerInput', ()=>{
|
|
|
240
240
|
describe('onChange on blur — 12h mode', ()=>{
|
|
241
241
|
it('emits 07:00 AM correctly in 12h mode', ()=>{
|
|
242
242
|
const onChange = vi.fn();
|
|
243
|
-
const { getByTestId } = render(
|
|
243
|
+
const { getByTestId } = render(React.createElement(TimepickerInput, {
|
|
244
244
|
disabled: false,
|
|
245
245
|
uses12hClock: true,
|
|
246
246
|
time: "07:00",
|
|
@@ -257,7 +257,7 @@ describe('TimepickerInput', ()=>{
|
|
|
257
257
|
});
|
|
258
258
|
it('emits 07:00 PM correctly in 12h mode', ()=>{
|
|
259
259
|
const onChange = vi.fn();
|
|
260
|
-
const { getByTestId } = render(
|
|
260
|
+
const { getByTestId } = render(React.createElement(TimepickerInput, {
|
|
261
261
|
disabled: false,
|
|
262
262
|
uses12hClock: true,
|
|
263
263
|
time: "07:00",
|
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import { Select } from '@contentful/f36-components';
|
|
3
3
|
import { zoneOffsets, defaultZoneOffset } from './utils/zoneOffsets';
|
|
4
4
|
export const TimezonepickerInput = ({ disabled, onChange, value = defaultZoneOffset })=>{
|
|
5
|
-
return
|
|
5
|
+
return React.createElement(Select, {
|
|
6
6
|
"aria-label": "Select timezone",
|
|
7
7
|
testId: "timezone-input",
|
|
8
8
|
value: value,
|
|
@@ -10,7 +10,7 @@ export const TimezonepickerInput = ({ disabled, onChange, value = defaultZoneOff
|
|
|
10
10
|
onChange: (e)=>{
|
|
11
11
|
onChange(e.currentTarget.value);
|
|
12
12
|
}
|
|
13
|
-
}, zoneOffsets.map((offset)
|
|
13
|
+
}, zoneOffsets.map((offset)=>React.createElement(Select.Option, {
|
|
14
14
|
key: offset,
|
|
15
15
|
value: offset
|
|
16
16
|
}, "UTC", offset)));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contentful/field-editor-date",
|
|
3
|
-
"version": "2.3.5-canary.
|
|
3
|
+
"version": "2.3.5-canary.30+0e4621f9",
|
|
4
4
|
"main": "dist/cjs/index.js",
|
|
5
5
|
"module": "dist/esm/index.js",
|
|
6
6
|
"types": "dist/types/index.d.ts",
|
|
@@ -41,14 +41,14 @@
|
|
|
41
41
|
"dependencies": {
|
|
42
42
|
"@contentful/f36-components": "^6.7.1",
|
|
43
43
|
"@contentful/f36-tokens": "^6.1.2",
|
|
44
|
-
"@contentful/field-editor-shared": "^4.6.3-canary.
|
|
44
|
+
"@contentful/field-editor-shared": "^4.6.3-canary.30+0e4621f9",
|
|
45
45
|
"@emotion/css": "^11.13.5",
|
|
46
46
|
"date-fns": "^2.30.0"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
49
|
"@babel/core": "^7.29.7",
|
|
50
50
|
"@contentful/field-editor-test-utils": "^3.2.1",
|
|
51
|
-
"@lingui/core": "5.
|
|
51
|
+
"@lingui/core": "5.9.5",
|
|
52
52
|
"@types/timezoned-date": "^3.0.2",
|
|
53
53
|
"timezoned-date": "^3.0.2"
|
|
54
54
|
},
|
|
@@ -66,5 +66,5 @@
|
|
|
66
66
|
"prettier --write"
|
|
67
67
|
]
|
|
68
68
|
},
|
|
69
|
-
"gitHead": "
|
|
69
|
+
"gitHead": "0e4621f97b3a6b65da12df50fa740c00bcd17b1f"
|
|
70
70
|
}
|