@moneyforward/mfui-components 4.2.0 → 4.3.1
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/src/DateTimeSelection/shared/CalendarGrid/utilities/computeDataForStyling.js +2 -4
- package/dist/src/FileDropZone/FileDropZone.d.ts +5 -1
- package/dist/src/FileDropZone/FileDropZone.js +26 -6
- package/dist/src/FileDropZone/FileDropZone.types.d.ts +10 -0
- package/dist/src/NumberBox/NumberBox.js +2 -1
- package/dist/src/Popover/Popover.js +2 -1
- package/dist/src/SidePane/hooks/useSidePaneStateController.js +3 -5
- package/dist/src/SplitView/utils/parseSize.d.ts +1 -1
- package/dist/src/SplitView/utils/parseSize.js +4 -2
- package/dist/src/Tabs/TabContext.d.ts +3 -1
- package/dist/src/Tabs/TabContext.js +1 -0
- package/dist/src/Tabs/TabItem/TabItem.js +14 -3
- package/dist/src/Tabs/Tabs.js +5 -21
- package/dist/src/Tabs/hooks/useTabRegistry.d.ts +24 -0
- package/dist/src/Tabs/hooks/useTabRegistry.js +130 -0
- package/dist/src/Toast/api/toast.d.ts +34 -0
- package/dist/src/Toast/api/toast.js +41 -0
- package/dist/src/Tooltip/hooks/useOpenStateDelayed.js +2 -2
- package/dist/src/utilities/dom/setInputFiles.d.ts +21 -0
- package/dist/src/utilities/dom/setInputFiles.js +41 -0
- package/dist/src/utilities/dom/toFileList.d.ts +20 -0
- package/dist/src/utilities/dom/toFileList.js +26 -0
- package/dist/src/utilities/dom/useFixedColumns.js +4 -2
- package/dist/src/utilities/dom/useOnClickOutside.js +3 -1
- package/dist/styled-system/types/composition.d.ts +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +4 -4
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Builds a `FileList` from an array of files.
|
|
3
|
+
*
|
|
4
|
+
* `FileList` cannot be constructed: the only ways to obtain one are a user selection on a file
|
|
5
|
+
* input, a drag operation, or a `DataTransfer`. Code that has to hand a `FileList` to an API it
|
|
6
|
+
* does not control, without a `DataTransfer` available, therefore has to assemble the shape by
|
|
7
|
+
* hand. Every member of the interface is implemented, so index access, `item()`, `length` and
|
|
8
|
+
* iteration all behave as they do on a native list.
|
|
9
|
+
*
|
|
10
|
+
* The result is not an instance of `FileList`, so `instanceof` is `false` and it is rejected by
|
|
11
|
+
* APIs that check the brand rather than the shape, `HTMLInputElement.files` among them. Prefer
|
|
12
|
+
* {@link setInputFiles} whenever the destination is a file input.
|
|
13
|
+
*
|
|
14
|
+
* @param files - The files the list should contain, in order
|
|
15
|
+
*
|
|
16
|
+
* @returns A `FileList` holding the given files
|
|
17
|
+
*
|
|
18
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/FileList
|
|
19
|
+
*/
|
|
20
|
+
export declare const toFileList: (files: readonly File[]) => FileList;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Builds a `FileList` from an array of files.
|
|
3
|
+
*
|
|
4
|
+
* `FileList` cannot be constructed: the only ways to obtain one are a user selection on a file
|
|
5
|
+
* input, a drag operation, or a `DataTransfer`. Code that has to hand a `FileList` to an API it
|
|
6
|
+
* does not control, without a `DataTransfer` available, therefore has to assemble the shape by
|
|
7
|
+
* hand. Every member of the interface is implemented, so index access, `item()`, `length` and
|
|
8
|
+
* iteration all behave as they do on a native list.
|
|
9
|
+
*
|
|
10
|
+
* The result is not an instance of `FileList`, so `instanceof` is `false` and it is rejected by
|
|
11
|
+
* APIs that check the brand rather than the shape, `HTMLInputElement.files` among them. Prefer
|
|
12
|
+
* {@link setInputFiles} whenever the destination is a file input.
|
|
13
|
+
*
|
|
14
|
+
* @param files - The files the list should contain, in order
|
|
15
|
+
*
|
|
16
|
+
* @returns A `FileList` holding the given files
|
|
17
|
+
*
|
|
18
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/FileList
|
|
19
|
+
*/
|
|
20
|
+
export const toFileList = (files) => ({
|
|
21
|
+
// eslint-disable-next-line no-misused-spread -- Spreading the array to indexed keys is exactly the `[index: number]: File` half of the FileList contract
|
|
22
|
+
...files,
|
|
23
|
+
length: files.length,
|
|
24
|
+
item: (index) => files[index] ?? null,
|
|
25
|
+
[Symbol.iterator]: () => files[Symbol.iterator](),
|
|
26
|
+
});
|
|
@@ -21,12 +21,14 @@ export const useFixedColumns = ({ enableRowSelection = false, columnIndex, leftF
|
|
|
21
21
|
return 'left';
|
|
22
22
|
if (leftFixedColumnIndex !== undefined &&
|
|
23
23
|
actualColumnIndex !== undefined &&
|
|
24
|
-
actualColumnIndex <= leftFixedColumnIndex)
|
|
24
|
+
actualColumnIndex <= leftFixedColumnIndex) {
|
|
25
25
|
return 'left';
|
|
26
|
+
}
|
|
26
27
|
if (rightFixedColumnIndex !== undefined &&
|
|
27
28
|
actualColumnIndex !== undefined &&
|
|
28
|
-
actualColumnIndex >= rightFixedColumnIndex)
|
|
29
|
+
actualColumnIndex >= rightFixedColumnIndex) {
|
|
29
30
|
return 'right';
|
|
31
|
+
}
|
|
30
32
|
// Without this, "Not all code paths return a value. ts(7030)" warning occurs.
|
|
31
33
|
// eslint-disable-next-line no-useless-return
|
|
32
34
|
return;
|
|
@@ -8,7 +8,9 @@ import { getRootNode } from './getRootNode';
|
|
|
8
8
|
*/
|
|
9
9
|
const getPortalNestingDepth = (portalElement) => {
|
|
10
10
|
const depthAttribute = portalElement.dataset['mfuiPopoverDepth'];
|
|
11
|
-
|
|
11
|
+
// The attribute is written by this package as a stringified integer, so plain `Number`
|
|
12
|
+
// is equivalent to the previous `Number.parseInt(_, 10)` here.
|
|
13
|
+
return depthAttribute ? Number(depthAttribute) : 0;
|
|
12
14
|
};
|
|
13
15
|
/**
|
|
14
16
|
* Helper function to get the nesting depth of a popover container element.
|