@jobber/components 6.103.4-uncontroll-3a6b89f.8 → 6.103.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 (82) hide show
  1. package/dist/Autocomplete/Autocomplete.types.d.ts +13 -19
  2. package/dist/Autocomplete/index.cjs +10 -51
  3. package/dist/Autocomplete/index.mjs +10 -51
  4. package/dist/Autocomplete/tests/Autocomplete.setup.d.ts +0 -17
  5. package/dist/Autocomplete/useAutocomplete.d.ts +0 -1
  6. package/dist/Card-cjs.js +1 -1
  7. package/dist/Card-es.js +1 -1
  8. package/dist/Chip/Chip.d.ts +1 -2
  9. package/dist/Chip/hooks/useChildComponent.d.ts +4 -3
  10. package/dist/Chip/index.cjs +1 -1
  11. package/dist/Chip-cjs.js +5 -4
  12. package/dist/Chip-es.js +5 -4
  13. package/dist/ChipDismissible-cjs.js +4 -4
  14. package/dist/ChipDismissible-es.js +5 -5
  15. package/dist/Chips/InternalChipDismissible/hooks/useInView.d.ts +1 -1
  16. package/dist/Chips/InternalChipDismissible/hooks/useInternalChipDismissibleInput.d.ts +1 -1
  17. package/dist/Chips/InternalChipDismissible/hooks/useScrollToActive.d.ts +1 -1
  18. package/dist/Combobox/Combobox.d.ts +2 -1
  19. package/dist/Combobox/Combobox.types.d.ts +2 -2
  20. package/dist/Combobox/ComboboxProvider.d.ts +1 -1
  21. package/dist/Combobox/components/ComboboxActivator/ComboboxActivator.d.ts +1 -1
  22. package/dist/Combobox/components/ComboboxContent/ComboboxContent.d.ts +2 -1
  23. package/dist/Combobox/components/ComboboxContent/ComboboxContentHeader/ComboboxContentHeader.d.ts +2 -1
  24. package/dist/Combobox/components/ComboboxContent/ComboboxContentList/ComboboxContentList.d.ts +2 -1
  25. package/dist/Combobox/components/ComboboxContent/ComboboxContentSearch/ComboboxContentSearch.d.ts +2 -1
  26. package/dist/Combobox/hooks/useCombobox.d.ts +1 -1
  27. package/dist/Combobox/hooks/useComboboxAccessibility.d.ts +2 -2
  28. package/dist/Combobox/hooks/useComboboxContent.d.ts +1 -1
  29. package/dist/ComboboxActivator-cjs.js +2 -2
  30. package/dist/ComboboxActivator-es.js +3 -3
  31. package/dist/ComboboxTrigger-cjs.js +1 -1
  32. package/dist/ComboboxTrigger-es.js +2 -2
  33. package/dist/DataList/DataList.types.d.ts +2 -2
  34. package/dist/DataList/DataList.utils.d.ts +1 -1
  35. package/dist/DataList/components/DataListHeaderTile/components/DataListSortingOptions.d.ts +2 -2
  36. package/dist/DataList/components/DataListItem/DataListItemInternal.d.ts +2 -1
  37. package/dist/DataList.utils-cjs.js +2 -0
  38. package/dist/DataList.utils-es.js +2 -0
  39. package/dist/DataListActions-cjs.js +10 -3
  40. package/dist/DataListActions-es.js +10 -3
  41. package/dist/DataListItem-cjs.js +2 -0
  42. package/dist/DataListItem-es.js +2 -0
  43. package/dist/DataListSort-cjs.js +1 -1
  44. package/dist/DataListSort-es.js +2 -2
  45. package/dist/DataTable/SortIcon.d.ts +2 -1
  46. package/dist/DataTable/components/DataTableSortableHeader.d.ts +1 -1
  47. package/dist/DatePicker/useFocusOnSelectedDate.d.ts +1 -2
  48. package/dist/DatePicker-cjs.js +1 -1
  49. package/dist/DatePicker-es.js +1 -1
  50. package/dist/FormField/FormFieldAffix.d.ts +1 -1
  51. package/dist/FormField/FormFieldTypes.d.ts +3 -3
  52. package/dist/FormField/hooks/useFormFieldFocus.d.ts +1 -1
  53. package/dist/FormField/hooks/useFormFieldWrapperStyles.d.ts +2 -2
  54. package/dist/FormField-cjs.js +2 -2
  55. package/dist/FormField-es.js +2 -2
  56. package/dist/InputGroup-cjs.js +1 -0
  57. package/dist/InputGroup-es.js +1 -0
  58. package/dist/InputText/InputText.d.ts +2 -2
  59. package/dist/InputText/useInputTextActions.d.ts +1 -1
  60. package/dist/InputText/useInputTextFormField.d.ts +15 -1
  61. package/dist/InputText/useTextAreaResize.d.ts +2 -2
  62. package/dist/InternalChipDismissible-cjs.js +3 -3
  63. package/dist/InternalChipDismissible-es.js +4 -4
  64. package/dist/Menu-cjs.js +2 -0
  65. package/dist/Menu-es.js +2 -0
  66. package/dist/MultiSelect-cjs.js +13 -7
  67. package/dist/MultiSelect-es.js +13 -7
  68. package/dist/RadioGroup-cjs.js +7 -1
  69. package/dist/RadioGroup-es.js +7 -1
  70. package/dist/StatusLabel/StatusLabel.d.ts +2 -1
  71. package/dist/Tabs/hooks/useTabsOverflow.d.ts +2 -2
  72. package/dist/Tabs-cjs.js +4 -2
  73. package/dist/Tabs-es.js +4 -2
  74. package/dist/Tooltip/useTooltipPositioning.d.ts +1 -1
  75. package/dist/helpers-cjs.js +1 -0
  76. package/dist/helpers-es.js +1 -0
  77. package/dist/index.cjs +1 -1
  78. package/dist/showToast-cjs.js +2 -2
  79. package/dist/showToast-es.js +2 -2
  80. package/dist/useChildComponent-cjs.js +1 -1
  81. package/dist/useChildComponent-es.js +1 -1
  82. package/package.json +2 -2
