@nubisco/ui 5.25.1 → 5.26.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/{AiProvider-BVT_8D6a.js → AiProvider-B4salihw.js} +2 -2
- package/dist/{AiProvider-BXWMTzi9.cjs → AiProvider-pHIvM5zN.cjs} +1 -1
- package/dist/{Confirm-CHsxP6G_.js → Confirm-DQqArhXl.js} +1 -1
- package/dist/{Confirm--cR6XRZQ.cjs → Confirm-YhMEfWX5.cjs} +1 -1
- package/dist/DataTable-B2hBaZ2y.cjs +1 -0
- package/dist/DataTable-BZ8Q_6fr.js +500 -0
- package/dist/{Field-LiiMobFy.js → Field-DCEukL3E.js} +1 -1
- package/dist/{Field-DznERREe.cjs → Field-M289tArC.cjs} +1 -1
- package/dist/FileUploader-C9Pyc7er.js +187 -0
- package/dist/FileUploader-D1HoVmOw.cjs +1 -0
- package/dist/{LineChart-D869JljU.js → LineChart-CKGlZDLI.js} +109 -99
- package/dist/LineChart-CjlCW-us.cjs +1 -0
- package/dist/{TextInput-BkCOQWfT.cjs → TextInput-DmCYZgG0.cjs} +1 -1
- package/dist/{TextInput-Kt2ciMVI.js → TextInput-HwIhSOJD.js} +1 -1
- package/dist/all.cjs +1 -1
- package/dist/all.mjs +7 -7
- package/dist/components/AiProvider.cjs +1 -1
- package/dist/components/AiProvider.mjs +1 -1
- package/dist/components/Charts/LineChart.cjs +1 -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/xLabels.d.ts.map +1 -1
- 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.d.ts +17 -1
- package/dist/components/DataTable.mjs +1 -1
- package/dist/components/DataTable.vue.d.ts +7 -1
- package/dist/components/DataTable.vue.d.ts.map +1 -1
- package/dist/components/DatePicker.vue.d.ts.map +1 -1
- package/dist/components/Field.cjs +1 -1
- package/dist/components/Field.mjs +1 -1
- package/dist/components/Field.vue.d.ts.map +1 -1
- package/dist/components/FileUploader.cjs +1 -1
- package/dist/components/FileUploader.mjs +1 -1
- package/dist/components/FileUploader.vue.d.ts +1 -0
- package/dist/components/FileUploader.vue.d.ts.map +1 -1
- package/dist/components/TextInput.cjs +1 -1
- package/dist/components/TextInput.mjs +1 -1
- package/dist/components/TextInput.vue.d.ts.map +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 +7 -7
- package/dist/styles/DataTable.css +1 -1
- package/dist/styles/DatePicker.css +1 -1
- package/dist/styles/Field.css +1 -1
- package/dist/styles/FileUploader.css +1 -1
- package/dist/styles/LineChart.css +1 -1
- package/dist/styles/TextInput.css +1 -1
- package/dist/ui.css +6 -6
- package/package.json +1 -1
- package/src/styles/_appearance.scss +3 -1
- package/dist/DataTable-COfiHgll.js +0 -412
- package/dist/DataTable-XSEybeeP.cjs +0 -1
- package/dist/FileUploader-BjYXOXxj.cjs +0 -1
- package/dist/FileUploader-DwKKUn71.js +0 -162
- package/dist/LineChart-D7nlCRxj.cjs +0 -1
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
import { t as e } from "./_plugin-vue_export-helper-O4QQSku4.js";
|
|
2
|
+
import { t } from "./Icon-rREAqsu0.js";
|
|
3
|
+
import { useSurfaceLayer as n } from "./composables/useSurfaceLayer.composable.mjs";
|
|
4
|
+
import { t as r } from "./Button-IcCXOoCT.js";
|
|
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, watch as y, withCtx as b, withModifiers as x } from "vue";
|
|
6
|
+
import { regular as S } from "@nubisco/ui/icons/x";
|
|
7
|
+
import { regular as C } from "@nubisco/ui/icons/circle-notch";
|
|
8
|
+
//#region src/types/Variants.d.ts
|
|
9
|
+
var w = /* @__PURE__ */ function(e) {
|
|
10
|
+
return e.Primary = "primary", e.Secondary = "secondary", e.Ghost = "ghost", e.Danger = "danger", e.Success = "success", e.Warning = "warning", e;
|
|
11
|
+
}(w || {}), T = /* @__PURE__ */ function(e) {
|
|
12
|
+
return e.Idle = "idle", e.Loading = "loading", e.Success = "success", e;
|
|
13
|
+
}(T || {}), E = {
|
|
14
|
+
key: 0,
|
|
15
|
+
class: "nb-file-uploader__heading"
|
|
16
|
+
}, D = {
|
|
17
|
+
key: 1,
|
|
18
|
+
class: "nb-file-uploader__description"
|
|
19
|
+
}, O = [
|
|
20
|
+
"accept",
|
|
21
|
+
"multiple",
|
|
22
|
+
"disabled"
|
|
23
|
+
], k = {
|
|
24
|
+
key: 4,
|
|
25
|
+
class: "nb-file-uploader__list"
|
|
26
|
+
}, A = { class: "nb-file-uploader__name" }, j = { class: "nb-file-uploader__status" }, M = [
|
|
27
|
+
"aria-label",
|
|
28
|
+
"disabled",
|
|
29
|
+
"onClick"
|
|
30
|
+
], N = {
|
|
31
|
+
key: 0,
|
|
32
|
+
class: "nb-file-uploader__error"
|
|
33
|
+
}, P = /* @__PURE__ */ e(/* @__PURE__ */ d({
|
|
34
|
+
__name: "FileUploader",
|
|
35
|
+
props: {
|
|
36
|
+
heading: {},
|
|
37
|
+
description: {},
|
|
38
|
+
buttonLabel: { default: "Add file" },
|
|
39
|
+
variant: { default: w.Primary },
|
|
40
|
+
accept: {},
|
|
41
|
+
multiple: {
|
|
42
|
+
type: Boolean,
|
|
43
|
+
default: !1
|
|
44
|
+
},
|
|
45
|
+
maxSize: {},
|
|
46
|
+
disabled: {
|
|
47
|
+
type: Boolean,
|
|
48
|
+
default: !1
|
|
49
|
+
},
|
|
50
|
+
id: {}
|
|
51
|
+
},
|
|
52
|
+
emits: ["change", "remove"],
|
|
53
|
+
setup(e, { expose: d, emit: w }) {
|
|
54
|
+
let P = e, { layerProps: F } = n(), I = w, L = h(null), R = h([]), z = h(!1), B = 0;
|
|
55
|
+
y(() => P.disabled, (e) => {
|
|
56
|
+
e && (B = 0, z.value = !1);
|
|
57
|
+
});
|
|
58
|
+
function V() {
|
|
59
|
+
P.disabled || L.value?.click();
|
|
60
|
+
}
|
|
61
|
+
function H(e) {
|
|
62
|
+
if (P.maxSize && e.size > P.maxSize) return "File exceeds size limit.";
|
|
63
|
+
if (P.accept) {
|
|
64
|
+
let t = P.accept.split(",").map((e) => e.trim().toLowerCase()), n = e.name.toLowerCase();
|
|
65
|
+
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.";
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
function U(e) {
|
|
69
|
+
let t = Array.from(e);
|
|
70
|
+
P.multiple || (R.value = []);
|
|
71
|
+
for (let e of t) {
|
|
72
|
+
let t = H(e);
|
|
73
|
+
R.value.push({
|
|
74
|
+
file: e,
|
|
75
|
+
status: T.Idle,
|
|
76
|
+
error: t
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
I("change", R.value.filter((e) => !e.error).map((e) => e.file));
|
|
80
|
+
}
|
|
81
|
+
function W(e) {
|
|
82
|
+
let t = e.target;
|
|
83
|
+
if (P.disabled) {
|
|
84
|
+
t.value = "";
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
t.files?.length && (U(t.files), t.value = "");
|
|
88
|
+
}
|
|
89
|
+
function G() {
|
|
90
|
+
P.disabled || (B++, z.value = !0);
|
|
91
|
+
}
|
|
92
|
+
function K() {
|
|
93
|
+
B--, B <= 0 && (B = 0, z.value = !1);
|
|
94
|
+
}
|
|
95
|
+
function q(e) {
|
|
96
|
+
P.disabled && e.dataTransfer && (e.dataTransfer.dropEffect = "none");
|
|
97
|
+
}
|
|
98
|
+
function J(e) {
|
|
99
|
+
if (B = 0, z.value = !1, P.disabled) return;
|
|
100
|
+
let t = e.dataTransfer?.files;
|
|
101
|
+
t?.length && U(t);
|
|
102
|
+
}
|
|
103
|
+
function Y(e) {
|
|
104
|
+
if (P.disabled) return;
|
|
105
|
+
let t = R.value[e];
|
|
106
|
+
R.value.splice(e, 1), I("remove", t.file), I("change", R.value.filter((e) => !e.error).map((e) => e.file));
|
|
107
|
+
}
|
|
108
|
+
function X(e, t, n) {
|
|
109
|
+
R.value[e] && (R.value[e].status = t, R.value[e].error = n);
|
|
110
|
+
}
|
|
111
|
+
return d({
|
|
112
|
+
files: R,
|
|
113
|
+
setFileStatus: X
|
|
114
|
+
}), (n, d) => (m(), s("div", f({ class: ["nb-file-uploader", { "nb-file-uploader--disabled": e.disabled }] }, v(F), {
|
|
115
|
+
onDragenter: x(G, ["prevent"]),
|
|
116
|
+
onDragover: x(q, ["prevent"]),
|
|
117
|
+
onDragleave: x(K, ["prevent"]),
|
|
118
|
+
onDrop: x(J, ["prevent"])
|
|
119
|
+
}), [
|
|
120
|
+
e.heading ? (m(), s("p", E, _(e.heading), 1)) : o("", !0),
|
|
121
|
+
e.description ? (m(), s("p", D, _(e.description), 1)) : o("", !0),
|
|
122
|
+
z.value ? (m(), s("div", {
|
|
123
|
+
key: 2,
|
|
124
|
+
class: p(["nb-file-uploader__dropzone", `nb-file-uploader__dropzone--${e.variant}`])
|
|
125
|
+
}, [...d[0] ||= [c("span", { class: "nb-file-uploader__drop-label" }, [
|
|
126
|
+
l(" Drag and drop files here"),
|
|
127
|
+
c("br"),
|
|
128
|
+
l("or click to upload ")
|
|
129
|
+
], -1)]], 2)) : (m(), a(r, {
|
|
130
|
+
key: 3,
|
|
131
|
+
class: "nb-file-uploader__btn",
|
|
132
|
+
variant: e.variant,
|
|
133
|
+
disabled: e.disabled,
|
|
134
|
+
onClick: x(V, ["stop"])
|
|
135
|
+
}, {
|
|
136
|
+
default: b(() => [l(_(e.buttonLabel), 1)]),
|
|
137
|
+
_: 1
|
|
138
|
+
}, 8, ["variant", "disabled"])),
|
|
139
|
+
c("input", {
|
|
140
|
+
ref_key: "inputRef",
|
|
141
|
+
ref: L,
|
|
142
|
+
type: "file",
|
|
143
|
+
class: "nb-file-uploader__input",
|
|
144
|
+
accept: e.accept,
|
|
145
|
+
multiple: e.multiple,
|
|
146
|
+
disabled: e.disabled,
|
|
147
|
+
onChange: W
|
|
148
|
+
}, null, 40, O),
|
|
149
|
+
R.value.length ? (m(), s("ul", k, [(m(!0), s(i, null, g(R.value, (n, r) => (m(), s("li", {
|
|
150
|
+
key: r,
|
|
151
|
+
class: p(["nb-file-uploader__item", {
|
|
152
|
+
"nb-file-uploader__item--error": n.error,
|
|
153
|
+
"nb-file-uploader__item--success": n.status === "success"
|
|
154
|
+
}])
|
|
155
|
+
}, [
|
|
156
|
+
c("span", A, _(n.file.name), 1),
|
|
157
|
+
c("span", j, [
|
|
158
|
+
n.status === "loading" ? (m(), a(t, {
|
|
159
|
+
key: 0,
|
|
160
|
+
name: v(C),
|
|
161
|
+
class: "nb-file-uploader__spinner"
|
|
162
|
+
}, null, 8, ["name"])) : n.status === "success" ? (m(), a(t, {
|
|
163
|
+
key: 1,
|
|
164
|
+
name: "check-circle-fill",
|
|
165
|
+
class: "nb-file-uploader__check"
|
|
166
|
+
})) : o("", !0),
|
|
167
|
+
n.error ? (m(), a(t, {
|
|
168
|
+
key: 2,
|
|
169
|
+
name: "warning-circle-fill",
|
|
170
|
+
class: "nb-file-uploader__warn"
|
|
171
|
+
})) : o("", !0),
|
|
172
|
+
n.status === "loading" ? o("", !0) : (m(), s("button", {
|
|
173
|
+
key: 3,
|
|
174
|
+
class: "nb-file-uploader__remove",
|
|
175
|
+
type: "button",
|
|
176
|
+
"aria-label": `Remove ${n.file.name}`,
|
|
177
|
+
disabled: e.disabled,
|
|
178
|
+
onClick: (e) => Y(r)
|
|
179
|
+
}, [u(t, { name: v(S) }, null, 8, ["name"])], 8, M))
|
|
180
|
+
]),
|
|
181
|
+
n.error ? (m(), s("div", N, _(n.error), 1)) : o("", !0)
|
|
182
|
+
], 2))), 128))])) : o("", !0)
|
|
183
|
+
], 16));
|
|
184
|
+
}
|
|
185
|
+
}), [["__scopeId", "data-v-9bd5f6ba"]]);
|
|
186
|
+
//#endregion
|
|
187
|
+
export { P as t };
|
|
@@ -0,0 +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-C0UUTgEB.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`,`disabled`],f={key:4,class:`nb-file-uploader__list`},p={class:`nb-file-uploader__name`},m={class:`nb-file-uploader__status`},h=[`aria-label`,`disabled`,`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,default:!1},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;(0,i.watch)(()=>v.disabled,e=>{e&&(w=0,C.value=!1)});function T(){v.disabled||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;if(v.disabled){t.value=``;return}t.files?.length&&(D(t.files),t.value=``)}function k(){v.disabled||(w++,C.value=!0)}function A(){w--,w<=0&&(w=0,C.value=!1)}function j(e){v.disabled&&e.dataTransfer&&(e.dataTransfer.dropEffect=`none`)}function M(e){if(w=0,C.value=!1,v.disabled)return;let t=e.dataTransfer?.files;t?.length&&D(t)}function N(e){if(v.disabled)return;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 P(e,t,n){S.value[e]&&(S.value[e].status=t,S.value[e].error=n)}return s({files:S,setFileStatus:P}),(n,s)=>((0,i.openBlock)(),(0,i.createElementBlock)(`div`,(0,i.mergeProps)({class:[`nb-file-uploader`,{"nb-file-uploader--disabled":e.disabled}]},(0,i.unref)(y),{onDragenter:(0,i.withModifiers)(k,[`prevent`]),onDragover:(0,i.withModifiers)(j,[`prevent`]),onDragleave:(0,i.withModifiers)(A,[`prevent`]),onDrop:(0,i.withModifiers)(M,[`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[0]||=[(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,disabled:e.disabled,onClick:(0,i.withModifiers)(T,[`stop`])},{default:(0,i.withCtx)(()=>[(0,i.createTextVNode)((0,i.toDisplayString)(e.buttonLabel),1)]),_:1},8,[`variant`,`disabled`])),(0,i.createElementVNode)(`input`,{ref_key:`inputRef`,ref:x,type:`file`,class:`nb-file-uploader__input`,accept:e.accept,multiple:e.multiple,disabled:e.disabled,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,(n,r)=>((0,i.openBlock)(),(0,i.createElementBlock)(`li`,{key:r,class:(0,i.normalizeClass)([`nb-file-uploader__item`,{"nb-file-uploader__item--error":n.error,"nb-file-uploader__item--success":n.status===`success`}])},[(0,i.createElementVNode)(`span`,p,(0,i.toDisplayString)(n.file.name),1),(0,i.createElementVNode)(`span`,m,[n.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`])):n.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),n.error?((0,i.openBlock)(),(0,i.createBlock)(t.t,{key:2,name:`warning-circle-fill`,class:`nb-file-uploader__warn`})):(0,i.createCommentVNode)(``,!0),n.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 ${n.file.name}`,disabled:e.disabled,onClick:e=>N(r)},[(0,i.createVNode)(t.t,{name:(0,i.unref)(a.regular)},null,8,[`name`])],8,h))]),n.error?((0,i.openBlock)(),(0,i.createElementBlock)(`div`,g,(0,i.toDisplayString)(n.error),1)):(0,i.createCommentVNode)(``,!0)],2))),128))])):(0,i.createCommentVNode)(``,!0)],16))}}),v=e.t(_,[[`__scopeId`,`data-v-9bd5f6ba`]]);Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return v}});
|
|
@@ -3,66 +3,71 @@ import { i as t, l as n, n as r, u as i } from "./palette-VMXxKICH.js";
|
|
|
3
3
|
import { t as a } from "./ChartLegend-BtBKVnH3.js";
|
|
4
4
|
import { i as o, r as s } from "./scales-DVJzRU1F.js";
|
|
5
5
|
import { t as c } from "./useChartSize-Dyh37PYP.js";
|
|
6
|
-
import { Fragment as l, computed as u, createBlock as d, createCommentVNode as f, createElementBlock as p, createElementVNode as m, createVNode as h, defineComponent as g, onBeforeUnmount as
|
|
6
|
+
import { Fragment as l, computed as u, createBlock as d, createCommentVNode as f, createElementBlock as p, createElementVNode as m, createVNode as h, defineComponent as g, onBeforeUnmount as ee, onMounted as te, openBlock as _, ref as v, renderList as y, toDisplayString as b, unref as x, watch as ne, withCtx as S } from "vue";
|
|
7
7
|
//#region src/components/Charts/shared/xLabels.ts
|
|
8
|
-
var
|
|
8
|
+
var C = 6, w = 8, T = (e, t = C) => {
|
|
9
9
|
let n = [];
|
|
10
10
|
if (e <= 0) return n;
|
|
11
11
|
let r = Math.max(1, Math.ceil(e / t));
|
|
12
12
|
for (let t = 0; t < e; t += r) n.push(t);
|
|
13
13
|
return n[n.length - 1] !== e - 1 && n.push(e - 1), n;
|
|
14
|
-
},
|
|
14
|
+
}, E = (e, t, n) => {
|
|
15
15
|
for (let r = 1; r < e.length; r++) {
|
|
16
16
|
let i = e[r - 1], a = e[r], o = i.x + t(i.index) / 2;
|
|
17
17
|
if (a.x - t(a.index) / 2 - o < n) return !1;
|
|
18
18
|
}
|
|
19
19
|
return !0;
|
|
20
|
-
},
|
|
20
|
+
}, D = (e, t, n) => {
|
|
21
21
|
if (n === void 0 || t >= n) return e;
|
|
22
22
|
let r = t / 2;
|
|
23
23
|
return Math.min(Math.max(e, r), n - r);
|
|
24
|
-
},
|
|
25
|
-
let a =
|
|
24
|
+
}, O = (e, t, n, r, i) => {
|
|
25
|
+
let a = (e) => e.x === n(e.index) ? r : i, o = e, s = o[o.length - 1];
|
|
26
|
+
return o.length > 2 && !E(o.slice(-2), t, a(s)) && (o = [...o.slice(0, -2), s]), o.length > 2 && !E(o.slice(0, 2), t, a(o[0])) && (o = [o[0], ...o.slice(2)]), o;
|
|
27
|
+
}, k = ({ count: e, positionOf: t, widthOf: n, width: r, gap: i = w }) => {
|
|
28
|
+
let a = T(e);
|
|
29
|
+
if (!n) return a.map((e) => ({
|
|
26
30
|
index: e,
|
|
27
31
|
x: t(e)
|
|
28
32
|
}));
|
|
29
|
-
|
|
30
|
-
let o = e - 1, s = (e) => ({
|
|
33
|
+
let o = (e) => ({
|
|
31
34
|
index: e,
|
|
32
|
-
x:
|
|
33
|
-
}),
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
let r = [
|
|
38
|
-
|
|
35
|
+
x: D(t(e), n(e), r)
|
|
36
|
+
}), s = O(a.map(o), n, t, -Infinity, i);
|
|
37
|
+
if (E(s, n, 0)) return s;
|
|
38
|
+
let c = e - 1, l = Math.max(1, Math.ceil(e / C)) + 1;
|
|
39
|
+
for (let e = l; e <= c; e++) {
|
|
40
|
+
let r = [];
|
|
41
|
+
for (let t = 0; t < c; t += e) r.push(t);
|
|
42
|
+
let a = O([...r, c].map(o), n, t, i, i);
|
|
43
|
+
if (E(a, n, i)) return a;
|
|
39
44
|
}
|
|
40
|
-
return [
|
|
41
|
-
},
|
|
45
|
+
return [o(0)];
|
|
46
|
+
}, A = [
|
|
42
47
|
"width",
|
|
43
48
|
"height",
|
|
44
49
|
"aria-label"
|
|
45
|
-
],
|
|
50
|
+
], j = { key: 0 }, M = [
|
|
46
51
|
"x1",
|
|
47
52
|
"x2",
|
|
48
53
|
"y1",
|
|
49
54
|
"y2"
|
|
50
|
-
],
|
|
55
|
+
], N = { class: "nb-chart__axis" }, P = ["x", "y"], F = ["x", "y"], I = [
|
|
51
56
|
"x1",
|
|
52
57
|
"x2",
|
|
53
58
|
"y1",
|
|
54
59
|
"y2"
|
|
55
|
-
],
|
|
60
|
+
], L = ["d", "fill"], R = ["d", "stroke"], z = [
|
|
56
61
|
"cx",
|
|
57
62
|
"cy",
|
|
58
63
|
"r",
|
|
59
64
|
"fill"
|
|
60
|
-
],
|
|
65
|
+
], B = [
|
|
61
66
|
"x1",
|
|
62
67
|
"x2",
|
|
63
68
|
"y1",
|
|
64
69
|
"y2"
|
|
65
|
-
],
|
|
70
|
+
], V = /* @__PURE__ */ e(/* @__PURE__ */ g({
|
|
66
71
|
__name: "LineChart",
|
|
67
72
|
props: {
|
|
68
73
|
series: { default: () => [] },
|
|
@@ -99,55 +104,60 @@ var E = 6, D = 8, O = (e, t = E) => {
|
|
|
99
104
|
right: 16,
|
|
100
105
|
bottom: 28,
|
|
101
106
|
left: 44
|
|
102
|
-
},
|
|
107
|
+
}, C = v(null), w = c(C, {
|
|
103
108
|
width: 480,
|
|
104
109
|
height: 240
|
|
105
|
-
}),
|
|
110
|
+
}), T = u(() => r.series.map((e, n) => ({
|
|
106
111
|
name: e.name,
|
|
107
112
|
data: e.data,
|
|
108
113
|
color: e.color ?? t(n, r.colors)
|
|
109
|
-
}))),
|
|
114
|
+
}))), E = u(() => (r.series[0]?.data ?? []).map((e) => e.x)), D = u(() => {
|
|
110
115
|
let e = r.series.flatMap((e) => e.data.map((e) => e.y));
|
|
111
116
|
return e.length ? o(Math.min(0, ...e), Math.max(...e), .1) : [0, 1];
|
|
112
|
-
}),
|
|
113
|
-
let t =
|
|
114
|
-
return t <= 1 ? g.left +
|
|
115
|
-
},
|
|
116
|
-
let e =
|
|
117
|
+
}), O = u(() => s(D.value, [Math.max(g.top, w.value.height - g.bottom), g.top])), V = u(() => O.value.ticks(5)), H = v(7), U = (e) => Math.max(O.value(e), H.value), W = u(() => Math.max(0, w.value.width - g.left - g.right)), G = (e) => {
|
|
118
|
+
let t = E.value.length;
|
|
119
|
+
return t <= 1 ? g.left + W.value / 2 : g.left + e / (t - 1) * W.value;
|
|
120
|
+
}, K = v(null), q = v(null), J = () => {
|
|
121
|
+
let e = K.value;
|
|
117
122
|
if (!e || typeof document > "u") return;
|
|
118
123
|
let t = document.createElementNS("http://www.w3.org/2000/svg", "text");
|
|
119
124
|
if (typeof t.getComputedTextLength != "function") return;
|
|
120
125
|
t.setAttribute("visibility", "hidden"), t.setAttribute("aria-hidden", "true"), e.appendChild(t);
|
|
121
126
|
let n = /* @__PURE__ */ new Map();
|
|
122
|
-
for (let e of
|
|
123
|
-
let r =
|
|
127
|
+
for (let e of E.value) {
|
|
128
|
+
let r = b(e);
|
|
124
129
|
n.has(r) || (t.textContent = r, n.set(r, t.getComputedTextLength()));
|
|
125
130
|
}
|
|
126
|
-
|
|
131
|
+
if (typeof t.getBBox == "function") {
|
|
132
|
+
t.setAttribute("dominant-baseline", "middle"), t.setAttribute("y", "0"), t.textContent = "0";
|
|
133
|
+
let e = -t.getBBox().y;
|
|
134
|
+
e > 0 && (H.value = e);
|
|
135
|
+
}
|
|
136
|
+
e.removeChild(t), q.value = n;
|
|
127
137
|
};
|
|
128
|
-
|
|
129
|
-
let
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
}),
|
|
133
|
-
|
|
138
|
+
ne(E, J, { flush: "post" });
|
|
139
|
+
let Y = typeof document > "u" ? void 0 : document.fonts;
|
|
140
|
+
te(() => {
|
|
141
|
+
J(), Y?.addEventListener?.("loadingdone", J);
|
|
142
|
+
}), ee(() => {
|
|
143
|
+
Y?.removeEventListener?.("loadingdone", J);
|
|
134
144
|
});
|
|
135
|
-
let
|
|
136
|
-
let e =
|
|
137
|
-
return
|
|
145
|
+
let re = u(() => {
|
|
146
|
+
let e = E.value, t = q.value;
|
|
147
|
+
return k({
|
|
138
148
|
count: e.length,
|
|
139
|
-
positionOf:
|
|
140
|
-
widthOf: t ? (n) => t.get(
|
|
141
|
-
width:
|
|
149
|
+
positionOf: G,
|
|
150
|
+
widthOf: t ? (n) => t.get(b(e[n])) ?? 0 : void 0,
|
|
151
|
+
width: w.value.width
|
|
142
152
|
}).map((t) => ({
|
|
143
153
|
...t,
|
|
144
154
|
value: e[t.index]
|
|
145
155
|
}));
|
|
146
|
-
}),
|
|
156
|
+
}), ie = (e) => e.length ? X(e.map((e, t) => [G(t), O.value(e.y)]), r.curve) : "", ae = (e) => {
|
|
147
157
|
if (!e.length) return "";
|
|
148
|
-
let t = e.map((e, t) => [
|
|
149
|
-
return `${
|
|
150
|
-
},
|
|
158
|
+
let t = e.map((e, t) => [G(t), O.value(e.y)]), n = w.value.height - g.bottom;
|
|
159
|
+
return `${X(t, r.curve)} L${t[t.length - 1][0]},${n} L${t[0][0]},${n} Z`;
|
|
160
|
+
}, X = (e, t) => {
|
|
151
161
|
if (!e.length) return "";
|
|
152
162
|
if (e.length === 1) return `M${e[0][0]},${e[0][1]}`;
|
|
153
163
|
if (t === "linear") return e.map((e, t) => `${t === 0 ? "M" : "L"}${e[0]},${e[1]}`).join(" ");
|
|
@@ -165,18 +175,18 @@ var E = 6, D = 8, O = (e, t = E) => {
|
|
|
165
175
|
r += ` C${c},${l} ${u},${d} ${o[0]},${o[1]}`;
|
|
166
176
|
}
|
|
167
177
|
return r;
|
|
168
|
-
},
|
|
178
|
+
}, oe = (e) => Math.abs(e) >= 1e3 ? `${(e / 1e3).toFixed(1)}k` : Number.isInteger(e) ? String(e) : e.toFixed(1), Z = (e) => r.valueFormatter ? r.valueFormatter(e) : oe(e), Q = v(null), $ = v({
|
|
169
179
|
x: 0,
|
|
170
180
|
y: 0
|
|
171
|
-
}),
|
|
172
|
-
let t = e.currentTarget.getBoundingClientRect(), n = e.clientX - t.left, r =
|
|
181
|
+
}), se = (e) => {
|
|
182
|
+
let t = e.currentTarget.getBoundingClientRect(), n = e.clientX - t.left, r = E.value.length;
|
|
173
183
|
if (!r) return;
|
|
174
|
-
let i = (n - g.left) / Math.max(1,
|
|
184
|
+
let i = (n - g.left) / Math.max(1, W.value);
|
|
175
185
|
Q.value = Math.round(Math.min(1, Math.max(0, i)) * (r - 1)), $.value = {
|
|
176
186
|
x: e.clientX - t.left + 12,
|
|
177
187
|
y: e.clientY - t.top + 12
|
|
178
188
|
};
|
|
179
|
-
},
|
|
189
|
+
}, ce = u(() => Q.value === null ? [] : T.value.map((e) => {
|
|
180
190
|
let t = e.data[Q.value];
|
|
181
191
|
return {
|
|
182
192
|
label: e.name,
|
|
@@ -184,101 +194,101 @@ var E = 6, D = 8, O = (e, t = E) => {
|
|
|
184
194
|
color: e.color
|
|
185
195
|
};
|
|
186
196
|
}));
|
|
187
|
-
return (t, r) => (
|
|
197
|
+
return (t, r) => (_(), d(i, {
|
|
188
198
|
title: e.title,
|
|
189
199
|
subtitle: e.subtitle,
|
|
190
200
|
height: e.height,
|
|
191
|
-
"show-legend": e.showLegend &&
|
|
201
|
+
"show-legend": e.showLegend && T.value.length > 0
|
|
192
202
|
}, {
|
|
193
|
-
legend:
|
|
203
|
+
legend: S(() => [h(a, { items: T.value.map((e) => ({
|
|
194
204
|
label: e.name,
|
|
195
205
|
color: e.color
|
|
196
206
|
})) }, null, 8, ["items"])]),
|
|
197
|
-
default:
|
|
207
|
+
default: S(() => [m("div", {
|
|
198
208
|
ref_key: "root",
|
|
199
|
-
ref:
|
|
209
|
+
ref: C,
|
|
200
210
|
class: "nb-line-chart"
|
|
201
|
-
}, [(
|
|
202
|
-
width:
|
|
203
|
-
height:
|
|
211
|
+
}, [(_(), p("svg", {
|
|
212
|
+
width: x(w).width,
|
|
213
|
+
height: x(w).height,
|
|
204
214
|
class: "nb-chart__svg",
|
|
205
215
|
role: "img",
|
|
206
216
|
"aria-label": e.title || "Line chart",
|
|
207
217
|
onMouseleave: r[0] ||= (e) => Q.value = null,
|
|
208
|
-
onMousemove:
|
|
218
|
+
onMousemove: se
|
|
209
219
|
}, [
|
|
210
|
-
e.showGrid &&
|
|
220
|
+
e.showGrid && x(w).width > 0 ? (_(), p("g", j, [(_(!0), p(l, null, y(V.value, (e) => (_(), p("line", {
|
|
211
221
|
key: `grid-${e}`,
|
|
212
222
|
class: "nb-chart__gridline",
|
|
213
223
|
x1: g.left,
|
|
214
|
-
x2:
|
|
215
|
-
y1:
|
|
216
|
-
y2:
|
|
217
|
-
}, null, 8,
|
|
218
|
-
m("g",
|
|
224
|
+
x2: x(w).width - g.right,
|
|
225
|
+
y1: O.value(e),
|
|
226
|
+
y2: O.value(e)
|
|
227
|
+
}, null, 8, M))), 128))])) : f("", !0),
|
|
228
|
+
m("g", N, [(_(!0), p(l, null, y(V.value, (e) => (_(), p("text", {
|
|
219
229
|
key: `yt-${e}`,
|
|
220
230
|
x: g.left - 6,
|
|
221
|
-
y:
|
|
231
|
+
y: U(e),
|
|
222
232
|
"text-anchor": "end",
|
|
223
233
|
"dominant-baseline": "middle"
|
|
224
|
-
},
|
|
234
|
+
}, b(Z(e)), 9, P))), 128))]),
|
|
225
235
|
m("g", {
|
|
226
236
|
ref_key: "xAxis",
|
|
227
|
-
ref:
|
|
237
|
+
ref: K,
|
|
228
238
|
class: "nb-chart__axis"
|
|
229
|
-
}, [(
|
|
239
|
+
}, [(_(!0), p(l, null, y(re.value, (e, t) => (_(), p("text", {
|
|
230
240
|
key: `xt-${t}`,
|
|
231
241
|
x: e.x,
|
|
232
|
-
y:
|
|
242
|
+
y: x(w).height - g.bottom + 14,
|
|
233
243
|
"text-anchor": "middle"
|
|
234
|
-
},
|
|
244
|
+
}, b(e.value), 9, F))), 128))], 512),
|
|
235
245
|
m("line", {
|
|
236
246
|
class: "nb-chart__axis-line",
|
|
237
247
|
x1: g.left,
|
|
238
|
-
x2:
|
|
239
|
-
y1:
|
|
240
|
-
y2:
|
|
241
|
-
}, null, 8,
|
|
242
|
-
(
|
|
243
|
-
e.area ? (
|
|
248
|
+
x2: x(w).width - g.right,
|
|
249
|
+
y1: x(w).height - g.bottom,
|
|
250
|
+
y2: x(w).height - g.bottom
|
|
251
|
+
}, null, 8, I),
|
|
252
|
+
(_(!0), p(l, null, y(T.value, (t, n) => (_(), p("g", { key: `s-${n}` }, [
|
|
253
|
+
e.area ? (_(), p("path", {
|
|
244
254
|
key: 0,
|
|
245
255
|
class: "nb-chart__area",
|
|
246
|
-
d:
|
|
256
|
+
d: ae(t.data),
|
|
247
257
|
fill: t.color,
|
|
248
258
|
opacity: "0.18"
|
|
249
|
-
}, null, 8,
|
|
259
|
+
}, null, 8, L)) : f("", !0),
|
|
250
260
|
m("path", {
|
|
251
261
|
class: "nb-chart__line",
|
|
252
|
-
d:
|
|
262
|
+
d: ie(t.data),
|
|
253
263
|
stroke: t.color,
|
|
254
264
|
fill: "none",
|
|
255
265
|
"stroke-width": "2",
|
|
256
266
|
"stroke-linejoin": "round",
|
|
257
267
|
"stroke-linecap": "round"
|
|
258
|
-
}, null, 8,
|
|
259
|
-
e.points ? (
|
|
268
|
+
}, null, 8, R),
|
|
269
|
+
e.points ? (_(!0), p(l, { key: 1 }, y(t.data, (e, r) => (_(), p("circle", {
|
|
260
270
|
key: `p-${n}-${r}`,
|
|
261
|
-
cx:
|
|
262
|
-
cy:
|
|
271
|
+
cx: G(r),
|
|
272
|
+
cy: O.value(e.y),
|
|
263
273
|
r: Q.value === r ? 4 : 3,
|
|
264
274
|
fill: t.color,
|
|
265
275
|
class: "nb-chart__point"
|
|
266
|
-
}, null, 8,
|
|
276
|
+
}, null, 8, z))), 128)) : f("", !0)
|
|
267
277
|
]))), 128)),
|
|
268
|
-
Q.value === null ? f("", !0) : (
|
|
278
|
+
Q.value === null ? f("", !0) : (_(), p("line", {
|
|
269
279
|
key: 1,
|
|
270
280
|
class: "nb-chart__hover-line",
|
|
271
|
-
x1:
|
|
272
|
-
x2:
|
|
281
|
+
x1: G(Q.value),
|
|
282
|
+
x2: G(Q.value),
|
|
273
283
|
y1: g.top,
|
|
274
|
-
y2:
|
|
275
|
-
}, null, 8,
|
|
276
|
-
], 40,
|
|
284
|
+
y2: x(w).height - g.bottom
|
|
285
|
+
}, null, 8, B))
|
|
286
|
+
], 40, A)), h(n, {
|
|
277
287
|
visible: e.showTooltip && Q.value !== null,
|
|
278
288
|
x: $.value.x,
|
|
279
289
|
y: $.value.y,
|
|
280
|
-
title: Q.value === null ? "" : String(
|
|
281
|
-
rows:
|
|
290
|
+
title: Q.value === null ? "" : String(E.value[Q.value]),
|
|
291
|
+
rows: ce.value
|
|
282
292
|
}, null, 8, [
|
|
283
293
|
"visible",
|
|
284
294
|
"x",
|
|
@@ -294,6 +304,6 @@ var E = 6, D = 8, O = (e, t = E) => {
|
|
|
294
304
|
"show-legend"
|
|
295
305
|
]));
|
|
296
306
|
}
|
|
297
|
-
}), [["__scopeId", "data-v-
|
|
307
|
+
}), [["__scopeId", "data-v-9a4509a0"]]);
|
|
298
308
|
//#endregion
|
|
299
|
-
export {
|
|
309
|
+
export { V as t };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
require(`./chunk-D-qHiVGv.cjs`);const e=require(`./_plugin-vue_export-helper-tagjRzOz.cjs`),t=require(`./palette-BoABA-De.cjs`),n=require(`./ChartLegend-ndpGucTZ.cjs`),r=require(`./scales-BWtB8m5D.cjs`),i=require(`./useChartSize-D9UxUkiU.cjs`);let a=require(`vue`);var o=6,s=8,c=(e,t=o)=>{let n=[];if(e<=0)return n;let r=Math.max(1,Math.ceil(e/t));for(let t=0;t<e;t+=r)n.push(t);return n[n.length-1]!==e-1&&n.push(e-1),n},l=(e,t,n)=>{for(let r=1;r<e.length;r++){let i=e[r-1],a=e[r],o=i.x+t(i.index)/2;if(a.x-t(a.index)/2-o<n)return!1}return!0},u=(e,t,n)=>{if(n===void 0||t>=n)return e;let r=t/2;return Math.min(Math.max(e,r),n-r)},d=(e,t,n,r,i)=>{let a=e=>e.x===n(e.index)?r:i,o=e,s=o[o.length-1];return o.length>2&&!l(o.slice(-2),t,a(s))&&(o=[...o.slice(0,-2),s]),o.length>2&&!l(o.slice(0,2),t,a(o[0]))&&(o=[o[0],...o.slice(2)]),o},f=({count:e,positionOf:t,widthOf:n,width:r,gap:i=s})=>{let a=c(e);if(!n)return a.map(e=>({index:e,x:t(e)}));let f=e=>({index:e,x:u(t(e),n(e),r)}),p=d(a.map(f),n,t,-1/0,i);if(l(p,n,0))return p;let m=e-1,h=Math.max(1,Math.ceil(e/o))+1;for(let e=h;e<=m;e++){let r=[];for(let t=0;t<m;t+=e)r.push(t);let a=d([...r,m].map(f),n,t,i,i);if(l(a,n,i))return a}return[f(0)]},p=[`width`,`height`,`aria-label`],m={key:0},h=[`x1`,`x2`,`y1`,`y2`],g={class:`nb-chart__axis`},_=[`x`,`y`],v=[`x`,`y`],y=[`x1`,`x2`,`y1`,`y2`],b=[`d`,`fill`],x=[`d`,`stroke`],S=[`cx`,`cy`,`r`,`fill`],C=[`x1`,`x2`,`y1`,`y2`],w=(0,a.defineComponent)({__name:`LineChart`,props:{series:{default:()=>[]},area:{type:Boolean,default:!1},points:{type:Boolean,default:!1},curve:{default:`smooth`},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}},setup(e){let o=e,s={top:12,right:16,bottom:28,left:44},c=(0,a.ref)(null),l=i.t(c,{width:480,height:240}),u=(0,a.computed)(()=>o.series.map((e,n)=>({name:e.name,data:e.data,color:e.color??t.i(n,o.colors)}))),d=(0,a.computed)(()=>(o.series[0]?.data??[]).map(e=>e.x)),w=(0,a.computed)(()=>{let e=o.series.flatMap(e=>e.data.map(e=>e.y));return e.length?r.i(Math.min(0,...e),Math.max(...e),.1):[0,1]}),T=(0,a.computed)(()=>r.r(w.value,[Math.max(s.top,l.value.height-s.bottom),s.top])),E=(0,a.computed)(()=>T.value.ticks(5)),D=(0,a.ref)(7),O=e=>Math.max(T.value(e),D.value),k=(0,a.computed)(()=>Math.max(0,l.value.width-s.left-s.right)),A=e=>{let t=d.value.length;return t<=1?s.left+k.value/2:s.left+e/(t-1)*k.value},j=(0,a.ref)(null),M=(0,a.ref)(null),N=()=>{let e=j.value;if(!e||typeof document>`u`)return;let t=document.createElementNS(`http://www.w3.org/2000/svg`,`text`);if(typeof t.getComputedTextLength!=`function`)return;t.setAttribute(`visibility`,`hidden`),t.setAttribute(`aria-hidden`,`true`),e.appendChild(t);let n=new Map;for(let e of d.value){let r=(0,a.toDisplayString)(e);n.has(r)||(t.textContent=r,n.set(r,t.getComputedTextLength()))}if(typeof t.getBBox==`function`){t.setAttribute(`dominant-baseline`,`middle`),t.setAttribute(`y`,`0`),t.textContent=`0`;let e=-t.getBBox().y;e>0&&(D.value=e)}e.removeChild(t),M.value=n};(0,a.watch)(d,N,{flush:`post`});let P=typeof document>`u`?void 0:document.fonts;(0,a.onMounted)(()=>{N(),P?.addEventListener?.(`loadingdone`,N)}),(0,a.onBeforeUnmount)(()=>{P?.removeEventListener?.(`loadingdone`,N)});let F=(0,a.computed)(()=>{let e=d.value,t=M.value;return f({count:e.length,positionOf:A,widthOf:t?n=>t.get((0,a.toDisplayString)(e[n]))??0:void 0,width:l.value.width}).map(t=>({...t,value:e[t.index]}))}),I=e=>e.length?R(e.map((e,t)=>[A(t),T.value(e.y)]),o.curve):``,L=e=>{if(!e.length)return``;let t=e.map((e,t)=>[A(t),T.value(e.y)]),n=l.value.height-s.bottom;return`${R(t,o.curve)} L${t[t.length-1][0]},${n} L${t[0][0]},${n} Z`},R=(e,t)=>{if(!e.length)return``;if(e.length===1)return`M${e[0][0]},${e[0][1]}`;if(t===`linear`)return e.map((e,t)=>`${t===0?`M`:`L`}${e[0]},${e[1]}`).join(` `);if(t===`step`){let t=`M${e[0][0]},${e[0][1]}`;for(let n=1;n<e.length;n++){let[r,i]=e[n-1],[a,o]=e[n],s=(r+a)/2;t+=` L${s},${i} L${s},${o} L${a},${o}`}return t}let n=.2,r=`M${e[0][0]},${e[0][1]}`;for(let t=0;t<e.length-1;t++){let i=e[t-1]??e[t],a=e[t],o=e[t+1],s=e[t+2]??o,c=a[0]+(o[0]-i[0])*n,l=a[1]+(o[1]-i[1])*n,u=o[0]-(s[0]-a[0])*n,d=o[1]-(s[1]-a[1])*n;r+=` C${c},${l} ${u},${d} ${o[0]},${o[1]}`}return r},z=e=>Math.abs(e)>=1e3?`${(e/1e3).toFixed(1)}k`:Number.isInteger(e)?String(e):e.toFixed(1),B=e=>o.valueFormatter?o.valueFormatter(e):z(e),V=(0,a.ref)(null),H=(0,a.ref)({x:0,y:0}),U=e=>{let t=e.currentTarget.getBoundingClientRect(),n=e.clientX-t.left,r=d.value.length;if(!r)return;let i=(n-s.left)/Math.max(1,k.value);V.value=Math.round(Math.min(1,Math.max(0,i))*(r-1)),H.value={x:e.clientX-t.left+12,y:e.clientY-t.top+12}},W=(0,a.computed)(()=>V.value===null?[]:u.value.map(e=>{let t=e.data[V.value];return{label:e.name,value:t?.label??B(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&&u.value.length>0},{legend:(0,a.withCtx)(()=>[(0,a.createVNode)(n.t,{items:u.value.map(e=>({label:e.name,color:e.color}))},null,8,[`items`])]),default:(0,a.withCtx)(()=>[(0,a.createElementVNode)(`div`,{ref_key:`root`,ref:c,class:`nb-line-chart`},[((0,a.openBlock)(),(0,a.createElementBlock)(`svg`,{width:(0,a.unref)(l).width,height:(0,a.unref)(l).height,class:`nb-chart__svg`,role:`img`,"aria-label":e.title||`Line chart`,onMouseleave:i[0]||=e=>V.value=null,onMousemove:U},[e.showGrid&&(0,a.unref)(l).width>0?((0,a.openBlock)(),(0,a.createElementBlock)(`g`,m,[((0,a.openBlock)(!0),(0,a.createElementBlock)(a.Fragment,null,(0,a.renderList)(E.value,e=>((0,a.openBlock)(),(0,a.createElementBlock)(`line`,{key:`grid-${e}`,class:`nb-chart__gridline`,x1:s.left,x2:(0,a.unref)(l).width-s.right,y1:T.value(e),y2:T.value(e)},null,8,h))),128))])):(0,a.createCommentVNode)(``,!0),(0,a.createElementVNode)(`g`,g,[((0,a.openBlock)(!0),(0,a.createElementBlock)(a.Fragment,null,(0,a.renderList)(E.value,e=>((0,a.openBlock)(),(0,a.createElementBlock)(`text`,{key:`yt-${e}`,x:s.left-6,y:O(e),"text-anchor":`end`,"dominant-baseline":`middle`},(0,a.toDisplayString)(B(e)),9,_))),128))]),(0,a.createElementVNode)(`g`,{ref_key:`xAxis`,ref:j,class:`nb-chart__axis`},[((0,a.openBlock)(!0),(0,a.createElementBlock)(a.Fragment,null,(0,a.renderList)(F.value,(e,t)=>((0,a.openBlock)(),(0,a.createElementBlock)(`text`,{key:`xt-${t}`,x:e.x,y:(0,a.unref)(l).height-s.bottom+14,"text-anchor":`middle`},(0,a.toDisplayString)(e.value),9,v))),128))],512),(0,a.createElementVNode)(`line`,{class:`nb-chart__axis-line`,x1:s.left,x2:(0,a.unref)(l).width-s.right,y1:(0,a.unref)(l).height-s.bottom,y2:(0,a.unref)(l).height-s.bottom},null,8,y),((0,a.openBlock)(!0),(0,a.createElementBlock)(a.Fragment,null,(0,a.renderList)(u.value,(t,n)=>((0,a.openBlock)(),(0,a.createElementBlock)(`g`,{key:`s-${n}`},[e.area?((0,a.openBlock)(),(0,a.createElementBlock)(`path`,{key:0,class:`nb-chart__area`,d:L(t.data),fill:t.color,opacity:`0.18`},null,8,b)):(0,a.createCommentVNode)(``,!0),(0,a.createElementVNode)(`path`,{class:`nb-chart__line`,d:I(t.data),stroke:t.color,fill:`none`,"stroke-width":`2`,"stroke-linejoin":`round`,"stroke-linecap":`round`},null,8,x),e.points?((0,a.openBlock)(!0),(0,a.createElementBlock)(a.Fragment,{key:1},(0,a.renderList)(t.data,(e,r)=>((0,a.openBlock)(),(0,a.createElementBlock)(`circle`,{key:`p-${n}-${r}`,cx:A(r),cy:T.value(e.y),r:V.value===r?4:3,fill:t.color,class:`nb-chart__point`},null,8,S))),128)):(0,a.createCommentVNode)(``,!0)]))),128)),V.value===null?(0,a.createCommentVNode)(``,!0):((0,a.openBlock)(),(0,a.createElementBlock)(`line`,{key:1,class:`nb-chart__hover-line`,x1:A(V.value),x2:A(V.value),y1:s.top,y2:(0,a.unref)(l).height-s.bottom},null,8,C))],40,p)),(0,a.createVNode)(t.l,{visible:e.showTooltip&&V.value!==null,x:H.value.x,y:H.value.y,title:V.value===null?``:String(d.value[V.value]),rows:W.value},null,8,[`visible`,`x`,`y`,`title`,`rows`])],512)]),_:1},8,[`title`,`subtitle`,`height`,`show-legend`]))}}),T=e.t(w,[[`__scopeId`,`data-v-9a4509a0`]]);Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return T}});
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
require(`./chunk-D-qHiVGv.cjs`);const e=require(`./_plugin-vue_export-helper-tagjRzOz.cjs`),t=require(`./Grid-D8c0StGs.cjs`),n=require(`./Label-CVCNXFn1.cjs`),r=require(`./Message-VfpaGblO.cjs`);let i=require(`vue`);var a={key:0,class:`nb-text-input__overlay-wrap`},o=[`innerHTML`],s=[`id`,`value`,`placeholder`,`disabled`,`readonly`,`name`,`maxlength`],c=[`id`,`value`,`placeholder`,`disabled`,`readonly`,`name`,`maxlength`],l=[`id`,`placeholder`,`disabled`,`readonly`,`name`,`maxlength`,`rows`],u=[`id`,`type`,`placeholder`,`disabled`,`readonly`,`required`,`name`,`min`,`max`,`step`,`maxlength`],d={key:2,class:`nb-text-input__actions`},f={key:0,class:`nb-text-input__inner-header`},p=[`for`],m={key:0,class:`nb-text-input__asterisk`,"aria-hidden":`true`},h=[`id`,`type`,`placeholder`,`disabled`,`readonly`,`required`,`name`,`min`,`max`,`step`,`maxlength`],g=(0,i.defineComponent)({inheritAttrs:!1,__name:`TextInput`,props:(0,i.mergeModels)({type:{default:`text`},min:{default:void 0},max:{default:void 0},step:{default:void 0},maxlength:{default:void 0},multiline:{type:Boolean,default:!1},rows:{default:3},highlight:{type:Function,default:void 0},readonly:{type:Boolean,default:!1},placeholder:{default:``},name:{default:``},disabled:{type:Boolean,default:!1},required:{type:Boolean,default:!1},id:{default:void 0},label:{default:``},error:{default:``},warning:{default:``},helper:{default:``},variant:{default:`default`},size:{default:`md`}},{modelValue:{default:``},modelModifiers:{}}),emits:[`update:modelValue`],setup(e,{expose:g}){let _=e,v=(0,i.useModel)(e,`modelValue`),y=(0,i.ref)(null),b=(0,i.ref)(null);g({focus:()=>y.value?.focus(),blur:()=>y.value?.blur(),nativeEl:y});let x=(0,i.ref)(!1),S=`nb-input-${(0,i.useId)()}`,C=(0,i.computed)(()=>_.id??S),w=(0,i.computed)(()=>!!_.highlight),T=(0,i.computed)(()=>{if(!_.highlight)return``;let e=String(v.value??``);return _.highlight(e)+`
|
|
2
|
-
`});function E(){b.value&&y.value&&(b.value.scrollTop=y.value.scrollTop)}(0,i.watch)(T,()=>(0,i.nextTick)(E));let D=(0,i.computed)(()=>_.error?`error`:_.warning?`warning`:`helper`),O=(0,i.computed)(()=>_.error||_.warning||_.helper||``),k=(0,i.computed)(()=>!!O.value),A=(0,i.computed)(()=>({"nb-text-input__field-wrapper--focused":x.value,"nb-text-input__field-wrapper--error":!!_.error,"nb-text-input__field-wrapper--warning":!_.error&&!!_.warning,"nb-text-input__field-wrapper--disabled":_.disabled,"nb-text-input__field-wrapper--readonly":_.readonly,"nb-text-input__field-wrapper--overlay":w.value,"nb-text-input__field-wrapper--multiline":_.multiline}));return(g,_)=>((0,i.openBlock)(),(0,i.createBlock)(t.t,{dir:`col`,class:(0,i.normalizeClass)([`nb-text-input`,`nb-text-input--${e.variant}`,`nb-text-input--${e.size}`,{"nb-text-input--multiline":e.multiline}])},{default:(0,i.withCtx)(()=>[e.variant===`default`?((0,i.openBlock)(),(0,i.createElementBlock)(i.Fragment,{key:0},[g.$slots.label?(0,i.renderSlot)(g.$slots,`label`,{key:0},void 0,!0):e.label?((0,i.openBlock)(),(0,i.createBlock)(n.t,{key:1,for:C.value,required:e.required,disabled:e.disabled},{default:(0,i.withCtx)(()=>[(0,i.createTextVNode)((0,i.toDisplayString)(e.label),1)]),_:1},8,[`for`,`required`,`disabled`])):(0,i.createCommentVNode)(``,!0),(0,i.createElementVNode)(`div`,{class:(0,i.normalizeClass)([`nb-text-input__field-wrapper`,A.value])},[(0,i.renderSlot)(g.$slots,`leading`,{},void 0,!0),w.value?((0,i.openBlock)(),(0,i.createElementBlock)(`div`,a,[(0,i.createElementVNode)(`div`,{ref_key:`mirrorRef`,ref:b,class:`nb-text-input__mirror`,"aria-hidden":`true`,innerHTML:T.value},null,8,o),e.multiline?((0,i.openBlock)(),(0,i.createElementBlock)(`textarea`,(0,i.mergeProps)({key:0,id:C.value,ref_key:`nativeRef`,ref:y},g.$attrs,{class:`nb-text-input__field--transparent`,value:v.value,placeholder:e.placeholder,disabled:e.disabled,readonly:e.readonly,name:e.name,maxlength:e.maxlength,spellcheck:`false`,autocomplete:`off`,autocorrect:`off`,onInput:_[0]||=e=>v.value=e.target.value,onFocus:_[1]||=e=>x.value=!0,onBlur:_[2]||=e=>x.value=!1,onScroll:E}),null,16,s)):((0,i.openBlock)(),(0,i.createElementBlock)(`input`,(0,i.mergeProps)({key:1,id:C.value,ref_key:`nativeRef`,ref:y},g.$attrs,{type:`text`,class:`nb-text-input__field--transparent`,value:v.value,placeholder:e.placeholder,disabled:e.disabled,readonly:e.readonly,name:e.name,maxlength:e.maxlength,spellcheck:`false`,onInput:_[3]||=e=>v.value=e.target.value,onFocus:_[4]||=e=>x.value=!0,onBlur:_[5]||=e=>x.value=!1}),null,16,c))])):((0,i.openBlock)(),(0,i.createElementBlock)(i.Fragment,{key:1},[e.multiline?(0,i.withDirectives)(((0,i.openBlock)(),(0,i.createElementBlock)(`textarea`,(0,i.mergeProps)({key:0,id:C.value,ref_key:`nativeRef`,ref:y},g.$attrs,{"onUpdate:modelValue":_[6]||=e=>v.value=e,class:`nb-text-input__field`,placeholder:e.placeholder,disabled:e.disabled,readonly:e.readonly,name:e.name,maxlength:e.maxlength,rows:e.rows,onFocus:_[7]||=e=>x.value=!0,onBlur:_[8]||=e=>x.value=!1}),null,16,l)),[[i.vModelText,v.value]]):(0,i.withDirectives)(((0,i.openBlock)(),(0,i.createElementBlock)(`input`,(0,i.mergeProps)({key:1,id:C.value,ref_key:`nativeRef`,ref:y},g.$attrs,{"onUpdate:modelValue":_[9]||=e=>v.value=e,class:`nb-text-input__field`,type:e.type,placeholder:e.placeholder,disabled:e.disabled,readonly:e.readonly,required:e.required,name:e.name,min:e.min,max:e.max,step:e.step,maxlength:e.maxlength,onFocus:_[10]||=e=>x.value=!0,onBlur:_[11]||=e=>x.value=!1}),null,16,u)),[[i.vModelDynamic,v.value]])],64)),(0,i.renderSlot)(g.$slots,`trailing`,{},void 0,!0),g.$slots.actions?((0,i.openBlock)(),(0,i.createElementBlock)(`div`,d,[(0,i.renderSlot)(g.$slots,`actions`,{},void 0,!0)])):(0,i.createCommentVNode)(``,!0)],2),k.value?((0,i.openBlock)(),(0,i.createBlock)(r.t,{key:2,variant:D.value,class:`nb-text-input__message`},{default:(0,i.withCtx)(()=>[(0,i.createTextVNode)((0,i.toDisplayString)(O.value),1)]),_:1},8,[`variant`])):(0,i.createCommentVNode)(``,!0),(0,i.renderSlot)(g.$slots,`dropdown`,{},void 0,!0)],64)):e.variant===`fluid`?((0,i.openBlock)(),(0,i.createElementBlock)(`div`,{key:1,class:(0,i.normalizeClass)([`nb-text-input__field-wrapper`,A.value])},[e.label||g.$slots.label?((0,i.openBlock)(),(0,i.createElementBlock)(`div`,f,[g.$slots.label?(0,i.renderSlot)(g.$slots,`label`,{key:0},void 0,!0):((0,i.openBlock)(),(0,i.createElementBlock)(`label`,{key:1,for:C.value,class:(0,i.normalizeClass)([`nb-text-input__inner-label`,{"nb-text-input__inner-label--required":e.required}])},[(0,i.createTextVNode)((0,i.toDisplayString)(e.label)+` `,1),e.required?((0,i.openBlock)(),(0,i.createElementBlock)(`span`,m,`*`)):(0,i.createCommentVNode)(``,!0)],10,p)),k.value?((0,i.openBlock)(),(0,i.createBlock)(r.t,{key:2,variant:D.value,"icon-only":``,class:`nb-text-input__inner-message`},{default:(0,i.withCtx)(()=>[(0,i.createTextVNode)((0,i.toDisplayString)(O.value),1)]),_:1},8,[`variant`])):(0,i.createCommentVNode)(``,!0)])):(0,i.createCommentVNode)(``,!0),(0,i.withDirectives)((0,i.createElementVNode)(`input`,(0,i.mergeProps)({id:C.value,ref_key:`nativeRef`,ref:y},g.$attrs,{"onUpdate:modelValue":_[12]||=e=>v.value=e,class:`nb-text-input__field`,type:e.type,placeholder:e.placeholder,disabled:e.disabled,readonly:e.readonly,required:e.required,name:e.name,min:e.min,max:e.max,step:e.step,maxlength:e.maxlength,onFocus:_[13]||=e=>x.value=!0,onBlur:_[14]||=e=>x.value=!1}),null,16,h),[[i.vModelDynamic,v.value]])],2)):(0,i.createCommentVNode)(``,!0)]),_:3},8,[`class`]))}}),_=e.t(g,[[`__scopeId`,`data-v-
|
|
2
|
+
`});function E(){b.value&&y.value&&(b.value.scrollTop=y.value.scrollTop)}(0,i.watch)(T,()=>(0,i.nextTick)(E));let D=(0,i.computed)(()=>_.error?`error`:_.warning?`warning`:`helper`),O=(0,i.computed)(()=>_.error||_.warning||_.helper||``),k=(0,i.computed)(()=>!!O.value),A=(0,i.computed)(()=>({"nb-text-input__field-wrapper--focused":x.value,"nb-text-input__field-wrapper--error":!!_.error,"nb-text-input__field-wrapper--warning":!_.error&&!!_.warning,"nb-text-input__field-wrapper--disabled":_.disabled,"nb-text-input__field-wrapper--readonly":_.readonly,"nb-text-input__field-wrapper--overlay":w.value,"nb-text-input__field-wrapper--multiline":_.multiline}));return(g,_)=>((0,i.openBlock)(),(0,i.createBlock)(t.t,{dir:`col`,class:(0,i.normalizeClass)([`nb-text-input`,`nb-text-input--${e.variant}`,`nb-text-input--${e.size}`,{"nb-text-input--multiline":e.multiline}])},{default:(0,i.withCtx)(()=>[e.variant===`default`?((0,i.openBlock)(),(0,i.createElementBlock)(i.Fragment,{key:0},[g.$slots.label?(0,i.renderSlot)(g.$slots,`label`,{key:0},void 0,!0):e.label?((0,i.openBlock)(),(0,i.createBlock)(n.t,{key:1,for:C.value,required:e.required,disabled:e.disabled},{default:(0,i.withCtx)(()=>[(0,i.createTextVNode)((0,i.toDisplayString)(e.label),1)]),_:1},8,[`for`,`required`,`disabled`])):(0,i.createCommentVNode)(``,!0),(0,i.createElementVNode)(`div`,{class:(0,i.normalizeClass)([`nb-text-input__field-wrapper`,A.value])},[(0,i.renderSlot)(g.$slots,`leading`,{},void 0,!0),w.value?((0,i.openBlock)(),(0,i.createElementBlock)(`div`,a,[(0,i.createElementVNode)(`div`,{ref_key:`mirrorRef`,ref:b,class:`nb-text-input__mirror`,"aria-hidden":`true`,innerHTML:T.value},null,8,o),e.multiline?((0,i.openBlock)(),(0,i.createElementBlock)(`textarea`,(0,i.mergeProps)({key:0,id:C.value,ref_key:`nativeRef`,ref:y},g.$attrs,{class:`nb-text-input__field--transparent`,value:v.value,placeholder:e.placeholder,disabled:e.disabled,readonly:e.readonly,name:e.name,maxlength:e.maxlength,spellcheck:`false`,autocomplete:`off`,autocorrect:`off`,onInput:_[0]||=e=>v.value=e.target.value,onFocus:_[1]||=e=>x.value=!0,onBlur:_[2]||=e=>x.value=!1,onScroll:E}),null,16,s)):((0,i.openBlock)(),(0,i.createElementBlock)(`input`,(0,i.mergeProps)({key:1,id:C.value,ref_key:`nativeRef`,ref:y},g.$attrs,{type:`text`,class:`nb-text-input__field--transparent`,value:v.value,placeholder:e.placeholder,disabled:e.disabled,readonly:e.readonly,name:e.name,maxlength:e.maxlength,spellcheck:`false`,onInput:_[3]||=e=>v.value=e.target.value,onFocus:_[4]||=e=>x.value=!0,onBlur:_[5]||=e=>x.value=!1}),null,16,c))])):((0,i.openBlock)(),(0,i.createElementBlock)(i.Fragment,{key:1},[e.multiline?(0,i.withDirectives)(((0,i.openBlock)(),(0,i.createElementBlock)(`textarea`,(0,i.mergeProps)({key:0,id:C.value,ref_key:`nativeRef`,ref:y},g.$attrs,{"onUpdate:modelValue":_[6]||=e=>v.value=e,class:`nb-text-input__field`,placeholder:e.placeholder,disabled:e.disabled,readonly:e.readonly,name:e.name,maxlength:e.maxlength,rows:e.rows,onFocus:_[7]||=e=>x.value=!0,onBlur:_[8]||=e=>x.value=!1}),null,16,l)),[[i.vModelText,v.value]]):(0,i.withDirectives)(((0,i.openBlock)(),(0,i.createElementBlock)(`input`,(0,i.mergeProps)({key:1,id:C.value,ref_key:`nativeRef`,ref:y},g.$attrs,{"onUpdate:modelValue":_[9]||=e=>v.value=e,class:`nb-text-input__field`,type:e.type,placeholder:e.placeholder,disabled:e.disabled,readonly:e.readonly,required:e.required,name:e.name,min:e.min,max:e.max,step:e.step,maxlength:e.maxlength,onFocus:_[10]||=e=>x.value=!0,onBlur:_[11]||=e=>x.value=!1}),null,16,u)),[[i.vModelDynamic,v.value]])],64)),(0,i.renderSlot)(g.$slots,`trailing`,{},void 0,!0),g.$slots.actions?((0,i.openBlock)(),(0,i.createElementBlock)(`div`,d,[(0,i.renderSlot)(g.$slots,`actions`,{},void 0,!0)])):(0,i.createCommentVNode)(``,!0)],2),k.value?((0,i.openBlock)(),(0,i.createBlock)(r.t,{key:2,variant:D.value,class:`nb-text-input__message`},{default:(0,i.withCtx)(()=>[(0,i.createTextVNode)((0,i.toDisplayString)(O.value),1)]),_:1},8,[`variant`])):(0,i.createCommentVNode)(``,!0),(0,i.renderSlot)(g.$slots,`dropdown`,{},void 0,!0)],64)):e.variant===`fluid`?((0,i.openBlock)(),(0,i.createElementBlock)(`div`,{key:1,class:(0,i.normalizeClass)([`nb-text-input__field-wrapper`,A.value])},[e.label||g.$slots.label?((0,i.openBlock)(),(0,i.createElementBlock)(`div`,f,[g.$slots.label?(0,i.renderSlot)(g.$slots,`label`,{key:0},void 0,!0):((0,i.openBlock)(),(0,i.createElementBlock)(`label`,{key:1,for:C.value,class:(0,i.normalizeClass)([`nb-text-input__inner-label`,{"nb-text-input__inner-label--required":e.required}])},[(0,i.createTextVNode)((0,i.toDisplayString)(e.label)+` `,1),e.required?((0,i.openBlock)(),(0,i.createElementBlock)(`span`,m,`*`)):(0,i.createCommentVNode)(``,!0)],10,p)),k.value?((0,i.openBlock)(),(0,i.createBlock)(r.t,{key:2,variant:D.value,"icon-only":``,class:`nb-text-input__inner-message`},{default:(0,i.withCtx)(()=>[(0,i.createTextVNode)((0,i.toDisplayString)(O.value),1)]),_:1},8,[`variant`])):(0,i.createCommentVNode)(``,!0)])):(0,i.createCommentVNode)(``,!0),(0,i.withDirectives)((0,i.createElementVNode)(`input`,(0,i.mergeProps)({id:C.value,ref_key:`nativeRef`,ref:y},g.$attrs,{"onUpdate:modelValue":_[12]||=e=>v.value=e,class:`nb-text-input__field`,type:e.type,placeholder:e.placeholder,disabled:e.disabled,readonly:e.readonly,required:e.required,name:e.name,min:e.min,max:e.max,step:e.step,maxlength:e.maxlength,onFocus:_[13]||=e=>x.value=!0,onBlur:_[14]||=e=>x.value=!1}),null,16,h),[[i.vModelDynamic,v.value]])],2)):(0,i.createCommentVNode)(``,!0)]),_:3},8,[`class`]))}}),_=e.t(g,[[`__scopeId`,`data-v-2e908d7d`]]);Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return _}});
|