@spaced-out/ui-design-system 0.5.37 → 0.5.39
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +20 -0
- package/design-tokens/size/base-size.json +12 -0
- package/lib/components/PastChatCard/PastChatCard.d.ts +22 -0
- package/lib/components/PastChatCard/PastChatCard.d.ts.map +1 -0
- package/lib/components/PastChatCard/PastChatCard.js +91 -0
- package/lib/components/PastChatCard/PastChatCard.module.css +83 -0
- package/lib/components/PastChatCard/index.d.ts +2 -0
- package/lib/components/PastChatCard/index.d.ts.map +1 -0
- package/lib/components/PastChatCard/index.js +16 -0
- package/lib/components/PreviewCard/PreviewCard.d.ts +30 -0
- package/lib/components/PreviewCard/PreviewCard.d.ts.map +1 -0
- package/lib/components/PreviewCard/PreviewCard.js +154 -0
- package/lib/components/PreviewCard/PreviewCard.module.css +216 -0
- package/lib/components/PreviewCard/index.d.ts +2 -0
- package/lib/components/PreviewCard/index.d.ts.map +1 -0
- package/lib/components/PreviewCard/index.js +16 -0
- package/lib/components/ScrollingLoader/ScrollingLoader.d.ts +35 -0
- package/lib/components/ScrollingLoader/ScrollingLoader.d.ts.map +1 -0
- package/lib/components/ScrollingLoader/ScrollingLoader.js +205 -0
- package/lib/components/ScrollingLoader/ScrollingLoader.module.css +283 -0
- package/lib/components/ScrollingLoader/index.d.ts +2 -0
- package/lib/components/ScrollingLoader/index.d.ts.map +1 -0
- package/lib/components/ScrollingLoader/index.js +16 -0
- package/lib/components/TokenListInput/TokenListInput.module.css +20 -12
- package/lib/components/index.d.ts +3 -0
- package/lib/components/index.d.ts.map +1 -1
- package/lib/components/index.js +33 -0
- package/lib/styles/index.css +8 -0
- package/lib/styles/index.d.ts +4 -0
- package/lib/styles/index.d.ts.map +1 -1
- package/lib/styles/index.js +5 -1
- package/lib/styles/variables/_size.css +8 -0
- package/lib/styles/variables/_size.d.ts +4 -0
- package/lib/styles/variables/_size.d.ts.map +1 -1
- package/lib/styles/variables/_size.js +5 -1
- package/mcp/package.json +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
@value (
|
|
2
|
+
spaceSmall,
|
|
3
|
+
spaceXSmall,
|
|
4
|
+
spaceXXSmall,
|
|
5
|
+
spaceXLarge,
|
|
6
|
+
spaceNone
|
|
7
|
+
) from '../../styles/variables/_space.css';
|
|
8
|
+
|
|
9
|
+
@value (
|
|
10
|
+
colorBorderPrimary,
|
|
11
|
+
colorBackgroundTertiary,
|
|
12
|
+
colorNeutralLightest,
|
|
13
|
+
colorFillSecondary,
|
|
14
|
+
colorInformationLightest,
|
|
15
|
+
colorFillPrimary,
|
|
16
|
+
colorInformation,
|
|
17
|
+
colorTextClickable,
|
|
18
|
+
colorFocusPrimary,
|
|
19
|
+
colorDataViz1,
|
|
20
|
+
colorDataViz2,
|
|
21
|
+
colorTextDisabled
|
|
22
|
+
) from '../../styles/variables/_color.css';
|
|
23
|
+
|
|
24
|
+
@value (
|
|
25
|
+
borderRadiusSmall,
|
|
26
|
+
borderRadiusMedium,
|
|
27
|
+
borderWidthPrimary,
|
|
28
|
+
borderWidthTertiary,
|
|
29
|
+
borderWidthNone
|
|
30
|
+
) from '../../styles/variables/_border.css';
|
|
31
|
+
|
|
32
|
+
@value (
|
|
33
|
+
shadowBoxShadow1X,
|
|
34
|
+
shadowBoxShadow1Y,
|
|
35
|
+
shadowBoxShadow1Blur,
|
|
36
|
+
shadowBoxShadow2X,
|
|
37
|
+
shadowBoxShadow2Y,
|
|
38
|
+
shadowBoxShadow2Blur,
|
|
39
|
+
shadowBoxShadow1Spread,
|
|
40
|
+
shadowBoxShadow1Color,
|
|
41
|
+
shadowBoxShadow4Spread
|
|
42
|
+
) from '../../styles/variables/_shadow.css';
|
|
43
|
+
|
|
44
|
+
@value (
|
|
45
|
+
sizeFluid,
|
|
46
|
+
size66,
|
|
47
|
+
size50,
|
|
48
|
+
size4,
|
|
49
|
+
size120,
|
|
50
|
+
size10
|
|
51
|
+
) from '../../styles/variables/_size.css';
|
|
52
|
+
|
|
53
|
+
@value (
|
|
54
|
+
motionDurationNormal,
|
|
55
|
+
motionDurationSlow,
|
|
56
|
+
motionEaseInEaseOut
|
|
57
|
+
) from '../../styles/variables/_motion.css';
|
|
58
|
+
|
|
59
|
+
.wrapper {
|
|
60
|
+
display: flex;
|
|
61
|
+
flex-direction: column;
|
|
62
|
+
gap: spaceXSmall;
|
|
63
|
+
width: sizeFluid;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.previewTextContainer {
|
|
67
|
+
display: flex;
|
|
68
|
+
align-items: center;
|
|
69
|
+
gap: spaceXXSmall;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.card {
|
|
73
|
+
background-color: colorBackgroundTertiary;
|
|
74
|
+
border: borderWidthPrimary solid colorBorderPrimary;
|
|
75
|
+
border-radius: borderRadiusMedium;
|
|
76
|
+
cursor: pointer;
|
|
77
|
+
outline: none;
|
|
78
|
+
transition: all motionDurationNormal motionEaseInEaseOut;
|
|
79
|
+
width: sizeFluid;
|
|
80
|
+
min-height: fit-content;
|
|
81
|
+
overflow: hidden;
|
|
82
|
+
|
|
83
|
+
&:focus {
|
|
84
|
+
border-color: colorTextClickable;
|
|
85
|
+
box-shadow: borderWidthNone borderWidthNone borderWidthNone
|
|
86
|
+
borderWidthTertiary colorFocusPrimary;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
&:hover:not(:focus) {
|
|
90
|
+
box-shadow: shadowBoxShadow1X shadowBoxShadow1Y shadowBoxShadow1Blur
|
|
91
|
+
shadowBoxShadow1Spread shadowBoxShadow1Color;
|
|
92
|
+
background-color: colorNeutralLightest;
|
|
93
|
+
border-color: transparent;
|
|
94
|
+
background-image: linear-gradient(
|
|
95
|
+
colorNeutralLightest,
|
|
96
|
+
colorNeutralLightest
|
|
97
|
+
),
|
|
98
|
+
linear-gradient(to right, colorDataViz2, colorDataViz1);
|
|
99
|
+
background-clip: content-box, border-box;
|
|
100
|
+
background-origin: border-box;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
&:focus:hover {
|
|
104
|
+
box-shadow: borderWidthNone borderWidthNone borderWidthNone
|
|
105
|
+
borderWidthTertiary colorFocusPrimary;
|
|
106
|
+
background-color: colorNeutralLightest;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
&.selected {
|
|
110
|
+
border: borderWidthPrimary solid transparent;
|
|
111
|
+
border-radius: borderRadiusMedium;
|
|
112
|
+
background-image: linear-gradient(
|
|
113
|
+
colorFillSecondary,
|
|
114
|
+
colorInformationLightest
|
|
115
|
+
),
|
|
116
|
+
linear-gradient(to right, colorFillPrimary, colorInformation);
|
|
117
|
+
background-clip: content-box, border-box;
|
|
118
|
+
background-origin: border-box;
|
|
119
|
+
box-shadow: none;
|
|
120
|
+
|
|
121
|
+
&:focus {
|
|
122
|
+
box-shadow: borderWidthNone borderWidthNone borderWidthNone
|
|
123
|
+
borderWidthTertiary colorFocusPrimary;
|
|
124
|
+
border-color: colorTextClickable;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
&:focus:hover {
|
|
128
|
+
background-image: linear-gradient(
|
|
129
|
+
colorNeutralLightest,
|
|
130
|
+
colorNeutralLightest
|
|
131
|
+
);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
&.disabled {
|
|
136
|
+
cursor: not-allowed;
|
|
137
|
+
pointer-events: none;
|
|
138
|
+
background-color: colorBackgroundTertiary;
|
|
139
|
+
border: borderWidthPrimary solid colorBorderPrimary;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
.cardContent {
|
|
144
|
+
display: flex;
|
|
145
|
+
align-items: flex-start;
|
|
146
|
+
padding: spaceSmall;
|
|
147
|
+
gap: spaceSmall;
|
|
148
|
+
position: relative;
|
|
149
|
+
min-height: size66;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
.mainContent {
|
|
153
|
+
display: flex;
|
|
154
|
+
flex-direction: column;
|
|
155
|
+
gap: spaceXSmall;
|
|
156
|
+
flex: 1;
|
|
157
|
+
min-width: spaceNone;
|
|
158
|
+
padding-right: calc(spaceXLarge + spaceXSmall + spaceSmall);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
.titleText {
|
|
162
|
+
width: sizeFluid;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
.previewText {
|
|
166
|
+
width: fit-content;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
.cardIconSection {
|
|
170
|
+
display: flex;
|
|
171
|
+
align-items: flex-start;
|
|
172
|
+
justify-content: center;
|
|
173
|
+
height: calc(size120 + size10);
|
|
174
|
+
width: calc(size50 + size4);
|
|
175
|
+
flex-shrink: 0;
|
|
176
|
+
border-radius: borderRadiusSmall;
|
|
177
|
+
background-color: colorNeutralLightest;
|
|
178
|
+
border: borderWidthPrimary solid colorBorderPrimary;
|
|
179
|
+
transition: all motionDurationSlow motionEaseInEaseOut;
|
|
180
|
+
transform: rotate(-3deg);
|
|
181
|
+
padding-top: spaceSmall;
|
|
182
|
+
position: absolute;
|
|
183
|
+
right: spaceXSmall;
|
|
184
|
+
box-shadow: shadowBoxShadow2X shadowBoxShadow2Y shadowBoxShadow2Blur
|
|
185
|
+
shadowBoxShadow4Spread shadowBoxShadow1Color;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
.card:hover .cardIconSection {
|
|
189
|
+
transform: rotate(5deg);
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
.card.selected .cardIconSection,
|
|
193
|
+
.card:hover .cardIconSection {
|
|
194
|
+
border: borderWidthPrimary solid colorBorderPrimary;
|
|
195
|
+
background-image: linear-gradient(
|
|
196
|
+
colorBackgroundTertiary,
|
|
197
|
+
colorBackgroundTertiary
|
|
198
|
+
);
|
|
199
|
+
background-clip: border-box;
|
|
200
|
+
background-origin: border-box;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
.card.selected .cardIconSection > div,
|
|
204
|
+
.card:hover .cardIconSection > div {
|
|
205
|
+
color: colorTextClickable;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
.card.disabled .cardIconSection > div {
|
|
209
|
+
color: colorTextDisabled;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
.helperText {
|
|
213
|
+
display: flex;
|
|
214
|
+
align-items: center;
|
|
215
|
+
gap: spaceXXSmall;
|
|
216
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/PreviewCard/index.ts"],"names":[],"mappings":"AAAA,cAAc,wCAAwC,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _PreviewCard = require("./PreviewCard");
|
|
7
|
+
Object.keys(_PreviewCard).forEach(function (key) {
|
|
8
|
+
if (key === "default" || key === "__esModule") return;
|
|
9
|
+
if (key in exports && exports[key] === _PreviewCard[key]) return;
|
|
10
|
+
Object.defineProperty(exports, key, {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function () {
|
|
13
|
+
return _PreviewCard[key];
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
});
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { Flow } from 'flow-to-typescript-codemod';
|
|
2
|
+
export declare const SCROLLING_LOADER_SIZE: Readonly<{
|
|
3
|
+
medium: "medium";
|
|
4
|
+
large: "large";
|
|
5
|
+
fluid: "fluid";
|
|
6
|
+
}>;
|
|
7
|
+
export type ScrollingLoaderSize = (typeof SCROLLING_LOADER_SIZE)[keyof typeof SCROLLING_LOADER_SIZE];
|
|
8
|
+
type ClassNames = Readonly<{
|
|
9
|
+
wrapper?: string;
|
|
10
|
+
skeletonContainer?: string;
|
|
11
|
+
textContainer?: string;
|
|
12
|
+
}>;
|
|
13
|
+
export interface IconItem {
|
|
14
|
+
name: string;
|
|
15
|
+
type?: 'regular' | 'solid' | 'duotone' | 'brands';
|
|
16
|
+
}
|
|
17
|
+
export interface ScrollingLoaderProps {
|
|
18
|
+
/** List of icons to display in skeleton rows */
|
|
19
|
+
iconList: IconItem[];
|
|
20
|
+
/** List of text messages to cycle through */
|
|
21
|
+
textList: string[];
|
|
22
|
+
/** Size variant of the loader */
|
|
23
|
+
size?: ScrollingLoaderSize;
|
|
24
|
+
/** Custom class names for styling */
|
|
25
|
+
classNames?: ClassNames;
|
|
26
|
+
/** Test ID for the component */
|
|
27
|
+
testId?: string;
|
|
28
|
+
/** Animation duration in ms for each text item (default: 2500) */
|
|
29
|
+
textAnimationDuration?: number;
|
|
30
|
+
/** Whether to loop through texts or stop at the last one (default: false) */
|
|
31
|
+
loopTexts?: boolean;
|
|
32
|
+
}
|
|
33
|
+
export declare const ScrollingLoader: Flow.AbstractComponent<ScrollingLoaderProps, HTMLDivElement>;
|
|
34
|
+
export {};
|
|
35
|
+
//# sourceMappingURL=ScrollingLoader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ScrollingLoader.d.ts","sourceRoot":"","sources":["../../../src/components/ScrollingLoader/ScrollingLoader.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAC,IAAI,EAAC,MAAM,4BAA4B,CAAC;AAUrD,eAAO,MAAM,qBAAqB;;;;EAIhC,CAAC;AAEH,MAAM,MAAM,mBAAmB,GAC7B,CAAC,OAAO,qBAAqB,CAAC,CAAC,MAAM,OAAO,qBAAqB,CAAC,CAAC;AAErE,KAAK,UAAU,GAAG,QAAQ,CAAC;IACzB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB,CAAC,CAAC;AAEH,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,SAAS,GAAG,OAAO,GAAG,SAAS,GAAG,QAAQ,CAAC;CACnD;AAED,MAAM,WAAW,oBAAoB;IACnC,gDAAgD;IAChD,QAAQ,EAAE,QAAQ,EAAE,CAAC;IACrB,6CAA6C;IAC7C,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,iCAAiC;IACjC,IAAI,CAAC,EAAE,mBAAmB,CAAC;IAC3B,qCAAqC;IACrC,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,gCAAgC;IAChC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,kEAAkE;IAClE,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,6EAA6E;IAC7E,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,eAAO,MAAM,eAAe,EAAE,IAAI,CAAC,iBAAiB,CAClD,oBAAoB,EACpB,cAAc,CAqOf,CAAC"}
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.ScrollingLoader = exports.SCROLLING_LOADER_SIZE = void 0;
|
|
7
|
+
var React = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _classify = _interopRequireDefault(require("../../utils/classify"));
|
|
9
|
+
var _qa = require("../../utils/qa");
|
|
10
|
+
var _SemanticIcon = require("../Icon/SemanticIcon");
|
|
11
|
+
var _ScrollingLoaderModule = _interopRequireDefault(require("./ScrollingLoader.module.css"));
|
|
12
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
13
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
14
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
15
|
+
const SCROLLING_LOADER_SIZE = exports.SCROLLING_LOADER_SIZE = Object.freeze({
|
|
16
|
+
medium: 'medium',
|
|
17
|
+
large: 'large',
|
|
18
|
+
fluid: 'fluid'
|
|
19
|
+
});
|
|
20
|
+
const ScrollingLoader = exports.ScrollingLoader = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
21
|
+
let {
|
|
22
|
+
iconList,
|
|
23
|
+
textList,
|
|
24
|
+
size = SCROLLING_LOADER_SIZE.medium,
|
|
25
|
+
classNames,
|
|
26
|
+
testId,
|
|
27
|
+
textAnimationDuration = 2500,
|
|
28
|
+
loopTexts = false
|
|
29
|
+
} = _ref;
|
|
30
|
+
// Track active and exiting text indices for animation
|
|
31
|
+
const [activeIndex, setActiveIndex] = React.useState(0);
|
|
32
|
+
const [exitingIndex, setExitingIndex] = React.useState(null);
|
|
33
|
+
|
|
34
|
+
// Ref to track active index for interval callback (avoids stale closure)
|
|
35
|
+
const activeIndexRef = React.useRef(0);
|
|
36
|
+
|
|
37
|
+
// Ref to track textList length for interval callback (supports streaming without restart)
|
|
38
|
+
const textListLengthRef = React.useRef(textList.length);
|
|
39
|
+
|
|
40
|
+
// Ref to track loopTexts for interval callback (avoids stale closure)
|
|
41
|
+
const loopTextsRef = React.useRef(loopTexts);
|
|
42
|
+
|
|
43
|
+
// Ref to track the timeout for clearing exiting state
|
|
44
|
+
const exitingTimeoutRef = React.useRef(null);
|
|
45
|
+
|
|
46
|
+
// Create extended icon list for infinite scroll effect with unique IDs
|
|
47
|
+
const extendedIconList = React.useMemo(() =>
|
|
48
|
+
// Duplicate the list to create seamless looping
|
|
49
|
+
[...iconList, ...iconList].map((icon, idx) => ({
|
|
50
|
+
...icon,
|
|
51
|
+
id: `${icon.name}-${idx < iconList.length ? 'a' : 'b'}-${idx % iconList.length}`
|
|
52
|
+
})), [iconList]);
|
|
53
|
+
const skeletonAnimationDuration = iconList.length * 1.5;
|
|
54
|
+
|
|
55
|
+
// Create text items with unique IDs
|
|
56
|
+
const textItems = React.useMemo(() => textList.map((text, idx) => ({
|
|
57
|
+
text,
|
|
58
|
+
id: `text-${idx}-${text.slice(0, 10).replace(/\s/g, '')}`,
|
|
59
|
+
index: idx
|
|
60
|
+
})), [textList]);
|
|
61
|
+
|
|
62
|
+
// Keep textList length ref in sync (supports streaming without restarting interval)
|
|
63
|
+
React.useEffect(() => {
|
|
64
|
+
textListLengthRef.current = textList.length;
|
|
65
|
+
}, [textList.length]);
|
|
66
|
+
|
|
67
|
+
// Keep loopTexts ref in sync
|
|
68
|
+
React.useEffect(() => {
|
|
69
|
+
loopTextsRef.current = loopTexts;
|
|
70
|
+
}, [loopTexts]);
|
|
71
|
+
|
|
72
|
+
// Reset indices when textList length decreases and current index is out of bounds
|
|
73
|
+
// This prevents invisible text when switching to a shorter list
|
|
74
|
+
React.useEffect(() => {
|
|
75
|
+
if (activeIndexRef.current >= textList.length) {
|
|
76
|
+
activeIndexRef.current = 0;
|
|
77
|
+
setActiveIndex(0);
|
|
78
|
+
setExitingIndex(null);
|
|
79
|
+
}
|
|
80
|
+
}, [textList.length]);
|
|
81
|
+
|
|
82
|
+
// Animation interval - uses refs to support streaming without restart
|
|
83
|
+
React.useEffect(() => {
|
|
84
|
+
const interval = setInterval(() => {
|
|
85
|
+
const currentLength = textListLengthRef.current;
|
|
86
|
+
const shouldLoop = loopTextsRef.current;
|
|
87
|
+
|
|
88
|
+
// Only animate if we have multiple items
|
|
89
|
+
if (currentLength <= 1) {
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
const currentIndex = activeIndexRef.current;
|
|
93
|
+
const isAtLastItem = currentIndex === currentLength - 1;
|
|
94
|
+
|
|
95
|
+
// If not looping and at the last item, don't advance
|
|
96
|
+
if (!shouldLoop && isAtLastItem) {
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
const nextIndex = (currentIndex + 1) % currentLength;
|
|
100
|
+
|
|
101
|
+
// Set exiting index to current
|
|
102
|
+
setExitingIndex(currentIndex);
|
|
103
|
+
|
|
104
|
+
// Clear any existing timeout before creating a new one
|
|
105
|
+
if (exitingTimeoutRef.current !== null) {
|
|
106
|
+
clearTimeout(exitingTimeoutRef.current);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
// Clear exiting state after animation completes
|
|
110
|
+
exitingTimeoutRef.current = setTimeout(() => {
|
|
111
|
+
setExitingIndex(null);
|
|
112
|
+
}, 350);
|
|
113
|
+
|
|
114
|
+
// Update ref and state
|
|
115
|
+
activeIndexRef.current = nextIndex;
|
|
116
|
+
setActiveIndex(nextIndex);
|
|
117
|
+
}, textAnimationDuration);
|
|
118
|
+
return () => {
|
|
119
|
+
clearInterval(interval);
|
|
120
|
+
// Clean up any pending timeout on unmount
|
|
121
|
+
if (exitingTimeoutRef.current !== null) {
|
|
122
|
+
clearTimeout(exitingTimeoutRef.current);
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
}, [textAnimationDuration]);
|
|
126
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
127
|
+
ref: ref,
|
|
128
|
+
"data-testid": (0, _qa.generateTestId)({
|
|
129
|
+
base: testId,
|
|
130
|
+
slot: 'wrapper'
|
|
131
|
+
}),
|
|
132
|
+
className: (0, _classify.default)(_ScrollingLoaderModule.default.wrapper, {
|
|
133
|
+
[_ScrollingLoaderModule.default.medium]: size === SCROLLING_LOADER_SIZE.medium,
|
|
134
|
+
[_ScrollingLoaderModule.default.large]: size === SCROLLING_LOADER_SIZE.large,
|
|
135
|
+
[_ScrollingLoaderModule.default.fluid]: size === SCROLLING_LOADER_SIZE.fluid
|
|
136
|
+
}, classNames?.wrapper),
|
|
137
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
138
|
+
"data-testid": (0, _qa.generateTestId)({
|
|
139
|
+
base: testId,
|
|
140
|
+
slot: 'skeleton'
|
|
141
|
+
}),
|
|
142
|
+
className: (0, _classify.default)(_ScrollingLoaderModule.default.skeletonContainer, classNames?.skeletonContainer),
|
|
143
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
144
|
+
className: _ScrollingLoaderModule.default.skeletonScroller,
|
|
145
|
+
style: {
|
|
146
|
+
'--animation-duration': `${skeletonAnimationDuration}s`
|
|
147
|
+
},
|
|
148
|
+
children: extendedIconList.map(icon => /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
149
|
+
className: (0, _classify.default)(_ScrollingLoaderModule.default.skeletonRow, {
|
|
150
|
+
[_ScrollingLoaderModule.default.skeletonRowSmall]: size === SCROLLING_LOADER_SIZE.medium,
|
|
151
|
+
[_ScrollingLoaderModule.default.skeletonRowLarge]: size === SCROLLING_LOADER_SIZE.large || size === SCROLLING_LOADER_SIZE.fluid
|
|
152
|
+
}),
|
|
153
|
+
"data-testid": (0, _qa.generateTestId)({
|
|
154
|
+
base: testId,
|
|
155
|
+
slot: `skeleton-row-${icon.id}`
|
|
156
|
+
}),
|
|
157
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_SemanticIcon.SemanticIcon, {
|
|
158
|
+
name: icon.name,
|
|
159
|
+
type: icon.type || 'regular',
|
|
160
|
+
size: size === SCROLLING_LOADER_SIZE.medium ? 'small' : 'medium',
|
|
161
|
+
semantic: "neutral",
|
|
162
|
+
testId: (0, _qa.generateTestId)({
|
|
163
|
+
base: testId,
|
|
164
|
+
slot: `icon-${icon.id}`
|
|
165
|
+
})
|
|
166
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
167
|
+
className: _ScrollingLoaderModule.default.skeletonBars,
|
|
168
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
169
|
+
className: _ScrollingLoaderModule.default.skeletonBarTitle
|
|
170
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
171
|
+
className: _ScrollingLoaderModule.default.skeletonBarSubtitle
|
|
172
|
+
})]
|
|
173
|
+
})]
|
|
174
|
+
}, icon.id))
|
|
175
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
176
|
+
className: _ScrollingLoaderModule.default.gradientTop
|
|
177
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
178
|
+
className: _ScrollingLoaderModule.default.gradientBottom
|
|
179
|
+
})]
|
|
180
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
181
|
+
"data-testid": (0, _qa.generateTestId)({
|
|
182
|
+
base: testId,
|
|
183
|
+
slot: 'text'
|
|
184
|
+
}),
|
|
185
|
+
className: (0, _classify.default)(_ScrollingLoaderModule.default.textContainer, classNames?.textContainer),
|
|
186
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
187
|
+
className: _ScrollingLoaderModule.default.textScroller,
|
|
188
|
+
children: textItems.map(item => /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
189
|
+
className: (0, _classify.default)(_ScrollingLoaderModule.default.textItem, {
|
|
190
|
+
[_ScrollingLoaderModule.default.textItemMedium]: size === SCROLLING_LOADER_SIZE.medium,
|
|
191
|
+
[_ScrollingLoaderModule.default.textItemLarge]: size === SCROLLING_LOADER_SIZE.large || size === SCROLLING_LOADER_SIZE.fluid,
|
|
192
|
+
[_ScrollingLoaderModule.default.textItemStatic]: textList.length <= 1,
|
|
193
|
+
[_ScrollingLoaderModule.default.textItemActive]: textList.length > 1 && item.index === activeIndex,
|
|
194
|
+
[_ScrollingLoaderModule.default.textItemExiting]: textList.length > 1 && item.index === exitingIndex
|
|
195
|
+
}),
|
|
196
|
+
"data-testid": (0, _qa.generateTestId)({
|
|
197
|
+
base: testId,
|
|
198
|
+
slot: `text-item-${item.id}`
|
|
199
|
+
}),
|
|
200
|
+
children: item.text
|
|
201
|
+
}, item.id))
|
|
202
|
+
})
|
|
203
|
+
})]
|
|
204
|
+
});
|
|
205
|
+
});
|