@servicetitan/anvil2 1.45.1 → 1.45.2

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.
Files changed (106) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/dist/{Calendar-Dq_of5A3.js → Calendar-BK861SAW.js} +1173 -166
  3. package/dist/Calendar-BK861SAW.js.map +1 -0
  4. package/dist/Calendar.css +83 -47
  5. package/dist/Calendar.js +1 -1
  6. package/dist/{Checkbox-BiOzGpgJ.js → Checkbox-CYNjFdtO.js} +2 -2
  7. package/dist/{Checkbox-BiOzGpgJ.js.map → Checkbox-CYNjFdtO.js.map} +1 -1
  8. package/dist/{Checkbox-3y2d9mBd.js → Checkbox-ZphVb1l0.js} +2 -2
  9. package/dist/{Checkbox-3y2d9mBd.js.map → Checkbox-ZphVb1l0.js.map} +1 -1
  10. package/dist/Checkbox.js +2 -2
  11. package/dist/Combobox.js +1 -1
  12. package/dist/{DateField-B2mnasH5.js → DateField-DnasO2rB.js} +4 -4
  13. package/dist/{DateField-B2mnasH5.js.map → DateField-DnasO2rB.js.map} +1 -1
  14. package/dist/DateField.js +1 -1
  15. package/dist/{DateFieldRange-DPbyzuHb.js → DateFieldRange-Ba-8T-Nz.js} +31 -25
  16. package/dist/DateFieldRange-Ba-8T-Nz.js.map +1 -0
  17. package/dist/DateFieldRange.js +1 -1
  18. package/dist/{DateFieldSingle-CfAJDcx9.js → DateFieldSingle-BBu5Hi9c.js} +26 -26
  19. package/dist/DateFieldSingle-BBu5Hi9c.js.map +1 -0
  20. package/dist/DateFieldSingle.js +1 -1
  21. package/dist/{DateFieldYearless-ydxcsmRV.js → DateFieldYearless-Ba7HiTiI.js} +2 -2
  22. package/dist/{DateFieldYearless-ydxcsmRV.js.map → DateFieldYearless-Ba7HiTiI.js.map} +1 -1
  23. package/dist/DateFieldYearless.js +1 -1
  24. package/dist/{DaysOfTheWeek-BYvE9QK5.js → DaysOfTheWeek-BYSYZySH.js} +2 -2
  25. package/dist/{DaysOfTheWeek-BYvE9QK5.js.map → DaysOfTheWeek-BYSYZySH.js.map} +1 -1
  26. package/dist/DaysOfTheWeek.js +1 -1
  27. package/dist/{Dialog-DpH2Qvbd.js → Dialog-CgkrvrQu.js} +2 -2
  28. package/dist/{Dialog-DpH2Qvbd.js.map → Dialog-CgkrvrQu.js.map} +1 -1
  29. package/dist/Dialog.js +1 -1
  30. package/dist/{Drawer-DI_k6W2k.js → Drawer-CM4ZbAro.js} +2 -2
  31. package/dist/{Drawer-DI_k6W2k.js.map → Drawer-CM4ZbAro.js.map} +1 -1
  32. package/dist/Drawer.js +1 -1
  33. package/dist/{FieldLabel-BfnCXung.js → FieldLabel-BsbTTyom.js} +3 -14
  34. package/dist/FieldLabel-BsbTTyom.js.map +1 -0
  35. package/dist/FieldLabel.js +1 -1
  36. package/dist/{InputMask-O_qi1p_3.js → InputMask-_F139qFu.js} +2 -2
  37. package/dist/{InputMask-O_qi1p_3.js.map → InputMask-_F139qFu.js.map} +1 -1
  38. package/dist/InputMask.js +1 -1
  39. package/dist/{ListView-jR2ZkBB7.js → ListView-DEAMQopB.js} +2 -2
  40. package/dist/{ListView-jR2ZkBB7.js.map → ListView-DEAMQopB.js.map} +1 -1
  41. package/dist/ListView.js +1 -1
  42. package/dist/{NumberField-1_gRsWT4.js → NumberField-CkZZrkYC.js} +5 -5
  43. package/dist/{NumberField-1_gRsWT4.js.map → NumberField-CkZZrkYC.js.map} +1 -1
  44. package/dist/NumberField.js +1 -1
  45. package/dist/{Page-CY6QRlvb.js → Page-cKXkjMmd.js} +2 -2
  46. package/dist/{Page-CY6QRlvb.js.map → Page-cKXkjMmd.js.map} +1 -1
  47. package/dist/Page.js +1 -1
  48. package/dist/{ProgressBar-BnXuQ6Bx.js → ProgressBar-DXcXZEJ2.js} +2 -2
  49. package/dist/{ProgressBar-BnXuQ6Bx.js.map → ProgressBar-DXcXZEJ2.js.map} +1 -1
  50. package/dist/ProgressBar.js +1 -1
  51. package/dist/{Radio-CwmRUIzo.js → Radio-C89VCMXd.js} +2 -2
  52. package/dist/{Radio-CwmRUIzo.js.map → Radio-C89VCMXd.js.map} +1 -1
  53. package/dist/Radio.js +2 -2
  54. package/dist/{RadioGroup-BNCWIHOG.js → RadioGroup-C_4buUtG.js} +2 -2
  55. package/dist/{RadioGroup-BNCWIHOG.js.map → RadioGroup-C_4buUtG.js.map} +1 -1
  56. package/dist/{SelectCard-DOGCG0zr.js → SelectCard-BWh8Yp7T.js} +3 -3
  57. package/dist/{SelectCard-DOGCG0zr.js.map → SelectCard-BWh8Yp7T.js.map} +1 -1
  58. package/dist/SelectCard.js +1 -1
  59. package/dist/{SelectTrigger-BMo0e-F7.js → SelectTrigger-f1hvRrSC.js} +2 -2
  60. package/dist/{SelectTrigger-BMo0e-F7.js.map → SelectTrigger-f1hvRrSC.js.map} +1 -1
  61. package/dist/SelectTrigger.js +1 -1
  62. package/dist/{SelectTriggerBase-BMMxnXrw.js → SelectTriggerBase-DP9fmRSo.js} +2 -2
  63. package/dist/{SelectTriggerBase-BMMxnXrw.js.map → SelectTriggerBase-DP9fmRSo.js.map} +1 -1
  64. package/dist/{TextField-CwgE_JJU.js → TextField-BiHxlzE3.js} +2 -2
  65. package/dist/{TextField-CwgE_JJU.js.map → TextField-BiHxlzE3.js.map} +1 -1
  66. package/dist/{TextField-DlsZEkS0.js → TextField-D8fow9j7.js} +2 -2
  67. package/dist/{TextField-DlsZEkS0.js.map → TextField-D8fow9j7.js.map} +1 -1
  68. package/dist/TextField.js +1 -1
  69. package/dist/{Textarea-DU-SpoDL.js → Textarea-BdVJJlbP.js} +2 -2
  70. package/dist/{Textarea-DU-SpoDL.js.map → Textarea-BdVJJlbP.js.map} +1 -1
  71. package/dist/Textarea.js +1 -1
  72. package/dist/{TimeField-CfhyRfX9.js → TimeField-CmbErrsZ.js} +2 -2
  73. package/dist/{TimeField-CfhyRfX9.js.map → TimeField-CmbErrsZ.js.map} +1 -1
  74. package/dist/TimeField.js +1 -1
  75. package/dist/Toast.js +2 -2
  76. package/dist/{Toaster-BgjT0p8b.js → Toaster-9cpG_tWR.js} +2 -2
  77. package/dist/{Toaster-BgjT0p8b.js.map → Toaster-9cpG_tWR.js.map} +1 -1
  78. package/dist/{Toaster-CfC9wod0.js → Toaster-B7zUwJOt.js} +2 -2
  79. package/dist/{Toaster-CfC9wod0.js.map → Toaster-B7zUwJOt.js.map} +1 -1
  80. package/dist/components/DateFieldRange/DateFieldRange.d.ts +2 -2
  81. package/dist/components/DateFieldRange/internal/useDateFieldRangeState.d.ts +2 -7
  82. package/dist/components/DateFieldSingle/DateFieldSingle.d.ts +2 -2
  83. package/dist/components/DateFieldSingle/internal/useDateFieldSingleState.d.ts +2 -7
  84. package/dist/components/NumberField/NumberField.d.ts +4 -4
  85. package/dist/index.js +26 -26
  86. package/dist/internal/components/YearSelector/YearSelector.d.ts +67 -0
  87. package/dist/internal/components/YearSelector/index.d.ts +1 -0
  88. package/dist/internal/components/YearSelector/internal/YearItem.d.ts +10 -0
  89. package/dist/internal/components/YearSelector/internal/useYearSelectorKeys.d.ts +19 -0
  90. package/dist/internal/hooks/useFocusWithin/useFocusWithin.d.ts +11 -16
  91. package/dist/types/PassThroughProps.d.ts +4 -0
  92. package/dist/types/index.d.ts +1 -0
  93. package/dist/{useDateFieldOrchestration-Cqa7dxtr.js → useDateFieldOrchestration-DPLftOxu.js} +2 -2
  94. package/dist/{useDateFieldOrchestration-Cqa7dxtr.js.map → useDateFieldOrchestration-DPLftOxu.js.map} +1 -1
  95. package/dist/useFocusWithin-BhhgRXdZ.js +32 -0
  96. package/dist/useFocusWithin-BhhgRXdZ.js.map +1 -0
  97. package/dist/{useInfiniteCombobox-BN2uGhBh.js → useInfiniteCombobox-BaYWUxjg.js} +2 -2
  98. package/dist/{useInfiniteCombobox-BN2uGhBh.js.map → useInfiniteCombobox-BaYWUxjg.js.map} +1 -1
  99. package/package.json +2 -1
  100. package/dist/Calendar-Dq_of5A3.js.map +0 -1
  101. package/dist/DateFieldRange-DPbyzuHb.js.map +0 -1
  102. package/dist/DateFieldSingle-CfAJDcx9.js.map +0 -1
  103. package/dist/FieldLabel-BfnCXung.js.map +0 -1
  104. package/dist/components/Calendar/internal/CalendarYearSelection.d.ts +0 -25
  105. package/dist/useFocusWithin-BhU7hoAD.js +0 -56
  106. package/dist/useFocusWithin-BhU7hoAD.js.map +0 -1
