@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.
Files changed (127) hide show
  1. package/dist/components/UploadFile/UploadFile.cjs +82 -71
  2. package/dist/components/UploadFile/UploadFile.cjs.map +1 -1
  3. package/dist/components/UploadFile/UploadFile.js +85 -74
  4. package/dist/components/UploadFile/UploadFile.js.map +1 -1
  5. package/dist/components/UploadFile/UploadGraphic.cjs +14 -0
  6. package/dist/components/UploadFile/UploadGraphic.cjs.map +1 -0
  7. package/dist/components/UploadFile/UploadGraphic.d.ts +2 -0
  8. package/dist/components/UploadFile/UploadGraphic.js +8 -0
  9. package/dist/components/UploadFile/UploadGraphic.js.map +1 -0
  10. package/dist/components/UploadFile/components/UploadCopy/UploadCopy.cjs +6 -6
  11. package/dist/components/UploadFile/components/UploadCopy/UploadCopy.cjs.map +1 -1
  12. package/dist/components/UploadFile/components/UploadCopy/UploadCopy.js +6 -6
  13. package/dist/components/UploadFile/components/UploadCopy/UploadCopy.js.map +1 -1
  14. package/dist/components/UploadFile/components/UploadFileErrors/UploadFileErrors.cjs +31 -0
  15. package/dist/components/UploadFile/components/UploadFileErrors/UploadFileErrors.cjs.map +1 -0
  16. package/dist/components/UploadFile/components/UploadFileErrors/UploadFileErrors.d.ts +7 -0
  17. package/dist/components/UploadFile/components/UploadFileErrors/UploadFileErrors.js +25 -0
  18. package/dist/components/UploadFile/components/UploadFileErrors/UploadFileErrors.js.map +1 -0
  19. package/dist/components/UploadFile/components/UploadedFile/UploadedFile.cjs +5 -52
  20. package/dist/components/UploadFile/components/UploadedFile/UploadedFile.cjs.map +1 -1
  21. package/dist/components/UploadFile/components/UploadedFile/UploadedFile.d.ts +3 -7
  22. package/dist/components/UploadFile/components/UploadedFile/UploadedFile.js +5 -52
  23. package/dist/components/UploadFile/components/UploadedFile/UploadedFile.js.map +1 -1
  24. package/dist/components/UploadFile/components/UploadedFile/styled.cjs +20 -0
  25. package/dist/components/UploadFile/components/UploadedFile/styled.cjs.map +1 -0
  26. package/dist/components/UploadFile/components/UploadedFile/styled.d.ts +2 -0
  27. package/dist/components/UploadFile/components/UploadedFile/styled.js +13 -0
  28. package/dist/components/UploadFile/components/UploadedFile/styled.js.map +1 -0
  29. package/dist/components/UploadFile/constants.cjs +8 -64
  30. package/dist/components/UploadFile/constants.cjs.map +1 -1
  31. package/dist/components/UploadFile/constants.d.ts +5 -52
  32. package/dist/components/UploadFile/constants.js +9 -63
  33. package/dist/components/UploadFile/constants.js.map +1 -1
  34. package/dist/components/UploadFile/mocks/files.d.ts +0 -2
  35. package/dist/components/UploadFile/mocks/utils.d.ts +2 -1
  36. package/dist/components/UploadFile/styled.cjs +1 -16
  37. package/dist/components/UploadFile/styled.cjs.map +1 -1
  38. package/dist/components/UploadFile/styled.d.ts +1 -4
  39. package/dist/components/UploadFile/styled.js +1 -16
  40. package/dist/components/UploadFile/styled.js.map +1 -1
  41. package/dist/components/UploadFile/types.d.ts +1 -14
  42. package/dist/components/UploadFile/utils/getFileSizeString/getFileSizeString.cjs +11 -14
  43. package/dist/components/UploadFile/utils/getFileSizeString/getFileSizeString.cjs.map +1 -1
  44. package/dist/components/UploadFile/utils/getFileSizeString/getFileSizeString.d.ts +7 -10
  45. package/dist/components/UploadFile/utils/getFileSizeString/getFileSizeString.js +11 -14
  46. package/dist/components/UploadFile/utils/getFileSizeString/getFileSizeString.js.map +1 -1
  47. package/dist/components/UploadFile/utils/getValidTypesString/getValidTypesString.cjs +30 -16
  48. package/dist/components/UploadFile/utils/getValidTypesString/getValidTypesString.cjs.map +1 -1
  49. package/dist/components/UploadFile/utils/getValidTypesString/getValidTypesString.js +30 -16
  50. package/dist/components/UploadFile/utils/getValidTypesString/getValidTypesString.js.map +1 -1
  51. package/dist/components/UploadFile/utils/index.d.ts +1 -0
  52. package/dist/components/UploadFile/utils/setInputElFile/setInputElFile.cjs +18 -0
  53. package/dist/components/UploadFile/utils/setInputElFile/setInputElFile.cjs.map +1 -0
  54. package/dist/components/UploadFile/utils/setInputElFile/setInputElFile.d.ts +13 -0
  55. package/dist/components/UploadFile/utils/setInputElFile/setInputElFile.js +16 -0
  56. package/dist/components/UploadFile/utils/setInputElFile/setInputElFile.js.map +1 -0
  57. package/dist/components/ViewsContainer/ViewsContainer.cjs +37 -10
  58. package/dist/components/ViewsContainer/ViewsContainer.cjs.map +1 -1
  59. package/dist/components/ViewsContainer/ViewsContainer.js +37 -10
  60. package/dist/components/ViewsContainer/ViewsContainer.js.map +1 -1
  61. package/dist/components/ViewsContainer/ViewsContainer.module.scss.cjs +9 -0
  62. package/dist/components/ViewsContainer/ViewsContainer.module.scss.cjs.map +1 -0
  63. package/dist/components/ViewsContainer/ViewsContainer.module.scss.js +7 -0
  64. package/dist/components/ViewsContainer/ViewsContainer.module.scss.js.map +1 -0
  65. package/dist/components/ViewsContainer/hooks/useSetScrollPosition.cjs +73 -45
  66. package/dist/components/ViewsContainer/hooks/useSetScrollPosition.cjs.map +1 -1
  67. package/dist/components/ViewsContainer/hooks/useSetScrollPosition.d.ts +9 -1
  68. package/dist/components/ViewsContainer/hooks/useSetScrollPosition.js +74 -46
  69. package/dist/components/ViewsContainer/hooks/useSetScrollPosition.js.map +1 -1
  70. package/dist/components/ViewsContainer/types.d.ts +18 -0
  71. package/dist/utils/forms/form.module.scss.cjs +2 -2
  72. package/dist/utils/forms/form.module.scss.cjs.map +1 -1
  73. package/dist/utils/forms/form.module.scss.js +2 -2
  74. package/dist/utils/forms/form.module.scss.js.map +1 -1
  75. package/package.json +1 -1
  76. package/dist/components/UploadFile/components/DropCopy/DropCopy.cjs +0 -28
  77. package/dist/components/UploadFile/components/DropCopy/DropCopy.cjs.map +0 -1
  78. package/dist/components/UploadFile/components/DropCopy/DropCopy.d.ts +0 -2
  79. package/dist/components/UploadFile/components/DropCopy/DropCopy.js +0 -22
  80. package/dist/components/UploadFile/components/DropCopy/DropCopy.js.map +0 -1
  81. package/dist/components/UploadFile/components/UploadedFile/UploadedFile.module.scss.cjs +0 -9
  82. package/dist/components/UploadFile/components/UploadedFile/UploadedFile.module.scss.cjs.map +0 -1
  83. package/dist/components/UploadFile/components/UploadedFile/UploadedFile.module.scss.js +0 -7
  84. package/dist/components/UploadFile/components/UploadedFile/UploadedFile.module.scss.js.map +0 -1
  85. package/dist/components/UploadFile/hooks/useFileErrorMessages/index.d.ts +0 -1
  86. package/dist/components/UploadFile/hooks/useFileErrorMessages/useFileErrorMessages.cjs +0 -39
  87. package/dist/components/UploadFile/hooks/useFileErrorMessages/useFileErrorMessages.cjs.map +0 -1
  88. package/dist/components/UploadFile/hooks/useFileErrorMessages/useFileErrorMessages.d.ts +0 -13
  89. package/dist/components/UploadFile/hooks/useFileErrorMessages/useFileErrorMessages.js +0 -37
  90. package/dist/components/UploadFile/hooks/useFileErrorMessages/useFileErrorMessages.js.map +0 -1
  91. package/dist/components/UploadFile/hooks/usePreviewImage/index.d.ts +0 -1
  92. package/dist/components/UploadFile/hooks/usePreviewImage/usePreviewImage.cjs +0 -36
  93. package/dist/components/UploadFile/hooks/usePreviewImage/usePreviewImage.cjs.map +0 -1
  94. package/dist/components/UploadFile/hooks/usePreviewImage/usePreviewImage.d.ts +0 -8
  95. package/dist/components/UploadFile/hooks/usePreviewImage/usePreviewImage.js +0 -34
  96. package/dist/components/UploadFile/hooks/usePreviewImage/usePreviewImage.js.map +0 -1
  97. package/dist/components/UploadFile/hooks/useUploadFile/index.d.ts +0 -1
  98. package/dist/components/UploadFile/hooks/useUploadFile/useUploadFile.cjs +0 -65
  99. package/dist/components/UploadFile/hooks/useUploadFile/useUploadFile.cjs.map +0 -1
  100. package/dist/components/UploadFile/hooks/useUploadFile/useUploadFile.d.ts +0 -9
  101. package/dist/components/UploadFile/hooks/useUploadFile/useUploadFile.js +0 -63
  102. package/dist/components/UploadFile/hooks/useUploadFile/useUploadFile.js.map +0 -1
  103. package/dist/components/UploadFile/hooks/useValidateInput/index.d.ts +0 -1
  104. package/dist/components/UploadFile/hooks/useValidateInput/useValidateInput.cjs +0 -85
  105. package/dist/components/UploadFile/hooks/useValidateInput/useValidateInput.cjs.map +0 -1
  106. package/dist/components/UploadFile/hooks/useValidateInput/useValidateInput.d.ts +0 -13
  107. package/dist/components/UploadFile/hooks/useValidateInput/useValidateInput.js +0 -83
  108. package/dist/components/UploadFile/hooks/useValidateInput/useValidateInput.js.map +0 -1
  109. package/dist/components/UploadFile/mocks/mockUseUploadFile.d.ts +0 -14
  110. package/dist/components/UploadFile/utils/convertFileTypeToAcceptedFileExtension/convertFileTypeToAcceptedFileExtension.d.ts +0 -1
  111. package/dist/components/UploadFile/utils/convertFileTypeToAcceptedFileExtension/convertFileTypeToAcceptedFileType.cjs +0 -17
  112. package/dist/components/UploadFile/utils/convertFileTypeToAcceptedFileExtension/convertFileTypeToAcceptedFileType.cjs.map +0 -1
  113. package/dist/components/UploadFile/utils/convertFileTypeToAcceptedFileExtension/convertFileTypeToAcceptedFileType.d.ts +0 -1
  114. package/dist/components/UploadFile/utils/convertFileTypeToAcceptedFileExtension/convertFileTypeToAcceptedFileType.js +0 -15
  115. package/dist/components/UploadFile/utils/convertFileTypeToAcceptedFileExtension/convertFileTypeToAcceptedFileType.js.map +0 -1
  116. package/dist/components/UploadFile/utils/convertFileTypeToAcceptedFileExtension/index.d.ts +0 -1
  117. package/dist/components/UploadFile/utils/isImageType/index.d.ts +0 -1
  118. package/dist/components/UploadFile/utils/isImageType/isImageType.cjs +0 -14
  119. package/dist/components/UploadFile/utils/isImageType/isImageType.cjs.map +0 -1
  120. package/dist/components/UploadFile/utils/isImageType/isImageType.d.ts +0 -1
  121. package/dist/components/UploadFile/utils/isImageType/isImageType.js +0 -12
  122. package/dist/components/UploadFile/utils/isImageType/isImageType.js.map +0 -1
  123. package/dist/components/ViewsContainer/styled.cjs +0 -37
  124. package/dist/components/ViewsContainer/styled.cjs.map +0 -1
  125. package/dist/components/ViewsContainer/styled.d.ts +0 -34
  126. package/dist/components/ViewsContainer/styled.js +0 -23
  127. package/dist/components/ViewsContainer/styled.js.map +0 -1
