@jobber/components 6.103.2 → 6.103.4-JOB-138679-1657252.19
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.
- package/dist/Autocomplete/components/MenuList.d.ts +1 -1
- package/dist/Autocomplete/components/PersistentRegion.d.ts +1 -1
- package/dist/Autocomplete/hooks/useAutocompleteListNav.d.ts +1 -1
- package/dist/Autocomplete/useAutocomplete.d.ts +1 -1
- package/dist/Card-cjs.js +1 -1
- package/dist/Card-es.js +1 -1
- package/dist/Chip/Chip.d.ts +1 -2
- package/dist/Chip/hooks/useChildComponent.d.ts +4 -3
- package/dist/Chip/index.cjs +1 -1
- package/dist/Chip-cjs.js +5 -4
- package/dist/Chip-es.js +5 -4
- package/dist/ChipDismissible-cjs.js +4 -4
- package/dist/ChipDismissible-es.js +5 -5
- package/dist/Chips/InternalChipDismissible/hooks/useInView.d.ts +1 -1
- package/dist/Chips/InternalChipDismissible/hooks/useInternalChipDismissibleInput.d.ts +1 -1
- package/dist/Chips/InternalChipDismissible/hooks/useScrollToActive.d.ts +1 -1
- package/dist/Combobox/Combobox.d.ts +2 -1
- package/dist/Combobox/Combobox.types.d.ts +2 -2
- package/dist/Combobox/ComboboxProvider.d.ts +3 -3
- package/dist/Combobox/components/ComboboxActivator/ComboboxActivator.d.ts +1 -1
- package/dist/Combobox/components/ComboboxContent/ComboboxContent.d.ts +2 -1
- package/dist/Combobox/components/ComboboxContent/ComboboxContentHeader/ComboboxContentHeader.d.ts +2 -1
- package/dist/Combobox/components/ComboboxContent/ComboboxContentList/ComboboxContentList.d.ts +2 -1
- package/dist/Combobox/components/ComboboxContent/ComboboxContentSearch/ComboboxContentSearch.d.ts +2 -1
- package/dist/Combobox/hooks/useCombobox.d.ts +1 -1
- package/dist/Combobox/hooks/useComboboxAccessibility.d.ts +2 -2
- package/dist/Combobox/hooks/useComboboxContent.d.ts +2 -1
- package/dist/Combobox/hooks/useMakeComboboxHandlers.d.ts +1 -1
- package/dist/ComboboxActivator-cjs.js +2 -2
- package/dist/ComboboxActivator-es.js +3 -3
- package/dist/ComboboxTrigger-cjs.js +1 -1
- package/dist/ComboboxTrigger-es.js +2 -2
- package/dist/DataList/DataList.types.d.ts +2 -2
- package/dist/DataList/DataList.utils.d.ts +2 -2
- package/dist/DataList/components/DataListHeaderTile/components/DataListSortingOptions.d.ts +2 -2
- package/dist/DataList/components/DataListItem/DataListItemInternal.d.ts +2 -2
- package/dist/DataList/hooks/useGetItemActions.d.ts +2 -3
- package/dist/DataListActions-cjs.js +4 -2
- package/dist/DataListActions-es.js +4 -2
- package/dist/DataListItem-cjs.js +9 -10
- package/dist/DataListItem-es.js +10 -11
- package/dist/DataListSort-cjs.js +1 -1
- package/dist/DataListSort-es.js +2 -2
- package/dist/DataTable/SortIcon.d.ts +2 -1
- package/dist/DataTable/components/DataTableSortableHeader.d.ts +1 -1
- package/dist/DatePicker/useFocusOnSelectedDate.d.ts +1 -2
- package/dist/DatePicker-cjs.js +1 -1
- package/dist/DatePicker-es.js +1 -1
- package/dist/FormField/FormFieldAffix.d.ts +2 -2
- package/dist/FormField/FormFieldTypes.d.ts +3 -3
- package/dist/FormField/hooks/useFormFieldFocus.d.ts +1 -1
- package/dist/FormField/hooks/useFormFieldWrapperStyles.d.ts +2 -2
- package/dist/FormField-cjs.js +2 -2
- package/dist/FormField-es.js +2 -2
- package/dist/InputGroup-cjs.js +5 -2
- package/dist/InputGroup-es.js +5 -2
- package/dist/InputText/InputText.d.ts +2 -2
- package/dist/InputText/useInputTextActions.d.ts +1 -1
- package/dist/InputText/useInputTextFormField.d.ts +15 -1
- package/dist/InputText/useTextAreaResize.d.ts +2 -2
- package/dist/InternalChipDismissible-cjs.js +3 -3
- package/dist/InternalChipDismissible-es.js +4 -4
- package/dist/Menu/Menu.types.d.ts +5 -1
- package/dist/Modal/Modal.types.d.ts +3 -3
- package/dist/Modal/ModalContext.rebuilt.d.ts +2 -2
- package/dist/Modal/index.cjs +1 -1
- package/dist/Modal/index.mjs +1 -1
- package/dist/MultiSelect/DropDownMenu.d.ts +1 -1
- package/dist/MultiSelect-cjs.js +13 -7
- package/dist/MultiSelect-es.js +13 -7
- package/dist/RadioGroup/RadioGroup.d.ts +2 -1
- package/dist/RadioGroup/RadioOption.d.ts +1 -1
- package/dist/StatusLabel/StatusLabel.d.ts +2 -1
- package/dist/Tabs/hooks/useTabsOverflow.d.ts +2 -2
- package/dist/Tabs-cjs.js +4 -2
- package/dist/Tabs-es.js +4 -2
- package/dist/Tooltip/useTooltipPositioning.d.ts +1 -1
- package/dist/helpers-cjs.js +1 -1
- package/dist/helpers-es.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/showToast-cjs.js +2 -2
- package/dist/showToast-es.js +2 -2
- package/dist/styles.css +18 -20
- package/dist/useChildComponent-cjs.js +1 -1
- package/dist/useChildComponent-es.js +1 -1
- package/dist/utils/mergeRefs.d.ts +2 -2
- 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.
|
|
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.
|
|
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.
|
|
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.
|
|
58
|
+
listRef: React.RefObject<(HTMLElement | null)[]>;
|
|
59
59
|
onSelection: (option: Value) => void;
|
|
60
60
|
onAction: (action: ActionConfig) => void;
|
|
61
61
|
onInputChangeFromUser: (val: string) => void;
|
package/dist/Card-cjs.js
CHANGED
|
@@ -19,7 +19,7 @@ const SPACEBAR_KEY = " ";
|
|
|
19
19
|
* Please use `<Card onClick={onClick} />` component instead.
|
|
20
20
|
*/
|
|
21
21
|
function CardClickable({ className, onClick, children, UNSAFE_style = {}, }) {
|
|
22
|
-
const cardRef = React.useRef();
|
|
22
|
+
const cardRef = React.useRef(null);
|
|
23
23
|
return (React.createElement("div", { ref: cardRef, "data-testid": "clickable-card", className: className, style: UNSAFE_style, onClick: onClick, onKeyUp: handleKeyup, onKeyDown: handleKeyDown, role: "button", tabIndex: 0 }, children));
|
|
24
24
|
function isCardFocused() {
|
|
25
25
|
return document.activeElement === cardRef.current;
|
package/dist/Card-es.js
CHANGED
|
@@ -17,7 +17,7 @@ const SPACEBAR_KEY = " ";
|
|
|
17
17
|
* Please use `<Card onClick={onClick} />` component instead.
|
|
18
18
|
*/
|
|
19
19
|
function CardClickable({ className, onClick, children, UNSAFE_style = {}, }) {
|
|
20
|
-
const cardRef = useRef();
|
|
20
|
+
const cardRef = useRef(null);
|
|
21
21
|
return (React__default.createElement("div", { ref: cardRef, "data-testid": "clickable-card", className: className, style: UNSAFE_style, onClick: onClick, onKeyUp: handleKeyup, onKeyDown: handleKeyDown, role: "button", tabIndex: 0 }, children));
|
|
22
22
|
function isCardFocused() {
|
|
23
23
|
return document.activeElement === cardRef.current;
|
package/dist/Chip/Chip.d.ts
CHANGED
|
@@ -2,8 +2,7 @@ import React from "react";
|
|
|
2
2
|
import { ChipPrefix } from "./components/ChipPrefix/Chip.Prefix";
|
|
3
3
|
import { ChipSuffix } from "./components/ChipSuffix/Chip.Suffix";
|
|
4
4
|
import type { ChipProps } from "./Chip.types";
|
|
5
|
-
declare const
|
|
5
|
+
export declare const Chip: React.ForwardRefExoticComponent<ChipProps & React.RefAttributes<HTMLDivElement | HTMLButtonElement>> & {
|
|
6
6
|
Prefix: typeof ChipPrefix;
|
|
7
7
|
Suffix: typeof ChipSuffix;
|
|
8
8
|
};
|
|
9
|
-
export { ChipNamespace as Chip };
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import type { ReactNode } from "react";
|
|
1
|
+
import type { ReactElement, ReactNode } from "react";
|
|
2
|
+
import React from "react";
|
|
2
3
|
/**
|
|
3
4
|
* Returns the first React Child that receives `true` from isCorrectComponent
|
|
4
5
|
* @param children React Children
|
|
5
|
-
* @param isCorrectComponent a function that accepts a
|
|
6
|
+
* @param isCorrectComponent a function that accepts a ReactElement and returns a boolean.
|
|
6
7
|
* @returns The first child component that returns true on isCorrectComponent
|
|
7
8
|
*/
|
|
8
|
-
export declare function useChildComponent(children: ReactNode | undefined, isCorrectComponent: (toCheck:
|
|
9
|
+
export declare function useChildComponent(children: ReactNode | undefined, isCorrectComponent: (toCheck: ReactElement) => boolean): ReactElement<unknown, string | React.JSXElementConstructor<any>> | undefined;
|
package/dist/Chip/index.cjs
CHANGED
package/dist/Chip-cjs.js
CHANGED
|
@@ -21,14 +21,15 @@ function ChipPrefix({ children }) {
|
|
|
21
21
|
var styles = {"wrapper":"NLNJBhRffp4-","input":"ulLzwMsQL3U-","inactive":"_3LLjp8oIxJ0-","invalid":"H7VZzUBkgjk-","disabled":"-yQxZSnxBBU-","button":"ngKOY8l4BG4-","icon":"rzbiB2nz36Q-","spinning":"X7Bx5CDPfDs-"};
|
|
22
22
|
|
|
23
23
|
function InternalChipButton({ icon, invalid, disabled, label, onClick, }) {
|
|
24
|
-
const buttonRef = React.useRef();
|
|
24
|
+
const buttonRef = React.useRef(null);
|
|
25
25
|
return (React.createElement("div", { ref: buttonRef, className: styles.button, tabIndex: 0, onKeyUp: handleKeyUp, onKeyDown: handleKeyDown, onClick: handleClick, role: "button", "aria-label": `Remove ${label}`, "aria-hidden": disabled, "aria-disabled": disabled, "data-testid": "remove-chip-button" },
|
|
26
26
|
React.createElement(Icon.Icon, { size: "small", name: icon, color: getColor() })));
|
|
27
27
|
function handleKeyUp(event) {
|
|
28
|
+
var _a;
|
|
28
29
|
if (document.activeElement === buttonRef.current &&
|
|
29
30
|
(event.key === " " || event.key === "Enter")) {
|
|
30
31
|
event.stopPropagation();
|
|
31
|
-
buttonRef.current.click();
|
|
32
|
+
(_a = buttonRef.current) === null || _a === void 0 ? void 0 : _a.click();
|
|
32
33
|
}
|
|
33
34
|
}
|
|
34
35
|
function handleKeyDown(event) {
|
|
@@ -124,12 +125,12 @@ function getTooltipMessage(labelFullyVisible, headingFullyVisible, label, headin
|
|
|
124
125
|
return message;
|
|
125
126
|
}
|
|
126
127
|
ChipComponent.displayName = "Chip";
|
|
127
|
-
const
|
|
128
|
+
const Chip = Object.assign(ChipComponent, {
|
|
128
129
|
Prefix: ChipPrefix,
|
|
129
130
|
Suffix: ChipSuffix,
|
|
130
131
|
});
|
|
131
132
|
|
|
132
|
-
exports.
|
|
133
|
+
exports.Chip = Chip;
|
|
133
134
|
exports.InternalChipButton = InternalChipButton;
|
|
134
135
|
exports.styles = styles$1;
|
|
135
136
|
exports.styles$1 = styles;
|
package/dist/Chip-es.js
CHANGED
|
@@ -19,14 +19,15 @@ function ChipPrefix({ children }) {
|
|
|
19
19
|
var styles = {"wrapper":"NLNJBhRffp4-","input":"ulLzwMsQL3U-","inactive":"_3LLjp8oIxJ0-","invalid":"H7VZzUBkgjk-","disabled":"-yQxZSnxBBU-","button":"ngKOY8l4BG4-","icon":"rzbiB2nz36Q-","spinning":"X7Bx5CDPfDs-"};
|
|
20
20
|
|
|
21
21
|
function InternalChipButton({ icon, invalid, disabled, label, onClick, }) {
|
|
22
|
-
const buttonRef = useRef();
|
|
22
|
+
const buttonRef = useRef(null);
|
|
23
23
|
return (React__default.createElement("div", { ref: buttonRef, className: styles.button, tabIndex: 0, onKeyUp: handleKeyUp, onKeyDown: handleKeyDown, onClick: handleClick, role: "button", "aria-label": `Remove ${label}`, "aria-hidden": disabled, "aria-disabled": disabled, "data-testid": "remove-chip-button" },
|
|
24
24
|
React__default.createElement(Icon, { size: "small", name: icon, color: getColor() })));
|
|
25
25
|
function handleKeyUp(event) {
|
|
26
|
+
var _a;
|
|
26
27
|
if (document.activeElement === buttonRef.current &&
|
|
27
28
|
(event.key === " " || event.key === "Enter")) {
|
|
28
29
|
event.stopPropagation();
|
|
29
|
-
buttonRef.current.click();
|
|
30
|
+
(_a = buttonRef.current) === null || _a === void 0 ? void 0 : _a.click();
|
|
30
31
|
}
|
|
31
32
|
}
|
|
32
33
|
function handleKeyDown(event) {
|
|
@@ -122,9 +123,9 @@ function getTooltipMessage(labelFullyVisible, headingFullyVisible, label, headin
|
|
|
122
123
|
return message;
|
|
123
124
|
}
|
|
124
125
|
ChipComponent.displayName = "Chip";
|
|
125
|
-
const
|
|
126
|
+
const Chip = Object.assign(ChipComponent, {
|
|
126
127
|
Prefix: ChipPrefix,
|
|
127
128
|
Suffix: ChipSuffix,
|
|
128
129
|
});
|
|
129
130
|
|
|
130
|
-
export {
|
|
131
|
+
export { Chip as C, InternalChipButton as I, styles as a, styles$1 as s };
|
|
@@ -7,14 +7,14 @@ var Chip = require('./Chip-cjs.js');
|
|
|
7
7
|
|
|
8
8
|
function ChipSelectable(_a) {
|
|
9
9
|
var { selected } = _a, rest = tslib_es6.__rest(_a, ["selected"]);
|
|
10
|
-
return (React.createElement(Chip.
|
|
11
|
-
React.createElement(Chip.
|
|
10
|
+
return (React.createElement(Chip.Chip, Object.assign({}, rest),
|
|
11
|
+
React.createElement(Chip.Chip.Suffix, { className: selected ? Chip.styles.selected : "" },
|
|
12
12
|
React.createElement(Icon.Icon, { name: selected ? "checkmark" : "add", size: "small", color: "interactiveSubtle" }))));
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
function ChipDismissible(props) {
|
|
16
|
-
return (React.createElement(Chip.
|
|
17
|
-
React.createElement(Chip.
|
|
16
|
+
return (React.createElement(Chip.Chip, Object.assign({}, props),
|
|
17
|
+
React.createElement(Chip.Chip.Suffix, null,
|
|
18
18
|
React.createElement(Icon.Icon, { name: "cross", size: "small", color: "interactiveSubtle" }))));
|
|
19
19
|
}
|
|
20
20
|
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { _ as __rest } from './tslib.es6-es.js';
|
|
2
2
|
import React__default from 'react';
|
|
3
3
|
import { I as Icon } from './Icon-es.js';
|
|
4
|
-
import { C as
|
|
4
|
+
import { C as Chip, s as styles } from './Chip-es.js';
|
|
5
5
|
|
|
6
6
|
function ChipSelectable(_a) {
|
|
7
7
|
var { selected } = _a, rest = __rest(_a, ["selected"]);
|
|
8
|
-
return (React__default.createElement(
|
|
9
|
-
React__default.createElement(
|
|
8
|
+
return (React__default.createElement(Chip, Object.assign({}, rest),
|
|
9
|
+
React__default.createElement(Chip.Suffix, { className: selected ? styles.selected : "" },
|
|
10
10
|
React__default.createElement(Icon, { name: selected ? "checkmark" : "add", size: "small", color: "interactiveSubtle" }))));
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
function ChipDismissible(props) {
|
|
14
|
-
return (React__default.createElement(
|
|
15
|
-
React__default.createElement(
|
|
14
|
+
return (React__default.createElement(Chip, Object.assign({}, props),
|
|
15
|
+
React__default.createElement(Chip.Suffix, null,
|
|
16
16
|
React__default.createElement(Icon, { name: "cross", size: "small", color: "interactiveSubtle" }))));
|
|
17
17
|
}
|
|
18
18
|
|
|
@@ -8,7 +8,7 @@ export declare function useInternalChipDismissibleInput({ options, isLoadingMore
|
|
|
8
8
|
searchValue: string;
|
|
9
9
|
shouldCancelBlur: boolean;
|
|
10
10
|
menuId: string;
|
|
11
|
-
inputRef: React.RefObject<HTMLInputElement>;
|
|
11
|
+
inputRef: React.RefObject<HTMLInputElement | null>;
|
|
12
12
|
activeOption: ChipDismissibleInputOptionProps;
|
|
13
13
|
hasAvailableOptions: boolean;
|
|
14
14
|
nextOptionIndex: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function useScrollToActive(index: number): import("react").
|
|
1
|
+
export declare function useScrollToActive(index: number): import("react").RefObject<HTMLDivElement | null>;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import React from "react";
|
|
1
2
|
import type { ComboboxProps } from "./Combobox.types";
|
|
2
3
|
import { ComboboxAction } from "./components/ComboboxAction";
|
|
3
4
|
import { ComboboxOption as ComboboxOptionComponent } from "./components/ComboboxOption/ComboboxOption";
|
|
4
5
|
import { ComboboxActivator } from "./components/ComboboxActivator";
|
|
5
|
-
export declare function Combobox(props: ComboboxProps): JSX.Element;
|
|
6
|
+
export declare function Combobox(props: ComboboxProps): React.JSX.Element;
|
|
6
7
|
export declare namespace Combobox {
|
|
7
8
|
var Activator: typeof ComboboxActivator;
|
|
8
9
|
var Action: typeof ComboboxAction;
|
|
@@ -165,7 +165,7 @@ export interface ComboboxContentProps {
|
|
|
165
165
|
/**
|
|
166
166
|
* Reference to the wrapping div element of all the Combobox pieces
|
|
167
167
|
*/
|
|
168
|
-
readonly wrapperRef: React.RefObject<HTMLDivElement>;
|
|
168
|
+
readonly wrapperRef: React.RefObject<HTMLDivElement | null>;
|
|
169
169
|
/**
|
|
170
170
|
* Is the Combobox open
|
|
171
171
|
*/
|
|
@@ -235,7 +235,7 @@ export interface ComboboxListProps {
|
|
|
235
235
|
/**
|
|
236
236
|
* A ref to the list element.
|
|
237
237
|
*/
|
|
238
|
-
readonly optionsListRef: React.RefObject<HTMLUListElement>;
|
|
238
|
+
readonly optionsListRef: React.RefObject<HTMLUListElement | null>;
|
|
239
239
|
/**
|
|
240
240
|
* The current search term. Used in the no results message.
|
|
241
241
|
*/
|
|
@@ -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,11 +8,11 @@ export interface ComboboxProviderProps {
|
|
|
8
8
|
readonly open: boolean;
|
|
9
9
|
readonly handleClose: () => void;
|
|
10
10
|
readonly handleOpen: () => void;
|
|
11
|
-
readonly shouldScroll:
|
|
11
|
+
readonly shouldScroll: RefObject<boolean>;
|
|
12
12
|
readonly searchValue: string;
|
|
13
13
|
readonly label?: string;
|
|
14
14
|
readonly onClear?: () => void;
|
|
15
15
|
readonly onSelectAll?: (selection: ComboboxOption[]) => void;
|
|
16
16
|
}
|
|
17
17
|
export declare const ComboboxContext: React.Context<Omit<ComboboxProviderProps, "children">>;
|
|
18
|
-
export declare function ComboboxContextProvider({ children, ...props }: ComboboxProviderProps): JSX.Element;
|
|
18
|
+
export declare function ComboboxContextProvider({ children, ...props }: ComboboxProviderProps): React.JSX.Element;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import type { ComboboxActivatorProps } from "../../Combobox.types";
|
|
3
|
-
export declare function ComboboxActivator(props: ComboboxActivatorProps): React.ReactElement<
|
|
3
|
+
export declare function ComboboxActivator(props: ComboboxActivatorProps): React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | null;
|
package/dist/Combobox/components/ComboboxContent/ComboboxContentHeader/ComboboxContentHeader.d.ts
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
|
+
import React from "react";
|
|
1
2
|
import type { ComboboxHeaderProps } from "../../../Combobox.types";
|
|
2
|
-
export declare function ComboboxContentHeader(props: ComboboxHeaderProps): JSX.Element;
|
|
3
|
+
export declare function ComboboxContentHeader(props: ComboboxHeaderProps): React.JSX.Element;
|
package/dist/Combobox/components/ComboboxContent/ComboboxContentSearch/ComboboxContentSearch.d.ts
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
|
+
import React from "react";
|
|
1
2
|
import type { ComboboxSearchProps } from "../../../Combobox.types";
|
|
2
|
-
export declare function ComboboxContentSearch(props: ComboboxSearchProps): JSX.Element;
|
|
3
|
+
export declare function ComboboxContentSearch(props: ComboboxSearchProps): React.JSX.Element;
|
|
@@ -3,7 +3,7 @@ import type React from "react";
|
|
|
3
3
|
import type { UseMakeComboboxHandlersReturn } from "./useMakeComboboxHandlers";
|
|
4
4
|
import { type ComboboxOption } from "../Combobox.types";
|
|
5
5
|
type UseComboboxReturn = {
|
|
6
|
-
wrapperRef: React.RefObject<HTMLDivElement>;
|
|
6
|
+
wrapperRef: React.RefObject<HTMLDivElement | null>;
|
|
7
7
|
searchValue: string;
|
|
8
8
|
setSearchValue: Dispatch<React.SetStateAction<string>>;
|
|
9
9
|
open: boolean;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { UseInteractionsReturn } from "@floating-ui/react";
|
|
2
2
|
import { type ComboboxOption } from "../Combobox.types";
|
|
3
|
-
export declare function useComboboxAccessibility(selectionCallback: (selection: ComboboxOption) => void, filteredOptions: ComboboxOption[], optionsListRef: React.RefObject<HTMLUListElement>, open: boolean, wrapperRef: React.RefObject<HTMLDivElement>): {
|
|
4
|
-
floatingRef: React.RefObject<HTMLDivElement>;
|
|
3
|
+
export declare function useComboboxAccessibility(selectionCallback: (selection: ComboboxOption) => void, filteredOptions: ComboboxOption[], optionsListRef: React.RefObject<HTMLUListElement | null>, open: boolean, wrapperRef: React.RefObject<HTMLDivElement | null>): {
|
|
4
|
+
floatingRef: React.RefObject<HTMLDivElement | null>;
|
|
5
5
|
floatingStyles: React.CSSProperties;
|
|
6
6
|
floatingProps: ReturnType<UseInteractionsReturn["getFloatingProps"]>;
|
|
7
7
|
nodeId?: string;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import type { RefObject } from "react";
|
|
1
2
|
import { type ComboboxOption } from "../Combobox.types";
|
|
2
3
|
interface useComboboxContent {
|
|
3
|
-
optionsListRef:
|
|
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.
|
|
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;
|
|
@@ -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 (
|
|
26
|
-
(props.children.type === Button.Button || props.children.type === Chip.
|
|
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
|
|
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 (
|
|
24
|
-
(props.children.type === Button || props.children.type ===
|
|
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.
|
|
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
|
|
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(
|
|
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
|
|
|
@@ -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[]>) =>
|
|
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
|
/**
|
|
@@ -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
|
|
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<
|
|
22
|
+
export declare function getExposedActions<T extends DataListObject>(childrenArray: ReactElement<DataListActionProps<T>>[], childCount?: number): ReactElement<DataListActionProps<T>, 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,7 @@
|
|
|
1
|
-
import React from "react";
|
|
1
|
+
import React, { type ReactElement } from "react";
|
|
2
2
|
import type { DataListObject } from "@jobber/components/DataList/DataList.types";
|
|
3
3
|
interface ListItemInternalProps<T extends DataListObject> {
|
|
4
|
-
readonly children:
|
|
4
|
+
readonly children: ReactElement;
|
|
5
5
|
readonly item: T;
|
|
6
6
|
}
|
|
7
7
|
export declare function DataListItemInternal<T extends DataListObject>({ children, item, }: ListItemInternalProps<T>): React.JSX.Element;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { DataListActionProps, DataListObject } from "../DataList.types";
|
|
1
|
+
import type { DataListObject } from "../DataList.types";
|
|
3
2
|
export declare function useGetItemActions<T extends DataListObject>(item: T): {
|
|
4
|
-
actions: ReactElement<DataListActionProps<T>>[];
|
|
3
|
+
actions: import("react").ReactElement<import("../DataList.types").DataListActionProps<T>, string | import("react").JSXElementConstructor<any>>[];
|
|
5
4
|
hasActions: boolean;
|
|
6
5
|
disableContextMenu: boolean;
|
|
7
6
|
};
|
|
@@ -27,13 +27,15 @@ function DataListActions({ children, itemsToExpose = 2, }) {
|
|
|
27
27
|
if (activeItem) {
|
|
28
28
|
return props.label(activeItem);
|
|
29
29
|
}
|
|
30
|
+
return "";
|
|
30
31
|
}
|
|
31
32
|
const actionLabel = getActionLabel();
|
|
32
33
|
// If the action is always visible, we don't want a tooltip.
|
|
33
34
|
if (props.alwaysVisible) {
|
|
34
|
-
return (React.createElement(Button.Button, { ariaLabel: actionLabel, key:
|
|
35
|
+
return (React.createElement(Button.Button, { ariaLabel: actionLabel, key: actionLabel, icon: props.icon, label: actionLabel, onClick: () => {
|
|
35
36
|
var _a;
|
|
36
|
-
|
|
37
|
+
if (activeItem)
|
|
38
|
+
(_a = props.onClick) === null || _a === void 0 ? void 0 : _a.call(props, activeItem);
|
|
37
39
|
}, type: "secondary", variation: "subtle" }));
|
|
38
40
|
}
|
|
39
41
|
return (React.createElement(Tooltip.Tooltip, { key: actionLabel, message: actionLabel },
|
|
@@ -25,13 +25,15 @@ function DataListActions({ children, itemsToExpose = 2, }) {
|
|
|
25
25
|
if (activeItem) {
|
|
26
26
|
return props.label(activeItem);
|
|
27
27
|
}
|
|
28
|
+
return "";
|
|
28
29
|
}
|
|
29
30
|
const actionLabel = getActionLabel();
|
|
30
31
|
// If the action is always visible, we don't want a tooltip.
|
|
31
32
|
if (props.alwaysVisible) {
|
|
32
|
-
return (React__default.createElement(Button, { ariaLabel: actionLabel, key:
|
|
33
|
+
return (React__default.createElement(Button, { ariaLabel: actionLabel, key: actionLabel, icon: props.icon, label: actionLabel, onClick: () => {
|
|
33
34
|
var _a;
|
|
34
|
-
|
|
35
|
+
if (activeItem)
|
|
36
|
+
(_a = props.onClick) === null || _a === void 0 ? void 0 : _a.call(props, activeItem);
|
|
35
37
|
}, type: "secondary", variation: "subtle" }));
|
|
36
38
|
}
|
|
37
39
|
return (React__default.createElement(Tooltip, { key: actionLabel, message: actionLabel },
|
package/dist/DataListItem-cjs.js
CHANGED
|
@@ -61,19 +61,18 @@ function DataListItemInternal({ children, item, }) {
|
|
|
61
61
|
function useGetItemActions(item) {
|
|
62
62
|
var _a;
|
|
63
63
|
const { itemActionComponent } = DataListContext.useDataListContext();
|
|
64
|
-
const
|
|
65
|
-
const actionsArray =
|
|
64
|
+
const rawActions = itemActionComponent === null || itemActionComponent === void 0 ? void 0 : itemActionComponent.props.children;
|
|
65
|
+
const actionsArray = rawActions
|
|
66
|
+
? Array.isArray(rawActions)
|
|
67
|
+
? rawActions
|
|
68
|
+
: [rawActions]
|
|
69
|
+
: [];
|
|
66
70
|
const disableContextMenu = (_a = itemActionComponent === null || itemActionComponent === void 0 ? void 0 : itemActionComponent.props.disableContextMenu) !== null && _a !== void 0 ? _a : false;
|
|
67
71
|
const actions = React.useMemo(() => {
|
|
68
|
-
return actionsArray.filter(action =>
|
|
69
|
-
|
|
70
|
-
return action.props.visible(item);
|
|
71
|
-
}
|
|
72
|
-
return true;
|
|
73
|
-
});
|
|
74
|
-
}, [itemActionComponent === null || itemActionComponent === void 0 ? void 0 : itemActionComponent.props.children, item]);
|
|
72
|
+
return actionsArray.filter(action => action.props.visible ? action.props.visible(item) : true);
|
|
73
|
+
}, [actionsArray, item]);
|
|
75
74
|
return {
|
|
76
|
-
actions
|
|
75
|
+
actions,
|
|
77
76
|
hasActions: Boolean(actions.length),
|
|
78
77
|
disableContextMenu,
|
|
79
78
|
};
|
package/dist/DataListItem-es.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React__default, {
|
|
1
|
+
import React__default, { useMemo, 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,19 +59,18 @@ function DataListItemInternal({ children, item, }) {
|
|
|
59
59
|
function useGetItemActions(item) {
|
|
60
60
|
var _a;
|
|
61
61
|
const { itemActionComponent } = useDataListContext();
|
|
62
|
-
const
|
|
63
|
-
const actionsArray =
|
|
62
|
+
const rawActions = itemActionComponent === null || itemActionComponent === void 0 ? void 0 : itemActionComponent.props.children;
|
|
63
|
+
const actionsArray = rawActions
|
|
64
|
+
? Array.isArray(rawActions)
|
|
65
|
+
? rawActions
|
|
66
|
+
: [rawActions]
|
|
67
|
+
: [];
|
|
64
68
|
const disableContextMenu = (_a = itemActionComponent === null || itemActionComponent === void 0 ? void 0 : itemActionComponent.props.disableContextMenu) !== null && _a !== void 0 ? _a : false;
|
|
65
69
|
const actions = useMemo(() => {
|
|
66
|
-
return actionsArray.filter(action =>
|
|
67
|
-
|
|
68
|
-
return action.props.visible(item);
|
|
69
|
-
}
|
|
70
|
-
return true;
|
|
71
|
-
});
|
|
72
|
-
}, [itemActionComponent === null || itemActionComponent === void 0 ? void 0 : itemActionComponent.props.children, item]);
|
|
70
|
+
return actionsArray.filter(action => action.props.visible ? action.props.visible(item) : true);
|
|
71
|
+
}, [actionsArray, item]);
|
|
73
72
|
return {
|
|
74
|
-
actions
|
|
73
|
+
actions,
|
|
75
74
|
hasActions: Boolean(actions.length),
|
|
76
75
|
disableContextMenu,
|
|
77
76
|
};
|
package/dist/DataListSort-cjs.js
CHANGED
|
@@ -21,7 +21,7 @@ function DataListSort() {
|
|
|
21
21
|
},
|
|
22
22
|
] },
|
|
23
23
|
React.createElement(Combobox.Combobox.Activator, null,
|
|
24
|
-
React.createElement(Chip.
|
|
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() {
|