@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.
@@ -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
- return depthAttribute ? Number.parseInt(depthAttribute, 10) : 0;
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.
@@ -38,7 +38,7 @@ type TextStyleProperty =
38
38
  | 'fontVariationSettings'
39
39
  | 'fontWeight'
40
40
  | 'hangingPunctuation'
41
- | 'hypens'
41
+ | 'hyphens'
42
42
  | 'hyphenateCharacter'
43
43
  | 'hyphenateLimitChars'
44
44
  | 'letterSpacing'