@@ -1,7 +1,15 @@
1
1
  import { MutableRefObject, ReactNode } from 'react';
2
- export declare const useSetScrollPosition: (containerRef: MutableRefObject<HTMLDivElement>, children: ReactNode) => {
2
+ type UseSetScrollPositionProps = {
3
+ containerRef: MutableRefObject<HTMLDivElement>;
4
+ children: ReactNode;
5
+ hasMoreViews?: boolean;
6
+ onFetchMoreViews?: () => void;
7
+ isLoadingMoreViews?: boolean;
8
+ };
9
+ export declare const useSetScrollPosition: ({ containerRef, children, hasMoreViews, onFetchMoreViews, isLoadingMoreViews, }: UseSetScrollPositionProps) => {
3
10
  rightDisabled: boolean;
4
11
  leftDisabled: boolean;
5
12
  toNextScrollPosition: () => void;
6
13
  toPrevScrollPosition: () => void;
7
14
  };
15
+ export {};
@@ -1,8 +1,8 @@
1
- import { useState, useCallback, useEffect } from 'react';
1
+ import { useState, useCallback, useEffect, Children } from 'react';
2
2
  import { usePrevious } from 'react-use';
3
3
  import { getNextViewPosition, getPrevViewPosition, createViewPositionArray } from '../utils.js';
4
4
 
5
- const useSetScrollPosition = (containerRef, children) => {
5
+ const useSetScrollPosition = ({ containerRef, children, hasMoreViews = false, onFetchMoreViews, isLoadingMoreViews = false, }) => {
6
6
  var _a;
7
7
  const [leftDisabled, setLeftDisabled] = useState(true);
8
8
  const [rightDisabled, setRightDisabled] = useState(false);
@@ -29,11 +29,16 @@ const useSetScrollPosition = (containerRef, children) => {
29
29
  (_h = document.getElementById('left-arrow')) === null || _h === undefined ? undefined : _h.focus();
30
30
  }
31
31
  setRightDisabled(true);
32
+ // Check if we've reached the end and should fetch more data
33
+ // Only fetches more when not already loading more views and has more views to load
34
+ if (hasMoreViews && onFetchMoreViews && !isLoadingMoreViews) {
35
+ onFetchMoreViews();
36
+ }
32
37
  }
33
38
  else {
34
39
  setRightDisabled(false);
35
40
  }
36
- }, [containerRef]);
41
+ }, [containerRef, onFetchMoreViews, isLoadingMoreViews, hasMoreViews]);
37
42
  const handleResize = useCallback(() => {
38
43
  if (!containerRef.current)
39
44
  return;
@@ -60,58 +65,81 @@ const useSetScrollPosition = (containerRef, children) => {
60
65
  behavior: 'smooth',
61
66
  });
62
67
  }, [containerRef, viewStartPositions]);
68
+ // Initialize view positions when container first has children
69
+ useEffect(() => {
70
+ var _a, _b;
71
+ 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)
72
+ return;
73
+ setViewStartPositions(createViewPositionArray(containerRef.current));
74
+ }, [containerRef, viewStartPositions.length]);
75
+ // Handle new item addition - scroll to end and update positions
76
+ useEffect(() => {
77
+ var _a, _b, _c, _d;
78
+ if (!((_b = (_a = containerRef === null || containerRef === undefined ? undefined : containerRef.current) === null || _a === undefined ? undefined : _a.children) === null || _b === undefined ? undefined : _b.length))
79
+ return;
80
+ const childrenCount = containerRef.current.children.length;
81
+ const positionsCount = viewStartPositions.length;
82
+ const totalChildren = Children.count(children);
83
+ const shouldScrollToNewItem = childrenCount !== positionsCount && positionsCount > 0 && positionsCount < totalChildren;
84
+ if (!shouldScrollToNewItem)
85
+ return;
86
+ containerRef.current.scrollTo({
87
+ left: containerRef.current.scrollWidth - containerRef.current.clientWidth,
88
+ top: 0,
89
+ behavior: 'smooth',
90
+ });
91
+ // Compute the x position of the new item
92
+ const lastChildRect = (_c = containerRef.current.children[positionsCount - 1]) === null || _c === undefined ? undefined : _c.getBoundingClientRect();
93
+ const newPosition = viewStartPositions[positionsCount - 1] + ((_d = lastChildRect === null || lastChildRect === undefined ? undefined : lastChildRect.x) !== null && _d !== undefined ? _d : 0) - 20;
94
+ setViewStartPositions([...viewStartPositions, newPosition]);
95
+ }, [containerRef, children, viewStartPositions]);
96
+ // Handle active tab changes - scroll to active tab
97
+ useEffect(() => {
98
+ var _a, _b;
99
+ if (!((_b = (_a = containerRef === null || containerRef === undefined ? undefined : containerRef.current) === null || _a === undefined ? undefined : _a.children) === null || _b === undefined ? undefined : _b.length))
100
+ return;
101
+ if (activeTab === prevActiveTab || activeTab === null)
102
+ return;
103
+ if (containerRef.current.children.length !== viewStartPositions.length)
104
+ return;
105
+ const index = Array.from(containerRef.current.children).indexOf(activeTab);
106
+ if (index === -1)
107
+ return;
108
+ containerRef.current.scrollTo({
109
+ left: viewStartPositions[index],
110
+ top: 0,
111
+ behavior: 'smooth',
112
+ });
113
+ }, [activeTab, prevActiveTab, containerRef, viewStartPositions]);
114
+ // Handle fetching more views - recompute positions
115
+ useEffect(() => {
116
+ var _a, _b;
117
+ if (!((_b = (_a = containerRef === null || containerRef === undefined ? undefined : containerRef.current) === null || _a === undefined ? undefined : _a.children) === null || _b === undefined ? undefined : _b.length))
118
+ return;
119
+ if (viewStartPositions.length >= containerRef.current.children.length)
120
+ return;
121
+ const currentScrollLeft = containerRef.current.scrollLeft;
122
+ // Temporarily reset scroll to 0 to get accurate positions
123
+ containerRef.current.scrollTo({ left: 0, top: 0, behavior: 'auto' });
124
+ // Recompute positions from scroll position 0
125
+ setViewStartPositions(createViewPositionArray(containerRef.current));
126
+ // Restore the user's scroll position
127
+ containerRef.current.scrollTo({ left: currentScrollLeft, top: 0, behavior: 'auto' });
128
+ }, [containerRef, viewStartPositions.length]);
129
+ // Handle window resize and scroll event listeners
63
130
  useEffect(() => {
64
- var _a, _b, _c, _d, _e, _f, _g;
65
131
  if (!(containerRef === null || containerRef === undefined ? undefined : containerRef.current))
66
132
  return;
67
- if (((_a = containerRef.current.children) === null || _a === undefined ? undefined : _a.length) &&
68
- ((_b = containerRef.current.children) === null || _b === undefined ? undefined : _b.length) !== viewStartPositions.length &&
69
- viewStartPositions.length > 0 &&
70
- viewStartPositions.length < children.length) {
71
- // scrolls to the last view, when a new item is added
72
- containerRef.current.scrollTo({
73
- left: containerRef.current.scrollWidth - containerRef.current.clientWidth,
74
- top: 0,
75
- behavior: 'smooth',
76
- });
77
- // computes the x position of the new item
78
- setViewStartPositions([
79
- ...viewStartPositions,
80
- viewStartPositions[viewStartPositions.length - 1] +
81
- ((_d = (_c = containerRef.current.children[viewStartPositions.length - 1]) === null || _c === undefined ? undefined : _c.getBoundingClientRect().x) !== null && _d !== undefined ? _d : 0) -
82
- 20,
83
- ]);
84
- }
85
- if (((_e = containerRef.current.children) === null || _e === undefined ? undefined : _e.length) && viewStartPositions.length === 0) {
86
- setViewStartPositions(createViewPositionArray(containerRef.current));
87
- }
88
- // scrolls to active tab when page loads
89
- if (activeTab !== prevActiveTab &&
90
- activeTab !== null &&
91
- ((_f = containerRef.current.children) === null || _f === undefined ? undefined : _f.length) === viewStartPositions.length) {
92
- const index = Array.from(containerRef.current.children).indexOf(activeTab);
93
- containerRef.current.scrollTo({
94
- left: viewStartPositions[index],
95
- top: 0,
96
- behavior: 'smooth',
97
- });
98
- }
133
+ const container = containerRef.current;
99
134
  handleResize();
100
135
  window.addEventListener('resize', handleResize);
101
- (_g = containerRef.current) === null || _g === undefined ? undefined : _g.addEventListener('scroll', handleScroll);
136
+ container.addEventListener('scroll', handleScroll);
102
137
  // eslint-disable-next-line consistent-return
103
138
  return () => {
104
139
  window.removeEventListener('resize', handleResize);
140
+ container.removeEventListener('scroll', handleScroll);
105
141
  };
106
- }, [
107
- containerRef,
108
- children,
109
- handleResize,
110
- handleScroll,
111
- viewStartPositions,
112
- activeTab,
113
- prevActiveTab,
114
- ]);
142
+ }, [containerRef, handleResize, handleScroll]);
115
143
  return { rightDisabled, leftDisabled, toNextScrollPosition, toPrevScrollPosition };
