@servicetitan/anvil2 1.46.3 → 1.46.5

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 (50) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/dist/{Calendar-Cn0fOgog.js → Calendar-BqOvsaby.js} +148 -148
  3. package/dist/{Calendar-Cn0fOgog.js.map → Calendar-BqOvsaby.js.map} +1 -1
  4. package/dist/Calendar.js +1 -1
  5. package/dist/{DateField-qHdgwSlB.js → DateField-DLqKbCcm.js} +2 -2
  6. package/dist/{DateField-qHdgwSlB.js.map → DateField-DLqKbCcm.js.map} +1 -1
  7. package/dist/DateField.js +1 -1
  8. package/dist/{DateFieldRange-GNpWV70g.js → DateFieldRange-DI-iF-sd.js} +3 -3
  9. package/dist/{DateFieldRange-GNpWV70g.js.map → DateFieldRange-DI-iF-sd.js.map} +1 -1
  10. package/dist/DateFieldRange.js +1 -1
  11. package/dist/{DateFieldSingle-B9caNibj.js → DateFieldSingle-BXakaSIE.js} +3 -3
  12. package/dist/{DateFieldSingle-B9caNibj.js.map → DateFieldSingle-BXakaSIE.js.map} +1 -1
  13. package/dist/DateFieldSingle.js +1 -1
  14. package/dist/{Dialog-BHFLnFNQ.js → Dialog-xsgqM6e1.js} +10 -17
  15. package/dist/Dialog-xsgqM6e1.js.map +1 -0
  16. package/dist/Dialog.js +1 -1
  17. package/dist/DndSort.js +46 -6
  18. package/dist/DndSort.js.map +1 -1
  19. package/dist/{Drawer-BDA7Sjj9.js → Drawer-DpN7wUNy.js} +11 -18
  20. package/dist/Drawer-DpN7wUNy.js.map +1 -0
  21. package/dist/Drawer.js +1 -1
  22. package/dist/{Page-BfH2mGSt.js → Page-CRuqAlNu.js} +2 -2
  23. package/dist/{Page-BfH2mGSt.js.map → Page-CRuqAlNu.js.map} +1 -1
  24. package/dist/Page.js +1 -1
  25. package/dist/{Toolbar-BXGTrR6o.js → Toolbar-B1FUI3bF.js} +81 -35
  26. package/dist/Toolbar-B1FUI3bF.js.map +1 -0
  27. package/dist/Toolbar.js +1 -1
  28. package/dist/beta.js +1 -1
  29. package/dist/components/Checkbox/Checkbox.d.ts +1 -1
  30. package/dist/components/Dialog/internal/useInitialFocus.d.ts +15 -0
  31. package/dist/components/DndSort/internal/DndSortOverlay.d.ts +1 -1
  32. package/dist/components/NumberField/NumberField.d.ts +2 -2
  33. package/dist/components/Radio/Radio.d.ts +1 -1
  34. package/dist/index.js +86 -38
  35. package/dist/index.js.map +1 -1
  36. package/dist/internal/components/index.d.ts +1 -0
  37. package/dist/internal/hooks/index.d.ts +2 -2
  38. package/dist/internal/hooks/usePlatform/index.d.ts +1 -1
  39. package/dist/internal/index.d.ts +5 -0
  40. package/dist/internal/types/argTypes.d.ts +154 -0
  41. package/dist/internal/types/index.d.ts +1 -0
  42. package/dist/{useKeyboardFocusables-ek2mYel-.js → useInitialFocus-CAFMgbJG.js} +27 -2
  43. package/dist/useInitialFocus-CAFMgbJG.js.map +1 -0
  44. package/dist/{utils-CnKBdBNm.js → utils-Dh3aegV3.js} +2 -2
  45. package/dist/{utils-CnKBdBNm.js.map → utils-Dh3aegV3.js.map} +1 -1
  46. package/package.json +1 -1
  47. package/dist/Dialog-BHFLnFNQ.js.map +0 -1
  48. package/dist/Drawer-BDA7Sjj9.js.map +0 -1
  49. package/dist/Toolbar-BXGTrR6o.js.map +0 -1
  50. package/dist/useKeyboardFocusables-ek2mYel-.js.map +0 -1
package/dist/index.js CHANGED
@@ -9,23 +9,23 @@ import { B as Button } from './Button-VNQQgZ45.js';
9
9
  export { B as ButtonCompound } from './ButtonCompound-BbPK-Xjj.js';
10
10
  import { B as ButtonLink } from './ButtonLink-CqR1F5Wn.js';
11
11
  import { B as ButtonToggle } from './ButtonToggle-PCeSG-5D.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-Cn0fOgog.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-BqOvsaby.js';
13
13
  export { C as Card } from './Card-vTYeSkxt.js';
14
14
  export { C as Checkbox } from './Checkbox-DAODkzN3.js';
