bj-web-components 0.2.33 → 0.2.34

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,67 +1,69 @@
1
- import { jsx as o } from "react/jsx-runtime";
2
- import { forwardRef as S, useState as b, useMemo as h, useEffect as _ } from "react";
3
- import w from "./BCheckBox.mjs";
4
- import { CheckBoxGroupContext as E } from "./context.mjs";
5
- function I(u) {
6
- return (u ?? []).map((r) => typeof r == "string" || typeof r == "number" ? { label: r, value: r } : r);
1
+ import { jsx as f } from "react/jsx-runtime";
2
+ import { forwardRef as _, useState as q, useRef as w, useMemo as O, useEffect as E, useCallback as m } from "react";
3
+ import I from "./BCheckBox.mjs";
4
+ import { CheckBoxGroupContext as M } from "./context.mjs";
5
+ function P(n) {
6
+ return (n ?? []).map((r) => typeof r == "string" || typeof r == "number" ? { label: r, value: r } : r);
7
7
  }
8
- const M = S(({
9
- defaultValue: u = [],
8
+ const A = _(({
9
+ defaultValue: n = [],
10
10
  value: r,
11
- onChange: i,
12
- options: m,
13
- children: p,
14
- disabled: n,
15
- name: d,
16
- className: k,
17
- style: B,
18
- direction: O = "ltr",
19
- variant: x = "dark"
20
- }, j) => {
21
- const [y, v] = b(u), [f, g] = b([]), s = r ?? y, c = h(() => I(m), [m]);
22
- _(() => {
23
- r !== void 0 && v(r);
11
+ onChange: l,
12
+ options: d,
13
+ children: j,
14
+ disabled: i,
15
+ name: o,
16
+ className: y,
17
+ style: G,
18
+ direction: N = "ltr",
19
+ variant: v = "dark",
20
+ shape: x = "square"
21
+ }, R) => {
22
+ const [z, b] = q(n), t = w([]), c = r ?? z, s = O(() => P(d), [d]);
23
+ E(() => {
24
+ r !== void 0 && b(r);
24
25
  }, [r]);
25
- const V = (e) => {
26
- g((t) => t.includes(e) ? t : [...t, e]);
27
- }, G = (e) => {
28
- g((t) => t.filter((a) => a !== e));
29
- }, N = (e) => {
30
- const t = s.includes(e.value) ? s.filter((l) => l !== e.value) : [...s, e.value];
31
- r === void 0 && v(t);
32
- const a = c.length > 0 ? c.map((l) => l.value) : f;
33
- i == null || i(t.filter((l) => f.includes(l)).sort((l, R) => a.indexOf(l) - a.indexOf(R)));
34
- }, z = h(() => ({
35
- name: d,
36
- value: s,
37
- disabled: n,
38
- variant: x,
39
- registerValue: V,
40
- cancelValue: G,
41
- toggleOption: N
42
- }), [n, s, d, f, x]), C = c.length > 0 ? c.map((e) => /* @__PURE__ */ o(
43
- w,
26
+ const g = m((e) => {
27
+ t.current.includes(e) || (t.current = [...t.current, e]);
28
+ }, []), k = m((e) => {
29
+ t.current.includes(e) && (t.current = t.current.filter((a) => a !== e));
30
+ }, []), h = m((e) => {
31
+ const a = c.includes(e.value) ? c.filter((u) => u !== e.value) : [...c, e.value];
32
+ r === void 0 && b(a);
33
+ const p = t.current, B = s.length > 0 ? s.map((u) => u.value) : p;
34
+ l == null || l(a.filter((u) => p.includes(u)).sort((u, V) => B.indexOf(u) - B.indexOf(V)));
35
+ }, [r, c, s, l]), C = O(() => ({
36
+ name: o,
37
+ value: c,
38
+ disabled: i,
39
+ variant: v,
40
+ shape: x,
41
+ registerValue: g,
42
+ cancelValue: k,
43
+ toggleOption: h
44
+ }), [k, i, c, o, g, h, x, v]), S = s.length > 0 ? s.map((e) => /* @__PURE__ */ f(
45
+ I,
44
46
  {
45
47
  className: "bj-checkbox-group__item",
46
- disabled: e.disabled ?? n,
48
+ disabled: e.disabled ?? i,
47
49
  onChange: e.onChange,
48
50
  style: e.style,
49
51
  value: e.value,
50
52
  children: e.label
51
53
  },
52
54
  String(e.value)
53
- )) : p;
54
- return /* @__PURE__ */ o(
55
+ )) : j;
56
+ return /* @__PURE__ */ f(
55
57
  "div",
56
58
  {
57
- className: ["bj-checkbox-group", O === "rtl" ? "bj-checkbox-group--rtl" : "", k].filter(Boolean).join(" "),
58
- ref: j,
59
- style: B,
60
- children: /* @__PURE__ */ o(E.Provider, { value: z, children: C })
59
+ className: ["bj-checkbox-group", N === "rtl" ? "bj-checkbox-group--rtl" : "", y].filter(Boolean).join(" "),
60
+ ref: R,
61
+ style: G,
62
+ children: /* @__PURE__ */ f(M.Provider, { value: C, children: S })
61
63
  }
62
64
  );
63
65
  });
64
- M.displayName = "BCheckBox.Group";
66
+ A.displayName = "BCheckBox.Group";
65
67
  export {
66
- M as default
68
+ A as default
67
69
  };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),t=require("react"),U=require("react-dom"),X=require("../CheckBox/index.js"),H=require("../Icon/Icon.js");;/* empty css */function J(...i){return i.filter(Boolean).join(" ")}const O=240;function Q({visible:i,defaultVisible:p=!1,title:k,options:_,value:w,defaultValue:E=[],onChange:b,onOK:f,onCancel:q,onClose:d,footer:u,t:o=v=>v,okText:S=o("确定"),cancelText:T=o("取消"),emptyText:V,closable:B=!0,maskClosable:D=!0,maxHeight:I="86.21vh",zIndex:y,className:M,style:A,getContainer:j}){const[v,F]=t.useState(p),[R,g]=t.useState(E),m=i??v,a=w??R,[c,h]=t.useState(m),[L,x]=t.useState(m),l=t.useRef(null);t.useEffect(()=>{if(l.current&&(clearTimeout(l.current),l.current=null),m){h(!0);const e=requestAnimationFrame(()=>x(!0));return()=>cancelAnimationFrame(e)}return x(!1),l.current=setTimeout(()=>{l.current=null,h(!1)},O),()=>{l.current&&(clearTimeout(l.current),l.current=null)}},[m]),t.useEffect(()=>{if(!c||typeof document>"u")return;const{body:e}=document,s=e.style.overflow;return e.style.overflow="hidden",()=>{e.style.overflow=s}},[c]);const n=t.useCallback(e=>{i===void 0&&F(!1),e==null||e()},[i]);t.useEffect(()=>{if(!c||typeof document>"u")return;const e=s=>{s.key==="Escape"&&n(d)};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[n,c,d]);const P=e=>{if(e.disabled)return;const s=a.includes(e.value)?a.filter(G=>G!==e.value):[...a,e.value];w===void 0&&g(s),b==null||b(s,e)};if(!c||typeof document>"u")return null;const N=(j==null?void 0:j())??document.body;return N?U.createPortal(r.jsxs("div",{className:J("bj-mobile-drawer",L&&"bj-mobile-drawer--open",M),style:y===void 0?void 0:{zIndex:y},children:[r.jsx("div",{"aria-hidden":"true",className:"bj-mobile-drawer__mask",onClick:D?()=>n(d):void 0}),r.jsxs("div",{"aria-modal":"true",className:"bj-mobile-drawer__panel",role:"dialog",style:{maxHeight:I,...A},children:[r.jsxs("div",{className:"bj-mobile-drawer__header",children:[r.jsx("div",{className:"bj-mobile-drawer__title",children:k}),B&&r.jsx("button",{"aria-label":o("关闭"),className:"bj-mobile-drawer__close",onClick:()=>n(d),type:"button",children:r.jsx(H,{type:"icon-a-guanbixi"})})]}),r.jsx("div",{className:"bj-mobile-drawer__body",children:_.length>0?_.map(e=>r.jsx(X.BCheckBox,{checked:a.includes(e.value),className:"bj-mobile-drawer__option",disabled:e.disabled,onChange:()=>P(e),shape:"circle",skipGroup:!0,children:r.jsx("span",{className:"bj-mobile-drawer__option-label",children:e.label})},String(e.value))):r.jsx("div",{className:"bj-mobile-drawer__empty",children:V??o("暂无数据")})}),u!==!1&&r.jsx("div",{className:"bj-mobile-drawer__footer",children:u===void 0||u===!0?r.jsxs(r.Fragment,{children:[r.jsx("button",{className:"bj-mobile-drawer__action",onClick:()=>n(q),type:"button",children:T}),r.jsx("button",{className:"bj-mobile-drawer__action bj-mobile-drawer__action--primary",onClick:()=>n(()=>f==null?void 0:f(a)),type:"button",children:S})]}):u})]})]}),N):null}exports.BMobileDrawer=Q;
@@ -0,0 +1,151 @@
1
+ import { jsxs as m, jsx as r, Fragment as H } from "react/jsx-runtime";
2
+ import { useState as b, useRef as J, useEffect as h, useCallback as Q } from "react";
3
+ import { createPortal as W } from "react-dom";
4
+ import { BCheckBox as Y } from "../CheckBox/index.mjs";
5
+ import Z from "../Icon/Icon.mjs";
6
+ /* empty css */
7
+ function $(...n) {
8
+ return n.filter(Boolean).join(" ");
9
+ }
10
+ const z = 240;
11
+ function te({
12
+ visible: n,
13
+ defaultVisible: B = !1,
14
+ title: V,
15
+ options: y,
16
+ value: p,
17
+ defaultValue: E = [],
18
+ onChange: f,
19
+ onOK: v,
20
+ onCancel: T,
21
+ onClose: o,
22
+ footer: s,
23
+ t: c = (w) => w,
24
+ okText: I = c("确定"),
25
+ cancelText: A = c("取消"),
26
+ emptyText: D,
27
+ closable: F = !0,
28
+ maskClosable: L = !0,
29
+ maxHeight: M = "86.21vh",
30
+ zIndex: j,
31
+ className: R,
32
+ style: S,
33
+ getContainer: _
34
+ }) {
35
+ const [w, q] = b(B), [G, P] = b(E), u = n ?? w, a = p ?? G, [d, N] = b(u), [U, k] = b(u), l = J(null);
36
+ h(() => {
37
+ if (l.current && (clearTimeout(l.current), l.current = null), u) {
38
+ N(!0);
39
+ const e = requestAnimationFrame(() => k(!0));
40
+ return () => cancelAnimationFrame(e);
41
+ }
42
+ return k(!1), l.current = setTimeout(() => {
43
+ l.current = null, N(!1);
44
+ }, z), () => {
45
+ l.current && (clearTimeout(l.current), l.current = null);
46
+ };
47
+ }, [u]), h(() => {
48
+ if (!d || typeof document > "u") return;
49
+ const { body: e } = document, i = e.style.overflow;
50
+ return e.style.overflow = "hidden", () => {
51
+ e.style.overflow = i;
52
+ };
53
+ }, [d]);
54
+ const t = Q((e) => {
55
+ n === void 0 && q(!1), e == null || e();
56
+ }, [n]);
57
+ h(() => {
58
+ if (!d || typeof document > "u") return;
59
+ const e = (i) => {
60
+ i.key === "Escape" && t(o);
61
+ };
62
+ return document.addEventListener("keydown", e), () => document.removeEventListener("keydown", e);
63
+ }, [t, d, o]);
64
+ const X = (e) => {
65
+ if (e.disabled) return;
66
+ const i = a.includes(e.value) ? a.filter((g) => g !== e.value) : [...a, e.value];
67
+ p === void 0 && P(i), f == null || f(i, e);
68
+ };
69
+ if (!d || typeof document > "u") return null;
70
+ const x = (_ == null ? void 0 : _()) ?? document.body;
71
+ return x ? W(
72
+ /* @__PURE__ */ m(
73
+ "div",
74
+ {
75
+ className: $("bj-mobile-drawer", U && "bj-mobile-drawer--open", R),
76
+ style: j === void 0 ? void 0 : { zIndex: j },
77
+ children: [
78
+ /* @__PURE__ */ r(
79
+ "div",
80
+ {
81
+ "aria-hidden": "true",
82
+ className: "bj-mobile-drawer__mask",
83
+ onClick: L ? () => t(o) : void 0
84
+ }
85
+ ),
86
+ /* @__PURE__ */ m(
87
+ "div",
88
+ {
89
+ "aria-modal": "true",
90
+ className: "bj-mobile-drawer__panel",
91
+ role: "dialog",
92
+ style: { maxHeight: M, ...S },
93
+ children: [
94
+ /* @__PURE__ */ m("div", { className: "bj-mobile-drawer__header", children: [
95
+ /* @__PURE__ */ r("div", { className: "bj-mobile-drawer__title", children: V }),
96
+ F && /* @__PURE__ */ r(
97
+ "button",
98
+ {
99
+ "aria-label": c("关闭"),
100
+ className: "bj-mobile-drawer__close",
101
+ onClick: () => t(o),
102
+ type: "button",
103
+ children: /* @__PURE__ */ r(Z, { type: "icon-a-guanbixi" })
104
+ }
105
+ )
106
+ ] }),
107
+ /* @__PURE__ */ r("div", { className: "bj-mobile-drawer__body", children: y.length > 0 ? y.map((e) => /* @__PURE__ */ r(
108
+ Y,
109
+ {
110
+ checked: a.includes(e.value),
111
+ className: "bj-mobile-drawer__option",
112
+ disabled: e.disabled,
113
+ onChange: () => X(e),
114
+ shape: "circle",
115
+ skipGroup: !0,
116
+ children: /* @__PURE__ */ r("span", { className: "bj-mobile-drawer__option-label", children: e.label })
117
+ },
118
+ String(e.value)
119
+ )) : /* @__PURE__ */ r("div", { className: "bj-mobile-drawer__empty", children: D ?? c("暂无数据") }) }),
120
+ s !== !1 && /* @__PURE__ */ r("div", { className: "bj-mobile-drawer__footer", children: s === void 0 || s === !0 ? /* @__PURE__ */ m(H, { children: [
121
+ /* @__PURE__ */ r(
122
+ "button",
123
+ {
124
+ className: "bj-mobile-drawer__action",
125
+ onClick: () => t(T),
126
+ type: "button",
127
+ children: A
128
+ }
129
+ ),
130
+ /* @__PURE__ */ r(
131
+ "button",
132
+ {
133
+ className: "bj-mobile-drawer__action bj-mobile-drawer__action--primary",
134
+ onClick: () => t(() => v == null ? void 0 : v(a)),
135
+ type: "button",
136
+ children: I
137
+ }
138
+ )
139
+ ] }) : s })
140
+ ]
141
+ }
142
+ )
143
+ ]
144
+ }
145
+ ),
146
+ x
147
+ ) : null;
148
+ }
149
+ export {
150
+ te as BMobileDrawer
151
+ };
@@ -1 +1 @@
1
- "use strict";const t=require("react/jsx-runtime"),l=require("react"),ae=require("react-dom");;/* empty css */function le({triggerRect:w,dropdownHeight:r,viewportHeight:L}){const x=L-w.bottom,b=w.top;return x<r&&b>=r?"top":"bottom"}const re=w=>{const{current:r,defaultCurrent:L=1,pageSize:x,defaultPageSize:b=10,total:v=0,onChange:c,onShowSizeChange:N,showSizeChanger:A=!1,showQuickJumper:q=!1,pageSizeOptions:S=[10,20,50,100],disabled:a=!1,hideOnSinglePage:T=!1,showTotal:y,size:H="medium",align:J="start",simple:Q=!1,popupPlacement:d,resolvePopupPlacement:k,dropdownClassName:P,t:j=e=>e,className:$,style:M}=w,[W,E]=l.useState(L),[F,G]=l.useState(b),[g,f]=l.useState(!1),[C,K]=l.useState("bottom"),[z,U]=l.useState(null),p=l.useRef(null),R=l.useRef(null),s=r??W,u=x??F,o=Math.ceil(v/u);if(T&&o<=1)return null;const h=e=>{a||e<1||e>o||e===s||(r===void 0&&E(e),c==null||c(e,u))},V=e=>{const i=Math.ceil(v/e),n=Math.min(s,i)||1;x===void 0&&(G(e),r===void 0&&E(n)),N==null||N(n,e),c==null||c(n,e)},B=e=>{if(!p.current)return;const i=p.current.getBoundingClientRect();U({left:i.left+i.width/2,top:e==="bottom"?i.bottom+4:i.top-4})},X=()=>{if(a)return;if(g){f(!1);return}let e=C;if(d===void 0&&p.current){const i=p.current.getBoundingClientRect(),n=S.length*40+8,m=window.innerHeight;e=(k==null?void 0:k({triggerRect:i,dropdownHeight:n,viewportHeight:m}))??le({triggerRect:i,dropdownHeight:n,viewportHeight:m}),K(e)}B(d??e),f(!0)},Y=e=>{V(e),f(!1)};l.useEffect(()=>{const e=m=>{var I,Z;const O=m.target;(I=p.current)!=null&&I.contains(O)||(Z=R.current)!=null&&Z.contains(O)||f(!1)},i=()=>f(!1),n=()=>B(d??C);if(g)return document.addEventListener("mousedown",e),document.addEventListener("scroll",i,!0),window.addEventListener("resize",n),()=>{document.removeEventListener("mousedown",e),document.removeEventListener("scroll",i,!0),window.removeEventListener("resize",n)}},[g,d,C]);const _=e=>{const i=parseInt(e.target.value);!isNaN(i)&&i>=1&&i<=o&&h(i)},ee=l.useMemo(()=>{const e=[];if(o<=7)for(let n=1;n<=o;n++)e.push(n);else if(s<=4){for(let n=1;n<=5;n++)e.push(n);e.push("..."),e.push(o)}else if(s>=o-3){e.push(1),e.push("...");for(let n=o-4;n<=o;n++)e.push(n)}else{e.push(1),e.push("...");for(let n=s-1;n<=s+1;n++)e.push(n);e.push("..."),e.push(o)}return e},[s,o]),te=(s-1)*u+1,ne=Math.min(s*u,v),ie=`pagination-${H}`,se=`pagination-${J}`,D=a?"pagination-disabled":"",oe=(e,i)=>{if(e==="...")return t.jsx("span",{className:"pagination-item pagination-ellipsis",children:"..."},`ellipsis-${i}`);const m=e===s?"pagination-item-active":"";return t.jsx("button",{type:"button",className:`pagination-item ${m}`,onClick:()=>h(e),disabled:a,children:e},e)};return Q?t.jsx("div",{className:`pagination pagination-simple ${D} ${$||""}`,style:M,children:t.jsxs("div",{className:"pagination-simple-list",children:[t.jsx("button",{type:"button",className:"pagination-simple-item pagination-simple-prev",onClick:()=>h(s-1),disabled:a||s===1,children:t.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",children:t.jsx("path",{d:"M8 2L4 6L8 10",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}),t.jsxs("span",{className:"pagination-simple-text",children:[s," / ",o||0]}),t.jsx("button",{type:"button",className:"pagination-simple-item pagination-simple-next",onClick:()=>h(s+1),disabled:a||s===o,children:t.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",children:t.jsx("path",{d:"M4 2L8 6L4 10",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})})]})}):t.jsxs("div",{className:`pagination ${ie} ${se} ${D} ${$||""}`,style:M,children:[y&&t.jsx("div",{className:"pagination-total",children:y(v,[te,ne])}),t.jsxs("div",{className:"pagination-list",children:[t.jsx("button",{type:"button",className:"pagination-item pagination-prev",onClick:()=>h(s-1),disabled:a||s===1,children:t.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[t.jsx("path",{d:"M11.1749 5.57516C11.3377 5.41245 11.6014 5.41245 11.7641 5.57516C11.9268 5.73788 11.9268 6.00164 11.7641 6.16436L7.8945 10.034L11.7617 13.8366C11.9257 13.998 11.9279 14.2617 11.7666 14.4258C11.6052 14.5899 11.3414 14.592 11.1774 14.4307L7.2105 10.5299C6.93541 10.2594 6.93349 9.81648 7.20629 9.54367L11.1749 5.57516Z",fill:"#333333"}),t.jsx("path",{d:"M11.1749 5.57516C11.3377 5.41245 11.6014 5.41245 11.7641 5.57516C11.9268 5.73788 11.9268 6.00164 11.7641 6.16436L7.8945 10.034L11.7617 13.8366C11.9257 13.998 11.9279 14.2617 11.7666 14.4258C11.6052 14.5899 11.3414 14.592 11.1774 14.4307L7.2105 10.5299C6.93541 10.2594 6.93349 9.81648 7.20629 9.54367L11.1749 5.57516Z",fill:"black",fillOpacity:"0.2"})]})}),ee.map((e,i)=>oe(e,i)),t.jsx("button",{type:"button",className:"pagination-item pagination-next",onClick:()=>h(s+1),disabled:a||s===o,children:t.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[t.jsx("path",{d:"M8.82507 5.57516C8.66235 5.41245 8.39859 5.41245 8.23587 5.57516C8.07315 5.73788 8.07315 6.00164 8.23587 6.16436L12.1055 10.034L8.23831 13.8366C8.07427 13.998 8.0721 14.2617 8.23343 14.4258C8.39478 14.5899 8.65856 14.592 8.82262 14.4307L12.7895 10.5299C13.0646 10.2594 13.0665 9.81648 12.7937 9.54367L8.82507 5.57516Z",fill:"#333333"}),t.jsx("path",{d:"M8.82507 5.57516C8.66235 5.41245 8.39859 5.41245 8.23587 5.57516C8.07315 5.73788 8.07315 6.00164 8.23587 6.16436L12.1055 10.034L8.23831 13.8366C8.07427 13.998 8.0721 14.2617 8.23343 14.4258C8.39478 14.5899 8.65856 14.592 8.82262 14.4307L12.7895 10.5299C13.0646 10.2594 13.0665 9.81648 12.7937 9.54367L8.82507 5.57516Z",fill:"black","fill-opacity":"0.2"})]})})]}),A&&t.jsxs("div",{className:"pagination-sizer",ref:p,children:[t.jsxs("button",{type:"button",className:"pagination-sizer-select",onClick:X,disabled:a,children:[u,j("条/页"),t.jsxs("svg",{className:`pagination-sizer-icon${g?" pagination-sizer-icon-open":""}`,width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[t.jsx("path",{d:"M5.57321 8.828C5.41049 8.66528 5.41049 8.40152 5.57321 8.2388C5.73593 8.07608 5.99969 8.07608 6.1624 8.2388L10.032 12.1084L13.8347 8.24124C13.996 8.0772 14.2598 8.07503 14.4239 8.23636C14.5879 8.39771 14.5901 8.66149 14.4287 8.82555L10.5279 12.7924C10.2574 13.0675 9.81452 13.0694 9.54172 12.7966L5.57321 8.828Z",fill:"#333333"}),t.jsx("path",{d:"M5.57321 8.828C5.41049 8.66528 5.41049 8.40152 5.57321 8.2388C5.73593 8.07608 5.99969 8.07608 6.1624 8.2388L10.032 12.1084L13.8347 8.24124C13.996 8.0772 14.2598 8.07503 14.4239 8.23636C14.5879 8.39771 14.5901 8.66149 14.4287 8.82555L10.5279 12.7924C10.2574 13.0675 9.81452 13.0694 9.54172 12.7966L5.57321 8.828Z",fill:"black",fillOpacity:"0.2"})]})]}),g&&z&&ae.createPortal(t.jsx("div",{ref:R,className:`pagination-sizer-dropdown pagination-sizer-dropdown-${d??C}${P?` ${P}`:""}`,style:{position:"fixed",left:z.left,top:z.top,zIndex:99999,transform:(d??C)==="bottom"?"translate(-50%, 0)":"translate(-50%, -100%)"},children:S.map(e=>t.jsxs("button",{type:"button",className:"pagination-sizer-option",onClick:()=>Y(e),"data-selected":e===u,children:[e,j("条/页")]},e))}),document.body)]}),q&&t.jsxs("div",{className:"pagination-jumper",children:[t.jsx("span",{children:j("跳至")}),t.jsx("input",{type:"number",className:"pagination-jumper-input",min:1,max:o,onChange:_,disabled:a,placeholder:""}),t.jsx("span",{children:j("页")})]})]})};module.exports=re;
1
+ "use strict";const t=require("react/jsx-runtime"),l=require("react"),ae=require("react-dom");;/* empty css */function le({triggerRect:w,dropdownHeight:r,viewportHeight:L}){const x=L-w.bottom,b=w.top;return x<r&&b>=r?"top":"bottom"}const re=w=>{const{current:r,defaultCurrent:L=1,pageSize:x,defaultPageSize:b=10,total:v=0,onChange:c,onShowSizeChange:N,showSizeChanger:A=!1,showQuickJumper:q=!1,pageSizeOptions:S=[10,20,50,100],disabled:a=!1,hideOnSinglePage:T=!1,showTotal:y,size:H="medium",align:J="start",simple:Q=!1,popupPlacement:d,resolvePopupPlacement:k,dropdownClassName:P,t:j=e=>e,className:$,style:M}=w,[W,E]=l.useState(L),[F,G]=l.useState(b),[g,f]=l.useState(!1),[C,K]=l.useState("bottom"),[z,U]=l.useState(null),p=l.useRef(null),R=l.useRef(null),s=r??W,u=x??F,o=Math.ceil(v/u);if(T&&o<=1)return null;const h=e=>{a||e<1||e>o||e===s||(r===void 0&&E(e),c==null||c(e,u))},V=e=>{const i=Math.ceil(v/e),n=Math.min(s,i)||1;x===void 0&&(G(e),r===void 0&&E(n)),N==null||N(n,e),c==null||c(n,e)},O=e=>{if(!p.current)return;const i=p.current.getBoundingClientRect();U({left:i.left+i.width/2,top:e==="bottom"?i.bottom+4:i.top-4})},X=()=>{if(a)return;if(g){f(!1);return}let e=C;if(d===void 0&&p.current){const i=p.current.getBoundingClientRect(),n=S.length*40+8,m=window.innerHeight;e=(k==null?void 0:k({triggerRect:i,dropdownHeight:n,viewportHeight:m}))??le({triggerRect:i,dropdownHeight:n,viewportHeight:m}),K(e)}O(d??e),f(!0)},Y=e=>{V(e),f(!1)};l.useEffect(()=>{const e=m=>{var I,Z;const D=m.target;(I=p.current)!=null&&I.contains(D)||(Z=R.current)!=null&&Z.contains(D)||f(!1)},i=()=>f(!1),n=()=>O(d??C);if(g)return document.addEventListener("mousedown",e),document.addEventListener("scroll",i,!0),window.addEventListener("resize",n),()=>{document.removeEventListener("mousedown",e),document.removeEventListener("scroll",i,!0),window.removeEventListener("resize",n)}},[g,d,C]);const _=e=>{const i=parseInt(e.target.value);!isNaN(i)&&i>=1&&i<=o&&h(i)},ee=l.useMemo(()=>{const e=[];if(o<=7)for(let n=1;n<=o;n++)e.push(n);else if(s<=4){for(let n=1;n<=5;n++)e.push(n);e.push("..."),e.push(o)}else if(s>=o-3){e.push(1),e.push("...");for(let n=o-4;n<=o;n++)e.push(n)}else{e.push(1),e.push("...");for(let n=s-1;n<=s+1;n++)e.push(n);e.push("..."),e.push(o)}return e},[s,o]),te=(s-1)*u+1,ne=Math.min(s*u,v),ie=`pagination-${H}`,se=`pagination-${J}`,B=a?"pagination-disabled":"",oe=(e,i)=>{if(e==="...")return t.jsx("span",{className:"pagination-item pagination-ellipsis",children:"..."},`ellipsis-${i}`);const m=e===s?"pagination-item-active":"";return t.jsx("button",{type:"button",className:`pagination-item ${m}`,onClick:()=>h(e),disabled:a,children:e},e)};return Q?t.jsx("div",{className:`pagination pagination-simple ${B} ${$||""}`,style:M,children:t.jsxs("div",{className:"pagination-simple-list",children:[t.jsx("button",{type:"button",className:"pagination-simple-item pagination-simple-prev",onClick:()=>h(s-1),disabled:a||s===1,children:t.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",children:t.jsx("path",{d:"M8 2L4 6L8 10",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}),t.jsxs("span",{className:"pagination-simple-text",children:[s," / ",o||0]}),t.jsx("button",{type:"button",className:"pagination-simple-item pagination-simple-next",onClick:()=>h(s+1),disabled:a||s===o,children:t.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",children:t.jsx("path",{d:"M4 2L8 6L4 10",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})})]})}):t.jsxs("div",{className:`pagination ${ie} ${se} ${B} ${$||""}`,style:M,children:[typeof y=="function"&&t.jsx("div",{className:"pagination-total",children:y(v,[te,ne])}),t.jsxs("div",{className:"pagination-list",children:[t.jsx("button",{type:"button",className:"pagination-item pagination-prev",onClick:()=>h(s-1),disabled:a||s===1,children:t.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[t.jsx("path",{d:"M11.1749 5.57516C11.3377 5.41245 11.6014 5.41245 11.7641 5.57516C11.9268 5.73788 11.9268 6.00164 11.7641 6.16436L7.8945 10.034L11.7617 13.8366C11.9257 13.998 11.9279 14.2617 11.7666 14.4258C11.6052 14.5899 11.3414 14.592 11.1774 14.4307L7.2105 10.5299C6.93541 10.2594 6.93349 9.81648 7.20629 9.54367L11.1749 5.57516Z",fill:"#333333"}),t.jsx("path",{d:"M11.1749 5.57516C11.3377 5.41245 11.6014 5.41245 11.7641 5.57516C11.9268 5.73788 11.9268 6.00164 11.7641 6.16436L7.8945 10.034L11.7617 13.8366C11.9257 13.998 11.9279 14.2617 11.7666 14.4258C11.6052 14.5899 11.3414 14.592 11.1774 14.4307L7.2105 10.5299C6.93541 10.2594 6.93349 9.81648 7.20629 9.54367L11.1749 5.57516Z",fill:"black",fillOpacity:"0.2"})]})}),ee.map((e,i)=>oe(e,i)),t.jsx("button",{type:"button",className:"pagination-item pagination-next",onClick:()=>h(s+1),disabled:a||s===o,children:t.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[t.jsx("path",{d:"M8.82507 5.57516C8.66235 5.41245 8.39859 5.41245 8.23587 5.57516C8.07315 5.73788 8.07315 6.00164 8.23587 6.16436L12.1055 10.034L8.23831 13.8366C8.07427 13.998 8.0721 14.2617 8.23343 14.4258C8.39478 14.5899 8.65856 14.592 8.82262 14.4307L12.7895 10.5299C13.0646 10.2594 13.0665 9.81648 12.7937 9.54367L8.82507 5.57516Z",fill:"#333333"}),t.jsx("path",{d:"M8.82507 5.57516C8.66235 5.41245 8.39859 5.41245 8.23587 5.57516C8.07315 5.73788 8.07315 6.00164 8.23587 6.16436L12.1055 10.034L8.23831 13.8366C8.07427 13.998 8.0721 14.2617 8.23343 14.4258C8.39478 14.5899 8.65856 14.592 8.82262 14.4307L12.7895 10.5299C13.0646 10.2594 13.0665 9.81648 12.7937 9.54367L8.82507 5.57516Z",fill:"black",fillOpacity:"0.2"})]})})]}),A&&t.jsxs("div",{className:"pagination-sizer",ref:p,children:[t.jsxs("button",{type:"button",className:"pagination-sizer-select",onClick:X,disabled:a,children:[u,j("条/页"),t.jsxs("svg",{className:`pagination-sizer-icon${g?" pagination-sizer-icon-open":""}`,width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[t.jsx("path",{d:"M5.57321 8.828C5.41049 8.66528 5.41049 8.40152 5.57321 8.2388C5.73593 8.07608 5.99969 8.07608 6.1624 8.2388L10.032 12.1084L13.8347 8.24124C13.996 8.0772 14.2598 8.07503 14.4239 8.23636C14.5879 8.39771 14.5901 8.66149 14.4287 8.82555L10.5279 12.7924C10.2574 13.0675 9.81452 13.0694 9.54172 12.7966L5.57321 8.828Z",fill:"#333333"}),t.jsx("path",{d:"M5.57321 8.828C5.41049 8.66528 5.41049 8.40152 5.57321 8.2388C5.73593 8.07608 5.99969 8.07608 6.1624 8.2388L10.032 12.1084L13.8347 8.24124C13.996 8.0772 14.2598 8.07503 14.4239 8.23636C14.5879 8.39771 14.5901 8.66149 14.4287 8.82555L10.5279 12.7924C10.2574 13.0675 9.81452 13.0694 9.54172 12.7966L5.57321 8.828Z",fill:"black",fillOpacity:"0.2"})]})]}),g&&z&&ae.createPortal(t.jsx("div",{ref:R,className:`pagination-sizer-dropdown pagination-sizer-dropdown-${d??C}${P?` ${P}`:""}`,style:{position:"fixed",left:z.left,top:z.top,zIndex:99999,transform:(d??C)==="bottom"?"translate(-50%, 0)":"translate(-50%, -100%)"},children:S.map(e=>t.jsxs("button",{type:"button",className:"pagination-sizer-option",onClick:()=>Y(e),"data-selected":e===u,children:[e,j("条/页")]},e))}),document.body)]}),q&&t.jsxs("div",{className:"pagination-jumper",children:[t.jsx("span",{children:j("跳至")}),t.jsx("input",{type:"number",className:"pagination-jumper-input",min:1,max:o,onChange:_,disabled:a,placeholder:""}),t.jsx("span",{children:j("页")})]})]})};module.exports=re;
@@ -33,15 +33,15 @@ const ft = (v) => {
33
33
  dropdownClassName: S,
34
34
  t: N = (t) => t,
35
35
  className: E,
36
- style: B
37
- } = v, [G, O] = w(k), [K, U] = w(z), [m, g] = w(!1), [f, V] = w("bottom"), [P, X] = w(null), p = T(null), R = T(null), o = r ?? G, u = L ?? K, s = Math.ceil(b / u);
36
+ style: O
37
+ } = v, [G, B] = w(k), [K, U] = w(z), [m, g] = w(!1), [f, V] = w("bottom"), [P, X] = w(null), p = T(null), R = T(null), o = r ?? G, u = L ?? K, s = Math.ceil(b / u);
38
38
  if (Q && s <= 1)
