@ttoss/components 2.0.14 → 2.0.16
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/dist/esm/Menu/index.js +159 -47
- package/dist/esm/Toast/index.js +0 -5
- package/package.json +16 -16
package/dist/esm/Menu/index.js
CHANGED
|
@@ -58,10 +58,10 @@ var Drawer = ({
|
|
|
58
58
|
// ../react-icons/src/Icon.tsx
|
|
59
59
|
import * as React2 from "react";
|
|
60
60
|
|
|
61
|
-
// ../../node_modules/.pnpm/@iconify-icon+react@2.
|
|
61
|
+
// ../../node_modules/.pnpm/@iconify-icon+react@2.2.0_react@19.0.0/node_modules/@iconify-icon/react/dist/iconify.mjs
|
|
62
62
|
import React from "react";
|
|
63
63
|
|
|
64
|
-
// ../../node_modules/.pnpm/iconify-icon@2.
|
|
64
|
+
// ../../node_modules/.pnpm/iconify-icon@2.2.0/node_modules/iconify-icon/dist/iconify-icon.mjs
|
|
65
65
|
var defaultIconDimensions = Object.freeze({
|
|
66
66
|
left: 0,
|
|
67
67
|
top: 0,
|
|
@@ -208,7 +208,10 @@ var validateIconName = (icon, allowSimpleName) => {
|
|
|
208
208
|
if (!icon) {
|
|
209
209
|
return false;
|
|
210
210
|
}
|
|
211
|
-
return !!(
|
|
211
|
+
return !!(
|
|
212
|
+
// Check prefix: cannot be empty, unless allowSimpleName is enabled
|
|
213
|
+
// Check name: cannot be empty
|
|
214
|
+
(allowSimpleName && icon.prefix === "" || !!icon.prefix) && !!icon.name);
|
|
212
215
|
};
|
|
213
216
|
function mergeIconTransformations(obj1, obj2) {
|
|
214
217
|
const result = {};
|
|
@@ -257,7 +260,7 @@ function getIconsTree(data, names) {
|
|
|
257
260
|
}
|
|
258
261
|
return resolved[name];
|
|
259
262
|
}
|
|
260
|
-
|
|
263
|
+
Object.keys(icons).concat(Object.keys(aliases)).forEach(resolve);
|
|
261
264
|
return resolved;
|
|
262
265
|
}
|
|
263
266
|
function internalGetIconData(data, name, tree) {
|
|
@@ -320,7 +323,13 @@ function quicklyValidateIconSet(obj) {
|
|
|
320
323
|
const icons = data.icons;
|
|
321
324
|
for (const name in icons) {
|
|
322
325
|
const icon = icons[name];
|
|
323
|
-
if (
|
|
326
|
+
if (
|
|
327
|
+
// Name cannot be empty
|
|
328
|
+
!name ||
|
|
329
|
+
// Must have body
|
|
330
|
+
typeof icon.body !== "string" ||
|
|
331
|
+
// Check other props
|
|
332
|
+
!checkOptionalProps(icon, defaultExtendedIconProps)) {
|
|
324
333
|
return null;
|
|
325
334
|
}
|
|
326
335
|
}
|
|
@@ -328,7 +337,13 @@ function quicklyValidateIconSet(obj) {
|
|
|
328
337
|
for (const name in aliases) {
|
|
329
338
|
const icon = aliases[name];
|
|
330
339
|
const parent = icon.parent;
|
|
331
|
-
if (
|
|
340
|
+
if (
|
|
341
|
+
// Name cannot be empty
|
|
342
|
+
!name ||
|
|
343
|
+
// Parent must be set and point to existing icon
|
|
344
|
+
typeof parent !== "string" || !icons[parent] && !aliases[parent] ||
|
|
345
|
+
// Check other props
|
|
346
|
+
!checkOptionalProps(icon, defaultExtendedIconProps)) {
|
|
332
347
|
return null;
|
|
333
348
|
}
|
|
334
349
|
}
|
|
@@ -403,7 +418,12 @@ function addIcon$1(name, data) {
|
|
|
403
418
|
return false;
|
|
404
419
|
}
|
|
405
420
|
const storage2 = getStorage(icon.provider, icon.prefix);
|
|
406
|
-
|
|
421
|
+
if (data) {
|
|
422
|
+
return addIconToStorage(storage2, icon.name, data);
|
|
423
|
+
} else {
|
|
424
|
+
storage2.missing.add(icon.name);
|
|
425
|
+
return true;
|
|
426
|
+
}
|
|
407
427
|
}
|
|
408
428
|
function addCollection$1(data, provider) {
|
|
409
429
|
if (typeof data !== "object") {
|
|
@@ -417,7 +437,7 @@ function addCollection$1(data, provider) {
|
|
|
417
437
|
if (quicklyValidateIconSet(data)) {
|
|
418
438
|
data.prefix = "";
|
|
419
439
|
parseIconSet(data, (name, icon) => {
|
|
420
|
-
if (
|
|
440
|
+
if (addIcon$1(name, icon)) {
|
|
421
441
|
added = true;
|
|
422
442
|
}
|
|
423
443
|
});
|
|
@@ -443,7 +463,7 @@ function getIcon$1(name) {
|
|
|
443
463
|
return result ? {
|
|
444
464
|
...defaultIconProps,
|
|
445
465
|
...result
|
|
446
|
-
} :
|
|
466
|
+
} : result;
|
|
447
467
|
}
|
|
448
468
|
function sortIcons(icons) {
|
|
449
469
|
const result = {
|
|
@@ -1076,6 +1096,57 @@ function loadedNewIcons(storage2) {
|
|
|
1076
1096
|
});
|
|
1077
1097
|
}
|
|
1078
1098
|
}
|
|
1099
|
+
function checkIconNamesForAPI(icons) {
|
|
1100
|
+
const valid = [];
|
|
1101
|
+
const invalid = [];
|
|
1102
|
+
icons.forEach(name => {
|
|
1103
|
+
(name.match(matchIconName) ? valid : invalid).push(name);
|
|
1104
|
+
});
|
|
1105
|
+
return {
|
|
1106
|
+
valid,
|
|
1107
|
+
invalid
|
|
1108
|
+
};
|
|
1109
|
+
}
|
|
1110
|
+
function parseLoaderResponse(storage2, icons, data, isAPIResponse) {
|
|
1111
|
+
function checkMissing() {
|
|
1112
|
+
const pending = storage2.pendingIcons;
|
|
1113
|
+
icons.forEach(name => {
|
|
1114
|
+
if (pending) {
|
|
1115
|
+
pending.delete(name);
|
|
1116
|
+
}
|
|
1117
|
+
if (!storage2.icons[name]) {
|
|
1118
|
+
storage2.missing.add(name);
|
|
1119
|
+
}
|
|
1120
|
+
});
|
|
1121
|
+
}
|
|
1122
|
+
if (data && typeof data === "object") {
|
|
1123
|
+
try {
|
|
1124
|
+
const parsed = addIconSet(storage2, data);
|
|
1125
|
+
if (!parsed.length) {
|
|
1126
|
+
checkMissing();
|
|
1127
|
+
return;
|
|
1128
|
+
}
|
|
1129
|
+
if (isAPIResponse) {
|
|
1130
|
+
storeInBrowserStorage(storage2, data);
|
|
1131
|
+
}
|
|
1132
|
+
} catch (err) {
|
|
1133
|
+
console.error(err);
|
|
1134
|
+
}
|
|
1135
|
+
}
|
|
1136
|
+
checkMissing();
|
|
1137
|
+
loadedNewIcons(storage2);
|
|
1138
|
+
}
|
|
1139
|
+
function parsePossiblyAsyncResponse(response, callback) {
|
|
1140
|
+
if (response instanceof Promise) {
|
|
1141
|
+
response.then(data => {
|
|
1142
|
+
callback(data);
|
|
1143
|
+
}).catch(() => {
|
|
1144
|
+
callback(null);
|
|
1145
|
+
});
|
|
1146
|
+
} else {
|
|
1147
|
+
callback(response);
|
|
1148
|
+
}
|
|
1149
|
+
}
|
|
1079
1150
|
function loadNewIcons(storage2, icons) {
|
|
1080
1151
|
if (!storage2.iconsToLoad) {
|
|
1081
1152
|
storage2.iconsToLoad = icons;
|
|
@@ -1092,35 +1163,50 @@ function loadNewIcons(storage2, icons) {
|
|
|
1092
1163
|
} = storage2;
|
|
1093
1164
|
const icons2 = storage2.iconsToLoad;
|
|
1094
1165
|
delete storage2.iconsToLoad;
|
|
1095
|
-
|
|
1096
|
-
|
|
1166
|
+
if (!icons2 || !icons2.length) {
|
|
1167
|
+
return;
|
|
1168
|
+
}
|
|
1169
|
+
const customIconLoader = storage2.loadIcon;
|
|
1170
|
+
if (storage2.loadIcons && (icons2.length > 1 || !customIconLoader)) {
|
|
1171
|
+
parsePossiblyAsyncResponse(storage2.loadIcons(icons2, prefix, provider), data => {
|
|
1172
|
+
parseLoaderResponse(storage2, icons2, data, false);
|
|
1173
|
+
});
|
|
1174
|
+
return;
|
|
1175
|
+
}
|
|
1176
|
+
if (customIconLoader) {
|
|
1177
|
+
icons2.forEach(name => {
|
|
1178
|
+
const response = customIconLoader(name, prefix, provider);
|
|
1179
|
+
parsePossiblyAsyncResponse(response, data => {
|
|
1180
|
+
const iconSet = data ? {
|
|
1181
|
+
prefix,
|
|
1182
|
+
icons: {
|
|
1183
|
+
[name]: data
|
|
1184
|
+
}
|
|
1185
|
+
} : null;
|
|
1186
|
+
parseLoaderResponse(storage2, [name], iconSet, false);
|
|
1187
|
+
});
|
|
1188
|
+
});
|
|
1097
1189
|
return;
|
|
1098
1190
|
}
|
|
1099
|
-
const
|
|
1191
|
+
const {
|
|
1192
|
+
valid,
|
|
1193
|
+
invalid
|
|
1194
|
+
} = checkIconNamesForAPI(icons2);
|
|
1195
|
+
if (invalid.length) {
|
|
1196
|
+
parseLoaderResponse(storage2, invalid, null, false);
|
|
1197
|
+
}
|
|
1198
|
+
if (!valid.length) {
|
|
1199
|
+
return;
|
|
1200
|
+
}
|
|
1201
|
+
const api = prefix.match(matchIconName) ? getAPIModule(provider) : null;
|
|
1202
|
+
if (!api) {
|
|
1203
|
+
parseLoaderResponse(storage2, valid, null, false);
|
|
1204
|
+
return;
|
|
1205
|
+
}
|
|
1206
|
+
const params = api.prepare(provider, prefix, valid);
|
|
1100
1207
|
params.forEach(item => {
|
|
1101
1208
|
sendAPIQuery(provider, item, data => {
|
|
1102
|
-
|
|
1103
|
-
item.icons.forEach(name => {
|
|
1104
|
-
storage2.missing.add(name);
|
|
1105
|
-
});
|
|
1106
|
-
} else {
|
|
1107
|
-
try {
|
|
1108
|
-
const parsed = addIconSet(storage2, data);
|
|
1109
|
-
if (!parsed.length) {
|
|
1110
|
-
return;
|
|
1111
|
-
}
|
|
1112
|
-
const pending = storage2.pendingIcons;
|
|
1113
|
-
if (pending) {
|
|
1114
|
-
parsed.forEach(name => {
|
|
1115
|
-
pending.delete(name);
|
|
1116
|
-
});
|
|
1117
|
-
}
|
|
1118
|
-
storeInBrowserStorage(storage2, data);
|
|
1119
|
-
} catch (err) {
|
|
1120
|
-
console.error(err);
|
|
1121
|
-
}
|
|
1122
|
-
}
|
|
1123
|
-
loadedNewIcons(storage2);
|
|
1209
|
+
parseLoaderResponse(storage2, item.icons, data, true);
|
|
1124
1210
|
});
|
|
1125
1211
|
});
|
|
1126
1212
|
});
|
|
@@ -1175,12 +1261,9 @@ var loadIcons$1 = (icons, callback) => {
|
|
|
1175
1261
|
}
|
|
1176
1262
|
});
|
|
1177
1263
|
sources.forEach(storage2 => {
|
|
1178
|
-
const
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
} = storage2;
|
|
1182
|
-
if (newIcons[provider][prefix].length) {
|
|
1183
|
-
loadNewIcons(storage2, newIcons[provider][prefix]);
|
|
1264
|
+
const list = newIcons[storage2.provider][storage2.prefix];
|
|
1265
|
+
if (list.length) {
|
|
1266
|
+
loadNewIcons(storage2, list);
|
|
1184
1267
|
}
|
|
1185
1268
|
});
|
|
1186
1269
|
return callback ? storeCallback(callback, sortedIcons, sources) : emptyCallback;
|
|
@@ -1218,12 +1301,31 @@ function testIconObject(value) {
|
|
|
1218
1301
|
} catch (err) {}
|
|
1219
1302
|
}
|
|
1220
1303
|
function parseIconValue(value, onload) {
|
|
1221
|
-
|
|
1222
|
-
if (!name) {
|
|
1304
|
+
if (typeof value === "object") {
|
|
1223
1305
|
const data2 = testIconObject(value);
|
|
1224
1306
|
return {
|
|
1225
|
-
|
|
1226
|
-
|
|
1307
|
+
data: data2,
|
|
1308
|
+
value
|
|
1309
|
+
};
|
|
1310
|
+
}
|
|
1311
|
+
if (typeof value !== "string") {
|
|
1312
|
+
return {
|
|
1313
|
+
value
|
|
1314
|
+
};
|
|
1315
|
+
}
|
|
1316
|
+
if (value.includes("{")) {
|
|
1317
|
+
const data2 = testIconObject(value);
|
|
1318
|
+
if (data2) {
|
|
1319
|
+
return {
|
|
1320
|
+
data: data2,
|
|
1321
|
+
value
|
|
1322
|
+
};
|
|
1323
|
+
}
|
|
1324
|
+
}
|
|
1325
|
+
const name = stringToIcon(value, true, true);
|
|
1326
|
+
if (!name) {
|
|
1327
|
+
return {
|
|
1328
|
+
value
|
|
1227
1329
|
};
|
|
1228
1330
|
}
|
|
1229
1331
|
const data = getIconData(name);
|
|
@@ -1575,6 +1677,12 @@ var fetchAPIModule = {
|
|
|
1575
1677
|
prepare,
|
|
1576
1678
|
send
|
|
1577
1679
|
};
|
|
1680
|
+
function setCustomIconsLoader$1(loader, prefix, provider) {
|
|
1681
|
+
getStorage(provider || "", prefix).loadIcons = loader;
|
|
1682
|
+
}
|
|
1683
|
+
function setCustomIconLoader$1(loader, prefix, provider) {
|
|
1684
|
+
getStorage(provider || "", prefix).loadIcon = loader;
|
|
1685
|
+
}
|
|
1578
1686
|
function toggleBrowserCache(storage2, value) {
|
|
1579
1687
|
switch (storage2) {
|
|
1580
1688
|
case "local":
|
|
@@ -1600,7 +1708,7 @@ function updateStyle(parent, inline) {
|
|
|
1600
1708
|
styleNode.setAttribute(nodeAttr, nodeAttr);
|
|
1601
1709
|
parent.appendChild(styleNode);
|
|
1602
1710
|
}
|
|
1603
|
-
styleNode.textContent = ":host{display:inline-block;vertical-align:" + (inline ? "-0.125em" : "0") + "}span,svg{display:block}" + customStyle;
|
|
1711
|
+
styleNode.textContent = ":host{display:inline-block;vertical-align:" + (inline ? "-0.125em" : "0") + "}span,svg{display:block;margin:auto}" + customStyle;
|
|
1604
1712
|
}
|
|
1605
1713
|
function exportFunctions() {
|
|
1606
1714
|
setAPIModule("", fetchAPIModule);
|
|
@@ -1677,6 +1785,8 @@ function exportFunctions() {
|
|
|
1677
1785
|
loadIcons: loadIcons$1,
|
|
1678
1786
|
loadIcon: loadIcon$1,
|
|
1679
1787
|
addAPIProvider: addAPIProvider$1,
|
|
1788
|
+
setCustomIconLoader: setCustomIconLoader$1,
|
|
1789
|
+
setCustomIconsLoader: setCustomIconsLoader$1,
|
|
1680
1790
|
appendCustomStyle,
|
|
1681
1791
|
_api: _api2
|
|
1682
1792
|
};
|
|
@@ -2168,11 +2278,13 @@ var {
|
|
|
2168
2278
|
svgToURL,
|
|
2169
2279
|
loadIcons,
|
|
2170
2280
|
loadIcon,
|
|
2281
|
+
setCustomIconLoader,
|
|
2282
|
+
setCustomIconsLoader,
|
|
2171
2283
|
addAPIProvider,
|
|
2172
2284
|
_api
|
|
2173
2285
|
} = IconifyIconComponent;
|
|
2174
2286
|
|
|
2175
|
-
// ../../node_modules/.pnpm/@iconify-icon+react@2.
|
|
2287
|
+
// ../../node_modules/.pnpm/@iconify-icon+react@2.2.0_react@19.0.0/node_modules/@iconify-icon/react/dist/iconify.mjs
|
|
2176
2288
|
var Icon = React.forwardRef((props, ref) => {
|
|
2177
2289
|
const newProps = {
|
|
2178
2290
|
...props,
|
|
@@ -2293,6 +2405,6 @@ iconify-icon/dist/iconify-icon.mjs:
|
|
|
2293
2405
|
* Licensed under MIT.
|
|
2294
2406
|
*
|
|
2295
2407
|
* @license MIT
|
|
2296
|
-
* @version 2.
|
|
2408
|
+
* @version 2.2.0
|
|
2297
2409
|
*)
|
|
2298
2410
|
*/
|
package/dist/esm/Toast/index.js
CHANGED
|
@@ -2,15 +2,10 @@
|
|
|
2
2
|
import "../chunk-ESDEGKXL.js";
|
|
3
3
|
|
|
4
4
|
// src/components/Toast/Toast.tsx
|
|
5
|
-
import * as React from "react";
|
|
6
5
|
import { Box } from "@ttoss/ui";
|
|
7
6
|
import { ToastContainer as ReactToastifyToastContainer, toast } from "react-toastify";
|
|
8
|
-
import { injectStyle } from "react-toastify/dist/inject-style";
|
|
9
7
|
import { jsx } from "react/jsx-runtime";
|
|
10
8
|
var ToastContainer = props => {
|
|
11
|
-
React.useEffect(() => {
|
|
12
|
-
injectStyle();
|
|
13
|
-
}, []);
|
|
14
9
|
return /* @__PURE__ */jsx(Box, {
|
|
15
10
|
sx: ({
|
|
16
11
|
colors,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ttoss/components",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.16",
|
|
4
4
|
"description": "React components for ttoss ecosystem.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "ttoss",
|
|
@@ -60,35 +60,35 @@
|
|
|
60
60
|
],
|
|
61
61
|
"sideEffects": false,
|
|
62
62
|
"dependencies": {
|
|
63
|
-
"@emotion/css": "^11.13.
|
|
64
|
-
"@tanstack/react-table": "^8.20.
|
|
65
|
-
"@theme-ui/css": "^0.
|
|
63
|
+
"@emotion/css": "^11.13.5",
|
|
64
|
+
"@tanstack/react-table": "^8.20.6",
|
|
65
|
+
"@theme-ui/css": "^0.17.1",
|
|
66
66
|
"@types/react-modal": "^3.16.3",
|
|
67
67
|
"react-accessible-accordion": "^5.0.0",
|
|
68
68
|
"react-markdown": "^9.0.1",
|
|
69
|
-
"react-modal": "^3.16.
|
|
69
|
+
"react-modal": "^3.16.3",
|
|
70
70
|
"react-modern-drawer": "^1.4.0",
|
|
71
|
-
"react-toastify": "^
|
|
71
|
+
"react-toastify": "^11.0.2",
|
|
72
72
|
"rehype-raw": "^7.0.0",
|
|
73
73
|
"remark-gfm": "^4.0.0"
|
|
74
74
|
},
|
|
75
75
|
"peerDependencies": {
|
|
76
76
|
"react": ">=16.8.0",
|
|
77
|
-
"@ttoss/react-hooks": "^2.0.
|
|
78
|
-
"@ttoss/ui": "^5.0.
|
|
77
|
+
"@ttoss/react-hooks": "^2.0.8",
|
|
78
|
+
"@ttoss/ui": "^5.0.14"
|
|
79
79
|
},
|
|
80
80
|
"devDependencies": {
|
|
81
81
|
"@types/jest": "^29.5.14",
|
|
82
|
-
"@types/react": "^
|
|
82
|
+
"@types/react": "^19.0.2",
|
|
83
83
|
"jest": "^29.7.0",
|
|
84
|
-
"react": "^
|
|
84
|
+
"react": "^19.0.0",
|
|
85
85
|
"tsup": "^8.3.5",
|
|
86
|
-
"tsx": "^4.
|
|
87
|
-
"@ttoss/config": "^1.35.
|
|
88
|
-
"@ttoss/react-
|
|
89
|
-
"@ttoss/
|
|
90
|
-
"@ttoss/
|
|
91
|
-
"@ttoss/
|
|
86
|
+
"tsx": "^4.19.2",
|
|
87
|
+
"@ttoss/config": "^1.35.2",
|
|
88
|
+
"@ttoss/react-icons": "^0.4.8",
|
|
89
|
+
"@ttoss/ui": "^5.0.14",
|
|
90
|
+
"@ttoss/test-utils": "^2.1.21",
|
|
91
|
+
"@ttoss/react-hooks": "^2.0.8"
|
|
92
92
|
},
|
|
93
93
|
"keywords": [
|
|
94
94
|
"React",
|