@orchidui/dashboard 1.8.1-96 → 1.8.1-98

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 (166) hide show
  1. package/dist/Dashboard/Card/OcCard.js +1 -1
  2. package/dist/Dashboard/TextEditor/QuillEditor.js +1 -1
  3. package/dist/{OcCard-B3SCzVwn.js → OcCard-D3be6IMj.js} +58 -54
  4. package/dist/OcCodeBlock-uFQyGnLq.js +37 -0
  5. package/dist/{OcLottieAnimation-DeMoIDaX.js → OcLottieAnimation-BB7AK2AO.js} +62 -62
  6. package/dist/{QuillEditor-hFQ0MJZO.js → QuillEditor-DRwC0sgJ.js} +579 -556
  7. package/dist/index.js +4 -4
  8. package/package.json +3 -265
  9. package/dist/AccordionTrigger.vue_vue_type_script_setup_true_lang-BdmLII9i.js +0 -295
  10. package/dist/CalendarPrevButton.vue_vue_type_script_setup_true_lang-DpJRpFhK.js +0 -891
  11. package/dist/CardTitle.vue_vue_type_script_setup_true_lang-D2_Bj3jw.js +0 -68
  12. package/dist/Checkbox.vue_vue_type_script_setup_true_lang-C51LjITJ.js +0 -172
  13. package/dist/CollapsibleTrigger-fCarY5DJ.js +0 -154
  14. package/dist/Collection-COudIl-A.js +0 -55
  15. package/dist/ConfigProvider-7mV0D7Sp.js +0 -6
  16. package/dist/DialogContent.vue_vue_type_script_setup_true_lang-CdrrrG29.js +0 -68
  17. package/dist/DialogOverlay-Cj3UTjZ8.js +0 -309
  18. package/dist/DialogPortal-zAvO8zt4.js +0 -23
  19. package/dist/DialogTrigger-BIF1A4hk.js +0 -72
  20. package/dist/DismissableLayer-C7IJliOb.js +0 -151
  21. package/dist/FocusScope--pJ6bboI.js +0 -121
  22. package/dist/FormMessage.vue_vue_type_script_setup_true_lang-DwlnFEn2.js +0 -92
  23. package/dist/Input.vue_vue_type_script_setup_true_lang-BrjsUUvL.js +0 -27
  24. package/dist/Label.vue_vue_type_script_setup_true_lang-D_LMIKBv.js +0 -51
  25. package/dist/ListboxItem-CjMk-mEX.js +0 -417
  26. package/dist/MenuSubTrigger-CUrxnPwO.js +0 -845
  27. package/dist/OcCodeBlock-CBdVqav7.js +0 -37
  28. package/dist/PopoverTrigger.vue_vue_type_script_setup_true_lang-DtI_qIyx.js +0 -394
  29. package/dist/PopperContent-BT3Svcc3.js +0 -1465
  30. package/dist/Presence-CxfTrw6l.js +0 -133
  31. package/dist/Primitive-B3twiLO1.js +0 -44
  32. package/dist/RadioGroupItem.vue_vue_type_script_setup_true_lang-BNfRYIhL.js +0 -297
  33. package/dist/RovingFocusGroup-0OHdFQl0.js +0 -92
  34. package/dist/RovingFocusItem-s7Ug6oxb.js +0 -82
  35. package/dist/SelectValue.vue_vue_type_script_setup_true_lang-CVsYrN1R.js +0 -1255
  36. package/dist/Separator-DRam5i7g.js +0 -54
  37. package/dist/Separator.vue_vue_type_script_setup_true_lang-DGPbh6Dt.js +0 -27
  38. package/dist/Skeleton.vue_vue_type_script_setup_true_lang-k1A7l6Y-.js +0 -17
  39. package/dist/Switch.vue_vue_type_script_setup_true_lang-94ZKgnTz.js +0 -135
  40. package/dist/Teleport-DnUewq5H.js +0 -25
  41. package/dist/Textarea.vue_vue_type_script_setup_true_lang-DKazues9.js +0 -27
  42. package/dist/TooltipTrigger.vue_vue_type_script_setup_true_lang-CZ3AuN38.js +0 -426
  43. package/dist/VisuallyHidden-DMAU4heD.js +0 -41
  44. package/dist/VisuallyHiddenInput-DvJnsVHt.js +0 -59
  45. package/dist/_commonjsHelpers-B4e78b8K.js +0 -28
  46. package/dist/_plugin-vue_export-helper-CHgC5LLL.js +0 -9
  47. package/dist/array-CqVTtuYm.js +0 -6
  48. package/dist/arrays-4jDZqbdb.js +0 -20
  49. package/dist/check-C2tzJ0Gk.js +0 -11
  50. package/dist/chevron-down-CnpAlizg.js +0 -13
  51. package/dist/chevron-left-BOwFasou.js +0 -13
  52. package/dist/chevron-right-D308801z.js +0 -13
  53. package/dist/circle-A-6NpYiX.js +0 -13
  54. package/dist/clamp-BL1Rb24G.js +0 -22
  55. package/dist/constant-CuDQlTIy.js +0 -3433
  56. package/dist/createContext-CZEfaSVa.js +0 -17
  57. package/dist/createLucideIcon-eXqDwUWj.js +0 -71
  58. package/dist/ellipsis-CEG9G7eN.js +0 -15
  59. package/dist/getActiveElement-B-HWdUIb.js +0 -11
  60. package/dist/handleAndDispatchCustomEvent-Byh08EHr.js +0 -11
  61. package/dist/index-B3LW8uSH.js +0 -133
  62. package/dist/index-BIlpXuWX.js +0 -3430
  63. package/dist/index-BlGEiPHj.js +0 -1246
  64. package/dist/index-BwPb_idr.js +0 -574
  65. package/dist/index-C9julNQm.js +0 -173
  66. package/dist/index-C_aI-Wfj.js +0 -34
  67. package/dist/index-CumjCvqB.js +0 -5703
  68. package/dist/index-LqWMCtOd.js +0 -809
  69. package/dist/index-OpE2oGce.js +0 -110
  70. package/dist/isValueEqualOrExist-BDSMUv8t.js +0 -8
  71. package/dist/lib/utils.js +0 -5
  72. package/dist/nullish-CjWwlQS3.js +0 -6
  73. package/dist/ohash.D__AXeF1-DX2n0b2C.js +0 -106
  74. package/dist/plus-CgluTYQY.js +0 -14
  75. package/dist/text-zwICaAnx.js +0 -743
  76. package/dist/ui/accordion/index.js +0 -7
  77. package/dist/ui/alert/index.js +0 -64
  78. package/dist/ui/alert-dialog/index.js +0 -356
  79. package/dist/ui/aspect-ratio/index.js +0 -50
  80. package/dist/ui/auto-form/constant.js +0 -5
  81. package/dist/ui/auto-form/dependencies.js +0 -61
  82. package/dist/ui/auto-form/index.js +0 -227
  83. package/dist/ui/auto-form/interface.js +0 -4
  84. package/dist/ui/auto-form/utils.js +0 -89
  85. package/dist/ui/avatar/index.js +0 -189
  86. package/dist/ui/badge/index.js +0 -37
  87. package/dist/ui/breadcrumb/index.js +0 -126
  88. package/dist/ui/button/index.js +0 -55
  89. package/dist/ui/calendar/index.js +0 -15
  90. package/dist/ui/card/index.js +0 -38
  91. package/dist/ui/carousel/index.js +0 -174
  92. package/dist/ui/carousel/interface.js +0 -1
  93. package/dist/ui/carousel/useCarousel.js +0 -1288
  94. package/dist/ui/chart/index.js +0 -8
  95. package/dist/ui/chart/interface.js +0 -1
  96. package/dist/ui/chart-area/index.js +0 -331
  97. package/dist/ui/chart-bar/index.js +0 -490
  98. package/dist/ui/chart-donut/index.js +0 -509
  99. package/dist/ui/chart-line/index.js +0 -110
  100. package/dist/ui/checkbox/index.js +0 -4
  101. package/dist/ui/collapsible/index.js +0 -60
  102. package/dist/ui/combobox/index.js +0 -877
  103. package/dist/ui/command/index.js +0 -323
  104. package/dist/ui/context-menu/index.js +0 -734
  105. package/dist/ui/dialog/index.js +0 -169
  106. package/dist/ui/drawer/index.js +0 -971
  107. package/dist/ui/dropdown-menu/index.js +0 -723
  108. package/dist/ui/form/index.js +0 -13
  109. package/dist/ui/form/injectionKeys.js +0 -4
  110. package/dist/ui/form/useFormField.js +0 -25
  111. package/dist/ui/hover-card/index.js +0 -331
  112. package/dist/ui/input/index.js +0 -4
  113. package/dist/ui/label/index.js +0 -4
  114. package/dist/ui/menubar/index.js +0 -862
  115. package/dist/ui/navigation-menu/index.js +0 -873
  116. package/dist/ui/number-field/index.js +0 -682
  117. package/dist/ui/pagination/index.js +0 -444
  118. package/dist/ui/pin-input/index.js +0 -308
  119. package/dist/ui/popover/index.js +0 -6
  120. package/dist/ui/progress/index.js +0 -137
  121. package/dist/ui/radio-group/index.js +0 -5
  122. package/dist/ui/range-calendar/index.js +0 -986
  123. package/dist/ui/resizable/index.js +0 -1432
  124. package/dist/ui/scroll-area/index.js +0 -775
  125. package/dist/ui/select/index.js +0 -135
  126. package/dist/ui/separator/index.js +0 -4
  127. package/dist/ui/sheet/index.js +0 -188
  128. package/dist/ui/sidebar/index.js +0 -652
  129. package/dist/ui/sidebar/utils.js +0 -12
  130. package/dist/ui/skeleton/index.js +0 -4
  131. package/dist/ui/slider/index.js +0 -478
  132. package/dist/ui/sonner/index.js +0 -892
  133. package/dist/ui/stepper/index.js +0 -442
  134. package/dist/ui/switch/index.js +0 -4
  135. package/dist/ui/table/index.js +0 -153
  136. package/dist/ui/tabs/index.js +0 -280
  137. package/dist/ui/tags-input/index.js +0 -449
  138. package/dist/ui/textarea/index.js +0 -4
  139. package/dist/ui/toast/index.js +0 -738
  140. package/dist/ui/toast/use-toast.js +0 -85
  141. package/dist/ui/toggle/index.js +0 -6
  142. package/dist/ui/toggle-group/index.js +0 -112
  143. package/dist/ui/tooltip/index.js +0 -29
  144. package/dist/useArrowNavigation-BRMPveaB.js +0 -49
  145. package/dist/useBodyScrollLock-CazCRZjZ.js +0 -153
  146. package/dist/useDirection-C3C_TLKm.js +0 -14
  147. package/dist/useFocusGuards-CyjC9cG9.js +0 -26
  148. package/dist/useFormControl-CFVC51Lp.js +0 -11
  149. package/dist/useForwardExpose-DZT6mL_U.js +0 -37
  150. package/dist/useForwardPropsEmits-0XKBv1pB.js +0 -33
  151. package/dist/useGraceArea-D7-GP1ii.js +0 -137
  152. package/dist/useId-reAg216X.js +0 -13
  153. package/dist/useKbd-BJNupnml.js +0 -41
  154. package/dist/useLocale-BfU0LC8Z.js +0 -14
  155. package/dist/useNonce-C1ZOgOp5.js +0 -14
  156. package/dist/usePrimitiveElement-BjwUvHih.js +0 -15
  157. package/dist/useSingleOrMultipleValue-BkTAaaJB.js +0 -43
  158. package/dist/useSize-BnyQ8FZF.js +0 -37
  159. package/dist/useTypeahead-oSidjyFF.js +0 -40
  160. package/dist/utils-DKNaYMZh.js +0 -57
  161. package/dist/utils-Dx9la83v.js +0 -35
  162. package/dist/utils-DxQ_ywGa.js +0 -55
  163. package/dist/utils-SFgRDk1R.js +0 -2748
  164. package/dist/utils-W-UiqiPE.js +0 -1869
  165. package/dist/vee-validate-Cf8JDJ_k.js +0 -2232
  166. package/dist/x-Cl6YllUK.js +0 -14
