@spaced-out/ui-design-system 0.5.1 → 0.5.3
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/.cspell/custom-words.txt +4 -0
- package/.dependency-cruiser.cjs +22 -0
- package/.prettierrc +1 -0
- package/.storybook/public/depgraph.json +23818 -0
- package/.vscode/settings.json +6 -1
- package/CHANGELOG.md +15 -0
- package/cspell.json +1 -0
- package/lib/components/FileUpload/FileUpload.js +0 -1
- package/lib/components/InContextAlert/InContextAlert.d.ts +9 -0
- package/lib/components/InContextAlert/InContextAlert.d.ts.map +1 -1
- package/lib/components/InContextAlert/InContextAlert.js +4 -2
- package/lib/components/InContextAlert/InContextAlert.stories.d.ts +17 -0
- package/lib/components/InContextAlert/InContextAlert.stories.d.ts.map +1 -1
- package/lib/components/InContextAlertWithMultipleActions/InContextAlertWithMultipleActions.d.ts +12 -0
- package/lib/components/InContextAlertWithMultipleActions/InContextAlertWithMultipleActions.d.ts.map +1 -0
- package/lib/components/InContextAlertWithMultipleActions/InContextAlertWithMultipleActions.js +78 -0
- package/lib/components/InContextAlertWithMultipleActions/InContextAlertWithMultipleActions.module.css +91 -0
- package/lib/components/InContextAlertWithMultipleActions/InContextAlertWithMultipleActions.stories.d.ts +249 -0
- package/lib/components/InContextAlertWithMultipleActions/InContextAlertWithMultipleActions.stories.d.ts.map +1 -0
- package/lib/components/InContextAlertWithMultipleActions/index.d.ts +2 -0
- package/lib/components/InContextAlertWithMultipleActions/index.d.ts.map +1 -0
- package/lib/components/InContextAlertWithMultipleActions/index.js +16 -0
- package/lib/components/Pagination/Pagination.d.ts +1 -1
- package/lib/components/Pagination/Pagination.d.ts.map +1 -1
- package/lib/components/Pagination/Pagination.js +1 -3
- package/lib/components/Table/StaticTable.js +1 -1
- package/lib/components/Table/Table.d.ts.map +1 -1
- package/lib/components/Table/Table.js +3 -1
- package/lib/components/Table/Table.module.css +1 -0
- package/lib/devtools/DependencyGraph/DependencyGraph.stories.d.ts +19 -0
- package/lib/devtools/DependencyGraph/DependencyGraph.stories.d.ts.map +1 -0
- package/lib/hooks/useArbitraryOptionAddition/useArbitraryOptionAddition.d.ts +3 -3
- package/lib/hooks/useArbitraryOptionAddition/useArbitraryOptionAddition.d.ts.map +1 -1
- package/lib/hooks/useArbitraryOptionAddition/useArbitraryOptionAddition.js +5 -18
- package/lib/hooks/useArbitraryOptionAddition/useArbitraryOptionAddition.stories.d.ts.map +1 -1
- package/lib/hooks/useFileUpload/useFileUpload.d.ts +12 -8
- package/lib/hooks/useFileUpload/useFileUpload.d.ts.map +1 -1
- package/lib/hooks/useFileUpload/useFileUpload.js +2 -19
- package/lib/hooks/useFileUpload/useFileUpload.stories.d.ts.map +1 -1
- package/lib/hooks/useFilteredOptions/useFilteredOptions.d.ts +7 -3
- package/lib/hooks/useFilteredOptions/useFilteredOptions.d.ts.map +1 -1
- package/lib/hooks/useFilteredOptions/useFilteredOptions.js +2 -6
- package/lib/hooks/useInputState/useInputState.js +1 -3
- package/lib/hooks/useMountTransition/index.d.ts.map +1 -1
- package/lib/hooks/useMountTransition/index.js +0 -2
- package/lib/hooks/usePagination/usePagination.d.ts +1 -1
- package/lib/hooks/usePagination/usePagination.d.ts.map +1 -1
- package/lib/hooks/usePagination/usePagination.js +0 -3
- package/lib/hooks/usePagination/usePagination.stories.d.ts +1 -1
- package/lib/hooks/useResizeObserver/useResizeObserver.d.ts +1 -1
- package/lib/hooks/useResizeObserver/useResizeObserver.d.ts.map +1 -1
- package/lib/hooks/useResizeObserver/useResizeObserver.js +2 -5
- package/lib/hooks/useToastPortal/useToastPortal.d.ts.map +1 -1
- package/lib/hooks/useToastPortal/useToastPortal.js +0 -4
- package/lib/hooks/useToggle/useToggle.stories.d.ts.map +1 -1
- package/lib/utils/click-away/ClickAway.stories.d.ts.map +1 -1
- package/lib/utils/click-away/click-away.d.ts +11 -11
- package/lib/utils/click-away/click-away.d.ts.map +1 -1
- package/lib/utils/helpers/helpers.stories.d.ts.map +1 -1
- package/lib/utils/merge-refs/merge-refs.stories.d.ts.map +1 -1
- package/package.json +7 -2
|
@@ -376,7 +376,7 @@ function StaticTableVirtualized(props) {
|
|
|
376
376
|
'--border-radius': borderRadius,
|
|
377
377
|
'--table-width': tableWidth ? `${tableWidth}px` : _size.sizeFluid,
|
|
378
378
|
// @ts-ignore - TS2532 - Object is possibly 'undefined'.
|
|
379
|
-
height: (rowsCount + 1) * parseInt(rowHeight)
|
|
379
|
+
'--table-height': `${(rowsCount + 1) * parseInt(rowHeight)}px`,
|
|
380
380
|
overflowY: 'auto'
|
|
381
381
|
},
|
|
382
382
|
classNames: classNames,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Table.d.ts","sourceRoot":"","sources":["../../../src/components/Table/Table.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAC,QAAQ,EAAC,MAAM,cAAc,CAAC;AAC3C,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,sBAAsB,CAAC;AAC7D,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,SAAS,CAAC;AAM3C,MAAM,MAAM,aAAa,GAAG;IAM1B,QAAQ,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACjC,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG,QAAQ,CAAC;IACrC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC,CAAC;AAEH,KAAK,qBAAqB,GAAG;IAC3B,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC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AE,MAAM,SAAS,aAAa,EAC5E,KAAK,EAAE,UAAU,CAAC,IAAI,EAAE,MAAM,CAAC,qBAgFhC"}
|
|
@@ -68,7 +68,9 @@ function Table(props) {
|
|
|
68
68
|
onSort,
|
|
69
69
|
enableInternalSorting
|
|
70
70
|
});
|
|
71
|
-
|
|
71
|
+
|
|
72
|
+
// Need to consider virtualization only if entries are more than 0 and virtualizationOptions are passed
|
|
73
|
+
const virtualized = !!(virtualizationOptions && virtualizationOptions.rowsCount > 0 && entries.length > 0);
|
|
72
74
|
return virtualized ? /*#__PURE__*/React.createElement(_StaticTable.StaticTableVirtualized, _extends({}, props, sortableProps, {
|
|
73
75
|
sortable: sortable,
|
|
74
76
|
entries: sortedEntries
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import '@xyflow/react/dist/style.css';
|
|
3
|
+
declare const _default: {
|
|
4
|
+
title: string;
|
|
5
|
+
parameters: {
|
|
6
|
+
docs: {
|
|
7
|
+
subtitle: string;
|
|
8
|
+
description: {
|
|
9
|
+
component: string;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
storySource: {
|
|
13
|
+
componentPath: string;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
export default _default;
|
|
18
|
+
export declare const _DependencyGraph: () => React.JSX.Element;
|
|
19
|
+
//# sourceMappingURL=DependencyGraph.stories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DependencyGraph.stories.d.ts","sourceRoot":"","sources":["../../../src/devtools/DependencyGraph/DependencyGraph.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAqB/B,OAAO,8BAA8B,CAAC;;;;;;;;;;;;;;;AAItC,wBAYE;AAoUF,eAAO,MAAM,gBAAgB,yBAkC5B,CAAC"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import type { GroupTitleOption } from '../useFilteredOptions';
|
|
1
|
+
import type { BaseOption, GroupTitleOption } from '../useFilteredOptions';
|
|
2
2
|
export type ArbitraryOption = {
|
|
3
3
|
key: string;
|
|
4
4
|
label: string;
|
|
5
5
|
arbitrary?: boolean;
|
|
6
6
|
multiArbitrary?: boolean;
|
|
7
7
|
};
|
|
8
|
-
export declare function useArbitraryOptionAddition<V>({ searchTerm, options, excludedKeys, allowArbitraryValues, allowMultiArbitraryValues, validateArbitraryValue, makeArbitraryValue, makeMultiArbitraryValue, groupTitleOptions, arbitraryGroup, searchOptionsBy, }: {
|
|
8
|
+
export declare function useArbitraryOptionAddition<V extends BaseOption>({ searchTerm, options, excludedKeys, allowArbitraryValues, allowMultiArbitraryValues, validateArbitraryValue, makeArbitraryValue, makeMultiArbitraryValue, groupTitleOptions, arbitraryGroup, searchOptionsBy, }: {
|
|
9
9
|
searchTerm: string;
|
|
10
10
|
options?: V[];
|
|
11
11
|
excludedKeys?: string[];
|
|
@@ -13,7 +13,7 @@ export declare function useArbitraryOptionAddition<V>({ searchTerm, options, exc
|
|
|
13
13
|
allowMultiArbitraryValues?: boolean;
|
|
14
14
|
validateArbitraryValue?: (arg1: string) => boolean;
|
|
15
15
|
makeArbitraryValue?: (arg1: string) => V;
|
|
16
|
-
makeMultiArbitraryValue?: (arg1: string) => V;
|
|
16
|
+
makeMultiArbitraryValue?: (arg1: string) => V | undefined;
|
|
17
17
|
groupTitleOptions?: GroupTitleOption<V>[];
|
|
18
18
|
arbitraryGroup?: GroupTitleOption<V>;
|
|
19
19
|
searchOptionsBy?: (option: V, searchTerm: string) => boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useArbitraryOptionAddition.d.ts","sourceRoot":"","sources":["../../../src/hooks/useArbitraryOptionAddition/useArbitraryOptionAddition.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,gBAAgB,EAAC,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"useArbitraryOptionAddition.d.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,8BAA8B,EAAE,KAAK,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC;CAC5D,CAkDA"}
|
|
@@ -13,24 +13,21 @@ function useArbitraryOptionAddition(_ref) {
|
|
|
13
13
|
allowArbitraryValues = true,
|
|
14
14
|
allowMultiArbitraryValues = false,
|
|
15
15
|
validateArbitraryValue = value => value.trim() !== '',
|
|
16
|
-
// @ts-ignore - TS2322 - Type '{ key: string; label: string; arbitrary: boolean; }' is not assignable to type 'V'.
|
|
17
16
|
makeArbitraryValue = searchTerm => ({
|
|
18
17
|
key: searchTerm,
|
|
19
18
|
label: searchTerm,
|
|
20
19
|
arbitrary: true
|
|
21
20
|
}),
|
|
22
|
-
// @ts-ignore - TS2366 - Function lacks ending return statement and return type does not include 'undefined'.
|
|
23
21
|
makeMultiArbitraryValue = searchTerm => {
|
|
24
|
-
const regex = /^(?=.*[,\n])
|
|
22
|
+
const regex = /^(?=.*[,\n]).+$/;
|
|
25
23
|
if (regex.test(searchTerm)) {
|
|
26
|
-
// $FlowFixMe - Object literal is compatible with V due to type constraint
|
|
27
|
-
// @ts-ignore - TS2322 - Type '{ key: string; label: string; multiArbitrary: boolean; }' is not assignable to type 'V'.
|
|
28
24
|
return {
|
|
29
25
|
key: searchTerm,
|
|
30
26
|
label: searchTerm,
|
|
31
27
|
multiArbitrary: true
|
|
32
28
|
};
|
|
33
29
|
}
|
|
30
|
+
return undefined;
|
|
34
31
|
},
|
|
35
32
|
groupTitleOptions = [],
|
|
36
33
|
arbitraryGroup = {
|
|
@@ -39,13 +36,11 @@ function useArbitraryOptionAddition(_ref) {
|
|
|
39
36
|
options: []
|
|
40
37
|
},
|
|
41
38
|
searchOptionsBy = (option, searchTerm) => {
|
|
42
|
-
// $FlowFixMe
|
|
43
|
-
// @ts-ignore - TS2322 - Type 'V' is not assignable to type '{ label: string; key: string; }'.
|
|
44
39
|
const {
|
|
45
40
|
label,
|
|
46
41
|
key
|
|
47
42
|
} = option;
|
|
48
|
-
return key.toLowerCase().includes(searchTerm) || label.toLowerCase().includes(searchTerm);
|
|
43
|
+
return key.toLowerCase().includes(searchTerm) || (label ? label.toLowerCase().includes(searchTerm) : false);
|
|
49
44
|
}
|
|
50
45
|
} = _ref;
|
|
51
46
|
const trimmedSearchTerm = (searchTerm || '').trim().toLowerCase();
|
|
@@ -60,22 +55,15 @@ function useArbitraryOptionAddition(_ref) {
|
|
|
60
55
|
});
|
|
61
56
|
|
|
62
57
|
// Find if an arbitrary option should be added
|
|
63
|
-
const arbitraryOption = allowArbitraryValues && trimmedSearchTerm &&
|
|
64
|
-
// @ts-ignore - TS2532 - Object is possibly 'undefined'. | TS2339 - Property 'key' does not exist on type 'V'.
|
|
65
|
-
!filteredOptions.some(option => option.key === trimmedSearchTerm) &&
|
|
66
|
-
// @ts-ignore - TS2532 - Object is possibly 'undefined'.
|
|
67
|
-
!filteredGroupTitleOptions.some(group => Array.isArray(group.options) &&
|
|
68
|
-
// @ts-ignore - TS2339 - Property 'key' does not exist on type 'V'.
|
|
69
|
-
group.options.some(option => option.key === trimmedSearchTerm)) && !excludedKeys.includes(trimmedSearchTerm) && validateArbitraryValue(trimmedSearchTerm) && makeArbitraryValue(trimmedSearchTerm);
|
|
58
|
+
const arbitraryOption = allowArbitraryValues && trimmedSearchTerm && !filteredOptions.some(option => option.key === trimmedSearchTerm) && !filteredGroupTitleOptions.some(group => Array.isArray(group.options) && group.options.some(option => option.key === trimmedSearchTerm)) && !excludedKeys.includes(trimmedSearchTerm) && validateArbitraryValue(trimmedSearchTerm) && makeArbitraryValue(trimmedSearchTerm);
|
|
70
59
|
|
|
71
60
|
// Find if a multi-arbitrary option should be added
|
|
72
61
|
const multiArbitraryOption = allowMultiArbitraryValues && trimmedSearchTerm && makeMultiArbitraryValue(trimmedSearchTerm);
|
|
73
62
|
|
|
74
63
|
// Compose the results
|
|
75
64
|
let optionsWithArbitrary = filteredOptions;
|
|
76
|
-
let groupTitleOptionsWithArbitrary =
|
|
65
|
+
let groupTitleOptionsWithArbitrary = filteredGroupTitleOptions;
|
|
77
66
|
if (arbitraryOption) {
|
|
78
|
-
// @ts-ignore - TS2488 - Type 'V[] | undefined' must have a '[Symbol.iterator]()' method that returns an iterator.
|
|
79
67
|
optionsWithArbitrary = [arbitraryOption, ...optionsWithArbitrary];
|
|
80
68
|
groupTitleOptionsWithArbitrary = [{
|
|
81
69
|
...arbitraryGroup,
|
|
@@ -89,7 +77,6 @@ function useArbitraryOptionAddition(_ref) {
|
|
|
89
77
|
options: [multiArbitraryOption]
|
|
90
78
|
}, ...groupTitleOptionsWithArbitrary];
|
|
91
79
|
}
|
|
92
|
-
// @ts-ignore - TS2322 - Type 'V[] | undefined' is not assignable to type 'V[]'.
|
|
93
80
|
return {
|
|
94
81
|
optionsWithArbitrary,
|
|
95
82
|
groupTitleOptionsWithArbitrary
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useArbitraryOptionAddition.stories.d.ts","sourceRoot":"","sources":["../../../src/hooks/useArbitraryOptionAddition/useArbitraryOptionAddition.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"useArbitraryOptionAddition.stories.d.ts","sourceRoot":"","sources":["../../../src/hooks/useArbitraryOptionAddition/useArbitraryOptionAddition.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAO/B,OAAO,EAAC,0BAA0B,EAAC,MAAM,8BAA8B,CAAC;;;;;;;;;;;;;AAUxE,wBAmDE;AASF,eAAO,MAAM,KAAK,yBAgCjB,CAAC;AAwBF,eAAO,MAAM,OAAO,yBA+BnB,CAAC"}
|
|
@@ -1,17 +1,21 @@
|
|
|
1
|
+
import { type DropzoneInputProps, type DropzoneRootProps } from 'react-dropzone';
|
|
1
2
|
import type { FileObject, FileProgress, FileUploadBaseProps } from '../../components/FileUpload';
|
|
3
|
+
type GetRootProps = <T extends DropzoneRootProps>(props?: T) => T;
|
|
4
|
+
type GetInputProps = <T extends DropzoneInputProps>(props?: T) => T;
|
|
2
5
|
export type UseFileUploadReturnProps = {
|
|
3
6
|
validFiles: Array<FileObject>;
|
|
4
7
|
rejectedFiles: Array<FileObject>;
|
|
5
8
|
isDragActive: boolean;
|
|
6
9
|
shouldAcceptFiles: boolean;
|
|
7
|
-
getRootProps:
|
|
8
|
-
getInputProps:
|
|
9
|
-
handleFileClear: (id: string) =>
|
|
10
|
-
handleClear: () =>
|
|
11
|
-
moveFileToProgress: (id: string, progress: FileProgress) =>
|
|
12
|
-
moveFileToSuccess: (id: string, successMessage?: string) =>
|
|
13
|
-
moveFileToReject: (id: string, rejectReason?: string) =>
|
|
14
|
-
setShowReUpload: (id: string, showReUpload?: boolean) =>
|
|
10
|
+
getRootProps: GetRootProps;
|
|
11
|
+
getInputProps: GetInputProps;
|
|
12
|
+
handleFileClear: (id: string) => void;
|
|
13
|
+
handleClear: () => void;
|
|
14
|
+
moveFileToProgress: (id: string, progress: FileProgress) => void;
|
|
15
|
+
moveFileToSuccess: (id: string, successMessage?: string) => void;
|
|
16
|
+
moveFileToReject: (id: string, rejectReason?: string) => void;
|
|
17
|
+
setShowReUpload: (id: string, showReUpload?: boolean) => void;
|
|
15
18
|
};
|
|
16
19
|
export declare const useFileUpload: ({ maxFiles, maxSize, accept, disabled, onValidFilesDrop, onRejectedFilesDrop, onFileClear, onClear, }: FileUploadBaseProps) => UseFileUploadReturnProps;
|
|
20
|
+
export {};
|
|
17
21
|
//# sourceMappingURL=useFileUpload.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useFileUpload.d.ts","sourceRoot":"","sources":["../../../src/hooks/useFileUpload/useFileUpload.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useFileUpload.d.ts","sourceRoot":"","sources":["../../../src/hooks/useFileUpload/useFileUpload.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,KAAK,kBAAkB,EACvB,KAAK,iB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er, initialState);
|
|
152
|
-
|
|
153
|
-
// Callbacks for when files are dropped / selected and are valid
|
|
154
152
|
const handleDropAccepted = acceptedFiles => {
|
|
155
153
|
const validFiles = acceptedFiles.map(file => ({
|
|
156
154
|
file,
|
|
@@ -168,8 +166,6 @@ const useFileUpload = _ref => {
|
|
|
168
166
|
});
|
|
169
167
|
onValidFilesDrop?.(validFiles);
|
|
170
168
|
};
|
|
171
|
-
|
|
172
|
-
// Callbacks for when files are dropped / selected and are invalid
|
|
173
169
|
const handleDropRejected = fileRejections => {
|
|
174
170
|
const rejectedFiles = fileRejections.map(_ref2 => {
|
|
175
171
|
let {
|
|
@@ -180,9 +176,7 @@ const useFileUpload = _ref => {
|
|
|
180
176
|
file,
|
|
181
177
|
id: (0, _helpers.uuid)(),
|
|
182
178
|
reject: true,
|
|
183
|
-
rejectReason:
|
|
184
|
-
// @ts-ignore - TS7053 - Element implicitly has an 'any' type because expression of type 'string' can't be used to index type '{ readonly 'file-too-large': "File exceeds maximum size"; readonly 'file-invalid-type': "Wrong file type"; readonly 'too-many-files': "Too many files"; readonly 'file-too-small': "File is too small"; }'.
|
|
185
|
-
DROPZONE_ERROR_MESSAGES[errors[0].code] || 'Some error occurred uploading this file',
|
|
179
|
+
rejectReason: DROPZONE_ERROR_MESSAGES[errors[0]?.code] ?? 'Some error occurred uploading this file',
|
|
186
180
|
success: false,
|
|
187
181
|
successMessage: undefined,
|
|
188
182
|
progress: undefined,
|
|
@@ -215,8 +209,6 @@ const useFileUpload = _ref => {
|
|
|
215
209
|
progress
|
|
216
210
|
});
|
|
217
211
|
};
|
|
218
|
-
|
|
219
|
-
// Note(Nishant): If the file is found in rejected files, we move it to valid files first in the reducer
|
|
220
212
|
const moveFileToSuccess = (id, successMessage) => {
|
|
221
213
|
dispatch({
|
|
222
214
|
type: 'SET_FILE_SUCCESS',
|
|
@@ -224,8 +216,6 @@ const useFileUpload = _ref => {
|
|
|
224
216
|
successMessage
|
|
225
217
|
});
|
|
226
218
|
};
|
|
227
|
-
|
|
228
|
-
// Note(Nishant): If the file is found in valid files, we move it to rejected files first in the reducer
|
|
229
219
|
const moveFileToReject = (id, rejectReason) => {
|
|
230
220
|
dispatch({
|
|
231
221
|
type: 'SET_FILE_REJECT',
|
|
@@ -233,8 +223,6 @@ const useFileUpload = _ref => {
|
|
|
233
223
|
rejectReason
|
|
234
224
|
});
|
|
235
225
|
};
|
|
236
|
-
|
|
237
|
-
// Note: This is used to show the re-upload button on the file
|
|
238
226
|
const setShowReUpload = (id, showReUpload) => {
|
|
239
227
|
dispatch({
|
|
240
228
|
type: 'SET_FILE_RE_UPLOAD',
|
|
@@ -244,8 +232,6 @@ const useFileUpload = _ref => {
|
|
|
244
232
|
};
|
|
245
233
|
const totalFiles = state.validFiles.length + state.rejectedFiles.length;
|
|
246
234
|
const shouldAcceptFiles = !disabled && (maxFiles === 0 || totalFiles < maxFiles);
|
|
247
|
-
|
|
248
|
-
// We are using react-dropzone's useDropzone hook to get the drag and drop props
|
|
249
235
|
const {
|
|
250
236
|
isDragActive,
|
|
251
237
|
getRootProps,
|
|
@@ -259,17 +245,14 @@ const useFileUpload = _ref => {
|
|
|
259
245
|
noClick: !shouldAcceptFiles,
|
|
260
246
|
noDrag: !shouldAcceptFiles,
|
|
261
247
|
onDropAccepted: handleDropAccepted,
|
|
262
|
-
|
|
263
|
-
onDropRejected: handleDropRejected
|
|
248
|
+
onDropRejected: (rejections, _evt) => handleDropRejected(rejections)
|
|
264
249
|
});
|
|
265
250
|
return {
|
|
266
251
|
validFiles: state.validFiles,
|
|
267
252
|
rejectedFiles: state.rejectedFiles,
|
|
268
253
|
shouldAcceptFiles,
|
|
269
254
|
isDragActive,
|
|
270
|
-
// @ts-ignore - TS2322 - Type '<T extends DropzoneRootProps>(props?: T | undefined) => T' is not assignable to type '(arg1: unknown) => unknown'.
|
|
271
255
|
getRootProps,
|
|
272
|
-
// @ts-ignore - TS2322 - Type '<T extends DropzoneInputProps>(props?: T | undefined) => T' is not assignable to type '(arg1: unknown) => unknown'.
|
|
273
256
|
getInputProps,
|
|
274
257
|
handleFileClear,
|
|
275
258
|
handleClear,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useFileUpload.stories.d.ts","sourceRoot":"","sources":["../../../src/hooks/useFileUpload/useFileUpload.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;;;;;;;;;;;;;AAe1B,wBAiPE;AAEF,eAAO,MAAM,OAAO,QAAO,KAAK,CAAC,YAAY,CAAC,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,
|
|
1
|
+
{"version":3,"file":"useFileUpload.stories.d.ts","sourceRoot":"","sources":["../../../src/hooks/useFileUpload/useFileUpload.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;;;;;;;;;;;;;AAe1B,wBAiPE;AAEF,eAAO,MAAM,OAAO,QAAO,KAAK,CAAC,YAAY,CAAC,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,CA0NxE,CAAC"}
|
|
@@ -4,14 +4,18 @@ export type GroupTitleOption<V> = {
|
|
|
4
4
|
options?: V[];
|
|
5
5
|
showLineDivider?: boolean;
|
|
6
6
|
};
|
|
7
|
-
export
|
|
7
|
+
export type BaseOption = {
|
|
8
|
+
key: string;
|
|
9
|
+
label?: string;
|
|
10
|
+
};
|
|
11
|
+
export declare function useFilteredOptions<V extends BaseOption>({ searchTerm, options, excludedKeys, groupTitleOptions, searchOptionsBy, }: {
|
|
8
12
|
searchTerm: string;
|
|
9
13
|
options?: V[];
|
|
10
14
|
groupTitleOptions?: GroupTitleOption<V>[];
|
|
11
15
|
excludedKeys?: string[];
|
|
12
16
|
searchOptionsBy?: (option: V, searchTerm: string) => boolean;
|
|
13
17
|
}): {
|
|
14
|
-
filteredOptions
|
|
15
|
-
filteredGroupTitleOptions
|
|
18
|
+
filteredOptions: V[];
|
|
19
|
+
filteredGroupTitleOptions: GroupTitleOption<V>[];
|
|
16
20
|
};
|
|
17
21
|
//# sourceMappingURL=useFilteredOptions.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useFilteredOptions.d.ts","sourceRoot":"","sources":["../../../src/hooks/useFilteredOptions/useFilteredOptions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,MAAM,MAAM,gBAAgB,CAAC,CAAC,IAAI;IAChC,UAAU,EAAE,KAAK,CAAC,SAAS,CAAC;IAC5B,OAAO,CAAC,EAAE,CAAC,EAAE,CAAC;IACd,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B,CAAC;
|
|
1
|
+
{"version":3,"file":"useFilteredOptions.d.ts","sourceRoot":"","sources":["../../../src/hooks/useFilteredOptions/useFilteredOptions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,MAAM,MAAM,gBAAgB,CAAC,CAAC,IAAI;IAChC,UAAU,EAAE,KAAK,CAAC,SAAS,CAAC;IAC5B,OAAO,CAAC,EAAE,CAAC,EAAE,CAAC;IACd,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B,CAAC;AAGF,MAAM,MAAM,UAAU,GAAG;IACvB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,wBAAgB,kBAAkB,CAAC,CAAC,SAAS,UAAU,EAAE,EACvD,UAAU,EACV,OAAY,EACZ,YAAiB,EACjB,iBAAsB,EAEtB,eAOC,GACF,EAAE;IACD,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,CAAC,EAAE,CAAC;IACd,iBAAiB,CAAC,EAAE,gBAAgB,CAAC,CAAC,CAAC,EAAE,CAAC;IAC1C,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB,eAAe,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,EAAE,UAAU,EAAE,MAAM,KAAK,OAAO,CAAC;CAC9D,GAAG;IACF,eAAe,EAAE,CAAC,EAAE,CAAC;IACrB,yBAAyB,EAAE,gBAAgB,CAAC,CAAC,CAAC,EAAE,CAAC;CAClD,CA+CA"}
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.useFilteredOptions = useFilteredOptions;
|
|
7
7
|
var React = _interopRequireWildcard(require("react"));
|
|
8
8
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
9
|
-
//
|
|
9
|
+
// Define a base type that all options must extend
|
|
10
10
|
|
|
11
11
|
function useFilteredOptions(_ref) {
|
|
12
12
|
let {
|
|
@@ -15,8 +15,6 @@ function useFilteredOptions(_ref) {
|
|
|
15
15
|
excludedKeys = [],
|
|
16
16
|
groupTitleOptions = [],
|
|
17
17
|
searchOptionsBy = (option, searchTerm) => {
|
|
18
|
-
// $FlowFixMe
|
|
19
|
-
// @ts-ignore - TS2322 - Type 'V' is not assignable to type '{ label: string; key: string; }'.
|
|
20
18
|
const {
|
|
21
19
|
label,
|
|
22
20
|
key
|
|
@@ -25,9 +23,7 @@ function useFilteredOptions(_ref) {
|
|
|
25
23
|
}
|
|
26
24
|
} = _ref;
|
|
27
25
|
// Memoize the filterExcluded function for performance
|
|
28
|
-
const filterExcluded = React.useCallback(list =>
|
|
29
|
-
//@ts-expect-error
|
|
30
|
-
list ? list.filter(option => !excludedKeys.includes(option.key)) : [], [excludedKeys]);
|
|
26
|
+
const filterExcluded = React.useCallback(list => list ? list.filter(option => !excludedKeys.includes(option.key)) : [], [excludedKeys]);
|
|
31
27
|
return React.useMemo(() => {
|
|
32
28
|
const trimmedValue = (searchTerm || '').trim().toLowerCase();
|
|
33
29
|
|
|
@@ -17,9 +17,7 @@ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r
|
|
|
17
17
|
const useInputState = function () {
|
|
18
18
|
let initialState = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
19
19
|
const [state, setState] = React.useState(initialState);
|
|
20
|
-
const setInputState = React.useCallback(
|
|
21
|
-
// @ts-ignore - TS7006 - Parameter 'event' implicitly has an 'any' type.
|
|
22
|
-
event => setState(event && event.target.value), []);
|
|
20
|
+
const setInputState = React.useCallback(event => setState(event.target.value), []);
|
|
23
21
|
return [state, setInputState];
|
|
24
22
|
};
|
|
25
23
|
exports.useInputState = useInputState;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hooks/useMountTransition/index.ts"],"names":[],"mappings":"AAGA,QAAA,MAAM,kBAAkB,GACtB,WAAW,OAAO,EAClB,cAAc,MAAM,KACnB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hooks/useMountTransition/index.ts"],"names":[],"mappings":"AAGA,QAAA,MAAM,kBAAkB,GACtB,WAAW,OAAO,EAClB,cAAc,MAAM,KACnB,OAiBF,CAAC;AAEF,eAAe,kBAAkB,CAAC"}
|
|
@@ -8,7 +8,6 @@ var _react = require("react");
|
|
|
8
8
|
const useMountTransition = (isMounted, unmountDelay) => {
|
|
9
9
|
const [isTransitioning, setIsTransitioning] = (0, _react.useState)(false);
|
|
10
10
|
(0, _react.useEffect)(() => {
|
|
11
|
-
// @ts-ignore - TS7034 - Variable 'timeoutId' implicitly has type 'any' in some locations where its type cannot be determined.
|
|
12
11
|
let timeoutId;
|
|
13
12
|
if (isMounted && !isTransitioning) {
|
|
14
13
|
setIsTransitioning(true);
|
|
@@ -16,7 +15,6 @@ const useMountTransition = (isMounted, unmountDelay) => {
|
|
|
16
15
|
timeoutId = setTimeout(() => setIsTransitioning(false), unmountDelay);
|
|
17
16
|
}
|
|
18
17
|
return () => {
|
|
19
|
-
// @ts-ignore - TS7005 - Variable 'timeoutId' implicitly has an 'any' type.
|
|
20
18
|
clearTimeout(timeoutId);
|
|
21
19
|
};
|
|
22
20
|
}, [unmountDelay, isMounted, isTransitioning]);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { PaginationBaseProps, PaginationItemProps } from '../../components/Pagination';
|
|
2
2
|
export declare const usePagination: (props: PaginationBaseProps) => {
|
|
3
|
-
items: PaginationItemProps
|
|
3
|
+
items: Array<PaginationItemProps> | null | undefined;
|
|
4
4
|
};
|
|
5
5
|
//# sourceMappingURL=usePagination.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usePagination.d.ts","sourceRoot":"","sources":["../../../src/hooks/usePagination/usePagination.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,mBAAmB,EACnB,mBAAmB,
|
|
1
|
+
{"version":3,"file":"usePagination.d.ts","sourceRoot":"","sources":["../../../src/hooks/usePagination/usePagination.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,mBAAmB,EACnB,mBAAmB,EAEpB,MAAM,6BAA6B,CAAC;AAIrC,eAAO,MAAM,aAAa,GACxB,OAAO,mBAAmB,KACzB;IACD,KAAK,EAAE,KAAK,CAAC,mBAAmB,CAAC,GAAG,IAAI,GAAG,SAAS,CAAC;CAiJtD,CAAC"}
|
|
@@ -78,7 +78,6 @@ const usePagination = props => {
|
|
|
78
78
|
// Convert the basic item list to contain PaginationItem props objects
|
|
79
79
|
const items = itemList.map((item, idx) => typeof item === 'number' ? {
|
|
80
80
|
id: idx.toString(),
|
|
81
|
-
// @ts-ignore - TS7006 - Parameter 'event' implicitly has an 'any' type.
|
|
82
81
|
onClick: event => {
|
|
83
82
|
handleClick(event, item);
|
|
84
83
|
},
|
|
@@ -88,7 +87,6 @@ const usePagination = props => {
|
|
|
88
87
|
disabled
|
|
89
88
|
} : {
|
|
90
89
|
id: idx.toString(),
|
|
91
|
-
// @ts-ignore - TS7006 - Parameter 'event' implicitly has an 'any' type.
|
|
92
90
|
onClick: event => {
|
|
93
91
|
handleClick(event, buttonPage(item));
|
|
94
92
|
},
|
|
@@ -98,7 +96,6 @@ const usePagination = props => {
|
|
|
98
96
|
disabled: disabled || item.indexOf('ellipsis') === -1 && (item === 'next' || item === 'last' ? currentPage >= totalPages : currentPage <= 1)
|
|
99
97
|
});
|
|
100
98
|
return {
|
|
101
|
-
// @ts-ignore - TS2322 - Type '{ id: string; onClick: (event: any) => void; type: string; page: number | null; selected: boolean; disabled: boolean; }[]' is not assignable to type 'PaginationItemProps[]'.
|
|
102
99
|
items
|
|
103
100
|
};
|
|
104
101
|
};
|
|
@@ -3,7 +3,7 @@ declare const _default: {
|
|
|
3
3
|
tags: string[];
|
|
4
4
|
title: string;
|
|
5
5
|
component: (props: import("../../components/Pagination").PaginationBaseProps) => {
|
|
6
|
-
items: import("../../components/Pagination").PaginationItemProps
|
|
6
|
+
items: Array<import("../../components/Pagination").PaginationItemProps> | null | undefined;
|
|
7
7
|
};
|
|
8
8
|
parameters: {
|
|
9
9
|
docs: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useResizeObserver.d.ts","sourceRoot":"","sources":["../../../src/hooks/useResizeObserver/useResizeObserver.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,wBAAgB,iBAAiB,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,
|
|
1
|
+
{"version":3,"file":"useResizeObserver.d.ts","sourceRoot":"","sources":["../../../src/hooks/useResizeObserver/useResizeObserver.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,wBAAgB,iBAAiB,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,cAAc,CAAC,EAAE,MAAM,CAAC,CA0BvE"}
|
|
@@ -14,14 +14,11 @@ function useResizeObserver() {
|
|
|
14
14
|
if (!node) {
|
|
15
15
|
return;
|
|
16
16
|
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
const resizeObserver = new ResizeObserver(_ref => {
|
|
20
|
-
let [entry] = _ref;
|
|
17
|
+
const resizeObserver = new ResizeObserver(entries => {
|
|
18
|
+
const [entry] = entries;
|
|
21
19
|
setHeight(entry.contentRect.height);
|
|
22
20
|
});
|
|
23
21
|
resizeObserver.observe(node);
|
|
24
|
-
// @ts-ignore - TS2339 - Property 'getBoundingClientRect' does not exist on type 'never'.
|
|
25
22
|
setHeight(node.getBoundingClientRect().height);
|
|
26
23
|
return () => {
|
|
27
24
|
resizeObserver.disconnect();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useToastPortal.d.ts","sourceRoot":"","sources":["../../../src/hooks/useToastPortal/useToastPortal.ts"],"names":[],"mappings":"AAMA,KAAK,cAAc,GAAG;IACpB,QAAQ,EAAE;QACR,OAAO,EAAE,cAAc,GAAG,IAAI,CAAC;KAChC,CAAC;CACH,CAAC;AAEF,eAAO,MAAM,cAAc,GAAI,eAE5B,cAAc,KAAG;IAClB,MAAM,EAAE,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"useToastPortal.d.ts","sourceRoot":"","sources":["../../../src/hooks/useToastPortal/useToastPortal.ts"],"names":[],"mappings":"AAMA,KAAK,cAAc,GAAG;IACpB,QAAQ,EAAE;QACR,OAAO,EAAE,cAAc,GAAG,IAAI,CAAC;KAChC,CAAC;CACH,CAAC;AAEF,eAAO,MAAM,cAAc,GAAI,eAE5B,cAAc,KAAG;IAClB,MAAM,EAAE,OAAO,CAAC;CAcjB,CAAC"}
|
|
@@ -12,12 +12,8 @@ const useToastPortal = _ref => {
|
|
|
12
12
|
toastRef
|
|
13
13
|
} = _ref;
|
|
14
14
|
const [loaded, setLoaded] = (0, _react.useState)(false);
|
|
15
|
-
|
|
16
|
-
// @ts-ignore - TS2345 - Argument of type '() => () => HTMLDivElement' is not assignable to parameter of type 'EffectCallback'.
|
|
17
15
|
(0, _react.useEffect)(() => {
|
|
18
16
|
const div = document.createElement('div');
|
|
19
|
-
|
|
20
|
-
// @ts-ignore - TS2540 - Cannot assign to 'style' because it is a read-only property.
|
|
21
17
|
div.style = `position: fixed; bottom: ${_space.spaceMedium}; left: ${_space.spaceMedium}; z-index: ${_elevation.elevationToast};`;
|
|
22
18
|
document.body.prepend(div);
|
|
23
19
|
toastRef.current = div;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useToggle.stories.d.ts","sourceRoot":"","sources":["../../../src/hooks/useToggle/useToggle.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAK1B,OAAO,EAAC,SAAS,EAAC,MAAM,aAAa,CAAC;;;;;;;;;;;;;AAKtC,wBA2CE;AAEF,eAAO,MAAM,OAAO,QAAO,KAAK,CAAC,YAAY,CAAC,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,
|
|
1
|
+
{"version":3,"file":"useToggle.stories.d.ts","sourceRoot":"","sources":["../../../src/hooks/useToggle/useToggle.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAK1B,OAAO,EAAC,SAAS,EAAC,MAAM,aAAa,CAAC;;;;;;;;;;;;;AAKtC,wBA2CE;AAEF,eAAO,MAAM,OAAO,QAAO,KAAK,CAAC,YAAY,CAAC,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,CAWxE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ClickAway.stories.d.ts","sourceRoot":"","sources":["../../../src/utils/click-away/ClickAway.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAO/B,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,wBAAwB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAM3D,wBA4IE;AAEF,eAAO,MAAM,UAAU;WAAU,cAAc;;;;
|
|
1
|
+
{"version":3,"file":"ClickAway.stories.d.ts","sourceRoot":"","sources":["../../../src/utils/click-away/ClickAway.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAO/B,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,wBAAwB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAM3D,wBA4IE;AAEF,eAAO,MAAM,UAAU;WAAU,cAAc;;;;CA4F9C,CAAC"}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
type BoundaryRefType<T> = React.RefObject<T | null>;
|
|
3
|
-
type TriggerRefType<T> = React.RefObject<T | null>;
|
|
4
|
-
export type ChildProps = {
|
|
2
|
+
type BoundaryRefType<T extends HTMLElement> = React.RefObject<T | null>;
|
|
3
|
+
type TriggerRefType<T extends HTMLElement> = React.RefObject<T | null>;
|
|
4
|
+
export type ChildProps<TTrigger extends HTMLElement = HTMLButtonElement, TBoundary extends HTMLElement = HTMLDivElement> = {
|
|
5
5
|
onOpen: () => void;
|
|
6
6
|
isOpen: boolean;
|
|
7
7
|
height: number | null | undefined;
|
|
8
8
|
pageBottom: number | null | undefined;
|
|
9
9
|
clickAway: () => void;
|
|
10
|
-
boundaryRef: BoundaryRefType<
|
|
11
|
-
triggerRef: TriggerRefType<
|
|
10
|
+
boundaryRef: BoundaryRefType<TBoundary>;
|
|
11
|
+
triggerRef: TriggerRefType<TTrigger>;
|
|
12
12
|
};
|
|
13
13
|
export type ClickAwayRefType = {
|
|
14
14
|
current: {
|
|
@@ -16,9 +16,9 @@ export type ClickAwayRefType = {
|
|
|
16
16
|
forceOpen: () => void;
|
|
17
17
|
} | null | undefined;
|
|
18
18
|
} | null | undefined;
|
|
19
|
-
export type ClickAwayProps = {
|
|
19
|
+
export type ClickAwayProps<TTrigger extends HTMLElement = HTMLButtonElement, TBoundary extends HTMLElement = HTMLDivElement> = {
|
|
20
20
|
closeOnEscapeKeypress?: boolean;
|
|
21
|
-
children: (props: ChildProps) => React.ReactNode;
|
|
21
|
+
children: (props: ChildProps<TTrigger, TBoundary>) => React.ReactNode;
|
|
22
22
|
onChange?: (isOpen: boolean) => unknown;
|
|
23
23
|
clickAwayRef?: ClickAwayRefType;
|
|
24
24
|
/**
|
|
@@ -49,17 +49,17 @@ type ClickAwayState = {
|
|
|
49
49
|
height: number | null | undefined;
|
|
50
50
|
pageBottom: number | null | undefined;
|
|
51
51
|
};
|
|
52
|
-
export declare class ClickAway extends React.Component<ClickAwayProps, ClickAwayState> {
|
|
52
|
+
export declare class ClickAway<TTrigger extends HTMLElement = HTMLButtonElement, TBoundary extends HTMLElement = HTMLDivElement> extends React.Component<ClickAwayProps<TTrigger, TBoundary>, ClickAwayState> {
|
|
53
53
|
static defaultProps: {
|
|
54
54
|
containsNestedFloatingPortals?: boolean;
|
|
55
55
|
closeOnEscapeKeypress?: boolean;
|
|
56
56
|
};
|
|
57
57
|
state: ClickAwayState;
|
|
58
58
|
el: HTMLElement | null | undefined;
|
|
59
|
-
boundaryRef: BoundaryRefType<
|
|
60
|
-
triggerRef: TriggerRefType<
|
|
59
|
+
boundaryRef: BoundaryRefType<TBoundary>;
|
|
60
|
+
triggerRef: TriggerRefType<TTrigger>;
|
|
61
61
|
componentDidMount(): void;
|
|
62
|
-
componentDidUpdate(_prevProps: ClickAwayProps, prevState: ClickAwayState): void;
|
|
62
|
+
componentDidUpdate(_prevProps: Readonly<ClickAwayProps<TTrigger, TBoundary>>, prevState: Readonly<ClickAwayState>): void;
|
|
63
63
|
componentWillUnmount(): void;
|
|
64
64
|
render(): React.ReactNode;
|
|
65
65
|
handleOpenClick: () => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"click-away.d.ts","sourceRoot":"","sources":["../../../src/utils/click-away/click-away.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAM/B,KAAK,eAAe,CAAC,CAAC,IAAI,KAAK,CAAC,SAAS,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"click-away.d.ts","sourceRoot":"","sources":["../../../src/utils/click-away/click-away.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAM/B,KAAK,eAAe,CAAC,CAAC,SAAS,WAAW,IAAI,KAAK,CAAC,SAAS,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC;AACxE,KAAK,cAAc,CAAC,CAAC,SAAS,WAAW,IAAI,KAAK,CAAC,SAAS,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC;AAEvE,MAAM,MAAM,UAAU,CACpB,QAAQ,SAAS,WAAW,GAAG,iBAAiB,EAChD,SAAS,SAAS,WAAW,GAAG,cAAc,IAC5C;IACF,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB,MAAM,EAAE,OAAO,CAAC;IAChB,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;IAClC,UAAU,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;IACtC,SAAS,EAAE,MAAM,IAAI,CAAC;IACtB,WAAW,EAAE,eAAe,CAAC,SAAS,CAAC,CAAC;IACxC,UAAU,EAAE,cAAc,CAAC,QAAQ,CAAC,CAAC;CACtC,CAAC;AAEF,MAAM,MAAM,gBAAgB,GACxB;IACE,OAAO,EACH;QACE,UAAU,EAAE,MAAM,IAAI,CAAC;QACvB,SAAS,EAAE,MAAM,IAAI,CAAC;KACv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AAC,cAAc,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC,EACzD,SAAS,EAAE,QAAQ,CAAC,cAAc,CAAC,GAClC,IAAI;IAyBP,oBAAoB;IAUpB,MAAM,IAAI,KAAK,CAAC,SAAS;IAoBzB,eAAe,EAAE,MAAM,IAAI,CAezB;IAEF,gBAAgB,EAAE,CAAC,GAAG,EAAE,UAAU,KAAK,IAAI,CAmCzC;IAEF,2BAA2B,EAAE,CAAC,GAAG,CAAC,EAAE,aAAa,KAAK,IAAI,CAMxD;IAEF,UAAU,EAAE,MAAM,IAAI,CAEpB;IAEF,cAAc,EAAE,MAAM,OAAO,CACmC;IAEhE,UAAU,IAAI,MAAM;CAKrB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.stories.d.ts","sourceRoot":"","sources":["../../../src/utils/helpers/helpers.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAiB,MAAM,OAAO,CAAC;;;;;;;;;;;;AAWtC,wBA+BE;AAEF,eAAO,MAAM,OAAO,QAAO,KAAK,CAAC,YAAY,CAAC,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,
|
|
1
|
+
{"version":3,"file":"helpers.stories.d.ts","sourceRoot":"","sources":["../../../src/utils/helpers/helpers.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAiB,MAAM,OAAO,CAAC;;;;;;;;;;;;AAWtC,wBA+BE;AAEF,eAAO,MAAM,OAAO,QAAO,KAAK,CAAC,YAAY,CAAC,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,CAmExE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"merge-refs.stories.d.ts","sourceRoot":"","sources":["../../../src/utils/merge-refs/merge-refs.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAyB,MAAM,OAAO,CAAC;;;;;;;;;;;;AAW9C,wBAqBE;AAEF,eAAO,MAAM,OAAO,QAAO,KAAK,CAAC,YAAY,CAAC,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,
|
|
1
|
+
{"version":3,"file":"merge-refs.stories.d.ts","sourceRoot":"","sources":["../../../src/utils/merge-refs/merge-refs.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAyB,MAAM,OAAO,CAAC;;;;;;;;;;;;AAW9C,wBAqBE;AAEF,eAAO,MAAM,OAAO,QAAO,KAAK,CAAC,YAAY,CAAC,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,CAqDxE,CAAC"}
|