aot-ui 0.2.6 → 0.2.7

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.
@@ -2081,95 +2081,95 @@ function xt(e, t) {
2081
2081
  return Number.isFinite(r) ? r : t;
2082
2082
  }
2083
2083
  function St({ items: e, index: t, defaultIndex: n = 0, onChange: r, className: i = "", "aria-label": a = "底部导航", barOnly: o = !1 }) {
2084
- let c = t !== void 0, [u, d] = h(n), f = c ? t : u, p = m(null), g = m([]), [y, b] = h(0), [x, S] = h({
2084
+ let c = Array.isArray(e) ? e : [], u = t !== void 0, [d, f] = h(n), p = u ? t : d, g = m(null), y = m([]), [b, x] = h(0), [S, C] = h({
2085
2085
  idle: "#9ca3af",
2086
2086
  active: bt("--aot-config-primary", "#2563eb")
2087
- }), [C, w] = h(40), [T, E] = h(14), D = !o && e.some((e) => e.content != null), O = s((e) => {
2088
- c || d(e), r?.(e);
2089
- }, [c, r]), k = s(() => {
2090
- let t = p.current;
2091
- if (!t) return [];
2092
- let n = t.getBoundingClientRect(), r = C, i = (n.height - r) / 2;
2093
- return g.current.slice(0, e.length).map((e) => {
2087
+ }), [w, T] = h(40), [E, D] = h(14), O = !o && c.some((e) => e.content != null), k = s((e) => {
2088
+ u || f(e), r?.(e);
2089
+ }, [u, r]), A = s(() => {
2090
+ let e = g.current;
2091
+ if (!e) return [];
2092
+ let t = e.getBoundingClientRect(), n = w, r = (t.height - n) / 2;
2093
+ return y.current.slice(0, c.length).map((e) => {
2094
2094
  if (!e) return {
2095
2095
  left: 0,
2096
2096
  width: 0,
2097
- height: r,
2098
- top: i
2097
+ height: n,
2098
+ top: r
2099
2099
  };
2100
- let t = e.getBoundingClientRect(), a = Math.min(10, t.width * .12);
2100
+ let i = e.getBoundingClientRect(), a = Math.min(10, i.width * .12);
2101
2101
  return {
2102
- left: t.left - n.left + a,
2103
- width: Math.max(t.width - a * 2, 28),
2104
- height: r,
2105
- top: i
2102
+ left: i.left - t.left + a,
2103
+ width: Math.max(i.width - a * 2, 28),
2104
+ height: n,
2105
+ top: r
2106
2106
  };
2107
2107
  });
2108
2108
  }, [
2109
- e.length,
2110
- C,
2111
- y
2112
- ]), { frame: A, select: j } = yt({
2113
- count: e.length,
2114
- index: f,
2115
- measure: k,
2116
- onIndexChange: O
2109
+ c.length,
2110
+ w,
2111
+ b
2112
+ ]), { frame: j, select: M } = yt({
2113
+ count: c.length,
2114
+ index: p,
2115
+ measure: A,
2116
+ onIndexChange: k
2117
2117
  });
2118
2118
  l(() => {
2119
- S({
2119
+ C({
2120
2120
  idle: bt("--color-bnav-idle", "#9ca3af"),
2121
2121
  active: bt("--color-bnav-active", bt("--aot-config-primary", "#2563eb"))
2122
- }), w(xt("--bnav-capsule-h", 40)), E(xt("--bnav-push", 14));
2122
+ }), T(xt("--bnav-capsule-h", 40)), D(xt("--bnav-push", 14));
2123
2123
  }, []), l(() => {
2124
- let e = p.current;
2125
- if (e) return it(e, () => b((e) => e + 1));
2124
+ let e = g.current;
2125
+ if (e) return it(e, () => x((e) => e + 1));
2126
2126
  }, []);
2127
- let M = e[A.pageIndex], N = { "--bnav-page-push": `${A.pageDir === 0 ? 0 : A.pageDir * T}px` }, P = A.capsule;
2127
+ let N = c[j.pageIndex], P = { "--bnav-page-push": `${j.pageDir === 0 ? 0 : j.pageDir * E}px` }, F = j.capsule;
2128
2128
  return /* @__PURE__ */ v("div", {
2129
2129
  className: [
2130
2130
  "bottom-nav",
2131
2131
  o ? "bottom-nav--bar-only" : "",
2132
2132
  i
2133
2133
  ].filter(Boolean).join(" "),
2134
- children: [D ? /* @__PURE__ */ _("div", {
2134
+ children: [O ? /* @__PURE__ */ _("div", {
2135
2135
  className: "bottom-nav__stage",
2136
- children: M ? /* @__PURE__ */ _("div", {
2137
- className: `bottom-nav__page${A.pageKey > 0 ? " is-enter" : ""}`,
2138
- style: N,
2136
+ children: N ? /* @__PURE__ */ _("div", {
2137
+ className: `bottom-nav__page${j.pageKey > 0 ? " is-enter" : ""}`,
2138
+ style: P,
2139
2139
  role: "tabpanel",
2140
- id: `bnav-panel-${M.key}`,
2141
- "aria-labelledby": `bnav-tab-${M.key}`,
2142
- children: M.content
2143
- }, `${M.key}-${A.pageKey}`) : null
2140
+ id: `bnav-panel-${N.key}`,
2141
+ "aria-labelledby": `bnav-tab-${N.key}`,
2142
+ children: N.content
2143
+ }, `${N.key}-${j.pageKey}`) : null
2144
2144
  }) : null, /* @__PURE__ */ v("div", {
2145
- ref: p,
2145
+ ref: g,
2146
2146
  className: "bottom-nav__bar",
2147
2147
  role: "tablist",
2148
2148
  "aria-label": a,
2149
- children: [P && P.width > 0 ? /* @__PURE__ */ _("span", {
2149
+ children: [F && F.width > 0 ? /* @__PURE__ */ _("span", {
2150
2150
  className: "bottom-nav__capsule",
2151
2151
  "aria-hidden": !0,
2152
2152
  style: {
2153
- transform: `translate3d(${P.left}px, ${P.top}px, 0)`,
2154
- width: P.width,
2155
- height: P.height
2153
+ transform: `translate3d(${F.left}px, ${F.top}px, 0)`,
2154
+ width: F.width,
2155
+ height: F.height
2156
2156
  }
2157
- }) : null, e.map((e, t) => {
2158
- let n = A.blends[t] ?? 0, r = mt(x.idle, x.active, n), i = t === A.pageIndex, a = i ? A.iconScale : 1, o = Math.max(0, Math.floor(e.badge || 0));
2157
+ }) : null, c.map((e, t) => {
2158
+ let n = j.blends[t] ?? 0, r = mt(S.idle, S.active, n), i = t === j.pageIndex, a = i ? j.iconScale : 1, o = Math.max(0, Math.floor(e.badge || 0));
2159
2159
  return /* @__PURE__ */ v("button", {
2160
2160
  ref: (e) => {
2161
- g.current[t] = e;
2161
+ y.current[t] = e;
2162
2162
  },
2163
2163
  type: "button",
2164
2164
  role: "tab",
2165
2165
  id: `bnav-tab-${e.key}`,
2166
2166
  className: ["bottom-nav__tab", e.disabled ? "is-disabled" : ""].filter(Boolean).join(" "),
2167
2167
  "aria-selected": i,
2168
- "aria-controls": D ? `bnav-panel-${e.key}` : void 0,
2168
+ "aria-controls": O ? `bnav-panel-${e.key}` : void 0,
2169
2169
  tabIndex: i ? 0 : -1,
2170
- disabled: A.animating || e.disabled,
2170
+ disabled: j.animating || e.disabled,
2171
2171
  style: { color: r },
2172
- onClick: () => j(t),
2172
+ onClick: () => M(t),
2173
2173
  children: [/* @__PURE__ */ v("span", {
2174
2174
  className: "bottom-nav__icon",
2175
2175
  style: { transform: `scale(${a})` },
@@ -13652,11 +13652,11 @@ function _c({ title: e, description: t = "暂无数据", image: n, showImage: r
13652
13652
  className: "aot-empty__image",
13653
13653
  children: o
13654
13654
  }),
13655
- e ? /* @__PURE__ */ _("h3", {
13655
+ e != null && e !== !1 ? /* @__PURE__ */ _("h3", {
13656
13656
  className: "aot-empty__title",
13657
13657
  children: e
13658
13658
  }) : null,
13659
- t ? /* @__PURE__ */ _("p", {
13659
+ t != null && t !== !1 ? /* @__PURE__ */ _("p", {
13660
13660
  className: "aot-empty__desc",
13661
13661
  children: t
13662
13662
  }) : null,
@@ -14598,8 +14598,8 @@ function Zc({ index: e }) {
14598
14598
  ]
14599
14599
  });
14600
14600
  }
14601
- function Qc({ items: e = [], loaded: t = !1, className: n = "", children: r, layout: i = "feed", count: a = 6 }) {
14602
- let o = i === "grid";
14601
+ function Qc({ items: e, loaded: t = !1, className: n = "", children: r, layout: i = "feed", count: a = 6 }) {
14602
+ let o = i === "grid", s = Array.isArray(e) ? e : [], c = Math.max(1, Number(a) || 6);
14603
14603
  return /* @__PURE__ */ v("div", {
14604
14604
  className: [
14605
14605
  "feed-skeleton",
@@ -14614,7 +14614,7 @@ function Qc({ items: e = [], loaded: t = !1, className: n = "", children: r, lay
14614
14614
  className: "feed-skeleton__shimmer",
14615
14615
  "aria-hidden": !0
14616
14616
  }),
14617
- o ? Array.from({ length: Math.max(1, a) }, (e, t) => /* @__PURE__ */ _(Zc, { index: t }, `tile-${t}`)) : e.map((e, n) => /* @__PURE__ */ _(Xc, {
14617
+ o ? Array.from({ length: c }, (e, t) => /* @__PURE__ */ _(Zc, { index: t }, `tile-${t}`)) : s.map((e, n) => /* @__PURE__ */ _(Xc, {
14618
14618
  item: e,
14619
14619
  loaded: !!t,
14620
14620
  index: n
@@ -18985,7 +18985,7 @@ function af({ count: e }) {
18985
18985
  }, `sk-${t}`)) });
18986
18986
  }
18987
18987
  function of({ className: e = "", items: t, retryMs: n = $d, onRetry: r, onLoaded: i, status: a, title: o, description: s, retryText: c = "点我重试", skeletonCount: u = rf, children: d }) {
18988
- let f = a !== void 0, g = p(() => t?.length ? t : tf.map((e) => ({ ...e })), [t]), [y, b] = h(0), [x, S] = h("error"), C = f ? a : x, [w, T] = h(!1), [E, D] = h(!1), [O, k] = h(!0), [A, j] = h(!1), [M, N] = h(!1), P = m(null);
18988
+ let f = a !== void 0, g = p(() => Array.isArray(t) && t.length ? t : tf.map((e) => ({ ...e })), [t]), [y, b] = h(0), [x, S] = h("error"), C = f ? a : x, [w, T] = h(!1), [E, D] = h(!1), [O, k] = h(!0), [A, j] = h(!1), [M, N] = h(!1), P = m(null);
18989
18989
  l(() => () => {
18990
18990
  P.current != null && window.clearTimeout(P.current);
18991
18991
  }, []), l(() => {
@@ -1,2 +1,2 @@
1
1
  import { BottomNavProps } from '../types';
2
- export declare function BottomNav({ items, index: indexProp, defaultIndex, onChange, className, "aria-label": ariaLabel, barOnly, }: BottomNavProps): import('react').JSX.Element;
2
+ export declare function BottomNav({ items: itemsProp, index: indexProp, defaultIndex, onChange, className, "aria-label": ariaLabel, barOnly, }: BottomNavProps): import('react').JSX.Element;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aot-ui",
3
- "version": "0.2.6",
3
+ "version": "0.2.7",
4
4
  "description": "AOT React UI component kit",
5
5
  "type": "module",
6
6
  "main": "./dist-lib/aot-ui.js",