@@ -1,6 +1,5 @@
1
1
  import { DateTime } from 'luxon';
2
- import { MaskedDateInputChange, MaskedDateInputRef } from './MaskedDateInput';
3
- import { RefObject } from 'react';
2
+ import { MaskedDateInputChange } from './MaskedDateInput';
4
3
  export type DateFieldSingleStateChange = {
5
4
  date: DateTime | null;
6
5
  isInputValid: boolean;
@@ -16,10 +15,6 @@ export type DateFieldSingleStateParam = {
16
15
  * The default (uncontrolled) value of the date field.
17
16
  */
18
17
  defaultValueProp?: DateTime | null;
19
- /**
20
- * The ref to the input field.
21
- */
22
- inputRef: RefObject<MaskedDateInputRef>;
23
18
  /**
24
19
  * Callback for when the date changes.
25
20
  */
@@ -46,4 +41,4 @@ export type DateFieldSingleState = {
46
41
  /**
47
42
  * This is a hook for keeping state in sync between a date input and calendar.
48
43
  */
49
- export declare function useDateFieldSingleState({ valueProp, defaultValueProp, inputRef, onChange, }: DateFieldSingleStateParam): DateFieldSingleState;
44
+ export declare function useDateFieldSingleState({ valueProp, defaultValueProp, onChange, }: DateFieldSingleStateParam): DateFieldSingleState;
@@ -21,8 +21,8 @@ export type NumberFieldProps = Omit<ComponentPropsWithoutRef<"input">, "size" |
21
21
  value?: number | null;
22
22
  defaultValue?: number | null;
23
23
  onChange?: (value: number | null) => void;
24
- onFocus?: (event: FocusEvent) => void;
25
- onBlur?: (event: FocusEvent) => void;
24
+ onFocus?: (event: React.FocusEvent) => void;
25
+ onBlur?: (event: React.FocusEvent) => void;
26
26
  hideControls?: boolean;
27
27
  } & DataTrackingId;
28
28
  export declare const NumberField: import('react').ForwardRefExoticComponent<Omit<Omit<import('react').DetailedHTMLProps<import('react').InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "ref">, "size" | "value" | "onBlur" | "onFocus" | "onChange" | "defaultValue" | "prefix" | "inputMode" | "type"> & LayoutUtilProps & Pick<import('../../internal/components').LabelProps, "required" | "moreInfo"> & {
@@ -46,7 +46,7 @@ export declare const NumberField: import('react').ForwardRefExoticComponent<Omit
46
46
  value?: number | null;
47
47
  defaultValue?: number | null;
48
48
  onChange?: (value: number | null) => void;
49
- onFocus?: (event: FocusEvent) => void;
50
- onBlur?: (event: FocusEvent) => void;
49
+ onFocus?: (event: React.FocusEvent) => void;
50
+ onBlur?: (event: React.FocusEvent) => void;
51
51
  hideControls?: boolean;
52
52
  } & DataTrackingId & import('react').RefAttributes<HTMLInputElement>>;
package/dist/index.js CHANGED
@@ -9,47 +9,47 @@ export { B as Button } from './Button-BxFXQ0-n.js';
9
9
  export { B as ButtonCompound } from './ButtonCompound-BF2Q6gGX.js';
10
10
  export { B as ButtonLink } from './ButtonLink-CXv65WVV.js';
11
11
  export { B as ButtonToggle } from './ButtonToggle-pSwg7NvT.js';
12
- export { C as Calendar, f as CalendarMonth, e as CalendarMonthButton, d as CalendarNext, a as CalendarNow, c as CalendarPrev, b as CalendarYearButton } from './Calendar-Dq_of5A3.js';
12
+ export { C as Calendar, f as CalendarMonth, e as CalendarMonthButton, d as CalendarNext, a as CalendarNow, c as CalendarPrev, b as CalendarYearButton } from './Calendar-BK861SAW.js';
13
13
  export { C as Card } from './Card-vTYeSkxt.js';
14
- export { C as Checkbox } from './Checkbox-3y2d9mBd.js';
15
- export { C as CheckboxGroup } from './Checkbox-BiOzGpgJ.js';
14
+ export { C as Checkbox } from './Checkbox-ZphVb1l0.js';
15
+ export { C as CheckboxGroup } from './Checkbox-CYNjFdtO.js';
16
16
  export { C as Chip } from './Chip-Bz-vlQ4D.js';
17
- export { C as Combobox, c as ComboboxContent, a as ComboboxElement, i as ComboboxEmpty, e as ComboboxItem, f as ComboboxItemAddNew, d as ComboboxList, g as ComboboxSearchField, b as ComboboxSelect, h as ComboboxSelectTrigger, u as useInfiniteCombobox } from './useInfiniteCombobox-BN2uGhBh.js';
18
- export { D as DateField } from './DateField-B2mnasH5.js';
19
- export { D as DateFieldRange } from './DateFieldRange-DPbyzuHb.js';
20
- export { D as DateFieldSingle } from './DateFieldSingle-CfAJDcx9.js';
21
- export { D as DateFieldYearless } from './DateFieldYearless-ydxcsmRV.js';
22
- export { D as DaysOfTheWeek } from './DaysOfTheWeek-BYvE9QK5.js';
17
+ export { C as Combobox, c as ComboboxContent, a as ComboboxElement, i as ComboboxEmpty, e as ComboboxItem, f as ComboboxItemAddNew, d as ComboboxList, g as ComboboxSearchField, b as ComboboxSelect, h as ComboboxSelectTrigger, u as useInfiniteCombobox } from './useInfiniteCombobox-BaYWUxjg.js';
18
+ export { D as DateField } from './DateField-DnasO2rB.js';
19
+ export { D as DateFieldRange } from './DateFieldRange-Ba-8T-Nz.js';
20
+ export { D as DateFieldSingle } from './DateFieldSingle-BBu5Hi9c.js';
21
+ export { D as DateFieldYearless } from './DateFieldYearless-Ba7HiTiI.js';
22
+ export { D as DaysOfTheWeek } from './DaysOfTheWeek-BYSYZySH.js';
23
23
  export { D as Details, b as DetailsContent, a as DetailsSummary } from './Details-CF8DImjw.js';
24
- export { D as Dialog, a as DialogCancelButton, b as DialogContent, c as DialogFooter, d as DialogHeader } from './Dialog-DpH2Qvbd.js';
24
+ export { D as Dialog, a as DialogCancelButton, b as DialogContent, c as DialogFooter, d as DialogHeader } from './Dialog-CgkrvrQu.js';
25
25
  export { D as Divider } from './Divider-DJe8kLf2.js';
26
26
  export { D as Dnd } from './index-CqdP5W00.js';
27
- export { D as Drawer, a as DrawerCancelButton, d as DrawerContent, b as DrawerFooter, c as DrawerHeader } from './Drawer-DI_k6W2k.js';
27
+ export { D as Drawer, a as DrawerCancelButton, d as DrawerContent, b as DrawerFooter, c as DrawerHeader } from './Drawer-CM4ZbAro.js';
28
28
  export { E as EditCard } from './EditCard-WKzZ2XCz.js';
29
- export { F as FieldLabel } from './FieldLabel-BfnCXung.js';
29
+ export { F as FieldLabel } from './FieldLabel-BsbTTyom.js';
30
30
  export { F as FieldMessage } from './FieldMessage-B7uQ8vmr.js';
31
31
  export { F as Flex } from './Flex-BdQMekvA.js';
32
32
  export { G as Grid } from './Grid-MGUC698u.js';
33
33
  export { I as Icon } from './Icon-D8SPKeO4.js';
34
- export { I as InputMask } from './InputMask-O_qi1p_3.js';
34
+ export { I as InputMask } from './InputMask-_F139qFu.js';
35
35
  export { L as Layout, a as LayoutElement, b as LayoutItem } from './Layout-CUUb2PVr.js';
36
36
  export { L as Link, u as useLinkStyles } from './Link-eRsLWPaQ.js';
37
37
  export { L as LinkButton } from './LinkButton-2lXfrVoU.js';
38
38
  export { L as Listbox, a as ListboxOption, b as ListboxOptionGroup } from './Listbox-CUhMbFm2.js';
39
- export { L as ListView, a as ListViewOption, b as ListViewOptionCell } from './ListView-jR2ZkBB7.js';
39
+ export { L as ListView, a as ListViewOption, b as ListViewOptionCell } from './ListView-DEAMQopB.js';
40
40
  export { M as Menu, a as MenuItem } from './Menu-C8we5CHP.js';
41
- export { N as NumberField } from './NumberField-1_gRsWT4.js';
41
+ export { N as NumberField } from './NumberField-CkZZrkYC.js';
42
42
  export { Overflow, OverflowText } from './Overflow.js';
43
- export { P as Page } from './Page-CY6QRlvb.js';
43
+ export { P as Page } from './Page-cKXkjMmd.js';
44
44
  export { P as Pagination } from './Pagination-ta8a2cJN.js';
45
45
  export { P as Popover, a as PopoverButton, b as PopoverClose, c as PopoverContent, d as PopoverTrigger } from './Popover-r26xMIfm.js';
46
- export { P as ProgressBar } from './ProgressBar-BnXuQ6Bx.js';
47
- export { R as Radio } from './Radio-CwmRUIzo.js';
48
- export { R as RadioGroup } from './RadioGroup-BNCWIHOG.js';
46
+ export { P as ProgressBar } from './ProgressBar-DXcXZEJ2.js';
47
+ export { R as Radio } from './Radio-C89VCMXd.js';
48
+ export { R as RadioGroup } from './RadioGroup-C_4buUtG.js';
49
49
  export { S as SearchField } from './SearchField-BKXkoWPs.js';
50
50
  export { S as SegmentedControl, a as SegmentedControlSegment } from './SegmentedControl-CsjjV1Dz.js';
51
- export { S as SelectCard, a as SelectCardElement, b as SelectCardGroup } from './SelectCard-DOGCG0zr.js';
52
- export { S as SelectTrigger } from './SelectTrigger-BMo0e-F7.js';
51
+ export { S as SelectCard, a as SelectCardElement, b as SelectCardGroup } from './SelectCard-BWh8Yp7T.js';
52
+ export { S as SelectTrigger } from './SelectTrigger-f1hvRrSC.js';
53
53
  export { S as SideNav, b as SideNavCollapsible, c as SideNavGroup, a as SideNavLink } from './SideNav-CBAzYyML.js';
54
54
  export { Skeleton, SkeletonCircle, SkeletonPill, SkeletonRectangle, SkeletonText } from './Skeleton.js';
55
55
  export { S as Spinner } from './Spinner-wmO8Epw0.js';
@@ -58,11 +58,11 @@ export { S as Stepper, a as StepperFinalPanel, b as StepperList, c as StepperNex
58
58
  export { S as Switch } from './Switch-C2ddZcr9.js';
59
59
  export { T as Tab, a as TabButton, b as TabList, c as TabPanel } from './Tab-wNucMTgo.js';
60
60
  export { T as Text } from './Text-BqvcbXyp.js';
61
- export { T as Textarea } from './Textarea-DU-SpoDL.js';
62
- export { T as TextField } from './TextField-CwgE_JJU.js';
63
- export { T as TimeField } from './TimeField-CfhyRfX9.js';
64
- export { T as Toaster } from './Toaster-CfC9wod0.js';
65
- export { t as toast } from './Toaster-BgjT0p8b.js';
61
+ export { T as Textarea } from './Textarea-BdVJJlbP.js';
62
+ export { T as TextField } from './TextField-BiHxlzE3.js';
63
+ export { T as TimeField } from './TimeField-CmbErrsZ.js';
64
+ export { T as Toaster } from './Toaster-B7zUwJOt.js';
65
+ export { t as toast } from './Toaster-9cpG_tWR.js';
66
66
  export { T as Toolbar, a as ToolbarButton, c as ToolbarButtonLink, b as ToolbarButtonToggle, e as ToolbarElement, d as ToolbarSelect } from './Toolbar-DK7tXy_W.js';
67
67
  export { T as Tooltip, a as TooltipContent, b as TooltipTrigger } from './Tooltip-BI3Xs75X.js';
68
68
  export { u as useAccessibleColor } from './useAccessibleColor-BYKjkGRg.js';
@@ -0,0 +1,67 @@
1
+ import { PassThroughProps } from '../../../types';
2
+ export interface YearSelectorProps {
3
+ /**
4
+ * The minimum selectable year
5
+ * Defaults to 1900.
6
+ */
7
+ min?: number;
8
+ /**
9
+ * The maximum selectable year.
10
+ * Defaults to 2200.
11
+ */
12
+ max?: number;
13
+ /**
14
+ * The currently selected year
15
+ */
16
+ value?: number | null;
17
+ /**
18
+ * The default value of the selected year
19
+ */
20
+ defaultValue?: number;
21
+ /**
22
+ * The function to call when the selected year changes
23
+ *
24
+ * @param year - The year that is selected.
25
+ */
26
+ onChange?: (year: number | null) => void;
27
+ /**
28
+ * The function to call when the selected year is affirmatively changed.
29
+ * This is called when the user confirms the selection by pressing Enter, pressing Space, or clicking.
30
+ *
31
+ * @param year - The year that is selected.
32
+ */
33
+ onConfirm?: (year: number | null) => void;
34
+ /**
35
+ * If a `value` or `defaultValue` is not provided, this will be used as the starting scroll position (and initial focus for accessibility).
36
+ */
37
+ startingYear?: number;
38
+ /**
39
+ * The number of columns to display.
40
+ * @default 2
41
+ */
42
+ columns?: number;
43
+ /**
44
+ * The class name to apply to the component.
45
+ */
46
+ className?: string;
47
+ /**
48
+ * Controls whether a year can be deselected, i.e. set to null.
49
+ * @default false
50
+ */
51
+ required?: boolean;
52
+ /**
53
+ * Controls whether the component allows the user to select a year.
54
+ * @default false
55
+ */
56
+ disabled?: boolean;
57
+ /**
58
+ * The aria-label for the component.
59
+ * @default "Year selection"
60
+ */
61
+ ariaLabel?: string;
62
+ /**
63
+ * Props forwarded onto the root element of the component.
64
+ */
65
+ rootProps?: PassThroughProps<"div">;
66
+ }
67
+ export declare const YearSelector: import('react').ForwardRefExoticComponent<YearSelectorProps & import('react').RefAttributes<HTMLDivElement>>;
@@ -0,0 +1 @@
1
+ export { YearSelector, type YearSelectorProps } from './YearSelector';
@@ -0,0 +1,10 @@
1
+ import { ComponentPropsWithoutRef } from 'react';
2
+ type YearItemProps = Omit<ComponentPropsWithoutRef<"div">, "onChange"> & {
3
+ year: number;
4
+ onChange: (year: number) => void;
5
+ selected: boolean;
6
+ pseudoFocused: boolean;
7
+ disabled: boolean;
8
+ };
9
+ export declare const YearItem: ({ year, onChange, selected, pseudoFocused, disabled, onFocus, ...rest }: YearItemProps) => import("react/jsx-runtime").JSX.Element;
10
+ export {};
@@ -0,0 +1,19 @@
1
+ export type UseYearSelectorKeysParams = {
2
+ columns: number;
3
+ scrollToYear: (year: number, { focus }: {
4
+ focus?: boolean;
5
+ }) => void;
6
+ initialFocus: number;
7
+ onSelect: (year: number | null) => void;
8
+ onConfirm: () => void;
9
+ min: number;
10
+ max: number;
11
+ disabled: boolean;
12
+ pseudoFocused: number;
13
+ setPseudoFocused: (year: number) => void;
14
+ required: boolean;
15
+ };
16
+ export type UseYearSelectorKeysReturn = {
17
+ listRef: React.RefObject<HTMLDivElement>;
18
+ };
19
+ export declare const useYearSelectorKeys: ({ columns, scrollToYear, initialFocus, onSelect, onConfirm, pseudoFocused, setPseudoFocused, min, max, disabled, required, }: UseYearSelectorKeysParams) => UseYearSelectorKeysReturn;
@@ -1,33 +1,28 @@
1
+ import { FocusEventHandler } from 'react';
1
2
  export interface UseFocusWithinOptions {
2
- onFocus?: (event: FocusEvent) => void;
3
- onBlur?: (event: FocusEvent) => void;
3
+ onFocus?: (event: React.FocusEvent) => void;
4
+ onBlur?: (event: React.FocusEvent) => void;
4
5
  }
5
- export interface UseFocusWithinReturnValue<T extends HTMLElement = any> {
6
- ref: React.RefObject<T>;
7
- focused: boolean;
6
+ export interface UseFocusWithinReturnValue<T extends HTMLElement = HTMLElement> {
7
+ props: {
8
+ onFocus: FocusEventHandler<T>;
9
+ onBlur: FocusEventHandler<T>;
10
+ };
8
11
  }
9
12
  /**
10
13
  * Custom hook for tracking focus state within a DOM element.
11
14
  *
12
- * Features:
13
- * - Tracks whether any child element has focus
14
- * - Provides a ref object to attach to the target element
15
- * - Handles focus events with proper cleanup
16
- * - Supports custom onFocus and onBlur callbacks
17
- * - Prevents false blur events when focus moves between children
18
- * - Automatically cleans up event listeners on unmount
19
- *
20
15
  * @param options Configuration options for the hook
21
16
  * @param options.onFocus Optional callback when focus enters the element
22
17
  * @param options.onBlur Optional callback when focus leaves the element
23
- * @returns Object containing ref and focused state
18
+ * @returns Object containing props for the element
24
19
  *
25
20
  * @example
26
- * const { ref, focused } = useFocusWithin({
21
+ * const { props } = useFocusWithin({
27
22
  * onFocus: () => console.log('Focus entered'),
28
23
  * onBlur: () => console.log('Focus left')
29
24
  * });
30
25
  *
31
- * return <div ref={ref} className={focused ? 'focused' : ''}>Content</div>;
26
+ * return <div {...props}>Content</div>;
32
27
  */
33
28
  export declare function useFocusWithin<T extends HTMLElement = any>({ onBlur, onFocus, }?: UseFocusWithinOptions): UseFocusWithinReturnValue<T>;
@@ -0,0 +1,4 @@
1
+ import { ComponentPropsWithoutRef, ComponentPropsWithRef } from 'react';
2
+ export type DataAttributes = Record<`data-${string}`, string>;
3
+ export type PassThroughProps<T extends keyof JSX.IntrinsicElements> = ComponentPropsWithoutRef<T> & DataAttributes;
4
+ export type PassThroughPropsWithRef<T extends keyof JSX.IntrinsicElements> = ComponentPropsWithRef<T> & DataAttributes;
@@ -4,3 +4,4 @@ export { type MaxLengthCounterProps } from './MaxLengthCounterProps';
4
4
  export * from './ianaZones';
5
5
  export * from './locales';
6
6
  export * from './props';
7
+ export * from './PassThroughProps';
@@ -1,4 +1,4 @@
1
- import { D as DateTime } from './Calendar-Dq_of5A3.js';
1
+ import { D as DateTime } from './Calendar-BK861SAW.js';
2
2
  import { useRef, useState } from 'react';
3
3
  import { a as useKeyboardFocusables } from './useOnClickOutside-BHEWMLa9.js';
4
4
 
@@ -135,4 +135,4 @@ const useDateFieldOrchestration = ({
135
135
  };
136
136
 
137
137
  export { DateModeToPlaceholderMap as D, DateModeToFormatMap as a, convertStringToDate as c, useDateFieldOrchestration as u, validateDate as v };
138
- //# sourceMappingURL=useDateFieldOrchestration-Cqa7dxtr.js.map
138
+ //# sourceMappingURL=useDateFieldOrchestration-DPLftOxu.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useDateFieldOrchestration-Cqa7dxtr.js","sources":["../src/components/DateFieldSingle/internal/constants.ts","../src/components/DateFieldSingle/internal/utils.ts","../src/components/DateFieldSingle/internal/useDateFieldOrchestration.ts"],"sourcesContent":["import { DateMode } from \"../types\";\n\nexport const DateModeToFormatMap: Record<DateMode, string> = {\n \"mm/dd/yyyy\": \"MM/dd/yyyy\",\n \"dd/mm/yyyy\": \"dd/MM/yyyy\",\n \"yyyy/mm/dd\": \"yyyy/MM/dd\",\n};\n\nexport const DateModeToPlaceholderMap: Record<DateMode, string> = {\n \"dd/mm/yyyy\": \"__/__/____\",\n \"mm/dd/yyyy\": \"__/__/____\",\n \"yyyy/mm/dd\": \"____/__/__\",\n};\n","import { DateTime } from \"luxon\";\n\nexport function convertStringToDate(\n v: string | null | undefined,\n): DateTime | null | undefined {\n if (v === undefined || v === null) {\n return v;\n }\n const date = DateTime.fromISO(v, { setZone: true, zone: \"utc\" }).startOf(\n \"day\",\n );\n if (date.isValid) {\n return date;\n }\n return null;\n}\nexport function validateDate({\n date,\n constraints,\n}: {\n date: DateTime | null;\n constraints: {\n required?: boolean;\n unavailable?: {\n dates?: DateTime[];\n daysOfWeek?: number[];\n };\n minDate?: DateTime;\n maxDate?: DateTime;\n };\n}) {\n const { required, unavailable, minDate, maxDate } = constraints;\n if (!date) {\n return required ? false : true;\n }\n if (unavailable?.dates?.some((d) => d.equals(date))) {\n return false;\n }\n if (unavailable?.daysOfWeek?.includes(date.weekday)) {\n return false;\n }\n if (minDate && date < minDate) {\n return false;\n }\n if (maxDate && date > maxDate) {\n return false;\n }\n return true;\n}\n","import { KeyboardEventHandler, RefObject, useRef, useState } from \"react\";\nimport { useKeyboardFocusables } from \"../../../internal/hooks\";\n\n/**\n * Responsible for orchestrating the input and calendar popover states\n * @param inputRef - The ref to the input element\n * @returns calendarOpen, setCalendarOpen, handleCalendarKeyDown, handleInputKeyDown\n */\nexport const useDateFieldOrchestration = ({\n inputRef,\n calendarDefaultOpen,\n popoverContentRef,\n disableCalendar = false,\n}: {\n inputRef: RefObject<HTMLInputElement>;\n calendarDefaultOpen: boolean;\n popoverContentRef: RefObject<HTMLDivElement>;\n disableCalendar?: boolean;\n}) => {\n const documentRef = useRef<HTMLElement>(document.body);\n const [calendarOpen, setCalendarOpen] = useState(calendarDefaultOpen);\n\n const { focusables } = useKeyboardFocusables(documentRef, {\n observeChange: true,\n });\n\n const { focusables: popoverFocusables } = useKeyboardFocusables(\n popoverContentRef,\n {\n observeChange: true,\n },\n );\n\n const pageFocusables = focusables?.filter(\n (item) => !popoverFocusables?.includes(item),\n );\n\n const handleCalendarKeyDown = (\n event: React.KeyboardEvent<HTMLDivElement>,\n ) => {\n if (event.key === \"Escape\") {\n inputRef.current?.focus();\n }\n };\n\n const focusToCalendar = () => {\n if (popoverContentRef.current) {\n const currentFocusable =\n popoverContentRef.current.querySelectorAll('[tabindex = \"0\"]')[0];\n if (currentFocusable) {\n (currentFocusable as HTMLButtonElement).focus();\n }\n }\n };\n\n const handleInputKeyDown: KeyboardEventHandler<HTMLInputElement> = (ev) => {\n if (disableCalendar) {\n return;\n }\n let currentFocusIndex = 0;\n switch (ev.key) {\n case \"Escape\":\n setCalendarOpen(false);\n break;\n case \"Tab\":\n if (!calendarOpen || !pageFocusables?.length) {\n break;\n }\n ev.preventDefault();\n currentFocusIndex = pageFocusables.indexOf(inputRef.current!) || 0;\n setCalendarOpen(false);\n if (ev.shiftKey) {\n if (currentFocusIndex === 0) {\n requestAnimationFrame(() =>\n pageFocusables[pageFocusables.length - 1].focus(),\n );\n } else {\n requestAnimationFrame(() =>\n pageFocusables[currentFocusIndex - 1].focus(),\n );\n }\n break;\n }\n if (pageFocusables.length > currentFocusIndex + 1) {\n requestAnimationFrame(() =>\n pageFocusables[currentFocusIndex + 1].focus(),\n );\n } else {\n requestAnimationFrame(() => pageFocusables[0].focus());\n }\n break;\n case \"ArrowDown\":\n if (!calendarOpen) {\n setCalendarOpen(true);\n setTimeout(focusToCalendar, 200);\n } else {\n focusToCalendar();\n }\n }\n };\n\n return {\n calendarOpen,\n setCalendarOpen,\n handleCalendarKeyDown,\n handleInputKeyDown,\n };\n};\n"],"names":[],"mappings":";;;;AAEO,MAAM,mBAAgD,GAAA;AAAA,EAC3D,YAAc,EAAA,YAAA;AAAA,EACd,YAAc,EAAA,YAAA;AAAA,EACd,YAAc,EAAA;AAChB;AAEO,MAAM,wBAAqD,GAAA;AAAA,EAChE,YAAc,EAAA,YAAA;AAAA,EACd,YAAc,EAAA,YAAA;AAAA,EACd,YAAc,EAAA;AAChB;;ACVO,SAAS,oBACd,CAC6B,EAAA;AAC7B,EAAI,IAAA,CAAA,KAAM,MAAa,IAAA,CAAA,KAAM,IAAM,EAAA;AACjC,IAAO,OAAA,CAAA;AAAA;AAET,EAAM,MAAA,IAAA,GAAO,QAAS,CAAA,OAAA,CAAQ,CAAG,EAAA,EAAE,SAAS,IAAM,EAAA,IAAA,EAAM,KAAM,EAAC,CAAE,CAAA,OAAA;AAAA,IAC/D;AAAA,GACF;AACA,EAAA,IAAI,KAAK,OAAS,EAAA;AAChB,IAAO,OAAA,IAAA;AAAA;AAET,EAAO,OAAA,IAAA;AACT;AACO,SAAS,YAAa,CAAA;AAAA,EAC3B,IAAA;AAAA,EACA;AACF,CAWG,EAAA;AACD,EAAA,MAAM,EAAE,QAAA,EAAU,WAAa,EAAA,OAAA,EAAS,SAAY,GAAA,WAAA;AACpD,EAAA,IAAI,CAAC,IAAM,EAAA;AACT,IAAA,OAAO,WAAW,KAAQ,GAAA,IAAA;AAAA;AAE5B,EAAI,IAAA,WAAA,EAAa,OAAO,IAAK,CAAA,CAAC,MAAM,CAAE,CAAA,MAAA,CAAO,IAAI,CAAC,CAAG,EAAA;AACnD,IAAO,OAAA,KAAA;AAAA;A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AA;AACH,QAAA,IAAI,CAAC,YAAc,EAAA;AACjB,UAAA,eAAA,CAAgB,IAAI,CAAA;AACpB,UAAA,UAAA,CAAW,iBAAiB,GAAG,CAAA;AAAA,SAC1B,MAAA;AACL,UAAgB,eAAA,EAAA;AAAA;AAClB;AACJ,GACF;AAEA,EAAO,OAAA;AAAA,IACL,YAAA;AAAA,IACA,eAAA;AAAA,IACA,qBAAA;AAAA,IACA;AAAA,GACF;AACF;;;;"}
1
+ {"version":3,"file":"useDateFieldOrchestration-DPLftOxu.js","sources":["../src/components/DateFieldSingle/internal/constants.ts","../src/components/DateFieldSingle/internal/utils.ts","../src/components/DateFieldSingle/internal/useDateFieldOrchestration.ts"],"sourcesContent":["import { DateMode } from \"../types\";\n\nexport const DateModeToFormatMap: Record<DateMode, string> = {\n \"mm/dd/yyyy\": \"MM/dd/yyyy\",\n \"dd/mm/yyyy\": \"dd/MM/yyyy\",\n \"yyyy/mm/dd\": \"yyyy/MM/dd\",\n};\n\nexport const DateModeToPlaceholderMap: Record<DateMode, string> = {\n \"dd/mm/yyyy\": \"__/__/____\",\n \"mm/dd/yyyy\": \"__/__/____\",\n \"yyyy/mm/dd\": \"____/__/__\",\n};\n","import { DateTime } from \"luxon\";\n\nexport function convertStringToDate(\n v: string | null | undefined,\n): DateTime | null | undefined {\n if (v === undefined || v === null) {\n return v;\n }\n const date = DateTime.fromISO(v, { setZone: true, zone: \"utc\" }).startOf(\n \"day\",\n );\n if (date.isValid) {\n return date;\n }\n return null;\n}\nexport function validateDate({\n date,\n constraints,\n}: {\n date: DateTime | null;\n constraints: {\n required?: boolean;\n unavailable?: {\n dates?: DateTime[];\n daysOfWeek?: number[];\n };\n minDate?: DateTime;\n maxDate?: DateTime;\n };\n}) {\n const { required, unavailable, minDate, maxDate } = constraints;\n if (!date) {\n return required ? false : true;\n }\n if (unavailable?.dates?.some((d) => d.equals(date))) {\n return false;\n }\n if (unavailable?.daysOfWeek?.includes(date.weekday)) {\n return false;\n }\n if (minDate && date < minDate) {\n return false;\n }\n if (maxDate && date > maxDate) {\n return false;\n }\n return true;\n}\n","import { KeyboardEventHandler, RefObject, useRef, useState } from \"react\";\nimport { useKeyboardFocusables } from \"../../../internal/hooks\";\n\n/**\n * Responsible for orchestrating the input and calendar popover states\n * @param inputRef - The ref to the input element\n * @returns calendarOpen, setCalendarOpen, handleCalendarKeyDown, handleInputKeyDown\n */\nexport const useDateFieldOrchestration = ({\n inputRef,\n calendarDefaultOpen,\n popoverContentRef,\n disableCalendar = false,\n}: {\n inputRef: RefObject<HTMLInputElement>;\n calendarDefaultOpen: boolean;\n popoverContentRef: RefObject<HTMLDivElement>;\n disableCalendar?: boolean;\n}) => {\n const documentRef = useRef<HTMLElement>(document.body);\n const [calendarOpen, setCalendarOpen] = useState(calendarDefaultOpen);\n\n const { focusables } = useKeyboardFocusables(documentRef, {\n observeChange: true,\n });\n\n const { focusables: popoverFocusables } = useKeyboardFocusables(\n popoverContentRef,\n {\n observeChange: true,\n },\n );\n\n const pageFocusables = focusables?.filter(\n (item) => !popoverFocusables?.includes(item),\n );\n\n const handleCalendarKeyDown = (\n event: React.KeyboardEvent<HTMLDivElement>,\n ) => {\n if (event.key === \"Escape\") {\n inputRef.current?.focus();\n }\n };\n\n const focusToCalendar = () => {\n if (popoverContentRef.current) {\n const currentFocusable =\n popoverContentRef.current.querySelectorAll('[tabindex = \"0\"]')[0];\n if (currentFocusable) {\n (currentFocusable as HTMLButtonElement).focus();\n }\n }\n };\n\n const handleInputKeyDown: KeyboardEventHandler<HTMLInputElement> = (ev) => {\n if (disableCalendar) {\n return;\n }\n let currentFocusIndex = 0;\n switch (ev.key) {\n case \"Escape\":\n setCalendarOpen(false);\n break;\n case \"Tab\":\n if (!calendarOpen || !pageFocusables?.length) {\n break;\n }\n ev.preventDefault();\n currentFocusIndex = pageFocusables.indexOf(inputRef.current!) || 0;\n setCalendarOpen(false);\n if (ev.shiftKey) {\n if (currentFocusIndex === 0) {\n requestAnimationFrame(() =>\n pageFocusables[pageFocusables.length - 1].focus(),\n );\n } else {\n requestAnimationFrame(() =>\n pageFocusables[currentFocusIndex - 1].focus(),\n );\n }\n break;\n }\n if (pageFocusables.length > currentFocusIndex + 1) {\n requestAnimationFrame(() =>\n pageFocusables[currentFocusIndex + 1].focus(),\n );\n } else {\n requestAnimationFrame(() => pageFocusables[0].focus());\n }\n break;\n case \"ArrowDown\":\n if (!calendarOpen) {\n setCalendarOpen(true);\n setTimeout(focusToCalendar, 200);\n } else {\n focusToCalendar();\n }\n }\n };\n\n return {\n calendarOpen,\n setCalendarOpen,\n handleCalendarKeyDown,\n handleInputKeyDown,\n };\n};\n"],"names":[],"mappings":";;;;AAEO,MAAM,mBAAgD,GAAA;AAAA,EAC3D,YAAc,EAAA,YAAA;AAAA,EACd,YAAc,EAAA,YAAA;AAAA,EACd,YAAc,EAAA;AAChB;AAEO,MAAM,wBAAqD,GAAA;AAAA,EAChE,YAAc,EAAA,YAAA;AAAA,EACd,YAAc,EAAA,YAAA;AAAA,EACd,YAAc,EAAA;AAChB;;ACVO,SAAS,oBACd,CAC6B,EAAA;AAC7B,EAAI,IAAA,CAAA,KAAM,MAAa,IAAA,CAAA,KAAM,IAAM,EAAA;AACjC,IAAO,OAAA,CAAA;AAAA;AAET,EAAM,MAAA,IAAA,GAAO,QAAS,CAAA,OAAA,CAAQ,CAAG,EAAA,EAAE,SAAS,IAAM,EAAA,IAAA,EAAM,KAAM,EAAC,CAAE,CAAA,OAAA;AAAA,IAC/D;AAAA,GACF;AACA,EAAA,IAAI,KAAK,OAAS,EAAA;AAChB,IAAO,OAAA,IAAA;AAAA;AAET,EAAO,OAAA,IAAA;AACT;AACO,SAAS,YAAa,CAAA;AAAA,EAC3B,IAAA;AAAA,EACA;AACF,CAWG,EAAA;AACD,EAAA,MAAM,EAAE,QAAA,EAAU,WAAa,EAAA,OAAA,EAAS,SAAY,GAAA,WAAA;AACpD,EAAA,IAAI,CAAC,IAAM,EAAA;AACT,IAAA,OAAO,WAAW,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GAAA,CAAC,EAAE,KAAM;AAAA,WAC9C;AAAA,SACK,MAAA;AACL,UAAA,qBAAA,CAAsB,MAAM,cAAA,CAAe,CAAC,CAAA,CAAE,OAAO,CAAA;AAAA;AAEvD,QAAA;AAAA,MACF,KAAK,WAAA;AACH,QAAA,IAAI,CAAC,YAAc,EAAA;AACjB,UAAA,eAAA,CAAgB,IAAI,CAAA;AACpB,UAAA,UAAA,CAAW,iBAAiB,GAAG,CAAA;AAAA,SAC1B,MAAA;AACL,UAAgB,eAAA,EAAA;AAAA;AAClB;AACJ,GACF;AAEA,EAAO,OAAA;AAAA,IACL,YAAA;AAAA,IACA,eAAA;AAAA,IACA,qBAAA;AAAA,IACA;AAAA,GACF;AACF;;;;"}
@@ -0,0 +1,32 @@
1
+ import { useRef } from 'react';
2
+
3
+ function useFocusWithin({
4
+ onBlur,
5
+ onFocus
6
+ } = {}) {
7
+ const isFocusedRef = useRef(false);
8
+ const handleFocus = (event) => {
9
+ if (!isFocusedRef.current) {
10
+ isFocusedRef.current = true;
11
+ onFocus?.(event);
12
+ }
13
+ };
14
+ const handleBlur = (event) => {
15
+ if (isFocusedRef.current && !containsRelatedTarget(event)) {
16
+ isFocusedRef.current = false;
17
+ onBlur?.(event);
18
+ }
19
+ };
20
+ return {
21
+ props: { onFocus: handleFocus, onBlur: handleBlur }
22
+ };
23
+ }
24
+ function containsRelatedTarget(event) {
25
+ if (event.currentTarget instanceof HTMLElement && event.relatedTarget instanceof HTMLElement) {
26
+ return event.currentTarget.contains(event.relatedTarget);
27
+ }
28
+ return false;
29
+ }
30
+
31
+ export { useFocusWithin as u };
32
+ //# sourceMappingURL=useFocusWithin-BhhgRXdZ.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useFocusWithin-BhhgRXdZ.js","sources":["../src/internal/hooks/useFocusWithin/useFocusWithin.ts"],"sourcesContent":["import { FocusEventHandler, useRef } from \"react\";\nexport interface UseFocusWithinOptions {\n onFocus?: (event: React.FocusEvent) => void;\n onBlur?: (event: React.FocusEvent) => void;\n}\n\nexport interface UseFocusWithinReturnValue<\n T extends HTMLElement = HTMLElement,\n> {\n props: {\n onFocus: FocusEventHandler<T>;\n onBlur: FocusEventHandler<T>;\n };\n}\n\n/**\n * Custom hook for tracking focus state within a DOM element.\n *\n * @param options Configuration options for the hook\n * @param options.onFocus Optional callback when focus enters the element\n * @param options.onBlur Optional callback when focus leaves the element\n * @returns Object containing props for the element\n *\n * @example\n * const { props } = useFocusWithin({\n * onFocus: () => console.log('Focus entered'),\n * onBlur: () => console.log('Focus left')\n * });\n *\n * return <div {...props}>Content</div>;\n */\nexport function useFocusWithin<T extends HTMLElement = any>({\n onBlur,\n onFocus,\n}: UseFocusWithinOptions = {}): UseFocusWithinReturnValue<T> {\n const isFocusedRef = useRef(false);\n\n const handleFocus: FocusEventHandler<T> = (event) => {\n if (!isFocusedRef.current) {\n isFocusedRef.current = true;\n onFocus?.(event);\n }\n };\n\n const handleBlur: FocusEventHandler<T> = (event) => {\n if (isFocusedRef.current && !containsRelatedTarget(event)) {\n isFocusedRef.current = false;\n onBlur?.(event);\n }\n };\n\n return {\n props: { onFocus: handleFocus, onBlur: handleBlur },\n };\n}\n\nfunction containsRelatedTarget(event: React.FocusEvent) {\n if (\n event.currentTarget instanceof HTMLElement &&\n event.relatedTarget instanceof HTMLElement\n ) {\n return event.currentTarget.contains(event.relatedTarget);\n }\n\n return false;\n}\n"],"names":[],"mappings":";;AA+BO,SAAS,cAA4C,CAAA;AAAA,EAC1D,MAAA;AAAA,EACA;AACF,CAAA,GAA2B,EAAkC,EAAA;AAC3D,EAAM,MAAA,YAAA,GAAe,OAAO,KAAK,CAAA;AAEjC,EAAM,MAAA,WAAA,GAAoC,CAAC,KAAU,KAAA;AACnD,IAAI,IAAA,CAAC,aAAa,OAAS,EAAA;AACzB,MAAA,YAAA,CAAa,OAAU,GAAA,IAAA;AACvB,MAAA,OAAA,GAAU,KAAK,CAAA;AAAA;AACjB,GACF;AAEA,EAAM,MAAA,UAAA,GAAmC,CAAC,KAAU,KAAA;AAClD,IAAA,IAAI,YAAa,CAAA,OAAA,IAAW,CAAC,qBAAA,CAAsB,KAAK,CAAG,EAAA;AACzD,MAAA,YAAA,CAAa,OAAU,GAAA,KAAA;AACvB,MAAA,MAAA,GAAS,KAAK,CAAA;AAAA;AAChB,GACF;AAEA,EAAO,OAAA;AAAA,IACL,KAAO,EAAA,EAAE,OAAS,EAAA,WAAA,EAAa,QAAQ,UAAW;AAAA,GACpD;AACF;AAEA,SAAS,sBAAsB,KAAyB,EAAA;AACtD,EAAA,IACE,KAAM,CAAA,aAAA,YAAyB,WAC/B,IAAA,KAAA,CAAM,yBAAyB,WAC/B,EAAA;AACA,IAAA,OAAO,KAAM,CAAA,aAAA,CAAc,QAAS,CAAA,KAAA,CAAM,aAAa,CAAA;AAAA;AAGzD,EAAO,OAAA,KAAA;AACT;;;;"}
@@ -5,7 +5,7 @@ import { a as _extends, _ as _objectWithoutPropertiesLoose } from './extends-Bg2
5
5
  import { P as Popover, u as usePopoverLegacyContext, f as usePopoverContext } from './Popover-r26xMIfm.js';
6
6
  import { u as useLayoutPropsUtil } from './useLayoutPropsUtil-DjD5IMh0.js';
7
7
  import { s as supportsPopover } from './DrawerContext-DboTgTmo.js';
8
- import { i as isMultiple, u as useDownshiftEnvironment$1, a as defaultItemToKey$1, d as defaultItemToString$1, S as SelectTriggerBase, A as ADD_NEW$1 } from './SelectTriggerBase-BMMxnXrw.js';
8
+ import { i as isMultiple, u as useDownshiftEnvironment$1, a as defaultItemToKey$1, d as defaultItemToString$1, S as SelectTriggerBase, A as ADD_NEW$1 } from './SelectTriggerBase-DP9fmRSo.js';
9
9
  import { s as styles$4 } from './Listbox.module-DcBE8Zmo.js';
10
10
  import { T as Text } from './Text-BqvcbXyp.js';
11
11
  import { F as Flex } from './Flex-BdQMekvA.js';
@@ -10353,4 +10353,4 @@ function useInfiniteCombobox({
10353
10353
  }
10354
10354
 
10355
10355
  export { Combobox as C, ComboboxElement as a, ComboboxSelect as b, ComboboxContent as c, ComboboxList as d, ComboboxItem as e, ComboboxItemAddNew as f, ComboboxSearchField as g, ComboboxSelectTrigger as h, ComboboxEmpty as i, useInfiniteCombobox as u };
10356
- //# sourceMappingURL=useInfiniteCombobox-BN2uGhBh.js.map
10356
+ //# sourceMappingURL=useInfiniteCombobox-BaYWUxjg.js.map