rapidograph 1.0.3

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Olja Milović
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,157 @@
1
+ <p style="text-align: center;">
2
+ <picture>
3
+ <source
4
+ srcset="assets/logo/logo-lockup-light.png"
5
+ media="(prefers-color-scheme: light)"
6
+ />
7
+ <source
8
+ srcset="assets/logo/logo-lockup-dark.png"
9
+ media="(prefers-color-scheme: dark)"
10
+ />
11
+ <img
12
+ src="assets/logo/logo-lockup-light.png"
13
+ alt="Library logo"
14
+ style="max-width: 100%;"
15
+ />
16
+ </picture>
17
+ </p>
18
+
19
+ <p style="text-align: center;">
20
+ <strong>A focused charting system built with Web Components.</strong>
21
+ </p>
22
+
23
+ <p style="text-align: center;">
24
+ Lightweight, theme-aware, responsive charts rendered with HTML and CSS.
25
+ </p>
26
+
27
+ [//]: # '<p style="text-align: center;">'
28
+ [//]: # ' <a href="https://github.com/your-org/rapidograph/actions">'
29
+ [//]: # ' <img src="https://img.shields.io/github/actions/workflow/status/olja-milovic/rapidograph/ci.yml" alt="workflow-status"/>'
30
+ [//]: # " </a>"
31
+ [//]: # ' <a href="https://www.npmjs.com/package/rapidograph">'
32
+ [//]: # ' <img src="https://img.shields.io/npm/v/rapidograph" alt="npm-package"/>'
33
+ [//]: # " </a>"
34
+ [//]: # ' <img src="https://img.shields.io/bundlephobia/minzip/rapidograph" alt="bundlephobia"/>'
35
+ [//]: # ' <img src="https://img.shields.io/npm/l/rapidograph" alt="license"/>'
36
+ [//]: # "</p>"
37
+
38
+ ## Overview
39
+
40
+ Rapidograph is a **charting design system** built on Web Components.
41
+ It provides a small set of **chart primitives** designed to integrate seamlessly into modern UI systems.
42
+
43
+ Charts are rendered using **HTML and CSS** instead of SVG or Canvas, making them easy to style, theme, and reason about.
44
+
45
+ > ⚠️ At the moment, Rapidograph includes **only a Bar Chart**.
46
+ > 📝 Additional chart types will be introduced incrementally.
47
+
48
+ ## Principles
49
+
50
+ - 🥇 **Design-system first**
51
+ Charts integrate into UI systems rather than behaving as isolated visual artifacts.
52
+
53
+ - 🧩 **Framework-agnostic**
54
+ Built with Web Components, works everywhere.
55
+
56
+ - 🎨 **Theme-aware and CSS-driven**
57
+ Support for light and dark themes. Colors and typography controlled via CSS.
58
+
59
+ - 🔑 **Accessible by design**
60
+ Charts are built with accessibility in mind, using predictable interaction patterns and support for assistive
61
+ technologies.
62
+ Accessibility is treated as a core requirement, not an afterthought.
63
+
64
+ ## Installation
65
+
66
+ ```bash
67
+ npm install rapidograph
68
+ ```
69
+
70
+ ## Usage
71
+
72
+ Rapidograph components are standard Web Components and can be used in any environment.
73
+
74
+ ```html
75
+ <rapido-bar
76
+ id="rapido-bar"
77
+ category-label="Dates"
78
+ value-label="Values (%)"
79
+ ></rapido-bar>
80
+
81
+ <script>
82
+ const rapidobar = document.getElementById("rapido-bar");
83
+
84
+ rapidobar.data = [
85
+ { category: "Jan", value: 10 },
86
+ { category: "Feb", value: -5 },
87
+ { category: "Mar", value: 15 },
88
+ ];
89
+ </script>
90
+ ```
91
+
92
+ ## Theming
93
+
94
+ Charts support **light** and **dark** themes out of the box.
95
+
96
+ ```html
97
+ <rapido-bar id="rapido-bar" theme="dark"></rapido-bar>
98
+ ```
99
+
100
+ Themes can be further customized per-instance using CSS variables such as:
101
+
102
+ ```css
103
+ #rapido-bar {
104
+ /*light theme colors*/
105
+ --rpg-bar-color: #85b8ff;
106
+ --rpg-bar-color-hover: #579cff;
107
+ /*...*/
108
+
109
+ /*dark theme colors*/
110
+ --rpg-bar-color-dark: #0055cc;
111
+ --rpg-bar-color-hover-dark: #0c65e3;
112
+ /*...*/
113
+ }
114
+ ```
115
+
116
+ Rapidograph is designed to integrate naturally with application-level theming systems.
117
+
118
+ [//]: # "## Documentation"
119
+ [//]: #
120
+ [//]: # "Rapidograph uses **Storybook as the primary documentation surface**."
121
+ [//]: #
122
+ [//]: # "Each chart is documented through interactive stories that demonstrate:"
123
+ [//]: # "- configuration options"
124
+ [//]: # "- layout variations"
125
+ [//]: # "- theming"
126
+ [//]: # "- accessibility considerations"
127
+ [//]: #
128
+ [//]: # "### 📘Storybook"
129
+ [//]: # '➡️<a href="storybook-link">View Storybook</a>'
130
+
131
+ ## Available Charts
132
+
133
+ ### Bar Chart
134
+
135
+ > The Bar Chart is currently the **only chart available** in Rapidograph.
136
+
137
+ It is:
138
+
139
+ - orientation-agnostic (vertical - default, or horizontal)
140
+ - theme-aware (light and dark)
141
+
142
+ Additional chart types will be added as the library evolves.
143
+
144
+ ## Compatibility
145
+
146
+ - Modern evergreen browsers
147
+ - Works with React, Angular, Vue, Svelte, or plain HTML
148
+ - No framework-specific dependencies
149
+
150
+ ## Status
151
+
152
+ Rapidograph is experimental and under active development.
153
+ Breaking changes may occur prior to a stable release.
154
+
155
+ ## License
156
+
157
+ MIT
@@ -0,0 +1,69 @@
1
+ import { DataItem, Orientation, ValueFormatters } from '../../shared';
2
+ import { LitElement, PropertyValues } from 'lit';
3
+ export declare class Rapidobar extends LitElement {
4
+ static get styles(): import('lit').CSSResult;
5
+ private _data;
6
+ private _categoryLabels;
7
+ private _ticks;
8
+ private _tickLabels;
9
+ private _hasPositive;
10
+ private _hasNegative;
11
+ private _allPositive;
12
+ private _allNegative;
13
+ private _yAxisMinWidth;
14
+ private _yAxisMaxWidth;
15
+ private _vObserver;
16
+ private _hObserver;
17
+ private _oldCursor?;
18
+ private get _yAxisWidthPercentage();
19
+ private get _yAxisWidthDescription();
20
+ private _xAxisHeight;
21
+ private _firstXAxisLabelWidth;
22
+ private _lastXAxisLabelWidth;
23
+ private _scrollbarSize;
24
+ private _activeBar;
25
+ private _yAxisWidth;
26
+ private _isDraggingYAxis;
27
+ private _focusedBarIndex;
28
+ get data(): DataItem[];
29
+ set data(value: DataItem[]);
30
+ formatters: ValueFormatters;
31
+ orientation: Orientation;
32
+ xAxisPosition: "bottom";
33
+ yAxisPosition: "left";
34
+ theme: "light";
35
+ tooltipTheme: "light";
36
+ categoryLabel: string;
37
+ valueLabel: string;
38
+ showLabels: "always";
39
+ private get _wrapperClasses();
40
+ private get _wrapperStyles();
41
+ private get _barContainerClasses();
42
+ private _wrapper;
43
+ private _scrollableElem;
44
+ private _barContainer;
45
+ private _xAxis;
46
+ private _yAxis;
47
+ private _textSizeDiv;
48
+ private _bars;
49
+ render(): import('lit-html').TemplateResult<1>;
50
+ connectedCallback(): void;
51
+ protected firstUpdated(_changedProperties: PropertyValues): void;
52
+ updated(changedProperties: Map<string, never>): void;
53
+ private _calculateYAxisWidths;
54
+ private _calculateTickWidths;
55
+ private addObservers;
56
+ private onBarEnter;
57
+ private onBarContainerMouseLeave;
58
+ private onBarContainerFocus;
59
+ private onBarContainerBlur;
60
+ private onBarContainerKeyDown;
61
+ private onYAxisPointerDown;
62
+ private onYAxisKeyDown;
63
+ disconnectedCallback(): void;
64
+ }
65
+ declare global {
66
+ interface HTMLElementTagNameMap {
67
+ "rapido-bar": Rapidobar;
68
+ }
69
+ }
@@ -0,0 +1,381 @@
1
+ import { LitElement as V, unsafeCSS as z, css as H, html as c, nothing as S } from "lit";
2
+ import { state as _, property as d, query as y, queryAll as R, eventOptions as A, customElement as N } from "lit/decorators.js";
3
+ import { Tooltip as K } from "../../helpers/tooltip/index.js";
4
+ import { classMap as C } from "lit/directives/class-map.js";
5
+ import { styleMap as F } from "lit/directives/style-map.js";
6
+ import U from "./rapidobar.css.js";
7
+ import { Orientation as b, XAxisPosition as T, YAxisPosition as v, Theme as m, ShowLabels as k } from "../../shared/enums.js";
8
+ import { formatLabels as P, getMinAndMax as j, generateTicks as q, checkIfSomePositiveAndNegative as G, checkIfAllPositiveOrNegative as J, noop as Q, formatLabel as D, getSizeInPercentages as Z, getUpdatedYAxisWidth as f } from "../../utils/rapidobar.js";
9
+ import { MIN_Y_AXIS_WIDTH as tt, MAX_Y_AXIS_WIDTH as L, DEFAULT_Y_AXIS_WIDTH as it, X_AXIS_LAST_LABEL_CSS_VAR as et, X_AXIS_FIRST_LABEL_CSS_VAR as st, DATA_LENGTH_CSS_VAR as at, X_AXIS_HEIGHT_CSS_VAR as rt, Y_AXIS_WIDTH_CSS_VAR as I, SCROLLBAR_WIDTH_CSS_VAR as ot } from "../../shared/constants.js";
10
+ import { calculateYAxisWidths as nt, getTextWidth as M, getScrollbarSize as lt } from "../../utils/dom.js";
11
+ var ht = Object.defineProperty, ct = Object.getOwnPropertyDescriptor, s = (t, i, a, o) => {
12
+ for (var r = o > 1 ? void 0 : o ? ct(i, a) : i, l = t.length - 1, n; l >= 0; l--)
13
+ (n = t[l]) && (r = (o ? n(i, a, r) : n(r)) || r);
14
+ return o && r && ht(i, a, r), r;
15
+ };
16
+ let e = class extends V {
17
+ constructor() {
18
+ super(...arguments), this._data = [], this._categoryLabels = [], this._ticks = [], this._tickLabels = [], this._hasPositive = !0, this._hasNegative = !1, this._allPositive = !0, this._allNegative = !1, this._yAxisMinWidth = tt, this._yAxisMaxWidth = L, this._xAxisHeight = 0, this._firstXAxisLabelWidth = 0, this._lastXAxisLabelWidth = 0, this._scrollbarSize = 0, this._activeBar = null, this._yAxisWidth = it, this._isDraggingYAxis = !1, this._focusedBarIndex = 0, this.formatters = {}, this.orientation = b.Vertical, this.xAxisPosition = T.Bottom, this.yAxisPosition = v.Left, this.theme = m.Light, this.tooltipTheme = m.Light, this.categoryLabel = "", this.valueLabel = "", this.showLabels = k.Always;
19
+ }
20
+ static get styles() {
21
+ return H`
22
+ ${z(U)}
23
+ `;
24
+ }
25
+ get _yAxisWidthPercentage() {
26
+ const t = this._yAxisMaxWidth - this._yAxisMinWidth;
27
+ return ((this._yAxisWidth - this._yAxisMinWidth) * 100 / t).toFixed(0);
28
+ }
29
+ get _yAxisWidthDescription() {
30
+ return `Y-axis offset ${this._yAxisWidthPercentage}%`;
31
+ }
32
+ get data() {
33
+ return this._data || [];
34
+ }
35
+ set data(t) {
36
+ const i = this._data;
37
+ this._data = t, this.requestUpdate("data", i);
38
+ const a = this._data.length, o = new Array(a), r = new Array(a);
39
+ this.data.forEach(({ category: x, value: u }, p) => {
40
+ o[p] = x, r[p] = u;
41
+ }), this._categoryLabels = P(o, this.formatters.category);
42
+ const [l, n] = j(r);
43
+ this._ticks = q(l, n), this._tickLabels = P(this._ticks, this.formatters.value), [this._hasPositive, this._hasNegative] = G(r), [this._allPositive, this._allNegative] = J(r), this._calculateTickWidths();
44
+ }
45
+ get _wrapperClasses() {
46
+ return {
47
+ rpg: !0,
48
+ [this.orientation]: !0,
49
+ [`x-axis-${this.xAxisPosition}`]: !0,
50
+ [`y-axis-${this.yAxisPosition}`]: !0,
51
+ [`labels-${this.showLabels}`]: !0
52
+ };
53
+ }
54
+ get _wrapperStyles() {
55
+ return {
56
+ [ot]: `${this._scrollbarSize}px`,
57
+ [I]: `${this._yAxisWidth}px`,
58
+ [rt]: `${this._xAxisHeight}px`,
59
+ [at]: this.data.length,
60
+ [st]: `${this._firstXAxisLabelWidth}px`,
61
+ [et]: `${this._lastXAxisLabelWidth}px`
62
+ };
63
+ }
64
+ get _barContainerClasses() {
65
+ return {
66
+ "rpg-bar-container": !0,
67
+ "start-from-half": this._hasPositive && this._hasNegative
68
+ };
69
+ }
70
+ render() {
71
+ const t = this.orientation === b.Vertical, i = t ? this.categoryLabel : this.valueLabel, a = t ? this.valueLabel : this.categoryLabel;
72
+ let o, r;
73
+ t ? (o = this._categoryLabels, r = this._tickLabels) : (o = this._tickLabels, r = this._categoryLabels);
74
+ const l = [];
75
+ for (const h of o)
76
+ l.push(c`
77
+ <div class="rpg-axis-label" title=${h}>${h}</div>
78
+ `);
79
+ const n = c`
80
+ <div class="rpg-x-axis">
81
+ ${i ? c`<div class="rpg-axis-label rpg-axis-title">
82
+ <div class="rpg-axis-title-content">${i}</div>
83
+ </div>` : S}
84
+ <div class="rpg-x-axis-labels">${l}</div>
85
+ </div>
86
+ `, x = [];
87
+ for (const h of r)
88
+ x.push(c`
89
+ <div class="rpg-axis-label" title=${h}>${h}</div>
90
+ `);
91
+ const u = c`
92
+ <div class="rpg-y-axis">
93
+ <div class="rpg-y-axis-labels">${x}</div>
94
+ <div
95
+ class="rpg-y-axis-line-container"
96
+ role="slider"
97
+ tabindex=${this.yAxisPosition === v.Left ? "1" : "0"}
98
+ aria-valuemin="0"
99
+ aria-valuemax="100"
100
+ aria-valuenow=${this._yAxisWidthPercentage}
101
+ aria-valuetext=${this._yAxisWidthDescription}
102
+ aria-label=${`Y-axis positioned ${this.yAxisPosition}`}
103
+ @dragstart=${Q}
104
+ @pointerdown=${this.onYAxisPointerDown}
105
+ @keydown=${this.onYAxisKeyDown}
106
+ >
107
+ ${a ? c`<div class="rpg-axis-label rpg-axis-title">
108
+ <div class="rpg-axis-title-content">${a}</div>
109
+ </div>` : S}
110
+ <div class="rpg-y-axis-line"></div>
111
+ </div>
112
+ </div>
113
+ `, p = [];
114
+ for (let h = 0; h < this._ticks.length - 1; h++)
115
+ p.push(c`<div class="rpg-gridline"></div>`);
116
+ const W = [];
117
+ for (const [h, { value: g }] of this.data.entries()) {
118
+ const w = h === this._focusedBarIndex, $ = this._categoryLabels[h], X = this._tickLabels[h], B = D(g, this.formatters.data), Y = D(
119
+ g,
120
+ this.formatters.tooltip || this.formatters.value
121
+ ), E = this._allPositive || !this._allNegative ? g >= 0 : g > 0, O = Z(
122
+ g,
123
+ this._ticks[0],
124
+ this._ticks.at(-1)
125
+ );
126
+ W.push(
127
+ c`<li
128
+ class="rpg-bar ${E ? "positive" : "negative"}"
129
+ tabindex=${w ? 0 : -1}
130
+ aria-current=${w ? "true" : "false"}
131
+ aria-label="${$}: ${X}"
132
+ data-category=${$}
133
+ data-value=${Y}
134
+ >
135
+ <div
136
+ class="rpg-bar-content"
137
+ style="--rpg-bar-size: ${Math.abs(O)}%;"
138
+ >
139
+ <div class="rpg-bar-label">${B}</div>
140
+ <div class="rpg-small-bar-label">${B}</div>
141
+ </div>
142
+ </li>`
143
+ );
144
+ }
145
+ return c`
146
+ <div
147
+ class=${C(this._wrapperClasses)}
148
+ style=${F(this._wrapperStyles)}
149
+ role="figure"
150
+ >
151
+ <div class="rpg-scrollable">
152
+ <div class="rpg-scrollable-content">
153
+ ${t ? n : u}
154
+ <div class="rpg-content-container">
155
+ <div class="rpg-gridlines">${p}</div>
156
+ <ul
157
+ class=${C(this._barContainerClasses)}
158
+ @mouseenter=${this.onBarEnter}
159
+ @mouseleave=${this.onBarContainerMouseLeave}
160
+ @focus=${this.onBarContainerFocus}
161
+ @blur=${this.onBarContainerBlur}
162
+ @keydown=${this.onBarContainerKeyDown}
163
+ >
164
+ ${this.data.length ? W : c`<div class="rpg-empty-state">No data</div>`}
165
+ </ul>
166
+ </div>
167
+ </div>
168
+ </div>
169
+ ${t ? u : n}
170
+ </div>
171
+ <tool-tip
172
+ .element=${this._isDraggingYAxis ? null : this._activeBar}
173
+ .container=${this._scrollableElem}
174
+ orientation=${this.orientation}
175
+ theme=${this.tooltipTheme}
176
+ ></tool-tip>
177
+ <div aria-live="polite">${this._yAxisWidthDescription}</div>
178
+ <div id="rpg-get-text-width" class="rpg-axis-label"></div>
179
+ `;
180
+ }
181
+ connectedCallback() {
182
+ super.connectedCallback(), customElements.get("tool-tip") || customElements.define("tool-tip", K);
183
+ }
184
+ firstUpdated(t) {
185
+ super.firstUpdated(t), this._calculateYAxisWidths(), this.addObservers();
186
+ }
187
+ updated(t) {
188
+ this._xAxis && (this._xAxisHeight = this._xAxis.getBoundingClientRect().height ?? 0), (t.get("orientation") || t.get("data")) && this._calculateYAxisWidths();
189
+ }
190
+ _calculateYAxisWidths() {
191
+ const t = this.orientation === b.Vertical;
192
+ [this._yAxisMinWidth, this._yAxisWidth, this._yAxisMaxWidth] = nt(
193
+ this._textSizeDiv,
194
+ this._wrapper,
195
+ this._yAxis,
196
+ t ? this._tickLabels : this._categoryLabels
197
+ );
198
+ }
199
+ _calculateTickWidths() {
200
+ this._firstXAxisLabelWidth = M(
201
+ this._textSizeDiv,
202
+ this._tickLabels[0].toString()
203
+ ), this._lastXAxisLabelWidth = M(
204
+ this._textSizeDiv,
205
+ this._tickLabels.at(-1)?.toString()
206
+ );
207
+ }
208
+ addObservers() {
209
+ const t = {
210
+ root: this._scrollableElem,
211
+ threshold: 1
212
+ }, i = () => {
213
+ this._scrollbarSize = lt(
214
+ this.orientation,
215
+ this._scrollableElem
216
+ );
217
+ };
218
+ this._vObserver = new IntersectionObserver(i, {
219
+ ...t,
220
+ rootMargin: "0px -16px"
221
+ }), this._hObserver = new IntersectionObserver(i, {
222
+ ...t,
223
+ rootMargin: "-16px 0px"
224
+ }), this._vObserver.observe(this._barContainer), this._hObserver.observe(this._barContainer);
225
+ }
226
+ onBarEnter(t) {
227
+ const i = t.target;
228
+ i.classList.contains("rpg-bar") && (this._activeBar = i);
229
+ }
230
+ onBarContainerMouseLeave(t) {
231
+ t.target === t.currentTarget && (this._activeBar = null);
232
+ }
233
+ onBarContainerFocus(t) {
234
+ this._activeBar = t.target;
235
+ }
236
+ onBarContainerBlur(t) {
237
+ const i = t.relatedTarget;
238
+ (!i || i && !this._barContainer.contains(i)) && (this._activeBar = null, this._focusedBarIndex = 0);
239
+ }
240
+ onBarContainerKeyDown(t) {
241
+ const i = this.orientation === b.Vertical, a = i ? "ArrowRight" : "ArrowDown", o = i ? "ArrowLeft" : "ArrowUp", r = t.key;
242
+ r === a ? (t.preventDefault(), this._focusedBarIndex = Math.min(
243
+ this._focusedBarIndex + 1,
244
+ this.data.length - 1
245
+ ), this._bars[this._focusedBarIndex].focus()) : r === o ? (t.preventDefault(), this._focusedBarIndex = Math.max(this._focusedBarIndex - 1, 0), this._bars[this._focusedBarIndex].focus()) : r === "Home" ? (t.preventDefault(), this._focusedBarIndex = 0, this._bars[this._focusedBarIndex].focus()) : r === "End" && (t.preventDefault(), this._focusedBarIndex = this.data.length - 1, this._bars[this._focusedBarIndex].focus());
246
+ }
247
+ onYAxisPointerDown(t) {
248
+ t.preventDefault(), this._isDraggingYAxis = !0;
249
+ let i = this._yAxisWidth;
250
+ const a = this, o = (l) => {
251
+ const n = a._wrapper, x = l.clientX, u = t.clientX;
252
+ i = a._yAxisWidth + (a.yAxisPosition === v.Left ? x - u : u - x);
253
+ let p = a._yAxisMaxWidth;
254
+ i < a._yAxisMinWidth && (i = a._yAxisMinWidth), a._yAxisMaxWidth > n.offsetWidth - L && (p = n.offsetWidth - L), i > p && (i = p), this._wrapper.style.setProperty(I, `${i}px`);
255
+ };
256
+ function r() {
257
+ a._yAxisWidth = i, a._isDraggingYAxis = !1, a._oldCursor ? document.body.style.cursor = a._oldCursor : document.body.style.removeProperty("cursor"), window.removeEventListener("pointermove", o), window.removeEventListener("pointerup", r);
258
+ }
259
+ a._oldCursor = document.body.style.cursor, document.body.style.cursor = "col-resize", window.addEventListener("pointermove", o), window.addEventListener("pointerup", r);
260
+ }
261
+ onYAxisKeyDown(t) {
262
+ const i = parseInt(this._yAxisWidthPercentage ?? "0", 10), a = t.key, o = this.yAxisPosition === v.Left, r = o ? "ArrowLeft" : "ArrowRight", l = o ? "ArrowRight" : "ArrowLeft", n = {
263
+ currentPercentage: i,
264
+ minWidth: this._yAxisMinWidth,
265
+ maxWidth: this._yAxisMaxWidth
266
+ };
267
+ a === r ? (t.preventDefault(), this._yAxisWidth = f({
268
+ ...n,
269
+ widthPercentage: Math.max(i - 5, 0)
270
+ }) ?? this._yAxisWidth) : a === l ? (t.preventDefault(), this._yAxisWidth = f({
271
+ ...n,
272
+ widthPercentage: Math.min(i + 5, 100)
273
+ }) ?? this._yAxisWidth) : a === "Home" ? (t.preventDefault(), this._yAxisWidth = f({
274
+ ...n,
275
+ widthPercentage: 0
276
+ }) ?? this._yAxisWidth) : a === "End" && (t.preventDefault(), this._yAxisWidth = f({
277
+ ...n,
278
+ widthPercentage: 100
279
+ }) ?? this._yAxisWidth);
280
+ }
281
+ disconnectedCallback() {
282
+ super.disconnectedCallback(), this._vObserver?.unobserve(this._barContainer), this._hObserver?.unobserve(this._barContainer);
283
+ }
284
+ };
285
+ s([
286
+ _()
287
+ ], e.prototype, "_xAxisHeight", 2);
288
+ s([
289
+ _()
290
+ ], e.prototype, "_firstXAxisLabelWidth", 2);
291
+ s([
292
+ _()
293
+ ], e.prototype, "_lastXAxisLabelWidth", 2);
294
+ s([
295
+ _()
296
+ ], e.prototype, "_scrollbarSize", 2);
297
+ s([
298
+ _()
299
+ ], e.prototype, "_activeBar", 2);
300
+ s([
301
+ _()
302
+ ], e.prototype, "_yAxisWidth", 2);
303
+ s([
304
+ _()
305
+ ], e.prototype, "_isDraggingYAxis", 2);
306
+ s([
307
+ _()
308
+ ], e.prototype, "_focusedBarIndex", 2);
309
+ s([
310
+ d({ type: Array, attribute: !1 })
311
+ ], e.prototype, "data", 1);
312
+ s([
313
+ d({ type: Object, attribute: !1 })
314
+ ], e.prototype, "formatters", 2);
315
+ s([
316
+ d({ type: b })
317
+ ], e.prototype, "orientation", 2);
318
+ s([
319
+ d({ type: T, attribute: "x-axis-position" })
320
+ ], e.prototype, "xAxisPosition", 2);
321
+ s([
322
+ d({ type: v, attribute: "y-axis-position" })
323
+ ], e.prototype, "yAxisPosition", 2);
324
+ s([
325
+ d({ type: m })
326
+ ], e.prototype, "theme", 2);
327
+ s([
328
+ d({ type: m, attribute: "tooltip-theme" })
329
+ ], e.prototype, "tooltipTheme", 2);
330
+ s([
331
+ d({ type: String, attribute: "category-label" })
332
+ ], e.prototype, "categoryLabel", 2);
333
+ s([
334
+ d({ type: String, attribute: "value-label" })
335
+ ], e.prototype, "valueLabel", 2);
336
+ s([
337
+ d({ type: k, attribute: "show-labels" })
338
+ ], e.prototype, "showLabels", 2);
339
+ s([
340
+ y(".rpg")
341
+ ], e.prototype, "_wrapper", 2);
342
+ s([
343
+ y(".rpg-scrollable")
344
+ ], e.prototype, "_scrollableElem", 2);
345
+ s([
346
+ y(".rpg-bar-container")
347
+ ], e.prototype, "_barContainer", 2);
348
+ s([
349
+ y(".rpg-x-axis")
350
+ ], e.prototype, "_xAxis", 2);
351
+ s([
352
+ y(".rpg-y-axis")
353
+ ], e.prototype, "_yAxis", 2);
354
+ s([
355
+ y("#rpg-get-text-width")
356
+ ], e.prototype, "_textSizeDiv", 2);
357
+ s([
358
+ R(".rpg-bar")
359
+ ], e.prototype, "_bars", 2);
360
+ s([
361
+ A({ capture: !0 })
362
+ ], e.prototype, "onBarEnter", 1);
363
+ s([
364
+ A({ capture: !0 })
365
+ ], e.prototype, "onBarContainerMouseLeave", 1);
366
+ s([
367
+ A({ capture: !0 })
368
+ ], e.prototype, "onBarContainerFocus", 1);
369
+ s([
370
+ A({ capture: !0 })
371
+ ], e.prototype, "onBarContainerBlur", 1);
372
+ s([
373
+ A({ capture: !0 })
374
+ ], e.prototype, "onBarContainerKeyDown", 1);
375
+ e = s([
376
+ N("rapido-bar")
377
+ ], e);
378
+ export {
379
+ e as Rapidobar
380
+ };
381
+ //# sourceMappingURL=index.js.map