@dloizides/ui-forms 1.41.0 → 1.42.0

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/index.mjs CHANGED
@@ -1,16 +1,16 @@
1
- import React26, { forwardRef, useState, useCallback, useMemo, useRef, useEffect, useLayoutEffect } from 'react';
2
- import { Platform, StyleSheet, TextInput, View, Text, useWindowDimensions, ScrollView, Pressable, Switch, Image, AccessibilityInfo, Animated, TouchableOpacity, Modal } from 'react-native';
1
+ import React37, { forwardRef, createContext, useState, useCallback, useMemo, useRef, useEffect, useLayoutEffect, useContext } from 'react';
2
+ import { Platform, StyleSheet, TextInput, View, Text, useWindowDimensions, ScrollView, Pressable, Switch, AccessibilityInfo, Image, Animated, TouchableOpacity, Modal } from 'react-native';
3
3
  import { useUi } from '@dloizides/ui-feedback';
4
4
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
5
- import { Z_INDEX, focusRingOutline, readableScaleInk } from '@dloizides/design-tokens';
6
- import { themeFocusRingColor, Button, useFocusRing } from '@dloizides/ui-buttons';
5
+ import { Z_INDEX, focusRingOutline, readableScaleInk, resolveOnBrand } from '@dloizides/design-tokens';
6
+ import { themeFocusRingColor, Button, useFocusRing, IconButton } from '@dloizides/ui-buttons';
7
7
  import { createPortal } from 'react-dom';
8
8
  import { MIN_TOUCH_TARGET_PX } from '@dloizides/a11y';
9
9
  import Svg, { Rect, Circle, Polygon } from 'react-native-svg';
10
10
 
11
11
  // src/Field/Field.tsx
