@ultraviolet/ui 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (115) hide show
  1. package/LICENSE +189 -0
  2. package/README.md +64 -0
  3. package/dist/index.d.ts +2427 -0
  4. package/dist/react-datepicker/dist/react-datepicker.min.css.js +3 -0
  5. package/dist/react-toastify/dist/ReactToastify.min.css.js +3 -0
  6. package/dist/src/components/ActionBar/index.js +55 -0
  7. package/dist/src/components/Alert/index.js +144 -0
  8. package/dist/src/components/Avatar/index.js +90 -0
  9. package/dist/src/components/Badge/index.js +143 -0
  10. package/dist/src/components/Banner/index.js +117 -0
  11. package/dist/src/components/BarChart/Tooltip.js +63 -0
  12. package/dist/src/components/BarChart/index.js +94 -0
  13. package/dist/src/components/BarStack/index.js +223 -0
  14. package/dist/src/components/Breadcrumbs/index.js +89 -0
  15. package/dist/src/components/Bullet/index.js +137 -0
  16. package/dist/src/components/Button/index.js +303 -0
  17. package/dist/src/components/Card/index.js +81 -0
  18. package/dist/src/components/Carousel/index.js +162 -0
  19. package/dist/src/components/Checkbox/index.js +338 -0
  20. package/dist/src/components/CopyButton/index.js +92 -0
  21. package/dist/src/components/DateInput/index.js +250 -0
  22. package/dist/src/components/EmptyState/index.js +124 -0
  23. package/dist/src/components/Expandable/index.js +84 -0
  24. package/dist/src/components/Icon/index.js +350 -0
  25. package/dist/src/components/LineChart/CustomLegend.js +147 -0
  26. package/dist/src/components/LineChart/Tooltip.js +58 -0
  27. package/dist/src/components/LineChart/helpers.js +75 -0
  28. package/dist/src/components/LineChart/index.js +139 -0
  29. package/dist/src/components/Link/index.js +159 -0
  30. package/dist/src/components/List/Body.js +22 -0
  31. package/dist/src/components/List/Cell.js +38 -0
  32. package/dist/src/components/List/HeaderCell.js +118 -0
  33. package/dist/src/components/List/HeaderRow.js +47 -0
  34. package/dist/src/components/List/ListContext.js +120 -0
  35. package/dist/src/components/List/Row.js +211 -0
  36. package/dist/src/components/List/SelectBar.js +52 -0
  37. package/dist/src/components/List/SkeletonRows.js +54 -0
  38. package/dist/src/components/List/constants.js +3 -0
  39. package/dist/src/components/List/index.js +77 -0
  40. package/dist/src/components/Loader/index.js +87 -0
  41. package/dist/src/components/Menu/Item.js +122 -0
  42. package/dist/src/components/Menu/index.js +143 -0
  43. package/dist/src/components/Modal/index.js +279 -0
  44. package/dist/src/components/Notice/index.js +33 -0
  45. package/dist/src/components/NumberInput/helpers.js +6 -0
  46. package/dist/src/components/NumberInput/index.js +366 -0
  47. package/dist/src/components/Pagination/getPageNumbers.js +32 -0
  48. package/dist/src/components/Pagination/index.js +118 -0
  49. package/dist/src/components/PasswordCheck/index.js +42 -0
  50. package/dist/src/components/PasswordStrengthMeter/index.js +116 -0
  51. package/dist/src/components/PieChart/Legends.js +183 -0
  52. package/dist/src/components/PieChart/Tooltip.js +64 -0
  53. package/dist/src/components/PieChart/index.js +133 -0
  54. package/dist/src/components/PieChart/patterns.js +9 -0
  55. package/dist/src/components/Popover/index.js +131 -0
  56. package/dist/src/components/ProgressBar/index.js +72 -0
  57. package/dist/src/components/Radio/index.js +231 -0
  58. package/dist/src/components/Row/index.js +43 -0
  59. package/dist/src/components/SelectInput/index.js +662 -0
  60. package/dist/src/components/SelectableCard/index.js +154 -0
  61. package/dist/src/components/Separator/index.js +91 -0
  62. package/dist/src/components/Skeleton/Block.js +53 -0
  63. package/dist/src/components/Skeleton/Blocks.js +52 -0
  64. package/dist/src/components/Skeleton/BoxWithIcon.js +47 -0
  65. package/dist/src/components/Skeleton/Donut.js +58 -0
  66. package/dist/src/components/Skeleton/IconSkeleton.js +37 -0
  67. package/dist/src/components/Skeleton/Line.js +19 -0
  68. package/dist/src/components/Skeleton/List.js +60 -0
  69. package/dist/src/components/Skeleton/Slider.js +57 -0
  70. package/dist/src/components/Skeleton/index.js +85 -0
  71. package/dist/src/components/Snippet/index.js +250 -0
  72. package/dist/src/components/Stack/index.js +24 -0
  73. package/dist/src/components/Status/index.js +101 -0
  74. package/dist/src/components/StepList/index.js +81 -0
  75. package/dist/src/components/Stepper/index.js +217 -0
  76. package/dist/src/components/SwitchButton/FocusOverlay.js +47 -0
  77. package/dist/src/components/SwitchButton/index.js +131 -0
  78. package/dist/src/components/Table/Body.js +12 -0
  79. package/dist/src/components/Table/Cell.js +27 -0
  80. package/dist/src/components/Table/Header.js +21 -0
  81. package/dist/src/components/Table/HeaderCell.js +119 -0
  82. package/dist/src/components/Table/HeaderRow.js +35 -0
  83. package/dist/src/components/Table/Row.js +70 -0
  84. package/dist/src/components/Table/SelectBar.js +52 -0
  85. package/dist/src/components/Table/SkeletonRows.js +52 -0
  86. package/dist/src/components/Table/TableContext.js +91 -0
  87. package/dist/src/components/Table/index.js +84 -0
  88. package/dist/src/components/Tabs/Tab.js +165 -0
  89. package/dist/src/components/Tabs/TabMenu.js +46 -0
  90. package/dist/src/components/Tabs/TabMenuItem.js +40 -0
  91. package/dist/src/components/Tabs/TabsContext.js +6 -0
  92. package/dist/src/components/Tabs/index.js +117 -0
  93. package/dist/src/components/Tag/index.js +177 -0
  94. package/dist/src/components/TagInput/index.js +277 -0
  95. package/dist/src/components/TagList/index.js +110 -0
  96. package/dist/src/components/Text/index.js +106 -0
  97. package/dist/src/components/TextInput/index.js +529 -0
  98. package/dist/src/components/TimeInput/index.js +38 -0
  99. package/dist/src/components/Toaster/index.js +116 -0
  100. package/dist/src/components/Toggle/index.js +192 -0
  101. package/dist/src/components/Tooltip/helpers.js +131 -0
  102. package/dist/src/components/Tooltip/index.js +275 -0
  103. package/dist/src/components/VerificationCode/index.js +203 -0
  104. package/dist/src/helpers/isJSON.js +11 -0
  105. package/dist/src/helpers/legend.js +13 -0
  106. package/dist/src/helpers/recursivelyGetChildrenString.js +12 -0
  107. package/dist/src/index.js +63 -0
  108. package/dist/src/theme/index.js +25 -0
  109. package/dist/src/utils/animations.js +250 -0
  110. package/dist/src/utils/capitalize.js +4 -0
  111. package/dist/src/utils/ids.js +12 -0
  112. package/dist/src/utils/normalize.js +36 -0
  113. package/dist/src/utils/responsive/Breakpoint.js +12 -0
  114. package/dist/src/utils/responsive/utilities.js +12 -0
  115. package/package.json +70 -0
