@jobber/components 4.58.5 → 4.59.1-st-spike-w.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.
Files changed (133) hide show
  1. package/dist/AnimatedSwitcher/index.js +5 -13
  2. package/dist/{AnimatedSwitcher-d1e1ddcf.js → AnimatedSwitcher-6ffd5003.js} +9 -15
  3. package/dist/Autocomplete/index.js +57 -68
  4. package/dist/Avatar/index.js +7 -15
  5. package/dist/{Avatar-1aa30ee1.js → Avatar-b2e862de.js} +13 -21
  6. package/dist/Banner/index.js +29 -38
  7. package/dist/Button/index.js +8 -16
  8. package/dist/{Button-db6114a6.js → Button-319d8fa0.js} +15 -22
  9. package/dist/ButtonDismiss/index.js +9 -17
  10. package/dist/ButtonDismiss-85986110.js +8 -0
  11. package/dist/Card/index.js +15 -23
  12. package/dist/{Card-116af709.js → Card-c1970a7c.js} +27 -34
  13. package/dist/Checkbox/index.js +11 -19
  14. package/dist/{Checkbox-bc4bc968.js → Checkbox-e4733fb4.js} +30 -37
  15. package/dist/Chip/index.js +24 -33
  16. package/dist/{Chip-4f12eec8.js → Chip-12a64c38.js} +94 -106
  17. package/dist/{Chip-f8b8fd89.js → Chip-40f5214c.js} +29 -37
  18. package/dist/Chips/index.js +25 -34
  19. package/dist/Combobox/Combobox.d.ts +3 -8
  20. package/dist/Combobox/Combobox.types.d.ts +71 -44
  21. package/dist/Combobox/ComboboxProvider.d.ts +12 -4
  22. package/dist/Combobox/components/ComboboxActivator/ComboboxActivator.d.ts +1 -4
  23. package/dist/Combobox/components/ComboboxOption/ComboboxOption.d.ts +6 -2
  24. package/dist/Combobox/components/ComboboxTrigger/ComboboxTrigger.d.ts +2 -6
  25. package/dist/Combobox/components/ComboboxTrigger/index.d.ts +0 -2
  26. package/dist/Combobox/hooks/useCombobox.d.ts +15 -0
  27. package/dist/Combobox/hooks/useComboboxAccessibility.d.ts +1 -1
  28. package/dist/Combobox/hooks/useComboboxContent.d.ts +1 -6
  29. package/dist/Combobox/hooks/useComboboxValidation.d.ts +11 -9
  30. package/dist/Combobox/hooks/useMakeComboboxHandlers.d.ts +7 -0
  31. package/dist/Combobox/index.js +219 -247
  32. package/dist/ConfirmationModal/index.js +22 -30
  33. package/dist/{ConfirmationModal-285c3cbe.js → ConfirmationModal-86b42ca0.js} +14 -20
  34. package/dist/Content/index.js +4 -12
  35. package/dist/{Content-2ca1ffe1.js → Content-3354c281.js} +8 -14
  36. package/dist/Countdown/index.js +8 -17
  37. package/dist/DataDump/index.js +24 -32
  38. package/dist/DataList/index.js +256 -268
  39. package/dist/DataTable/index.js +92 -123
  40. package/dist/DatePicker/index.js +12 -20
  41. package/dist/{DatePicker-49213434.js → DatePicker-9f1e19a5.js} +30 -39
  42. package/dist/DescriptionList/index.js +9 -17
  43. package/dist/Disclosure/index.js +21 -29
  44. package/dist/Divider/index.js +7 -16
  45. package/dist/Drawer/index.js +24 -34
  46. package/dist/Emphasis/index.js +5 -13
  47. package/dist/Emphasis-edd2af9b.js +13 -0
  48. package/dist/FeatureSwitch/index.js +39 -48
  49. package/dist/Flex/index.js +6 -15
  50. package/dist/Form/index.js +11 -19
  51. package/dist/FormField/index.js +16 -24
  52. package/dist/{FormField-fa9254dc.js → FormField-99918ed4.js} +58 -65
  53. package/dist/FormatDate/index.js +2 -11
  54. package/dist/{FormatDate-70ea5b43.js → FormatDate-720b39cf.js} +3 -10
  55. package/dist/FormatEmail/index.js +7 -16
  56. package/dist/FormatFile/index.js +27 -35
  57. package/dist/{FormatFile-6423c3b5.js → FormatFile-e1498cb9.js} +44 -52
  58. package/dist/FormatRelativeDateTime/index.js +7 -15
  59. package/dist/FormatTime/index.js +3 -11
  60. package/dist/Gallery/index.js +40 -49
  61. package/dist/Glimmer/index.js +6 -15
  62. package/dist/{Glimmer-cfa92a88.js → Glimmer-d3be9219.js} +25 -33
  63. package/dist/Grid/index.js +14 -24
  64. package/dist/Heading/index.js +5 -13
  65. package/dist/{Heading-4cde9989.js → Heading-04994667.js} +4 -10
  66. package/dist/Icon/index.js +3 -11
  67. package/dist/Icon-22723fe6.js +34 -0
  68. package/dist/InlineLabel/index.js +5 -13
  69. package/dist/{InlineLabel-a24706c4.js → InlineLabel-4df86867.js} +9 -16
  70. package/dist/InputAvatar/index.js +32 -40
  71. package/dist/InputDate/index.js +26 -35
  72. package/dist/InputEmail/index.js +18 -27
  73. package/dist/InputFile/index.js +14 -23
  74. package/dist/{InputFile-25c3369b.js → InputFile-3bbaa09e.js} +24 -33
  75. package/dist/InputGroup/index.js +4 -12
  76. package/dist/{InputGroup-3fdde16b.js → InputGroup-1b4abd36.js} +9 -16
  77. package/dist/InputNumber/index.js +17 -25
  78. package/dist/{InputNumber-ea9fcee1.js → InputNumber-fa8132f3.js} +7 -13
  79. package/dist/InputPassword/index.js +19 -27
  80. package/dist/InputPhoneNumber/index.js +28 -36
  81. package/dist/InputText/index.js +17 -25
  82. package/dist/{InputText-ab237501.js → InputText-6d262128.js} +9 -15
  83. package/dist/InputTime/index.js +29 -38
  84. package/dist/InputValidation/index.js +9 -17
  85. package/dist/InputValidation-b6adff05.js +23 -0
  86. package/dist/LightBox/index.js +16 -24
  87. package/dist/LightBox-8c8f30b1.js +109 -0
  88. package/dist/Link/index.js +3 -11
  89. package/dist/List/index.js +47 -59
  90. package/dist/Markdown/index.js +10 -18
  91. package/dist/Markdown-2ec28e51.js +55 -0
  92. package/dist/Menu/index.js +13 -21
  93. package/dist/{Menu-2e64307a.js → Menu-10681184.js} +40 -47
  94. package/dist/Modal/index.js +16 -24
  95. package/dist/{Modal-c17cc105.js → Modal-06dc9551.js} +33 -41
  96. package/dist/MultiSelect/index.js +38 -47
  97. package/dist/Option-7967170c.js +12 -0
  98. package/dist/Page/index.js +48 -57
  99. package/dist/Popover/index.js +12 -20
  100. package/dist/{Popover-7c966790.js → Popover-a93db92d.js} +15 -21
  101. package/dist/ProgressBar/index.js +4 -12
  102. package/dist/{ProgressBar-5dfc1885.js → ProgressBar-04ee007d.js} +8 -15
  103. package/dist/RadioGroup/index.js +7 -16
  104. package/dist/{RadioGroup-9bdd8a59.js → RadioGroup-2ccd0678.js} +16 -23
  105. package/dist/RecurringSelect/index.js +90 -98
  106. package/dist/Select/index.js +17 -26
  107. package/dist/Spinner/index.js +4 -12
  108. package/dist/{Spinner-9d8fc7ff.js → Spinner-5d8359b8.js} +7 -14
  109. package/dist/StatusLabel/index.js +12 -21
  110. package/dist/Switch/index.js +5 -13
  111. package/dist/{Switch-cc9b645c.js → Switch-8bee06df.js} +17 -24
  112. package/dist/Table/index.js +19 -35
  113. package/dist/Tabs/index.js +23 -33
  114. package/dist/Text/index.js +5 -13
  115. package/dist/{Text-54334431.js → Text-703e2c21.js} +4 -10
  116. package/dist/Toast/index.js +32 -40
  117. package/dist/Tooltip/index.js +7 -15
  118. package/dist/{Tooltip-6b12f1c2.js → Tooltip-c80b9fb7.js} +22 -30
  119. package/dist/Typography/index.js +4 -12
  120. package/dist/{Typography-83915c54.js → Typography-09952a2f.js} +15 -22
  121. package/dist/{style-inject.es-9d2f5f4e.js → style-inject.es-a0e1a0ba.js} +1 -3
  122. package/dist/{tslib.es6-5b8768b7.js → tslib.es6-5849cd88.js} +1 -4
  123. package/package.json +3 -3
  124. package/rollup.config.js +1 -1
  125. package/dist/ButtonDismiss-1ccb84ec.js +0 -14
  126. package/dist/Combobox/components/ComboboxTrigger/ComboboxTriggerButton/ComboboxTriggerButton.d.ts +0 -3
  127. package/dist/Combobox/components/ComboboxTrigger/ComboboxTriggerChip/ComboboxTriggerChip.d.ts +0 -3
  128. package/dist/Emphasis-e10dde65.js +0 -19
  129. package/dist/Icon-405a216c.js +0 -40
  130. package/dist/InputValidation-377d6c62.js +0 -29
  131. package/dist/LightBox-93ef99b9.js +0 -117
  132. package/dist/Markdown-d53b01bf.js +0 -62
  133. package/dist/Option-07a24acd.js +0 -19