12
12
  function attachControlId(child, candidateId, describedById) {
13
- if (!React26.isValidElement(child) || child.type === React26.Fragment) {
13
+ if (!React37.isValidElement(child) || child.type === React37.Fragment) {
14
14
  return { node: child };
15
15
  }
16
16
  const props = child.props;
@@ -21,7 +21,7 @@ function attachControlId(child, candidateId, describedById) {
21
21
  if (describedById !== void 0 && props.describedById === void 0) {
22
22
  injected.describedById = describedById;
23
23
  }
24
- return { node: React26.cloneElement(element, injected), controlId };
24
+ return { node: React37.cloneElement(element, injected), controlId };
25
25
  }
26
26
  var IS_WEB = Platform.OS === "web";
27
27
  function isAttributeHost(node) {
@@ -131,15 +131,15 @@ var labelVariantStyles = StyleSheet.create({
131
131
  function resolveLabelVariantStyle(variant) {
132
132
  return variant === "control" ? labelVariantStyles.control : labelVariantStyles.field;
133
133
  }
134
- var FormGridContext = React26.createContext(null);
135
- var GapOwnedContext = React26.createContext(false);
134
+ var FormGridContext = React37.createContext(null);
135
+ var GapOwnedContext = React37.createContext(false);
136
136
  var FormGridProvider = FormGridContext.Provider;
137
137
  var GapOwnedProvider = GapOwnedContext.Provider;
138
138
  function useFormGridMetrics() {
139
- return React26.useContext(FormGridContext);
139
+ return React37.useContext(FormGridContext);
140
140
  }
141
141
  function useIsGapOwned() {
142
- return React26.useContext(GapOwnedContext);
142
+ return React37.useContext(GapOwnedContext);
143
143
  }
144
144
  var ERROR_LIGHT_STEPS = ["500", "600", "700"];
145
145
  var ERROR_DARK_STEPS = ["300", "200", "400", "100", "500"];
@@ -162,7 +162,7 @@ var styles = StyleSheet.create({
162
162
  });
163
163
  var fieldSeq = 0;
164
164
  function useFieldIds() {
165
- const [ids] = React26.useState(() => {
165
+ const [ids] = React37.useState(() => {
166
166
  fieldSeq += 1;
167
167
  const seq = String(fieldSeq);
168
168
  return {
@@ -209,7 +209,7 @@ var Field = ({
209
209
  const hasLabel = labelText !== "";
210
210
  const marker = resolveFieldMarker(required, optional);
211
211
  const { hintId, errorId, controlId, labelId } = useFieldIds();
212
- const themeStyles = React26.useMemo(
212
+ const themeStyles = React37.useMemo(
213
213
  () => ({
214
214
  label: { color: colors.textSecondary },
215
215
  requiredMark: { color: errorColor },
@@ -261,7 +261,7 @@ var FormGrid = ({
261
261
  style,
262
262
  testID
263
263
  }) => {
264
- const metrics = React26.useMemo(() => ({ minWidth, basis }), [minWidth, basis]);
264
+ const metrics = React37.useMemo(() => ({ minWidth, basis }), [minWidth, basis]);
265
265
  return /* @__PURE__ */ jsx(FormGridProvider, { value: metrics, children: /* @__PURE__ */ jsx(GapOwnedProvider, { value: true, children: /* @__PURE__ */ jsx(View, { style: [styles2.grid, { gap }, style], testID, children }) }) });
266
266
  };
267
267
  var LABEL_LINE_PLACEHOLDER = "\xA0";
@@ -528,7 +528,7 @@ var styles9 = StyleSheet.create({
528
528
  });
529
529
  var sectionSeq = 0;
530
530
  function useSectionLegendId() {
531
- const [id] = React26.useState(() => {
531
+ const [id] = React37.useState(() => {
532
532
  sectionSeq += 1;
533
533
  return `form-section-legend-${String(sectionSeq)}`;
534
534
  });
@@ -922,7 +922,7 @@ function AnchoredMenu({
922
922
  listbox,
923
923
  placement
924
924
  }) {
925
- const menuRef = React26.useRef(null);
925
+ const menuRef = React37.useRef(null);
926
926
  useDismiss(anchorRef, menuRef, onDismiss);
927
927
  useKeepHighlightInView(testID, listbox?.highlightedValue);
928
928
  const rect2 = useAnchorRect(placement?.positionRef ?? anchorRef, usePortal);
@@ -1082,7 +1082,7 @@ var boxStyles = StyleSheet.create({
1082
1082
  textAlignVertical: "top"
1083
1083
  }
1084
1084
  });
1085
- var ThemedTextInput = React26.forwardRef(function ThemedTextInput2({
1085
+ var ThemedTextInput = React37.forwardRef(function ThemedTextInput2({
1086
1086
  hasError = false,
1087
1087
  describedById,
1088
1088
  requiredField = false,
@@ -1392,7 +1392,7 @@ function ChipContent({ icon, label, textStyle, numberOfLines }) {
1392
1392
  }
1393
1393
  function OutlineChip(props) {
1394
1394
  const { option, selected, disabled, colors, testID, accessibilityHint, onPress } = props;
1395
- const [hovered, setHovered] = React26.useState(false);
1395
+ const [hovered, setHovered] = React37.useState(false);
1396
1396
  const active = selected || hovered;
1397
1397
  const borderColor = active ? colors.primary : colors.border;
1398
1398
  const backgroundColor = selected ? colors.tint : colors.muted;
@@ -1492,8 +1492,8 @@ function radioTabIndex(index, selectedIndex, disabled) {
1492
1492
  var NO_GROUP_PROPS = {};
1493
1493
  function useRadioKeyboard(config) {
1494
1494
  const { enabled, disabled, values, selectedIndex, onChange } = config;
1495
- const nodes = React26.useRef([]);
1496
- const chipRef = React26.useCallback((index) => (node) => {
1495
+ const nodes = React37.useRef([]);
1496
+ const chipRef = React37.useCallback((index) => (node) => {
1497
1497
  nodes.current[index] = node;
1498
1498
  }, []);
1499
1499
  const onKeyDown = (event) => {
@@ -1606,7 +1606,7 @@ var ChipSelector = ({
1606
1606
  const isRadioGroup = !multiple && singleSelectRole === "radio";
1607
1607
  const { theme } = useUi();
1608
1608
  const { colors, palette } = theme;
1609
- const chipColors = React26.useMemo(() => buildChipColors(colors, palette), [colors, palette]);
1609
+ const chipColors = React37.useMemo(() => buildChipColors(colors, palette), [colors, palette]);
1610
1610
  function isSelected(optionValue) {
1611
1611
  if (multiple && Array.isArray(value))
1612
1612
  return value.includes(optionValue);
@@ -1702,12 +1702,12 @@ var FormSwitch = ({
1702
1702
  accessibilityHint
1703
1703
  }) => {
1704
1704
  const { theme } = useUi();
1705
- const toggle2 = React26.useCallback(() => {
1705
+ const toggle2 = React37.useCallback(() => {
1706
1706
  if (!disabled) onValueChange(!value);
1707
1707
  }, [disabled, onValueChange, value]);
1708
1708
  const { colors } = theme;
1709
1709
  const hasDescription = typeof description === "string" && description !== "";
1710
- const themeStyles = React26.useMemo(() => {
1710
+ const themeStyles = React37.useMemo(() => {
1711
1711
  const labelStyle = { color: colors.text };
1712
1712
  const descriptionStyle = { color: colors.textSecondary };
1713
1713
  return { label: labelStyle, description: descriptionStyle };
@@ -1830,8 +1830,8 @@ var FormCheckbox = ({
1830
1830
  const hintText = typeof hint === "string" && hint !== "" ? hint : description;
1831
1831
  const hasHint = typeof hintText === "string" && hintText !== "";
1832
1832
  const { hintId } = useFieldIds();
1833
- const [focused, setFocused] = React26.useState(false);
1834
- const themeStyles = React26.useMemo(() => {
1833
+ const [focused, setFocused] = React37.useState(false);
1834
+ const themeStyles = React37.useMemo(() => {
1835
1835
  const boxOn = checkboxBoxColors(colors, brand, true);
1836
1836
  const boxOff = checkboxBoxColors(colors, brand, false);
1837
1837
  const ring = { borderColor: brand };
@@ -2335,8 +2335,733 @@ function WebDateInput({ fieldProps, context, webInputType }) {
2335
2335
  }
2336
2336
  );
2337
2337
  }
2338
+ var PATHS = {
2339
+ ["calendar" /* Calendar */]: "M7 3v3M17 3v3M4 9h16M5 5h14a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V6a1 1 0 0 1 1-1z",
2340
+ ["previous" /* Previous */]: "M15 5l-7 7 7 7",
2341
+ ["next" /* Next */]: "M9 5l7 7-7 7"
2342
+ };
2343
+ var SIZE = 18;
2344
+ var STROKE = 2;
2345
+ function Glyph({ name, color }) {
2346
+ return /* @__PURE__ */ jsx("svg", { "aria-hidden": "true", fill: "none", height: SIZE, stroke: color, strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: STROKE, viewBox: "0 0 24 24", width: SIZE, children: /* @__PURE__ */ jsx("path", { d: PATHS[name] }) });
2347
+ }
2348
+ var TINT_STEP = "100";
2349
+ function usePickerColors() {
2350
+ const { theme } = useUi();
2351
+ const brand = theme.palette.primary["500"];
2352
+ return {
2353
+ text: theme.colors.text,
2354
+ textSecondary: theme.colors.textSecondary,
2355
+ border: theme.colors.border,
2356
+ surface: theme.colors.surface,
2357
+ brand,
2358
+ onBrand: resolveOnBrand(brand),
2359
+ tint: theme.palette.primary[TINT_STEP] ?? theme.colors.background
2360
+ };
2361
+ }
2362
+ var FOCUSABLE = "button, select, input, [tabindex]";
2363
+ var RADIUS = 12;
2364
+ var SHEET_RADIUS = 16;
2365
+ var PAD = 12;
2366
+ var SHEET_MAX_HEIGHT = "90vh";
2367
+ function tabStops(container) {
2368
+ return Array.from(container.querySelectorAll(FOCUSABLE)).filter(
2369
+ (node) => node.tabIndex >= 0 && !node.hasAttribute("disabled") && node.getAttribute("aria-disabled") !== "true"
2370
+ );
2371
+ }
2372
+ function PickerDialog({ testID, sheet, onDismiss, children }) {
2373
+ const colors = usePickerColors();
2374
+ const ref = useRef(null);
2375
+ const onKeyDown = (event) => {
2376
+ if (event.key === "Escape") {
2377
+ event.preventDefault();
2378
+ event.stopPropagation();
2379
+ onDismiss();
2380
+ return;
2381
+ }
2382
+ if (event.key !== "Tab" || ref.current === null) return;
2383
+ const stops = tabStops(ref.current);
2384
+ const first = stops[0];
2385
+ const last = stops[stops.length - 1];
2386
+ if (first === void 0 || last === void 0) return;
2387
+ const atEdge = event.shiftKey ? document.activeElement === first : document.activeElement === last;
2388
+ if (!atEdge) return;
2389
+ event.preventDefault();
2390
+ (event.shiftKey ? last : first).focus();
2391
+ };
2392
+ const shape = sheet ? { borderTopLeftRadius: SHEET_RADIUS, borderTopRightRadius: SHEET_RADIUS, maxHeight: SHEET_MAX_HEIGHT, overflowY: "auto" } : { borderRadius: RADIUS, boxShadow: `0 12px 32px ${colors.border}` };
2393
+ const style = { boxSizing: "border-box", padding: PAD, background: colors.surface, color: colors.text, border: `1px solid ${colors.border}`, fontFamily: "inherit", ...shape };
2394
+ return /* @__PURE__ */ jsx("div", { ref, "data-testid": testID, "data-variant": sheet ? "sheet" : "popover", style, onKeyDown, children });
2395
+ }
2396
+ function useAnchorRect2(anchorRef) {
2397
+ const [rect2, setRect] = useState(null);
2398
+ useEffect(() => {
2399
+ anchorRef.current?.measureInWindow((x, y, width, height) => setRect({ x, y, width, height }));
2400
+ }, [anchorRef]);
2401
+ return rect2;
2402
+ }
2403
+
2404
+ // src/SearchSelect/DropdownPlacement.ts
2405
+ var DropdownPlacement = /* @__PURE__ */ ((DropdownPlacement2) => {
2406
+ DropdownPlacement2["Below"] = "below";
2407
+ DropdownPlacement2["Above"] = "above";
2408
+ return DropdownPlacement2;
2409
+ })(DropdownPlacement || {});
2410
+
2411
+ // src/SearchSelect/utils/dropdownFrame.ts
2412
+ var MIN_PANEL_WIDTH = 240;
2413
+ var EDGE = 8;
2414
+ function placeDropdown(anchor, panelHeight, viewportHeight) {
2415
+ const roomBelow = viewportHeight - (anchor.y + anchor.height);
2416
+ if (roomBelow >= panelHeight) return "below" /* Below */;
2417
+ return anchor.y > roomBelow ? "above" /* Above */ : "below" /* Below */;
2418
+ }
2419
+ function dropdownFrame(anchor, panelHeight, viewportHeight) {
2420
+ const placement = placeDropdown(anchor, panelHeight, viewportHeight);
2421
+ const base = { placement, left: anchor.x, width: anchor.width };
2422
+ if (placement === "above" /* Above */) return { ...base, bottom: viewportHeight - anchor.y };
2423
+ return { ...base, top: anchor.y + anchor.height };
2424
+ }
2425
+ function fitDropdownWidth(frame, viewportWidth, minWidth = MIN_PANEL_WIDTH) {
2426
+ const width = Math.max(frame.width, Math.min(minWidth, viewportWidth - EDGE - EDGE));
2427
+ const left = Math.max(EDGE, Math.min(frame.left, viewportWidth - width - EDGE));
2428
+ return { ...frame, width, left: frame.width >= width ? frame.left : left };
2429
+ }
2430
+ function DropdownSurface({ progress, translateY, anchorRef, onDismiss, closeLabel, closeHint, testID, children, minWidth, scale, accessibilityLabel }) {
2431
+ const { height: viewportHeight, width: viewportWidth } = useWindowDimensions();
2432
+ const anchor = useAnchorRect2(anchorRef);
2433
+ const [panelHeight, setPanelHeight] = useState(0);
2434
+ const onLayout = useCallback((event) => setPanelHeight(event.nativeEvent.layout.height), []);
2435
+ const frame = anchor === null ? null : fitDropdownWidth(dropdownFrame(anchor, panelHeight, viewportHeight), viewportWidth, minWidth);
2436
+ const place = frame === null ? null : { left: frame.left, width: frame.width, top: frame.top, bottom: frame.bottom };
2437
+ return /* @__PURE__ */ jsxs(Modal, { transparent: true, visible: true, animationType: "none", "aria-label": accessibilityLabel, onRequestClose: onDismiss, children: [
2438
+ /* @__PURE__ */ jsx(Pressable, { accessibilityHint: closeHint, accessibilityLabel: closeLabel, accessibilityRole: "button", style: StyleSheet.absoluteFill, testID: `${testID}-backdrop`, onPress: onDismiss }),
2439
+ frame !== null ? /* @__PURE__ */ jsx(Animated.View, { style: [styles15.dropdown, place, { opacity: progress, transform: scale === void 0 ? [{ translateY }] : [{ translateY }, { scale }] }, scale === void 0 ? null : styles15.growFromField], testID: `${testID}-dropdown-${frame.placement}`, onLayout, children }) : null
2440
+ ] });
2441
+ }
2442
+ var styles15 = StyleSheet.create({
2443
+ dropdown: { position: "absolute" },
2444
+ growFromField: { transformOrigin: "top left" }
2445
+ });
2446
+ function SheetSurface({ translateY, onDismiss, closeLabel, closeHint, testID, children, progress, scale, accessibilityLabel }) {
2447
+ return /* @__PURE__ */ jsx(Modal, { transparent: true, visible: true, animationType: "none", "aria-label": accessibilityLabel, onRequestClose: onDismiss, children: /* @__PURE__ */ jsxs(View, { style: styles16.backdrop, children: [
2448
+ /* @__PURE__ */ jsx(Pressable, { accessibilityHint: closeHint, accessibilityLabel: closeLabel, accessibilityRole: "button", style: StyleSheet.absoluteFill, testID: `${testID}-backdrop`, onPress: onDismiss }),
2449
+ /* @__PURE__ */ jsx(Animated.View, { style: [{ transform: scale === void 0 ? [{ translateY }] : [{ translateY }, { scale }] }, progress === void 0 ? null : { opacity: progress }], children })
2450
+ ] }) });
2451
+ }
2452
+ var styles16 = StyleSheet.create({
2453
+ backdrop: { flex: 1, justifyContent: "flex-end" }
2454
+ });
2455
+ function useReducedMotion() {
2456
+ const [reduced, setReduced] = useState(false);
2457
+ useEffect(() => {
2458
+ let active = true;
2459
+ AccessibilityInfo.isReduceMotionEnabled().then((value) => {
2460
+ if (active) setReduced(value);
2461
+ }).catch(() => void 0);
2462
+ const subscription = AccessibilityInfo.addEventListener("reduceMotionChanged", setReduced);
2463
+ return () => {
2464
+ active = false;
2465
+ subscription?.remove();
2466
+ };
2467
+ }, []);
2468
+ return reduced;
2469
+ }
2470
+
2471
+ // src/DatePicker/data/defaultLabels.ts
2472
+ var DEFAULT_DATE_PICKER_LABELS = {
2473
+ dialog: "Choose a date",
2474
+ rangeDialog: "Choose a date range",
2475
+ openCalendar: "Open calendar",
2476
+ openCalendarHint: "Opens a calendar to pick the date",
2477
+ previousMonth: "Previous month",
2478
+ nextMonth: "Next month",
2479
+ monthHint: "Shows another month",
2480
+ month: "Month",
2481
+ year: "Year",
2482
+ dayHint: "Picks this day",
2483
+ setDate: "Set date",
2484
+ setDateHint: "Saves the picked date",
2485
+ clear: "Clear",
2486
+ clearHint: "Removes the date",
2487
+ cancel: "Cancel",
2488
+ cancelHint: "Closes without changes",
2489
+ apply: "Apply",
2490
+ applyHint: "Saves the picked range",
2491
+ presets: "Quick ranges",
2492
+ presetHint: "Sets the range to this period",
2493
+ today: "Today",
2494
+ last7Days: "Last 7 days",
2495
+ thisMonth: "This month",
2496
+ quarter: "Quarter",
2497
+ dayCount: "{{p1}} days",
2498
+ invalidDate: "Enter a real date",
2499
+ rangeSeparator: " \u2013 ",
2500
+ rangeOrder: "The start must be on or before the end",
2501
+ outOfRange: "This date is outside the allowed range"
2502
+ };
2503
+
2504
+ // src/DatePicker/utils/isoDate.ts
2505
+ var ISO_DATE = /^(\d{4})-(\d{2})-(\d{2})$/;
2506
+ var MONTHS_IN_YEAR = 12;
2507
+ var DAYS_IN_WEEK = 7;
2508
+ var PAD2 = 2;
2509
+ var YEAR_PAD = 4;
2510
+ var SUNDAY = 0;
2511
+ var MONDAY = 1;
2512
+ var MS_PER_DAY = 864e5;
2513
+ var MONTH_PREFIX = "YYYY-MM".length;
2514
+ var EPOCH = { year: 1970, month: 1, day: 1 };
2515
+ function daysInMonth(year, month) {
2516
+ return new Date(Date.UTC(year, month, 0)).getUTCDate();
2517
+ }
2518
+ function isValidParts({ year, month, day }) {
2519
+ const inMonth = month >= 1 && month <= MONTHS_IN_YEAR;
2520
+ return Number.isInteger(year) && year > 0 && inMonth && Number.isInteger(day) && day >= 1 && day <= daysInMonth(year, month);
2521
+ }
2522
+ function parseIso(value) {
2523
+ const match = ISO_DATE.exec(value);
2524
+ if (match === null) return null;
2525
+ const parts = { year: Number(match[1]), month: Number(match[2]), day: Number(match[3]) };
2526
+ return isValidParts(parts) ? parts : null;
2527
+ }
2528
+ function toIso({ year, month, day }) {
2529
+ return `${String(year).padStart(YEAR_PAD, "0")}-${String(month).padStart(PAD2, "0")}-${String(day).padStart(PAD2, "0")}`;
2530
+ }
2531
+ function toUtc(iso) {
2532
+ const parts = parseIso(iso) ?? EPOCH;
2533
+ return new Date(Date.UTC(parts.year, parts.month - 1, parts.day));
2534
+ }
2535
+ function fromUtc(date) {
2536
+ return toIso({ year: date.getUTCFullYear(), month: date.getUTCMonth() + 1, day: date.getUTCDate() });
2537
+ }
2538
+ function addDays(iso, days) {
2539
+ const date = toUtc(iso);
2540
+ date.setUTCDate(date.getUTCDate() + days);
2541
+ return fromUtc(date);
2542
+ }
2543
+ function addMonths(iso, months) {
2544
+ const parts = parseIso(iso) ?? EPOCH;
2545
+ const index = parts.year * MONTHS_IN_YEAR + (parts.month - 1) + months;
2546
+ const year = Math.floor(index / MONTHS_IN_YEAR);
2547
+ const month = index % MONTHS_IN_YEAR + 1;
2548
+ return toIso({ year, month, day: Math.min(parts.day, daysInMonth(year, month)) });
2549
+ }
2550
+ function weekdayIndex(iso, firstDay = MONDAY) {
2551
+ const day = toUtc(iso).getUTCDay();
2552
+ const isoDay = day === SUNDAY ? DAYS_IN_WEEK : day;
2553
+ return (isoDay - firstDay + DAYS_IN_WEEK) % DAYS_IN_WEEK;
2554
+ }
2555
+ function daysBetweenInclusive(from, to) {
2556
+ return Math.round((toUtc(to).getTime() - toUtc(from).getTime()) / MS_PER_DAY) + 1;
2557
+ }
2558
+ function isWithinBounds(iso, min, max) {
2559
+ const aboveMin = min === void 0 || min === "" || iso >= min.slice(0, iso.length);
2560
+ const belowMax = max === void 0 || max === "" || iso <= max.slice(0, iso.length);
2561
+ return aboveMin && belowMax;
2562
+ }
2563
+ function clampToBounds(iso, min, max) {
2564
+ if (min !== void 0 && min !== "" && iso < min.slice(0, iso.length)) return min.slice(0, iso.length);
2565
+ if (max !== void 0 && max !== "" && iso > max.slice(0, iso.length)) return max.slice(0, iso.length);
2566
+ return iso;
2567
+ }
2568
+ function todayIso(now = /* @__PURE__ */ new Date()) {
2569
+ return toIso({ year: now.getFullYear(), month: now.getMonth() + 1, day: now.getDate() });
2570
+ }
2571
+ function monthStart(iso) {
2572
+ return `${iso.slice(0, MONTH_PREFIX)}-01`;
2573
+ }
2574
+
2575
+ // src/DatePicker/utils/weekStart.ts
2576
+ var MONDAY2 = 1;
2577
+ var SUNDAY2 = 7;
2578
+ var SUNDAY_REGIONS = /* @__PURE__ */ new Set(["US", "CA", "MX", "BR", "JP", "KR", "TW", "HK", "IL", "PH", "IN", "ZA", "SA", "PE", "CO", "VE", "GT", "HN", "PA", "PR", "DO", "SV", "TH", "ID"]);
2579
+ function weekFirstDay(locale) {
2580
+ try {
2581
+ const resolved = new Intl.Locale(locale ?? new Intl.DateTimeFormat().resolvedOptions().locale);
2582
+ const info = resolved;
2583
+ const first = info.getWeekInfo?.().firstDay ?? info.weekInfo?.firstDay;
2584
+ if (first !== void 0) return first;
2585
+ return SUNDAY_REGIONS.has(resolved.maximize().region ?? "") ? SUNDAY2 : MONDAY2;
2586
+ } catch {
2587
+ return MONDAY2;
2588
+ }
2589
+ }
2590
+ var DatePickerContext = createContext({ labels: DEFAULT_DATE_PICKER_LABELS });
2591
+ function DatePickerProvider({ labels, locale, today, children }) {
2592
+ const value = useMemo(() => ({ labels: { ...DEFAULT_DATE_PICKER_LABELS, ...labels }, locale, today }), [labels, locale, today]);
2593
+ return /* @__PURE__ */ jsx(DatePickerContext.Provider, { value, children });
2594
+ }
2595
+ function useDatePickerConfig() {
2596
+ const config = useContext(DatePickerContext);
2597
+ const firstDay = useMemo(() => weekFirstDay(config.locale), [config.locale]);
2598
+ return { labels: config.labels, locale: config.locale, today: config.today ?? todayIso(), firstDay };
2599
+ }
2600
+
2601
+ // src/DatePicker/utils/motionStyles.ts
2602
+ var OPEN_MS = 180;
2603
+ var MONTH_SLIDE_MS = 200;
2604
+ var MONTH_SLIDE_PX = 16;
2605
+ var OPEN_SCALE = 0.96;
2606
+ var EASE = "cubic-bezier(0.2, 0, 0, 1)";
2607
+ function resolveOpenMotion(reduced) {
2608
+ return reduced ? { durationMs: 0, fromScale: 1 } : { durationMs: OPEN_MS, fromScale: OPEN_SCALE };
2609
+ }
2610
+ function monthSlideStyle(entered, reduced, direction) {
2611
+ if (reduced || direction === 0) return {};
2612
+ return {
2613
+ opacity: entered ? 1 : 0,
2614
+ transform: entered ? "translateX(0px)" : `translateX(${direction * MONTH_SLIDE_PX}px)`,
2615
+ transition: `opacity ${MONTH_SLIDE_MS}ms ${EASE}, transform ${MONTH_SLIDE_MS}ms ${EASE}`
2616
+ };
2617
+ }
2618
+ function useOpenProgress() {
2619
+ const { durationMs, fromScale } = resolveOpenMotion(useReducedMotion());
2620
+ const progress = useRef(new Animated.Value(0)).current;
2621
+ useEffect(() => {
2622
+ Animated.timing(progress, { toValue: 1, duration: durationMs, useNativeDriver: false }).start();
2623
+ }, [progress, durationMs]);
2624
+ return {
2625
+ progress,
2626
+ scale: progress.interpolate({ inputRange: [0, 1], outputRange: [fromScale, 1] }),
2627
+ still: progress.interpolate({ inputRange: [0, 1], outputRange: [0, 0] })
2628
+ };
2629
+ }
2630
+ function PickerSurface({ anchorRef, phone, minWidth, label, testID, onDismiss, children }) {
2631
+ const { labels } = useDatePickerConfig();
2632
+ const { progress, scale, still } = useOpenProgress();
2633
+ const body = /* @__PURE__ */ jsx(PickerDialog, { sheet: phone, testID, onDismiss, children });
2634
+ if (phone) {
2635
+ return /* @__PURE__ */ jsx(SheetSurface, { accessibilityLabel: label, closeHint: labels.cancelHint, closeLabel: labels.cancel, progress, scale, testID, translateY: still, onDismiss, children: body });
2636
+ }
2637
+ return /* @__PURE__ */ jsx(DropdownSurface, { accessibilityLabel: label, anchorRef, closeHint: labels.cancelHint, closeLabel: labels.cancel, minWidth, progress, scale, testID, translateY: still, onDismiss, children: body });
2638
+ }
2639
+
2640
+ // src/DatePicker/utils/calendarKeys.ts
2641
+ var DAYS_IN_WEEK2 = 7;
2642
+ var MONTHS_IN_YEAR2 = 12;
2643
+ var MONDAY3 = 1;
2644
+ var DAY_STEPS = {
2645
+ ArrowLeft: -1,
2646
+ ArrowRight: 1,
2647
+ ArrowUp: -DAYS_IN_WEEK2,
2648
+ ArrowDown: DAYS_IN_WEEK2
2649
+ };
2650
+ function nextFocusDay(iso, key, shiftKey = false, firstDay = MONDAY3) {
2651
+ const step = DAY_STEPS[key];
2652
+ if (step !== void 0) return addDays(iso, step);
2653
+ const monthStep = shiftKey ? MONTHS_IN_YEAR2 : 1;
2654
+ if (key === "PageUp") return addMonths(iso, -monthStep);
2655
+ if (key === "PageDown") return addMonths(iso, monthStep);
2656
+ if (key === "Home") return addDays(iso, -weekdayIndex(iso, firstDay));
2657
+ if (key === "End") return addDays(iso, DAYS_IN_WEEK2 - 1 - weekdayIndex(iso, firstDay));
2658
+ return null;
2659
+ }
2660
+
2661
+ // src/DatePicker/hooks/useGridFocus.ts
2662
+ function dayDomId(testID, iso) {
2663
+ return `${testID}-day-${iso}`;
2664
+ }
2665
+ function useGridFocus(initial, bounds, testID, onPick) {
2666
+ const { firstDay } = useDatePickerConfig();
2667
+ const [focusedDay, setFocusedDay] = useState(initial);
2668
+ const focusPending = useRef(true);
2669
+ const { min, max } = bounds;
2670
+ useEffect(() => {
2671
+ if (!focusPending.current) return;
2672
+ focusPending.current = false;
2673
+ document.getElementById(dayDomId(testID, focusedDay))?.focus();
2674
+ }, [focusedDay, testID]);
2675
+ const moveTo = useCallback((iso) => setFocusedDay(clampToBounds(iso, min, max)), [min, max]);
2676
+ const onDayKey = useCallback(
2677
+ (event, iso) => {
2678
+ if (event.key === "Enter" || event.key === " ") {
2679
+ event.preventDefault();
2680
+ onPick(iso);
2681
+ return;
2682
+ }
2683
+ const next = nextFocusDay(iso, event.key, event.shiftKey, firstDay);
2684
+ if (next === null) return;
2685
+ event.preventDefault();
2686
+ focusPending.current = true;
2687
+ moveTo(next);
2688
+ },
2689
+ [moveTo, onPick, firstDay]
2690
+ );
2691
+ return { focusedDay, moveTo, onDayKey };
2692
+ }
2693
+ var DAY_CELL_PX = 44;
2694
+ var DAY_START = 8;
2695
+ var RING = 2;
2696
+ var FONT = 14;
2697
+ var BOLD = 700;
2698
+ var REGULAR = 400;
2699
+ function DayCell({ iso, state, testID, label, hint, onPick, onKey }) {
2700
+ const colors = usePickerColors();
2701
+ const { inRange, isEnd, isToday, enabled, focusable } = state;
2702
+ const cellStyle = { width: DAY_CELL_PX, height: DAY_CELL_PX, background: inRange && !isEnd ? colors.tint : "transparent" };
2703
+ const textColor = isEnd ? colors.onBrand : enabled ? colors.text : colors.textSecondary;
2704
+ const buttonStyle = {
2705
+ width: DAY_CELL_PX,
2706
+ height: DAY_CELL_PX,
2707
+ padding: 0,
2708
+ boxSizing: "border-box",
2709
+ borderRadius: DAY_CELL_PX / 2,
2710
+ border: `${RING}px solid ${isToday ? colors.brand : "transparent"}`,
2711
+ background: isEnd ? colors.brand : "transparent",
2712
+ color: textColor,
2713
+ textDecoration: enabled ? "none" : "line-through",
2714
+ fontFamily: "inherit",
2715
+ fontSize: FONT,
2716
+ fontWeight: isEnd || isToday ? BOLD : REGULAR,
2717
+ cursor: enabled ? "pointer" : "default"
2718
+ };
2719
+ return /* @__PURE__ */ jsx("div", { "aria-selected": isEnd, role: "gridcell", style: cellStyle, children: /* @__PURE__ */ jsx(
2720
+ "button",
2721
+ {
2722
+ "aria-current": isToday ? "date" : void 0,
2723
+ "aria-label": label,
2724
+ "data-testid": dayDomId(testID, iso),
2725
+ disabled: !enabled,
2726
+ id: dayDomId(testID, iso),
2727
+ style: buttonStyle,
2728
+ tabIndex: focusable ? 0 : -1,
2729
+ title: hint,
2730
+ type: "button",
2731
+ onClick: () => onPick(iso),
2732
+ onKeyDown: (event) => onKey(event, iso),
2733
+ children: Number(iso.slice(DAY_START))
2734
+ }
2735
+ ) });
2736
+ }
2737
+
2738
+ // src/DatePicker/utils/formatDate.ts
2739
+ var SAMPLE_UTC = Date.UTC(2027, 5, 12);
2740
+ var TWO_DIGIT_YEAR = 100;
2741
+ var CENTURY = 2e3;
2742
+ var PART_COUNT = 3;
2743
+ var PAD3 = 2;
2744
+ var MONDAY4 = 1;
2745
+ var ISO_LIKE = /^\d{4}-\d{1,2}-\d{1,2}$/;
2746
+ var MONTH_INDEXES = Array.from({ length: 12 }, (_unused, index) => index);
2747
+ var WEEK_OFFSETS = Array.from({ length: 7 }, (_unused, index) => index);
2748
+ var UTC = "UTC";
2749
+ var PART_OF = { day: "day" /* Day */, month: "month" /* Month */, year: "year" /* Year */ };
2750
+ function utcOf(iso) {
2751
+ const parts = parseIso(iso);
2752
+ return parts === null ? null : new Date(Date.UTC(parts.year, parts.month - 1, parts.day));
2753
+ }
2754
+ function formatWith(iso, locale, options) {
2755
+ const date = utcOf(iso);
2756
+ if (date === null) return iso;
2757
+ return new Intl.DateTimeFormat(locale, { ...options, timeZone: UTC }).format(date).replace(/,/g, "");
2758
+ }
2759
+ function formatDisplay(iso, locale) {
2760
+ return formatWith(iso, locale, { weekday: "short", day: "numeric", month: "short", year: "numeric" });
2761
+ }
2762
+ function formatShort(iso, locale, withYear = true) {
2763
+ return formatWith(iso, locale, withYear ? { day: "numeric", month: "short", year: "numeric" } : { day: "numeric", month: "short" });
2764
+ }
2765
+ function formatMonthYear(iso, locale) {
2766
+ return formatWith(iso, locale, { month: "long", year: "numeric" });
2767
+ }
2768
+ function monthNames(locale) {
2769
+ const format = new Intl.DateTimeFormat(locale, { month: "long", timeZone: UTC });
2770
+ return MONTH_INDEXES.map((month) => format.format(new Date(Date.UTC(2024, month, 1))));
2771
+ }
2772
+ function weekdayNames(locale, firstDay = MONDAY4) {
2773
+ const format = new Intl.DateTimeFormat(locale, { weekday: "short", timeZone: UTC });
2774
+ return WEEK_OFFSETS.map((offset) => format.format(new Date(Date.UTC(2024, 0, firstDay + offset))));
2775
+ }
2776
+ function typedOrder(locale) {
2777
+ const parts = new Intl.DateTimeFormat(locale, { day: "numeric", month: "numeric", year: "numeric", timeZone: UTC }).formatToParts(new Date(SAMPLE_UTC));
2778
+ return parts.map((part) => PART_OF[part.type]).filter((part) => part !== void 0);
2779
+ }
2780
+ function formatTyped(iso, locale) {
2781
+ const parts = parseIso(iso);
2782
+ if (parts === null) return iso;
2783
+ const text = {
2784
+ ["day" /* Day */]: String(parts.day).padStart(PAD3, "0"),
2785
+ ["month" /* Month */]: String(parts.month).padStart(PAD3, "0"),
2786
+ ["year" /* Year */]: String(parts.year)
2787
+ };
2788
+ return typedOrder(locale).map((part) => text[part]).join("/");
2789
+ }
2790
+ function parseTyped(text, locale) {
2791
+ const trimmed = text.trim();
2792
+ if (ISO_LIKE.test(trimmed)) {
2793
+ const [year = 0, month = 0, day = 0] = trimmed.split("-").map(Number);
2794
+ const parts2 = { year, month, day };
2795
+ return isValidParts(parts2) ? toIso(parts2) : null;
2796
+ }
2797
+ const numbers2 = trimmed.split(/\D+/).filter((piece) => piece !== "").map(Number);
2798
+ if (numbers2.length !== PART_COUNT) return null;
2799
+ const order = typedOrder(locale);
2800
+ const read = (part) => numbers2[order.indexOf(part)] ?? 0;
2801
+ const rawYear = read("year" /* Year */);
2802
+ const parts = { year: rawYear < TWO_DIGIT_YEAR ? CENTURY + rawYear : rawYear, month: read("month" /* Month */), day: read("day" /* Day */) };
2803
+ return isValidParts(parts) ? toIso(parts) : null;
2804
+ }
2805
+
2806
+ // src/DatePicker/utils/monthGrid.ts
2807
+ var DAYS_IN_WEEK3 = 7;
2808
+ var MONDAY5 = 1;
2809
+ function buildMonthGrid(year, month, firstDay = MONDAY5) {
2810
+ const lead = weekdayIndex(toIso({ year, month, day: 1 }), firstDay);
2811
+ const cells = Array.from({ length: lead }, () => null);
2812
+ for (let day = 1; day <= daysInMonth(year, month); day += 1) cells.push(toIso({ year, month, day }));
2813
+ while (cells.length % DAYS_IN_WEEK3 !== 0) cells.push(null);
2814
+ const weeks = [];
2815
+ for (let start = 0; start < cells.length; start += DAYS_IN_WEEK3) weeks.push(cells.slice(start, start + DAYS_IN_WEEK3));
2816
+ return weeks;
2817
+ }
2818
+ var SHORT_DAY = 2;
2819
+ var DAYS_IN_WEEK4 = 7;
2820
+ var HEADER_LINE = 28;
2821
+ var CAPTION_FONT = 15;
2822
+ var WEEKDAY_FONT = 12;
2823
+ var BOLD2 = 700;
2824
+ var ROW = { display: "flex" };
2825
+ var EMPTY = { width: DAY_CELL_PX, height: DAY_CELL_PX };
2826
+ var FALLBACK = { year: 1970, month: 1};
2827
+ function MonthGrid({ month, selection, focusedDay, bounds, testID, onPick, onKey, showCaption = false, motion }) {
2828
+ const { labels, locale, today, firstDay } = useDatePickerConfig();
2829
+ const colors = usePickerColors();
2830
+ const parts = parseIso(month) ?? FALLBACK;
2831
+ const weeks = useMemo(() => buildMonthGrid(parts.year, parts.month, firstDay), [parts.year, parts.month, firstDay]);
2832
+ const weekdays = useMemo(() => weekdayNames(locale, firstDay), [locale, firstDay]);
2833
+ const title = formatMonthYear(month, locale);
2834
+ const end = selection.to === "" ? selection.from : selection.to;
2835
+ const stateOf = (iso) => ({
2836
+ inRange: selection.from !== "" && iso >= selection.from && iso <= end,
2837
+ isEnd: iso === selection.from || iso === selection.to,
2838
+ isToday: iso === today,
2839
+ enabled: isWithinBounds(iso, bounds.min, bounds.max),
2840
+ focusable: iso === focusedDay
2841
+ });
2842
+ return /* @__PURE__ */ jsxs("div", { style: { width: DAYS_IN_WEEK4 * DAY_CELL_PX, margin: "0 auto", ...motion }, children: [
2843
+ showCaption ? /* @__PURE__ */ jsx("div", { style: { textAlign: "center", fontWeight: BOLD2, fontSize: CAPTION_FONT, lineHeight: `${MIN_TOUCH_TARGET_PX}px` }, children: title }) : null,
2844
+ /* @__PURE__ */ jsxs("div", { "aria-label": title, "data-testid": `${testID}-grid-${month.slice(0, "2026-11".length)}`, role: "grid", children: [
2845
+ /* @__PURE__ */ jsx("div", { role: "row", style: ROW, children: weekdays.map((name) => /* @__PURE__ */ jsx("div", { role: "columnheader", style: { width: DAY_CELL_PX, textAlign: "center", fontSize: WEEKDAY_FONT, lineHeight: `${HEADER_LINE}px`, color: colors.textSecondary }, children: name.slice(0, SHORT_DAY) }, name)) }),
2846
+ weeks.map((week, row) => /* @__PURE__ */ jsx("div", { role: "row", style: ROW, children: week.map(
2847
+ (iso, column) => iso === null ? /* @__PURE__ */ jsx("div", { role: "gridcell", style: EMPTY }, `empty-${column}`) : /* @__PURE__ */ jsx(DayCell, { hint: labels.dayHint, iso, label: formatDisplay(iso, locale), state: stateOf(iso), testID, onKey, onPick }, iso)
2848
+ ) }, `${month}-${row}`))
2849
+ ] })
2850
+ ] });
2851
+ }
2852
+ var YEARS_BACK = 100;
2853
+ var YEARS_AHEAD = 20;
2854
+ var ISO_LENGTH = 10;
2855
+ var FONT2 = 15;
2856
+ var BOLD3 = 700;
2857
+ var GAP = 4;
2858
+ var FALLBACK2 = { year: 1970, month: 1, day: 1 };
2859
+ function boundYear(bound) {
2860
+ return parseIso((bound ?? "").slice(0, ISO_LENGTH))?.year;
2861
+ }
2862
+ function yearOptions(current, bounds) {
2863
+ const first = Math.min(current, boundYear(bounds.min) ?? current - YEARS_BACK);
2864
+ const last = Math.max(current, boundYear(bounds.max) ?? current + YEARS_AHEAD);
2865
+ return Array.from({ length: last - first + 1 }, (_unused, index) => first + index);
2866
+ }
2867
+ function MonthHeader({ focusedDay, bounds, testID, onMove }) {
2868
+ const { labels, locale } = useDatePickerConfig();
2869
+ const colors = usePickerColors();
2870
+ const parts = parseIso(focusedDay) ?? FALLBACK2;
2871
+ const names = useMemo(() => monthNames(locale), [locale]);
2872
+ const setMonthYear = (year, month) => onMove(toIso({ year, month, day: Math.min(parts.day, daysInMonth(year, month)) }));
2873
+ const selectStyle = { minHeight: MIN_TOUCH_TARGET_PX, border: "none", background: "transparent", color: colors.text, fontWeight: BOLD3, fontSize: FONT2, fontFamily: "inherit", cursor: "pointer" };
2874
+ return /* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between" }, children: [
2875
+ /* @__PURE__ */ jsx(IconButton, { accessibilityHint: labels.monthHint, accessibilityLabel: labels.previousMonth, appearance: "ghost", renderIcon: (color) => /* @__PURE__ */ jsx(Glyph, { color, name: "previous" /* Previous */ }), testID: `${testID}-previous`, onPress: () => onMove(addMonths(focusedDay, -1)) }),
2876
+ /* @__PURE__ */ jsxs("div", { style: { display: "flex", gap: GAP }, children: [
2877
+ /* @__PURE__ */ jsx("select", { "aria-label": labels.month, "data-testid": `${testID}-month`, style: selectStyle, title: labels.monthHint, value: parts.month, onChange: (event) => setMonthYear(parts.year, Number(event.target.value)), children: names.map((name, index) => /* @__PURE__ */ jsx("option", { value: index + 1, children: name }, name)) }),
2878
+ /* @__PURE__ */ jsx("select", { "aria-label": labels.year, "data-testid": `${testID}-year`, style: selectStyle, title: labels.monthHint, value: parts.year, onChange: (event) => setMonthYear(Number(event.target.value), parts.month), children: yearOptions(parts.year, bounds).map((year) => /* @__PURE__ */ jsx("option", { value: year, children: year }, year)) })
2879
+ ] }),
2880
+ /* @__PURE__ */ jsx(IconButton, { accessibilityHint: labels.monthHint, accessibilityLabel: labels.nextMonth, appearance: "ghost", renderIcon: (color) => /* @__PURE__ */ jsx(Glyph, { color, name: "next" /* Next */ }), testID: `${testID}-next`, onPress: () => onMove(addMonths(focusedDay, 1)) })
2881
+ ] });
2882
+ }
2883
+ var GAP2 = 8;
2884
+ function PickerFooter({ summary, children }) {
2885
+ const colors = usePickerColors();
2886
+ return /* @__PURE__ */ jsxs("div", { style: { display: "flex", flexWrap: "wrap", alignItems: "center", justifyContent: "space-between", gap: GAP2, borderTop: `1px solid ${colors.border}`, paddingTop: GAP2, marginTop: GAP2 }, children: [
2887
+ summary,
2888
+ /* @__PURE__ */ jsx("div", { style: { display: "flex", gap: GAP2, marginLeft: "auto" }, children })
2889
+ ] });
2890
+ }
2891
+ function useEntered(key, reduced) {
2892
+ const [enteredKey, setEnteredKey] = useState(null);
2893
+ useEffect(() => {
2894
+ if (reduced) return void 0;
2895
+ let inner = 0;
2896
+ const outer = requestAnimationFrame(() => {
2897
+ inner = requestAnimationFrame(() => setEnteredKey(key));
2898
+ });
2899
+ return () => {
2900
+ cancelAnimationFrame(outer);
2901
+ cancelAnimationFrame(inner);
2902
+ };
2903
+ }, [key, reduced]);
2904
+ return reduced || enteredKey === key;
2905
+ }
2906
+ function useMonthSlide(month) {
2907
+ const reduced = useReducedMotion();
2908
+ const previous = useRef(month);
2909
+ const direction = useRef(0);
2910
+ if (previous.current !== month) {
2911
+ direction.current = month > previous.current ? 1 : -1;
2912
+ previous.current = month;
2913
+ }
2914
+ const entered = useEntered(month, reduced);
2915
+ return monthSlideStyle(entered, reduced, direction.current);
2916
+ }
2917
+ function SingleCalendar({ value, bounds, testID, onCommit }) {
2918
+ const { labels, today } = useDatePickerConfig();
2919
+ const [draft, setDraft] = useState(value);
2920
+ const grid = useGridFocus(clampToBounds(value !== "" ? value : today, bounds.min, bounds.max), bounds, testID, setDraft);
2921
+ const month = monthStart(grid.focusedDay);
2922
+ const motion = useMonthSlide(month);
2923
+ const pick = (iso) => {
2924
+ setDraft(iso);
2925
+ grid.moveTo(iso);
2926
+ };
2927
+ return /* @__PURE__ */ jsxs("div", { children: [
2928
+ /* @__PURE__ */ jsx(MonthHeader, { bounds, focusedDay: grid.focusedDay, testID, onMove: grid.moveTo }),
2929
+ /* @__PURE__ */ jsx(MonthGrid, { bounds, focusedDay: grid.focusedDay, month, motion, selection: { from: draft, to: draft }, testID, onKey: grid.onDayKey, onPick: pick }),
2930
+ /* @__PURE__ */ jsxs(PickerFooter, { children: [
2931
+ /* @__PURE__ */ jsx(Button, { accessibilityHint: labels.clearHint, accessibilityLabel: labels.clear, label: labels.clear, testID: `${testID}-clear`, variant: "ghost", onPress: () => onCommit("") }),
2932
+ /* @__PURE__ */ jsx(Button, { accessibilityHint: labels.setDateHint, accessibilityLabel: labels.setDate, disabled: draft === "", label: labels.setDate, testID: `${testID}-set`, onPress: () => onCommit(draft) })
2933
+ ] })
2934
+ ] });
2935
+ }
2936
+ function useIsPhone() {
2937
+ return !isWideFormLayout(useWindowDimensions().width);
2938
+ }
2939
+ function useReturnFocus(open, target) {
2940
+ const wasOpen = useRef(open);
2941
+ useEffect(() => {
2942
+ if (wasOpen.current && !open) target.current?.focus();
2943
+ wasOpen.current = open;
2944
+ }, [open, target]);
2945
+ }
2946
+ function useTypedDate({ value, onChange, bounds, format, onError, rangeMessage }) {
2947
+ const { labels, locale } = useDatePickerConfig();
2948
+ const [focused, setFocused] = useState(false);
2949
+ const [text, setText] = useState("");
2950
+ useEffect(() => {
2951
+ setText((current) => {
2952
+ const parsed = current.trim() === "" ? "" : parseTyped(current, locale);
2953
+ if (parsed === null || parsed === value) return current;
2954
+ return value === "" ? "" : formatTyped(value, locale);
2955
+ });
2956
+ }, [value, locale]);
2957
+ const verdict = (typed) => {
2958
+ if (typed.trim() === "") return void 0;
2959
+ const parsed = parseTyped(typed, locale);
2960
+ if (parsed === null) return labels.invalidDate;
2961
+ return isWithinBounds(parsed, bounds.min, bounds.max) ? void 0 : rangeMessage ?? labels.outOfRange;
2962
+ };
2963
+ const onText = (next) => {
2964
+ setText(next);
2965
+ if (next.trim() === "") {
2966
+ onError?.(void 0);
2967
+ onChange("");
2968
+ return;
2969
+ }
2970
+ const parsed = parseTyped(next, locale);
2971
+ if (parsed === null) return;
2972
+ const message = verdict(next);
2973
+ onError?.(message);
2974
+ if (message === void 0) onChange(parsed);
2975
+ };
2976
+ const isReady = () => {
2977
+ if (!focused) return true;
2978
+ const message = verdict(text);
2979
+ onError?.(message);
2980
+ return message === void 0;
2981
+ };
2982
+ return {
2983
+ display: focused ? text : value === "" ? "" : format(value, locale),
2984
+ onText,
2985
+ onFocus: () => {
2986
+ setFocused(true);
2987
+ setText(value === "" ? "" : formatTyped(value, locale));
2988
+ },
2989
+ onBlur: () => {
2990
+ setFocused(false);
2991
+ if (verdict(text) !== void 0) onError?.(verdict(text));
2992
+ },
2993
+ isReady
2994
+ };
2995
+ }
2996
+ var SINGLE_PICKER_WIDTH = 340;
2997
+ var ICON_ROOM = 48;
2998
+ var ICON_SLOT = { position: "absolute", right: 2, top: 0, bottom: 0, display: "flex", alignItems: "center" };
2999
+ var anchorStyles = StyleSheet.create({ wrap: { position: "relative", width: "100%" } });
3000
+ function DatePickerInput({ fieldProps, context, onTypedError }) {
3001
+ const { label, value, onChange, onSubmit, accessibilityHint, testID, required, disabled = false, min, max } = fieldProps;
3002
+ const { labels } = useDatePickerConfig();
3003
+ const phone = useIsPhone();
3004
+ const [open, setOpen] = useState(false);
3005
+ const anchorRef = useRef(null);
3006
+ const inputRef = useRef(null);
3007
+ const bounds = { min, max };
3008
+ const typed = useTypedDate({ value, onChange, bounds, format: formatDisplay, onError: onTypedError });
3009
+ const { style, focusBind, hoverBind } = useThemedInput({ hasError: context.hasError, editable: !disabled });
3010
+ const focus = focusBind;
3011
+ const webA11y = webFieldA11y({ describedById: context.describedById, hasError: context.hasError, required });
3012
+ const close = useCallback(() => setOpen(false), []);
3013
+ useReturnFocus(open, inputRef);
3014
+ const commit = (iso) => {
3015
+ onTypedError?.(void 0);
3016
+ onChange(iso);
3017
+ close();
3018
+ };
3019
+ const onKeyDown = (event) => {
3020
+ if (event.key === "ArrowDown" && event.altKey) {
3021
+ event.preventDefault();
3022
+ setOpen(true);
3023
+ return;
3024
+ }
3025
+ if (event.key !== "Enter" || onSubmit === void 0) return;
3026
+ event.preventDefault();
3027
+ if (typed.isReady()) onSubmit();
3028
+ };
3029
+ return /* @__PURE__ */ jsxs(View, { ref: anchorRef, style: anchorStyles.wrap, children: [
3030
+ /* @__PURE__ */ jsx(
3031
+ "input",
3032
+ {
3033
+ ...webA11y,
3034
+ ...hoverBind,
3035
+ ref: inputRef,
3036
+ "aria-label": label,
3037
+ autoComplete: "off",
3038
+ "data-testid": testID,
3039
+ disabled,
3040
+ id: context.controlId,
3041
+ style: { ...buildNativeInputStyle(style), paddingInlineEnd: ICON_ROOM },
3042
+ title: accessibilityHint,
3043
+ type: "text",
3044
+ value: typed.display,
3045
+ onBlur: (event) => {
3046
+ focus.onBlur?.(event);
3047
+ typed.onBlur();
3048
+ },
3049
+ onChange: (event) => typed.onText(event.target.value),
3050
+ onFocus: (event) => {
3051
+ focus.onFocus?.(event);
3052
+ typed.onFocus();
3053
+ },
3054
+ onKeyDown
3055
+ }
3056
+ ),
3057
+ /* @__PURE__ */ jsx("div", { style: ICON_SLOT, children: /* @__PURE__ */ jsx(IconButton, { accessibilityHint: labels.openCalendarHint, accessibilityLabel: labels.openCalendar, appearance: "ghost", disabled, renderIcon: (color) => /* @__PURE__ */ jsx(Glyph, { color, name: "calendar" /* Calendar */ }), testID: `${testID}-calendar`, onPress: () => setOpen((current) => !current) }) }),
3058
+ open ? /* @__PURE__ */ jsx(PickerSurface, { anchorRef, label: labels.dialog, minWidth: SINGLE_PICKER_WIDTH, phone, testID: `${testID}-picker`, onDismiss: close, children: /* @__PURE__ */ jsx(SingleCalendar, { bounds, testID: `${testID}-picker`, value, onCommit: commit }) }) : null
3059
+ ] });
3060
+ }
2338
3061
  var IS_WEB7 = Platform.OS === "web";
2339
- function TemporalInput({ fieldProps, context, webInputType }) {
3062
+ var DATE_TYPE = "date";
3063
+ function TemporalInput({ fieldProps, context, webInputType, onTypedError }) {
3064
+ if (IS_WEB7 && webInputType === DATE_TYPE) return /* @__PURE__ */ jsx(DatePickerInput, { context, fieldProps, onTypedError });
2340
3065
  if (IS_WEB7) return /* @__PURE__ */ jsx(WebDateInput, { context, fieldProps, webInputType });
2341
3066
  return /* @__PURE__ */ jsx(
2342
3067
  ThemedTextInput,
@@ -2357,11 +3082,269 @@ function TemporalInput({ fieldProps, context, webInputType }) {
2357
3082
  }
2358
3083
  function TemporalField({ fieldProps, webInputType }) {
2359
3084
  const { label, required, hint, error } = fieldProps;
2360
- return /* @__PURE__ */ jsx(Field, { error, hint, label, required, children: (context) => /* @__PURE__ */ jsx(TemporalInput, { context, fieldProps, webInputType }) });
3085
+ const [typedError, setTypedError] = useState(void 0);
3086
+ return /* @__PURE__ */ jsx(Field, { error: error ?? typedError, hint, label, required, children: (context) => /* @__PURE__ */ jsx(TemporalInput, { context, fieldProps, webInputType, onTypedError: setTypedError }) });
2361
3087
  }
2362
3088
  function DateField(props) {
2363
3089
  return /* @__PURE__ */ jsx(TemporalField, { fieldProps: props, webInputType: "date" });
2364
3090
  }
3091
+ function NativeDateRange({ value, onChange, onSubmit, fromLabel, toLabel, hint, style, testID }) {
3092
+ return /* @__PURE__ */ jsxs(View, { style: [controlStyles.dateRow, style], testID: `${testID}-range`, children: [
3093
+ /* @__PURE__ */ jsx(View, { style: controlStyles.dateCol, children: /* @__PURE__ */ jsx(DateField, { accessibilityHint: hint, label: fromLabel, testID: `${testID}-from`, value: value.from, onChange: (from) => onChange({ from, to: value.to }), onSubmit }) }),
3094
+ /* @__PURE__ */ jsx(View, { style: controlStyles.dateCol, children: /* @__PURE__ */ jsx(DateField, { accessibilityHint: hint, label: toLabel, testID: `${testID}-to`, value: value.to, onChange: (to) => onChange({ from: value.from, to }), onSubmit }) })
3095
+ ] });
3096
+ }
3097
+
3098
+ // src/DatePicker/utils/rangePresets.ts
3099
+ var RANGE_PRESETS = ["today" /* Today */, "last7Days" /* Last7Days */, "thisMonth" /* ThisMonth */, "quarter" /* Quarter */];
3100
+ var PRESET_LABEL = {
3101
+ ["today" /* Today */]: "today",
3102
+ ["last7Days" /* Last7Days */]: "last7Days",
3103
+ ["thisMonth" /* ThisMonth */]: "thisMonth",
3104
+ ["quarter" /* Quarter */]: "quarter"
3105
+ };
3106
+ var MONTHS_IN_QUARTER = 3;
3107
+ var EPOCH2 = { year: 1970, month: 1};
3108
+ function presetLabel(labels, preset) {
3109
+ return labels[PRESET_LABEL[preset]];
3110
+ }
3111
+ function quarterStart(today) {
3112
+ const parts = parseIso(today) ?? EPOCH2;
3113
+ const month = Math.floor((parts.month - 1) / MONTHS_IN_QUARTER) * MONTHS_IN_QUARTER + 1;
3114
+ return toIso({ year: parts.year, month, day: 1 });
3115
+ }
3116
+ function presetRange(preset, today) {
3117
+ if (preset === "last7Days" /* Last7Days */) return { from: addDays(today, -6), to: today };
3118
+ if (preset === "thisMonth" /* ThisMonth */) return { from: monthStart(today), to: today };
3119
+ if (preset === "quarter" /* Quarter */) return { from: quarterStart(today), to: today };
3120
+ return { from: today, to: today };
3121
+ }
3122
+ function matchingPreset(range, today) {
3123
+ return RANGE_PRESETS.find((preset) => {
3124
+ const span = presetRange(preset, today);
3125
+ return span.from === range.from && span.to === range.to;
3126
+ }) ?? null;
3127
+ }
3128
+ function pickRangeDay(range, day) {
3129
+ const open = range.from !== "" && range.to === "";
3130
+ if (!open) return { from: day, to: "" };
3131
+ return day < range.from ? { from: day, to: range.from } : { from: range.from, to: day };
3132
+ }
3133
+ var GAP3 = 8;
3134
+ var CHIP_PAD = 16;
3135
+ var FONT3 = 14;
3136
+ var BOLD4 = 700;
3137
+ var REGULAR2 = 400;
3138
+ var ACTIVE_BORDER = 2;
3139
+ function PresetChips({ active, testID, onPick }) {
3140
+ const { labels } = useDatePickerConfig();
3141
+ const colors = usePickerColors();
3142
+ const chipStyle = (isActive) => ({
3143
+ minHeight: MIN_TOUCH_TARGET_PX,
3144
+ padding: `0 ${CHIP_PAD}px`,
3145
+ borderRadius: MIN_TOUCH_TARGET_PX / 2,
3146
+ border: `${isActive ? ACTIVE_BORDER : 1}px solid ${isActive ? colors.brand : colors.border}`,
3147
+ background: colors.surface,
3148
+ color: colors.text,
3149
+ fontFamily: "inherit",
3150
+ fontSize: FONT3,
3151
+ fontWeight: isActive ? BOLD4 : REGULAR2,
3152
+ cursor: "pointer"
3153
+ });
3154
+ return /* @__PURE__ */ jsx("div", { "aria-label": labels.presets, role: "group", style: { display: "flex", flexWrap: "wrap", gap: GAP3, marginBottom: GAP3 }, children: RANGE_PRESETS.map((preset) => /* @__PURE__ */ jsxs("button", { "aria-pressed": active === preset, "data-testid": `${testID}-preset-${preset}`, style: chipStyle(active === preset), title: labels.presetHint, type: "button", onClick: () => onPick(preset), children: [
3155
+ active === preset ? "\u2713 " : "",
3156
+ presetLabel(labels, preset)
3157
+ ] }, preset)) });
3158
+ }
3159
+ var GAP4 = 8;
3160
+ var FONT4 = 14;
3161
+ function PresetMenu({ active, testID, onPick }) {
3162
+ const { labels } = useDatePickerConfig();
3163
+ const colors = usePickerColors();
3164
+ const onChange = (event) => {
3165
+ const preset = RANGE_PRESETS.find((candidate) => candidate === event.target.value);
3166
+ if (preset !== void 0) onPick(preset);
3167
+ };
3168
+ return /* @__PURE__ */ jsxs(
3169
+ "select",
3170
+ {
3171
+ "aria-label": labels.presets,
3172
+ "data-testid": `${testID}-presets`,
3173
+ style: { minHeight: MIN_TOUCH_TARGET_PX, width: "100%", marginBottom: GAP4, border: `1px solid ${colors.border}`, borderRadius: GAP4, background: colors.surface, color: colors.text, fontFamily: "inherit", fontSize: FONT4 },
3174
+ title: labels.presetHint,
3175
+ value: active ?? "",
3176
+ onChange,
3177
+ children: [
3178
+ /* @__PURE__ */ jsx("option", { value: "", children: labels.presets }),
3179
+ RANGE_PRESETS.map((preset) => /* @__PURE__ */ jsx("option", { value: preset, children: presetLabel(labels, preset) }, preset))
3180
+ ]
3181
+ }
3182
+ );
3183
+ }
3184
+ var PHONE_LIST_HEIGHT = "min(56vh, 440px)";
3185
+ var MONTH_GAP = 32;
3186
+ var NAV_ROW = { position: "absolute", left: 0, right: 0, top: 0, display: "flex", justifyContent: "space-between", pointerEvents: "none" };
3187
+ var NAV_SLOT = { pointerEvents: "auto" };
3188
+ function RangeMonthsList({ months, grid }) {
3189
+ return /* @__PURE__ */ jsx("div", { "data-testid": `${grid.testID}-months`, style: { maxHeight: PHONE_LIST_HEIGHT, overflowY: "auto" }, children: months.map((month) => /* @__PURE__ */ jsx(MonthGrid, { showCaption: true, month, ...grid }, month)) });
3190
+ }
3191
+ function RangeMonthsPair({ months, grid, motion, onShift }) {
3192
+ const { labels } = useDatePickerConfig();
3193
+ return /* @__PURE__ */ jsxs("div", { style: { position: "relative" }, children: [
3194
+ /* @__PURE__ */ jsxs("div", { style: NAV_ROW, children: [
3195
+ /* @__PURE__ */ jsx("div", { style: NAV_SLOT, children: /* @__PURE__ */ jsx(IconButton, { accessibilityHint: labels.monthHint, accessibilityLabel: labels.previousMonth, appearance: "ghost", renderIcon: (color) => /* @__PURE__ */ jsx(Glyph, { color, name: "previous" /* Previous */ }), testID: `${grid.testID}-previous`, onPress: () => onShift(-1) }) }),
3196
+ /* @__PURE__ */ jsx("div", { style: NAV_SLOT, children: /* @__PURE__ */ jsx(IconButton, { accessibilityHint: labels.monthHint, accessibilityLabel: labels.nextMonth, appearance: "ghost", renderIcon: (color) => /* @__PURE__ */ jsx(Glyph, { color, name: "next" /* Next */ }), testID: `${grid.testID}-next`, onPress: () => onShift(1) }) })
3197
+ ] }),
3198
+ /* @__PURE__ */ jsx("div", { style: { display: "flex", gap: MONTH_GAP }, children: months.map((month) => /* @__PURE__ */ jsx(MonthGrid, { showCaption: true, month, motion, ...grid }, month)) })
3199
+ ] });
3200
+ }
3201
+ var PHONE_MONTHS = 6;
3202
+ var DESKTOP_MONTHS = 2;
3203
+ var SUMMARY_FONT = 14;
3204
+ var SEMIBOLD = 600;
3205
+ function useRangeSummary(draft) {
3206
+ const { labels, locale } = useDatePickerConfig();
3207
+ if (draft.from === "") return "";
3208
+ if (draft.to === "") return formatShort(draft.from, locale);
3209
+ const days = labels.dayCount.replace("{{p1}}", String(daysBetweenInclusive(draft.from, draft.to)));
3210
+ return `${formatShort(draft.from, locale, false)}${labels.rangeSeparator}${formatShort(draft.to, locale)} \xB7 ${days}`;
3211
+ }
3212
+ function RangeCalendar({ value, bounds, phone, testID, onApply, onCancel }) {
3213
+ const { labels, today } = useDatePickerConfig();
3214
+ const [draft, setDraft] = useState(value);
3215
+ const initialDay = clampToBounds(value.from !== "" ? value.from : today, bounds.min, bounds.max);
3216
+ const pickDraft = useCallback((iso) => setDraft((current) => pickRangeDay(current, iso)), []);
3217
+ const focus = useGridFocus(initialDay, bounds, testID, pickDraft);
3218
+ const visible = phone ? PHONE_MONTHS : DESKTOP_MONTHS;
3219
+ const [first, setFirst] = useState(() => monthStart(phone ? initialDay : addMonths(initialDay, 1 - DESKTOP_MONTHS)));
3220
+ const focusMonth = monthStart(focus.focusedDay);
3221
+ const last = addMonths(first, visible - 1);
3222
+ const motion = useMonthSlide(first);
3223
+ const summary = useRangeSummary(draft);
3224
+ useEffect(() => {
3225
+ if (focusMonth < first) setFirst(focusMonth);
3226
+ else if (focusMonth > last) setFirst(addMonths(focusMonth, 1 - visible));
3227
+ }, [focusMonth, first, last, visible]);
3228
+ const pick = (iso) => {
3229
+ pickDraft(iso);
3230
+ focus.moveTo(iso);
3231
+ };
3232
+ const applyPreset = (preset) => {
3233
+ const range = presetRange(preset, today);
3234
+ setDraft(range);
3235
+ focus.moveTo(range.to);
3236
+ };
3237
+ const shift = (step) => {
3238
+ setFirst(addMonths(first, step));
3239
+ focus.moveTo(addMonths(focus.focusedDay, step));
3240
+ };
3241
+ const months = Array.from({ length: visible }, (_unused, index) => addMonths(first, index));
3242
+ const grid = { selection: draft, focusedDay: focus.focusedDay, bounds, testID, onPick: pick, onKey: focus.onDayKey };
3243
+ const presets = { active: matchingPreset(draft, today), testID, onPick: applyPreset };
3244
+ return /* @__PURE__ */ jsxs("div", { children: [
3245
+ phone ? /* @__PURE__ */ jsx(PresetMenu, { ...presets }) : /* @__PURE__ */ jsx(PresetChips, { ...presets }),
3246
+ phone ? /* @__PURE__ */ jsx(RangeMonthsList, { grid, months }) : /* @__PURE__ */ jsx(RangeMonthsPair, { grid, months, motion, onShift: shift }),
3247
+ /* @__PURE__ */ jsxs(PickerFooter, { summary: /* @__PURE__ */ jsx("span", { "aria-live": "polite", "data-testid": `${testID}-summary`, style: { fontSize: SUMMARY_FONT, fontWeight: SEMIBOLD }, children: summary }), children: [
3248
+ /* @__PURE__ */ jsx(Button, { accessibilityHint: labels.cancelHint, accessibilityLabel: labels.cancel, label: labels.cancel, testID: `${testID}-cancel`, variant: "ghost", onPress: onCancel }),
3249
+ /* @__PURE__ */ jsx(
3250
+ Button,
3251
+ {
3252
+ accessibilityHint: labels.applyHint,
3253
+ accessibilityLabel: labels.apply,
3254
+ disabled: draft.from === "",
3255
+ label: labels.apply,
3256
+ testID: `${testID}-apply`,
3257
+ onPress: () => onApply({ from: draft.from, to: draft.to === "" ? draft.from : draft.to })
3258
+ }
3259
+ )
3260
+ ] })
3261
+ ] });
3262
+ }
3263
+ var RANGE_PICKER_WIDTH = 690;
3264
+ var GAP5 = 8;
3265
+ var NO_BOUNDS = {};
3266
+ var SEGMENT = { flex: 1, minWidth: 0, border: "none", background: "transparent", color: "inherit", font: "inherit", outline: "none", padding: 0 };
3267
+ function orNone(value) {
3268
+ return value !== "" ? value : void 0;
3269
+ }
3270
+ function WebDateRange({ value, onChange, onSubmit, fromLabel, toLabel, hint, testID, context, onTypedError }) {
3271
+ const { labels } = useDatePickerConfig();
3272
+ const phone = useIsPhone();
3273
+ const [open, setOpen] = useState(false);
3274
+ const [fromError, setFromError] = useState(void 0);
3275
+ const [toError, setToError] = useState(void 0);
3276
+ const anchorRef = useRef(null);
3277
+ const fromRef = useRef(null);
3278
+ const from = useTypedDate({ value: value.from, onChange: (next) => onChange({ from: next, to: value.to }), bounds: { max: orNone(value.to) }, format: formatShort, onError: setFromError, rangeMessage: labels.rangeOrder });
3279
+ const to = useTypedDate({ value: value.to, onChange: (next) => onChange({ from: value.from, to: next }), bounds: { min: orNone(value.from) }, format: formatShort, onError: setToError, rangeMessage: labels.rangeOrder });
3280
+ const { style, focusBind, hoverBind } = useThemedInput({ hasError: context.hasError, editable: true });
3281
+ const focus = focusBind;
3282
+ const webA11y = webFieldA11y({ describedById: context.describedById, hasError: context.hasError });
3283
+ useEffect(() => onTypedError(fromError ?? toError), [fromError, toError, onTypedError]);
3284
+ const close = useCallback(() => setOpen(false), []);
3285
+ useReturnFocus(open, fromRef);
3286
+ const onKeyDown = (event) => {
3287
+ if (event.key === "ArrowDown" && event.altKey) {
3288
+ event.preventDefault();
3289
+ setOpen(true);
3290
+ return;
3291
+ }
3292
+ if (event.key !== "Enter" || onSubmit === void 0) return;
3293
+ event.preventDefault();
3294
+ const ready = [from.isReady(), to.isReady()].every(Boolean);
3295
+ if (ready) onSubmit();
3296
+ };
3297
+ const segment = (side, typed) => /* @__PURE__ */ jsx(
3298
+ "input",
3299
+ {
3300
+ ...webA11y,
3301
+ ref: side === "from" /* From */ ? fromRef : void 0,
3302
+ "aria-label": side === "from" /* From */ ? fromLabel : toLabel,
3303
+ autoComplete: "off",
3304
+ "data-testid": `${testID}-${side}`,
3305
+ id: side === "from" /* From */ ? context.controlId : void 0,
3306
+ style: SEGMENT,
3307
+ title: hint,
3308
+ type: "text",
3309
+ value: typed.display,
3310
+ onBlur: (event) => {
3311
+ focus.onBlur?.(event);
3312
+ typed.onBlur();
3313
+ },
3314
+ onChange: (event) => typed.onText(event.target.value),
3315
+ onFocus: (event) => {
3316
+ focus.onFocus?.(event);
3317
+ typed.onFocus();
3318
+ },
3319
+ onKeyDown
3320
+ }
3321
+ );
3322
+ return /* @__PURE__ */ jsxs(View, { ref: anchorRef, style: anchorStyles.wrap, children: [
3323
+ /* @__PURE__ */ jsxs("div", { ...hoverBind, style: { ...buildNativeInputStyle(style), display: "flex", alignItems: "center", gap: GAP5, paddingInlineEnd: ICON_ROOM }, children: [
3324
+ segment("from" /* From */, from),
3325
+ /* @__PURE__ */ jsx("span", { "aria-hidden": "true", children: "\u2192" }),
3326
+ segment("to" /* To */, to)
3327
+ ] }),
3328
+ /* @__PURE__ */ jsx("div", { style: ICON_SLOT, children: /* @__PURE__ */ jsx(IconButton, { accessibilityHint: labels.openCalendarHint, accessibilityLabel: labels.openCalendar, appearance: "ghost", renderIcon: (color) => /* @__PURE__ */ jsx(Glyph, { color, name: "calendar" /* Calendar */ }), testID: `${testID}-calendar`, onPress: () => setOpen((current) => !current) }) }),
3329
+ open ? /* @__PURE__ */ jsx(PickerSurface, { anchorRef, label: labels.rangeDialog, minWidth: RANGE_PICKER_WIDTH, phone, testID: `${testID}-picker`, onDismiss: close, children: /* @__PURE__ */ jsx(
3330
+ RangeCalendar,
3331
+ {
3332
+ bounds: NO_BOUNDS,
3333
+ phone,
3334
+ testID: `${testID}-picker`,
3335
+ value,
3336
+ onApply: (range) => {
3337
+ setFromError(void 0);
3338
+ setToError(void 0);
3339
+ onChange(range);
3340
+ close();
3341
+ },
3342
+ onCancel: close
3343
+ }
3344
+ ) }) : null
3345
+ ] });
3346
+ }
3347
+ var IS_WEB8 = Platform.OS === "web";
2365
3348
  function DateRangeControl({
2366
3349
  value,
2367
3350
  onChange,
@@ -2373,30 +3356,12 @@ function DateRangeControl({
2373
3356
  testID
2374
3357
  }) {
2375
3358
  const hint = accessibilityHint ?? `${fromLabel} \u2013 ${toLabel}`;
2376
- return /* @__PURE__ */ jsx(GapOwnedProvider, { value: true, children: /* @__PURE__ */ jsxs(View, { style: [controlStyles.dateRow, style], testID: `${testID}-range`, children: [
2377
- /* @__PURE__ */ jsx(View, { style: controlStyles.dateCol, children: /* @__PURE__ */ jsx(
2378
- DateField,
2379
- {
2380
- accessibilityHint: hint,
2381
- label: fromLabel,
2382
- testID: `${testID}-from`,
2383
- value: value.from,
2384
- onChange: (from) => onChange({ from, to: value.to }),
2385
- onSubmit
2386
- }
2387
- ) }),
2388
- /* @__PURE__ */ jsx(View, { style: controlStyles.dateCol, children: /* @__PURE__ */ jsx(
2389
- DateField,
2390
- {
2391
- accessibilityHint: hint,
2392
- label: toLabel,
2393
- testID: `${testID}-to`,
2394
- value: value.to,
2395
- onChange: (to) => onChange({ from: value.from, to }),
2396
- onSubmit
2397
- }
2398
- ) })
2399
- ] }) });
3359
+ const { labels } = useDatePickerConfig();
3360
+ const [typedError, setTypedError] = useState(void 0);
3361
+ if (!IS_WEB8) {
3362
+ return /* @__PURE__ */ jsx(GapOwnedProvider, { value: true, children: /* @__PURE__ */ jsx(NativeDateRange, { fromLabel, hint, style, testID, toLabel, value, onChange, onSubmit }) });
3363
+ }
3364
+ return /* @__PURE__ */ jsx(GapOwnedProvider, { value: true, children: /* @__PURE__ */ jsx(View, { style, testID: `${testID}-range`, children: /* @__PURE__ */ jsx(Field, { error: typedError, label: `${fromLabel}${labels.rangeSeparator}${toLabel}`, children: (context) => /* @__PURE__ */ jsx(WebDateRange, { context, fromLabel, hint, testID, toLabel, value, onChange, onSubmit, onTypedError: setTypedError }) }) }) });
2400
3365
  }
2401
3366
  function DateTimeField(props) {
2402
3367
  return /* @__PURE__ */ jsx(TemporalField, { fieldProps: props, webInputType: "datetime-local" });
@@ -2432,7 +3397,7 @@ var ROW_GAP = 4;
2432
3397
  var TAB_PADDING = 4;
2433
3398
  var INDICATOR_WIDTH = 2;
2434
3399
  var TAB_FONT_SIZE = 12;
2435
- var styles15 = StyleSheet.create({
3400
+ var styles17 = StyleSheet.create({
2436
3401
  row: { flexDirection: "row", flexWrap: "nowrap", gap: ROW_GAP },
2437
3402
  tab: {
2438
3403
  borderBottomWidth: INDICATOR_WIDTH,
@@ -2472,13 +3437,13 @@ var StepperTab = ({
2472
3437
  accessibilityRole: "tab",
2473
3438
  accessibilityState: { selected },
2474
3439
  "aria-selected": selected,
2475
- style: [styles15.tab, { borderBottomColor: indicator }, ring.ringStyle],
3440
+ style: [styles17.tab, { borderBottomColor: indicator }, ring.ringStyle],
2476
3441
  testID,
2477
3442
  onBlur: ring.onBlur,
2478
3443
  onFocus: ring.onFocus,
2479
3444
  onPress: () => onStep(step.key),
2480
3445
  ...webKeyProps,
2481
- children: /* @__PURE__ */ jsx(Text, { style: [styles15.text, { color: theme.colors.text }, selected ? styles15.textSelected : void 0], children: step.label })
3446
+ children: /* @__PURE__ */ jsx(Text, { style: [styles17.text, { color: theme.colors.text }, selected ? styles17.textSelected : void 0], children: step.label })
2482
3447
  }
2483
3448
  );
2484
3449
  };
@@ -2488,7 +3453,7 @@ var StepperTabs = ({
2488
3453
  onStep,
2489
3454
  stepHint,
2490
3455
  testID
2491
- }) => /* @__PURE__ */ jsx(View, { accessibilityRole: "tablist", style: styles15.row, testID, children: steps.map((step) => /* @__PURE__ */ jsx(
3456
+ }) => /* @__PURE__ */ jsx(View, { accessibilityRole: "tablist", style: styles17.row, testID, children: steps.map((step) => /* @__PURE__ */ jsx(
2492
3457
  StepperTab,
2493
3458
  {
2494
3459
  hint: stepHint,
@@ -2507,7 +3472,7 @@ function resolveStepNeighbours(steps, current) {
2507
3472
  return { previous: steps[index - 1] ?? null, next: steps[index + 1] ?? null };
2508
3473
  }
2509
3474
  var ROW_GAP2 = 8;
2510
- var styles16 = StyleSheet.create({
3475
+ var styles18 = StyleSheet.create({
2511
3476
  cell: { flex: 1, minWidth: 0 },
2512
3477
  row: { flexDirection: "row", gap: ROW_GAP2 }
2513
3478
  });
@@ -2519,8 +3484,8 @@ var StepperNav = ({
2519
3484
  testID
2520
3485
  }) => {
2521
3486
  const { previous, next } = resolveStepNeighbours(steps, current);
2522
- return /* @__PURE__ */ jsxs(View, { style: styles16.row, testID, children: [
2523
- /* @__PURE__ */ jsx(View, { style: styles16.cell, children: /* @__PURE__ */ jsx(
3487
+ return /* @__PURE__ */ jsxs(View, { style: styles18.row, testID, children: [
3488
+ /* @__PURE__ */ jsx(View, { style: styles18.cell, children: /* @__PURE__ */ jsx(
2524
3489
  Button,
2525
3490
  {
2526
3491
  fullWidth: true,
@@ -2536,7 +3501,7 @@ var StepperNav = ({
2536
3501
  }
2537
3502
  }
2538
3503
  ) }),
2539
- next === null ? null : /* @__PURE__ */ jsx(View, { style: styles16.cell, children: /* @__PURE__ */ jsx(
3504
+ next === null ? null : /* @__PURE__ */ jsx(View, { style: styles18.cell, children: /* @__PURE__ */ jsx(
2540
3505
  Button,
2541
3506
  {
2542
3507
  fullWidth: true,
@@ -2551,13 +3516,13 @@ var StepperNav = ({
2551
3516
  ] });
2552
3517
  };
2553
3518
  var STATUS_FONT = 16;
2554
- var styles17 = StyleSheet.create({
3519
+ var styles19 = StyleSheet.create({
2555
3520
  line: { fontSize: STATUS_FONT }
2556
3521
  });
2557
3522
  function FormStatusLine({ message, testID, style }) {
2558
3523
  const { theme } = useUi();
2559
3524
  if (message === null || message === void 0 || message === "") return null;
2560
- return /* @__PURE__ */ jsx(Text, { role: "alert", style: [styles17.line, { color: theme.colors.text }, style], testID, children: message });
3525
+ return /* @__PURE__ */ jsx(Text, { role: "alert", style: [styles19.line, { color: theme.colors.text }, style], testID, children: message });
2561
3526
  }
2562
3527
  function useFocusFirstInvalid(refs) {
2563
3528
  const latest = useRef(refs);
@@ -2581,13 +3546,13 @@ function useKeepInView(trigger) {
2581
3546
  }
2582
3547
  var DEFAULT_PREVIEW_PX = 48;
2583
3548
  var PREVIEW_RADIUS = 8;
2584
- var GAP = 8;
3549
+ var GAP6 = 8;
2585
3550
  var TITLE_FONT_SIZE = 14;
2586
3551
  var HELP_FONT_SIZE = 13;
2587
- var styles18 = StyleSheet.create({
3552
+ var styles20 = StyleSheet.create({
2588
3553
  help: { flex: 1, fontSize: HELP_FONT_SIZE },
2589
- root: { gap: GAP },
2590
- tile: { alignItems: "center", flexDirection: "row", gap: GAP },
3554
+ root: { gap: GAP6 },
3555
+ tile: { alignItems: "center", flexDirection: "row", gap: GAP6 },
2591
3556
  title: { fontSize: TITLE_FONT_SIZE, fontWeight: "700" },
2592
3557
  toggle: { alignSelf: "flex-start", justifyContent: "center", minHeight: MIN_TOUCH_TARGET_PX },
2593
3558
  toggleText: { fontSize: TITLE_FONT_SIZE, fontWeight: "700", textDecorationLine: "underline" }
@@ -2606,11 +3571,11 @@ var UploadWithLinkField = ({
2606
3571
  const url = value ?? "";
2607
3572
  const [pasting, setPasting] = useState(url !== "");
2608
3573
  const previewBox = { borderRadius: PREVIEW_RADIUS, height: previewSize, width: previewSize };
2609
- return /* @__PURE__ */ jsxs(View, { style: styles18.root, children: [
2610
- /* @__PURE__ */ jsx(Text, { style: [styles18.title, { color: theme.colors.text }], children: labels.title }),
2611
- /* @__PURE__ */ jsxs(View, { style: styles18.tile, children: [
3574
+ return /* @__PURE__ */ jsxs(View, { style: styles20.root, children: [
3575
+ /* @__PURE__ */ jsx(Text, { style: [styles20.title, { color: theme.colors.text }], children: labels.title }),
3576
+ /* @__PURE__ */ jsxs(View, { style: styles20.tile, children: [
2612
3577
  url === "" ? /* @__PURE__ */ jsx(View, { style: [previewBox, { backgroundColor: theme.colors.border }] }) : /* @__PURE__ */ jsx(Image, { accessible: false, source: { uri: url }, style: previewBox, testID: `${testID}-preview` }),
2613
- labels.help === void 0 ? null : /* @__PURE__ */ jsx(Text, { style: [styles18.help, { color: theme.colors.text }], children: labels.help })
3578
+ labels.help === void 0 ? null : /* @__PURE__ */ jsx(Text, { style: [styles20.help, { color: theme.colors.text }], children: labels.help })
2614
3579
  ] }),
2615
3580
  uploadControl,
2616
3581
  /* @__PURE__ */ jsx(
@@ -2621,12 +3586,12 @@ var UploadWithLinkField = ({
2621
3586
  accessibilityRole: "button",
2622
3587
  accessibilityState: { expanded: pasting },
2623
3588
  "aria-expanded": pasting,
2624
- style: [styles18.toggle, ring.ringStyle],
3589
+ style: [styles20.toggle, ring.ringStyle],
2625
3590
  testID: `${testID}-paste`,
2626
3591
  onBlur: ring.onBlur,
2627
3592
  onFocus: ring.onFocus,
2628
3593
  onPress: () => setPasting(!pasting),
2629
- children: /* @__PURE__ */ jsx(Text, { style: [styles18.toggleText, { color: theme.colors.text }], children: labels.pasteToggle })
3594
+ children: /* @__PURE__ */ jsx(Text, { style: [styles20.toggleText, { color: theme.colors.text }], children: labels.pasteToggle })
2630
3595
  }
2631
3596
  ),
2632
3597
  pasting ? /* @__PURE__ */ jsx(
@@ -2645,7 +3610,7 @@ var UploadWithLinkField = ({
2645
3610
  };
2646
3611
  var ACTION_GAP = 8;
2647
3612
  var GROUP_GAP = 16;
2648
- var styles19 = StyleSheet.create({
3613
+ var styles21 = StyleSheet.create({
2649
3614
  action: { alignItems: "flex-start", marginTop: ACTION_GAP },
2650
3615
  group: { marginBottom: GROUP_GAP }
2651
3616
  });
@@ -2668,7 +3633,7 @@ var AddOnRequest = ({
2668
3633
  onRemove();
2669
3634
  };
2670
3635
  if (!isAddOnOpen(hasValue, requested))
2671
- return /* @__PURE__ */ jsx(View, { style: [styles19.action, style], children: /* @__PURE__ */ jsx(
3636
+ return /* @__PURE__ */ jsx(View, { style: [styles21.action, style], children: /* @__PURE__ */ jsx(
2672
3637
  Button,
2673
3638
  {
2674
3639
  accessibilityHint: addHint,
@@ -2680,9 +3645,9 @@ var AddOnRequest = ({
2680
3645
  onPress: () => setRequested(true)
2681
3646
  }
2682
3647
  ) });
2683
- return /* @__PURE__ */ jsxs(View, { style: [styles19.group, style], testID, children: [
3648
+ return /* @__PURE__ */ jsxs(View, { style: [styles21.group, style], testID, children: [
2684
3649
  children,
2685
- /* @__PURE__ */ jsx(View, { style: styles19.action, children: /* @__PURE__ */ jsx(
3650
+ /* @__PURE__ */ jsx(View, { style: styles21.action, children: /* @__PURE__ */ jsx(
2686
3651
  Button,
2687
3652
  {
2688
3653
  accessibilityHint: removeHint,
@@ -2699,7 +3664,7 @@ var AddOnRequest = ({
2699
3664
  var ROW_GAP3 = 8;
2700
3665
  var TEXT_SIZE = 13;
2701
3666
  var TEXT_LINE = 18;
2702
- var styles20 = StyleSheet.create({
3667
+ var styles22 = StyleSheet.create({
2703
3668
  row: { alignItems: "center", columnGap: ROW_GAP3, flexDirection: "row", justifyContent: "space-between" },
2704
3669
  text: { flexShrink: 1, fontSize: TEXT_SIZE, fontWeight: "700", lineHeight: TEXT_LINE }
2705
3670
  });
@@ -2707,8 +3672,8 @@ var isFixBarVisible = (count) => count > 0;
2707
3672
  var FixBar = ({ count, message, showLabel, showHint, onShow, testID, style }) => {
2708
3673
  const { theme } = useUi();
2709
3674
  if (!isFixBarVisible(count)) return null;
2710
- return /* @__PURE__ */ jsxs(View, { style: [styles20.row, style], testID, children: [
2711
- /* @__PURE__ */ jsx(Text, { role: "alert", style: [styles20.text, { color: fieldErrorInk(theme) }], testID: `${testID}-count`, children: message }),
3675
+ return /* @__PURE__ */ jsxs(View, { style: [styles22.row, style], testID, children: [
3676
+ /* @__PURE__ */ jsx(Text, { role: "alert", style: [styles22.text, { color: fieldErrorInk(theme) }], testID: `${testID}-count`, children: message }),
2712
3677
  /* @__PURE__ */ jsx(
2713
3678
  Button,
2714
3679
  {
@@ -2729,55 +3694,6 @@ var SelectSurface = /* @__PURE__ */ ((SelectSurface2) => {
2729
3694
  SelectSurface2["Dropdown"] = "dropdown";
2730
3695
  return SelectSurface2;
2731
3696
  })(SelectSurface || {});
2732
- function useAnchorRect2(anchorRef) {
2733
- const [rect2, setRect] = useState(null);
2734
- useEffect(() => {
2735
- anchorRef.current?.measureInWindow((x, y, width, height) => setRect({ x, y, width, height }));
2736
- }, [anchorRef]);
2737
- return rect2;
2738
- }
2739
-
2740
- // src/SearchSelect/DropdownPlacement.ts
2741
- var DropdownPlacement = /* @__PURE__ */ ((DropdownPlacement2) => {
2742
- DropdownPlacement2["Below"] = "below";
2743
- DropdownPlacement2["Above"] = "above";
2744
- return DropdownPlacement2;
2745
- })(DropdownPlacement || {});
2746
-
2747
- // src/SearchSelect/utils/dropdownFrame.ts
2748
- var MIN_PANEL_WIDTH = 240;
2749
- var EDGE = 8;
2750
- function placeDropdown(anchor, panelHeight, viewportHeight) {
2751
- const roomBelow = viewportHeight - (anchor.y + anchor.height);
2752
- if (roomBelow >= panelHeight) return "below" /* Below */;
2753
- return anchor.y > roomBelow ? "above" /* Above */ : "below" /* Below */;
2754
- }
2755
- function dropdownFrame(anchor, panelHeight, viewportHeight) {
2756
- const placement = placeDropdown(anchor, panelHeight, viewportHeight);
2757
- const base = { placement, left: anchor.x, width: anchor.width };
2758
- if (placement === "above" /* Above */) return { ...base, bottom: viewportHeight - anchor.y };
2759
- return { ...base, top: anchor.y + anchor.height };
2760
- }
2761
- function fitDropdownWidth(frame, viewportWidth) {
2762
- const width = Math.max(frame.width, Math.min(MIN_PANEL_WIDTH, viewportWidth - EDGE - EDGE));
2763
- const left = Math.max(EDGE, Math.min(frame.left, viewportWidth - width - EDGE));
2764
- return { ...frame, width, left: frame.width >= width ? frame.left : left };
2765
- }
2766
- function DropdownSurface({ progress, translateY, anchorRef, onDismiss, closeLabel, closeHint, testID, children }) {
2767
- const { height: viewportHeight, width: viewportWidth } = useWindowDimensions();
2768
- const anchor = useAnchorRect2(anchorRef);
2769
- const [panelHeight, setPanelHeight] = useState(0);
2770
- const onLayout = useCallback((event) => setPanelHeight(event.nativeEvent.layout.height), []);
2771
- const frame = anchor === null ? null : fitDropdownWidth(dropdownFrame(anchor, panelHeight, viewportHeight), viewportWidth);
2772
- const place = frame === null ? null : { left: frame.left, width: frame.width, top: frame.top, bottom: frame.bottom };
2773
- return /* @__PURE__ */ jsxs(Modal, { transparent: true, visible: true, animationType: "none", onRequestClose: onDismiss, children: [
2774
- /* @__PURE__ */ jsx(Pressable, { accessibilityHint: closeHint, accessibilityLabel: closeLabel, accessibilityRole: "button", style: StyleSheet.absoluteFill, testID: `${testID}-backdrop`, onPress: onDismiss }),
2775
- frame !== null ? /* @__PURE__ */ jsx(Animated.View, { style: [styles21.dropdown, place, { opacity: progress, transform: [{ translateY }] }], testID: `${testID}-dropdown-${frame.placement}`, onLayout, children }) : null
2776
- ] });
2777
- }
2778
- var styles21 = StyleSheet.create({
2779
- dropdown: { position: "absolute" }
2780
- });
2781
3697
  var ROW_PAD_H = 12;
2782
3698
  var ROW_GAP4 = 8;
2783
3699
  var OPTION_FONT2 = 14;
@@ -2795,21 +3711,21 @@ function OptionRow2({ option, active, current, renderLeading, renderDetail, onPi
2795
3711
  accessibilityLabel: option.label,
2796
3712
  accessibilityRole: "button",
2797
3713
  accessibilityState: { selected: active, checked: current },
2798
- style: [styles22.row, active ? { backgroundColor: colors.surface } : null],
3714
+ style: [styles23.row, active ? { backgroundColor: colors.surface } : null],
2799
3715
  testID: `${testID}-option-${option.value}`,
2800
3716
  onPress: () => onPick(option),
2801
3717
  children: [
2802
3718
  renderLeading?.(option),
2803
- /* @__PURE__ */ jsxs(View, { style: styles22.label, children: [
2804
- /* @__PURE__ */ jsx(Text, { style: [styles22.primary, { color: colors.text }], children: option.label }),
2805
- detailBelow ? /* @__PURE__ */ jsx(Text, { style: [styles22.secondary, { color: colors.textSecondary }], children: option.detail }) : null
3719
+ /* @__PURE__ */ jsxs(View, { style: styles23.label, children: [
3720
+ /* @__PURE__ */ jsx(Text, { style: [styles23.primary, { color: colors.text }], children: option.label }),
3721
+ detailBelow ? /* @__PURE__ */ jsx(Text, { style: [styles23.secondary, { color: colors.textSecondary }], children: option.detail }) : null
2806
3722
  ] }),
2807
3723
  renderDetail?.(option)
2808
3724
  ]
2809
3725
  }
2810
3726
  );
2811
3727
  }
2812
- var styles22 = StyleSheet.create({
3728
+ var styles23 = StyleSheet.create({
2813
3729
  row: { minHeight: MIN_TOUCH_TARGET_PX, flexDirection: "row", alignItems: "center", gap: ROW_GAP4, paddingHorizontal: ROW_PAD_H },
2814
3730
  label: { flex: 1 },
2815
3731
  primary: { fontSize: OPTION_FONT2, flexShrink: 1 },
@@ -2823,26 +3739,17 @@ function OptionSection({ title, options, offset, highlight, selectedValue, ...ro
2823
3739
  const { colors } = theme;
2824
3740
  if (options.length === 0) return null;
2825
3741
  return /* @__PURE__ */ jsxs(View, { children: [
2826
- /* @__PURE__ */ jsx(Text, { accessibilityRole: "header", style: [styles23.header, { color: colors.textSecondary }], children: title }),
3742
+ /* @__PURE__ */ jsx(Text, { accessibilityRole: "header", style: [styles24.header, { color: colors.textSecondary }], children: title }),
2827
3743
  options.map((option, index) => /* @__PURE__ */ jsx(OptionRow2, { ...row, active: offset + index === highlight, current: option.value === selectedValue, option }, option.value))
2828
3744
  ] });
2829
3745
  }
2830
- var styles23 = StyleSheet.create({
2831
- header: { fontSize: HEADER_FONT, paddingHorizontal: ROW_PAD_H2, paddingTop: ROW_GAP5, textTransform: "uppercase" }
2832
- });
2833
- function SheetSurface({ translateY, onDismiss, closeLabel, closeHint, testID, children }) {
2834
- return /* @__PURE__ */ jsx(Modal, { transparent: true, visible: true, animationType: "none", onRequestClose: onDismiss, children: /* @__PURE__ */ jsxs(View, { style: styles24.backdrop, children: [
2835
- /* @__PURE__ */ jsx(Pressable, { accessibilityHint: closeHint, accessibilityLabel: closeLabel, accessibilityRole: "button", style: StyleSheet.absoluteFill, testID: `${testID}-backdrop`, onPress: onDismiss }),
2836
- /* @__PURE__ */ jsx(Animated.View, { style: { transform: [{ translateY }] }, children })
2837
- ] }) });
2838
- }
2839
3746
  var styles24 = StyleSheet.create({
2840
- backdrop: { flex: 1, justifyContent: "flex-end" }
3747
+ header: { fontSize: HEADER_FONT, paddingHorizontal: ROW_PAD_H2, paddingTop: ROW_GAP5, textTransform: "uppercase" }
2841
3748
  });
2842
3749
  var KEY_ESCAPE = "Escape";
2843
3750
  var PANEL_PAD = 8;
2844
3751
  var PANEL_RADIUS = 8;
2845
- var SHEET_MAX_HEIGHT = 480;
3752
+ var SHEET_MAX_HEIGHT2 = 480;
2846
3753
  function SearchSelectPanel({ motion, state, labels, anchorRef, renderLeading, renderDetail, selectedValue, testID }) {
2847
3754
  const { theme } = useUi();
2848
3755
  const { colors } = theme;
@@ -2895,24 +3802,9 @@ function SearchSelectPanel({ motion, state, labels, anchorRef, renderLeading, re
2895
3802
  var styles25 = StyleSheet.create({
2896
3803
  panel: { borderWidth: 1, borderRadius: PANEL_RADIUS, padding: PANEL_PAD, gap: PANEL_PAD },
2897
3804
  dropList: { maxHeight: MENU_MAX_HEIGHT },
2898
- sheetList: { maxHeight: SHEET_MAX_HEIGHT },
3805
+ sheetList: { maxHeight: SHEET_MAX_HEIGHT2 },
2899
3806
  empty: { padding: PANEL_PAD }
2900
3807
  });
2901
- function useReducedMotion() {
2902
- const [reduced, setReduced] = useState(false);
2903
- useEffect(() => {
2904
- let active = true;
2905
- AccessibilityInfo.isReduceMotionEnabled().then((value) => {
2906
- if (active) setReduced(value);
2907
- }).catch(() => void 0);
2908
- const subscription = AccessibilityInfo.addEventListener("reduceMotionChanged", setReduced);
2909
- return () => {
2910
- active = false;
2911
- subscription.remove();
2912
- };
2913
- }, []);
2914
- return reduced;
2915
- }
2916
3808
  function useRefocusOnClose(open, ref) {
2917
3809
  const wasOpen = useRef(false);
2918
3810
  useEffect(() => {
@@ -4021,7 +4913,7 @@ var FONT_SIZE = 14;
4021
4913
  var LINE_HEIGHT = 20;
4022
4914
  var COUNTER_FONT = 12;
4023
4915
  var BRANCH_OPACITY = 0.5;
4024
- var GAP2 = 8;
4916
+ var GAP7 = 8;
4025
4917
  var INPUT_PAD_V2 = 13;
4026
4918
  var ghostStyles = StyleSheet.create({
4027
4919
  field: { flex: 1, justifyContent: "center", minHeight: LINE_HEIGHT },
@@ -4031,7 +4923,7 @@ var ghostStyles = StyleSheet.create({
4031
4923
  branch: { opacity: BRANCH_OPACITY },
4032
4924
  input: { padding: 0, paddingVertical: INPUT_PAD_V2, borderWidth: 0, minHeight: LINE_HEIGHT },
4033
4925
  trigger: { paddingVertical: 0 },
4034
- counter: { fontSize: COUNTER_FONT, marginLeft: GAP2 }
4926
+ counter: { fontSize: COUNTER_FONT, marginLeft: GAP7 }
4035
4927
  });
4036
4928
 
4037
4929
  // src/IbanInput/data/IbanRejection.ts
@@ -4302,14 +5194,14 @@ var DOT_INNER = 8;
4302
5194
  var ROW_GAP6 = 10;
4303
5195
  var PAD_H2 = 12;
4304
5196
  var PAD_V2 = 8;
4305
- var RADIUS = 8;
5197
+ var RADIUS2 = 8;
4306
5198
  var LABEL_SIZE = 14;
4307
5199
  var DESCRIPTION_SIZE = 12;
4308
5200
  var DESCRIPTION_LINE = 16;
4309
5201
  var styles31 = StyleSheet.create({
4310
5202
  row: {
4311
5203
  alignItems: "center",
4312
- borderRadius: RADIUS,
5204
+ borderRadius: RADIUS2,
4313
5205
  borderWidth: 1,
4314
5206
  columnGap: ROW_GAP6,
4315
5207
  flexDirection: "row",
@@ -4368,7 +5260,7 @@ var styles32 = StyleSheet.create({
4368
5260
  function RadioList(props) {
4369
5261
  const { options, value, onChange, optionTestIDPrefix, label, error, required = false, disabled = false, testID } = props;
4370
5262
  const { theme } = useUi();
4371
- const colors = React26.useMemo(() => buildChipColors(theme.colors, theme.palette), [theme.colors, theme.palette]);
5263
+ const colors = React37.useMemo(() => buildChipColors(theme.colors, theme.palette), [theme.colors, theme.palette]);
4372
5264
  const selectedIndex = options.findIndex((option) => option.value === value);
4373
5265
  const radio = useRadioKeyboard({ enabled: true, disabled, values: options.map((option) => option.value), selectedIndex, onChange });
4374
5266
  return /* @__PURE__ */ jsx(Field, { error, label, required, testID, children: ({ describedById, hasError }) => /* @__PURE__ */ jsx(
@@ -4523,12 +5415,12 @@ var SubmitError = ({ message, testID }) => {
4523
5415
  };
4524
5416
  var toggle = (list, id) => list.includes(id) ? list.filter((item) => item !== id) : [...list, id];
4525
5417
  function useDecisionPanel(outcomes, onSubmit) {
4526
- const [outcome, setOutcome] = React26.useState("");
4527
- const [note, setNote] = React26.useState("");
4528
- const [reasons, setReasons] = React26.useState([]);
4529
- const [checked, setChecked] = React26.useState([]);
4530
- const [error, setError] = React26.useState(null);
4531
- const [pending, setPending] = React26.useState(null);
5418
+ const [outcome, setOutcome] = React37.useState("");
5419
+ const [note, setNote] = React37.useState("");
5420
+ const [reasons, setReasons] = React37.useState([]);
5421
+ const [checked, setChecked] = React37.useState([]);
5422
+ const [error, setError] = React37.useState(null);
5423
+ const [pending, setPending] = React37.useState(null);
4532
5424
  const submit = async (override) => {
4533
5425
  const target = override ?? outcome;
4534
5426
  const problem = validateDecision(outcomes, target, note);
@@ -4583,6 +5475,6 @@ function DecisionPanel(props) {
4583
5475
  ] });
4584
5476
  }
4585
5477
 
4586
- export { ActionBar, AddOnRequest, AlignToControl, AnchoredMenu, BicInput, BicRejection, COUNTRIES, ChipLabelWrap, ChipSelector, CountryField, CountryFlag, DEFAULT_MAX_RECENTS, DEFAULT_OPTIONAL_LABEL, DEFAULT_TYPEAHEAD_MAX_SUGGESTIONS, DEFAULT_TYPEAHEAD_MIN_CHARS, DateField, DateInput, DateRangeControl, DateTimeField, DecisionPanel, DropdownPlacement, FLAG_HEIGHT, FLAG_WIDTH, Field, FixBar, FlagShapeKind, FormActions, FormCell, FormCheckbox, FormField, FormGrid, FormSection, FormStack, FormStatusLine, FormSwitch, GatedChecklist, IBAN_MAX_LENGTH, IBAN_REGISTERED_COUNTRY_COUNT, INLINE_FIELD_ROW_MIN_WIDTH, IbanInput, IbanRejection, InlineFieldRow, LINE_ITEMS_WIDE_MIN_WIDTH, LineItems, PHONE_MAX_WIDTH, RESPONSIVE_FORM_DEFAULT_BREAKPOINT, RadioList, ResponsiveFormLayout, SearchSelect, SelectControl, SelectField, SelectSurface, StepperNav, StepperTabs, ThemedTextInput, TypeaheadControl, UploadWithLinkField, actionBarPosition, buildSearchSelectSections, canRemoveLine, controlStyles, countryFieldOptions, countryFlag, countryOptions, defaultDecisionVariant, draftBic, draftIban, dropdownFrame, findOption, fitDropdownWidth, flagShapes, groupAriaChecked, groupInFours, highlightAfterQuery, ibanCounter, ibanLengthFor, inlineFieldRowLayout, isAddOnOpen, isChecklistComplete, isFallbackFlag, isFixBarVisible, isLineItemsWide, isOutside, isUnmatched, isWideFormLayout, leadFirst, lineItemColumnFlex, lineNumberOf, moveHighlight, nextHighlight, placeDropdown, radioRowIdentity, rejectionMessage, resolveGroupSelection, resolveSelectMotion, resolveStepNeighbours, suggestOptions, toCountryValue, toggleGroupSelection, useBlurVerdict, useDeferredFocus, useFocusFirstInvalid, useKeepInView, useOutsidePress, useRecentValues, useReducedMotion, useSearchSelectState, useThemedInput, validateBic, validateDecision, validateIban };
5478
+ export { ActionBar, AddOnRequest, AlignToControl, AnchoredMenu, BicInput, BicRejection, COUNTRIES, ChipLabelWrap, ChipSelector, CountryField, CountryFlag, DEFAULT_DATE_PICKER_LABELS, DEFAULT_MAX_RECENTS, DEFAULT_OPTIONAL_LABEL, DEFAULT_TYPEAHEAD_MAX_SUGGESTIONS, DEFAULT_TYPEAHEAD_MIN_CHARS, DateField, DateInput, DatePickerProvider, DateRangeControl, DateTimeField, DecisionPanel, DropdownPlacement, FLAG_HEIGHT, FLAG_WIDTH, Field, FixBar, FlagShapeKind, FormActions, FormCell, FormCheckbox, FormField, FormGrid, FormSection, FormStack, FormStatusLine, FormSwitch, GatedChecklist, IBAN_MAX_LENGTH, IBAN_REGISTERED_COUNTRY_COUNT, INLINE_FIELD_ROW_MIN_WIDTH, IbanInput, IbanRejection, InlineFieldRow, LINE_ITEMS_WIDE_MIN_WIDTH, LineItems, PHONE_MAX_WIDTH, RESPONSIVE_FORM_DEFAULT_BREAKPOINT, RadioList, ResponsiveFormLayout, SearchSelect, SelectControl, SelectField, SelectSurface, StepperNav, StepperTabs, ThemedTextInput, TypeaheadControl, UploadWithLinkField, actionBarPosition, buildSearchSelectSections, canRemoveLine, controlStyles, countryFieldOptions, countryFlag, countryOptions, defaultDecisionVariant, draftBic, draftIban, dropdownFrame, findOption, fitDropdownWidth, flagShapes, groupAriaChecked, groupInFours, highlightAfterQuery, ibanCounter, ibanLengthFor, inlineFieldRowLayout, isAddOnOpen, isChecklistComplete, isFallbackFlag, isFixBarVisible, isLineItemsWide, isOutside, isUnmatched, isWideFormLayout, leadFirst, lineItemColumnFlex, lineNumberOf, moveHighlight, nextHighlight, placeDropdown, radioRowIdentity, rejectionMessage, resolveGroupSelection, resolveSelectMotion, resolveStepNeighbours, suggestOptions, toCountryValue, toggleGroupSelection, useBlurVerdict, useDeferredFocus, useFocusFirstInvalid, useKeepInView, useOutsidePress, useRecentValues, useReducedMotion, useSearchSelectState, useThemedInput, validateBic, validateDecision, validateIban };
4587
5479
  //# sourceMappingURL=index.mjs.map
4588
5480
  //# sourceMappingURL=index.mjs.map