116
144
  };
117
145
 
@@ -1 +1 @@
1
- {"version":3,"file":"useSetScrollPosition.js","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":[],"mappings":";;;;MAIa,oBAAoB,GAAG,CAClC,YAA8C,EAC9C,QAAmB,KACjB;;IACF,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,GAAG,QAAQ,CAAC,IAAI,CAAC;IACtD,MAAM,CAAC,aAAa,EAAE,gBAAgB,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC;IACzD,MAAM,CAAC,kBAAkB,EAAE,qBAAqB,CAAC,GAAG,QAAQ,CAAW,EAAE,CAAC;AAE1E,IAAA,MAAM,SAAS,GAAG,CAAA,EAAA,GAAA,YAAY,aAAZ,YAAY,KAAA,SAAA,GAAA,SAAA,GAAZ,YAAY,CAAE,OAAO,MAAE,IAAA,IAAA,EAAA,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AAE,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.js","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":[],"mappings":";;;;MAYa,oBAAoB,GAAG,CAAC,EACnC,YAAY,EACZ,QAAQ,EACR,YAAY,GAAG,KAAK,EACpB,gBAAgB,EAChB,kBAAkB,GAAG,KAAK,GACA,KAAI;;IAC9B,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,GAAG,QAAQ,CAAC,IAAI,CAAC;IACtD,MAAM,CAAC,aAAa,EAA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handler for when the menu icon is clicked (can be used to enable popover) */
6
6
  onClickMenu?: () => void;
7
+ /** reduces padding around the container */
8
+ compact?: boolean;
9
+ /** changes the appearance of the container */
10
+ appearance?: 'primary' | 'secondary';
11
+ /** Slot for the menu button */
12
+ menuButtonSlot?: ReactNode;
13
+ /** aria-controls attribute for the menu button */
7
14
  ariaMenuControls?: string;
15
+ /** aria-expanded attribute for the menu button */
8
16
  ariaMenuExpanded?: boolean;
17
+ /** indicates when there is more views to be loaded */
18
+ hasMoreViews?: boolean;
19
+ /** Callback to fetch more views when at the end of the list */
20
+ onFetchMoreViews?: () => void;
21
+ /** indicates when more views are currently being loaded */
22
+ isLoadingMoreViews?: boolean;
23
+ /** Additional className for the container */
24
+ className?: string;
25
+ /** Additional styles for the container */
26
+ style?: React.CSSProperties;
9
27
  };
@@ -2,8 +2,8 @@
2
2
 
3
3
  var ___$insertStyle = require('../../_virtual/____insertStyle.cjs');
4
4
 
5
- ___$insertStyle("._fullStyles_1j3kl_1 {\n /* Set default CSS custom properties */\n --outline-size: var(--sizes-xs);\n --border-color: var(--colors-neutral-ink-lightest);\n --shadow-color: var(--colors-secondary-blue-light);\n}\n._fullStyles_1j3kl_1:disabled, ._fullStyles_1j3kl_1[data-disabled] {\n opacity: 1;\n box-shadow: none;\n background-color: var(--colors-neutral-grey-light);\n cursor: not-allowed;\n}\n._fullStyles_1j3kl_1._compact_1j3kl_13 {\n --outline-size: 2px;\n min-height: var(--sizes-8);\n}\n._fullStyles_1j3kl_1._error_1j3kl_17 {\n --border-color: var(--colors-secondary-red-base);\n --shadow-color: var(--colors-secondary-red-light);\n}\n._fullStyles_1j3kl_1:focus {\n border-color: var(--border-color);\n box-shadow: 0 0 0 var(--outline-size) var(--shadow-color);\n outline: 0;\n}\n._fullStyles_1j3kl_1::placeholder {\n font-family: var(--text-placeholder-font-family);\n font-style: var(--text-placeholder-font-style);\n font-weight: var(--text-placeholder-font-weight);\n font-size: var(--text-placeholder-font-size);\n line-height: var(--text-placeholder-line-height);\n color: var(--text-placeholder-color);\n text-decoration: var(--text-placeholder-text-decoration);\n letter-spacing: var(--text-placeholder-letter-spacing);\n}\n._fullStyles_1j3kl_1:invalid {\n box-shadow: 0 0 0 var(--outline-size) var(--border-color);\n border-color: var(--colors-secondary-red-base);\n}\n\n._base_1j3kl_41 {\n font-family: var(--text-body-font-family);\n font-style: var(--text-body-font-style);\n font-weight: var(--text-body-font-weight);\n font-size: var(--text-body-font-size);\n line-height: var(--text-body-line-height);\n color: var(--text-body-color);\n text-decoration: var(--text-body-text-decoration);\n letter-spacing: var(--text-body-letter-spacing);\n appearance: none;\n box-sizing: border-box;\n background-color: white;\n text-align: left;\n min-height: var(--sizes-10);\n padding-inline: var(--sizes-3);\n border-radius: var(--radius-base);\n border: 1px solid var(--border-color);\n display: flex;\n align-items: center;\n justify-content: flex-start;\n}\n._base_1j3kl_41._inputGroup_1j3kl_62:first-child {\n padding-right: calc(var(--sizes-3) - var(--sizes-1));\n}\n._base_1j3kl_41._inputGroup_1j3kl_62:last-child {\n padding-left: var(--sizes-2);\n}\n._base_1j3kl_41._inputGroup_1j3kl_62:not(:first-child):not(:last-child) {\n padding-inline: var(--sizes-2);\n}");
6
- var formStyles = {"fullStyles":"_fullStyles_1j3kl_1","compact":"_compact_1j3kl_13","error":"_error_1j3kl_17","base":"_base_1j3kl_41","inputGroup":"_inputGroup_1j3kl_62"};
5
+ ___$insertStyle("._fullStyles_1e3xu_1 {\n /* Set default CSS custom properties */\n --outline-size: var(--sizes-xs);\n --border-color: var(--colors-neutral-ink-lightest);\n --shadow-color: var(--colors-secondary-blue-light);\n}\n._fullStyles_1e3xu_1:disabled, ._fullStyles_1e3xu_1[data-disabled] {\n opacity: 1;\n box-shadow: none;\n background-color: var(--colors-neutral-grey-light);\n cursor: not-allowed;\n}\n._fullStyles_1e3xu_1._compact_1e3xu_13 {\n --outline-size: 2px;\n min-height: var(--sizes-8);\n}\n._fullStyles_1e3xu_1._error_1e3xu_17 {\n --border-color: var(--colors-secondary-red-base);\n --shadow-color: var(--colors-secondary-red-light);\n}\n._fullStyles_1e3xu_1:focus {\n border-color: var(--border-color);\n box-shadow: 0 0 0 var(--outline-size) var(--shadow-color);\n outline: 0;\n}\n._fullStyles_1e3xu_1::placeholder {\n font-family: var(--text-placeholder-font-family);\n font-style: var(--text-placeholder-font-style);\n font-weight: var(--text-placeholder-font-weight);\n font-size: var(--text-placeholder-font-size);\n line-height: var(--text-placeholder-line-height);\n color: var(--text-placeholder-color);\n text-decoration: var(--text-placeholder-text-decoration);\n letter-spacing: var(--text-placeholder-letter-spacing);\n}\n._fullStyles_1e3xu_1:invalid {\n box-shadow: 0 0 0 var(--outline-size) var(--border-color);\n border-color: var(--colors-secondary-red-base);\n}\n\n._base_1e3xu_41 {\n font-family: var(--text-body-font-family);\n font-style: var(--text-body-font-style);\n font-weight: var(--text-body-font-weight);\n font-size: var(--text-body-font-size);\n line-height: var(--text-body-line-height);\n color: var(--text-body-color);\n text-decoration: var(--text-body-text-decoration);\n letter-spacing: var(--text-body-letter-spacing);\n appearance: none;\n box-sizing: border-box;\n background-color: white;\n text-align: left;\n min-height: var(--sizes-10);\n padding-inline: var(--sizes-3);\n border-radius: var(--radius-base);\n border: 1px solid var(--border-color);\n display: flex;\n align-items: center;\n justify-content: flex-start;\n /* When inside an InputGroup, reduce inline padding to bring content closer together */\n}\n._base_1e3xu_41._inputGroup_1e3xu_63:first-child {\n padding-right: calc(var(--sizes-3) - var(--sizes-1));\n}\n._base_1e3xu_41._inputGroup_1e3xu_63:last-child {\n padding-left: var(--sizes-2);\n}\n._base_1e3xu_41._inputGroup_1e3xu_63:not(:first-child):not(:last-child) {\n padding-inline: var(--sizes-2);\n}\n\n/** InputGroup styles from the InputGroup component */\n._inputGroup_1e3xu_63 {\n display: flex;\n /* Remove inline margins from all children */\n /* Bring in-focus and active children to the front to maintain outlines */\n /* Remove inline borders for children in the middle */\n /* Remove right border radius from first child */\n /* Remove left border radius from last child */\n}\n._inputGroup_1e3xu_63 > * {\n margin-left: 0;\n margin-right: 0;\n box-shadow: none;\n}\n._inputGroup_1e3xu_63 > *:focus, ._inputGroup_1e3xu_63 > *:active {\n z-index: 5;\n}\n._inputGroup_1e3xu_63 > *:not(:first-child):not(:last-child) {\n border-radius: 0 !important;\n border-inline: 0 !important;\n}\n._inputGroup_1e3xu_63 > *:first-child {\n border-top-right-radius: 0 !important;\n border-bottom-right-radius: 0 !important;\n border-right: 0 !important;\n}\n._inputGroup_1e3xu_63 > *:last-child {\n border-top-left-radius: 0 !important;\n border-bottom-left-radius: 0 !important;\n border-left: 0 !important;\n}");
6
+ var formStyles = {"fullStyles":"_fullStyles_1e3xu_1","compact":"_compact_1e3xu_13","error":"_error_1e3xu_17","base":"_base_1e3xu_41","inputGroup":"_inputGroup_1e3xu_63"};
7
7
 