@@ -0,0 +1,303 @@
1
+ import _styled from '@emotion/styled/base';
2
+ import { forwardRef } from 'react';
3
+ import { Icon } from '../Icon/index.js';
4
+ import { Loader } from '../Loader/index.js';
5
+ import { Tooltip } from '../Tooltip/index.js';
6
+ import { jsxs, Fragment, jsx } from '@emotion/react/jsx-runtime';
7
+
8
+ // SIZE
9
+ const SIZE_HEIGHT = {
10
+ large: 48,
11
+ medium: 40,
12
+ small: 32,
13
+ xsmall: 24
14
+ };
15
+ const SIZE_PADDING_KEY = {
16
+ large: 2,
17
+ medium: 1.5,
18
+ small: 1,
19
+ xsmall: 0.5
20
+ };
21
+ const SIZE_GAP_KEY = {
22
+ large: 1,
23
+ medium: 1,
24
+ small: 1,
25
+ xsmall: 0.5
26
+ };
27
+
28
+ // FOCUS RING
29
+ const FOCUS_RING_KEY = {
30
+ danger: 'focusDanger',
31
+ info: 'focusInfo',
32
+ neutral: 'focusNeutral',
33
+ primary: 'focusPrimary',
34
+ success: 'focusSuccess',
35
+ warning: 'focusWarning'
36
+ };
37
+
38
+ // VARIANTS
39
+
40
+ const coreStyle = _ref => {
41
+ let {
42
+ theme,
43
+ size,
44
+ sentiment,
45
+ iconPosition,
46
+ fullWidth,
47
+ disabled,
48
+ iconOnly
49
+ } = _ref;
50
+ const font = size === 'large' ? theme.typography.bodyStrong : theme.typography.bodySmallStrong;
51
+ let width = 'auto';
52
+ if (fullWidth) {
53
+ width = '100%';
54
+ } else if (iconOnly) {
55
+ width = `${SIZE_HEIGHT[size]}px`;
56
+ }
57
+ return `display: inline-flex;
58
+ height: ${SIZE_HEIGHT[size]}px;
59
+ padding: 0 ${theme.space[SIZE_PADDING_KEY[size]]};
60
+ flex-direction: ${iconPosition === 'right' ? 'row-reverse' : 'row'};
61
+ gap: ${theme.space[SIZE_GAP_KEY[size]]};
62
+ border-radius: ${theme.radii.default};
63
+ box-sizing: border-box;
64
+ width: ${width};
65
+ align-items: center;
66
+ cursor: ${disabled ? 'not-allowed' : 'pointer'};
67
+ justify-content: center;
68
+ outline-offset: 2px;
69
+ white-space: nowrap;
70
+ text-decoration: none;
71
+ &:hover {
72
+ text-decoration: none;
73
+ }
74
+
75
+
76
+ ${disabled ? '' : `
77
+ &:active {
78
+ box-shadow: ${theme.shadows[FOCUS_RING_KEY[sentiment]]};
79
+ }
80
+ `}
81
+
82
+ /* We can't use Text component because of button hover effect, so we need to duplicate */
83
+ font-size: ${font.fontSize};
84
+ font-family: ${font.fontFamily};
85
+ font-weight: ${font.weight};
86
+ letter-spacing: ${font.letterSpacing};
87
+ line-height: ${font.lineHeight};
88
+ paragraph-spacing: ${font.paragraphSpacing};
89
+ text-case: ${font.textCase};
90
+ `;
91
+ };
92
+ const StyledFilledButton = /*#__PURE__*/_styled('button', {
93
+ shouldForwardProp: prop => !['size', 'sentiment', 'iconPosition', 'fullWidth', 'iconOnly'].includes(prop),
94
+ target: "e112qvla2"
95
+ })(args => coreStyle(args), " background:", _ref2 => {
96
+ let {
97
+ theme,
98
+ sentiment
99
+ } = _ref2;
100
+ return theme.colors[sentiment].backgroundStrong;
101
+ }, ";border:none;color:", _ref3 => {
102
+ let {
103
+ theme,
104
+ sentiment
105
+ } = _ref3;
106
+ return theme.colors[sentiment][sentiment === 'neutral' ? 'text' : 'textStrong'];
107
+ }, ";", _ref4 => {
108
+ let {
109
+ theme,
110
+ sentiment,
111
+ disabled
112
+ } = _ref4;
113
+ return disabled ? `
114
+ background: ${theme.colors[sentiment].backgroundStrongDisabled};
115
+ color:
116
+ ${theme.colors[sentiment][sentiment === 'neutral' ? 'textDisabled' : 'textStrongDisabled']};
117
+ ` : `
118
+ &:hover, &:active
119
+ {
120
+ background: ${theme.colors[sentiment].backgroundStrongHover};
121
+ color:
122
+ ${theme.colors[sentiment][sentiment === 'neutral' ? 'textHover' : 'textStrongHover']};
123
+ }
124
+ `;
125
+ }, ";");
126
+ const StyledOutlinedButton = /*#__PURE__*/_styled('button', {
127
+ shouldForwardProp: prop => !['size', 'sentiment', 'iconPosition', 'fullWidth', 'iconOnly'].includes(prop),
128
+ target: "e112qvla1"
129
+ })(args => coreStyle(args), " background:none;border:1px solid ", _ref5 => {
130
+ let {
131
+ theme,
132
+ sentiment
133
+ } = _ref5;
134
+ return theme.colors[sentiment][sentiment === 'neutral' ? 'borderStrong' : 'borderWeak'];
135
+ }, ";color:", _ref6 => {
136
+ let {
137
+ theme,
138
+ sentiment
139
+ } = _ref6;
140
+ return theme.colors[sentiment][sentiment === 'neutral' ? 'text' : 'textWeak'];
141
+ }, ";", _ref7 => {
142
+ let {
143
+ theme,
144
+ sentiment,
145
+ disabled
146
+ } = _ref7;
147
+ return disabled ? `
148
+ color:
149
+ ${theme.colors[sentiment][sentiment === 'neutral' ? 'textDisabled' : 'textWeakDisabled']};
150
+ border: 1px solid ${theme.colors[sentiment][sentiment === 'neutral' ? 'borderStrongDisabled' : 'borderWeakDisabled']};
151
+
152
+ ` : `
153
+ &:hover, &:active
154
+ {
155
+ background: ${theme.colors[sentiment].backgroundWeakHover};
156
+ color:
157
+ ${theme.colors[sentiment][sentiment === 'neutral' ? 'textHover' : 'textWeakHover']};
158
+ border: 1px solid ${theme.colors[sentiment][sentiment === 'neutral' ? 'borderStrongHover' : 'borderWeakHover']};
159
+
160
+ }
161
+ `;
162
+ }, ";");
163
+ const StyledGhostButton = /*#__PURE__*/_styled('button', {
164
+ shouldForwardProp: prop => !['size', 'sentiment', 'iconPosition', 'fullWidth', 'iconOnly'].includes(prop),
165
+ target: "e112qvla0"
166
+ })(args => coreStyle(args), " background:none;border:none;color:", _ref8 => {
167
+ let {
168
+ theme,
169
+ sentiment
170
+ } = _ref8;
171
+ return theme.colors[sentiment][sentiment === 'neutral' ? 'text' : 'textWeak'];
172
+ }, ";", _ref9 => {
173
+ let {
174
+ theme,
175
+ sentiment,
176
+ disabled
177
+ } = _ref9;
178
+ return disabled ? `
179
+ color:
180
+ ${theme.colors[sentiment][sentiment === 'neutral' ? 'textDisabled' : 'textWeakDisabled']};
181
+ ` : `
182
+ &:hover, &:active
183
+ {
184
+ background: ${theme.colors[sentiment].backgroundWeakHover};
185
+ color:
186
+ ${theme.colors[sentiment][sentiment === 'neutral' ? 'textHover' : 'textWeakHover']};
187
+ }
188
+ `;
189
+ }, ";");
190
+ const VARIANTS_COMPONENTS = {
191
+ filled: {
192
+ button: StyledFilledButton,
193
+ link: /*#__PURE__*/StyledFilledButton.withComponent('a', {
194
+ target: "e112qvla3"
195
+ })
196
+ },
197
+ outlined: {
198
+ button: StyledOutlinedButton,
199
+ link: /*#__PURE__*/StyledOutlinedButton.withComponent('a', {
200
+ target: "e112qvla4"
201
+ })
202
+ },
203
+ ghost: {
204
+ button: StyledGhostButton,
205
+ link: /*#__PURE__*/StyledGhostButton.withComponent('a', {
206
+ target: "e112qvla5"
207
+ })
208
+ }
209
+ };
210
+
211
+ // @note: using XOR utility was generating some lint erros
212
+
213
+ const Button = /*#__PURE__*/forwardRef((_ref10, ref) => {
214
+ let {
215
+ type = 'button',
216
+ className,
217
+ 'data-testid': dataTestId,
218
+ sentiment = 'primary',
219
+ variant = 'filled',
220
+ size = 'large',
221
+ disabled = false,
222
+ icon,
223
+ iconPosition = 'left',
224
+ fullWidth = false,
225
+ isLoading = false,
226
+ children,
227
+ onClick,
228
+ name,
229
+ 'aria-label': ariaLabel,
230
+ 'aria-current': ariaCurrent,
231
+ href,
232
+ download,
233
+ target,
234
+ role,
235
+ tooltip
236
+ } = _ref10;
237
+ const computeIsDisabled = disabled || isLoading;
238
+ const content = jsxs(Fragment, {
239
+ children: [!isLoading && icon ? jsx(Icon, {
240
+ name: icon,
241
+ size: 16
242
+ }) : null, isLoading ? jsx(Loader, {
243
+ active: true,
244
+ trailColor: "transparent",
245
+ size: "1em",
246
+ color: "currentColor"
247
+ }) : null, children && typeof children !== 'string' ? jsx("div", {
248
+ children: children
249
+ }) : children]
250
+ });
251
+
252
+ // @note: an anchor can't be disabled
253
+ if (href && !computeIsDisabled) {
254
+ const Component = VARIANTS_COMPONENTS[variant].link;
255
+ return jsx(Tooltip, {
256
+ text: tooltip,
257
+ children: jsx(Component, {
258
+ role: role,
259
+ className: className,
260
+ "data-testid": dataTestId,
261
+ disabled: false,
262
+ fullWidth: fullWidth,
263
+ iconPosition: iconPosition,
264
+ sentiment: sentiment,
265
+ size: size,
266
+ type: type,
267
+ onClick: onClick,
268
+ "aria-label": ariaLabel,
269
+ "aria-current": ariaCurrent,
270
+ href: href,
271
+ target: target,
272
+ download: download,
273
+ ref: ref,
274
+ iconOnly: !!icon && !children,
275
+ children: content
276
+ })
277
+ });
278
+ }
279
+ const Component = VARIANTS_COMPONENTS[variant].button;
280
+ return jsx(Tooltip, {
281
+ text: tooltip,
282
+ children: jsx(Component, {
283
+ role: role,
284
+ className: className,
285
+ "data-testid": dataTestId,
286
+ disabled: computeIsDisabled,
287
+ fullWidth: fullWidth,
288
+ iconPosition: iconPosition,
289
+ sentiment: sentiment,
290
+ size: size,
291
+ type: type,
292
+ onClick: onClick,
293
+ ref: ref,
294
+ name: name,
295
+ "aria-label": ariaLabel,
296
+ "aria-current": ariaCurrent,
297
+ iconOnly: !!icon && !children,
298
+ children: content
299
+ })
300
+ });
301
+ });
302
+
303
+ export { Button };
@@ -0,0 +1,81 @@
1
+ import _styled from '@emotion/styled/base';
2
+ import { forwardRef } from 'react';
3
+ import { Stack } from '../Stack/index.js';
4
+ import { Text } from '../Text/index.js';
5
+ import { jsxs, jsx } from '@emotion/react/jsx-runtime';
6
+
7
+ function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
8
+ const StyledStack = /*#__PURE__*/_styled(Stack, {
9
+ target: "exwxj841"
10
+ })(process.env.NODE_ENV === "production" ? {
11
+ name: "1b3njxj",
12
+ styles: "&[data-disabled='true']{cursor:not-allowed;}"
13
+ } : {
14
+ name: "1b3njxj",
15
+ styles: "&[data-disabled='true']{cursor:not-allowed;}",
16
+ toString: _EMOTION_STRINGIFIED_CSS_ERROR__
17
+ });
18
+ const BorderedBox = /*#__PURE__*/_styled("div", {
19
+ target: "exwxj840"
20
+ })("border:1px solid ", _ref => {
21
+ let {
22
+ theme
23
+ } = _ref;
24
+ return theme.colors.neutral.border;
25
+ }, ";border-radius:", _ref2 => {
26
+ let {
27
+ theme
28
+ } = _ref2;
29
+ return theme.radii.default;
30
+ }, ";padding:", _ref3 => {
31
+ let {
32
+ theme
33
+ } = _ref3;
34
+ return theme.space['3'];
35
+ }, ";&[data-is-active='true']{border:1px solid ", _ref4 => {
36
+ let {
37
+ theme
38
+ } = _ref4;
39
+ return theme.colors.primary.border;
40
+ }, ";}&[data-disabled='true']{border:1px solid ", _ref5 => {
41
+ let {
42
+ theme
43
+ } = _ref5;
44
+ return theme.colors.neutral.borderDisabled;
45
+ }, ";}");
46
+ const Card = /*#__PURE__*/forwardRef((_ref6, ref) => {
47
+ let {
48
+ header,
49
+ disabled = false,
50
+ isActive = false,
51
+ children,
52
+ className,
53
+ 'data-testid': dataTestId
54
+ } = _ref6;
55
+ return header ? jsxs(StyledStack, {
56
+ gap: 1,
57
+ className: className,
58
+ "data-testid": dataTestId,
59
+ "data-disabled": disabled,
60
+ ref: ref,
61
+ children: [typeof header === 'string' ? jsx(Text, {
62
+ variant: "heading",
63
+ as: "h2",
64
+ disabled: disabled,
65
+ children: header
66
+ }) : header, jsx(BorderedBox, {
67
+ "data-is-active": isActive,
68
+ "data-disabled": disabled,
69
+ children: children
70
+ })]
71
+ }) : jsx(BorderedBox, {
72
+ "data-is-active": isActive,
73
+ "data-disabled": disabled,
74
+ className: className,
75
+ "data-testid": dataTestId,
76
+ ref: ref,
77
+ children: children
78
+ });
79
+ });
80
+
81
+ export { Card };
@@ -0,0 +1,162 @@
1
+ import _styled from '@emotion/styled/base';
2
+ import { useRef, useEffect, useState } from 'react';
3
+ import { jsxs, jsx } from '@emotion/react/jsx-runtime';
4
+
5
+ function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
6
+ const StyledWrapper = /*#__PURE__*/_styled("div", {
7
+ target: "e1id70w04"
8
+ })(process.env.NODE_ENV === "production" ? {
9
+ name: "1239432",
10
+ styles: "position:relative;margin-left:-100px;margin-right:-100px"
11
+ } : {
12
+ name: "1239432",
13
+ styles: "position:relative;margin-left:-100px;margin-right:-100px",
14
+ toString: _EMOTION_STRINGIFIED_CSS_ERROR__
15
+ });
16
+ const StyledBeforeScroll = /*#__PURE__*/_styled("span", {
17
+ target: "e1id70w03"
18
+ })("position:absolute;width:100px;height:100%;content:'';background:linear-gradient(\n -90deg,\n rgba(255, 255, 255, 0),\n ", _ref => {
19
+ let {
20
+ theme
21
+ } = _ref;
22
+ return theme.colors.neutral.backgroundWeak;
23
+ }, "\n );cursor:w-resize;z-index:auto;");
24
+ const StyledScrollableWrapper = /*#__PURE__*/_styled("div", {
25
+ target: "e1id70w02"
26
+ })(process.env.NODE_ENV === "production" ? {
27
+ name: "1td2787",
28
+ styles: "overflow-x:scroll;overflow-y:hidden;white-space:nowrap;padding-left:100px;padding-right:100px;padding-bottom:16px;>*:not(:last-child){margin-right:16px;}"
29
+ } : {
30
+ name: "1td2787",
31
+ styles: "overflow-x:scroll;overflow-y:hidden;white-space:nowrap;padding-left:100px;padding-right:100px;padding-bottom:16px;>*:not(:last-child){margin-right:16px;}",
32
+ toString: _EMOTION_STRINGIFIED_CSS_ERROR__
33
+ });
34
+ const StyledAfterScroll = /*#__PURE__*/_styled("span", {
35
+ target: "e1id70w01"
36
+ })("position:absolute;bottom:0;right:0;width:100px;height:100%;content:'';cursor:e-resize;z-index:auto;background:linear-gradient(\n -90deg,\n ", _ref2 => {
37
+ let {
38
+ theme
39
+ } = _ref2;
40
+ return theme.colors.neutral.backgroundWeak;
41
+ }, ",\n rgba(255, 255, 255, 0)\n );");
42
+ const StyledBorderWrapper = /*#__PURE__*/_styled("div", {
43
+ target: "e1id70w00"
44
+ })("display:inline-block;border-radius:", _ref3 => {
45
+ let {
46
+ theme
47
+ } = _ref3;
48
+ return theme.radii.default;
49
+ }, ";border:1px solid ", _ref4 => {
50
+ let {
51
+ theme
52
+ } = _ref4;
53
+ return theme.colors.neutral.borderWeak;
54
+ }, ";height:261px;width:248px;max-width:240px;overflow-wrap:break-word;white-space:normal;cursor:grab;&:hover,&:active,&:focus{border:1px solid ", _ref5 => {
55
+ let {
56
+ theme
57
+ } = _ref5;
58
+ return theme.colors.primary.border;
59
+ }, ";transition:box-shadow 0.2s ease;box-shadow:", _ref6 => {
60
+ let {
61
+ theme
62
+ } = _ref6;
63
+ return theme.shadows.focusPrimary;
64
+ }, ";}img{border-radius:", _ref7 => {
65
+ let {
66
+ theme
67
+ } = _ref7;
68
+ return theme.radii.default;
69
+ }, " ", _ref8 => {
70
+ let {
71
+ theme
72
+ } = _ref8;
73
+ return theme.radii.default;
74
+ }, " 0 0;}");
75
+ const CarouselItem = _ref9 => {
76
+ let {
77
+ children
78
+ } = _ref9;
79
+ return jsx(StyledBorderWrapper, {
80
+ draggable: "true",
81
+ children: children
82
+ });
83
+ };
84
+ const Carousel = _ref10 => {
85
+ let {
86
+ children,
87
+ className,
88
+ 'data-testid': dataTestId = 'scrollbar'
89
+ } = _ref10;
90
+ const scrollRef = useRef(null);
91
+ let intervalLeft;
92
+ let intervalRight;
93
+ const handleScrollRight = () => {
94
+ intervalRight = setInterval(() => {
95
+ if (scrollRef.current?.scrollTo && scrollRef.current?.scrollLeft) {
96
+ scrollRef.current.scrollTo?.(scrollRef.current.scrollLeft - 25, 0);
97
+ }
98
+ }, 30);
99
+ };
100
+ const handleScrollLeft = () => {
101
+ intervalLeft = setInterval(() => {
102
+ if (scrollRef.current?.scrollTo && scrollRef.current?.scrollLeft) {
103
+ scrollRef.current.scrollTo(scrollRef.current.scrollLeft + 25, 0);
104
+ }
105
+ }, 30);
106
+ };
107
+ const handleScrollX = function (scrollX) {
108
+ if (scrollX === void 0) {
109
+ scrollX = 25;
110
+ }
111
+ if (scrollRef.current?.scrollTo && scrollRef.current?.scrollLeft) {
112
+ scrollRef.current.scrollTo?.(scrollRef.current.scrollLeft + scrollX, 0);
113
+ }
114
+ };
115
+ const cleanUp = () => {
116
+ clearInterval(intervalLeft);
117
+ clearInterval(intervalRight);
118
+ };
119
+ useEffect(() => cleanUp);
120
+ const [dragStartX, setDragStartX] = useState(0);
121
+ const [deltaX, setDeltaX] = useState(0);
122
+ return jsxs(StyledWrapper, {
123
+ className: className,
124
+ "data-testid": dataTestId,
125
+ children: [jsx(StyledBeforeScroll, {
126
+ "data-testid": `${dataTestId}-before`,
127
+ onMouseOver: handleScrollRight,
128
+ onMouseLeave: () => clearInterval(intervalRight)
129
+ }), jsx(StyledScrollableWrapper, {
130
+ ref: scrollRef,
131
+ onDragOver: e => {
132
+ setDeltaX(dragStartX - e.pageX);
133
+ setDragStartX(e.pageX);
134
+ },
135
+ onDragStart: e => {
136
+ const blankImg = new Image();
137
+ blankImg.src = 'data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==';
138
+ e.dataTransfer.setDragImage(blankImg, 0, 0);
139
+ setDragStartX(e.clientX);
140
+ },
141
+ onDrag: () => handleScrollX(deltaX),
142
+ onDragEnd: () => {
143
+ setDeltaX(0);
144
+ setDragStartX(0);
145
+ },
146
+ onMouseUp: e => {
147
+ e.preventDefault();
148
+ e.stopPropagation();
149
+ },
150
+ className: className,
151
+ "data-testid": `${dataTestId}-wrapper`,
152
+ children: children
153
+ }), jsx(StyledAfterScroll, {
154
+ "data-testid": `${dataTestId}-after`,
155
+ onMouseOver: handleScrollLeft,
156
+ onMouseLeave: () => clearInterval(intervalLeft)
157
+ })]
158
+ });
159
+ };
160
+ Carousel.Item = CarouselItem;
161
+
162
+ export { Carousel, CarouselItem };