@prom-ui/core 2.1.0 → 2.2.0-alpha.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/Avatar/package.json +1 -1
- package/Backdrop/package.json +1 -1
- package/Badge/package.json +1 -1
- package/Body/cjs/index.development.js +8 -12
- package/Body/cjs/index.development.v2.js +8 -12
- package/Body/cjs/index.production.js +1 -1
- package/Body/cjs/index.production.v2.js +1 -1
- package/Body/index.d.ts +3 -3
- package/Body/package.json +2 -5
- package/BodyProvider/package.json +1 -1
- package/BodyScrollLock/package.json +1 -1
- package/Box/cjs/index.development.js +4 -7
- package/Box/cjs/index.development.v2.js +4 -7
- package/Box/cjs/index.production.js +1 -1
- package/Box/cjs/index.production.v2.js +1 -1
- package/Box/index.d.ts +2 -2
- package/Box/package.json +2 -5
- package/Button/cjs/index.development.js +7 -6
- package/Button/cjs/index.development.v2.js +7 -6
- package/Button/cjs/index.production.js +1 -1
- package/Button/cjs/index.production.v2.js +1 -1
- package/Button/index.d.ts +1 -1
- package/Button/package.json +2 -3
- package/ButtonPageUp/package.json +1 -1
- package/Checkbox/package.json +1 -1
- package/ColorScheme/package.json +1 -1
- package/ContextMenu/package.json +1 -1
- package/ErrorCatch/package.json +1 -1
- package/Flex/cjs/index.development.js +8 -14
- package/Flex/cjs/index.development.v2.js +8 -14
- package/Flex/cjs/index.production.js +1 -1
- package/Flex/cjs/index.production.v2.js +1 -1
- package/Flex/index.d.ts +3 -3
- package/Flex/package.json +2 -5
- package/Grid/cjs/index.development.js +8 -14
- package/Grid/cjs/index.development.v2.js +8 -14
- package/Grid/cjs/index.production.js +1 -1
- package/Grid/cjs/index.production.v2.js +1 -1
- package/Grid/index.d.ts +3 -3
- package/Grid/package.json +2 -5
- package/Icon/cjs/index.development.js +5 -26
- package/Icon/cjs/index.development.v2.js +5 -26
- package/Icon/cjs/index.production.js +1 -1
- package/Icon/cjs/index.production.v2.js +1 -1
- package/Icon/index.d.ts +2 -2
- package/Icon/package.json +2 -5
- package/Image/cjs/index.development.js +4 -7
- package/Image/cjs/index.development.v2.js +4 -7
- package/Image/cjs/index.production.js +1 -1
- package/Image/cjs/index.production.v2.js +1 -1
- package/Image/index.d.ts +2 -2
- package/Image/package.json +2 -5
- package/ImageEmoji/package.json +1 -1
- package/Input/cjs/index.development.js +4 -25
- package/Input/cjs/index.development.v2.js +4 -25
- package/Input/cjs/index.production.js +1 -1
- package/Input/cjs/index.production.v2.js +1 -1
- package/Input/index.d.ts +2 -2
- package/Input/package.json +2 -5
- package/InputField/index.d.ts +1 -1
- package/InputField/package.json +1 -1
- package/KeyPress/package.json +1 -1
- package/Label/cjs/index.development.js +5 -26
- package/Label/cjs/index.development.v2.js +5 -26
- package/Label/cjs/index.production.js +1 -1
- package/Label/cjs/index.production.v2.js +1 -1
- package/Label/index.d.ts +3 -3
- package/Label/package.json +2 -5
- package/Line/cjs/index.development.js +4 -7
- package/Line/cjs/index.development.v2.js +4 -7
- package/Line/cjs/index.production.js +1 -1
- package/Line/cjs/index.production.v2.js +1 -1
- package/Line/index.d.ts +2 -2
- package/Line/package.json +2 -5
- package/Link/cjs/index.development.js +7 -8
- package/Link/cjs/index.development.v2.js +7 -8
- package/Link/cjs/index.production.js +1 -1
- package/Link/cjs/index.production.v2.js +1 -1
- package/Link/index.d.ts +2 -2
- package/Link/package.json +2 -5
- package/List/cjs/index.development.js +8 -14
- package/List/cjs/index.development.v2.js +8 -14
- package/List/cjs/index.production.js +1 -1
- package/List/cjs/index.production.v2.js +1 -1
- package/List/index.d.ts +3 -3
- package/List/package.json +2 -5
- package/Media/package.json +1 -1
- package/Modal/package.json +1 -1
- package/OutsideClick/package.json +1 -1
- package/Overlay/package.json +1 -1
- package/PhotoGallery/package.json +1 -1
- package/Picture/cjs/index.development.js +9 -14
- package/Picture/cjs/index.development.v2.js +9 -14
- package/Picture/cjs/index.production.js +1 -1
- package/Picture/cjs/index.production.v2.js +1 -1
- package/Picture/index.d.ts +4 -4
- package/Picture/package.json +2 -5
- package/Portal/package.json +1 -1
- package/Progress/package.json +1 -1
- package/QRCode/package.json +1 -1
- package/Rating/package.json +1 -1
- package/RatingSelect/package.json +1 -1
- package/Scroll/cjs/index.development.js +8 -29
- package/Scroll/cjs/index.development.v2.js +8 -29
- package/Scroll/cjs/index.production.js +1 -1
- package/Scroll/cjs/index.production.v2.js +1 -1
- package/Scroll/index.d.ts +3 -3
- package/Scroll/package.json +2 -5
- package/ScrollControls/package.json +1 -1
- package/SimpleSlider/package.json +1 -1
- package/Skeleton/cjs/index.development.js +2 -1
- package/Skeleton/cjs/index.development.v2.js +2 -1
- package/Skeleton/cjs/index.production.js +1 -1
- package/Skeleton/cjs/index.production.v2.js +1 -1
- package/Skeleton/index.d.ts +1 -1
- package/Skeleton/package.json +2 -3
- package/SnackBar/package.json +1 -1
- package/Spinner/cjs/index.development.js +3 -1
- package/Spinner/cjs/index.development.v2.js +3 -1
- package/Spinner/cjs/index.production.js +1 -1
- package/Spinner/cjs/index.production.v2.js +1 -1
- package/Spinner/index.d.ts +1 -1
- package/Spinner/package.json +2 -3
- package/Text/cjs/index.development.js +4 -7
- package/Text/cjs/index.development.v2.js +4 -7
- package/Text/cjs/index.production.js +1 -1
- package/Text/cjs/index.production.v2.js +1 -1
- package/Text/index.d.ts +2 -2
- package/Text/package.json +2 -5
- package/TextEmoji/package.json +1 -1
- package/Tooltip/package.json +1 -1
- package/Tumbler/package.json +1 -1
- package/Viewport/package.json +1 -1
- package/evokit/cjs/index.development.js +263 -0
- package/evokit/cjs/index.development.v2.js +263 -0
- package/evokit/cjs/index.production.js +1 -0
- package/evokit/cjs/index.production.v2.js +1 -0
- package/evokit/className.d.ts +2 -0
- package/evokit/index.d.ts +3 -0
- package/evokit/index.js +7 -0
- package/evokit/index.v2.js +7 -0
- package/evokit/package.json +12 -0
- package/evokit/utils.d.ts +2 -0
- package/package.json +2 -2
- package/useBrowserLayoutEffect/package.json +1 -1
- package/useDebounce/package.json +1 -1
- package/useForwardRef/package.json +1 -1
- package/useInView/package.json +1 -1
- package/useIsMounted/package.json +1 -1
- package/useKeyPress/package.json +1 -1
- package/useMedia/package.json +1 -1
- package/useOutsideClick/package.json +1 -1
- package/usePortal/package.json +1 -1
- package/useScrollPosition/package.json +1 -1
- package/useSnackBar/package.json +1 -1
- package/base/types.d.ts +0 -55
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var react = require('react');
|
|
6
|
+
var _typeof = require('@babel/runtime/helpers/typeof');
|
|
7
|
+
var _slicedToArray = require('@babel/runtime/helpers/slicedToArray');
|
|
8
|
+
|
|
9
|
+
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
10
|
+
|
|
11
|
+
var _typeof__default = /*#__PURE__*/_interopDefaultCompat(_typeof);
|
|
12
|
+
var _slicedToArray__default = /*#__PURE__*/_interopDefaultCompat(_slicedToArray);
|
|
13
|
+
|
|
14
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
15
|
+
// @ts-nocheck
|
|
16
|
+
|
|
17
|
+
var withPreset = function withPreset(preset) {
|
|
18
|
+
var b = 'ek-';
|
|
19
|
+
var e = '__';
|
|
20
|
+
var m = '_';
|
|
21
|
+
var v = '_';
|
|
22
|
+
var getCSSModuleClassName = function getCSSModuleClassName(cls) {
|
|
23
|
+
return cls;
|
|
24
|
+
};
|
|
25
|
+
if (_typeof__default.default(preset) === 'object' && preset !== null) {
|
|
26
|
+
if (typeof preset.b === 'string') {
|
|
27
|
+
b = preset.b;
|
|
28
|
+
}
|
|
29
|
+
if (typeof preset.e === 'string') {
|
|
30
|
+
e = preset.e;
|
|
31
|
+
}
|
|
32
|
+
if (typeof preset.m === 'string') {
|
|
33
|
+
m = preset.m;
|
|
34
|
+
}
|
|
35
|
+
if (typeof preset.v === 'string') {
|
|
36
|
+
v = preset.v;
|
|
37
|
+
}
|
|
38
|
+
if (_typeof__default.default(preset.css) === 'object' && preset.css !== null) {
|
|
39
|
+
getCSSModuleClassName = function getCSSModuleClassName(cls) {
|
|
40
|
+
return preset.css[cls];
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
var getBlockClassName = function getBlockClassName(name, elem) {
|
|
45
|
+
if (elem) {
|
|
46
|
+
return b + name + e + elem;
|
|
47
|
+
}
|
|
48
|
+
return b + name;
|
|
49
|
+
};
|
|
50
|
+
var getModClassName = function getModClassName(blockName, modName, modValue) {
|
|
51
|
+
if (modValue) {
|
|
52
|
+
return blockName + m + modName + v + modValue;
|
|
53
|
+
}
|
|
54
|
+
return blockName + m + modName;
|
|
55
|
+
};
|
|
56
|
+
return function (name, elem) {
|
|
57
|
+
if (typeof name !== 'string') {
|
|
58
|
+
throw new Error('The argument "name" is not a string');
|
|
59
|
+
}
|
|
60
|
+
var block = getBlockClassName(name, elem);
|
|
61
|
+
return function (mods, mix) {
|
|
62
|
+
var modsExtended = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
63
|
+
var result = '';
|
|
64
|
+
var appendResult = function appendResult(cls) {
|
|
65
|
+
var CSSModuleClassName = getCSSModuleClassName(cls);
|
|
66
|
+
if (CSSModuleClassName) {
|
|
67
|
+
if (result) {
|
|
68
|
+
result += ' ';
|
|
69
|
+
}
|
|
70
|
+
result += CSSModuleClassName;
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
appendResult(block);
|
|
74
|
+
var appendFn = function appendFn(modKey, modVal) {
|
|
75
|
+
if (modVal.indexOf(' ') !== -1) {
|
|
76
|
+
var splitVal = modVal.split(' ');
|
|
77
|
+
if (splitVal.length > 1 && Object.prototype.hasOwnProperty.call(modsExtended, modKey)) {
|
|
78
|
+
for (var index = 0; index < splitVal.length; index++) {
|
|
79
|
+
var extendedVal = modsExtended[modKey];
|
|
80
|
+
var extendedKey = extendedVal[index];
|
|
81
|
+
if (extendedKey) {
|
|
82
|
+
if (Array.isArray(extendedKey)) {
|
|
83
|
+
for (var i = 0; i < extendedKey.length; i++) {
|
|
84
|
+
var extKey = extendedKey[i];
|
|
85
|
+
var extIndex = extendedVal.indexOf(extKey);
|
|
86
|
+
if (i === 0 || extIndex !== -1 && !splitVal[extIndex]) {
|
|
87
|
+
appendResult(getModClassName(block, extKey, splitVal[index]));
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
} else {
|
|
91
|
+
appendResult(getModClassName(block, extendedKey, splitVal[index]));
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
} else {
|
|
97
|
+
appendResult(getModClassName(block, modKey, modVal));
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
if (_typeof__default.default(mods) === 'object') {
|
|
101
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
102
|
+
for (var key in mods) {
|
|
103
|
+
if (Object.prototype.hasOwnProperty.call(mods, key)) {
|
|
104
|
+
var modVal = mods[key];
|
|
105
|
+
if (typeof modVal === 'string' || typeof modVal === 'number') {
|
|
106
|
+
appendFn(key, '' + modVal);
|
|
107
|
+
} else if (typeof modVal === 'boolean') {
|
|
108
|
+
if (modVal) {
|
|
109
|
+
appendResult(getModClassName(block, key));
|
|
110
|
+
}
|
|
111
|
+
} else if (_typeof__default.default(modVal) === 'object') {
|
|
112
|
+
var k = void 0;
|
|
113
|
+
if (Array.isArray(modVal)) {
|
|
114
|
+
for (k = 0; k < modVal.length; k++) {
|
|
115
|
+
if (typeof modVal[k] === 'string' || typeof modVal[k] === 'number') {
|
|
116
|
+
appendFn(key, '' + modVal[k]);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
} else {
|
|
120
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
121
|
+
for (k in modVal) {
|
|
122
|
+
if (modVal[k]) {
|
|
123
|
+
appendFn(key, '' + k);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
if (mix) {
|
|
132
|
+
if (typeof mix === 'string') {
|
|
133
|
+
if (result) {
|
|
134
|
+
result += ' ';
|
|
135
|
+
}
|
|
136
|
+
result += mix;
|
|
137
|
+
} else if (Array.isArray(mix)) {
|
|
138
|
+
for (var i = 0; i < mix.length; i++) {
|
|
139
|
+
if (result) {
|
|
140
|
+
result += ' ';
|
|
141
|
+
}
|
|
142
|
+
result += mix[i];
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
return result;
|
|
147
|
+
};
|
|
148
|
+
};
|
|
149
|
+
};
|
|
150
|
+
withPreset();
|
|
151
|
+
|
|
152
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
153
|
+
// @ts-nocheck
|
|
154
|
+
|
|
155
|
+
var flatten = function flatten(arr) {
|
|
156
|
+
var flattend = [];
|
|
157
|
+
var _flat = function flat(array) {
|
|
158
|
+
array.forEach(function (el) {
|
|
159
|
+
if (Array.isArray(el)) {
|
|
160
|
+
_flat(el);
|
|
161
|
+
} else if (flattend.indexOf(el) === -1) {
|
|
162
|
+
flattend.push(el);
|
|
163
|
+
}
|
|
164
|
+
});
|
|
165
|
+
};
|
|
166
|
+
_flat(arr);
|
|
167
|
+
return flattend;
|
|
168
|
+
};
|
|
169
|
+
var getMapPropModsExtend = function getMapPropModsExtend(blockMods) {
|
|
170
|
+
return blockMods.reduce(function (acc, modName) {
|
|
171
|
+
if (Array.isArray(modName) && modName.length > 0) {
|
|
172
|
+
var _modName = _slicedToArray__default.default(modName, 2),
|
|
173
|
+
key = _modName[0],
|
|
174
|
+
value = _modName[1];
|
|
175
|
+
acc[key] = value;
|
|
176
|
+
}
|
|
177
|
+
return acc;
|
|
178
|
+
}, {});
|
|
179
|
+
};
|
|
180
|
+
|
|
181
|
+
/* eslint-disable react/prop-types, @typescript-eslint/no-empty-object-type */
|
|
182
|
+
|
|
183
|
+
var createBlock = function createBlock() {
|
|
184
|
+
var tagName = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'div';
|
|
185
|
+
var blockName = arguments.length > 1 ? arguments[1] : undefined;
|
|
186
|
+
var blockMods = arguments.length > 2 ? arguments[2] : undefined;
|
|
187
|
+
var blockPreset = arguments.length > 3 ? arguments[3] : undefined;
|
|
188
|
+
var blockDefaultProps = arguments.length > 4 ? arguments[4] : undefined;
|
|
189
|
+
var PREFIX = blockName.replace(/__/, '-');
|
|
190
|
+
var BLOCK_PROP_AS = "".concat(PREFIX, "-as");
|
|
191
|
+
var MODS_BLOCK_PROPS = flatten(blockMods);
|
|
192
|
+
var MODS_BLOCK_PROPS_EXTENDED = getMapPropModsExtend(blockMods);
|
|
193
|
+
var MODS_BLOCK_PROPS_WITH_PREFIX = MODS_BLOCK_PROPS.map(function (val) {
|
|
194
|
+
return "".concat(PREFIX, "-").concat(val);
|
|
195
|
+
});
|
|
196
|
+
|
|
197
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
198
|
+
// @ts-ignore-next-line
|
|
199
|
+
var createClassName = withPreset(blockPreset)(blockName);
|
|
200
|
+
var Block = /*#__PURE__*/react.forwardRef(function (props, ref) {
|
|
201
|
+
var elementType = tagName;
|
|
202
|
+
var elementProps = {};
|
|
203
|
+
var modsProps = {};
|
|
204
|
+
if (blockDefaultProps) {
|
|
205
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
206
|
+
for (var key in blockDefaultProps) {
|
|
207
|
+
if (key === BLOCK_PROP_AS) {
|
|
208
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
209
|
+
// @ts-ignore-next-line
|
|
210
|
+
elementType = blockDefaultProps[key];
|
|
211
|
+
continue;
|
|
212
|
+
}
|
|
213
|
+
var index = MODS_BLOCK_PROPS_WITH_PREFIX.indexOf(key);
|
|
214
|
+
if (index !== -1) {
|
|
215
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
216
|
+
// @ts-ignore-next-line
|
|
217
|
+
modsProps[MODS_BLOCK_PROPS[index]] = blockDefaultProps[key];
|
|
218
|
+
} else {
|
|
219
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
220
|
+
// @ts-ignore-next-line
|
|
221
|
+
elementProps[key] = blockDefaultProps[key];
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
227
|
+
for (var _key in props) {
|
|
228
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
229
|
+
// @ts-ignore-next-line
|
|
230
|
+
if (props[_key] === undefined) {
|
|
231
|
+
continue;
|
|
232
|
+
}
|
|
233
|
+
if (_key === BLOCK_PROP_AS) {
|
|
234
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
235
|
+
// @ts-ignore-next-line
|
|
236
|
+
elementType = props[_key];
|
|
237
|
+
continue;
|
|
238
|
+
}
|
|
239
|
+
var _index = MODS_BLOCK_PROPS_WITH_PREFIX.indexOf(_key);
|
|
240
|
+
if (_index !== -1) {
|
|
241
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
242
|
+
// @ts-ignore-next-line
|
|
243
|
+
modsProps[MODS_BLOCK_PROPS[_index]] = props[_key];
|
|
244
|
+
} else {
|
|
245
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
246
|
+
// @ts-ignore-next-line
|
|
247
|
+
elementProps[_key] = props[_key];
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
252
|
+
// @ts-ignore-next-line
|
|
253
|
+
elementProps.ref = ref;
|
|
254
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
255
|
+
// @ts-ignore-next-line
|
|
256
|
+
elementProps.className = createClassName(modsProps, props.className, MODS_BLOCK_PROPS_EXTENDED);
|
|
257
|
+
return /*#__PURE__*/react.createElement(elementType, elementProps);
|
|
258
|
+
});
|
|
259
|
+
Block.displayName = blockName;
|
|
260
|
+
return Block;
|
|
261
|
+
};
|
|
262
|
+
|
|
263
|
+
exports.createBlock = createBlock;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),r=require("@babel/runtime/helpers/typeof"),t=require("@babel/runtime/helpers/slicedToArray");function n(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var i=n(r),f=n(t),o=function(e){var r="ek-",t="__",n="_",f="_",o=function(e){return e};"object"===i.default(e)&&null!==e&&("string"==typeof e.b&&(r=e.b),"string"==typeof e.e&&(t=e.e),"string"==typeof e.m&&(n=e.m),"string"==typeof e.v&&(f=e.v),"object"===i.default(e.css)&&null!==e.css&&(o=function(r){return e.css[r]}));var a=function(e,r,t){return t?e+n+r+f+t:e+n+r};return function(e,n){if("string"!=typeof e)throw new Error('The argument "name" is not a string');var f=function(e,n){return n?r+e+t+n:r+e}(e,n);return function(e,r){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n="",u=function(e){var r=o(e);r&&(n&&(n+=" "),n+=r)};u(f);var l=function(e,r){if(-1!==r.indexOf(" ")){var n=r.split(" ");if(n.length>1&&Object.prototype.hasOwnProperty.call(t,e))for(var i=0;i<n.length;i++){var o=t[e],l=o[i];if(l)if(Array.isArray(l))for(var c=0;c<l.length;c++){var s=l[c],v=o.indexOf(s);(0===c||-1!==v&&!n[v])&&u(a(f,s,n[i]))}else u(a(f,l,n[i]))}}else u(a(f,e,r))};if("object"===i.default(e))for(var c in e)if(Object.prototype.hasOwnProperty.call(e,c)){var s=e[c];if("string"==typeof s||"number"==typeof s)l(c,""+s);else if("boolean"==typeof s)s&&u(a(f,c));else if("object"===i.default(s)){var v=void 0;if(Array.isArray(s))for(v=0;v<s.length;v++)"string"!=typeof s[v]&&"number"!=typeof s[v]||l(c,""+s[v]);else for(v in s)s[v]&&l(c,""+v)}}if(r)if("string"==typeof r)n&&(n+=" "),n+=r;else if(Array.isArray(r))for(var y=0;y<r.length;y++)n&&(n+=" "),n+=r[y];return n}}};o();exports.createBlock=function(){var r,t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"div",i=arguments.length>1?arguments[1]:void 0,a=arguments.length>2?arguments[2]:void 0,u=arguments.length>3?arguments[3]:void 0,l=arguments.length>4?arguments[4]:void 0,c=i.replace(/__/,"-"),s="".concat(c,"-as"),v=(r=[],(t=function(e){e.forEach((function(e){Array.isArray(e)?t(e):-1===r.indexOf(e)&&r.push(e)}))})(a),r),y=function(e){return e.reduce((function(e,r){if(Array.isArray(r)&&r.length>0){var t=f.default(r,2),n=t[0],i=t[1];e[n]=i}return e}),{})}(a),p=v.map((function(e){return"".concat(c,"-").concat(e)})),d=o(u)(i),g=e.forwardRef((function(r,t){var i=n,f={},o={};if(l)for(var a in l)if(a!==s){var u=p.indexOf(a);-1!==u?o[v[u]]=l[a]:f[a]=l[a]}else i=l[a];for(var c in r)if(void 0!==r[c])if(c!==s){var g=p.indexOf(c);-1!==g?o[v[g]]=r[c]:f[c]=r[c]}else i=r[c];return f.ref=t,f.className=d(o,r.className,y),e.createElement(i,f)}));return g.displayName=i,g};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),r=require("@babel/runtime/helpers/typeof"),t=require("@babel/runtime/helpers/slicedToArray");function n(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var i=n(r),f=n(t),o=function(e){var r="ek-",t="__",n="_",f="_",o=function(e){return e};"object"===i.default(e)&&null!==e&&("string"==typeof e.b&&(r=e.b),"string"==typeof e.e&&(t=e.e),"string"==typeof e.m&&(n=e.m),"string"==typeof e.v&&(f=e.v),"object"===i.default(e.css)&&null!==e.css&&(o=function(r){return e.css[r]}));var a=function(e,r,t){return t?e+n+r+f+t:e+n+r};return function(e,n){if("string"!=typeof e)throw new Error('The argument "name" is not a string');var f=function(e,n){return n?r+e+t+n:r+e}(e,n);return function(e,r){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n="",u=function(e){var r=o(e);r&&(n&&(n+=" "),n+=r)};u(f);var l=function(e,r){if(-1!==r.indexOf(" ")){var n=r.split(" ");if(n.length>1&&Object.prototype.hasOwnProperty.call(t,e))for(var i=0;i<n.length;i++){var o=t[e],l=o[i];if(l)if(Array.isArray(l))for(var c=0;c<l.length;c++){var s=l[c],v=o.indexOf(s);(0===c||-1!==v&&!n[v])&&u(a(f,s,n[i]))}else u(a(f,l,n[i]))}}else u(a(f,e,r))};if("object"===i.default(e))for(var c in e)if(Object.prototype.hasOwnProperty.call(e,c)){var s=e[c];if("string"==typeof s||"number"==typeof s)l(c,""+s);else if("boolean"==typeof s)s&&u(a(f,c));else if("object"===i.default(s)){var v=void 0;if(Array.isArray(s))for(v=0;v<s.length;v++)"string"!=typeof s[v]&&"number"!=typeof s[v]||l(c,""+s[v]);else for(v in s)s[v]&&l(c,""+v)}}if(r)if("string"==typeof r)n&&(n+=" "),n+=r;else if(Array.isArray(r))for(var y=0;y<r.length;y++)n&&(n+=" "),n+=r[y];return n}}};o();exports.createBlock=function(){var r,t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"div",i=arguments.length>1?arguments[1]:void 0,a=arguments.length>2?arguments[2]:void 0,u=arguments.length>3?arguments[3]:void 0,l=arguments.length>4?arguments[4]:void 0,c=i.replace(/__/,"-"),s="".concat(c,"-as"),v=(r=[],(t=function(e){e.forEach((function(e){Array.isArray(e)?t(e):-1===r.indexOf(e)&&r.push(e)}))})(a),r),y=function(e){return e.reduce((function(e,r){if(Array.isArray(r)&&r.length>0){var t=f.default(r,2),n=t[0],i=t[1];e[n]=i}return e}),{})}(a),p=v.map((function(e){return"".concat(c,"-").concat(e)})),d=o(u)(i),g=e.forwardRef((function(r,t){var i=n,f={},o={};if(l)for(var a in l)if(a!==s){var u=p.indexOf(a);-1!==u?o[v[u]]=l[a]:f[a]=l[a]}else i=l[a];for(var c in r)if(void 0!==r[c])if(c!==s){var g=p.indexOf(c);-1!==g?o[v[g]]=r[c]:f[c]=r[c]}else i=r[c];return f.ref=t,f.className=d(o,r.className,y),e.createElement(i,f)}));return g.displayName=i,g};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { CreateBlock, BlockModsConstraint, BlockPreset, EvokitProp, EvokitMediaSufix, BlockDefaultProps } from './types';
|
|
2
|
+
export declare const createBlock: <E extends React.ElementType = "div", N extends string = string, P = {}, S extends object = {}>(tagName: E | undefined, blockName: N, blockMods: BlockModsConstraint<P, N>, blockPreset: BlockPreset, blockDefaultProps?: BlockDefaultProps<E, N, P>) => CreateBlock<E, N, P> & S;
|
|
3
|
+
export type { CreateBlock, EvokitProp, EvokitMediaSufix };
|
package/evokit/index.js
ADDED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prom-ui/core",
|
|
3
3
|
"author": "e.marchenko",
|
|
4
|
-
"version": "2.
|
|
4
|
+
"version": "2.2.0-alpha.0",
|
|
5
5
|
"description": "core ui blocks",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"lint": "eslint ./src",
|
|
@@ -64,5 +64,5 @@
|
|
|
64
64
|
"react": ">=18.0.0",
|
|
65
65
|
"react-dom": ">=18.0.0"
|
|
66
66
|
},
|
|
67
|
-
"gitHead": "
|
|
67
|
+
"gitHead": "b1e90b34246ca40e57b4cc008426691bf88cbb96"
|
|
68
68
|
}
|
package/useDebounce/package.json
CHANGED
package/useInView/package.json
CHANGED
package/useKeyPress/package.json
CHANGED
package/useMedia/package.json
CHANGED
package/usePortal/package.json
CHANGED
package/useSnackBar/package.json
CHANGED
package/base/types.d.ts
DELETED
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
|
|
3
|
-
// export type EvokitProps<P extends Record<string, string | number>> = {
|
|
4
|
-
// [K in keyof P]: P[K] | `${P[K]}` | P[K][] | `${P[K]}`[] | Partial<Record<`${P[K]}`, boolean>>;
|
|
5
|
-
// };
|
|
6
|
-
// type PolymorphicRef<T extends React.ElementType> = React.ComponentPropsWithRef<T>['ref'];
|
|
7
|
-
// type PropsToOmit<T extends React.ElementType, N extends string, P> = keyof (AsProp<T, N> & P);
|
|
8
|
-
// Omit<React.ComponentPropsWithoutRef<T>, keyof (P & BaseProps<T, N>)> &
|
|
9
|
-
|
|
10
|
-
type EvokitPreset = {
|
|
11
|
-
b?: string;
|
|
12
|
-
m?: string;
|
|
13
|
-
v?: string;
|
|
14
|
-
css?: Record<string, string>;
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
type EvokitMedia = 'small' | 'medium' | 'large' | 'wide' | 'huge';
|
|
18
|
-
|
|
19
|
-
type PropsPrefix<P extends string, T> = {
|
|
20
|
-
[Property in keyof T as `${P}-${string & Property}`]?: T[Property];
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
type BaseProps<T extends React.ElementType, N extends string> = PropsPrefix<
|
|
24
|
-
N,
|
|
25
|
-
{
|
|
26
|
-
as?: T;
|
|
27
|
-
preset?: EvokitPreset;
|
|
28
|
-
}
|
|
29
|
-
>;
|
|
30
|
-
|
|
31
|
-
type PolymorphicComponentProp<
|
|
32
|
-
T extends React.ElementType,
|
|
33
|
-
N extends string,
|
|
34
|
-
P = {},
|
|
35
|
-
> = React.ComponentPropsWithoutRef<T> & React.PropsWithChildren<P & BaseProps<T, N>>;
|
|
36
|
-
|
|
37
|
-
type PolymorphicComponentPropWithRef<T extends React.ElementType, N extends string, P = {}> = PolymorphicComponentProp<
|
|
38
|
-
T,
|
|
39
|
-
N,
|
|
40
|
-
P
|
|
41
|
-
> & {
|
|
42
|
-
ref?: React.ComponentPropsWithRef<T>['ref'];
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
export type EvokitMediaSufix<T extends string | number> = T | `${T}` | `${T}@${EvokitMedia}`;
|
|
46
|
-
|
|
47
|
-
export type EvokitProp<T extends string | number> = T | `${T}` | T[] | `${T}`[] | Partial<Record<`${T}`, boolean>>;
|
|
48
|
-
|
|
49
|
-
export interface CreateBlock<E extends React.ElementType, N extends string, P = {}> {
|
|
50
|
-
<T extends React.ElementType = E>(props: PolymorphicComponentPropWithRef<T, N, P>): React.ReactNode;
|
|
51
|
-
propTypes?: React.WeakValidationMap<PolymorphicComponentProp<E, N, P>> | undefined;
|
|
52
|
-
contextTypes?: React.ValidationMap<any> | undefined;
|
|
53
|
-
defaultProps?: Partial<PolymorphicComponentProp<E, N, P>> | undefined;
|
|
54
|
-
displayName?: string | undefined;
|
|
55
|
-
}
|