@jobber/components 6.112.2 → 6.113.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,12 +1,14 @@
1
1
  import React from "react";
2
2
  import { type AutocompleteRebuiltProps, type MenuItem, type OptionLike } from "../Autocomplete.types";
3
- export declare function Wrapper<T extends OptionLike>({ initialValue, initialInputValue, onChange, onInputChange, onBlur, onFocus, menu, openOnFocus, filterOptions, emptyActions, customRenderOption, customRenderAction, customRenderSection, customRenderInput, customRenderHeader, customRenderFooter, loading, customRenderLoading, emptyStateMessage, ref, readOnly, UNSAFE_className, UNSAFE_styles, debounce, ...props }: {
3
+ export declare function Wrapper<T extends OptionLike>({ initialValue, initialInputValue, onChange, onInputChange, onBlur, onFocus, onOpen, onClose, menu, openOnFocus, filterOptions, emptyActions, customRenderOption, customRenderAction, customRenderSection, customRenderInput, customRenderHeader, customRenderFooter, loading, customRenderLoading, emptyStateMessage, ref, readOnly, UNSAFE_className, UNSAFE_styles, debounce, ...props }: {
4
4
  readonly initialValue?: T;
5
5
  readonly initialInputValue?: string;
6
6
  readonly onChange?: (v: T | undefined) => void;
7
7
  readonly onInputChange?: (v: string) => void;
8
8
  readonly onBlur?: () => void;
9
9
  readonly onFocus?: () => void;
10
+ readonly onOpen?: () => void;
11
+ readonly onClose?: () => void;
10
12
  readonly menu?: MenuItem<T>[];
11
13
  readonly openOnFocus?: boolean;
12
14
  readonly filterOptions?: false | ((opts: T[], input: string) => T[]);
@@ -24,7 +26,9 @@ export declare function Wrapper<T extends OptionLike>({ initialValue, initialInp
24
26
  readonly UNSAFE_className?: AutocompleteRebuiltProps<T, false>["UNSAFE_className"];
25
27
  readonly UNSAFE_styles?: AutocompleteRebuiltProps<T, false>["UNSAFE_styles"];
26
28
  readonly readOnly?: boolean;
29
+ readonly clearable?: AutocompleteRebuiltProps<T, false>["clearable"];
27
30
  readonly debounce?: number;
31
+ readonly disabled?: boolean;
28
32
  }): React.JSX.Element;
29
33
  export declare function FreeFormWrapper({ initialValue, initialInputValue, onChange, onInputChange, menu, openOnFocus, inputEqualsOption, debounce, }: {
30
34
  readonly initialValue?: OptionLike;
@@ -36,16 +40,47 @@ export declare function FreeFormWrapper({ initialValue, initialInputValue, onCha
36
40
  readonly inputEqualsOption?: (input: string, option: OptionLike) => boolean;
37
41
  readonly debounce?: number;
38
42
  }): React.JSX.Element;
43
+ /**
44
+ * Stateful wrapper for testing multiple-selection behavior.
45
+ * Manages both value (array) and inputValue internally so tests
46
+ * can perform multiple interactions that build on each other.
47
+ *
48
+ * When allowFreeForm is true, uses createFreeFormValue if provided,
49
+ * otherwise defaults to (input) => ({ label: input }).
50
+ */
51
+ export declare function MultipleWrapper<T extends OptionLike>({ initialValue, initialInputValue, onChange, onInputChange, menu, disabled, readOnly, debounce, customRenderValue, clearable, allowFreeForm, createFreeFormValue, onBlur, UNSAFE_className, UNSAFE_styles, limitVisibleSelections, limitSelectionText, }: MultipleWrapperProps<T>): React.JSX.Element;
52
+ interface MultipleWrapperProps<T extends OptionLike> {
53
+ readonly initialValue?: T[];
54
+ readonly initialInputValue?: string;
55
+ readonly onChange?: (v: T[]) => void;
56
+ readonly onInputChange?: (v: string) => void;
57
+ readonly menu?: MenuItem<T>[];
58
+ readonly debounce?: number;
59
+ readonly disabled?: boolean;
60
+ readonly readOnly?: boolean;
61
+ readonly customRenderValue?: AutocompleteRebuiltProps<T, true>["customRenderValue"];
62
+ readonly clearable?: AutocompleteRebuiltProps<T, true>["clearable"];
63
+ readonly allowFreeForm?: boolean;
64
+ readonly createFreeFormValue?: (input: string) => T;
65
+ readonly onBlur?: () => void;
66
+ readonly UNSAFE_className?: AutocompleteRebuiltProps<T, true>["UNSAFE_className"];
67
+ readonly UNSAFE_styles?: AutocompleteRebuiltProps<T, true>["UNSAFE_styles"];
68
+ readonly limitVisibleSelections?: number;
69
+ readonly limitSelectionText?: (truncatedCount: number) => string;
70
+ }
39
71
  /**
40
72
  * Wrapper for testing focus and blur behavior with tabbable siblings
41
73
  * Includes tabbable elements before and after the autocomplete
42
74
  * so tests can use tab navigation to focus without clicking
43
75
  */
44
- export declare function FocusableSiblingsWrapper<T extends OptionLike>({ onFocus, onChange, onInputChange, menu, readOnly, openOnFocus, }: {
76
+ export declare function FocusableSiblingsWrapper<T extends OptionLike>({ onFocus, onOpen, onClose, onChange, onInputChange, menu, readOnly, openOnFocus, }: {
45
77
  readonly onChange?: (v: T | undefined) => void;
46
78
  readonly onInputChange?: (v: string) => void;
47
79
  readonly menu?: MenuItem<T>[];
48
80
  readonly readOnly?: boolean;
49
81
  readonly onFocus?: () => void;
82
+ readonly onOpen?: () => void;
83
+ readonly onClose?: () => void;
50
84
  readonly openOnFocus?: boolean;
51
85
  }): React.JSX.Element;
86
+ export {};
@@ -11,7 +11,7 @@ export type RenderItem<T extends OptionLike, S extends object = Record<string, u
11
11
  kind: "section";
12
12
  section: MenuSection<T, S, A>;
13
13
  };
14
- export declare function useAutocomplete<Value extends OptionLike, Multiple extends boolean = false, SectionExtra extends object = Record<string, unknown>, ActionExtra extends object = Record<string, unknown>>(props: AutocompleteRebuiltProps<Value, Multiple, SectionExtra, ActionExtra>): {
14
+ export declare function useAutocomplete<Value extends OptionLike, Multiple extends boolean = false, SectionExtra extends object = Record<string, unknown>, ActionExtra extends object = Record<string, unknown>>(props: AutocompleteRebuiltProps<Value, Multiple, SectionExtra, ActionExtra>, inputRef: React.RefObject<HTMLInputElement | HTMLTextAreaElement | null>): {
15
15
  renderable: RenderItem<Value, SectionExtra, ActionExtra>[];
16
16
  optionCount: number;
17
17
  persistentsHeaders: import("./Autocomplete.types").MenuHeader<ActionExtra>[];
@@ -59,6 +59,8 @@ export declare function useAutocomplete<Value extends OptionLike, Multiple exten
59
59
  onSelection: (option: Value) => void;
60
60
  onAction: (action: ActionConfig) => void;
61
61
  onInteractionPointerDown: (e: React.PointerEvent) => void;
62
+ removeSelection: (option: Value) => void;
63
+ clearAll: () => void;
62
64
  onInputChangeFromUser: (val: string) => void;
63
65
  onInputBlur: (event: React.FocusEvent<HTMLInputElement | HTMLTextAreaElement>) => void;
64
66
  onInputFocus: (event: React.FocusEvent<HTMLInputElement | HTMLTextAreaElement>) => void;
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react';
2
2
  import { useLayoutEffect } from 'react';
3
- import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
3
+ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
4
4
  import * as ReactDOM from 'react-dom';
5
5
 
6
6
  function hasWindow() {
package/dist/index.cjs CHANGED
@@ -112,12 +112,12 @@ require('react/jsx-runtime');
112
112
  require('react-dom');
113
113
  require('classnames');
114
114
  require('./maxHeight-cjs.js');
115
- require('./filterDataAttributes-cjs.js');
116
115
  require('./tslib.es6-cjs.js');
116
+ require('react-hook-form');
117
+ require('./filterDataAttributes-cjs.js');
117
118
  require('color');
118
119
  require('react-router-dom');
119
120
  require('./getMappedAtlantisSpaceToken-cjs.js');
120
- require('react-hook-form');
121
121
  require('./useChildComponent-cjs.js');
122
122
  require('./InternalChipDismissible-cjs.js');
123
123
  require('./useScrollToActive-cjs.js');
package/dist/index.mjs CHANGED
@@ -110,12 +110,12 @@ import 'react/jsx-runtime';
110
110
  import 'react-dom';
111
111
  import 'classnames';
112
112
  import './maxHeight-es.js';
113
- import './filterDataAttributes-es.js';
114
113
  import './tslib.es6-es.js';
114
+ import 'react-hook-form';
115
+ import './filterDataAttributes-es.js';
115
116
  import 'color';
116
117
  import 'react-router-dom';
117
118
  import './getMappedAtlantisSpaceToken-es.js';
118
- import 'react-hook-form';
119
119
  import './useChildComponent-es.js';
120
120
  import './InternalChipDismissible-es.js';
121
121
  import './useScrollToActive-es.js';