@jobber/components 6.103.5 → 6.103.6

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 (36) hide show
  1. package/dist/Autocomplete/components/MenuList.d.ts +1 -1
  2. package/dist/Autocomplete/components/PersistentRegion.d.ts +1 -1
  3. package/dist/Autocomplete/hooks/useAutocompleteListNav.d.ts +1 -1
  4. package/dist/Autocomplete/useAutocomplete.d.ts +1 -1
  5. package/dist/Combobox/ComboboxProvider.d.ts +2 -2
  6. package/dist/Combobox/hooks/useComboboxContent.d.ts +2 -1
  7. package/dist/Combobox/hooks/useMakeComboboxHandlers.d.ts +1 -1
  8. package/dist/DataList/DataList.types.d.ts +2 -2
  9. package/dist/DataList/DataList.utils.d.ts +2 -2
  10. package/dist/DataList/components/DataListItem/DataListItemInternal.d.ts +1 -2
  11. package/dist/DataList/hooks/useGetItemActions.d.ts +1 -1
  12. package/dist/DataList.utils-cjs.js +0 -2
  13. package/dist/DataList.utils-es.js +0 -2
  14. package/dist/DataListActions-cjs.js +6 -11
  15. package/dist/DataListActions-es.js +6 -11
  16. package/dist/DataListItem-cjs.js +8 -9
  17. package/dist/DataListItem-es.js +9 -10
  18. package/dist/FormField/FormFieldAffix.d.ts +1 -1
  19. package/dist/InputGroup-cjs.js +5 -3
  20. package/dist/InputGroup-es.js +5 -3
  21. package/dist/Menu/Menu.types.d.ts +5 -1
  22. package/dist/Menu-cjs.js +0 -2
  23. package/dist/Menu-es.js +0 -2
  24. package/dist/Modal/Modal.types.d.ts +3 -3
  25. package/dist/Modal/ModalContext.rebuilt.d.ts +2 -2
  26. package/dist/MultiSelect/DropDownMenu.d.ts +1 -1
  27. package/dist/RadioGroup/RadioGroup.d.ts +2 -1
  28. package/dist/RadioGroup/RadioOption.d.ts +1 -1
  29. package/dist/RadioGroup-cjs.js +1 -7
  30. package/dist/RadioGroup-es.js +1 -7
  31. package/dist/Tabs-cjs.js +4 -4
  32. package/dist/Tabs-es.js +4 -4
  33. package/dist/helpers-cjs.js +1 -2
  34. package/dist/helpers-es.js +1 -2
  35. package/dist/utils/mergeRefs.d.ts +2 -2
  36. package/package.json +2 -2
