@nubisco/ui 5.25.0 → 5.25.2

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.
Files changed (41) hide show
  1. package/dist/{AiProvider-BVT_8D6a.js → AiProvider-B4salihw.js} +2 -2
  2. package/dist/{AiProvider-BXWMTzi9.cjs → AiProvider-pHIvM5zN.cjs} +1 -1
  3. package/dist/{Confirm-CHsxP6G_.js → Confirm-DQqArhXl.js} +1 -1
  4. package/dist/{Confirm--cR6XRZQ.cjs → Confirm-YhMEfWX5.cjs} +1 -1
  5. package/dist/{Field-LiiMobFy.js → Field-DCEukL3E.js} +1 -1
  6. package/dist/{Field-DznERREe.cjs → Field-M289tArC.cjs} +1 -1
  7. package/dist/LineChart-CKGlZDLI.js +309 -0
  8. package/dist/LineChart-CjlCW-us.cjs +1 -0
  9. package/dist/{TextInput-BkCOQWfT.cjs → TextInput-DmCYZgG0.cjs} +1 -1
  10. package/dist/{TextInput-Kt2ciMVI.js → TextInput-HwIhSOJD.js} +1 -1
  11. package/dist/all.cjs +1 -1
  12. package/dist/all.mjs +5 -5
  13. package/dist/components/AiProvider.cjs +1 -1
  14. package/dist/components/AiProvider.mjs +1 -1
  15. package/dist/components/Charts/LineChart.cjs +1 -1
  16. package/dist/components/Charts/LineChart.mjs +1 -1
  17. package/dist/components/Charts/LineChart.vue.d.ts.map +1 -1
  18. package/dist/components/Charts/shared/xLabels.d.ts +16 -0
  19. package/dist/components/Charts/shared/xLabels.d.ts.map +1 -0
  20. package/dist/components/Confirm.cjs +1 -1
  21. package/dist/components/Confirm.mjs +1 -1
  22. package/dist/components/DatePicker.vue.d.ts.map +1 -1
  23. package/dist/components/Field.cjs +1 -1
  24. package/dist/components/Field.mjs +1 -1
  25. package/dist/components/Field.vue.d.ts.map +1 -1
  26. package/dist/components/TextInput.cjs +1 -1
  27. package/dist/components/TextInput.mjs +1 -1
  28. package/dist/components/TextInput.vue.d.ts.map +1 -1
  29. package/dist/composables/useConfirm.composable.cjs +1 -1
  30. package/dist/composables/useConfirm.composable.mjs +1 -1
  31. package/dist/index.cjs +1 -1
  32. package/dist/index.mjs +5 -5
  33. package/dist/styles/DatePicker.css +1 -1
  34. package/dist/styles/Field.css +1 -1
  35. package/dist/styles/LineChart.css +1 -1
  36. package/dist/styles/TextInput.css +1 -1
  37. package/dist/ui.css +4 -4
  38. package/package.json +1 -1
  39. package/src/styles/_appearance.scss +3 -1
  40. package/dist/LineChart-BE5DVpYZ.js +0 -241
  41. package/dist/LineChart-Dt7wwxeW.cjs +0 -1
