@onewelcome/react-lib-components 6.4.4 → 6.6.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.
- package/dist/cjs/Form/FileUpload/FileItem/FileItem.cjs.js +1 -1
- package/dist/cjs/Form/FileUpload/FileItem/FileItem.cjs.js.map +1 -1
- package/dist/cjs/Form/FileUpload/FileItem/FileItem.module.cjs.js +2 -0
- package/dist/cjs/Form/FileUpload/FileItem/FileItem.module.cjs.js.map +1 -0
- package/dist/cjs/Form/Select/MultiSelect/MultiOption.cjs.js +1 -1
- package/dist/cjs/Form/Select/MultiSelect/MultiOption.cjs.js.map +1 -1
- package/dist/cjs/Form/Select/MultiSelect/MultiSelect.cjs.js +1 -1
- package/dist/cjs/Form/Select/MultiSelect/MultiSelect.cjs.js.map +1 -1
- package/dist/cjs/Form/Select/MultiSelect/MultiSelect.module.cjs.js +1 -1
- package/dist/cjs/Form/Select/MultiSelect/SelectButton.cjs.js +1 -1
- package/dist/cjs/Form/Select/MultiSelect/SelectButton.cjs.js.map +1 -1
- package/dist/cjs/Form/Select/MultiSelect/SelectButton.module.cjs.js +1 -1
- package/dist/cjs/Form/Select/MultiSelect/SelectedOptions.cjs.js +1 -1
- package/dist/cjs/Form/Select/MultiSelect/SelectedOptions.cjs.js.map +1 -1
- package/dist/cjs/Form/Select/MultiSelect/useArrowNavigation.cjs.js +2 -0
- package/dist/cjs/Form/Select/MultiSelect/useArrowNavigation.cjs.js.map +1 -0
- package/dist/cjs/Form/Select/MultiSelect/useSearch.cjs.js +2 -0
- package/dist/cjs/Form/Select/MultiSelect/useSearch.cjs.js.map +1 -0
- package/dist/cjs/Form/Select/SingleSelect/Option.cjs.js +1 -1
- package/dist/cjs/Form/Select/SingleSelect/Option.cjs.js.map +1 -1
- package/dist/cjs/Form/Select/SingleSelect/Select.cjs.js +1 -1
- package/dist/cjs/Form/Select/SingleSelect/Select.cjs.js.map +1 -1
- package/dist/cjs/Form/Select/SingleSelect/Select.module.cjs.js +1 -1
- package/dist/cjs/Form/Select/SingleSelect/useArrowNavigation.cjs.js +2 -0
- package/dist/cjs/Form/Select/SingleSelect/useArrowNavigation.cjs.js.map +1 -0
- package/dist/cjs/Form/Select/SingleSelect/useSearch.cjs.js +2 -0
- package/dist/cjs/Form/Select/SingleSelect/useSearch.cjs.js.map +1 -0
- package/dist/cjs/Form/Select/useAddNewBtn.cjs.js +1 -1
- package/dist/cjs/Form/Select/useAddNewBtn.cjs.js.map +1 -1
- package/dist/cjs/Form/Select/useAddNewBtn.module.cjs.js +1 -1
- package/dist/cjs/Form/Select/useSelectPositionList.cjs.js +2 -0
- package/dist/cjs/Form/Select/useSelectPositionList.cjs.js.map +1 -0
- package/dist/cjs/Notifications/BaseModal/BaseModalActions/BaseModalActions.cjs.js +1 -1
- package/dist/cjs/Notifications/BaseModal/BaseModalActions/BaseModalActions.cjs.js.map +1 -1
- package/dist/cjs/Notifications/Dialog/Dialog.cjs.js.map +1 -1
- package/dist/cjs/Notifications/Dialog/DialogTitle/DialogTitle.cjs.js +1 -1
- package/dist/cjs/Notifications/Dialog/DialogTitle/DialogTitle.cjs.js.map +1 -1
- package/dist/cjs/Tooltip/Tooltip.module.cjs.js +1 -1
- package/dist/cjs/src/components/Form/Select/MultiSelect/MultiSelect.test.d.ts +63 -1
- package/dist/cjs/src/components/Form/Select/MultiSelect/MultiSelectKeyboardNavigation.test.d.ts +1 -0
- package/dist/cjs/src/components/Form/Select/MultiSelect/SelectedOptions.d.ts +2 -1
- package/dist/cjs/src/components/Form/Select/MultiSelect/useArrowNavigation.d.ts +16 -0
- package/dist/cjs/src/components/Form/Select/MultiSelect/useSearch.d.ts +34 -0
- package/dist/cjs/src/components/Form/Select/Select.interfaces.d.ts +1 -0
- package/dist/cjs/src/components/Form/Select/SingleSelect/Option.d.ts +1 -0
- package/dist/cjs/src/components/Form/Select/SingleSelect/useArrowNavigation.d.ts +5 -0
- package/dist/cjs/src/components/Form/Select/{useSearch.d.ts → SingleSelect/useSearch.d.ts} +2 -1
- package/dist/cjs/src/components/Form/Select/useAddNewBtn.d.ts +10 -3
- package/dist/cjs/src/components/Form/Select/useSelectPositionList.d.ts +12 -0
- package/dist/cjs/src/components/Notifications/Dialog/Dialog.d.ts +1 -1
- package/dist/cjs/src/util/helper.cjs.js +1 -1
- package/dist/cjs/src/util/helper.cjs.js.map +1 -1
- package/dist/cjs/src/util/helper.d.ts +1 -0
- package/dist/esm/Form/FileUpload/FileItem/FileItem.esm.js +1 -1
- package/dist/esm/Form/FileUpload/FileItem/FileItem.esm.js.map +1 -1
- package/dist/esm/Form/FileUpload/FileItem/FileItem.module.esm.js +2 -0
- package/dist/esm/Form/FileUpload/FileItem/FileItem.module.esm.js.map +1 -0
- package/dist/esm/Form/Select/MultiSelect/MultiOption.esm.js +1 -1
- package/dist/esm/Form/Select/MultiSelect/MultiOption.esm.js.map +1 -1
- package/dist/esm/Form/Select/MultiSelect/MultiSelect.esm.js +1 -1
- package/dist/esm/Form/Select/MultiSelect/MultiSelect.esm.js.map +1 -1
- package/dist/esm/Form/Select/MultiSelect/MultiSelect.module.esm.js +1 -1
- package/dist/esm/Form/Select/MultiSelect/SelectButton.esm.js +1 -1
- package/dist/esm/Form/Select/MultiSelect/SelectButton.esm.js.map +1 -1
- package/dist/esm/Form/Select/MultiSelect/SelectButton.module.esm.js +1 -1
- package/dist/esm/Form/Select/MultiSelect/SelectedOptions.esm.js +1 -1
- package/dist/esm/Form/Select/MultiSelect/SelectedOptions.esm.js.map +1 -1
- package/dist/esm/Form/Select/MultiSelect/useArrowNavigation.esm.js +2 -0
- package/dist/esm/Form/Select/MultiSelect/useArrowNavigation.esm.js.map +1 -0
- package/dist/esm/Form/Select/MultiSelect/useSearch.esm.js +2 -0
- package/dist/esm/Form/Select/MultiSelect/useSearch.esm.js.map +1 -0
- package/dist/esm/Form/Select/SingleSelect/Option.esm.js +1 -1
- package/dist/esm/Form/Select/SingleSelect/Option.esm.js.map +1 -1
- package/dist/esm/Form/Select/SingleSelect/Select.esm.js +1 -1
- package/dist/esm/Form/Select/SingleSelect/Select.esm.js.map +1 -1
- package/dist/esm/Form/Select/SingleSelect/Select.module.esm.js +1 -1
- package/dist/esm/Form/Select/SingleSelect/useArrowNavigation.esm.js +2 -0
- package/dist/esm/Form/Select/SingleSelect/useArrowNavigation.esm.js.map +1 -0
- package/dist/esm/Form/Select/SingleSelect/useSearch.esm.js +2 -0
- package/dist/esm/Form/Select/SingleSelect/useSearch.esm.js.map +1 -0
- package/dist/esm/Form/Select/useAddNewBtn.esm.js +1 -1
- package/dist/esm/Form/Select/useAddNewBtn.esm.js.map +1 -1
- package/dist/esm/Form/Select/useAddNewBtn.module.esm.js +1 -1
- package/dist/esm/Form/Select/useSelectPositionList.esm.js +2 -0
- package/dist/esm/Form/Select/useSelectPositionList.esm.js.map +1 -0
- package/dist/esm/Notifications/BaseModal/BaseModalActions/BaseModalActions.esm.js +1 -1
- package/dist/esm/Notifications/BaseModal/BaseModalActions/BaseModalActions.esm.js.map +1 -1
- package/dist/esm/Notifications/Dialog/Dialog.esm.js.map +1 -1
- package/dist/esm/Notifications/Dialog/DialogTitle/DialogTitle.esm.js +1 -1
- package/dist/esm/Notifications/Dialog/DialogTitle/DialogTitle.esm.js.map +1 -1
- package/dist/esm/Tooltip/Tooltip.module.esm.js +1 -1
- package/dist/esm/src/components/Form/Select/MultiSelect/MultiSelect.test.d.ts +63 -1
- package/dist/esm/src/components/Form/Select/MultiSelect/MultiSelectKeyboardNavigation.test.d.ts +1 -0
- package/dist/esm/src/components/Form/Select/MultiSelect/SelectedOptions.d.ts +2 -1
- package/dist/esm/src/components/Form/Select/MultiSelect/useArrowNavigation.d.ts +16 -0
- package/dist/esm/src/components/Form/Select/MultiSelect/useSearch.d.ts +34 -0
- package/dist/esm/src/components/Form/Select/Select.interfaces.d.ts +1 -0
- package/dist/esm/src/components/Form/Select/SingleSelect/Option.d.ts +1 -0
- package/dist/esm/src/components/Form/Select/SingleSelect/useArrowNavigation.d.ts +5 -0
- package/dist/esm/src/components/Form/Select/{useSearch.d.ts → SingleSelect/useSearch.d.ts} +2 -1
- package/dist/esm/src/components/Form/Select/useAddNewBtn.d.ts +10 -3
- package/dist/esm/src/components/Form/Select/useSelectPositionList.d.ts +12 -0
- package/dist/esm/src/components/Notifications/Dialog/Dialog.d.ts +1 -1
- package/dist/esm/src/util/helper.d.ts +1 -0
- package/dist/esm/src/util/helper.esm.js +1 -1
- package/dist/esm/src/util/helper.esm.js.map +1 -1
- package/package.json +6 -6
- package/src/components/Form/FileUpload/FileItem/FileItem.tsx +1 -1
- package/src/components/Form/Select/MultiSelect/MultiOption.tsx +36 -3
- package/src/components/Form/Select/MultiSelect/MultiSelect.module.scss +29 -19
- package/src/components/Form/Select/MultiSelect/MultiSelect.tsx +85 -62
- package/src/components/Form/Select/MultiSelect/SelectButton.module.scss +1 -1
- package/src/components/Form/Select/MultiSelect/SelectButton.tsx +1 -1
- package/src/components/Form/Select/MultiSelect/SelectedOptions.tsx +5 -4
- package/src/components/Form/Select/MultiSelect/useArrowNavigation.ts +128 -0
- package/src/components/Form/Select/MultiSelect/useSearch.tsx +126 -0
- package/src/components/Form/Select/Select.interfaces.ts +1 -0
- package/src/components/Form/Select/SingleSelect/Option.tsx +15 -4
- package/src/components/Form/Select/SingleSelect/Select.module.scss +13 -2
- package/src/components/Form/Select/SingleSelect/Select.tsx +7 -3
- package/src/components/Form/Select/{SelectService.ts → SingleSelect/useArrowNavigation.ts} +1 -101
- package/src/components/Form/Select/{useSearch.tsx → SingleSelect/useSearch.tsx} +3 -2
- package/src/components/Form/Select/useAddNewBtn.module.scss +18 -4
- package/src/components/Form/Select/useAddNewBtn.tsx +42 -8
- package/src/components/Form/Select/useSelectPositionList.ts +113 -0
- package/src/components/Notifications/BaseModal/BaseModalActions/BaseModalActions.tsx +1 -1
- package/src/components/Notifications/Dialog/Dialog.tsx +1 -1
- package/src/components/Notifications/Dialog/DialogTitle/DialogTitle.tsx +5 -3
- package/src/components/Tooltip/Tooltip.module.scss +1 -1
- package/src/util/helper.tsx +2 -0
- package/dist/cjs/Form/FileUpload/FileItem/FileItem.modules.cjs.js +0 -2
- package/dist/cjs/Form/FileUpload/FileItem/FileItem.modules.cjs.js.map +0 -1
- package/dist/cjs/Form/Select/SelectService.cjs.js +0 -2
- package/dist/cjs/Form/Select/SelectService.cjs.js.map +0 -1
- package/dist/cjs/Form/Select/useSearch.cjs.js +0 -2
- package/dist/cjs/Form/Select/useSearch.cjs.js.map +0 -1
- package/dist/cjs/src/components/Form/Select/SelectService.d.ts +0 -17
- package/dist/esm/Form/FileUpload/FileItem/FileItem.modules.esm.js +0 -2
- package/dist/esm/Form/FileUpload/FileItem/FileItem.modules.esm.js.map +0 -1
- package/dist/esm/Form/Select/SelectService.esm.js +0 -2
- package/dist/esm/Form/Select/SelectService.esm.js.map +0 -1
- package/dist/esm/Form/Select/useSearch.esm.js +0 -2
- package/dist/esm/Form/Select/useSearch.esm.js.map +0 -1
- package/dist/esm/src/components/Form/Select/SelectService.d.ts +0 -17
- /package/src/components/Form/FileUpload/FileItem/{FileItem.modules.scss → FileItem.module.scss} +0 -0
|
@@ -1 +1,63 @@
|
|
|
1
|
-
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { MultiSelectProps } from "../Select.interfaces";
|
|
3
|
+
export declare const createMultiSelect: (params?: ((defaultParams: MultiSelectProps) => MultiSelectProps) | undefined) => {
|
|
4
|
+
select: HTMLElement;
|
|
5
|
+
button: HTMLElement;
|
|
6
|
+
list: Element | null;
|
|
7
|
+
dropdownWrapper: Element | null;
|
|
8
|
+
container: HTMLElement;
|
|
9
|
+
baseElement: HTMLElement;
|
|
10
|
+
debug: (baseElement?: Element | DocumentFragment | (Element | DocumentFragment)[] | undefined, maxLength?: number | undefined, options?: import("pretty-format").PrettyFormatOptions | undefined) => void;
|
|
11
|
+
rerender: (ui: React.ReactNode) => void;
|
|
12
|
+
unmount: () => void;
|
|
13
|
+
asFragment: () => DocumentFragment;
|
|
14
|
+
getByLabelText: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").SelectorMatcherOptions | undefined) => HTMLElement;
|
|
15
|
+
getAllByLabelText: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").SelectorMatcherOptions | undefined) => HTMLElement[];
|
|
16
|
+
queryByLabelText: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").SelectorMatcherOptions | undefined) => HTMLElement | null;
|
|
17
|
+
queryAllByLabelText: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").SelectorMatcherOptions | undefined) => HTMLElement[];
|
|
18
|
+
findByLabelText: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").SelectorMatcherOptions | undefined, waitForElementOptions?: import("@testing-library/react").waitForOptions | undefined) => Promise<HTMLElement>;
|
|
19
|
+
findAllByLabelText: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").SelectorMatcherOptions | undefined, waitForElementOptions?: import("@testing-library/react").waitForOptions | undefined) => Promise<HTMLElement[]>;
|
|
20
|
+
getByPlaceholderText: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined) => HTMLElement;
|
|
21
|
+
getAllByPlaceholderText: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined) => HTMLElement[];
|
|
22
|
+
queryByPlaceholderText: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined) => HTMLElement | null;
|
|
23
|
+
queryAllByPlaceholderText: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined) => HTMLElement[];
|
|
24
|
+
findByPlaceholderText: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined, waitForElementOptions?: import("@testing-library/react").waitForOptions | undefined) => Promise<HTMLElement>;
|
|
25
|
+
findAllByPlaceholderText: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined, waitForElementOptions?: import("@testing-library/react").waitForOptions | undefined) => Promise<HTMLElement[]>;
|
|
26
|
+
getByText: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").SelectorMatcherOptions | undefined) => HTMLElement;
|
|
27
|
+
getAllByText: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").SelectorMatcherOptions | undefined) => HTMLElement[];
|
|
28
|
+
queryByText: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").SelectorMatcherOptions | undefined) => HTMLElement | null;
|
|
29
|
+
queryAllByText: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").SelectorMatcherOptions | undefined) => HTMLElement[];
|
|
30
|
+
findByText: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").SelectorMatcherOptions | undefined, waitForElementOptions?: import("@testing-library/react").waitForOptions | undefined) => Promise<HTMLElement>;
|
|
31
|
+
findAllByText: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").SelectorMatcherOptions | undefined, waitForElementOptions?: import("@testing-library/react").waitForOptions | undefined) => Promise<HTMLElement[]>;
|
|
32
|
+
getByAltText: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined) => HTMLElement;
|
|
33
|
+
getAllByAltText: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined) => HTMLElement[];
|
|
34
|
+
queryByAltText: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined) => HTMLElement | null;
|
|
35
|
+
queryAllByAltText: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined) => HTMLElement[];
|
|
36
|
+
findByAltText: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined, waitForElementOptions?: import("@testing-library/react").waitForOptions | undefined) => Promise<HTMLElement>;
|
|
37
|
+
findAllByAltText: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined, waitForElementOptions?: import("@testing-library/react").waitForOptions | undefined) => Promise<HTMLElement[]>;
|
|
38
|
+
getByTitle: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined) => HTMLElement;
|
|
39
|
+
getAllByTitle: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined) => HTMLElement[];
|
|
40
|
+
queryByTitle: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined) => HTMLElement | null;
|
|
41
|
+
queryAllByTitle: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined) => HTMLElement[];
|
|
42
|
+
findByTitle: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined, waitForElementOptions?: import("@testing-library/react").waitForOptions | undefined) => Promise<HTMLElement>;
|
|
43
|
+
findAllByTitle: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined, waitForElementOptions?: import("@testing-library/react").waitForOptions | undefined) => Promise<HTMLElement[]>;
|
|
44
|
+
getByDisplayValue: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined) => HTMLElement;
|
|
45
|
+
getAllByDisplayValue: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined) => HTMLElement[];
|
|
46
|
+
queryByDisplayValue: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined) => HTMLElement | null;
|
|
47
|
+
queryAllByDisplayValue: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined) => HTMLElement[];
|
|
48
|
+
findByDisplayValue: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined, waitForElementOptions?: import("@testing-library/react").waitForOptions | undefined) => Promise<HTMLElement>;
|
|
49
|
+
findAllByDisplayValue: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined, waitForElementOptions?: import("@testing-library/react").waitForOptions | undefined) => Promise<HTMLElement[]>;
|
|
50
|
+
getByRole: (role: import("@testing-library/react").ByRoleMatcher, options?: import("@testing-library/react").ByRoleOptions | undefined) => HTMLElement;
|
|
51
|
+
getAllByRole: (role: import("@testing-library/react").ByRoleMatcher, options?: import("@testing-library/react").ByRoleOptions | undefined) => HTMLElement[];
|
|
52
|
+
queryByRole: (role: import("@testing-library/react").ByRoleMatcher, options?: import("@testing-library/react").ByRoleOptions | undefined) => HTMLElement | null;
|
|
53
|
+
queryAllByRole: (role: import("@testing-library/react").ByRoleMatcher, options?: import("@testing-library/react").ByRoleOptions | undefined) => HTMLElement[];
|
|
54
|
+
findByRole: (role: import("@testing-library/react").ByRoleMatcher, options?: import("@testing-library/react").ByRoleOptions | undefined, waitForElementOptions?: import("@testing-library/react").waitForOptions | undefined) => Promise<HTMLElement>;
|
|
55
|
+
findAllByRole: (role: import("@testing-library/react").ByRoleMatcher, options?: import("@testing-library/react").ByRoleOptions | undefined, waitForElementOptions?: import("@testing-library/react").waitForOptions | undefined) => Promise<HTMLElement[]>;
|
|
56
|
+
getByTestId: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined) => HTMLElement;
|
|
57
|
+
getAllByTestId: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined) => HTMLElement[];
|
|
58
|
+
queryByTestId: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined) => HTMLElement | null;
|
|
59
|
+
queryAllByTestId: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined) => HTMLElement[];
|
|
60
|
+
findByTestId: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined, waitForElementOptions?: import("@testing-library/react").waitForOptions | undefined) => Promise<HTMLElement>;
|
|
61
|
+
findAllByTestId: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined, waitForElementOptions?: import("@testing-library/react").waitForOptions | undefined) => Promise<HTMLElement[]>;
|
|
62
|
+
};
|
|
63
|
+
export declare const turnOnScrollToFunctionSupportInTest: () => void;
|
package/dist/esm/src/components/Form/Select/MultiSelect/MultiSelectKeyboardNavigation.test.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import React, { ComponentPropsWithRef } from "react";
|
|
2
2
|
export type Display = {
|
|
3
|
+
value: string;
|
|
3
4
|
label: string;
|
|
4
5
|
fixed?: boolean;
|
|
5
6
|
};
|
|
6
7
|
export interface Props extends ComponentPropsWithRef<"div"> {
|
|
7
|
-
display:
|
|
8
|
+
display: Display[];
|
|
8
9
|
onRemove: (value: string) => void;
|
|
9
10
|
disabled: boolean;
|
|
10
11
|
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
interface UseArrowNavigationParams {
|
|
2
|
+
expanded: boolean;
|
|
3
|
+
setExpanded: React.Dispatch<React.SetStateAction<boolean>>;
|
|
4
|
+
setFocusedSelectItem: React.Dispatch<React.SetStateAction<number>>;
|
|
5
|
+
childrenCount: number;
|
|
6
|
+
setShouldClick: React.Dispatch<React.SetStateAction<boolean>>;
|
|
7
|
+
addBtnRef: React.RefObject<HTMLButtonElement>;
|
|
8
|
+
searchInputRef: React.RefObject<HTMLInputElement>;
|
|
9
|
+
customSelectButtonRef: React.RefObject<HTMLButtonElement>;
|
|
10
|
+
onClose: () => void;
|
|
11
|
+
}
|
|
12
|
+
/** @scope .*/
|
|
13
|
+
export declare const useArrowNavigation: ({ expanded, setExpanded, setFocusedSelectItem, childrenCount, setShouldClick, addBtnRef, searchInputRef, customSelectButtonRef, onClose }: UseArrowNavigationParams) => {
|
|
14
|
+
onArrowNavigation: (event: React.KeyboardEvent) => void;
|
|
15
|
+
};
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { PartialInputProps, SearchProps } from "../Select.interfaces";
|
|
3
|
+
interface Props {
|
|
4
|
+
selectId: string;
|
|
5
|
+
search?: SearchProps;
|
|
6
|
+
optionsCount: number;
|
|
7
|
+
/**
|
|
8
|
+
* @deprecated
|
|
9
|
+
*/
|
|
10
|
+
searchPlaceholder?: string;
|
|
11
|
+
/**
|
|
12
|
+
* @deprecated
|
|
13
|
+
*/
|
|
14
|
+
searchInputProps?: PartialInputProps & {
|
|
15
|
+
reset?: boolean;
|
|
16
|
+
};
|
|
17
|
+
searchInputClassName: string;
|
|
18
|
+
expanded: boolean;
|
|
19
|
+
setFocusedSelectItem: (idx: number) => void;
|
|
20
|
+
focusedSelectItem: number;
|
|
21
|
+
describedBy?: string;
|
|
22
|
+
getOptionId: (multiSelectId: string, optionIndex: number) => string;
|
|
23
|
+
getListboxId: (multiSelectId: string) => string;
|
|
24
|
+
}
|
|
25
|
+
/** @scope .*/
|
|
26
|
+
export declare const useSearch: ({ selectId, search, optionsCount, searchPlaceholder, searchInputProps, searchInputClassName, expanded, setFocusedSelectItem, focusedSelectItem, describedBy, getOptionId, getListboxId }: Props) => {
|
|
27
|
+
renderSearch: () => React.JSX.Element;
|
|
28
|
+
resetSearchState: () => void;
|
|
29
|
+
searchVisible: boolean;
|
|
30
|
+
searchThreshold: number;
|
|
31
|
+
searchInputRef: React.RefObject<HTMLInputElement>;
|
|
32
|
+
filter: string;
|
|
33
|
+
};
|
|
34
|
+
export {};
|
|
@@ -14,6 +14,7 @@ export interface AddNewProps {
|
|
|
14
14
|
label: string;
|
|
15
15
|
onAddNew: (value: string) => void;
|
|
16
16
|
btnProps?: React.ButtonHTMLAttributes<HTMLButtonElement>;
|
|
17
|
+
alwaysEnabled?: boolean;
|
|
17
18
|
}
|
|
18
19
|
export interface SelectProps<V extends string | readonly string[] | undefined> extends ComponentPropsWithRef<"select">, FormElement {
|
|
19
20
|
children: ReactElement[];
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { UseArrowNavigationParams } from "../Select.interfaces";
|
|
2
|
+
/** @scope .*/
|
|
3
|
+
export declare const useArrowNavigation: ({ expanded, setExpanded, isSearching, setIsSearching, setFocusedSelectItem, onOptionChangeHandler, childrenCount, setShouldClick, searchInputRef, addBtnRef, renderThreshold }: UseArrowNavigationParams) => {
|
|
4
|
+
onArrowNavigation: (event: React.KeyboardEvent) => void;
|
|
5
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { PartialInputProps, SearchProps } from "
|
|
2
|
+
import { PartialInputProps, SearchProps } from "../Select.interfaces";
|
|
3
3
|
interface Props {
|
|
4
4
|
search?: SearchProps;
|
|
5
5
|
optionsCount: number;
|
|
@@ -17,6 +17,7 @@ interface Props {
|
|
|
17
17
|
expanded: boolean;
|
|
18
18
|
setFocusedSelectItem: (idx: number) => void;
|
|
19
19
|
}
|
|
20
|
+
/** @scope .*/
|
|
20
21
|
export declare const useSearch: ({ search, optionsCount, searchPlaceholder, searchInputProps, searchInputClassName, expanded, setFocusedSelectItem }: Props) => {
|
|
21
22
|
renderSearch: () => React.JSX.Element;
|
|
22
23
|
setIsSearching: React.Dispatch<React.SetStateAction<boolean>>;
|
|
@@ -1,12 +1,19 @@
|
|
|
1
|
-
import React from "react";
|
|
1
|
+
import React, { RefObject } from "react";
|
|
2
2
|
import { AddNewProps } from "./Select.interfaces";
|
|
3
3
|
interface Props {
|
|
4
|
+
id?: string;
|
|
4
5
|
addNew?: AddNewProps;
|
|
5
6
|
filter: string;
|
|
7
|
+
focusedSelectItem: number;
|
|
8
|
+
optionsCount: number;
|
|
9
|
+
searchInputRef: RefObject<HTMLInputElement>;
|
|
10
|
+
shouldClick?: boolean;
|
|
11
|
+
onClickCallback?: () => void;
|
|
6
12
|
}
|
|
7
|
-
|
|
13
|
+
/** @scope .*/
|
|
14
|
+
export declare const useAddNewBtn: ({ id, addNew, filter, focusedSelectItem, optionsCount, searchInputRef, shouldClick, onClickCallback }: Props) => {
|
|
8
15
|
addNewBtnOptionsContainerClassName: string;
|
|
9
|
-
renderAddNew: () => React.JSX.Element | undefined;
|
|
16
|
+
renderAddNew: () => false | React.JSX.Element | undefined;
|
|
10
17
|
addBtnRef: React.RefObject<HTMLButtonElement>;
|
|
11
18
|
};
|
|
12
19
|
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Position, UseSelectPositionListParams } from "./Select.interfaces";
|
|
2
|
+
/** @scope .*/
|
|
3
|
+
export declare const useSelectPositionList: ({ expanded, optionListReference, addBtnRef, containerReference }: UseSelectPositionListParams) => {
|
|
4
|
+
optionsListMaxHeight: {
|
|
5
|
+
wrapper?: string | undefined;
|
|
6
|
+
list?: string | undefined;
|
|
7
|
+
};
|
|
8
|
+
opacity: number;
|
|
9
|
+
setOpacity: import("react").Dispatch<import("react").SetStateAction<number>>;
|
|
10
|
+
listPosition: Partial<Position>;
|
|
11
|
+
setListPosition: import("react").Dispatch<import("react").SetStateAction<Partial<Position>>>;
|
|
12
|
+
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const t=(t=15,e)=>{let r=["1","2","3","4","5","6","7","8","9","0","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"];let o="";for(let n=0;n<t&&o.length<t;n++){let t=typeof e==="string"&&(e===null||e===void 0?void 0:e[n])!==void 0&&!/\s/.test(e[n])?e[n]:"";o=o+t+r[Math.floor(Math.random()*r.length)]}return o.slice(0,t)};const e=(t,e,r=true)=>{if(r)return Object.keys(t).reduce(((r,o)=>{if(e.test(o))r[o]=t[o];return r}),{});else return Object.entries(t).filter((([t])=>!e.test(t))).reduce(((t,e)=>({...t,[e[0]]:e[1]})),{})};const r=(t,e)=>{let r;return function o(...n){const l=()=>{clearTimeout(r);t(...n)};clearTimeout(r);r=setTimeout(l,e)}};const o=(t,e)=>{let r=0;return function(){let o=Date.now();if(o-r>=e){t();r=o}}};const n=t=>t*parseFloat(getComputedStyle(document.documentElement).fontSize);const l=(t,e)=>{if(!e)return t;let r={...t};for(let o in e)if(Object.prototype.hasOwnProperty.call(e,o))if(typeof e[o]==="object"&&e[o]!==null&&Object.prototype.hasOwnProperty.call(t,o)&&!Array.isArray(e[o]))r[o]=l(t[o],e[o]);else r[o]=e[o];return r};export{r as debounce,l as deepMerge,e as filterProps,t as generateID,n as remToPx,o as throttle};
|
|
1
|
+
const t=(t=15,e)=>{let r=["1","2","3","4","5","6","7","8","9","0","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"];let o="";for(let n=0;n<t&&o.length<t;n++){let t=typeof e==="string"&&(e===null||e===void 0?void 0:e[n])!==void 0&&!/\s/.test(e[n])?e[n]:"";o=o+t+r[Math.floor(Math.random()*r.length)]}return o.slice(0,t)};const e=(t,e,r=true)=>{if(r)return Object.keys(t).reduce(((r,o)=>{if(e.test(o))r[o]=t[o];return r}),{});else return Object.entries(t).filter((([t])=>!e.test(t))).reduce(((t,e)=>({...t,[e[0]]:e[1]})),{})};const r=(t,e)=>{let r;return function o(...n){const l=()=>{clearTimeout(r);t(...n)};clearTimeout(r);r=setTimeout(l,e)}};const o=(t,e)=>{let r=0;return function(){let o=Date.now();if(o-r>=e){t();r=o}}};const n=t=>t*parseFloat(getComputedStyle(document.documentElement).fontSize);const l=(t,e)=>{if(!e)return t;let r={...t};for(let o in e)if(Object.prototype.hasOwnProperty.call(e,o))if(typeof e[o]==="object"&&e[o]!==null&&Object.prototype.hasOwnProperty.call(t,o)&&!Array.isArray(e[o]))r[o]=l(t[o],e[o]);else r[o]=e[o];return r};const c=t=>t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");export{r as debounce,l as deepMerge,c as escapeRegExp,e as filterProps,t as generateID,n as remToPx,o as throttle};
|
|
2
2
|
//# sourceMappingURL=helper.esm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helper.esm.js","sources":["../../../../../../src/util/helper.tsx"],"sourcesContent":["/*\n * Copyright 2022 OneWelcome B.V.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\ntype KeyValuePair = { [key: string]: unknown };\n\nexport const generateID = (length = 15, stringToWeaveIn?: string) => {\n /** We will make sure to mesh the generate id and name property together to basically create a unique ID */\n let hashCharacters = [\n \"1\",\n \"2\",\n \"3\",\n \"4\",\n \"5\",\n \"6\",\n \"7\",\n \"8\",\n \"9\",\n \"0\",\n \"A\",\n \"B\",\n \"C\",\n \"D\",\n \"E\",\n \"F\",\n \"G\",\n \"H\",\n \"I\",\n \"J\",\n \"K\",\n \"L\",\n \"M\",\n \"N\",\n \"O\",\n \"P\",\n \"Q\",\n \"R\",\n \"S\",\n \"T\",\n \"U\",\n \"V\",\n \"W\",\n \"X\",\n \"Y\",\n \"Z\",\n \"a\",\n \"b\",\n \"c\",\n \"d\",\n \"e\",\n \"f\",\n \"g\",\n \"h\",\n \"i\",\n \"j\",\n \"k\",\n \"l\",\n \"m\",\n \"n\",\n \"o\",\n \"p\",\n \"q\",\n \"r\",\n \"s\",\n \"t\",\n \"u\",\n \"v\",\n \"w\",\n \"x\",\n \"y\",\n \"z\"\n ];\n\n let id = \"\";\n\n /** Generate an id of x characters in length */\n for (let i = 0; i < length && id.length < length; i++) {\n let stringCharacter =\n typeof stringToWeaveIn === \"string\" &&\n stringToWeaveIn?.[i] !== undefined &&\n !/\\s/.test(stringToWeaveIn[i])\n ? stringToWeaveIn[i]\n : \"\";\n id = id + stringCharacter + hashCharacters[Math.floor(Math.random() * hashCharacters.length)];\n }\n\n return id.slice(0, length);\n};\n\nexport const filterProps = (props: any, regexPattern: RegExp, returnFiltered: boolean = true) => {\n if (returnFiltered) {\n return Object.keys(props).reduce((acc: KeyValuePair, key) => {\n if (regexPattern.test(key)) {\n acc[key] = props[key];\n }\n\n return acc;\n }, {});\n } else {\n return Object.entries(props)\n .filter(([key]) => !regexPattern.test(key))\n .reduce(\n (prevObj, currKeyValPair) => ({ ...prevObj, [currKeyValPair[0]]: currKeyValPair[1] }),\n {}\n );\n }\n};\n\nexport const debounce = (fn: (...args: unknown[]) => unknown, delay: number) => {\n let timeout: undefined | ReturnType<typeof setTimeout>;\n\n return function executedFunction(...args: unknown[]) {\n const later = () => {\n clearTimeout(timeout);\n fn(...args);\n };\n\n clearTimeout(timeout);\n\n timeout = setTimeout(later, delay);\n };\n};\n\nexport const throttle = (fn: (...args: unknown[]) => unknown, delay: number) => {\n let lastTime = 0;\n\n return function () {\n let now = Date.now();\n\n if (now - lastTime >= delay) {\n fn();\n lastTime = now;\n }\n };\n};\n\nexport const isEqual = (x: any, y: any): boolean => {\n const typesCoincide = x && y && typeof x === \"object\" && typeof y === \"object\";\n return typesCoincide\n ? Object.keys(x).length === Object.keys(y).length &&\n Object.keys(x).every(key => isEqual(x[key], y[key]))\n : x === y;\n};\n\nexport const areArraysDifferent = (\n arr1: Record<string, any>[],\n arr2: Record<string, any>[],\n key: string\n) => {\n if (arr1.length !== arr2.length) {\n return true;\n } else {\n const firstFilteredArray = arr1.filter(arr1Item =>\n arr2.some((arr2Item: { [x: string]: any }) => !isEqual(arr1Item[key], arr2Item[key]))\n );\n const secondFilteredArray = arr2.filter(arr2Item =>\n arr1.some((arr1Item: { [x: string]: any }) => !isEqual(arr1Item[key], arr2Item[key]))\n );\n\n return !!firstFilteredArray.length || !!secondFilteredArray.length;\n }\n};\n\nexport const getValueByPath = (obj: { [key: string]: any }, path: string): any => {\n return path.split(\".\").reduce((res, prop) => {\n return res[prop];\n }, obj);\n};\n\n/** Source: https://stackoverflow.com/a/42769683/5084110 */\nexport const remToPx = (rem: number): number => {\n return rem * parseFloat(getComputedStyle(document.documentElement).fontSize);\n};\n\nexport const isJsonString = (str: any) => {\n try {\n JSON.parse(str);\n } catch (e) {\n return false;\n }\n return true;\n};\n\ntype ObjectType = { [key: string]: any };\n\nexport const deepMerge = <T extends {}>(obj1: ObjectType, obj2: ObjectType | false): T => {\n if (!obj2) return obj1 as T;\n\n let result: ObjectType = { ...obj1 };\n\n for (let key in obj2) {\n if (Object.prototype.hasOwnProperty.call(obj2, key)) {\n if (\n typeof obj2[key] === \"object\" &&\n obj2[key] !== null &&\n Object.prototype.hasOwnProperty.call(obj1, key) &&\n !Array.isArray(obj2[key])\n ) {\n result[key] = deepMerge(obj1[key], obj2[key]);\n } else {\n result[key] = obj2[key];\n }\n }\n }\n\n return result as T;\n};\n"],"names":["generateID","length","stringToWeaveIn","hashCharacters","id","i","stringCharacter","undefined","test","Math","floor","random","slice","filterProps","props","regexPattern","returnFiltered","Object","keys","reduce","acc","key","entries","filter","prevObj","currKeyValPair","debounce","fn","delay","timeout","executedFunction","args","later","clearTimeout","setTimeout","throttle","lastTime","now","Date","remToPx","rem","parseFloat","getComputedStyle","document","documentElement","fontSize","deepMerge","obj1","obj2","result","prototype","hasOwnProperty","call","Array","isArray"],"mappings":"AAkBa,MAAAA,EAAa,CAACC,EAAS,GAAIC,KAEtC,IAAIC,EAAiB,CACnB,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,KAGF,IAAIC,EAAK,GAGT,IAAK,IAAIC,EAAI,EAAGA,EAAIJ,GAAUG,EAAGH,OAASA,EAAQI,IAAK,CACrD,IAAIC,SACKJ,IAAoB,WAC3BA,UAAAA,SAAe,OAAA,EAAfA,EAAkBG,WAAOE,IACxB,KAAKC,KAAKN,EAAgBG,IACvBH,EAAgBG,GAChB,GACND,EAAKA,EAAKE,EAAkBH,EAAeM,KAAKC,MAAMD,KAAKE,SAAWR,EAAeF,QACtF,CAED,OAAOG,EAAGQ,MAAM,EAAGX,EAAO,EAGrB,MAAMY,EAAc,CAACC,EAAYC,EAAsBC,EAA0B,QACtF,GAAIA,EACF,OAAOC,OAAOC,KAAKJ,GAAOK,QAAO,CAACC,EAAmBC,KACnD,GAAIN,EAAaP,KAAKa,GACpBD,EAAIC,GAAOP,EAAMO,GAGnB,OAAOD,CAAG,GACT,CAAE,QAEL,OAAOH,OAAOK,QAAQR,GACnBS,QAAO,EAAEF,MAAUN,EAAaP,KAAKa,KACrCF,QACC,CAACK,EAASC,KAAc,IAAWD,EAAS,CAACC,EAAe,IAAKA,EAAe,MAChF,CAAE,EAEP,QAGUC,EAAW,CAACC,EAAqCC,KAC5D,IAAIC,EAEJ,OAAO,SAASC,KAAoBC,GAClC,MAAMC,EAAQ,KACZC,aAAaJ,GACbF,KAAMI,EAAK,EAGbE,aAAaJ,GAEbA,EAAUK,WAAWF,EAAOJ,EAC9B,CAAC,QAGUO,EAAW,CAACR,EAAqCC,KAC5D,IAAIQ,EAAW,EAEf,OAAO,WACL,IAAIC,EAAMC,KAAKD,MAEf,GAAIA,EAAMD,GAAYR,EAAO,CAC3BD,IACAS,EAAWC,CACZ,CACH,CAAC,EAqCU,MAAAE,EAAWC,GACfA,EAAMC,WAAWC,iBAAiBC,SAASC,iBAAiBC,gBAcxDC,EAAY,CAAeC,EAAkBC,KACxD,IAAKA,EAAM,OAAOD,EAElB,IAAIE,EAAqB,IAAKF,GAE9B,IAAK,IAAI1B,KAAO2B,EACd,GAAI/B,OAAOiC,UAAUC,eAAeC,KAAKJ,EAAM3B,GAC7C,UACS2B,EAAK3B,KAAS,UACrB2B,EAAK3B,KAAS,MACdJ,OAAOiC,UAAUC,eAAeC,KAAKL,EAAM1B,KAC1CgC,MAAMC,QAAQN,EAAK3B,IAEpB4B,EAAO5B,GAAOyB,EAAUC,EAAK1B,GAAM2B,EAAK3B,SAExC4B,EAAO5B,GAAO2B,EAAK3B,GAKzB,OAAO4B,CAAW"}
|
|
1
|
+
{"version":3,"file":"helper.esm.js","sources":["../../../../../../src/util/helper.tsx"],"sourcesContent":["/*\n * Copyright 2022 OneWelcome B.V.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\ntype KeyValuePair = { [key: string]: unknown };\n\nexport const generateID = (length = 15, stringToWeaveIn?: string) => {\n /** We will make sure to mesh the generate id and name property together to basically create a unique ID */\n let hashCharacters = [\n \"1\",\n \"2\",\n \"3\",\n \"4\",\n \"5\",\n \"6\",\n \"7\",\n \"8\",\n \"9\",\n \"0\",\n \"A\",\n \"B\",\n \"C\",\n \"D\",\n \"E\",\n \"F\",\n \"G\",\n \"H\",\n \"I\",\n \"J\",\n \"K\",\n \"L\",\n \"M\",\n \"N\",\n \"O\",\n \"P\",\n \"Q\",\n \"R\",\n \"S\",\n \"T\",\n \"U\",\n \"V\",\n \"W\",\n \"X\",\n \"Y\",\n \"Z\",\n \"a\",\n \"b\",\n \"c\",\n \"d\",\n \"e\",\n \"f\",\n \"g\",\n \"h\",\n \"i\",\n \"j\",\n \"k\",\n \"l\",\n \"m\",\n \"n\",\n \"o\",\n \"p\",\n \"q\",\n \"r\",\n \"s\",\n \"t\",\n \"u\",\n \"v\",\n \"w\",\n \"x\",\n \"y\",\n \"z\"\n ];\n\n let id = \"\";\n\n /** Generate an id of x characters in length */\n for (let i = 0; i < length && id.length < length; i++) {\n let stringCharacter =\n typeof stringToWeaveIn === \"string\" &&\n stringToWeaveIn?.[i] !== undefined &&\n !/\\s/.test(stringToWeaveIn[i])\n ? stringToWeaveIn[i]\n : \"\";\n id = id + stringCharacter + hashCharacters[Math.floor(Math.random() * hashCharacters.length)];\n }\n\n return id.slice(0, length);\n};\n\nexport const filterProps = (props: any, regexPattern: RegExp, returnFiltered: boolean = true) => {\n if (returnFiltered) {\n return Object.keys(props).reduce((acc: KeyValuePair, key) => {\n if (regexPattern.test(key)) {\n acc[key] = props[key];\n }\n\n return acc;\n }, {});\n } else {\n return Object.entries(props)\n .filter(([key]) => !regexPattern.test(key))\n .reduce(\n (prevObj, currKeyValPair) => ({ ...prevObj, [currKeyValPair[0]]: currKeyValPair[1] }),\n {}\n );\n }\n};\n\nexport const debounce = (fn: (...args: unknown[]) => unknown, delay: number) => {\n let timeout: undefined | ReturnType<typeof setTimeout>;\n\n return function executedFunction(...args: unknown[]) {\n const later = () => {\n clearTimeout(timeout);\n fn(...args);\n };\n\n clearTimeout(timeout);\n\n timeout = setTimeout(later, delay);\n };\n};\n\nexport const throttle = (fn: (...args: unknown[]) => unknown, delay: number) => {\n let lastTime = 0;\n\n return function () {\n let now = Date.now();\n\n if (now - lastTime >= delay) {\n fn();\n lastTime = now;\n }\n };\n};\n\nexport const isEqual = (x: any, y: any): boolean => {\n const typesCoincide = x && y && typeof x === \"object\" && typeof y === \"object\";\n return typesCoincide\n ? Object.keys(x).length === Object.keys(y).length &&\n Object.keys(x).every(key => isEqual(x[key], y[key]))\n : x === y;\n};\n\nexport const areArraysDifferent = (\n arr1: Record<string, any>[],\n arr2: Record<string, any>[],\n key: string\n) => {\n if (arr1.length !== arr2.length) {\n return true;\n } else {\n const firstFilteredArray = arr1.filter(arr1Item =>\n arr2.some((arr2Item: { [x: string]: any }) => !isEqual(arr1Item[key], arr2Item[key]))\n );\n const secondFilteredArray = arr2.filter(arr2Item =>\n arr1.some((arr1Item: { [x: string]: any }) => !isEqual(arr1Item[key], arr2Item[key]))\n );\n\n return !!firstFilteredArray.length || !!secondFilteredArray.length;\n }\n};\n\nexport const getValueByPath = (obj: { [key: string]: any }, path: string): any => {\n return path.split(\".\").reduce((res, prop) => {\n return res[prop];\n }, obj);\n};\n\n/** Source: https://stackoverflow.com/a/42769683/5084110 */\nexport const remToPx = (rem: number): number => {\n return rem * parseFloat(getComputedStyle(document.documentElement).fontSize);\n};\n\nexport const isJsonString = (str: any) => {\n try {\n JSON.parse(str);\n } catch (e) {\n return false;\n }\n return true;\n};\n\ntype ObjectType = { [key: string]: any };\n\nexport const deepMerge = <T extends {}>(obj1: ObjectType, obj2: ObjectType | false): T => {\n if (!obj2) return obj1 as T;\n\n let result: ObjectType = { ...obj1 };\n\n for (let key in obj2) {\n if (Object.prototype.hasOwnProperty.call(obj2, key)) {\n if (\n typeof obj2[key] === \"object\" &&\n obj2[key] !== null &&\n Object.prototype.hasOwnProperty.call(obj1, key) &&\n !Array.isArray(obj2[key])\n ) {\n result[key] = deepMerge(obj1[key], obj2[key]);\n } else {\n result[key] = obj2[key];\n }\n }\n }\n\n return result as T;\n};\n\nexport const escapeRegExp = (str: string) => str.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\");\n"],"names":["generateID","length","stringToWeaveIn","hashCharacters","id","i","stringCharacter","undefined","test","Math","floor","random","slice","filterProps","props","regexPattern","returnFiltered","Object","keys","reduce","acc","key","entries","filter","prevObj","currKeyValPair","debounce","fn","delay","timeout","executedFunction","args","later","clearTimeout","setTimeout","throttle","lastTime","now","Date","remToPx","rem","parseFloat","getComputedStyle","document","documentElement","fontSize","deepMerge","obj1","obj2","result","prototype","hasOwnProperty","call","Array","isArray","escapeRegExp","str","replace"],"mappings":"AAkBa,MAAAA,EAAa,CAACC,EAAS,GAAIC,KAEtC,IAAIC,EAAiB,CACnB,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IACA,KAGF,IAAIC,EAAK,GAGT,IAAK,IAAIC,EAAI,EAAGA,EAAIJ,GAAUG,EAAGH,OAASA,EAAQI,IAAK,CACrD,IAAIC,SACKJ,IAAoB,WAC3BA,UAAAA,SAAe,OAAA,EAAfA,EAAkBG,WAAOE,IACxB,KAAKC,KAAKN,EAAgBG,IACvBH,EAAgBG,GAChB,GACND,EAAKA,EAAKE,EAAkBH,EAAeM,KAAKC,MAAMD,KAAKE,SAAWR,EAAeF,QACtF,CAED,OAAOG,EAAGQ,MAAM,EAAGX,EAAO,EAGrB,MAAMY,EAAc,CAACC,EAAYC,EAAsBC,EAA0B,QACtF,GAAIA,EACF,OAAOC,OAAOC,KAAKJ,GAAOK,QAAO,CAACC,EAAmBC,KACnD,GAAIN,EAAaP,KAAKa,GACpBD,EAAIC,GAAOP,EAAMO,GAGnB,OAAOD,CAAG,GACT,CAAE,QAEL,OAAOH,OAAOK,QAAQR,GACnBS,QAAO,EAAEF,MAAUN,EAAaP,KAAKa,KACrCF,QACC,CAACK,EAASC,KAAc,IAAWD,EAAS,CAACC,EAAe,IAAKA,EAAe,MAChF,CAAE,EAEP,QAGUC,EAAW,CAACC,EAAqCC,KAC5D,IAAIC,EAEJ,OAAO,SAASC,KAAoBC,GAClC,MAAMC,EAAQ,KACZC,aAAaJ,GACbF,KAAMI,EAAK,EAGbE,aAAaJ,GAEbA,EAAUK,WAAWF,EAAOJ,EAC9B,CAAC,QAGUO,EAAW,CAACR,EAAqCC,KAC5D,IAAIQ,EAAW,EAEf,OAAO,WACL,IAAIC,EAAMC,KAAKD,MAEf,GAAIA,EAAMD,GAAYR,EAAO,CAC3BD,IACAS,EAAWC,CACZ,CACH,CAAC,EAqCU,MAAAE,EAAWC,GACfA,EAAMC,WAAWC,iBAAiBC,SAASC,iBAAiBC,gBAcxDC,EAAY,CAAeC,EAAkBC,KACxD,IAAKA,EAAM,OAAOD,EAElB,IAAIE,EAAqB,IAAKF,GAE9B,IAAK,IAAI1B,KAAO2B,EACd,GAAI/B,OAAOiC,UAAUC,eAAeC,KAAKJ,EAAM3B,GAC7C,UACS2B,EAAK3B,KAAS,UACrB2B,EAAK3B,KAAS,MACdJ,OAAOiC,UAAUC,eAAeC,KAAKL,EAAM1B,KAC1CgC,MAAMC,QAAQN,EAAK3B,IAEpB4B,EAAO5B,GAAOyB,EAAUC,EAAK1B,GAAM2B,EAAK3B,SAExC4B,EAAO5B,GAAO2B,EAAK3B,GAKzB,OAAO4B,CAAW,EAGP,MAAAM,EAAgBC,GAAgBA,EAAIC,QAAQ,sBAAuB"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"homepage": "http://onewelcome.github.io/react-lib-components",
|
|
3
3
|
"name": "@onewelcome/react-lib-components",
|
|
4
|
-
"version": "6.
|
|
4
|
+
"version": "6.6.0",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "OneWelcome B.V.",
|
|
7
7
|
"main": "dist/cjs/src/index.cjs.js",
|
|
@@ -82,14 +82,14 @@
|
|
|
82
82
|
"@testing-library/user-event": "^14.5.2",
|
|
83
83
|
"@types/jest": "^29.5.12",
|
|
84
84
|
"@types/mdx": "^2.0.12",
|
|
85
|
-
"@types/react": "^18.2.
|
|
86
|
-
"@types/react-dom": "^18.2.
|
|
85
|
+
"@types/react": "^18.2.73",
|
|
86
|
+
"@types/react-dom": "^18.2.23",
|
|
87
87
|
"@types/react-router": "^5.1.20",
|
|
88
88
|
"@types/react-router-dom": "^5.3.3",
|
|
89
|
-
"@typescript-eslint/eslint-plugin": "^
|
|
90
|
-
"@typescript-eslint/parser": "^
|
|
89
|
+
"@typescript-eslint/eslint-plugin": "^7.5.0",
|
|
90
|
+
"@typescript-eslint/parser": "^7.5.0",
|
|
91
91
|
"babel-loader": "^9.1.3",
|
|
92
|
-
"chromatic": "^
|
|
92
|
+
"chromatic": "^11.2.0",
|
|
93
93
|
"css-loader": "^6.10.0",
|
|
94
94
|
"eslint": "^8.57.0",
|
|
95
95
|
"eslint-config-prettier": "^9.1.0",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
17
|
import React, { ComponentPropsWithRef, ForwardRefRenderFunction } from "react";
|
|
18
|
-
import classes from "./FileItem.
|
|
18
|
+
import classes from "./FileItem.module.scss";
|
|
19
19
|
import { Typography } from "../../../Typography/Typography";
|
|
20
20
|
import { Icon, Icons } from "../../../Icon/Icon";
|
|
21
21
|
import { ProgressBar } from "../../../ProgressBar/ProgressBar";
|
|
@@ -14,18 +14,51 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
import React, { ForwardRefRenderFunction } from "react";
|
|
17
|
+
import React, { ForwardRefRenderFunction, RefObject, createRef, useEffect } from "react";
|
|
18
18
|
import { Props as SelectOptionProps, Option as SelectOption } from "../SingleSelect/Option";
|
|
19
19
|
|
|
20
|
+
import classes from "./MultiSelect.module.scss";
|
|
21
|
+
|
|
20
22
|
export interface Props extends SelectOptionProps {
|
|
21
23
|
fixed?: boolean;
|
|
22
24
|
}
|
|
23
25
|
|
|
24
26
|
const MultiOptionComponent: ForwardRefRenderFunction<HTMLLIElement, Props> = (
|
|
25
|
-
{ fixed: _fixed, ...rest }: Props,
|
|
27
|
+
{ fixed: _fixed, hasFocus, className, ...rest }: Props,
|
|
26
28
|
ref
|
|
27
29
|
) => {
|
|
28
|
-
|
|
30
|
+
let innerOptionRef = (ref as RefObject<HTMLLIElement>) || createRef<HTMLLIElement>();
|
|
31
|
+
|
|
32
|
+
const additionalClasses = [];
|
|
33
|
+
className && additionalClasses.push(className);
|
|
34
|
+
hasFocus && additionalClasses.push(classes["focus"]);
|
|
35
|
+
|
|
36
|
+
const scrollToSelectedElement = (element: HTMLLIElement) => {
|
|
37
|
+
const listbox = element.parentElement;
|
|
38
|
+
const listboxWrapper = element.parentElement?.parentElement;
|
|
39
|
+
const isListboxWrapperScrollable = !!listboxWrapper?.style.maxHeight;
|
|
40
|
+
if (isListboxWrapperScrollable) {
|
|
41
|
+
listboxWrapper?.scrollTo(0, element.offsetTop - (listboxWrapper?.offsetHeight ?? 1) / 2);
|
|
42
|
+
}
|
|
43
|
+
listbox?.scrollTo(0, element.offsetTop - (listbox?.offsetHeight ?? 1) / 2);
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
useEffect(() => {
|
|
47
|
+
if (innerOptionRef.current && hasFocus) {
|
|
48
|
+
scrollToSelectedElement(innerOptionRef.current);
|
|
49
|
+
}
|
|
50
|
+
}, [hasFocus, innerOptionRef]);
|
|
51
|
+
|
|
52
|
+
return (
|
|
53
|
+
<SelectOption
|
|
54
|
+
ref={innerOptionRef}
|
|
55
|
+
isSelected={hasFocus}
|
|
56
|
+
disableDefaultSelectedStyle
|
|
57
|
+
className={additionalClasses.join(" ")}
|
|
58
|
+
aria-disabled={false}
|
|
59
|
+
{...rest}
|
|
60
|
+
/>
|
|
61
|
+
);
|
|
29
62
|
};
|
|
30
63
|
|
|
31
64
|
export const MultiOption = React.forwardRef(MultiOptionComponent);
|
|
@@ -90,6 +90,7 @@ $listItemHeight: 2.5rem;
|
|
|
90
90
|
display: flex;
|
|
91
91
|
align-items: center;
|
|
92
92
|
padding: 0.1875rem 0;
|
|
93
|
+
gap: 0.375rem;
|
|
93
94
|
}
|
|
94
95
|
}
|
|
95
96
|
|
|
@@ -143,9 +144,21 @@ $listItemHeight: 2.5rem;
|
|
|
143
144
|
opacity: 0.05;
|
|
144
145
|
}
|
|
145
146
|
|
|
146
|
-
&:focus
|
|
147
|
-
|
|
148
|
-
outline
|
|
147
|
+
&:focus,
|
|
148
|
+
&.focus {
|
|
149
|
+
outline: none;
|
|
150
|
+
|
|
151
|
+
&::before {
|
|
152
|
+
@include mixins.focusVisibleOutline($outlineOffset: 0, $selectors: null);
|
|
153
|
+
content: "";
|
|
154
|
+
position: absolute;
|
|
155
|
+
top: 0;
|
|
156
|
+
left: 0.125rem;
|
|
157
|
+
height: 100%;
|
|
158
|
+
width: calc(100% - 0.25rem);
|
|
159
|
+
opacity: 1;
|
|
160
|
+
z-index: calc(variables.$popover-z-index + 1);
|
|
161
|
+
}
|
|
149
162
|
}
|
|
150
163
|
|
|
151
164
|
&:hover:after,
|
|
@@ -166,20 +179,6 @@ $listItemHeight: 2.5rem;
|
|
|
166
179
|
}
|
|
167
180
|
}
|
|
168
181
|
|
|
169
|
-
.selected-option {
|
|
170
|
-
&:before {
|
|
171
|
-
content: "";
|
|
172
|
-
position: absolute;
|
|
173
|
-
top: 0;
|
|
174
|
-
left: 0;
|
|
175
|
-
height: 100%;
|
|
176
|
-
border-top-right-radius: 0.125rem;
|
|
177
|
-
border-bottom-right-radius: 0.125rem;
|
|
178
|
-
border-left: 0.25rem solid var(--color-primary);
|
|
179
|
-
}
|
|
180
|
-
color: var(--color-primary);
|
|
181
|
-
}
|
|
182
|
-
|
|
183
182
|
.status {
|
|
184
183
|
padding: 0.3125rem;
|
|
185
184
|
display: flex;
|
|
@@ -210,11 +209,22 @@ $listItemHeight: 2.5rem;
|
|
|
210
209
|
}
|
|
211
210
|
|
|
212
211
|
.select-search {
|
|
213
|
-
|
|
214
|
-
width: 100%;
|
|
212
|
+
flex: 1;
|
|
215
213
|
box-sizing: border-box;
|
|
216
214
|
border-bottom-left-radius: 0;
|
|
217
215
|
border-bottom-right-radius: 0;
|
|
216
|
+
border: 0;
|
|
217
|
+
background-color: transparent;
|
|
218
|
+
color: var(--default);
|
|
219
|
+
font-family: var(--font-family);
|
|
220
|
+
line-height: 1.3333;
|
|
221
|
+
margin: 0;
|
|
222
|
+
padding: 0;
|
|
223
|
+
|
|
224
|
+
&:focus-visible,
|
|
225
|
+
&:focus {
|
|
226
|
+
outline: none;
|
|
227
|
+
}
|
|
218
228
|
}
|
|
219
229
|
|
|
220
230
|
.disabled {
|