@@ -6,7 +6,7 @@ interface MenuListProps<T extends OptionLike> {
6
6
  readonly activeIndex: number | null;
7
7
  readonly indexOffset?: number;
8
8
  readonly getItemProps: (userProps?: Record<string, unknown>) => Record<string, unknown>;
9
- readonly listRef: React.MutableRefObject<Array<HTMLElement | null>>;
9
+ readonly listRef: React.RefObject<Array<HTMLElement | null>>;
10
10
  readonly listboxId: string;
11
11
  readonly customRenderOption?: AutocompleteRebuiltProps<T, false>["customRenderOption"];
12
12
  readonly customRenderSection?: AutocompleteRebuiltProps<T, false>["customRenderSection"];
@@ -7,7 +7,7 @@ interface PersistentRegionProps<T extends OptionLike> {
7
7
  readonly indexOffset: number;
8
8
  readonly listboxId?: string;
9
9
  readonly getItemProps: (args?: Record<string, unknown>) => Record<string, unknown>;
10
- readonly listRef: React.MutableRefObject<Array<HTMLElement | null>>;
10
+ readonly listRef: React.RefObject<Array<HTMLElement | null>>;
11
11
  readonly customRenderHeader?: AutocompleteRebuiltProps<T, false>["customRenderHeader"];
12
12
  readonly customRenderFooter?: AutocompleteRebuiltProps<T, false>["customRenderFooter"];
13
13
  readonly className?: string;
@@ -8,7 +8,7 @@ export interface UseAutocompleteListNavReturn {
8
8
  getItemProps: UseInteractionsReturn["getItemProps"];
9
9
  activeIndex: number | null;
10
10
  setActiveIndex: (index: number | null) => void;
11
- listRef: React.MutableRefObject<Array<HTMLElement | null>>;
11
+ listRef: React.RefObject<Array<HTMLElement | null>>;
12
12
  open: boolean;
13
13
  setOpen: (open: boolean) => void;
14
14
  setReferenceElement: (el: HTMLElement | null) => void;
@@ -55,7 +55,7 @@ export declare function useAutocomplete<Value extends OptionLike, Multiple exten
55
55
  setOpen: (open: boolean) => void;
56
56
  activeIndex: number | null;
57
57
  setActiveIndex: (index: number | null) => void;
58
- listRef: React.MutableRefObject<(HTMLElement | null)[]>;
58
+ listRef: React.RefObject<(HTMLElement | null)[]>;
59
59
  onSelection: (option: Value) => void;
60
60
  onAction: (action: ActionConfig) => void;
61
61
  onInputChangeFromUser: (val: string) => void;
@@ -1,5 +1,5 @@
1
- import type { MutableRefObject } from "react";
2
1
  import React from "react";
2
+ import type { RefObject } from "react";
3
3
  import { type ComboboxOption } from "./Combobox.types";
4
4
  export interface ComboboxProviderProps {
5
5
  readonly children: React.ReactNode;
@@ -8,7 +8,7 @@ export interface ComboboxProviderProps {
8
8
  readonly open: boolean;
9
9
  readonly handleClose: () => void;
10
10
  readonly handleOpen: () => void;
11
- readonly shouldScroll: MutableRefObject<boolean>;
11
+ readonly shouldScroll: RefObject<boolean>;
12
12
  readonly searchValue: string;
13
13
  readonly label?: string;
14
14
  readonly onClear?: () => void;
@@ -1,6 +1,7 @@
1
+ import type { RefObject } from "react";
1
2
  import { type ComboboxOption } from "../Combobox.types";
2
3
  interface useComboboxContent {
3
- optionsListRef: React.RefObject<HTMLUListElement | null>;
4
+ optionsListRef: RefObject<HTMLUListElement | null>;
4
5
  onClear?: () => void;
5
6
  onSelectAll?: (selection: ComboboxOption[]) => void;
6
7
  }
@@ -5,4 +5,4 @@ export interface UseMakeComboboxHandlersReturn {
5
5
  handleSelection: (selection: ComboboxOption) => void;
6
6
  handleOpen: () => void;
7
7
  }
8
- export declare function useMakeComboboxHandlers(setOpen: (open: boolean) => void, open: boolean, setSearchValue: (searchValue: string) => void, selectedOptions: ComboboxOption[], shouldScroll: React.MutableRefObject<boolean>, selectedStateSetter: (selected: ComboboxOption[]) => void, multiSelect?: boolean, onClose?: () => void, onSearch?: (searchValue: string) => void): UseMakeComboboxHandlersReturn;
8
+ export declare function useMakeComboboxHandlers(setOpen: (open: boolean) => void, open: boolean, setSearchValue: (searchValue: string) => void, selectedOptions: ComboboxOption[], shouldScroll: React.RefObject<boolean>, selectedStateSetter: (selected: ComboboxOption[]) => void, multiSelect?: boolean, onClose?: () => void, onSearch?: (searchValue: string) => void): UseMakeComboboxHandlersReturn;
@@ -1,4 +1,4 @@
1
- import { type ReactElement, type ReactNode } from "react";
1
+ import type { ReactElement, ReactNode } from "react";
2
2
  import type { IconNames } from "@jobber/design";
3
3
  import type { XOR } from "ts-xor";
4
4
  import { type Breakpoints } from "./DataList.const";
@@ -289,7 +289,7 @@ export interface DataListActionProps<T extends DataListObject> {
289
289
  /**
290
290
  * Determine if the action is visible for a given item.
291
291
  */
292
- readonly visible?: (item: T) => boolean;
292
+ readonly visible?: (item?: T) => boolean;
293
293
  /**
294
294
  * The callback function when the action is clicked.
295
295
  */
@@ -1,6 +1,6 @@
1
1
  import type { ReactElement } from "react";
2
2
  import React from "react";
3
- import type { DataListHeader, DataListItemType, DataListItemTypeFromHeader, DataListObject } from "./DataList.types";
3
+ import type { DataListActionProps, DataListHeader, DataListItemType, DataListItemTypeFromHeader, DataListObject } from "./DataList.types";
4
4
  import type { Breakpoints } from "./DataList.const";
5
5
  /**
6
6
  * Return the child component that matches the `type` provided
@@ -19,4 +19,4 @@ export declare function generateListItemElement<T extends DataListObject>(item:
19
19
  */
20
20
  export declare function generateHeaderElements<T extends DataListObject>(headers: DataListHeader<T>): DataListItemTypeFromHeader<T, DataListHeader<T>> | undefined;
21
21
  export declare function sortBreakpoints(sizeProp: Breakpoints[]): ("xs" | "sm" | "md" | "lg" | "xl")[];
22
- export declare function getExposedActions(childrenArray: ReactElement[], childCount?: number): ReactElement<unknown, string | React.JSXElementConstructor<any>>[];
22
+ export declare function getExposedActions<T extends DataListObject>(childrenArray: ReactElement<DataListActionProps<T>>[], childCount?: number): ReactElement<DataListActionProps<T>, string | React.JSXElementConstructor<any>>[];
@@ -1,5 +1,4 @@
1
- import type { ReactElement } from "react";
2
- import React from "react";
1
+ import React, { type ReactElement } from "react";
3
2
  import type { DataListObject } from "@jobber/components/DataList/DataList.types";
4
3
  interface ListItemInternalProps<T extends DataListObject> {
5
4
  readonly children: ReactElement;
@@ -1,7 +1,7 @@
1
1
  import type { ReactElement } from "react";
2
2
  import type { DataListActionProps, DataListObject } from "../DataList.types";
3
3
  export declare function useGetItemActions<T extends DataListObject>(item: T): {
4
- actions: ReactElement<DataListActionProps<T>>[];
4
+ actions: ReactElement<DataListActionProps<T>, string | import("react").JSXElementConstructor<any>>[];
5
5
  hasActions: boolean;
6
6
  disableContextMenu: boolean;
7
7
  };
@@ -149,9 +149,7 @@ function sortBreakpoints(sizeProp) {
149
149
  function getExposedActions(childrenArray, childCount = 2) {
150
150
  const firstNChildren = childrenArray.slice(0, childCount);
151
151
  return firstNChildren.reduce((result, child, i) => {
152
- // @ts-expect-error - TODO: fix props are type unknown
153
152
  const hasIcon = Boolean(child.props.icon);
154
- // @ts-expect-error - TODO: fix props are type unknown
155
153
  const isAlwaysVisible = child.props.alwaysVisible; // If true, the child action will always be visible and not nested in the dropdown.
156
154
  if (isAlwaysVisible === false ||
157
155
  (isAlwaysVisible === undefined && !hasIcon)) {
@@ -147,9 +147,7 @@ function sortBreakpoints(sizeProp) {
147
147
  function getExposedActions(childrenArray, childCount = 2) {
148
148
  const firstNChildren = childrenArray.slice(0, childCount);
149
149
  return firstNChildren.reduce((result, child, i) => {
150
- // @ts-expect-error - TODO: fix props are type unknown
151
150
  const hasIcon = Boolean(child.props.icon);
152
- // @ts-expect-error - TODO: fix props are type unknown
153
151
  const isAlwaysVisible = child.props.alwaysVisible; // If true, the child action will always be visible and not nested in the dropdown.
154
152
  if (isAlwaysVisible === false ||
155
153
  (isAlwaysVisible === undefined && !hasIcon)) {
@@ -14,9 +14,7 @@ function DataListActions({ children, itemsToExpose = 2, }) {
14
14
  const exposedActions = DataList_utils.getExposedActions(childrenArray, itemsToExpose);
15
15
  childrenArray.splice(0, exposedActions.length);
16
16
  return (React.createElement(React.Fragment, null,
17
- exposedActions.map(({ props: actionProps }) => {
18
- const props = actionProps;
19
- // @ts-expect-error - TODO: fix activeItem might be undefined
17
+ exposedActions.map(({ props }) => {
20
18
  const isVisible = props.visible ? props.visible(activeItem) : true;
21
19
  const hasIconOrAlwaysVisible = props.icon || props.alwaysVisible;
22
20
  if (!isVisible || !hasIconOrAlwaysVisible) {
@@ -29,21 +27,18 @@ function DataListActions({ children, itemsToExpose = 2, }) {
29
27
  if (activeItem) {
30
28
  return props.label(activeItem);
31
29
  }
30
+ return "";
32
31
  }
33
32
  const actionLabel = getActionLabel();
34
33
  // If the action is always visible, we don't want a tooltip.
35
34
  if (props.alwaysVisible) {
36
- return (React.createElement(Button.Button, { ariaLabel: actionLabel,
37
- // @ts-expect-error - TODO: fix props.label might be a function
38
- key: props.label, icon: props.icon, label: actionLabel, onClick: () => {
35
+ return (React.createElement(Button.Button, { ariaLabel: actionLabel, key: actionLabel, icon: props.icon, label: actionLabel, onClick: () => {
39
36
  var _a;
40
- // @ts-expect-error - TODO: fix activeItem might be undefined
41
- (_a = props.onClick) === null || _a === void 0 ? void 0 : _a.call(props, activeItem);
37
+ if (activeItem)
38
+ (_a = props.onClick) === null || _a === void 0 ? void 0 : _a.call(props, activeItem);
42
39
  }, type: "secondary", variation: "subtle" }));
43
40
  }
44
- return (
45
- // @ts-expect-error - TODO: fix actionLabel might be undefined
46
- React.createElement(Tooltip.Tooltip, { key: actionLabel, message: actionLabel },
41
+ return (React.createElement(Tooltip.Tooltip, { key: actionLabel, message: actionLabel },
47
42
  React.createElement(Button.Button, { icon: props.icon, ariaLabel: actionLabel, onClick: () => {
48
43
  var _a, _b;
49
44
  if (activeItem) {
@@ -12,9 +12,7 @@ function DataListActions({ children, itemsToExpose = 2, }) {
12
12
  const exposedActions = getExposedActions(childrenArray, itemsToExpose);
13
13
  childrenArray.splice(0, exposedActions.length);
14
14
  return (React__default.createElement(React__default.Fragment, null,
15
- exposedActions.map(({ props: actionProps }) => {
16
- const props = actionProps;
17
- // @ts-expect-error - TODO: fix activeItem might be undefined
15
+ exposedActions.map(({ props }) => {
18
16
  const isVisible = props.visible ? props.visible(activeItem) : true;
19
17
  const hasIconOrAlwaysVisible = props.icon || props.alwaysVisible;
20
18
  if (!isVisible || !hasIconOrAlwaysVisible) {
@@ -27,21 +25,18 @@ function DataListActions({ children, itemsToExpose = 2, }) {
27
25
  if (activeItem) {
28
26
  return props.label(activeItem);
29
27
  }
28
+ return "";
30
29
  }
31
30
  const actionLabel = getActionLabel();
32
31
  // If the action is always visible, we don't want a tooltip.
33
32
  if (props.alwaysVisible) {
34
- return (React__default.createElement(Button, { ariaLabel: actionLabel,
35
- // @ts-expect-error - TODO: fix props.label might be a function
36
- key: props.label, icon: props.icon, label: actionLabel, onClick: () => {
33
+ return (React__default.createElement(Button, { ariaLabel: actionLabel, key: actionLabel, icon: props.icon, label: actionLabel, onClick: () => {
37
34
  var _a;
38
- // @ts-expect-error - TODO: fix activeItem might be undefined
39
- (_a = props.onClick) === null || _a === void 0 ? void 0 : _a.call(props, activeItem);
35
+ if (activeItem)
36
+ (_a = props.onClick) === null || _a === void 0 ? void 0 : _a.call(props, activeItem);
40
37
  }, type: "secondary", variation: "subtle" }));
41
38
  }
42
- return (
43
- // @ts-expect-error - TODO: fix actionLabel might be undefined
44
- React__default.createElement(Tooltip, { key: actionLabel, message: actionLabel },
39
+ return (React__default.createElement(Tooltip, { key: actionLabel, message: actionLabel },
45
40
  React__default.createElement(Button, { icon: props.icon, ariaLabel: actionLabel, onClick: () => {
46
41
  var _a, _b;
47
42
  if (activeItem) {
@@ -61,21 +61,20 @@ function DataListItemInternal({ children, item, }) {
61
61
  function useGetItemActions(item) {
62
62
  var _a;
63
63
  const { itemActionComponent } = DataListContext.useDataListContext();
64
- const itemActions = (itemActionComponent === null || itemActionComponent === void 0 ? void 0 : itemActionComponent.props.children) || [];
65
- const actionsArray = React.Children.toArray(itemActions);
66
64
  const disableContextMenu = (_a = itemActionComponent === null || itemActionComponent === void 0 ? void 0 : itemActionComponent.props.disableContextMenu) !== null && _a !== void 0 ? _a : false;
67
65
  const actions = React.useMemo(() => {
68
- return actionsArray.filter(action => {
69
- // @ts-expect-error - TODO: fix action.props type is unknown
70
- if (React.isValidElement(action) && action.props.visible) {
71
- // @ts-expect-error - TODO: fix action.props type is unknown
72
- return action.props.visible(item);
66
+ var _a;
67
+ const children = (_a = itemActionComponent === null || itemActionComponent === void 0 ? void 0 : itemActionComponent.props.children) !== null && _a !== void 0 ? _a : [];
68
+ const nodes = React.Children.toArray(children);
69
+ return nodes.filter((node) => {
70
+ if (React.isValidElement(node)) {
71
+ return node.props.visible ? node.props.visible(item) : true;
73
72
  }
74
- return true;
73
+ return false;
75
74
  });
76
75
  }, [itemActionComponent === null || itemActionComponent === void 0 ? void 0 : itemActionComponent.props.children, item]);
77
76
  return {
78
- actions: actions,
77
+ actions,
79
78
  hasActions: Boolean(actions.length),
80
79
  disableContextMenu,
81
80
  };
@@ -1,4 +1,4 @@
1
- import React__default, { Children, useMemo, isValidElement, useState } from 'react';
1
+ import React__default, { useMemo, Children, isValidElement, useState } from 'react';
2
2
  import { AnimatePresence } from 'framer-motion';
3
3
  import classnames from 'classnames';
4
4
  import { u as useDataListLayoutContext } from './DataListLayoutContext-es.js';
@@ -59,21 +59,20 @@ function DataListItemInternal({ children, item, }) {
59
59
  function useGetItemActions(item) {
60
60
  var _a;
61
61
  const { itemActionComponent } = useDataListContext();
62
- const itemActions = (itemActionComponent === null || itemActionComponent === void 0 ? void 0 : itemActionComponent.props.children) || [];
63
- const actionsArray = Children.toArray(itemActions);
64
62
  const disableContextMenu = (_a = itemActionComponent === null || itemActionComponent === void 0 ? void 0 : itemActionComponent.props.disableContextMenu) !== null && _a !== void 0 ? _a : false;
65
63
  const actions = useMemo(() => {
66
- return actionsArray.filter(action => {
67
- // @ts-expect-error - TODO: fix action.props type is unknown
68
- if (isValidElement(action) && action.props.visible) {
69
- // @ts-expect-error - TODO: fix action.props type is unknown
70
- return action.props.visible(item);
64
+ var _a;
65
+ const children = (_a = itemActionComponent === null || itemActionComponent === void 0 ? void 0 : itemActionComponent.props.children) !== null && _a !== void 0 ? _a : [];
66
+ const nodes = Children.toArray(children);
67
+ return nodes.filter((node) => {
68
+ if (isValidElement(node)) {
69
+ return node.props.visible ? node.props.visible(item) : true;
71
70
  }
72
- return true;
71
+ return false;
73
72
  });
74
73
  }, [itemActionComponent === null || itemActionComponent === void 0 ? void 0 : itemActionComponent.props.children, item]);
75
74
  return {
76
- actions: actions,
75
+ actions,
77
76
  hasActions: Boolean(actions.length),
78
77
  disableContextMenu,
79
78
  };
@@ -1,5 +1,5 @@
1
- import type { RefObject } from "react";
2
1
  import React from "react";
2
+ import type { RefObject } from "react";
3
3
  import type { XOR } from "ts-xor";
4
4
  import type { Affix, FormFieldProps, Suffix } from "./FormFieldTypes";
5
5
  interface AffixLabelProps extends Affix {
@@ -11,11 +11,13 @@ function InputGroup({ children, flowDirection = "vertical", }) {
11
11
  const className = classnames(styles.inputGroup, styles[flowDirection]);
12
12
  return React.createElement("div", { className: className }, children);
13
13
  }
14
+ function isInputGroupElement(node) {
15
+ return React.isValidElement(node) && node.type === InputGroup;
16
+ }
14
17
  function isInvalidGroupNesting(childs) {
15
18
  return React.Children.toArray(childs).some(child => {
16
- if (child.type === InputGroup &&
17
- // @ts-expect-error - TODO: fix child.props type is unknown
18
- child.props.flowDirection != "horizontal") {
19
+ if (isInputGroupElement(child) &&
20
+ child.props.flowDirection !== "horizontal") {
19
21
  console.error(`ERROR: InputGroup not rendered: nesting 'flowDirection="vertical"' columns not supported.`, `https://atlantis.getjobber.com/?path=/story/components-forms-and-inputs-inputgroup-web--nested`);
20
22
  return true;
21
23
  }
@@ -9,11 +9,13 @@ function InputGroup({ children, flowDirection = "vertical", }) {
9
9
  const className = classnames(styles.inputGroup, styles[flowDirection]);
10
10
  return React__default.createElement("div", { className: className }, children);
11
11
  }
12
+ function isInputGroupElement(node) {
13
+ return React__default.isValidElement(node) && node.type === InputGroup;
14
+ }
12
15
  function isInvalidGroupNesting(childs) {
13
16
  return React__default.Children.toArray(childs).some(child => {
14
- if (child.type === InputGroup &&
15
- // @ts-expect-error - TODO: fix child.props type is unknown
16
- child.props.flowDirection != "horizontal") {
17
+ if (isInputGroupElement(child) &&
18
+ child.props.flowDirection !== "horizontal") {
17
19
  console.error(`ERROR: InputGroup not rendered: nesting 'flowDirection="vertical"' columns not supported.`, `https://atlantis.getjobber.com/?path=/story/components-forms-and-inputs-inputgroup-web--nested`);
18
20
  return true;
19
21
  }
@@ -8,7 +8,11 @@ export interface MenuLegacyProps extends MenuBaseProps {
8
8
  /**
9
9
  * Custom menu activator. If this is not provided a default [… More] will be used.
10
10
  */
11
- readonly activator?: ReactElement;
11
+ readonly activator?: ReactElement<{
12
+ fullWidth?: boolean;
13
+ onClick?: (event?: React.MouseEvent) => void;
14
+ [key: string]: unknown;
15
+ }>;
12
16
  /**
13
17
  * Collection of action items.
14
18
  */
package/dist/Menu-cjs.js CHANGED
@@ -126,7 +126,6 @@ function MenuLegacy({ activator, items, UNSAFE_className, UNSAFE_style, }) {
126
126
  const { width } = jobberHooks.useWindowDimensions();
127
127
  const buttonID = React.useId();
128
128
  const menuID = React.useId();
129
- // @ts-expect-error - TODO: fix activator.props type is unknown
130
129
  const fullWidth = ((_a = activator === null || activator === void 0 ? void 0 : activator.props) === null || _a === void 0 ? void 0 : _a.fullWidth) || false;
131
130
  const wrapperClasses = classnames(styles.wrapper, {
132
131
  [styles.fullWidth]: fullWidth,
@@ -199,7 +198,6 @@ function MenuLegacy({ activator, items, UNSAFE_className, UNSAFE_style, }) {
199
198
  }))));
200
199
  return (React.createElement("div", { className: wrapperClasses, onClick: handleParentClick },
201
200
  React.createElement("div", Object.assign({ ref: setReferenceElement }, getReferenceProps()), React.cloneElement(activator, {
202
- // @ts-expect-error - TODO: fix activator.props type is unknown, onClick doesn't exist in unknown type
203
201
  onClick: toggle(activator.props.onClick),
204
202
  id: buttonID,
205
203
  ariaControls: menuID,
package/dist/Menu-es.js CHANGED
@@ -124,7 +124,6 @@ function MenuLegacy({ activator, items, UNSAFE_className, UNSAFE_style, }) {
124
124
  const { width } = useWindowDimensions();
125
125
  const buttonID = useId();
126
126
  const menuID = useId();
127
- // @ts-expect-error - TODO: fix activator.props type is unknown
128
127
  const fullWidth = ((_a = activator === null || activator === void 0 ? void 0 : activator.props) === null || _a === void 0 ? void 0 : _a.fullWidth) || false;
129
128
  const wrapperClasses = classnames(styles.wrapper, {
130
129
  [styles.fullWidth]: fullWidth,
@@ -197,7 +196,6 @@ function MenuLegacy({ activator, items, UNSAFE_className, UNSAFE_style, }) {
197
196
  }))));
198
197
  return (React__default.createElement("div", { className: wrapperClasses, onClick: handleParentClick },
199
198
  React__default.createElement("div", Object.assign({ ref: setReferenceElement }, getReferenceProps()), React__default.cloneElement(activator, {
200
- // @ts-expect-error - TODO: fix activator.props type is unknown, onClick doesn't exist in unknown type
201
199
  onClick: toggle(activator.props.onClick),
202
200
  id: buttonID,
203
201
  ariaControls: menuID,
@@ -1,4 +1,4 @@
1
- import type { MutableRefObject, PropsWithChildren, ReactNode } from "react";
1
+ import type { PropsWithChildren, ReactNode, RefObject } from "react";
2
2
  import type { ExtendedRefs, FloatingContext, ReferenceType, UseInteractionsReturn } from "@floating-ui/react";
3
3
  import type { XOR } from "ts-xor";
4
4
  import type sizes from "./ModalSizes.module.css";
@@ -18,7 +18,7 @@ export interface ModalContextType {
18
18
  * Ref to specify the activator element. Useful if the activator can unmount
19
19
  * and needs to be re-mounted.
20
20
  */
21
- readonly activatorRef?: MutableRefObject<HTMLElement | null> | null;
21
+ readonly activatorRef?: RefObject<HTMLElement | null>;
22
22
  /**
23
23
  * Refs used by floating-ui to position the modal.
24
24
  */
@@ -57,7 +57,7 @@ export interface ModalContextType {
57
57
  * Tracks whether the current pointer interaction began inside the dialog.
58
58
  * Used to disambiguate outsidePress after nested overlay closes.
59
59
  */
60
- readonly startedInsideRef?: MutableRefObject<boolean>;
60
+ readonly startedInsideRef?: RefObject<boolean>;
61
61
  }
62
62
  export interface ModalActionsProps {
63
63
  /**
@@ -1,4 +1,4 @@
1
- import type { MutableRefObject } from "react";
1
+ import type { RefObject } from "react";
2
2
  import React from "react";
3
3
  import type sizes from "./ModalSizes.module.css";
4
4
  import type { ModalContextType } from "./Modal.types";
@@ -8,7 +8,7 @@ export interface ModalProviderProps {
8
8
  readonly size?: keyof typeof sizes;
9
9
  readonly open?: boolean;
10
10
  readonly onRequestClose?: () => void;
11
- readonly activatorRef?: MutableRefObject<HTMLElement | null> | null;
11
+ readonly activatorRef?: RefObject<HTMLElement | null>;
12
12
  readonly dismissible?: boolean;
13
13
  readonly modalLabelledBy?: string;
14
14
  readonly ariaLabel?: string;
@@ -1,5 +1,5 @@
1
- import type { Dispatch } from "react";
2
1
  import React from "react";
2
+ import type { Dispatch } from "react";
3
3
  import type { Options } from "./types";
4
4
  interface DropDownMenuProps {
5
5
  /**
@@ -1,7 +1,8 @@
1
1
  import type { ReactElement } from "react";
2
2
  import React from "react";
3
+ import type { RadioOptionProps } from "./RadioOption";
3
4
  export interface RadioGroupProps {
4
- readonly children: ReactElement | ReactElement[];
5
+ readonly children: ReactElement<RadioOptionProps> | ReactElement<RadioOptionProps>[];
5
6
  /**
6
7
  * Defines the default value that will be pre-selected in the radio group.
7
8
  */
@@ -33,7 +33,7 @@ interface WithRequiredChildren extends BaseRadioOptionProps {
33
33
  interface WithRequiredLabel extends BaseRadioOptionProps {
34
34
  readonly label: string;
35
35
  }
36
- type RadioOptionProps = XOR<WithRequiredChildren, WithRequiredLabel>;
36
+ export type RadioOptionProps = XOR<WithRequiredChildren, WithRequiredLabel>;
37
37
  /**
38
38
  * For rendering props only. To make updates to
39
39
  * the real RadioOption, look at InternalRadioOption
@@ -31,13 +31,7 @@ function RadioGroup({ children, value, ariaLabel, onChange, name = React.useId()
31
31
  const className = classnames(styles.radioGroup, {
32
32
  [styles.directionHorizontal]: direction === "horizontal",
33
33
  });
34
- return (React.createElement("div", { role: "radiogroup", "aria-label": ariaLabel, className: className }, React.Children.map(children, option => (
35
- // @ts-expect-error - TODO: it thinks value is missing, but it's probably coming from option.props
36
- React.createElement(InternalRadioOption
37
- // @ts-expect-error - TODO: fix option.props type is unknown
38
- , Object.assign({
39
- // @ts-expect-error - TODO: fix option.props type is unknown
40
- checked: value === option.props.value, name: name, onChange: handleChange }, option.props), option.props.children)))));
34
+ return (React.createElement("div", { role: "radiogroup", "aria-label": ariaLabel, className: className }, React.Children.map(children, option => (React.createElement(InternalRadioOption, Object.assign({ checked: value === option.props.value, name: name, onChange: handleChange }, option.props), option.props.children)))));
41
35
  function handleChange(newValue) {
42
36
  if (newValue !== value) {
43
37
  onChange(newValue);
@@ -29,13 +29,7 @@ function RadioGroup({ children, value, ariaLabel, onChange, name = useId(), dire
29
29
  const className = classnames(styles.radioGroup, {
30
30
  [styles.directionHorizontal]: direction === "horizontal",
31
31
  });
32
- return (React__default.createElement("div", { role: "radiogroup", "aria-label": ariaLabel, className: className }, React__default.Children.map(children, option => (
33
- // @ts-expect-error - TODO: it thinks value is missing, but it's probably coming from option.props
34
- React__default.createElement(InternalRadioOption
35
- // @ts-expect-error - TODO: fix option.props type is unknown
36
- , Object.assign({
37
- // @ts-expect-error - TODO: fix option.props type is unknown
38
- checked: value === option.props.value, name: name, onChange: handleChange }, option.props), option.props.children)))));
32
+ return (React__default.createElement("div", { role: "radiogroup", "aria-label": ariaLabel, className: className }, React__default.Children.map(children, option => (React__default.createElement(InternalRadioOption, Object.assign({ checked: value === option.props.value, name: name, onChange: handleChange }, option.props), option.props.children)))));
39
33
  function handleChange(newValue) {
40
34
  if (newValue !== value) {
41
35
  onChange(newValue);
package/dist/Tabs-cjs.js CHANGED
@@ -187,9 +187,7 @@ function Tabs({ children, defaultTab = 0, activeTab: controlledActiveTab, onTabC
187
187
  if (!isChildTab(child)) {
188
188
  return child;
189
189
  }
190
- const index = tabChildren.findIndex(
191
- // @ts-expect-error - TODO: fix tab.props type is unknown
192
- tab => tab.props.label === child.props.label);
190
+ const index = tabChildren.findIndex(tab => tab.props.label === child.props.label);
193
191
  return (React.createElement(InternalTab, { label: child.props.label, selected: activeTab === index, activateTab: activateTab(index), onClick: child.props.onClick, ref: el => {
194
192
  if (el) {
195
193
  tabRefs.current.set(index, el);
@@ -199,7 +197,9 @@ function Tabs({ children, defaultTab = 0, activeTab: controlledActiveTab, onTabC
199
197
  }
200
198
  }, tabIndex: activeTab === index ? 0 : -1 }));
201
199
  }))),
202
- React.createElement("section", { role: "tabpanel", className: styles.tabContent, "aria-label": activeTabProps === null || activeTabProps === void 0 ? void 0 : activeTabProps.label }, activeTabProps === null || activeTabProps === void 0 ? void 0 : activeTabProps.children)));
200
+ React.createElement("section", { role: "tabpanel", className: styles.tabContent, "aria-label": typeof (activeTabProps === null || activeTabProps === void 0 ? void 0 : activeTabProps.label) === "string"
201
+ ? activeTabProps.label
202
+ : undefined }, activeTabProps === null || activeTabProps === void 0 ? void 0 : activeTabProps.children)));
203
203
  }
204
204
  function Tab({ label }) {
205
205
  return React.createElement(React.Fragment, null, label);
package/dist/Tabs-es.js CHANGED
@@ -185,9 +185,7 @@ function Tabs({ children, defaultTab = 0, activeTab: controlledActiveTab, onTabC
185
185
  if (!isChildTab(child)) {
186
186
  return child;
187
187
  }
188
- const index = tabChildren.findIndex(
189
- // @ts-expect-error - TODO: fix tab.props type is unknown
190
- tab => tab.props.label === child.props.label);
188
+ const index = tabChildren.findIndex(tab => tab.props.label === child.props.label);
191
189
  return (React__default.createElement(InternalTab, { label: child.props.label, selected: activeTab === index, activateTab: activateTab(index), onClick: child.props.onClick, ref: el => {
192
190
  if (el) {
193
191
  tabRefs.current.set(index, el);
@@ -197,7 +195,9 @@ function Tabs({ children, defaultTab = 0, activeTab: controlledActiveTab, onTabC
197
195
  }
198
196
  }, tabIndex: activeTab === index ? 0 : -1 }));
199
197
  }))),
200
- React__default.createElement("section", { role: "tabpanel", className: styles.tabContent, "aria-label": activeTabProps === null || activeTabProps === void 0 ? void 0 : activeTabProps.label }, activeTabProps === null || activeTabProps === void 0 ? void 0 : activeTabProps.children)));
198
+ React__default.createElement("section", { role: "tabpanel", className: styles.tabContent, "aria-label": typeof (activeTabProps === null || activeTabProps === void 0 ? void 0 : activeTabProps.label) === "string"
199
+ ? activeTabProps.label
200
+ : undefined }, activeTabProps === null || activeTabProps === void 0 ? void 0 : activeTabProps.children)));
201
201
  }
202
202
  function Tab({ label }) {
203
203
  return React__default.createElement(React__default.Fragment, null, label);
@@ -23,8 +23,7 @@ var jobberHooks__namespace = /*#__PURE__*/_interopNamespaceDefault(jobberHooks);
23
23
 
24
24
  const mockContainerWidth = (exactWidth) => {
25
25
  jest.spyOn(jobberHooks__namespace, "useResizeObserver").mockReturnValue([
26
- // @ts-expect-error - TODO: fix this mock ref value
27
- { current: null },
26
+ { current: document.createElement("div") },
28
27
  {
29
28
  width: 1200,
30
29
  height: 800,
@@ -2,8 +2,7 @@ import * as jobberHooks from '@jobber/hooks';
2
2
 
3
3
  const mockContainerWidth = (exactWidth) => {
4
4
  jest.spyOn(jobberHooks, "useResizeObserver").mockReturnValue([
5
- // @ts-expect-error - TODO: fix this mock ref value
6
- { current: null },
5
+ { current: document.createElement("div") },
7
6
  {
8
7
  width: 1200,
9
8
  height: 800,
@@ -1,6 +1,6 @@
1
- import type { LegacyRef, MutableRefObject, RefCallback } from "react";
1
+ import type { LegacyRef, RefCallback, RefObject } from "react";
2
2
  /**
3
3
  * Given an array of refs, merge them into a single ref callback.
4
4
  * This is useful for cases where you need to pass a multiple refs to a component.
5
5
  */
6
- export declare function mergeRefs<T = unknown>(refs: Array<MutableRefObject<T> | LegacyRef<T> | undefined | null>): RefCallback<T>;
6
+ export declare function mergeRefs<T = unknown>(refs: Array<RefObject<T> | LegacyRef<T> | undefined | null>): RefCallback<T>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jobber/components",
3
- "version": "6.103.5",
3
+ "version": "6.103.6",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "main": "dist/index.cjs",
@@ -538,5 +538,5 @@
538
538
  "> 1%",
539
539
  "IE 10"
540
540
  ],
541
- "gitHead": "4b120bbb1789aa1b6b9a8eaf157be90d4ea15efc"
541
+ "gitHead": "953deb18e2cf5a920ab5e23295e15aefd3865c0f"
542
542
  }