@@ -1,241 +0,0 @@
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-VMXxKICH.js";
3
- import { t as a } from "./ChartLegend-BtBKVnH3.js";
4
- import { i as o, r as s } from "./scales-DVJzRU1F.js";
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, openBlock as _, ref as v, renderList as y, toDisplayString as b, unref as x, withCtx as S } from "vue";
7
- //#region src/components/Charts/LineChart.vue?vue&type=script&setup=true&lang.ts
8
- var C = [
9
- "width",
10
- "height",
11
- "aria-label"
12
- ], w = { key: 0 }, T = [
13
- "x1",
14
- "x2",
15
- "y1",
16
- "y2"
17
- ], E = { class: "nb-chart__axis" }, D = ["x", "y"], O = { class: "nb-chart__axis" }, k = ["x", "y"], A = [
18
- "x1",
19
- "x2",
20
- "y1",
21
- "y2"
22
- ], j = ["d", "fill"], M = ["d", "stroke"], N = [
23
- "cx",
24
- "cy",
25
- "r",
26
- "fill"
27
- ], P = [
28
- "x1",
29
- "x2",
30
- "y1",
31
- "y2"
32
- ], F = /* @__PURE__ */ e(/* @__PURE__ */ g({
33
- __name: "LineChart",
34
- props: {
35
- series: { default: () => [] },
36
- area: {
37
- type: Boolean,
38
- default: !1
39
- },
40
- points: {
41
- type: Boolean,
42
- default: !1
43
- },
44
- curve: { default: "smooth" },
45
- valueFormatter: {},
46
- title: { default: void 0 },
47
- subtitle: { default: void 0 },
48
- height: { default: 280 },
49
- showLegend: {
50
- type: Boolean,
51
- default: !0
52
- },
53
- showTooltip: {
54
- type: Boolean,
55
- default: !0
56
- },
57
- showGrid: {
58
- type: Boolean,
59
- default: !0
60
- },
61
- colors: { default: () => r }
62
- },
63
- setup(e) {
64
- let r = e, g = {
65
- top: 12,
66
- right: 16,
67
- bottom: 28,
68
- left: 44
69
- }, F = v(null), I = c(F, {
70
- width: 480,
71
- height: 240
72
- }), L = u(() => r.series.map((e, n) => ({
73
- name: e.name,
74
- data: e.data,
75
- color: e.color ?? t(n, r.colors)
76
- }))), R = u(() => (r.series[0]?.data ?? []).map((e) => e.x)), z = u(() => {
77
- let e = r.series.flatMap((e) => e.data.map((e) => e.y));
78
- return e.length ? o(Math.min(0, ...e), Math.max(...e), .1) : [0, 1];
79
- }), B = u(() => s(z.value, [Math.max(g.top, I.value.height - g.bottom), g.top])), V = u(() => B.value.ticks(5)), H = u(() => Math.max(0, I.value.width - g.left - g.right)), U = (e) => {
80
- let t = R.value.length;
81
- return t <= 1 ? g.left + H.value / 2 : g.left + e / (t - 1) * H.value;
82
- }, W = u(() => {
83
- let e = R.value, t = Math.max(1, Math.ceil(e.length / 6)), n = [];
84
- for (let r = 0; r < e.length; r += t) n.push({
85
- index: r,
86
- value: e[r]
87
- });
88
- return e.length && n[n.length - 1].index !== e.length - 1 && n.push({
89
- index: e.length - 1,
90
- value: e[e.length - 1]
91
- }), n;
92
- }), G = (e) => e.length ? q(e.map((e, t) => [U(t), B.value(e.y)]), r.curve) : "", K = (e) => {
93
- if (!e.length) return "";
94
- let t = e.map((e, t) => [U(t), B.value(e.y)]), n = I.value.height - g.bottom;
95
- return `${q(t, r.curve)} L${t[t.length - 1][0]},${n} L${t[0][0]},${n} Z`;
96
- }, q = (e, t) => {
97
- if (!e.length) return "";
98
- if (e.length === 1) return `M${e[0][0]},${e[0][1]}`;
99
- if (t === "linear") return e.map((e, t) => `${t === 0 ? "M" : "L"}${e[0]},${e[1]}`).join(" ");
100
- if (t === "step") {
101
- let t = `M${e[0][0]},${e[0][1]}`;
102
- for (let n = 1; n < e.length; n++) {
103
- let [r, i] = e[n - 1], [a, o] = e[n], s = (r + a) / 2;
104
- t += ` L${s},${i} L${s},${o} L${a},${o}`;
105
- }
106
- return t;
107
- }
108
- let n = .2, r = `M${e[0][0]},${e[0][1]}`;
109
- for (let t = 0; t < e.length - 1; t++) {
110
- 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;
111
- r += ` C${c},${l} ${u},${d} ${o[0]},${o[1]}`;
112
- }
113
- return r;
114
- }, J = (e) => Math.abs(e) >= 1e3 ? `${(e / 1e3).toFixed(1)}k` : Number.isInteger(e) ? String(e) : e.toFixed(1), Y = (e) => r.valueFormatter ? r.valueFormatter(e) : J(e), X = v(null), Z = v({
115
- x: 0,
116
- y: 0
117
- }), Q = (e) => {
118
- let t = e.currentTarget.getBoundingClientRect(), n = e.clientX - t.left, r = R.value.length;
119
- if (!r) return;
120
- let i = (n - g.left) / Math.max(1, H.value);
121
- X.value = Math.round(Math.min(1, Math.max(0, i)) * (r - 1)), Z.value = {
122
- x: e.clientX - t.left + 12,
123
- y: e.clientY - t.top + 12
124
- };
125
- }, $ = u(() => X.value === null ? [] : L.value.map((e) => {
126
- let t = e.data[X.value];
127
- return {
128
- label: e.name,
129
- value: t?.label ?? Y(t?.y ?? 0),
130
- color: e.color
131
- };
132
- }));
133
- return (t, r) => (_(), d(i, {
134
- title: e.title,
135
- subtitle: e.subtitle,
136
- height: e.height,
137
- "show-legend": e.showLegend && L.value.length > 0
138
- }, {
139
- legend: S(() => [h(a, { items: L.value.map((e) => ({
140
- label: e.name,
141
- color: e.color
142
- })) }, null, 8, ["items"])]),
143
- default: S(() => [m("div", {
144
- ref_key: "root",
145
- ref: F,
146
- class: "nb-line-chart"
147
- }, [(_(), p("svg", {
148
- width: x(I).width,
149
- height: x(I).height,
150
- class: "nb-chart__svg",
151
- role: "img",
152
- "aria-label": e.title || "Line chart",
153
- onMouseleave: r[0] ||= (e) => X.value = null,
154
- onMousemove: Q
155
- }, [
156
- e.showGrid && x(I).width > 0 ? (_(), p("g", w, [(_(!0), p(l, null, y(V.value, (e) => (_(), p("line", {
157
- key: `grid-${e}`,
158
- class: "nb-chart__gridline",
159
- x1: g.left,
160
- x2: x(I).width - g.right,
161
- y1: B.value(e),
162
- y2: B.value(e)
163
- }, null, 8, T))), 128))])) : f("", !0),
164
- m("g", E, [(_(!0), p(l, null, y(V.value, (e) => (_(), p("text", {
165
- key: `yt-${e}`,
166
- x: g.left - 6,
167
- y: B.value(e),
168
- "text-anchor": "end",
169
- "dominant-baseline": "middle"
170
- }, b(Y(e)), 9, D))), 128))]),
171
- m("g", O, [(_(!0), p(l, null, y(W.value, (e, t) => (_(), p("text", {
172
- key: `xt-${t}`,
173
- x: U(e.index),
174
- y: x(I).height - g.bottom + 14,
175
- "text-anchor": "middle"
176
- }, b(e.value), 9, k))), 128))]),
177
- m("line", {
178
- class: "nb-chart__axis-line",
179
- x1: g.left,
180
- x2: x(I).width - g.right,
181
- y1: x(I).height - g.bottom,
182
- y2: x(I).height - g.bottom
183
- }, null, 8, A),
184
- (_(!0), p(l, null, y(L.value, (t, n) => (_(), p("g", { key: `s-${n}` }, [
185
- e.area ? (_(), p("path", {
186
- key: 0,
187
- class: "nb-chart__area",
188
- d: K(t.data),
189
- fill: t.color,
190
- opacity: "0.18"
191
- }, null, 8, j)) : f("", !0),
192
- m("path", {
193
- class: "nb-chart__line",
194
- d: G(t.data),
195
- stroke: t.color,
196
- fill: "none",
197
- "stroke-width": "2",
198
- "stroke-linejoin": "round",
199
- "stroke-linecap": "round"
200
- }, null, 8, M),
201
- e.points ? (_(!0), p(l, { key: 1 }, y(t.data, (e, r) => (_(), p("circle", {
202
- key: `p-${n}-${r}`,
203
- cx: U(r),
204
- cy: B.value(e.y),
205
- r: X.value === r ? 4 : 3,
206
- fill: t.color,
207
- class: "nb-chart__point"
208
- }, null, 8, N))), 128)) : f("", !0)
209
- ]))), 128)),
210
- X.value === null ? f("", !0) : (_(), p("line", {
211
- key: 1,
212
- class: "nb-chart__hover-line",
213
- x1: U(X.value),
214
- x2: U(X.value),
215
- y1: g.top,
216
- y2: x(I).height - g.bottom
217
- }, null, 8, P))
218
- ], 40, C)), h(n, {
219
- visible: e.showTooltip && X.value !== null,
220
- x: Z.value.x,
221
- y: Z.value.y,
222
- title: X.value === null ? "" : String(R.value[X.value]),
223
- rows: $.value
224
- }, null, 8, [
225
- "visible",
226
- "x",
227
- "y",
228
- "title",
229
- "rows"
230
- ])], 512)]),
231
- _: 1
232
- }, 8, [
233
- "title",
234
- "subtitle",
235
- "height",
236
- "show-legend"
237
- ]));
238
- }
239
- }), [["__scopeId", "data-v-90bf8144"]]);
240
- //#endregion
241
- export { F as t };
@@ -1 +0,0 @@
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=[`width`,`height`,`aria-label`],s={key:0},c=[`x1`,`x2`,`y1`,`y2`],l={class:`nb-chart__axis`},u=[`x`,`y`],d={class:`nb-chart__axis`},f=[`x`,`y`],p=[`x1`,`x2`,`y1`,`y2`],m=[`d`,`fill`],h=[`d`,`stroke`],g=[`cx`,`cy`,`r`,`fill`],_=[`x1`,`x2`,`y1`,`y2`],v=(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 v=e,y={top:12,right:16,bottom:28,left:44},b=(0,a.ref)(null),x=i.t(b,{width:480,height:240}),S=(0,a.computed)(()=>v.series.map((e,n)=>({name:e.name,data:e.data,color:e.color??t.i(n,v.colors)}))),C=(0,a.computed)(()=>(v.series[0]?.data??[]).map(e=>e.x)),w=(0,a.computed)(()=>{let e=v.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(y.top,x.value.height-y.bottom),y.top])),E=(0,a.computed)(()=>T.value.ticks(5)),D=(0,a.computed)(()=>Math.max(0,x.value.width-y.left-y.right)),O=e=>{let t=C.value.length;return t<=1?y.left+D.value/2:y.left+e/(t-1)*D.value},k=(0,a.computed)(()=>{let e=C.value,t=Math.max(1,Math.ceil(e.length/6)),n=[];for(let r=0;r<e.length;r+=t)n.push({index:r,value:e[r]});return e.length&&n[n.length-1].index!==e.length-1&&n.push({index:e.length-1,value:e[e.length-1]}),n}),A=e=>e.length?M(e.map((e,t)=>[O(t),T.value(e.y)]),v.curve):``,j=e=>{if(!e.length)return``;let t=e.map((e,t)=>[O(t),T.value(e.y)]),n=x.value.height-y.bottom;return`${M(t,v.curve)} L${t[t.length-1][0]},${n} L${t[0][0]},${n} Z`},M=(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},N=e=>Math.abs(e)>=1e3?`${(e/1e3).toFixed(1)}k`:Number.isInteger(e)?String(e):e.toFixed(1),P=e=>v.valueFormatter?v.valueFormatter(e):N(e),F=(0,a.ref)(null),I=(0,a.ref)({x:0,y:0}),L=e=>{let t=e.currentTarget.getBoundingClientRect(),n=e.clientX-t.left,r=C.value.length;if(!r)return;let i=(n-y.left)/Math.max(1,D.value);F.value=Math.round(Math.min(1,Math.max(0,i))*(r-1)),I.value={x:e.clientX-t.left+12,y:e.clientY-t.top+12}},R=(0,a.computed)(()=>F.value===null?[]:S.value.map(e=>{let t=e.data[F.value];return{label:e.name,value:t?.label??P(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&&S.value.length>0},{legend:(0,a.withCtx)(()=>[(0,a.createVNode)(n.t,{items:S.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-line-chart`},[((0,a.openBlock)(),(0,a.createElementBlock)(`svg`,{width:(0,a.unref)(x).width,height:(0,a.unref)(x).height,class:`nb-chart__svg`,role:`img`,"aria-label":e.title||`Line chart`,onMouseleave:i[0]||=e=>F.value=null,onMousemove:L},[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)(E.value,e=>((0,a.openBlock)(),(0,a.createElementBlock)(`line`,{key:`grid-${e}`,class:`nb-chart__gridline`,x1:y.left,x2:(0,a.unref)(x).width-y.right,y1:T.value(e),y2:T.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)(E.value,e=>((0,a.openBlock)(),(0,a.createElementBlock)(`text`,{key:`yt-${e}`,x:y.left-6,y:T.value(e),"text-anchor":`end`,"dominant-baseline":`middle`},(0,a.toDisplayString)(P(e)),9,u))),128))]),(0,a.createElementVNode)(`g`,d,[((0,a.openBlock)(!0),(0,a.createElementBlock)(a.Fragment,null,(0,a.renderList)(k.value,(e,t)=>((0,a.openBlock)(),(0,a.createElementBlock)(`text`,{key:`xt-${t}`,x:O(e.index),y:(0,a.unref)(x).height-y.bottom+14,"text-anchor":`middle`},(0,a.toDisplayString)(e.value),9,f))),128))]),(0,a.createElementVNode)(`line`,{class:`nb-chart__axis-line`,x1:y.left,x2:(0,a.unref)(x).width-y.right,y1:(0,a.unref)(x).height-y.bottom,y2:(0,a.unref)(x).height-y.bottom},null,8,p),((0,a.openBlock)(!0),(0,a.createElementBlock)(a.Fragment,null,(0,a.renderList)(S.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:j(t.data),fill:t.color,opacity:`0.18`},null,8,m)):(0,a.createCommentVNode)(``,!0),(0,a.createElementVNode)(`path`,{class:`nb-chart__line`,d:A(t.data),stroke:t.color,fill:`none`,"stroke-width":`2`,"stroke-linejoin":`round`,"stroke-linecap":`round`},null,8,h),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:O(r),cy:T.value(e.y),r:F.value===r?4:3,fill:t.color,class:`nb-chart__point`},null,8,g))),128)):(0,a.createCommentVNode)(``,!0)]))),128)),F.value===null?(0,a.createCommentVNode)(``,!0):((0,a.openBlock)(),(0,a.createElementBlock)(`line`,{key:1,class:`nb-chart__hover-line`,x1:O(F.value),x2:O(F.value),y1:y.top,y2:(0,a.unref)(x).height-y.bottom},null,8,_))],40,o)),(0,a.createVNode)(t.l,{visible:e.showTooltip&&F.value!==null,x:I.value.x,y:I.value.y,title:F.value===null?``:String(C.value[F.value]),rows:R.value},null,8,[`visible`,`x`,`y`,`title`,`rows`])],512)]),_:1},8,[`title`,`subtitle`,`height`,`show-legend`]))}}),y=e.t(v,[[`__scopeId`,`data-v-90bf8144`]]);Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return y}});