@sproutsocial/seeds-react-list 0.0.2 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +10 -10
- package/CHANGELOG.md +6 -0
- package/dist/esm/index.js +1053 -38
- package/dist/esm/index.js.map +1 -1
- package/dist/index.d.mts +57 -5
- package/dist/index.d.ts +57 -5
- package/dist/index.js +1059 -41
- package/dist/index.js.map +1 -1
- package/package.json +7 -3
- package/src/DataItemSkeleton.tsx +43 -0
- package/src/DataItemSkeletonTypes.ts +8 -0
- package/src/DataList.stories.tsx +659 -0
- package/src/DataList.tsx +88 -0
- package/src/DataListTypes.ts +31 -0
- package/src/DynamicVirtualizedExample.tsx +85 -0
- package/src/List.stories.tsx +13 -5
- package/src/List.tsx +1 -10
- package/src/ListItem.tsx +22 -19
- package/src/ListItemButton.tsx +17 -5
- package/src/ListItemTypes.ts +2 -0
- package/src/ListTypes.ts +2 -0
- package/src/VirtualizedDataList.stories.tsx +353 -0
- package/src/VirtualizedDataList.tsx +122 -0
- package/src/VirtualizedExamples.tsx +55 -0
- package/src/__tests__/DataList.test.tsx +218 -0
- package/src/__tests__/List.test.tsx +10 -10
- package/src/index.ts +13 -1
package/dist/esm/index.js
CHANGED
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
// src/List.tsx
|
|
2
|
-
import "react";
|
|
3
|
-
import { Children } from "react";
|
|
4
|
-
import Box from "@sproutsocial/seeds-react-box";
|
|
5
|
-
|
|
6
1
|
// src/styles.tsx
|
|
7
2
|
import styled from "styled-components";
|
|
8
3
|
var Container = styled.ul`
|
|
@@ -19,41 +14,43 @@ var styles_default = Container;
|
|
|
19
14
|
// src/List.tsx
|
|
20
15
|
import { jsx } from "react/jsx-runtime";
|
|
21
16
|
var List = ({ as = "ul", children, ...rest }) => {
|
|
22
|
-
|
|
23
|
-
return /* @__PURE__ */ jsx(styles_default, { as, ...rest, children: listItems.map((item, index) => /* @__PURE__ */ jsx(Box, { as: "li", mt: 300, children: item }, index)) });
|
|
17
|
+
return /* @__PURE__ */ jsx(styles_default, { as, ...rest, children });
|
|
24
18
|
};
|
|
25
19
|
List.displayName = "List";
|
|
26
20
|
var List_default = List;
|
|
27
21
|
|
|
28
22
|
// src/ListItem.tsx
|
|
29
|
-
import "react";
|
|
30
|
-
import
|
|
31
|
-
import "@sproutsocial/seeds-react-text";
|
|
32
|
-
import "@sproutsocial/seeds-react-icon";
|
|
23
|
+
import * as React from "react";
|
|
24
|
+
import Box from "@sproutsocial/seeds-react-box";
|
|
33
25
|
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
34
|
-
var ListItem = (
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
26
|
+
var ListItem = React.forwardRef(
|
|
27
|
+
({ isBordered, children, ...rest }, ref) => {
|
|
28
|
+
return /* @__PURE__ */ jsx2(
|
|
29
|
+
Box,
|
|
30
|
+
{
|
|
31
|
+
as: "li",
|
|
32
|
+
ref,
|
|
33
|
+
borderRadius: "outer",
|
|
34
|
+
...isBordered ? {
|
|
35
|
+
border: 500,
|
|
36
|
+
borderColor: "container.border.base",
|
|
37
|
+
p: 300
|
|
38
|
+
} : {},
|
|
39
|
+
mt: 300,
|
|
40
|
+
...rest,
|
|
41
|
+
children
|
|
42
|
+
}
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
);
|
|
49
46
|
ListItem.displayName = "ListItem";
|
|
50
47
|
var ListItem_default = ListItem;
|
|
51
48
|
|
|
52
49
|
// src/ListItemContent.tsx
|
|
53
50
|
import "react";
|
|
54
|
-
import
|
|
55
|
-
import
|
|
56
|
-
import { Icon
|
|
51
|
+
import Box2 from "@sproutsocial/seeds-react-box";
|
|
52
|
+
import Text from "@sproutsocial/seeds-react-text";
|
|
53
|
+
import { Icon } from "@sproutsocial/seeds-react-icon";
|
|
57
54
|
import { jsx as jsx3, jsxs } from "react/jsx-runtime";
|
|
58
55
|
var ListItemContent = ({
|
|
59
56
|
text,
|
|
@@ -65,7 +62,7 @@ var ListItemContent = ({
|
|
|
65
62
|
...rest
|
|
66
63
|
}) => {
|
|
67
64
|
return /* @__PURE__ */ jsxs(
|
|
68
|
-
|
|
65
|
+
Box2,
|
|
69
66
|
{
|
|
70
67
|
display: "flex",
|
|
71
68
|
justifyContent: "space-between",
|
|
@@ -73,16 +70,16 @@ var ListItemContent = ({
|
|
|
73
70
|
alignItems: "baseline",
|
|
74
71
|
...rest,
|
|
75
72
|
children: [
|
|
76
|
-
/* @__PURE__ */ jsxs(
|
|
77
|
-
iconName && /* @__PURE__ */ jsx3(
|
|
78
|
-
/* @__PURE__ */ jsxs(
|
|
79
|
-
/* @__PURE__ */ jsx3(
|
|
80
|
-
details && /* @__PURE__ */ jsx3(
|
|
73
|
+
/* @__PURE__ */ jsxs(Box2, { display: "flex", flex: "1", children: [
|
|
74
|
+
iconName && /* @__PURE__ */ jsx3(Icon, { mr: 300, name: iconName, size: "small", ariaLabel: iconLabel }),
|
|
75
|
+
/* @__PURE__ */ jsxs(Box2, { flex: "1", children: [
|
|
76
|
+
/* @__PURE__ */ jsx3(Text.SmallSubHeadline, { as: "div", children: text }),
|
|
77
|
+
details && /* @__PURE__ */ jsx3(Text.Byline, { as: "div", mt: 200, children: details })
|
|
81
78
|
] })
|
|
82
79
|
] }),
|
|
83
|
-
/* @__PURE__ */ jsxs(
|
|
84
|
-
aside && /* @__PURE__ */ jsx3(
|
|
85
|
-
actions && /* @__PURE__ */ jsx3(
|
|
80
|
+
/* @__PURE__ */ jsxs(Box2, { display: "flex", alignItems: "center", gap: 300, flexShrink: 0, children: [
|
|
81
|
+
aside && /* @__PURE__ */ jsx3(Text.Byline, { as: "div", children: aside }),
|
|
82
|
+
actions && /* @__PURE__ */ jsx3(Box2, { display: "flex", alignItems: "center", children: actions })
|
|
86
83
|
] })
|
|
87
84
|
]
|
|
88
85
|
}
|
|
@@ -91,12 +88,1030 @@ var ListItemContent = ({
|
|
|
91
88
|
ListItemContent.displayName = "ListItemContent";
|
|
92
89
|
var ListItemContent_default = ListItemContent;
|
|
93
90
|
|
|
91
|
+
// src/DataList.tsx
|
|
92
|
+
import "react";
|
|
93
|
+
import { useRef } from "react";
|
|
94
|
+
|
|
95
|
+
// src/DataItemSkeleton.tsx
|
|
96
|
+
import "react";
|
|
97
|
+
import Box4 from "@sproutsocial/seeds-react-box";
|
|
98
|
+
|
|
99
|
+
// ../seeds-react-skeleton/dist/esm/index.js
|
|
100
|
+
import styled2 from "styled-components";
|
|
101
|
+
import Box3 from "@sproutsocial/seeds-react-box";
|
|
102
|
+
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
103
|
+
var SkeletonAttrs = ({ borderRadius, height, width }) => ({
|
|
104
|
+
className: borderRadius === "pill" && height === width ? "circular" : "linear"
|
|
105
|
+
});
|
|
106
|
+
var Skeleton = styled2(Box3).attrs(SkeletonAttrs)`
|
|
107
|
+
position: relative;
|
|
108
|
+
background: ${(props) => props.theme.colors.container.background.decorative.neutral};
|
|
109
|
+
overflow: hidden;
|
|
110
|
+
&.circular {
|
|
111
|
+
&:before {
|
|
112
|
+
position: absolute;
|
|
113
|
+
top: -25%;
|
|
114
|
+
left: -25%;
|
|
115
|
+
content: '';
|
|
116
|
+
background-image: ${(props) => `conic-gradient(
|
|
117
|
+
${props.theme.colors.container.background.decorative.neutral} 270deg,
|
|
118
|
+
${props.theme.colors.container.border.decorative.neutral} 300deg
|
|
119
|
+
);`};
|
|
120
|
+
height: 150%;
|
|
121
|
+
width: 150%;
|
|
122
|
+
animation: SkeletonRotate 2s infinite linear;
|
|
123
|
+
}
|
|
124
|
+
&:after {
|
|
125
|
+
position: absolute;
|
|
126
|
+
top: 50%;
|
|
127
|
+
left: 50%;
|
|
128
|
+
transform: translate(-50%, -50%);
|
|
129
|
+
content: '';
|
|
130
|
+
height: calc(100% - 8px);
|
|
131
|
+
width: calc(100% - 8px);
|
|
132
|
+
background: ${(p) => p.theme.colors.app.background.base};
|
|
133
|
+
border-radius: 50%;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
&.linear {
|
|
137
|
+
position: relative;
|
|
138
|
+
background-image: ${(props) => `linear-gradient(
|
|
139
|
+
288deg,
|
|
140
|
+
${props.theme.colors.container.background.decorative.neutral} 32%,
|
|
141
|
+
${props.theme.colors.container.border.decorative.neutral},
|
|
142
|
+
${props.theme.colors.container.background.decorative.neutral} 68%
|
|
143
|
+
);`}
|
|
144
|
+
background-size: 400%;
|
|
145
|
+
background-repeat: no-repeat;
|
|
146
|
+
animation: SkeletonShimmer 2s linear infinite reverse;
|
|
147
|
+
overflow: hidden;
|
|
148
|
+
&:after {
|
|
149
|
+
position: absolute;
|
|
150
|
+
bottom: 0;
|
|
151
|
+
content: "";
|
|
152
|
+
height: calc(100% - 4px);
|
|
153
|
+
width: 100%;
|
|
154
|
+
background: ${(props) => props.theme.colors.container.background.decorative.neutral};
|
|
155
|
+
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
@media (prefers-reduced-motion) {
|
|
160
|
+
&.linear,
|
|
161
|
+
&.circular::before {
|
|
162
|
+
animation: none;
|
|
163
|
+
}
|
|
164
|
+
&:before,
|
|
165
|
+
&:after {
|
|
166
|
+
display: none;
|
|
167
|
+
}
|
|
168
|
+
&.linear,
|
|
169
|
+
&.circular {
|
|
170
|
+
border: 1px solid ${(props) => props.theme.colors.container.border.decorative.neutral};
|
|
171
|
+
animation: SkeletonPulse 2s linear infinite alternate;
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
@keyframes SkeletonRotate {
|
|
176
|
+
100% {
|
|
177
|
+
transform: rotate(360deg);
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
@keyframes SkeletonRotateFade {
|
|
181
|
+
50% {
|
|
182
|
+
transform: rotate(360deg);
|
|
183
|
+
}
|
|
184
|
+
90% {
|
|
185
|
+
opacity: 1;
|
|
186
|
+
}
|
|
187
|
+
100% {
|
|
188
|
+
transform: rotate(720deg);
|
|
189
|
+
opacity: 0;
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
@keyframes SkeletonShimmer {
|
|
194
|
+
0% {
|
|
195
|
+
background-position: 0% 0;
|
|
196
|
+
}
|
|
197
|
+
100% {
|
|
198
|
+
background-position: 100% 0;
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
@keyframes SkeletonPulse {
|
|
202
|
+
0% {
|
|
203
|
+
border-color: ${(props) => props.theme.colors.container.border.decorative.neutral}FF;
|
|
204
|
+
}
|
|
205
|
+
100% {
|
|
206
|
+
border-color: ${(props) => props.theme.colors.container.border.decorative.neutral}1A;
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
`;
|
|
210
|
+
var Skeleton_default = Skeleton;
|
|
211
|
+
var index_default = Skeleton_default;
|
|
212
|
+
|
|
213
|
+
// src/DataItemSkeleton.tsx
|
|
214
|
+
import { jsx as jsx5, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
215
|
+
var DataItemSkeleton = ({
|
|
216
|
+
hasIcon = false,
|
|
217
|
+
hasAside = false,
|
|
218
|
+
hasSubtext = false
|
|
219
|
+
}) => {
|
|
220
|
+
return /* @__PURE__ */ jsxs2(
|
|
221
|
+
Box4,
|
|
222
|
+
{
|
|
223
|
+
display: "flex",
|
|
224
|
+
justifyContent: "space-between",
|
|
225
|
+
borderRadius: "outer",
|
|
226
|
+
alignItems: "flex-start",
|
|
227
|
+
mb: 100,
|
|
228
|
+
children: [
|
|
229
|
+
/* @__PURE__ */ jsxs2(Box4, { display: "flex", flex: "1", children: [
|
|
230
|
+
hasIcon && /* @__PURE__ */ jsx5(Box4, { mr: 300, flexShrink: 0, children: /* @__PURE__ */ jsx5(index_default, { width: 21, height: 21, borderRadius: "pill" }) }),
|
|
231
|
+
/* @__PURE__ */ jsxs2(Box4, { flex: "1", children: [
|
|
232
|
+
/* @__PURE__ */ jsx5(index_default, { width: "80%", height: 21, borderRadius: "inner" }),
|
|
233
|
+
hasSubtext && /* @__PURE__ */ jsx5(index_default, { width: "60%", height: 16, mt: 300, borderRadius: "inner" })
|
|
234
|
+
] })
|
|
235
|
+
] }),
|
|
236
|
+
hasAside && /* @__PURE__ */ jsx5(Box4, { display: "flex", alignItems: "center", gap: 300, flexShrink: 0, children: /* @__PURE__ */ jsx5(index_default, { width: 60, height: 21, borderRadius: "inner" }) })
|
|
237
|
+
]
|
|
238
|
+
}
|
|
239
|
+
);
|
|
240
|
+
};
|
|
241
|
+
DataItemSkeleton.displayName = "DataItemSkeleton";
|
|
242
|
+
var DataItemSkeleton_default = DataItemSkeleton;
|
|
243
|
+
|
|
244
|
+
// src/DataList.tsx
|
|
245
|
+
import Box5 from "@sproutsocial/seeds-react-box";
|
|
246
|
+
import styled3 from "styled-components";
|
|
247
|
+
import { Fragment, jsx as jsx6, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
248
|
+
var HeaderContent = styled3(Box5)`
|
|
249
|
+
width: 100%;
|
|
250
|
+
transition: transform 0.4s ease-in-out;
|
|
251
|
+
`;
|
|
252
|
+
var DataList = ({
|
|
253
|
+
as = "ul",
|
|
254
|
+
data,
|
|
255
|
+
renderItem,
|
|
256
|
+
isLoading,
|
|
257
|
+
LoadingComponent = DataItemSkeleton_default,
|
|
258
|
+
listItemProps = {},
|
|
259
|
+
estimateItemSize = 50,
|
|
260
|
+
Header,
|
|
261
|
+
...rest
|
|
262
|
+
}) => {
|
|
263
|
+
const containerRef = useRef(null);
|
|
264
|
+
const loadingItems = [0, 1, 2, 3, 4];
|
|
265
|
+
if (isLoading) {
|
|
266
|
+
return /* @__PURE__ */ jsxs3(Fragment, { children: [
|
|
267
|
+
Header && /* @__PURE__ */ jsx6(
|
|
268
|
+
HeaderContent,
|
|
269
|
+
{
|
|
270
|
+
style: {
|
|
271
|
+
position: "sticky",
|
|
272
|
+
top: 0,
|
|
273
|
+
left: 0,
|
|
274
|
+
width: "100%",
|
|
275
|
+
zIndex: 1
|
|
276
|
+
},
|
|
277
|
+
id: "header",
|
|
278
|
+
children: Header
|
|
279
|
+
}
|
|
280
|
+
),
|
|
281
|
+
/* @__PURE__ */ jsx6(List_default, { as, ...rest, children: loadingItems.map((index) => /* @__PURE__ */ jsx6(ListItem_default, { ...listItemProps, children: /* @__PURE__ */ jsx6(LoadingComponent, {}) }, index)) })
|
|
282
|
+
] });
|
|
283
|
+
}
|
|
284
|
+
return /* @__PURE__ */ jsxs3(Fragment, { children: [
|
|
285
|
+
Header && /* @__PURE__ */ jsx6(
|
|
286
|
+
HeaderContent,
|
|
287
|
+
{
|
|
288
|
+
style: {
|
|
289
|
+
position: "sticky",
|
|
290
|
+
top: 0,
|
|
291
|
+
left: 0,
|
|
292
|
+
width: "100%",
|
|
293
|
+
zIndex: 1
|
|
294
|
+
},
|
|
295
|
+
id: "header",
|
|
296
|
+
children: Header
|
|
297
|
+
}
|
|
298
|
+
),
|
|
299
|
+
/* @__PURE__ */ jsx6(List_default, { as, ...rest, children: data.map((item, index) => /* @__PURE__ */ jsx6(ListItem_default, { ...listItemProps, children: renderItem(item, index) }, index)) })
|
|
300
|
+
] });
|
|
301
|
+
};
|
|
302
|
+
DataList.displayName = "DataList";
|
|
303
|
+
var DataList_default = DataList;
|
|
304
|
+
|
|
305
|
+
// src/VirtualizedDataList.tsx
|
|
306
|
+
import * as React5 from "react";
|
|
307
|
+
import Box6 from "@sproutsocial/seeds-react-box";
|
|
308
|
+
|
|
309
|
+
// ../seeds-react-loader/dist/esm/index.js
|
|
310
|
+
import "react";
|
|
311
|
+
import styled4, { css as css2, keyframes } from "styled-components";
|
|
312
|
+
import { COMMON } from "@sproutsocial/seeds-react-system-props";
|
|
313
|
+
|
|
314
|
+
// ../../node_modules/@babel/runtime/helpers/esm/extends.js
|
|
315
|
+
function _extends() {
|
|
316
|
+
return _extends = Object.assign ? Object.assign.bind() : function(n) {
|
|
317
|
+
for (var e = 1; e < arguments.length; e++) {
|
|
318
|
+
var t = arguments[e];
|
|
319
|
+
for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
|
|
320
|
+
}
|
|
321
|
+
return n;
|
|
322
|
+
}, _extends.apply(null, arguments);
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
// ../../node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js
|
|
326
|
+
function _assertThisInitialized(e) {
|
|
327
|
+
if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
328
|
+
return e;
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
// ../../node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js
|
|
332
|
+
function _setPrototypeOf(t, e) {
|
|
333
|
+
return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(t2, e2) {
|
|
334
|
+
return t2.__proto__ = e2, t2;
|
|
335
|
+
}, _setPrototypeOf(t, e);
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
// ../../node_modules/@babel/runtime/helpers/esm/inheritsLoose.js
|
|
339
|
+
function _inheritsLoose(t, o) {
|
|
340
|
+
t.prototype = Object.create(o.prototype), t.prototype.constructor = t, _setPrototypeOf(t, o);
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
// ../../node_modules/@babel/runtime/helpers/esm/getPrototypeOf.js
|
|
344
|
+
function _getPrototypeOf(t) {
|
|
345
|
+
return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(t2) {
|
|
346
|
+
return t2.__proto__ || Object.getPrototypeOf(t2);
|
|
347
|
+
}, _getPrototypeOf(t);
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
// ../../node_modules/@babel/runtime/helpers/esm/isNativeFunction.js
|
|
351
|
+
function _isNativeFunction(t) {
|
|
352
|
+
try {
|
|
353
|
+
return -1 !== Function.toString.call(t).indexOf("[native code]");
|
|
354
|
+
} catch (n) {
|
|
355
|
+
return "function" == typeof t;
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
// ../../node_modules/@babel/runtime/helpers/esm/isNativeReflectConstruct.js
|
|
360
|
+
function _isNativeReflectConstruct() {
|
|
361
|
+
try {
|
|
362
|
+
var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
|
|
363
|
+
}));
|
|
364
|
+
} catch (t2) {
|
|
365
|
+
}
|
|
366
|
+
return (_isNativeReflectConstruct = function _isNativeReflectConstruct2() {
|
|
367
|
+
return !!t;
|
|
368
|
+
})();
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
// ../../node_modules/@babel/runtime/helpers/esm/construct.js
|
|
372
|
+
function _construct(t, e, r) {
|
|
373
|
+
if (_isNativeReflectConstruct()) return Reflect.construct.apply(null, arguments);
|
|
374
|
+
var o = [null];
|
|
375
|
+
o.push.apply(o, e);
|
|
376
|
+
var p = new (t.bind.apply(t, o))();
|
|
377
|
+
return r && _setPrototypeOf(p, r.prototype), p;
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
// ../../node_modules/@babel/runtime/helpers/esm/wrapNativeSuper.js
|
|
381
|
+
function _wrapNativeSuper(t) {
|
|
382
|
+
var r = "function" == typeof Map ? /* @__PURE__ */ new Map() : void 0;
|
|
383
|
+
return _wrapNativeSuper = function _wrapNativeSuper2(t2) {
|
|
384
|
+
if (null === t2 || !_isNativeFunction(t2)) return t2;
|
|
385
|
+
if ("function" != typeof t2) throw new TypeError("Super expression must either be null or a function");
|
|
386
|
+
if (void 0 !== r) {
|
|
387
|
+
if (r.has(t2)) return r.get(t2);
|
|
388
|
+
r.set(t2, Wrapper);
|
|
389
|
+
}
|
|
390
|
+
function Wrapper() {
|
|
391
|
+
return _construct(t2, arguments, _getPrototypeOf(this).constructor);
|
|
392
|
+
}
|
|
393
|
+
return Wrapper.prototype = Object.create(t2.prototype, {
|
|
394
|
+
constructor: {
|
|
395
|
+
value: Wrapper,
|
|
396
|
+
enumerable: false,
|
|
397
|
+
writable: true,
|
|
398
|
+
configurable: true
|
|
399
|
+
}
|
|
400
|
+
}), _setPrototypeOf(Wrapper, t2);
|
|
401
|
+
}, _wrapNativeSuper(t);
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
// ../../node_modules/polished/dist/polished.esm.js
|
|
405
|
+
var ERRORS = {
|
|
406
|
+
"1": "Passed invalid arguments to hsl, please pass multiple numbers e.g. hsl(360, 0.75, 0.4) or an object e.g. rgb({ hue: 255, saturation: 0.4, lightness: 0.75 }).\n\n",
|
|
407
|
+
"2": "Passed invalid arguments to hsla, please pass multiple numbers e.g. hsla(360, 0.75, 0.4, 0.7) or an object e.g. rgb({ hue: 255, saturation: 0.4, lightness: 0.75, alpha: 0.7 }).\n\n",
|
|
408
|
+
"3": "Passed an incorrect argument to a color function, please pass a string representation of a color.\n\n",
|
|
409
|
+
"4": "Couldn't generate valid rgb string from %s, it returned %s.\n\n",
|
|
410
|
+
"5": "Couldn't parse the color string. Please provide the color as a string in hex, rgb, rgba, hsl or hsla notation.\n\n",
|
|
411
|
+
"6": "Passed invalid arguments to rgb, please pass multiple numbers e.g. rgb(255, 205, 100) or an object e.g. rgb({ red: 255, green: 205, blue: 100 }).\n\n",
|
|
412
|
+
"7": "Passed invalid arguments to rgba, please pass multiple numbers e.g. rgb(255, 205, 100, 0.75) or an object e.g. rgb({ red: 255, green: 205, blue: 100, alpha: 0.75 }).\n\n",
|
|
413
|
+
"8": "Passed invalid argument to toColorString, please pass a RgbColor, RgbaColor, HslColor or HslaColor object.\n\n",
|
|
414
|
+
"9": "Please provide a number of steps to the modularScale helper.\n\n",
|
|
415
|
+
"10": "Please pass a number or one of the predefined scales to the modularScale helper as the ratio.\n\n",
|
|
416
|
+
"11": 'Invalid value passed as base to modularScale, expected number or em string but got "%s"\n\n',
|
|
417
|
+
"12": 'Expected a string ending in "px" or a number passed as the first argument to %s(), got "%s" instead.\n\n',
|
|
418
|
+
"13": 'Expected a string ending in "px" or a number passed as the second argument to %s(), got "%s" instead.\n\n',
|
|
419
|
+
"14": 'Passed invalid pixel value ("%s") to %s(), please pass a value like "12px" or 12.\n\n',
|
|
420
|
+
"15": 'Passed invalid base value ("%s") to %s(), please pass a value like "12px" or 12.\n\n',
|
|
421
|
+
"16": "You must provide a template to this method.\n\n",
|
|
422
|
+
"17": "You passed an unsupported selector state to this method.\n\n",
|
|
423
|
+
"18": "minScreen and maxScreen must be provided as stringified numbers with the same units.\n\n",
|
|
424
|
+
"19": "fromSize and toSize must be provided as stringified numbers with the same units.\n\n",
|
|
425
|
+
"20": "expects either an array of objects or a single object with the properties prop, fromSize, and toSize.\n\n",
|
|
426
|
+
"21": "expects the objects in the first argument array to have the properties `prop`, `fromSize`, and `toSize`.\n\n",
|
|
427
|
+
"22": "expects the first argument object to have the properties `prop`, `fromSize`, and `toSize`.\n\n",
|
|
428
|
+
"23": "fontFace expects a name of a font-family.\n\n",
|
|
429
|
+
"24": "fontFace expects either the path to the font file(s) or a name of a local copy.\n\n",
|
|
430
|
+
"25": "fontFace expects localFonts to be an array.\n\n",
|
|
431
|
+
"26": "fontFace expects fileFormats to be an array.\n\n",
|
|
432
|
+
"27": "radialGradient requries at least 2 color-stops to properly render.\n\n",
|
|
433
|
+
"28": "Please supply a filename to retinaImage() as the first argument.\n\n",
|
|
434
|
+
"29": "Passed invalid argument to triangle, please pass correct pointingDirection e.g. 'right'.\n\n",
|
|
435
|
+
"30": "Passed an invalid value to `height` or `width`. Please provide a pixel based unit.\n\n",
|
|
436
|
+
"31": "The animation shorthand only takes 8 arguments. See the specification for more information: http://mdn.io/animation\n\n",
|
|
437
|
+
"32": "To pass multiple animations please supply them in arrays, e.g. animation(['rotate', '2s'], ['move', '1s'])\nTo pass a single animation please supply them in simple values, e.g. animation('rotate', '2s')\n\n",
|
|
438
|
+
"33": "The animation shorthand arrays can only have 8 elements. See the specification for more information: http://mdn.io/animation\n\n",
|
|
439
|
+
"34": "borderRadius expects a radius value as a string or number as the second argument.\n\n",
|
|
440
|
+
"35": 'borderRadius expects one of "top", "bottom", "left" or "right" as the first argument.\n\n',
|
|
441
|
+
"36": "Property must be a string value.\n\n",
|
|
442
|
+
"37": "Syntax Error at %s.\n\n",
|
|
443
|
+
"38": "Formula contains a function that needs parentheses at %s.\n\n",
|
|
444
|
+
"39": "Formula is missing closing parenthesis at %s.\n\n",
|
|
445
|
+
"40": "Formula has too many closing parentheses at %s.\n\n",
|
|
446
|
+
"41": "All values in a formula must have the same unit or be unitless.\n\n",
|
|
447
|
+
"42": "Please provide a number of steps to the modularScale helper.\n\n",
|
|
448
|
+
"43": "Please pass a number or one of the predefined scales to the modularScale helper as the ratio.\n\n",
|
|
449
|
+
"44": "Invalid value passed as base to modularScale, expected number or em/rem string but got %s.\n\n",
|
|
450
|
+
"45": "Passed invalid argument to hslToColorString, please pass a HslColor or HslaColor object.\n\n",
|
|
451
|
+
"46": "Passed invalid argument to rgbToColorString, please pass a RgbColor or RgbaColor object.\n\n",
|
|
452
|
+
"47": "minScreen and maxScreen must be provided as stringified numbers with the same units.\n\n",
|
|
453
|
+
"48": "fromSize and toSize must be provided as stringified numbers with the same units.\n\n",
|
|
454
|
+
"49": "Expects either an array of objects or a single object with the properties prop, fromSize, and toSize.\n\n",
|
|
455
|
+
"50": "Expects the objects in the first argument array to have the properties prop, fromSize, and toSize.\n\n",
|
|
456
|
+
"51": "Expects the first argument object to have the properties prop, fromSize, and toSize.\n\n",
|
|
457
|
+
"52": "fontFace expects either the path to the font file(s) or a name of a local copy.\n\n",
|
|
458
|
+
"53": "fontFace expects localFonts to be an array.\n\n",
|
|
459
|
+
"54": "fontFace expects fileFormats to be an array.\n\n",
|
|
460
|
+
"55": "fontFace expects a name of a font-family.\n\n",
|
|
461
|
+
"56": "linearGradient requries at least 2 color-stops to properly render.\n\n",
|
|
462
|
+
"57": "radialGradient requries at least 2 color-stops to properly render.\n\n",
|
|
463
|
+
"58": "Please supply a filename to retinaImage() as the first argument.\n\n",
|
|
464
|
+
"59": "Passed invalid argument to triangle, please pass correct pointingDirection e.g. 'right'.\n\n",
|
|
465
|
+
"60": "Passed an invalid value to `height` or `width`. Please provide a pixel based unit.\n\n",
|
|
466
|
+
"61": "Property must be a string value.\n\n",
|
|
467
|
+
"62": "borderRadius expects a radius value as a string or number as the second argument.\n\n",
|
|
468
|
+
"63": 'borderRadius expects one of "top", "bottom", "left" or "right" as the first argument.\n\n',
|
|
469
|
+
"64": "The animation shorthand only takes 8 arguments. See the specification for more information: http://mdn.io/animation.\n\n",
|
|
470
|
+
"65": "To pass multiple animations please supply them in arrays, e.g. animation(['rotate', '2s'], ['move', '1s'])\\nTo pass a single animation please supply them in simple values, e.g. animation('rotate', '2s').\n\n",
|
|
471
|
+
"66": "The animation shorthand arrays can only have 8 elements. See the specification for more information: http://mdn.io/animation.\n\n",
|
|
472
|
+
"67": "You must provide a template to this method.\n\n",
|
|
473
|
+
"68": "You passed an unsupported selector state to this method.\n\n",
|
|
474
|
+
"69": 'Expected a string ending in "px" or a number passed as the first argument to %s(), got %s instead.\n\n',
|
|
475
|
+
"70": 'Expected a string ending in "px" or a number passed as the second argument to %s(), got %s instead.\n\n',
|
|
476
|
+
"71": 'Passed invalid pixel value %s to %s(), please pass a value like "12px" or 12.\n\n',
|
|
477
|
+
"72": 'Passed invalid base value %s to %s(), please pass a value like "12px" or 12.\n\n',
|
|
478
|
+
"73": "Please provide a valid CSS variable.\n\n",
|
|
479
|
+
"74": "CSS variable not found.\n\n",
|
|
480
|
+
"75": "fromSize and toSize must be provided as stringified numbers with the same units as minScreen and maxScreen.\n"
|
|
481
|
+
};
|
|
482
|
+
function format() {
|
|
483
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
484
|
+
args[_key] = arguments[_key];
|
|
485
|
+
}
|
|
486
|
+
var a = args[0];
|
|
487
|
+
var b = [];
|
|
488
|
+
var c;
|
|
489
|
+
for (c = 1; c < args.length; c += 1) {
|
|
490
|
+
b.push(args[c]);
|
|
491
|
+
}
|
|
492
|
+
b.forEach(function(d) {
|
|
493
|
+
a = a.replace(/%[a-z]/, d);
|
|
494
|
+
});
|
|
495
|
+
return a;
|
|
496
|
+
}
|
|
497
|
+
var PolishedError = /* @__PURE__ */ function(_Error) {
|
|
498
|
+
_inheritsLoose(PolishedError2, _Error);
|
|
499
|
+
function PolishedError2(code) {
|
|
500
|
+
var _this;
|
|
501
|
+
if (process.env.NODE_ENV === "production") {
|
|
502
|
+
_this = _Error.call(this, "An error occurred. See https://github.com/styled-components/polished/blob/main/src/internalHelpers/errors.md#" + code + " for more information.") || this;
|
|
503
|
+
} else {
|
|
504
|
+
for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
|
505
|
+
args[_key2 - 1] = arguments[_key2];
|
|
506
|
+
}
|
|
507
|
+
_this = _Error.call(this, format.apply(void 0, [ERRORS[code]].concat(args))) || this;
|
|
508
|
+
}
|
|
509
|
+
return _assertThisInitialized(_this);
|
|
510
|
+
}
|
|
511
|
+
return PolishedError2;
|
|
512
|
+
}(/* @__PURE__ */ _wrapNativeSuper(Error));
|
|
513
|
+
function colorToInt(color) {
|
|
514
|
+
return Math.round(color * 255);
|
|
515
|
+
}
|
|
516
|
+
function convertToInt(red, green, blue) {
|
|
517
|
+
return colorToInt(red) + "," + colorToInt(green) + "," + colorToInt(blue);
|
|
518
|
+
}
|
|
519
|
+
function hslToRgb(hue, saturation, lightness, convert) {
|
|
520
|
+
if (convert === void 0) {
|
|
521
|
+
convert = convertToInt;
|
|
522
|
+
}
|
|
523
|
+
if (saturation === 0) {
|
|
524
|
+
return convert(lightness, lightness, lightness);
|
|
525
|
+
}
|
|
526
|
+
var huePrime = (hue % 360 + 360) % 360 / 60;
|
|
527
|
+
var chroma = (1 - Math.abs(2 * lightness - 1)) * saturation;
|
|
528
|
+
var secondComponent = chroma * (1 - Math.abs(huePrime % 2 - 1));
|
|
529
|
+
var red = 0;
|
|
530
|
+
var green = 0;
|
|
531
|
+
var blue = 0;
|
|
532
|
+
if (huePrime >= 0 && huePrime < 1) {
|
|
533
|
+
red = chroma;
|
|
534
|
+
green = secondComponent;
|
|
535
|
+
} else if (huePrime >= 1 && huePrime < 2) {
|
|
536
|
+
red = secondComponent;
|
|
537
|
+
green = chroma;
|
|
538
|
+
} else if (huePrime >= 2 && huePrime < 3) {
|
|
539
|
+
green = chroma;
|
|
540
|
+
blue = secondComponent;
|
|
541
|
+
} else if (huePrime >= 3 && huePrime < 4) {
|
|
542
|
+
green = secondComponent;
|
|
543
|
+
blue = chroma;
|
|
544
|
+
} else if (huePrime >= 4 && huePrime < 5) {
|
|
545
|
+
red = secondComponent;
|
|
546
|
+
blue = chroma;
|
|
547
|
+
} else if (huePrime >= 5 && huePrime < 6) {
|
|
548
|
+
red = chroma;
|
|
549
|
+
blue = secondComponent;
|
|
550
|
+
}
|
|
551
|
+
var lightnessModification = lightness - chroma / 2;
|
|
552
|
+
var finalRed = red + lightnessModification;
|
|
553
|
+
var finalGreen = green + lightnessModification;
|
|
554
|
+
var finalBlue = blue + lightnessModification;
|
|
555
|
+
return convert(finalRed, finalGreen, finalBlue);
|
|
556
|
+
}
|
|
557
|
+
var namedColorMap = {
|
|
558
|
+
aliceblue: "f0f8ff",
|
|
559
|
+
antiquewhite: "faebd7",
|
|
560
|
+
aqua: "00ffff",
|
|
561
|
+
aquamarine: "7fffd4",
|
|
562
|
+
azure: "f0ffff",
|
|
563
|
+
beige: "f5f5dc",
|
|
564
|
+
bisque: "ffe4c4",
|
|
565
|
+
black: "000",
|
|
566
|
+
blanchedalmond: "ffebcd",
|
|
567
|
+
blue: "0000ff",
|
|
568
|
+
blueviolet: "8a2be2",
|
|
569
|
+
brown: "a52a2a",
|
|
570
|
+
burlywood: "deb887",
|
|
571
|
+
cadetblue: "5f9ea0",
|
|
572
|
+
chartreuse: "7fff00",
|
|
573
|
+
chocolate: "d2691e",
|
|
574
|
+
coral: "ff7f50",
|
|
575
|
+
cornflowerblue: "6495ed",
|
|
576
|
+
cornsilk: "fff8dc",
|
|
577
|
+
crimson: "dc143c",
|
|
578
|
+
cyan: "00ffff",
|
|
579
|
+
darkblue: "00008b",
|
|
580
|
+
darkcyan: "008b8b",
|
|
581
|
+
darkgoldenrod: "b8860b",
|
|
582
|
+
darkgray: "a9a9a9",
|
|
583
|
+
darkgreen: "006400",
|
|
584
|
+
darkgrey: "a9a9a9",
|
|
585
|
+
darkkhaki: "bdb76b",
|
|
586
|
+
darkmagenta: "8b008b",
|
|
587
|
+
darkolivegreen: "556b2f",
|
|
588
|
+
darkorange: "ff8c00",
|
|
589
|
+
darkorchid: "9932cc",
|
|
590
|
+
darkred: "8b0000",
|
|
591
|
+
darksalmon: "e9967a",
|
|
592
|
+
darkseagreen: "8fbc8f",
|
|
593
|
+
darkslateblue: "483d8b",
|
|
594
|
+
darkslategray: "2f4f4f",
|
|
595
|
+
darkslategrey: "2f4f4f",
|
|
596
|
+
darkturquoise: "00ced1",
|
|
597
|
+
darkviolet: "9400d3",
|
|
598
|
+
deeppink: "ff1493",
|
|
599
|
+
deepskyblue: "00bfff",
|
|
600
|
+
dimgray: "696969",
|
|
601
|
+
dimgrey: "696969",
|
|
602
|
+
dodgerblue: "1e90ff",
|
|
603
|
+
firebrick: "b22222",
|
|
604
|
+
floralwhite: "fffaf0",
|
|
605
|
+
forestgreen: "228b22",
|
|
606
|
+
fuchsia: "ff00ff",
|
|
607
|
+
gainsboro: "dcdcdc",
|
|
608
|
+
ghostwhite: "f8f8ff",
|
|
609
|
+
gold: "ffd700",
|
|
610
|
+
goldenrod: "daa520",
|
|
611
|
+
gray: "808080",
|
|
612
|
+
green: "008000",
|
|
613
|
+
greenyellow: "adff2f",
|
|
614
|
+
grey: "808080",
|
|
615
|
+
honeydew: "f0fff0",
|
|
616
|
+
hotpink: "ff69b4",
|
|
617
|
+
indianred: "cd5c5c",
|
|
618
|
+
indigo: "4b0082",
|
|
619
|
+
ivory: "fffff0",
|
|
620
|
+
khaki: "f0e68c",
|
|
621
|
+
lavender: "e6e6fa",
|
|
622
|
+
lavenderblush: "fff0f5",
|
|
623
|
+
lawngreen: "7cfc00",
|
|
624
|
+
lemonchiffon: "fffacd",
|
|
625
|
+
lightblue: "add8e6",
|
|
626
|
+
lightcoral: "f08080",
|
|
627
|
+
lightcyan: "e0ffff",
|
|
628
|
+
lightgoldenrodyellow: "fafad2",
|
|
629
|
+
lightgray: "d3d3d3",
|
|
630
|
+
lightgreen: "90ee90",
|
|
631
|
+
lightgrey: "d3d3d3",
|
|
632
|
+
lightpink: "ffb6c1",
|
|
633
|
+
lightsalmon: "ffa07a",
|
|
634
|
+
lightseagreen: "20b2aa",
|
|
635
|
+
lightskyblue: "87cefa",
|
|
636
|
+
lightslategray: "789",
|
|
637
|
+
lightslategrey: "789",
|
|
638
|
+
lightsteelblue: "b0c4de",
|
|
639
|
+
lightyellow: "ffffe0",
|
|
640
|
+
lime: "0f0",
|
|
641
|
+
limegreen: "32cd32",
|
|
642
|
+
linen: "faf0e6",
|
|
643
|
+
magenta: "f0f",
|
|
644
|
+
maroon: "800000",
|
|
645
|
+
mediumaquamarine: "66cdaa",
|
|
646
|
+
mediumblue: "0000cd",
|
|
647
|
+
mediumorchid: "ba55d3",
|
|
648
|
+
mediumpurple: "9370db",
|
|
649
|
+
mediumseagreen: "3cb371",
|
|
650
|
+
mediumslateblue: "7b68ee",
|
|
651
|
+
mediumspringgreen: "00fa9a",
|
|
652
|
+
mediumturquoise: "48d1cc",
|
|
653
|
+
mediumvioletred: "c71585",
|
|
654
|
+
midnightblue: "191970",
|
|
655
|
+
mintcream: "f5fffa",
|
|
656
|
+
mistyrose: "ffe4e1",
|
|
657
|
+
moccasin: "ffe4b5",
|
|
658
|
+
navajowhite: "ffdead",
|
|
659
|
+
navy: "000080",
|
|
660
|
+
oldlace: "fdf5e6",
|
|
661
|
+
olive: "808000",
|
|
662
|
+
olivedrab: "6b8e23",
|
|
663
|
+
orange: "ffa500",
|
|
664
|
+
orangered: "ff4500",
|
|
665
|
+
orchid: "da70d6",
|
|
666
|
+
palegoldenrod: "eee8aa",
|
|
667
|
+
palegreen: "98fb98",
|
|
668
|
+
paleturquoise: "afeeee",
|
|
669
|
+
palevioletred: "db7093",
|
|
670
|
+
papayawhip: "ffefd5",
|
|
671
|
+
peachpuff: "ffdab9",
|
|
672
|
+
peru: "cd853f",
|
|
673
|
+
pink: "ffc0cb",
|
|
674
|
+
plum: "dda0dd",
|
|
675
|
+
powderblue: "b0e0e6",
|
|
676
|
+
purple: "800080",
|
|
677
|
+
rebeccapurple: "639",
|
|
678
|
+
red: "f00",
|
|
679
|
+
rosybrown: "bc8f8f",
|
|
680
|
+
royalblue: "4169e1",
|
|
681
|
+
saddlebrown: "8b4513",
|
|
682
|
+
salmon: "fa8072",
|
|
683
|
+
sandybrown: "f4a460",
|
|
684
|
+
seagreen: "2e8b57",
|
|
685
|
+
seashell: "fff5ee",
|
|
686
|
+
sienna: "a0522d",
|
|
687
|
+
silver: "c0c0c0",
|
|
688
|
+
skyblue: "87ceeb",
|
|
689
|
+
slateblue: "6a5acd",
|
|
690
|
+
slategray: "708090",
|
|
691
|
+
slategrey: "708090",
|
|
692
|
+
snow: "fffafa",
|
|
693
|
+
springgreen: "00ff7f",
|
|
694
|
+
steelblue: "4682b4",
|
|
695
|
+
tan: "d2b48c",
|
|
696
|
+
teal: "008080",
|
|
697
|
+
thistle: "d8bfd8",
|
|
698
|
+
tomato: "ff6347",
|
|
699
|
+
turquoise: "40e0d0",
|
|
700
|
+
violet: "ee82ee",
|
|
701
|
+
wheat: "f5deb3",
|
|
702
|
+
white: "fff",
|
|
703
|
+
whitesmoke: "f5f5f5",
|
|
704
|
+
yellow: "ff0",
|
|
705
|
+
yellowgreen: "9acd32"
|
|
706
|
+
};
|
|
707
|
+
function nameToHex(color) {
|
|
708
|
+
if (typeof color !== "string") return color;
|
|
709
|
+
var normalizedColorName = color.toLowerCase();
|
|
710
|
+
return namedColorMap[normalizedColorName] ? "#" + namedColorMap[normalizedColorName] : color;
|
|
711
|
+
}
|
|
712
|
+
var hexRegex = /^#[a-fA-F0-9]{6}$/;
|
|
713
|
+
var hexRgbaRegex = /^#[a-fA-F0-9]{8}$/;
|
|
714
|
+
var reducedHexRegex = /^#[a-fA-F0-9]{3}$/;
|
|
715
|
+
var reducedRgbaHexRegex = /^#[a-fA-F0-9]{4}$/;
|
|
716
|
+
var rgbRegex = /^rgb\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*\)$/i;
|
|
717
|
+
var rgbaRegex = /^rgba\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*([-+]?[0-9]*[.]?[0-9]+)\s*\)$/i;
|
|
718
|
+
var hslRegex = /^hsl\(\s*(\d{0,3}[.]?[0-9]+)\s*,\s*(\d{1,3}[.]?[0-9]?)%\s*,\s*(\d{1,3}[.]?[0-9]?)%\s*\)$/i;
|
|
719
|
+
var hslaRegex = /^hsla\(\s*(\d{0,3}[.]?[0-9]+)\s*,\s*(\d{1,3}[.]?[0-9]?)%\s*,\s*(\d{1,3}[.]?[0-9]?)%\s*,\s*([-+]?[0-9]*[.]?[0-9]+)\s*\)$/i;
|
|
720
|
+
function parseToRgb(color) {
|
|
721
|
+
if (typeof color !== "string") {
|
|
722
|
+
throw new PolishedError(3);
|
|
723
|
+
}
|
|
724
|
+
var normalizedColor = nameToHex(color);
|
|
725
|
+
if (normalizedColor.match(hexRegex)) {
|
|
726
|
+
return {
|
|
727
|
+
red: parseInt("" + normalizedColor[1] + normalizedColor[2], 16),
|
|
728
|
+
green: parseInt("" + normalizedColor[3] + normalizedColor[4], 16),
|
|
729
|
+
blue: parseInt("" + normalizedColor[5] + normalizedColor[6], 16)
|
|
730
|
+
};
|
|
731
|
+
}
|
|
732
|
+
if (normalizedColor.match(hexRgbaRegex)) {
|
|
733
|
+
var alpha = parseFloat((parseInt("" + normalizedColor[7] + normalizedColor[8], 16) / 255).toFixed(2));
|
|
734
|
+
return {
|
|
735
|
+
red: parseInt("" + normalizedColor[1] + normalizedColor[2], 16),
|
|
736
|
+
green: parseInt("" + normalizedColor[3] + normalizedColor[4], 16),
|
|
737
|
+
blue: parseInt("" + normalizedColor[5] + normalizedColor[6], 16),
|
|
738
|
+
alpha
|
|
739
|
+
};
|
|
740
|
+
}
|
|
741
|
+
if (normalizedColor.match(reducedHexRegex)) {
|
|
742
|
+
return {
|
|
743
|
+
red: parseInt("" + normalizedColor[1] + normalizedColor[1], 16),
|
|
744
|
+
green: parseInt("" + normalizedColor[2] + normalizedColor[2], 16),
|
|
745
|
+
blue: parseInt("" + normalizedColor[3] + normalizedColor[3], 16)
|
|
746
|
+
};
|
|
747
|
+
}
|
|
748
|
+
if (normalizedColor.match(reducedRgbaHexRegex)) {
|
|
749
|
+
var _alpha = parseFloat((parseInt("" + normalizedColor[4] + normalizedColor[4], 16) / 255).toFixed(2));
|
|
750
|
+
return {
|
|
751
|
+
red: parseInt("" + normalizedColor[1] + normalizedColor[1], 16),
|
|
752
|
+
green: parseInt("" + normalizedColor[2] + normalizedColor[2], 16),
|
|
753
|
+
blue: parseInt("" + normalizedColor[3] + normalizedColor[3], 16),
|
|
754
|
+
alpha: _alpha
|
|
755
|
+
};
|
|
756
|
+
}
|
|
757
|
+
var rgbMatched = rgbRegex.exec(normalizedColor);
|
|
758
|
+
if (rgbMatched) {
|
|
759
|
+
return {
|
|
760
|
+
red: parseInt("" + rgbMatched[1], 10),
|
|
761
|
+
green: parseInt("" + rgbMatched[2], 10),
|
|
762
|
+
blue: parseInt("" + rgbMatched[3], 10)
|
|
763
|
+
};
|
|
764
|
+
}
|
|
765
|
+
var rgbaMatched = rgbaRegex.exec(normalizedColor.substring(0, 50));
|
|
766
|
+
if (rgbaMatched) {
|
|
767
|
+
return {
|
|
768
|
+
red: parseInt("" + rgbaMatched[1], 10),
|
|
769
|
+
green: parseInt("" + rgbaMatched[2], 10),
|
|
770
|
+
blue: parseInt("" + rgbaMatched[3], 10),
|
|
771
|
+
alpha: parseFloat("" + rgbaMatched[4])
|
|
772
|
+
};
|
|
773
|
+
}
|
|
774
|
+
var hslMatched = hslRegex.exec(normalizedColor);
|
|
775
|
+
if (hslMatched) {
|
|
776
|
+
var hue = parseInt("" + hslMatched[1], 10);
|
|
777
|
+
var saturation = parseInt("" + hslMatched[2], 10) / 100;
|
|
778
|
+
var lightness = parseInt("" + hslMatched[3], 10) / 100;
|
|
779
|
+
var rgbColorString = "rgb(" + hslToRgb(hue, saturation, lightness) + ")";
|
|
780
|
+
var hslRgbMatched = rgbRegex.exec(rgbColorString);
|
|
781
|
+
if (!hslRgbMatched) {
|
|
782
|
+
throw new PolishedError(4, normalizedColor, rgbColorString);
|
|
783
|
+
}
|
|
784
|
+
return {
|
|
785
|
+
red: parseInt("" + hslRgbMatched[1], 10),
|
|
786
|
+
green: parseInt("" + hslRgbMatched[2], 10),
|
|
787
|
+
blue: parseInt("" + hslRgbMatched[3], 10)
|
|
788
|
+
};
|
|
789
|
+
}
|
|
790
|
+
var hslaMatched = hslaRegex.exec(normalizedColor.substring(0, 50));
|
|
791
|
+
if (hslaMatched) {
|
|
792
|
+
var _hue = parseInt("" + hslaMatched[1], 10);
|
|
793
|
+
var _saturation = parseInt("" + hslaMatched[2], 10) / 100;
|
|
794
|
+
var _lightness = parseInt("" + hslaMatched[3], 10) / 100;
|
|
795
|
+
var _rgbColorString = "rgb(" + hslToRgb(_hue, _saturation, _lightness) + ")";
|
|
796
|
+
var _hslRgbMatched = rgbRegex.exec(_rgbColorString);
|
|
797
|
+
if (!_hslRgbMatched) {
|
|
798
|
+
throw new PolishedError(4, normalizedColor, _rgbColorString);
|
|
799
|
+
}
|
|
800
|
+
return {
|
|
801
|
+
red: parseInt("" + _hslRgbMatched[1], 10),
|
|
802
|
+
green: parseInt("" + _hslRgbMatched[2], 10),
|
|
803
|
+
blue: parseInt("" + _hslRgbMatched[3], 10),
|
|
804
|
+
alpha: parseFloat("" + hslaMatched[4])
|
|
805
|
+
};
|
|
806
|
+
}
|
|
807
|
+
throw new PolishedError(5);
|
|
808
|
+
}
|
|
809
|
+
var reduceHexValue = function reduceHexValue2(value) {
|
|
810
|
+
if (value.length === 7 && value[1] === value[2] && value[3] === value[4] && value[5] === value[6]) {
|
|
811
|
+
return "#" + value[1] + value[3] + value[5];
|
|
812
|
+
}
|
|
813
|
+
return value;
|
|
814
|
+
};
|
|
815
|
+
function numberToHex(value) {
|
|
816
|
+
var hex = value.toString(16);
|
|
817
|
+
return hex.length === 1 ? "0" + hex : hex;
|
|
818
|
+
}
|
|
819
|
+
function rgb(value, green, blue) {
|
|
820
|
+
if (typeof value === "number" && typeof green === "number" && typeof blue === "number") {
|
|
821
|
+
return reduceHexValue("#" + numberToHex(value) + numberToHex(green) + numberToHex(blue));
|
|
822
|
+
} else if (typeof value === "object" && green === void 0 && blue === void 0) {
|
|
823
|
+
return reduceHexValue("#" + numberToHex(value.red) + numberToHex(value.green) + numberToHex(value.blue));
|
|
824
|
+
}
|
|
825
|
+
throw new PolishedError(6);
|
|
826
|
+
}
|
|
827
|
+
function rgba(firstValue, secondValue, thirdValue, fourthValue) {
|
|
828
|
+
if (typeof firstValue === "string" && typeof secondValue === "number") {
|
|
829
|
+
var rgbValue = parseToRgb(firstValue);
|
|
830
|
+
return "rgba(" + rgbValue.red + "," + rgbValue.green + "," + rgbValue.blue + "," + secondValue + ")";
|
|
831
|
+
} else if (typeof firstValue === "number" && typeof secondValue === "number" && typeof thirdValue === "number" && typeof fourthValue === "number") {
|
|
832
|
+
return fourthValue >= 1 ? rgb(firstValue, secondValue, thirdValue) : "rgba(" + firstValue + "," + secondValue + "," + thirdValue + "," + fourthValue + ")";
|
|
833
|
+
} else if (typeof firstValue === "object" && secondValue === void 0 && thirdValue === void 0 && fourthValue === void 0) {
|
|
834
|
+
return firstValue.alpha >= 1 ? rgb(firstValue.red, firstValue.green, firstValue.blue) : "rgba(" + firstValue.red + "," + firstValue.green + "," + firstValue.blue + "," + firstValue.alpha + ")";
|
|
835
|
+
}
|
|
836
|
+
throw new PolishedError(7);
|
|
837
|
+
}
|
|
838
|
+
function curried(f, length, acc) {
|
|
839
|
+
return function fn() {
|
|
840
|
+
var combined = acc.concat(Array.prototype.slice.call(arguments));
|
|
841
|
+
return combined.length >= length ? f.apply(this, combined) : curried(f, length, combined);
|
|
842
|
+
};
|
|
843
|
+
}
|
|
844
|
+
function curry(f) {
|
|
845
|
+
return curried(f, f.length, []);
|
|
846
|
+
}
|
|
847
|
+
function guard(lowerBoundary, upperBoundary, value) {
|
|
848
|
+
return Math.max(lowerBoundary, Math.min(upperBoundary, value));
|
|
849
|
+
}
|
|
850
|
+
function transparentize(amount, color) {
|
|
851
|
+
if (color === "transparent") return color;
|
|
852
|
+
var parsedColor = parseToRgb(color);
|
|
853
|
+
var alpha = typeof parsedColor.alpha === "number" ? parsedColor.alpha : 1;
|
|
854
|
+
var colorWithAlpha = _extends({}, parsedColor, {
|
|
855
|
+
alpha: guard(0, 1, +(alpha * 100 - parseFloat(amount) * 100).toFixed(2) / 100)
|
|
856
|
+
});
|
|
857
|
+
return rgba(colorWithAlpha);
|
|
858
|
+
}
|
|
859
|
+
var curriedTransparentize = /* @__PURE__ */ curry(transparentize);
|
|
860
|
+
|
|
861
|
+
// ../seeds-react-mixins/dist/esm/index.js
|
|
862
|
+
import { css } from "styled-components";
|
|
863
|
+
import { theme } from "@sproutsocial/seeds-react-theme";
|
|
864
|
+
var visuallyHidden = css`
|
|
865
|
+
position: absolute;
|
|
866
|
+
width: 1px;
|
|
867
|
+
height: 1px;
|
|
868
|
+
padding: 0;
|
|
869
|
+
margin: -1px;
|
|
870
|
+
overflow: hidden;
|
|
871
|
+
clip: rect(0 0 0 0);
|
|
872
|
+
border: 0;
|
|
873
|
+
`;
|
|
874
|
+
var focusRing = css`
|
|
875
|
+
box-shadow: 0 0 0 1px ${theme.colors.button.primary.background.base},
|
|
876
|
+
0 0px 0px 4px
|
|
877
|
+
${curriedTransparentize(0.7, theme.colors.button.primary.background.base)};
|
|
878
|
+
outline: none;
|
|
879
|
+
|
|
880
|
+
&::-moz-focus-inner {
|
|
881
|
+
border: 0;
|
|
882
|
+
}
|
|
883
|
+
`;
|
|
884
|
+
var pill = css`
|
|
885
|
+
min-width: ${theme.space[600]};
|
|
886
|
+
min-height: ${theme.space[600]};
|
|
887
|
+
padding: ${theme.space[300]};
|
|
888
|
+
border-radius: ${theme.radii.pill};
|
|
889
|
+
`;
|
|
890
|
+
var disabled = css`
|
|
891
|
+
opacity: 0.4;
|
|
892
|
+
pointer-events: none;
|
|
893
|
+
`;
|
|
894
|
+
|
|
895
|
+
// ../seeds-react-loader/dist/esm/index.js
|
|
896
|
+
import { jsx as jsx7 } from "react/jsx-runtime";
|
|
897
|
+
var getSize = (size) => {
|
|
898
|
+
const spinnerSize = Math.round(size * 1);
|
|
899
|
+
const borderWidth = Math.round(size * 0.1);
|
|
900
|
+
return css2`
|
|
901
|
+
width: ${size}px;
|
|
902
|
+
height: ${size}px;
|
|
903
|
+
box-shadow: ${({ theme: theme2 }) => `0 0 0 2px ${theme2.colors.neutral[600]},
|
|
904
|
+
inset 0 0 0 ${borderWidth + 2}px ${theme2.colors.neutral[600]}`};
|
|
905
|
+
|
|
906
|
+
&:after {
|
|
907
|
+
width: ${spinnerSize}px;
|
|
908
|
+
height: ${spinnerSize}px;
|
|
909
|
+
box-sizing: border-box;
|
|
910
|
+
border-width: ${borderWidth}px;
|
|
911
|
+
}
|
|
912
|
+
|
|
913
|
+
.no-cssanimations &::after {
|
|
914
|
+
background-size: ${spinnerSize}px;
|
|
915
|
+
}
|
|
916
|
+
`;
|
|
917
|
+
};
|
|
918
|
+
var spin = keyframes`
|
|
919
|
+
from {
|
|
920
|
+
transform: translate(-50%,-50%) rotate(0deg);
|
|
921
|
+
}
|
|
922
|
+
to {
|
|
923
|
+
transform: translate(-50%,-50%) rotate(360deg);
|
|
924
|
+
}
|
|
925
|
+
`;
|
|
926
|
+
var delayAnimation = keyframes`
|
|
927
|
+
0% {
|
|
928
|
+
opacity: 0;
|
|
929
|
+
}
|
|
930
|
+
80% {
|
|
931
|
+
opacity: 0;
|
|
932
|
+
}
|
|
933
|
+
100% {
|
|
934
|
+
opacity: 1;
|
|
935
|
+
}
|
|
936
|
+
`;
|
|
937
|
+
var Container3 = styled4.div.attrs({
|
|
938
|
+
className: "Loader"
|
|
939
|
+
})`
|
|
940
|
+
position: relative;
|
|
941
|
+
margin: 0 auto;
|
|
942
|
+
padding: 0;
|
|
943
|
+
overflow: hidden;
|
|
944
|
+
border-radius: 100%;
|
|
945
|
+
|
|
946
|
+
animation: ${(props) => props.delay ? css2`
|
|
947
|
+
${delayAnimation} 2s 1;
|
|
948
|
+
` : "none"};
|
|
949
|
+
|
|
950
|
+
&:after {
|
|
951
|
+
position: absolute;
|
|
952
|
+
top: 50%;
|
|
953
|
+
left: 50%;
|
|
954
|
+
background: transparent;
|
|
955
|
+
border-style: solid;
|
|
956
|
+
border-radius: 100%;
|
|
957
|
+
content: "";
|
|
958
|
+
transition: opacity 250ms;
|
|
959
|
+
border-color: ${({ theme: theme2 }) => `${theme2.colors.neutral[0]} ${theme2.colors.neutral[0]} ${theme2.colors.neutral[600]} ${theme2.colors.neutral[600]}`};
|
|
960
|
+
|
|
961
|
+
animation: ${(props) => props.delay ? css2`
|
|
962
|
+
${spin} 2.25s infinite linear, ${delayAnimation} 2s 1
|
|
963
|
+
` : css2`
|
|
964
|
+
${spin} 2.25s infinite linear
|
|
965
|
+
`};
|
|
966
|
+
}
|
|
967
|
+
|
|
968
|
+
${(props) => props.small ? getSize(20) : getSize(40)}
|
|
969
|
+
${COMMON}
|
|
970
|
+
`;
|
|
971
|
+
var Text2 = styled4.div`
|
|
972
|
+
${visuallyHidden}
|
|
973
|
+
`;
|
|
974
|
+
var styles_default2 = Container3;
|
|
975
|
+
var Loader = ({
|
|
976
|
+
size = "large",
|
|
977
|
+
text = "",
|
|
978
|
+
delay = true,
|
|
979
|
+
color = "dark",
|
|
980
|
+
qa,
|
|
981
|
+
...rest
|
|
982
|
+
}) => {
|
|
983
|
+
return /* @__PURE__ */ jsx7(
|
|
984
|
+
styles_default2,
|
|
985
|
+
{
|
|
986
|
+
small: size === "small",
|
|
987
|
+
dark: color === "dark",
|
|
988
|
+
delay,
|
|
989
|
+
"data-qa-loader": "",
|
|
990
|
+
...qa,
|
|
991
|
+
...rest,
|
|
992
|
+
children: /* @__PURE__ */ jsx7(Text2, { children: text || "Loading" })
|
|
993
|
+
}
|
|
994
|
+
);
|
|
995
|
+
};
|
|
996
|
+
var Loader_default = Loader;
|
|
997
|
+
var index_default2 = Loader_default;
|
|
998
|
+
|
|
999
|
+
// src/VirtualizedDataList.tsx
|
|
1000
|
+
import { useVirtualizer } from "@tanstack/react-virtual";
|
|
1001
|
+
import { useInView } from "react-intersection-observer";
|
|
1002
|
+
import styled5 from "styled-components";
|
|
1003
|
+
import { jsx as jsx8, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
1004
|
+
var HeaderContent2 = styled5(Box6)`
|
|
1005
|
+
width: 100%;
|
|
1006
|
+
transition: transform 0.4s ease-in-out;
|
|
1007
|
+
background-color: red;
|
|
1008
|
+
`;
|
|
1009
|
+
var Experimental_VirtualizedDataList = ({
|
|
1010
|
+
as = "ul",
|
|
1011
|
+
data,
|
|
1012
|
+
renderItem,
|
|
1013
|
+
estimateItemSize = 50,
|
|
1014
|
+
onEndReached,
|
|
1015
|
+
hasNextPage,
|
|
1016
|
+
isFetchingNextPage,
|
|
1017
|
+
Header,
|
|
1018
|
+
removeHeaderDepth = 500,
|
|
1019
|
+
headerHeight = 60,
|
|
1020
|
+
...rest
|
|
1021
|
+
}) => {
|
|
1022
|
+
const afterInView = useInView();
|
|
1023
|
+
const parentRef = React5.useRef(null);
|
|
1024
|
+
const count = data.length;
|
|
1025
|
+
const virtualizer = useVirtualizer({
|
|
1026
|
+
count,
|
|
1027
|
+
getScrollElement: () => parentRef.current,
|
|
1028
|
+
estimateSize: () => estimateItemSize,
|
|
1029
|
+
overscan: 5
|
|
1030
|
+
});
|
|
1031
|
+
const items = virtualizer.getVirtualItems();
|
|
1032
|
+
const offset = virtualizer.scrollOffset;
|
|
1033
|
+
const transform = offset && offset > removeHeaderDepth ? `translateY(-${headerHeight}px)` : "translateY(0px)";
|
|
1034
|
+
React5.useEffect(() => {
|
|
1035
|
+
if (afterInView.inView) {
|
|
1036
|
+
onEndReached?.();
|
|
1037
|
+
}
|
|
1038
|
+
}, [onEndReached, afterInView.inView]);
|
|
1039
|
+
return /* @__PURE__ */ jsxs4(
|
|
1040
|
+
"div",
|
|
1041
|
+
{
|
|
1042
|
+
ref: parentRef,
|
|
1043
|
+
className: "List",
|
|
1044
|
+
style: {
|
|
1045
|
+
width: "100%",
|
|
1046
|
+
height: "100%",
|
|
1047
|
+
overflowY: "auto",
|
|
1048
|
+
contain: "strict"
|
|
1049
|
+
},
|
|
1050
|
+
children: [
|
|
1051
|
+
Header && /* @__PURE__ */ jsx8(
|
|
1052
|
+
HeaderContent2,
|
|
1053
|
+
{
|
|
1054
|
+
style: {
|
|
1055
|
+
position: "sticky",
|
|
1056
|
+
transform,
|
|
1057
|
+
top: 0,
|
|
1058
|
+
left: 0,
|
|
1059
|
+
width: "100%",
|
|
1060
|
+
zIndex: 1
|
|
1061
|
+
},
|
|
1062
|
+
id: "header",
|
|
1063
|
+
children: Header
|
|
1064
|
+
}
|
|
1065
|
+
),
|
|
1066
|
+
/* @__PURE__ */ jsx8(
|
|
1067
|
+
List_default,
|
|
1068
|
+
{
|
|
1069
|
+
as,
|
|
1070
|
+
style: {
|
|
1071
|
+
height: `${virtualizer.getTotalSize()}px`,
|
|
1072
|
+
width: "100%",
|
|
1073
|
+
position: "relative"
|
|
1074
|
+
},
|
|
1075
|
+
children: items.map((virtualRow) => {
|
|
1076
|
+
return /* @__PURE__ */ jsx8(
|
|
1077
|
+
ListItem_default,
|
|
1078
|
+
{
|
|
1079
|
+
"data-index": virtualRow.index,
|
|
1080
|
+
ref: virtualizer.measureElement,
|
|
1081
|
+
style: {
|
|
1082
|
+
position: "absolute",
|
|
1083
|
+
top: 0,
|
|
1084
|
+
left: 0,
|
|
1085
|
+
width: "100%",
|
|
1086
|
+
transform: `translateY(${virtualRow.start - virtualizer.options.scrollMargin}px)`
|
|
1087
|
+
},
|
|
1088
|
+
children: renderItem(data[virtualRow.index])
|
|
1089
|
+
},
|
|
1090
|
+
virtualRow.key
|
|
1091
|
+
);
|
|
1092
|
+
})
|
|
1093
|
+
}
|
|
1094
|
+
),
|
|
1095
|
+
/* @__PURE__ */ jsx8("div", { ref: afterInView.ref, children: /* @__PURE__ */ jsx8(index_default2, { delay: false }) })
|
|
1096
|
+
]
|
|
1097
|
+
}
|
|
1098
|
+
);
|
|
1099
|
+
};
|
|
1100
|
+
Experimental_VirtualizedDataList.displayName = "Experimental_VirtualizedDataList";
|
|
1101
|
+
var VirtualizedDataList_default = Experimental_VirtualizedDataList;
|
|
1102
|
+
|
|
94
1103
|
// src/ListTypes.ts
|
|
95
1104
|
import "react";
|
|
96
1105
|
|
|
97
1106
|
// src/ListItemTypes.ts
|
|
98
1107
|
import "react";
|
|
1108
|
+
|
|
1109
|
+
// src/DataListTypes.ts
|
|
1110
|
+
import "react";
|
|
99
1111
|
export {
|
|
1112
|
+
DataItemSkeleton_default as DataItemSkeleton,
|
|
1113
|
+
DataList_default as DataList,
|
|
1114
|
+
VirtualizedDataList_default as Experimental_VirtualizedDataList,
|
|
100
1115
|
List_default as List,
|
|
101
1116
|
ListItem_default as ListItem,
|
|
102
1117
|
ListItemContent_default as ListItemContent
|