15
15
  export { C as CheckboxGroup } from './Checkbox-C5PX8wur.js';
16
16
  export { C as Chip } from './Chip-DLU13qe-.js';
17
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 } from './Combobox-DO8cIvRQ.js';
18
18
  export { u as useInfiniteCombobox } from './useInfiniteCombobox-WcRgC9p6.js';
19
- export { D as DateField } from './DateField-qHdgwSlB.js';
20
- export { D as DateFieldRange } from './DateFieldRange-GNpWV70g.js';
21
- export { D as DateFieldSingle } from './DateFieldSingle-B9caNibj.js';
19
+ export { D as DateField } from './DateField-DLqKbCcm.js';
20
+ export { D as DateFieldRange } from './DateFieldRange-DI-iF-sd.js';
21
+ export { D as DateFieldSingle } from './DateFieldSingle-BXakaSIE.js';
22
22
  export { D as DateFieldYearless } from './DateFieldYearless-BmeKGaDc.js';
23
23
  export { D as DaysOfTheWeek } from './DaysOfTheWeek-DPH13VCK.js';
24
24
  export { D as Details, b as DetailsContent, a as DetailsSummary } from './Details-CF8DImjw.js';
25
- export { D as Dialog, a as DialogCancelButton, b as DialogContent, c as DialogFooter, d as DialogHeader } from './Dialog-BHFLnFNQ.js';
25
+ export { D as Dialog, a as DialogCancelButton, b as DialogContent, c as DialogFooter, d as DialogHeader } from './Dialog-xsgqM6e1.js';
26
26
  export { D as Divider } from './Divider-DJe8kLf2.js';
27
27
  export { D as Dnd } from './index-DrM3iid4.js';
28
- export { D as Drawer, a as DrawerCancelButton, d as DrawerContent, b as DrawerFooter, c as DrawerHeader } from './Drawer-BDA7Sjj9.js';
28
+ export { D as Drawer, a as DrawerCancelButton, d as DrawerContent, b as DrawerFooter, c as DrawerHeader } from './Drawer-DpN7wUNy.js';
29
29
  export { E as EditCard } from './EditCard-CZzL0nx7.js';
30
30
  export { F as FieldLabel } from './FieldLabel-Bgl3iu13.js';
31
31
  export { F as FieldMessage } from './FieldMessage-B7uQ8vmr.js';
@@ -42,7 +42,7 @@ export { L as ListView, a as ListViewOption, b as ListViewOptionCell } from './L
42
42
  export { M as Menu, a as MenuItem } from './Menu-DUZqzpwg.js';
43
43
  export { N as NumberField } from './NumberField-DWPAy1eG.js';
44
44
  export { Overflow, OverflowText } from './Overflow.js';
45
- export { P as Page } from './Page-BfH2mGSt.js';
45
+ export { P as Page } from './Page-CRuqAlNu.js';
46
46
  export { P as Pagination } from './Pagination-B_G9QcHf.js';
47
47
  import { P as Popover } from './Popover-v8R920kj.js';
48
48
  export { a as PopoverButton, b as PopoverClose, c as PopoverContent, d as PopoverTrigger } from './Popover-v8R920kj.js';
