@veeqo/ui 12.4.0-beta-9 → 12.4.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/components/UploadFile/UploadFile.cjs +82 -71
- package/dist/components/UploadFile/UploadFile.cjs.map +1 -1
- package/dist/components/UploadFile/UploadFile.js +85 -74
- package/dist/components/UploadFile/UploadFile.js.map +1 -1
- package/dist/components/UploadFile/UploadGraphic.cjs +14 -0
- package/dist/components/UploadFile/UploadGraphic.cjs.map +1 -0
- package/dist/components/UploadFile/UploadGraphic.d.ts +2 -0
- package/dist/components/UploadFile/UploadGraphic.js +8 -0
- package/dist/components/UploadFile/UploadGraphic.js.map +1 -0
- package/dist/components/UploadFile/components/UploadCopy/UploadCopy.cjs +6 -6
- package/dist/components/UploadFile/components/UploadCopy/UploadCopy.cjs.map +1 -1
- package/dist/components/UploadFile/components/UploadCopy/UploadCopy.js +6 -6
- package/dist/components/UploadFile/components/UploadCopy/UploadCopy.js.map +1 -1
- package/dist/components/UploadFile/components/UploadFileErrors/UploadFileErrors.cjs +31 -0
- package/dist/components/UploadFile/components/UploadFileErrors/UploadFileErrors.cjs.map +1 -0
- package/dist/components/UploadFile/components/UploadFileErrors/UploadFileErrors.d.ts +7 -0
- package/dist/components/UploadFile/components/UploadFileErrors/UploadFileErrors.js +25 -0
- package/dist/components/UploadFile/components/UploadFileErrors/UploadFileErrors.js.map +1 -0
- package/dist/components/UploadFile/components/UploadedFile/UploadedFile.cjs +5 -52
- package/dist/components/UploadFile/components/UploadedFile/UploadedFile.cjs.map +1 -1
- package/dist/components/UploadFile/components/UploadedFile/UploadedFile.d.ts +3 -7
- package/dist/components/UploadFile/components/UploadedFile/UploadedFile.js +5 -52
- package/dist/components/UploadFile/components/UploadedFile/UploadedFile.js.map +1 -1
- package/dist/components/UploadFile/components/UploadedFile/styled.cjs +20 -0
- package/dist/components/UploadFile/components/UploadedFile/styled.cjs.map +1 -0
- package/dist/components/UploadFile/components/UploadedFile/styled.d.ts +2 -0
- package/dist/components/UploadFile/components/UploadedFile/styled.js +13 -0
- package/dist/components/UploadFile/components/UploadedFile/styled.js.map +1 -0
- package/dist/components/UploadFile/constants.cjs +8 -64
- package/dist/components/UploadFile/constants.cjs.map +1 -1
- package/dist/components/UploadFile/constants.d.ts +5 -52
- package/dist/components/UploadFile/constants.js +9 -63
- package/dist/components/UploadFile/constants.js.map +1 -1
- package/dist/components/UploadFile/mocks/files.d.ts +0 -2
- package/dist/components/UploadFile/mocks/utils.d.ts +2 -1
- package/dist/components/UploadFile/styled.cjs +1 -16
- package/dist/components/UploadFile/styled.cjs.map +1 -1
- package/dist/components/UploadFile/styled.d.ts +1 -4
- package/dist/components/UploadFile/styled.js +1 -16
- package/dist/components/UploadFile/styled.js.map +1 -1
- package/dist/components/UploadFile/types.d.ts +1 -14
- package/dist/components/UploadFile/utils/getFileSizeString/getFileSizeString.cjs +11 -14
- package/dist/components/UploadFile/utils/getFileSizeString/getFileSizeString.cjs.map +1 -1
- package/dist/components/UploadFile/utils/getFileSizeString/getFileSizeString.d.ts +7 -10
- package/dist/components/UploadFile/utils/getFileSizeString/getFileSizeString.js +11 -14
- package/dist/components/UploadFile/utils/getFileSizeString/getFileSizeString.js.map +1 -1
- package/dist/components/UploadFile/utils/getValidTypesString/getValidTypesString.cjs +30 -16
- package/dist/components/UploadFile/utils/getValidTypesString/getValidTypesString.cjs.map +1 -1
- package/dist/components/UploadFile/utils/getValidTypesString/getValidTypesString.js +30 -16
- package/dist/components/UploadFile/utils/getValidTypesString/getValidTypesString.js.map +1 -1
- package/dist/components/UploadFile/utils/index.d.ts +1 -0
- package/dist/components/UploadFile/utils/setInputElFile/setInputElFile.cjs +18 -0
- package/dist/components/UploadFile/utils/setInputElFile/setInputElFile.cjs.map +1 -0
- package/dist/components/UploadFile/utils/setInputElFile/setInputElFile.d.ts +13 -0
- package/dist/components/UploadFile/utils/setInputElFile/setInputElFile.js +16 -0
- package/dist/components/UploadFile/utils/setInputElFile/setInputElFile.js.map +1 -0
- package/dist/components/ViewsContainer/ViewsContainer.cjs +37 -10
- package/dist/components/ViewsContainer/ViewsContainer.cjs.map +1 -1
- package/dist/components/ViewsContainer/ViewsContainer.js +37 -10
- package/dist/components/ViewsContainer/ViewsContainer.js.map +1 -1
- package/dist/components/ViewsContainer/ViewsContainer.module.scss.cjs +9 -0
- package/dist/components/ViewsContainer/ViewsContainer.module.scss.cjs.map +1 -0
- package/dist/components/ViewsContainer/ViewsContainer.module.scss.js +7 -0
- package/dist/components/ViewsContainer/ViewsContainer.module.scss.js.map +1 -0
- package/dist/components/ViewsContainer/hooks/useSetScrollPosition.cjs +73 -45
- package/dist/components/ViewsContainer/hooks/useSetScrollPosition.cjs.map +1 -1
- package/dist/components/ViewsContainer/hooks/useSetScrollPosition.d.ts +9 -1
- package/dist/components/ViewsContainer/hooks/useSetScrollPosition.js +74 -46
- package/dist/components/ViewsContainer/hooks/useSetScrollPosition.js.map +1 -1
- package/dist/components/ViewsContainer/types.d.ts +18 -0
- package/dist/utils/forms/form.module.scss.cjs +2 -2
- package/dist/utils/forms/form.module.scss.cjs.map +1 -1
- package/dist/utils/forms/form.module.scss.js +2 -2
- package/dist/utils/forms/form.module.scss.js.map +1 -1
- package/package.json +1 -1
- package/dist/components/UploadFile/components/DropCopy/DropCopy.cjs +0 -28
- package/dist/components/UploadFile/components/DropCopy/DropCopy.cjs.map +0 -1
- package/dist/components/UploadFile/components/DropCopy/DropCopy.d.ts +0 -2
- package/dist/components/UploadFile/components/DropCopy/DropCopy.js +0 -22
- package/dist/components/UploadFile/components/DropCopy/DropCopy.js.map +0 -1
- package/dist/components/UploadFile/components/UploadedFile/UploadedFile.module.scss.cjs +0 -9
- package/dist/components/UploadFile/components/UploadedFile/UploadedFile.module.scss.cjs.map +0 -1
- package/dist/components/UploadFile/components/UploadedFile/UploadedFile.module.scss.js +0 -7
- package/dist/components/UploadFile/components/UploadedFile/UploadedFile.module.scss.js.map +0 -1
- package/dist/components/UploadFile/hooks/useFileErrorMessages/index.d.ts +0 -1
- package/dist/components/UploadFile/hooks/useFileErrorMessages/useFileErrorMessages.cjs +0 -39
- package/dist/components/UploadFile/hooks/useFileErrorMessages/useFileErrorMessages.cjs.map +0 -1
- package/dist/components/UploadFile/hooks/useFileErrorMessages/useFileErrorMessages.d.ts +0 -13
- package/dist/components/UploadFile/hooks/useFileErrorMessages/useFileErrorMessages.js +0 -37
- package/dist/components/UploadFile/hooks/useFileErrorMessages/useFileErrorMessages.js.map +0 -1
- package/dist/components/UploadFile/hooks/usePreviewImage/index.d.ts +0 -1
- package/dist/components/UploadFile/hooks/usePreviewImage/usePreviewImage.cjs +0 -36
- package/dist/components/UploadFile/hooks/usePreviewImage/usePreviewImage.cjs.map +0 -1
- package/dist/components/UploadFile/hooks/usePreviewImage/usePreviewImage.d.ts +0 -8
- package/dist/components/UploadFile/hooks/usePreviewImage/usePreviewImage.js +0 -34
- package/dist/components/UploadFile/hooks/usePreviewImage/usePreviewImage.js.map +0 -1
- package/dist/components/UploadFile/hooks/useUploadFile/index.d.ts +0 -1
- package/dist/components/UploadFile/hooks/useUploadFile/useUploadFile.cjs +0 -65
- package/dist/components/UploadFile/hooks/useUploadFile/useUploadFile.cjs.map +0 -1
- package/dist/components/UploadFile/hooks/useUploadFile/useUploadFile.d.ts +0 -9
- package/dist/components/UploadFile/hooks/useUploadFile/useUploadFile.js +0 -63
- package/dist/components/UploadFile/hooks/useUploadFile/useUploadFile.js.map +0 -1
- package/dist/components/UploadFile/hooks/useValidateInput/index.d.ts +0 -1
- package/dist/components/UploadFile/hooks/useValidateInput/useValidateInput.cjs +0 -85
- package/dist/components/UploadFile/hooks/useValidateInput/useValidateInput.cjs.map +0 -1
- package/dist/components/UploadFile/hooks/useValidateInput/useValidateInput.d.ts +0 -13
- package/dist/components/UploadFile/hooks/useValidateInput/useValidateInput.js +0 -83
- package/dist/components/UploadFile/hooks/useValidateInput/useValidateInput.js.map +0 -1
- package/dist/components/UploadFile/mocks/mockUseUploadFile.d.ts +0 -14
- package/dist/components/UploadFile/utils/convertFileTypeToAcceptedFileExtension/convertFileTypeToAcceptedFileExtension.d.ts +0 -1
- package/dist/components/UploadFile/utils/convertFileTypeToAcceptedFileExtension/convertFileTypeToAcceptedFileType.cjs +0 -17
- package/dist/components/UploadFile/utils/convertFileTypeToAcceptedFileExtension/convertFileTypeToAcceptedFileType.cjs.map +0 -1
- package/dist/components/UploadFile/utils/convertFileTypeToAcceptedFileExtension/convertFileTypeToAcceptedFileType.d.ts +0 -1
- package/dist/components/UploadFile/utils/convertFileTypeToAcceptedFileExtension/convertFileTypeToAcceptedFileType.js +0 -15
- package/dist/components/UploadFile/utils/convertFileTypeToAcceptedFileExtension/convertFileTypeToAcceptedFileType.js.map +0 -1
- package/dist/components/UploadFile/utils/convertFileTypeToAcceptedFileExtension/index.d.ts +0 -1
- package/dist/components/UploadFile/utils/isImageType/index.d.ts +0 -1
- package/dist/components/UploadFile/utils/isImageType/isImageType.cjs +0 -14
- package/dist/components/UploadFile/utils/isImageType/isImageType.cjs.map +0 -1
- package/dist/components/UploadFile/utils/isImageType/isImageType.d.ts +0 -1
- package/dist/components/UploadFile/utils/isImageType/isImageType.js +0 -12
- package/dist/components/UploadFile/utils/isImageType/isImageType.js.map +0 -1
- package/dist/components/ViewsContainer/styled.cjs +0 -37
- package/dist/components/ViewsContainer/styled.cjs.map +0 -1
- package/dist/components/ViewsContainer/styled.d.ts +0 -34
- package/dist/components/ViewsContainer/styled.js +0 -23
- package/dist/components/ViewsContainer/styled.js.map +0 -1
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { AcceptedFileTypes } from '../../constants.js';
|
|
2
|
+
|
|
1
3
|
/**
|
|
2
4
|
* Constructs a user-friendly string of accepted types valid for the UploadFile component based on the
|
|
3
5
|
* fileTypes list passed as parameter.
|
|
@@ -17,22 +19,34 @@
|
|
|
17
19
|
* the returned string
|
|
18
20
|
*/
|
|
19
21
|
const getValidTypesString = ({ fileTypes, baseString }) => {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
22
|
+
let base = baseString == null ? 'Valid types: ' : baseString;
|
|
23
|
+
fileTypes.forEach((fileType, index, list) => {
|
|
24
|
+
const iterable = list.length > 1;
|
|
25
|
+
const isLast = index === list.length - 1 && iterable;
|
|
26
|
+
const isPenultimate = index === list.length - 2 && iterable;
|
|
27
|
+
if (isLast)
|
|
28
|
+
base += ' and ';
|
|
29
|
+
switch (fileType) {
|
|
30
|
+
case AcceptedFileTypes.CSV:
|
|
31
|
+
base += 'CSV';
|
|
32
|
+
break;
|
|
33
|
+
case AcceptedFileTypes.GIF:
|
|
34
|
+
base += 'GIF';
|
|
35
|
+
break;
|
|
36
|
+
case AcceptedFileTypes.JPEG:
|
|
37
|
+
base += 'JPEG';
|
|
38
|
+
break;
|
|
39
|
+
case AcceptedFileTypes.JPG:
|
|
40
|
+
base += 'JPG';
|
|
41
|
+
break;
|
|
42
|
+
case AcceptedFileTypes.PNG:
|
|
43
|
+
base += 'PNG';
|
|
44
|
+
break;
|
|
45
|
+
}
|
|
46
|
+
if (!isPenultimate && !isLast && list.length > 2)
|
|
47
|
+
base += ', ';
|
|
48
|
+
});
|
|
49
|
+
return base;
|
|
36
50
|
};
|
|
37
51
|
|
|
38
52
|
export { getValidTypesString };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getValidTypesString.js","sources":["../../../../../src/components/UploadFile/utils/getValidTypesString/getValidTypesString.ts"],"sourcesContent":["import { AcceptedFileTypes } from '../../constants';\n\ntype GetValidTypesStringProps = {\n fileTypes: Array<AcceptedFileTypes>;\n baseString?: string;\n};\n\n/**\n * Constructs a user-friendly string of accepted types valid for the UploadFile component based on the\n * fileTypes list passed as parameter.\n *\n * E.g.\n *\n * const validTypesCopy = getValidTypesString({\n * fileTypes: [\n * AcceptedFileTypes.CSV,\n * ]\n * });\n *\n * Where @constant validTypesCopy would equal \"Valid types: CSV\"\n *\n * @param fileTypes - A list of file types, each value being of @type AcceptedFileTypes\n * @param baseString - An optional string to override the default value of 'Valid types: ' prefixed to\n * the returned string\n */\nexport const getValidTypesString = ({ fileTypes, baseString }: GetValidTypesStringProps) => {\n
|
|
1
|
+
{"version":3,"file":"getValidTypesString.js","sources":["../../../../../src/components/UploadFile/utils/getValidTypesString/getValidTypesString.ts"],"sourcesContent":["import { AcceptedFileTypes } from '../../constants';\n\ntype GetValidTypesStringProps = {\n fileTypes: Array<AcceptedFileTypes>;\n baseString?: string;\n};\n\n/**\n * Constructs a user-friendly string of accepted types valid for the UploadFile component based on the\n * fileTypes list passed as parameter.\n *\n * E.g.\n *\n * const validTypesCopy = getValidTypesString({\n * fileTypes: [\n * AcceptedFileTypes.CSV,\n * ]\n * });\n *\n * Where @constant validTypesCopy would equal \"Valid types: CSV\"\n *\n * @param fileTypes - A list of file types, each value being of @type AcceptedFileTypes\n * @param baseString - An optional string to override the default value of 'Valid types: ' prefixed to\n * the returned string\n */\nexport const getValidTypesString = ({ fileTypes, baseString }: GetValidTypesStringProps) => {\n let base = baseString == null ? 'Valid types: ' : baseString;\n fileTypes.forEach((fileType, index, list) => {\n const iterable = list.length > 1;\n const isLast = index === list.length - 1 && iterable;\n const isPenultimate = index === list.length - 2 && iterable;\n\n if (isLast) base += ' and ';\n\n switch (fileType) {\n case AcceptedFileTypes.CSV:\n base += 'CSV';\n break;\n case AcceptedFileTypes.GIF:\n base += 'GIF';\n break;\n case AcceptedFileTypes.JPEG:\n base += 'JPEG';\n break;\n case AcceptedFileTypes.JPG:\n base += 'JPG';\n break;\n case AcceptedFileTypes.PNG:\n base += 'PNG';\n break;\n default:\n break;\n }\n\n if (!isPenultimate && !isLast && list.length > 2) base += ', ';\n });\n return base;\n};\n"],"names":[],"mappings":";;AAOA;;;;;;;;;;;;;;;;;AAiBG;AACU,MAAA,mBAAmB,GAAG,CAAC,EAAE,SAAS,EAAE,UAAU,EAA4B,KAAI;AACzF,IAAA,IAAI,IAAI,GAAG,UAAU,IAAI,IAAI,GAAG,eAAe,GAAG,UAAU;IAC5D,SAAS,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,KAAK,EAAE,IAAI,KAAI;AAC1C,QAAA,MAAM,QAAQ,GAAG,IAAI,CAAC,MAAM,GAAG,CAAC;QAChC,MAAM,MAAM,GAAG,KAAK,KAAK,IAAI,CAAC,MAAM,GAAG,CAAC,IAAI,QAAQ;QACpD,MAAM,aAAa,GAAG,KAAK,KAAK,IAAI,CAAC,MAAM,GAAG,CAAC,IAAI,QAAQ;AAE3D,QAAA,IAAI,MAAM;YAAE,IAAI,IAAI,OAAO;AAE3B,QAAA,QAAQ,QAAQ;YACd,KAAK,iBAAiB,CAAC,GAAG;gBACxB,IAAI,IAAI,KAAK;gBACb;YACF,KAAK,iBAAiB,CAAC,GAAG;gBACxB,IAAI,IAAI,KAAK;gBACb;YACF,KAAK,iBAAiB,CAAC,IAAI;gBACzB,IAAI,IAAI,MAAM;gBACd;YACF,KAAK,iBAAiB,CAAC,GAAG;gBACxB,IAAI,IAAI,KAAK;gBACb;YACF,KAAK,iBAAiB,CAAC,GAAG;gBACxB,IAAI,IAAI,KAAK;gBACb;AAGH;QAED,IAAI,CAAC,aAAa,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC;YAAE,IAAI,IAAI,IAAI;AAChE,KAAC,CAAC;AACF,IAAA,OAAO,IAAI;AACb;;;;"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
export { getValidTypesString } from './getValidTypesString/getValidTypesString';
|
|
2
2
|
export { getFileSizeString } from './getFileSizeString/getFileSizeString';
|
|
3
3
|
export { getTypePropForInputEl } from './getTypePropForInputEl/getTypePropForInputEl';
|
|
4
|
+
export { setInputElFile } from './setInputElFile/setInputElFile';
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Updates the value of the files attribute held within an input elment. Used during DnD operations where
|
|
5
|
+
* the input element's files need to kept in sync and updated.
|
|
6
|
+
*
|
|
7
|
+
* @param fileList - A list of files, typically extracted from the "files" attribute of an input element
|
|
8
|
+
* @param elementId - The ID of the input element
|
|
9
|
+
*/
|
|
10
|
+
const setInputElFile = ({ fileList, elementId }) => {
|
|
11
|
+
const inputEl = document.getElementById(elementId);
|
|
12
|
+
if (fileList.length) {
|
|
13
|
+
inputEl.files = fileList;
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
exports.setInputElFile = setInputElFile;
|
|
18
|
+
//# sourceMappingURL=setInputElFile.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setInputElFile.cjs","sources":["../../../../../src/components/UploadFile/utils/setInputElFile/setInputElFile.ts"],"sourcesContent":["type SetInputElFileProps = {\n fileList: FileList;\n elementId: string;\n};\n\n/**\n * Updates the value of the files attribute held within an input elment. Used during DnD operations where\n * the input element's files need to kept in sync and updated.\n *\n * @param fileList - A list of files, typically extracted from the \"files\" attribute of an input element\n * @param elementId - The ID of the input element\n */\nexport const setInputElFile = ({ fileList, elementId }: SetInputElFileProps) => {\n const inputEl = document.getElementById(elementId) as HTMLInputElement;\n if (fileList.length) {\n inputEl.files = fileList;\n }\n};\n"],"names":[],"mappings":";;AAKA;;;;;;AAMG;AACU,MAAA,cAAc,GAAG,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAuB,KAAI;IAC7E,MAAM,OAAO,GAAG,QAAQ,CAAC,cAAc,CAAC,SAAS,CAAqB;IACtE,IAAI,QAAQ,CAAC,MAAM,EAAE;AACnB,QAAA,OAAO,CAAC,KAAK,GAAG,QAAQ;AACzB;AACH;;;;"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
type SetInputElFileProps = {
|
|
2
|
+
fileList: FileList;
|
|
3
|
+
elementId: string;
|
|
4
|
+
};
|
|
5
|
+
/**
|
|
6
|
+
* Updates the value of the files attribute held within an input elment. Used during DnD operations where
|
|
7
|
+
* the input element's files need to kept in sync and updated.
|
|
8
|
+
*
|
|
9
|
+
* @param fileList - A list of files, typically extracted from the "files" attribute of an input element
|
|
10
|
+
* @param elementId - The ID of the input element
|
|
11
|
+
*/
|
|
12
|
+
export declare const setInputElFile: ({ fileList, elementId }: SetInputElFileProps) => void;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Updates the value of the files attribute held within an input elment. Used during DnD operations where
|
|
3
|
+
* the input element's files need to kept in sync and updated.
|
|
4
|
+
*
|
|
5
|
+
* @param fileList - A list of files, typically extracted from the "files" attribute of an input element
|
|
6
|
+
* @param elementId - The ID of the input element
|
|
7
|
+
*/
|
|
8
|
+
const setInputElFile = ({ fileList, elementId }) => {
|
|
9
|
+
const inputEl = document.getElementById(elementId);
|
|
10
|
+
if (fileList.length) {
|
|
11
|
+
inputEl.files = fileList;
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export { setInputElFile };
|
|
16
|
+
//# sourceMappingURL=setInputElFile.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setInputElFile.js","sources":["../../../../../src/components/UploadFile/utils/setInputElFile/setInputElFile.ts"],"sourcesContent":["type SetInputElFileProps = {\n fileList: FileList;\n elementId: string;\n};\n\n/**\n * Updates the value of the files attribute held within an input elment. Used during DnD operations where\n * the input element's files need to kept in sync and updated.\n *\n * @param fileList - A list of files, typically extracted from the \"files\" attribute of an input element\n * @param elementId - The ID of the input element\n */\nexport const setInputElFile = ({ fileList, elementId }: SetInputElFileProps) => {\n const inputEl = document.getElementById(elementId) as HTMLInputElement;\n if (fileList.length) {\n inputEl.files = fileList;\n }\n};\n"],"names":[],"mappings":"AAKA;;;;;;AAMG;AACU,MAAA,cAAc,GAAG,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAuB,KAAI;IAC7E,MAAM,OAAO,GAAG,QAAQ,CAAC,cAAc,CAAC,SAAS,CAAqB;IACtE,IAAI,QAAQ,CAAC,MAAM,EAAE;AACnB,QAAA,OAAO,CAAC,KAAK,GAAG,QAAQ;AACzB;AACH;;;;"}
|
|
@@ -1,23 +1,50 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var React = require('react');
|
|
4
|
-
var
|
|
4
|
+
var index = require('../../theme/index.cjs');
|
|
5
5
|
var useSetScrollPosition = require('./hooks/useSetScrollPosition.cjs');
|
|
6
|
+
var FlexRow = require('../Flex/FlexRow/FlexRow.cjs');
|
|
7
|
+
var Button = require('../Button/Button.cjs');
|
|
8
|
+
var Skeleton = require('../Skeleton/Skeleton.cjs');
|
|
9
|
+
var LeftArrowIcon = require('../../icons/design-system/components/LeftArrowIcon.cjs');
|
|
10
|
+
var RightArrowIcon = require('../../icons/design-system/components/RightArrowIcon.cjs');
|
|
11
|
+
var ThreeDotsIcon = require('../../icons/custom/components/ThreeDotsIcon.cjs');
|
|
12
|
+
var buildClassnames = require('../../utils/buildClassnames.cjs');
|
|
13
|
+
require('uid/secure');
|
|
14
|
+
var ViewsContainer_module = require('./ViewsContainer.module.scss.cjs');
|
|
15
|
+
var form_module = require('../../utils/forms/form.module.scss.cjs');
|
|
6
16
|
|
|
7
17
|
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
8
18
|
|
|
9
19
|
var React__default = /*#__PURE__*/_interopDefaultCompat(React);
|
|
10
20
|
|
|
11
|
-
const ViewsContainer = React__default.default.forwardRef(({ children, onClickMenu, ariaMenuControls, ariaMenuExpanded }, menuRef) => {
|
|
21
|
+
const ViewsContainer = React__default.default.forwardRef(({ children, className, style, onClickMenu, ariaMenuControls, ariaMenuExpanded, hasMoreViews, onFetchMoreViews, isLoadingMoreViews, compact = false, appearance = 'primary', menuButtonSlot, }, menuRef) => {
|
|
12
22
|
const viewsRef = React.useRef(null);
|
|
13
|
-
const { rightDisabled, leftDisabled, toNextScrollPosition, toPrevScrollPosition } = useSetScrollPosition.useSetScrollPosition(
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
23
|
+
const { rightDisabled, leftDisabled, toNextScrollPosition, toPrevScrollPosition } = useSetScrollPosition.useSetScrollPosition({
|
|
24
|
+
containerRef: viewsRef,
|
|
25
|
+
children,
|
|
26
|
+
hasMoreViews,
|
|
27
|
+
onFetchMoreViews,
|
|
28
|
+
isLoadingMoreViews,
|
|
29
|
+
});
|
|
30
|
+
const showCustomMenuButton = !onClickMenu && !!menuButtonSlot;
|
|
31
|
+
return (React__default.default.createElement(FlexRow.FlexRow, { className: buildClassnames.buildClassnames([ViewsContainer_module[`appearance-${appearance}`], className]), justifyContent: "between", flexWrap: "nowrap", style: style },
|
|
32
|
+
React__default.default.createElement(FlexRow.FlexRow, { className: buildClassnames.buildClassnames([ViewsContainer_module.viewsWrapper, compact && ViewsContainer_module.compact]), ref: viewsRef, id: "views", role: "tablist", gap: "sm", flexWrap: "nowrap" },
|
|
33
|
+
children,
|
|
34
|
+
isLoadingMoreViews && (React__default.default.createElement(React__default.default.Fragment, null,
|
|
35
|
+
React__default.default.createElement(Skeleton.Skeleton, { width: "80px", height: "40px" }),
|
|
36
|
+
React__default.default.createElement(Skeleton.Skeleton, { width: "80px", height: "40px" }),
|
|
37
|
+
React__default.default.createElement(Skeleton.Skeleton, { width: "80px", height: "40px" })))),
|
|
38
|
+
React__default.default.createElement(FlexRow.FlexRow, { flexWrap: "nowrap", className: buildClassnames.buildClassnames([
|
|
39
|
+
ViewsContainer_module.buttonGroup,
|
|
40
|
+
showCustomMenuButton && ViewsContainer_module.customMenuButton,
|
|
41
|
+
]) },
|
|
42
|
+
React__default.default.createElement("div", { className: form_module.inputGroup },
|
|
43
|
+
(!leftDisabled || !rightDisabled) && (React__default.default.createElement(React__default.default.Fragment, null,
|
|
44
|
+
React__default.default.createElement(Button.Button, { id: "left-arrow", className: ViewsContainer_module.scrollButton, iconSlot: React__default.default.createElement(LeftArrowIcon.ReactComponent, { color: index.theme.colors.neutral.ink.base }), disabled: leftDisabled, onClick: toPrevScrollPosition, variant: "flat", "aria-label": "move views to the left" }),
|
|
45
|
+
React__default.default.createElement(Button.Button, { id: "right-arrow", className: ViewsContainer_module.scrollButton, iconSlot: React__default.default.createElement(RightArrowIcon.ReactComponent, { color: index.theme.colors.neutral.ink.base }), disabled: rightDisabled, onClick: toNextScrollPosition, variant: "flat", "aria-label": "move views to the right" }))),
|
|
46
|
+
!menuButtonSlot && !!onClickMenu && (React__default.default.createElement(Button.Button, { className: ViewsContainer_module.menuButton, iconSlot: React__default.default.createElement(ThreeDotsIcon.ThreeDotsIcon, { color: index.theme.colors.neutral.ink.base }), variant: "flat", onClick: onClickMenu, "aria-label": "open menu", "aria-controls": ariaMenuControls, "aria-expanded": ariaMenuExpanded, "aria-haspopup": ariaMenuControls ? 'dialog' : undefined, ref: menuRef }))),
|
|
47
|
+
menuButtonSlot)));
|
|
21
48
|
});
|
|
22
49
|
|
|
23
50
|
exports.ViewsContainer = ViewsContainer;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ViewsContainer.cjs","sources":["../../../src/components/ViewsContainer/ViewsContainer.tsx"],"sourcesContent":["import React, { useRef, MutableRefObject, Ref } from 'react';\n\nimport {
|
|
1
|
+
{"version":3,"file":"ViewsContainer.cjs","sources":["../../../src/components/ViewsContainer/ViewsContainer.tsx"],"sourcesContent":["import React, { useRef, MutableRefObject, Ref, Fragment } from 'react';\n\nimport { theme } from 'Theme';\nimport { ViewContainerProps } from './types';\nimport { useSetScrollPosition } from './hooks/useSetScrollPosition';\nimport { FlexRow } from '../Flex/FlexRow';\nimport { Button } from '../Button';\nimport { Skeleton } from '../Skeleton';\nimport { LeftArrowIcon, RightArrowIcon, ThreeDotsIcon } from '../../icons';\nimport { buildClassnames } from '../../utils';\n\nimport styles from './ViewsContainer.module.scss';\nimport formStyles from '../../utils/forms/form.module.scss';\n\nexport const ViewsContainer = React.forwardRef<HTMLButtonElement, ViewContainerProps>(\n (\n {\n children,\n className,\n style,\n onClickMenu,\n ariaMenuControls,\n ariaMenuExpanded,\n hasMoreViews,\n onFetchMoreViews,\n isLoadingMoreViews,\n compact = false,\n appearance = 'primary',\n menuButtonSlot,\n }: ViewContainerProps,\n menuRef: Ref<HTMLButtonElement>,\n ) => {\n const viewsRef = useRef<HTMLDivElement>(null) as MutableRefObject<HTMLDivElement>;\n const { rightDisabled, leftDisabled, toNextScrollPosition, toPrevScrollPosition } =\n useSetScrollPosition({\n containerRef: viewsRef,\n children,\n hasMoreViews,\n onFetchMoreViews,\n isLoadingMoreViews,\n });\n\n const showCustomMenuButton = !onClickMenu && !!menuButtonSlot;\n\n return (\n <FlexRow\n className={buildClassnames([styles[`appearance-${appearance}`], className])}\n justifyContent=\"between\"\n flexWrap=\"nowrap\"\n style={style}\n >\n <FlexRow\n className={buildClassnames([styles.viewsWrapper, compact && styles.compact])}\n ref={viewsRef}\n id=\"views\"\n role=\"tablist\"\n gap=\"sm\"\n flexWrap=\"nowrap\"\n >\n {children}\n {isLoadingMoreViews && (\n <>\n <Skeleton width=\"80px\" height=\"40px\" />\n <Skeleton width=\"80px\" height=\"40px\" />\n <Skeleton width=\"80px\" height=\"40px\" />\n </>\n )}\n </FlexRow>\n\n <FlexRow\n flexWrap=\"nowrap\"\n className={buildClassnames([\n styles.buttonGroup,\n showCustomMenuButton && styles.customMenuButton,\n ])}\n >\n <div className={formStyles.inputGroup}>\n {(!leftDisabled || !rightDisabled) && (\n <>\n <Button\n id=\"left-arrow\"\n className={styles.scrollButton}\n iconSlot={<LeftArrowIcon color={theme.colors.neutral.ink.base} />}\n disabled={leftDisabled}\n onClick={toPrevScrollPosition}\n variant=\"flat\"\n aria-label=\"move views to the left\"\n />\n <Button\n id=\"right-arrow\"\n className={styles.scrollButton}\n iconSlot={<RightArrowIcon color={theme.colors.neutral.ink.base} />}\n disabled={rightDisabled}\n onClick={toNextScrollPosition}\n variant=\"flat\"\n aria-label=\"move views to the right\"\n />\n </>\n )}\n {!menuButtonSlot && !!onClickMenu && (\n <Button\n className={styles.menuButton}\n iconSlot={<ThreeDotsIcon color={theme.colors.neutral.ink.base} />}\n variant=\"flat\"\n onClick={onClickMenu}\n aria-label=\"open menu\"\n aria-controls={ariaMenuControls}\n aria-expanded={ariaMenuExpanded}\n aria-haspopup={ariaMenuControls ? 'dialog' : undefined}\n ref={menuRef}\n />\n )}\n </div>\n {menuButtonSlot}\n </FlexRow>\n </FlexRow>\n );\n },\n);\n"],"names":["React","useRef","useSetScrollPosition","FlexRow","buildClassnames","styles","Skeleton","formStyles","Button","LeftArrowIcon","theme","RightArrowIcon","ThreeDotsIcon"],"mappings":";;;;;;;;;;;;;;;;;;;;AAca,MAAA,cAAc,GAAGA,sBAAK,CAAC,UAAU,CAC5C,CACE,EACE,QAAQ,EACR,SAAS,EACT,KAAK,EACL,WAAW,EACX,gBAAgB,EAChB,gBAAgB,EAChB,YAAY,EACZ,gBAAgB,EAChB,kBAAkB,EAClB,OAAO,GAAG,KAAK,EACf,UAAU,GAAG,SAAS,EACtB,cAAc,GACK,EACrB,OAA+B,KAC7B;AACF,IAAA,MAAM,QAAQ,GAAGC,YAAM,CAAiB,IAAI,CAAqC;IACjF,MAAM,EAAE,aAAa,EAAE,YAAY,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,GAC/EC,yCAAoB,CAAC;AACnB,QAAA,YAAY,EAAE,QAAQ;QACtB,QAAQ;QACR,YAAY;QACZ,gBAAgB;QAChB,kBAAkB;AACnB,KAAA,CAAC;IAEJ,MAAM,oBAAoB,GAAG,CAAC,WAAW,IAAI,CAAC,CAAC,cAAc;AAE7D,IAAA,QACEF,sBAAA,CAAA,aAAA,CAACG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eAAA,EAChB,gBAAgB,GAAG,QAAQ,GAAG,SAAS,EACtD,GAAG,EAAE,OAAO,EAAA,CACZ,CACH,CACG;YACL,cAAc,CACP,CACF;AAEd,CAAC;;;;"}
|
|
@@ -1,17 +1,44 @@
|
|
|
1
1
|
import React__default, { useRef } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { theme } from '../../theme/index.js';
|
|
3
3
|
import { useSetScrollPosition } from './hooks/useSetScrollPosition.js';
|
|
4
|
+
import { FlexRow } from '../Flex/FlexRow/FlexRow.js';
|
|
5
|
+
import { Button } from '../Button/Button.js';
|
|
6
|
+
import { Skeleton } from '../Skeleton/Skeleton.js';
|
|
7
|
+
import { ReactComponent as LeftArrowIcon } from '../../icons/design-system/components/LeftArrowIcon.js';
|
|
8
|
+
import { ReactComponent as RightArrowIcon } from '../../icons/design-system/components/RightArrowIcon.js';
|
|
9
|
+
import { ThreeDotsIcon } from '../../icons/custom/components/ThreeDotsIcon.js';
|
|
10
|
+
import { buildClassnames } from '../../utils/buildClassnames.js';
|
|
11
|
+
import 'uid/secure';
|
|
12
|
+
import styles from './ViewsContainer.module.scss.js';
|
|
13
|
+
import formStyles from '../../utils/forms/form.module.scss.js';
|
|
4
14
|
|
|
5
|
-
const ViewsContainer = React__default.forwardRef(({ children, onClickMenu, ariaMenuControls, ariaMenuExpanded }, menuRef) => {
|
|
15
|
+
const ViewsContainer = React__default.forwardRef(({ children, className, style, onClickMenu, ariaMenuControls, ariaMenuExpanded, hasMoreViews, onFetchMoreViews, isLoadingMoreViews, compact = false, appearance = 'primary', menuButtonSlot, }, menuRef) => {
|
|
6
16
|
const viewsRef = useRef(null);
|
|
7
|
-
const { rightDisabled, leftDisabled, toNextScrollPosition, toPrevScrollPosition } = useSetScrollPosition(
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
17
|
+
const { rightDisabled, leftDisabled, toNextScrollPosition, toPrevScrollPosition } = useSetScrollPosition({
|
|
18
|
+
containerRef: viewsRef,
|
|
19
|
+
children,
|
|
20
|
+
hasMoreViews,
|
|
21
|
+
onFetchMoreViews,
|
|
22
|
+
isLoadingMoreViews,
|
|
23
|
+
});
|
|
24
|
+
const showCustomMenuButton = !onClickMenu && !!menuButtonSlot;
|
|
25
|
+
return (React__default.createElement(FlexRow, { className: buildClassnames([styles[`appearance-${appearance}`], className]), justifyContent: "between", flexWrap: "nowrap", style: style },
|
|
26
|
+
React__default.createElement(FlexRow, { className: buildClassnames([styles.viewsWrapper, compact && styles.compact]), ref: viewsRef, id: "views", role: "tablist", gap: "sm", flexWrap: "nowrap" },
|
|
27
|
+
children,
|
|
28
|
+
isLoadingMoreViews && (React__default.createElement(React__default.Fragment, null,
|
|
29
|
+
React__default.createElement(Skeleton, { width: "80px", height: "40px" }),
|
|
30
|
+
React__default.createElement(Skeleton, { width: "80px", height: "40px" }),
|
|
31
|
+
React__default.createElement(Skeleton, { width: "80px", height: "40px" })))),
|
|
32
|
+
React__default.createElement(FlexRow, { flexWrap: "nowrap", className: buildClassnames([
|
|
33
|
+
styles.buttonGroup,
|
|
34
|
+
showCustomMenuButton && styles.customMenuButton,
|
|
35
|
+
]) },
|
|
36
|
+
React__default.createElement("div", { className: formStyles.inputGroup },
|
|
37
|
+
(!leftDisabled || !rightDisabled) && (React__default.createElement(React__default.Fragment, null,
|
|
38
|
+
React__default.createElement(Button, { id: "left-arrow", className: styles.scrollButton, iconSlot: React__default.createElement(LeftArrowIcon, { color: theme.colors.neutral.ink.base }), disabled: leftDisabled, onClick: toPrevScrollPosition, variant: "flat", "aria-label": "move views to the left" }),
|
|
39
|
+
React__default.createElement(Button, { id: "right-arrow", className: styles.scrollButton, iconSlot: React__default.createElement(RightArrowIcon, { color: theme.colors.neutral.ink.base }), disabled: rightDisabled, onClick: toNextScrollPosition, variant: "flat", "aria-label": "move views to the right" }))),
|
|
40
|
+
!menuButtonSlot && !!onClickMenu && (React__default.createElement(Button, { className: styles.menuButton, iconSlot: React__default.createElement(ThreeDotsIcon, { color: theme.colors.neutral.ink.base }), variant: "flat", onClick: onClickMenu, "aria-label": "open menu", "aria-controls": ariaMenuControls, "aria-expanded": ariaMenuExpanded, "aria-haspopup": ariaMenuControls ? 'dialog' : undefined, ref: menuRef }))),
|
|
41
|
+
menuButtonSlot)));
|
|
15
42
|
});
|
|
16
43
|
|
|
17
44
|
export { ViewsContainer };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ViewsContainer.js","sources":["../../../src/components/ViewsContainer/ViewsContainer.tsx"],"sourcesContent":["import React, { useRef, MutableRefObject, Ref } from 'react';\n\nimport {
|
|
1
|
+
{"version":3,"file":"ViewsContainer.js","sources":["../../../src/components/ViewsContainer/ViewsContainer.tsx"],"sourcesContent":["import React, { useRef, MutableRefObject, Ref, Fragment } from 'react';\n\nimport { theme } from 'Theme';\nimport { ViewContainerProps } from './types';\nimport { useSetScrollPosition } from './hooks/useSetScrollPosition';\nimport { FlexRow } from '../Flex/FlexRow';\nimport { Button } from '../Button';\nimport { Skeleton } from '../Skeleton';\nimport { LeftArrowIcon, RightArrowIcon, ThreeDotsIcon } from '../../icons';\nimport { buildClassnames } from '../../utils';\n\nimport styles from './ViewsContainer.module.scss';\nimport formStyles from '../../utils/forms/form.module.scss';\n\nexport const ViewsContainer = React.forwardRef<HTMLButtonElement, ViewContainerProps>(\n (\n {\n children,\n className,\n style,\n onClickMenu,\n ariaMenuControls,\n ariaMenuExpanded,\n hasMoreViews,\n onFetchMoreViews,\n isLoadingMoreViews,\n compact = false,\n appearance = 'primary',\n menuButtonSlot,\n }: ViewContainerProps,\n menuRef: Ref<HTMLButtonElement>,\n ) => {\n const viewsRef = useRef<HTMLDivElement>(null) as MutableRefObject<HTMLDivElement>;\n const { rightDisabled, leftDisabled, toNextScrollPosition, toPrevScrollPosition } =\n useSetScrollPosition({\n containerRef: viewsRef,\n children,\n hasMoreViews,\n onFetchMoreViews,\n isLoadingMoreViews,\n });\n\n const showCustomMenuButton = !onClickMenu && !!menuButtonSlot;\n\n return (\n <FlexRow\n className={buildClassnames([styles[`appearance-${appearance}`], className])}\n justifyContent=\"between\"\n flexWrap=\"nowrap\"\n style={style}\n >\n <FlexRow\n className={buildClassnames([styles.viewsWrapper, compact && styles.compact])}\n ref={viewsRef}\n id=\"views\"\n role=\"tablist\"\n gap=\"sm\"\n flexWrap=\"nowrap\"\n >\n {children}\n {isLoadingMoreViews && (\n <>\n <Skeleton width=\"80px\" height=\"40px\" />\n <Skeleton width=\"80px\" height=\"40px\" />\n <Skeleton width=\"80px\" height=\"40px\" />\n </>\n )}\n </FlexRow>\n\n <FlexRow\n flexWrap=\"nowrap\"\n className={buildClassnames([\n styles.buttonGroup,\n showCustomMenuButton && styles.customMenuButton,\n ])}\n >\n <div className={formStyles.inputGroup}>\n {(!leftDisabled || !rightDisabled) && (\n <>\n <Button\n id=\"left-arrow\"\n className={styles.scrollButton}\n iconSlot={<LeftArrowIcon color={theme.colors.neutral.ink.base} />}\n disabled={leftDisabled}\n onClick={toPrevScrollPosition}\n variant=\"flat\"\n aria-label=\"move views to the left\"\n />\n <Button\n id=\"right-arrow\"\n className={styles.scrollButton}\n iconSlot={<RightArrowIcon color={theme.colors.neutral.ink.base} />}\n disabled={rightDisabled}\n onClick={toNextScrollPosition}\n variant=\"flat\"\n aria-label=\"move views to the right\"\n />\n </>\n )}\n {!menuButtonSlot && !!onClickMenu && (\n <Button\n className={styles.menuButton}\n iconSlot={<ThreeDotsIcon color={theme.colors.neutral.ink.base} />}\n variant=\"flat\"\n onClick={onClickMenu}\n aria-label=\"open menu\"\n aria-controls={ariaMenuControls}\n aria-expanded={ariaMenuExpanded}\n aria-haspopup={ariaMenuControls ? 'dialog' : undefined}\n ref={menuRef}\n />\n )}\n </div>\n {menuButtonSlot}\n </FlexRow>\n </FlexRow>\n );\n },\n);\n"],"names":["React"],"mappings":";;;;;;;;;;;;;;AAca,MAAA,cAAc,GAAGA,cAAK,CAAC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ClE,QAAQ,EAAE,aAAa,EACvB,OAAO,EAAE,oBAAoB,EAC7B,OAAO,EAAC,MAAM,EACH,YAAA,EAAA,yBAAyB,EACpC,CAAA,CACD,CACJ;AACA,gBAAA,CAAC,cAAc,IAAI,CAAC,CAAC,WAAW,KAC/BA,cAAA,CAAA,aAAA,CAAC,MAAM,EAAA,EACL,SAAS,EAAE,MAAM,CAAC,UAAU,EAC5B,QAAQ,EAAEA,cAAC,CAAA,aAAA,CAAA,aAAa,EAAC,EAAA,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,EAAA,CAAI,EACjE,OAAO,EAAC,MAAM,EACd,OAAO,EAAE,WAAW,EACT,YAAA,EAAA,WAAW,EACP,eAAA,EAAA,gBAAgB,mBAChB,gBAAgB,EAAA,eAAA,EAChB,gBAAgB,GAAG,QAAQ,GAAG,SAAS,EACtD,GAAG,EAAE,OAAO,EAAA,CACZ,CACH,CACG;YACL,cAAc,CACP,CACF;AAEd,CAAC;;;;"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var ___$insertStyle = require('../../_virtual/____insertStyle.cjs');
|
|
4
|
+
|
|
5
|
+
___$insertStyle("._viewsWrapper_lffdu_1 {\n overflow-x: scroll;\n -ms-overflow-style: none; /* for Internet Explorer, Edge */\n scrollbar-width: none; /* for Firefox */\n height: inherit;\n padding: var(--sizes-sm) 6px var(--sizes-sm) var(--sizes-3);\n margin-left: 0;\n}\n._viewsWrapper_lffdu_1 ::-webkit-scrollbar {\n display: none; /* for Chrome, Safari, and Opera */\n}\n._viewsWrapper_lffdu_1._compact_lffdu_12 {\n padding: var(--sizes-xs);\n}\n\n._appearance-primary_lffdu_16 {\n background-color: var(--colors-neutral-grey-lightest);\n}\n\n._menuButton_lffdu_20 {\n background-color: white !important;\n}\n._menuButton_lffdu_20:hover {\n background-color: var(--colors-neutral-grey-lightest);\n}\n\n._scrollButton_lffdu_27 {\n background-color: white !important;\n}\n._scrollButton_lffdu_27:disabled {\n background-color: white !important;\n}\n._scrollButton_lffdu_27:disabled svg {\n color: var(--colors-neutral-ink-lightest);\n}\n._scrollButton_lffdu_27:hover {\n background-color: var(--colors-neutral-grey-lightest);\n}\n\n._buttonGroup_lffdu_40 {\n padding-right: var(--sizes-sm);\n}");
|
|
6
|
+
var styles = {"viewsWrapper":"_viewsWrapper_lffdu_1","compact":"_compact_lffdu_12","appearance-primary":"_appearance-primary_lffdu_16","menuButton":"_menuButton_lffdu_20","scrollButton":"_scrollButton_lffdu_27","buttonGroup":"_buttonGroup_lffdu_40"};
|
|
7
|
+
|
|
8
|
+
module.exports = styles;
|
|
9
|
+
//# sourceMappingURL=ViewsContainer.module.scss.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ViewsContainer.module.scss.cjs","sources":["../../../src/components/ViewsContainer/ViewsContainer.module.scss"],"sourcesContent":[".viewsWrapper {\n overflow-x: scroll;\n -ms-overflow-style: none; /* for Internet Explorer, Edge */\n scrollbar-width: none; /* for Firefox */\n\n ::-webkit-scrollbar {\n display: none; /* for Chrome, Safari, and Opera */\n }\n\n height: inherit;\n padding: var(--sizes-sm) 6px var(--sizes-sm) var(--sizes-3);\n margin-left: 0;\n\n &.compact {\n padding: var(--sizes-xs);\n }\n}\n\n.appearance-primary {\n background-color: var(--colors-neutral-grey-lightest);\n}\n\n// using important to override styled-component styles on button\n.menuButton {\n background-color: white !important;\n\n &:hover {\n background-color: var(--colors-neutral-grey-lightest);\n }\n}\n\n// using important to override styled-component styles on button\n.scrollButton {\n background-color: white !important;\n\n &:disabled {\n background-color: white !important;\n & svg {\n color: var(--colors-neutral-ink-lightest);\n }\n }\n\n &:hover {\n background-color: var(--colors-neutral-grey-lightest);\n }\n}\n\n.buttonGroup {\n padding-right: var(--sizes-sm);\n}\n"],"names":[],"mappings":";;;;AACE,eAAA,CAAA,wkCAAA;AACA,aAAA,CAAA,cAAA,CAAA,uBAAA,CAAA,SAAA,CAAA,mBAAA,CAAA,oBAAA,CAAA,8BAAA,CAAA,YAAA,CAAA,sBAAA,CAAA,cAAA,CAAA,wBAAA,CAAA,aAAA,CAAA,uBAAA;;;;"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import insertStyle from '../../_virtual/____insertStyle.js';
|
|
2
|
+
|
|
3
|
+
insertStyle("._viewsWrapper_lffdu_1 {\n overflow-x: scroll;\n -ms-overflow-style: none; /* for Internet Explorer, Edge */\n scrollbar-width: none; /* for Firefox */\n height: inherit;\n padding: var(--sizes-sm) 6px var(--sizes-sm) var(--sizes-3);\n margin-left: 0;\n}\n._viewsWrapper_lffdu_1 ::-webkit-scrollbar {\n display: none; /* for Chrome, Safari, and Opera */\n}\n._viewsWrapper_lffdu_1._compact_lffdu_12 {\n padding: var(--sizes-xs);\n}\n\n._appearance-primary_lffdu_16 {\n background-color: var(--colors-neutral-grey-lightest);\n}\n\n._menuButton_lffdu_20 {\n background-color: white !important;\n}\n._menuButton_lffdu_20:hover {\n background-color: var(--colors-neutral-grey-lightest);\n}\n\n._scrollButton_lffdu_27 {\n background-color: white !important;\n}\n._scrollButton_lffdu_27:disabled {\n background-color: white !important;\n}\n._scrollButton_lffdu_27:disabled svg {\n color: var(--colors-neutral-ink-lightest);\n}\n._scrollButton_lffdu_27:hover {\n background-color: var(--colors-neutral-grey-lightest);\n}\n\n._buttonGroup_lffdu_40 {\n padding-right: var(--sizes-sm);\n}");
|
|
4
|
+
var styles = {"viewsWrapper":"_viewsWrapper_lffdu_1","compact":"_compact_lffdu_12","appearance-primary":"_appearance-primary_lffdu_16","menuButton":"_menuButton_lffdu_20","scrollButton":"_scrollButton_lffdu_27","buttonGroup":"_buttonGroup_lffdu_40"};
|
|
5
|
+
|
|
6
|
+
export { styles as default };
|
|
7
|
+
//# sourceMappingURL=ViewsContainer.module.scss.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ViewsContainer.module.scss.js","sources":["../../../src/components/ViewsContainer/ViewsContainer.module.scss"],"sourcesContent":[".viewsWrapper {\n overflow-x: scroll;\n -ms-overflow-style: none; /* for Internet Explorer, Edge */\n scrollbar-width: none; /* for Firefox */\n\n ::-webkit-scrollbar {\n display: none; /* for Chrome, Safari, and Opera */\n }\n\n height: inherit;\n padding: var(--sizes-sm) 6px var(--sizes-sm) var(--sizes-3);\n margin-left: 0;\n\n &.compact {\n padding: var(--sizes-xs);\n }\n}\n\n.appearance-primary {\n background-color: var(--colors-neutral-grey-lightest);\n}\n\n// using important to override styled-component styles on button\n.menuButton {\n background-color: white !important;\n\n &:hover {\n background-color: var(--colors-neutral-grey-lightest);\n }\n}\n\n// using important to override styled-component styles on button\n.scrollButton {\n background-color: white !important;\n\n &:disabled {\n background-color: white !important;\n & svg {\n color: var(--colors-neutral-ink-lightest);\n }\n }\n\n &:hover {\n background-color: var(--colors-neutral-grey-lightest);\n }\n}\n\n.buttonGroup {\n padding-right: var(--sizes-sm);\n}\n"],"names":["___$insertStyle"],"mappings":";;AACEA,WAAA,CAAA,wkCAAA;AACA,aAAA,CAAA,cAAA,CAAA,uBAAA,CAAA,SAAA,CAAA,mBAAA,CAAA,oBAAA,CAAA,8BAAA,CAAA,YAAA,CAAA,sBAAA,CAAA,cAAA,CAAA,wBAAA,CAAA,aAAA,CAAA,uBAAA;;;;"}
|
|
@@ -4,7 +4,7 @@ var React = require('react');
|
|
|
4
4
|
var reactUse = require('react-use');
|
|
5
5
|
var utils = require('../utils.cjs');
|
|
6
6
|
|
|
7
|
-
const useSetScrollPosition = (containerRef, children) => {
|
|
7
|
+
const useSetScrollPosition = ({ containerRef, children, hasMoreViews = false, onFetchMoreViews, isLoadingMoreViews = false, }) => {
|
|
8
8
|
var _a;
|
|
9
9
|
const [leftDisabled, setLeftDisabled] = React.useState(true);
|
|
10
10
|
const [rightDisabled, setRightDisabled] = React.useState(false);
|
|
@@ -31,11 +31,16 @@ const useSetScrollPosition = (containerRef, children) => {
|
|
|
31
31
|
(_h = document.getElementById('left-arrow')) === null || _h === undefined ? undefined : _h.focus();
|
|
32
32
|
}
|
|
33
33
|
setRightDisabled(true);
|
|
34
|
+
// Check if we've reached the end and should fetch more data
|
|
35
|
+
// Only fetches more when not already loading more views and has more views to load
|
|
36
|
+
if (hasMoreViews && onFetchMoreViews && !isLoadingMoreViews) {
|
|
37
|
+
onFetchMoreViews();
|
|
38
|
+
}
|
|
34
39
|
}
|
|
35
40
|
else {
|
|
36
41
|
setRightDisabled(false);
|
|
37
42
|
}
|
|
38
|
-
}, [containerRef]);
|
|
43
|
+
}, [containerRef, onFetchMoreViews, isLoadingMoreViews, hasMoreViews]);
|
|
39
44
|
const handleResize = React.useCallback(() => {
|
|
40
45
|
if (!containerRef.current)
|
|
41
46
|
return;
|
|
@@ -62,58 +67,81 @@ const useSetScrollPosition = (containerRef, children) => {
|
|
|
62
67
|
behavior: 'smooth',
|
|
63
68
|
});
|
|
64
69
|
}, [containerRef, viewStartPositions]);
|
|
70
|
+
// Initialize view positions when container first has children
|
|
71
|
+
React.useEffect(() => {
|
|
72
|
+
var _a, _b;
|
|
73
|
+
if (!((_b = (_a = containerRef === null || containerRef === undefined ? undefined : containerRef.current) === null || _a === undefined ? undefined : _a.children) === null || _b === undefined ? undefined : _b.length) || viewStartPositions.length > 0)
|
|
74
|
+
return;
|
|
75
|
+
setViewStartPositions(utils.createViewPositionArray(containerRef.current));
|
|
76
|
+
}, [containerRef, viewStartPositions.length]);
|
|
77
|
+
// Handle new item addition - scroll to end and update positions
|
|
78
|
+
React.useEffect(() => {
|
|
79
|
+
var _a, _b, _c, _d;
|
|
80
|
+
if (!((_b = (_a = containerRef === null || containerRef === undefined ? undefined : containerRef.current) === null || _a === undefined ? undefined : _a.children) === null || _b === undefined ? undefined : _b.length))
|
|
81
|
+
return;
|
|
82
|
+
const childrenCount = containerRef.current.children.length;
|
|
83
|
+
const positionsCount = viewStartPositions.length;
|
|
84
|
+
const totalChildren = React.Children.count(children);
|
|
85
|
+
const shouldScrollToNewItem = childrenCount !== positionsCount && positionsCount > 0 && positionsCount < totalChildren;
|
|
86
|
+
if (!shouldScrollToNewItem)
|
|
87
|
+
return;
|
|
88
|
+
containerRef.current.scrollTo({
|
|
89
|
+
left: containerRef.current.scrollWidth - containerRef.current.clientWidth,
|
|
90
|
+
top: 0,
|
|
91
|
+
behavior: 'smooth',
|
|
92
|
+
});
|
|
93
|
+
// Compute the x position of the new item
|
|
94
|
+
const lastChildRect = (_c = containerRef.current.children[positionsCount - 1]) === null || _c === undefined ? undefined : _c.getBoundingClientRect();
|
|
95
|
+
const newPosition = viewStartPositions[positionsCount - 1] + ((_d = lastChildRect === null || lastChildRect === undefined ? undefined : lastChildRect.x) !== null && _d !== undefined ? _d : 0) - 20;
|
|
96
|
+
setViewStartPositions([...viewStartPositions, newPosition]);
|
|
97
|
+
}, [containerRef, children, viewStartPositions]);
|
|
98
|
+
// Handle active tab changes - scroll to active tab
|
|
99
|
+
React.useEffect(() => {
|
|
100
|
+
var _a, _b;
|
|
101
|
+
if (!((_b = (_a = containerRef === null || containerRef === undefined ? undefined : containerRef.current) === null || _a === undefined ? undefined : _a.children) === null || _b === undefined ? undefined : _b.length))
|
|
102
|
+
return;
|
|
103
|
+
if (activeTab === prevActiveTab || activeTab === null)
|
|
104
|
+
return;
|
|
105
|
+
if (containerRef.current.children.length !== viewStartPositions.length)
|
|
106
|
+
return;
|
|
107
|
+
const index = Array.from(containerRef.current.children).indexOf(activeTab);
|
|
108
|
+
if (index === -1)
|
|
109
|
+
return;
|
|
110
|
+
containerRef.current.scrollTo({
|
|
111
|
+
left: viewStartPositions[index],
|
|
112
|
+
top: 0,
|
|
113
|
+
behavior: 'smooth',
|
|
114
|
+
});
|
|
115
|
+
}, [activeTab, prevActiveTab, containerRef, viewStartPositions]);
|
|
116
|
+
// Handle fetching more views - recompute positions
|
|
117
|
+
React.useEffect(() => {
|
|
118
|
+
var _a, _b;
|
|
119
|
+
if (!((_b = (_a = containerRef === null || containerRef === undefined ? undefined : containerRef.current) === null || _a === undefined ? undefined : _a.children) === null || _b === undefined ? undefined : _b.length))
|
|
120
|
+
return;
|
|
121
|
+
if (viewStartPositions.length >= containerRef.current.children.length)
|
|
122
|
+
return;
|
|
123
|
+
const currentScrollLeft = containerRef.current.scrollLeft;
|
|
124
|
+
// Temporarily reset scroll to 0 to get accurate positions
|
|
125
|
+
containerRef.current.scrollTo({ left: 0, top: 0, behavior: 'auto' });
|
|
126
|
+
// Recompute positions from scroll position 0
|
|
127
|
+
setViewStartPositions(utils.createViewPositionArray(containerRef.current));
|
|
128
|
+
// Restore the user's scroll position
|
|
129
|
+
containerRef.current.scrollTo({ left: currentScrollLeft, top: 0, behavior: 'auto' });
|
|
130
|
+
}, [containerRef, viewStartPositions.length]);
|
|
131
|
+
// Handle window resize and scroll event listeners
|
|
65
132
|
React.useEffect(() => {
|
|
66
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
67
133
|
if (!(containerRef === null || containerRef === undefined ? undefined : containerRef.current))
|
|
68
134
|
return;
|
|
69
|
-
|
|
70
|
-
((_b = containerRef.current.children) === null || _b === undefined ? undefined : _b.length) !== viewStartPositions.length &&
|
|
71
|
-
viewStartPositions.length > 0 &&
|
|
72
|
-
viewStartPositions.length < children.length) {
|
|
73
|
-
// scrolls to the last view, when a new item is added
|
|
74
|
-
containerRef.current.scrollTo({
|
|
75
|
-
left: containerRef.current.scrollWidth - containerRef.current.clientWidth,
|
|
76
|
-
top: 0,
|
|
77
|
-
behavior: 'smooth',
|
|
78
|
-
});
|
|
79
|
-
// computes the x position of the new item
|
|
80
|
-
setViewStartPositions([
|
|
81
|
-
...viewStartPositions,
|
|
82
|
-
viewStartPositions[viewStartPositions.length - 1] +
|
|
83
|
-
((_d = (_c = containerRef.current.children[viewStartPositions.length - 1]) === null || _c === undefined ? undefined : _c.getBoundingClientRect().x) !== null && _d !== undefined ? _d : 0) -
|
|
84
|
-
20,
|
|
85
|
-
]);
|
|
86
|
-
}
|
|
87
|
-
if (((_e = containerRef.current.children) === null || _e === undefined ? undefined : _e.length) && viewStartPositions.length === 0) {
|
|
88
|
-
setViewStartPositions(utils.createViewPositionArray(containerRef.current));
|
|
89
|
-
}
|
|
90
|
-
// scrolls to active tab when page loads
|
|
91
|
-
if (activeTab !== prevActiveTab &&
|
|
92
|
-
activeTab !== null &&
|
|
93
|
-
((_f = containerRef.current.children) === null || _f === undefined ? undefined : _f.length) === viewStartPositions.length) {
|
|
94
|
-
const index = Array.from(containerRef.current.children).indexOf(activeTab);
|
|
95
|
-
containerRef.current.scrollTo({
|
|
96
|
-
left: viewStartPositions[index],
|
|
97
|
-
top: 0,
|
|
98
|
-
behavior: 'smooth',
|
|
99
|
-
});
|
|
100
|
-
}
|
|
135
|
+
const container = containerRef.current;
|
|
101
136
|
handleResize();
|
|
102
137
|
window.addEventListener('resize', handleResize);
|
|
103
|
-
|
|
138
|
+
container.addEventListener('scroll', handleScroll);
|
|
104
139
|
// eslint-disable-next-line consistent-return
|
|
105
140
|
return () => {
|
|
106
141
|
window.removeEventListener('resize', handleResize);
|
|
142
|
+
container.removeEventListener('scroll', handleScroll);
|
|
107
143
|
};
|
|
108
|
-
}, [
|
|
109
|
-
containerRef,
|
|
110
|
-
children,
|
|
111
|
-
handleResize,
|
|
112
|
-
handleScroll,
|
|
113
|
-
viewStartPositions,
|
|
114
|
-
activeTab,
|
|
115
|
-
prevActiveTab,
|
|
116
|
-
]);
|
|
144
|
+
}, [containerRef, handleResize, handleScroll]);
|
|
117
145
|
return { rightDisabled, leftDisabled, toNextScrollPosition, toPrevScrollPosition };
|
|
118
146
|
};
|
|
119
147
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useSetScrollPosition.cjs","sources":["../../../../src/components/ViewsContainer/hooks/useSetScrollPosition.ts"],"sourcesContent":["import { MutableRefObject, ReactNode, useCallback, useEffect, useState } from 'react';\nimport { usePrevious } from 'react-use';\nimport { createViewPositionArray, getNextViewPosition, getPrevViewPosition } from '../utils';\n\nexport const useSetScrollPosition = (\n containerRef: MutableRefObject<HTMLDivElement>,\n children: ReactNode,\n) => {\n const [leftDisabled, setLeftDisabled] = useState(true);\n const [rightDisabled, setRightDisabled] = useState(false);\n const [viewStartPositions, setViewStartPositions] = useState<number[]>([]);\n\n const activeTab = containerRef?.current?.querySelector('[aria-selected = true]');\n const prevActiveTab = usePrevious(activeTab);\n\n const handleScroll = useCallback(() => {\n if (containerRef.current?.scrollLeft > 0) {\n setLeftDisabled(false);\n } else {\n if (document.getElementById('left-arrow') === document.activeElement) {\n document.getElementById('right-arrow')?.focus();\n }\n setLeftDisabled(true);\n }\n\n const maxScrollWidth = containerRef.current?.scrollWidth ?? 0;\n const maxClientWidth = containerRef.current?.clientWidth ?? 0;\n const maxScrollLeft = maxScrollWidth - maxClientWidth;\n\n // -10 to prevent javascript assertion errors on floating points\n if (containerRef.current?.scrollLeft >= maxScrollLeft - 10) {\n if (document.getElementById('right-arrow') === document.activeElement) {\n document.getElementById('left-arrow')?.focus();\n }\n setRightDisabled(true);\n } else {\n setRightDisabled(false);\n }\n }, [containerRef]);\n\n const handleResize = useCallback(() => {\n if (!containerRef.current) return;\n if (containerRef.current.scrollWidth - containerRef.current.getBoundingClientRect().width < 5) {\n setRightDisabled(true);\n } else {\n setRightDisabled(false);\n }\n }, [containerRef]);\n\n const toNextScrollPosition = useCallback(() => {\n const newPosition = getNextViewPosition(\n viewStartPositions,\n containerRef.current.scrollLeft,\n containerRef.current.clientWidth,\n );\n\n containerRef.current.scrollTo({\n left: newPosition,\n top: 0,\n behavior: 'smooth',\n });\n }, [containerRef, viewStartPositions]);\n\n const toPrevScrollPosition = useCallback(() => {\n const newPosition = getPrevViewPosition(viewStartPositions, containerRef.current.scrollLeft);\n\n containerRef.current.scrollTo({\n left: newPosition,\n top: 0,\n behavior: 'smooth',\n });\n }, [containerRef, viewStartPositions]);\n\n useEffect(() => {\n if (!containerRef?.current) return;\n\n if (\n containerRef.current.children?.length &&\n containerRef.current.children?.length !== viewStartPositions.length &&\n viewStartPositions.length > 0 &&\n viewStartPositions.length < (children as ReactNode[]).length\n ) {\n // scrolls to the last view, when a new item is added\n containerRef.current.scrollTo({\n left: containerRef.current.scrollWidth - containerRef.current.clientWidth,\n top: 0,\n behavior: 'smooth',\n });\n // computes the x position of the new item\n setViewStartPositions([\n ...viewStartPositions,\n viewStartPositions[viewStartPositions.length - 1] +\n (containerRef.current.children[viewStartPositions.length - 1]?.getBoundingClientRect()\n .x ?? 0) -\n 20,\n ]);\n }\n\n if (containerRef.current.children?.length && viewStartPositions.length === 0) {\n setViewStartPositions(createViewPositionArray(containerRef.current));\n }\n\n // scrolls to active tab when page loads\n if (\n activeTab !== prevActiveTab &&\n activeTab !== null &&\n containerRef.current.children?.length === viewStartPositions.length\n ) {\n const index = Array.from(containerRef.current.children).indexOf(activeTab);\n\n containerRef.current.scrollTo({\n left: viewStartPositions[index],\n top: 0,\n behavior: 'smooth',\n });\n }\n\n handleResize();\n window.addEventListener('resize', handleResize);\n containerRef.current?.addEventListener('scroll', handleScroll);\n\n // eslint-disable-next-line consistent-return\n return () => {\n window.removeEventListener('resize', handleResize);\n };\n }, [\n containerRef,\n children,\n handleResize,\n handleScroll,\n viewStartPositions,\n activeTab,\n prevActiveTab,\n ]);\n\n return { rightDisabled, leftDisabled, toNextScrollPosition, toPrevScrollPosition };\n};\n"],"names":["useState","usePrevious","useCallback","getNextViewPosition","getPrevViewPosition","useEffect","createViewPositionArray"],"mappings":";;;;;;MAIa,oBAAoB,GAAG,CAClC,YAA8C,EAC9C,QAAmB,KACjB;;IACF,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,GAAGA,cAAQ,CAAC,IAAI,CAAC;IACtD,MAAM,CAAC,aAAa,EAAE,gBAAgB,CAAC,GAAGA,cAAQ,CAAC,KAAK,CAAC;IACzD,MAAM,CAAC,kBAAkB,EAAE,qBAAqB,CAAC,GAAGA,cAAQ,CAAW,EAAE,CAAC;AAE1E,IAAA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AA,GAAA,SAAA,GAAA,EAAA,CAAA,gBAAgB,CAAC,QAAQ,EAAE,YAAY,CAAC;;AAG9D,QAAA,OAAO,MAAK;AACV,YAAA,MAAM,CAAC,mBAAmB,CAAC,QAAQ,EAAE,YAAY,CAAC;AACpD,SAAC;AACH,KAAC,EAAE;QACD,YAAY;QACZ,QAAQ;QACR,YAAY;QACZ,YAAY;QACZ,kBAAkB;QAClB,SAAS;QACT,aAAa;AACd,KAAA,CAAC;IAEF,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,oBAAoB,EAAE,oBAAoB,EAAE;AACpF;;;;"}
|
|
1
|
+
{"version":3,"file":"useSetScrollPosition.cjs","sources":["../../../../src/components/ViewsContainer/hooks/useSetScrollPosition.ts"],"sourcesContent":["import { MutableRefObject, ReactNode, useCallback, useEffect, useState, Children } from 'react';\nimport { usePrevious } from 'react-use';\nimport { createViewPositionArray, getNextViewPosition, getPrevViewPosition } from '../utils';\n\ntype UseSetScrollPositionProps = {\n containerRef: MutableRefObject<HTMLDivElement>;\n children: ReactNode;\n hasMoreViews?: boolean;\n onFetchMoreViews?: () => void;\n isLoadingMoreViews?: boolean;\n};\n\nexport const useSetScrollPosition = ({\n containerRef,\n children,\n hasMoreViews = false,\n onFetchMoreViews,\n isLoadingMoreViews = false,\n}: UseSetScrollPositionProps) => {\n const [leftDisabled, setLeftDisabled] = useState(true);\n const [rightDisabled, setRightDisabled] = useState(false);\n const [viewStartPositions, setViewStartPositions] = useState<number[]>([]);\n\n const activeTab = containerRef?.current?.querySelector('[aria-selected = true]');\n const prevActiveTab = usePrevious(activeTab);\n\n const handleScroll = useCallback(() => {\n if (containerRef.current?.scrollLeft > 0) {\n setLeftDisabled(false);\n } else {\n if (document.getElementById('left-arrow') === document.activeElement) {\n document.getElementById('right-arrow')?.focus();\n }\n setLeftDisabled(true);\n }\n\n const maxScrollWidth = containerRef.current?.scrollWidth ?? 0;\n const maxClientWidth = containerRef.current?.clientWidth ?? 0;\n const maxScrollLeft = maxScrollWidth - maxClientWidth;\n\n // -10 to prevent javascript assertion errors on floating points\n if (containerRef.current?.scrollLeft >= maxScrollLeft - 10) {\n if (document.getElementById('right-arrow') === document.activeElement) {\n document.getElementById('left-arrow')?.focus();\n }\n setRightDisabled(true);\n\n // Check if we've reached the end and should fetch more data\n // Only fetches more when not already loading more views and has more views to load\n if (hasMoreViews && onFetchMoreViews && !isLoadingMoreViews) {\n onFetchMoreViews();\n }\n } else {\n setRightDisabled(false);\n }\n }, [containerRef, onFetchMoreViews, isLoadingMoreViews, hasMoreViews]);\n\n const handleResize = useCallback(() => {\n if (!containerRef.current) return;\n if (containerRef.current.scrollWidth - containerRef.current.getBoundingClientRect().width < 5) {\n setRightDisabled(true);\n } else {\n setRightDisabled(false);\n }\n }, [containerRef]);\n\n const toNextScrollPosition = useCallback(() => {\n const newPosition = getNextViewPosition(\n viewStartPositions,\n containerRef.current.scrollLeft,\n containerRef.current.clientWidth,\n );\n\n containerRef.current.scrollTo({\n left: newPosition,\n top: 0,\n behavior: 'smooth',\n });\n }, [containerRef, viewStartPositions]);\n\n const toPrevScrollPosition = useCallback(() => {\n const newPosition = getPrevViewPosition(viewStartPositions, containerRef.current.scrollLeft);\n\n containerRef.current.scrollTo({\n left: newPosition,\n top: 0,\n behavior: 'smooth',\n });\n }, [containerRef, viewStartPositions]);\n\n // Initialize view positions when container first has children\n useEffect(() => {\n if (!containerRef?.current?.children?.length || viewStartPositions.length > 0) return;\n\n setViewStartPositions(createViewPositionArray(containerRef.current));\n }, [containerRef, viewStartPositions.length]);\n\n // Handle new item addition - scroll to end and update positions\n useEffect(() => {\n if (!containerRef?.current?.children?.length) return;\n\n const childrenCount = containerRef.current.children.length;\n const positionsCount = viewStartPositions.length;\n const totalChildren = Children.count(children);\n\n const shouldScrollToNewItem =\n childrenCount !== positionsCount && positionsCount > 0 && positionsCount < totalChildren;\n\n if (!shouldScrollToNewItem) return;\n\n containerRef.current.scrollTo({\n left: containerRef.current.scrollWidth - containerRef.current.clientWidth,\n top: 0,\n behavior: 'smooth',\n });\n\n // Compute the x position of the new item\n const lastChildRect =\n containerRef.current.children[positionsCount - 1]?.getBoundingClientRect();\n const newPosition = viewStartPositions[positionsCount - 1] + (lastChildRect?.x ?? 0) - 20;\n\n setViewStartPositions([...viewStartPositions, newPosition]);\n }, [containerRef, children, viewStartPositions]);\n\n // Handle active tab changes - scroll to active tab\n useEffect(() => {\n if (!containerRef?.current?.children?.length) return;\n if (activeTab === prevActiveTab || activeTab === null) return;\n if (containerRef.current.children.length !== viewStartPositions.length) return;\n\n const index = Array.from(containerRef.current.children).indexOf(activeTab);\n if (index === -1) return;\n\n containerRef.current.scrollTo({\n left: viewStartPositions[index],\n top: 0,\n behavior: 'smooth',\n });\n }, [activeTab, prevActiveTab, containerRef, viewStartPositions]);\n\n // Handle fetching more views - recompute positions\n useEffect(() => {\n if (!containerRef?.current?.children?.length) return;\n if (viewStartPositions.length >= containerRef.current.children.length) return;\n\n const currentScrollLeft = containerRef.current.scrollLeft;\n\n // Temporarily reset scroll to 0 to get accurate positions\n containerRef.current.scrollTo({ left: 0, top: 0, behavior: 'auto' });\n\n // Recompute positions from scroll position 0\n setViewStartPositions(createViewPositionArray(containerRef.current));\n\n // Restore the user's scroll position\n containerRef.current.scrollTo({ left: currentScrollLeft, top: 0, behavior: 'auto' });\n }, [containerRef, viewStartPositions.length]);\n\n // Handle window resize and scroll event listeners\n useEffect(() => {\n if (!containerRef?.current) return;\n\n const container = containerRef.current;\n\n handleResize();\n window.addEventListener('resize', handleResize);\n container.addEventListener('scroll', handleScroll);\n\n // eslint-disable-next-line consistent-return\n return () => {\n window.removeEventListener('resize', handleResize);\n container.removeEventListener('scroll', handleScroll);\n };\n }, [containerRef, handleResize, handleScroll]);\n\n return { rightDisabled, leftDisabled, toNextScrollPosition, toPrevScrollPosition };\n};\n"],"names":["useState","usePrevious","useCallback","getNextViewPosition","getPrevViewPosition","useEffect","createViewPositionArray","Children"],"mappings":";;;;;;MAYa,oBAAo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