@ttoss/layouts 0.11.23 → 0.11.25
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/index.cjs +59 -59
- package/dist/index.mjs +59 -59
- package/package.json +8 -8
package/dist/index.cjs
CHANGED
|
@@ -37,7 +37,7 @@ react = __toESM(react);
|
|
|
37
37
|
let _ttoss_components_Drawer = require("@ttoss/components/Drawer");
|
|
38
38
|
|
|
39
39
|
//#region src/components/Footer.tsx
|
|
40
|
-
|
|
40
|
+
var Footer = props => {
|
|
41
41
|
return /* @__PURE__ */(0, react_jsx_runtime.jsx)(_ttoss_ui.Box, {
|
|
42
42
|
variant: "layout.footer",
|
|
43
43
|
...props,
|
|
@@ -60,31 +60,31 @@ Footer.displayName = "Footer";
|
|
|
60
60
|
* @license MIT
|
|
61
61
|
* @version 2.3.0
|
|
62
62
|
*/
|
|
63
|
-
|
|
63
|
+
var defaultIconDimensions = Object.freeze({
|
|
64
64
|
left: 0,
|
|
65
65
|
top: 0,
|
|
66
66
|
width: 16,
|
|
67
67
|
height: 16
|
|
68
68
|
});
|
|
69
|
-
|
|
69
|
+
var defaultIconTransformations = Object.freeze({
|
|
70
70
|
rotate: 0,
|
|
71
71
|
vFlip: false,
|
|
72
72
|
hFlip: false
|
|
73
73
|
});
|
|
74
|
-
|
|
74
|
+
var defaultIconProps = Object.freeze({
|
|
75
75
|
...defaultIconDimensions,
|
|
76
76
|
...defaultIconTransformations
|
|
77
77
|
});
|
|
78
|
-
|
|
78
|
+
var defaultExtendedIconProps = Object.freeze({
|
|
79
79
|
...defaultIconProps,
|
|
80
80
|
body: "",
|
|
81
81
|
hidden: false
|
|
82
82
|
});
|
|
83
|
-
|
|
83
|
+
var defaultIconSizeCustomisations = Object.freeze({
|
|
84
84
|
width: null,
|
|
85
85
|
height: null
|
|
86
86
|
});
|
|
87
|
-
|
|
87
|
+
var defaultIconCustomisations = Object.freeze({
|
|
88
88
|
...defaultIconSizeCustomisations,
|
|
89
89
|
...defaultIconTransformations
|
|
90
90
|
});
|
|
@@ -115,7 +115,7 @@ function rotateFromString(value, defaultValue = 0) {
|
|
|
115
115
|
}
|
|
116
116
|
return defaultValue;
|
|
117
117
|
}
|
|
118
|
-
|
|
118
|
+
var separator = /[\s,]+/;
|
|
119
119
|
function flipFromString(custom, flip) {
|
|
120
120
|
flip.split(separator).forEach(str => {
|
|
121
121
|
switch (str.trim()) {
|
|
@@ -128,7 +128,7 @@ function flipFromString(custom, flip) {
|
|
|
128
128
|
}
|
|
129
129
|
});
|
|
130
130
|
}
|
|
131
|
-
|
|
131
|
+
var defaultCustomisations = {
|
|
132
132
|
...defaultIconCustomisations,
|
|
133
133
|
preserveAspectRatio: ""
|
|
134
134
|
};
|
|
@@ -154,8 +154,8 @@ function haveCustomisationsChanged(value1, value2) {
|
|
|
154
154
|
for (const key in defaultCustomisations) if (value1[key] !== value2[key]) return true;
|
|
155
155
|
return false;
|
|
156
156
|
}
|
|
157
|
-
|
|
158
|
-
|
|
157
|
+
var matchIconName = /^[a-z0-9]+(-[a-z0-9]+)*$/;
|
|
158
|
+
var stringToIcon = (value, validate, allowSimpleName, provider = "") => {
|
|
159
159
|
const colonSeparated = value.split(":");
|
|
160
160
|
if (value.slice(0, 1) === "@") {
|
|
161
161
|
if (colonSeparated.length < 2 || colonSeparated.length > 3) return null;
|
|
@@ -192,7 +192,7 @@ const stringToIcon = (value, validate, allowSimpleName, provider = "") => {
|
|
|
192
192
|
}
|
|
193
193
|
return null;
|
|
194
194
|
};
|
|
195
|
-
|
|
195
|
+
var validateIconName = (icon, allowSimpleName) => {
|
|
196
196
|
if (!icon) return false;
|
|
197
197
|
return !!((allowSimpleName && icon.prefix === "" || !!icon.prefix) && !!icon.name);
|
|
198
198
|
};
|
|
@@ -256,7 +256,7 @@ function parseIconSet(data, callback) {
|
|
|
256
256
|
}
|
|
257
257
|
return names;
|
|
258
258
|
}
|
|
259
|
-
|
|
259
|
+
var optionalPropertyDefaults = {
|
|
260
260
|
provider: "",
|
|
261
261
|
aliases: {},
|
|
262
262
|
not_found: {},
|
|
@@ -284,7 +284,7 @@ function quicklyValidateIconSet(obj) {
|
|
|
284
284
|
}
|
|
285
285
|
return data;
|
|
286
286
|
}
|
|
287
|
-
|
|
287
|
+
var dataStorage = /* @__PURE__ */Object.create(null);
|
|
288
288
|
function newStorage(provider, prefix) {
|
|
289
289
|
return {
|
|
290
290
|
provider,
|
|
@@ -324,7 +324,7 @@ function listIcons$1(provider, prefix) {
|
|
|
324
324
|
});
|
|
325
325
|
return allIcons;
|
|
326
326
|
}
|
|
327
|
-
|
|
327
|
+
var simpleNames = false;
|
|
328
328
|
function allowSimpleNames(allow) {
|
|
329
329
|
if (typeof allow === "boolean") simpleNames = allow;
|
|
330
330
|
return simpleNames;
|
|
@@ -457,7 +457,7 @@ function updateCallbacks(storage) {
|
|
|
457
457
|
});
|
|
458
458
|
}
|
|
459
459
|
}
|
|
460
|
-
|
|
460
|
+
var idCounter = 0;
|
|
461
461
|
function storeCallback(callback, icons, pendingSources) {
|
|
462
462
|
const id = idCounter++;
|
|
463
463
|
const abort = removeCallback.bind(null, pendingSources, id);
|
|
@@ -473,7 +473,7 @@ function storeCallback(callback, icons, pendingSources) {
|
|
|
473
473
|
});
|
|
474
474
|
return abort;
|
|
475
475
|
}
|
|
476
|
-
|
|
476
|
+
var storage = /* @__PURE__ */Object.create(null);
|
|
477
477
|
function setAPIModule(provider, item) {
|
|
478
478
|
storage[provider] = item;
|
|
479
479
|
}
|
|
@@ -674,9 +674,9 @@ function createAPIConfig(source) {
|
|
|
674
674
|
dataAfterTimeout: source.dataAfterTimeout !== false
|
|
675
675
|
};
|
|
676
676
|
}
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
677
|
+
var configStorage = /* @__PURE__ */Object.create(null);
|
|
678
|
+
var fallBackAPISources = ["https://api.simplesvg.com", "https://api.unisvg.com"];
|
|
679
|
+
var fallBackAPI = [];
|
|
680
680
|
while (fallBackAPISources.length > 0) if (fallBackAPISources.length === 1) fallBackAPI.push(fallBackAPISources.shift());else if (Math.random() > .5) fallBackAPI.push(fallBackAPISources.shift());else fallBackAPI.push(fallBackAPISources.pop());
|
|
681
681
|
configStorage[""] = createAPIConfig({
|
|
682
682
|
resources: ["https://api.iconify.design"].concat(fallBackAPI)
|
|
@@ -694,7 +694,7 @@ function listAPIProviders() {
|
|
|
694
694
|
return Object.keys(configStorage);
|
|
695
695
|
}
|
|
696
696
|
function emptyCallback$1() {}
|
|
697
|
-
|
|
697
|
+
var redundancyCache = /* @__PURE__ */Object.create(null);
|
|
698
698
|
function getRedundancyCache(provider) {
|
|
699
699
|
if (!redundancyCache[provider]) {
|
|
700
700
|
const config = getAPIConfig(provider);
|
|
@@ -831,7 +831,7 @@ function loadNewIcons(storage, icons) {
|
|
|
831
831
|
});
|
|
832
832
|
}
|
|
833
833
|
}
|
|
834
|
-
|
|
834
|
+
var loadIcons$1 = (icons, callback) => {
|
|
835
835
|
const sortedIcons = sortIcons(listToIcons(icons, true, allowSimpleNames()));
|
|
836
836
|
if (!sortedIcons.pending.length) {
|
|
837
837
|
let callCallback = true;
|
|
@@ -876,7 +876,7 @@ const loadIcons$1 = (icons, callback) => {
|
|
|
876
876
|
});
|
|
877
877
|
return callback ? storeCallback(callback, sortedIcons, sources) : emptyCallback;
|
|
878
878
|
};
|
|
879
|
-
|
|
879
|
+
var loadIcon$1 = icon => {
|
|
880
880
|
return new Promise((fulfill, reject) => {
|
|
881
881
|
const iconObj = typeof icon === "string" ? stringToIcon(icon, true) : icon;
|
|
882
882
|
if (!iconObj) {
|
|
@@ -943,7 +943,7 @@ function parseIconValue(value, onload) {
|
|
|
943
943
|
loading: loadIcons$1([name], () => onload(value, name, getIconData(name)))
|
|
944
944
|
};
|
|
945
945
|
}
|
|
946
|
-
|
|
946
|
+
var isBuggedSafari = false;
|
|
947
947
|
try {
|
|
948
948
|
isBuggedSafari = navigator.vendor.indexOf("Apple") === 0;
|
|
949
949
|
} catch (err) {}
|
|
@@ -960,8 +960,8 @@ function getRenderMode(body, mode) {
|
|
|
960
960
|
if (mode !== "style" && (isBuggedSafari || body.indexOf("<a") === -1)) return "svg";
|
|
961
961
|
return body.indexOf("currentColor") === -1 ? "bg" : "mask";
|
|
962
962
|
}
|
|
963
|
-
|
|
964
|
-
|
|
963
|
+
var unitsSplit = /(-?[0-9.]*[0-9]+[0-9.]*)/g;
|
|
964
|
+
var unitsTest = /^-?[0-9.]*[0-9]+[0-9.]*$/g;
|
|
965
965
|
function calculateSize$1(size, ratio, precision) {
|
|
966
966
|
if (ratio === 1) return size;
|
|
967
967
|
precision = precision || 100;
|
|
@@ -1006,7 +1006,7 @@ function wrapSVGContent(body, start, end) {
|
|
|
1006
1006
|
const split = splitSVGDefs(body);
|
|
1007
1007
|
return mergeDefsAndContent(split.defs, start + split.content + end);
|
|
1008
1008
|
}
|
|
1009
|
-
|
|
1009
|
+
var isUnsetKeyword = value => value === "unset" || value === "undefined" || value === "none";
|
|
1010
1010
|
function iconToSVG(icon, customisations) {
|
|
1011
1011
|
const fullIcon = {
|
|
1012
1012
|
...defaultIconProps,
|
|
@@ -1110,14 +1110,14 @@ function svgToData(svg) {
|
|
|
1110
1110
|
function svgToURL$1(svg) {
|
|
1111
1111
|
return "url(\"" + svgToData(svg) + "\")";
|
|
1112
1112
|
}
|
|
1113
|
-
|
|
1113
|
+
var detectFetch = () => {
|
|
1114
1114
|
let callback;
|
|
1115
1115
|
try {
|
|
1116
1116
|
callback = fetch;
|
|
1117
1117
|
if (typeof callback === "function") return callback;
|
|
1118
1118
|
} catch (err) {}
|
|
1119
1119
|
};
|
|
1120
|
-
|
|
1120
|
+
var fetchModule = detectFetch();
|
|
1121
1121
|
function setFetch(fetch2) {
|
|
1122
1122
|
fetchModule = fetch2;
|
|
1123
1123
|
}
|
|
@@ -1141,7 +1141,7 @@ function calculateMaxLength(provider, prefix) {
|
|
|
1141
1141
|
function shouldAbort(status) {
|
|
1142
1142
|
return status === 404;
|
|
1143
1143
|
}
|
|
1144
|
-
|
|
1144
|
+
var prepare = (provider, prefix, icons) => {
|
|
1145
1145
|
const results = [];
|
|
1146
1146
|
const maxLength = calculateMaxLength(provider, prefix);
|
|
1147
1147
|
const type = "icons";
|
|
@@ -1176,7 +1176,7 @@ function getPath(provider) {
|
|
|
1176
1176
|
}
|
|
1177
1177
|
return "/";
|
|
1178
1178
|
}
|
|
1179
|
-
|
|
1179
|
+
var send = (host, params, callback) => {
|
|
1180
1180
|
if (!fetchModule) {
|
|
1181
1181
|
callback("abort", 424);
|
|
1182
1182
|
return;
|
|
@@ -1228,7 +1228,7 @@ const send = (host, params, callback) => {
|
|
|
1228
1228
|
callback("next", defaultError);
|
|
1229
1229
|
});
|
|
1230
1230
|
};
|
|
1231
|
-
|
|
1231
|
+
var fetchAPIModule = {
|
|
1232
1232
|
prepare,
|
|
1233
1233
|
send
|
|
1234
1234
|
};
|
|
@@ -1241,11 +1241,11 @@ function setCustomIconLoader$1(loader, prefix, provider) {
|
|
|
1241
1241
|
/**
|
|
1242
1242
|
* Attribute to add
|
|
1243
1243
|
*/
|
|
1244
|
-
|
|
1244
|
+
var nodeAttr = "data-style";
|
|
1245
1245
|
/**
|
|
1246
1246
|
* Custom style to add to each node
|
|
1247
1247
|
*/
|
|
1248
|
-
|
|
1248
|
+
var customStyle = "";
|
|
1249
1249
|
/**
|
|
1250
1250
|
* Set custom style to add to all components
|
|
1251
1251
|
*
|
|
@@ -1334,18 +1334,18 @@ function exportFunctions() {
|
|
|
1334
1334
|
}
|
|
1335
1335
|
};
|
|
1336
1336
|
}
|
|
1337
|
-
|
|
1337
|
+
var monotoneProps = {
|
|
1338
1338
|
"background-color": "currentColor"
|
|
1339
1339
|
};
|
|
1340
|
-
|
|
1340
|
+
var coloredProps = {
|
|
1341
1341
|
"background-color": "transparent"
|
|
1342
1342
|
};
|
|
1343
|
-
|
|
1343
|
+
var propsToAdd = {
|
|
1344
1344
|
image: "var(--svg)",
|
|
1345
1345
|
repeat: "no-repeat",
|
|
1346
1346
|
size: "100% 100%"
|
|
1347
1347
|
};
|
|
1348
|
-
|
|
1348
|
+
var propsToAddTo = {
|
|
1349
1349
|
"-webkit-mask": monotoneProps,
|
|
1350
1350
|
"mask": monotoneProps,
|
|
1351
1351
|
"background": coloredProps
|
|
@@ -1383,7 +1383,7 @@ function renderSPAN(data, icon, useMask) {
|
|
|
1383
1383
|
for (const prop in styles) svgStyle.setProperty(prop, styles[prop]);
|
|
1384
1384
|
return node;
|
|
1385
1385
|
}
|
|
1386
|
-
|
|
1386
|
+
var policy;
|
|
1387
1387
|
function createPolicy() {
|
|
1388
1388
|
try {
|
|
1389
1389
|
policy = window.trustedTypes.createPolicy("iconify", {
|
|
@@ -1726,11 +1726,11 @@ function defineIconifyIcon(name = "iconify-icon") {
|
|
|
1726
1726
|
/**
|
|
1727
1727
|
* Create exported data: either component instance or functions
|
|
1728
1728
|
*/
|
|
1729
|
-
|
|
1729
|
+
var IconifyIconComponent = defineIconifyIcon() || exportFunctions();
|
|
1730
1730
|
/**
|
|
1731
1731
|
* Export functions
|
|
1732
1732
|
*/
|
|
1733
|
-
|
|
1733
|
+
var {
|
|
1734
1734
|
enableCache,
|
|
1735
1735
|
disableCache,
|
|
1736
1736
|
iconLoaded,
|
|
@@ -1771,7 +1771,7 @@ var Icon$1 = react$1.default.forwardRef((props, ref) => {
|
|
|
1771
1771
|
*
|
|
1772
1772
|
* Set `noobserver={false}` only when you need Iconify observer updates enabled.
|
|
1773
1773
|
*/
|
|
1774
|
-
|
|
1774
|
+
var Icon = react.forwardRef((props, ref) => {
|
|
1775
1775
|
const {
|
|
1776
1776
|
noobserver = true,
|
|
1777
1777
|
...restProps
|
|
@@ -1789,7 +1789,7 @@ Icon.displayName = "Icon";
|
|
|
1789
1789
|
|
|
1790
1790
|
//#endregion
|
|
1791
1791
|
//#region src/useIsDesktop.ts
|
|
1792
|
-
|
|
1792
|
+
var useIsDesktop = () => {
|
|
1793
1793
|
return {
|
|
1794
1794
|
isDesktop: (0, _ttoss_ui.useBreakpointIndex)() >= 2
|
|
1795
1795
|
};
|
|
@@ -1797,11 +1797,11 @@ const useIsDesktop = () => {
|
|
|
1797
1797
|
|
|
1798
1798
|
//#endregion
|
|
1799
1799
|
//#region src/components/LayoutProvider.tsx
|
|
1800
|
-
|
|
1800
|
+
var LayoutContext = react.createContext({
|
|
1801
1801
|
isSidebarOpen: true,
|
|
1802
1802
|
toggleSidebar: () => {}
|
|
1803
1803
|
});
|
|
1804
|
-
|
|
1804
|
+
var LayoutProvider = ({
|
|
1805
1805
|
children
|
|
1806
1806
|
}) => {
|
|
1807
1807
|
const [isSidebarOpen, setIsSidebarOpen] = react.useState(true);
|
|
@@ -1829,7 +1829,7 @@ const LayoutProvider = ({
|
|
|
1829
1829
|
children
|
|
1830
1830
|
});
|
|
1831
1831
|
};
|
|
1832
|
-
|
|
1832
|
+
var useLayout = () => {
|
|
1833
1833
|
const context = react.useContext(LayoutContext);
|
|
1834
1834
|
if (!context) throw new Error("useLayout must be used within a LayoutProvider");
|
|
1835
1835
|
return context;
|
|
@@ -1837,8 +1837,8 @@ const useLayout = () => {
|
|
|
1837
1837
|
|
|
1838
1838
|
//#endregion
|
|
1839
1839
|
//#region src/components/Sidebar.tsx
|
|
1840
|
-
|
|
1841
|
-
|
|
1840
|
+
var SIDEBAR_WIDTH = "2xs";
|
|
1841
|
+
var Sidebar = ({
|
|
1842
1842
|
drawerSlot,
|
|
1843
1843
|
showSidebarButtonInDrawer,
|
|
1844
1844
|
children,
|
|
@@ -1956,11 +1956,11 @@ Sidebar.displayName = "Sidebar";
|
|
|
1956
1956
|
|
|
1957
1957
|
//#endregion
|
|
1958
1958
|
//#region src/components/Header.tsx
|
|
1959
|
-
|
|
1959
|
+
var paddingSx = {
|
|
1960
1960
|
paddingX: "4",
|
|
1961
1961
|
paddingY: "3"
|
|
1962
1962
|
};
|
|
1963
|
-
|
|
1963
|
+
var Header = ({
|
|
1964
1964
|
showSidebarButton,
|
|
1965
1965
|
sidebarSlot,
|
|
1966
1966
|
children,
|
|
@@ -2037,7 +2037,7 @@ Header.displayName = "Header";
|
|
|
2037
2037
|
|
|
2038
2038
|
//#endregion
|
|
2039
2039
|
//#region src/components/MainBody.tsx
|
|
2040
|
-
|
|
2040
|
+
var MainBody = ({
|
|
2041
2041
|
containerSx,
|
|
2042
2042
|
...props
|
|
2043
2043
|
}) => {
|
|
@@ -2065,7 +2065,7 @@ MainBody.displayName = "MainBody";
|
|
|
2065
2065
|
|
|
2066
2066
|
//#endregion
|
|
2067
2067
|
//#region src/components/MainFooter.tsx
|
|
2068
|
-
|
|
2068
|
+
var MainFooter = ({
|
|
2069
2069
|
containerSx,
|
|
2070
2070
|
...props
|
|
2071
2071
|
}) => {
|
|
@@ -2092,7 +2092,7 @@ MainFooter.displayName = "MainFooter";
|
|
|
2092
2092
|
|
|
2093
2093
|
//#endregion
|
|
2094
2094
|
//#region src/components/MainHeader.tsx
|
|
2095
|
-
|
|
2095
|
+
var MainHeader = ({
|
|
2096
2096
|
containerSx,
|
|
2097
2097
|
...props
|
|
2098
2098
|
}) => {
|
|
@@ -2120,7 +2120,7 @@ MainHeader.displayName = "MainHeader";
|
|
|
2120
2120
|
|
|
2121
2121
|
//#endregion
|
|
2122
2122
|
//#region src/components/Main.tsx
|
|
2123
|
-
|
|
2123
|
+
var Main = props => {
|
|
2124
2124
|
return /* @__PURE__ */(0, react_jsx_runtime.jsx)(_ttoss_ui.Box, {
|
|
2125
2125
|
variant: "layout.main",
|
|
2126
2126
|
sx: {
|
|
@@ -2140,7 +2140,7 @@ Main.Footer = MainFooter;
|
|
|
2140
2140
|
|
|
2141
2141
|
//#endregion
|
|
2142
2142
|
//#region src/components/Layout.tsx
|
|
2143
|
-
|
|
2143
|
+
var Layout = ({
|
|
2144
2144
|
children
|
|
2145
2145
|
}) => {
|
|
2146
2146
|
return /* @__PURE__ */(0, react_jsx_runtime.jsx)(_ttoss_ui.Box, {
|
|
@@ -2156,7 +2156,7 @@ Layout.Container = _ttoss_ui.Container;
|
|
|
2156
2156
|
|
|
2157
2157
|
//#endregion
|
|
2158
2158
|
//#region src/getSemanticElements.ts
|
|
2159
|
-
|
|
2159
|
+
var semanticComponents = {
|
|
2160
2160
|
Header: "header",
|
|
2161
2161
|
Sidebar: "sidebar",
|
|
2162
2162
|
Footer: "footer",
|
|
@@ -2169,7 +2169,7 @@ const semanticComponents = {
|
|
|
2169
2169
|
* It's not worth to use React hooks here because children props always
|
|
2170
2170
|
* change when the parent component re-renders.
|
|
2171
2171
|
*/
|
|
2172
|
-
|
|
2172
|
+
var getSematicElements = ({
|
|
2173
2173
|
children
|
|
2174
2174
|
}) => {
|
|
2175
2175
|
const semanticElements = {};
|
|
@@ -2183,7 +2183,7 @@ const getSematicElements = ({
|
|
|
2183
2183
|
|
|
2184
2184
|
//#endregion
|
|
2185
2185
|
//#region src/components/SidebarCollapseLayout.tsx
|
|
2186
|
-
|
|
2186
|
+
var SidebarCollapseLayout = ({
|
|
2187
2187
|
children,
|
|
2188
2188
|
...props
|
|
2189
2189
|
}) => {
|
|
@@ -2218,7 +2218,7 @@ const SidebarCollapseLayout = ({
|
|
|
2218
2218
|
|
|
2219
2219
|
//#endregion
|
|
2220
2220
|
//#region src/components/StackedLayout.tsx
|
|
2221
|
-
|
|
2221
|
+
var StackedLayout = ({
|
|
2222
2222
|
children,
|
|
2223
2223
|
...props
|
|
2224
2224
|
}) => {
|
package/dist/index.mjs
CHANGED
|
@@ -6,7 +6,7 @@ import React from "react";
|
|
|
6
6
|
import { Drawer } from "@ttoss/components/Drawer";
|
|
7
7
|
|
|
8
8
|
//#region src/components/Footer.tsx
|
|
9
|
-
|
|
9
|
+
var Footer = props => {
|
|
10
10
|
return /* @__PURE__ */jsx(Box, {
|
|
11
11
|
variant: "layout.footer",
|
|
12
12
|
...props,
|
|
@@ -29,31 +29,31 @@ Footer.displayName = "Footer";
|
|
|
29
29
|
* @license MIT
|
|
30
30
|
* @version 2.3.0
|
|
31
31
|
*/
|
|
32
|
-
|
|
32
|
+
var defaultIconDimensions = Object.freeze({
|
|
33
33
|
left: 0,
|
|
34
34
|
top: 0,
|
|
35
35
|
width: 16,
|
|
36
36
|
height: 16
|
|
37
37
|
});
|
|
38
|
-
|
|
38
|
+
var defaultIconTransformations = Object.freeze({
|
|
39
39
|
rotate: 0,
|
|
40
40
|
vFlip: false,
|
|
41
41
|
hFlip: false
|
|
42
42
|
});
|
|
43
|
-
|
|
43
|
+
var defaultIconProps = Object.freeze({
|
|
44
44
|
...defaultIconDimensions,
|
|
45
45
|
...defaultIconTransformations
|
|
46
46
|
});
|
|
47
|
-
|
|
47
|
+
var defaultExtendedIconProps = Object.freeze({
|
|
48
48
|
...defaultIconProps,
|
|
49
49
|
body: "",
|
|
50
50
|
hidden: false
|
|
51
51
|
});
|
|
52
|
-
|
|
52
|
+
var defaultIconSizeCustomisations = Object.freeze({
|
|
53
53
|
width: null,
|
|
54
54
|
height: null
|
|
55
55
|
});
|
|
56
|
-
|
|
56
|
+
var defaultIconCustomisations = Object.freeze({
|
|
57
57
|
...defaultIconSizeCustomisations,
|
|
58
58
|
...defaultIconTransformations
|
|
59
59
|
});
|
|
@@ -84,7 +84,7 @@ function rotateFromString(value, defaultValue = 0) {
|
|
|
84
84
|
}
|
|
85
85
|
return defaultValue;
|
|
86
86
|
}
|
|
87
|
-
|
|
87
|
+
var separator = /[\s,]+/;
|
|
88
88
|
function flipFromString(custom, flip) {
|
|
89
89
|
flip.split(separator).forEach(str => {
|
|
90
90
|
switch (str.trim()) {
|
|
@@ -97,7 +97,7 @@ function flipFromString(custom, flip) {
|
|
|
97
97
|
}
|
|
98
98
|
});
|
|
99
99
|
}
|
|
100
|
-
|
|
100
|
+
var defaultCustomisations = {
|
|
101
101
|
...defaultIconCustomisations,
|
|
102
102
|
preserveAspectRatio: ""
|
|
103
103
|
};
|
|
@@ -123,8 +123,8 @@ function haveCustomisationsChanged(value1, value2) {
|
|
|
123
123
|
for (const key in defaultCustomisations) if (value1[key] !== value2[key]) return true;
|
|
124
124
|
return false;
|
|
125
125
|
}
|
|
126
|
-
|
|
127
|
-
|
|
126
|
+
var matchIconName = /^[a-z0-9]+(-[a-z0-9]+)*$/;
|
|
127
|
+
var stringToIcon = (value, validate, allowSimpleName, provider = "") => {
|
|
128
128
|
const colonSeparated = value.split(":");
|
|
129
129
|
if (value.slice(0, 1) === "@") {
|
|
130
130
|
if (colonSeparated.length < 2 || colonSeparated.length > 3) return null;
|
|
@@ -161,7 +161,7 @@ const stringToIcon = (value, validate, allowSimpleName, provider = "") => {
|
|
|
161
161
|
}
|
|
162
162
|
return null;
|
|
163
163
|
};
|
|
164
|
-
|
|
164
|
+
var validateIconName = (icon, allowSimpleName) => {
|
|
165
165
|
if (!icon) return false;
|
|
166
166
|
return !!((allowSimpleName && icon.prefix === "" || !!icon.prefix) && !!icon.name);
|
|
167
167
|
};
|
|
@@ -225,7 +225,7 @@ function parseIconSet(data, callback) {
|
|
|
225
225
|
}
|
|
226
226
|
return names;
|
|
227
227
|
}
|
|
228
|
-
|
|
228
|
+
var optionalPropertyDefaults = {
|
|
229
229
|
provider: "",
|
|
230
230
|
aliases: {},
|
|
231
231
|
not_found: {},
|
|
@@ -253,7 +253,7 @@ function quicklyValidateIconSet(obj) {
|
|
|
253
253
|
}
|
|
254
254
|
return data;
|
|
255
255
|
}
|
|
256
|
-
|
|
256
|
+
var dataStorage = /* @__PURE__ */Object.create(null);
|
|
257
257
|
function newStorage(provider, prefix) {
|
|
258
258
|
return {
|
|
259
259
|
provider,
|
|
@@ -293,7 +293,7 @@ function listIcons$1(provider, prefix) {
|
|
|
293
293
|
});
|
|
294
294
|
return allIcons;
|
|
295
295
|
}
|
|
296
|
-
|
|
296
|
+
var simpleNames = false;
|
|
297
297
|
function allowSimpleNames(allow) {
|
|
298
298
|
if (typeof allow === "boolean") simpleNames = allow;
|
|
299
299
|
return simpleNames;
|
|
@@ -426,7 +426,7 @@ function updateCallbacks(storage) {
|
|
|
426
426
|
});
|
|
427
427
|
}
|
|
428
428
|
}
|
|
429
|
-
|
|
429
|
+
var idCounter = 0;
|
|
430
430
|
function storeCallback(callback, icons, pendingSources) {
|
|
431
431
|
const id = idCounter++;
|
|
432
432
|
const abort = removeCallback.bind(null, pendingSources, id);
|
|
@@ -442,7 +442,7 @@ function storeCallback(callback, icons, pendingSources) {
|
|
|
442
442
|
});
|
|
443
443
|
return abort;
|
|
444
444
|
}
|
|
445
|
-
|
|
445
|
+
var storage = /* @__PURE__ */Object.create(null);
|
|
446
446
|
function setAPIModule(provider, item) {
|
|
447
447
|
storage[provider] = item;
|
|
448
448
|
}
|
|
@@ -643,9 +643,9 @@ function createAPIConfig(source) {
|
|
|
643
643
|
dataAfterTimeout: source.dataAfterTimeout !== false
|
|
644
644
|
};
|
|
645
645
|
}
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
646
|
+
var configStorage = /* @__PURE__ */Object.create(null);
|
|
647
|
+
var fallBackAPISources = ["https://api.simplesvg.com", "https://api.unisvg.com"];
|
|
648
|
+
var fallBackAPI = [];
|
|
649
649
|
while (fallBackAPISources.length > 0) if (fallBackAPISources.length === 1) fallBackAPI.push(fallBackAPISources.shift());else if (Math.random() > .5) fallBackAPI.push(fallBackAPISources.shift());else fallBackAPI.push(fallBackAPISources.pop());
|
|
650
650
|
configStorage[""] = createAPIConfig({
|
|
651
651
|
resources: ["https://api.iconify.design"].concat(fallBackAPI)
|
|
@@ -663,7 +663,7 @@ function listAPIProviders() {
|
|
|
663
663
|
return Object.keys(configStorage);
|
|
664
664
|
}
|
|
665
665
|
function emptyCallback$1() {}
|
|
666
|
-
|
|
666
|
+
var redundancyCache = /* @__PURE__ */Object.create(null);
|
|
667
667
|
function getRedundancyCache(provider) {
|
|
668
668
|
if (!redundancyCache[provider]) {
|
|
669
669
|
const config = getAPIConfig(provider);
|
|
@@ -800,7 +800,7 @@ function loadNewIcons(storage, icons) {
|
|
|
800
800
|
});
|
|
801
801
|
}
|
|
802
802
|
}
|
|
803
|
-
|
|
803
|
+
var loadIcons$1 = (icons, callback) => {
|
|
804
804
|
const sortedIcons = sortIcons(listToIcons(icons, true, allowSimpleNames()));
|
|
805
805
|
if (!sortedIcons.pending.length) {
|
|
806
806
|
let callCallback = true;
|
|
@@ -845,7 +845,7 @@ const loadIcons$1 = (icons, callback) => {
|
|
|
845
845
|
});
|
|
846
846
|
return callback ? storeCallback(callback, sortedIcons, sources) : emptyCallback;
|
|
847
847
|
};
|
|
848
|
-
|
|
848
|
+
var loadIcon$1 = icon => {
|
|
849
849
|
return new Promise((fulfill, reject) => {
|
|
850
850
|
const iconObj = typeof icon === "string" ? stringToIcon(icon, true) : icon;
|
|
851
851
|
if (!iconObj) {
|
|
@@ -912,7 +912,7 @@ function parseIconValue(value, onload) {
|
|
|
912
912
|
loading: loadIcons$1([name], () => onload(value, name, getIconData(name)))
|
|
913
913
|
};
|
|
914
914
|
}
|
|
915
|
-
|
|
915
|
+
var isBuggedSafari = false;
|
|
916
916
|
try {
|
|
917
917
|
isBuggedSafari = navigator.vendor.indexOf("Apple") === 0;
|
|
918
918
|
} catch (err) {}
|
|
@@ -929,8 +929,8 @@ function getRenderMode(body, mode) {
|
|
|
929
929
|
if (mode !== "style" && (isBuggedSafari || body.indexOf("<a") === -1)) return "svg";
|
|
930
930
|
return body.indexOf("currentColor") === -1 ? "bg" : "mask";
|
|
931
931
|
}
|
|
932
|
-
|
|
933
|
-
|
|
932
|
+
var unitsSplit = /(-?[0-9.]*[0-9]+[0-9.]*)/g;
|
|
933
|
+
var unitsTest = /^-?[0-9.]*[0-9]+[0-9.]*$/g;
|
|
934
934
|
function calculateSize$1(size, ratio, precision) {
|
|
935
935
|
if (ratio === 1) return size;
|
|
936
936
|
precision = precision || 100;
|
|
@@ -975,7 +975,7 @@ function wrapSVGContent(body, start, end) {
|
|
|
975
975
|
const split = splitSVGDefs(body);
|
|
976
976
|
return mergeDefsAndContent(split.defs, start + split.content + end);
|
|
977
977
|
}
|
|
978
|
-
|
|
978
|
+
var isUnsetKeyword = value => value === "unset" || value === "undefined" || value === "none";
|
|
979
979
|
function iconToSVG(icon, customisations) {
|
|
980
980
|
const fullIcon = {
|
|
981
981
|
...defaultIconProps,
|
|
@@ -1079,14 +1079,14 @@ function svgToData(svg) {
|
|
|
1079
1079
|
function svgToURL$1(svg) {
|
|
1080
1080
|
return "url(\"" + svgToData(svg) + "\")";
|
|
1081
1081
|
}
|
|
1082
|
-
|
|
1082
|
+
var detectFetch = () => {
|
|
1083
1083
|
let callback;
|
|
1084
1084
|
try {
|
|
1085
1085
|
callback = fetch;
|
|
1086
1086
|
if (typeof callback === "function") return callback;
|
|
1087
1087
|
} catch (err) {}
|
|
1088
1088
|
};
|
|
1089
|
-
|
|
1089
|
+
var fetchModule = detectFetch();
|
|
1090
1090
|
function setFetch(fetch2) {
|
|
1091
1091
|
fetchModule = fetch2;
|
|
1092
1092
|
}
|
|
@@ -1110,7 +1110,7 @@ function calculateMaxLength(provider, prefix) {
|
|
|
1110
1110
|
function shouldAbort(status) {
|
|
1111
1111
|
return status === 404;
|
|
1112
1112
|
}
|
|
1113
|
-
|
|
1113
|
+
var prepare = (provider, prefix, icons) => {
|
|
1114
1114
|
const results = [];
|
|
1115
1115
|
const maxLength = calculateMaxLength(provider, prefix);
|
|
1116
1116
|
const type = "icons";
|
|
@@ -1145,7 +1145,7 @@ function getPath(provider) {
|
|
|
1145
1145
|
}
|
|
1146
1146
|
return "/";
|
|
1147
1147
|
}
|
|
1148
|
-
|
|
1148
|
+
var send = (host, params, callback) => {
|
|
1149
1149
|
if (!fetchModule) {
|
|
1150
1150
|
callback("abort", 424);
|
|
1151
1151
|
return;
|
|
@@ -1197,7 +1197,7 @@ const send = (host, params, callback) => {
|
|
|
1197
1197
|
callback("next", defaultError);
|
|
1198
1198
|
});
|
|
1199
1199
|
};
|
|
1200
|
-
|
|
1200
|
+
var fetchAPIModule = {
|
|
1201
1201
|
prepare,
|
|
1202
1202
|
send
|
|
1203
1203
|
};
|
|
@@ -1210,11 +1210,11 @@ function setCustomIconLoader$1(loader, prefix, provider) {
|
|
|
1210
1210
|
/**
|
|
1211
1211
|
* Attribute to add
|
|
1212
1212
|
*/
|
|
1213
|
-
|
|
1213
|
+
var nodeAttr = "data-style";
|
|
1214
1214
|
/**
|
|
1215
1215
|
* Custom style to add to each node
|
|
1216
1216
|
*/
|
|
1217
|
-
|
|
1217
|
+
var customStyle = "";
|
|
1218
1218
|
/**
|
|
1219
1219
|
* Set custom style to add to all components
|
|
1220
1220
|
*
|
|
@@ -1303,18 +1303,18 @@ function exportFunctions() {
|
|
|
1303
1303
|
}
|
|
1304
1304
|
};
|
|
1305
1305
|
}
|
|
1306
|
-
|
|
1306
|
+
var monotoneProps = {
|
|
1307
1307
|
"background-color": "currentColor"
|
|
1308
1308
|
};
|
|
1309
|
-
|
|
1309
|
+
var coloredProps = {
|
|
1310
1310
|
"background-color": "transparent"
|
|
1311
1311
|
};
|
|
1312
|
-
|
|
1312
|
+
var propsToAdd = {
|
|
1313
1313
|
image: "var(--svg)",
|
|
1314
1314
|
repeat: "no-repeat",
|
|
1315
1315
|
size: "100% 100%"
|
|
1316
1316
|
};
|
|
1317
|
-
|
|
1317
|
+
var propsToAddTo = {
|
|
1318
1318
|
"-webkit-mask": monotoneProps,
|
|
1319
1319
|
"mask": monotoneProps,
|
|
1320
1320
|
"background": coloredProps
|
|
@@ -1352,7 +1352,7 @@ function renderSPAN(data, icon, useMask) {
|
|
|
1352
1352
|
for (const prop in styles) svgStyle.setProperty(prop, styles[prop]);
|
|
1353
1353
|
return node;
|
|
1354
1354
|
}
|
|
1355
|
-
|
|
1355
|
+
var policy;
|
|
1356
1356
|
function createPolicy() {
|
|
1357
1357
|
try {
|
|
1358
1358
|
policy = window.trustedTypes.createPolicy("iconify", {
|
|
@@ -1695,11 +1695,11 @@ function defineIconifyIcon(name = "iconify-icon") {
|
|
|
1695
1695
|
/**
|
|
1696
1696
|
* Create exported data: either component instance or functions
|
|
1697
1697
|
*/
|
|
1698
|
-
|
|
1698
|
+
var IconifyIconComponent = defineIconifyIcon() || exportFunctions();
|
|
1699
1699
|
/**
|
|
1700
1700
|
* Export functions
|
|
1701
1701
|
*/
|
|
1702
|
-
|
|
1702
|
+
var {
|
|
1703
1703
|
enableCache,
|
|
1704
1704
|
disableCache,
|
|
1705
1705
|
iconLoaded,
|
|
@@ -1740,7 +1740,7 @@ var Icon$1 = React.forwardRef((props, ref) => {
|
|
|
1740
1740
|
*
|
|
1741
1741
|
* Set `noobserver={false}` only when you need Iconify observer updates enabled.
|
|
1742
1742
|
*/
|
|
1743
|
-
|
|
1743
|
+
var Icon = React$1.forwardRef((props, ref) => {
|
|
1744
1744
|
const {
|
|
1745
1745
|
noobserver = true,
|
|
1746
1746
|
...restProps
|
|
@@ -1758,7 +1758,7 @@ Icon.displayName = "Icon";
|
|
|
1758
1758
|
|
|
1759
1759
|
//#endregion
|
|
1760
1760
|
//#region src/useIsDesktop.ts
|
|
1761
|
-
|
|
1761
|
+
var useIsDesktop = () => {
|
|
1762
1762
|
return {
|
|
1763
1763
|
isDesktop: useBreakpointIndex() >= 2
|
|
1764
1764
|
};
|
|
@@ -1766,11 +1766,11 @@ const useIsDesktop = () => {
|
|
|
1766
1766
|
|
|
1767
1767
|
//#endregion
|
|
1768
1768
|
//#region src/components/LayoutProvider.tsx
|
|
1769
|
-
|
|
1769
|
+
var LayoutContext = React$1.createContext({
|
|
1770
1770
|
isSidebarOpen: true,
|
|
1771
1771
|
toggleSidebar: () => {}
|
|
1772
1772
|
});
|
|
1773
|
-
|
|
1773
|
+
var LayoutProvider = ({
|
|
1774
1774
|
children
|
|
1775
1775
|
}) => {
|
|
1776
1776
|
const [isSidebarOpen, setIsSidebarOpen] = React$1.useState(true);
|
|
@@ -1798,7 +1798,7 @@ const LayoutProvider = ({
|
|
|
1798
1798
|
children
|
|
1799
1799
|
});
|
|
1800
1800
|
};
|
|
1801
|
-
|
|
1801
|
+
var useLayout = () => {
|
|
1802
1802
|
const context = React$1.useContext(LayoutContext);
|
|
1803
1803
|
if (!context) throw new Error("useLayout must be used within a LayoutProvider");
|
|
1804
1804
|
return context;
|
|
@@ -1806,8 +1806,8 @@ const useLayout = () => {
|
|
|
1806
1806
|
|
|
1807
1807
|
//#endregion
|
|
1808
1808
|
//#region src/components/Sidebar.tsx
|
|
1809
|
-
|
|
1810
|
-
|
|
1809
|
+
var SIDEBAR_WIDTH = "2xs";
|
|
1810
|
+
var Sidebar = ({
|
|
1811
1811
|
drawerSlot,
|
|
1812
1812
|
showSidebarButtonInDrawer,
|
|
1813
1813
|
children,
|
|
@@ -1925,11 +1925,11 @@ Sidebar.displayName = "Sidebar";
|
|
|
1925
1925
|
|
|
1926
1926
|
//#endregion
|
|
1927
1927
|
//#region src/components/Header.tsx
|
|
1928
|
-
|
|
1928
|
+
var paddingSx = {
|
|
1929
1929
|
paddingX: "4",
|
|
1930
1930
|
paddingY: "3"
|
|
1931
1931
|
};
|
|
1932
|
-
|
|
1932
|
+
var Header = ({
|
|
1933
1933
|
showSidebarButton,
|
|
1934
1934
|
sidebarSlot,
|
|
1935
1935
|
children,
|
|
@@ -2006,7 +2006,7 @@ Header.displayName = "Header";
|
|
|
2006
2006
|
|
|
2007
2007
|
//#endregion
|
|
2008
2008
|
//#region src/components/MainBody.tsx
|
|
2009
|
-
|
|
2009
|
+
var MainBody = ({
|
|
2010
2010
|
containerSx,
|
|
2011
2011
|
...props
|
|
2012
2012
|
}) => {
|
|
@@ -2034,7 +2034,7 @@ MainBody.displayName = "MainBody";
|
|
|
2034
2034
|
|
|
2035
2035
|
//#endregion
|
|
2036
2036
|
//#region src/components/MainFooter.tsx
|
|
2037
|
-
|
|
2037
|
+
var MainFooter = ({
|
|
2038
2038
|
containerSx,
|
|
2039
2039
|
...props
|
|
2040
2040
|
}) => {
|
|
@@ -2061,7 +2061,7 @@ MainFooter.displayName = "MainFooter";
|
|
|
2061
2061
|
|
|
2062
2062
|
//#endregion
|
|
2063
2063
|
//#region src/components/MainHeader.tsx
|
|
2064
|
-
|
|
2064
|
+
var MainHeader = ({
|
|
2065
2065
|
containerSx,
|
|
2066
2066
|
...props
|
|
2067
2067
|
}) => {
|
|
@@ -2089,7 +2089,7 @@ MainHeader.displayName = "MainHeader";
|
|
|
2089
2089
|
|
|
2090
2090
|
//#endregion
|
|
2091
2091
|
//#region src/components/Main.tsx
|
|
2092
|
-
|
|
2092
|
+
var Main = props => {
|
|
2093
2093
|
return /* @__PURE__ */jsx(Box, {
|
|
2094
2094
|
variant: "layout.main",
|
|
2095
2095
|
sx: {
|
|
@@ -2109,7 +2109,7 @@ Main.Footer = MainFooter;
|
|
|
2109
2109
|
|
|
2110
2110
|
//#endregion
|
|
2111
2111
|
//#region src/components/Layout.tsx
|
|
2112
|
-
|
|
2112
|
+
var Layout = ({
|
|
2113
2113
|
children
|
|
2114
2114
|
}) => {
|
|
2115
2115
|
return /* @__PURE__ */jsx(Box, {
|
|
@@ -2125,7 +2125,7 @@ Layout.Container = Container;
|
|
|
2125
2125
|
|
|
2126
2126
|
//#endregion
|
|
2127
2127
|
//#region src/getSemanticElements.ts
|
|
2128
|
-
|
|
2128
|
+
var semanticComponents = {
|
|
2129
2129
|
Header: "header",
|
|
2130
2130
|
Sidebar: "sidebar",
|
|
2131
2131
|
Footer: "footer",
|
|
@@ -2138,7 +2138,7 @@ const semanticComponents = {
|
|
|
2138
2138
|
* It's not worth to use React hooks here because children props always
|
|
2139
2139
|
* change when the parent component re-renders.
|
|
2140
2140
|
*/
|
|
2141
|
-
|
|
2141
|
+
var getSematicElements = ({
|
|
2142
2142
|
children
|
|
2143
2143
|
}) => {
|
|
2144
2144
|
const semanticElements = {};
|
|
@@ -2152,7 +2152,7 @@ const getSematicElements = ({
|
|
|
2152
2152
|
|
|
2153
2153
|
//#endregion
|
|
2154
2154
|
//#region src/components/SidebarCollapseLayout.tsx
|
|
2155
|
-
|
|
2155
|
+
var SidebarCollapseLayout = ({
|
|
2156
2156
|
children,
|
|
2157
2157
|
...props
|
|
2158
2158
|
}) => {
|
|
@@ -2187,7 +2187,7 @@ const SidebarCollapseLayout = ({
|
|
|
2187
2187
|
|
|
2188
2188
|
//#endregion
|
|
2189
2189
|
//#region src/components/StackedLayout.tsx
|
|
2190
|
-
|
|
2190
|
+
var StackedLayout = ({
|
|
2191
2191
|
children,
|
|
2192
2192
|
...props
|
|
2193
2193
|
}) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ttoss/layouts",
|
|
3
|
-
"version": "0.11.
|
|
3
|
+
"version": "0.11.25",
|
|
4
4
|
"description": "Layout components for React",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"React"
|
|
@@ -32,16 +32,16 @@
|
|
|
32
32
|
"jest": "^30.3.0",
|
|
33
33
|
"react": "^19.2.6",
|
|
34
34
|
"tsdown": "^0.22.0",
|
|
35
|
-
"@ttoss/components": "^2.14.
|
|
36
|
-
"@ttoss/react-icons": "^0.7.
|
|
37
|
-
"@ttoss/
|
|
38
|
-
"@ttoss/
|
|
39
|
-
"@ttoss/
|
|
35
|
+
"@ttoss/components": "^2.14.24",
|
|
36
|
+
"@ttoss/react-icons": "^0.7.17",
|
|
37
|
+
"@ttoss/ui": "^6.9.23",
|
|
38
|
+
"@ttoss/test-utils": "^4.2.15",
|
|
39
|
+
"@ttoss/config": "^1.37.15"
|
|
40
40
|
},
|
|
41
41
|
"peerDependencies": {
|
|
42
42
|
"react": ">=16.8.0",
|
|
43
|
-
"@ttoss/components": "^2.14.
|
|
44
|
-
"@ttoss/ui": "^6.9.
|
|
43
|
+
"@ttoss/components": "^2.14.24",
|
|
44
|
+
"@ttoss/ui": "^6.9.23"
|
|
45
45
|
},
|
|
46
46
|
"publishConfig": {
|
|
47
47
|
"access": "public",
|