@@ -1,8 +1,8 @@
1
1
  import { Dispatch, ReactElement, SetStateAction } from "react";
2
- import { XOR } from "ts-xor";
3
- import { ButtonProps } from "../Button";
4
- export interface ComboboxProps extends Partial<Omit<ComboboxContentBaseProps, "options">> {
5
- readonly children: ReactElement | ReactElement[];
2
+ type ComboboxFragment = Iterable<ComboboxNode>;
3
+ type ComboboxNode = ReactElement | ComboboxFragment;
4
+ export interface ComboboxProps {
5
+ readonly children?: ComboboxNode;
6
6
  /**
7
7
  * When `true`, `Combobox` will allow for multiple selections
8
8
  *
@@ -10,52 +10,48 @@ export interface ComboboxProps extends Partial<Omit<ComboboxContentBaseProps, "o
10
10
  */
11
11
  readonly multiSelect?: boolean;
12
12
  /**
13
- * The label for the Combobox trigger
14
- */
15
- readonly label?: string;
16
- readonly onSelect?: (selection: ComboboxOption[]) => void;
17
- readonly onClose?: (selection: ComboboxOption[]) => void;
18
- }
19
- export interface ComboboxTriggerProps {
20
- /**
21
- * The label text of the trigger.
13
+ * Placeholder text to display in the search input. Defaults to "Search".
22
14
  */
23
- readonly label: string;
24
- }
25
- export interface ComboboxTriggerButtonProps extends ComboboxTriggerProps, Pick<ButtonProps, "type" | "variation" | "icon" | "iconOnRight"> {
26
- }
27
- export type ComboboxTriggerChipProps = ComboboxTriggerProps;
28
- export interface ComboboxOption {
15
+ readonly searchPlaceholder?: string;
29
16
  /**
30
- * A unique identifier for the option.
17
+ * The selected options of the Combobox.
31
18
  */
32
- id: string | number;
19
+ readonly selected: ComboboxOption[];
33
20
  /**
34
- * The value to be visually displayed in the Combobox options list.
21
+ * The encapsulating noun for the content of the combobox. Used
22
+ * in the empty state, and search placeholder. Should be pluralized.
35
23
  */
36
- label: string;
37
- }
38
- interface ComboboxCloseProps {
24
+ readonly subjectNoun?: string;
39
25
  /**
40
26
  * Callback function invoked upon the selection of an option. Provides the selected option(s) as an argument.
41
27
  */
42
28
  readonly onSelect: (selection: ComboboxOption[]) => void;
43
- }
44
- interface ComboboxSelectProps {
45
29
  /**
46
- * Callback function invoked upon the Combobox menu closing. Provides the selected option(s) as an argument.
30
+ * Callback function invoked upon the Combobox menu closing.
31
+ */
32
+ readonly onClose?: () => void;
33
+ /**
34
+ * The Chip heading for the trigger
47
35
  */
48
- readonly onClose: (selection: ComboboxOption[]) => void;
36
+ readonly label?: string;
37
+ }
38
+ export interface ComboboxActivatorProps {
39
+ readonly children: React.ReactElement;
40
+ }
41
+ export interface ComboboxTriggerProps extends Pick<ComboboxContentProps, "selected"> {
42
+ readonly label?: string;
49
43
  }
50
- interface ComboboxContentBaseProps {
44
+ export interface ComboboxOption {
51
45
  /**
52
- * List of selectable options to display.
46
+ * A unique identifier for the option.
53
47
  */
54
- readonly options: ComboboxOption[];
48
+ id: string | number;
55
49
  /**
56
- * Optional action button(s) to display at the bottom of the list.
50
+ * The value to be visually displayed in the Combobox options list.
57
51
  */
58
- readonly children?: ReactElement | ReactElement[];
52
+ label: string;
53
+ }
54
+ export interface ComboboxContentProps {
59
55
  /**
60
56
  * Placeholder text to display in the search input. Defaults to "Search".
61
57
  */
@@ -69,8 +65,47 @@ interface ComboboxContentBaseProps {
69
65
  * in the empty state, and search placeholder. Should be pluralized.
70
66
  */
71
67
  readonly subjectNoun?: string;
68
+ /**
69
+ * Action elements to be displayed at the bottom of the list.
70
+ */
71
+ readonly actionElements?: ReactElement[];
72
+ /**
73
+ * State setter for the selected options.
74
+ */
75
+ readonly selectedStateSetter: (selection: ComboboxOption[]) => void;
76
+ /**
77
+ * Callback function to be called when an option is selected.
78
+ */
79
+ readonly handleSelection: (option: ComboboxOption) => void;
80
+ /**
81
+ * Are multiple selections permitted.
82
+ */
83
+ readonly multiselect?: boolean;
84
+ /**
85
+ * The current search term.
86
+ */
87
+ readonly searchValue: string;
88
+ /**
89
+ * Setter for the current search term.
90
+ */
91
+ readonly setSearchValue: Dispatch<SetStateAction<string>>;
92
+ /**
93
+ * Reference to the wrapping div element of all the Combobox pieces
94
+ */
95
+ readonly wrapperRef: React.RefObject<HTMLDivElement>;
96
+ /**
97
+ * Is the Combobox open
98
+ */
99
+ readonly open: boolean;
100
+ /**
101
+ * Setter for the open state of the Combobox.
102
+ */
103
+ readonly setOpen: (open: boolean) => void;
104
+ /**
105
+ * The full set of options for the Combobox in the shape of data, not elements.
106
+ */
107
+ readonly options: ComboboxOption[];
72
108
  }
73
- export type ComboboxContentProps = ComboboxContentBaseProps & XOR<ComboboxCloseProps, ComboboxSelectProps>;
74
109
  export interface ComboboxSearchProps {
75
110
  /**
76
111
  * The placeholder for the search input.
@@ -128,14 +163,6 @@ export interface ComboboxListProps {
128
163
  * A ref to the list element.
129
164
  */
130
165
  readonly optionsListRef: React.RefObject<HTMLUListElement>;
131
- /**
132
- * Setter for the first selected element, which is used to scroll the list to the first selected element on re-opening.
133
- */
134
- readonly setFirstSelectedElement: React.Dispatch<SetStateAction<HTMLElement | null>>;
135
- /**
136
- * The callback function to call when an option is selected.
137
- */
138
- readonly selectionHandler: (option: ComboboxOption) => void;
139
166
  /**
140
167
  * The current search term. Used in the no results message.
141
168
  */
@@ -143,7 +170,7 @@ export interface ComboboxListProps {
143
170
  /**
144
171
  * Determines if it is a single selection or multi selection Combobox.
145
172
  */
146
- readonly multiselect: boolean;
173
+ readonly multiselect?: boolean;
147
174
  /**
148
175
  * The noun to be used in the empty state message.
149
176
  */
@@ -1,12 +1,20 @@
1
- import React, { RefObject } from "react";
1
+ import React, { Dispatch, MutableRefObject, SetStateAction } from "react";
2
+ import { ComboboxOption } from "./Combobox.types";
2
3
  export declare const ComboboxContext: React.Context<{
3
- multiselect: boolean;
4
4
  open: boolean;
5
5
  setOpen: (open: boolean) => void;
6
- wrapperRef: RefObject<HTMLDivElement>;
6
+ selected: ComboboxOption[];
7
+ selectionHandler: (option: ComboboxOption) => void;
8
+ handleClose: () => void;
9
+ shouldScroll: MutableRefObject<boolean>;
7
10
  }>;
8
11
  export interface ComboboxProviderProps {
9
12
  readonly children: React.ReactNode;
10
- readonly multiselect?: boolean;
13
+ readonly selected: ComboboxOption[];
14
+ readonly selectionHandler: (option: ComboboxOption) => void;
15
+ readonly open: boolean;
16
+ readonly setOpen: Dispatch<SetStateAction<boolean>>;
17
+ readonly handleClose: () => void;
18
+ readonly shouldScroll: MutableRefObject<boolean>;
11
19
  }
12
20
  export declare function ComboboxContextProvider(props: ComboboxProviderProps): JSX.Element;
@@ -1,6 +1,3 @@
1
1
  import React from "react";
2
- interface ComboboxActivatorProps {
3
- readonly children: React.ReactElement;
4
- }
2
+ import { ComboboxActivatorProps } from "../../Combobox.types";
5
3
  export declare function ComboboxActivator(props: ComboboxActivatorProps): React.ReactElement<any, string | React.JSXElementConstructor<any>>;
6
- export {};
@@ -1,2 +1,6 @@
1
- import { ComboboxOption as ComboboxOptionType } from "../../Combobox.types";
2
- export declare function ComboboxOption(_: ComboboxOptionType): null;
1
+ /// <reference types="react" />
2
+ export interface ComboboxOptionProps {
3
+ readonly id: string | number;
4
+ readonly label: string;
5
+ }
6
+ export declare function ComboboxOption(props: ComboboxOptionProps): JSX.Element;
@@ -1,7 +1,3 @@
1
1
  /// <reference types="react" />
2
- import { ComboboxContentProps } from "../../Combobox.types";
3
- interface ComboboxTriggerProps extends Pick<ComboboxContentProps, "selected"> {
4
- readonly label: string;
5
- }
6
- export declare function ComboboxTrigger({ selected, ...props }: ComboboxTriggerProps): JSX.Element;
7
- export {};
2
+ import { ComboboxTriggerProps } from "../../Combobox.types";
3
+ export declare function ComboboxTrigger({ label, selected, }: ComboboxTriggerProps): JSX.Element;
@@ -1,3 +1 @@
1
- export { ComboboxTriggerButton } from "./ComboboxTriggerButton/ComboboxTriggerButton";
2
- export { ComboboxTriggerChip } from "./ComboboxTriggerChip/ComboboxTriggerChip";
3
1
  export { ComboboxTrigger } from "./ComboboxTrigger";
@@ -0,0 +1,15 @@
1
+ import React, { Dispatch, MutableRefObject } from "react";
2
+ import { UseMakeComboboxHandlersReturn } from "./useMakeComboboxHandlers";
3
+ import { ComboboxOption } from "../Combobox.types";
4
+ type UseComboboxReturn = {
5
+ wrapperRef: React.RefObject<HTMLDivElement>;
6
+ searchValue: string;
7
+ setSearchValue: Dispatch<React.SetStateAction<string>>;
8
+ open: boolean;
9
+ setOpen: Dispatch<React.SetStateAction<boolean>>;
10
+ selectedOptions: ComboboxOption[];
11
+ selectedStateSetter: (selection: ComboboxOption[]) => void;
12
+ shouldScroll: MutableRefObject<boolean>;
13
+ } & UseMakeComboboxHandlersReturn;
14
+ export declare function useCombobox(selected: ComboboxOption[], onSelect: (selection: ComboboxOption[]) => void, onClose?: () => void, multiSelect?: boolean): UseComboboxReturn;
15
+ export {};
@@ -1,6 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  import { ComboboxOption } from "../Combobox.types";
3
- export declare function useComboboxAccessibility(selectionCallback: (selection: ComboboxOption) => void, filteredOptions: ComboboxOption[], optionsListRef: React.RefObject<HTMLUListElement>, open: boolean, setOpen: (open: boolean) => void, wrapperRef: React.RefObject<HTMLDivElement>): {
3
+ export declare function useComboboxAccessibility(selectionCallback: (selection: ComboboxOption) => void, filteredOptions: ComboboxOption[], optionsListRef: React.RefObject<HTMLUListElement>, open: boolean, wrapperRef: React.RefObject<HTMLDivElement>): {
4
4
  popperRef: React.RefObject<HTMLDivElement>;
5
5
  popperStyles: {
6
6
  [key: string]: React.CSSProperties;
@@ -1,13 +1,8 @@
1
1
  /// <reference types="react" />
2
2
  import { ComboboxOption } from "../Combobox.types";
3
3
  interface useComboboxContent {
4
- searchValue: string;
5
- setSearchValue: React.Dispatch<React.SetStateAction<string>>;
6
- setFirstSelectedElement: React.Dispatch<React.SetStateAction<HTMLElement | null>>;
7
4
  filteredOptions: ComboboxOption[];
8
5
  optionsListRef: React.RefObject<HTMLUListElement>;
9
- selectedOptions: ComboboxOption[];
10
- optionsSelectionHandler: (selected: ComboboxOption[]) => void;
11
6
  }
12
- export declare function useComboboxContent(options: ComboboxOption[], open: boolean, selected: ComboboxOption[], onClose: ((selection: ComboboxOption[]) => void) | undefined, onSelect: ((selection: ComboboxOption[]) => void) | undefined): useComboboxContent;
7
+ export declare function useComboboxContent(options: ComboboxOption[], open: boolean, selected: ComboboxOption[], searchValue: string): useComboboxContent;
13
8
  export {};
@@ -1,10 +1,12 @@
1
- import { ReactElement, ReactNode } from "react";
2
- import { ComboboxActionProps, ComboboxOption as ComboboxOptionProps } from "../Combobox.types";
3
- export declare const COMBOBOX_TRIGGER_COUNT_ERROR_MESSAGE = "Combobox can only have one Trigger or Activator element";
4
- export declare const COMBOBOX_OPTION_AND_CONTENT_EXISTS_ERROR = "Combobox prefers using Combobox.Option and Combobox.Action as the direct child of Combobox instead of Combobox.Content";
5
- export declare function useComboboxValidation(children: ReactNode): {
6
- triggerElement: ReactNode;
7
- contentElement: ReactNode | undefined;
8
- optionElements: ReactElement<ComboboxOptionProps>[];
9
- actionElements: ReactElement<ComboboxActionProps>[];
1
+ import { ReactElement } from "react";
2
+ import { ComboboxProps } from "../Combobox.types";
3
+ export declare const COMBOBOX_TRIGGER_COUNT_ERROR_MESSAGE = "Combobox must have exactly one Trigger element";
4
+ export declare function useComboboxValidation(children?: ComboboxProps["children"]): {
5
+ triggerElement?: ReactElement;
6
+ optionElements?: ReactElement[];
7
+ actionElements?: ReactElement[];
10
8
  };
9
+ /**
10
+ * Return all instances child component that matches the `type` provided
11
+ */
12
+ export declare function getCompoundComponents<T>(type: ReactElement<T>["type"], children?: ComboboxProps["children"]): ReactElement<T>[];
@@ -0,0 +1,7 @@
1
+ import React from "react";
2
+ import { ComboboxOption } from "../Combobox.types";
3
+ export interface UseMakeComboboxHandlersReturn {
4
+ handleClose: () => void;
5
+ handleSelection: (selection: ComboboxOption) => void;
6
+ }
7
+ export declare function useMakeComboboxHandlers(setOpen: (open: boolean) => void, setSearchValue: (searchValue: string) => void, selectedOptions: ComboboxOption[], shouldScroll: React.MutableRefObject<boolean>, selectedStateSetter: (selected: ComboboxOption[]) => void, multiSelect?: boolean, onClose?: () => void): UseMakeComboboxHandlersReturn;