@@ -22,8 +22,8 @@ function useComboboxActivatorAccessibility() {
22
22
  function ComboboxActivator(props) {
23
23
  const { handleOpen } = React.useContext(ComboboxProvider.ComboboxContext);
24
24
  const accessibilityAttributes = useComboboxActivatorAccessibility();
25
- if (typeof props.children !== "function" &&
26
- (props.children.type === Button.Button || props.children.type === Chip.ChipNamespace)) {
25
+ if (React.isValidElement(props.children) &&
26
+ (props.children.type === Button.Button || props.children.type === Chip.Chip)) {
27
27
  return React.cloneElement(props.children, {
28
28
  role: accessibilityAttributes.role,
29
29
  onClick: handleOpen,
@@ -1,7 +1,7 @@
1
1
  import React__default, { useContext } from 'react';
2
2
  import { B as Button } from './Button-es.js';
3
3
  import 'classnames';
4
- import { C as ChipNamespace } from './Chip-es.js';
4
+ import { C as Chip } from './Chip-es.js';
5
5
  import './tslib.es6-es.js';
6
6
  import '@jobber/design';
7
7
  import { a as ComboboxContext } from './ComboboxProvider-es.js';
@@ -20,8 +20,8 @@ function useComboboxActivatorAccessibility() {
20
20
  function ComboboxActivator(props) {
21
21
  const { handleOpen } = React__default.useContext(ComboboxContext);
22
22
  const accessibilityAttributes = useComboboxActivatorAccessibility();
23
- if (typeof props.children !== "function" &&
24
- (props.children.type === Button || props.children.type === ChipNamespace)) {
23
+ if (React__default.isValidElement(props.children) &&
24
+ (props.children.type === Button || props.children.type === Chip)) {
25
25
  return React__default.cloneElement(props.children, {
26
26
  role: accessibilityAttributes.role,
27
27
  onClick: handleOpen,
@@ -10,7 +10,7 @@ function ComboboxTrigger({ label = "Select", selected, activatorRef, }) {
10
10
  const { handleOpen } = React.useContext(ComboboxProvider.ComboboxContext);
11
11
  const hasSelection = selected.length;
12
12
  const selectedLabel = selected.map(option => option.label).join(", ");
13
- return (React.createElement(Chip.ChipNamespace, { variation: hasSelection ? "base" : "subtle", label: hasSelection ? selectedLabel : "", ariaLabel: label, heading: label, onClick: handleOpen, role: "combobox", ref: activatorRef }, !hasSelection && (React.createElement(Chip.ChipNamespace.Suffix, null,
13
+ return (React.createElement(Chip.Chip, { variation: hasSelection ? "base" : "subtle", label: hasSelection ? selectedLabel : "", ariaLabel: label, heading: label, onClick: handleOpen, role: "combobox", ref: activatorRef }, !hasSelection && (React.createElement(Chip.Chip.Suffix, null,
14
14
  React.createElement(Icon.Icon, { name: "add", size: "small" })))));
15
15
  }
16
16
 
@@ -1,5 +1,5 @@
1
1
  import React__default from 'react';
2
- import { C as ChipNamespace } from './Chip-es.js';
2
+ import { C as Chip } from './Chip-es.js';
3
3
  import './tslib.es6-es.js';
4
4
  import { I as Icon } from './Icon-es.js';
5
5
  import { a as ComboboxContext } from './ComboboxProvider-es.js';
@@ -8,7 +8,7 @@ function ComboboxTrigger({ label = "Select", selected, activatorRef, }) {
8
8
  const { handleOpen } = React__default.useContext(ComboboxContext);
9
9
  const hasSelection = selected.length;
10
10
  const selectedLabel = selected.map(option => option.label).join(", ");
11
- return (React__default.createElement(ChipNamespace, { variation: hasSelection ? "base" : "subtle", label: hasSelection ? selectedLabel : "", ariaLabel: label, heading: label, onClick: handleOpen, role: "combobox", ref: activatorRef }, !hasSelection && (React__default.createElement(ChipNamespace.Suffix, null,
11
+ return (React__default.createElement(Chip, { variation: hasSelection ? "base" : "subtle", label: hasSelection ? selectedLabel : "", ariaLabel: label, heading: label, onClick: handleOpen, role: "combobox", ref: activatorRef }, !hasSelection && (React__default.createElement(Chip.Suffix, null,
12
12
  React__default.createElement(Icon, { name: "add", size: "small" })))));
13
13
  }
14
14
 
@@ -1,4 +1,4 @@
1
- import type { ReactElement, ReactNode } from "react";
1
+ import { type ReactElement, type 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";
@@ -144,7 +144,7 @@ export interface DataListSelectedAllType<T extends DataListObject = DataListObje
144
144
  readonly unselected: T["id"][];
145
145
  }
146
146
  export type DataListSelectedType<T extends string | number = DataListObject["id"]> = T[] | DataListSelectedAllType;
147
- export type LayoutRenderer<T extends DataListObject> = (item: DataListItemType<T[]>) => JSX.Element;
147
+ export type LayoutRenderer<T extends DataListObject> = (item: DataListItemType<T[]>) => ReactElement;
148
148
  export interface DataListLayoutProps<T extends DataListObject> {
149
149
  readonly children: LayoutRenderer<T>;
150
150
  /**
@@ -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<any, string | React.JSXElementConstructor<any>>[];
22
+ export declare function getExposedActions(childrenArray: ReactElement[], childCount?: number): ReactElement<unknown, string | React.JSXElementConstructor<any>>[];
@@ -5,8 +5,8 @@ interface DataListSortingOptionsProps {
5
5
  readonly selectedOption: DataListSorting | null;
6
6
  readonly onSelectChange: (selectedOption: SortableOptions) => void;
7
7
  readonly onClose: () => void;
8
- readonly optionsListRef: React.RefObject<HTMLUListElement>;
9
- readonly dataListHeaderTileRef: React.RefObject<HTMLElement>;
8
+ readonly optionsListRef: React.RefObject<HTMLUListElement | null>;
9
+ readonly dataListHeaderTileRef: React.RefObject<HTMLElement | null>;
10
10
  }
11
11
  export declare function DataListSortingOptions({ options, selectedOption, onSelectChange, onClose, optionsListRef, dataListHeaderTileRef, }: DataListSortingOptionsProps): React.JSX.Element;
12
12
  export {};
@@ -1,7 +1,8 @@
1
+ import type { ReactElement } from "react";
1
2
  import React from "react";
2
3
  import type { DataListObject } from "@jobber/components/DataList/DataList.types";
3
4
  interface ListItemInternalProps<T extends DataListObject> {
4
- readonly children: JSX.Element;
5
+ readonly children: ReactElement;
5
6
  readonly item: T;
6
7
  }
7
8
  export declare function DataListItemInternal<T extends DataListObject>({ children, item, }: ListItemInternalProps<T>): React.JSX.Element;
@@ -149,7 +149,9 @@ 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
152
153
  const hasIcon = Boolean(child.props.icon);
154
+ // @ts-expect-error - TODO: fix props are type unknown
153
155
  const isAlwaysVisible = child.props.alwaysVisible; // If true, the child action will always be visible and not nested in the dropdown.
154
156
  if (isAlwaysVisible === false ||
155
157
  (isAlwaysVisible === undefined && !hasIcon)) {
@@ -147,7 +147,9 @@ 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
150
151
  const hasIcon = Boolean(child.props.icon);
152
+ // @ts-expect-error - TODO: fix props are type unknown
151
153
  const isAlwaysVisible = child.props.alwaysVisible; // If true, the child action will always be visible and not nested in the dropdown.
152
154
  if (isAlwaysVisible === false ||
153
155
  (isAlwaysVisible === undefined && !hasIcon)) {
@@ -14,7 +14,9 @@ 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 }) => {
17
+ exposedActions.map(({ props: actionProps }) => {
18
+ const props = actionProps;
19
+ // @ts-expect-error - TODO: fix activeItem might be undefined
18
20
  const isVisible = props.visible ? props.visible(activeItem) : true;
19
21
  const hasIconOrAlwaysVisible = props.icon || props.alwaysVisible;
20
22
  if (!isVisible || !hasIconOrAlwaysVisible) {
@@ -31,12 +33,17 @@ function DataListActions({ children, itemsToExpose = 2, }) {
31
33
  const actionLabel = getActionLabel();
32
34
  // If the action is always visible, we don't want a tooltip.
33
35
  if (props.alwaysVisible) {
34
- return (React.createElement(Button.Button, { ariaLabel: actionLabel, key: props.label, icon: props.icon, label: actionLabel, onClick: () => {
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
39
  var _a;
40
+ // @ts-expect-error - TODO: fix activeItem might be undefined
36
41
  (_a = props.onClick) === null || _a === void 0 ? void 0 : _a.call(props, activeItem);
37
42
  }, type: "secondary", variation: "subtle" }));
38
43
  }
39
- return (React.createElement(Tooltip.Tooltip, { key: actionLabel, message: actionLabel },
44
+ return (
45
+ // @ts-expect-error - TODO: fix actionLabel might be undefined
46
+ React.createElement(Tooltip.Tooltip, { key: actionLabel, message: actionLabel },
40
47
  React.createElement(Button.Button, { icon: props.icon, ariaLabel: actionLabel, onClick: () => {
41
48
  var _a, _b;
42
49
  if (activeItem) {
@@ -12,7 +12,9 @@ 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 }) => {
15
+ exposedActions.map(({ props: actionProps }) => {
16
+ const props = actionProps;
17
+ // @ts-expect-error - TODO: fix activeItem might be undefined
16
18
  const isVisible = props.visible ? props.visible(activeItem) : true;
17
19
  const hasIconOrAlwaysVisible = props.icon || props.alwaysVisible;
18
20
  if (!isVisible || !hasIconOrAlwaysVisible) {
@@ -29,12 +31,17 @@ function DataListActions({ children, itemsToExpose = 2, }) {
29
31
  const actionLabel = getActionLabel();
30
32
  // If the action is always visible, we don't want a tooltip.
31
33
  if (props.alwaysVisible) {
32
- return (React__default.createElement(Button, { ariaLabel: actionLabel, key: props.label, icon: props.icon, label: actionLabel, onClick: () => {
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
37
  var _a;
38
+ // @ts-expect-error - TODO: fix activeItem might be undefined
34
39
  (_a = props.onClick) === null || _a === void 0 ? void 0 : _a.call(props, activeItem);
35
40
  }, type: "secondary", variation: "subtle" }));
36
41
  }
37
- return (React__default.createElement(Tooltip, { key: actionLabel, message: actionLabel },
42
+ return (
43
+ // @ts-expect-error - TODO: fix actionLabel might be undefined
44
+ React__default.createElement(Tooltip, { key: actionLabel, message: actionLabel },
38
45
  React__default.createElement(Button, { icon: props.icon, ariaLabel: actionLabel, onClick: () => {
39
46
  var _a, _b;
40
47
  if (activeItem) {
@@ -66,7 +66,9 @@ function useGetItemActions(item) {
66
66
  const disableContextMenu = (_a = itemActionComponent === null || itemActionComponent === void 0 ? void 0 : itemActionComponent.props.disableContextMenu) !== null && _a !== void 0 ? _a : false;
67
67
  const actions = React.useMemo(() => {
68
68
  return actionsArray.filter(action => {
69
+ // @ts-expect-error - TODO: fix action.props type is unknown
69
70
  if (React.isValidElement(action) && action.props.visible) {
71
+ // @ts-expect-error - TODO: fix action.props type is unknown
70
72
  return action.props.visible(item);
71
73
  }
72
74
  return true;
@@ -64,7 +64,9 @@ function useGetItemActions(item) {
64
64
  const disableContextMenu = (_a = itemActionComponent === null || itemActionComponent === void 0 ? void 0 : itemActionComponent.props.disableContextMenu) !== null && _a !== void 0 ? _a : false;
65
65
  const actions = useMemo(() => {
66
66
  return actionsArray.filter(action => {
67
+ // @ts-expect-error - TODO: fix action.props type is unknown
67
68
  if (isValidElement(action) && action.props.visible) {
69
+ // @ts-expect-error - TODO: fix action.props type is unknown
68
70
  return action.props.visible(item);
69
71
  }
70
72
  return true;
@@ -21,7 +21,7 @@ function DataListSort() {
21
21
  },
22
22
  ] },
23
23
  React.createElement(Combobox.Combobox.Activator, null,
24
- React.createElement(Chip.ChipNamespace, { heading: "Sort", label: getButtonLabel(), variation: state ? "base" : "subtle" }, !state && (React.createElement(Chip.ChipNamespace.Suffix, null,
24
+ React.createElement(Chip.Chip, { heading: "Sort", label: getButtonLabel(), variation: state ? "base" : "subtle" }, !state && (React.createElement(Chip.Chip.Suffix, null,
25
25
  React.createElement(Icon.Icon, { name: "arrowDown", size: "small" }))))),
26
26
  sortByOptions.map(({ label, value }) => (React.createElement(Combobox.Combobox.Option, { key: value, id: value, label: label })))));
27
27
  function getSortByOptions() {
@@ -2,7 +2,7 @@ import React__default from 'react';
2
2
  import { u as useDataListContext } from './DataListContext-es.js';
3
3
  import { C as Combobox } from './Combobox-es.js';
4
4
  import './ComboboxProvider-es.js';
5
- import { C as ChipNamespace } from './Chip-es.js';
5
+ import { C as Chip } from './Chip-es.js';
6
6
  import './tslib.es6-es.js';
7
7
  import { I as Icon } from './Icon-es.js';
8
8
 
@@ -19,7 +19,7 @@ function DataListSort() {
19
19
  },
20
20
  ] },
21
21
  React__default.createElement(Combobox.Activator, null,
22
- React__default.createElement(ChipNamespace, { heading: "Sort", label: getButtonLabel(), variation: state ? "base" : "subtle" }, !state && (React__default.createElement(ChipNamespace.Suffix, null,
22
+ React__default.createElement(Chip, { heading: "Sort", label: getButtonLabel(), variation: state ? "base" : "subtle" }, !state && (React__default.createElement(Chip.Suffix, null,
23
23
  React__default.createElement(Icon, { name: "arrowDown", size: "small" }))))),
24
24
  sortByOptions.map(({ label, value }) => (React__default.createElement(Combobox.Option, { key: value, id: value, label: label })))));
25
25
  function getSortByOptions() {
@@ -1,3 +1,4 @@
1
+ import React from "react";
1
2
  export declare enum SortDirection {
2
3
  ascending = 0,
3
4
  descending = 1,
@@ -6,5 +7,5 @@ export declare enum SortDirection {
6
7
  interface SortIconProps {
7
8
  readonly direction: SortDirection;
8
9
  }
9
- export declare function SortIcon({ direction }: SortIconProps): JSX.Element;
10
+ export declare function SortIcon({ direction }: SortIconProps): React.JSX.Element;
10
11
  export {};
@@ -15,4 +15,4 @@ export interface DataTableSortableHeaderProps {
15
15
  */
16
16
  readonly onSort?: () => void;
17
17
  }
18
- export declare function DataTableSortableHeader(props: DataTableSortableHeaderProps & React.HTMLAttributes<HTMLTableCellElement>): JSX.Element;
18
+ export declare function DataTableSortableHeader(props: DataTableSortableHeaderProps & React.HTMLAttributes<HTMLTableCellElement>): React.JSX.Element;
@@ -1,5 +1,4 @@
1
- import type { MutableRefObject } from "react";
2
1
  export declare function useFocusOnSelectedDate(): {
3
- ref: MutableRefObject<HTMLDivElement>;
2
+ ref: import("react").RefObject<HTMLDivElement | null>;
4
3
  focusOnSelectedDate: () => void;
5
4
  };
@@ -12692,7 +12692,7 @@ function InternalActivator(props, ref) {
12692
12692
  }
12693
12693
 
12694
12694
  function useFocusOnSelectedDate() {
12695
- const ref = React.useRef();
12695
+ const ref = React.useRef(null);
12696
12696
  function focusOnSelectedDate() {
12697
12697
  var _a;
12698
12698
  const selectedDateClass = ".react-datepicker__day--selected";
@@ -12690,7 +12690,7 @@ function InternalActivator(props, ref) {
12690
12690
  }
12691
12691
 
12692
12692
  function useFocusOnSelectedDate() {
12693
- const ref = useRef();
12693
+ const ref = useRef(null);
12694
12694
  function focusOnSelectedDate() {
12695
12695
  var _a;
12696
12696
  const selectedDateClass = ".react-datepicker__day--selected";
@@ -3,7 +3,7 @@ import React 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 {
6
- readonly labelRef: RefObject<HTMLDivElement>;
6
+ readonly labelRef: RefObject<HTMLDivElement | null>;
7
7
  readonly variation?: "prefix" | "suffix";
8
8
  }
9
9
  /**
@@ -109,7 +109,7 @@ export interface CommonFormFieldProps {
109
109
  version?: 1;
110
110
  }
111
111
  export interface FormFieldProps extends CommonFormFieldProps {
112
- actionsRef?: RefObject<FieldActionsRef>;
112
+ actionsRef?: RefObject<FieldActionsRef | null>;
113
113
  /**
114
114
  * Determines if the input should be auto-focused, using the HTML attribute
115
115
  */
@@ -126,8 +126,8 @@ export interface FormFieldProps extends CommonFormFieldProps {
126
126
  * `<select>`.
127
127
  */
128
128
  readonly children?: ReactNode;
129
- inputRef?: RefObject<HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement>;
130
- wrapperRef?: RefObject<HTMLDivElement>;
129
+ inputRef?: RefObject<HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement | null>;
130
+ wrapperRef?: RefObject<HTMLDivElement | null>;
131
131
  /**
132
132
  * Initial value of the input. Only use this when you need to pre-populate
133
133
  * the field with a data that is not controlled by the components state. If a
@@ -2,7 +2,7 @@ interface UseFormFieldFocus {
2
2
  focused: boolean;
3
3
  }
4
4
  interface UseFormFieldFocusProps {
5
- wrapperRef?: React.RefObject<HTMLDivElement>;
5
+ wrapperRef?: React.RefObject<HTMLDivElement | null>;
6
6
  }
7
7
  export declare const formFieldFocusAttribute: {
8
8
  "data-atl-maintain-portal-focus": string;
@@ -2,8 +2,8 @@ import type { RefObject } from "react";
2
2
  import type { FormFieldProps } from "../FormFieldTypes";
3
3
  export interface useFormFieldWrapperStylesProps extends Pick<FormFieldProps, "size" | "align" | "placeholder" | "value" | "invalid" | "max" | "maxLength" | "type" | "disabled" | "inline"> {
4
4
  readonly error?: string;
5
- suffixRef?: RefObject<HTMLDivElement>;
6
- prefixRef?: RefObject<HTMLDivElement>;
5
+ suffixRef?: RefObject<HTMLDivElement | null>;
6
+ prefixRef?: RefObject<HTMLDivElement | null>;
7
7
  showMiniLabel?: boolean;
8
8
  }
9
9
  export interface LabelPadding {
@@ -150,8 +150,8 @@ function getAffixPaddding({ value, type, prefixWidth, suffixWidth, }) {
150
150
  }
151
151
 
152
152
  function FormFieldWrapper({ align, description, descriptionIdentifier, placeholder, value, children, invalid, error, size, prefix, suffix, max, maxLength, type, disabled, inline, identifier, clearable, onClear, readonly, toolbar, toolbarVisibility = "while-editing", showMiniLabel = true, wrapperRef, }) {
153
- const prefixRef = React.useRef();
154
- const suffixRef = React.useRef();
153
+ const prefixRef = React.useRef(null);
154
+ const suffixRef = React.useRef(null);
155
155
  const { wrapperClasses, containerClasses, wrapperInlineStyle, labelStyle } = useFormFieldWrapperStyles({
156
156
  align,
157
157
  max,
@@ -148,8 +148,8 @@ function getAffixPaddding({ value, type, prefixWidth, suffixWidth, }) {
148
148
  }
149
149
 
150
150
  function FormFieldWrapper({ align, description, descriptionIdentifier, placeholder, value, children, invalid, error, size, prefix, suffix, max, maxLength, type, disabled, inline, identifier, clearable, onClear, readonly, toolbar, toolbarVisibility = "while-editing", showMiniLabel = true, wrapperRef, }) {
151
- const prefixRef = useRef();
152
- const suffixRef = useRef();
151
+ const prefixRef = useRef(null);
152
+ const suffixRef = useRef(null);
153
153
  const { wrapperClasses, containerClasses, wrapperInlineStyle, labelStyle } = useFormFieldWrapperStyles({
154
154
  align,
155
155
  max,
@@ -14,6 +14,7 @@ function InputGroup({ children, flowDirection = "vertical", }) {
14
14
  function isInvalidGroupNesting(childs) {
15
15
  return React.Children.toArray(childs).some(child => {
16
16
  if (child.type === InputGroup &&
17
+ // @ts-expect-error - TODO: fix child.props type is unknown
17
18
  child.props.flowDirection != "horizontal") {
18
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`);
19
20
  return true;
@@ -12,6 +12,7 @@ function InputGroup({ children, flowDirection = "vertical", }) {
12
12
  function isInvalidGroupNesting(childs) {
13
13
  return React__default.Children.toArray(childs).some(child => {
14
14
  if (child.type === InputGroup &&
15
+ // @ts-expect-error - TODO: fix child.props type is unknown
15
16
  child.props.flowDirection != "horizontal") {
16
17
  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`);
17
18
  return true;
@@ -26,7 +26,7 @@ export declare const InputText: React.ForwardRefExoticComponent<({
26
26
  readonly prefix?: import("../FormField").Affix | undefined;
27
27
  readonly autofocus?: boolean | undefined;
28
28
  readonly autocomplete?: (boolean | import("../FormField").AutocompleteTypes) | undefined;
29
- inputRef?: React.RefObject<HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement> | undefined;
29
+ inputRef?: React.RefObject<HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement | null> | undefined;
30
30
  readonly keyboard?: ("numeric" | "decimal") | undefined;
31
31
  readonly maxLength?: number | undefined;
32
32
  readonly suffix?: import("ts-xor").XOR<import("../FormField").Affix, import("../FormField").Suffix> | undefined;
@@ -60,7 +60,7 @@ export declare const InputText: React.ForwardRefExoticComponent<({
60
60
  readonly prefix?: import("../FormField").Affix | undefined;
61
61
  readonly autofocus?: boolean | undefined;
62
62
  readonly autocomplete?: (boolean | import("../FormField").AutocompleteTypes) | undefined;
63
- inputRef?: React.RefObject<HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement> | undefined;
63
+ inputRef?: React.RefObject<HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement | null> | undefined;
64
64
  readonly keyboard?: ("numeric" | "decimal") | undefined;
65
65
  readonly maxLength?: number | undefined;
66
66
  readonly suffix?: import("ts-xor").XOR<import("../FormField").Affix, import("../FormField").Suffix> | undefined;
@@ -1,7 +1,7 @@
1
1
  import type { ChangeEvent, FocusEvent, KeyboardEvent } from "react";
2
2
  import type { InputTextRebuiltProps } from "./InputText.types";
3
3
  export interface useInputTextActionsProps extends Pick<InputTextRebuiltProps, "onChange" | "onEnter" | "onFocus" | "onBlur" | "onKeyDown"> {
4
- inputRef?: React.RefObject<HTMLInputElement | HTMLTextAreaElement>;
4
+ inputRef?: React.RefObject<HTMLInputElement | HTMLTextAreaElement | null>;
5
5
  }
6
6
  /**
7
7
  * Combines the actions on the InputText such as onChange, onEnter, onFocus, onBlur, and onClear to forward information to the consumers of the InputText.
@@ -69,7 +69,7 @@ export declare function useInputTextFormField({ id, name, description, inline, h
69
69
  capture?: boolean | "user" | "environment" | undefined;
70
70
  checked?: boolean | undefined;
71
71
  form?: string | undefined;
72
- formAction?: string | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_FORM_ACTIONS[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_FORM_ACTIONS] | undefined;
72
+ formAction?: string | ((formData: FormData) => void | Promise<void>) | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_FORM_ACTIONS[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_FORM_ACTIONS] | undefined;
73
73
  formEncType?: string | undefined;
74
74
  formMethod?: string | undefined;
75
75
  formNoValidate?: boolean | undefined;
@@ -135,6 +135,10 @@ export declare function useInputTextFormField({ id, name, description, inline, h
135
135
  results?: number | undefined;
136
136
  security?: string | undefined;
137
137
  unselectable?: "on" | "off" | undefined;
138
+ popover?: "" | "auto" | "manual" | "hint" | undefined;
139
+ popoverTargetAction?: "toggle" | "show" | "hide" | undefined;
140
+ popoverTarget?: string | undefined;
141
+ inert?: boolean | undefined;
138
142
  is?: string | undefined;
139
143
  exportparts?: string | undefined;
140
144
  part?: string | undefined;
@@ -337,6 +341,8 @@ export declare function useInputTextFormField({ id, name, description, inline, h
337
341
  onLostPointerCaptureCapture?: import("react").PointerEventHandler<HTMLInputElement | HTMLTextAreaElement> | undefined;
338
342
  onScroll?: import("react").UIEventHandler<HTMLInputElement | HTMLTextAreaElement> | undefined;
339
343
  onScrollCapture?: import("react").UIEventHandler<HTMLInputElement | HTMLTextAreaElement> | undefined;
344
+ onScrollEnd?: import("react").UIEventHandler<HTMLInputElement | HTMLTextAreaElement> | undefined;
345
+ onScrollEndCapture?: import("react").UIEventHandler<HTMLInputElement | HTMLTextAreaElement> | undefined;
340
346
  onWheel?: import("react").WheelEventHandler<HTMLInputElement | HTMLTextAreaElement> | undefined;
341
347
  onWheelCapture?: import("react").WheelEventHandler<HTMLInputElement | HTMLTextAreaElement> | undefined;
342
348
  onAnimationStart?: import("react").AnimationEventHandler<HTMLInputElement | HTMLTextAreaElement> | undefined;
@@ -345,8 +351,16 @@ export declare function useInputTextFormField({ id, name, description, inline, h
345
351
  onAnimationEndCapture?: import("react").AnimationEventHandler<HTMLInputElement | HTMLTextAreaElement> | undefined;
346
352
  onAnimationIteration?: import("react").AnimationEventHandler<HTMLInputElement | HTMLTextAreaElement> | undefined;
347
353
  onAnimationIterationCapture?: import("react").AnimationEventHandler<HTMLInputElement | HTMLTextAreaElement> | undefined;
354
+ onToggle?: import("react").ToggleEventHandler<HTMLInputElement | HTMLTextAreaElement> | undefined;
355
+ onBeforeToggle?: import("react").ToggleEventHandler<HTMLInputElement | HTMLTextAreaElement> | undefined;
356
+ onTransitionCancel?: import("react").TransitionEventHandler<HTMLInputElement | HTMLTextAreaElement> | undefined;
357
+ onTransitionCancelCapture?: import("react").TransitionEventHandler<HTMLInputElement | HTMLTextAreaElement> | undefined;
348
358
  onTransitionEnd?: import("react").TransitionEventHandler<HTMLInputElement | HTMLTextAreaElement> | undefined;
349
359
  onTransitionEndCapture?: import("react").TransitionEventHandler<HTMLInputElement | HTMLTextAreaElement> | undefined;
360
+ onTransitionRun?: import("react").TransitionEventHandler<HTMLInputElement | HTMLTextAreaElement> | undefined;
361
+ onTransitionRunCapture?: import("react").TransitionEventHandler<HTMLInputElement | HTMLTextAreaElement> | undefined;
362
+ onTransitionStart?: import("react").TransitionEventHandler<HTMLInputElement | HTMLTextAreaElement> | undefined;
363
+ onTransitionStartCapture?: import("react").TransitionEventHandler<HTMLInputElement | HTMLTextAreaElement> | undefined;
350
364
  };
351
365
  descriptionIdentifier: string;
352
366
  };
@@ -6,8 +6,8 @@ import type { RowRange } from "./InputText.types";
6
6
  export declare function useTextAreaResize({ rows, value, inputRef, wrapperRef, }: {
7
7
  rows?: number | RowRange;
8
8
  value: string | number | Date | undefined;
9
- inputRef: RefObject<HTMLTextAreaElement | HTMLInputElement>;
10
- wrapperRef: RefObject<HTMLDivElement>;
9
+ inputRef: RefObject<HTMLTextAreaElement | HTMLInputElement | null>;
10
+ wrapperRef: RefObject<HTMLDivElement | null>;
11
11
  }): {
12
12
  resize: () => void;
13
13
  rowRange: RowRange;
@@ -14,9 +14,9 @@ var Chip = require('./Chip-cjs.js');
14
14
  require('./tslib.es6-cjs.js');
15
15
 
16
16
  function InternalChip({ label, active = false, disabled = false, invalid = false, prefix, suffix, tabIndex, ariaLabel, onClick, onKeyDown, }) {
17
- return (React.createElement(Chip.ChipNamespace, { disabled: disabled, invalid: invalid, onKeyDown: onKeyDown, testID: "ATL-InternalChip", ariaLabel: ariaLabel, tabIndex: tabIndex, variation: active ? "base" : "subtle", role: tabIndex !== undefined ? "option" : undefined, onClick: onClick ? (_, ev) => onClick(ev) : undefined, label: label },
18
- prefix && React.createElement(Chip.ChipNamespace.Prefix, null, prefix),
19
- suffix && React.createElement(Chip.ChipNamespace.Suffix, null, suffix)));
17
+ return (React.createElement(Chip.Chip, { disabled: disabled, invalid: invalid, onKeyDown: onKeyDown, testID: "ATL-InternalChip", ariaLabel: ariaLabel, tabIndex: tabIndex, variation: active ? "base" : "subtle", role: tabIndex !== undefined ? "option" : undefined, onClick: onClick ? (_, ev) => onClick(ev) : undefined, label: label },
18
+ prefix && React.createElement(Chip.Chip.Prefix, null, prefix),
19
+ suffix && React.createElement(Chip.Chip.Suffix, null, suffix)));
20
20
  }
21
21
 
22
22
  var styles = {"wrapper":"XRnU90M2-fs-","input":"Dq-yFHd1zK0-","menu":"F7CpurjKzBI-","menuListOption":"_9SAK31TqNDY-","loadingIndicator":"s5vFJVv0t0Q-","activeOption":"_8d0w-JzgzS4-","spinning":"hDJGLX6kE-U-"};
@@ -8,13 +8,13 @@ import { F as FloatingPortal } from './floating-ui.react-es.js';
8
8
  import { T as Text } from './Text-es.js';
9
9
  import { B as Button } from './Button-es.js';
10
10
  import { S as Spinner } from './Spinner-es.js';
11
- import { C as ChipNamespace, I as InternalChipButton } from './Chip-es.js';
11
+ import { C as Chip, I as InternalChipButton } from './Chip-es.js';
12
12
  import './tslib.es6-es.js';
13
13
 
14
14
  function InternalChip({ label, active = false, disabled = false, invalid = false, prefix, suffix, tabIndex, ariaLabel, onClick, onKeyDown, }) {
15
- return (React__default.createElement(ChipNamespace, { disabled: disabled, invalid: invalid, onKeyDown: onKeyDown, testID: "ATL-InternalChip", ariaLabel: ariaLabel, tabIndex: tabIndex, variation: active ? "base" : "subtle", role: tabIndex !== undefined ? "option" : undefined, onClick: onClick ? (_, ev) => onClick(ev) : undefined, label: label },
16
- prefix && React__default.createElement(ChipNamespace.Prefix, null, prefix),
17
- suffix && React__default.createElement(ChipNamespace.Suffix, null, suffix)));
15
+ return (React__default.createElement(Chip, { disabled: disabled, invalid: invalid, onKeyDown: onKeyDown, testID: "ATL-InternalChip", ariaLabel: ariaLabel, tabIndex: tabIndex, variation: active ? "base" : "subtle", role: tabIndex !== undefined ? "option" : undefined, onClick: onClick ? (_, ev) => onClick(ev) : undefined, label: label },
16
+ prefix && React__default.createElement(Chip.Prefix, null, prefix),
17
+ suffix && React__default.createElement(Chip.Suffix, null, suffix)));
18
18
  }
19
19
 
20
20
  var styles = {"wrapper":"XRnU90M2-fs-","input":"Dq-yFHd1zK0-","menu":"F7CpurjKzBI-","menuListOption":"_9SAK31TqNDY-","loadingIndicator":"s5vFJVv0t0Q-","activeOption":"_8d0w-JzgzS4-","spinning":"hDJGLX6kE-U-"};
package/dist/Menu-cjs.js CHANGED
@@ -126,6 +126,7 @@ 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
129
130
  const fullWidth = ((_a = activator === null || activator === void 0 ? void 0 : activator.props) === null || _a === void 0 ? void 0 : _a.fullWidth) || false;
130
131
  const wrapperClasses = classnames(styles.wrapper, {
131
132
  [styles.fullWidth]: fullWidth,
@@ -198,6 +199,7 @@ function MenuLegacy({ activator, items, UNSAFE_className, UNSAFE_style, }) {
198
199
  }))));
199
200
  return (React.createElement("div", { className: wrapperClasses, onClick: handleParentClick },
200
201
  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
201
203
  onClick: toggle(activator.props.onClick),
202
204
  id: buttonID,
203
205
  ariaControls: menuID,
package/dist/Menu-es.js CHANGED
@@ -124,6 +124,7 @@ 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
127
128
  const fullWidth = ((_a = activator === null || activator === void 0 ? void 0 : activator.props) === null || _a === void 0 ? void 0 : _a.fullWidth) || false;
128
129
  const wrapperClasses = classnames(styles.wrapper, {
129
130
  [styles.fullWidth]: fullWidth,
@@ -196,6 +197,7 @@ function MenuLegacy({ activator, items, UNSAFE_className, UNSAFE_style, }) {
196
197
  }))));
197
198
  return (React__default.createElement("div", { className: wrapperClasses, onClick: handleParentClick },
198
199
  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
199
201
  onClick: toggle(activator.props.onClick),
200
202
  id: buttonID,
201
203
  ariaControls: menuID,
@@ -12,7 +12,7 @@ var styles = {"dropDownMenuContainer":"zossMHCpMPU-","option":"poS49c-LqiU-","ac
12
12
 
13
13
  function DropDownMenu({ options, setOptions }) {
14
14
  const [highlightedIndex, setHighlightedIndex] = React.useState(0);
15
- const menuDiv = React.useRef();
15
+ const menuDiv = React.useRef(null);
16
16
  const handleOptionClick = React.useCallback((clickedOption) => {
17
17
  setOptions(current => current.map(option => {
18
18
  if (option.label == clickedOption.label) {
@@ -87,13 +87,17 @@ function DropDownMenu({ options, setOptions }) {
87
87
  event.preventDefault();
88
88
  const newIndex = Math.max(0, highlightedIndex - 1);
89
89
  handleOptionFocus(newIndex);
90
- scrollMenuIfItemNotInView(menuDiv.current, "up");
90
+ if (menuDiv.current) {
91
+ scrollMenuIfItemNotInView(menuDiv.current, "up");
92
+ }
91
93
  }
92
94
  function handlePressDown(event) {
93
95
  event.preventDefault();
94
96
  const newIndex = Math.min(options.length - 1, highlightedIndex + 1);
95
97
  handleOptionFocus(newIndex);
96
- scrollMenuIfItemNotInView(menuDiv.current, "down");
98
+ if (menuDiv.current) {
99
+ scrollMenuIfItemNotInView(menuDiv.current, "down");
100
+ }
97
101
  }
98
102
  }
99
103
 
@@ -101,15 +105,16 @@ function MultiSelect({ defaultLabel, allSelectedLabel, options, onOptionsChange,
101
105
  const [label, setLabel] = React.useState(defaultLabel);
102
106
  const [menuVisible, setMenuVisible] = React.useState(false);
103
107
  const [focused, setFocused] = React.useState(false);
104
- const multiSelectContainer = React.useRef();
105
- const multiSelectRef = React.useRef();
108
+ const multiSelectContainer = React.useRef(null);
109
+ const multiSelectRef = React.useRef(null);
106
110
  const multiSelectClass = classnames(styles$1.multiSelect, {
107
111
  [styles$1.active]: menuVisible,
108
112
  [styles$1.large]: size === "large",
109
113
  [styles$1.small]: size === "small",
110
114
  });
111
115
  function handleMenuVisibility() {
112
- multiSelectRef.current.focus();
116
+ var _a;
117
+ (_a = multiSelectRef.current) === null || _a === void 0 ? void 0 : _a.focus();
113
118
  setMenuVisible(!menuVisible);
114
119
  }
115
120
  const handleClickOutside = (e) => {
@@ -119,6 +124,7 @@ function MultiSelect({ defaultLabel, allSelectedLabel, options, onOptionsChange,
119
124
  }
120
125
  };
121
126
  function handleKeydown(event) {
127
+ var _a;
122
128
  const { key, metaKey, ctrlKey } = event;
123
129
  if (metaKey || ctrlKey)
124
130
  return;
@@ -131,7 +137,7 @@ function MultiSelect({ defaultLabel, allSelectedLabel, options, onOptionsChange,
131
137
  break;
132
138
  }
133
139
  case "Escape": {
134
- multiSelectRef.current.focus();
140
+ (_a = multiSelectRef.current) === null || _a === void 0 ? void 0 : _a.focus();
135
141
  setMenuVisible(false);
136
142
  break;
137
143
  }