@@ -1,490 +0,0 @@
1
- import { defineComponent as z, inject as K, computed as C, ref as X, createElementBlock as Y, onMounted as Q, nextTick as tt, onUnmounted as et, watch as A, openBlock as D, normalizeClass as St, unref as V, createBlock as B, createCommentVNode as G, createVNode as U, normalizeStyle as xt, withCtx as yt, renderSlot as kt } from "vue";
2
- import { X as at, O as j, b as $, i as st, e as rt, g as it, h as x, t as M, u as ot, f as O, j as Vt, l as F, s as y, k as H, v as nt, o as $t, x as lt, y as ct, z as _t, A as Dt, B as Ct, C as Mt, p as dt, q as ht, r as ut, d as Et, _ as Bt, a as Gt } from "../../index-CumjCvqB.js";
3
- import { u as Wt } from "../../index-B3LW8uSH.js";
4
- import { c as wt } from "../../utils-SFgRDk1R.js";
5
- import { D as W, $ as Pt, O as J, A as At } from "../../index-LqWMCtOd.js";
6
- function gt({ x: k, y: e, w: t, h: r, tl: i = !1, tr: l = !1, bl: o = !1, br: s = !1, r: d = 0 }) {
7
- let c;
8
- c = `M${k + d},${e}h${t - 2 * d}`;
9
- let n = l ? d : 0, a = l ? 0 : d;
10
- return c += `a${n},${n} 0 0 1 ${n},${n}`, c += `h${a}v${a}`, c += `v${r - 2 * d}`, n = s ? d : 0, a = s ? 0 : d, c += `a${n},${n} 0 0 1 ${-n},${n}`, c += `v${a}h${-a}`, c += `h${2 * d - t}`, n = o ? d : 0, a = o ? 0 : d, c += `a${n},${n} 0 0 1 ${-n},${-n}`, c += `h${-a}v${-a}`, c += `v${2 * d - r}`, n = i ? d : 0, a = i ? 0 : d, c += `a${n},${n} 0 0 1 ${n},${-n}`, c += `v${-a}h${a}`, c += "z", c;
11
- }
12
- const Ot = Object.assign(Object.assign({}, at), { color: void 0, barMaxWidth: void 0, barWidth: void 0, dataStep: void 0, barPadding: 0, roundedCorners: 2, cursor: null, barMinHeight1Px: !1, barMinHeightZeroValue: null, orientation: j.Vertical }), pt = $`
13
- label: stacked-bar-component;
14
- `, Ft = st`
15
- :root {
16
- --vis-stacked-bar-cursor: default;
17
- --vis-stacked-bar-fill-color: var(--vis-color-main);
18
- --vis-stacked-bar-stroke-color: none;
19
- --vis-stacked-bar-stroke-width: 0px;
20
- --vis-stacked-bar-hover-stroke-width: none;
21
- --vis-stacked-bar-hover-stroke-color: none;
22
-
23
- /* Dark Theme */
24
- --vis-dark-stacked-bar-stroke-color: none;
25
- }
26
-
27
- body.theme-dark ${`.${pt}`} {
28
- --vis-stacked-bar-stroke-color: var(--vis-dark-stacked-bar-stroke-color);
29
- }
30
- `, w = $`
31
- label: bar;
32
- fill: var(--vis-stacked-bar-fill-color);
33
- stroke: var(--vis-stacked-bar-stroke-color);
34
- stroke-width: var(--vis-stacked-bar-stroke-width);
35
- cursor: var(--vis-stacked-bar-cursor);
36
-
37
- &:hover {
38
- stroke-width: var(--vis-stacked-bar-hover-stroke-width);
39
- stroke: var(--vis-stacked-bar-hover-stroke-color);
40
- }
41
- `, T = $`
42
- label: barGroup;
43
- `, bt = $`
44
- label: barGroupExit;
45
- `, Ht = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
46
- __proto__: null,
47
- bar: w,
48
- barGroup: T,
49
- barGroupExit: bt,
50
- globalStyles: Ft,
51
- root: pt
52
- }, Symbol.toStringTag, { value: "Module" }));
53
- class q extends rt {
54
- constructor(e) {
55
- super(), this._defaultConfig = Ot, this.config = this._defaultConfig, this.getAccessors = () => it(this.config.y) ? this.config.y : [this.config.y], this.stacked = !0, this.events = {}, this._barData = [], e && this.setConfig(e);
56
- }
57
- get bleed() {
58
- if (this._barData = this._getVisibleData(), this._barData.length === 0)
59
- return { top: 0, bottom: 0, left: 0, right: 0 };
60
- const e = !this.isVertical() && this.dataScale.range()[0] > this.dataScale.range()[1], t = this.dataScale.domain(), r = this._getBarWidth() / 2, i = this._barData.map((p, h) => x(p, this.config.x, h)), l = M(i), o = ot(i), s = this.dataScale(l), d = this.dataScale(o), c = this.dataScale.invert(s + (e ? r : -r)), n = this.dataScale.invert(d + (e ? -r : r)), a = c <= t[0] ? this.dataScale(t[0]) - this.dataScale(c) : 0, u = n > t[1] ? this.dataScale(n) - this.dataScale(t[1]) : 0;
61
- return {
62
- top: this.isVertical() ? 0 : e ? -u : a,
63
- bottom: this.isVertical() ? 0 : e ? -a : u,
64
- left: this.isVertical() ? a : 0,
65
- right: this.isVertical() ? u : 0
66
- };
67
- }
68
- get dataScale() {
69
- return this.isVertical() ? this.xScale : this.yScale;
70
- }
71
- get valueScale() {
72
- return this.isVertical() ? this.yScale : this.xScale;
73
- }
74
- isVertical() {
75
- return this.config.orientation === j.Vertical;
76
- }
77
- _render(e) {
78
- const { config: t } = this, r = O(e) ? e : t.duration, i = this.getAccessors(), l = Vt(this._barData, 0, i, this._prevNegative);
79
- this._prevNegative = l.map((h) => !!h.isMostlyNegative);
80
- const o = this.g.selectAll(`.${T}`).data(this._barData, (h, g) => {
81
- var f;
82
- return `${(f = F(h, t.id, g)) !== null && f !== void 0 ? f : g}`;
83
- }), s = (h, g) => {
84
- const f = this.dataScale(x(h, t.x, g)), b = this.isVertical() ? f : 0, v = this.isVertical() ? 0 : f;
85
- return `translate(${b},${v})`;
86
- }, c = o.enter().append("g").attr("class", T).attr("transform", s).style("opacity", 1).merge(o);
87
- y(c, r).attr("transform", s).style("opacity", 1);
88
- const n = o.exit().attr("class", bt);
89
- y(n, r).style("opacity", 0).remove(), y(n.selectAll(`.${w}`), r).attr("transform", this.isVertical() ? `translate(0,${this._height / 3})` : `translate(${this._width / 6},0)`);
90
- const a = c.selectAll(`.${w}`).data((h, g) => l.map((f, b) => Object.assign(Object.assign({}, h), {
91
- _index: g,
92
- _stacked: f[g],
93
- // Ending bar if the next stack is not the same as the current one
94
- _ending: b === l.length - 1 || b <= l.length - 1 && l[b + 1][g][0] !== f[g][1]
95
- }))), p = a.enter().append("path").attr("class", w).attr("d", (h, g) => this._getBarPath(h, g, !0)).style("fill", (h, g) => H(h, t.color, g)).merge(a);
96
- y(p, r).attr("d", (h, g) => this._getBarPath(h, g)).style("fill", (h, g) => H(h, t.color, g)).style("cursor", (h, g) => F(h, t.cursor, g)), y(a.exit(), r).style("opacity", 0).remove();
97
- }
98
- _getBarWidth() {
99
- const { config: e, datamodel: { data: t } } = this;
100
- if (nt(t))
101
- return 0;
102
- if (e.barWidth)
103
- return M([e.barWidth, e.barMaxWidth]);
104
- const r = this.dataScale.bandwidth, i = this.dataScale.domain ? this.dataScale.domain() : [];
105
- let o = 1 + (r ? i.length : i[1] - i[0]) / e.dataStep || !r && t.filter((c, n) => {
106
- const a = x(c, e.x, n);
107
- return a >= i[0] && a <= i[1];
108
- }).length || t.length;
109
- !r && o >= 2 && (o += 1);
110
- const d = (o < 2 ? 1 : 1 - e.barPadding) * (this.isVertical() ? this._width : this._height) / o;
111
- return M([d, e.barMaxWidth]);
112
- }
113
- _getVisibleData() {
114
- const { config: e, datamodel: { data: t } } = this, r = this._getBarWidth(), i = t.length < 2 ? 0 : r / 2, l = this.dataScale, o = Math.abs(l.invert(i) - l.invert(0));
115
- return t == null ? void 0 : t.filter((d, c) => {
116
- const n = x(d, e.x, c), a = l.domain(), u = +a[0], p = +a[1];
117
- return n >= u - o && n <= p + o;
118
- });
119
- }
120
- _getBarPath(e, t, r = !1) {
121
- const { config: i } = this, l = this.getAccessors(), o = this._getBarWidth(), s = e._stacked[1] < 0, d = e._ending, c = x(e, l[t], e._index), n = r ? 0 : Math.abs(this.valueScale(e._stacked[0]) - this.valueScale(e._stacked[1])), a = !r && i.barMinHeight1Px && n < 1 && isFinite(c) && c !== i.barMinHeightZeroValue ? 1 : n, u = r ? this.valueScale(0) : this.valueScale(s ? e._stacked[0] : e._stacked[1]) - (n < 1 && i.barMinHeight1Px ? 1 : 0), p = -o / 2, h = o, g = i.roundedCorners ? O(i.roundedCorners) ? +i.roundedCorners : h / 2 : 0, f = ct(g, 0, Math.min(n, h) / 2), b = this.yScale.range()[0] > this.yScale.range()[1];
122
- return gt({
123
- x: this.isVertical() ? p : u - a,
124
- y: this.isVertical() ? u + (b ? 0 : -a) : p,
125
- w: this.isVertical() ? h : a,
126
- h: this.isVertical() ? a : h,
127
- tl: d && (this.isVertical() ? !s && b || s && !b : s),
128
- tr: d && (this.isVertical() ? !s && b || s && !b : !s),
129
- br: d && (this.isVertical() ? s && b || !s && !b : !s),
130
- bl: d && (this.isVertical() ? s && b || !s && !b : s),
131
- r: f
132
- });
133
- }
134
- getValueScaleExtent(e) {
135
- const { datamodel: t } = this, r = this.getAccessors(), i = e ? this._getVisibleData() : t.data;
136
- return $t(i, ...r);
137
- }
138
- getDataScaleExtent() {
139
- const { config: e, datamodel: t } = this;
140
- return lt(t.data, e.x);
141
- }
142
- getYDataExtent(e) {
143
- return this.isVertical() ? this.getValueScaleExtent(e) : this.getDataScaleExtent();
144
- }
145
- getXDataExtent() {
146
- return this.isVertical() ? this.getDataScaleExtent() : this.getValueScaleExtent(!1);
147
- }
148
- }
149
- q.selectors = Ht;
150
- const jt = Object.assign(Object.assign({}, at), { color: void 0, groupMaxWidth: void 0, groupWidth: void 0, dataStep: void 0, groupPadding: 0.05, barPadding: 0, roundedCorners: 2, barMinHeight: 2, cursor: null, orientation: j.Vertical }), vt = $`
151
- label: grouped-bar-component;
152
- `, Nt = st`
153
- :root {
154
- --vis-grouped-bar-cursor: default;
155
- --vis-grouped-bar-fill-color: var(--vis-color-main);
156
- --vis-grouped-bar-stroke-color: none;
157
- --vis-grouped-bar-stroke-width: 0px;
158
- --vis-grouped-bar-hover-stroke-width: 1px;
159
- --vis-grouped-bar-hover-stroke-color: none;
160
-
161
-
162
- /* Dark Theme */
163
- --vis-dark-grouped-bar-stroke-color: none;
164
- }
165
-
166
- body.theme-dark ${`.${vt}`} {
167
- --vis-grouped-bar-stroke-color: var(--vis-dark-grouped-bar-stroke-color);
168
- }
169
- `, P = $`
170
- label: bar;
171
- fill: var(--vis-grouped-bar-fill-color);
172
- stroke: var(--vis-grouped-bar-stroke-color);
173
- stroke-width: var(--vis-grouped-bar-stroke-width);
174
- cursor: var(--vis-grouped-bar-cursor);
175
-
176
- &:hover {
177
- stroke-width: var(--vis-grouped-bar-hover-stroke-width);
178
- stroke: var(--vis-grouped-bar-hover-stroke-color);
179
- }
180
- `, L = $`
181
- label: barGroup;
182
- `, mt = $`
183
- label: barGroupExit;
184
- `, Rt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
185
- __proto__: null,
186
- bar: P,
187
- barGroup: L,
188
- barGroupExit: mt,
189
- globalStyles: Nt,
190
- root: vt
191
- }, Symbol.toStringTag, { value: "Module" }));
192
- class I extends rt {
193
- constructor(e) {
194
- super(), this._defaultConfig = jt, this.config = this._defaultConfig, this.getAccessors = () => it(this.config.y) ? this.config.y : [this.config.y], this.events = {}, this._barData = [], e && this.setConfig(e);
195
- }
196
- get bleed() {
197
- if (this._barData = this._getVisibleData(), this._barData.length === 0)
198
- return { top: 0, bottom: 0, left: 0, right: 0 };
199
- const e = !this.isVertical() && this.dataScale.range()[0] > this.dataScale.range()[1], t = this.dataScale.domain(), r = this._getGroupWidth() / 2, i = this._barData.map((p, h) => x(p, this.config.x, h)), l = M(i), o = ot(i), s = this.dataScale(l), d = this.dataScale(o), c = this.dataScale.invert(s + (e ? r : -r)), n = this.dataScale.invert(d + (e ? -r : r)), a = c <= t[0] ? this.dataScale(t[0]) - this.dataScale(c) : 0, u = n > t[1] ? this.dataScale(n) - this.dataScale(t[1]) : 0;
200
- return {
201
- top: this.isVertical() ? 0 : e ? -u : a,
202
- bottom: this.isVertical() ? 0 : e ? -a : u,
203
- left: this.isVertical() ? a : 0,
204
- right: this.isVertical() ? u : 0
205
- };
206
- }
207
- get dataScale() {
208
- return this.isVertical() ? this.xScale : this.yScale;
209
- }
210
- get valueScale() {
211
- return this.isVertical() ? this.yScale : this.xScale;
212
- }
213
- isVertical() {
214
- return this.config.orientation === j.Vertical;
215
- }
216
- _render(e) {
217
- const { config: t } = this, r = O(e) ? e : t.duration, i = this._getGroupWidth(), l = this.getAccessors(), o = [-i / 2, i / 2], s = _t().domain(Dt(l.length)).range(o).paddingInner(t.barPadding).paddingOuter(t.barPadding), d = this.g.selectAll(`.${L}`).data(this._barData, (v, m) => {
218
- var S;
219
- return `${(S = F(v, t.id, m)) !== null && S !== void 0 ? S : m}`;
220
- }), c = (v, m) => {
221
- const S = this.dataScale(x(v, t.x, m)), E = this.isVertical() ? S : 0, _ = this.isVertical() ? 0 : S;
222
- return `translate(${E},${_})`;
223
- }, a = d.enter().append("g").attr("class", L).attr("transform", c).style("opacity", 1).merge(d);
224
- y(a, r).attr("transform", c).style("opacity", 1);
225
- const u = d.exit().attr("class", mt);
226
- y(u, r).style("opacity", 0).remove(), y(u.selectAll(`.${P}`), r).attr("transform", (v, m, S) => this.isVertical() ? `translate(0,${this.yScale(0)}) scale(1,0)` : `translate(${this.xScale(0)},0) scale(0,1)`);
227
- const p = s.bandwidth(), h = a.selectAll(`.${P}`).data((v) => l.map(() => v)), g = this._getValueAxisDirection(), b = h.enter().append("path").attr("class", P).attr("d", (v, m) => {
228
- const S = s(m), E = this.valueScale(0), _ = p;
229
- return this._getBarPath(S, E, _, 0, !1, g);
230
- }).style("fill", (v, m) => H(v, t.color, m)).merge(h);
231
- y(b, r).attr("d", (v, m) => {
232
- const S = s(m), E = p, _ = x(v, l[m]), N = _ < 0;
233
- let Z = N ? this.valueScale(0) : this.valueScale(_ || 0), R = Math.abs(this.valueScale(0) - this.valueScale(_)) || 0;
234
- if (R < t.barMinHeight) {
235
- const ft = g === W.North ? -1 : 1;
236
- Z = this.valueScale(0) + ft * t.barMinHeight, R = t.barMinHeight;
237
- }
238
- return this._getBarPath(S, Z, E, R, N, g);
239
- }).style("fill", (v, m) => H(v, t.color, m)).style("cursor", (v, m) => F(v, t.cursor, m)), y(h.exit(), r).remove();
240
- }
241
- _getValueAxisDirection() {
242
- return this.valueScale.range()[0] > this.valueScale.range()[1] ? W.North : W.South;
243
- }
244
- _getVisibleData() {
245
- const { config: e, datamodel: { data: t } } = this, r = this._getGroupWidth(), i = t.length < 2 ? 0 : r / 2, l = this.dataScale, o = Math.abs(l.invert(i) - l.invert(0));
246
- return t == null ? void 0 : t.filter((d, c) => {
247
- const n = x(d, e.x, c), a = l.domain(), u = +a[0], p = +a[1];
248
- return n >= u - o && n <= p + o;
249
- });
250
- }
251
- _getBarPath(e, t, r, i, l, o) {
252
- const { config: s } = this, d = s.roundedCorners ? O(s.roundedCorners) ? +s.roundedCorners : r / 2 : 0, c = ct(d, 0, Math.min(i, r) / 2), n = o === W.North, a = this.isVertical() && l !== n, u = this.isVertical() && l === n, p = !this.isVertical() && l, h = !this.isVertical() && !l;
253
- return gt({
254
- x: this.isVertical() ? e : t + (n ? 0 : -i),
255
- y: this.isVertical() ? t + (n ? 0 : -i) : e,
256
- w: this.isVertical() ? r : i,
257
- h: this.isVertical() ? i : r,
258
- tl: a || p,
259
- tr: a || h,
260
- bl: u || p,
261
- br: u || h,
262
- r: c
263
- });
264
- }
265
- _getGroupWidth() {
266
- const { config: e, datamodel: { data: t } } = this;
267
- if (nt(t))
268
- return 0;
269
- if (e.groupWidth)
270
- return M([e.groupWidth, e.groupMaxWidth]);
271
- const r = this.dataScale.bandwidth, i = this.dataScale.domain ? this.dataScale.domain() : [];
272
- let o = 1 + (r ? i.length : i[1] - i[0]) / e.dataStep || !r && t.filter((c, n) => {
273
- const a = x(c, e.x, n);
274
- return a >= i[0] && a <= i[1];
275
- }).length || t.length;
276
- !r && o >= 2 && (o += 1);
277
- const d = (o < 2 ? 1 : 1 - e.groupPadding) * (this.isVertical() ? this._width : this._height) / o;
278
- return M([d, e.groupMaxWidth]);
279
- }
280
- getValueScaleExtent(e) {
281
- const { datamodel: t } = this, r = this.getAccessors(), i = e ? this._getVisibleData() : t.data, l = Ct(i, ...r), o = Mt(i, ...r);
282
- return [l > 0 ? 0 : l, o < 0 ? 0 : o];
283
- }
284
- getDataScaleExtent() {
285
- const { config: e, datamodel: t } = this;
286
- return lt(t.data, e.x);
287
- }
288
- getYDataExtent(e) {
289
- return this.isVertical() ? this.getValueScaleExtent(e) : this.getDataScaleExtent();
290
- }
291
- getXDataExtent() {
292
- return this.isVertical() ? this.getDataScaleExtent() : this.getValueScaleExtent(!1);
293
- }
294
- }
295
- I.selectors = Rt;
296
- const Tt = { "data-vis-component": "" }, Lt = /* @__PURE__ */ z({
297
- __name: "index",
298
- props: {
299
- color: {},
300
- groupWidth: {},
301
- groupMaxWidth: {},
302
- dataStep: {},
303
- groupPadding: {},
304
- barPadding: {},
305
- roundedCorners: { type: [Number, Boolean] },
306
- barMinHeight: {},
307
- cursor: {},
308
- orientation: {},
309
- x: {},
310
- y: {},
311
- id: { type: Function },
312
- xScale: { type: [Object, Function] },
313
- yScale: { type: [Object, Function] },
314
- excludeFromDomainCalculation: { type: Boolean },
315
- duration: {},
316
- events: {},
317
- attributes: {},
318
- data: {}
319
- },
320
- setup(k, { expose: e }) {
321
- const t = K(dt), r = k, i = C(() => t.data.value ?? r.data), l = ht(r), o = X();
322
- return Q(() => {
323
- tt(() => {
324
- var s;
325
- o.value = new I(l.value), (s = o.value) == null || s.setData(i.value), t.update(o.value);
326
- });
327
- }), et(() => {
328
- var s;
329
- (s = o.value) == null || s.destroy(), t.destroy();
330
- }), A(l, (s, d) => {
331
- var c;
332
- ut(s, d) || (c = o.value) == null || c.setConfig(l.value);
333
- }), A(i, () => {
334
- var s;
335
- (s = o.value) == null || s.setData(i.value);
336
- }), e({
337
- component: o
338
- }), (s, d) => (D(), Y("div", Tt));
339
- }
340
- }), zt = { "data-vis-component": "" }, Xt = /* @__PURE__ */ z({
341
- __name: "index",
342
- props: {
343
- color: {},
344
- barWidth: {},
345
- barMaxWidth: {},
346
- dataStep: {},
347
- barPadding: {},
348
- roundedCorners: { type: [Number, Boolean] },
349
- cursor: {},
350
- barMinHeight1Px: { type: Boolean },
351
- barMinHeightZeroValue: {},
352
- orientation: {},
353
- x: {},
354
- y: {},
355
- id: { type: Function },
356
- xScale: { type: [Object, Function] },
357
- yScale: { type: [Object, Function] },
358
- excludeFromDomainCalculation: { type: Boolean },
359
- duration: {},
360
- events: {},
361
- attributes: {},
362
- data: {}
363
- },
364
- setup(k, { expose: e }) {
365
- const t = K(dt), r = k, i = C(() => t.data.value ?? r.data), l = ht(r), o = X();
366
- return Q(() => {
367
- tt(() => {
368
- var s;
369
- o.value = new q(l.value), (s = o.value) == null || s.setData(i.value), t.update(o.value);
370
- });
371
- }), et(() => {
372
- var s;
373
- (s = o.value) == null || s.destroy(), t.destroy();
374
- }), A(l, (s, d) => {
375
- var c;
376
- ut(s, d) || (c = o.value) == null || c.setConfig(l.value);
377
- }), A(i, () => {
378
- var s;
379
- (s = o.value) == null || s.setData(i.value);
380
- }), e({
381
- component: o
382
- }), (s, d) => (D(), Y("div", zt));
383
- }
384
- }), Jt = /* @__PURE__ */ z({
385
- __name: "BarChart",
386
- props: {
387
- data: {},
388
- categories: {},
389
- index: {},
390
- colors: {},
391
- margin: { default: () => ({ top: 0, bottom: 0, left: 0, right: 0 }) },
392
- filterOpacity: { default: 0.2 },
393
- xFormatter: {},
394
- yFormatter: {},
395
- showXAxis: { type: Boolean, default: !0 },
396
- showYAxis: { type: Boolean, default: !0 },
397
- showTooltip: { type: Boolean, default: !0 },
398
- showLegend: { type: Boolean, default: !0 },
399
- showGridLine: { type: Boolean, default: !0 },
400
- customTooltip: {},
401
- type: { default: "grouped" },
402
- roundedCorners: { default: 0 }
403
- },
404
- emits: ["legendItemClick"],
405
- setup(k, { emit: e }) {
406
- const t = k, r = e, i = C(() => t.index), l = C(() => {
407
- var a;
408
- return (a = t.colors) != null && a.length ? t.colors : Et(t.categories.length);
409
- }), o = X(t.categories.map((a, u) => ({
410
- name: a,
411
- color: l.value[u],
412
- inactive: !1
413
- }))), s = Wt();
414
- function d(a, u) {
415
- r("legendItemClick", a, u);
416
- }
417
- const c = C(() => t.type === "grouped" ? Lt : Xt), n = C(() => t.type === "grouped" ? I.selectors.bar : q.selectors.bar);
418
- return (a, u) => (D(), Y("div", {
419
- class: St(V(wt)("w-full h-[400px] flex flex-col items-end", a.$attrs.class ?? ""))
420
- }, [
421
- a.showLegend ? (D(), B(V(Bt), {
422
- key: 0,
423
- items: o.value,
424
- "onUpdate:items": u[0] || (u[0] = (p) => o.value = p),
425
- onLegendItemClick: d
426
- }, null, 8, ["items"])) : G("", !0),
427
- U(V(Pt), {
428
- data: a.data,
429
- style: xt({ height: V(s) ? "100%" : "auto" }),
430
- margin: a.margin
431
- }, {
432
- default: yt(() => [
433
- a.showTooltip ? (D(), B(V(Gt), {
434
- key: 0,
435
- colors: l.value,
436
- items: o.value,
437
- "custom-tooltip": a.customTooltip,
438
- index: i.value
439
- }, null, 8, ["colors", "items", "custom-tooltip", "index"])) : G("", !0),
440
- U(V(c), {
441
- x: (p, h) => h,
442
- y: a.categories.map((p) => (h) => h[p]),
443
- color: l.value,
444
- "rounded-corners": a.roundedCorners,
445
- "bar-padding": 0.05,
446
- attributes: {
447
- [n.value]: {
448
- opacity: (p, h) => {
449
- var f;
450
- const g = h % a.categories.length;
451
- return (f = o.value[g]) != null && f.inactive ? a.filterOpacity : 1;
452
- }
453
- }
454
- }
455
- }, null, 8, ["x", "y", "color", "rounded-corners", "attributes"]),
456
- a.showXAxis ? (D(), B(V(J), {
457
- key: 1,
458
- type: "x",
459
- "tick-format": a.xFormatter ?? ((p) => {
460
- var h;
461
- return (h = a.data[p]) == null ? void 0 : h[i.value];
462
- }),
463
- "grid-line": !1,
464
- "tick-line": !1,
465
- "tick-text-color": "hsl(var(--vis-text-color))"
466
- }, null, 8, ["tick-format"])) : G("", !0),
467
- a.showYAxis ? (D(), B(V(J), {
468
- key: 2,
469
- type: "y",
470
- "tick-line": !1,
471
- "tick-format": a.yFormatter,
472
- "domain-line": !1,
473
- "grid-line": a.showGridLine,
474
- attributes: {
475
- [V(At).selectors.grid]: {
476
- class: "text-muted"
477
- }
478
- },
479
- "tick-text-color": "hsl(var(--vis-text-color))"
480
- }, null, 8, ["tick-format", "grid-line", "attributes"])) : G("", !0),
481
- kt(a.$slots, "default")
482
- ]),
483
- _: 3
484
- }, 8, ["data", "style", "margin"])
485
- ], 2));
486
- }
487
- });
488
- export {
489
- Jt as BarChart
490
- };