@runlume/admin-ui 0.2.1 → 0.2.3
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/README.en.md +40 -0
- package/README.md +34 -0
- package/dist-package/components/calendar.cjs +1 -1
- package/dist-package/components/calendar.d.ts.map +1 -1
- package/dist-package/components/calendar.js +1 -1
- package/dist-package/components/charts.cjs +1 -1
- package/dist-package/components/charts.d.ts.map +1 -1
- package/dist-package/components/charts.js +3 -2
- package/dist-package/components/rate.cjs +1 -1
- package/dist-package/components/rate.d.ts.map +1 -1
- package/dist-package/components/rate.js +20 -15
- package/dist-package/components/transfer.cjs +1 -1
- package/dist-package/components/transfer.d.ts.map +1 -1
- package/dist-package/components/transfer.js +2 -1
- package/dist-package/components/ui/alert-dialog.cjs +1 -1
- package/dist-package/components/ui/alert-dialog.d.ts +1 -1
- package/dist-package/components/ui/alert-dialog.d.ts.map +1 -1
- package/dist-package/components/ui/alert-dialog.js +42 -39
- package/dist-package/components/ui/context-menu.cjs +1 -1
- package/dist-package/components/ui/context-menu.d.ts +7 -6
- package/dist-package/components/ui/context-menu.d.ts.map +1 -1
- package/dist-package/components/ui/context-menu.js +28 -24
- package/dist-package/components/ui/dialog.cjs +1 -1
- package/dist-package/components/ui/dialog.d.ts +1 -1
- package/dist-package/components/ui/dialog.d.ts.map +1 -1
- package/dist-package/components/ui/dialog.js +85 -84
- package/dist-package/components/ui/dropdown-menu.cjs +1 -1
- package/dist-package/components/ui/dropdown-menu.d.ts +2 -2
- package/dist-package/components/ui/dropdown-menu.d.ts.map +1 -1
- package/dist-package/components/ui/dropdown-menu.js +74 -69
- package/dist-package/components/ui/native-select.cjs +1 -1
- package/dist-package/components/ui/native-select.d.ts.map +1 -1
- package/dist-package/components/ui/native-select.js +73 -70
- package/dist-package/components/ui/scroll-area.cjs +1 -1
- package/dist-package/components/ui/scroll-area.d.ts.map +1 -1
- package/dist-package/components/ui/scroll-area.js +1 -0
- package/dist-package/components/ui/sheet.cjs +1 -1
- package/dist-package/components/ui/sheet.d.ts +1 -1
- package/dist-package/components/ui/sheet.d.ts.map +1 -1
- package/dist-package/components/ui/sheet.js +45 -42
- package/dist-package/lib/overlay-suppression.cjs +1 -0
- package/dist-package/lib/overlay-suppression.d.ts +25 -0
- package/dist-package/lib/overlay-suppression.d.ts.map +1 -0
- package/dist-package/lib/overlay-suppression.js +36 -0
- package/dist-package/styles.css +1 -1
- package/package.json +5 -4
package/README.en.md
CHANGED
|
@@ -55,6 +55,46 @@ The package supports React 18.2–19, ESM, and CommonJS. Fine-grained imports ar
|
|
|
55
55
|
to readable English instead of exposing i18n keys. Brand assets, example pages, and application state are not
|
|
56
56
|
part of the library exports.
|
|
57
57
|
|
|
58
|
+
## Changelog
|
|
59
|
+
|
|
60
|
+
Only user-visible changes are listed here; see
|
|
61
|
+
[Releases](https://github.com/runlume/admin-design/releases) for the full history.
|
|
62
|
+
|
|
63
|
+
### 0.2.3 (2026-09-22)
|
|
64
|
+
|
|
65
|
+
- Accessibility: while a modal overlay (dialog, sheet, dropdown menu, context menu, select) is open, the
|
|
66
|
+
background is marked with both `aria-hidden` and `inert`, fixing the axe `aria-hidden-focus` violation
|
|
67
|
+
and the "background controls are still tabbable" problem. The state is removed on close and never
|
|
68
|
+
applies to the overlay itself.
|
|
69
|
+
- New accessibility gate `src/test/e2e/a11y.spec.ts`: full axe scans of the nine gallery pages in light and
|
|
70
|
+
dark mode, plus a scan for each opened overlay, asserting focus returns to the trigger and no `inert`
|
|
71
|
+
leaks into the background.
|
|
72
|
+
- Contrast: the `warning` semantic color is darkened to meet AA (`--warning` `#9a6700` → `#946300`;
|
|
73
|
+
contrast against `--warning-soft` 4.44 → 4.74). Out-of-month calendar days, chart bars, and disabled
|
|
74
|
+
transfer rows no longer fall below 4.5:1.
|
|
75
|
+
- Component semantics: rating stars are no longer nested buttons (the outer `role="slider"` owns value and
|
|
76
|
+
keyboard handling); transfer lists use `role="group"` instead of `listbox` (a checkbox group by nature);
|
|
77
|
+
the table corner cell is marked presentational; horizontally scrollable containers are focusable.
|
|
78
|
+
- Tests: added the `@axe-core/playwright` devDependency (test-only, not shipped).
|
|
79
|
+
|
|
80
|
+
### 0.2.2 (2026-09-22)
|
|
81
|
+
|
|
82
|
+
- Refined the warning semantic color and half-star rendering.
|
|
83
|
+
- Fixed language initialization being dropped from production builds.
|
|
84
|
+
|
|
85
|
+
### 0.2.1 (2026-09-22)
|
|
86
|
+
|
|
87
|
+
- Removed internal maintenance notes from the published package.
|
|
88
|
+
- Synced version information across the site and docs.
|
|
89
|
+
|
|
90
|
+
### 0.2.0 (2026-09-22)
|
|
91
|
+
|
|
92
|
+
- Added the remaining advanced components and completed npm consumption (exports, types, styles entry).
|
|
93
|
+
|
|
94
|
+
### 0.1.0 (2026-09-22)
|
|
95
|
+
|
|
96
|
+
- First public release: standard admin theme and semantic tokens, layout shell, shared components, gallery.
|
|
97
|
+
|
|
58
98
|
## Verification
|
|
59
99
|
|
|
60
100
|
```bash
|
package/README.md
CHANGED
|
@@ -50,6 +50,40 @@ import '@runlume/admin-ui/styles.css'
|
|
|
50
50
|
`@runlume/admin-ui/components/data-table` 或 `@runlume/admin-ui/ui/button` 引入。公共组件缺少宿主翻译时会显示内置英文兜底,不会直接暴露 i18n key。
|
|
51
51
|
品牌资源、示例页面以及应用状态不属于组件库出口。
|
|
52
52
|
|
|
53
|
+
## 更新日志
|
|
54
|
+
|
|
55
|
+
只记录对外可见的变化;完整提交历史见 [Releases](https://github.com/runlume/admin-design/releases)。
|
|
56
|
+
|
|
57
|
+
### 0.2.3(2026-09-22)
|
|
58
|
+
|
|
59
|
+
- 无障碍:模态浮层(对话框、抽屉、下拉菜单、右键菜单、选择器)打开时,背景同时标记 `aria-hidden` 与 `inert`,修复
|
|
60
|
+
axe `aria-hidden-focus` 以及"背景控件仍能 Tab 进去"的问题,关闭后自动撤销,浮层自身不受影响。
|
|
61
|
+
- 新增无障碍门禁 `src/test/e2e/a11y.spec.ts`:9 个总览页在浅色与深色下全量 axe 扫描,并逐个展开浮层复扫,
|
|
62
|
+
同时断言关闭后焦点回到触发器、背景不残留 `inert`。
|
|
63
|
+
- 对比度:`warning` 语义色加深到 AA(`--warning` 由 `#9a6700` 调整为 `#946300`,与 `--warning-soft` 对比度 4.44 → 4.74);
|
|
64
|
+
日历跨月日期、图表条形、穿梭框禁用态不再低于 4.5:1。
|
|
65
|
+
- 组件语义:评分星级不再嵌套按钮(外层 `role="slider"` 承载取值与键盘操作);穿梭框两侧容器由 `listbox` 改为
|
|
66
|
+
`group`(复选框组语义);表格角格声明为展示单元;横向滚动容器可聚焦以便键盘滚动。
|
|
67
|
+
- 测试:新增 devDependency `@axe-core/playwright`,仅用于测试,不进产物。
|
|
68
|
+
|
|
69
|
+
### 0.2.2(2026-09-22)
|
|
70
|
+
|
|
71
|
+
- 优化警告语义色与半星显示。
|
|
72
|
+
- 修复生产构建裁掉语言初始化的问题。
|
|
73
|
+
|
|
74
|
+
### 0.2.1(2026-09-22)
|
|
75
|
+
|
|
76
|
+
- 移除公开发布包中的内部维护信息。
|
|
77
|
+
- 同步站点与文档中的版本信息。
|
|
78
|
+
|
|
79
|
+
### 0.2.0(2026-09-22)
|
|
80
|
+
|
|
81
|
+
- 补齐高级组件,并完善作为 npm 组件库的消费方式(导出、类型与样式入口)。
|
|
82
|
+
|
|
83
|
+
### 0.1.0(2026-09-22)
|
|
84
|
+
|
|
85
|
+
- 首个公开发布:标准后台主题与语义 Token、布局外壳、公共组件与组件总览。
|
|
86
|
+
|
|
53
87
|
## 校验
|
|
54
88
|
|
|
55
89
|
```bash
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require("../lib/utils.cjs"),t=require("./ui/button.cjs"),n=require("../lib/range.cjs");let r=require("react"),i=require("lucide-react"),a=require("react/jsx-runtime");function o({value:o,onValueChange:s,locale:c=`zh-CN`,weekStartsOn:l=1,min:u,max:d,disabledDates:f,todayLabel:p=`今天`,className:m}){let h=o?new Date(`${o}T00:00:00`):new Date,[g,_]=(0,r.useState)(()=>new Date(h.getFullYear(),h.getMonth(),1)),v=n.monthGrid(g,l),y=(0,r.useMemo)(()=>new Intl.DateTimeFormat(c,{year:`numeric`,month:`long`}),[c]),b=(0,r.useMemo)(()=>{let e=new Date(2026,8,l===1?14:13);return Array.from({length:7},(t,n)=>{let r=new Date(e);return r.setDate(e.getDate()+n),new Intl.DateTimeFormat(c,{weekday:`short`}).format(r)})},[c,l]),x=n.dayKey(new Date);function S(e){_(t=>new Date(t.getFullYear(),t.getMonth()+e,1))}return(0,a.jsxs)(`section`,{className:e.cn(`w-full max-w-md rounded-xl border bg-card p-4`,m),"aria-label":`Calendar`,children:[(0,a.jsxs)(`header`,{className:`mb-3 flex items-center justify-between gap-2`,children:[(0,a.jsx)(t.Button,{type:`button`,size:`icon`,variant:`ghost`,onClick:()=>S(-1),"aria-label":`上个月`,children:(0,a.jsx)(i.ChevronLeft,{"aria-hidden":`true`})}),(0,a.jsx)(`h3`,{className:`font-medium`,children:y.format(g)}),(0,a.jsx)(t.Button,{type:`button`,size:`icon`,variant:`ghost`,onClick:()=>S(1),"aria-label":`下个月`,children:(0,a.jsx)(i.ChevronRight,{"aria-hidden":`true`})})]}),(0,a.jsx)(`div`,{className:`grid grid-cols-7 text-center text-xs text-muted-foreground`,children:b.map(e=>(0,a.jsx)(`span`,{className:`py-2`,children:e},e))}),(0,a.jsx)(`div`,{className:`grid grid-cols-7 gap-1`,children:v.map(t=>{let r=n.dayKey(t),i=t.getMonth()!==g.getMonth(),l=!!(u&&r<u||d&&r>d||f?.(t));return(0,a.jsx)(`button`,{type:`button`,disabled:l,"aria-label":new Intl.DateTimeFormat(c,{dateStyle:`full`}).format(t),"aria-current":r===x?`date`:void 0,"aria-pressed":r===o,className:e.cn(`aspect-square rounded-md text-sm hover:bg-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,i&&`text-muted-foreground
|
|
1
|
+
const e=require("../lib/utils.cjs"),t=require("./ui/button.cjs"),n=require("../lib/range.cjs");let r=require("react"),i=require("lucide-react"),a=require("react/jsx-runtime");function o({value:o,onValueChange:s,locale:c=`zh-CN`,weekStartsOn:l=1,min:u,max:d,disabledDates:f,todayLabel:p=`今天`,className:m}){let h=o?new Date(`${o}T00:00:00`):new Date,[g,_]=(0,r.useState)(()=>new Date(h.getFullYear(),h.getMonth(),1)),v=n.monthGrid(g,l),y=(0,r.useMemo)(()=>new Intl.DateTimeFormat(c,{year:`numeric`,month:`long`}),[c]),b=(0,r.useMemo)(()=>{let e=new Date(2026,8,l===1?14:13);return Array.from({length:7},(t,n)=>{let r=new Date(e);return r.setDate(e.getDate()+n),new Intl.DateTimeFormat(c,{weekday:`short`}).format(r)})},[c,l]),x=n.dayKey(new Date);function S(e){_(t=>new Date(t.getFullYear(),t.getMonth()+e,1))}return(0,a.jsxs)(`section`,{className:e.cn(`w-full max-w-md rounded-xl border bg-card p-4`,m),"aria-label":`Calendar`,children:[(0,a.jsxs)(`header`,{className:`mb-3 flex items-center justify-between gap-2`,children:[(0,a.jsx)(t.Button,{type:`button`,size:`icon`,variant:`ghost`,onClick:()=>S(-1),"aria-label":`上个月`,children:(0,a.jsx)(i.ChevronLeft,{"aria-hidden":`true`})}),(0,a.jsx)(`h3`,{className:`font-medium`,children:y.format(g)}),(0,a.jsx)(t.Button,{type:`button`,size:`icon`,variant:`ghost`,onClick:()=>S(1),"aria-label":`下个月`,children:(0,a.jsx)(i.ChevronRight,{"aria-hidden":`true`})})]}),(0,a.jsx)(`div`,{className:`grid grid-cols-7 text-center text-xs text-muted-foreground`,children:b.map(e=>(0,a.jsx)(`span`,{className:`py-2`,children:e},e))}),(0,a.jsx)(`div`,{className:`grid grid-cols-7 gap-1`,children:v.map(t=>{let r=n.dayKey(t),i=t.getMonth()!==g.getMonth(),l=!!(u&&r<u||d&&r>d||f?.(t));return(0,a.jsx)(`button`,{type:`button`,disabled:l,"aria-label":new Intl.DateTimeFormat(c,{dateStyle:`full`}).format(t),"aria-current":r===x?`date`:void 0,"aria-pressed":r===o,className:e.cn(`aspect-square rounded-md text-sm hover:bg-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,i&&`text-muted-foreground`,r===x&&`border border-primary`,r===o&&`bg-primary text-primary-foreground hover:bg-primary`,l&&`cursor-not-allowed opacity-30`),onClick:()=>{s?.(r),i&&_(new Date(t.getFullYear(),t.getMonth(),1))},children:t.getDate()},r)})}),(0,a.jsx)(t.Button,{type:`button`,variant:`ghost`,size:`sm`,className:`mt-3 w-full`,onClick:()=>{let e=new Date;_(new Date(e.getFullYear(),e.getMonth(),1)),s?.(x)},children:p})]})}exports.Calendar=o;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"calendar.d.ts","sourceRoot":"","sources":["../../src/components/calendar.tsx"],"names":[],"mappings":"AAMA,MAAM,MAAM,aAAa,GAAG;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;IACvC,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,YAAY,CAAC,EAAE,CAAC,GAAG,CAAC,CAAA;IACpB,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,aAAa,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,OAAO,CAAA;IACvC,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,CAAA;AAED,wBAAgB,QAAQ,CAAC,EACvB,KAAK,EACL,aAAa,EACb,MAAgB,EAChB,YAAgB,EAChB,GAAG,EACH,GAAG,EACH,aAAa,EACb,UAAiB,EACjB,SAAS,GACV,EAAE,aAAa,+
|
|
1
|
+
{"version":3,"file":"calendar.d.ts","sourceRoot":"","sources":["../../src/components/calendar.tsx"],"names":[],"mappings":"AAMA,MAAM,MAAM,aAAa,GAAG;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;IACvC,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,YAAY,CAAC,EAAE,CAAC,GAAG,CAAC,CAAA;IACpB,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,aAAa,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,OAAO,CAAA;IACvC,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,CAAA;AAED,wBAAgB,QAAQ,CAAC,EACvB,KAAK,EACL,aAAa,EACb,MAAgB,EAChB,YAAgB,EAChB,GAAG,EACH,GAAG,EACH,aAAa,EACb,UAAiB,EACjB,SAAS,GACV,EAAE,aAAa,+BAuGf"}
|
|
@@ -65,7 +65,7 @@ function u({ value: u, onValueChange: d, locale: f = "zh-CN", weekStartsOn: p =
|
|
|
65
65
|
"aria-label": new Intl.DateTimeFormat(f, { dateStyle: "full" }).format(t),
|
|
66
66
|
"aria-current": r === T ? "date" : void 0,
|
|
67
67
|
"aria-pressed": r === u,
|
|
68
|
-
className: e("aspect-square rounded-md text-sm hover:bg-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring", i && "text-muted-foreground
|
|
68
|
+
className: e("aspect-square rounded-md text-sm hover:bg-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring", i && "text-muted-foreground", r === T && "border border-primary", r === u && "bg-primary text-primary-foreground hover:bg-primary", a && "cursor-not-allowed opacity-30"),
|
|
69
69
|
onClick: () => {
|
|
70
70
|
d?.(r), i && x(new Date(t.getFullYear(), t.getMonth(), 1));
|
|
71
71
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require("../lib/utils.cjs"),t=require("../lib/metrics.cjs");let n=require("react"),r=require("react/jsx-runtime");function i({values:t,label:n,height:i=32,className:a}){let o=Math.max(...t,1);return(0,r.jsx)(`svg`,{role:`img`,"aria-label":n,viewBox:`0 0 ${t.length*4} ${i}`,className:e.cn(`w-full`,a),style:{height:i},children:t.map((e,t)=>{let n=e/o*(i-2);return(0,r.jsx)(`rect`,{x:t*4,y:i-n,width:2.6,height:n,rx:1,fill:`var(--primary)`,opacity:.35+e/o*.65},t)})})}function a({value:e,max:t=100,label:n,size:i=96,tone:a=`var(--primary)`}){let o=t>0?Math.min(100,Math.max(0,e/t*100)):0,s=i/2-8,c=2*Math.PI*s;return(0,r.jsxs)(`div`,{className:`relative inline-flex items-center justify-center`,style:{width:i,height:i},children:[(0,r.jsxs)(`svg`,{role:`img`,"aria-label":n,width:i,height:i,className:`-rotate-90`,children:[(0,r.jsx)(`circle`,{cx:i/2,cy:i/2,r:s,fill:`none`,stroke:`var(--border)`,strokeWidth:8}),(0,r.jsx)(`circle`,{cx:i/2,cy:i/2,r:s,fill:`none`,stroke:a,strokeWidth:8,strokeLinecap:`round`,strokeDasharray:c,strokeDashoffset:c*(1-o/100),className:`transition-[stroke-dashoffset] duration-500`})]}),(0,r.jsxs)(`span`,{className:`absolute text-sm font-semibold tabular-nums`,children:[Math.round(o),`%`]})]})}function o({series:i,labels:a,height:o=160,className:s}){let c=(0,n.useId)(),[l,u]=(0,n.useState)(),d=i.flatMap(e=>e.values),f=Math.max(...d,1),p=Math.min(...d,0),m=e=>o-16-(e-p)/(f-p||1)*(o-32);return(0,r.jsxs)(`div`,{className:e.cn(`space-y-2`,s),children:[(0,r.jsxs)(`svg`,{role:`img`,"aria-label":i.map(e=>e.name).join(` / `),viewBox:`0 0 480 ${o}`,className:`w-full`,style:{height:o},onMouseLeave:()=>u(void 0),children:[(0,r.jsx)(`defs`,{children:(0,r.jsxs)(`linearGradient`,{id:c,x1:`0`,y1:`0`,x2:`0`,y2:`1`,children:[(0,r.jsx)(`stop`,{offset:`0%`,stopColor:`var(--primary)`,stopOpacity:`0.25`}),(0,r.jsx)(`stop`,{offset:`100%`,stopColor:`var(--primary)`,stopOpacity:`0`})]})}),[0,1,2,3].map(e=>(0,r.jsx)(`line`,{x1:0,x2:480,y1:16+e*(o-32)/3,y2:16+e*(o-32)/3,stroke:`var(--border)`,strokeDasharray:`2 6`},e)),i.map((e,n)=>{let i=e.values.map((t,n)=>({x:n/Math.max(1,e.values.length-1)*480,y:m(t)}));return(0,r.jsxs)(`g`,{children:[n===0&&(0,r.jsx)(`path`,{d:`${t.sparklinePath(i,!0)} L480 ${o} L0 ${o} Z`,fill:`url(#${c})`}),(0,r.jsx)(`path`,{d:t.sparklinePath(i,!0),fill:`none`,stroke:e.tone??(n===0?`var(--primary)`:`var(--info)`),strokeWidth:2,strokeLinecap:`round`}),i.map((t,i)=>(0,r.jsx)(`circle`,{cx:t.x,cy:t.y,r:l===i?4:2.5,fill:e.tone??(n===0?`var(--primary)`:`var(--info)`)},i))]},e.name)}),a.map((e,t)=>(0,r.jsxs)(`g`,{children:[(0,r.jsx)(`rect`,{x:t/Math.max(1,a.length-1)*480-16,y:0,width:32,height:o,fill:`transparent`,onMouseEnter:()=>u(t)}),(0,r.jsx)(`text`,{x:t/Math.max(1,a.length-1)*480,y:o-2,textAnchor:`middle`,className:`fill-muted-foreground text-[10px]`,children:e})]},e))]}),(0,r.jsx)(`ul`,{className:`flex flex-wrap items-center gap-3 text-xs text-muted-foreground`,children:i.map((e,t)=>(0,r.jsxs)(`li`,{className:`flex items-center gap-1.5`,children:[(0,r.jsx)(`span`,{"aria-hidden":`true`,className:`size-2 rounded-full`,style:{background:e.tone??(t===0?`var(--primary)`:`var(--info)`)}}),e.name,l!==void 0&&(0,r.jsx)(`span`,{className:`tabular-nums text-foreground`,children:e.values[l]?.toLocaleString(`zh-CN`)})]},e.name))})]})}function s({items:t,label:n,className:i}){let a=Math.max(...t.map(e=>e.value),1);return(0,r.jsx)(`ul`,{"aria-label":n,className:e.cn(`space-y-3`,i),children:t.map(e=>(0,r.jsxs)(`li`,{className:`space-y-1`,children:[(0,r.jsxs)(`div`,{className:`flex items-center justify-between text-sm`,children:[(0,r.jsx)(`span`,{className:`truncate`,children:e.name}),(0,r.jsx)(`span`,{className:`tabular-nums text-muted-foreground`,children:e.value.toLocaleString(`zh-CN`)})]}),(0,r.jsx)(`div`,{className:`h-2 overflow-hidden rounded-full bg-muted`,children:(0,r.jsx)(`div`,{className:`h-full rounded-full bg-primary/70`,style:{width:`${e.value/a*100}%`}})})]},e.name))})}function c({rows:t,columns:n,values:i,label:a,className:o}){return(0,r.jsx)(`div`,{className:e.cn(`overflow-x-auto`,o),children:(0,r.jsxs)(`table`,{"aria-label":a,className:`w-full border-separate border-spacing-1 text-xs`,children:[(0,r.jsx)(`thead`,{children:(0,r.jsxs)(`tr`,{children:[(0,r.jsx)(`th`,{}),n.map(e=>(0,r.jsx)(`th`,{className:`font-normal text-muted-foreground`,children:e},e))]})}),(0,r.jsx)(`tbody`,{children:t.map((e,t)=>(0,r.jsxs)(`tr`,{children:[(0,r.jsx)(`th`,{scope:`row`,className:`pr-2 text-right font-normal text-muted-foreground`,children:e}),n.map((n,a)=>{let o=i[t]?.[a]??0;return(0,r.jsx)(`td`,{children:(0,r.jsx)(`span`,{title:`${e} ${n} · ${Math.round(o*100)}%`,className:`block h-6 rounded`,style:{background:o===0?`var(--muted)`:`color-mix(in oklab, var(--primary) ${Math.round(o*100)}%, transparent)`}})},n)})]},e))})]})})}function l({axes:t,series:n,size:i=220,className:a}){let o=i/2,s=o-34,c=(e,n)=>{let r=Math.PI*2*e/t.length-Math.PI/2;return[o+Math.cos(r)*s*n,o+Math.sin(r)*s*n]};return(0,r.jsxs)(`div`,{className:e.cn(`flex flex-wrap items-center gap-4`,a),children:[(0,r.jsxs)(`svg`,{role:`img`,"aria-label":n.map(e=>e.name).join(` / `),width:i,height:i,children:[[.25,.5,.75,1].map(e=>(0,r.jsx)(`polygon`,{points:t.map((t,n)=>c(n,e).join(`,`)).join(` `),fill:`none`,stroke:`var(--border)`},e)),t.map((e,t)=>{let[n,i]=c(t,1),[a,s]=c(t,1.16);return(0,r.jsxs)(`g`,{children:[(0,r.jsx)(`line`,{x1:o,y1:o,x2:n,y2:i,stroke:`var(--border)`}),(0,r.jsx)(`text`,{x:a,y:s,textAnchor:`middle`,dominantBaseline:`middle`,className:`fill-muted-foreground text-[10px]`,children:e})]},e)}),n.map((e,t)=>{let n=e.tone??(t===0?`var(--primary)`:`var(--info)`);return(0,r.jsx)(`polygon`,{points:e.values.map((e,t)=>c(t,e).join(`,`)).join(` `),fill:`color-mix(in oklab, ${n} 18%, transparent)`,stroke:n,strokeWidth:2},e.name)})]}),(0,r.jsx)(`ul`,{className:`space-y-1 text-xs text-muted-foreground`,children:n.map((e,t)=>(0,r.jsxs)(`li`,{className:`flex items-center gap-2`,children:[(0,r.jsx)(`span`,{"aria-hidden":`true`,className:`size-2 rounded-full`,style:{background:e.tone??(t===0?`var(--primary)`:`var(--info)`)}}),e.name]},e.name))})]})}function u({stages:t,className:n}){let i=Math.max(...t.map(e=>e.value),1);return(0,r.jsx)(`ul`,{"aria-label":`转化漏斗`,className:e.cn(`space-y-2`,n),children:t.map((e,n)=>{let a=e.value/i*100,o=t[n-1]?.value,s=o?Math.round(e.value/o*100):100;return(0,r.jsxs)(`li`,{className:`flex items-center gap-3`,children:[(0,r.jsx)(`span`,{className:`w-20 shrink-0 truncate text-xs text-muted-foreground`,children:e.name}),(0,r.jsx)(`span`,{className:`min-w-0 flex-1`,children:(0,r.jsx)(`span`,{className:`flex h-7 items-center justify-end rounded bg-primary
|
|
1
|
+
const e=require("../lib/utils.cjs"),t=require("../lib/metrics.cjs");let n=require("react"),r=require("react/jsx-runtime");function i({values:t,label:n,height:i=32,className:a}){let o=Math.max(...t,1);return(0,r.jsx)(`svg`,{role:`img`,"aria-label":n,viewBox:`0 0 ${t.length*4} ${i}`,className:e.cn(`w-full`,a),style:{height:i},children:t.map((e,t)=>{let n=e/o*(i-2);return(0,r.jsx)(`rect`,{x:t*4,y:i-n,width:2.6,height:n,rx:1,fill:`var(--primary)`,opacity:.35+e/o*.65},t)})})}function a({value:e,max:t=100,label:n,size:i=96,tone:a=`var(--primary)`}){let o=t>0?Math.min(100,Math.max(0,e/t*100)):0,s=i/2-8,c=2*Math.PI*s;return(0,r.jsxs)(`div`,{className:`relative inline-flex items-center justify-center`,style:{width:i,height:i},children:[(0,r.jsxs)(`svg`,{role:`img`,"aria-label":n,width:i,height:i,className:`-rotate-90`,children:[(0,r.jsx)(`circle`,{cx:i/2,cy:i/2,r:s,fill:`none`,stroke:`var(--border)`,strokeWidth:8}),(0,r.jsx)(`circle`,{cx:i/2,cy:i/2,r:s,fill:`none`,stroke:a,strokeWidth:8,strokeLinecap:`round`,strokeDasharray:c,strokeDashoffset:c*(1-o/100),className:`transition-[stroke-dashoffset] duration-500`})]}),(0,r.jsxs)(`span`,{className:`absolute text-sm font-semibold tabular-nums`,children:[Math.round(o),`%`]})]})}function o({series:i,labels:a,height:o=160,className:s}){let c=(0,n.useId)(),[l,u]=(0,n.useState)(),d=i.flatMap(e=>e.values),f=Math.max(...d,1),p=Math.min(...d,0),m=e=>o-16-(e-p)/(f-p||1)*(o-32);return(0,r.jsxs)(`div`,{className:e.cn(`space-y-2`,s),children:[(0,r.jsxs)(`svg`,{role:`img`,"aria-label":i.map(e=>e.name).join(` / `),viewBox:`0 0 480 ${o}`,className:`w-full`,style:{height:o},onMouseLeave:()=>u(void 0),children:[(0,r.jsx)(`defs`,{children:(0,r.jsxs)(`linearGradient`,{id:c,x1:`0`,y1:`0`,x2:`0`,y2:`1`,children:[(0,r.jsx)(`stop`,{offset:`0%`,stopColor:`var(--primary)`,stopOpacity:`0.25`}),(0,r.jsx)(`stop`,{offset:`100%`,stopColor:`var(--primary)`,stopOpacity:`0`})]})}),[0,1,2,3].map(e=>(0,r.jsx)(`line`,{x1:0,x2:480,y1:16+e*(o-32)/3,y2:16+e*(o-32)/3,stroke:`var(--border)`,strokeDasharray:`2 6`},e)),i.map((e,n)=>{let i=e.values.map((t,n)=>({x:n/Math.max(1,e.values.length-1)*480,y:m(t)}));return(0,r.jsxs)(`g`,{children:[n===0&&(0,r.jsx)(`path`,{d:`${t.sparklinePath(i,!0)} L480 ${o} L0 ${o} Z`,fill:`url(#${c})`}),(0,r.jsx)(`path`,{d:t.sparklinePath(i,!0),fill:`none`,stroke:e.tone??(n===0?`var(--primary)`:`var(--info)`),strokeWidth:2,strokeLinecap:`round`}),i.map((t,i)=>(0,r.jsx)(`circle`,{cx:t.x,cy:t.y,r:l===i?4:2.5,fill:e.tone??(n===0?`var(--primary)`:`var(--info)`)},i))]},e.name)}),a.map((e,t)=>(0,r.jsxs)(`g`,{children:[(0,r.jsx)(`rect`,{x:t/Math.max(1,a.length-1)*480-16,y:0,width:32,height:o,fill:`transparent`,onMouseEnter:()=>u(t)}),(0,r.jsx)(`text`,{x:t/Math.max(1,a.length-1)*480,y:o-2,textAnchor:`middle`,className:`fill-muted-foreground text-[10px]`,children:e})]},e))]}),(0,r.jsx)(`ul`,{className:`flex flex-wrap items-center gap-3 text-xs text-muted-foreground`,children:i.map((e,t)=>(0,r.jsxs)(`li`,{className:`flex items-center gap-1.5`,children:[(0,r.jsx)(`span`,{"aria-hidden":`true`,className:`size-2 rounded-full`,style:{background:e.tone??(t===0?`var(--primary)`:`var(--info)`)}}),e.name,l!==void 0&&(0,r.jsx)(`span`,{className:`tabular-nums text-foreground`,children:e.values[l]?.toLocaleString(`zh-CN`)})]},e.name))})]})}function s({items:t,label:n,className:i}){let a=Math.max(...t.map(e=>e.value),1);return(0,r.jsx)(`ul`,{"aria-label":n,className:e.cn(`space-y-3`,i),children:t.map(e=>(0,r.jsxs)(`li`,{className:`space-y-1`,children:[(0,r.jsxs)(`div`,{className:`flex items-center justify-between text-sm`,children:[(0,r.jsx)(`span`,{className:`truncate`,children:e.name}),(0,r.jsx)(`span`,{className:`tabular-nums text-muted-foreground`,children:e.value.toLocaleString(`zh-CN`)})]}),(0,r.jsx)(`div`,{className:`h-2 overflow-hidden rounded-full bg-muted`,children:(0,r.jsx)(`div`,{className:`h-full rounded-full bg-primary/70`,style:{width:`${e.value/a*100}%`}})})]},e.name))})}function c({rows:t,columns:n,values:i,label:a,className:o}){return(0,r.jsx)(`div`,{className:e.cn(`overflow-x-auto`,o),children:(0,r.jsxs)(`table`,{"aria-label":a,className:`w-full border-separate border-spacing-1 text-xs`,children:[(0,r.jsx)(`thead`,{children:(0,r.jsxs)(`tr`,{children:[(0,r.jsx)(`th`,{role:`presentation`}),n.map(e=>(0,r.jsx)(`th`,{className:`font-normal text-muted-foreground`,children:e},e))]})}),(0,r.jsx)(`tbody`,{children:t.map((e,t)=>(0,r.jsxs)(`tr`,{children:[(0,r.jsx)(`th`,{scope:`row`,className:`pr-2 text-right font-normal text-muted-foreground`,children:e}),n.map((n,a)=>{let o=i[t]?.[a]??0;return(0,r.jsx)(`td`,{children:(0,r.jsx)(`span`,{title:`${e} ${n} · ${Math.round(o*100)}%`,className:`block h-6 rounded`,style:{background:o===0?`var(--muted)`:`color-mix(in oklab, var(--primary) ${Math.round(o*100)}%, transparent)`}})},n)})]},e))})]})})}function l({axes:t,series:n,size:i=220,className:a}){let o=i/2,s=o-34,c=(e,n)=>{let r=Math.PI*2*e/t.length-Math.PI/2;return[o+Math.cos(r)*s*n,o+Math.sin(r)*s*n]};return(0,r.jsxs)(`div`,{className:e.cn(`flex flex-wrap items-center gap-4`,a),children:[(0,r.jsxs)(`svg`,{role:`img`,"aria-label":n.map(e=>e.name).join(` / `),width:i,height:i,children:[[.25,.5,.75,1].map(e=>(0,r.jsx)(`polygon`,{points:t.map((t,n)=>c(n,e).join(`,`)).join(` `),fill:`none`,stroke:`var(--border)`},e)),t.map((e,t)=>{let[n,i]=c(t,1),[a,s]=c(t,1.16);return(0,r.jsxs)(`g`,{children:[(0,r.jsx)(`line`,{x1:o,y1:o,x2:n,y2:i,stroke:`var(--border)`}),(0,r.jsx)(`text`,{x:a,y:s,textAnchor:`middle`,dominantBaseline:`middle`,className:`fill-muted-foreground text-[10px]`,children:e})]},e)}),n.map((e,t)=>{let n=e.tone??(t===0?`var(--primary)`:`var(--info)`);return(0,r.jsx)(`polygon`,{points:e.values.map((e,t)=>c(t,e).join(`,`)).join(` `),fill:`color-mix(in oklab, ${n} 18%, transparent)`,stroke:n,strokeWidth:2},e.name)})]}),(0,r.jsx)(`ul`,{className:`space-y-1 text-xs text-muted-foreground`,children:n.map((e,t)=>(0,r.jsxs)(`li`,{className:`flex items-center gap-2`,children:[(0,r.jsx)(`span`,{"aria-hidden":`true`,className:`size-2 rounded-full`,style:{background:e.tone??(t===0?`var(--primary)`:`var(--info)`)}}),e.name]},e.name))})]})}function u({stages:t,className:n}){let i=Math.max(...t.map(e=>e.value),1);return(0,r.jsx)(`ul`,{"aria-label":`转化漏斗`,className:e.cn(`space-y-2`,n),children:t.map((e,n)=>{let a=e.value/i*100,o=t[n-1]?.value,s=o?Math.round(e.value/o*100):100;return(0,r.jsxs)(`li`,{className:`flex items-center gap-3`,children:[(0,r.jsx)(`span`,{className:`w-20 shrink-0 truncate text-xs text-muted-foreground`,children:e.name}),(0,r.jsx)(`span`,{className:`min-w-0 flex-1`,children:(0,r.jsx)(`span`,{className:`flex h-7 items-center justify-end rounded bg-primary pr-2 text-xs font-medium text-primary-foreground`,style:{width:`${Math.max(a,6)}%`},children:e.value.toLocaleString(`zh-CN`)})}),(0,r.jsx)(`span`,{className:`w-12 shrink-0 text-right text-xs tabular-nums text-muted-foreground`,children:n===0?`—`:`${s}%`})]},e.name)})})}function d({rows:t,days:n,today:i,className:a}){let o=n.length*40;return(0,r.jsx)(`div`,{className:e.cn(`overflow-x-auto`,a),tabIndex:0,children:(0,r.jsxs)(`div`,{className:`min-w-max`,children:[(0,r.jsxs)(`div`,{className:`flex text-[10px] text-muted-foreground`,children:[(0,r.jsx)(`span`,{className:`w-28 shrink-0`}),(0,r.jsx)(`div`,{className:`relative`,style:{width:o},children:n.map((e,t)=>(0,r.jsx)(`span`,{className:`absolute -translate-x-1/2 text-center`,style:{left:t*40+20},children:e},e))})]}),(0,r.jsx)(`ul`,{"aria-label":`任务排期`,className:`mt-3 space-y-2`,children:t.map(e=>(0,r.jsxs)(`li`,{className:`flex items-center`,children:[(0,r.jsx)(`span`,{className:`w-28 shrink-0 truncate pr-2 text-xs`,children:e.name}),(0,r.jsxs)(`div`,{className:`relative h-6`,style:{width:o},children:[n.map((e,t)=>(0,r.jsx)(`span`,{"aria-hidden":`true`,className:`absolute inset-y-0 border-l border-border/60`,style:{left:t*40}},e)),(0,r.jsx)(`span`,{className:`absolute top-1 h-4 rounded`,style:{left:e.start*40+2,width:Math.max(e.span*40-4,8),background:`color-mix(in oklab, ${e.tone??`var(--primary)`} 35%, transparent)`},children:(0,r.jsx)(`span`,{className:`block h-full rounded`,style:{width:`${e.progress??100}%`,background:e.tone??`var(--primary)`}})}),i!==void 0&&i>=0&&i<n.length&&(0,r.jsx)(`span`,{"aria-hidden":`true`,className:`absolute inset-y-0 w-px bg-danger`,style:{left:i*40+20}})]})]},e.name))})]})})}exports.BarList=s,exports.DonutChart=a,exports.FunnelChart=u,exports.GanttChart=d,exports.Heatmap=c,exports.LineChart=o,exports.MiniBars=i,exports.RadarChart=l;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"charts.d.ts","sourceRoot":"","sources":["../../src/components/charts.tsx"],"names":[],"mappings":"AAIA,kCAAkC;AAClC,wBAAgB,QAAQ,CAAC,EACvB,MAAM,EACN,KAAK,EACL,MAAW,EACX,SAAS,GACV,EAAE;IACD,MAAM,EAAE,MAAM,EAAE,CAAA;IAChB,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,+BA2BA;AAED,oCAAoC;AACpC,wBAAgB,UAAU,CAAC,EACzB,KAAK,EACL,GAAS,EACT,KAAK,EACL,IAAS,EACT,IAAuB,GACxB,EAAE;IACD,KAAK,EAAE,MAAM,CAAA;IACb,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,IAAI,CAAC,EAAE,MAAM,CAAA;CACd,+BAkCA;AAED,8BAA8B;AAC9B,wBAAgB,SAAS,CAAC,EACxB,MAAM,EACN,MAAM,EACN,MAAY,EACZ,SAAS,GACV,EAAE;IACD,MAAM,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,EAAE,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,EAAE,CAAA;IAC3D,MAAM,EAAE,MAAM,EAAE,CAAA;IAChB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,+BA2GA;AAED,0BAA0B;AAC1B,wBAAgB,OAAO,CAAC,EACtB,KAAK,EACL,KAAK,EACL,SAAS,GACV,EAAE;IACD,KAAK,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,EAAE,CAAA;IACxC,KAAK,EAAE,MAAM,CAAA;IACb,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,+BAsBA;AAED,kCAAkC;AAClC,wBAAgB,OAAO,CAAC,EACtB,IAAI,EACJ,OAAO,EACP,MAAM,EACN,KAAK,EACL,SAAS,GACV,EAAE;IACD,IAAI,EAAE,MAAM,EAAE,CAAA;IACd,OAAO,EAAE,MAAM,EAAE,CAAA;IACjB,kCAAkC;IAClC,MAAM,EAAE,MAAM,EAAE,EAAE,CAAA;IAClB,KAAK,EAAE,MAAM,CAAA;IACb,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,+
|
|
1
|
+
{"version":3,"file":"charts.d.ts","sourceRoot":"","sources":["../../src/components/charts.tsx"],"names":[],"mappings":"AAIA,kCAAkC;AAClC,wBAAgB,QAAQ,CAAC,EACvB,MAAM,EACN,KAAK,EACL,MAAW,EACX,SAAS,GACV,EAAE;IACD,MAAM,EAAE,MAAM,EAAE,CAAA;IAChB,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,+BA2BA;AAED,oCAAoC;AACpC,wBAAgB,UAAU,CAAC,EACzB,KAAK,EACL,GAAS,EACT,KAAK,EACL,IAAS,EACT,IAAuB,GACxB,EAAE;IACD,KAAK,EAAE,MAAM,CAAA;IACb,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,IAAI,CAAC,EAAE,MAAM,CAAA;CACd,+BAkCA;AAED,8BAA8B;AAC9B,wBAAgB,SAAS,CAAC,EACxB,MAAM,EACN,MAAM,EACN,MAAY,EACZ,SAAS,GACV,EAAE;IACD,MAAM,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,EAAE,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,EAAE,CAAA;IAC3D,MAAM,EAAE,MAAM,EAAE,CAAA;IAChB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,+BA2GA;AAED,0BAA0B;AAC1B,wBAAgB,OAAO,CAAC,EACtB,KAAK,EACL,KAAK,EACL,SAAS,GACV,EAAE;IACD,KAAK,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,EAAE,CAAA;IACxC,KAAK,EAAE,MAAM,CAAA;IACb,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,+BAsBA;AAED,kCAAkC;AAClC,wBAAgB,OAAO,CAAC,EACtB,IAAI,EACJ,OAAO,EACP,MAAM,EACN,KAAK,EACL,SAAS,GACV,EAAE;IACD,IAAI,EAAE,MAAM,EAAE,CAAA;IACd,OAAO,EAAE,MAAM,EAAE,CAAA;IACjB,kCAAkC;IAClC,MAAM,EAAE,MAAM,EAAE,EAAE,CAAA;IAClB,KAAK,EAAE,MAAM,CAAA;IACb,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,+BA4CA;AAED,8BAA8B;AAC9B,wBAAgB,UAAU,CAAC,EACzB,IAAI,EACJ,MAAM,EACN,IAAU,EACV,SAAS,GACV,EAAE;IACD,4BAA4B;IAC5B,IAAI,EAAE,MAAM,EAAE,CAAA;IACd,MAAM,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,EAAE,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,EAAE,CAAA;IAC3D,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,+BAoEA;AAED,iCAAiC;AACjC,wBAAgB,WAAW,CAAC,EAC1B,MAAM,EACN,SAAS,GACV,EAAE;IACD,MAAM,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,EAAE,CAAA;IACzC,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,+BA6BA;AAED,6BAA6B;AAC7B,wBAAgB,UAAU,CAAC,EACzB,IAAI,EACJ,IAAI,EACJ,KAAK,EACL,SAAS,GACV,EAAE;IACD,IAAI,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,EAAE,CAAA;IACvF,2BAA2B;IAC3B,IAAI,EAAE,MAAM,EAAE,CAAA;IACd,yBAAyB;IACzB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,+BAgEA"}
|
|
@@ -197,7 +197,7 @@ function u({ rows: t, columns: n, values: r, label: o, className: s }) {
|
|
|
197
197
|
children: /* @__PURE__ */ a("table", {
|
|
198
198
|
"aria-label": o,
|
|
199
199
|
className: "w-full border-separate border-spacing-1 text-xs",
|
|
200
|
-
children: [/* @__PURE__ */ i("thead", { children: /* @__PURE__ */ a("tr", { children: [/* @__PURE__ */ i("th", {}), n.map((e) => /* @__PURE__ */ i("th", {
|
|
200
|
+
children: [/* @__PURE__ */ i("thead", { children: /* @__PURE__ */ a("tr", { children: [/* @__PURE__ */ i("th", { role: "presentation" }), n.map((e) => /* @__PURE__ */ i("th", {
|
|
201
201
|
className: "font-normal text-muted-foreground",
|
|
202
202
|
children: e
|
|
203
203
|
}, e))] }) }), /* @__PURE__ */ i("tbody", { children: t.map((e, t) => /* @__PURE__ */ a("tr", { children: [/* @__PURE__ */ i("th", {
|
|
@@ -295,7 +295,7 @@ function f({ stages: t, className: n }) {
|
|
|
295
295
|
/* @__PURE__ */ i("span", {
|
|
296
296
|
className: "min-w-0 flex-1",
|
|
297
297
|
children: /* @__PURE__ */ i("span", {
|
|
298
|
-
className: "flex h-7 items-center justify-end rounded bg-primary
|
|
298
|
+
className: "flex h-7 items-center justify-end rounded bg-primary pr-2 text-xs font-medium text-primary-foreground",
|
|
299
299
|
style: { width: `${Math.max(o, 6)}%` },
|
|
300
300
|
children: e.value.toLocaleString("zh-CN")
|
|
301
301
|
})
|
|
@@ -313,6 +313,7 @@ function p({ rows: t, days: n, today: r, className: o }) {
|
|
|
313
313
|
let s = n.length * 40;
|
|
314
314
|
return /* @__PURE__ */ i("div", {
|
|
315
315
|
className: e("overflow-x-auto", o),
|
|
316
|
+
tabIndex: 0,
|
|
316
317
|
children: /* @__PURE__ */ a("div", {
|
|
317
318
|
className: "min-w-max",
|
|
318
319
|
children: [/* @__PURE__ */ a("div", {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require("../lib/utils.cjs");let t=require("react"),n=require("lucide-react"),r=require("react/jsx-runtime");function i({value:i,defaultValue:a=0,onValueChange:o,max:s=5,precision:c=1,clearable:l=!0,disabled:u,label:d=`评分`,className:f}){let[p,m]=(0,t.useState)(a),[h,g]=(0,t.useState)(),_=i??p,v=h??_;function y(e){if(u)return;let t=l&&e===_?0:e;i===void 0&&m(t),o?.(t)}return(0,r.jsx)(`div`,{role:`slider`,tabIndex:u?-1:0,"aria-label":d,"aria-valuemin":0,"aria-valuemax":s,"aria-valuenow":_,"aria-disabled":u,className:e.cn(`inline-flex items-center gap-1 rounded-md focus-visible:ring-2 focus-visible:ring-ring`,f),onBlur:()=>g(void 0),onKeyDown:e=>{let t=c;e.key===`ArrowRight`||e.key===`ArrowUp`?(e.preventDefault(),y(Math.min(s,_+t))):e.key===`ArrowLeft`||e.key===`ArrowDown`?(e.preventDefault(),y(Math.max(0,_-t))):e.key===`Home`?y(0):e.key===`End`&&y(s)},onMouseLeave:()=>g(void 0),children:Array.from({length:s},(
|
|
1
|
+
const e=require("../lib/utils.cjs");let t=require("react"),n=require("lucide-react"),r=require("react/jsx-runtime");function i({value:i,defaultValue:a=0,onValueChange:o,max:s=5,precision:c=1,clearable:l=!0,disabled:u,label:d=`评分`,className:f}){let[p,m]=(0,t.useState)(a),[h,g]=(0,t.useState)(),_=i??p,v=h??_;function y(e){if(u)return;let t=l&&e===_?0:e;i===void 0&&m(t),o?.(t)}return(0,r.jsx)(`div`,{role:`slider`,tabIndex:u?-1:0,"aria-label":d,"aria-valuemin":0,"aria-valuemax":s,"aria-valuenow":_,"aria-disabled":u,className:e.cn(`inline-flex items-center gap-1 rounded-md focus-visible:ring-2 focus-visible:ring-ring`,f),onBlur:()=>g(void 0),onKeyDown:e=>{let t=c;e.key===`ArrowRight`||e.key===`ArrowUp`?(e.preventDefault(),y(Math.min(s,_+t))):e.key===`ArrowLeft`||e.key===`ArrowDown`?(e.preventDefault(),y(Math.max(0,_-t))):e.key===`Home`?y(0):e.key===`End`&&y(s)},onMouseLeave:()=>g(void 0),children:Array.from({length:s},(t,i)=>{let a=i+1,o=v>=a?100:v>=a-.5?50:0;return(0,r.jsxs)(`span`,{"data-slot":`rate-star`,"data-value":a,className:e.cn(`relative size-7 text-muted-foreground transition-transform`,u?`pointer-events-none`:`cursor-pointer hover:scale-110`),onMouseMove:e=>{if(u)return;let t=c===.5&&e.nativeEvent.offsetX<e.currentTarget.offsetWidth/2;g(t?a-.5:a)},onClick:()=>{u||y(h??a)},children:[(0,r.jsx)(n.Star,{className:`absolute inset-1 size-5`,"aria-hidden":`true`}),(0,r.jsx)(`span`,{className:`absolute inset-1 size-5 text-rating`,children:(0,r.jsx)(`span`,{className:`block h-full overflow-hidden`,style:{width:`${o}%`},children:(0,r.jsx)(n.Star,{className:`size-5 fill-current`,"aria-hidden":`true`})})})]},a)})})}exports.Rate=i;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rate.d.ts","sourceRoot":"","sources":["../../src/components/rate.tsx"],"names":[],"mappings":"AAIA,MAAM,MAAM,SAAS,GAAG;IACtB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;IACvC,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,SAAS,CAAC,EAAE,CAAC,GAAG,GAAG,CAAA;IACnB,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,CAAA;AAED,wBAAgB,IAAI,CAAC,EACnB,KAAK,EACL,YAAgB,EAChB,aAAa,EACb,GAAO,EACP,SAAa,EACb,SAAgB,EAChB,QAAQ,EACR,KAAY,EACZ,SAAS,GACV,EAAE,SAAS,+
|
|
1
|
+
{"version":3,"file":"rate.d.ts","sourceRoot":"","sources":["../../src/components/rate.tsx"],"names":[],"mappings":"AAIA,MAAM,MAAM,SAAS,GAAG;IACtB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;IACvC,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,SAAS,CAAC,EAAE,CAAC,GAAG,GAAG,CAAA;IACnB,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,CAAA;AAED,wBAAgB,IAAI,CAAC,EACnB,KAAK,EACL,YAAgB,EAChB,aAAa,EACb,GAAO,EACP,SAAa,EACb,SAAgB,EAChB,QAAQ,EACR,KAAY,EACZ,SAAS,GACV,EAAE,SAAS,+BA2EX"}
|
|
@@ -25,30 +25,35 @@ function a({ value: a, defaultValue: o = 0, onValueChange: s, max: c = 5, precis
|
|
|
25
25
|
e.key === "ArrowRight" || e.key === "ArrowUp" ? (e.preventDefault(), b(Math.min(c, v + t))) : e.key === "ArrowLeft" || e.key === "ArrowDown" ? (e.preventDefault(), b(Math.max(0, v - t))) : e.key === "Home" ? b(0) : e.key === "End" && b(c);
|
|
26
26
|
},
|
|
27
27
|
onMouseLeave: () => _(void 0),
|
|
28
|
-
children: Array.from({ length: c }, (
|
|
29
|
-
let
|
|
30
|
-
return /* @__PURE__ */ i("
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
"
|
|
34
|
-
className: "relative size-7 text-muted-foreground transition-transform hover:scale-110 disabled:pointer-events-none",
|
|
28
|
+
children: Array.from({ length: c }, (t, a) => {
|
|
29
|
+
let o = a + 1, s = y >= o ? 100 : y >= o - .5 ? 50 : 0;
|
|
30
|
+
return /* @__PURE__ */ i("span", {
|
|
31
|
+
"data-slot": "rate-star",
|
|
32
|
+
"data-value": o,
|
|
33
|
+
className: e("relative size-7 text-muted-foreground transition-transform", d ? "pointer-events-none" : "cursor-pointer hover:scale-110"),
|
|
35
34
|
onMouseMove: (e) => {
|
|
35
|
+
if (d) return;
|
|
36
36
|
let t = l === .5 && e.nativeEvent.offsetX < e.currentTarget.offsetWidth / 2;
|
|
37
|
-
_(t ?
|
|
37
|
+
_(t ? o - .5 : o);
|
|
38
|
+
},
|
|
39
|
+
onClick: () => {
|
|
40
|
+
d || b(g ?? o);
|
|
38
41
|
},
|
|
39
|
-
onClick: () => b(g ?? a),
|
|
40
42
|
children: [/* @__PURE__ */ r(n, {
|
|
41
43
|
className: "absolute inset-1 size-5",
|
|
42
44
|
"aria-hidden": "true"
|
|
43
45
|
}), /* @__PURE__ */ r("span", {
|
|
44
|
-
className: "absolute inset-1
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
46
|
+
className: "absolute inset-1 size-5 text-rating",
|
|
47
|
+
children: /* @__PURE__ */ r("span", {
|
|
48
|
+
className: "block h-full overflow-hidden",
|
|
49
|
+
style: { width: `${s}%` },
|
|
50
|
+
children: /* @__PURE__ */ r(n, {
|
|
51
|
+
className: "size-5 fill-current",
|
|
52
|
+
"aria-hidden": "true"
|
|
53
|
+
})
|
|
49
54
|
})
|
|
50
55
|
})]
|
|
51
|
-
},
|
|
56
|
+
}, o);
|
|
52
57
|
})
|
|
53
58
|
});
|
|
54
59
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require("../lib/utils.cjs"),t=require("./ui/button.cjs"),n=require("./ui/checkbox.cjs"),r=require("./ui/input.cjs");let i=require("react"),a=require("lucide-react"),o=require("react/jsx-runtime");function s({items:s,value:c,onValueChange:l,sourceTitle:u=`可选项`,targetTitle:d=`已选项`,searchPlaceholder:f=`搜索`,emptyText:p=`暂无数据`,className:m}){let[h,g]=(0,i.useState)(``),[_,v]=(0,i.useState)([]),[y,b]=(0,i.useState)([]),x=new Set(c),S=(0,i.useMemo)(()=>s.filter(e=>e.label.toLowerCase().includes(h.trim().toLowerCase())),[s,h]).filter(e=>!x.has(e.value)),C=s.filter(e=>x.has(e.value));function w(e,t,n){n(e.includes(t)?e.filter(e=>e!==t):[...e,t])}function T(){l([...c,..._.filter(e=>!x.has(e))]),v([])}function E(){l(c.filter(e=>!y.includes(e))),b([])}let D=(t,r,i,a)=>(0,o.jsxs)(`section`,{className:`min-w-0 flex-1 overflow-hidden rounded-lg border bg-card`,children:[(0,o.jsxs)(`header`,{className:`flex items-center justify-between border-b px-3 py-2 text-sm font-medium`,children:[(0,o.jsx)(`span`,{children:t}),(0,o.jsx)(`span`,{className:`text-xs font-normal text-muted-foreground`,children:r.length})]}),(0,o.jsx)(`div`,{className:`max-h-64 min-h-52 overflow-auto p-2`,role:`
|
|
1
|
+
const e=require("../lib/utils.cjs"),t=require("./ui/button.cjs"),n=require("./ui/checkbox.cjs"),r=require("./ui/input.cjs");let i=require("react"),a=require("lucide-react"),o=require("react/jsx-runtime");function s({items:s,value:c,onValueChange:l,sourceTitle:u=`可选项`,targetTitle:d=`已选项`,searchPlaceholder:f=`搜索`,emptyText:p=`暂无数据`,className:m}){let[h,g]=(0,i.useState)(``),[_,v]=(0,i.useState)([]),[y,b]=(0,i.useState)([]),x=new Set(c),S=(0,i.useMemo)(()=>s.filter(e=>e.label.toLowerCase().includes(h.trim().toLowerCase())),[s,h]).filter(e=>!x.has(e.value)),C=s.filter(e=>x.has(e.value));function w(e,t,n){n(e.includes(t)?e.filter(e=>e!==t):[...e,t])}function T(){l([...c,..._.filter(e=>!x.has(e))]),v([])}function E(){l(c.filter(e=>!y.includes(e))),b([])}let D=(t,r,i,a)=>(0,o.jsxs)(`section`,{className:`min-w-0 flex-1 overflow-hidden rounded-lg border bg-card`,children:[(0,o.jsxs)(`header`,{className:`flex items-center justify-between border-b px-3 py-2 text-sm font-medium`,children:[(0,o.jsx)(`span`,{children:t}),(0,o.jsx)(`span`,{className:`text-xs font-normal text-muted-foreground`,children:r.length})]}),(0,o.jsx)(`div`,{className:`max-h-64 min-h-52 overflow-auto p-2`,role:`group`,"aria-label":t,children:r.length===0?(0,o.jsx)(`p`,{className:`grid min-h-36 place-items-center text-sm text-muted-foreground`,children:p}):r.map(t=>(0,o.jsxs)(`label`,{"aria-disabled":t.disabled||void 0,className:e.cn(`flex min-h-11 items-start gap-2 rounded-md px-2 py-2 text-sm hover:bg-muted`,t.disabled&&`cursor-not-allowed opacity-50`),children:[(0,o.jsx)(n.Checkbox,{disabled:t.disabled,checked:i.includes(t.value),onCheckedChange:()=>w(i,t.value,a),"aria-label":t.label}),(0,o.jsxs)(`span`,{className:`min-w-0`,children:[(0,o.jsx)(`span`,{className:`block truncate`,children:t.label}),t.description&&(0,o.jsx)(`span`,{className:`block truncate text-xs text-muted-foreground`,children:t.description})]})]},t.value))})]});return(0,o.jsxs)(`div`,{className:e.cn(`space-y-3`,m),children:[(0,o.jsx)(r.Input,{value:h,onChange:e=>g(e.target.value),placeholder:f,"aria-label":f,start:(0,o.jsx)(a.Search,{"aria-hidden":`true`,className:`size-4`}),clearable:!0,onClear:()=>g(``)}),(0,o.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[D(u,S,_,v),(0,o.jsxs)(`div`,{className:`flex shrink-0 flex-col gap-2`,children:[(0,o.jsx)(t.Button,{type:`button`,size:`icon`,variant:`outline`,disabled:_.length===0,onClick:T,"aria-label":`移动到${d}`,children:(0,o.jsx)(a.ArrowRight,{"aria-hidden":`true`})}),(0,o.jsx)(t.Button,{type:`button`,size:`icon`,variant:`outline`,disabled:y.length===0,onClick:E,"aria-label":`移动到${u}`,children:(0,o.jsx)(a.ArrowLeft,{"aria-hidden":`true`})})]}),D(d,C,y,b)]})]})}exports.Transfer=s;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transfer.d.ts","sourceRoot":"","sources":["../../src/components/transfer.tsx"],"names":[],"mappings":"AAOA,MAAM,MAAM,YAAY,GAAG;IACzB,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,EAAE,MAAM,CAAA;IACb,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB,CAAA;AAED,MAAM,MAAM,aAAa,GAAG;IAC1B,KAAK,EAAE,YAAY,EAAE,CAAA;IACrB,KAAK,EAAE,MAAM,EAAE,CAAA;IACf,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,IAAI,CAAA;IACxC,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,CAAA;AAED,wBAAgB,QAAQ,CAAC,EACvB,KAAK,EACL,KAAK,EACL,aAAa,EACb,WAAmB,EACnB,WAAmB,EACnB,iBAAwB,EACxB,SAAkB,EAClB,SAAS,GACV,EAAE,aAAa,+
|
|
1
|
+
{"version":3,"file":"transfer.d.ts","sourceRoot":"","sources":["../../src/components/transfer.tsx"],"names":[],"mappings":"AAOA,MAAM,MAAM,YAAY,GAAG;IACzB,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,EAAE,MAAM,CAAA;IACb,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB,CAAA;AAED,MAAM,MAAM,aAAa,GAAG;IAC1B,KAAK,EAAE,YAAY,EAAE,CAAA;IACrB,KAAK,EAAE,MAAM,EAAE,CAAA;IACf,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,IAAI,CAAA;IACxC,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,CAAA;AAED,wBAAgB,QAAQ,CAAC,EACvB,KAAK,EACL,KAAK,EACL,aAAa,EACb,WAAmB,EACnB,WAAmB,EACnB,iBAAwB,EACxB,SAAkB,EAClB,SAAS,GACV,EAAE,aAAa,+BAiHf"}
|
|
@@ -27,12 +27,13 @@ function d({ items: d, value: f, onValueChange: p, sourceTitle: m = "可选项",
|
|
|
27
27
|
})]
|
|
28
28
|
}), /* @__PURE__ */ l("div", {
|
|
29
29
|
className: "max-h-64 min-h-52 overflow-auto p-2",
|
|
30
|
-
role: "
|
|
30
|
+
role: "group",
|
|
31
31
|
"aria-label": t,
|
|
32
32
|
children: r.length === 0 ? /* @__PURE__ */ l("p", {
|
|
33
33
|
className: "grid min-h-36 place-items-center text-sm text-muted-foreground",
|
|
34
34
|
children: _
|
|
35
35
|
}) : r.map((t) => /* @__PURE__ */ u("label", {
|
|
36
|
+
"aria-disabled": t.disabled || void 0,
|
|
36
37
|
className: e("flex min-h-11 items-start gap-2 rounded-md px-2 py-2 text-sm hover:bg-muted", t.disabled && "cursor-not-allowed opacity-50"),
|
|
37
38
|
children: [/* @__PURE__ */ l(n, {
|
|
38
39
|
disabled: t.disabled,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require("../../_virtual/_rolldown/runtime.cjs"),t=require("../../lib/
|
|
1
|
+
const e=require("../../_virtual/_rolldown/runtime.cjs"),t=require("../../lib/overlay-suppression.cjs"),n=require("../../lib/utils.cjs"),r=require("./button.cjs");let i=require("react");i=e.__toESM(i,1);let a=require("radix-ui"),o=require("react/jsx-runtime");var s=a.AlertDialog.Root,c=a.AlertDialog.Trigger,l=a.AlertDialog.Portal;function u({className:e,...t}){return(0,o.jsx)(a.AlertDialog.Overlay,{className:n.cn(`fixed inset-0 z-50 bg-black/50 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0`,e),...t})}function d({className:e,ref:r,...s}){let c=i.useRef(null),d=t.useOverlayBackgroundSuppression(),f=i.useMemo(()=>t.composeRefs(c,d,r),[d,r]);return(0,o.jsxs)(l,{children:[(0,o.jsx)(u,{}),(0,o.jsx)(a.AlertDialog.Content,{ref:f,className:n.cn(`fixed left-1/2 top-1/2 z-50 grid w-[calc(100%-2rem)] max-w-lg -translate-x-1/2 -translate-y-1/2 gap-4 rounded-xl border bg-background p-6 shadow-lg`,e),...s})]})}function f({className:e,...t}){return(0,o.jsx)(`div`,{className:n.cn(`flex flex-col gap-2 text-center sm:text-left`,e),...t})}function p({className:e,...t}){return(0,o.jsx)(`div`,{className:n.cn(`flex flex-col-reverse gap-2 sm:flex-row sm:justify-end`,e),...t})}function m({className:e,...t}){return(0,o.jsx)(a.AlertDialog.Title,{className:n.cn(`text-lg font-semibold`,e),...t})}function h({className:e,...t}){return(0,o.jsx)(a.AlertDialog.Description,{className:n.cn(`text-sm leading-6 text-muted-foreground`,e),...t})}function g({className:e,...t}){return(0,o.jsx)(a.AlertDialog.Action,{className:n.cn(r.buttonVariants({variant:`destructive`}),e),...t})}function _({className:e,...t}){return(0,o.jsx)(a.AlertDialog.Cancel,{className:n.cn(r.buttonVariants({variant:`outline`}),e),...t})}exports.AlertDialog=s,exports.AlertDialogAction=g,exports.AlertDialogCancel=_,exports.AlertDialogContent=d,exports.AlertDialogDescription=h,exports.AlertDialogFooter=p,exports.AlertDialogHeader=f,exports.AlertDialogTitle=m,exports.AlertDialogTrigger=c;
|
|
@@ -2,7 +2,7 @@ import * as React from 'react';
|
|
|
2
2
|
import { AlertDialog as AlertDialogPrimitive } from 'radix-ui';
|
|
3
3
|
declare const AlertDialog: React.FC<AlertDialogPrimitive.AlertDialogProps>;
|
|
4
4
|
declare const AlertDialogTrigger: React.ForwardRefExoticComponent<AlertDialogPrimitive.AlertDialogTriggerProps & React.RefAttributes<HTMLButtonElement>>;
|
|
5
|
-
declare function AlertDialogContent({ className, ...props }: React.ComponentProps<typeof AlertDialogPrimitive.Content>): React.JSX.Element;
|
|
5
|
+
declare function AlertDialogContent({ className, ref, ...props }: React.ComponentProps<typeof AlertDialogPrimitive.Content>): React.JSX.Element;
|
|
6
6
|
declare function AlertDialogHeader({ className, ...props }: React.ComponentProps<'div'>): React.JSX.Element;
|
|
7
7
|
declare function AlertDialogFooter({ className, ...props }: React.ComponentProps<'div'>): React.JSX.Element;
|
|
8
8
|
declare function AlertDialogTitle({ className, ...props }: React.ComponentProps<typeof AlertDialogPrimitive.Title>): React.JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"alert-dialog.d.ts","sourceRoot":"","sources":["../../../src/components/ui/alert-dialog.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAE,WAAW,IAAI,oBAAoB,EAAE,MAAM,UAAU,CAAA;
|
|
1
|
+
{"version":3,"file":"alert-dialog.d.ts","sourceRoot":"","sources":["../../../src/components/ui/alert-dialog.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAE,WAAW,IAAI,oBAAoB,EAAE,MAAM,UAAU,CAAA;AAK9D,QAAA,MAAM,WAAW,iDAA4B,CAAA;AAC7C,QAAA,MAAM,kBAAkB,wHAA+B,CAAA;AAiBvD,iBAAS,kBAAkB,CAAC,EAC1B,SAAS,EACT,GAAG,EACH,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,oBAAoB,CAAC,OAAO,CAAC,qBAiB3D;AACD,iBAAS,iBAAiB,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,qBAI9E;AACD,iBAAS,iBAAiB,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,qBAO9E;AACD,iBAAS,gBAAgB,CAAC,EACxB,SAAS,EACT,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,oBAAoB,CAAC,KAAK,CAAC,qBAIzD;AACD,iBAAS,sBAAsB,CAAC,EAC9B,SAAS,EACT,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,oBAAoB,CAAC,WAAW,CAAC,qBAO/D;AACD,iBAAS,iBAAiB,CAAC,EACzB,SAAS,EACT,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,oBAAoB,CAAC,MAAM,CAAC,qBAO1D;AACD,iBAAS,iBAAiB,CAAC,EACzB,SAAS,EACT,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,oBAAoB,CAAC,MAAM,CAAC,qBAO1D;AACD,OAAO,EACL,WAAW,EACX,kBAAkB,EAClB,kBAAkB,EAClB,iBAAiB,EACjB,iBAAiB,EACjB,gBAAgB,EAChB,sBAAsB,EACtB,iBAAiB,EACjB,iBAAiB,GAClB,CAAA"}
|
|
@@ -1,57 +1,60 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import "
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
1
|
+
import { composeRefs as e, useOverlayBackgroundSuppression as t } from "../../lib/overlay-suppression.js";
|
|
2
|
+
import { cn as n } from "../../lib/utils.js";
|
|
3
|
+
import { buttonVariants as r } from "./button.js";
|
|
4
|
+
import * as i from "react";
|
|
5
|
+
import { AlertDialog as a } from "radix-ui";
|
|
6
|
+
import { jsx as o, jsxs as s } from "react/jsx-runtime";
|
|
6
7
|
//#region src/components/ui/alert-dialog.tsx
|
|
7
|
-
var
|
|
8
|
-
function
|
|
9
|
-
return /* @__PURE__ */
|
|
10
|
-
className:
|
|
11
|
-
...
|
|
8
|
+
var c = a.Root, l = a.Trigger, u = a.Portal;
|
|
9
|
+
function d({ className: e, ...t }) {
|
|
10
|
+
return /* @__PURE__ */ o(a.Overlay, {
|
|
11
|
+
className: n("fixed inset-0 z-50 bg-black/50 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0", e),
|
|
12
|
+
...t
|
|
12
13
|
});
|
|
13
14
|
}
|
|
14
|
-
function
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
function f({ className: r, ref: c, ...l }) {
|
|
16
|
+
let f = i.useRef(null), p = t(), m = i.useMemo(() => e(f, p, c), [p, c]);
|
|
17
|
+
return /* @__PURE__ */ s(u, { children: [/* @__PURE__ */ o(d, {}), /* @__PURE__ */ o(a.Content, {
|
|
18
|
+
ref: m,
|
|
19
|
+
className: n("fixed left-1/2 top-1/2 z-50 grid w-[calc(100%-2rem)] max-w-lg -translate-x-1/2 -translate-y-1/2 gap-4 rounded-xl border bg-background p-6 shadow-lg", r),
|
|
20
|
+
...l
|
|
18
21
|
})] });
|
|
19
22
|
}
|
|
20
|
-
function
|
|
21
|
-
return /* @__PURE__ */
|
|
22
|
-
className:
|
|
23
|
-
...
|
|
23
|
+
function p({ className: e, ...t }) {
|
|
24
|
+
return /* @__PURE__ */ o("div", {
|
|
25
|
+
className: n("flex flex-col gap-2 text-center sm:text-left", e),
|
|
26
|
+
...t
|
|
24
27
|
});
|
|
25
28
|
}
|
|
26
|
-
function
|
|
27
|
-
return /* @__PURE__ */
|
|
28
|
-
className:
|
|
29
|
-
...
|
|
29
|
+
function m({ className: e, ...t }) {
|
|
30
|
+
return /* @__PURE__ */ o("div", {
|
|
31
|
+
className: n("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end", e),
|
|
32
|
+
...t
|
|
30
33
|
});
|
|
31
34
|
}
|
|
32
|
-
function
|
|
33
|
-
return /* @__PURE__ */
|
|
34
|
-
className:
|
|
35
|
-
...
|
|
35
|
+
function h({ className: e, ...t }) {
|
|
36
|
+
return /* @__PURE__ */ o(a.Title, {
|
|
37
|
+
className: n("text-lg font-semibold", e),
|
|
38
|
+
...t
|
|
36
39
|
});
|
|
37
40
|
}
|
|
38
|
-
function
|
|
39
|
-
return /* @__PURE__ */
|
|
40
|
-
className:
|
|
41
|
-
...
|
|
41
|
+
function g({ className: e, ...t }) {
|
|
42
|
+
return /* @__PURE__ */ o(a.Description, {
|
|
43
|
+
className: n("text-sm leading-6 text-muted-foreground", e),
|
|
44
|
+
...t
|
|
42
45
|
});
|
|
43
46
|
}
|
|
44
|
-
function
|
|
45
|
-
return /* @__PURE__ */
|
|
46
|
-
className:
|
|
47
|
-
...
|
|
47
|
+
function _({ className: e, ...t }) {
|
|
48
|
+
return /* @__PURE__ */ o(a.Action, {
|
|
49
|
+
className: n(r({ variant: "destructive" }), e),
|
|
50
|
+
...t
|
|
48
51
|
});
|
|
49
52
|
}
|
|
50
|
-
function
|
|
51
|
-
return /* @__PURE__ */
|
|
52
|
-
className:
|
|
53
|
-
...
|
|
53
|
+
function v({ className: e, ...t }) {
|
|
54
|
+
return /* @__PURE__ */ o(a.Cancel, {
|
|
55
|
+
className: n(r({ variant: "outline" }), e),
|
|
56
|
+
...t
|
|
54
57
|
});
|
|
55
58
|
}
|
|
56
59
|
//#endregion
|
|
57
|
-
export {
|
|
60
|
+
export { c as AlertDialog, _ as AlertDialogAction, v as AlertDialogCancel, f as AlertDialogContent, g as AlertDialogDescription, m as AlertDialogFooter, p as AlertDialogHeader, h as AlertDialogTitle, l as AlertDialogTrigger };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require("../../lib/utils.cjs");let
|
|
1
|
+
const e=require("../../_virtual/_rolldown/runtime.cjs"),t=require("../../lib/overlay-suppression.cjs"),n=require("../../lib/utils.cjs");let r=require("react");r=e.__toESM(r,1);let i=require("radix-ui"),a=require("react/jsx-runtime");function o(e){return(0,a.jsx)(i.ContextMenu.Root,{"data-slot":`context-menu`,...e})}function s(e){return(0,a.jsx)(i.ContextMenu.Trigger,{"data-slot":`context-menu-trigger`,...e})}function c({className:e,ref:o,...s}){let c=r.useRef(null),l=t.useOverlayBackgroundSuppression(),u=r.useMemo(()=>t.composeRefs(c,l,o),[l,o]);return(0,a.jsx)(i.ContextMenu.Portal,{children:(0,a.jsx)(i.ContextMenu.Content,{"data-slot":`context-menu-content`,ref:u,className:n.cn(`z-50 min-w-40 overflow-hidden rounded-lg border bg-popover p-1 text-popover-foreground shadow-md`,e),...s})})}function l({className:e,...t}){return(0,a.jsx)(i.ContextMenu.Item,{"data-slot":`context-menu-item`,className:n.cn(`relative flex cursor-default select-none items-center gap-2 rounded-md px-2 py-1.5 text-sm outline-none`,`focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50`,`[&_svg]:size-4 [&_svg]:shrink-0`,e),...t})}function u({className:e,...t}){return(0,a.jsx)(i.ContextMenu.Separator,{"data-slot":`context-menu-separator`,className:n.cn(`-mx-1 my-1 h-px bg-border`,e),...t})}function d({className:e,...t}){return(0,a.jsx)(i.ContextMenu.Label,{"data-slot":`context-menu-label`,className:n.cn(`px-2 py-1.5 text-xs text-muted-foreground`,e),...t})}exports.ContextMenu=o,exports.ContextMenuContent=c,exports.ContextMenuItem=l,exports.ContextMenuLabel=d,exports.ContextMenuSeparator=u,exports.ContextMenuTrigger=s;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
1
2
|
import { ContextMenu as ContextMenuPrimitive } from 'radix-ui';
|
|
2
3
|
/** 右键菜单:表格行、标签页等密集列表的次级操作入口。 */
|
|
3
|
-
declare function ContextMenu(props: React.ComponentProps<typeof ContextMenuPrimitive.Root>):
|
|
4
|
-
declare function ContextMenuTrigger(props: React.ComponentProps<typeof ContextMenuPrimitive.Trigger>):
|
|
5
|
-
declare function ContextMenuContent({ className, ...props }: React.ComponentProps<typeof ContextMenuPrimitive.Content>):
|
|
6
|
-
declare function ContextMenuItem({ className, ...props }: React.ComponentProps<typeof ContextMenuPrimitive.Item>):
|
|
7
|
-
declare function ContextMenuSeparator({ className, ...props }: React.ComponentProps<typeof ContextMenuPrimitive.Separator>):
|
|
8
|
-
declare function ContextMenuLabel({ className, ...props }: React.ComponentProps<typeof ContextMenuPrimitive.Label>):
|
|
4
|
+
declare function ContextMenu(props: React.ComponentProps<typeof ContextMenuPrimitive.Root>): React.JSX.Element;
|
|
5
|
+
declare function ContextMenuTrigger(props: React.ComponentProps<typeof ContextMenuPrimitive.Trigger>): React.JSX.Element;
|
|
6
|
+
declare function ContextMenuContent({ className, ref, ...props }: React.ComponentProps<typeof ContextMenuPrimitive.Content>): React.JSX.Element;
|
|
7
|
+
declare function ContextMenuItem({ className, ...props }: React.ComponentProps<typeof ContextMenuPrimitive.Item>): React.JSX.Element;
|
|
8
|
+
declare function ContextMenuSeparator({ className, ...props }: React.ComponentProps<typeof ContextMenuPrimitive.Separator>): React.JSX.Element;
|
|
9
|
+
declare function ContextMenuLabel({ className, ...props }: React.ComponentProps<typeof ContextMenuPrimitive.Label>): React.JSX.Element;
|
|
9
10
|
export { ContextMenu, ContextMenuTrigger, ContextMenuContent, ContextMenuItem, ContextMenuSeparator, ContextMenuLabel, };
|
|
10
11
|
//# sourceMappingURL=context-menu.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context-menu.d.ts","sourceRoot":"","sources":["../../../src/components/ui/context-menu.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,IAAI,oBAAoB,EAAE,MAAM,UAAU,CAAA;
|
|
1
|
+
{"version":3,"file":"context-menu.d.ts","sourceRoot":"","sources":["../../../src/components/ui/context-menu.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAE,WAAW,IAAI,oBAAoB,EAAE,MAAM,UAAU,CAAA;AAI9D,gCAAgC;AAChC,iBAAS,WAAW,CAAC,KAAK,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,oBAAoB,CAAC,IAAI,CAAC,qBAEjF;AAED,iBAAS,kBAAkB,CAAC,KAAK,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,oBAAoB,CAAC,OAAO,CAAC,qBAE3F;AAED,iBAAS,kBAAkB,CAAC,EAC1B,SAAS,EACT,GAAG,EACH,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,oBAAoB,CAAC,OAAO,CAAC,qBAiB3D;AAED,iBAAS,eAAe,CAAC,EACvB,SAAS,EACT,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,oBAAoB,CAAC,IAAI,CAAC,qBAaxD;AAED,iBAAS,oBAAoB,CAAC,EAC5B,SAAS,EACT,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,oBAAoB,CAAC,SAAS,CAAC,qBAQ7D;AAED,iBAAS,gBAAgB,CAAC,EACxB,SAAS,EACT,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,oBAAoB,CAAC,KAAK,CAAC,qBAQzD;AAED,OAAO,EACL,WAAW,EACX,kBAAkB,EAClB,kBAAkB,EAClB,eAAe,EACf,oBAAoB,EACpB,gBAAgB,GACjB,CAAA"}
|
|
@@ -1,46 +1,50 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
1
|
+
import { composeRefs as e, useOverlayBackgroundSuppression as t } from "../../lib/overlay-suppression.js";
|
|
2
|
+
import { cn as n } from "../../lib/utils.js";
|
|
3
|
+
import * as r from "react";
|
|
4
|
+
import { ContextMenu as i } from "radix-ui";
|
|
5
|
+
import { jsx as a } from "react/jsx-runtime";
|
|
4
6
|
//#region src/components/ui/context-menu.tsx
|
|
5
|
-
function
|
|
6
|
-
return /* @__PURE__ */
|
|
7
|
+
function o(e) {
|
|
8
|
+
return /* @__PURE__ */ a(i.Root, {
|
|
7
9
|
"data-slot": "context-menu",
|
|
8
10
|
...e
|
|
9
11
|
});
|
|
10
12
|
}
|
|
11
|
-
function
|
|
12
|
-
return /* @__PURE__ */
|
|
13
|
+
function s(e) {
|
|
14
|
+
return /* @__PURE__ */ a(i.Trigger, {
|
|
13
15
|
"data-slot": "context-menu-trigger",
|
|
14
16
|
...e
|
|
15
17
|
});
|
|
16
18
|
}
|
|
17
|
-
function
|
|
18
|
-
|
|
19
|
+
function c({ className: o, ref: s, ...c }) {
|
|
20
|
+
let l = r.useRef(null), u = t(), d = r.useMemo(() => e(l, u, s), [u, s]);
|
|
21
|
+
return /* @__PURE__ */ a(i.Portal, { children: /* @__PURE__ */ a(i.Content, {
|
|
19
22
|
"data-slot": "context-menu-content",
|
|
20
|
-
|
|
21
|
-
|
|
23
|
+
ref: d,
|
|
24
|
+
className: n("z-50 min-w-40 overflow-hidden rounded-lg border bg-popover p-1 text-popover-foreground shadow-md", o),
|
|
25
|
+
...c
|
|
22
26
|
}) });
|
|
23
27
|
}
|
|
24
|
-
function
|
|
25
|
-
return /* @__PURE__ */
|
|
28
|
+
function l({ className: e, ...t }) {
|
|
29
|
+
return /* @__PURE__ */ a(i.Item, {
|
|
26
30
|
"data-slot": "context-menu-item",
|
|
27
|
-
className:
|
|
28
|
-
...
|
|
31
|
+
className: n("relative flex cursor-default select-none items-center gap-2 rounded-md px-2 py-1.5 text-sm outline-none", "focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50", "[&_svg]:size-4 [&_svg]:shrink-0", e),
|
|
32
|
+
...t
|
|
29
33
|
});
|
|
30
34
|
}
|
|
31
|
-
function
|
|
32
|
-
return /* @__PURE__ */
|
|
35
|
+
function u({ className: e, ...t }) {
|
|
36
|
+
return /* @__PURE__ */ a(i.Separator, {
|
|
33
37
|
"data-slot": "context-menu-separator",
|
|
34
|
-
className:
|
|
35
|
-
...
|
|
38
|
+
className: n("-mx-1 my-1 h-px bg-border", e),
|
|
39
|
+
...t
|
|
36
40
|
});
|
|
37
41
|
}
|
|
38
|
-
function
|
|
39
|
-
return /* @__PURE__ */
|
|
42
|
+
function d({ className: e, ...t }) {
|
|
43
|
+
return /* @__PURE__ */ a(i.Label, {
|
|
40
44
|
"data-slot": "context-menu-label",
|
|
41
|
-
className:
|
|
42
|
-
...
|
|
45
|
+
className: n("px-2 py-1.5 text-xs text-muted-foreground", e),
|
|
46
|
+
...t
|
|
43
47
|
});
|
|
44
48
|
}
|
|
45
49
|
//#endregion
|
|
46
|
-
export {
|
|
50
|
+
export { o as ContextMenu, c as ContextMenuContent, l as ContextMenuItem, d as ContextMenuLabel, u as ContextMenuSeparator, s as ContextMenuTrigger };
|