39
39
  return null;
40
40
  const h = (t) => {
41
- l || t < 1 || t > s || t === o || (r === void 0 && O(t), c == null || c(t, u));
41
+ l || t < 1 || t > s || t === o || (r === void 0 && B(t), c == null || c(t, u));
42
42
  }, Y = (t) => {
43
43
  const n = Math.ceil(b / t), e = Math.min(o, n) || 1;
44
- L === void 0 && (U(t), r === void 0 && O(e)), x == null || x(e, t), c == null || c(e, t);
44
+ L === void 0 && (U(t), r === void 0 && B(e)), x == null || x(e, t), c == null || c(e, t);
45
45
  }, D = (t) => {
46
46
  if (!p.current) return;
47
47
  const n = p.current.getBoundingClientRect();
@@ -113,7 +113,7 @@ const ft = (v) => {
113
113
  "div",
114
114
  {
115
115
  className: `pagination pagination-simple ${j} ${E || ""}`,
116
- style: B,
116
+ style: O,
117
117
  children: /* @__PURE__ */ a("div", { className: "pagination-simple-list", children: [
118
118
  /* @__PURE__ */ i(
119
119
  "button",
@@ -146,9 +146,9 @@ const ft = (v) => {
146
146
  "div",
147
147
  {
148
148
  className: `pagination ${st} ${at} ${j} ${E || ""}`,
149
- style: B,
149
+ style: O,
150
150
  children: [
151
- M && /* @__PURE__ */ i("div", { className: "pagination-total", children: M(b, [it, ot]) }),
151
+ typeof M == "function" && /* @__PURE__ */ i("div", { className: "pagination-total", children: M(b, [it, ot]) }),
152
152
  /* @__PURE__ */ a("div", { className: "pagination-list", children: [
153
153
  /* @__PURE__ */ i(
154
154
  "button",
@@ -173,7 +173,7 @@ const ft = (v) => {
173
173
  disabled: l || o === s,
174
174
  children: /* @__PURE__ */ a("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [
175
175
  /* @__PURE__ */ i("path", { d: "M8.82507 5.57516C8.66235 5.41245 8.39859 5.41245 8.23587 5.57516C8.07315 5.73788 8.07315 6.00164 8.23587 6.16436L12.1055 10.034L8.23831 13.8366C8.07427 13.998 8.0721 14.2617 8.23343 14.4258C8.39478 14.5899 8.65856 14.592 8.82262 14.4307L12.7895 10.5299C13.0646 10.2594 13.0665 9.81648 12.7937 9.54367L8.82507 5.57516Z", fill: "#333333" }),
176
- /* @__PURE__ */ i("path", { d: "M8.82507 5.57516C8.66235 5.41245 8.39859 5.41245 8.23587 5.57516C8.07315 5.73788 8.07315 6.00164 8.23587 6.16436L12.1055 10.034L8.23831 13.8366C8.07427 13.998 8.0721 14.2617 8.23343 14.4258C8.39478 14.5899 8.65856 14.592 8.82262 14.4307L12.7895 10.5299C13.0646 10.2594 13.0665 9.81648 12.7937 9.54367L8.82507 5.57516Z", fill: "black", "fill-opacity": "0.2" })
176
+ /* @__PURE__ */ i("path", { d: "M8.82507 5.57516C8.66235 5.41245 8.39859 5.41245 8.23587 5.57516C8.07315 5.73788 8.07315 6.00164 8.23587 6.16436L12.1055 10.034L8.23831 13.8366C8.07427 13.998 8.0721 14.2617 8.23343 14.4258C8.39478 14.5899 8.65856 14.592 8.82262 14.4307L12.7895 10.5299C13.0646 10.2594 13.0665 9.81648 12.7937 9.54367L8.82507 5.57516Z", fill: "black", fillOpacity: "0.2" })
177
177
  ] })
178
178
  }
179
179
  )
@@ -0,0 +1 @@
1
+ "use strict";const n=require("react/jsx-runtime"),i=require("react"),p=require("./context.js");;/* empty css */function M(...o){return o.filter(Boolean).join(" ")}const x=i.forwardRef((o,C)=>{const{checked:d,defaultChecked:f=!1,disabled:l,children:u,className:k,style:v,onChange:r,onMouseEnter:N,onMouseLeave:_,value:t,name:y,direction:R="ltr",variant:b="dark",...g}=o,e=i.useContext(p.RadioGroupContext),B=i.useContext(p.RadioOptionTypeContext),[q,E]=i.useState(f),a=!!e,D=((e==null?void 0:e.optionType)||B)==="button",h=a?t===e.value:d??q,c=a?l??e.disabled:l,P=a?e==null?void 0:e.name:y,T=a?(e==null?void 0:e.variant)??b:b,G=s=>{if(c)return;const j=s.target.checked;!a&&d===void 0&&E(j);const m={target:{...o,checked:j,value:t},stopPropagation:()=>s.stopPropagation(),preventDefault:()=>s.preventDefault(),nativeEvent:s.nativeEvent};r==null||r(m),e==null||e.onChange(m)};return n.jsxs("label",{className:M("bj-radio",`bj-radio--${T}`,h&&"bj-radio--checked",c&&"bj-radio--disabled",R==="rtl"&&"bj-radio--rtl",D&&"bj-radio--button",k),onMouseEnter:N,onMouseLeave:_,style:v,children:[n.jsxs("span",{className:"bj-radio__control",children:[n.jsx("input",{...g,checked:h,className:"bj-radio__input",disabled:c,name:P,onChange:G,ref:C,type:"radio",value:typeof t=="boolean"?String(t):t}),n.jsx("span",{className:"bj-radio__inner"})]}),u!==void 0&&n.jsx("span",{className:"bj-radio__label",children:u})]})});x.displayName="BRadio";module.exports=x;
@@ -0,0 +1,79 @@
1
+ import { jsxs as f, jsx as r } from "react/jsx-runtime";
2
+ import { forwardRef as M, useContext as u, useState as S } from "react";
3
+ import { RadioGroupContext as w, RadioOptionTypeContext as I } from "./context.mjs";
4
+ /* empty css */
5
+ function L(...n) {
6
+ return n.filter(Boolean).join(" ");
7
+ }
8
+ const O = M((n, j) => {
9
+ const {
10
+ checked: s,
11
+ defaultChecked: k = !1,
12
+ disabled: c,
13
+ children: l,
14
+ className: v,
15
+ style: C,
16
+ onChange: i,
17
+ onMouseEnter: N,
18
+ onMouseLeave: x,
19
+ value: a,
20
+ name: _,
21
+ direction: y = "ltr",
22
+ variant: m = "dark",
23
+ ...g
24
+ } = n, e = u(w), B = u(I), [R, E] = S(k), t = !!e, D = ((e == null ? void 0 : e.optionType) || B) === "button", b = t ? a === e.value : s ?? R, d = t ? c ?? e.disabled : c, P = t ? e == null ? void 0 : e.name : _, T = t ? (e == null ? void 0 : e.variant) ?? m : m, G = (o) => {
25
+ if (d) return;
26
+ const p = o.target.checked;
27
+ !t && s === void 0 && E(p);
28
+ const h = {
29
+ // Group 内的单选项始终带 value;保持 target.value 与 props.value 同源,
30
+ // 同时让类型收窄为 RadioValueType,避免调用方每次都要判空。
31
+ target: { ...n, checked: p, value: a },
32
+ stopPropagation: () => o.stopPropagation(),
33
+ preventDefault: () => o.preventDefault(),
34
+ nativeEvent: o.nativeEvent
35
+ };
36
+ i == null || i(h), e == null || e.onChange(h);
37
+ };
38
+ return /* @__PURE__ */ f(
39
+ "label",
40
+ {
41
+ className: L(
42
+ "bj-radio",
43
+ `bj-radio--${T}`,
44
+ b && "bj-radio--checked",
45
+ d && "bj-radio--disabled",
46
+ y === "rtl" && "bj-radio--rtl",
47
+ D && "bj-radio--button",
48
+ v
49
+ ),
50
+ onMouseEnter: N,
51
+ onMouseLeave: x,
52
+ style: C,
53
+ children: [
54
+ /* @__PURE__ */ f("span", { className: "bj-radio__control", children: [
55
+ /* @__PURE__ */ r(
56
+ "input",
57
+ {
58
+ ...g,
59
+ checked: b,
60
+ className: "bj-radio__input",
61
+ disabled: d,
62
+ name: P,
63
+ onChange: G,
64
+ ref: j,
65
+ type: "radio",
66
+ value: typeof a == "boolean" ? String(a) : a
67
+ }
68
+ ),
69
+ /* @__PURE__ */ r("span", { className: "bj-radio__inner" })
70
+ ] }),
71
+ l !== void 0 && /* @__PURE__ */ r("span", { className: "bj-radio__label", children: l })
72
+ ]
73
+ }
74
+ );
75
+ });
76
+ O.displayName = "BRadio";
77
+ export {
78
+ O as default
79
+ };
@@ -0,0 +1 @@
1
+ "use strict";const t=require("react/jsx-runtime"),i=require("react"),n=require("./BRadio.js"),s=require("./context.js"),e=i.forwardRef((o,r)=>t.jsx(s.RadioOptionTypeContext.Provider,{value:"button",children:t.jsx(n,{...o,ref:r})}));e.displayName="BRadio.Button";module.exports=e;
@@ -0,0 +1,9 @@
1
+ import { jsx as o } from "react/jsx-runtime";
2
+ import { forwardRef as i } from "react";
3
+ import a from "./BRadio.mjs";
4
+ import { RadioOptionTypeContext as e } from "./context.mjs";
5
+ const m = i((t, r) => /* @__PURE__ */ o(e.Provider, { value: "button", children: /* @__PURE__ */ o(a, { ...t, ref: r }) }));
6
+ m.displayName = "BRadio.Button";
7
+ export {
8
+ m as default
9
+ };
@@ -0,0 +1 @@
1
+ "use strict";const o=require("react/jsx-runtime"),s=require("react"),w=require("./BRadio.js"),z=require("./context.js");function I(...t){return t.filter(Boolean).join(" ")}function P(t){return(t??[]).map(e=>typeof e=="string"||typeof e=="number"?{label:e,value:e}:e)}const j=s.forwardRef(({defaultValue:t,value:e,onChange:u,options:a,children:v,disabled:l,name:c,className:f,style:x,id:R,direction:q="ltr",variant:d="dark",optionType:i,buttonStyle:B="outline",size:m,onMouseEnter:y,onMouseLeave:G,onFocus:N,onBlur:h},M)=>{const[O,S]=s.useState(t),n=e!==void 0?e:O,b=i==="button",V=s.useMemo(()=>P(a),[a]),k=s.useMemo(()=>({name:c,value:n,disabled:l,variant:d,optionType:i,onChange:r=>{const g=r.target.value;e===void 0&&S(g),g!==n&&(u==null||u(r))}}),[e,l,n,c,u,i,d]),p=a&&a.length>0?V.map(r=>o.jsx(w,{disabled:r.disabled||l,onChange:r.onChange,style:r.style,value:r.value,children:r.label},String(r.value))):v;return o.jsx("div",{className:I("bj-radio-group",b&&"bj-radio-group--button",b&&B==="solid"&&"bj-radio-group--solid",m==="large"&&"bj-radio-group--lg",m==="small"&&"bj-radio-group--sm",q==="rtl"&&"bj-radio-group--rtl",f),id:R,onBlur:h,onFocus:N,onMouseEnter:y,onMouseLeave:G,ref:M,style:x,children:o.jsx(z.RadioGroupContext.Provider,{value:k,children:p})})});j.displayName="BRadio.Group";module.exports=j;
@@ -0,0 +1,80 @@
1
+ import { jsx as i } from "react/jsx-runtime";
2
+ import { forwardRef as z, useState as I, useMemo as b } from "react";
3
+ import M from "./BRadio.mjs";
4
+ import { RadioGroupContext as P } from "./context.mjs";
5
+ function q(...a) {
6
+ return a.filter(Boolean).join(" ");
7
+ }
8
+ function A(a) {
9
+ return (a ?? []).map((r) => typeof r == "string" || typeof r == "number" ? { label: r, value: r } : r);
10
+ }
11
+ const D = z(({
12
+ defaultValue: a,
13
+ value: r,
14
+ onChange: l,
15
+ options: t,
16
+ children: g,
17
+ disabled: u,
18
+ name: d,
19
+ className: v,
20
+ style: j,
21
+ id: p,
22
+ direction: x = "ltr",
23
+ variant: m = "dark",
24
+ optionType: s,
25
+ buttonStyle: B = "outline",
26
+ size: n,
27
+ onMouseEnter: R,
28
+ onMouseLeave: y,
29
+ onFocus: G,
30
+ onBlur: N
31
+ }, h) => {
32
+ const [O, S] = I(a), o = r !== void 0 ? r : O, c = s === "button", V = b(() => A(t), [t]), k = b(() => ({
33
+ name: d,
34
+ value: o,
35
+ disabled: u,
36
+ variant: m,
37
+ // 保持原始值(可能是 undefined),以便 BRadio.Button 能在组内生效
38
+ optionType: s,
39
+ onChange: (e) => {
40
+ const f = e.target.value;
41
+ r === void 0 && S(f), f !== o && (l == null || l(e));
42
+ }
43
+ }), [r, u, o, d, l, s, m]), w = t && t.length > 0 ? V.map((e) => /* @__PURE__ */ i(
44
+ M,
45
+ {
46
+ disabled: e.disabled || u,
47
+ onChange: e.onChange,
48
+ style: e.style,
49
+ value: e.value,
50
+ children: e.label
51
+ },
52
+ String(e.value)
53
+ )) : g;
54
+ return /* @__PURE__ */ i(
55
+ "div",
56
+ {
57
+ className: q(
58
+ "bj-radio-group",
59
+ c && "bj-radio-group--button",
60
+ c && B === "solid" && "bj-radio-group--solid",
61
+ n === "large" && "bj-radio-group--lg",
62
+ n === "small" && "bj-radio-group--sm",
63
+ x === "rtl" && "bj-radio-group--rtl",
64
+ v
65
+ ),
66
+ id: p,
67
+ onBlur: N,
68
+ onFocus: G,
69
+ onMouseEnter: R,
70
+ onMouseLeave: y,
71
+ ref: h,
72
+ style: j,
73
+ children: /* @__PURE__ */ i(P.Provider, { value: k, children: w })
74
+ }
75
+ );
76
+ });
77
+ D.displayName = "BRadio.Group";
78
+ export {
79
+ D as default
80
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react"),e=t.createContext(null),o=t.createContext(null);exports.RadioGroupContext=e;exports.RadioOptionTypeContext=o;
@@ -0,0 +1,6 @@
1
+ import { createContext as o } from "react";
2
+ const n = o(null), e = o(null);
3
+ export {
4
+ n as RadioGroupContext,
5
+ e as RadioOptionTypeContext
6
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./BRadio.js"),e=require("./Button.js"),r=require("./Group.js"),o=t;o.Group=r;o.Button=e;o.__ANT_RADIO=!0;exports.BRadio=o;
@@ -0,0 +1,10 @@
1
+ import r from "./BRadio.mjs";
2
+ import t from "./Button.mjs";
3
+ import m from "./Group.mjs";
4
+ const o = r;
5
+ o.Group = m;
6
+ o.Button = t;
7
+ o.__ANT_RADIO = !0;
8
+ export {
9
+ o as BRadio
10
+ };