@spaced-out/ui-design-system 0.3.42 → 0.3.44

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 (65) hide show
  1. package/.cspell/custom-words.txt +1 -0
  2. package/.github/workflows/pages.yml +1 -1
  3. package/.github/workflows/publish_to_npm.yml +2 -12
  4. package/.github/workflows/pull_request_checks.yml +1 -11
  5. package/.storybook/SenseTheme.js +1 -1
  6. package/.storybook/main.js +16 -40
  7. package/.storybook/manager.js +2 -3
  8. package/.storybook/preview.js +22 -1
  9. package/.vscode/settings.json +2 -1
  10. package/CHANGELOG.md +26 -0
  11. package/CONTRIBUTING.md +19 -0
  12. package/dts-generator/package.json +1 -1
  13. package/lib/components/EmptyState/EmptyImages/ChartEmptyImage.d.ts +2 -2
  14. package/lib/components/EmptyState/EmptyImages/ChartEmptyImage.js +2 -2
  15. package/lib/components/EmptyState/EmptyImages/ChartEmptyImage.js.flow +2 -2
  16. package/lib/components/FilterButtonOverlay/FilterButtonOverlay.d.ts +130 -0
  17. package/lib/components/FilterButtonOverlay/FilterButtonOverlay.js +90 -0
  18. package/lib/components/FilterButtonOverlay/FilterButtonOverlay.js.flow +135 -0
  19. package/lib/components/FilterButtonOverlay/FilterButtonOverlay.module.css +35 -0
  20. package/lib/components/FilterButtonOverlay/index.d.ts +1 -0
  21. package/lib/components/FilterButtonOverlay/index.js +16 -0
  22. package/lib/components/FilterButtonOverlay/index.js.flow +3 -0
  23. package/lib/components/Icon/ClickableIcon.d.ts +2 -1
  24. package/lib/components/Icon/ClickableIcon.js +3 -2
  25. package/lib/components/Icon/ClickableIcon.js.flow +2 -1
  26. package/lib/components/Icon/ClickableIcon.module.css +2 -2
  27. package/lib/components/Icon/Icon.docs.d.ts +15 -1
  28. package/lib/components/Icon/Icon.docs.js +15 -1
  29. package/lib/components/Icon/Icon.docs.js.flow +11 -1
  30. package/lib/components/InfinitePagination/InfinitePagination.d.ts +112 -0
  31. package/lib/components/InfinitePagination/InfinitePagination.js +84 -0
  32. package/lib/components/InfinitePagination/InfinitePagination.js.flow +122 -0
  33. package/lib/components/InfinitePagination/InfinitePagination.module.css +18 -0
  34. package/lib/components/InfinitePagination/index.d.ts +1 -0
  35. package/lib/components/InfinitePagination/index.js +16 -0
  36. package/lib/components/InfinitePagination/index.js.flow +3 -0
  37. package/lib/components/SemanticAIIcon/BadgedIcon.d.ts +70 -0
  38. package/lib/components/SemanticAIIcon/BadgedIcon.js +54 -0
  39. package/lib/components/SemanticAIIcon/BadgedIcon.js.flow +73 -0
  40. package/lib/components/SemanticAIIcon/BadgedIcon.module.css +88 -0
  41. package/lib/components/SemanticAIIcon/index.d.ts +1 -0
  42. package/lib/components/SemanticAIIcon/index.js +16 -0
  43. package/lib/components/SemanticAIIcon/index.js.flow +3 -0
  44. package/lib/components/Table/Table.docs.d.ts +1 -1
  45. package/lib/components/Table/Table.docs.js +1 -1
  46. package/lib/components/Table/Table.docs.js.flow +1 -1
  47. package/lib/components/index.d.ts +3 -0
  48. package/lib/components/index.js +33 -0
  49. package/lib/components/index.js.flow +3 -0
  50. package/lib/hooks/index.d.ts +2 -0
  51. package/lib/hooks/index.js +22 -0
  52. package/lib/hooks/index.js.flow +2 -0
  53. package/lib/hooks/useInfiniteScroll/index.d.ts +1 -0
  54. package/lib/hooks/useInfiniteScroll/index.js +16 -0
  55. package/lib/hooks/useInfiniteScroll/index.js.flow +3 -0
  56. package/lib/hooks/useInfiniteScroll/useInfiniteScroll.d.ts +77 -0
  57. package/lib/hooks/useInfiniteScroll/useInfiniteScroll.js +58 -0
  58. package/lib/hooks/useInfiniteScroll/useInfiniteScroll.js.flow +82 -0
  59. package/lib/hooks/useResizeObserver/index.d.ts +1 -0
  60. package/lib/hooks/useResizeObserver/index.js +16 -0
  61. package/lib/hooks/useResizeObserver/index.js.flow +3 -0
  62. package/lib/hooks/useResizeObserver/useResizeObserver.d.ts +22 -0
  63. package/lib/hooks/useResizeObserver/useResizeObserver.js +30 -0
  64. package/lib/hooks/useResizeObserver/useResizeObserver.js.flow +28 -0
  65. package/package.json +9 -16
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ var _InfinitePagination = require("./InfinitePagination");
7
+ Object.keys(_InfinitePagination).forEach(function (key) {
8
+ if (key === "default" || key === "__esModule") return;
9
+ if (key in exports && exports[key] === _InfinitePagination[key]) return;
10
+ Object.defineProperty(exports, key, {
11
+ enumerable: true,
12
+ get: function () {
13
+ return _InfinitePagination[key];
14
+ }
15
+ });
16
+ });
@@ -0,0 +1,3 @@
1
+ // @flow strict
2
+
3
+ export * from './InfinitePagination';
@@ -0,0 +1,70 @@
1
+ import {$ReadOnly} from 'utility-types';
2
+ import * as React from 'react';
3
+ import {TEXT_COLORS} from '../../types/typography';
4
+ import classify from '../../utils/classify';
5
+ import type {IconSize, IconType} from '../Icon';
6
+ import {Icon} from '../Icon';
7
+ import typographyStyle from '../../styles/typography.module.css';
8
+ import css from './BadgedIcon.module.css';
9
+ type ClassNames = $ReadOnly<{
10
+ wrapper?: string;
11
+ icon?: string;
12
+ badgeIcon?: string;
13
+ }>;
14
+ export type BadgedIconProps = {
15
+ type?: IconType;
16
+ name: string;
17
+ size?: IconSize;
18
+ ariaLabel?: string;
19
+ showBadge?: boolean;
20
+ classNames?: ClassNames;
21
+ };
22
+ export const BadgedIcon = ({
23
+ name,
24
+ showBadge = true,
25
+ classNames,
26
+ size = 'medium',
27
+ type = 'solid',
28
+ ariaLabel,
29
+ }: BadgedIconProps): React.ReactNode => (
30
+ <>
31
+ {!!name && (
32
+ <div
33
+ className={classify(css.iconContainer, css[size], classNames?.wrapper)}
34
+ >
35
+ <Icon
36
+ ariaLabel={ariaLabel}
37
+ name={name}
38
+ className={classNames?.icon}
39
+ name={name}
40
+ size={size === 'large' ? 'medium' : size}
41
+ type={type}
42
+ color={TEXT_COLORS.clickable}
43
+ />
44
+ {showBadge && <BadgeIcon className={classNames?.badgeIcon} />}
45
+ </div>
46
+ )}
47
+ </>
48
+ );
49
+
50
+ const BadgeIcon = ({
51
+ className,
52
+ }: {
53
+ className: string | null | undefined;
54
+ }): React.ReactNode => (
55
+ <svg
56
+ className={classify(
57
+ css.badgeIcon,
58
+ typographyStyle[TEXT_COLORS['clickable']],
59
+ className,
60
+ )}
61
+ viewBox="0 0 12 13"
62
+ fill="none"
63
+ xmlns="http://www.w3.org/2000/svg"
64
+ >
65
+ <path
66
+ d="M6.46573 1.0335L8.10352 4.61465L11.6941 6.24816C11.883 6.3424 12.009 6.53088 12.009 6.71936C12.009 6.90784 11.883 7.09632 11.6941 7.15915L8.10352 8.82407L6.46573 12.4052C6.37124 12.5937 6.18226 12.7194 5.99329 12.7194C5.80431 12.7194 5.61533 12.5937 5.55234 12.4052L3.88305 8.82407L0.292498 7.19056C0.103521 7.09632 0.0090332 6.90784 0.0090332 6.71936C0.0090332 6.53088 0.103521 6.3424 0.292498 6.24816L3.88305 4.61465L5.55234 1.0335C5.61533 0.845015 5.80431 0.71936 5.99329 0.71936C6.18226 0.71936 6.37124 0.845015 6.46573 1.0335Z"
67
+ fill="currentColor"
68
+ />
69
+ </svg>
70
+ );
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.BadgedIcon = void 0;
7
+ var React = _interopRequireWildcard(require("react"));
8
+ var _typography = require("../../types/typography");
9
+ var _classify = _interopRequireDefault(require("../../utils/classify"));
10
+ var _Icon = require("../Icon");
11
+ var _typographyModule = _interopRequireDefault(require("../../styles/typography.module.css"));
12
+ var _BadgedIconModule = _interopRequireDefault(require("./BadgedIcon.module.css"));
13
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
14
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
15
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
16
+
17
+ const BadgedIcon = _ref => {
18
+ let {
19
+ name,
20
+ showBadge = true,
21
+ classNames,
22
+ size = 'medium',
23
+ type = 'solid',
24
+ ariaLabel
25
+ } = _ref;
26
+ return /*#__PURE__*/React.createElement(React.Fragment, null, !!name && /*#__PURE__*/React.createElement("div", {
27
+ className: (0, _classify.default)(_BadgedIconModule.default.iconContainer, _BadgedIconModule.default[size], classNames?.wrapper)
28
+ }, /*#__PURE__*/React.createElement(_Icon.Icon, {
29
+ ariaLabel: ariaLabel,
30
+ name: name,
31
+ className: classNames?.icon,
32
+ name: name,
33
+ size: size === 'large' ? 'medium' : size,
34
+ type: type,
35
+ color: _typography.TEXT_COLORS.clickable
36
+ }), showBadge && /*#__PURE__*/React.createElement(BadgeIcon, {
37
+ className: classNames?.badgeIcon
38
+ })));
39
+ };
40
+ exports.BadgedIcon = BadgedIcon;
41
+ const BadgeIcon = _ref2 => {
42
+ let {
43
+ className
44
+ } = _ref2;
45
+ return /*#__PURE__*/React.createElement("svg", {
46
+ className: (0, _classify.default)(_BadgedIconModule.default.badgeIcon, _typographyModule.default[_typography.TEXT_COLORS['clickable']], className),
47
+ viewBox: "0 0 12 13",
48
+ fill: "none",
49
+ xmlns: "http://www.w3.org/2000/svg"
50
+ }, /*#__PURE__*/React.createElement("path", {
51
+ d: "M6.46573 1.0335L8.10352 4.61465L11.6941 6.24816C11.883 6.3424 12.009 6.53088 12.009 6.71936C12.009 6.90784 11.883 7.09632 11.6941 7.15915L8.10352 8.82407L6.46573 12.4052C6.37124 12.5937 6.18226 12.7194 5.99329 12.7194C5.80431 12.7194 5.61533 12.5937 5.55234 12.4052L3.88305 8.82407L0.292498 7.19056C0.103521 7.09632 0.0090332 6.90784 0.0090332 6.71936C0.0090332 6.53088 0.103521 6.3424 0.292498 6.24816L3.88305 4.61465L5.55234 1.0335C5.61533 0.845015 5.80431 0.71936 5.99329 0.71936C6.18226 0.71936 6.37124 0.845015 6.46573 1.0335Z",
52
+ fill: "currentColor"
53
+ }));
54
+ };
@@ -0,0 +1,73 @@
1
+ // @flow strict
2
+
3
+ import * as React from 'react';
4
+
5
+ import {TEXT_COLORS} from '../../types/typography';
6
+ import classify from '../../utils/classify';
7
+ import type {IconSize, IconType} from '../Icon';
8
+ import {Icon} from '../Icon';
9
+
10
+ import typographyStyle from '../../styles/typography.module.css';
11
+ import css from './BadgedIcon.module.css';
12
+
13
+
14
+ type ClassNames = $ReadOnly<{
15
+ wrapper?: string,
16
+ icon?: string,
17
+ badgeIcon?: string,
18
+ }>;
19
+
20
+ export type BadgedIconProps = {
21
+ type?: IconType,
22
+ name: string,
23
+ size?: IconSize,
24
+ ariaLabel?: string,
25
+ showBadge?: boolean,
26
+ classNames?: ClassNames,
27
+ };
28
+
29
+ export const BadgedIcon = ({
30
+ name,
31
+ showBadge = true,
32
+ classNames,
33
+ size = 'medium',
34
+ type = 'solid',
35
+ ariaLabel,
36
+ }: BadgedIconProps): React.Node => (
37
+ <>
38
+ {!!name && (
39
+ <div
40
+ className={classify(css.iconContainer, css[size], classNames?.wrapper)}
41
+ >
42
+ <Icon
43
+ ariaLabel={ariaLabel}
44
+ name={name}
45
+ className={classNames?.icon}
46
+ name={name}
47
+ size={size === 'large' ? 'medium' : size}
48
+ type={type}
49
+ color={TEXT_COLORS.clickable}
50
+ />
51
+ {showBadge && <BadgeIcon className={classNames?.badgeIcon} />}
52
+ </div>
53
+ )}
54
+ </>
55
+ );
56
+
57
+ const BadgeIcon = ({className}: {className: ?string}): React.Node => (
58
+ <svg
59
+ className={classify(
60
+ css.badgeIcon,
61
+ typographyStyle[TEXT_COLORS['clickable']],
62
+ className,
63
+ )}
64
+ viewBox="0 0 12 13"
65
+ fill="none"
66
+ xmlns="http://www.w3.org/2000/svg"
67
+ >
68
+ <path
69
+ d="M6.46573 1.0335L8.10352 4.61465L11.6941 6.24816C11.883 6.3424 12.009 6.53088 12.009 6.71936C12.009 6.90784 11.883 7.09632 11.6941 7.15915L8.10352 8.82407L6.46573 12.4052C6.37124 12.5937 6.18226 12.7194 5.99329 12.7194C5.80431 12.7194 5.61533 12.5937 5.55234 12.4052L3.88305 8.82407L0.292498 7.19056C0.103521 7.09632 0.0090332 6.90784 0.0090332 6.71936C0.0090332 6.53088 0.103521 6.3424 0.292498 6.24816L3.88305 4.61465L5.55234 1.0335C5.61533 0.845015 5.80431 0.71936 5.99329 0.71936C6.18226 0.71936 6.37124 0.845015 6.46573 1.0335Z"
70
+ fill="currentColor"
71
+ />
72
+ </svg>
73
+ );
@@ -0,0 +1,88 @@
1
+ @value (colorBackgroundTertiary) from '../../styles/variables/_color.css';
2
+
3
+ @value (
4
+ size42,
5
+ size34,
6
+ size60,
7
+ size8,
8
+ size12,
9
+ size2,
10
+ size4
11
+ ) from '../../styles/variables/_size.css';
12
+
13
+ @value (
14
+ borderRadiusMedium,
15
+ borderRadiusCircle
16
+ ) from '../../styles/variables/_border.css';
17
+
18
+ @value (
19
+ motionEaseInEaseOut,
20
+ motionDurationSlow
21
+ ) from '../../styles/variables/_motion.css';
22
+
23
+ @value (
24
+ spaceNone,
25
+ spaceMedium,
26
+ spaceXSmall
27
+ ) from '../../styles/variables/_space.css';
28
+
29
+ .iconContainer {
30
+ display: flex;
31
+ width: fit-content;
32
+ min-width: size34;
33
+ min-height: size34;
34
+ justify-content: center;
35
+ align-items: center;
36
+ border-radius: borderRadiusMedium;
37
+ position: relative;
38
+ background: linear-gradient(
39
+ 91deg,
40
+ rgba(204, 192, 240, 0.5) 0%,
41
+ rgba(178, 209, 250, 0.5) 100%
42
+ ),
43
+ colorBackgroundTertiary;
44
+ }
45
+
46
+ .medium {
47
+ width: size42;
48
+ height: size42;
49
+ }
50
+
51
+ .small {
52
+ width: size34;
53
+ height: size34;
54
+ }
55
+
56
+ .large {
57
+ width: size60;
58
+ height: size60;
59
+ }
60
+
61
+ .iconContainer:hover .badgeIcon {
62
+ transform: rotate(-90deg);
63
+ }
64
+
65
+ .badgeIcon {
66
+ position: absolute;
67
+ border-radius: borderRadiusCircle;
68
+ top: calc(size2 * -1);
69
+ right: calc(size4 * -1);
70
+ transition: transform motionDurationSlow motionEaseInEaseOut;
71
+ }
72
+
73
+ .small .badgeIcon {
74
+ width: size8;
75
+ height: size8;
76
+ left: calc(spaceMedium + spaceXSmall);
77
+ top: spaceNone;
78
+ }
79
+
80
+ .medium .badgeIcon {
81
+ width: size12;
82
+ height: size12;
83
+ }
84
+
85
+ .large .badgeIcon {
86
+ width: size12;
87
+ height: size12;
88
+ }
@@ -0,0 +1 @@
1
+ export * from './BadgedIcon';
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ var _BadgedIcon = require("./BadgedIcon");
7
+ Object.keys(_BadgedIcon).forEach(function (key) {
8
+ if (key === "default" || key === "__esModule") return;
9
+ if (key in exports && exports[key] === _BadgedIcon[key]) return;
10
+ Object.defineProperty(exports, key, {
11
+ enumerable: true,
12
+ get: function () {
13
+ return _BadgedIcon[key];
14
+ }
15
+ });
16
+ });
@@ -0,0 +1,3 @@
1
+ // @flow strict
2
+
3
+ export * from './BadgedIcon';
@@ -232,8 +232,8 @@ export const TABLE_DOCS = {
232
232
  },
