@vygruppen/spor-react 3.0.3 → 3.0.4
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/.turbo/turbo-build.log +9 -9
- package/CHANGELOG.md +7 -0
- package/dist/{CountryCodeSelect-7ASYXAQD.mjs → CountryCodeSelect-PXKYFQHM.mjs} +1 -1
- package/dist/{chunk-B2RY6AU2.mjs → chunk-ETCK74GR.mjs} +285 -200
- package/dist/index.d.ts +5 -6
- package/dist/index.js +289 -205
- package/dist/index.mjs +1 -1
- package/package.json +1 -1
- package/src/datepicker/DateField.tsx +47 -27
- package/src/datepicker/DatePicker.tsx +122 -107
- package/src/datepicker/DateTimeSegment.tsx +41 -32
- package/src/input/Combobox.tsx +1 -0
- package/src/input/Popover.tsx +7 -1
package/dist/index.js
CHANGED
@@ -1094,26 +1094,30 @@ var init_card = __esm({
|
|
1094
1094
|
});
|
1095
1095
|
function $458b0a5536c1a7cf$export$40bfa8c7b0832715(value, defaultValue, onChange) {
|
1096
1096
|
let [stateValue, setStateValue] = (React49.useState)(value || defaultValue);
|
1097
|
-
let
|
1098
|
-
let wasControlled = ref.current;
|
1097
|
+
let isControlledRef = (React49.useRef)(value !== void 0);
|
1099
1098
|
let isControlled = value !== void 0;
|
1100
|
-
|
1101
|
-
|
1102
|
-
|
1103
|
-
|
1099
|
+
(React49.useEffect)(() => {
|
1100
|
+
let wasControlled = isControlledRef.current;
|
1101
|
+
if (wasControlled !== isControlled)
|
1102
|
+
console.warn(`WARN: A component changed from ${wasControlled ? "controlled" : "uncontrolled"} to ${isControlled ? "controlled" : "uncontrolled"}.`);
|
1103
|
+
isControlledRef.current = isControlled;
|
1104
|
+
}, [
|
1105
|
+
isControlled
|
1106
|
+
]);
|
1107
|
+
let currentValue = isControlled ? value : stateValue;
|
1104
1108
|
let setValue = (React49.useCallback)((value2, ...args) => {
|
1105
1109
|
let onChangeCaller = (value3, ...onChangeArgs) => {
|
1106
1110
|
if (onChange) {
|
1107
|
-
if (!Object.is(
|
1111
|
+
if (!Object.is(currentValue, value3))
|
1108
1112
|
onChange(value3, ...onChangeArgs);
|
1109
1113
|
}
|
1110
1114
|
if (!isControlled)
|
1111
|
-
|
1115
|
+
currentValue = value3;
|
1112
1116
|
};
|
1113
1117
|
if (typeof value2 === "function") {
|
1114
1118
|
console.warn("We can not support a function callback. See Github Issues for details https://github.com/adobe/react-spectrum/issues/2320");
|
1115
1119
|
let updateFunction = (oldValue, ...functionArgs) => {
|
1116
|
-
let interceptedValue = value2(isControlled ?
|
1120
|
+
let interceptedValue = value2(isControlled ? currentValue : oldValue, ...functionArgs);
|
1117
1121
|
onChangeCaller(interceptedValue, ...args);
|
1118
1122
|
if (!isControlled)
|
1119
1123
|
return interceptedValue;
|
@@ -1127,14 +1131,11 @@ function $458b0a5536c1a7cf$export$40bfa8c7b0832715(value, defaultValue, onChange
|
|
1127
1131
|
}
|
1128
1132
|
}, [
|
1129
1133
|
isControlled,
|
1134
|
+
currentValue,
|
1130
1135
|
onChange
|
1131
1136
|
]);
|
1132
|
-
if (isControlled)
|
1133
|
-
stateRef.current = value;
|
1134
|
-
else
|
1135
|
-
value = stateValue;
|
1136
1137
|
return [
|
1137
|
-
|
1138
|
+
currentValue,
|
1138
1139
|
setValue
|
1139
1140
|
];
|
1140
1141
|
}
|
@@ -1142,22 +1143,30 @@ var init_import = __esm({
|
|
1142
1143
|
"../../node_modules/@react-stately/utils/dist/import.mjs"() {
|
1143
1144
|
}
|
1144
1145
|
});
|
1145
|
-
|
1146
|
-
// ../../node_modules/@react-stately/overlays/dist/import.mjs
|
1147
1146
|
function $fc909762b330b746$export$61c6a8c84e605fb6(props) {
|
1148
1147
|
let [isOpen, setOpen] = ($458b0a5536c1a7cf$export$40bfa8c7b0832715)(props.isOpen, props.defaultOpen || false, props.onOpenChange);
|
1148
|
+
const open = (React49.useCallback)(() => {
|
1149
|
+
setOpen(true);
|
1150
|
+
}, [
|
1151
|
+
setOpen
|
1152
|
+
]);
|
1153
|
+
const close = (React49.useCallback)(() => {
|
1154
|
+
setOpen(false);
|
1155
|
+
}, [
|
1156
|
+
setOpen
|
1157
|
+
]);
|
1158
|
+
const toggle = (React49.useCallback)(() => {
|
1159
|
+
setOpen(!isOpen);
|
1160
|
+
}, [
|
1161
|
+
setOpen,
|
1162
|
+
isOpen
|
1163
|
+
]);
|
1149
1164
|
return {
|
1150
1165
|
isOpen,
|
1151
1166
|
setOpen,
|
1152
|
-
open
|
1153
|
-
|
1154
|
-
|
1155
|
-
close() {
|
1156
|
-
setOpen(false);
|
1157
|
-
},
|
1158
|
-
toggle() {
|
1159
|
-
setOpen(!isOpen);
|
1160
|
-
}
|
1167
|
+
open,
|
1168
|
+
close,
|
1169
|
+
toggle
|
1161
1170
|
};
|
1162
1171
|
}
|
1163
1172
|
var init_import2 = __esm({
|
@@ -1213,8 +1222,9 @@ function $35a22f14a1f04b11$export$eac50920cf2fd59a(value, minValue, maxValue) {
|
|
1213
1222
|
return value != null && (minValue != null && value.compare(minValue) < 0 || maxValue != null && value.compare(maxValue) > 0);
|
1214
1223
|
}
|
1215
1224
|
function $35a22f14a1f04b11$export$7e319ea407e63bc0(fieldOptions, options) {
|
1225
|
+
let defaultFieldOptions = options.shouldForceLeadingZeros ? $35a22f14a1f04b11$var$TWO_DIGIT_FIELD_OPTIONS : $35a22f14a1f04b11$var$DEFAULT_FIELD_OPTIONS;
|
1216
1226
|
fieldOptions = {
|
1217
|
-
|
1227
|
+
...defaultFieldOptions,
|
1218
1228
|
...fieldOptions
|
1219
1229
|
};
|
1220
1230
|
let granularity = options.granularity || "minute";
|
@@ -1270,17 +1280,25 @@ function $35a22f14a1f04b11$export$66aa2b09de4b1ea5(placeholderValue, granularity
|
|
1270
1280
|
return date$1;
|
1271
1281
|
}
|
1272
1282
|
function $35a22f14a1f04b11$export$2440da353cedad43(v, granularity) {
|
1273
|
-
let lastValue = (React49.useRef)(v);
|
1274
|
-
if (v)
|
1275
|
-
lastValue.current = v;
|
1276
|
-
v = lastValue.current;
|
1277
1283
|
let defaultTimeZone = v && "timeZone" in v ? v.timeZone : void 0;
|
1278
|
-
|
1279
|
-
if (v && !(granularity in v))
|
1284
|
+
let defaultGranularity = v && "minute" in v ? "minute" : "day";
|
1285
|
+
if (v && granularity && !(granularity in v))
|
1280
1286
|
throw new Error("Invalid granularity " + granularity + " for value " + v.toString());
|
1287
|
+
let [lastValue, setLastValue] = (React49.useState)([
|
1288
|
+
defaultGranularity,
|
1289
|
+
defaultTimeZone
|
1290
|
+
]);
|
1291
|
+
if (v && (lastValue[0] !== defaultGranularity || lastValue[1] !== defaultTimeZone))
|
1292
|
+
setLastValue([
|
1293
|
+
defaultGranularity,
|
1294
|
+
defaultTimeZone
|
1295
|
+
]);
|
1296
|
+
if (!granularity)
|
1297
|
+
granularity = v ? defaultGranularity : lastValue[0];
|
1298
|
+
let timeZone = v ? defaultTimeZone : lastValue[1];
|
1281
1299
|
return [
|
1282
1300
|
granularity,
|
1283
|
-
|
1301
|
+
timeZone
|
1284
1302
|
];
|
1285
1303
|
}
|
1286
1304
|
function $ab5bf3f618090389$export$87194bb378cc3ac2(props) {
|
@@ -1320,7 +1338,7 @@ function $ab5bf3f618090389$export$87194bb378cc3ac2(props) {
|
|
1320
1338
|
overlayState.setOpen(false);
|
1321
1339
|
};
|
1322
1340
|
let selectTime = (newValue) => {
|
1323
|
-
if (selectedDate)
|
1341
|
+
if (selectedDate && newValue)
|
1324
1342
|
commitValue(selectedDate, newValue);
|
1325
1343
|
else
|
1326
1344
|
setSelectedTime(newValue);
|
@@ -1393,11 +1411,13 @@ function $3c0fc76039f1c516$export$60e84778edff6d26(props) {
|
|
1393
1411
|
timeZone: defaultTimeZone,
|
1394
1412
|
hideTimeZone,
|
1395
1413
|
hourCycle: props.hourCycle,
|
1396
|
-
showEra
|
1414
|
+
showEra,
|
1415
|
+
shouldForceLeadingZeros: props.shouldForceLeadingZeros
|
1397
1416
|
}), [
|
1398
1417
|
props.maxGranularity,
|
1399
1418
|
granularity,
|
1400
1419
|
props.hourCycle,
|
1420
|
+
props.shouldForceLeadingZeros,
|
1401
1421
|
defaultTimeZone,
|
1402
1422
|
hideTimeZone,
|
1403
1423
|
showEra
|
@@ -1702,11 +1722,11 @@ function $3c0fc76039f1c516$var$setSegment(value, part, segmentValue, options) {
|
|
1702
1722
|
}
|
1703
1723
|
case "hour":
|
1704
1724
|
if (options.hour12) {
|
1705
|
-
let
|
1706
|
-
let
|
1707
|
-
if (!
|
1725
|
+
let hours = value.hour;
|
1726
|
+
let wasPM = hours >= 12;
|
1727
|
+
if (!wasPM && segmentValue === 12)
|
1708
1728
|
segmentValue = 0;
|
1709
|
-
if (
|
1729
|
+
if (wasPM && segmentValue < 12)
|
1710
1730
|
segmentValue += 12;
|
1711
1731
|
}
|
1712
1732
|
case "minute":
|
@@ -1851,11 +1871,11 @@ function $93c38a5e28be6249$export$e50a61c1de9f574(props) {
|
|
1851
1871
|
}
|
1852
1872
|
let start = "";
|
1853
1873
|
let end = "";
|
1854
|
-
for (let
|
1855
|
-
if (
|
1856
|
-
start += parts14[
|
1857
|
-
else if (
|
1858
|
-
end += parts14[
|
1874
|
+
for (let i = 0; i < parts14.length; i++) {
|
1875
|
+
if (i < separatorIndex)
|
1876
|
+
start += parts14[i].value;
|
1877
|
+
else if (i > separatorIndex)
|
1878
|
+
end += parts14[i].value;
|
1859
1879
|
}
|
1860
1880
|
return {
|
1861
1881
|
start,
|
@@ -1880,7 +1900,7 @@ function $93c38a5e28be6249$export$e50a61c1de9f574(props) {
|
|
1880
1900
|
}
|
1881
1901
|
};
|
1882
1902
|
}
|
1883
|
-
var $35a22f14a1f04b11$var$DEFAULT_FIELD_OPTIONS, $3e3ed55ab2966714$var$placeholders, $3c0fc76039f1c516$var$EDITABLE_SEGMENTS, $3c0fc76039f1c516$var$PAGE_STEP, $3c0fc76039f1c516$var$TYPE_MAPPING;
|
1903
|
+
var $35a22f14a1f04b11$var$DEFAULT_FIELD_OPTIONS, $35a22f14a1f04b11$var$TWO_DIGIT_FIELD_OPTIONS, $3e3ed55ab2966714$var$placeholders, $3c0fc76039f1c516$var$EDITABLE_SEGMENTS, $3c0fc76039f1c516$var$PAGE_STEP, $3c0fc76039f1c516$var$TYPE_MAPPING;
|
1884
1904
|
var init_import4 = __esm({
|
1885
1905
|
"../../node_modules/@react-stately/datepicker/dist/import.mjs"() {
|
1886
1906
|
init_import2();
|
@@ -1894,6 +1914,14 @@ var init_import4 = __esm({
|
|
1894
1914
|
minute: "2-digit",
|
1895
1915
|
second: "2-digit"
|
1896
1916
|
};
|
1917
|
+
$35a22f14a1f04b11$var$TWO_DIGIT_FIELD_OPTIONS = {
|
1918
|
+
year: "numeric",
|
1919
|
+
month: "2-digit",
|
1920
|
+
day: "2-digit",
|
1921
|
+
hour: "2-digit",
|
1922
|
+
minute: "2-digit",
|
1923
|
+
second: "2-digit"
|
1924
|
+
};
|
1897
1925
|
$3e3ed55ab2966714$var$placeholders = new ($5b160d28a433310d$export$c17fa47878dc55b6)({
|
1898
1926
|
ach: {
|
1899
1927
|
year: "mwaka",
|
@@ -2365,7 +2393,7 @@ function $131cf43a05231e1e$export$6d095e787d2b5e1f(props) {
|
|
2365
2393
|
]);
|
2366
2394
|
let { locale, createCalendar: createCalendar4, visibleDuration = {
|
2367
2395
|
months: 1
|
2368
|
-
}, minValue, maxValue, selectionAlignment, isDateUnavailable } = props;
|
2396
|
+
}, minValue, maxValue, selectionAlignment, isDateUnavailable, pageBehavior = "visible" } = props;
|
2369
2397
|
let calendar = (React49.useMemo)(() => createCalendar4(resolvedOptions.calendar), [
|
2370
2398
|
createCalendar4,
|
2371
2399
|
resolvedOptions.calendar
|
@@ -2419,12 +2447,12 @@ function $131cf43a05231e1e$export$6d095e787d2b5e1f(props) {
|
|
2419
2447
|
startDate,
|
2420
2448
|
visibleDuration
|
2421
2449
|
]);
|
2422
|
-
let lastCalendarIdentifier = (React49.
|
2423
|
-
if (calendar.identifier !== lastCalendarIdentifier
|
2450
|
+
let [lastCalendarIdentifier, setLastCalendarIdentifier] = (React49.useState)(calendar.identifier);
|
2451
|
+
if (calendar.identifier !== lastCalendarIdentifier) {
|
2424
2452
|
let newFocusedDate = (date.toCalendar)(focusedDate, calendar);
|
2425
2453
|
setStartDate(($f62d864046160412$export$f4a51ff076cc9a09)(newFocusedDate, visibleDuration, locale, minValue, maxValue));
|
2426
2454
|
setFocusedDate(newFocusedDate);
|
2427
|
-
|
2455
|
+
setLastCalendarIdentifier(calendar.identifier);
|
2428
2456
|
}
|
2429
2457
|
if (($f62d864046160412$export$eac50920cf2fd59a)(focusedDate, minValue, maxValue))
|
2430
2458
|
setFocusedDate(($f62d864046160412$export$4f5203c0d889109e)(focusedDate, minValue, maxValue));
|
@@ -2462,6 +2490,14 @@ function $131cf43a05231e1e$export$6d095e787d2b5e1f(props) {
|
|
2462
2490
|
maxValue
|
2463
2491
|
]);
|
2464
2492
|
let validationState = props.validationState || (isUnavailable ? "invalid" : null);
|
2493
|
+
let pageDuration = (React49.useMemo)(() => {
|
2494
|
+
if (pageBehavior === "visible")
|
2495
|
+
return visibleDuration;
|
2496
|
+
return $131cf43a05231e1e$var$unitDuration(visibleDuration);
|
2497
|
+
}, [
|
2498
|
+
pageBehavior,
|
2499
|
+
visibleDuration
|
2500
|
+
]);
|
2465
2501
|
return {
|
2466
2502
|
isDisabled: props.isDisabled,
|
2467
2503
|
isReadOnly: props.isReadOnly,
|
@@ -2507,14 +2543,14 @@ function $131cf43a05231e1e$export$6d095e787d2b5e1f(props) {
|
|
2507
2543
|
}));
|
2508
2544
|
},
|
2509
2545
|
focusNextPage() {
|
2510
|
-
let start = startDate.add(
|
2511
|
-
setFocusedDate(($f62d864046160412$export$4f5203c0d889109e)(focusedDate.add(
|
2512
|
-
setStartDate(($f62d864046160412$export$144a00ba6044eb9)(($f62d864046160412$export$5bb865b12696a77d)(focusedDate, start,
|
2546
|
+
let start = startDate.add(pageDuration);
|
2547
|
+
setFocusedDate(($f62d864046160412$export$4f5203c0d889109e)(focusedDate.add(pageDuration), minValue, maxValue));
|
2548
|
+
setStartDate(($f62d864046160412$export$144a00ba6044eb9)(($f62d864046160412$export$5bb865b12696a77d)(focusedDate, start, pageDuration, locale, minValue, maxValue), pageDuration, locale));
|
2513
2549
|
},
|
2514
2550
|
focusPreviousPage() {
|
2515
|
-
let start = startDate.subtract(
|
2516
|
-
setFocusedDate(($f62d864046160412$export$4f5203c0d889109e)(focusedDate.subtract(
|
2517
|
-
setStartDate(($f62d864046160412$export$144a00ba6044eb9)(($f62d864046160412$export$5bb865b12696a77d)(focusedDate, start,
|
2551
|
+
let start = startDate.subtract(pageDuration);
|
2552
|
+
setFocusedDate(($f62d864046160412$export$4f5203c0d889109e)(focusedDate.subtract(pageDuration), minValue, maxValue));
|
2553
|
+
setStartDate(($f62d864046160412$export$144a00ba6044eb9)(($f62d864046160412$export$5bb865b12696a77d)(focusedDate, start, pageDuration, locale, minValue, maxValue), pageDuration, locale));
|
2518
2554
|
},
|
2519
2555
|
focusSectionStart() {
|
2520
2556
|
if (visibleDuration.days)
|
@@ -2682,10 +2718,10 @@ function $9a36b6ba2fb1a7c5$export$9a987164d97ecc90(props) {
|
|
2682
2718
|
setAvailableRange(null);
|
2683
2719
|
}
|
2684
2720
|
};
|
2685
|
-
let lastVisibleRange = (React49.
|
2686
|
-
if (!(date.isEqualDay)(calendar.visibleRange.start, lastVisibleRange.
|
2721
|
+
let [lastVisibleRange, setLastVisibleRange] = (React49.useState)(calendar.visibleRange);
|
2722
|
+
if (!(date.isEqualDay)(calendar.visibleRange.start, lastVisibleRange.start) || !(date.isEqualDay)(calendar.visibleRange.end, lastVisibleRange.end)) {
|
2687
2723
|
updateAvailableRange(anchorDate);
|
2688
|
-
|
2724
|
+
setLastVisibleRange(calendar.visibleRange);
|
2689
2725
|
}
|
2690
2726
|
let setAnchorDate = (date) => {
|
2691
2727
|
if (date) {
|
@@ -3188,37 +3224,44 @@ var init_CalendarTriggerButton = __esm({
|
|
3188
3224
|
var DateTimeSegment, isPaddable;
|
3189
3225
|
var init_DateTimeSegment = __esm({
|
3190
3226
|
"src/datepicker/DateTimeSegment.tsx"() {
|
3191
|
-
DateTimeSegment = (
|
3192
|
-
|
3193
|
-
|
3194
|
-
|
3195
|
-
|
3196
|
-
|
3197
|
-
|
3198
|
-
|
3199
|
-
|
3200
|
-
{
|
3201
|
-
|
3202
|
-
|
3203
|
-
|
3204
|
-
|
3205
|
-
|
3206
|
-
|
3227
|
+
DateTimeSegment = React49.forwardRef(
|
3228
|
+
({ segment, state: state2 }, externalRef) => {
|
3229
|
+
const internalRef = React49.useRef(null);
|
3230
|
+
const ref = externalRef ?? internalRef;
|
3231
|
+
const { segmentProps } = reactAria.useDateSegment(
|
3232
|
+
segment,
|
3233
|
+
state2,
|
3234
|
+
ref
|
3235
|
+
);
|
3236
|
+
const styles2 = react.useMultiStyleConfig("Datepicker", {
|
3237
|
+
isPlaceholder: segment.isPlaceholder,
|
3238
|
+
isEditable: segment.isEditable
|
3239
|
+
});
|
3240
|
+
return /* @__PURE__ */ React49__namespace.default.createElement(
|
3241
|
+
react.Box,
|
3242
|
+
{
|
3243
|
+
...segmentProps,
|
3244
|
+
ref,
|
3245
|
+
style: {
|
3246
|
+
...segmentProps.style,
|
3247
|
+
fontVariantNumeric: "tabular-nums",
|
3248
|
+
boxSizing: "content-box"
|
3249
|
+
},
|
3250
|
+
paddingX: "1px",
|
3251
|
+
textAlign: "end",
|
3252
|
+
outline: "none",
|
3253
|
+
borderRadius: "xs",
|
3254
|
+
fontSize: "mobile.md",
|
3255
|
+
sx: styles2.dateTimeSegment,
|
3256
|
+
_focus: {
|
3257
|
+
backgroundColor: "darkTeal",
|
3258
|
+
color: "white"
|
3259
|
+
}
|
3207
3260
|
},
|
3208
|
-
|
3209
|
-
|
3210
|
-
|
3211
|
-
|
3212
|
-
fontSize: "mobile.md",
|
3213
|
-
sx: styles2.dateTimeSegment,
|
3214
|
-
_focus: {
|
3215
|
-
backgroundColor: "darkTeal",
|
3216
|
-
color: "white"
|
3217
|
-
}
|
3218
|
-
},
|
3219
|
-
isPaddable(segment.type) ? segment.text.padStart(2, "0") : segment.text
|
3220
|
-
);
|
3221
|
-
};
|
3261
|
+
isPaddable(segment.type) ? segment.text.padStart(2, "0") : segment.text
|
3262
|
+
);
|
3263
|
+
}
|
3264
|
+
);
|
3222
3265
|
isPaddable = (segmentType) => segmentType === "month" || segmentType === "day" || segmentType === "hour" || segmentType === "minute" || segmentType === "second";
|
3223
3266
|
}
|
3224
3267
|
});
|
@@ -3230,24 +3273,55 @@ function createCalendar2(identifier) {
|
|
3230
3273
|
throw new Error(`Unsupported calendar ${identifier}`);
|
3231
3274
|
}
|
3232
3275
|
}
|
3233
|
-
|
3234
|
-
var _a6;
|
3235
|
-
const locale = useCurrentLocale();
|
3236
|
-
const styles2 = react.useMultiStyleConfig("Datepicker", {});
|
3237
|
-
const state2 = $3c0fc76039f1c516$export$60e84778edff6d26({
|
3238
|
-
...props,
|
3239
|
-
locale,
|
3240
|
-
createCalendar: createCalendar2
|
3241
|
-
});
|
3242
|
-
const ref = React49.useRef(null);
|
3243
|
-
const { fieldProps, labelProps } = reactAria.useDateField(props, state2, ref);
|
3244
|
-
return /* @__PURE__ */ React49__namespace.default.createElement(react.Box, { minWidth: "6rem", width: "100%" }, props.label && /* @__PURE__ */ React49__namespace.default.createElement(react.FormLabel, { ...props.labelProps, ...labelProps, sx: styles2.inputLabel }, props.label), /* @__PURE__ */ React49__namespace.default.createElement(react.Flex, { ...fieldProps, ref }, state2.segments.map((segment, i) => /* @__PURE__ */ React49__namespace.default.createElement(DateTimeSegment, { key: i, segment, state: state2 }))), /* @__PURE__ */ React49__namespace.default.createElement("input", { type: "hidden", value: (_a6 = state2.value) == null ? void 0 : _a6.toString(), name: props.name }));
|
3245
|
-
}
|
3276
|
+
var DateField;
|
3246
3277
|
var init_DateField = __esm({
|
3247
3278
|
"src/datepicker/DateField.tsx"() {
|
3248
3279
|
init_import4();
|
3249
3280
|
init_DateTimeSegment();
|
3250
3281
|
init_utils();
|
3282
|
+
DateField = React49.forwardRef(
|
3283
|
+
(props, externalRef) => {
|
3284
|
+
var _a6;
|
3285
|
+
const locale = useCurrentLocale();
|
3286
|
+
const styles2 = react.useMultiStyleConfig("Datepicker", {});
|
3287
|
+
const state2 = $3c0fc76039f1c516$export$60e84778edff6d26({
|
3288
|
+
...props,
|
3289
|
+
locale,
|
3290
|
+
createCalendar: createCalendar2
|
3291
|
+
});
|
3292
|
+
const internalRef = React49.useRef(null);
|
3293
|
+
const ref = externalRef ?? internalRef;
|
3294
|
+
const { fieldProps, labelProps } = reactAria.useDateField(
|
3295
|
+
props,
|
3296
|
+
state2,
|
3297
|
+
ref
|
3298
|
+
);
|
3299
|
+
return /* @__PURE__ */ React49__namespace.default.createElement(react.Box, { minWidth: "6rem", width: "100%" }, props.label && /* @__PURE__ */ React49__namespace.default.createElement(
|
3300
|
+
react.FormLabel,
|
3301
|
+
{
|
3302
|
+
...props.labelProps,
|
3303
|
+
...labelProps,
|
3304
|
+
sx: styles2.inputLabel
|
3305
|
+
},
|
3306
|
+
props.label
|
3307
|
+
), /* @__PURE__ */ React49__namespace.default.createElement(react.Flex, { ...fieldProps }, state2.segments.map((segment, i) => /* @__PURE__ */ React49__namespace.default.createElement(
|
3308
|
+
DateTimeSegment,
|
3309
|
+
{
|
3310
|
+
ref: i === 0 ? ref : void 0,
|
3311
|
+
key: i,
|
3312
|
+
segment,
|
3313
|
+
state: state2
|
3314
|
+
}
|
3315
|
+
))), /* @__PURE__ */ React49__namespace.default.createElement(
|
3316
|
+
"input",
|
3317
|
+
{
|
3318
|
+
type: "hidden",
|
3319
|
+
value: (_a6 = state2.value) == null ? void 0 : _a6.toString(),
|
3320
|
+
name: props.name
|
3321
|
+
}
|
3322
|
+
));
|
3323
|
+
}
|
3324
|
+
);
|
3251
3325
|
}
|
3252
3326
|
});
|
3253
3327
|
var StyledField;
|
@@ -3273,106 +3347,7 @@ var init_StyledField = __esm({
|
|
3273
3347
|
);
|
3274
3348
|
}
|
3275
3349
|
});
|
3276
|
-
|
3277
|
-
variant,
|
3278
|
-
errorMessage,
|
3279
|
-
minHeight,
|
3280
|
-
showYearNavigation,
|
3281
|
-
width = "auto",
|
3282
|
-
...props
|
3283
|
-
}) {
|
3284
|
-
const formControlProps = react.useFormControlContext();
|
3285
|
-
const state2 = $ab5bf3f618090389$export$87194bb378cc3ac2({
|
3286
|
-
...props,
|
3287
|
-
shouldCloseOnSelect: true,
|
3288
|
-
errorMessage,
|
3289
|
-
isRequired: props.isRequired ?? (formControlProps == null ? void 0 : formControlProps.isRequired),
|
3290
|
-
validationState: (formControlProps == null ? void 0 : formControlProps.isInvalid) ? "invalid" : "valid"
|
3291
|
-
});
|
3292
|
-
const ref = React49.useRef(null);
|
3293
|
-
const {
|
3294
|
-
groupProps,
|
3295
|
-
labelProps,
|
3296
|
-
fieldProps,
|
3297
|
-
buttonProps,
|
3298
|
-
dialogProps,
|
3299
|
-
calendarProps,
|
3300
|
-
errorMessageProps
|
3301
|
-
} = reactAria.useDatePicker(props, state2, ref);
|
3302
|
-
const responsiveVariant = react.useBreakpointValue(typeof variant === "string" ? [variant] : variant) ?? "simple";
|
3303
|
-
const locale = useCurrentLocale();
|
3304
|
-
const handleEnterClick = (e) => {
|
3305
|
-
if (responsiveVariant === "simple" && e.key === "Enter" && !state2.isOpen) {
|
3306
|
-
e.stopPropagation();
|
3307
|
-
state2.setOpen(true);
|
3308
|
-
}
|
3309
|
-
};
|
3310
|
-
const onFieldClick = () => {
|
3311
|
-
if (!hasTrigger) {
|
3312
|
-
state2.setOpen(true);
|
3313
|
-
}
|
3314
|
-
};
|
3315
|
-
const hasTrigger = responsiveVariant === "with-trigger";
|
3316
|
-
const styles2 = react.useMultiStyleConfig("Datepicker", {});
|
3317
|
-
return /* @__PURE__ */ React49__namespace.default.createElement(reactAria.I18nProvider, { locale }, /* @__PURE__ */ React49__namespace.default.createElement(
|
3318
|
-
react.Box,
|
3319
|
-
{
|
3320
|
-
position: "relative",
|
3321
|
-
display: "inline-flex",
|
3322
|
-
flexDirection: "column",
|
3323
|
-
width
|
3324
|
-
},
|
3325
|
-
/* @__PURE__ */ React49__namespace.default.createElement(
|
3326
|
-
react.Popover,
|
3327
|
-
{
|
3328
|
-
...dialogProps,
|
3329
|
-
isOpen: state2.isOpen,
|
3330
|
-
onClose: () => state2.setOpen(false),
|
3331
|
-
onOpen: () => state2.setOpen(true),
|
3332
|
-
closeOnBlur: true,
|
3333
|
-
closeOnEsc: true,
|
3334
|
-
returnFocusOnClose: true
|
3335
|
-
},
|
3336
|
-
/* @__PURE__ */ React49__namespace.default.createElement(react.InputGroup, { ...groupProps, ref, display: "inline-flex" }, /* @__PURE__ */ React49__namespace.default.createElement(react.PopoverAnchor, null, /* @__PURE__ */ React49__namespace.default.createElement(
|
3337
|
-
StyledField,
|
3338
|
-
{
|
3339
|
-
variant: responsiveVariant,
|
3340
|
-
onClick: onFieldClick,
|
3341
|
-
onKeyPress: handleEnterClick,
|
3342
|
-
paddingX: 3,
|
3343
|
-
minHeight
|
3344
|
-
},
|
3345
|
-
!hasTrigger && /* @__PURE__ */ React49__namespace.default.createElement(sporIconReact.CalendarOutline24Icon, { marginRight: 2, alignSelf: "center" }),
|
3346
|
-
/* @__PURE__ */ React49__namespace.default.createElement(
|
3347
|
-
DateField,
|
3348
|
-
{
|
3349
|
-
label: props.label,
|
3350
|
-
labelProps,
|
3351
|
-
name: props.name,
|
3352
|
-
...fieldProps
|
3353
|
-
}
|
3354
|
-
)
|
3355
|
-
)), hasTrigger && /* @__PURE__ */ React49__namespace.default.createElement(CalendarTriggerButton, { ...buttonProps })),
|
3356
|
-
/* @__PURE__ */ React49__namespace.default.createElement(exports.FormErrorMessage, { ...errorMessageProps }, errorMessage),
|
3357
|
-
state2.isOpen && !props.isDisabled && /* @__PURE__ */ React49__namespace.default.createElement(react.Portal, null, /* @__PURE__ */ React49__namespace.default.createElement(
|
3358
|
-
react.PopoverContent,
|
3359
|
-
{
|
3360
|
-
color: "darkGrey",
|
3361
|
-
boxShadow: "md",
|
3362
|
-
sx: styles2.calendar
|
3363
|
-
},
|
3364
|
-
/* @__PURE__ */ React49__namespace.default.createElement(react.PopoverArrow, { sx: styles2.arrow }),
|
3365
|
-
/* @__PURE__ */ React49__namespace.default.createElement(react.PopoverBody, null, /* @__PURE__ */ React49__namespace.default.createElement(
|
3366
|
-
Calendar,
|
3367
|
-
{
|
3368
|
-
...calendarProps,
|
3369
|
-
showYearNavigation
|
3370
|
-
}
|
3371
|
-
))
|
3372
|
-
))
|
3373
|
-
)
|
3374
|
-
));
|
3375
|
-
}
|
3350
|
+
exports.DatePicker = void 0;
|
3376
3351
|
var init_DatePicker = __esm({
|
3377
3352
|
"src/datepicker/DatePicker.tsx"() {
|
3378
3353
|
init_import4();
|
@@ -3382,6 +3357,114 @@ var init_DatePicker = __esm({
|
|
3382
3357
|
init_DateField();
|
3383
3358
|
init_StyledField();
|
3384
3359
|
init_utils();
|
3360
|
+
exports.DatePicker = React49.forwardRef(
|
3361
|
+
({
|
3362
|
+
variant,
|
3363
|
+
errorMessage,
|
3364
|
+
minHeight,
|
3365
|
+
showYearNavigation,
|
3366
|
+
width = "auto",
|
3367
|
+
...props
|
3368
|
+
}, externalRef) => {
|
3369
|
+
const formControlProps = react.useFormControlContext();
|
3370
|
+
const state2 = $ab5bf3f618090389$export$87194bb378cc3ac2({
|
3371
|
+
...props,
|
3372
|
+
shouldCloseOnSelect: true,
|
3373
|
+
errorMessage,
|
3374
|
+
isRequired: props.isRequired ?? (formControlProps == null ? void 0 : formControlProps.isRequired),
|
3375
|
+
validationState: (formControlProps == null ? void 0 : formControlProps.isInvalid) ? "invalid" : "valid"
|
3376
|
+
});
|
3377
|
+
const internalRef = React49.useRef(null);
|
3378
|
+
const ref = externalRef ?? internalRef;
|
3379
|
+
const {
|
3380
|
+
groupProps,
|
3381
|
+
labelProps,
|
3382
|
+
fieldProps,
|
3383
|
+
buttonProps,
|
3384
|
+
dialogProps,
|
3385
|
+
calendarProps,
|
3386
|
+
errorMessageProps
|
3387
|
+
} = reactAria.useDatePicker(
|
3388
|
+
props,
|
3389
|
+
state2,
|
3390
|
+
ref
|
3391
|
+
);
|
3392
|
+
const responsiveVariant = react.useBreakpointValue(typeof variant === "string" ? [variant] : variant) ?? "simple";
|
3393
|
+
const locale = useCurrentLocale();
|
3394
|
+
const handleEnterClick = (e) => {
|
3395
|
+
if (responsiveVariant === "simple" && e.key === "Enter" && !state2.isOpen) {
|
3396
|
+
e.stopPropagation();
|
3397
|
+
state2.setOpen(true);
|
3398
|
+
}
|
3399
|
+
};
|
3400
|
+
const onFieldClick = () => {
|
3401
|
+
if (!hasTrigger) {
|
3402
|
+
state2.setOpen(true);
|
3403
|
+
}
|
3404
|
+
};
|
3405
|
+
const hasTrigger = responsiveVariant === "with-trigger";
|
3406
|
+
const styles2 = react.useMultiStyleConfig("Datepicker", {});
|
3407
|
+
return /* @__PURE__ */ React49__namespace.default.createElement(reactAria.I18nProvider, { locale }, /* @__PURE__ */ React49__namespace.default.createElement(
|
3408
|
+
react.Box,
|
3409
|
+
{
|
3410
|
+
position: "relative",
|
3411
|
+
display: "inline-flex",
|
3412
|
+
flexDirection: "column",
|
3413
|
+
width
|
3414
|
+
},
|
3415
|
+
/* @__PURE__ */ React49__namespace.default.createElement(
|
3416
|
+
react.Popover,
|
3417
|
+
{
|
3418
|
+
...dialogProps,
|
3419
|
+
isOpen: state2.isOpen,
|
3420
|
+
onClose: state2.close,
|
3421
|
+
onOpen: state2.open,
|
3422
|
+
closeOnBlur: true,
|
3423
|
+
closeOnEsc: true,
|
3424
|
+
returnFocusOnClose: true
|
3425
|
+
},
|
3426
|
+
/* @__PURE__ */ React49__namespace.default.createElement(react.InputGroup, { ...groupProps, display: "inline-flex" }, /* @__PURE__ */ React49__namespace.default.createElement(react.PopoverAnchor, null, /* @__PURE__ */ React49__namespace.default.createElement(
|
3427
|
+
StyledField,
|
3428
|
+
{
|
3429
|
+
variant: responsiveVariant,
|
3430
|
+
onClick: onFieldClick,
|
3431
|
+
onKeyPress: handleEnterClick,
|
3432
|
+
paddingX: 3,
|
3433
|
+
minHeight
|
3434
|
+
},
|
3435
|
+
!hasTrigger && /* @__PURE__ */ React49__namespace.default.createElement(sporIconReact.CalendarOutline24Icon, { marginRight: 2, alignSelf: "center" }),
|
3436
|
+
/* @__PURE__ */ React49__namespace.default.createElement(
|
3437
|
+
DateField,
|
3438
|
+
{
|
3439
|
+
label: props.label,
|
3440
|
+
labelProps,
|
3441
|
+
name: props.name,
|
3442
|
+
ref,
|
3443
|
+
...fieldProps
|
3444
|
+
}
|
3445
|
+
)
|
3446
|
+
)), hasTrigger && /* @__PURE__ */ React49__namespace.default.createElement(CalendarTriggerButton, { ...buttonProps })),
|
3447
|
+
/* @__PURE__ */ React49__namespace.default.createElement(exports.FormErrorMessage, { ...errorMessageProps }, errorMessage),
|
3448
|
+
state2.isOpen && !props.isDisabled && /* @__PURE__ */ React49__namespace.default.createElement(react.Portal, null, /* @__PURE__ */ React49__namespace.default.createElement(
|
3449
|
+
react.PopoverContent,
|
3450
|
+
{
|
3451
|
+
color: "darkGrey",
|
3452
|
+
boxShadow: "md",
|
3453
|
+
sx: styles2.calendar
|
3454
|
+
},
|
3455
|
+
/* @__PURE__ */ React49__namespace.default.createElement(react.PopoverArrow, { sx: styles2.arrow }),
|
3456
|
+
/* @__PURE__ */ React49__namespace.default.createElement(react.PopoverBody, null, /* @__PURE__ */ React49__namespace.default.createElement(
|
3457
|
+
Calendar,
|
3458
|
+
{
|
3459
|
+
...calendarProps,
|
3460
|
+
showYearNavigation
|
3461
|
+
}
|
3462
|
+
))
|
3463
|
+
))
|
3464
|
+
)
|
3465
|
+
));
|
3466
|
+
}
|
3467
|
+
);
|
3385
3468
|
}
|
3386
3469
|
});
|
3387
3470
|
function RangeCalendar(props) {
|
@@ -3773,7 +3856,8 @@ var init_Popover = __esm({
|
|
3773
3856
|
crossOffset = 0,
|
3774
3857
|
placement = "bottom",
|
3775
3858
|
shouldFlip = false,
|
3776
|
-
isNonModal = false
|
3859
|
+
isNonModal = false,
|
3860
|
+
hasBackdrop = true
|
3777
3861
|
}, ref) => {
|
3778
3862
|
var _a6;
|
3779
3863
|
const internalRef = React49.useRef(null);
|
@@ -3790,7 +3874,7 @@ var init_Popover = __esm({
|
|
3790
3874
|
},
|
3791
3875
|
state2
|
3792
3876
|
);
|
3793
|
-
return /* @__PURE__ */ React49__namespace.default.createElement(reactAria.Overlay, null, /* @__PURE__ */ React49__namespace.default.createElement(react.Box, { ...underlayProps, position: "fixed", inset: "0" }), /* @__PURE__ */ React49__namespace.default.createElement(
|
3877
|
+
return /* @__PURE__ */ React49__namespace.default.createElement(reactAria.Overlay, null, hasBackdrop && /* @__PURE__ */ React49__namespace.default.createElement(react.Box, { ...underlayProps, position: "fixed", inset: "0" }), /* @__PURE__ */ React49__namespace.default.createElement(
|
3794
3878
|
react.Box,
|
3795
3879
|
{
|
3796
3880
|
...popoverProps,
|
@@ -4804,7 +4888,8 @@ function Combobox({
|
|
4804
4888
|
triggerRef: inputRef,
|
4805
4889
|
ref: popoverRef,
|
4806
4890
|
placement: "bottom start",
|
4807
|
-
shouldFlip: false
|
4891
|
+
shouldFlip: false,
|
4892
|
+
hasBackdrop: false
|
4808
4893
|
},
|
4809
4894
|
/* @__PURE__ */ React49__namespace.default.createElement(
|
4810
4895
|
ListBox,
|
@@ -23279,7 +23364,6 @@ Object.defineProperty(exports, 'Section', {
|
|
23279
23364
|
});
|
23280
23365
|
exports.tokens = tokens10__namespace;
|
23281
23366
|
exports.Combobox = Combobox;
|
23282
|
-
exports.DatePicker = DatePicker;
|
23283
23367
|
exports.DateRangePicker = DateRangePicker;
|
23284
23368
|
exports.DrawerHeader = exports.ModalHeader;
|
23285
23369
|
exports.InfoSelect = InfoSelect;
|