@mathwiz/ui-components 0.1.0 → 0.1.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.
@@ -7651,7 +7651,7 @@ function ta(e, t) {
7651
7651
  })
7652
7652
  };
7653
7653
  }
7654
- var Id = () => import("./index-BzHrHPIj.js").then((e) => e.default), ra = (e) => {
7654
+ var Id = () => import("./index-CKSPEN4L.js").then((e) => e.default), ra = (e) => {
7655
7655
  const { ripples: t = [], motionProps: r, color: n = "currentColor", style: s, onClear: o } = e;
7656
7656
  return /* @__PURE__ */ f.jsx(f.Fragment, { children: t.map((a) => {
7657
7657
  const i = Ja(0.01 * a.size, 0.2, a.size > 100 ? 0.75 : 0.5);
@@ -10488,7 +10488,110 @@ const {
10488
10488
  renderItem: h ? (x) => h(x, _) : void 0
10489
10489
  }
10490
10490
  ) }) : /* @__PURE__ */ f.jsx("div", { className: `user-profile-container ${l || ""}`, children: /* @__PURE__ */ f.jsx("div", { className: "user-profile-loading", children: "未登录" }) });
10491
- }, qf = ({
10491
+ }, qf = (e) => /* @__PURE__ */ f.jsxs(
10492
+ "div",
10493
+ {
10494
+ className: "explore-menu-item",
10495
+ onClick: () => e.onClick?.(e),
10496
+ children: [
10497
+ /* @__PURE__ */ f.jsx("span", { className: "explore-item-label", children: e.label }),
10498
+ e.status && /* @__PURE__ */ f.jsx("span", { className: `explore-item-status status-${e.status.toLowerCase().replace("%", "").replace(" ", "-")}`, children: e.status })
10499
+ ]
10500
+ },
10501
+ e.id
10502
+ ), Yf = () => /* @__PURE__ */ f.jsxs("button", { className: "explore-button", "aria-label": "探索数学课程", children: [
10503
+ /* @__PURE__ */ f.jsx("span", { className: "explore-icon", children: "🌍" }),
10504
+ /* @__PURE__ */ f.jsx("span", { className: "explore-text", children: "探索" })
10505
+ ] }), Xf = ({
10506
+ // 通用Props
10507
+ className: e = "",
10508
+ style: t,
10509
+ logoHref: r = "/",
10510
+ logoText: n = "MathWiz",
10511
+ onLogoClick: s,
10512
+ // 探索菜单Props
10513
+ exploreItems: o = [],
10514
+ exploreMenuOpen: a = !1,
10515
+ onExploreMenuToggle: i,
10516
+ onExploreItemClick: c,
10517
+ renderExploreItem: d = qf,
10518
+ // 用户资料Props
10519
+ userData: l,
10520
+ userMenuItems: u,
10521
+ onUserMenuItemClick: y,
10522
+ onLogout: $,
10523
+ // 状态控制Props
10524
+ isLoading: g = !1,
10525
+ error: h = null,
10526
+ // 样式定制Props
10527
+ headerClassName: b = "",
10528
+ logoClassName: _ = "",
10529
+ exploreClassName: A = "",
10530
+ userProfileClassName: j = "",
10531
+ // 无障碍访问Props
10532
+ "aria-label": L,
10533
+ "aria-labelledby": M,
10534
+ ...D
10535
+ }) => {
10536
+ const S = o.map((T) => ({
10537
+ id: T.id,
10538
+ label: d(T),
10539
+ onClick: () => c?.(T)
10540
+ }));
10541
+ return /* @__PURE__ */ f.jsx(
10542
+ "header",
10543
+ {
10544
+ className: `mathwiz-header site-header ${b} ${e}`,
10545
+ style: t,
10546
+ "aria-label": L,
10547
+ "aria-labelledby": M,
10548
+ role: "banner",
10549
+ ...D,
10550
+ children: /* @__PURE__ */ f.jsxs("div", { className: "header-content", children: [
10551
+ /* @__PURE__ */ f.jsx("div", { className: "header-section left", children: /* @__PURE__ */ f.jsx(
10552
+ ua,
10553
+ {
10554
+ trigger: /* @__PURE__ */ f.jsx(Yf, {}),
10555
+ items: S,
10556
+ position: "bottom",
10557
+ alignment: "start",
10558
+ openDelay: 300,
10559
+ closeDelay: 100,
10560
+ onOpen: () => i?.(!0),
10561
+ onClose: () => i?.(!1),
10562
+ className: `explore-submenu ${A}`,
10563
+ menuClassName: "explore-panel"
10564
+ }
10565
+ ) }),
10566
+ /* @__PURE__ */ f.jsx("div", { className: "header-section center", children: /* @__PURE__ */ f.jsx(
10567
+ "a",
10568
+ {
10569
+ href: r,
10570
+ className: `logo ${_}`,
10571
+ onClick: s,
10572
+ "aria-label": "MathWiz 首页",
10573
+ children: n
10574
+ }
10575
+ ) }),
10576
+ /* @__PURE__ */ f.jsx("div", { className: "header-section right", children: /* @__PURE__ */ f.jsx(
10577
+ Kf,
10578
+ {
10579
+ userName: l?.name,
10580
+ userAvatar: l?.avatar,
10581
+ menuItems: u,
10582
+ onMenuItemClick: y,
10583
+ onLogout: $,
10584
+ containerClassName: j,
10585
+ isLoading: g,
10586
+ error: h
10587
+ }
10588
+ ) })
10589
+ ] })
10590
+ }
10591
+ );
10592
+ }, Jf = Q.memo(Xf, (e, t) => e.logoText === t.logoText && e.logoHref === t.logoHref && e.className === t.className && e.headerClassName === t.headerClassName && e.logoClassName === t.logoClassName && e.exploreClassName === t.exploreClassName && e.userProfileClassName === t.userProfileClassName && e["aria-label"] === t["aria-label"] && e["aria-labelledby"] === t["aria-labelledby"] && e.isLoading === t.isLoading && e.error === t.error && // 深度比较数组
10593
+ JSON.stringify(e.exploreItems) === JSON.stringify(t.exploreItems) && // 深度比较对象
10594
+ JSON.stringify(e.userData) === JSON.stringify(t.userData) && JSON.stringify(e.userMenuItems) === JSON.stringify(t.userMenuItems)), Zf = ({
10492
10595
  abilities: e,
10493
10596
  width: t = 400,
10494
10597
  height: r = 400
@@ -10602,8 +10705,8 @@ const {
10602
10705
  }
10603
10706
  }, s = () => t, i = { setState: n, getState: s, getInitialState: () => c, subscribe: (d) => (r.add(d), () => r.delete(d)) }, c = t = e(n, s, i);
10604
10707
  return i;
10605
- }, Yf = ((e) => e ? Os(e) : Os), Xf = (e) => e;
10606
- function Jf(e, t = Xf) {
10708
+ }, Qf = ((e) => e ? Os(e) : Os), ep = (e) => e;
10709
+ function tp(e, t = ep) {
10607
10710
  const r = Q.useSyncExternalStore(
10608
10711
  e.subscribe,
10609
10712
  Q.useCallback(() => t(e.getState()), [e, t]),
@@ -10612,9 +10715,9 @@ function Jf(e, t = Xf) {
10612
10715
  return Q.useDebugValue(r), r;
10613
10716
  }
10614
10717
  const Is = (e) => {
10615
- const t = Yf(e), r = (n) => Jf(t, n);
10718
+ const t = Qf(e), r = (n) => tp(t, n);
10616
10719
  return Object.assign(r, t), r;
10617
- }, Zf = ((e) => e ? Is(e) : Is), Ds = {
10720
+ }, rp = ((e) => e ? Is(e) : Is), Ds = {
10618
10721
  overallRating: "优秀",
10619
10722
  generalRecommendation: "你的空间想象力和逻辑推理能力非常出色!若能进一步提升在复杂图形下的专注力,你将所向披靡。建议尝试我们‘专注力挑战’系列游戏。",
10620
10723
  abilities: [
@@ -10674,7 +10777,7 @@ const Is = (e) => {
10674
10777
  }
10675
10778
  ]
10676
10779
  };
10677
- class Qf {
10780
+ class np {
10678
10781
  static API_BASE_URL = "/api/radar-ability";
10679
10782
  static async fetchRadarAbilityData() {
10680
10783
  try {
@@ -10693,7 +10796,7 @@ class Qf {
10693
10796
  }
10694
10797
  }
10695
10798
  }
10696
- const ep = Zf((e, t) => ({
10799
+ const sp = rp((e, t) => ({
10697
10800
  data: null,
10698
10801
  loading: !1,
10699
10802
  error: null,
@@ -10701,7 +10804,7 @@ const ep = Zf((e, t) => ({
10701
10804
  if (!t().loading) {
10702
10805
  e({ loading: !0, error: null });
10703
10806
  try {
10704
- const r = await Qf.fetchRadarAbilityData();
10807
+ const r = await np.fetchRadarAbilityData();
10705
10808
  e({ data: r, loading: !1 });
10706
10809
  } catch (r) {
10707
10810
  const n = r instanceof Error ? r.message : "获取数据失败";
@@ -10718,7 +10821,7 @@ const ep = Zf((e, t) => ({
10718
10821
  reset: () => {
10719
10822
  e({ data: null, loading: !1, error: null });
10720
10823
  }
10721
- })), tp = ({ ability: e }) => {
10824
+ })), op = ({ ability: e }) => {
10722
10825
  const t = e.score / e.maxScore * 100;
10723
10826
  return /* @__PURE__ */ f.jsxs(
10724
10827
  "div",
@@ -10758,7 +10861,7 @@ const ep = Zf((e, t) => ({
10758
10861
  ]
10759
10862
  }
10760
10863
  );
10761
- }, rp = ({
10864
+ }, ap = ({
10762
10865
  generalRecommendation: e
10763
10866
  }) => /* @__PURE__ */ f.jsx(
10764
10867
  "div",
@@ -10797,7 +10900,7 @@ const ep = Zf((e, t) => ({
10797
10900
  ] })
10798
10901
  ] })
10799
10902
  }
10800
- ), np = ({ ability: e, customLinkTexts: t = {} }) => {
10903
+ ), ip = ({ ability: e, customLinkTexts: t = {} }) => {
10801
10904
  const r = (n) => {
10802
10905
  const s = {
10803
10906
  空间想象力: "探索空间挑战",
@@ -10855,13 +10958,13 @@ const ep = Zf((e, t) => ({
10855
10958
  ] }) })
10856
10959
  }
10857
10960
  );
10858
- }, sp = "_dashboardLayout_10wqn_5", op = "_upperSection_10wqn_19", ap = "_lowerSection_10wqn_33", ip = "_radarChartArea_10wqn_51", Kt = {
10859
- dashboardLayout: sp,
10860
- upperSection: op,
10861
- lowerSection: ap,
10862
- radarChartArea: ip
10961
+ }, lp = "_dashboardLayout_10wqn_5", cp = "_upperSection_10wqn_19", dp = "_lowerSection_10wqn_33", up = "_radarChartArea_10wqn_51", Kt = {
10962
+ dashboardLayout: lp,
10963
+ upperSection: cp,
10964
+ lowerSection: dp,
10965
+ radarChartArea: up
10863
10966
  }, Gp = () => {
10864
- const { data: e, loading: t, error: r, fetchData: n } = ep();
10967
+ const { data: e, loading: t, error: r, fetchData: n } = sp();
10865
10968
  return le(() => {
10866
10969
  n();
10867
10970
  }, [n]), t ? /* @__PURE__ */ f.jsxs(
@@ -10926,9 +11029,9 @@ const ep = Zf((e, t) => ({
10926
11029
  ] }),
10927
11030
  /* @__PURE__ */ f.jsxs("div", { className: Kt.dashboardLayout, children: [
10928
11031
  /* @__PURE__ */ f.jsxs("div", { className: Kt.upperSection, children: [
10929
- /* @__PURE__ */ f.jsx("div", { className: Kt.radarChartArea, children: /* @__PURE__ */ f.jsx(qf, { abilities: e.abilities }) }),
11032
+ /* @__PURE__ */ f.jsx("div", { className: Kt.radarChartArea, children: /* @__PURE__ */ f.jsx(Zf, { abilities: e.abilities }) }),
10930
11033
  /* @__PURE__ */ f.jsx("div", { className: "space-y-4 flex flex-col justify-around py-2", children: e.abilities.map((s) => /* @__PURE__ */ f.jsx(
10931
- tp,
11034
+ op,
10932
11035
  {
10933
11036
  ability: s
10934
11037
  },
@@ -10937,14 +11040,14 @@ const ep = Zf((e, t) => ({
10937
11040
  ] }),
10938
11041
  /* @__PURE__ */ f.jsxs("div", { className: Kt.lowerSection, children: [
10939
11042
  /* @__PURE__ */ f.jsx(
10940
- rp,
11043
+ ap,
10941
11044
  {
10942
11045
  generalRecommendation: e.generalRecommendation
10943
11046
  }
10944
11047
  ),
10945
11048
  /* @__PURE__ */ f.jsx("h3", { className: "text-lg font-bold text-gray-800 mb-4 mt-6", children: "专项提升建议" }),
10946
11049
  /* @__PURE__ */ f.jsx("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4", children: e.abilities.map((s) => /* @__PURE__ */ f.jsx(
10947
- np,
11050
+ ip,
10948
11051
  {
10949
11052
  ability: s
10950
11053
  },
@@ -10963,110 +11066,7 @@ const ep = Zf((e, t) => ({
10963
11066
  children: /* @__PURE__ */ f.jsx("p", { className: "text-gray-600", children: "暂无数据" })
10964
11067
  }
10965
11068
  );
10966
- }, lp = (e) => /* @__PURE__ */ f.jsxs(
10967
- "div",
10968
- {
10969
- className: "explore-menu-item",
10970
- onClick: () => e.onClick?.(e),
10971
- children: [
10972
- /* @__PURE__ */ f.jsx("span", { className: "explore-item-label", children: e.label }),
10973
- e.status && /* @__PURE__ */ f.jsx("span", { className: `explore-item-status status-${e.status.toLowerCase().replace("%", "").replace(" ", "-")}`, children: e.status })
10974
- ]
10975
- },
10976
- e.id
10977
- ), cp = () => /* @__PURE__ */ f.jsxs("button", { className: "explore-button", "aria-label": "探索数学课程", children: [
10978
- /* @__PURE__ */ f.jsx("span", { className: "explore-icon", children: "🌍" }),
10979
- /* @__PURE__ */ f.jsx("span", { className: "explore-text", children: "探索" })
10980
- ] }), dp = ({
10981
- // 通用Props
10982
- className: e = "",
10983
- style: t,
10984
- logoHref: r = "/",
10985
- logoText: n = "MathWiz",
10986
- onLogoClick: s,
10987
- // 探索菜单Props
10988
- exploreItems: o = [],
10989
- exploreMenuOpen: a = !1,
10990
- onExploreMenuToggle: i,
10991
- onExploreItemClick: c,
10992
- renderExploreItem: d = lp,
10993
- // 用户资料Props
10994
- userData: l,
10995
- userMenuItems: u,
10996
- onUserMenuItemClick: y,
10997
- onLogout: $,
10998
- // 状态控制Props
10999
- isLoading: g = !1,
11000
- error: h = null,
11001
- // 样式定制Props
11002
- headerClassName: b = "",
11003
- logoClassName: _ = "",
11004
- exploreClassName: A = "",
11005
- userProfileClassName: j = "",
11006
- // 无障碍访问Props
11007
- "aria-label": L,
11008
- "aria-labelledby": M,
11009
- ...D
11010
- }) => {
11011
- const S = o.map((T) => ({
11012
- id: T.id,
11013
- label: d(T),
11014
- onClick: () => c?.(T)
11015
- }));
11016
- return /* @__PURE__ */ f.jsx(
11017
- "header",
11018
- {
11019
- className: `mathwiz-header site-header ${b} ${e}`,
11020
- style: t,
11021
- "aria-label": L,
11022
- "aria-labelledby": M,
11023
- role: "banner",
11024
- ...D,
11025
- children: /* @__PURE__ */ f.jsxs("div", { className: "header-content", children: [
11026
- /* @__PURE__ */ f.jsx("div", { className: "header-section left", children: /* @__PURE__ */ f.jsx(
11027
- ua,
11028
- {
11029
- trigger: /* @__PURE__ */ f.jsx(cp, {}),
11030
- items: S,
11031
- position: "bottom",
11032
- alignment: "start",
11033
- openDelay: 300,
11034
- closeDelay: 100,
11035
- onOpen: () => i?.(!0),
11036
- onClose: () => i?.(!1),
11037
- className: `explore-submenu ${A}`,
11038
- menuClassName: "explore-panel"
11039
- }
11040
- ) }),
11041
- /* @__PURE__ */ f.jsx("div", { className: "header-section center", children: /* @__PURE__ */ f.jsx(
11042
- "a",
11043
- {
11044
- href: r,
11045
- className: `logo ${_}`,
11046
- onClick: s,
11047
- "aria-label": "MathWiz 首页",
11048
- children: n
11049
- }
11050
- ) }),
11051
- /* @__PURE__ */ f.jsx("div", { className: "header-section right", children: /* @__PURE__ */ f.jsx(
11052
- Kf,
11053
- {
11054
- userName: l?.name,
11055
- userAvatar: l?.avatar,
11056
- menuItems: u,
11057
- onMenuItemClick: y,
11058
- onLogout: $,
11059
- containerClassName: j,
11060
- isLoading: g,
11061
- error: h
11062
- }
11063
- ) })
11064
- ] })
11065
- }
11066
- );
11067
- }, up = Q.memo(dp, (e, t) => e.logoText === t.logoText && e.logoHref === t.logoHref && e.className === t.className && e.headerClassName === t.headerClassName && e.logoClassName === t.logoClassName && e.exploreClassName === t.exploreClassName && e.userProfileClassName === t.userProfileClassName && e["aria-label"] === t["aria-label"] && e["aria-labelledby"] === t["aria-labelledby"] && e.isLoading === t.isLoading && e.error === t.error && // 深度比较数组
11068
- JSON.stringify(e.exploreItems) === JSON.stringify(t.exploreItems) && // 深度比较对象
11069
- JSON.stringify(e.userData) === JSON.stringify(t.userData) && JSON.stringify(e.userMenuItems) === JSON.stringify(t.userMenuItems)), Ct = {
11069
+ }, Ct = {
11070
11070
  id: "user-001",
11071
11071
  name: "小明",
11072
11072
  level: 5,
@@ -11288,7 +11288,7 @@ JSON.stringify(e.userData) === JSON.stringify(t.userData) && JSON.stringify(e.us
11288
11288
  "data-testid": "grade-unit-browser-page",
11289
11289
  children: [
11290
11290
  /* @__PURE__ */ f.jsx("div", { className: "header-area", children: /* @__PURE__ */ f.jsx(
11291
- up,
11291
+ Jf,
11292
11292
  {
11293
11293
  userData: _ || void 0,
11294
11294
  exploreItems: A
@@ -11645,7 +11645,7 @@ JSON.stringify(e.userData) === JSON.stringify(t.userData) && JSON.stringify(e.us
11645
11645
  ]
11646
11646
  };
11647
11647
  export {
11648
- em as $,
11648
+ Qp as $,
11649
11649
  Wl as A,
11650
11650
  Ol as B,
11651
11651
  Il as C,
@@ -11658,40 +11658,41 @@ export {
11658
11658
  qa as J,
11659
11659
  Qd as K,
11660
11660
  ua as L,
11661
- Gp as M,
11662
- tp as N,
11663
- np as O,
11664
- rp as P,
11665
- Kp as Q,
11666
- qf as R,
11661
+ Jf as M,
11662
+ Gp as N,
11663
+ op as O,
11664
+ ap as P,
11665
+ ip as Q,
11666
+ Zf as R,
11667
11667
  fu as S,
11668
- qp as T,
11668
+ Kp as T,
11669
11669
  Kf as U,
11670
- Yp as V,
11671
- Xp as W,
11672
- _e as X,
11673
- Jp as Y,
11674
- Zp as Z,
11675
- Qp as _,
11670
+ qp as V,
11671
+ Yp as W,
11672
+ Xp as X,
11673
+ _e as Y,
11674
+ Jp as Z,
11675
+ Zp as _,
11676
11676
  Br as a,
11677
- tm as a0,
11678
- rm as a1,
11679
- nm as a2,
11680
- sm as a3,
11681
- be as a4,
11682
- Hp as a5,
11683
- Wp as a6,
11684
- gp as a7,
11685
- bp as a8,
11686
- Oa as a9,
11687
- hp as aa,
11688
- om as ab,
11689
- am as ac,
11690
- Ia as ad,
11691
- im as ae,
11692
- lm as af,
11693
- cm as ag,
11694
- dm as ah,
11677
+ em as a0,
11678
+ tm as a1,
11679
+ rm as a2,
11680
+ nm as a3,
11681
+ sm as a4,
11682
+ be as a5,
11683
+ Hp as a6,
11684
+ Wp as a7,
11685
+ gp as a8,
11686
+ bp as a9,
11687
+ Oa as aa,
11688
+ hp as ab,
11689
+ om as ac,
11690
+ am as ad,
11691
+ Ia as ae,
11692
+ im as af,
11693
+ lm as ag,
11694
+ cm as ah,
11695
+ dm as ai,
11695
11696
  xp as b,
11696
11697
  tl as c,
11697
11698
  G as d,
@@ -11718,4 +11719,4 @@ export {
11718
11719
  wo as y,
11719
11720
  Xl as z
11720
11721
  };
11721
- //# sourceMappingURL=index-BjziaeiG.js.map
11722
+ //# sourceMappingURL=index-DW87szRE.js.map