@solibo/solibo-ui 2.3.0 → 2.3.1
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/index56.css');const v=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../assets/index56.css');const v=require("react/jsx-runtime"),M=require("classix"),s=require("react");function j(t){const[e,r]=s.useState(null),[f,o]=s.useState(),u=!!t&&f!=null,m=s.useCallback(n=>r(n),[]),l=s.useCallback(()=>{if(!e||!t){o(void 0);return}const n=Array.from(e.children).filter(a=>a instanceof HTMLElement&&getComputedStyle(a).display!=="none"),d=t?n[t-1]:void 0,c=t&&n.length>t&&d?d.getBoundingClientRect().bottom-e.getBoundingClientRect().top+e.scrollTop+(parseFloat(getComputedStyle(e).paddingBottom)||0):void 0;o(a=>a!=null&&c!=null&&Math.abs(a-c)<.5?a:c)},[e,t]);return s.useLayoutEffect(l),s.useLayoutEffect(()=>{if(!e||!t)return;const n=typeof ResizeObserver>"u"?void 0:new ResizeObserver(l),d=()=>{n==null||n.disconnect(),n==null||n.observe(e),Array.from(e.children).forEach(a=>n==null?void 0:n.observe(a)),l()},c=new MutationObserver(d);return c.observe(e,{childList:!0,subtree:!0,characterData:!0,attributes:!0,attributeFilter:["class","style","hidden"]}),window.addEventListener("resize",l),d(),()=>{n==null||n.disconnect(),c.disconnect(),window.removeEventListener("resize",l)}},[e,t,l]),{ref:m,isOverflowing:u,visibleHeight:f}}function k(t){return s.isValidElement(t)&&t.type===s.Fragment}function F(t,e=[]){return s.Children.forEach(t,r=>{k(r)?F(r.props.children,e):e.push(r)}),e}function N(t,{wrapper:e="li"}={}){return F(t).filter(o=>o!==null).map((o,u)=>{if(s.isValidElement(o)&&o.type===e)return o;const m=s.isValidElement(o)&&o.key!=null?o.key:u;return s.createElement(e,{key:m,"data-component":"wrapchildren"},o)})}const S="_controls_uue68_1",B="_horizontal_uue68_9",z="_list_uue68_20",H="_columns_uue68_61",q="_masonry_uue68_71",T="_scrollable_uue68_81",V="_overflowing_uue68_88",A="_sized_uue68_111",I="_compact_uue68_123",i={controls:S,horizontal:B,list:z,columns:H,masonry:q,scrollable:T,overflowing:V,sized:A,compact:I},L=(t,e)=>{typeof t=="function"?t(e):t&&(t.current=e)};function D({children:t,className:e,columns:r=1,columnWidth:f,compact:o=!1,controls:u,horizontal:m,layout:l="grid",maxVisibleItems:n,ordered:d,ref:c,style:a,..._}){const y=Number.isFinite(r)?Math.max(1,Math.floor(r)):1,g=l==="grid"&&y===1&&!m&&n!=null&&Number.isFinite(n)&&n>=1?Math.floor(n):void 0,{ref:b,isOverflowing:h,visibleHeight:p}=j(g),w=s.useCallback(R=>{b(R),L(c,R)},[b,c]),E=M(e,i.list,l==="masonry"?i.masonry:y>1&&i.columns,!!g&&i.scrollable,h&&i.overflowing,m&&i.horizontal,o&&i.compact,f&&i.sized),x={...a,"--list-columns":y,"--list-column-width":f,"--list-max-height":g&&p!=null?`${p}px`:void 0},C=d?v.jsx("ol",{className:E,ref:w,style:x,..._,"data-layout":l==="masonry"?"masonry":y>1?"columns":void 0,tabIndex:_.tabIndex??(h?0:void 0),"data-component":"list",children:N(t)}):v.jsx("ul",{className:E,ref:w,style:x,..._,"data-layout":l==="masonry"?"masonry":y>1?"columns":void 0,tabIndex:_.tabIndex??(h?0:void 0),"data-component":"list",children:N(t)});return u==null?C:v.jsxs(v.Fragment,{children:[v.jsx("div",{className:i.controls,"data-component":"list",children:u}),C]})}exports.List=D;
|
|
@@ -1,57 +1,57 @@
|
|
|
1
1
|
import { jsx as h, jsxs as z, Fragment as H } from "react/jsx-runtime";
|
|
2
2
|
import S from "classix";
|
|
3
|
-
import m, { useState as F, useCallback as p, useLayoutEffect as
|
|
3
|
+
import m, { useState as F, useCallback as p, useLayoutEffect as M } from "react";
|
|
4
4
|
import '../../assets/index56.css';function V(t) {
|
|
5
|
-
const [n,
|
|
5
|
+
const [n, r] = F(null), [d, o] = F(), i = !!t && d != null, f = p((e) => r(e), []), s = p(() => {
|
|
6
6
|
if (!n || !t) {
|
|
7
7
|
o(void 0);
|
|
8
8
|
return;
|
|
9
9
|
}
|
|
10
|
-
const e = Array.from(n.children).filter((
|
|
11
|
-
o(
|
|
10
|
+
const e = Array.from(n.children).filter((l) => l instanceof HTMLElement && getComputedStyle(l).display !== "none"), u = t ? e[t - 1] : void 0, a = t && e.length > t && u ? u.getBoundingClientRect().bottom - n.getBoundingClientRect().top + n.scrollTop + (parseFloat(getComputedStyle(n).paddingBottom) || 0) : void 0;
|
|
11
|
+
o((l) => l != null && a != null && Math.abs(l - a) < 0.5 ? l : a);
|
|
12
12
|
}, [n, t]);
|
|
13
|
-
return
|
|
13
|
+
return M(s), M(() => {
|
|
14
14
|
if (!n || !t) return;
|
|
15
|
-
const e = typeof ResizeObserver > "u" ? void 0 : new ResizeObserver(s),
|
|
16
|
-
e == null || e.disconnect(), e == null || e.observe(n), Array.from(n.children).forEach((
|
|
17
|
-
},
|
|
18
|
-
return
|
|
15
|
+
const e = typeof ResizeObserver > "u" ? void 0 : new ResizeObserver(s), u = () => {
|
|
16
|
+
e == null || e.disconnect(), e == null || e.observe(n), Array.from(n.children).forEach((l) => e == null ? void 0 : e.observe(l)), s();
|
|
17
|
+
}, a = new MutationObserver(u);
|
|
18
|
+
return a.observe(n, {
|
|
19
19
|
childList: !0,
|
|
20
20
|
subtree: !0,
|
|
21
21
|
characterData: !0,
|
|
22
22
|
attributes: !0,
|
|
23
23
|
attributeFilter: ["class", "style", "hidden"]
|
|
24
|
-
}), window.addEventListener("resize", s),
|
|
25
|
-
e == null || e.disconnect(),
|
|
24
|
+
}), window.addEventListener("resize", s), u(), () => {
|
|
25
|
+
e == null || e.disconnect(), a.disconnect(), window.removeEventListener("resize", s);
|
|
26
26
|
};
|
|
27
27
|
}, [n, t, s]), {
|
|
28
|
-
ref:
|
|
29
|
-
isOverflowing:
|
|
30
|
-
visibleHeight:
|
|
28
|
+
ref: f,
|
|
29
|
+
isOverflowing: i,
|
|
30
|
+
visibleHeight: d
|
|
31
31
|
};
|
|
32
32
|
}
|
|
33
33
|
function j(t) {
|
|
34
34
|
return m.isValidElement(t) && t.type === m.Fragment;
|
|
35
35
|
}
|
|
36
36
|
function k(t, n = []) {
|
|
37
|
-
return m.Children.forEach(t, (
|
|
38
|
-
j(
|
|
37
|
+
return m.Children.forEach(t, (r) => {
|
|
38
|
+
j(r) ? k(r.props.children, n) : n.push(r);
|
|
39
39
|
}), n;
|
|
40
40
|
}
|
|
41
|
-
function
|
|
41
|
+
function B(t, {
|
|
42
42
|
wrapper: n = "li"
|
|
43
43
|
} = {}) {
|
|
44
|
-
return k(t).filter((o) => o !== null).map((o,
|
|
44
|
+
return k(t).filter((o) => o !== null).map((o, i) => {
|
|
45
45
|
if (m.isValidElement(o) && o.type === n)
|
|
46
46
|
return o;
|
|
47
|
-
const
|
|
47
|
+
const f = m.isValidElement(o) && o.key != null ? o.key : i;
|
|
48
48
|
return m.createElement(n, {
|
|
49
|
-
key:
|
|
49
|
+
key: f,
|
|
50
50
|
"data-component": "wrapchildren"
|
|
51
51
|
}, o);
|
|
52
52
|
});
|
|
53
53
|
}
|
|
54
|
-
const A = "_controls_uue68_1", I = "_horizontal_uue68_9", T = "_list_uue68_20", D = "_columns_uue68_61", $ = "_masonry_uue68_71", q = "_scrollable_uue68_81", G = "_overflowing_uue68_88", J = "_sized_uue68_111", K = "_compact_uue68_123",
|
|
54
|
+
const A = "_controls_uue68_1", I = "_horizontal_uue68_9", T = "_list_uue68_20", D = "_columns_uue68_61", $ = "_masonry_uue68_71", q = "_scrollable_uue68_81", G = "_overflowing_uue68_88", J = "_sized_uue68_111", K = "_compact_uue68_123", c = {
|
|
55
55
|
controls: A,
|
|
56
56
|
horizontal: I,
|
|
57
57
|
list: T,
|
|
@@ -67,32 +67,32 @@ const A = "_controls_uue68_1", I = "_horizontal_uue68_9", T = "_list_uue68_20",
|
|
|
67
67
|
function U({
|
|
68
68
|
children: t,
|
|
69
69
|
className: n,
|
|
70
|
-
columns:
|
|
71
|
-
columnWidth:
|
|
70
|
+
columns: r = 1,
|
|
71
|
+
columnWidth: d,
|
|
72
72
|
compact: o = !1,
|
|
73
|
-
controls:
|
|
74
|
-
horizontal:
|
|
73
|
+
controls: i,
|
|
74
|
+
horizontal: f,
|
|
75
75
|
layout: s = "grid",
|
|
76
76
|
maxVisibleItems: e,
|
|
77
|
-
ordered:
|
|
78
|
-
ref:
|
|
79
|
-
style:
|
|
77
|
+
ordered: u,
|
|
78
|
+
ref: a,
|
|
79
|
+
style: l,
|
|
80
80
|
...v
|
|
81
81
|
}) {
|
|
82
|
-
const _ = Number.isFinite(
|
|
82
|
+
const _ = Number.isFinite(r) ? Math.max(1, Math.floor(r)) : 1, y = s === "grid" && _ === 1 && !f && e != null && Number.isFinite(e) && e >= 1 ? Math.floor(e) : void 0, {
|
|
83
83
|
ref: b,
|
|
84
84
|
isOverflowing: g,
|
|
85
85
|
visibleHeight: w
|
|
86
86
|
} = V(y), E = p((R) => {
|
|
87
|
-
b(R), L(
|
|
88
|
-
}, [b,
|
|
89
|
-
...
|
|
87
|
+
b(R), L(a, R);
|
|
88
|
+
}, [b, a]), x = S(n, c.list, s === "masonry" ? c.masonry : _ > 1 && c.columns, !!y && c.scrollable, g && c.overflowing, f && c.horizontal, o && c.compact, d && c.sized), C = {
|
|
89
|
+
...l,
|
|
90
90
|
"--list-columns": _,
|
|
91
|
-
"--list-column-width":
|
|
91
|
+
"--list-column-width": d,
|
|
92
92
|
"--list-max-height": y && w != null ? `${w}px` : void 0
|
|
93
|
-
}, N =
|
|
94
|
-
return
|
|
95
|
-
/* @__PURE__ */ h("div", { className:
|
|
93
|
+
}, N = u ? /* @__PURE__ */ h("ol", { className: x, ref: E, style: C, ...v, "data-layout": s === "masonry" ? "masonry" : _ > 1 ? "columns" : void 0, tabIndex: v.tabIndex ?? (g ? 0 : void 0), "data-component": "list", children: B(t) }) : /* @__PURE__ */ h("ul", { className: x, ref: E, style: C, ...v, "data-layout": s === "masonry" ? "masonry" : _ > 1 ? "columns" : void 0, tabIndex: v.tabIndex ?? (g ? 0 : void 0), "data-component": "list", children: B(t) });
|
|
94
|
+
return i == null ? N : /* @__PURE__ */ z(H, { children: [
|
|
95
|
+
/* @__PURE__ */ h("div", { className: c.controls, "data-component": "list", children: i }),
|
|
96
96
|
N
|
|
97
97
|
] });
|
|
98
98
|
}
|
package/dist/tokens.json
CHANGED