@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.
- package/LICENSE +189 -0
- package/README.md +64 -0
- package/dist/index.d.ts +2427 -0
- package/dist/react-datepicker/dist/react-datepicker.min.css.js +3 -0
- package/dist/react-toastify/dist/ReactToastify.min.css.js +3 -0
- package/dist/src/components/ActionBar/index.js +55 -0
- package/dist/src/components/Alert/index.js +144 -0
- package/dist/src/components/Avatar/index.js +90 -0
- package/dist/src/components/Badge/index.js +143 -0
- package/dist/src/components/Banner/index.js +117 -0
- package/dist/src/components/BarChart/Tooltip.js +63 -0
- package/dist/src/components/BarChart/index.js +94 -0
- package/dist/src/components/BarStack/index.js +223 -0
- package/dist/src/components/Breadcrumbs/index.js +89 -0
- package/dist/src/components/Bullet/index.js +137 -0
- package/dist/src/components/Button/index.js +303 -0
- package/dist/src/components/Card/index.js +81 -0
- package/dist/src/components/Carousel/index.js +162 -0
- package/dist/src/components/Checkbox/index.js +338 -0
- package/dist/src/components/CopyButton/index.js +92 -0
- package/dist/src/components/DateInput/index.js +250 -0
- package/dist/src/components/EmptyState/index.js +124 -0
- package/dist/src/components/Expandable/index.js +84 -0
- package/dist/src/components/Icon/index.js +350 -0
- package/dist/src/components/LineChart/CustomLegend.js +147 -0
- package/dist/src/components/LineChart/Tooltip.js +58 -0
- package/dist/src/components/LineChart/helpers.js +75 -0
- package/dist/src/components/LineChart/index.js +139 -0
- package/dist/src/components/Link/index.js +159 -0
- package/dist/src/components/List/Body.js +22 -0
- package/dist/src/components/List/Cell.js +38 -0
- package/dist/src/components/List/HeaderCell.js +118 -0
- package/dist/src/components/List/HeaderRow.js +47 -0
- package/dist/src/components/List/ListContext.js +120 -0
- package/dist/src/components/List/Row.js +211 -0
- package/dist/src/components/List/SelectBar.js +52 -0
- package/dist/src/components/List/SkeletonRows.js +54 -0
- package/dist/src/components/List/constants.js +3 -0
- package/dist/src/components/List/index.js +77 -0
- package/dist/src/components/Loader/index.js +87 -0
- package/dist/src/components/Menu/Item.js +122 -0
- package/dist/src/components/Menu/index.js +143 -0
- package/dist/src/components/Modal/index.js +279 -0
- package/dist/src/components/Notice/index.js +33 -0
- package/dist/src/components/NumberInput/helpers.js +6 -0
- package/dist/src/components/NumberInput/index.js +366 -0
- package/dist/src/components/Pagination/getPageNumbers.js +32 -0
- package/dist/src/components/Pagination/index.js +118 -0
- package/dist/src/components/PasswordCheck/index.js +42 -0
- package/dist/src/components/PasswordStrengthMeter/index.js +116 -0
- package/dist/src/components/PieChart/Legends.js +183 -0
- package/dist/src/components/PieChart/Tooltip.js +64 -0
- package/dist/src/components/PieChart/index.js +133 -0
- package/dist/src/components/PieChart/patterns.js +9 -0
- package/dist/src/components/Popover/index.js +131 -0
- package/dist/src/components/ProgressBar/index.js +72 -0
- package/dist/src/components/Radio/index.js +231 -0
- package/dist/src/components/Row/index.js +43 -0
- package/dist/src/components/SelectInput/index.js +662 -0
- package/dist/src/components/SelectableCard/index.js +154 -0
- package/dist/src/components/Separator/index.js +91 -0
- package/dist/src/components/Skeleton/Block.js +53 -0
- package/dist/src/components/Skeleton/Blocks.js +52 -0
- package/dist/src/components/Skeleton/BoxWithIcon.js +47 -0
- package/dist/src/components/Skeleton/Donut.js +58 -0
- package/dist/src/components/Skeleton/IconSkeleton.js +37 -0
- package/dist/src/components/Skeleton/Line.js +19 -0
- package/dist/src/components/Skeleton/List.js +60 -0
- package/dist/src/components/Skeleton/Slider.js +57 -0
- package/dist/src/components/Skeleton/index.js +85 -0
- package/dist/src/components/Snippet/index.js +250 -0
- package/dist/src/components/Stack/index.js +24 -0
- package/dist/src/components/Status/index.js +101 -0
- package/dist/src/components/StepList/index.js +81 -0
- package/dist/src/components/Stepper/index.js +217 -0
- package/dist/src/components/SwitchButton/FocusOverlay.js +47 -0
- package/dist/src/components/SwitchButton/index.js +131 -0
- package/dist/src/components/Table/Body.js +12 -0
- package/dist/src/components/Table/Cell.js +27 -0
- package/dist/src/components/Table/Header.js +21 -0
- package/dist/src/components/Table/HeaderCell.js +119 -0
- package/dist/src/components/Table/HeaderRow.js +35 -0
- package/dist/src/components/Table/Row.js +70 -0
- package/dist/src/components/Table/SelectBar.js +52 -0
- package/dist/src/components/Table/SkeletonRows.js +52 -0
- package/dist/src/components/Table/TableContext.js +91 -0
- package/dist/src/components/Table/index.js +84 -0
- package/dist/src/components/Tabs/Tab.js +165 -0
- package/dist/src/components/Tabs/TabMenu.js +46 -0
- package/dist/src/components/Tabs/TabMenuItem.js +40 -0
- package/dist/src/components/Tabs/TabsContext.js +6 -0
- package/dist/src/components/Tabs/index.js +117 -0
- package/dist/src/components/Tag/index.js +177 -0
- package/dist/src/components/TagInput/index.js +277 -0
- package/dist/src/components/TagList/index.js +110 -0
- package/dist/src/components/Text/index.js +106 -0
- package/dist/src/components/TextInput/index.js +529 -0
- package/dist/src/components/TimeInput/index.js +38 -0
- package/dist/src/components/Toaster/index.js +116 -0
- package/dist/src/components/Toggle/index.js +192 -0
- package/dist/src/components/Tooltip/helpers.js +131 -0
- package/dist/src/components/Tooltip/index.js +275 -0
- package/dist/src/components/VerificationCode/index.js +203 -0
- package/dist/src/helpers/isJSON.js +11 -0
- package/dist/src/helpers/legend.js +13 -0
- package/dist/src/helpers/recursivelyGetChildrenString.js +12 -0
- package/dist/src/index.js +63 -0
- package/dist/src/theme/index.js +25 -0
- package/dist/src/utils/animations.js +250 -0
- package/dist/src/utils/capitalize.js +4 -0
- package/dist/src/utils/ids.js +12 -0
- package/dist/src/utils/normalize.js +36 -0
- package/dist/src/utils/responsive/Breakpoint.js +12 -0
- package/dist/src/utils/responsive/utilities.js +12 -0
- package/package.json +70 -0
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
import _styled from '@emotion/styled/base';
|
|
2
|
+
import { useId, useState, createRef } from 'react';
|
|
3
|
+
import { jsx } from '@emotion/react/jsx-runtime';
|
|
4
|
+
|
|
5
|
+
const StyledInput = /*#__PURE__*/_styled("input", {
|
|
6
|
+
target: "e1a2bx9q0"
|
|
7
|
+
})("background:", _ref => {
|
|
8
|
+
let {
|
|
9
|
+
theme
|
|
10
|
+
} = _ref;
|
|
11
|
+
return theme.colors.neutral.backgroundWeak;
|
|
12
|
+
}, ";border:solid 1px ", _ref2 => {
|
|
13
|
+
let {
|
|
14
|
+
'aria-invalid': error,
|
|
15
|
+
theme
|
|
16
|
+
} = _ref2;
|
|
17
|
+
return error ? theme.colors.danger.borderWeak : theme.colors.neutral.borderWeak;
|
|
18
|
+
}, ";font-size:24px;color:", _ref3 => {
|
|
19
|
+
let {
|
|
20
|
+
'aria-invalid': error,
|
|
21
|
+
theme
|
|
22
|
+
} = _ref3;
|
|
23
|
+
return error ? theme.colors.danger.textWeak : theme.colors.neutral.text;
|
|
24
|
+
}, ";text-align:center;border-radius:", _ref4 => {
|
|
25
|
+
let {
|
|
26
|
+
theme
|
|
27
|
+
} = _ref4;
|
|
28
|
+
return theme.radii.default;
|
|
29
|
+
}, ";margin-right:", _ref5 => {
|
|
30
|
+
let {
|
|
31
|
+
theme
|
|
32
|
+
} = _ref5;
|
|
33
|
+
return theme.space['1'];
|
|
34
|
+
}, ";width:56px;height:64px;outline-style:none;transition:border-color 0.2s ease,box-shadow 0.2s ease;&:hover,&:focus{border-color:", _ref6 => {
|
|
35
|
+
let {
|
|
36
|
+
'aria-invalid': error,
|
|
37
|
+
theme
|
|
38
|
+
} = _ref6;
|
|
39
|
+
return error ? theme.colors.danger.borderWeakHover : theme.colors.primary.borderWeakHover;
|
|
40
|
+
}, ";}&:focus{box-shadow:", _ref7 => {
|
|
41
|
+
let {
|
|
42
|
+
'aria-invalid': error,
|
|
43
|
+
theme: {
|
|
44
|
+
shadows
|
|
45
|
+
}
|
|
46
|
+
} = _ref7;
|
|
47
|
+
return error ? shadows.focusDanger : shadows.focusPrimary;
|
|
48
|
+
}, ";}&:last-child{margin-right:0;}&::placeholder{color:", _ref8 => {
|
|
49
|
+
let {
|
|
50
|
+
theme
|
|
51
|
+
} = _ref8;
|
|
52
|
+
return theme.colors.neutral.textWeak;
|
|
53
|
+
}, ";}");
|
|
54
|
+
const KEY_CODE = {
|
|
55
|
+
backspace: 8,
|
|
56
|
+
down: 40,
|
|
57
|
+
left: 37,
|
|
58
|
+
right: 39,
|
|
59
|
+
up: 38
|
|
60
|
+
};
|
|
61
|
+
const DEFAULT_ON_FUNCTION = () => {};
|
|
62
|
+
const VerificationCode = _ref9 => {
|
|
63
|
+
let {
|
|
64
|
+
disabled = false,
|
|
65
|
+
className,
|
|
66
|
+
error = false,
|
|
67
|
+
fields = 4,
|
|
68
|
+
initialValue = '',
|
|
69
|
+
inputId,
|
|
70
|
+
inputStyle = '',
|
|
71
|
+
onChange = DEFAULT_ON_FUNCTION,
|
|
72
|
+
onComplete = DEFAULT_ON_FUNCTION,
|
|
73
|
+
placeholder = '',
|
|
74
|
+
required = false,
|
|
75
|
+
type = 'number',
|
|
76
|
+
'data-testid': dataTestId,
|
|
77
|
+
'aria-label': ariaLabel = 'Verification code'
|
|
78
|
+
} = _ref9;
|
|
79
|
+
const uniqueId = useId();
|
|
80
|
+
const valuesArray = Object.assign(new Array(fields).fill(''), initialValue.substring(0, fields).split(''));
|
|
81
|
+
const [values, setValues] = useState(valuesArray);
|
|
82
|
+
const inputRefs = Array.from({
|
|
83
|
+
length: fields
|
|
84
|
+
}, () => /*#__PURE__*/createRef());
|
|
85
|
+
const triggerChange = inputValues => {
|
|
86
|
+
const stringValue = inputValues.join('');
|
|
87
|
+
if (onChange) {
|
|
88
|
+
onChange(stringValue);
|
|
89
|
+
}
|
|
90
|
+
if (onComplete && stringValue.length >= fields) {
|
|
91
|
+
onComplete(stringValue);
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
const inputOnChange = index => event => {
|
|
95
|
+
let {
|
|
96
|
+
value
|
|
97
|
+
} = event.target;
|
|
98
|
+
if (type === 'number') {
|
|
99
|
+
value = event.target.value.replace(/[^\d]/gi, '');
|
|
100
|
+
}
|
|
101
|
+
const newValues = [...values];
|
|
102
|
+
if (value === '' || type === 'number' && !new RegExp(event.target.pattern).test(value)) {
|
|
103
|
+
newValues[index] = '';
|
|
104
|
+
setValues(newValues);
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
const sanitizedValue = value[0]; // in case more than 1 char, we just take the first one
|
|
108
|
+
newValues[index] = sanitizedValue;
|
|
109
|
+
setValues(newValues);
|
|
110
|
+
const nextIndex = Math.min(index + 1, fields - 1);
|
|
111
|
+
const next = inputRefs[nextIndex];
|
|
112
|
+
next?.current?.focus();
|
|
113
|
+
triggerChange(newValues);
|
|
114
|
+
};
|
|
115
|
+
const inputOnKeyDown = index => event => {
|
|
116
|
+
const prevIndex = index - 1;
|
|
117
|
+
const nextIndex = index + 1;
|
|
118
|
+
const first = inputRefs[0];
|
|
119
|
+
const last = inputRefs[inputRefs.length - 1];
|
|
120
|
+
const prev = inputRefs[prevIndex];
|
|
121
|
+
const next = inputRefs[nextIndex];
|
|
122
|
+
const vals = [...values];
|
|
123
|
+
switch (event.keyCode) {
|
|
124
|
+
case KEY_CODE.backspace:
|
|
125
|
+
event.preventDefault();
|
|
126
|
+
if (values[index]) {
|
|
127
|
+
vals[index] = '';
|
|
128
|
+
setValues(vals);
|
|
129
|
+
triggerChange(vals);
|
|
130
|
+
} else if (prev) {
|
|
131
|
+
vals[prevIndex] = '';
|
|
132
|
+
prev?.current?.focus();
|
|
133
|
+
setValues(vals);
|
|
134
|
+
triggerChange(vals);
|
|
135
|
+
}
|
|
136
|
+
break;
|
|
137
|
+
case KEY_CODE.left:
|
|
138
|
+
event.preventDefault();
|
|
139
|
+
prev?.current?.focus();
|
|
140
|
+
break;
|
|
141
|
+
case KEY_CODE.right:
|
|
142
|
+
event.preventDefault();
|
|
143
|
+
next?.current?.focus();
|
|
144
|
+
break;
|
|
145
|
+
case KEY_CODE.up:
|
|
146
|
+
event.preventDefault();
|
|
147
|
+
first?.current?.focus();
|
|
148
|
+
break;
|
|
149
|
+
case KEY_CODE.down:
|
|
150
|
+
event.preventDefault();
|
|
151
|
+
last?.current?.focus();
|
|
152
|
+
break;
|
|
153
|
+
}
|
|
154
|
+
};
|
|
155
|
+
const inputOnFocus = event => event.target.select();
|
|
156
|
+
const inputOnPaste = currentIndex => event => {
|
|
157
|
+
event.preventDefault();
|
|
158
|
+
const pastedValue = [...event.clipboardData.getData('Text').split('')].map(copiedValue =>
|
|
159
|
+
// Replace non number char with empty char when type is number
|
|
160
|
+
type === 'number' ? copiedValue.replace(/[^\d]/gi, '') : copiedValue);
|
|
161
|
+
|
|
162
|
+
// Trim array to avoid array overflow
|
|
163
|
+
pastedValue.splice(fields - currentIndex < pastedValue.length ? fields - currentIndex : pastedValue.length);
|
|
164
|
+
setValues(vals => {
|
|
165
|
+
const newArray = vals.slice();
|
|
166
|
+
newArray.splice(currentIndex, pastedValue.length, ...pastedValue);
|
|
167
|
+
return newArray;
|
|
168
|
+
});
|
|
169
|
+
|
|
170
|
+
// we select min value between the end of inputs and valid pasted chars
|
|
171
|
+
const nextIndex = Math.min(currentIndex + pastedValue.filter(item => item !== '').length, inputRefs.length - 1);
|
|
172
|
+
const next = inputRefs[nextIndex];
|
|
173
|
+
next?.current?.focus();
|
|
174
|
+
triggerChange(pastedValue);
|
|
175
|
+
};
|
|
176
|
+
return jsx("div", {
|
|
177
|
+
className: className,
|
|
178
|
+
"data-testid": dataTestId,
|
|
179
|
+
children: values.map((value, index) => jsx(StyledInput, {
|
|
180
|
+
css: [inputStyle],
|
|
181
|
+
"aria-invalid": error,
|
|
182
|
+
type: type === 'number' ? 'tel' : type,
|
|
183
|
+
pattern: type === 'number' ? '[0-9]*' : undefined
|
|
184
|
+
// eslint-disable-next-line react/no-array-index-key
|
|
185
|
+
,
|
|
186
|
+
|
|
187
|
+
"data-testid": index,
|
|
188
|
+
value: value,
|
|
189
|
+
id: `${inputId || uniqueId}-${index}`,
|
|
190
|
+
ref: inputRefs[index],
|
|
191
|
+
onChange: inputOnChange(index),
|
|
192
|
+
onKeyDown: inputOnKeyDown(index),
|
|
193
|
+
onPaste: inputOnPaste(index),
|
|
194
|
+
onFocus: inputOnFocus,
|
|
195
|
+
disabled: disabled,
|
|
196
|
+
required: required,
|
|
197
|
+
placeholder: placeholder?.[index] ?? '',
|
|
198
|
+
"aria-label": `${ariaLabel} ${index}`
|
|
199
|
+
}, index))
|
|
200
|
+
});
|
|
201
|
+
};
|
|
202
|
+
|
|
203
|
+
export { VerificationCode };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
const getLegendColor = theme => {
|
|
2
|
+
const {
|
|
3
|
+
colors
|
|
4
|
+
} = theme;
|
|
5
|
+
return Object.keys(colors.other.data.charts).filter(key => !['success', 'danger'].includes(key)).sort((a, b) => {
|
|
6
|
+
if (Number(a.replace('data', '')) < Number(b.replace('data', ''))) {
|
|
7
|
+
return -1;
|
|
8
|
+
}
|
|
9
|
+
return 1;
|
|
10
|
+
}).map(key => colors.other.data.charts[key]);
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export { getLegendColor };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
const recursivelyGetChildrenString = children => {
|
|
2
|
+
if (typeof children === 'string') return children;
|
|
3
|
+
if (Array.isArray(children)) return ''; // We can't determine which string to display in tooltip
|
|
4
|
+
if (typeof children === 'object') {
|
|
5
|
+
const childProps = children?.['props']?.['children'];
|
|
6
|
+
if (childProps) return recursivelyGetChildrenString(childProps);
|
|
7
|
+
}
|
|
8
|
+
return '';
|
|
9
|
+
};
|
|
10
|
+
var recursivelyGetChildrenString$1 = recursivelyGetChildrenString;
|
|
11
|
+
|
|
12
|
+
export { recursivelyGetChildrenString$1 as default };
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
export { extendTheme } from './theme/index.js';
|
|
2
|
+
export { consoleDarkTheme as darkTheme, consoleLightTheme as theme } from '@ultraviolet/themes';
|
|
3
|
+
export { bounce, fadeIn, fadeOut, flash, ping, pulse, quickScaleDown, scaleBack, scaleDown, scaleForward, scaleUp, sketchIn, sketchOut, slideDownLarge, slideFromBottom, slideFromLeft, slideFromRight, slideFromTop, slideToBottom, slideToLeft, slideToRight, slideToTop, slideUpLarge, unfoldIn, unfoldOut, zoomIn, zoomOut } from './utils/animations.js';
|
|
4
|
+
export { default as Breakpoint } from './utils/responsive/Breakpoint.js';
|
|
5
|
+
export { down, up } from './utils/responsive/utilities.js';
|
|
6
|
+
export { getUUID } from './utils/ids.js';
|
|
7
|
+
export { default as normalize } from './utils/normalize.js';
|
|
8
|
+
export { ActionBar } from './components/ActionBar/index.js';
|
|
9
|
+
export { Alert } from './components/Alert/index.js';
|
|
10
|
+
export { Avatar } from './components/Avatar/index.js';
|
|
11
|
+
export { Badge } from './components/Badge/index.js';
|
|
12
|
+
export { BarChart } from './components/BarChart/index.js';
|
|
13
|
+
export { BarStack } from './components/BarStack/index.js';
|
|
14
|
+
export { Breadcrumbs } from './components/Breadcrumbs/index.js';
|
|
15
|
+
export { Banner } from './components/Banner/index.js';
|
|
16
|
+
export { Bullet } from './components/Bullet/index.js';
|
|
17
|
+
export { Checkbox } from './components/Checkbox/index.js';
|
|
18
|
+
export { CopyButton } from './components/CopyButton/index.js';
|
|
19
|
+
export { DateInput } from './components/DateInput/index.js';
|
|
20
|
+
export { Expandable } from './components/Expandable/index.js';
|
|
21
|
+
export { EmptyState } from './components/EmptyState/index.js';
|
|
22
|
+
export { Icon } from './components/Icon/index.js';
|
|
23
|
+
export { LineChart } from './components/LineChart/index.js';
|
|
24
|
+
export { Link } from './components/Link/index.js';
|
|
25
|
+
export { List } from './components/List/index.js';
|
|
26
|
+
export { Loader } from './components/Loader/index.js';
|
|
27
|
+
export { Menu } from './components/Menu/index.js';
|
|
28
|
+
export { Modal } from './components/Modal/index.js';
|
|
29
|
+
export { Notice } from './components/Notice/index.js';
|
|
30
|
+
export { Pagination } from './components/Pagination/index.js';
|
|
31
|
+
export { PasswordCheck } from './components/PasswordCheck/index.js';
|
|
32
|
+
export { PasswordStrengthMeter } from './components/PasswordStrengthMeter/index.js';
|
|
33
|
+
export { PieChart } from './components/PieChart/index.js';
|
|
34
|
+
export { Skeleton } from './components/Skeleton/index.js';
|
|
35
|
+
export { ProgressBar } from './components/ProgressBar/index.js';
|
|
36
|
+
export { Radio } from './components/Radio/index.js';
|
|
37
|
+
export { SelectInput } from './components/SelectInput/index.js';
|
|
38
|
+
export { SelectableCard } from './components/SelectableCard/index.js';
|
|
39
|
+
export { NumberInput } from './components/NumberInput/index.js';
|
|
40
|
+
export { Separator } from './components/Separator/index.js';
|
|
41
|
+
export { Carousel } from './components/Carousel/index.js';
|
|
42
|
+
export { Snippet } from './components/Snippet/index.js';
|
|
43
|
+
export { Stack } from './components/Stack/index.js';
|
|
44
|
+
export { Status } from './components/Status/index.js';
|
|
45
|
+
export { StepList } from './components/StepList/index.js';
|
|
46
|
+
export { Stepper } from './components/Stepper/index.js';
|
|
47
|
+
export { SwitchButton } from './components/SwitchButton/index.js';
|
|
48
|
+
export { Table } from './components/Table/index.js';
|
|
49
|
+
export { Tabs } from './components/Tabs/index.js';
|
|
50
|
+
export { Tag } from './components/Tag/index.js';
|
|
51
|
+
export { TagInput } from './components/TagInput/index.js';
|
|
52
|
+
export { TagList } from './components/TagList/index.js';
|
|
53
|
+
export { Text } from './components/Text/index.js';
|
|
54
|
+
export { TextInput } from './components/TextInput/index.js';
|
|
55
|
+
export { TimeInput } from './components/TimeInput/index.js';
|
|
56
|
+
export { ToastContainer, toast } from './components/Toaster/index.js';
|
|
57
|
+
export { Toggle } from './components/Toggle/index.js';
|
|
58
|
+
export { Tooltip } from './components/Tooltip/index.js';
|
|
59
|
+
export { VerificationCode } from './components/VerificationCode/index.js';
|
|
60
|
+
export { Row } from './components/Row/index.js';
|
|
61
|
+
export { Button } from './components/Button/index.js';
|
|
62
|
+
export { Card } from './components/Card/index.js';
|
|
63
|
+
export { Popover } from './components/Popover/index.js';
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { consoleLightTheme } from '@ultraviolet/themes';
|
|
2
|
+
export { consoleDarkTheme as darkTheme, consoleLightTheme as default } from '@ultraviolet/themes';
|
|
3
|
+
import deepmerge from 'deepmerge';
|
|
4
|
+
|
|
5
|
+
const {
|
|
6
|
+
colors,
|
|
7
|
+
shadows,
|
|
8
|
+
typography,
|
|
9
|
+
space,
|
|
10
|
+
radii,
|
|
11
|
+
screens
|
|
12
|
+
} = consoleLightTheme;
|
|
13
|
+
/**
|
|
14
|
+
* Will extend theme with new theme properties
|
|
15
|
+
* @param {SCWUITheme} baseTheme the theme you want to extend from, by default it is set to light theme
|
|
16
|
+
* @param {RecursivePartial<SCWUITheme>} extendedTheme the properties of a new theme you want to apply from baseTheme
|
|
17
|
+
*/
|
|
18
|
+
const extendTheme = extendedTheme => deepmerge(consoleLightTheme, extendedTheme);
|
|
19
|
+
|
|
20
|
+
// This type exclude overlay and secondary color
|
|
21
|
+
|
|
22
|
+
const SENTIMENTS = ['primary', 'neutral', 'success', 'danger', 'warning', 'info'];
|
|
23
|
+
const SENTIMENTS_WITHOUT_NEUTRAL = /*#__PURE__*/SENTIMENTS.filter(sentiment => sentiment !== 'neutral');
|
|
24
|
+
|
|
25
|
+
export { SENTIMENTS, SENTIMENTS_WITHOUT_NEUTRAL, colors, extendTheme, radii, screens, shadows, space, typography };
|
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
import { keyframes } from '@emotion/react';
|
|
2
|
+
|
|
3
|
+
const bounce = keyframes`
|
|
4
|
+
from, 20%, 53%, 80%, to {
|
|
5
|
+
transform: translate3d(0,0,0);
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
40%, 43% {
|
|
9
|
+
transform: translate3d(0, -30px, 0);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
70% {
|
|
13
|
+
transform: translate3d(0, -15px, 0);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
90% {
|
|
17
|
+
transform: translate3d(0,-4px,0);
|
|
18
|
+
}
|
|
19
|
+
`;
|
|
20
|
+
const ping = keyframes`
|
|
21
|
+
75%, 100% {
|
|
22
|
+
transform: scale(2);
|
|
23
|
+
opacity: 0;
|
|
24
|
+
}
|
|
25
|
+
`;
|
|
26
|
+
const flash = keyframes`
|
|
27
|
+
0% {
|
|
28
|
+
opacity: 1;
|
|
29
|
+
}
|
|
30
|
+
50% {
|
|
31
|
+
opacity: 0.1;
|
|
32
|
+
}
|
|
33
|
+
100% {
|
|
34
|
+
opacity: 1;
|
|
35
|
+
}
|
|
36
|
+
`;
|
|
37
|
+
const zoomIn = keyframes`
|
|
38
|
+
0% {
|
|
39
|
+
transform: scale(0);
|
|
40
|
+
}
|
|
41
|
+
100% {
|
|
42
|
+
transform: scale(1);
|
|
43
|
+
}
|
|
44
|
+
`;
|
|
45
|
+
const zoomOut = keyframes`
|
|
46
|
+
0% {
|
|
47
|
+
transform: scale(1);
|
|
48
|
+
}
|
|
49
|
+
100% {
|
|
50
|
+
transform: scale(0);
|
|
51
|
+
}
|
|
52
|
+
`;
|
|
53
|
+
const unfoldIn = keyframes`
|
|
54
|
+
0% {
|
|
55
|
+
transform:scaleY(.005) scaleX(0);
|
|
56
|
+
}
|
|
57
|
+
50% {
|
|
58
|
+
transform:scaleY(.005) scaleX(1);
|
|
59
|
+
}
|
|
60
|
+
100% {
|
|
61
|
+
transform:scaleY(1) scaleX(1);
|
|
62
|
+
}
|
|
63
|
+
`;
|
|
64
|
+
const unfoldOut = keyframes`
|
|
65
|
+
0% {
|
|
66
|
+
transform:scaleY(1) scaleX(1);
|
|
67
|
+
}
|
|
68
|
+
50% {
|
|
69
|
+
transform:scaleY(.005) scaleX(1);
|
|
70
|
+
}
|
|
71
|
+
100% {
|
|
72
|
+
transform:scaleY(.005) scaleX(0);
|
|
73
|
+
}
|
|
74
|
+
`;
|
|
75
|
+
const fadeIn = keyframes`
|
|
76
|
+
0% {
|
|
77
|
+
opacity: 0;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
100% {
|
|
81
|
+
opacity: 1;
|
|
82
|
+
}
|
|
83
|
+
`;
|
|
84
|
+
const fadeOut = keyframes`
|
|
85
|
+
0% {
|
|
86
|
+
background:rgba(0,0,0,.4);
|
|
87
|
+
}
|
|
88
|
+
100% {
|
|
89
|
+
background:rgba(0,0,0,.0);
|
|
90
|
+
}
|
|
91
|
+
`;
|
|
92
|
+
const scaleUp = keyframes`
|
|
93
|
+
0% {
|
|
94
|
+
transform:scale(.8) translateY(1000px);
|
|
95
|
+
opacity:0;
|
|
96
|
+
}
|
|
97
|
+
100% {
|
|
98
|
+
transform:scale(1) translateY(0px);
|
|
99
|
+
opacity:1;
|
|
100
|
+
}
|
|
101
|
+
`;
|
|
102
|
+
const scaleDown = keyframes`
|
|
103
|
+
0% {
|
|
104
|
+
transform:scale(1) translateY(0px);
|
|
105
|
+
opacity:1;
|
|
106
|
+
}
|
|
107
|
+
100% {
|
|
108
|
+
transform:scale(.8) translateY(1000px);
|
|
109
|
+
opacity:0;
|
|
110
|
+
}
|
|
111
|
+
`;
|
|
112
|
+
const quickScaleDown = keyframes`
|
|
113
|
+
0% {
|
|
114
|
+
transform:scale(1);
|
|
115
|
+
}
|
|
116
|
+
99.9% {
|
|
117
|
+
transform:scale(1);
|
|
118
|
+
}
|
|
119
|
+
100% {
|
|
120
|
+
transform:scale(0);
|
|
121
|
+
}
|
|
122
|
+
`;
|
|
123
|
+
const scaleBack = keyframes`
|
|
124
|
+
0% {
|
|
125
|
+
transform:scale(1);
|
|
126
|
+
}
|
|
127
|
+
100% {
|
|
128
|
+
transform:scale(.85);
|
|
129
|
+
}
|
|
130
|
+
`;
|
|
131
|
+
const scaleForward = keyframes`
|
|
132
|
+
0% {
|
|
133
|
+
transform:scale(.85);
|
|
134
|
+
}
|
|
135
|
+
100% {
|
|
136
|
+
transform:scale(1);
|
|
137
|
+
}
|
|
138
|
+
`;
|
|
139
|
+
const sketchIn = keyframes`
|
|
140
|
+
0% {
|
|
141
|
+
stroke-dashoffset: 778;
|
|
142
|
+
}
|
|
143
|
+
100% {
|
|
144
|
+
stroke-dashoffset: 0;
|
|
145
|
+
}
|
|
146
|
+
`;
|
|
147
|
+
const sketchOut = keyframes`
|
|
148
|
+
0% {
|
|
149
|
+
stroke-dashoffset: 0;
|
|
150
|
+
}
|
|
151
|
+
100% {
|
|
152
|
+
stroke-dashoffset: 778;
|
|
153
|
+
}
|
|
154
|
+
`;
|
|
155
|
+
const slideDownLarge = keyframes`
|
|
156
|
+
0% {
|
|
157
|
+
transform:translateY(-100%);
|
|
158
|
+
}
|
|
159
|
+
100% {
|
|
160
|
+
transform:translateY(0%);
|
|
161
|
+
}
|
|
162
|
+
`;
|
|
163
|
+
const slideUpLarge = keyframes`
|
|
164
|
+
0% {
|
|
165
|
+
transform:translateY(0%);
|
|
166
|
+
}
|
|
167
|
+
100% {
|
|
168
|
+
transform:translateY(-100%);
|
|
169
|
+
}
|
|
170
|
+
`;
|
|
171
|
+
const slideFromBottom = keyframes`
|
|
172
|
+
0% {
|
|
173
|
+
transform:translateY(+100%);
|
|
174
|
+
}
|
|
175
|
+
100% {
|
|
176
|
+
transform:translateY(0%);
|
|
177
|
+
}
|
|
178
|
+
`;
|
|
179
|
+
const slideFromTop = keyframes`
|
|
180
|
+
0% {
|
|
181
|
+
transform:translateY(-100%);
|
|
182
|
+
}
|
|
183
|
+
100% {
|
|
184
|
+
transform:translateY(0%);
|
|
185
|
+
}
|
|
186
|
+
`;
|
|
187
|
+
const slideFromRight = keyframes`
|
|
188
|
+
0% {
|
|
189
|
+
transform:translateX(+100%);
|
|
190
|
+
}
|
|
191
|
+
100% {
|
|
192
|
+
transform:translateX(0%);
|
|
193
|
+
}
|
|
194
|
+
`;
|
|
195
|
+
const slideFromLeft = keyframes`
|
|
196
|
+
0% {
|
|
197
|
+
transform:translateX(-100%);
|
|
198
|
+
}
|
|
199
|
+
100% {
|
|
200
|
+
transform:translateX(0%);
|
|
201
|
+
}
|
|
202
|
+
`;
|
|
203
|
+
const slideToBottom = keyframes`
|
|
204
|
+
0% {
|
|
205
|
+
transform:translateY(0%);
|
|
206
|
+
}
|
|
207
|
+
100% {
|
|
208
|
+
transform:translateY(+100%);
|
|
209
|
+
}
|
|
210
|
+
`;
|
|
211
|
+
const slideToTop = keyframes`
|
|
212
|
+
0% {
|
|
213
|
+
transform:translateY(0%);
|
|
214
|
+
}
|
|
215
|
+
100% {
|
|
216
|
+
transform:translateY(-100%);
|
|
217
|
+
}
|
|
218
|
+
`;
|
|
219
|
+
const slideToRight = keyframes`
|
|
220
|
+
0% {
|
|
221
|
+
transform:translateX(0%);
|
|
222
|
+
}
|
|
223
|
+
100% {
|
|
224
|
+
transform:translateX(+100%);
|
|
225
|
+
}
|
|
226
|
+
`;
|
|
227
|
+
const slideToLeft = keyframes`
|
|
228
|
+
0% {
|
|
229
|
+
transform:translateX(0%);
|
|
230
|
+
}
|
|
231
|
+
100% {
|
|
232
|
+
transform:translateX(-100%);
|
|
233
|
+
}
|
|
234
|
+
`;
|
|
235
|
+
const pulse = keyframes`
|
|
236
|
+
0% {
|
|
237
|
+
opacity: 0;
|
|
238
|
+
transform: scale(1);
|
|
239
|
+
}
|
|
240
|
+
50% {
|
|
241
|
+
opacity: 1;
|
|
242
|
+
transform: scale(1.15);
|
|
243
|
+
}
|
|
244
|
+
100% {
|
|
245
|
+
opacity: 1;
|
|
246
|
+
transform: scale(1);
|
|
247
|
+
}
|
|
248
|
+
`;
|
|
249
|
+
|
|
250
|
+
export { bounce, fadeIn, fadeOut, flash, ping, pulse, quickScaleDown, scaleBack, scaleDown, scaleForward, scaleUp, sketchIn, sketchOut, slideDownLarge, slideFromBottom, slideFromLeft, slideFromRight, slideFromTop, slideToBottom, slideToLeft, slideToRight, slideToTop, slideUpLarge, unfoldIn, unfoldOut, zoomIn, zoomOut };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
const chr4 = () => Math.random().toString(16).slice(-4);
|
|
2
|
+
const uuid = () => Array.from({
|
|
3
|
+
length: 8
|
|
4
|
+
}, chr4).join('');
|
|
5
|
+
const getUUID = function (prefix) {
|
|
6
|
+
if (prefix === void 0) {
|
|
7
|
+
prefix = '';
|
|
8
|
+
}
|
|
9
|
+
return `${prefix ? `${prefix}-` : ''}${uuid()}`;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export { getUUID };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
const modernNormalize = `
|
|
2
|
+
/*! modern-normalize v1.1.0 | MIT License | https://github.com/sindresorhus/modern-normalize */
|
|
3
|
+
*,::after,::before{box-sizing:border-box}html{-moz-tab-size:4;tab-size:4}html{line-height:1.15;-webkit-text-size-adjust:100%}body{margin:0}body{font-family:system-ui,-apple-system,'Segoe UI',Roboto,Helvetica,Arial,sans-serif,'Apple Color Emoji','Segoe UI Emoji'}hr{height:0;color:inherit}abbr[title]{text-decoration:underline dotted}b,strong{font-weight:bolder}code,kbd,pre,samp{font-family:ui-monospace,SFMono-Regular,Consolas,'Liberation Mono',Menlo,monospace;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit}button,input,optgroup,select,textarea{font-family:inherit;font-size:100%;line-height:1.15;margin:0}button,select{text-transform:none}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button}::-moz-focus-inner{border-style:none;padding:0}:-moz-focusring{outline:1px dotted ButtonText}:-moz-ui-invalid{box-shadow:none}legend{padding:0}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}
|
|
4
|
+
`;
|
|
5
|
+
const normalize = () => `
|
|
6
|
+
${modernNormalize}
|
|
7
|
+
|
|
8
|
+
html {
|
|
9
|
+
font-size: 16px;
|
|
10
|
+
line-height: 1.5;
|
|
11
|
+
-webkit-tap-highlight-color: transparent;
|
|
12
|
+
margin: 0;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
body {
|
|
16
|
+
text-rendering: optimizeLegibility;
|
|
17
|
+
-webkit-font-smoothing: antialiased;
|
|
18
|
+
-moz-osx-font-smoothing: grayscale;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
img,
|
|
22
|
+
canvas,
|
|
23
|
+
iframe,
|
|
24
|
+
video,
|
|
25
|
+
select,
|
|
26
|
+
textarea {
|
|
27
|
+
max-width: 100%;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
p, h1, h2, h3, h4, h5, h6 {
|
|
31
|
+
margin: 0;
|
|
32
|
+
}
|
|
33
|
+
`;
|
|
34
|
+
var normalize$1 = normalize;
|
|
35
|
+
|
|
36
|
+
export { normalize$1 as default };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import _styled from '@emotion/styled/base';
|
|
2
|
+
import { up, down } from './utilities.js';
|
|
3
|
+
|
|
4
|
+
const Breakpoint = /*#__PURE__*/_styled("div", {
|
|
5
|
+
target: "e1ehbeci0"
|
|
6
|
+
})("display:none;", props => `
|
|
7
|
+
${props.up ? up(props.up, 'display: block;') : ''}
|
|
8
|
+
${props.down ? down(props.down, 'display: block;') : ''}
|
|
9
|
+
`, ";");
|
|
10
|
+
var Breakpoint$1 = Breakpoint;
|
|
11
|
+
|
|
12
|
+
export { Breakpoint$1 as default };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { screens } from '../../theme/index.js';
|
|
2
|
+
|
|
3
|
+
const up = (size, rules) => {
|
|
4
|
+
if (!(size in screens)) return '';
|
|
5
|
+
return `@media (min-width: ${screens[size]}px) { ${rules} }`;
|
|
6
|
+
};
|
|
7
|
+
const down = (size, rules) => {
|
|
8
|
+
if (!(size in screens)) return '';
|
|
9
|
+
return `@media (max-width: ${screens[size] - 1}px) { ${rules} }`;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export { down, up };
|