8
8
  module.exports = formStyles;
9
9
  //# sourceMappingURL=form.module.scss.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"form.module.scss.cjs","sources":["../../../src/utils/forms/form.module.scss"],"sourcesContent":[".fullStyles {\n /* Set default CSS custom properties */\n --outline-size: var(--sizes-xs);\n --border-color: var(--colors-neutral-ink-lightest);\n --shadow-color: var(--colors-secondary-blue-light);\n\n &:disabled,\n &[data-disabled] {\n opacity: 1;\n box-shadow: none;\n background-color: var(--colors-neutral-grey-light);\n cursor: not-allowed;\n }\n\n &.compact {\n --outline-size: 2px;\n min-height: var(--sizes-8);\n }\n\n &.error {\n --border-color: var(--colors-secondary-red-base);\n --shadow-color: var(--colors-secondary-red-light);\n }\n\n &:focus {\n border-color: var(--border-color);\n box-shadow: 0 0 0 var(--outline-size) var(--shadow-color);\n outline: 0;\n }\n\n &::placeholder {\n font-family: var(--text-placeholder-font-family);\n font-style: var(--text-placeholder-font-style);\n font-weight: var(--text-placeholder-font-weight);\n font-size: var(--text-placeholder-font-size);\n line-height: var(--text-placeholder-line-height);\n color: var(--text-placeholder-color);\n text-decoration: var(--text-placeholder-text-decoration);\n letter-spacing: var(--text-placeholder-letter-spacing);\n }\n\n &:invalid {\n box-shadow: 0 0 0 var(--outline-size) var(--border-color);\n border-color: var(--colors-secondary-red-base);\n }\n}\n\n.base {\n font-family: var(--text-body-font-family);\n font-style: var(--text-body-font-style);\n font-weight: var(--text-body-font-weight);\n font-size: var(--text-body-font-size);\n line-height: var(--text-body-line-height);\n color: var(--text-body-color);\n text-decoration: var(--text-body-text-decoration);\n letter-spacing: var(--text-body-letter-spacing);\n\n appearance: none;\n box-sizing: border-box;\n\n background-color: white;\n text-align: left;\n\n min-height: var(--sizes-10);\n padding-inline: var(--sizes-3);\n border-radius: var(--radius-base);\n border: 1px solid var(--border-color);\n\n display: flex;\n align-items: center;\n justify-content: flex-start;\n\n &.inputGroup {\n &:first-child {\n padding-right: calc(var(--sizes-3) - var(--sizes-1));\n }\n\n &:last-child {\n padding-left: var(--sizes-2);\n }\n\n &:not(:first-child):not(:last-child) {\n padding-inline: var(--sizes-2);\n }\n }\n}\n"],"names":[],"mappings":";;;;AACE,eAAA,CAAA,43EAAA;AACA,iBAAA,CAAA,YAAA,CAAA,qBAAA,CAAA,SAAA,CAAA,mBAAA,CAAA,OAAA,CAAA,iBAAA,CAAA,MAAA,CAAA,gBAAA,CAAA,YAAA,CAAA,sBAAA;;;;"}
1
+ {"version":3,"file":"form.module.scss.cjs","sources":["../../../src/utils/forms/form.module.scss"],"sourcesContent":[".fullStyles {\n /* Set default CSS custom properties */\n --outline-size: var(--sizes-xs);\n --border-color: var(--colors-neutral-ink-lightest);\n --shadow-color: var(--colors-secondary-blue-light);\n\n &:disabled,\n &[data-disabled] {\n opacity: 1;\n box-shadow: none;\n background-color: var(--colors-neutral-grey-light);\n cursor: not-allowed;\n }\n\n &.compact {\n --outline-size: 2px;\n min-height: var(--sizes-8);\n }\n\n &.error {\n --border-color: var(--colors-secondary-red-base);\n --shadow-color: var(--colors-secondary-red-light);\n }\n\n &:focus {\n border-color: var(--border-color);\n box-shadow: 0 0 0 var(--outline-size) var(--shadow-color);\n outline: 0;\n }\n\n &::placeholder {\n font-family: var(--text-placeholder-font-family);\n font-style: var(--text-placeholder-font-style);\n font-weight: var(--text-placeholder-font-weight);\n font-size: var(--text-placeholder-font-size);\n line-height: var(--text-placeholder-line-height);\n color: var(--text-placeholder-color);\n text-decoration: var(--text-placeholder-text-decoration);\n letter-spacing: var(--text-placeholder-letter-spacing);\n }\n\n &:invalid {\n box-shadow: 0 0 0 var(--outline-size) var(--border-color);\n border-color: var(--colors-secondary-red-base);\n }\n}\n\n.base {\n font-family: var(--text-body-font-family);\n font-style: var(--text-body-font-style);\n font-weight: var(--text-body-font-weight);\n font-size: var(--text-body-font-size);\n line-height: var(--text-body-line-height);\n color: var(--text-body-color);\n text-decoration: var(--text-body-text-decoration);\n letter-spacing: var(--text-body-letter-spacing);\n\n appearance: none;\n box-sizing: border-box;\n\n background-color: white;\n text-align: left;\n\n min-height: var(--sizes-10);\n padding-inline: var(--sizes-3);\n border-radius: var(--radius-base);\n border: 1px solid var(--border-color);\n\n display: flex;\n align-items: center;\n justify-content: flex-start;\n\n /* When inside an InputGroup, reduce inline padding to bring content closer together */\n &.inputGroup {\n &:first-child {\n padding-right: calc(var(--sizes-3) - var(--sizes-1));\n }\n\n &:last-child {\n padding-left: var(--sizes-2);\n }\n\n &:not(:first-child):not(:last-child) {\n padding-inline: var(--sizes-2);\n }\n }\n}\n\n/** InputGroup styles from the InputGroup component */\n.inputGroup {\n display: flex;\n\n /* Remove inline margins from all children */\n & > * {\n margin-left: 0;\n margin-right: 0;\n box-shadow: none;\n }\n\n /* Bring in-focus and active children to the front to maintain outlines */\n & > *:focus,\n & > *:active {\n z-index: 5;\n }\n\n /* Remove inline borders for children in the middle */\n & > *:not(:first-child):not(:last-child) {\n border-radius: 0 !important;\n border-inline: 0 !important;\n }\n\n /* Remove right border radius from first child */\n & > *:first-child {\n border-top-right-radius: 0 !important;\n border-bottom-right-radius: 0 !important;\n border-right: 0 !important;\n }\n\n /* Remove left border radius from last child */\n & > *:last-child {\n border-top-left-radius: 0 !important;\n border-bottom-left-radius: 0 !important;\n border-left: 0 !important;\n }\n}\n"],"names":[],"mappings":";;;;AACE,eAAA,CAAA,s9GAAA;AACA,iBAAA,CAAA,YAAA,CAAA,qBAAA,CAAA,SAAA,CAAA,mBAAA,CAAA,OAAA,CAAA,iBAAA,CAAA,MAAA,CAAA,gBAAA,CAAA,YAAA,CAAA,sBAAA;;;;"}
@@ -1,7 +1,7 @@
1
1
  import insertStyle from '../../_virtual/____insertStyle.js';
2
2
 
