@nubisco/ui 4.0.1 → 4.1.0
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/dist/BarChart-Ce1FARbr.cjs +1 -0
- package/dist/BarChart-DTu-Md40.js +290 -0
- package/dist/{BlueprintControls-Bo8iODBv.js → BlueprintControls-CJAKrQ6U.js} +1 -1
- package/dist/{BlueprintControls-BSFwzxjG.cjs → BlueprintControls-aF11uokn.cjs} +1 -1
- package/dist/{Button-C6VXnkFB.js → Button-Cegx6vaT.js} +16 -17
- package/dist/Button-Dqtcr4i0.cjs +1 -0
- package/dist/{Confirm-B2fEiMQw.cjs → Confirm-CW160zEF.cjs} +1 -1
- package/dist/{Confirm-BmI_VsqK.js → Confirm-pgn2HajX.js} +1 -1
- package/dist/{DataTable-DcQGGdbB.cjs → DataTable-BbiDmA1X.cjs} +1 -1
- package/dist/{DataTable-BRCaCVAA.js → DataTable-c0ltF6wT.js} +1 -1
- package/dist/{FileUploader-DsY6Agi1.js → FileUploader-BLwR6H3f.js} +1 -1
- package/dist/{FileUploader-Bn_iCgXm.cjs → FileUploader-Lzy4bFn7.cjs} +1 -1
- package/dist/{NotificationCenter-CiewkoQ-.cjs → NotificationCenter-CrCoVe8p.cjs} +1 -1
- package/dist/{NotificationCenter-CuwEhh08.js → NotificationCenter-CrwDwpt6.js} +1 -1
- package/dist/{Pagination-DDYLKW17.js → Pagination-B6a62qvI.js} +1 -1
- package/dist/{Pagination-P0P1-0ca.cjs → Pagination-CkBe9Naz.cjs} +1 -1
- package/dist/PieChart-D_POVa0d.cjs +1 -0
- package/dist/PieChart-Drnh7d1y.js +181 -0
- package/dist/SidebarLink-CngTvuB6.cjs +1 -0
- package/dist/{SidebarLink-BlQ50jgX.js → SidebarLink-y2If8dtl.js} +10 -11
- package/dist/SidebarMenuItem-DBINoxeA.js +170 -0
- package/dist/SidebarMenuItem-DoyuIs3w.cjs +1 -0
- package/dist/{Walkthrough-H1vr3r1p.cjs → Walkthrough-DHtLDsOk.cjs} +1 -1
- package/dist/{Walkthrough-CV6HLOnv.js → Walkthrough-l7HOZths.js} +1 -1
- package/dist/all.cjs +1 -1
- package/dist/all.mjs +12 -12
- package/dist/components/BlueprintCard.vue.d.ts +1 -1
- package/dist/components/BlueprintControls.cjs +1 -1
- package/dist/components/BlueprintControls.mjs +1 -1
- package/dist/components/Button.cjs +1 -1
- package/dist/components/Button.mjs +1 -1
- package/dist/components/Button.vue.d.ts +1 -1
- package/dist/components/Button.vue.d.ts.map +1 -1
- package/dist/components/Charts/BarChart.cjs +1 -1
- package/dist/components/Charts/BarChart.d.ts +2 -0
- package/dist/components/Charts/BarChart.mjs +1 -1
- package/dist/components/Charts/BarChart.vue.d.ts +7 -2
- package/dist/components/Charts/BarChart.vue.d.ts.map +1 -1
- package/dist/components/Charts/PieChart.cjs +1 -1
- package/dist/components/Charts/PieChart.mjs +1 -1
- package/dist/components/Charts/PieChart.vue.d.ts +7 -2
- package/dist/components/Charts/PieChart.vue.d.ts.map +1 -1
- package/dist/components/Charts/shared/types.d.ts +39 -0
- package/dist/components/Confirm.cjs +1 -1
- package/dist/components/Confirm.mjs +1 -1
- package/dist/components/DataTable.cjs +1 -1
- package/dist/components/DataTable.mjs +1 -1
- package/dist/components/FileUploader.cjs +1 -1
- package/dist/components/FileUploader.mjs +1 -1
- package/dist/components/NotificationCenter.cjs +1 -1
- package/dist/components/NotificationCenter.mjs +1 -1
- package/dist/components/Pagination.cjs +1 -1
- package/dist/components/Pagination.mjs +1 -1
- package/dist/components/SidebarLink.cjs +1 -1
- package/dist/components/SidebarLink.mjs +1 -1
- package/dist/components/SidebarLink.vue.d.ts.map +1 -1
- package/dist/components/SidebarMenuItem.cjs +1 -1
- package/dist/components/SidebarMenuItem.mjs +1 -1
- package/dist/components/SidebarMenuItem.vue.d.ts.map +1 -1
- package/dist/components/Walkthrough.cjs +1 -1
- package/dist/components/Walkthrough.mjs +1 -1
- package/dist/composables/useConfirm.composable.cjs +1 -1
- package/dist/composables/useConfirm.composable.mjs +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +12 -12
- package/dist/main.d.ts +2 -0
- package/dist/main.d.ts.map +1 -1
- package/dist/styles/BarChart.css +1 -1
- package/dist/styles/Button.css +1 -1
- package/dist/styles/PieChart.css +1 -1
- package/dist/styles/SidebarLink.css +1 -1
- package/dist/styles/SidebarMenuItem.css +1 -1
- package/dist/ui.css +5 -5
- package/package.json +2 -1
- package/dist/BarChart-B3WKey-r.cjs +0 -1
- package/dist/BarChart-DYgJdP0G.js +0 -185
- package/dist/Button-6GNkKckU.cjs +0 -1
- package/dist/PieChart-Ddw9Ixu2.cjs +0 -1
- package/dist/PieChart-E0Q6WOuT.js +0 -157
- package/dist/SidebarLink-B857d6tr.cjs +0 -1
- package/dist/SidebarMenuItem-BUqF3qLa.js +0 -171
- package/dist/SidebarMenuItem-DRtFtvJK.cjs +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
require(`./chunk-D-qHiVGv.cjs`);const e=require(`./_plugin-vue_export-helper-tagjRzOz.cjs`),t=require(`./palette-73dy8s3C.cjs`),n=require(`./ChartLegend-CkL6V-U_.cjs`),r=require(`./scales-Bzt05iAE.cjs`),i=require(`./useChartSize-xKPzLmex.cjs`);let a=require(`vue`);var o=[`width`,`height`,`role`,`aria-label`],s={key:0},c=[`x1`,`x2`,`y1`,`y2`],l={class:`nb-chart__axis`},u=[`x`,`y`,`text-anchor`,`dominant-baseline`],d={class:`nb-chart__axis`},f=[`x`,`y`,`text-anchor`,`dominant-baseline`],p=[`x1`,`x2`,`y1`,`y2`],m=[`fill`,`tabindex`,`role`,`aria-label`,`onKeydown`],h={class:`nb-chart__hover-layer`},g=[`onMouseenter`,`onMousemove`,`onClick`],_=(0,a.defineComponent)({__name:`BarChart`,props:{series:{default:()=>[]},orientation:{default:`vertical`},stacked:{type:Boolean,default:!1},title:{default:void 0},subtitle:{default:void 0},height:{default:280},showLegend:{type:Boolean,default:!0},showTooltip:{type:Boolean,default:!0},showGrid:{type:Boolean,default:!0},colors:{default:()=>t.n}},emits:[`select`],setup(e,{emit:_}){let v=e,y=_,b=(0,a.ref)(null),x=i.t(b,{width:480,height:240}),S=(0,a.computed)(()=>v.orientation===`horizontal`),C=(0,a.computed)(()=>v.series.map((e,n)=>({name:e.name,data:e.data,color:e.color??t.i(n,v.colors)}))),w=(0,a.computed)(()=>(v.series[0]?.data??[]).map(e=>e.x)),T=(e,t)=>C.value[t]?.data[e]?.y??0,E=(e,t)=>{let n=T(e,t);if(!v.stacked)return[0,n];let r=0;for(let i=0;i<t;i+=1){let t=T(e,i);t>=0==n>=0&&(r+=t)}return[r,r+n]},D=(0,a.computed)(()=>{let e=[];return w.value.forEach((t,n)=>{C.value.forEach((t,r)=>{e.push(E(n,r)[1])})}),e.length?r.i(Math.min(0,...e),Math.max(0,...e),.05):[0,1]}),O=(0,a.computed)(()=>{if(!S.value)return{top:12,right:16,bottom:28,left:44};let e=w.value.reduce((e,t)=>Math.max(e,String(t).length),0),t=Math.max(44,Math.round(x.value.width*.4));return{top:12,right:16,bottom:28,left:Math.min(Math.max(44,Math.ceil(e*6.2)+12),t)}}),k=(0,a.computed)(()=>({x0:O.value.left,x1:Math.max(O.value.left,x.value.width-O.value.right),y0:O.value.top,y1:Math.max(O.value.top,x.value.height-O.value.bottom)})),A=(0,a.computed)(()=>r.t(w.value.map(e=>String(e)),S.value?[k.value.y0,k.value.y1]:[k.value.x0,k.value.x1],.2)),j=(0,a.computed)(()=>r.r(D.value,S.value?[k.value.x0,k.value.x1]:[k.value.y1,k.value.y0])),M=(0,a.computed)(()=>j.value.ticks(5)),N=e=>A.value(String(w.value[e])),P=e=>N(e)+A.value.bandwidth/2,F=(0,a.computed)(()=>{let e=C.value.length||1;return v.stacked?A.value.bandwidth:A.value.bandwidth/e}),I=(e,t)=>{let[n,r]=E(e,t),i=j.value(n),a=j.value(r),o=Math.max(0,F.value-2),s=N(e)+(v.stacked?0:t*F.value),c=Math.max(0,Math.abs(a-i));return S.value?{x:Math.min(i,a),y:s,width:c,height:o}:{x:s,y:Math.min(i,a),width:o,height:c}},L=e=>{let t=N(e),n=A.value.bandwidth;return S.value?{x:k.value.x0,y:t,width:Math.max(0,k.value.x1-k.value.x0),height:n}:{x:t,y:k.value.y0,width:n,height:Math.max(0,k.value.y1-k.value.y0)}},R=e=>Math.abs(e)>=1e3?`${(e/1e3).toFixed(1)}k`:String(e),z=(0,a.getCurrentInstance)(),B=()=>!!z?.vnode.props?.onSelect,V=(e,t)=>{let n=C.value[t],r=R(T(e,t));return C.value.length>1?`${w.value[e]}, ${n?.name}: ${r}`:`${w.value[e]}: ${r}`},H=(e,t)=>{let n=C.value[t],r=n?.data[e];return{kind:`series`,x:r?.x??w.value[e],y:r?.y??0,seriesName:n?.name??``,seriesIndex:t,index:e,point:r??{x:w.value[e],y:0}}},U=e=>{let t=e.currentTarget.ownerSVGElement;if(!t)return null;let n=t.getBoundingClientRect();return{x:e.clientX-n.left,y:e.clientY-n.top}},W=(e,t)=>{let n=C.value.length;if(n<=1)return 0;let r=U(e);if(!r)return 0;if(v.stacked){let e=S.value?r.x:r.y;for(let r=0;r<n;r+=1){let[n,i]=E(t,r),a=j.value(n),o=j.value(i);if(e>=Math.min(a,o)&&e<=Math.max(a,o))return r}return n-1}let i=(S.value?r.y:r.x)-N(t),a=Math.floor(i/(F.value||1));return Math.min(Math.max(a,0),n-1)},G=(e,t)=>{B()&&y(`select`,H(t,W(e,t)))},K=(e,t,n)=>{B()&&(e.key!==`Enter`&&e.key!==` `||(e.preventDefault(),y(`select`,H(t,n))))},q=(0,a.ref)(null),J=(0,a.ref)({x:0,y:0}),Y=(e,t)=>{let n=U(e);n&&(J.value={x:n.x+12,y:n.y+12},q.value=t)},X=(0,a.computed)(()=>q.value===null?[]:C.value.map(e=>({label:e.name,value:R(e.data[q.value]?.y??0),color:e.color})));return(r,i)=>((0,a.openBlock)(),(0,a.createBlock)(t.u,{title:e.title,subtitle:e.subtitle,height:e.height,"show-legend":e.showLegend&&C.value.length>0},{legend:(0,a.withCtx)(()=>[(0,a.createVNode)(n.t,{items:C.value.map(e=>({label:e.name,color:e.color}))},null,8,[`items`])]),default:(0,a.withCtx)(()=>[(0,a.createElementVNode)(`div`,{ref_key:`root`,ref:b,class:`nb-bar-chart`},[((0,a.openBlock)(),(0,a.createElementBlock)(`svg`,{width:(0,a.unref)(x).width,height:(0,a.unref)(x).height,class:(0,a.normalizeClass)([`nb-chart__svg`,{"nb-chart__svg--selectable":B()}]),role:B()?`group`:`img`,"aria-label":e.title||`Bar chart`,onMouseleave:i[0]||=e=>q.value=null},[e.showGrid&&(0,a.unref)(x).width>0?((0,a.openBlock)(),(0,a.createElementBlock)(`g`,s,[((0,a.openBlock)(!0),(0,a.createElementBlock)(a.Fragment,null,(0,a.renderList)(M.value,e=>((0,a.openBlock)(),(0,a.createElementBlock)(`line`,{key:`grid-${e}`,class:`nb-chart__gridline`,x1:S.value?j.value(e):k.value.x0,x2:S.value?j.value(e):k.value.x1,y1:S.value?k.value.y0:j.value(e),y2:S.value?k.value.y1:j.value(e)},null,8,c))),128))])):(0,a.createCommentVNode)(``,!0),(0,a.createElementVNode)(`g`,l,[((0,a.openBlock)(!0),(0,a.createElementBlock)(a.Fragment,null,(0,a.renderList)(M.value,e=>((0,a.openBlock)(),(0,a.createElementBlock)(`text`,{key:`vt-${e}`,x:S.value?j.value(e):k.value.x0-6,y:S.value?k.value.y1+14:j.value(e),"text-anchor":S.value?`middle`:`end`,"dominant-baseline":S.value?`auto`:`middle`},(0,a.toDisplayString)(R(e)),9,u))),128))]),(0,a.createElementVNode)(`g`,d,[((0,a.openBlock)(!0),(0,a.createElementBlock)(a.Fragment,null,(0,a.renderList)(w.value,(e,t)=>((0,a.openBlock)(),(0,a.createElementBlock)(`text`,{key:`ct-${t}`,x:S.value?k.value.x0-6:P(t),y:S.value?P(t):k.value.y1+14,"text-anchor":S.value?`end`:`middle`,"dominant-baseline":S.value?`middle`:`auto`},(0,a.toDisplayString)(e),9,f))),128))]),(0,a.createElementVNode)(`line`,{class:`nb-chart__axis-line`,x1:S.value?j.value(0):k.value.x0,x2:S.value?j.value(0):k.value.x1,y1:S.value?k.value.y0:j.value(0),y2:S.value?k.value.y1:j.value(0)},null,8,p),((0,a.openBlock)(!0),(0,a.createElementBlock)(a.Fragment,null,(0,a.renderList)(w.value,(e,t)=>((0,a.openBlock)(),(0,a.createElementBlock)(`g`,{key:`g-${t}`},[((0,a.openBlock)(!0),(0,a.createElementBlock)(a.Fragment,null,(0,a.renderList)(C.value,(e,n)=>((0,a.openBlock)(),(0,a.createElementBlock)(`rect`,(0,a.mergeProps)({key:`${t}-${n}`,class:[`nb-chart__bar`,{"is-dim":q.value!==null&&q.value!==t}]},{ref_for:!0},I(t,n),{fill:e.color,tabindex:B()?0:void 0,role:B()?`button`:void 0,"aria-label":B()?V(t,n):void 0,onKeydown:e=>K(e,t,n)}),null,16,m))),128))]))),128)),(0,a.createElementVNode)(`g`,h,[((0,a.openBlock)(!0),(0,a.createElementBlock)(a.Fragment,null,(0,a.renderList)(w.value,(e,t)=>((0,a.openBlock)(),(0,a.createElementBlock)(`rect`,(0,a.mergeProps)({key:`hover-${t}`},{ref_for:!0},L(t),{fill:`transparent`,onMouseenter:e=>q.value=t,onMousemove:e=>Y(e,t),onClick:e=>G(e,t)}),null,16,g))),128))])],42,o)),(0,a.createVNode)(t.l,{visible:e.showTooltip&&q.value!==null,x:J.value.x,y:J.value.y,title:q.value===null?``:String(w.value[q.value]),rows:X.value},null,8,[`visible`,`x`,`y`,`title`,`rows`])],512)]),_:1},8,[`title`,`subtitle`,`height`,`show-legend`]))}}),v=e.t(_,[[`__scopeId`,`data-v-6e97c73e`]]);Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return v}});
|
|
@@ -0,0 +1,290 @@
|
|
|
1
|
+
import { t as e } from "./_plugin-vue_export-helper-O4QQSku4.js";
|
|
2
|
+
import { i as t, l as n, n as r, u as i } from "./palette-DpTb1uUD.js";
|
|
3
|
+
import { t as a } from "./ChartLegend-DvjSe_3l.js";
|
|
4
|
+
import { i as o, r as s, t as c } from "./scales-DzXsYt4Z.js";
|
|
5
|
+
import { t as ee } from "./useChartSize-B6TdJSnI.js";
|
|
6
|
+
import { Fragment as l, computed as u, createBlock as te, createCommentVNode as ne, createElementBlock as d, createElementVNode as f, createVNode as p, defineComponent as m, getCurrentInstance as re, mergeProps as h, normalizeClass as ie, openBlock as g, ref as _, renderList as v, toDisplayString as y, unref as b, withCtx as x } from "vue";
|
|
7
|
+
//#region src/components/Charts/BarChart.vue?vue&type=script&setup=true&lang.ts
|
|
8
|
+
var ae = [
|
|
9
|
+
"width",
|
|
10
|
+
"height",
|
|
11
|
+
"role",
|
|
12
|
+
"aria-label"
|
|
13
|
+
], oe = { key: 0 }, S = [
|
|
14
|
+
"x1",
|
|
15
|
+
"x2",
|
|
16
|
+
"y1",
|
|
17
|
+
"y2"
|
|
18
|
+
], C = { class: "nb-chart__axis" }, w = [
|
|
19
|
+
"x",
|
|
20
|
+
"y",
|
|
21
|
+
"text-anchor",
|
|
22
|
+
"dominant-baseline"
|
|
23
|
+
], T = { class: "nb-chart__axis" }, E = [
|
|
24
|
+
"x",
|
|
25
|
+
"y",
|
|
26
|
+
"text-anchor",
|
|
27
|
+
"dominant-baseline"
|
|
28
|
+
], D = [
|
|
29
|
+
"x1",
|
|
30
|
+
"x2",
|
|
31
|
+
"y1",
|
|
32
|
+
"y2"
|
|
33
|
+
], O = [
|
|
34
|
+
"fill",
|
|
35
|
+
"tabindex",
|
|
36
|
+
"role",
|
|
37
|
+
"aria-label",
|
|
38
|
+
"onKeydown"
|
|
39
|
+
], k = { class: "nb-chart__hover-layer" }, se = [
|
|
40
|
+
"onMouseenter",
|
|
41
|
+
"onMousemove",
|
|
42
|
+
"onClick"
|
|
43
|
+
], A = /* @__PURE__ */ e(/* @__PURE__ */ m({
|
|
44
|
+
__name: "BarChart",
|
|
45
|
+
props: {
|
|
46
|
+
series: { default: () => [] },
|
|
47
|
+
orientation: { default: "vertical" },
|
|
48
|
+
stacked: {
|
|
49
|
+
type: Boolean,
|
|
50
|
+
default: !1
|
|
51
|
+
},
|
|
52
|
+
title: { default: void 0 },
|
|
53
|
+
subtitle: { default: void 0 },
|
|
54
|
+
height: { default: 280 },
|
|
55
|
+
showLegend: {
|
|
56
|
+
type: Boolean,
|
|
57
|
+
default: !0
|
|
58
|
+
},
|
|
59
|
+
showTooltip: {
|
|
60
|
+
type: Boolean,
|
|
61
|
+
default: !0
|
|
62
|
+
},
|
|
63
|
+
showGrid: {
|
|
64
|
+
type: Boolean,
|
|
65
|
+
default: !0
|
|
66
|
+
},
|
|
67
|
+
colors: { default: () => r }
|
|
68
|
+
},
|
|
69
|
+
emits: ["select"],
|
|
70
|
+
setup(e, { emit: r }) {
|
|
71
|
+
let m = e, A = r, j = _(null), M = ee(j, {
|
|
72
|
+
width: 480,
|
|
73
|
+
height: 240
|
|
74
|
+
}), N = u(() => m.orientation === "horizontal"), P = u(() => m.series.map((e, n) => ({
|
|
75
|
+
name: e.name,
|
|
76
|
+
data: e.data,
|
|
77
|
+
color: e.color ?? t(n, m.colors)
|
|
78
|
+
}))), F = u(() => (m.series[0]?.data ?? []).map((e) => e.x)), I = (e, t) => P.value[t]?.data[e]?.y ?? 0, L = (e, t) => {
|
|
79
|
+
let n = I(e, t);
|
|
80
|
+
if (!m.stacked) return [0, n];
|
|
81
|
+
let r = 0;
|
|
82
|
+
for (let i = 0; i < t; i += 1) {
|
|
83
|
+
let t = I(e, i);
|
|
84
|
+
t >= 0 == n >= 0 && (r += t);
|
|
85
|
+
}
|
|
86
|
+
return [r, r + n];
|
|
87
|
+
}, R = u(() => {
|
|
88
|
+
let e = [];
|
|
89
|
+
return F.value.forEach((t, n) => {
|
|
90
|
+
P.value.forEach((t, r) => {
|
|
91
|
+
e.push(L(n, r)[1]);
|
|
92
|
+
});
|
|
93
|
+
}), e.length ? o(Math.min(0, ...e), Math.max(0, ...e), .05) : [0, 1];
|
|
94
|
+
}), z = u(() => {
|
|
95
|
+
if (!N.value) return {
|
|
96
|
+
top: 12,
|
|
97
|
+
right: 16,
|
|
98
|
+
bottom: 28,
|
|
99
|
+
left: 44
|
|
100
|
+
};
|
|
101
|
+
let e = F.value.reduce((e, t) => Math.max(e, String(t).length), 0), t = Math.max(44, Math.round(M.value.width * .4));
|
|
102
|
+
return {
|
|
103
|
+
top: 12,
|
|
104
|
+
right: 16,
|
|
105
|
+
bottom: 28,
|
|
106
|
+
left: Math.min(Math.max(44, Math.ceil(e * 6.2) + 12), t)
|
|
107
|
+
};
|
|
108
|
+
}), B = u(() => ({
|
|
109
|
+
x0: z.value.left,
|
|
110
|
+
x1: Math.max(z.value.left, M.value.width - z.value.right),
|
|
111
|
+
y0: z.value.top,
|
|
112
|
+
y1: Math.max(z.value.top, M.value.height - z.value.bottom)
|
|
113
|
+
})), V = u(() => c(F.value.map((e) => String(e)), N.value ? [B.value.y0, B.value.y1] : [B.value.x0, B.value.x1], .2)), H = u(() => s(R.value, N.value ? [B.value.x0, B.value.x1] : [B.value.y1, B.value.y0])), U = u(() => H.value.ticks(5)), W = (e) => V.value(String(F.value[e])), G = (e) => W(e) + V.value.bandwidth / 2, K = u(() => {
|
|
114
|
+
let e = P.value.length || 1;
|
|
115
|
+
return m.stacked ? V.value.bandwidth : V.value.bandwidth / e;
|
|
116
|
+
}), ce = (e, t) => {
|
|
117
|
+
let [n, r] = L(e, t), i = H.value(n), a = H.value(r), o = Math.max(0, K.value - 2), s = W(e) + (m.stacked ? 0 : t * K.value), c = Math.max(0, Math.abs(a - i));
|
|
118
|
+
return N.value ? {
|
|
119
|
+
x: Math.min(i, a),
|
|
120
|
+
y: s,
|
|
121
|
+
width: c,
|
|
122
|
+
height: o
|
|
123
|
+
} : {
|
|
124
|
+
x: s,
|
|
125
|
+
y: Math.min(i, a),
|
|
126
|
+
width: o,
|
|
127
|
+
height: c
|
|
128
|
+
};
|
|
129
|
+
}, le = (e) => {
|
|
130
|
+
let t = W(e), n = V.value.bandwidth;
|
|
131
|
+
return N.value ? {
|
|
132
|
+
x: B.value.x0,
|
|
133
|
+
y: t,
|
|
134
|
+
width: Math.max(0, B.value.x1 - B.value.x0),
|
|
135
|
+
height: n
|
|
136
|
+
} : {
|
|
137
|
+
x: t,
|
|
138
|
+
y: B.value.y0,
|
|
139
|
+
width: n,
|
|
140
|
+
height: Math.max(0, B.value.y1 - B.value.y0)
|
|
141
|
+
};
|
|
142
|
+
}, q = (e) => Math.abs(e) >= 1e3 ? `${(e / 1e3).toFixed(1)}k` : String(e), ue = re(), J = () => !!ue?.vnode.props?.onSelect, Y = (e, t) => {
|
|
143
|
+
let n = P.value[t], r = q(I(e, t));
|
|
144
|
+
return P.value.length > 1 ? `${F.value[e]}, ${n?.name}: ${r}` : `${F.value[e]}: ${r}`;
|
|
145
|
+
}, X = (e, t) => {
|
|
146
|
+
let n = P.value[t], r = n?.data[e];
|
|
147
|
+
return {
|
|
148
|
+
kind: "series",
|
|
149
|
+
x: r?.x ?? F.value[e],
|
|
150
|
+
y: r?.y ?? 0,
|
|
151
|
+
seriesName: n?.name ?? "",
|
|
152
|
+
seriesIndex: t,
|
|
153
|
+
index: e,
|
|
154
|
+
point: r ?? {
|
|
155
|
+
x: F.value[e],
|
|
156
|
+
y: 0
|
|
157
|
+
}
|
|
158
|
+
};
|
|
159
|
+
}, Z = (e) => {
|
|
160
|
+
let t = e.currentTarget.ownerSVGElement;
|
|
161
|
+
if (!t) return null;
|
|
162
|
+
let n = t.getBoundingClientRect();
|
|
163
|
+
return {
|
|
164
|
+
x: e.clientX - n.left,
|
|
165
|
+
y: e.clientY - n.top
|
|
166
|
+
};
|
|
167
|
+
}, de = (e, t) => {
|
|
168
|
+
let n = P.value.length;
|
|
169
|
+
if (n <= 1) return 0;
|
|
170
|
+
let r = Z(e);
|
|
171
|
+
if (!r) return 0;
|
|
172
|
+
if (m.stacked) {
|
|
173
|
+
let e = N.value ? r.x : r.y;
|
|
174
|
+
for (let r = 0; r < n; r += 1) {
|
|
175
|
+
let [n, i] = L(t, r), a = H.value(n), o = H.value(i);
|
|
176
|
+
if (e >= Math.min(a, o) && e <= Math.max(a, o)) return r;
|
|
177
|
+
}
|
|
178
|
+
return n - 1;
|
|
179
|
+
}
|
|
180
|
+
let i = (N.value ? r.y : r.x) - W(t), a = Math.floor(i / (K.value || 1));
|
|
181
|
+
return Math.min(Math.max(a, 0), n - 1);
|
|
182
|
+
}, fe = (e, t) => {
|
|
183
|
+
J() && A("select", X(t, de(e, t)));
|
|
184
|
+
}, pe = (e, t, n) => {
|
|
185
|
+
J() && (e.key !== "Enter" && e.key !== " " || (e.preventDefault(), A("select", X(t, n))));
|
|
186
|
+
}, Q = _(null), $ = _({
|
|
187
|
+
x: 0,
|
|
188
|
+
y: 0
|
|
189
|
+
}), me = (e, t) => {
|
|
190
|
+
let n = Z(e);
|
|
191
|
+
n && ($.value = {
|
|
192
|
+
x: n.x + 12,
|
|
193
|
+
y: n.y + 12
|
|
194
|
+
}, Q.value = t);
|
|
195
|
+
}, he = u(() => Q.value === null ? [] : P.value.map((e) => ({
|
|
196
|
+
label: e.name,
|
|
197
|
+
value: q(e.data[Q.value]?.y ?? 0),
|
|
198
|
+
color: e.color
|
|
199
|
+
})));
|
|
200
|
+
return (t, r) => (g(), te(i, {
|
|
201
|
+
title: e.title,
|
|
202
|
+
subtitle: e.subtitle,
|
|
203
|
+
height: e.height,
|
|
204
|
+
"show-legend": e.showLegend && P.value.length > 0
|
|
205
|
+
}, {
|
|
206
|
+
legend: x(() => [p(a, { items: P.value.map((e) => ({
|
|
207
|
+
label: e.name,
|
|
208
|
+
color: e.color
|
|
209
|
+
})) }, null, 8, ["items"])]),
|
|
210
|
+
default: x(() => [f("div", {
|
|
211
|
+
ref_key: "root",
|
|
212
|
+
ref: j,
|
|
213
|
+
class: "nb-bar-chart"
|
|
214
|
+
}, [(g(), d("svg", {
|
|
215
|
+
width: b(M).width,
|
|
216
|
+
height: b(M).height,
|
|
217
|
+
class: ie(["nb-chart__svg", { "nb-chart__svg--selectable": J() }]),
|
|
218
|
+
role: J() ? "group" : "img",
|
|
219
|
+
"aria-label": e.title || "Bar chart",
|
|
220
|
+
onMouseleave: r[0] ||= (e) => Q.value = null
|
|
221
|
+
}, [
|
|
222
|
+
e.showGrid && b(M).width > 0 ? (g(), d("g", oe, [(g(!0), d(l, null, v(U.value, (e) => (g(), d("line", {
|
|
223
|
+
key: `grid-${e}`,
|
|
224
|
+
class: "nb-chart__gridline",
|
|
225
|
+
x1: N.value ? H.value(e) : B.value.x0,
|
|
226
|
+
x2: N.value ? H.value(e) : B.value.x1,
|
|
227
|
+
y1: N.value ? B.value.y0 : H.value(e),
|
|
228
|
+
y2: N.value ? B.value.y1 : H.value(e)
|
|
229
|
+
}, null, 8, S))), 128))])) : ne("", !0),
|
|
230
|
+
f("g", C, [(g(!0), d(l, null, v(U.value, (e) => (g(), d("text", {
|
|
231
|
+
key: `vt-${e}`,
|
|
232
|
+
x: N.value ? H.value(e) : B.value.x0 - 6,
|
|
233
|
+
y: N.value ? B.value.y1 + 14 : H.value(e),
|
|
234
|
+
"text-anchor": N.value ? "middle" : "end",
|
|
235
|
+
"dominant-baseline": N.value ? "auto" : "middle"
|
|
236
|
+
}, y(q(e)), 9, w))), 128))]),
|
|
237
|
+
f("g", T, [(g(!0), d(l, null, v(F.value, (e, t) => (g(), d("text", {
|
|
238
|
+
key: `ct-${t}`,
|
|
239
|
+
x: N.value ? B.value.x0 - 6 : G(t),
|
|
240
|
+
y: N.value ? G(t) : B.value.y1 + 14,
|
|
241
|
+
"text-anchor": N.value ? "end" : "middle",
|
|
242
|
+
"dominant-baseline": N.value ? "middle" : "auto"
|
|
243
|
+
}, y(e), 9, E))), 128))]),
|
|
244
|
+
f("line", {
|
|
245
|
+
class: "nb-chart__axis-line",
|
|
246
|
+
x1: N.value ? H.value(0) : B.value.x0,
|
|
247
|
+
x2: N.value ? H.value(0) : B.value.x1,
|
|
248
|
+
y1: N.value ? B.value.y0 : H.value(0),
|
|
249
|
+
y2: N.value ? B.value.y1 : H.value(0)
|
|
250
|
+
}, null, 8, D),
|
|
251
|
+
(g(!0), d(l, null, v(F.value, (e, t) => (g(), d("g", { key: `g-${t}` }, [(g(!0), d(l, null, v(P.value, (e, n) => (g(), d("rect", h({
|
|
252
|
+
key: `${t}-${n}`,
|
|
253
|
+
class: ["nb-chart__bar", { "is-dim": Q.value !== null && Q.value !== t }]
|
|
254
|
+
}, { ref_for: !0 }, ce(t, n), {
|
|
255
|
+
fill: e.color,
|
|
256
|
+
tabindex: J() ? 0 : void 0,
|
|
257
|
+
role: J() ? "button" : void 0,
|
|
258
|
+
"aria-label": J() ? Y(t, n) : void 0,
|
|
259
|
+
onKeydown: (e) => pe(e, t, n)
|
|
260
|
+
}), null, 16, O))), 128))]))), 128)),
|
|
261
|
+
f("g", k, [(g(!0), d(l, null, v(F.value, (e, t) => (g(), d("rect", h({ key: `hover-${t}` }, { ref_for: !0 }, le(t), {
|
|
262
|
+
fill: "transparent",
|
|
263
|
+
onMouseenter: (e) => Q.value = t,
|
|
264
|
+
onMousemove: (e) => me(e, t),
|
|
265
|
+
onClick: (e) => fe(e, t)
|
|
266
|
+
}), null, 16, se))), 128))])
|
|
267
|
+
], 42, ae)), p(n, {
|
|
268
|
+
visible: e.showTooltip && Q.value !== null,
|
|
269
|
+
x: $.value.x,
|
|
270
|
+
y: $.value.y,
|
|
271
|
+
title: Q.value === null ? "" : String(F.value[Q.value]),
|
|
272
|
+
rows: he.value
|
|
273
|
+
}, null, 8, [
|
|
274
|
+
"visible",
|
|
275
|
+
"x",
|
|
276
|
+
"y",
|
|
277
|
+
"title",
|
|
278
|
+
"rows"
|
|
279
|
+
])], 512)]),
|
|
280
|
+
_: 1
|
|
281
|
+
}, 8, [
|
|
282
|
+
"title",
|
|
283
|
+
"subtitle",
|
|
284
|
+
"height",
|
|
285
|
+
"show-legend"
|
|
286
|
+
]));
|
|
287
|
+
}
|
|
288
|
+
}), [["__scopeId", "data-v-6e97c73e"]]);
|
|
289
|
+
//#endregion
|
|
290
|
+
export { A as t };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as e } from "./_plugin-vue_export-helper-O4QQSku4.js";
|
|
2
2
|
import { r as t } from "./Size.d-Bah6vMl3.js";
|
|
3
|
-
import { t as n } from "./Button-
|
|
3
|
+
import { t as n } from "./Button-Cegx6vaT.js";
|
|
4
4
|
import { useBlueprint as r } from "./composables/useBlueprint.composable.mjs";
|
|
5
5
|
import { computed as i, createBlock as a, createCommentVNode as o, createElementBlock as s, createElementVNode as c, createVNode as l, defineComponent as u, normalizeClass as d, openBlock as f, unref as p } from "vue";
|
|
6
6
|
import * as m from "@nubisco/ui/icons/magnifying-glass-plus";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require(`./chunk-D-qHiVGv.cjs`),t=require(`./_plugin-vue_export-helper-tagjRzOz.cjs`),n=require(`./Size.d-GBIblj2D.cjs`),r=require(`./Button-
|
|
1
|
+
const e=require(`./chunk-D-qHiVGv.cjs`),t=require(`./_plugin-vue_export-helper-tagjRzOz.cjs`),n=require(`./Size.d-GBIblj2D.cjs`),r=require(`./Button-Dqtcr4i0.cjs`),i=require(`./composables/useBlueprint.composable.cjs`);let a=require(`vue`),o=require(`@nubisco/ui/icons/magnifying-glass-plus`);o=e.n(o);let s=require(`@nubisco/ui/icons/magnifying-glass-minus`);s=e.n(s);let c=require(`@nubisco/ui/icons/frame-corners`);c=e.n(c);let l=require(`@nubisco/ui/icons/crosshair`);l=e.n(l);let u=require(`@nubisco/ui/icons/tree-structure`);u=e.n(u);let d=require(`@nubisco/ui/icons/align-left`);d=e.n(d);let f=require(`@nubisco/ui/icons/align-center-horizontal`);f=e.n(f);let p=require(`@nubisco/ui/icons/align-right`);p=e.n(p);let m=require(`@nubisco/ui/icons/align-top`);m=e.n(m);let h=require(`@nubisco/ui/icons/align-center-vertical`);h=e.n(h);let g=require(`@nubisco/ui/icons/align-bottom`);g=e.n(g);let _=require(`@nubisco/ui/icons/arrows-out-line-horizontal`);_=e.n(_);let v=require(`@nubisco/ui/icons/arrows-out-line-vertical`);v=e.n(v);var y={class:`nb-blueprint-controls__group`},b={key:0,class:`nb-blueprint-controls__group`},x=(0,a.defineComponent)({__name:`BlueprintControls`,props:{position:{default:`bottom-right`},orientation:{default:`vertical`},show:{default:`always`},autoLayout:{type:Boolean,default:!0},alignment:{type:Boolean,default:!0}},setup(e){let t=n.r.Small,x=e,S=i.useBlueprint(),C=(0,a.computed)(()=>x.show===`always`||S.isEditMode.value),w=(0,a.computed)(()=>x.alignment&&S.selectedIds.value.size>=2);return(n,i)=>C.value?((0,a.openBlock)(),(0,a.createElementBlock)(`div`,{key:0,class:(0,a.normalizeClass)([`nb-blueprint-controls`,[`nb-blueprint-controls--${e.position}`,`is-${e.orientation}`]]),role:`toolbar`,"aria-label":`Blueprint controls`},[(0,a.createElementVNode)(`div`,y,[(0,a.createVNode)(r.t,{variant:`ghost`,size:(0,a.unref)(t),icon:o,title:`Zoom in`,"aria-label":`Zoom in`,onClick:i[0]||=e=>(0,a.unref)(S).zoomIn()},null,8,[`size`]),(0,a.createVNode)(r.t,{variant:`ghost`,size:(0,a.unref)(t),icon:s,title:`Zoom out`,"aria-label":`Zoom out`,onClick:i[1]||=e=>(0,a.unref)(S).zoomOut()},null,8,[`size`]),(0,a.createVNode)(r.t,{variant:`ghost`,size:(0,a.unref)(t),icon:c,title:`Fit to view`,"aria-label":`Fit to view`,onClick:i[2]||=e=>(0,a.unref)(S).fitToView()},null,8,[`size`]),(0,a.createVNode)(r.t,{variant:`ghost`,size:(0,a.unref)(t),icon:l,title:`Center`,"aria-label":`Center`,onClick:i[3]||=e=>(0,a.unref)(S).centerView()},null,8,[`size`]),e.autoLayout?((0,a.openBlock)(),(0,a.createBlock)(r.t,{key:0,variant:`ghost`,size:(0,a.unref)(t),icon:u,title:`Auto layout`,"aria-label":`Auto layout`,onClick:i[4]||=e=>(0,a.unref)(S).autoLayout()},null,8,[`size`])):(0,a.createCommentVNode)(``,!0)]),w.value?((0,a.openBlock)(),(0,a.createElementBlock)(`div`,b,[(0,a.createVNode)(r.t,{variant:`ghost`,size:(0,a.unref)(t),icon:d,title:`Align left`,"aria-label":`Align left`,onClick:i[5]||=e=>(0,a.unref)(S).alignLeft()},null,8,[`size`]),(0,a.createVNode)(r.t,{variant:`ghost`,size:(0,a.unref)(t),icon:f,title:`Align horizontal center`,"aria-label":`Align horizontal center`,onClick:i[6]||=e=>(0,a.unref)(S).alignCenter()},null,8,[`size`]),(0,a.createVNode)(r.t,{variant:`ghost`,size:(0,a.unref)(t),icon:p,title:`Align right`,"aria-label":`Align right`,onClick:i[7]||=e=>(0,a.unref)(S).alignRight()},null,8,[`size`]),(0,a.createVNode)(r.t,{variant:`ghost`,size:(0,a.unref)(t),icon:m,title:`Align top`,"aria-label":`Align top`,onClick:i[8]||=e=>(0,a.unref)(S).alignTop()},null,8,[`size`]),(0,a.createVNode)(r.t,{variant:`ghost`,size:(0,a.unref)(t),icon:h,title:`Align vertical center`,"aria-label":`Align vertical center`,onClick:i[9]||=e=>(0,a.unref)(S).alignMiddle()},null,8,[`size`]),(0,a.createVNode)(r.t,{variant:`ghost`,size:(0,a.unref)(t),icon:g,title:`Align bottom`,"aria-label":`Align bottom`,onClick:i[10]||=e=>(0,a.unref)(S).alignBottom()},null,8,[`size`]),(0,a.createVNode)(r.t,{variant:`ghost`,size:(0,a.unref)(t),icon:_,title:`Distribute horizontally`,"aria-label":`Distribute horizontally`,onClick:i[11]||=e=>(0,a.unref)(S).distributeHorizontally()},null,8,[`size`]),(0,a.createVNode)(r.t,{variant:`ghost`,size:(0,a.unref)(t),icon:v,title:`Distribute vertically`,"aria-label":`Distribute vertically`,onClick:i[12]||=e=>(0,a.unref)(S).distributeVertically()},null,8,[`size`])])):(0,a.createCommentVNode)(``,!0)],2)):(0,a.createCommentVNode)(``,!0)}}),S=t.t(x,[[`__scopeId`,`data-v-5b86517c`]]);Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return S}});
|
|
@@ -2,7 +2,7 @@ import { t as e } from "./_plugin-vue_export-helper-O4QQSku4.js";
|
|
|
2
2
|
import { t } from "./Size.d-Bah6vMl3.js";
|
|
3
3
|
import { t as n } from "./Icon-rREAqsu0.js";
|
|
4
4
|
import { useRouterLink as r } from "./composables/useRouterLink.composable.mjs";
|
|
5
|
-
import { computed as i, createBlock as a, createCommentVNode as o, createElementBlock as s, defineComponent as c,
|
|
5
|
+
import { computed as i, createBlock as a, createCommentVNode as o, createElementBlock as s, defineComponent as c, mergeProps as l, openBlock as u, renderSlot as d, resolveDynamicComponent as f, useSlots as p, withCtx as m } from "vue";
|
|
6
6
|
//#region src/components/Button.d.ts
|
|
7
7
|
var h = /* @__PURE__ */ function(e) {
|
|
8
8
|
return e.Button = "button", e.Submit = "submit", e.Reset = "reset", e;
|
|
@@ -42,7 +42,11 @@ var h = /* @__PURE__ */ function(e) {
|
|
|
42
42
|
let t = e, c = p(), h = i(() => !c.default && !!(t.icon || t.loading)), v = r(), y = i(() => t.to != null && !!v.value), b = i(() => {
|
|
43
43
|
if (typeof t.to == "string") return t.to;
|
|
44
44
|
if (t.href) return t.href;
|
|
45
|
-
}), x = i(() => y.value ? v.value : b.value ? "a" : "button"), S = {
|
|
45
|
+
}), x = i(() => y.value ? v.value : b.value ? "a" : "button"), S = i(() => x.value === "a" ? {
|
|
46
|
+
href: b.value,
|
|
47
|
+
target: t.target,
|
|
48
|
+
rel: t.rel
|
|
49
|
+
} : {}), C = {
|
|
46
50
|
xxs: 10,
|
|
47
51
|
xs: 12,
|
|
48
52
|
sm: 12,
|
|
@@ -50,43 +54,38 @@ var h = /* @__PURE__ */ function(e) {
|
|
|
50
54
|
lg: 16,
|
|
51
55
|
xl: 16,
|
|
52
56
|
xxl: 20
|
|
53
|
-
},
|
|
54
|
-
return (t, r) => (u(), a(f(x.value), {
|
|
55
|
-
class:
|
|
57
|
+
}, w = i(() => C[t.size ?? "md"] ?? 14);
|
|
58
|
+
return (t, r) => (u(), a(f(x.value), l({
|
|
59
|
+
class: [
|
|
56
60
|
"nb-button",
|
|
57
61
|
`nb-button--${e.variant}`,
|
|
58
62
|
`nb-button--${e.size}`,
|
|
59
63
|
{ "nb-button--outlined": e.outlined },
|
|
60
64
|
{ "nb-button--loading": e.loading },
|
|
61
65
|
{ "nb-button--icon-only": h.value }
|
|
62
|
-
]
|
|
63
|
-
to: y.value ? e.to : void 0
|
|
64
|
-
|
|
65
|
-
target: x.value === "a" ? e.target : void 0,
|
|
66
|
-
rel: x.value === "a" ? e.rel : void 0,
|
|
66
|
+
],
|
|
67
|
+
to: y.value ? e.to : void 0
|
|
68
|
+
}, S.value, {
|
|
67
69
|
disabled: x.value === "button" ? e.disabled || e.loading : void 0,
|
|
68
70
|
"aria-disabled": x.value !== "button" && (e.disabled || e.loading) ? !0 : void 0,
|
|
69
71
|
type: x.value === "button" ? e.type : void 0,
|
|
70
72
|
onClick: r[0] ||= (n) => e.disabled || e.loading ? void 0 : t.$emit("click", n)
|
|
71
|
-
}, {
|
|
73
|
+
}), {
|
|
72
74
|
default: m(() => [d(t.$slots, "default", {}, void 0, !0), e.loading || e.icon ? (u(), s("div", g, [e.loading ? (u(), s("span", _)) : e.icon ? (u(), a(n, {
|
|
73
75
|
key: 1,
|
|
74
76
|
name: e.icon,
|
|
75
|
-
size:
|
|
77
|
+
size: w.value,
|
|
76
78
|
class: "nb-button__icon"
|
|
77
79
|
}, null, 8, ["name", "size"])) : o("", !0)])) : o("", !0)]),
|
|
78
80
|
_: 3
|
|
79
|
-
},
|
|
81
|
+
}, 16, [
|
|
80
82
|
"class",
|
|
81
83
|
"to",
|
|
82
|
-
"href",
|
|
83
|
-
"target",
|
|
84
|
-
"rel",
|
|
85
84
|
"disabled",
|
|
86
85
|
"aria-disabled",
|
|
87
86
|
"type"
|
|
88
87
|
]));
|
|
89
88
|
}
|
|
90
|
-
}), [["__scopeId", "data-v-
|
|
89
|
+
}), [["__scopeId", "data-v-fc827929"]]);
|
|
91
90
|
//#endregion
|
|
92
91
|
export { v as t };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
require(`./chunk-D-qHiVGv.cjs`);const e=require(`./_plugin-vue_export-helper-tagjRzOz.cjs`),t=require(`./Size.d-GBIblj2D.cjs`),n=require(`./Icon-C8R_r_In.cjs`),r=require(`./composables/useRouterLink.composable.cjs`);let i=require(`vue`);var a=function(e){return e.Button=`button`,e.Submit=`submit`,e.Reset=`reset`,e}(a||{}),o={key:0,class:`nb-button__decorations`},s={key:0,class:`nb-button__spinner`,"aria-hidden":`true`},c=(0,i.defineComponent)({__name:`Button`,props:{variant:{default:void 0},outlined:{type:Boolean,default:!1},size:{default:t.t.Medium},disabled:{type:Boolean,default:!1},loading:{type:Boolean,default:!1},icon:{default:void 0},type:{default:a.Button},href:{default:void 0},target:{default:void 0},rel:{default:void 0},to:{default:void 0}},emits:[`click`],setup(e){let t=e,a=(0,i.useSlots)(),c=(0,i.computed)(()=>!a.default&&!!(t.icon||t.loading)),l=r.useRouterLink(),u=(0,i.computed)(()=>t.to!=null&&!!l.value),d=(0,i.computed)(()=>{if(typeof t.to==`string`)return t.to;if(t.href)return t.href}),f=(0,i.computed)(()=>u.value?l.value:d.value?`a`:`button`),p=(0,i.computed)(()=>f.value===`a`?{href:d.value,target:t.target,rel:t.rel}:{}),m={xxs:10,xs:12,sm:12,md:14,lg:16,xl:16,xxl:20},h=(0,i.computed)(()=>m[t.size??`md`]??14);return(t,r)=>((0,i.openBlock)(),(0,i.createBlock)((0,i.resolveDynamicComponent)(f.value),(0,i.mergeProps)({class:[`nb-button`,`nb-button--${e.variant}`,`nb-button--${e.size}`,{"nb-button--outlined":e.outlined},{"nb-button--loading":e.loading},{"nb-button--icon-only":c.value}],to:u.value?e.to:void 0},p.value,{disabled:f.value===`button`?e.disabled||e.loading:void 0,"aria-disabled":f.value!==`button`&&(e.disabled||e.loading)?!0:void 0,type:f.value===`button`?e.type:void 0,onClick:r[0]||=n=>e.disabled||e.loading?void 0:t.$emit(`click`,n)}),{default:(0,i.withCtx)(()=>[(0,i.renderSlot)(t.$slots,`default`,{},void 0,!0),e.loading||e.icon?((0,i.openBlock)(),(0,i.createElementBlock)(`div`,o,[e.loading?((0,i.openBlock)(),(0,i.createElementBlock)(`span`,s)):e.icon?((0,i.openBlock)(),(0,i.createBlock)(n.t,{key:1,name:e.icon,size:h.value,class:`nb-button__icon`},null,8,[`name`,`size`])):(0,i.createCommentVNode)(``,!0)])):(0,i.createCommentVNode)(``,!0)]),_:3},16,[`class`,`to`,`disabled`,`aria-disabled`,`type`]))}}),l=e.t(c,[[`__scopeId`,`data-v-fc827929`]]);Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return l}});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
require(`./chunk-D-qHiVGv.cjs`);const e=require(`./composables/useReducedMotion.composable.cjs`),t=require(`./_plugin-vue_export-helper-tagjRzOz.cjs`),n=require(`./Icon-C8R_r_In.cjs`),r=require(`./Button-
|
|
1
|
+
require(`./chunk-D-qHiVGv.cjs`);const e=require(`./composables/useReducedMotion.composable.cjs`),t=require(`./_plugin-vue_export-helper-tagjRzOz.cjs`),n=require(`./Icon-C8R_r_In.cjs`),r=require(`./Button-Dqtcr4i0.cjs`),i=require(`./Message-Daj6hLC4.cjs`),a=require(`./Modal-8lgeNWj8.cjs`),ee=require(`./TextInput-CGD_wFwo.cjs`);let o=require(`vue`),s=require(`@nubisco/ui/icons/warning`),c=require(`@nubisco/ui/icons/check`);var l=200,u=[`[data-nb-confirm-floating]`,`.nb-select__dropdown`,`.nb-menu`,`.nb-date-picker__calendar`,`.nb-user-menu__panel`,`.nb-sidebar-menu-item__flyout`],d=new Set;function f(e){let t=e.trim();return t?(d.add(t),()=>{d.delete(t)}):()=>{}}function p(e=[]){return[...u,...d,...e].map(e=>e.trim()).filter(Boolean).join(`,`)}function m(e,t){if(!e)return;let n=`${t?0:200}ms`;e.style.transitionDuration=n;let r=e.parentElement;r instanceof HTMLElement&&(r.style.transitionDuration=n)}var h={key:0,class:`nb-confirm__message`},te={key:0,class:`nb-confirm__subject-kind`},ne={class:`nb-confirm__subject-name`},g={key:1,class:`nb-confirm__gate`},_={class:`nb-confirm__live`},re={key:0,class:`nb-confirm__status`,role:`status`},ie={key:1,class:`nb-confirm__status nb-confirm__status--success`,role:`status`},v=(0,o.defineComponent)({__name:`Confirm`,props:{open:{type:Boolean,default:!1},title:{},message:{default:void 0},subject:{default:void 0},subjectLabel:{default:void 0},confirmLabel:{default:`Confirm`},cancelLabel:{default:`Cancel`},tone:{default:`danger`},typeToConfirm:{default:void 0},typeToConfirmLabel:{default:void 0},typeToConfirmHelper:{default:void 0},busy:{type:Boolean,default:!1},busyLabel:{default:`Working...`},succeeded:{type:Boolean,default:!1},successLabel:{default:void 0},error:{default:void 0},size:{default:`sm`},floatingSelectors:{default:()=>[]},contentClass:{default:void 0}},emits:[`confirm`,`cancel`],setup(t,{expose:l,emit:u}){let d=t,f=u,v=(0,o.useId)(),y=`nb-confirm-title-${v}`,b=`nb-confirm-body-${v}`,x=(0,o.useSlots)(),S=(0,o.ref)(null),C=(0,o.ref)(null),w=(0,o.ref)(null),T=(0,o.ref)(``),E=e.useReducedMotion(),D=(0,o.computed)(()=>d.busy||d.succeeded);function O(){return!!d.message||!!d.subject||!!x.default}let k=(0,o.computed)(()=>d.tone===`danger`?`danger`:`primary`),A=(0,o.computed)(()=>d.typeToConfirmLabel??`Type ${d.typeToConfirm} to confirm`),j=(0,o.computed)(()=>!d.typeToConfirm||T.value.trim()===d.typeToConfirm),M=(0,o.computed)(()=>j.value&&!D.value);function N(){M.value&&f(`confirm`)}function P(){let e=w.value?.$el;return e instanceof HTMLElement?e:null}function F(){return S.value?.closest(`[role="dialog"],[role="alertdialog"]`)??null}function ae(){return typeof document>`u`?[]:Array.from(document.querySelectorAll(`[aria-modal="true"]`))}function I(){let e=F();if(!e)return!1;let t=ae();return t.length===0||t[t.length-1]===e}let L=[`a[href]:not([tabindex="-1"])`,`area[href]:not([tabindex="-1"])`,`button:not([disabled]):not([tabindex="-1"])`,`input:not([disabled]):not([type="hidden"]):not([tabindex="-1"])`,`select:not([disabled]):not([tabindex="-1"])`,`textarea:not([disabled]):not([tabindex="-1"])`,`summary:not([tabindex="-1"])`,`audio[controls]:not([tabindex="-1"])`,`video[controls]:not([tabindex="-1"])`,`iframe:not([tabindex="-1"])`,`[contenteditable]:not([contenteditable="false"]):not([tabindex="-1"])`,`[tabindex]:not([tabindex="-1"])`].map(e=>`${e}:not([hidden]):not([aria-hidden="true"])`).join(`,`);function R(){return p(d.floatingSelectors)}function z(e){return e instanceof Element?!!e.closest(R()):!1}function B(e){let t=F();return!!t&&!!e&&t.contains(e)}function V(){let e=F();return e?Array.from(e.querySelectorAll(L)).filter(e=>e.getAttribute(`aria-disabled`)!==`true`):[]}function H(){let e=F();return e?(e.focus(),!0):!1}function U(){let e=V()[0];e?e.focus():H()}let W=null;function G(){let e=W;W=null,e?.isConnected&&e.focus()}function K(){m(F(),E.value)}(0,o.watch)(E,()=>{d.open&&K()}),(0,o.watch)(()=>[d.busy,d.error],async(e,t)=>{if(!d.open)return;let[n,r]=e,i=t?.[0]??!1;if(await(0,o.nextTick)(),n){V().length===0&&H();return}if(i&&r){let e=C.value;e?e.focus():U();return}let a=document.activeElement;!B(a)&&!z(a)&&U()}),(0,o.watch)(()=>d.open,async e=>{e?(W=document.activeElement instanceof HTMLElement?document.activeElement:null,T.value=``,await(0,o.nextTick)(),K(),P()?P()?.focus():H()):G()},{immediate:!0});function q(){D.value||f(`cancel`)}let J=!1,Y=!1;function X(e){let t=e.target;J=B(t)||z(t)}function Z(e){Y=B(e.target)}function oe(){let e=J&&!Y;J=!1,!e&&q()}function Q(e){if(!d.open||z(document.activeElement))return;if(e.key===`Escape`){if(!I())return;e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation(),q();return}if(e.key!==`Tab`||!I())return;let t=V();if(t.length===0){e.preventDefault(),B(document.activeElement)||H();return}let n=t[0],r=t[t.length-1],i=document.activeElement;e.shiftKey&&(i===n||!B(i))?(e.preventDefault(),r.focus()):!e.shiftKey&&i===r?(e.preventDefault(),n.focus()):B(i)||(e.preventDefault(),n.focus())}function $(e){if(!d.open)return;let t=e.relatedTarget;if(t instanceof Element){if(B(t)||z(t))return}else if(t!==null)return;requestAnimationFrame(()=>{if(!d.open)return;let e=document.activeElement;B(e)||z(e)||e&&e!==document.body&&!e.isConnected||I()&&U()})}return typeof document<`u`&&(document.addEventListener(`keydown`,Q,!0),document.addEventListener(`focusout`,$,!0),document.addEventListener(`mousedown`,X,!0),document.addEventListener(`touchstart`,X,!0),document.addEventListener(`click`,Z,!0)),(0,o.onMounted)(()=>{d.open&&(K(),P()?P()?.focus():H())}),(0,o.onUnmounted)(()=>{typeof document<`u`&&(document.removeEventListener(`keydown`,Q,!0),document.removeEventListener(`focusout`,$,!0),document.removeEventListener(`mousedown`,X,!0),document.removeEventListener(`touchstart`,X,!0),document.removeEventListener(`click`,Z,!0)),G()}),l({focusCancel:()=>P()?.focus(),restoreFocus:G,isTopmost:I}),(e,l)=>((0,o.openBlock)(),(0,o.createBlock)(a.t,{open:t.open,size:t.size,role:t.tone===`danger`?`alertdialog`:`dialog`,"labelled-by":y,"described-by":O()?b:void 0,busy:t.busy,"close-on-overlay":!D.value,"close-disabled":D.value,"close-on-escape":!1,onClose:oe},{header:(0,o.withCtx)(()=>[(0,o.createElementVNode)(`span`,{id:y,class:(0,o.normalizeClass)([`nb-confirm__heading`,`nb-confirm__heading--${t.tone}`])},[t.tone===`danger`?((0,o.openBlock)(),(0,o.createBlock)(n.t,{key:0,name:(0,o.unref)(s.regular),size:16,"aria-hidden":`true`},null,8,[`name`])):(0,o.createCommentVNode)(``,!0),(0,o.createElementVNode)(`span`,null,(0,o.toDisplayString)(t.title),1)],2)]),footer:(0,o.withCtx)(()=>[(0,o.createVNode)(r.t,{ref_key:`cancelRef`,ref:w,class:`nb-confirm__action nb-confirm__action--cancel`,variant:`ghost`,size:`lg`,disabled:D.value,"data-nb-confirm":`cancel`,onClick:q},{default:(0,o.withCtx)(()=>[(0,o.createTextVNode)((0,o.toDisplayString)(t.cancelLabel),1)]),_:1},8,[`disabled`]),(0,o.createVNode)(r.t,{class:`nb-confirm__action nb-confirm__action--confirm`,variant:k.value,size:`lg`,disabled:!M.value,loading:t.busy,"data-nb-confirm":`confirm`,onClick:N},{default:(0,o.withCtx)(()=>[(0,o.createTextVNode)((0,o.toDisplayString)(t.confirmLabel),1)]),_:1},8,[`variant`,`disabled`,`loading`])]),default:(0,o.withCtx)(()=>[(0,o.createElementVNode)(`div`,{ref_key:`rootRef`,ref:S,class:(0,o.normalizeClass)([`nb-confirm`,t.contentClass])},[O()?((0,o.openBlock)(),(0,o.createElementBlock)(`div`,{key:0,id:b,class:`nb-confirm__body`},[(0,o.renderSlot)(e.$slots,`default`,{},()=>[t.message?((0,o.openBlock)(),(0,o.createElementBlock)(`p`,h,(0,o.toDisplayString)(t.message),1)):(0,o.createCommentVNode)(``,!0)],!0),t.subject?((0,o.openBlock)(),(0,o.createElementBlock)(`p`,{key:0,class:(0,o.normalizeClass)([`nb-confirm__subject`,`nb-confirm__subject--${t.tone}`])},[t.subjectLabel?((0,o.openBlock)(),(0,o.createElementBlock)(`span`,te,(0,o.toDisplayString)(t.subjectLabel),1)):(0,o.createCommentVNode)(``,!0),(0,o.createElementVNode)(`span`,ne,(0,o.toDisplayString)(t.subject),1)],2)):(0,o.createCommentVNode)(``,!0)])):(0,o.createCommentVNode)(``,!0),t.typeToConfirm?((0,o.openBlock)(),(0,o.createElementBlock)(`div`,g,[(0,o.createVNode)(ee.t,{modelValue:T.value,"onUpdate:modelValue":l[0]||=e=>T.value=e,class:`nb-confirm__gate-field`,label:A.value,helper:t.typeToConfirmHelper,disabled:D.value,autocomplete:`off`,spellcheck:`false`,"data-nb-confirm":`gate`,onKeydown:l[1]||=(0,o.withKeys)((0,o.withModifiers)(()=>{},[`prevent`]),[`enter`])},null,8,[`modelValue`,`label`,`helper`,`disabled`])])):(0,o.createCommentVNode)(``,!0),(0,o.createElementVNode)(`div`,_,[t.busy?((0,o.openBlock)(),(0,o.createElementBlock)(`p`,re,(0,o.toDisplayString)(t.busyLabel),1)):(0,o.createCommentVNode)(``,!0),t.succeeded&&t.successLabel?((0,o.openBlock)(),(0,o.createElementBlock)(`p`,ie,[(0,o.createVNode)(n.t,{name:(0,o.unref)(c.regular),size:14,"aria-hidden":`true`},null,8,[`name`]),(0,o.createElementVNode)(`span`,null,(0,o.toDisplayString)(t.successLabel),1)])):(0,o.createCommentVNode)(``,!0),t.error?((0,o.openBlock)(),(0,o.createElementBlock)(`div`,{key:2,ref_key:`errorRef`,ref:C,class:`nb-confirm__error`,tabindex:`-1`},[(0,o.createVNode)(i.t,{variant:`error`},{default:(0,o.withCtx)(()=>[(0,o.createTextVNode)((0,o.toDisplayString)(t.error),1)]),_:1})],512)):(0,o.createCommentVNode)(``,!0)])],2)]),_:3},8,[`open`,`size`,`role`,`described-by`,`busy`,`close-on-overlay`,`close-disabled`]))}}),y=t.t(v,[[`__scopeId`,`data-v-828ae71d`]]);Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return l}}),Object.defineProperty(exports,`r`,{enumerable:!0,get:function(){return f}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return y}});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useReducedMotion as e } from "./composables/useReducedMotion.composable.mjs";
|
|
2
2
|
import { t } from "./_plugin-vue_export-helper-O4QQSku4.js";
|
|
3
3
|
import { t as n } from "./Icon-rREAqsu0.js";
|
|
4
|
-
import { t as r } from "./Button-
|
|
4
|
+
import { t as r } from "./Button-Cegx6vaT.js";
|
|
5
5
|
import { t as i } from "./Message-BuG5t7bu.js";
|
|
6
6
|
import { t as a } from "./Modal-iN94HtKE.js";
|
|
7
7
|
import { t as ee } from "./TextInput-CxC2HVj6.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require(`./chunk-D-qHiVGv.cjs`),t=require(`./_plugin-vue_export-helper-tagjRzOz.cjs`),n=require(`./Size.d-GBIblj2D.cjs`),r=require(`./Icon-C8R_r_In.cjs`),i=require(`./composables/useSurfaceLayer.composable.cjs`),a=require(`./Button-6GNkKckU.cjs`),o=require(`./Grid-DVT8lBHr.cjs`),s=require(`./Checkbox-D9qW3gph.cjs`);let c=require(`vue`),l=require(`@nubisco/ui/icons/arrows-down-up`);l=e.n(l);let u=require(`@nubisco/ui/icons/arrow-up`);u=e.n(u);let d=require(`@nubisco/ui/icons/arrow-down`);d=e.n(d);var f={key:0,class:`nb-data-table__toolbar`},p=[`inert`,`aria-hidden`],m={key:0},h={key:0,class:`nb-data-table__title`},g={key:1,class:`nb-data-table__description`},_=[`inert`,`aria-hidden`],v={key:1,class:`nb-data-table__batch`,role:`region`,"aria-label":`Table batch actions`},y={class:`nb-data-table__batch-count`},b={class:`nb-data-table__batch-actions`},x={class:`nb-data-table__scroll`},ee=[`aria-label`,`aria-busy`],te={key:0,class:`nb-data-table__col-select`},ne={key:1,class:`nb-data-table__col-actions`},re={class:`nb-data-table__head`},ie={key:0,scope:`col`,class:`nb-data-table__th nb-data-table__select-cell`},ae=[`aria-sort`],oe=[`onClick`],se={class:`nb-data-table__th-label`},ce={key:1,class:`nb-data-table__th-label`},le={key:1,scope:`col`,class:`nb-data-table__th nb-data-table__actions-cell`},ue={class:`nb-data-table__body`},de={key:0,class:`nb-data-table__td`},fe={key:1,class:`nb-data-table__td`},pe={key:1,class:`nb-data-table__state-row`},S=[`colspan`],C={key:2,class:`nb-data-table__state-row`},w=[`colspan`],T=[`aria-selected`,`onClick`],E=[`checked`,`aria-label`,`onChange`],D={key:1,class:`nb-data-table__footer`},O=(0,c.defineComponent)({__name:`DataTable`,props:{columns:{},rows:{},rowKey:{},size:{default:n.r.Medium},sortState:{default:null},selectable:{default:`none`},selected:{default:()=>[]},loading:{type:Boolean,default:!1},skeletonRows:{default:5},error:{default:void 0},emptyMessage:{default:void 0},stickyHeader:{type:Boolean,default:!0},zebra:{type:Boolean,default:!1},fill:{type:Boolean,default:!1},title:{default:void 0},description:{default:void 0},ariaLabel:{default:void 0}},emits:[`sort`,`update:selected`,`row-click`],setup(e,{emit:t}){let n=e,{layerProps:O}=i.useSurfaceLayer(),k=t,A=(0,c.useSlots)(),j=`nb-data-table-select-${(0,c.useId)()}`,M=(0,c.computed)(()=>n.size),N=(0,c.computed)(()=>n.columns.filter(e=>!e.hidden)),P=(0,c.computed)(()=>n.selectable!==`none`),F=(0,c.computed)(()=>!!A[`row-actions`]),I=(0,c.computed)(()=>N.value.length+(P.value?1:0)+(F.value?1:0));function L(e){if(e.width!=null)return{width:typeof e.width==`number`?`${e.width}px`:e.width}}function R(e,t){return t[e.key]}function z(e){return e==null?``:String(e)}let B=e=>e.column.render?.(e.row,R(e.column,e.row),e.rowIndex)??null;B.props=[`column`,`row`,`rowIndex`];function V(e){let t=n.rowKey;return typeof t==`function`?t(e):e[t]}let H=(0,c.computed)(()=>new Set(n.selected)),me=(0,c.computed)(()=>n.selected),U=(0,c.computed)(()=>n.selected.length);function W(e){return H.value.has(V(e))}let G=(0,c.computed)(()=>n.rows.map(e=>V(e))),K=(0,c.computed)(()=>G.value.length>0&&G.value.every(e=>H.value.has(e))),he=(0,c.computed)(()=>!K.value&&G.value.some(e=>H.value.has(e))),q=(0,c.ref)(null),J=!1;function Y(e){J=e.shiftKey}(0,c.watch)(G,()=>{q.value=null});function ge(e,t){let r=V(e),i=new Set(n.selected),a=!i.has(r),o=q.value,s=e=>{a?i.add(e):i.delete(e)};if(J&&o!==null&&o!==t){let e=Math.min(o,t),r=Math.max(o,t);for(let t=e;t<=r;t++){let e=n.rows[t];e&&s(V(e))}}else s(r),q.value=t;J=!1,k(`update:selected`,[...i])}function _e(e){k(`update:selected`,[V(e)])}function ve(){let e=new Set(n.selected);K.value?G.value.forEach(t=>e.delete(t)):G.value.forEach(t=>e.add(t)),k(`update:selected`,[...e])}function X(){k(`update:selected`,[])}let Z=(0,c.computed)(()=>n.selectable!==`none`&&!!A[`batch-actions`]),Q=(0,c.computed)(()=>Z.value&&U.value>0),ye=(0,c.computed)(()=>!!n.title||!!n.description||!!A.toolbar||!!A.search||!!A[`toolbar-actions`]),be=(0,c.computed)(()=>ye.value||Z.value);function $(e){return!!n.sortState&&n.sortState.key===e.key&&n.sortState.direction!==`none`}function xe(e){return $(e)?n.sortState.direction===`asc`?`ascending`:`descending`:`none`}function Se(e){return $(e)?n.sortState.direction===`asc`?u:d:l}function Ce(e){return e===`asc`?`desc`:e===`desc`?`none`:`asc`}function we(e){let t=n.sortState&&n.sortState.key===e.key?n.sortState.direction:`none`;k(`sort`,{key:e.key,direction:Ce(t)})}let Te=(0,c.getCurrentInstance)(),Ee=(0,c.computed)(()=>!!Te?.vnode.props?.onRowClick);function De(e,t){k(`row-click`,e,t)}return(t,n)=>((0,c.openBlock)(),(0,c.createElementBlock)(`div`,(0,c.mergeProps)({class:[`nb-data-table`,`nb-data-table--${e.size}`,{"nb-data-table--zebra":e.zebra},{"nb-data-table--sticky":e.stickyHeader},{"nb-data-table--fill":e.fill}]},(0,c.unref)(O)),[be.value?((0,c.openBlock)(),(0,c.createElementBlock)(`div`,f,[(0,c.createElementVNode)(`div`,{class:`nb-data-table__toolbar-heading`,inert:Q.value||void 0,"aria-hidden":Q.value||void 0},[(0,c.renderSlot)(t.$slots,`toolbar`,{selectedCount:U.value},()=>[e.title||e.description?((0,c.openBlock)(),(0,c.createElementBlock)(`div`,m,[e.title?((0,c.openBlock)(),(0,c.createElementBlock)(`h2`,h,(0,c.toDisplayString)(e.title),1)):(0,c.createCommentVNode)(``,!0),e.description?((0,c.openBlock)(),(0,c.createElementBlock)(`p`,g,(0,c.toDisplayString)(e.description),1)):(0,c.createCommentVNode)(``,!0)])):(0,c.createCommentVNode)(``,!0)],!0)],8,p),t.$slots.search||t.$slots[`toolbar-actions`]?((0,c.openBlock)(),(0,c.createElementBlock)(`div`,{key:0,class:`nb-data-table__toolbar-tools`,inert:Q.value||void 0,"aria-hidden":Q.value||void 0},[(0,c.renderSlot)(t.$slots,`search`,{},void 0,!0),(0,c.renderSlot)(t.$slots,`toolbar-actions`,{},void 0,!0)],8,_)):(0,c.createCommentVNode)(``,!0),Q.value?((0,c.openBlock)(),(0,c.createElementBlock)(`div`,v,[(0,c.createElementVNode)(`span`,y,(0,c.toDisplayString)(U.value)+` selected `,1),(0,c.createElementVNode)(`div`,b,[(0,c.renderSlot)(t.$slots,`batch-actions`,{selectedKeys:me.value,clear:X},void 0,!0)]),(0,c.createVNode)(a.t,{class:`nb-data-table__batch-cancel`,variant:`ghost`,size:M.value,onClick:X},{default:(0,c.withCtx)(()=>[...n[2]||=[(0,c.createTextVNode)(` Cancel `,-1)]]),_:1},8,[`size`])])):(0,c.createCommentVNode)(``,!0)])):(0,c.createCommentVNode)(``,!0),(0,c.createElementVNode)(`div`,x,[(0,c.createElementVNode)(`table`,{class:`nb-data-table__table`,"aria-label":e.ariaLabel||e.title||void 0,"aria-busy":e.loading||void 0},[(0,c.createElementVNode)(`colgroup`,null,[P.value?((0,c.openBlock)(),(0,c.createElementBlock)(`col`,te)):(0,c.createCommentVNode)(``,!0),((0,c.openBlock)(!0),(0,c.createElementBlock)(c.Fragment,null,(0,c.renderList)(N.value,e=>((0,c.openBlock)(),(0,c.createElementBlock)(`col`,{key:`col-${e.key}`,style:(0,c.normalizeStyle)(L(e))},null,4))),128)),F.value?((0,c.openBlock)(),(0,c.createElementBlock)(`col`,ne)):(0,c.createCommentVNode)(``,!0)]),(0,c.createElementVNode)(`thead`,re,[(0,c.createElementVNode)(`tr`,null,[P.value?((0,c.openBlock)(),(0,c.createElementBlock)(`th`,ie,[e.selectable===`multiple`?((0,c.openBlock)(),(0,c.createBlock)(s.t,{key:0,"model-value":K.value,indeterminate:he.value,"aria-label":`Select all rows`,"onUpdate:modelValue":ve},null,8,[`model-value`,`indeterminate`])):(0,c.createCommentVNode)(``,!0)])):(0,c.createCommentVNode)(``,!0),((0,c.openBlock)(!0),(0,c.createElementBlock)(c.Fragment,null,(0,c.renderList)(N.value,e=>((0,c.openBlock)(),(0,c.createElementBlock)(`th`,{key:`th-${e.key}`,scope:`col`,class:(0,c.normalizeClass)([`nb-data-table__th`,`nb-data-table__th--${e.align||`left`}`,{"nb-data-table__th--sortable":e.sortable},{"nb-data-table__th--sorted":$(e)}]),"aria-sort":e.sortable?xe(e):void 0},[e.sortable?((0,c.openBlock)(),(0,c.createElementBlock)(`button`,{key:0,type:`button`,class:`nb-data-table__sort`,onClick:t=>we(e)},[(0,c.createElementVNode)(`span`,se,[(0,c.renderSlot)(t.$slots,`header-${e.key}`,{column:e},()=>[(0,c.createTextVNode)((0,c.toDisplayString)(e.header),1)],!0)]),(0,c.createVNode)(r.t,{name:Se(e),class:`nb-data-table__sort-icon`,"aria-hidden":`true`},null,8,[`name`])],8,oe)):((0,c.openBlock)(),(0,c.createElementBlock)(`span`,ce,[(0,c.renderSlot)(t.$slots,`header-${e.key}`,{column:e},()=>[(0,c.createTextVNode)((0,c.toDisplayString)(e.header),1)],!0)]))],10,ae))),128)),F.value?((0,c.openBlock)(),(0,c.createElementBlock)(`th`,le,[...n[3]||=[(0,c.createElementVNode)(`span`,{class:`nb-sr-only`},`Row actions`,-1)]])):(0,c.createCommentVNode)(``,!0)])]),(0,c.createElementVNode)(`tbody`,ue,[e.loading?((0,c.openBlock)(!0),(0,c.createElementBlock)(c.Fragment,{key:0},(0,c.renderList)(e.skeletonRows,e=>((0,c.openBlock)(),(0,c.createElementBlock)(`tr`,{key:`skeleton-${e}`,class:`nb-data-table__row nb-data-table__row--skeleton`},[P.value?((0,c.openBlock)(),(0,c.createElementBlock)(`td`,de,[...n[4]||=[(0,c.createElementVNode)(`span`,{class:`nb-data-table__skeleton nb-data-table__skeleton--box`},null,-1)]])):(0,c.createCommentVNode)(``,!0),((0,c.openBlock)(!0),(0,c.createElementBlock)(c.Fragment,null,(0,c.renderList)(N.value,t=>((0,c.openBlock)(),(0,c.createElementBlock)(`td`,{key:`sk-${e}-${t.key}`,class:`nb-data-table__td`},[...n[5]||=[(0,c.createElementVNode)(`span`,{class:`nb-data-table__skeleton`},null,-1)]]))),128)),F.value?((0,c.openBlock)(),(0,c.createElementBlock)(`td`,fe,[...n[6]||=[(0,c.createElementVNode)(`span`,{class:`nb-data-table__skeleton nb-data-table__skeleton--box`},null,-1)]])):(0,c.createCommentVNode)(``,!0)]))),128)):e.error?((0,c.openBlock)(),(0,c.createElementBlock)(`tr`,pe,[(0,c.createElementVNode)(`td`,{colspan:I.value,class:`nb-data-table__state nb-data-table__state--error`},[(0,c.renderSlot)(t.$slots,`error`,{error:e.error},()=>[(0,c.createVNode)(o.t,{is:`span`,align:`center`,justify:`center`,gap:`xs`,class:`nb-data-table__state-inner`},{default:(0,c.withCtx)(()=>[(0,c.createVNode)(r.t,{name:`warning-circle-fill`,"aria-hidden":`true`}),(0,c.createElementVNode)(`span`,null,(0,c.toDisplayString)(e.error),1)]),_:1})],!0)],8,S)])):e.rows.length?((0,c.openBlock)(!0),(0,c.createElementBlock)(c.Fragment,{key:3},(0,c.renderList)(e.rows,(r,i)=>((0,c.openBlock)(),(0,c.createElementBlock)(`tr`,{key:V(r),class:(0,c.normalizeClass)([`nb-data-table__row`,{"nb-data-table__row--selected":W(r)},{"nb-data-table__row--clickable":Ee.value}]),"aria-selected":e.selectable===`none`?void 0:W(r),onClick:e=>De(r,i)},[P.value?((0,c.openBlock)(),(0,c.createElementBlock)(`td`,{key:0,class:`nb-data-table__td nb-data-table__select-cell`,onClick:n[0]||=(0,c.withModifiers)(()=>{},[`stop`]),onMousedown:Y,onKeydown:Y},[e.selectable===`multiple`?((0,c.openBlock)(),(0,c.createBlock)(s.t,{key:0,"model-value":W(r),"aria-label":`Select row ${i+1}`,"onUpdate:modelValue":e=>ge(r,i)},null,8,[`model-value`,`aria-label`,`onUpdate:modelValue`])):((0,c.openBlock)(),(0,c.createElementBlock)(`input`,{key:1,type:`radio`,class:`nb-data-table__radio`,name:j,checked:W(r),"aria-label":`Select row ${i+1}`,onChange:e=>_e(r)},null,40,E))],32)):(0,c.createCommentVNode)(``,!0),((0,c.openBlock)(!0),(0,c.createElementBlock)(c.Fragment,null,(0,c.renderList)(N.value,e=>((0,c.openBlock)(),(0,c.createElementBlock)(`td`,{key:`td-${V(r)}-${e.key}`,class:(0,c.normalizeClass)([`nb-data-table__td`,`nb-data-table__td--${e.align||`left`}`,e.cellClass])},[(0,c.renderSlot)(t.$slots,`cell-${e.key}`,{row:r,value:R(e,r),column:e,rowIndex:i},()=>[e.render?((0,c.openBlock)(),(0,c.createBlock)(B,{key:0,column:e,row:r,"row-index":i},null,8,[`column`,`row`,`row-index`])):((0,c.openBlock)(),(0,c.createElementBlock)(c.Fragment,{key:1},[(0,c.createTextVNode)((0,c.toDisplayString)(z(R(e,r))),1)],64))],!0)],2))),128)),F.value?((0,c.openBlock)(),(0,c.createElementBlock)(`td`,{key:1,class:`nb-data-table__td nb-data-table__actions-cell`,onClick:n[1]||=(0,c.withModifiers)(()=>{},[`stop`])},[(0,c.renderSlot)(t.$slots,`row-actions`,{row:r,rowIndex:i},void 0,!0)])):(0,c.createCommentVNode)(``,!0)],10,T))),128)):((0,c.openBlock)(),(0,c.createElementBlock)(`tr`,C,[(0,c.createElementVNode)(`td`,{colspan:I.value,class:`nb-data-table__state nb-data-table__state--empty`},[(0,c.renderSlot)(t.$slots,`empty`,{},()=>[(0,c.createElementVNode)(`span`,null,(0,c.toDisplayString)(e.emptyMessage||`No data to display`),1)],!0)],8,w)]))])],8,ee)]),t.$slots.footer?((0,c.openBlock)(),(0,c.createElementBlock)(`div`,D,[(0,c.renderSlot)(t.$slots,`footer`,{},void 0,!0)])):(0,c.createCommentVNode)(``,!0)],16))}}),k=t.t(O,[[`__scopeId`,`data-v-c26b7d0f`]]);Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return k}});
|
|
1
|
+
const e=require(`./chunk-D-qHiVGv.cjs`),t=require(`./_plugin-vue_export-helper-tagjRzOz.cjs`),n=require(`./Size.d-GBIblj2D.cjs`),r=require(`./Icon-C8R_r_In.cjs`),i=require(`./composables/useSurfaceLayer.composable.cjs`),a=require(`./Button-Dqtcr4i0.cjs`),o=require(`./Grid-DVT8lBHr.cjs`),s=require(`./Checkbox-D9qW3gph.cjs`);let c=require(`vue`),l=require(`@nubisco/ui/icons/arrows-down-up`);l=e.n(l);let u=require(`@nubisco/ui/icons/arrow-up`);u=e.n(u);let d=require(`@nubisco/ui/icons/arrow-down`);d=e.n(d);var f={key:0,class:`nb-data-table__toolbar`},p=[`inert`,`aria-hidden`],m={key:0},h={key:0,class:`nb-data-table__title`},g={key:1,class:`nb-data-table__description`},_=[`inert`,`aria-hidden`],v={key:1,class:`nb-data-table__batch`,role:`region`,"aria-label":`Table batch actions`},y={class:`nb-data-table__batch-count`},b={class:`nb-data-table__batch-actions`},x={class:`nb-data-table__scroll`},ee=[`aria-label`,`aria-busy`],te={key:0,class:`nb-data-table__col-select`},ne={key:1,class:`nb-data-table__col-actions`},re={class:`nb-data-table__head`},ie={key:0,scope:`col`,class:`nb-data-table__th nb-data-table__select-cell`},ae=[`aria-sort`],oe=[`onClick`],se={class:`nb-data-table__th-label`},ce={key:1,class:`nb-data-table__th-label`},le={key:1,scope:`col`,class:`nb-data-table__th nb-data-table__actions-cell`},ue={class:`nb-data-table__body`},de={key:0,class:`nb-data-table__td`},fe={key:1,class:`nb-data-table__td`},pe={key:1,class:`nb-data-table__state-row`},S=[`colspan`],C={key:2,class:`nb-data-table__state-row`},w=[`colspan`],T=[`aria-selected`,`onClick`],E=[`checked`,`aria-label`,`onChange`],D={key:1,class:`nb-data-table__footer`},O=(0,c.defineComponent)({__name:`DataTable`,props:{columns:{},rows:{},rowKey:{},size:{default:n.r.Medium},sortState:{default:null},selectable:{default:`none`},selected:{default:()=>[]},loading:{type:Boolean,default:!1},skeletonRows:{default:5},error:{default:void 0},emptyMessage:{default:void 0},stickyHeader:{type:Boolean,default:!0},zebra:{type:Boolean,default:!1},fill:{type:Boolean,default:!1},title:{default:void 0},description:{default:void 0},ariaLabel:{default:void 0}},emits:[`sort`,`update:selected`,`row-click`],setup(e,{emit:t}){let n=e,{layerProps:O}=i.useSurfaceLayer(),k=t,A=(0,c.useSlots)(),j=`nb-data-table-select-${(0,c.useId)()}`,M=(0,c.computed)(()=>n.size),N=(0,c.computed)(()=>n.columns.filter(e=>!e.hidden)),P=(0,c.computed)(()=>n.selectable!==`none`),F=(0,c.computed)(()=>!!A[`row-actions`]),I=(0,c.computed)(()=>N.value.length+(P.value?1:0)+(F.value?1:0));function L(e){if(e.width!=null)return{width:typeof e.width==`number`?`${e.width}px`:e.width}}function R(e,t){return t[e.key]}function z(e){return e==null?``:String(e)}let B=e=>e.column.render?.(e.row,R(e.column,e.row),e.rowIndex)??null;B.props=[`column`,`row`,`rowIndex`];function V(e){let t=n.rowKey;return typeof t==`function`?t(e):e[t]}let H=(0,c.computed)(()=>new Set(n.selected)),me=(0,c.computed)(()=>n.selected),U=(0,c.computed)(()=>n.selected.length);function W(e){return H.value.has(V(e))}let G=(0,c.computed)(()=>n.rows.map(e=>V(e))),K=(0,c.computed)(()=>G.value.length>0&&G.value.every(e=>H.value.has(e))),he=(0,c.computed)(()=>!K.value&&G.value.some(e=>H.value.has(e))),q=(0,c.ref)(null),J=!1;function Y(e){J=e.shiftKey}(0,c.watch)(G,()=>{q.value=null});function ge(e,t){let r=V(e),i=new Set(n.selected),a=!i.has(r),o=q.value,s=e=>{a?i.add(e):i.delete(e)};if(J&&o!==null&&o!==t){let e=Math.min(o,t),r=Math.max(o,t);for(let t=e;t<=r;t++){let e=n.rows[t];e&&s(V(e))}}else s(r),q.value=t;J=!1,k(`update:selected`,[...i])}function _e(e){k(`update:selected`,[V(e)])}function ve(){let e=new Set(n.selected);K.value?G.value.forEach(t=>e.delete(t)):G.value.forEach(t=>e.add(t)),k(`update:selected`,[...e])}function X(){k(`update:selected`,[])}let Z=(0,c.computed)(()=>n.selectable!==`none`&&!!A[`batch-actions`]),Q=(0,c.computed)(()=>Z.value&&U.value>0),ye=(0,c.computed)(()=>!!n.title||!!n.description||!!A.toolbar||!!A.search||!!A[`toolbar-actions`]),be=(0,c.computed)(()=>ye.value||Z.value);function $(e){return!!n.sortState&&n.sortState.key===e.key&&n.sortState.direction!==`none`}function xe(e){return $(e)?n.sortState.direction===`asc`?`ascending`:`descending`:`none`}function Se(e){return $(e)?n.sortState.direction===`asc`?u:d:l}function Ce(e){return e===`asc`?`desc`:e===`desc`?`none`:`asc`}function we(e){let t=n.sortState&&n.sortState.key===e.key?n.sortState.direction:`none`;k(`sort`,{key:e.key,direction:Ce(t)})}let Te=(0,c.getCurrentInstance)(),Ee=(0,c.computed)(()=>!!Te?.vnode.props?.onRowClick);function De(e,t){k(`row-click`,e,t)}return(t,n)=>((0,c.openBlock)(),(0,c.createElementBlock)(`div`,(0,c.mergeProps)({class:[`nb-data-table`,`nb-data-table--${e.size}`,{"nb-data-table--zebra":e.zebra},{"nb-data-table--sticky":e.stickyHeader},{"nb-data-table--fill":e.fill}]},(0,c.unref)(O)),[be.value?((0,c.openBlock)(),(0,c.createElementBlock)(`div`,f,[(0,c.createElementVNode)(`div`,{class:`nb-data-table__toolbar-heading`,inert:Q.value||void 0,"aria-hidden":Q.value||void 0},[(0,c.renderSlot)(t.$slots,`toolbar`,{selectedCount:U.value},()=>[e.title||e.description?((0,c.openBlock)(),(0,c.createElementBlock)(`div`,m,[e.title?((0,c.openBlock)(),(0,c.createElementBlock)(`h2`,h,(0,c.toDisplayString)(e.title),1)):(0,c.createCommentVNode)(``,!0),e.description?((0,c.openBlock)(),(0,c.createElementBlock)(`p`,g,(0,c.toDisplayString)(e.description),1)):(0,c.createCommentVNode)(``,!0)])):(0,c.createCommentVNode)(``,!0)],!0)],8,p),t.$slots.search||t.$slots[`toolbar-actions`]?((0,c.openBlock)(),(0,c.createElementBlock)(`div`,{key:0,class:`nb-data-table__toolbar-tools`,inert:Q.value||void 0,"aria-hidden":Q.value||void 0},[(0,c.renderSlot)(t.$slots,`search`,{},void 0,!0),(0,c.renderSlot)(t.$slots,`toolbar-actions`,{},void 0,!0)],8,_)):(0,c.createCommentVNode)(``,!0),Q.value?((0,c.openBlock)(),(0,c.createElementBlock)(`div`,v,[(0,c.createElementVNode)(`span`,y,(0,c.toDisplayString)(U.value)+` selected `,1),(0,c.createElementVNode)(`div`,b,[(0,c.renderSlot)(t.$slots,`batch-actions`,{selectedKeys:me.value,clear:X},void 0,!0)]),(0,c.createVNode)(a.t,{class:`nb-data-table__batch-cancel`,variant:`ghost`,size:M.value,onClick:X},{default:(0,c.withCtx)(()=>[...n[2]||=[(0,c.createTextVNode)(` Cancel `,-1)]]),_:1},8,[`size`])])):(0,c.createCommentVNode)(``,!0)])):(0,c.createCommentVNode)(``,!0),(0,c.createElementVNode)(`div`,x,[(0,c.createElementVNode)(`table`,{class:`nb-data-table__table`,"aria-label":e.ariaLabel||e.title||void 0,"aria-busy":e.loading||void 0},[(0,c.createElementVNode)(`colgroup`,null,[P.value?((0,c.openBlock)(),(0,c.createElementBlock)(`col`,te)):(0,c.createCommentVNode)(``,!0),((0,c.openBlock)(!0),(0,c.createElementBlock)(c.Fragment,null,(0,c.renderList)(N.value,e=>((0,c.openBlock)(),(0,c.createElementBlock)(`col`,{key:`col-${e.key}`,style:(0,c.normalizeStyle)(L(e))},null,4))),128)),F.value?((0,c.openBlock)(),(0,c.createElementBlock)(`col`,ne)):(0,c.createCommentVNode)(``,!0)]),(0,c.createElementVNode)(`thead`,re,[(0,c.createElementVNode)(`tr`,null,[P.value?((0,c.openBlock)(),(0,c.createElementBlock)(`th`,ie,[e.selectable===`multiple`?((0,c.openBlock)(),(0,c.createBlock)(s.t,{key:0,"model-value":K.value,indeterminate:he.value,"aria-label":`Select all rows`,"onUpdate:modelValue":ve},null,8,[`model-value`,`indeterminate`])):(0,c.createCommentVNode)(``,!0)])):(0,c.createCommentVNode)(``,!0),((0,c.openBlock)(!0),(0,c.createElementBlock)(c.Fragment,null,(0,c.renderList)(N.value,e=>((0,c.openBlock)(),(0,c.createElementBlock)(`th`,{key:`th-${e.key}`,scope:`col`,class:(0,c.normalizeClass)([`nb-data-table__th`,`nb-data-table__th--${e.align||`left`}`,{"nb-data-table__th--sortable":e.sortable},{"nb-data-table__th--sorted":$(e)}]),"aria-sort":e.sortable?xe(e):void 0},[e.sortable?((0,c.openBlock)(),(0,c.createElementBlock)(`button`,{key:0,type:`button`,class:`nb-data-table__sort`,onClick:t=>we(e)},[(0,c.createElementVNode)(`span`,se,[(0,c.renderSlot)(t.$slots,`header-${e.key}`,{column:e},()=>[(0,c.createTextVNode)((0,c.toDisplayString)(e.header),1)],!0)]),(0,c.createVNode)(r.t,{name:Se(e),class:`nb-data-table__sort-icon`,"aria-hidden":`true`},null,8,[`name`])],8,oe)):((0,c.openBlock)(),(0,c.createElementBlock)(`span`,ce,[(0,c.renderSlot)(t.$slots,`header-${e.key}`,{column:e},()=>[(0,c.createTextVNode)((0,c.toDisplayString)(e.header),1)],!0)]))],10,ae))),128)),F.value?((0,c.openBlock)(),(0,c.createElementBlock)(`th`,le,[...n[3]||=[(0,c.createElementVNode)(`span`,{class:`nb-sr-only`},`Row actions`,-1)]])):(0,c.createCommentVNode)(``,!0)])]),(0,c.createElementVNode)(`tbody`,ue,[e.loading?((0,c.openBlock)(!0),(0,c.createElementBlock)(c.Fragment,{key:0},(0,c.renderList)(e.skeletonRows,e=>((0,c.openBlock)(),(0,c.createElementBlock)(`tr`,{key:`skeleton-${e}`,class:`nb-data-table__row nb-data-table__row--skeleton`},[P.value?((0,c.openBlock)(),(0,c.createElementBlock)(`td`,de,[...n[4]||=[(0,c.createElementVNode)(`span`,{class:`nb-data-table__skeleton nb-data-table__skeleton--box`},null,-1)]])):(0,c.createCommentVNode)(``,!0),((0,c.openBlock)(!0),(0,c.createElementBlock)(c.Fragment,null,(0,c.renderList)(N.value,t=>((0,c.openBlock)(),(0,c.createElementBlock)(`td`,{key:`sk-${e}-${t.key}`,class:`nb-data-table__td`},[...n[5]||=[(0,c.createElementVNode)(`span`,{class:`nb-data-table__skeleton`},null,-1)]]))),128)),F.value?((0,c.openBlock)(),(0,c.createElementBlock)(`td`,fe,[...n[6]||=[(0,c.createElementVNode)(`span`,{class:`nb-data-table__skeleton nb-data-table__skeleton--box`},null,-1)]])):(0,c.createCommentVNode)(``,!0)]))),128)):e.error?((0,c.openBlock)(),(0,c.createElementBlock)(`tr`,pe,[(0,c.createElementVNode)(`td`,{colspan:I.value,class:`nb-data-table__state nb-data-table__state--error`},[(0,c.renderSlot)(t.$slots,`error`,{error:e.error},()=>[(0,c.createVNode)(o.t,{is:`span`,align:`center`,justify:`center`,gap:`xs`,class:`nb-data-table__state-inner`},{default:(0,c.withCtx)(()=>[(0,c.createVNode)(r.t,{name:`warning-circle-fill`,"aria-hidden":`true`}),(0,c.createElementVNode)(`span`,null,(0,c.toDisplayString)(e.error),1)]),_:1})],!0)],8,S)])):e.rows.length?((0,c.openBlock)(!0),(0,c.createElementBlock)(c.Fragment,{key:3},(0,c.renderList)(e.rows,(r,i)=>((0,c.openBlock)(),(0,c.createElementBlock)(`tr`,{key:V(r),class:(0,c.normalizeClass)([`nb-data-table__row`,{"nb-data-table__row--selected":W(r)},{"nb-data-table__row--clickable":Ee.value}]),"aria-selected":e.selectable===`none`?void 0:W(r),onClick:e=>De(r,i)},[P.value?((0,c.openBlock)(),(0,c.createElementBlock)(`td`,{key:0,class:`nb-data-table__td nb-data-table__select-cell`,onClick:n[0]||=(0,c.withModifiers)(()=>{},[`stop`]),onMousedown:Y,onKeydown:Y},[e.selectable===`multiple`?((0,c.openBlock)(),(0,c.createBlock)(s.t,{key:0,"model-value":W(r),"aria-label":`Select row ${i+1}`,"onUpdate:modelValue":e=>ge(r,i)},null,8,[`model-value`,`aria-label`,`onUpdate:modelValue`])):((0,c.openBlock)(),(0,c.createElementBlock)(`input`,{key:1,type:`radio`,class:`nb-data-table__radio`,name:j,checked:W(r),"aria-label":`Select row ${i+1}`,onChange:e=>_e(r)},null,40,E))],32)):(0,c.createCommentVNode)(``,!0),((0,c.openBlock)(!0),(0,c.createElementBlock)(c.Fragment,null,(0,c.renderList)(N.value,e=>((0,c.openBlock)(),(0,c.createElementBlock)(`td`,{key:`td-${V(r)}-${e.key}`,class:(0,c.normalizeClass)([`nb-data-table__td`,`nb-data-table__td--${e.align||`left`}`,e.cellClass])},[(0,c.renderSlot)(t.$slots,`cell-${e.key}`,{row:r,value:R(e,r),column:e,rowIndex:i},()=>[e.render?((0,c.openBlock)(),(0,c.createBlock)(B,{key:0,column:e,row:r,"row-index":i},null,8,[`column`,`row`,`row-index`])):((0,c.openBlock)(),(0,c.createElementBlock)(c.Fragment,{key:1},[(0,c.createTextVNode)((0,c.toDisplayString)(z(R(e,r))),1)],64))],!0)],2))),128)),F.value?((0,c.openBlock)(),(0,c.createElementBlock)(`td`,{key:1,class:`nb-data-table__td nb-data-table__actions-cell`,onClick:n[1]||=(0,c.withModifiers)(()=>{},[`stop`])},[(0,c.renderSlot)(t.$slots,`row-actions`,{row:r,rowIndex:i},void 0,!0)])):(0,c.createCommentVNode)(``,!0)],10,T))),128)):((0,c.openBlock)(),(0,c.createElementBlock)(`tr`,C,[(0,c.createElementVNode)(`td`,{colspan:I.value,class:`nb-data-table__state nb-data-table__state--empty`},[(0,c.renderSlot)(t.$slots,`empty`,{},()=>[(0,c.createElementVNode)(`span`,null,(0,c.toDisplayString)(e.emptyMessage||`No data to display`),1)],!0)],8,w)]))])],8,ee)]),t.$slots.footer?((0,c.openBlock)(),(0,c.createElementBlock)(`div`,D,[(0,c.renderSlot)(t.$slots,`footer`,{},void 0,!0)])):(0,c.createCommentVNode)(``,!0)],16))}}),k=t.t(O,[[`__scopeId`,`data-v-c26b7d0f`]]);Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return k}});
|
|
@@ -2,7 +2,7 @@ import { t as e } from "./_plugin-vue_export-helper-O4QQSku4.js";
|
|
|
2
2
|
import { r as t } from "./Size.d-Bah6vMl3.js";
|
|
3
3
|
import { t as n } from "./Icon-rREAqsu0.js";
|
|
4
4
|
import { useSurfaceLayer as r } from "./composables/useSurfaceLayer.composable.mjs";
|
|
5
|
-
import { t as i } from "./Button-
|
|
5
|
+
import { t as i } from "./Button-Cegx6vaT.js";
|
|
6
6
|
import { t as a } from "./Grid-CVNb1HcS.js";
|
|
7
7
|
import { t as o } from "./Checkbox-BJrnykX9.js";
|
|
8
8
|
import { Fragment as s, computed as c, createBlock as l, createCommentVNode as u, createElementBlock as d, createElementVNode as f, createTextVNode as p, createVNode as m, defineComponent as h, getCurrentInstance as ee, mergeProps as te, normalizeClass as g, normalizeStyle as ne, openBlock as _, ref as re, renderList as v, renderSlot as y, toDisplayString as b, unref as ie, useId as ae, useSlots as oe, watch as se, withCtx as x, withModifiers as S } from "vue";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { t as e } from "./_plugin-vue_export-helper-O4QQSku4.js";
|
|
2
2
|
import { t } from "./Icon-rREAqsu0.js";
|
|
3
3
|
import { useSurfaceLayer as n } from "./composables/useSurfaceLayer.composable.mjs";
|
|
4
|
-
import { t as r } from "./Button-
|
|
4
|
+
import { t as r } from "./Button-Cegx6vaT.js";
|
|
5
5
|
import { Fragment as i, createBlock as a, createCommentVNode as o, createElementBlock as s, createElementVNode as c, createTextVNode as l, createVNode as u, defineComponent as d, mergeProps as f, normalizeClass as p, openBlock as m, ref as h, renderList as g, toDisplayString as _, unref as v, withCtx as y, withModifiers as b } from "vue";
|
|
6
6
|
import { regular as x } from "@nubisco/ui/icons/x";
|
|
7
7
|
import { regular as S } from "@nubisco/ui/icons/circle-notch";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
require(`./chunk-D-qHiVGv.cjs`);const e=require(`./_plugin-vue_export-helper-tagjRzOz.cjs`),t=require(`./Icon-C8R_r_In.cjs`),n=require(`./composables/useSurfaceLayer.composable.cjs`),r=require(`./Button-
|
|
1
|
+
require(`./chunk-D-qHiVGv.cjs`);const e=require(`./_plugin-vue_export-helper-tagjRzOz.cjs`),t=require(`./Icon-C8R_r_In.cjs`),n=require(`./composables/useSurfaceLayer.composable.cjs`),r=require(`./Button-Dqtcr4i0.cjs`);let i=require(`vue`),a=require(`@nubisco/ui/icons/x`),o=require(`@nubisco/ui/icons/circle-notch`);var s=function(e){return e.Primary=`primary`,e.Secondary=`secondary`,e.Ghost=`ghost`,e.Danger=`danger`,e.Success=`success`,e.Warning=`warning`,e}(s||{}),c=function(e){return e.Idle=`idle`,e.Loading=`loading`,e.Success=`success`,e}(c||{}),l={key:0,class:`nb-file-uploader__heading`},u={key:1,class:`nb-file-uploader__description`},d=[`accept`,`multiple`],f={key:4,class:`nb-file-uploader__list`},p={class:`nb-file-uploader__name`},m={class:`nb-file-uploader__status`},h=[`aria-label`,`onClick`],g={key:0,class:`nb-file-uploader__error`},_=(0,i.defineComponent)({__name:`FileUploader`,props:{heading:{},description:{},buttonLabel:{default:`Add file`},variant:{default:s.Primary},accept:{},multiple:{type:Boolean,default:!1},maxSize:{},disabled:{type:Boolean},id:{}},emits:[`change`,`remove`],setup(e,{expose:s,emit:_}){let v=e,{layerProps:y}=n.useSurfaceLayer(),b=_,x=(0,i.ref)(null),S=(0,i.ref)([]),C=(0,i.ref)(!1),w=0;function T(){x.value?.click()}function E(e){if(v.maxSize&&e.size>v.maxSize)return`File exceeds size limit.`;if(v.accept){let t=v.accept.split(`,`).map(e=>e.trim().toLowerCase()),n=e.name.toLowerCase();if(!t.some(t=>t.startsWith(`.`)?n.endsWith(t):t.includes(`/`)?e.type===t||e.type.startsWith(t.replaceAll(`*`,``)):!1))return`File type not accepted.`}}function D(e){let t=Array.from(e);v.multiple||(S.value=[]);for(let e of t){let t=E(e);S.value.push({file:e,status:c.Idle,error:t})}b(`change`,S.value.filter(e=>!e.error).map(e=>e.file))}function O(e){let t=e.target;t.files?.length&&(D(t.files),t.value=``)}function k(){w++,C.value=!0}function A(){w--,w<=0&&(w=0,C.value=!1)}function j(e){w=0,C.value=!1;let t=e.dataTransfer?.files;t?.length&&D(t)}function M(e){let t=S.value[e];S.value.splice(e,1),b(`remove`,t.file),b(`change`,S.value.filter(e=>!e.error).map(e=>e.file))}function N(e,t,n){S.value[e]&&(S.value[e].status=t,S.value[e].error=n)}return s({files:S,setFileStatus:N}),(n,s)=>((0,i.openBlock)(),(0,i.createElementBlock)(`div`,(0,i.mergeProps)({class:`nb-file-uploader`},(0,i.unref)(y),{onDragenter:(0,i.withModifiers)(k,[`prevent`]),onDragover:s[0]||=(0,i.withModifiers)(()=>{},[`prevent`]),onDragleave:(0,i.withModifiers)(A,[`prevent`]),onDrop:(0,i.withModifiers)(j,[`prevent`])}),[e.heading?((0,i.openBlock)(),(0,i.createElementBlock)(`p`,l,(0,i.toDisplayString)(e.heading),1)):(0,i.createCommentVNode)(``,!0),e.description?((0,i.openBlock)(),(0,i.createElementBlock)(`p`,u,(0,i.toDisplayString)(e.description),1)):(0,i.createCommentVNode)(``,!0),C.value?((0,i.openBlock)(),(0,i.createElementBlock)(`div`,{key:2,class:(0,i.normalizeClass)([`nb-file-uploader__dropzone`,`nb-file-uploader__dropzone--${e.variant}`])},[...s[1]||=[(0,i.createElementVNode)(`span`,{class:`nb-file-uploader__drop-label`},[(0,i.createTextVNode)(` Drag and drop files here`),(0,i.createElementVNode)(`br`),(0,i.createTextVNode)(`or click to upload `)],-1)]],2)):((0,i.openBlock)(),(0,i.createBlock)(r.t,{key:3,class:`nb-file-uploader__btn`,variant:e.variant,onClick:(0,i.withModifiers)(T,[`stop`])},{default:(0,i.withCtx)(()=>[(0,i.createTextVNode)((0,i.toDisplayString)(e.buttonLabel),1)]),_:1},8,[`variant`])),(0,i.createElementVNode)(`input`,{ref_key:`inputRef`,ref:x,type:`file`,class:`nb-file-uploader__input`,accept:e.accept,multiple:e.multiple,onChange:O},null,40,d),S.value.length?((0,i.openBlock)(),(0,i.createElementBlock)(`ul`,f,[((0,i.openBlock)(!0),(0,i.createElementBlock)(i.Fragment,null,(0,i.renderList)(S.value,(e,n)=>((0,i.openBlock)(),(0,i.createElementBlock)(`li`,{key:n,class:(0,i.normalizeClass)([`nb-file-uploader__item`,{"nb-file-uploader__item--error":e.error,"nb-file-uploader__item--success":e.status===`success`}])},[(0,i.createElementVNode)(`span`,p,(0,i.toDisplayString)(e.file.name),1),(0,i.createElementVNode)(`span`,m,[e.status===`loading`?((0,i.openBlock)(),(0,i.createBlock)(t.t,{key:0,name:(0,i.unref)(o.regular),class:`nb-file-uploader__spinner`},null,8,[`name`])):e.status===`success`?((0,i.openBlock)(),(0,i.createBlock)(t.t,{key:1,name:`check-circle-fill`,class:`nb-file-uploader__check`})):(0,i.createCommentVNode)(``,!0),e.error?((0,i.openBlock)(),(0,i.createBlock)(t.t,{key:2,name:`warning-circle-fill`,class:`nb-file-uploader__warn`})):(0,i.createCommentVNode)(``,!0),e.status===`loading`?(0,i.createCommentVNode)(``,!0):((0,i.openBlock)(),(0,i.createElementBlock)(`button`,{key:3,class:`nb-file-uploader__remove`,type:`button`,"aria-label":`Remove ${e.file.name}`,onClick:e=>M(n)},[(0,i.createVNode)(t.t,{name:(0,i.unref)(a.regular)},null,8,[`name`])],8,h))]),e.error?((0,i.openBlock)(),(0,i.createElementBlock)(`div`,g,(0,i.toDisplayString)(e.error),1)):(0,i.createCommentVNode)(``,!0)],2))),128))])):(0,i.createCommentVNode)(``,!0)],16))}}),v=e.t(_,[[`__scopeId`,`data-v-1adb0140`]]);Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return v}});
|