233
233
  },
234
234
  parameters: {
235
- componentSubtitle: 'Generates a Table component.',
236
235
  docs: {
236
+ subtitle: 'Generates a Table component.',
237
237
  description: {
238
238
  component: `
239
239
  \`\`\`js
@@ -224,8 +224,8 @@ const TABLE_DOCS = {
224
224
  }
225
225
  },
226
226
  parameters: {
227
- componentSubtitle: 'Generates a Table component.',
228
227
  docs: {
228
+ subtitle: 'Generates a Table component.',
229
229
  description: {
230
230
  component: `
231
231
  \`\`\`js
@@ -183,8 +183,8 @@ export const TABLE_DOCS = {
183
183
  },
184
184
  },
185
185
  parameters: {
186
- componentSubtitle: 'Generates a Table component.',
187
186
  docs: {
187
+ subtitle: 'Generates a Table component.',
188
188
  description: {
189
189
  component: `
190
190
  \`\`\`js
@@ -22,12 +22,14 @@ export * from './Dropdown';
22
22
  export * from './EmptyState';
23
23
  export * from './ErrorMessage';
24
24
  export * from './FileUpload';
25
+ export * from './FilterButtonOverlay';
25
26
  export * from './FocusManager';
26
27
  export * from './FocusManagerWithArrowKeyNavigation';
27
28
  export * from './FormTitleWrapper';
28
29
  export * from './Grid';
29
30
  export * from './Icon';
30
31
  export * from './InContextAlert';
32
+ export * from './InfinitePagination';
31
33
  export * from './InlineDropdown';
32
34
  export * from './Input';
33
35
  export * from './KPIBox';
@@ -49,6 +51,7 @@ export * from './RangeSlider';
49
51
  export * from './Rating';
50
52
  export * from './ScoreBar';
51
53
  export * from './SearchInput';
54
+ export * from './SemanticAIIcon';
52
55
  export * from './Separator';
53
56
  export * from './Shimmer';
54
57
  export * from './SideMenuLink';
@@ -267,6 +267,17 @@ Object.keys(_FileUpload).forEach(function (key) {
267
267
  }
268
268
  });
269
269
  });
270
+ var _FilterButtonOverlay = require("./FilterButtonOverlay");
271
+ Object.keys(_FilterButtonOverlay).forEach(function (key) {
272
+ if (key === "default" || key === "__esModule") return;
273
+ if (key in exports && exports[key] === _FilterButtonOverlay[key]) return;
274
+ Object.defineProperty(exports, key, {
275
+ enumerable: true,
276
+ get: function () {
277
+ return _FilterButtonOverlay[key];
278
+ }
279
+ });
280
+ });
270
281
  var _FocusManager = require("./FocusManager");
271
282
  Object.keys(_FocusManager).forEach(function (key) {
272
283
  if (key === "default" || key === "__esModule") return;
@@ -333,6 +344,17 @@ Object.keys(_InContextAlert).forEach(function (key) {
333
344
  }
334
345
  });
335
346
  });
347
+ var _InfinitePagination = require("./InfinitePagination");
348
+ Object.keys(_InfinitePagination).forEach(function (key) {
349
+ if (key === "default" || key === "__esModule") return;
350
+ if (key in exports && exports[key] === _InfinitePagination[key]) return;
351
+ Object.defineProperty(exports, key, {
352
+ enumerable: true,
353
+ get: function () {
354
+ return _InfinitePagination[key];
355
+ }
356
+ });
357
+ });
336
358
  var _InlineDropdown = require("./InlineDropdown");
337
359
  Object.keys(_InlineDropdown).forEach(function (key) {
338
360
  if (key === "default" || key === "__esModule") return;
@@ -564,6 +586,17 @@ Object.keys(_SearchInput).forEach(function (key) {
564
586
  }
565
587
  });
566
588
  });
589
+ var _SemanticAIIcon = require("./SemanticAIIcon");
590
+ Object.keys(_SemanticAIIcon).forEach(function (key) {
591
+ if (key === "default" || key === "__esModule") return;
592
+ if (key in exports && exports[key] === _SemanticAIIcon[key]) return;
593
+ Object.defineProperty(exports, key, {
594
+ enumerable: true,
595
+ get: function () {
596
+ return _SemanticAIIcon[key];
597
+ }
598
+ });
599
+ });
567
600
  var _Separator = require("./Separator");
568
601
  Object.keys(_Separator).forEach(function (key) {
569
602
  if (key === "default" || key === "__esModule") return;
@@ -24,12 +24,14 @@ export * from './Dropdown';
24
24
  export * from './EmptyState';
25
25
  export * from './ErrorMessage';
26
26
  export * from './FileUpload';
27
+ export * from './FilterButtonOverlay';
27
28
  export * from './FocusManager';
28
29
  export * from './FocusManagerWithArrowKeyNavigation';
29
30
  export * from './FormTitleWrapper';
30
31
  export * from './Grid';
31
32
  export * from './Icon';
32
33
  export * from './InContextAlert';
34
+ export * from './InfinitePagination';
33
35
  export * from './InlineDropdown';
34
36
  export * from './Input';
35
37
  export * from './KPIBox';
@@ -51,6 +53,7 @@ export * from './RangeSlider';
51
53
  export * from './Rating';
52
54
  export * from './ScoreBar';
53
55
  export * from './SearchInput';
56
+ export * from './SemanticAIIcon';
54
57
  export * from './Separator';
55
58
  export * from './Shimmer';
56
59
  export * from './SideMenuLink';
@@ -3,11 +3,13 @@ export * from './useCopyToClipboard';
3
3
  export * from './useDebounce';
4
4
  export * from './useFileUpload';
5
5
  export * from './useFilteredOptions';
6
+ export * from './useInfiniteScroll';
6
7
  export * from './useInputState';
7
8
  export * from './useLockedBody';
8
9
  export * from './useModal';
9
10
  export * from './useMountTransition';
10
11
  export * from './usePagination';
12
+ export * from './useResizeObserver';
11
13
  export * from './useToastPortal';
12
14
  export * from './useToggle';
13
15
  export * from './useWindowSize';
@@ -58,6 +58,17 @@ Object.keys(_useFilteredOptions).forEach(function (key) {
58
58
  }
59
59
  });
60
60
  });
61
+ var _useInfiniteScroll = require("./useInfiniteScroll");
62
+ Object.keys(_useInfiniteScroll).forEach(function (key) {
63
+ if (key === "default" || key === "__esModule") return;
64
+ if (key in exports && exports[key] === _useInfiniteScroll[key]) return;
65
+ Object.defineProperty(exports, key, {
66
+ enumerable: true,
67
+ get: function () {
68
+ return _useInfiniteScroll[key];
69
+ }
70
+ });
71
+ });
61
72
  var _useInputState = require("./useInputState");
62
73
  Object.keys(_useInputState).forEach(function (key) {
63
74
  if (key === "default" || key === "__esModule") return;
@@ -113,6 +124,17 @@ Object.keys(_usePagination).forEach(function (key) {
113
124
  }
114
125
  });
115
126
  });
127
+ var _useResizeObserver = require("./useResizeObserver");
128
+ Object.keys(_useResizeObserver).forEach(function (key) {
129
+ if (key === "default" || key === "__esModule") return;
130
+ if (key in exports && exports[key] === _useResizeObserver[key]) return;
131
+ Object.defineProperty(exports, key, {
132
+ enumerable: true,
133
+ get: function () {
134
+ return _useResizeObserver[key];
135
+ }
136
+ });
137
+ });
116
138
  var _useToastPortal = require("./useToastPortal");
117
139
  Object.keys(_useToastPortal).forEach(function (key) {
118
140
  if (key === "default" || key === "__esModule") return;
@@ -5,11 +5,13 @@ export * from './useCopyToClipboard';
5
5
  export * from './useDebounce';
6
6
  export * from './useFileUpload';
7
7
  export * from './useFilteredOptions';
8
+ export * from './useInfiniteScroll';
8
9
  export * from './useInputState';
9
10
  export * from './useLockedBody';
10
11
  export * from './useModal';
11
12
  export * from './useMountTransition';
12
13
  export * from './usePagination';
14
+ export * from './useResizeObserver';
13
15
  export * from './useToastPortal';
14
16
  export * from './useToggle';
15
17
  export * from './useWindowSize';
@@ -0,0 +1 @@
1
+ export * from './useInfiniteScroll';
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ var _useInfiniteScroll = require("./useInfiniteScroll");
7
+ Object.keys(_useInfiniteScroll).forEach(function (key) {
8
+ if (key === "default" || key === "__esModule") return;
9
+ if (key in exports && exports[key] === _useInfiniteScroll[key]) return;
10
+ Object.defineProperty(exports, key, {
11
+ enumerable: true,
12
+ get: function () {
13
+ return _useInfiniteScroll[key];
14
+ }
15
+ });
16
+ });
@@ -0,0 +1,3 @@
1
+ // @flow strict
2
+
3
+ export * from './useInfiniteScroll';
@@ -0,0 +1,77 @@
1
+ import * as React from 'react';
2
+ type InfiniteScrollOptions = {
3
+ itemSize: number | ((index: number) => number);
4
+ threshold: number;
5
+ itemsLength: number;
6
+ hasNextPage: boolean;
7
+ loadMoreItems: () => Promise<void>;
8
+ containerHeight: number;
9
+ isVariableSizeList?: boolean;
10
+ };
11
+ export function useInfiniteScroll({
12
+ itemSize,
13
+ threshold,
14
+ itemsLength,
15
+ hasNextPage,
16
+ loadMoreItems,
17
+ containerHeight,
18
+ isVariableSizeList,
19
+ }: InfiniteScrollOptions): (scrollData: {
20
+ scrollOffset: number;
21
+ scrollDirection: 'forward' | 'backward';
22
+ }) => void {
23
+ const [isLoading, setIsLoading] = React.useState(false);
24
+ const loadingRef = React.useRef(false);
25
+ const handleLoadMore = React.useCallback(async () => {
26
+ if (!hasNextPage || isLoading || loadingRef.current) {
27
+ return;
28
+ }
29
+
30
+ loadingRef.current = true;
31
+ setIsLoading(true);
32
+
33
+ try {
34
+ await loadMoreItems();
35
+ } catch (err) {
36
+ console.error('Error loading more items:', err);
37
+ } finally {
38
+ loadingRef.current = false;
39
+ setIsLoading(false);
40
+ }
41
+ }, [hasNextPage, isLoading, loadMoreItems]);
42
+ return React.useCallback(
43
+ ({scrollOffset, scrollDirection}) => {
44
+ if (scrollDirection !== 'forward') {
45
+ return;
46
+ }
47
+
48
+ let totalSize = 0;
49
+
50
+ if (isVariableSizeList && typeof itemSize === 'function') {
51
+ for (let i = 0; i < itemsLength; i++) {
52
+ totalSize += itemSize(i);
53
+ }
54
+ } else if (typeof itemSize === 'number') {
55
+ totalSize = itemsLength * itemSize;
56
+ }
57
+
58
+ if (
59
+ scrollOffset > totalSize - containerHeight - threshold &&
60
+ hasNextPage &&
61
+ !isLoading
62
+ ) {
63
+ handleLoadMore();
64
+ }
65
+ },
66
+ [
67
+ itemSize,
68
+ threshold,
69
+ isLoading,
70
+ itemsLength,
71
+ hasNextPage,
72
+ handleLoadMore,
73
+ containerHeight,
74
+ isVariableSizeList,
75
+ ],
76
+ );
77
+ }