3
- insertStyle("._fullStyles_1j3kl_1 {\n /* Set default CSS custom properties */\n --outline-size: var(--sizes-xs);\n --border-color: var(--colors-neutral-ink-lightest);\n --shadow-color: var(--colors-secondary-blue-light);\n}\n._fullStyles_1j3kl_1:disabled, ._fullStyles_1j3kl_1[data-disabled] {\n opacity: 1;\n box-shadow: none;\n background-color: var(--colors-neutral-grey-light);\n cursor: not-allowed;\n}\n._fullStyles_1j3kl_1._compact_1j3kl_13 {\n --outline-size: 2px;\n min-height: var(--sizes-8);\n}\n._fullStyles_1j3kl_1._error_1j3kl_17 {\n --border-color: var(--colors-secondary-red-base);\n --shadow-color: var(--colors-secondary-red-light);\n}\n._fullStyles_1j3kl_1:focus {\n border-color: var(--border-color);\n box-shadow: 0 0 0 var(--outline-size) var(--shadow-color);\n outline: 0;\n}\n._fullStyles_1j3kl_1::placeholder {\n font-family: var(--text-placeholder-font-family);\n font-style: var(--text-placeholder-font-style);\n font-weight: var(--text-placeholder-font-weight);\n font-size: var(--text-placeholder-font-size);\n line-height: var(--text-placeholder-line-height);\n color: var(--text-placeholder-color);\n text-decoration: var(--text-placeholder-text-decoration);\n letter-spacing: var(--text-placeholder-letter-spacing);\n}\n._fullStyles_1j3kl_1:invalid {\n box-shadow: 0 0 0 var(--outline-size) var(--border-color);\n border-color: var(--colors-secondary-red-base);\n}\n\n._base_1j3kl_41 {\n font-family: var(--text-body-font-family);\n font-style: var(--text-body-font-style);\n font-weight: var(--text-body-font-weight);\n font-size: var(--text-body-font-size);\n line-height: var(--text-body-line-height);\n color: var(--text-body-color);\n text-decoration: var(--text-body-text-decoration);\n letter-spacing: var(--text-body-letter-spacing);\n appearance: none;\n box-sizing: border-box;\n background-color: white;\n text-align: left;\n min-height: var(--sizes-10);\n padding-inline: var(--sizes-3);\n border-radius: var(--radius-base);\n border: 1px solid var(--border-color);\n display: flex;\n align-items: center;\n justify-content: flex-start;\n}\n._base_1j3kl_41._inputGroup_1j3kl_62:first-child {\n padding-right: calc(var(--sizes-3) - var(--sizes-1));\n}\n._base_1j3kl_41._inputGroup_1j3kl_62:last-child {\n padding-left: var(--sizes-2);\n}\n._base_1j3kl_41._inputGroup_1j3kl_62:not(:first-child):not(:last-child) {\n padding-inline: var(--sizes-2);\n}");
4
- var formStyles = {"fullStyles":"_fullStyles_1j3kl_1","compact":"_compact_1j3kl_13","error":"_error_1j3kl_17","base":"_base_1j3kl_41","inputGroup":"_inputGroup_1j3kl_62"};
3
+ insertStyle("._fullStyles_1e3xu_1 {\n /* Set default CSS custom properties */\n --outline-size: var(--sizes-xs);\n --border-color: var(--colors-neutral-ink-lightest);\n --shadow-color: var(--colors-secondary-blue-light);\n}\n._fullStyles_1e3xu_1:disabled, ._fullStyles_1e3xu_1[data-disabled] {\n opacity: 1;\n box-shadow: none;\n background-color: var(--colors-neutral-grey-light);\n cursor: not-allowed;\n}\n._fullStyles_1e3xu_1._compact_1e3xu_13 {\n --outline-size: 2px;\n min-height: var(--sizes-8);\n}\n._fullStyles_1e3xu_1._error_1e3xu_17 {\n --border-color: var(--colors-secondary-red-base);\n --shadow-color: var(--colors-secondary-red-light);\n}\n._fullStyles_1e3xu_1:focus {\n border-color: var(--border-color);\n box-shadow: 0 0 0 var(--outline-size) var(--shadow-color);\n outline: 0;\n}\n._fullStyles_1e3xu_1::placeholder {\n font-family: var(--text-placeholder-font-family);\n font-style: var(--text-placeholder-font-style);\n font-weight: var(--text-placeholder-font-weight);\n font-size: var(--text-placeholder-font-size);\n line-height: var(--text-placeholder-line-height);\n color: var(--text-placeholder-color);\n text-decoration: var(--text-placeholder-text-decoration);\n letter-spacing: var(--text-placeholder-letter-spacing);\n}\n._fullStyles_1e3xu_1:invalid {\n box-shadow: 0 0 0 var(--outline-size) var(--border-color);\n border-color: var(--colors-secondary-red-base);\n}\n\n._base_1e3xu_41 {\n font-family: var(--text-body-font-family);\n font-style: var(--text-body-font-style);\n font-weight: var(--text-body-font-weight);\n font-size: var(--text-body-font-size);\n line-height: var(--text-body-line-height);\n color: var(--text-body-color);\n text-decoration: var(--text-body-text-decoration);\n letter-spacing: var(--text-body-letter-spacing);\n appearance: none;\n box-sizing: border-box;\n background-color: white;\n text-align: left;\n min-height: var(--sizes-10);\n padding-inline: var(--sizes-3);\n border-radius: var(--radius-base);\n border: 1px solid var(--border-color);\n display: flex;\n align-items: center;\n justify-content: flex-start;\n /* When inside an InputGroup, reduce inline padding to bring content closer together */\n}\n._base_1e3xu_41._inputGroup_1e3xu_63:first-child {\n padding-right: calc(var(--sizes-3) - var(--sizes-1));\n}\n._base_1e3xu_41._inputGroup_1e3xu_63:last-child {\n padding-left: var(--sizes-2);\n}\n._base_1e3xu_41._inputGroup_1e3xu_63:not(:first-child):not(:last-child) {\n padding-inline: var(--sizes-2);\n}\n\n/** InputGroup styles from the InputGroup component */\n._inputGroup_1e3xu_63 {\n display: flex;\n /* Remove inline margins from all children */\n /* Bring in-focus and active children to the front to maintain outlines */\n /* Remove inline borders for children in the middle */\n /* Remove right border radius from first child */\n /* Remove left border radius from last child */\n}\n._inputGroup_1e3xu_63 > * {\n margin-left: 0;\n margin-right: 0;\n box-shadow: none;\n}\n._inputGroup_1e3xu_63 > *:focus, ._inputGroup_1e3xu_63 > *:active {\n z-index: 5;\n}\n._inputGroup_1e3xu_63 > *:not(:first-child):not(:last-child) {\n border-radius: 0 !important;\n border-inline: 0 !important;\n}\n._inputGroup_1e3xu_63 > *:first-child {\n border-top-right-radius: 0 !important;\n border-bottom-right-radius: 0 !important;\n border-right: 0 !important;\n}\n._inputGroup_1e3xu_63 > *:last-child {\n border-top-left-radius: 0 !important;\n border-bottom-left-radius: 0 !important;\n border-left: 0 !important;\n}");
4
+ var formStyles = {"fullStyles":"_fullStyles_1e3xu_1","compact":"_compact_1e3xu_13","error":"_error_1e3xu_17","base":"_base_1e3xu_41","inputGroup":"_inputGroup_1e3xu_63"};
5
5
 
6
6
  export { formStyles as default };
7
7
  //# sourceMappingURL=form.module.scss.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"form.module.scss.js","sources":["../../../src/utils/forms/form.module.scss"],"sourcesContent":[".fullStyles {\n /* Set default CSS custom properties */\n --outline-size: var(--sizes-xs);\n --border-color: var(--colors-neutral-ink-lightest);\n --shadow-color: var(--colors-secondary-blue-light);\n\n &:disabled,\n &[data-disabled] {\n opacity: 1;\n box-shadow: none;\n background-color: var(--colors-neutral-grey-light);\n cursor: not-allowed;\n }\n\n &.compact {\n --outline-size: 2px;\n min-height: var(--sizes-8);\n }\n\n &.error {\n --border-color: var(--colors-secondary-red-base);\n --shadow-color: var(--colors-secondary-red-light);\n }\n\n &:focus {\n border-color: var(--border-color);\n box-shadow: 0 0 0 var(--outline-size) var(--shadow-color);\n outline: 0;\n }\n\n &::placeholder {\n font-family: var(--text-placeholder-font-family);\n font-style: var(--text-placeholder-font-style);\n font-weight: var(--text-placeholder-font-weight);\n font-size: var(--text-placeholder-font-size);\n line-height: var(--text-placeholder-line-height);\n color: var(--text-placeholder-color);\n text-decoration: var(--text-placeholder-text-decoration);\n letter-spacing: var(--text-placeholder-letter-spacing);\n }\n\n &:invalid {\n box-shadow: 0 0 0 var(--outline-size) var(--border-color);\n border-color: var(--colors-secondary-red-base);\n }\n}\n\n.base {\n font-family: var(--text-body-font-family);\n font-style: var(--text-body-font-style);\n font-weight: var(--text-body-font-weight);\n font-size: var(--text-body-font-size);\n line-height: var(--text-body-line-height);\n color: var(--text-body-color);\n text-decoration: var(--text-body-text-decoration);\n letter-spacing: var(--text-body-letter-spacing);\n\n appearance: none;\n box-sizing: border-box;\n\n background-color: white;\n text-align: left;\n\n min-height: var(--sizes-10);\n padding-inline: var(--sizes-3);\n border-radius: var(--radius-base);\n border: 1px solid var(--border-color);\n\n display: flex;\n align-items: center;\n justify-content: flex-start;\n\n &.inputGroup {\n &:first-child {\n padding-right: calc(var(--sizes-3) - var(--sizes-1));\n }\n\n &:last-child {\n padding-left: var(--sizes-2);\n }\n\n &:not(:first-child):not(:last-child) {\n padding-inline: var(--sizes-2);\n }\n }\n}\n"],"names":["___$insertStyle"],"mappings":";;AACEA,WAAA,CAAA,43EAAA;AACA,iBAAA,CAAA,YAAA,CAAA,qBAAA,CAAA,SAAA,CAAA,mBAAA,CAAA,OAAA,CAAA,iBAAA,CAAA,MAAA,CAAA,gBAAA,CAAA,YAAA,CAAA,sBAAA;;;;"}
