@nubisco/ui 5.19.0 → 5.20.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/{ActionGroup-CMuposow.cjs → ActionGroup-CUN48Qea.cjs} +1 -1
- package/dist/{ActionGroup-0u17QzT8.js → ActionGroup-lEopoloN.js} +1 -1
- package/dist/BarChart-Bnkibwcl.js +294 -0
- package/dist/BarChart-CjxY_3RM.cjs +1 -0
- package/dist/{Confirm-OMhu2Fuz.js → Confirm-Dh1H2PMh.js} +1 -1
- package/dist/{Confirm-DCkG5bUZ.cjs → Confirm-ue689l-w.cjs} +1 -1
- package/dist/DataTable-CQBI0wcg.js +412 -0
- package/dist/DataTable-DN4SbClx.cjs +1 -0
- package/dist/{DatePicker-MDaQ2l8I.js → DatePicker-ViTSDX6d.js} +162 -135
- package/dist/DatePicker-lv4wQxf8.cjs +1 -0
- package/dist/LineChart-Bol60gtX.cjs +1 -0
- package/dist/{LineChart-DG_ows6r.js → LineChart-CsBHPIUF.js} +25 -21
- package/dist/{Menu-D-zvh-SA.js → Menu-2Se8F81Q.js} +1 -1
- package/dist/Menu-CAZmNx60.cjs +1 -0
- package/dist/{MenuBarItem-BDqp9LzY.js → MenuBarItem-Cxxs8Dnr.js} +1 -1
- package/dist/{MenuBarItem-Dmutkr1p.cjs → MenuBarItem-dBEuTZ3Q.cjs} +1 -1
- package/dist/{Modal-C97dRTiP.js → Modal-BxSP1eyD.js} +2 -2
- package/dist/{Modal-BNgLfB88.cjs → Modal-sGlC__uQ.cjs} +1 -1
- package/dist/{Pagination-Br-k9zuG.js → Pagination-BveCRx-Z.js} +1 -1
- package/dist/{Pagination-CCMhqtoz.cjs → Pagination-DlTqW-zR.cjs} +1 -1
- package/dist/Select-D4Il1NaM.js +489 -0
- package/dist/Select-MwbDOqbP.cjs +1 -0
- package/dist/Tabs-Bmw1hFrN.cjs +1 -0
- package/dist/Tabs-CjXOZ3K6.js +196 -0
- package/dist/all.cjs +1 -1
- package/dist/all.mjs +12 -12
- package/dist/components/ActionGroup.cjs +1 -1
- package/dist/components/ActionGroup.mjs +1 -1
- package/dist/components/Charts/BarChart.cjs +1 -1
- package/dist/components/Charts/BarChart.d.ts +8 -1
- package/dist/components/Charts/BarChart.mjs +1 -1
- package/dist/components/Charts/BarChart.vue.d.ts.map +1 -1
- package/dist/components/Charts/LineChart.cjs +1 -1
- package/dist/components/Charts/LineChart.d.ts +8 -1
- package/dist/components/Charts/LineChart.mjs +1 -1
- package/dist/components/Charts/LineChart.vue.d.ts.map +1 -1
- package/dist/components/Charts/shared/types.d.ts +7 -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/DataTable.vue.d.ts.map +1 -1
- package/dist/components/DatePicker.cjs +1 -1
- package/dist/components/DatePicker.mjs +1 -1
- package/dist/components/DatePicker.vue.d.ts.map +1 -1
- package/dist/components/Menu.cjs +1 -1
- package/dist/components/Menu.mjs +1 -1
- package/dist/components/MenuBarItem.cjs +1 -1
- package/dist/components/MenuBarItem.mjs +1 -1
- package/dist/components/Modal.cjs +1 -1
- package/dist/components/Modal.mjs +1 -1
- package/dist/components/Modal.vue.d.ts.map +1 -1
- package/dist/components/Pagination.cjs +1 -1
- package/dist/components/Pagination.mjs +1 -1
- package/dist/components/Select.cjs +1 -1
- package/dist/components/Select.d.ts +8 -0
- package/dist/components/Select.mjs +1 -1
- package/dist/components/Select.vue.d.ts +9 -7
- package/dist/components/Select.vue.d.ts.map +1 -1
- package/dist/components/Tabs.cjs +1 -1
- package/dist/components/Tabs.mjs +1 -1
- package/dist/components/Tabs.vue.d.ts.map +1 -1
- package/dist/composables/useConfirm.composable.cjs +1 -1
- package/dist/composables/useConfirm.composable.mjs +2 -2
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +12 -12
- package/dist/main.d.ts +1 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/styles/BarChart.css +1 -1
- package/dist/styles/DataTable.css +1 -1
- package/dist/styles/LineChart.css +1 -1
- package/dist/styles/Modal.css +1 -1
- package/dist/styles/Select.css +1 -1
- package/dist/styles/Tabs.css +1 -1
- package/dist/ui.css +6 -6
- package/package.json +1 -1
- package/dist/BarChart-DTStA9jd.js +0 -290
- package/dist/BarChart-Dvrl4xeX.cjs +0 -1
- package/dist/DataTable-CWMlmjMi.cjs +0 -1
- package/dist/DataTable-DaNZAixf.js +0 -389
- package/dist/DatePicker-BgMtkY76.cjs +0 -1
- package/dist/LineChart-C5bQNxQ-.cjs +0 -1
- package/dist/Menu-BALfMobG.cjs +0 -1
- package/dist/Select-ClkEzw5T.cjs +0 -1
- package/dist/Select-DIw08nte.js +0 -437
- package/dist/Tabs-CrrG1hvh.cjs +0 -1
- package/dist/Tabs-D3pdOieX.js +0 -180
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require(`./chunk-D-qHiVGv.cjs`),t=require(`./composables/usePhoneLayout.composable.cjs`),n=require(`./Button-C0UUTgEB.cjs`),r=require(`./Menu-
|
|
1
|
+
const e=require(`./chunk-D-qHiVGv.cjs`),t=require(`./composables/usePhoneLayout.composable.cjs`),n=require(`./Button-C0UUTgEB.cjs`),r=require(`./Menu-CAZmNx60.cjs`),i=require(`./MenuItem-ZQcFYe4m.cjs`),a=require(`./utils/slotContent.helper.cjs`);let o=require(`vue`),s=require(`@nubisco/ui/icons/dots-three`);s=e.n(s);var c={class:`nb-action-group`},l=(0,o.defineComponent)({__name:`ActionGroup`,props:{items:{},size:{default:`sm`},overflow:{default:`never`},overflowLabel:{default:`More actions`},phoneVisible:{default:1}},emits:[`select`],setup(e,{emit:l}){let u=e,d=l,f=(0,o.useSlots)(),{phone:p}=t.usePhoneLayout(),m=(0,o.computed)(()=>u.overflow===`never`?!1:u.overflow===`always`?!0:p.value),h=(0,o.computed)(()=>{let e=Math.max(0,u.phoneVisible),t=u.items.filter(e=>e.priority===`primary`);return(t.length?t:u.items).slice(0,e)}),g=(0,o.computed)(()=>u.items.filter(e=>!h.value.includes(e))),_=(0,o.computed)(()=>g.value.length>0||a.hasSlotContent(f,`menu`));function v(e){return p.value&&!!e.icon}function y(e){return e.variant??(e.danger?`danger`:void 0)}function b(e){e.disabled||e.loading||(e.onSelect?.(),d(`select`,e.id))}let x=(0,o.ref)(!1),S=(0,o.ref)(null),C=(0,o.ref)(null);function w(){return C.value?.$el??null}let T=!1;function E(){T=x.value}function D(){if(T||x.value){T=!1,x.value=!1;return}let e=w()?.getBoundingClientRect();e&&S.value?.setPosition(e),x.value=!0}function O(e){if(x.value=e,e)return;let t=document.activeElement;(!t||t===document.body||!t.isConnected)&&(0,o.nextTick)(()=>w()?.focus())}return(t,a)=>((0,o.openBlock)(),(0,o.createElementBlock)(`div`,c,[m.value?((0,o.openBlock)(),(0,o.createElementBlock)(o.Fragment,{key:1},[((0,o.openBlock)(!0),(0,o.createElementBlock)(o.Fragment,null,(0,o.renderList)(h.value,t=>((0,o.openBlock)(),(0,o.createElementBlock)(o.Fragment,{key:t.id},[v(t)?((0,o.openBlock)(),(0,o.createBlock)(n.t,{key:0,variant:y(t),outlined:t.outlined,size:e.size,disabled:t.disabled,loading:t.loading,icon:t.icon,"aria-label":t.label,"aria-pressed":t.pressed,onClick:e=>b(t)},null,8,[`variant`,`outlined`,`size`,`disabled`,`loading`,`icon`,`aria-label`,`aria-pressed`,`onClick`])):((0,o.openBlock)(),(0,o.createBlock)(n.t,{key:1,variant:y(t),outlined:t.outlined,size:e.size,disabled:t.disabled,loading:t.loading,icon:t.icon,"aria-pressed":t.pressed,onClick:e=>b(t)},{default:(0,o.withCtx)(()=>[(0,o.createTextVNode)((0,o.toDisplayString)(t.label),1)]),_:2},1032,[`variant`,`outlined`,`size`,`disabled`,`loading`,`icon`,`aria-pressed`,`onClick`]))],64))),128)),_.value?((0,o.openBlock)(),(0,o.createBlock)(n.t,{key:0,ref_key:`triggerRef`,ref:C,class:`nb-action-group__more`,variant:`ghost`,size:e.size,icon:s,"aria-label":e.overflowLabel,"aria-haspopup":`menu`,"aria-expanded":x.value,onMousedown:E,onClick:D},null,8,[`size`,`aria-label`,`aria-expanded`])):(0,o.createCommentVNode)(``,!0),_.value?((0,o.openBlock)(),(0,o.createBlock)(r.t,{key:1,ref_key:`menuRef`,ref:S,open:x.value,"onUpdate:open":O},{default:(0,o.withCtx)(()=>[((0,o.openBlock)(!0),(0,o.createElementBlock)(o.Fragment,null,(0,o.renderList)(g.value,e=>((0,o.openBlock)(),(0,o.createBlock)(i.t,{key:e.id,label:e.label,icon:e.icon,disabled:e.disabled||e.loading,danger:e.danger,selectable:e.pressed!==void 0,selected:e.pressed,onSelect:t=>b(e)},null,8,[`label`,`icon`,`disabled`,`danger`,`selectable`,`selected`,`onSelect`]))),128)),(0,o.renderSlot)(t.$slots,`menu`)]),_:3},8,[`open`])):(0,o.createCommentVNode)(``,!0)],64)):((0,o.openBlock)(!0),(0,o.createElementBlock)(o.Fragment,{key:0},(0,o.renderList)(e.items,t=>((0,o.openBlock)(),(0,o.createBlock)(n.t,{key:t.id,variant:y(t),outlined:t.outlined,size:e.size,disabled:t.disabled,loading:t.loading,icon:t.icon,"aria-pressed":t.pressed,onClick:e=>b(t)},{default:(0,o.withCtx)(()=>[(0,o.createTextVNode)((0,o.toDisplayString)(t.label),1)]),_:2},1032,[`variant`,`outlined`,`size`,`disabled`,`loading`,`icon`,`aria-pressed`,`onClick`]))),128))]))}});Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return l}});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { usePhoneLayout as e } from "./composables/usePhoneLayout.composable.mjs";
|
|
2
2
|
import { t } from "./Button-IcCXOoCT.js";
|
|
3
|
-
import { t as n } from "./Menu-
|
|
3
|
+
import { t as n } from "./Menu-2Se8F81Q.js";
|
|
4
4
|
import { t as r } from "./MenuItem-BDLX2QWw.js";
|
|
5
5
|
import { hasSlotContent as i } from "./utils/slotContent.helper.mjs";
|
|
6
6
|
import { Fragment as a, computed as o, createBlock as s, createCommentVNode as c, createElementBlock as l, createTextVNode as u, defineComponent as d, nextTick as f, openBlock as p, ref as m, renderList as h, renderSlot as g, toDisplayString as _, useSlots as v, withCtx as y } from "vue";
|
|
@@ -0,0 +1,294 @@
|
|
|
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-StNyj_sM.js";
|
|
3
|
+
import { t as a } from "./ChartLegend-BLTbVV2E.js";
|
|
4
|
+
import { i as o, r as s, t as c } from "./scales-DlFF1BRk.js";
|
|
5
|
+
import { t as l } from "./useChartSize-UdZSuP3G.js";
|
|
6
|
+
import { Fragment as u, computed as d, createBlock as f, createCommentVNode as p, createElementBlock as m, createElementVNode as h, createVNode as g, defineComponent as _, getCurrentInstance as v, mergeProps as y, normalizeClass as ee, openBlock as b, ref as x, renderList as S, toDisplayString as C, unref as w, withCtx as T } from "vue";
|
|
7
|
+
//#region src/components/Charts/BarChart.vue?vue&type=script&setup=true&lang.ts
|
|
8
|
+
var E = [
|
|
9
|
+
"width",
|
|
10
|
+
"height",
|
|
11
|
+
"role",
|
|
12
|
+
"aria-label"
|
|
13
|
+
], D = { key: 0 }, O = [
|
|
14
|
+
"x1",
|
|
15
|
+
"x2",
|
|
16
|
+
"y1",
|
|
17
|
+
"y2"
|
|
18
|
+
], te = { class: "nb-chart__axis" }, ne = [
|
|
19
|
+
"x",
|
|
20
|
+
"y",
|
|
21
|
+
"text-anchor",
|
|
22
|
+
"dominant-baseline"
|
|
23
|
+
], re = { class: "nb-chart__axis" }, ie = [
|
|
24
|
+
"x",
|
|
25
|
+
"y",
|
|
26
|
+
"text-anchor",
|
|
27
|
+
"dominant-baseline"
|
|
28
|
+
], ae = [
|
|
29
|
+
"x1",
|
|
30
|
+
"x2",
|
|
31
|
+
"y1",
|
|
32
|
+
"y2"
|
|
33
|
+
], oe = [
|
|
34
|
+
"fill",
|
|
35
|
+
"tabindex",
|
|
36
|
+
"role",
|
|
37
|
+
"aria-label",
|
|
38
|
+
"onKeydown"
|
|
39
|
+
], k = { class: "nb-chart__hover-layer" }, A = [
|
|
40
|
+
"onMouseenter",
|
|
41
|
+
"onMousemove",
|
|
42
|
+
"onClick"
|
|
43
|
+
], j = /* @__PURE__ */ e(/* @__PURE__ */ _({
|
|
44
|
+
__name: "BarChart",
|
|
45
|
+
props: {
|
|
46
|
+
series: { default: () => [] },
|
|
47
|
+
orientation: { default: "vertical" },
|
|
48
|
+
stacked: {
|
|
49
|
+
type: Boolean,
|
|
50
|
+
default: !1
|
|
51
|
+
},
|
|
52
|
+
valueFormatter: {},
|
|
53
|
+
title: { default: void 0 },
|
|
54
|
+
subtitle: { default: void 0 },
|
|
55
|
+
height: { default: 280 },
|
|
56
|
+
showLegend: {
|
|
57
|
+
type: Boolean,
|
|
58
|
+
default: !0
|
|
59
|
+
},
|
|
60
|
+
showTooltip: {
|
|
61
|
+
type: Boolean,
|
|
62
|
+
default: !0
|
|
63
|
+
},
|
|
64
|
+
showGrid: {
|
|
65
|
+
type: Boolean,
|
|
66
|
+
default: !0
|
|
67
|
+
},
|
|
68
|
+
colors: { default: () => r }
|
|
69
|
+
},
|
|
70
|
+
emits: ["select"],
|
|
71
|
+
setup(e, { emit: r }) {
|
|
72
|
+
let _ = e, j = r, M = x(null), N = l(M, {
|
|
73
|
+
width: 480,
|
|
74
|
+
height: 240
|
|
75
|
+
}), P = d(() => _.orientation === "horizontal"), F = d(() => _.series.map((e, n) => ({
|
|
76
|
+
name: e.name,
|
|
77
|
+
data: e.data,
|
|
78
|
+
color: e.color ?? t(n, _.colors)
|
|
79
|
+
}))), I = d(() => (_.series[0]?.data ?? []).map((e) => e.x)), L = (e, t) => F.value[t]?.data[e]?.y ?? 0, R = (e, t) => {
|
|
80
|
+
let n = L(e, t);
|
|
81
|
+
if (!_.stacked) return [0, n];
|
|
82
|
+
let r = 0;
|
|
83
|
+
for (let i = 0; i < t; i += 1) {
|
|
84
|
+
let t = L(e, i);
|
|
85
|
+
t >= 0 == n >= 0 && (r += t);
|
|
86
|
+
}
|
|
87
|
+
return [r, r + n];
|
|
88
|
+
}, z = d(() => {
|
|
89
|
+
let e = [];
|
|
90
|
+
return I.value.forEach((t, n) => {
|
|
91
|
+
F.value.forEach((t, r) => {
|
|
92
|
+
e.push(R(n, r)[1]);
|
|
93
|
+
});
|
|
94
|
+
}), e.length ? o(Math.min(0, ...e), Math.max(0, ...e), .05) : [0, 1];
|
|
95
|
+
}), B = d(() => {
|
|
96
|
+
if (!P.value) return {
|
|
97
|
+
top: 12,
|
|
98
|
+
right: 16,
|
|
99
|
+
bottom: 28,
|
|
100
|
+
left: 44
|
|
101
|
+
};
|
|
102
|
+
let e = I.value.reduce((e, t) => Math.max(e, String(t).length), 0), t = Math.max(44, Math.round(N.value.width * .4));
|
|
103
|
+
return {
|
|
104
|
+
top: 12,
|
|
105
|
+
right: 16,
|
|
106
|
+
bottom: 28,
|
|
107
|
+
left: Math.min(Math.max(44, Math.ceil(e * 6.2) + 12), t)
|
|
108
|
+
};
|
|
109
|
+
}), V = d(() => ({
|
|
110
|
+
x0: B.value.left,
|
|
111
|
+
x1: Math.max(B.value.left, N.value.width - B.value.right),
|
|
112
|
+
y0: B.value.top,
|
|
113
|
+
y1: Math.max(B.value.top, N.value.height - B.value.bottom)
|
|
114
|
+
})), H = d(() => c(I.value.map((e) => String(e)), P.value ? [V.value.y0, V.value.y1] : [V.value.x0, V.value.x1], .2)), U = d(() => s(z.value, P.value ? [V.value.x0, V.value.x1] : [V.value.y1, V.value.y0])), W = d(() => U.value.ticks(5)), G = (e) => H.value(String(I.value[e])), K = (e) => G(e) + H.value.bandwidth / 2, q = d(() => {
|
|
115
|
+
let e = F.value.length || 1;
|
|
116
|
+
return _.stacked ? H.value.bandwidth : H.value.bandwidth / e;
|
|
117
|
+
}), se = (e, t) => {
|
|
118
|
+
let [n, r] = R(e, t), i = U.value(n), a = U.value(r), o = Math.max(0, q.value - 2), s = G(e) + (_.stacked ? 0 : t * q.value), c = Math.max(0, Math.abs(a - i));
|
|
119
|
+
return P.value ? {
|
|
120
|
+
x: Math.min(i, a),
|
|
121
|
+
y: s,
|
|
122
|
+
width: c,
|
|
123
|
+
height: o
|
|
124
|
+
} : {
|
|
125
|
+
x: s,
|
|
126
|
+
y: Math.min(i, a),
|
|
127
|
+
width: o,
|
|
128
|
+
height: c
|
|
129
|
+
};
|
|
130
|
+
}, ce = (e) => {
|
|
131
|
+
let t = G(e), n = H.value.bandwidth;
|
|
132
|
+
return P.value ? {
|
|
133
|
+
x: V.value.x0,
|
|
134
|
+
y: t,
|
|
135
|
+
width: Math.max(0, V.value.x1 - V.value.x0),
|
|
136
|
+
height: n
|
|
137
|
+
} : {
|
|
138
|
+
x: t,
|
|
139
|
+
y: V.value.y0,
|
|
140
|
+
width: n,
|
|
141
|
+
height: Math.max(0, V.value.y1 - V.value.y0)
|
|
142
|
+
};
|
|
143
|
+
}, le = (e) => Math.abs(e) >= 1e3 ? `${(e / 1e3).toFixed(1)}k` : String(e), J = (e) => _.valueFormatter ? _.valueFormatter(e) : le(e), ue = v(), Y = () => !!ue?.vnode.props?.onSelect, de = (e, t) => {
|
|
144
|
+
let n = F.value[t], r = J(L(e, t));
|
|
145
|
+
return F.value.length > 1 ? `${I.value[e]}, ${n?.name}: ${r}` : `${I.value[e]}: ${r}`;
|
|
146
|
+
}, X = (e, t) => {
|
|
147
|
+
let n = F.value[t], r = n?.data[e];
|
|
148
|
+
return {
|
|
149
|
+
kind: "series",
|
|
150
|
+
x: r?.x ?? I.value[e],
|
|
151
|
+
y: r?.y ?? 0,
|
|
152
|
+
seriesName: n?.name ?? "",
|
|
153
|
+
seriesIndex: t,
|
|
154
|
+
index: e,
|
|
155
|
+
point: r ?? {
|
|
156
|
+
x: I.value[e],
|
|
157
|
+
y: 0
|
|
158
|
+
}
|
|
159
|
+
};
|
|
160
|
+
}, Z = (e) => {
|
|
161
|
+
let t = e.currentTarget.ownerSVGElement;
|
|
162
|
+
if (!t) return null;
|
|
163
|
+
let n = t.getBoundingClientRect();
|
|
164
|
+
return {
|
|
165
|
+
x: e.clientX - n.left,
|
|
166
|
+
y: e.clientY - n.top
|
|
167
|
+
};
|
|
168
|
+
}, fe = (e, t) => {
|
|
169
|
+
let n = F.value.length;
|
|
170
|
+
if (n <= 1) return 0;
|
|
171
|
+
let r = Z(e);
|
|
172
|
+
if (!r) return 0;
|
|
173
|
+
if (_.stacked) {
|
|
174
|
+
let e = P.value ? r.x : r.y;
|
|
175
|
+
for (let r = 0; r < n; r += 1) {
|
|
176
|
+
let [n, i] = R(t, r), a = U.value(n), o = U.value(i);
|
|
177
|
+
if (e >= Math.min(a, o) && e <= Math.max(a, o)) return r;
|
|
178
|
+
}
|
|
179
|
+
return n - 1;
|
|
180
|
+
}
|
|
181
|
+
let i = (P.value ? r.y : r.x) - G(t), a = Math.floor(i / (q.value || 1));
|
|
182
|
+
return Math.min(Math.max(a, 0), n - 1);
|
|
183
|
+
}, pe = (e, t) => {
|
|
184
|
+
Y() && j("select", X(t, fe(e, t)));
|
|
185
|
+
}, me = (e, t, n) => {
|
|
186
|
+
Y() && (e.key !== "Enter" && e.key !== " " || (e.preventDefault(), j("select", X(t, n))));
|
|
187
|
+
}, Q = x(null), $ = x({
|
|
188
|
+
x: 0,
|
|
189
|
+
y: 0
|
|
190
|
+
}), he = (e, t) => {
|
|
191
|
+
let n = Z(e);
|
|
192
|
+
n && ($.value = {
|
|
193
|
+
x: n.x + 12,
|
|
194
|
+
y: n.y + 12
|
|
195
|
+
}, Q.value = t);
|
|
196
|
+
}, ge = d(() => Q.value === null ? [] : F.value.map((e) => {
|
|
197
|
+
let t = e.data[Q.value];
|
|
198
|
+
return {
|
|
199
|
+
label: e.name,
|
|
200
|
+
value: t?.label ?? J(t?.y ?? 0),
|
|
201
|
+
color: e.color
|
|
202
|
+
};
|
|
203
|
+
}));
|
|
204
|
+
return (t, r) => (b(), f(i, {
|
|
205
|
+
title: e.title,
|
|
206
|
+
subtitle: e.subtitle,
|
|
207
|
+
height: e.height,
|
|
208
|
+
"show-legend": e.showLegend && F.value.length > 0
|
|
209
|
+
}, {
|
|
210
|
+
legend: T(() => [g(a, { items: F.value.map((e) => ({
|
|
211
|
+
label: e.name,
|
|
212
|
+
color: e.color
|
|
213
|
+
})) }, null, 8, ["items"])]),
|
|
214
|
+
default: T(() => [h("div", {
|
|
215
|
+
ref_key: "root",
|
|
216
|
+
ref: M,
|
|
217
|
+
class: "nb-bar-chart"
|
|
218
|
+
}, [(b(), m("svg", {
|
|
219
|
+
width: w(N).width,
|
|
220
|
+
height: w(N).height,
|
|
221
|
+
class: ee(["nb-chart__svg", { "nb-chart__svg--selectable": Y() }]),
|
|
222
|
+
role: Y() ? "group" : "img",
|
|
223
|
+
"aria-label": e.title || "Bar chart",
|
|
224
|
+
onMouseleave: r[0] ||= (e) => Q.value = null
|
|
225
|
+
}, [
|
|
226
|
+
e.showGrid && w(N).width > 0 ? (b(), m("g", D, [(b(!0), m(u, null, S(W.value, (e) => (b(), m("line", {
|
|
227
|
+
key: `grid-${e}`,
|
|
228
|
+
class: "nb-chart__gridline",
|
|
229
|
+
x1: P.value ? U.value(e) : V.value.x0,
|
|
230
|
+
x2: P.value ? U.value(e) : V.value.x1,
|
|
231
|
+
y1: P.value ? V.value.y0 : U.value(e),
|
|
232
|
+
y2: P.value ? V.value.y1 : U.value(e)
|
|
233
|
+
}, null, 8, O))), 128))])) : p("", !0),
|
|
234
|
+
h("g", te, [(b(!0), m(u, null, S(W.value, (e) => (b(), m("text", {
|
|
235
|
+
key: `vt-${e}`,
|
|
236
|
+
x: P.value ? U.value(e) : V.value.x0 - 6,
|
|
237
|
+
y: P.value ? V.value.y1 + 14 : U.value(e),
|
|
238
|
+
"text-anchor": P.value ? "middle" : "end",
|
|
239
|
+
"dominant-baseline": P.value ? "auto" : "middle"
|
|
240
|
+
}, C(J(e)), 9, ne))), 128))]),
|
|
241
|
+
h("g", re, [(b(!0), m(u, null, S(I.value, (e, t) => (b(), m("text", {
|
|
242
|
+
key: `ct-${t}`,
|
|
243
|
+
x: P.value ? V.value.x0 - 6 : K(t),
|
|
244
|
+
y: P.value ? K(t) : V.value.y1 + 14,
|
|
245
|
+
"text-anchor": P.value ? "end" : "middle",
|
|
246
|
+
"dominant-baseline": P.value ? "middle" : "auto"
|
|
247
|
+
}, C(e), 9, ie))), 128))]),
|
|
248
|
+
h("line", {
|
|
249
|
+
class: "nb-chart__axis-line",
|
|
250
|
+
x1: P.value ? U.value(0) : V.value.x0,
|
|
251
|
+
x2: P.value ? U.value(0) : V.value.x1,
|
|
252
|
+
y1: P.value ? V.value.y0 : U.value(0),
|
|
253
|
+
y2: P.value ? V.value.y1 : U.value(0)
|
|
254
|
+
}, null, 8, ae),
|
|
255
|
+
(b(!0), m(u, null, S(I.value, (e, t) => (b(), m("g", { key: `g-${t}` }, [(b(!0), m(u, null, S(F.value, (e, n) => (b(), m("rect", y({
|
|
256
|
+
key: `${t}-${n}`,
|
|
257
|
+
class: ["nb-chart__bar", { "is-dim": Q.value !== null && Q.value !== t }]
|
|
258
|
+
}, { ref_for: !0 }, se(t, n), {
|
|
259
|
+
fill: e.color,
|
|
260
|
+
tabindex: Y() ? 0 : void 0,
|
|
261
|
+
role: Y() ? "button" : void 0,
|
|
262
|
+
"aria-label": Y() ? de(t, n) : void 0,
|
|
263
|
+
onKeydown: (e) => me(e, t, n)
|
|
264
|
+
}), null, 16, oe))), 128))]))), 128)),
|
|
265
|
+
h("g", k, [(b(!0), m(u, null, S(I.value, (e, t) => (b(), m("rect", y({ key: `hover-${t}` }, { ref_for: !0 }, ce(t), {
|
|
266
|
+
fill: "transparent",
|
|
267
|
+
onMouseenter: (e) => Q.value = t,
|
|
268
|
+
onMousemove: (e) => he(e, t),
|
|
269
|
+
onClick: (e) => pe(e, t)
|
|
270
|
+
}), null, 16, A))), 128))])
|
|
271
|
+
], 42, E)), g(n, {
|
|
272
|
+
visible: e.showTooltip && Q.value !== null,
|
|
273
|
+
x: $.value.x,
|
|
274
|
+
y: $.value.y,
|
|
275
|
+
title: Q.value === null ? "" : String(I.value[Q.value]),
|
|
276
|
+
rows: ge.value
|
|
277
|
+
}, null, 8, [
|
|
278
|
+
"visible",
|
|
279
|
+
"x",
|
|
280
|
+
"y",
|
|
281
|
+
"title",
|
|
282
|
+
"rows"
|
|
283
|
+
])], 512)]),
|
|
284
|
+
_: 1
|
|
285
|
+
}, 8, [
|
|
286
|
+
"title",
|
|
287
|
+
"subtitle",
|
|
288
|
+
"height",
|
|
289
|
+
"show-legend"
|
|
290
|
+
]));
|
|
291
|
+
}
|
|
292
|
+
}), [["__scopeId", "data-v-7b3d7ee4"]]);
|
|
293
|
+
//#endregion
|
|
294
|
+
export { j as t };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
require(`./chunk-D-qHiVGv.cjs`);const e=require(`./_plugin-vue_export-helper-tagjRzOz.cjs`),t=require(`./palette-Cy2_8mLH.cjs`),n=require(`./ChartLegend-DGgW0yjG.cjs`),r=require(`./scales-4WxjhxBm.cjs`),i=require(`./useChartSize-C-BIN0vc.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},valueFormatter:{},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=e=>v.valueFormatter?v.valueFormatter(e):R(e),B=(0,a.getCurrentInstance)(),V=()=>!!B?.vnode.props?.onSelect,H=(e,t)=>{let n=C.value[t],r=z(T(e,t));return C.value.length>1?`${w.value[e]}, ${n?.name}: ${r}`:`${w.value[e]}: ${r}`},U=(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}}},W=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}},G=(e,t)=>{let n=C.value.length;if(n<=1)return 0;let r=W(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)},K=(e,t)=>{V()&&y(`select`,U(t,G(e,t)))},q=(e,t,n)=>{V()&&(e.key!==`Enter`&&e.key!==` `||(e.preventDefault(),y(`select`,U(t,n))))},J=(0,a.ref)(null),Y=(0,a.ref)({x:0,y:0}),X=(e,t)=>{let n=W(e);n&&(Y.value={x:n.x+12,y:n.y+12},J.value=t)},Z=(0,a.computed)(()=>J.value===null?[]:C.value.map(e=>{let t=e.data[J.value];return{label:e.name,value:t?.label??z(t?.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":V()}]),role:V()?`group`:`img`,"aria-label":e.title||`Bar chart`,onMouseleave:i[0]||=e=>J.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)(z(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":J.value!==null&&J.value!==t}]},{ref_for:!0},I(t,n),{fill:e.color,tabindex:V()?0:void 0,role:V()?`button`:void 0,"aria-label":V()?H(t,n):void 0,onKeydown:e=>q(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=>J.value=t,onMousemove:e=>X(e,t),onClick:e=>K(e,t)}),null,16,g))),128))])],42,o)),(0,a.createVNode)(t.l,{visible:e.showTooltip&&J.value!==null,x:Y.value.x,y:Y.value.y,title:J.value===null?``:String(w.value[J.value]),rows:Z.value},null,8,[`visible`,`x`,`y`,`title`,`rows`])],512)]),_:1},8,[`title`,`subtitle`,`height`,`show-legend`]))}}),v=e.t(_,[[`__scopeId`,`data-v-7b3d7ee4`]]);Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return v}});
|
|
@@ -3,7 +3,7 @@ import { t } from "./_plugin-vue_export-helper-O4QQSku4.js";
|
|
|
3
3
|
import { t as n } from "./Icon-rREAqsu0.js";
|
|
4
4
|
import { t as r } from "./Button-IcCXOoCT.js";
|
|
5
5
|
import { t as i } from "./Message-CHkTWe0K.js";
|
|
6
|
-
import { i as a, r as ee, t as te } from "./Modal-
|
|
6
|
+
import { i as a, r as ee, t as te } from "./Modal-BxSP1eyD.js";
|
|
7
7
|
import { t as ne } from "./TextInput-KQGVZCcT.js";
|
|
8
8
|
import { computed as o, createBlock as s, createCommentVNode as c, createElementBlock as l, createElementVNode as u, createTextVNode as d, createVNode as f, defineComponent as p, nextTick as m, normalizeClass as h, onMounted as re, onUnmounted as ie, openBlock as g, ref as _, renderSlot as ae, toDisplayString as v, unref as y, useId as oe, useSlots as se, watch as b, withCtx as x, withKeys as ce, withModifiers as le } from "vue";
|
|
9
9
|
import { regular as ue } from "@nubisco/ui/icons/check";
|
|
@@ -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-C0UUTgEB.cjs`),i=require(`./Message-C44ftsaT.cjs`),a=require(`./Modal-
|
|
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-C0UUTgEB.cjs`),i=require(`./Message-C44ftsaT.cjs`),a=require(`./Modal-sGlC__uQ.cjs`),o=require(`./TextInput-BdZPqTzI.cjs`);let s=require(`vue`),c=require(`@nubisco/ui/icons/check`),ee=require(`@nubisco/ui/icons/warning`);var te={key:0,class:`nb-confirm__message`},ne={key:0,class:`nb-confirm__subject-kind`},l={class:`nb-confirm__subject-name`},u={key:1,class:`nb-confirm__gate`},d={class:`nb-confirm__live`},f={key:0,class:`nb-confirm__status`,role:`status`},p={key:1,class:`nb-confirm__status nb-confirm__status--success`,role:`status`},m=(0,s.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:m,emit:h}){let g=t,_=h,v=(0,s.useId)(),y=`nb-confirm-title-${v}`,b=`nb-confirm-body-${v}`,x=(0,s.useSlots)(),S=(0,s.ref)(null),C=(0,s.ref)(null),w=(0,s.ref)(null),T=(0,s.ref)(``),E=e.useReducedMotion(),D=(0,s.computed)(()=>g.busy||g.succeeded);function O(){return!!g.message||!!g.subject||!!x.default}let k=(0,s.computed)(()=>g.tone===`danger`?`danger`:`primary`),A=(0,s.computed)(()=>g.typeToConfirmLabel??`Type ${g.typeToConfirm} to confirm`),j=(0,s.computed)(()=>!g.typeToConfirm||T.value.trim()===g.typeToConfirm),M=(0,s.computed)(()=>j.value&&!D.value);function N(){M.value&&_(`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 re(){return typeof document>`u`?[]:Array.from(document.querySelectorAll(`[aria-modal="true"]`))}function I(){let e=F();if(!e)return!1;let t=re();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 a.i(g.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(){a.r(F(),E.value)}(0,s.watch)(E,()=>{g.open&&K()}),(0,s.watch)(()=>[g.busy,g.error],async(e,t)=>{if(!g.open)return;let[n,r]=e,i=t?.[0]??!1;if(await(0,s.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,s.watch)(()=>g.open,async e=>{e?(W=document.activeElement instanceof HTMLElement?document.activeElement:null,T.value=``,await(0,s.nextTick)(),K(),P()?P()?.focus():H()):G()},{immediate:!0});function q(){D.value||_(`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 ie(){let e=J&&!Y;J=!1,!e&&q()}function Q(e){if(!g.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(!g.open)return;let t=e.relatedTarget;if(t instanceof Element){if(B(t)||z(t))return}else if(t!==null)return;requestAnimationFrame(()=>{if(!g.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,s.onMounted)(()=>{g.open&&(K(),P()?P()?.focus():H())}),(0,s.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()}),m({focusCancel:()=>P()?.focus(),restoreFocus:G,isTopmost:I}),(e,m)=>((0,s.openBlock)(),(0,s.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,"trap-focus":!1,onClose:ie},{header:(0,s.withCtx)(()=>[(0,s.createElementVNode)(`span`,{id:y,class:(0,s.normalizeClass)([`nb-confirm__heading`,`nb-confirm__heading--${t.tone}`])},[t.tone===`danger`?((0,s.openBlock)(),(0,s.createBlock)(n.t,{key:0,name:(0,s.unref)(ee.regular),size:16,"aria-hidden":`true`},null,8,[`name`])):(0,s.createCommentVNode)(``,!0),(0,s.createElementVNode)(`span`,null,(0,s.toDisplayString)(t.title),1)],2)]),footer:(0,s.withCtx)(()=>[(0,s.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,s.withCtx)(()=>[(0,s.createTextVNode)((0,s.toDisplayString)(t.cancelLabel),1)]),_:1},8,[`disabled`]),(0,s.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,s.withCtx)(()=>[(0,s.createTextVNode)((0,s.toDisplayString)(t.confirmLabel),1)]),_:1},8,[`variant`,`disabled`,`loading`])]),default:(0,s.withCtx)(()=>[(0,s.createElementVNode)(`div`,{ref_key:`rootRef`,ref:S,class:(0,s.normalizeClass)([`nb-confirm`,t.contentClass])},[O()?((0,s.openBlock)(),(0,s.createElementBlock)(`div`,{key:0,id:b,class:`nb-confirm__body`},[(0,s.renderSlot)(e.$slots,`default`,{},()=>[t.message?((0,s.openBlock)(),(0,s.createElementBlock)(`p`,te,(0,s.toDisplayString)(t.message),1)):(0,s.createCommentVNode)(``,!0)],!0),t.subject?((0,s.openBlock)(),(0,s.createElementBlock)(`p`,{key:0,class:(0,s.normalizeClass)([`nb-confirm__subject`,`nb-confirm__subject--${t.tone}`])},[t.subjectLabel?((0,s.openBlock)(),(0,s.createElementBlock)(`span`,ne,(0,s.toDisplayString)(t.subjectLabel),1)):(0,s.createCommentVNode)(``,!0),(0,s.createElementVNode)(`span`,l,(0,s.toDisplayString)(t.subject),1)],2)):(0,s.createCommentVNode)(``,!0)])):(0,s.createCommentVNode)(``,!0),t.typeToConfirm?((0,s.openBlock)(),(0,s.createElementBlock)(`div`,u,[(0,s.createVNode)(o.t,{modelValue:T.value,"onUpdate:modelValue":m[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:m[1]||=(0,s.withKeys)((0,s.withModifiers)(()=>{},[`prevent`]),[`enter`])},null,8,[`modelValue`,`label`,`helper`,`disabled`])])):(0,s.createCommentVNode)(``,!0),(0,s.createElementVNode)(`div`,d,[t.busy?((0,s.openBlock)(),(0,s.createElementBlock)(`p`,f,(0,s.toDisplayString)(t.busyLabel),1)):(0,s.createCommentVNode)(``,!0),t.succeeded&&t.successLabel?((0,s.openBlock)(),(0,s.createElementBlock)(`p`,p,[(0,s.createVNode)(n.t,{name:(0,s.unref)(c.regular),size:14,"aria-hidden":`true`},null,8,[`name`]),(0,s.createElementVNode)(`span`,null,(0,s.toDisplayString)(t.successLabel),1)])):(0,s.createCommentVNode)(``,!0),t.error?((0,s.openBlock)(),(0,s.createElementBlock)(`div`,{key:2,ref_key:`errorRef`,ref:C,class:`nb-confirm__error`,tabindex:`-1`},[(0,s.createVNode)(i.t,{variant:`error`},{default:(0,s.withCtx)(()=>[(0,s.createTextVNode)((0,s.toDisplayString)(t.error),1)]),_:1})],512)):(0,s.createCommentVNode)(``,!0)])],2)]),_:3},8,[`open`,`size`,`role`,`described-by`,`busy`,`close-on-overlay`,`close-disabled`]))}}),h=t.t(m,[[`__scopeId`,`data-v-683eafb1`]]);Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return h}});
|