@@ -737,7 +737,7 @@ const ToolbarItemWrapper = ({
737
737
  };
738
738
 
739
739
  const ToolbarButton = forwardRef(
740
- (props, _ref) => {
740
+ (props, ref) => {
741
741
  const { appearance = "ghost", className, children, ...rest } = props;
742
742
  const { isInOverflowMenu = false } = useOverFlowItemContext?.() || {};
743
743
  const trackingId = useTrackingId({
@@ -753,6 +753,7 @@ const ToolbarButton = forwardRef(
753
753
  const item = children ? /* @__PURE__ */ jsx(
754
754
  Button,
755
755
  {
756
+ ref,
756
757
  "data-tracking-id": trackingId,
757
758
  appearance,
758
759
  size: "small",
@@ -765,6 +766,7 @@ const ToolbarButton = forwardRef(
765
766
  /* @__PURE__ */ jsx(Tooltip.Trigger, { children: /* @__PURE__ */ jsx(
766
767
  Button,
767
768
  {
769
+ ref,
768
770
  "data-tracking-id": trackingId,
769
771
  appearance,
770
772
  size: "small",
@@ -890,6 +892,8 @@ const ToolbarSelect = forwardRef(
890
892
  ...rest
891
893
  } = props;
892
894
  const selectId = useId();
895
+ const popoverContentRef = useRef(null);
896
+ const [isPopoverOpen, setIsPopoverOpen] = useState(false);
893
897
  const defaultId = items.length > 0 ? items[0].id : "";
894
898
  const [internalSelectedId, setInternalSelectedId] = useState(defaultId);
895
899
  const selectedId = selectedItemId ?? internalSelectedId;
@@ -899,12 +903,37 @@ const ToolbarSelect = forwardRef(
899
903
  setInternalSelectedId(items[0].id);
900
904
  }
901
905
  }, [items, selectedItemId, internalSelectedId]);
906
+ const prevIsPopoverOpen = useRef(isPopoverOpen);
907
+ useEffect(() => {
908
+ if (prevIsPopoverOpen.current && !isPopoverOpen) {
909
+ setTimeout(() => {
910
+ const triggerButton = document.getElementById(selectId);
911
+ if (triggerButton) {
912
+ triggerButton.focus();
913
+ }
914
+ });
915
+ }
916
+ prevIsPopoverOpen.current = isPopoverOpen;
917
+ }, [isPopoverOpen, selectId]);
902
918
  const handleSelectionChange = (selected) => {
903
919
  if (selected?.id) {
904
920
  if (selectedItemId === void 0) {
905
921
  setInternalSelectedId(selected.id);
906
922
  }
907
923
  onChange?.(selected.id);
924
+ setIsPopoverOpen(false);
925
+ }
926
+ };
927
+ const handleKeyDown = (event) => {
928
+ if (event.code === "ArrowDown" && isPopoverOpen) {
929
+ const listboxContainer = popoverContentRef.current?.querySelector(
930
+ '[role="listbox"]'
931
+ );
932
+ if (listboxContainer) {
933
+ listboxContainer.focus();
934
+ }
935
+ event.stopPropagation();
936
+ event.preventDefault();
908
937
  }
909
938
  };
910
939
  const { isInOverflowMenu = false } = useOverFlowItemContext?.() || {};
@@ -919,39 +948,58 @@ const ToolbarSelect = forwardRef(
919
948
  hasOverride: !!props["data-tracking-id"]
920
949
  });
921
950
  const buttonClassNames = cx(className, styles["toolbar-button-item"]);
922
- const item = /* @__PURE__ */ jsxs(Popover, { noPadding: true, children: [
923
- /* @__PURE__ */ jsx(
924
- Popover.Button,
925
- {
926
- "data-tracking-id": trackingId,
927
- appearance,
928
- size: "small",
929
- icon: { after: SvgArrowDropDown },
930
- className: buttonClassNames,
931
- id: selectId,
932
- "data-anv": "toolbar-select",
933
- ...rest,
934
- children: selectedItem?.label
935
- }
936
- ),
937
- /* @__PURE__ */ jsx(
938
- Popover.Content,
939
- {
940
- className: styles["toolbar-select-content"],
941
- "aria-label": `${accessibleLabel} options`,
942
- children: /* @__PURE__ */ jsx(
943
- Listbox,
951
+ const item = /* @__PURE__ */ jsxs(
952
+ Popover,
953
+ {
954
+ noPadding: true,
955
+ open: isPopoverOpen,
956
+ onClickOutside: () => {
957
+ setIsPopoverOpen(false);
958
+ },
959
+ onClose: () => {
960
+ setIsPopoverOpen(false);
961
+ },
962
+ children: [
963
+ /* @__PURE__ */ jsx(
964
+ Popover.Button,
944
965
  {
945
- selected: selectedItem,
946
- onSelectionChange: handleSelectionChange,
947
- items,
948
- "aria-labelledby": selectId,
949
- children: ({ items: items2 }) => items2.map((item2) => /* @__PURE__ */ jsx(Listbox.Option, { item: item2, children: item2.label }, item2.label))
966
+ "data-tracking-id": trackingId,
967
+ appearance,
968
+ size: "small",
969
+ icon: { after: SvgArrowDropDown },
970
+ className: buttonClassNames,
971
+ id: selectId,
972
+ "data-anv": "toolbar-select",
973
+ onClick: () => {
974
+ setIsPopoverOpen(!isPopoverOpen);
975
+ },
976
+ onKeyDown: handleKeyDown,
977
+ ...rest,
978
+ children: selectedItem?.label
979
+ }
980
+ ),
981
+ /* @__PURE__ */ jsx(
982
+ Popover.Content,
983
+ {
984
+ ref: popoverContentRef,
985
+ className: styles["toolbar-select-content"],
986
+ "aria-label": `${accessibleLabel} options`,
987
+ children: /* @__PURE__ */ jsx(
988
+ Listbox,
989
+ {
990
+ selected: selectedItem,
991
+ onSelectionChange: handleSelectionChange,
992
+ items,
993
+ "aria-labelledby": selectId,
994
+ disableAutoSelectOnFocus: true,
995
+ children: ({ items: items2 }) => items2.map((item2) => /* @__PURE__ */ jsx(Listbox.Option, { item: item2, children: item2.label }, item2.label))
996
+ }
997
+ )
950
998
  }
951
999
  )
952
- }
953
- )
954
- ] });
1000
+ ]
1001
+ }
1002
+ );
955
1003
  if (isInOverflowMenu) {
956
1004
  return item;
957
1005
  }