1
+ {"version":3,"file":"form.module.scss.js","sources":["../../../src/utils/forms/form.module.scss"],"sourcesContent":[".fullStyles {\n /* Set default CSS custom properties */\n --outline-size: var(--sizes-xs);\n --border-color: var(--colors-neutral-ink-lightest);\n --shadow-color: var(--colors-secondary-blue-light);\n\n &:disabled,\n &[data-disabled] {\n opacity: 1;\n box-shadow: none;\n background-color: var(--colors-neutral-grey-light);\n cursor: not-allowed;\n }\n\n &.compact {\n --outline-size: 2px;\n min-height: var(--sizes-8);\n }\n\n &.error {\n --border-color: var(--colors-secondary-red-base);\n --shadow-color: var(--colors-secondary-red-light);\n }\n\n &:focus {\n border-color: var(--border-color);\n box-shadow: 0 0 0 var(--outline-size) var(--shadow-color);\n outline: 0;\n }\n\n &::placeholder {\n font-family: var(--text-placeholder-font-family);\n font-style: var(--text-placeholder-font-style);\n font-weight: var(--text-placeholder-font-weight);\n font-size: var(--text-placeholder-font-size);\n line-height: var(--text-placeholder-line-height);\n color: var(--text-placeholder-color);\n text-decoration: var(--text-placeholder-text-decoration);\n letter-spacing: var(--text-placeholder-letter-spacing);\n }\n\n &:invalid {\n box-shadow: 0 0 0 var(--outline-size) var(--border-color);\n border-color: var(--colors-secondary-red-base);\n }\n}\n\n.base {\n font-family: var(--text-body-font-family);\n font-style: var(--text-body-font-style);\n font-weight: var(--text-body-font-weight);\n font-size: var(--text-body-font-size);\n line-height: var(--text-body-line-height);\n color: var(--text-body-color);\n text-decoration: var(--text-body-text-decoration);\n letter-spacing: var(--text-body-letter-spacing);\n\n appearance: none;\n box-sizing: border-box;\n\n background-color: white;\n text-align: left;\n\n min-height: var(--sizes-10);\n padding-inline: var(--sizes-3);\n border-radius: var(--radius-base);\n border: 1px solid var(--border-color);\n\n display: flex;\n align-items: center;\n justify-content: flex-start;\n\n /* When inside an InputGroup, reduce inline padding to bring content closer together */\n &.inputGroup {\n &:first-child {\n padding-right: calc(var(--sizes-3) - var(--sizes-1));\n }\n\n &:last-child {\n padding-left: var(--sizes-2);\n }\n\n &:not(:first-child):not(:last-child) {\n padding-inline: var(--sizes-2);\n }\n }\n}\n\n/** InputGroup styles from the InputGroup component */\n.inputGroup {\n display: flex;\n\n /* Remove inline margins from all children */\n & > * {\n margin-left: 0;\n margin-right: 0;\n box-shadow: none;\n }\n\n /* Bring in-focus and active children to the front to maintain outlines */\n & > *:focus,\n & > *:active {\n z-index: 5;\n }\n\n /* Remove inline borders for children in the middle */\n & > *:not(:first-child):not(:last-child) {\n border-radius: 0 !important;\n border-inline: 0 !important;\n }\n\n /* Remove right border radius from first child */\n & > *:first-child {\n border-top-right-radius: 0 !important;\n border-bottom-right-radius: 0 !important;\n border-right: 0 !important;\n }\n\n /* Remove left border radius from last child */\n & > *:last-child {\n border-top-left-radius: 0 !important;\n border-bottom-left-radius: 0 !important;\n border-left: 0 !important;\n }\n}\n"],"names":["___$insertStyle"],"mappings":";;AACEA,WAAA,CAAA,s9GAAA;AACA,iBAAA,CAAA,YAAA,CAAA,qBAAA,CAAA,SAAA,CAAA,mBAAA,CAAA,OAAA,CAAA,iBAAA,CAAA,MAAA,CAAA,gBAAA,CAAA,YAAA,CAAA,sBAAA;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@veeqo/ui",
3
- "version": "12.4.0-beta-9",
3
+ "version": "12.4.0",
4
4
  "description": "New optimised component library for Veeqo.",
5
5
  "author": "Robert Wealthall",
6
6
  "license": "ISC",
@@ -1,28 +0,0 @@
1
- 'use strict';
2
-
3
- var React = require('react');
4
- var framerMotion = require('framer-motion');
5
- var index = require('../../../../theme/index.cjs');
6
- var sizes = require('../../../../theme/modules/sizes.cjs');
7
- var Text = require('../../../Text/Text.cjs');
8
- var FlexCol = require('../../../Flex/FlexCol/FlexCol.cjs');
9
- var ArrowDownIcon = require('../../../../icons/design-system/components/ArrowDownIcon.cjs');
10
-
11
- function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
12
-
13
- var React__default = /*#__PURE__*/_interopDefaultCompat(React);
14
-
15
- const DropCopy = () => (React__default.default.createElement(FlexCol.FlexCol, { alignItems: "center", gap: "sm", style: { pointerEvents: 'none' } },
16
- React__default.default.createElement("div", { style: { height: 24, display: 'flex', alignItems: 'center', justifyContent: 'center' } },
17
- React__default.default.createElement(framerMotion.motion.div, { animate: {
18
- y: [0, 8, 0],
19
- }, transition: {
20
- duration: 1,
21
- repeat: Infinity,
22
- ease: 'easeInOut',
23
- } },
24
- React__default.default.createElement(ArrowDownIcon.ReactComponent, { height: 24, width: 24 }))),
25
- React__default.default.createElement(Text.Text, { variant: "body", style: { paddingTop: sizes.sizes.sm, color: index.theme.colors.neutral.ink.base } }, "Drop to upload")));
26
-
27
- exports.DropCopy = DropCopy;
28
- //# sourceMappingURL=DropCopy.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"DropCopy.cjs","sources":["../../../../../src/components/UploadFile/components/DropCopy/DropCopy.tsx"],"sourcesContent":["import React from 'react';\nimport { motion } from 'framer-motion';\nimport { theme } from 'Theme';\nimport { sizes } from '../../../../theme/modules/sizes';\nimport { Text } from '../../../Text';\nimport { FlexCol } from '../../../Flex/FlexCol';\nimport { ArrowDownIcon } from '../../../../icons';\n\nexport const DropCopy = () => (\n <FlexCol alignItems=\"center\" gap=\"sm\" style={{ pointerEvents: 'none' }}>\n <div style={{ height: 24, display: 'flex', alignItems: 'center', justifyContent: 'center' }}>\n <motion.div\n animate={{\n y: [0, 8, 0],\n }}\n transition={{\n duration: 1,\n repeat: Infinity,\n ease: 'easeInOut',\n }}\n >\n <ArrowDownIcon height={24} width={24} />\n </motion.div>\n </div>\n <Text variant=\"body\" style={{ paddingTop: sizes.sm, color: theme.colors.neutral.ink.base }}>\n Drop to upload\n </Text>\n </FlexCol>\n);\n"],"names":["React","FlexCol","motion","ArrowDownIcon","Text","sizes","theme"],"mappings":";;;;;;;;;;;;;;AAQa,MAAA,QAAQ,GAAG,OACtBA,sBAAC,CAAA,aAAA,CAAAC,eAAO,EAAC,EAAA,UAAU,EAAC,QAAQ,EAAC,GAAG,EAAC,IAAI,EAAC,KAAK,EAAE,EAAE,aAAa,EAAE,MAAM,EAAE,EAAA;AACpE,IAAAD,sBAAA,CAAA,aAAA,CAAA,KAAA,EAAA,EAAK,KAAK,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,cAAc,EAAE,QAAQ,EAAE,EAAA;AACzF,QAAAA,sBAAA,CAAA,aAAA,CAACE,mBAAM,CAAC,GAAG,EAAA,EACT,OAAO,EAAE;AACP,gBAAA,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;AACb,aAAA,EACD,UAAU,EAAE;AACV,gBAAA,QAAQ,EAAE,CAAC;AACX,gBAAA,MAAM,EAAE,QAAQ;AAChB,gBAAA,IAAI,EAAE,WAAW;AAClB,aAAA,EAAA;YAEDF,sBAAC,CAAA,aAAA,CAAAG,4BAAa,EAAC,EAAA,MAAM,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,EAAI,CAAA,CAC7B,CACT;AACN,IAAAH,sBAAA,CAAA,aAAA,CAACI,SAAI,EAAA,EAAC,OAAO,EAAC,MAAM,EAAC,KAAK,EAAE,EAAE,UAAU,EAAEC,WAAK,CAAC,EAAE,EAAE,KAAK,EAAEC,WAAK,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,EAAE,EAEnF,EAAA,gBAAA,CAAA,CACC;;;;"}
@@ -1,2 +0,0 @@
1
- import React from 'react';
2
- export declare const DropCopy: () => React.JSX.Element;
@@ -1,22 +0,0 @@
1
- import React__default from 'react';
2
- import { motion } from 'framer-motion';
3
- import { theme } from '../../../../theme/index.js';
4
- import { sizes } from '../../../../theme/modules/sizes.js';
5
- import { Text } from '../../../Text/Text.js';
6
- import { FlexCol } from '../../../Flex/FlexCol/FlexCol.js';
7
- import { ReactComponent as ArrowDownIcon } from '../../../../icons/design-system/components/ArrowDownIcon.js';
8
-
9
- const DropCopy = () => (React__default.createElement(FlexCol, { alignItems: "center", gap: "sm", style: { pointerEvents: 'none' } },
10
- React__default.createElement("div", { style: { height: 24, display: 'flex', alignItems: 'center', justifyContent: 'center' } },
11
- React__default.createElement(motion.div, { animate: {
12
- y: [0, 8, 0],
13
- }, transition: {
14
- duration: 1,
15
- repeat: Infinity,
16
- ease: 'easeInOut',
17
- } },
18
- React__default.createElement(ArrowDownIcon, { height: 24, width: 24 }))),
19
- React__default.createElement(Text, { variant: "body", style: { paddingTop: sizes.sm, color: theme.colors.neutral.ink.base } }, "Drop to upload")));
20
-
21
- export { DropCopy };
22
- //# sourceMappingURL=DropCopy.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"DropCopy.js","sources":["../../../../../src/components/UploadFile/components/DropCopy/DropCopy.tsx"],"sourcesContent":["import React from 'react';\nimport { motion } from 'framer-motion';\nimport { theme } from 'Theme';\nimport { sizes } from '../../../../theme/modules/sizes';\nimport { Text } from '../../../Text';\nimport { FlexCol } from '../../../Flex/FlexCol';\nimport { ArrowDownIcon } from '../../../../icons';\n\nexport const DropCopy = () => (\n <FlexCol alignItems=\"center\" gap=\"sm\" style={{ pointerEvents: 'none' }}>\n <div style={{ height: 24, display: 'flex', alignItems: 'center', justifyContent: 'center' }}>\n <motion.div\n animate={{\n y: [0, 8, 0],\n }}\n transition={{\n duration: 1,\n repeat: Infinity,\n ease: 'easeInOut',\n }}\n >\n <ArrowDownIcon height={24} width={24} />\n </motion.div>\n </div>\n <Text variant=\"body\" style={{ paddingTop: sizes.sm, color: theme.colors.neutral.ink.base }}>\n Drop to upload\n </Text>\n </FlexCol>\n);\n"],"names":["React"],"mappings":";;;;;;;;AAQa,MAAA,QAAQ,GAAG,OACtBA,cAAC,CAAA,aAAA,CAAA,OAAO,EAAC,EAAA,UAAU,EAAC,QAAQ,EAAC,GAAG,EAAC,IAAI,EAAC,KAAK,EAAE,EAAE,aAAa,EAAE,MAAM,EAAE,EAAA;AACpE,IAAAA,cAAA,CAAA,aAAA,CAAA,KAAA,EAAA,EAAK,KAAK,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,cAAc,EAAE,QAAQ,EAAE,EAAA;AACzF,QAAAA,cAAA,CAAA,aAAA,CAAC,MAAM,CAAC,GAAG,EAAA,EACT,OAAO,EAAE;AACP,gBAAA,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;AACb,aAAA,EACD,UAAU,EAAE;AACV,gBAAA,QAAQ,EAAE,CAAC;AACX,gBAAA,MAAM,EAAE,QAAQ;AAChB,gBAAA,IAAI,EAAE,WAAW;AAClB,aAAA,EAAA;YAEDA,cAAC,CAAA,aAAA,CAAA,aAAa,EAAC,EAAA,MAAM,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,EAAI,CAAA,CAC7B,CACT;AACN,IAAAA,cAAA,CAAA,aAAA,CAAC,IAAI,EAAA,EAAC,OAAO,EAAC,MAAM,EAAC,KAAK,EAAE,EAAE,UAAU,EAAE,KAAK,CAAC,EAAE,EAAE,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,EAAE,EAEnF,EAAA,gBAAA,CAAA,CACC;;;;"}
@@ -1,9 +0,0 @@
1
- 'use strict';
2
-
3
- var ___$insertStyle = require('../../../../_virtual/____insertStyle.cjs');
4
-
5
- ___$insertStyle("._uploadedFileContainer_1lguk_1 {\n border: 1px solid var(--colors-neutral-ink-lightest);\n border-radius: var(--radius-base);\n padding: var(--sizes-3);\n}\n\n._uploadedFileContainerCriticalError_1lguk_7 {\n border: 1px solid var(--colors-secondary-red-base);\n border-radius: var(--radius-base);\n padding: var(--sizes-3);\n}\n\n._singleLineText_1lguk_13 {\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n flex: 0 1 80%;\n min-width: 0;\n}\n\n._singleLineTextWithoutFlex_1lguk_21 {\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n flex: none;\n min-width: 0;\n width: 100%;\n}\n\n._fileSizeText_1lguk_30 {\n white-space: nowrap;\n flex: 0 0 20%;\n text-align: right;\n}\n\n._previewImage_1lguk_36 img {\n border: 1px solid var(--colors-neutral-ink-lightest);\n border-radius: var(--sizes-xs);\n}");
6
- var uploadFileStyles = {"uploadedFileContainer":"_uploadedFileContainer_1lguk_1","uploadedFileContainerCriticalError":"_uploadedFileContainerCriticalError_1lguk_7","singleLineText":"_singleLineText_1lguk_13","singleLineTextWithoutFlex":"_singleLineTextWithoutFlex_1lguk_21","fileSizeText":"_fileSizeText_1lguk_30","previewImage":"_previewImage_1lguk_36"};
7
-
8
- module.exports = uploadFileStyles;
9
- //# sourceMappingURL=UploadedFile.module.scss.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"UploadedFile.module.scss.cjs","sources":["../../../../../src/components/UploadFile/components/UploadedFile/UploadedFile.module.scss"],"sourcesContent":[".uploadedFileContainer {\n border: 1px solid var(--colors-neutral-ink-lightest);\n border-radius: var(--radius-base);\n padding: var(--sizes-3);\n}\n\n.uploadedFileContainerCriticalError {\n border: 1px solid var(--colors-secondary-red-base);\n border-radius: var(--radius-base);\n padding: var(--sizes-3);\n}\n\n.singleLineText {\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n flex: 0 1 80%;\n min-width: 0;\n}\n\n.singleLineTextWithoutFlex {\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n flex: none;\n min-width: 0;\n width: 100%;\n}\n\n.fileSizeText {\n white-space: nowrap;\n flex: 0 0 20%;\n text-align: right;\n}\n\n.previewImage {\n img {\n border: 1px solid var(--colors-neutral-ink-lightest);\n border-radius: var(--sizes-xs);\n }\n}\n"],"names":[],"mappings":";;;;AACE,eAAA,CAAA,m2BAAA;AACA,uBAAA,CAAA,uBAAA,CAAA,gCAAA,CAAA,oCAAA,CAAA,6CAAA,CAAA,gBAAA,CAAA,0BAAA,CAAA,2BAAA,CAAA,qCAAA,CAAA,cAAA,CAAA,wBAAA,CAAA,cAAA,CAAA,wBAAA;;;;"}
@@ -1,7 +0,0 @@
1
- import insertStyle from '../../../../_virtual/____insertStyle.js';
2
-
3
- insertStyle("._uploadedFileContainer_1lguk_1 {\n border: 1px solid var(--colors-neutral-ink-lightest);\n border-radius: var(--radius-base);\n padding: var(--sizes-3);\n}\n\n._uploadedFileContainerCriticalError_1lguk_7 {\n border: 1px solid var(--colors-secondary-red-base);\n border-radius: var(--radius-base);\n padding: var(--sizes-3);\n}\n\n._singleLineText_1lguk_13 {\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n flex: 0 1 80%;\n min-width: 0;\n}\n\n._singleLineTextWithoutFlex_1lguk_21 {\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n flex: none;\n min-width: 0;\n width: 100%;\n}\n\n._fileSizeText_1lguk_30 {\n white-space: nowrap;\n flex: 0 0 20%;\n text-align: right;\n}\n\n._previewImage_1lguk_36 img {\n border: 1px solid var(--colors-neutral-ink-lightest);\n border-radius: var(--sizes-xs);\n}");
4
- var uploadFileStyles = {"uploadedFileContainer":"_uploadedFileContainer_1lguk_1","uploadedFileContainerCriticalError":"_uploadedFileContainerCriticalError_1lguk_7","singleLineText":"_singleLineText_1lguk_13","singleLineTextWithoutFlex":"_singleLineTextWithoutFlex_1lguk_21","fileSizeText":"_fileSizeText_1lguk_30","previewImage":"_previewImage_1lguk_36"};
5
-
6
- export { uploadFileStyles as default };
7
- //# sourceMappingURL=UploadedFile.module.scss.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"UploadedFile.module.scss.js","sources":["../../../../../src/components/UploadFile/components/UploadedFile/UploadedFile.module.scss"],"sourcesContent":[".uploadedFileContainer {\n border: 1px solid var(--colors-neutral-ink-lightest);\n border-radius: var(--radius-base);\n padding: var(--sizes-3);\n}\n\n.uploadedFileContainerCriticalError {\n border: 1px solid var(--colors-secondary-red-base);\n border-radius: var(--radius-base);\n padding: var(--sizes-3);\n}\n\n.singleLineText {\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n flex: 0 1 80%;\n min-width: 0;\n}\n\n.singleLineTextWithoutFlex {\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n flex: none;\n min-width: 0;\n width: 100%;\n}\n\n.fileSizeText {\n white-space: nowrap;\n flex: 0 0 20%;\n text-align: right;\n}\n\n.previewImage {\n img {\n border: 1px solid var(--colors-neutral-ink-lightest);\n border-radius: var(--sizes-xs);\n }\n}\n"],"names":["___$insertStyle"],"mappings":";;AACEA,WAAA,CAAA,m2BAAA;AACA,uBAAA,CAAA,uBAAA,CAAA,gCAAA,CAAA,oCAAA,CAAA,6CAAA,CAAA,gBAAA,CAAA,0BAAA,CAAA,2BAAA,CAAA,qCAAA,CAAA,cAAA,CAAA,wBAAA,CAAA,cAAA,CAAA,wBAAA;;;;"}
@@ -1 +0,0 @@
1
- export { useFileErrorMessages } from './useFileErrorMessages';
@@ -1,39 +0,0 @@
1
- 'use strict';
2
-
3
- var React = require('react');
4
- var constants = require('../../constants.cjs');
5
- var convertFileTypeToAcceptedFileType = require('../../utils/convertFileTypeToAcceptedFileExtension/convertFileTypeToAcceptedFileType.cjs');
6
-
7
- const useFileErrorMessages = ({ format, maxBytes, fileTypes, file, }) => {
8
- const [errorMessages, setErrorMessages] = React.useState({ criticalErrors: [] });
9
- React.useEffect(() => {
10
- if (!file)
11
- return;
12
- const extension = convertFileTypeToAcceptedFileType.convertFileTypeToAcceptedFileExtension(file.type);
13
- const isTypeValid = fileTypes.includes(extension);
14
- const hasInvalidFormat = !isTypeValid;
15
- const hasExceededMaxSize = file.size > maxBytes;
16
- const errors = { criticalErrors: [] };
17
- if (hasExceededMaxSize) {
18
- errors.criticalErrors.push({
19
- errorType: constants.ErrorType.critical,
20
- errorMessage: 'File is too big',
21
- });
22
- }
23
- if (hasInvalidFormat) {
24
- errors.criticalErrors.push({
25
- errorType: constants.ErrorType.critical,
26
- errorMessage: 'Invalid format',
27
- });
28
- }
29
- setErrorMessages(errors);
30
- }, [file, fileTypes, format, maxBytes]);
31
- const hasCriticalErrors = !!errorMessages.criticalErrors.length;
32
- return {
33
- hasCriticalErrors,
34
- errorMessages,
35
- };
36
- };
37
-
38
- exports.useFileErrorMessages = useFileErrorMessages;
39
- //# sourceMappingURL=useFileErrorMessages.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useFileErrorMessages.cjs","sources":["../../../../../src/components/UploadFile/hooks/useFileErrorMessages/useFileErrorMessages.ts"],"sourcesContent":["import { useState, useEffect } from 'react';\nimport { AcceptedFileTypes, ErrorType, FileSizeUnit } from '../../constants';\nimport { UploadFileErrors } from '../../types';\nimport { convertFileTypeToAcceptedFileExtension } from '../../utils/convertFileTypeToAcceptedFileExtension';\n\ntype UseFileErrorMessagesProps = {\n file?: File | null;\n format: FileSizeUnit;\n maxBytes: number;\n fileTypes: Array<AcceptedFileTypes>;\n};\n\nexport const useFileErrorMessages = ({\n format,\n maxBytes,\n fileTypes,\n file,\n}: UseFileErrorMessagesProps) => {\n const [errorMessages, setErrorMessages] = useState<UploadFileErrors>({ criticalErrors: [] });\n\n useEffect(() => {\n if (!file) return;\n\n const extension = convertFileTypeToAcceptedFileExtension(file.type);\n const isTypeValid = (fileTypes as string[]).includes(extension);\n const hasInvalidFormat = !isTypeValid;\n\n const hasExceededMaxSize = file.size > maxBytes;\n\n const errors: UploadFileErrors = { criticalErrors: [] };\n if (hasExceededMaxSize) {\n errors.criticalErrors.push({\n errorType: ErrorType.critical,\n errorMessage: 'File is too big',\n });\n }\n if (hasInvalidFormat) {\n errors.criticalErrors.push({\n errorType: ErrorType.critical,\n errorMessage: 'Invalid format',\n });\n }\n setErrorMessages(errors);\n }, [file, fileTypes, format, maxBytes]);\n\n const hasCriticalErrors = !!errorMessages.criticalErrors.length;\n\n return {\n hasCriticalErrors,\n errorMessages,\n };\n};\n"],"names":["useState","useEffect","convertFileTypeToAcceptedFileExtension","ErrorType"],"mappings":";;;;;;AAYO,MAAM,oBAAoB,GAAG,CAAC,EACnC,MAAM,EACN,QAAQ,EACR,SAAS,EACT,IAAI,GACsB,KAAI;AAC9B,IAAA,MAAM,CAAC,aAAa,EAAE,gBAAgB,CAAC,GAAGA,cAAQ,CAAmB,EAAE,cAAc,EAAE,EAAE,EAAE,CAAC;IAE5FC,eAAS,CAAC,MAAK;AACb,QAAA,IAAI,CAAC,IAAI;YAAE;QAEX,MAAM,SAAS,GAAGC,wEAAsC,CAAC,IAAI,CAAC,IAAI,CAAC;QACnE,MAAM,WAAW,GAAI,SAAsB,CAAC,QAAQ,CAAC,SAAS,CAAC;AAC/D,QAAA,MAAM,gBAAgB,GAAG,CAAC,WAAW;AAErC,QAAA,MAAM,kBAAkB,GAAG,IAAI,CAAC,IAAI,GAAG,QAAQ;AAE/C,QAAA,MAAM,MAAM,GAAqB,EAAE,cAAc,EAAE,EAAE,EAAE;AACvD,QAAA,IAAI,kBAAkB,EAAE;AACtB,YAAA,MAAM,CAAC,cAAc,CAAC,IAAI,CAAC;gBACzB,SAAS,EAAEC,mBAAS,CAAC,QAAQ;AAC7B,gBAAA,YAAY,EAAE,iBAAiB;AAChC,aAAA,CAAC;AACH;AACD,QAAA,IAAI,gBAAgB,EAAE;AACpB,YAAA,MAAM,CAAC,cAAc,CAAC,IAAI,CAAC;gBACzB,SAAS,EAAEA,mBAAS,CAAC,QAAQ;AAC7B,gBAAA,YAAY,EAAE,gBAAgB;AAC/B,aAAA,CAAC;AACH;QACD,gBAAgB,CAAC,MAAM,CAAC;KACzB,EAAE,CAAC,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC;IAEvC,MAAM,iBAAiB,GAAG,CAAC,CAAC,aAAa,CAAC,cAAc,CAAC,MAAM;IAE/D,OAAO;QACL,iBAAiB;QACjB,aAAa;KACd;AACH;;;;"}
@@ -1,13 +0,0 @@
1
- import { AcceptedFileTypes, FileSizeUnit } from '../../constants';
2
- import { UploadFileErrors } from '../../types';
3
- type UseFileErrorMessagesProps = {
4
- file?: File | null;
5
- format: FileSizeUnit;
6
- maxBytes: number;
7
- fileTypes: Array<AcceptedFileTypes>;
8
- };
9
- export declare const useFileErrorMessages: ({ format, maxBytes, fileTypes, file, }: UseFileErrorMessagesProps) => {
10
- hasCriticalErrors: boolean;
11
- errorMessages: UploadFileErrors;
12
- };
13
- export {};
@@ -1,37 +0,0 @@
1
- import { useState, useEffect } from 'react';
2
- import { ErrorType } from '../../constants.js';
3
- import { convertFileTypeToAcceptedFileExtension } from '../../utils/convertFileTypeToAcceptedFileExtension/convertFileTypeToAcceptedFileType.js';
4
-
5
- const useFileErrorMessages = ({ format, maxBytes, fileTypes, file, }) => {
6
- const [errorMessages, setErrorMessages] = useState({ criticalErrors: [] });
7
- useEffect(() => {
8
- if (!file)
9
- return;
10
- const extension = convertFileTypeToAcceptedFileExtension(file.type);
11
- const isTypeValid = fileTypes.includes(extension);
12
- const hasInvalidFormat = !isTypeValid;
13
- const hasExceededMaxSize = file.size > maxBytes;
14
- const errors = { criticalErrors: [] };
15
- if (hasExceededMaxSize) {
16
- errors.criticalErrors.push({
17
- errorType: ErrorType.critical,
18
- errorMessage: 'File is too big',
19
- });
20
- }
21
- if (hasInvalidFormat) {
22
- errors.criticalErrors.push({
23
- errorType: ErrorType.critical,
24
- errorMessage: 'Invalid format',
25
- });
26
- }
27
- setErrorMessages(errors);
28
- }, [file, fileTypes, format, maxBytes]);
29
- const hasCriticalErrors = !!errorMessages.criticalErrors.length;
30
- return {
31
- hasCriticalErrors,
32
- errorMessages,
33
- };
34
- };
35
-
36
- export { useFileErrorMessages };
37
- //# sourceMappingURL=useFileErrorMessages.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useFileErrorMessages.js","sources":["../../../../../src/components/UploadFile/hooks/useFileErrorMessages/useFileErrorMessages.ts"],"sourcesContent":["import { useState, useEffect } from 'react';\nimport { AcceptedFileTypes, ErrorType, FileSizeUnit } from '../../constants';\nimport { UploadFileErrors } from '../../types';\nimport { convertFileTypeToAcceptedFileExtension } from '../../utils/convertFileTypeToAcceptedFileExtension';\n\ntype UseFileErrorMessagesProps = {\n file?: File | null;\n format: FileSizeUnit;\n maxBytes: number;\n fileTypes: Array<AcceptedFileTypes>;\n};\n\nexport const useFileErrorMessages = ({\n format,\n maxBytes,\n fileTypes,\n file,\n}: UseFileErrorMessagesProps) => {\n const [errorMessages, setErrorMessages] = useState<UploadFileErrors>({ criticalErrors: [] });\n\n useEffect(() => {\n if (!file) return;\n\n const extension = convertFileTypeToAcceptedFileExtension(file.type);\n const isTypeValid = (fileTypes as string[]).includes(extension);\n const hasInvalidFormat = !isTypeValid;\n\n const hasExceededMaxSize = file.size > maxBytes;\n\n const errors: UploadFileErrors = { criticalErrors: [] };\n if (hasExceededMaxSize) {\n errors.criticalErrors.push({\n errorType: ErrorType.critical,\n errorMessage: 'File is too big',\n });\n }\n if (hasInvalidFormat) {\n errors.criticalErrors.push({\n errorType: ErrorType.critical,\n errorMessage: 'Invalid format',\n });\n }\n setErrorMessages(errors);\n }, [file, fileTypes, format, maxBytes]);\n\n const hasCriticalErrors = !!errorMessages.criticalErrors.length;\n\n return {\n hasCriticalErrors,\n errorMessages,\n };\n};\n"],"names":[],"mappings":";;;;AAYO,MAAM,oBAAoB,GAAG,CAAC,EACnC,MAAM,EACN,QAAQ,EACR,SAAS,EACT,IAAI,GACsB,KAAI;AAC9B,IAAA,MAAM,CAAC,aAAa,EAAE,gBAAgB,CAAC,GAAG,QAAQ,CAAmB,EAAE,cAAc,EAAE,EAAE,EAAE,CAAC;IAE5F,SAAS,CAAC,MAAK;AACb,QAAA,IAAI,CAAC,IAAI;YAAE;QAEX,MAAM,SAAS,GAAG,sCAAsC,CAAC,IAAI,CAAC,IAAI,CAAC;QACnE,MAAM,WAAW,GAAI,SAAsB,CAAC,QAAQ,CAAC,SAAS,CAAC;AAC/D,QAAA,MAAM,gBAAgB,GAAG,CAAC,WAAW;AAErC,QAAA,MAAM,kBAAkB,GAAG,IAAI,CAAC,IAAI,GAAG,QAAQ;AAE/C,QAAA,MAAM,MAAM,GAAqB,EAAE,cAAc,EAAE,EAAE,EAAE;AACvD,QAAA,IAAI,kBAAkB,EAAE;AACtB,YAAA,MAAM,CAAC,cAAc,CAAC,IAAI,CAAC;gBACzB,SAAS,EAAE,SAAS,CAAC,QAAQ;AAC7B,gBAAA,YAAY,EAAE,iBAAiB;AAChC,aAAA,CAAC;AACH;AACD,QAAA,IAAI,gBAAgB,EAAE;AACpB,YAAA,MAAM,CAAC,cAAc,CAAC,IAAI,CAAC;gBACzB,SAAS,EAAE,SAAS,CAAC,QAAQ;AAC7B,gBAAA,YAAY,EAAE,gBAAgB;AAC/B,aAAA,CAAC;AACH;QACD,gBAAgB,CAAC,MAAM,CAAC;KACzB,EAAE,CAAC,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC;IAEvC,MAAM,iBAAiB,GAAG,CAAC,CAAC,aAAa,CAAC,cAAc,CAAC,MAAM;IAE/D,OAAO;QACL,iBAAiB;QACjB,aAAa;KACd;AACH;;;;"}
@@ -1 +0,0 @@
1
- export { usePreviewImage } from './usePreviewImage';
@@ -1,36 +0,0 @@
1
- 'use strict';
2
-
3
- var React = require('react');
4
- var isImageType = require('../../utils/isImageType/isImageType.cjs');
5
-
6
- const usePreviewImage = ({ file }) => {
7
- const [previewSrc, setPreviewSrc] = React.useState('');
8
- React.useEffect(() => {
9
- if (!file) {
10
- setPreviewSrc('');
11
- return undefined;
12
- }
13
- if (!isImageType.isImageType(file)) {
14
- setPreviewSrc('');
15
- return undefined;
16
- }
17
- const fileReader = new FileReader();
18
- fileReader.onload = (event) => {
19
- var _a;
20
- const imageUrl = (_a = event.target) === null || _a === undefined ? undefined : _a.result;
21
- setPreviewSrc(String(imageUrl));
22
- };
23
- fileReader.readAsDataURL(file);
24
- return () => {
25
- fileReader.abort();
26
- };
27
- }, [file]);
28
- const shouldShowPreview = file ? isImageType.isImageType(file) : false;
29
- return {
30
- previewSrc,
31
- shouldShowPreview,
32
- };
33
- };
34
-
35
- exports.usePreviewImage = usePreviewImage;
36
- //# sourceMappingURL=usePreviewImage.cjs.map