reke-ui 0.5.2 → 0.5.4
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/custom-elements.json +764 -3
- package/dist/components/reke-bar-chart/reke-bar-chart.d.ts +99 -0
- package/dist/components/reke-bar-chart/reke-bar-chart.d.ts.map +1 -0
- package/dist/components/reke-bar-chart/reke-bar-chart.js +319 -0
- package/dist/components/reke-bar-chart/reke-bar-chart.styles.d.ts +2 -0
- package/dist/components/reke-bar-chart/reke-bar-chart.styles.d.ts.map +1 -0
- package/dist/components/reke-bar-chart/reke-bar-chart.styles.js +36 -0
- package/dist/components/reke-dialog/reke-dialog.d.ts +19 -0
- package/dist/components/reke-dialog/reke-dialog.d.ts.map +1 -1
- package/dist/components/reke-dialog/reke-dialog.js +40 -15
- package/dist/components/reke-dialog/reke-dialog.styles.d.ts.map +1 -1
- package/dist/components/reke-dialog/reke-dialog.styles.js +110 -0
- package/dist/components/reke-pie-chart/reke-pie-chart.d.ts +52 -1
- package/dist/components/reke-pie-chart/reke-pie-chart.d.ts.map +1 -1
- package/dist/components/reke-pie-chart/reke-pie-chart.js +181 -42
- package/dist/components/reke-pie-chart/reke-pie-chart.styles.d.ts.map +1 -1
- package/dist/components/reke-pie-chart/reke-pie-chart.styles.js +47 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +21 -20
- package/dist/node_modules/echarts/lib/chart/bar/BarSeries.js +50 -0
- package/dist/node_modules/echarts/lib/chart/bar/BarView.js +431 -0
- package/dist/node_modules/echarts/lib/chart/bar/BaseBarSeries.js +65 -0
- package/dist/node_modules/echarts/lib/chart/bar/install.js +22 -0
- package/dist/node_modules/echarts/lib/chart/helper/Symbol.js +142 -0
- package/dist/node_modules/echarts/lib/chart/helper/SymbolDraw.js +99 -0
- package/dist/node_modules/echarts/lib/chart/helper/axisSnippets.js +19 -0
- package/dist/node_modules/echarts/lib/chart/helper/createClipPathFromCoordSys.js +50 -0
- package/dist/node_modules/echarts/lib/chart/helper/createSeriesData.js +55 -0
- package/dist/node_modules/echarts/lib/chart/helper/createSeriesDataSimply.js +3 -3
- package/dist/node_modules/echarts/lib/chart/helper/labelHelper.js +24 -0
- package/dist/node_modules/echarts/lib/chart/line/LineSeries.js +60 -0
- package/dist/node_modules/echarts/lib/chart/line/LineView.js +471 -0
- package/dist/node_modules/echarts/lib/chart/line/helper.js +34 -0
- package/dist/node_modules/echarts/lib/chart/line/install.js +16 -0
- package/dist/node_modules/echarts/lib/chart/line/lineAnimationDiff.js +59 -0
- package/dist/node_modules/echarts/lib/chart/line/poly.js +135 -0
- package/dist/node_modules/echarts/lib/chart/pie/PieSeries.js +32 -32
- package/dist/node_modules/echarts/lib/chart/pie/PieView.js +69 -69
- package/dist/node_modules/echarts/lib/chart/pie/labelLayout.js +25 -25
- package/dist/node_modules/echarts/lib/chart/pie/pieLayout.js +16 -16
- package/dist/node_modules/echarts/lib/component/axis/AxisBuilder.js +153 -153
- package/dist/node_modules/echarts/lib/component/axis/AxisView.js +13 -13
- package/dist/node_modules/echarts/lib/component/axis/CartesianAxisView.js +106 -0
- package/dist/node_modules/echarts/lib/component/axis/axisSplitHelper.js +50 -0
- package/dist/node_modules/echarts/lib/component/axisPointer/BaseAxisPointer.js +20 -20
- package/dist/node_modules/echarts/lib/component/axisPointer/CartesianAxisPointer.js +30 -30
- package/dist/node_modules/echarts/lib/component/axisPointer/viewHelper.js +13 -13
- package/dist/node_modules/echarts/lib/component/dataZoom/AxisProxy.js +114 -0
- package/dist/node_modules/echarts/lib/component/dataZoom/DataZoomModel.js +189 -0
- package/dist/node_modules/echarts/lib/component/dataZoom/DataZoomView.js +15 -0
- package/dist/node_modules/echarts/lib/component/dataZoom/InsideZoomModel.js +21 -0
- package/dist/node_modules/echarts/lib/component/dataZoom/InsideZoomView.js +67 -0
- package/dist/node_modules/echarts/lib/component/dataZoom/SliderZoomModel.js +75 -0
- package/dist/node_modules/echarts/lib/component/dataZoom/SliderZoomView.js +465 -0
- package/dist/node_modules/echarts/lib/component/dataZoom/dataZoomAction.js +17 -0
- package/dist/node_modules/echarts/lib/component/dataZoom/dataZoomProcessor.js +55 -0
- package/dist/node_modules/echarts/lib/component/dataZoom/helper.js +88 -0
- package/dist/node_modules/echarts/lib/component/dataZoom/installCommon.js +14 -0
- package/dist/node_modules/echarts/lib/component/dataZoom/installDataZoomInside.js +10 -0
- package/dist/node_modules/echarts/lib/component/dataZoom/installDataZoomSlider.js +9 -0
- package/dist/node_modules/echarts/lib/component/dataZoom/roams.js +132 -0
- package/dist/node_modules/echarts/lib/component/grid/install.js +9 -0
- package/dist/node_modules/echarts/lib/component/grid/installSimple.js +32 -0
- package/dist/node_modules/echarts/lib/component/helper/RoamController.js +172 -0
- package/dist/node_modules/echarts/lib/component/helper/cursorHelper.js +17 -0
- package/dist/node_modules/echarts/lib/component/helper/interactionMutex.js +15 -0
- package/dist/node_modules/echarts/lib/component/helper/sliderMove.js +29 -0
- package/dist/node_modules/echarts/lib/component/legend/LegendModel.js +31 -31
- package/dist/node_modules/echarts/lib/component/legend/LegendView.js +61 -61
- package/dist/node_modules/echarts/lib/component/legend/ScrollableLegendView.js +29 -29
- package/dist/node_modules/echarts/lib/component/tooltip/TooltipRichContent.js +4 -4
- package/dist/node_modules/echarts/lib/component/tooltip/TooltipView.js +105 -105
- package/dist/node_modules/echarts/lib/coord/Axis.js +92 -0
- package/dist/node_modules/echarts/lib/coord/CoordinateSystem.js +6 -0
- package/dist/node_modules/echarts/lib/coord/axisAlignTicks.js +76 -0
- package/dist/node_modules/echarts/lib/coord/axisCommonTypes.js +9 -0
- package/dist/node_modules/echarts/lib/coord/axisDefault.js +124 -0
- package/dist/node_modules/echarts/lib/coord/axisHelper.js +123 -14
- package/dist/node_modules/echarts/lib/coord/axisModelCommonMixin.js +9 -0
- package/dist/node_modules/echarts/lib/coord/axisModelCreator.js +39 -0
- package/dist/node_modules/echarts/lib/coord/axisNiceTicks.js +64 -0
- package/dist/node_modules/echarts/lib/coord/axisStatistics.js +101 -22
- package/dist/node_modules/echarts/lib/coord/axisStatisticsMetricsImpl.js +43 -0
- package/dist/node_modules/echarts/lib/coord/axisTickLabelBuilder.js +151 -5
- package/dist/node_modules/echarts/lib/coord/cartesian/Axis2D.js +24 -0
- package/dist/node_modules/echarts/lib/coord/cartesian/AxisModel.js +18 -0
- package/dist/node_modules/echarts/lib/coord/cartesian/Cartesian.js +23 -0
- package/dist/node_modules/echarts/lib/coord/cartesian/Cartesian2D.js +69 -0
- package/dist/node_modules/echarts/lib/coord/cartesian/Grid.js +314 -0
- package/dist/node_modules/echarts/lib/coord/cartesian/GridModel.js +40 -0
- package/dist/node_modules/echarts/lib/coord/cartesian/cartesianAxisHelper.js +43 -12
- package/dist/node_modules/echarts/lib/coord/scaleRawExtentInfo.js +175 -0
- package/dist/node_modules/echarts/lib/core/CoordinateSystem.js +39 -16
- package/dist/node_modules/echarts/lib/core/echarts.js +421 -421
- package/dist/node_modules/echarts/lib/data/OrdinalMeta.js +30 -0
- package/dist/node_modules/echarts/lib/data/SeriesData.js +18 -18
- package/dist/node_modules/echarts/lib/data/helper/createDimensions.js +6 -6
- package/dist/node_modules/echarts/lib/data/helper/dataStackHelper.js +59 -0
- package/dist/node_modules/echarts/lib/data/helper/dataValueHelper.js +13 -13
- package/dist/node_modules/echarts/lib/data/helper/dimensionHelper.js +7 -4
- package/dist/node_modules/echarts/lib/data/helper/sourceHelper.js +40 -8
- package/dist/node_modules/echarts/lib/data/helper/sourceManager.js +3 -3
- package/dist/node_modules/echarts/lib/data/helper/transform.js +8 -8
- package/dist/node_modules/echarts/lib/extension.js +10 -10
- package/dist/node_modules/echarts/lib/label/labelGuideHelper.js +10 -10
- package/dist/node_modules/echarts/lib/label/labelStyle.js +34 -25
- package/dist/node_modules/echarts/lib/label/sectorLabel.js +83 -0
- package/dist/node_modules/echarts/lib/layout/barCommon.js +19 -0
- package/dist/node_modules/echarts/lib/layout/barGrid.js +165 -0
- package/dist/node_modules/echarts/lib/layout/points.js +37 -0
- package/dist/node_modules/echarts/lib/loading/default.js +6 -6
- package/dist/node_modules/echarts/lib/model/Component.js +39 -39
- package/dist/node_modules/echarts/lib/model/Global.js +122 -122
- package/dist/node_modules/echarts/lib/model/Series.js +78 -78
- package/dist/node_modules/echarts/lib/model/referHelper.js +58 -0
- package/dist/node_modules/echarts/lib/processor/dataSample.js +43 -0
- package/dist/node_modules/echarts/lib/scale/Interval.js +68 -0
- package/dist/node_modules/echarts/lib/scale/Log.js +100 -0
- package/dist/node_modules/echarts/lib/scale/Ordinal.js +92 -0
- package/dist/node_modules/echarts/lib/scale/Scale.js +13 -0
- package/dist/node_modules/echarts/lib/scale/Time.js +242 -0
- package/dist/node_modules/echarts/lib/scale/break.js +10 -2
- package/dist/node_modules/echarts/lib/scale/helper.js +61 -3
- package/dist/node_modules/echarts/lib/scale/minorTicks.js +22 -0
- package/dist/node_modules/echarts/lib/scale/scaleMapper.js +89 -7
- package/dist/node_modules/echarts/lib/util/clazz.js +35 -35
- package/dist/node_modules/echarts/lib/util/component.js +16 -16
- package/dist/node_modules/echarts/lib/util/cycleCache.js +4 -1
- package/dist/node_modules/echarts/lib/util/decal.js +11 -11
- package/dist/node_modules/echarts/lib/util/format.js +1 -1
- package/dist/node_modules/echarts/lib/util/graphic.js +170 -170
- package/dist/node_modules/echarts/lib/util/layout.js +23 -23
- package/dist/node_modules/echarts/lib/util/model.js +128 -68
- package/dist/node_modules/echarts/lib/util/number.js +55 -37
- package/dist/node_modules/echarts/lib/util/shape/sausage.js +25 -0
- package/dist/node_modules/echarts/lib/util/states.js +96 -82
- package/dist/node_modules/echarts/lib/util/styleCompat.js +10 -0
- package/dist/node_modules/echarts/lib/util/symbol.js +24 -21
- package/dist/node_modules/echarts/lib/util/time.js +154 -18
- package/dist/node_modules/echarts/lib/util/vendor.js +26 -0
- package/dist/node_modules/echarts/lib/view/Chart.js +19 -19
- package/dist/node_modules/echarts/lib/view/Component.js +7 -7
- package/dist/node_modules/echarts/lib/visual/style.js +5 -5
- package/dist/node_modules/zrender/lib/Element.js +35 -35
- package/dist/node_modules/zrender/lib/canvas/graphic.js +36 -36
- package/dist/node_modules/zrender/lib/core/PathProxy.js +25 -25
- package/dist/node_modules/zrender/lib/core/event.js +4 -1
- package/dist/node_modules/zrender/lib/core/util.js +69 -64
- package/dist/node_modules/zrender/lib/graphic/TSpan.js +7 -7
- package/dist/node_modules/zrender/lib/graphic/Text.js +37 -37
- package/dist/node_modules/zrender/lib/graphic/helper/parseText.js +59 -59
- package/dist/node_modules/zrender/lib/tool/color.js +60 -41
- package/dist/react.d.ts +10 -0
- package/dist/react.d.ts.map +1 -1
- package/dist/react.js +85 -73
- package/dist/shared/tailwind.js +1 -1
- package/dist/tokens/reke-tokens.css +1 -0
- package/package.json +5 -1
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { type PropertyValues } from 'lit';
|
|
2
|
+
import { RekeElement } from '../../shared/base-element.js';
|
|
3
|
+
export interface BarChartSeries {
|
|
4
|
+
name: string;
|
|
5
|
+
/** One value per entry in `categories`, in the same order. Negative values draw below zero. */
|
|
6
|
+
data: number[];
|
|
7
|
+
color?: string;
|
|
8
|
+
/** `line` overlays the series as a line (e.g. a running total); it is never stacked. Defaults to `bar`. */
|
|
9
|
+
type?: 'bar' | 'line';
|
|
10
|
+
}
|
|
11
|
+
export interface BarChartSelectDetail {
|
|
12
|
+
category: string;
|
|
13
|
+
series: string;
|
|
14
|
+
value: number;
|
|
15
|
+
index: number;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* @tag reke-bar-chart
|
|
19
|
+
* @summary A categorical bar chart (grouped or stacked) rendered with ECharts, isolated in Shadow DOM.
|
|
20
|
+
*
|
|
21
|
+
* Canvas cannot resolve `var()`, so every token below is read off the host's
|
|
22
|
+
* computed style and re-read whenever `data-reke-theme` or the OS color scheme
|
|
23
|
+
* changes on the document.
|
|
24
|
+
*
|
|
25
|
+
* @csspart chart - The chart canvas container.
|
|
26
|
+
*
|
|
27
|
+
* @fires reke-bar-chart-select - Fired when a bar is clicked. `detail: { category, series, value, index }`.
|
|
28
|
+
*
|
|
29
|
+
* @cssprop [--reke-chart-1=#22C55E] - Series colors 1–6 (`--reke-chart-1` … `--reke-chart-6`).
|
|
30
|
+
* @cssprop [--reke-bar-chart-height=280px] - Chart height.
|
|
31
|
+
* @cssprop [--reke-color-primary=#22C55E] - Loading spinner color.
|
|
32
|
+
* @cssprop [--reke-color-bg=#0A0A0B] - Loading mask tint.
|
|
33
|
+
* @cssprop [--reke-color-surface=#1A1A1A] - Tooltip background.
|
|
34
|
+
* @cssprop [--reke-color-border=#252525] - Tooltip border and grid lines.
|
|
35
|
+
* @cssprop [--reke-color-text=#E5E5E5] - Tooltip text.
|
|
36
|
+
* @cssprop [--reke-color-text-label=#8A8A8A] - Axis labels and legend text.
|
|
37
|
+
* @cssprop [--reke-color-text-disabled=#3B3B3B] - Legend items toggled off.
|
|
38
|
+
* @cssprop [--reke-font-mono=JetBrains Mono] - Chart font family.
|
|
39
|
+
*/
|
|
40
|
+
export declare class RekeBarChart extends RekeElement {
|
|
41
|
+
static styles: import("lit").CSSResult[];
|
|
42
|
+
/** X-axis categories (e.g. months). */
|
|
43
|
+
categories: string[];
|
|
44
|
+
/** Bar series; each `data` array is aligned with `categories`. */
|
|
45
|
+
series: BarChartSeries[];
|
|
46
|
+
/** Accessible label describing the chart. Required for screen readers. */
|
|
47
|
+
label: string;
|
|
48
|
+
/** Stack every series into a single bar per category instead of grouping them side by side. */
|
|
49
|
+
stacked: boolean;
|
|
50
|
+
/** Show the legend above the chart. */
|
|
51
|
+
showLegend: boolean;
|
|
52
|
+
/** Show ECharts' native loading spinner over the chart. */
|
|
53
|
+
loading: boolean;
|
|
54
|
+
/** Explicit color palette. Overrides the `--reke-chart-*` tokens when set. */
|
|
55
|
+
palette?: string[];
|
|
56
|
+
/** Entry/update animation length in ms. `0` disables animation. */
|
|
57
|
+
animationDuration: number;
|
|
58
|
+
/**
|
|
59
|
+
* Most categories drawn at once. Past it the chart opens on the latest ones
|
|
60
|
+
* and becomes scrollable/zoomable (wheel, drag, and a slider below). `0` = show all.
|
|
61
|
+
*/
|
|
62
|
+
maxVisible: number;
|
|
63
|
+
private chart?;
|
|
64
|
+
private observer?;
|
|
65
|
+
private themeObserver?;
|
|
66
|
+
private colorScheme?;
|
|
67
|
+
/** Read a CSS custom property off the host's computed style (canvas can't read var()). */
|
|
68
|
+
private readToken;
|
|
69
|
+
/** Honours the OS "reduce motion" setting: 0ms means ECharts paints statically. */
|
|
70
|
+
private motionDuration;
|
|
71
|
+
private resolvePalette;
|
|
72
|
+
firstUpdated(): void;
|
|
73
|
+
/** Repaints with freshly read tokens when the theme switches. */
|
|
74
|
+
private watchTheme;
|
|
75
|
+
/** Static repaint: a theme switch should not replay the entry animation. */
|
|
76
|
+
private repaint;
|
|
77
|
+
updated(changed: PropertyValues): void;
|
|
78
|
+
private applyLoading;
|
|
79
|
+
disconnectedCallback(): void;
|
|
80
|
+
/** "2026-01: USDC 100, USDT 20" — one line per category for assistive tech. */
|
|
81
|
+
private describeCategory;
|
|
82
|
+
private get chartAriaLabel();
|
|
83
|
+
private buildOption;
|
|
84
|
+
/**
|
|
85
|
+
* Corner radius per bar item. A bar is rounded at its far end from zero: top
|
|
86
|
+
* corners above zero, bottom corners below. Stacked, only the outermost
|
|
87
|
+
* segment on each side of zero is rounded, so each stack reads as one shape
|
|
88
|
+
* (ECharts stacks positives and negatives separately — `samesign`).
|
|
89
|
+
*/
|
|
90
|
+
private itemRadius;
|
|
91
|
+
private buildSeries;
|
|
92
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
93
|
+
}
|
|
94
|
+
declare global {
|
|
95
|
+
interface HTMLElementTagNameMap {
|
|
96
|
+
'reke-bar-chart': RekeBarChart;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
//# sourceMappingURL=reke-bar-chart.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reke-bar-chart.d.ts","sourceRoot":"","sources":["../../../src/components/reke-bar-chart/reke-bar-chart.ts"],"names":[],"mappings":"AAeA,OAAO,EAAQ,KAAK,cAAc,EAAE,MAAM,KAAK,CAAC;AAEhD,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAuB3D,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,+FAA+F;IAC/F,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,2GAA2G;IAC3G,IAAI,CAAC,EAAE,KAAK,GAAG,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,oBAAoB;IACnC,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf;AA+BD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,qBACa,YAAa,SAAQ,WAAW;IAC3C,OAAgB,MAAM,4BAAU;IAEhC,uCAAuC;IAEvC,UAAU,EAAE,MAAM,EAAE,CAAM;IAE1B,kEAAkE;IAElE,MAAM,EAAE,cAAc,EAAE,CAAM;IAE9B,0EAA0E;IAE1E,KAAK,SAAe;IAEpB,+FAA+F;IAE/F,OAAO,UAAS;IAEhB,uCAAuC;IAEvC,UAAU,UAAS;IAEnB,2DAA2D;IAE3D,OAAO,UAAS;IAEhB,8EAA8E;IAE9E,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IAEnB,mEAAmE;IAEnE,iBAAiB,SAAO;IAExB;;;OAGG;IAEH,UAAU,SAAK;IAEf,OAAO,CAAC,KAAK,CAAC,CAAU;IACxB,OAAO,CAAC,QAAQ,CAAC,CAAiB;IAClC,OAAO,CAAC,aAAa,CAAC,CAAmB;IACzC,OAAO,CAAC,WAAW,CAAC,CAAiB;IAErC,0FAA0F;IAC1F,OAAO,CAAC,SAAS;IAKjB,mFAAmF;IACnF,OAAO,CAAC,cAAc;IAMtB,OAAO,CAAC,cAAc;IAKb,YAAY,IAAI,IAAI;IAmB7B,iEAAiE;IACjE,OAAO,CAAC,UAAU;IAYlB,4EAA4E;IAC5E,OAAO,CAAC,OAAO,CAGb;IAEO,OAAO,CAAC,OAAO,EAAE,cAAc,GAAG,IAAI;IAiB/C,OAAO,CAAC,YAAY;IAYX,oBAAoB,IAAI,IAAI;IAWrC,+EAA+E;IAC/E,OAAO,CAAC,gBAAgB;IAKxB,OAAO,KAAK,cAAc,GAGzB;IAED,OAAO,CAAC,WAAW;IA4HnB;;;;;OAKG;IACH,OAAO,CAAC,UAAU;IAalB,OAAO,CAAC,WAAW;IAqCV,MAAM;CAUhB;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,gBAAgB,EAAE,YAAY,CAAC;KAChC;CACF"}
|
|
@@ -0,0 +1,319 @@
|
|
|
1
|
+
import { RekeElement as e } from "../../shared/base-element.js";
|
|
2
|
+
import { __decorate as t } from "../../_virtual/_@oxc-project_runtime@0.137.0/helpers/esm/decorate.js";
|
|
3
|
+
import { encodeHTML as n } from "../../node_modules/zrender/lib/core/dom.js";
|
|
4
|
+
import { install as r } from "../../node_modules/echarts/lib/chart/line/install.js";
|
|
5
|
+
import { install as i } from "../../node_modules/echarts/lib/chart/bar/install.js";
|
|
6
|
+
import { init as a } from "../../node_modules/echarts/lib/core/echarts.js";
|
|
7
|
+
import { use as o } from "../../node_modules/echarts/lib/extension.js";
|
|
8
|
+
import { install as s } from "../../node_modules/echarts/lib/component/grid/install.js";
|
|
9
|
+
import { install as c } from "../../node_modules/echarts/lib/component/tooltip/install.js";
|
|
10
|
+
import { install as l } from "../../node_modules/echarts/lib/component/legend/install.js";
|
|
11
|
+
import { install as u } from "../../node_modules/echarts/lib/component/dataZoom/installDataZoomInside.js";
|
|
12
|
+
import { install as d } from "../../node_modules/echarts/lib/component/dataZoom/installDataZoomSlider.js";
|
|
13
|
+
import { install as f } from "../../node_modules/echarts/lib/renderer/installCanvasRenderer.js";
|
|
14
|
+
import { styles as p } from "./reke-bar-chart.styles.js";
|
|
15
|
+
import { html as m } from "lit";
|
|
16
|
+
import { customElement as h, property as g } from "lit/decorators.js";
|
|
17
|
+
//#region src/components/reke-bar-chart/reke-bar-chart.ts
|
|
18
|
+
o([
|
|
19
|
+
i,
|
|
20
|
+
r,
|
|
21
|
+
s,
|
|
22
|
+
u,
|
|
23
|
+
d,
|
|
24
|
+
c,
|
|
25
|
+
l,
|
|
26
|
+
f
|
|
27
|
+
]);
|
|
28
|
+
var _ = [
|
|
29
|
+
"#22C55E",
|
|
30
|
+
"#3B82F6",
|
|
31
|
+
"#F59E0B",
|
|
32
|
+
"#EF4444",
|
|
33
|
+
"#A855F7",
|
|
34
|
+
"#14B8A6"
|
|
35
|
+
], v = "total", y = new Intl.NumberFormat(void 0, {
|
|
36
|
+
notation: "compact",
|
|
37
|
+
maximumFractionDigits: 1
|
|
38
|
+
}), b = new Intl.NumberFormat(void 0, { maximumFractionDigits: 2 });
|
|
39
|
+
function x(e, t) {
|
|
40
|
+
let n = e.trim().replace("#", ""), r = n.length === 3 ? [...n].map((e) => e + e).join("") : n;
|
|
41
|
+
if (!/^[0-9a-f]{6}$/i.test(r)) return `rgba(0, 0, 0, ${t})`;
|
|
42
|
+
let [i, a, o] = [
|
|
43
|
+
0,
|
|
44
|
+
2,
|
|
45
|
+
4
|
|
46
|
+
].map((e) => Number.parseInt(r.slice(e, e + 2), 16));
|
|
47
|
+
return `rgba(${i}, ${a}, ${o}, ${t})`;
|
|
48
|
+
}
|
|
49
|
+
var S = class extends e {
|
|
50
|
+
constructor(...e) {
|
|
51
|
+
super(...e), this.categories = [], this.series = [], this.label = "Bar chart", this.stacked = !1, this.showLegend = !1, this.loading = !1, this.animationDuration = 700, this.maxVisible = 0, this.repaint = () => {
|
|
52
|
+
this.chart?.setOption(this.buildOption(!1), !0), this.applyLoading();
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
static {
|
|
56
|
+
this.styles = p;
|
|
57
|
+
}
|
|
58
|
+
readToken(e, t) {
|
|
59
|
+
return getComputedStyle(this).getPropertyValue(e).trim() || t;
|
|
60
|
+
}
|
|
61
|
+
motionDuration() {
|
|
62
|
+
return typeof matchMedia == "function" && matchMedia("(prefers-reduced-motion: reduce)").matches ? 0 : Math.max(0, this.animationDuration);
|
|
63
|
+
}
|
|
64
|
+
resolvePalette() {
|
|
65
|
+
return this.palette?.length ? this.palette : _.map((e, t) => this.readToken(`--reke-chart-${t + 1}`, e));
|
|
66
|
+
}
|
|
67
|
+
firstUpdated() {
|
|
68
|
+
let e = this.renderRoot.querySelector(".chart");
|
|
69
|
+
this.chart = a(e), this.chart.setOption(this.buildOption(!0)), this.applyLoading(), this.chart.on("click", (e) => {
|
|
70
|
+
e.componentType === "series" && this.emit("reke-bar-chart-select", {
|
|
71
|
+
category: String(e.name),
|
|
72
|
+
series: String(e.seriesName),
|
|
73
|
+
value: Number(e.value),
|
|
74
|
+
index: Number(e.dataIndex)
|
|
75
|
+
});
|
|
76
|
+
}), this.observer = new ResizeObserver(() => this.chart?.resize()), this.observer.observe(e), this.watchTheme();
|
|
77
|
+
}
|
|
78
|
+
watchTheme() {
|
|
79
|
+
this.themeObserver = new MutationObserver(() => this.repaint()), this.themeObserver.observe(document.documentElement, {
|
|
80
|
+
attributes: !0,
|
|
81
|
+
attributeFilter: ["data-reke-theme"]
|
|
82
|
+
}), typeof matchMedia == "function" && (this.colorScheme = matchMedia("(prefers-color-scheme: light)"), this.colorScheme.addEventListener("change", this.repaint));
|
|
83
|
+
}
|
|
84
|
+
updated(e) {
|
|
85
|
+
this.chart && ((e.has("categories") || e.has("series") || e.has("stacked") || e.has("showLegend") || e.has("palette") || e.has("animationDuration") || e.has("maxVisible")) && this.chart.setOption(this.buildOption(!0), !0), e.has("loading") && this.applyLoading());
|
|
86
|
+
}
|
|
87
|
+
applyLoading() {
|
|
88
|
+
this.loading ? this.chart?.showLoading("default", {
|
|
89
|
+
text: "",
|
|
90
|
+
color: this.readToken("--reke-color-primary", "#22C55E"),
|
|
91
|
+
maskColor: x(this.readToken("--reke-color-bg", "#0A0A0B"), .6)
|
|
92
|
+
}) : this.chart?.hideLoading();
|
|
93
|
+
}
|
|
94
|
+
disconnectedCallback() {
|
|
95
|
+
this.themeObserver?.disconnect(), this.themeObserver = void 0, this.colorScheme?.removeEventListener("change", this.repaint), this.colorScheme = void 0, super.disconnectedCallback(), this.observer?.disconnect(), this.chart?.dispose(), this.chart = void 0;
|
|
96
|
+
}
|
|
97
|
+
describeCategory(e) {
|
|
98
|
+
let t = this.series.map((t) => `${t.name} ${b.format(t.data[e] ?? 0)}`);
|
|
99
|
+
return `${this.categories[e]}: ${t.join(", ")}`;
|
|
100
|
+
}
|
|
101
|
+
get chartAriaLabel() {
|
|
102
|
+
let e = this.series.map((e) => e.name).join(", ");
|
|
103
|
+
return `${this.label}. ${this.categories.length} categories, series: ${e}`;
|
|
104
|
+
}
|
|
105
|
+
buildOption(e) {
|
|
106
|
+
let t = e ? this.motionDuration() : 0, r = this.readToken("--reke-font-mono", "'JetBrains Mono', ui-monospace, monospace"), i = this.readToken("--reke-color-text", "#E5E5E5"), a = this.readToken("--reke-color-text-label", "#8A8A8A"), o = this.readToken("--reke-color-border", "#252525"), s = this.readToken("--reke-color-surface", "#1A1A1A"), c = this.stacked, l = this.maxVisible > 0 && this.categories.length > this.maxVisible, u = l ? {
|
|
107
|
+
startValue: this.categories.length - this.maxVisible,
|
|
108
|
+
endValue: this.categories.length - 1
|
|
109
|
+
} : void 0, d = this.readToken("--reke-color-primary", "#22C55E");
|
|
110
|
+
return {
|
|
111
|
+
color: this.resolvePalette(),
|
|
112
|
+
animation: t > 0,
|
|
113
|
+
animationDuration: t,
|
|
114
|
+
animationEasing: "cubicOut",
|
|
115
|
+
aria: { enabled: !0 },
|
|
116
|
+
textStyle: { fontFamily: r },
|
|
117
|
+
grid: {
|
|
118
|
+
left: 8,
|
|
119
|
+
right: 8,
|
|
120
|
+
top: this.showLegend ? 36 : 12,
|
|
121
|
+
bottom: l ? 44 : 8,
|
|
122
|
+
containLabel: !0
|
|
123
|
+
},
|
|
124
|
+
dataZoom: u ? [{
|
|
125
|
+
type: "inside",
|
|
126
|
+
xAxisIndex: 0,
|
|
127
|
+
...u,
|
|
128
|
+
zoomOnMouseWheel: "shift",
|
|
129
|
+
moveOnMouseWheel: !0
|
|
130
|
+
}, {
|
|
131
|
+
type: "slider",
|
|
132
|
+
xAxisIndex: 0,
|
|
133
|
+
...u,
|
|
134
|
+
height: 18,
|
|
135
|
+
bottom: 8,
|
|
136
|
+
brushSelect: !1,
|
|
137
|
+
borderColor: o,
|
|
138
|
+
backgroundColor: "transparent",
|
|
139
|
+
fillerColor: x(d, .15),
|
|
140
|
+
dataBackground: {
|
|
141
|
+
lineStyle: {
|
|
142
|
+
color: a,
|
|
143
|
+
opacity: .4
|
|
144
|
+
},
|
|
145
|
+
areaStyle: {
|
|
146
|
+
color: a,
|
|
147
|
+
opacity: .1
|
|
148
|
+
}
|
|
149
|
+
},
|
|
150
|
+
selectedDataBackground: {
|
|
151
|
+
lineStyle: {
|
|
152
|
+
color: d,
|
|
153
|
+
opacity: .6
|
|
154
|
+
},
|
|
155
|
+
areaStyle: {
|
|
156
|
+
color: d,
|
|
157
|
+
opacity: .15
|
|
158
|
+
}
|
|
159
|
+
},
|
|
160
|
+
handleStyle: {
|
|
161
|
+
color: s,
|
|
162
|
+
borderColor: a
|
|
163
|
+
},
|
|
164
|
+
moveHandleStyle: {
|
|
165
|
+
color: a,
|
|
166
|
+
opacity: .4
|
|
167
|
+
},
|
|
168
|
+
textStyle: {
|
|
169
|
+
color: a,
|
|
170
|
+
fontFamily: r,
|
|
171
|
+
fontSize: 10
|
|
172
|
+
}
|
|
173
|
+
}] : [],
|
|
174
|
+
tooltip: {
|
|
175
|
+
trigger: "axis",
|
|
176
|
+
axisPointer: {
|
|
177
|
+
type: "shadow",
|
|
178
|
+
shadowStyle: { color: x(i, .06) }
|
|
179
|
+
},
|
|
180
|
+
backgroundColor: s,
|
|
181
|
+
borderColor: o,
|
|
182
|
+
borderWidth: .5,
|
|
183
|
+
padding: [8, 12],
|
|
184
|
+
textStyle: {
|
|
185
|
+
color: i,
|
|
186
|
+
fontFamily: r,
|
|
187
|
+
fontSize: 12
|
|
188
|
+
},
|
|
189
|
+
extraCssText: `background: linear-gradient(180deg, #FFFFFF10 0%, #FFFFFF05 100%), ${s}; backdrop-filter: blur(40px); box-shadow: 0 12px 60px -2px #00000040; border-radius: 4px;`,
|
|
190
|
+
formatter: (e) => {
|
|
191
|
+
let t = e;
|
|
192
|
+
if (!t.length) return "";
|
|
193
|
+
let r = t.map((e) => `<div style="display:flex;align-items:center;gap:8px;"><span style="display:inline-block;width:8px;height:8px;border-radius:2px;background:${e.color};"></span>${n(e.seriesName)}<span style="margin-left:auto;padding-left:12px;font-weight:600;">${b.format(Number(e.value) || 0)}</span></div>`), s = t.filter((e) => (this.series[e.seriesIndex]?.type ?? "bar") === "bar"), c = s.reduce((e, t) => e + (Number(t.value) || 0), 0), l = s.length > 1 ? `<div style="display:flex;margin-top:4px;padding-top:4px;border-top:0.5px solid ${o};color:${a};">Total<span style="margin-left:auto;padding-left:12px;font-weight:600;color:${i};">${b.format(c)}</span></div>` : "";
|
|
194
|
+
return `<div style="margin-bottom:4px;color:${a};">${n(t[0].name)}</div>${r.join("")}${l}`;
|
|
195
|
+
}
|
|
196
|
+
},
|
|
197
|
+
legend: {
|
|
198
|
+
show: this.showLegend,
|
|
199
|
+
top: 0,
|
|
200
|
+
icon: "roundRect",
|
|
201
|
+
itemWidth: 10,
|
|
202
|
+
itemHeight: 10,
|
|
203
|
+
itemGap: 16,
|
|
204
|
+
textStyle: {
|
|
205
|
+
color: a,
|
|
206
|
+
fontFamily: r,
|
|
207
|
+
fontSize: 12
|
|
208
|
+
},
|
|
209
|
+
inactiveColor: this.readToken("--reke-color-text-disabled", "#3B3B3B")
|
|
210
|
+
},
|
|
211
|
+
xAxis: {
|
|
212
|
+
type: "category",
|
|
213
|
+
data: this.categories,
|
|
214
|
+
axisLine: { lineStyle: { color: o } },
|
|
215
|
+
axisTick: { show: !1 },
|
|
216
|
+
axisLabel: {
|
|
217
|
+
color: a,
|
|
218
|
+
fontFamily: r,
|
|
219
|
+
fontSize: 11
|
|
220
|
+
}
|
|
221
|
+
},
|
|
222
|
+
yAxis: {
|
|
223
|
+
type: "value",
|
|
224
|
+
splitLine: { lineStyle: {
|
|
225
|
+
color: o,
|
|
226
|
+
type: "dashed"
|
|
227
|
+
} },
|
|
228
|
+
axisLabel: {
|
|
229
|
+
color: a,
|
|
230
|
+
fontFamily: r,
|
|
231
|
+
fontSize: 11,
|
|
232
|
+
formatter: (e) => y.format(e)
|
|
233
|
+
}
|
|
234
|
+
},
|
|
235
|
+
series: this.series.map((e, t) => this.buildSeries(e, t, c))
|
|
236
|
+
};
|
|
237
|
+
}
|
|
238
|
+
itemRadius(e, t, n, r) {
|
|
239
|
+
if (!n) return 0;
|
|
240
|
+
let i = n > 0 ? [
|
|
241
|
+
4,
|
|
242
|
+
4,
|
|
243
|
+
0,
|
|
244
|
+
0
|
|
245
|
+
] : [
|
|
246
|
+
0,
|
|
247
|
+
0,
|
|
248
|
+
4,
|
|
249
|
+
4
|
|
250
|
+
];
|
|
251
|
+
if (!r) return i;
|
|
252
|
+
let a = -1;
|
|
253
|
+
return this.series.forEach((e, r) => {
|
|
254
|
+
let i = e.data[t] ?? 0;
|
|
255
|
+
(e.type ?? "bar") === "bar" && i !== 0 && Math.sign(i) === Math.sign(n) && (a = r);
|
|
256
|
+
}), e === a ? i : 0;
|
|
257
|
+
}
|
|
258
|
+
buildSeries(e, t, n) {
|
|
259
|
+
return e.type === "line" ? {
|
|
260
|
+
type: "line",
|
|
261
|
+
name: e.name,
|
|
262
|
+
data: e.data,
|
|
263
|
+
smooth: !0,
|
|
264
|
+
symbol: "circle",
|
|
265
|
+
symbolSize: 4,
|
|
266
|
+
showSymbol: !1,
|
|
267
|
+
lineStyle: {
|
|
268
|
+
width: 2,
|
|
269
|
+
color: e.color
|
|
270
|
+
},
|
|
271
|
+
itemStyle: { color: e.color },
|
|
272
|
+
emphasis: { focus: "series" },
|
|
273
|
+
z: 3
|
|
274
|
+
} : {
|
|
275
|
+
type: "bar",
|
|
276
|
+
name: e.name,
|
|
277
|
+
data: e.data.map((e, r) => ({
|
|
278
|
+
value: e,
|
|
279
|
+
itemStyle: { borderRadius: this.itemRadius(t, r, e, n) }
|
|
280
|
+
})),
|
|
281
|
+
stack: n ? v : void 0,
|
|
282
|
+
barMaxWidth: 32,
|
|
283
|
+
barGap: "20%",
|
|
284
|
+
itemStyle: { color: e.color },
|
|
285
|
+
emphasis: { focus: "series" },
|
|
286
|
+
blur: { itemStyle: { opacity: .35 } },
|
|
287
|
+
animationDelay: (e) => Math.min(e, 24) * 20
|
|
288
|
+
};
|
|
289
|
+
}
|
|
290
|
+
render() {
|
|
291
|
+
return m`
|
|
292
|
+
<div class="frame">
|
|
293
|
+
<div part="chart" class="chart" role="img" aria-label=${this.chartAriaLabel}></div>
|
|
294
|
+
</div>
|
|
295
|
+
<ul class="sr-only">
|
|
296
|
+
${this.categories.map((e, t) => m`<li>${this.describeCategory(t)}</li>`)}
|
|
297
|
+
</ul>
|
|
298
|
+
`;
|
|
299
|
+
}
|
|
300
|
+
};
|
|
301
|
+
t([g({ attribute: !1 })], S.prototype, "categories", void 0), t([g({ attribute: !1 })], S.prototype, "series", void 0), t([g()], S.prototype, "label", void 0), t([g({
|
|
302
|
+
type: Boolean,
|
|
303
|
+
reflect: !0
|
|
304
|
+
})], S.prototype, "stacked", void 0), t([g({
|
|
305
|
+
type: Boolean,
|
|
306
|
+
attribute: "show-legend",
|
|
307
|
+
reflect: !0
|
|
308
|
+
})], S.prototype, "showLegend", void 0), t([g({
|
|
309
|
+
type: Boolean,
|
|
310
|
+
reflect: !0
|
|
311
|
+
})], S.prototype, "loading", void 0), t([g({ attribute: !1 })], S.prototype, "palette", void 0), t([g({
|
|
312
|
+
type: Number,
|
|
313
|
+
attribute: "animation-duration"
|
|
314
|
+
})], S.prototype, "animationDuration", void 0), t([g({
|
|
315
|
+
type: Number,
|
|
316
|
+
attribute: "max-visible"
|
|
317
|
+
})], S.prototype, "maxVisible", void 0), S = t([h("reke-bar-chart")], S);
|
|
318
|
+
//#endregion
|
|
319
|
+
export { S as RekeBarChart };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reke-bar-chart.styles.d.ts","sourceRoot":"","sources":["../../../src/components/reke-bar-chart/reke-bar-chart.styles.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,MAAM,2BAiClB,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { tailwindStyles as e } from "../../shared/tailwind-styles.js";
|
|
2
|
+
import { css as t } from "lit";
|
|
3
|
+
//#region src/components/reke-bar-chart/reke-bar-chart.styles.ts
|
|
4
|
+
var n = [e, t`
|
|
5
|
+
:host {
|
|
6
|
+
display: block;
|
|
7
|
+
width: 100%;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.frame {
|
|
11
|
+
position: relative;
|
|
12
|
+
width: 100%;
|
|
13
|
+
height: var(--reke-bar-chart-height, 280px);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.chart {
|
|
17
|
+
box-sizing: border-box;
|
|
18
|
+
width: 100%;
|
|
19
|
+
height: 100%;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/* Visually hidden but readable by screen readers — canvas is opaque to AT. */
|
|
23
|
+
.sr-only {
|
|
24
|
+
position: absolute;
|
|
25
|
+
width: 1px;
|
|
26
|
+
height: 1px;
|
|
27
|
+
padding: 0;
|
|
28
|
+
margin: -1px;
|
|
29
|
+
overflow: hidden;
|
|
30
|
+
clip: rect(0, 0, 0, 0);
|
|
31
|
+
white-space: nowrap;
|
|
32
|
+
border: 0;
|
|
33
|
+
}
|
|
34
|
+
`];
|
|
35
|
+
//#endregion
|
|
36
|
+
export { n as styles };
|
|
@@ -28,6 +28,21 @@ export declare class RekeDialog extends RekeElement {
|
|
|
28
28
|
variant: DialogVariant;
|
|
29
29
|
/** Drawer slide direction. Only applies when variant="drawer". */
|
|
30
30
|
position: DrawerPosition;
|
|
31
|
+
/**
|
|
32
|
+
* Kept rendering after `open` flips to false so the panel can animate out.
|
|
33
|
+
* Without it `render()` would return `nothing` and the exit would be instant.
|
|
34
|
+
*/
|
|
35
|
+
private _closing;
|
|
36
|
+
/**
|
|
37
|
+
* Set once the enter animation has finished so the resting panel can drop its
|
|
38
|
+
* `transform`. `animation-fill-mode: both` otherwise keeps the final keyframe
|
|
39
|
+
* applied forever, and a transformed element becomes the containing block for
|
|
40
|
+
* its `position: fixed` descendants — which silently relocates every floating
|
|
41
|
+
* layer inside the dialog (combobox dropdowns, menus) because their
|
|
42
|
+
* viewport-based coordinates are suddenly resolved against the panel.
|
|
43
|
+
*/
|
|
44
|
+
private _settled;
|
|
45
|
+
private _exitTimer;
|
|
31
46
|
/** Element focused before the dialog opened, restored on close. */
|
|
32
47
|
private _previouslyFocused;
|
|
33
48
|
/** Body `overflow` value to put back when the scroll lock is released. */
|
|
@@ -36,6 +51,7 @@ export declare class RekeDialog extends RekeElement {
|
|
|
36
51
|
private _handleKeydown;
|
|
37
52
|
connectedCallback(): void;
|
|
38
53
|
disconnectedCallback(): void;
|
|
54
|
+
protected willUpdate(changed: PropertyValues<this>): void;
|
|
39
55
|
protected updated(changed: PropertyValues<this>): void;
|
|
40
56
|
show(): void;
|
|
41
57
|
close(): void;
|
|
@@ -48,6 +64,9 @@ export declare class RekeDialog extends RekeElement {
|
|
|
48
64
|
private getSlottedFocusable;
|
|
49
65
|
private handleOpened;
|
|
50
66
|
private handleClosed;
|
|
67
|
+
private startExit;
|
|
68
|
+
private cancelExit;
|
|
69
|
+
private handleExitAnimationEnd;
|
|
51
70
|
private lockScroll;
|
|
52
71
|
private releaseScrollLock;
|
|
53
72
|
render(): import("lit-html").TemplateResult<1> | typeof nothing;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reke-dialog.d.ts","sourceRoot":"","sources":["../../../src/components/reke-dialog/reke-dialog.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,KAAK,CAAC;AAGzD,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAG3D,MAAM,MAAM,aAAa,GAAG,OAAO,GAAG,QAAQ,CAAC;AAC/C,MAAM,MAAM,cAAc,GAAG,OAAO,GAAG,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"reke-dialog.d.ts","sourceRoot":"","sources":["../../../src/components/reke-dialog/reke-dialog.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,KAAK,CAAC;AAGzD,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAG3D,MAAM,MAAM,aAAa,GAAG,OAAO,GAAG,QAAQ,CAAC;AAC/C,MAAM,MAAM,cAAc,GAAG,OAAO,GAAG,MAAM,CAAC;AAsB9C;;;;;;;;;;;;;;;;;;GAkBG;AACH,qBACa,UAAW,SAAQ,WAAW;IACzC,OAAgB,MAAM,4BAAU;IAGhC,IAAI,UAAS;IAGb,OAAO,SAAM;IAGb,OAAO,EAAE,aAAa,CAAW;IAEjC,kEAAkE;IAElE,QAAQ,EAAE,cAAc,CAAW;IAEnC;;;OAGG;IAEH,OAAO,CAAC,QAAQ,CAAS;IAEzB;;;;;;;OAOG;IACH,OAAO,CAAC,QAAQ,CAAS;IAEzB,OAAO,CAAC,UAAU,CAA8C;IAEhE,mEAAmE;IACnE,OAAO,CAAC,kBAAkB,CAA4B;IAEtD,0EAA0E;IAC1E,OAAO,CAAC,qBAAqB,CAAM;IACnC,OAAO,CAAC,aAAa,CAAS;IAE9B,OAAO,CAAC,cAAc,CAiCpB;IAEO,iBAAiB;IAKjB,oBAAoB;cAQV,UAAU,CAAC,OAAO,EAAE,cAAc,CAAC,IAAI,CAAC;cAQxC,OAAO,CAAC,OAAO,EAAE,cAAc,CAAC,IAAI,CAAC;IAcxD,IAAI;IAIJ,KAAK;IAKL,OAAO,CAAC,QAAQ;IAIhB;;;OAGG;IACH,OAAO,CAAC,oBAAoB;IAS5B,OAAO,CAAC,mBAAmB;IAc3B,OAAO,CAAC,YAAY;IAMpB,OAAO,CAAC,YAAY;IAOpB,OAAO,CAAC,SAAS;IAMjB,OAAO,CAAC,UAAU;IAQlB,OAAO,CAAC,sBAAsB,CAY5B;IAEF,OAAO,CAAC,UAAU;IAOlB,OAAO,CAAC,iBAAiB;IAMhB,MAAM;CAyDhB;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,aAAa,EAAE,UAAU,CAAC;KAC3B;CACF"}
|
|
@@ -2,19 +2,23 @@ import { RekeElement as e } from "../../shared/base-element.js";
|
|
|
2
2
|
import { __decorate as t } from "../../_virtual/_@oxc-project_runtime@0.137.0/helpers/esm/decorate.js";
|
|
3
3
|
import { styles as n } from "./reke-dialog.styles.js";
|
|
4
4
|
import { html as r, nothing as i } from "lit";
|
|
5
|
-
import { customElement as a, property as o } from "lit/decorators.js";
|
|
6
|
-
import { classMap as
|
|
5
|
+
import { customElement as a, property as o, state as s } from "lit/decorators.js";
|
|
6
|
+
import { classMap as c } from "lit/directives/class-map.js";
|
|
7
7
|
//#region src/components/reke-dialog/reke-dialog.ts
|
|
8
|
-
var
|
|
8
|
+
var l = [
|
|
9
9
|
"a[href]",
|
|
10
10
|
"button:not([disabled])",
|
|
11
11
|
"input:not([disabled])",
|
|
12
12
|
"select:not([disabled])",
|
|
13
13
|
"textarea:not([disabled])",
|
|
14
14
|
"[tabindex]:not([tabindex=\"-1\"])"
|
|
15
|
-
].join(","),
|
|
15
|
+
].join(","), u = 400;
|
|
16
|
+
function d() {
|
|
17
|
+
return window.matchMedia?.("(prefers-reduced-motion: reduce)").matches ?? !1;
|
|
18
|
+
}
|
|
19
|
+
var f = class extends e {
|
|
16
20
|
constructor(...e) {
|
|
17
|
-
super(...e), this.open = !1, this.heading = "", this.variant = "modal", this.position = "right", this._previouslyFocused = null, this._previousBodyOverflow = "", this._scrollLocked = !1, this._handleKeydown = (e) => {
|
|
21
|
+
super(...e), this.open = !1, this.heading = "", this.variant = "modal", this.position = "right", this._closing = !1, this._settled = !1, this._exitTimer = null, this._previouslyFocused = null, this._previousBodyOverflow = "", this._scrollLocked = !1, this._handleKeydown = (e) => {
|
|
18
22
|
if (!this.open) return;
|
|
19
23
|
if (e.key === "Escape") {
|
|
20
24
|
this.close();
|
|
@@ -28,6 +32,14 @@ var c = [
|
|
|
28
32
|
}
|
|
29
33
|
let n = this.shadowRoot?.activeElement ?? document.activeElement, r = n ? t.indexOf(n) : -1;
|
|
30
34
|
e.shiftKey ? r <= 0 && (e.preventDefault(), t[t.length - 1].focus()) : (r === -1 || r === t.length - 1) && (e.preventDefault(), t[0].focus());
|
|
35
|
+
}, this.handleExitAnimationEnd = (e) => {
|
|
36
|
+
if (e.target === e.currentTarget) {
|
|
37
|
+
if (this._closing) {
|
|
38
|
+
this.cancelExit();
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
this._settled || (this._settled = !0, this.requestUpdate());
|
|
42
|
+
}
|
|
31
43
|
};
|
|
32
44
|
}
|
|
33
45
|
static {
|
|
@@ -37,10 +49,13 @@ var c = [
|
|
|
37
49
|
super.connectedCallback(), document.addEventListener("keydown", this._handleKeydown);
|
|
38
50
|
}
|
|
39
51
|
disconnectedCallback() {
|
|
40
|
-
super.disconnectedCallback(), document.removeEventListener("keydown", this._handleKeydown), this.releaseScrollLock();
|
|
52
|
+
super.disconnectedCallback(), document.removeEventListener("keydown", this._handleKeydown), this.releaseScrollLock(), this.cancelExit();
|
|
53
|
+
}
|
|
54
|
+
willUpdate(e) {
|
|
55
|
+
e.has("open") && this.open && (this._settled = !1);
|
|
41
56
|
}
|
|
42
57
|
updated(e) {
|
|
43
|
-
e.has("open") && (this.open ? this.handleOpened() : e.get("open") === !0 && this.handleClosed());
|
|
58
|
+
e.has("open") && (this.open ? (this.cancelExit(), this.handleOpened()) : e.get("open") === !0 && (this.handleClosed(), this.startExit()));
|
|
44
59
|
}
|
|
45
60
|
show() {
|
|
46
61
|
this.open = !0;
|
|
@@ -63,7 +78,7 @@ var c = [
|
|
|
63
78
|
let t = e ? `slot[name="${e}"]` : "slot:not([name])", n = this.shadowRoot?.querySelector(t);
|
|
64
79
|
if (!n) return [];
|
|
65
80
|
let r = [];
|
|
66
|
-
for (let e of n.assignedElements()) e instanceof HTMLElement && (e.matches(
|
|
81
|
+
for (let e of n.assignedElements()) e instanceof HTMLElement && (e.matches(l) && r.push(e), r.push(...e.querySelectorAll(l)));
|
|
67
82
|
return r;
|
|
68
83
|
}
|
|
69
84
|
handleOpened() {
|
|
@@ -74,6 +89,12 @@ var c = [
|
|
|
74
89
|
let e = this._previouslyFocused;
|
|
75
90
|
this._previouslyFocused = null, e?.focus();
|
|
76
91
|
}
|
|
92
|
+
startExit() {
|
|
93
|
+
d() || (this._closing = !0, this._exitTimer = setTimeout(() => this.cancelExit(), u));
|
|
94
|
+
}
|
|
95
|
+
cancelExit() {
|
|
96
|
+
this._exitTimer !== null && (clearTimeout(this._exitTimer), this._exitTimer = null), this._closing = !1;
|
|
97
|
+
}
|
|
77
98
|
lockScroll() {
|
|
78
99
|
this._scrollLocked ||= (this._previousBodyOverflow = document.body.style.overflow, document.body.style.overflow = "hidden", !0);
|
|
79
100
|
}
|
|
@@ -81,25 +102,29 @@ var c = [
|
|
|
81
102
|
this._scrollLocked &&= (document.body.style.overflow = this._previousBodyOverflow, !1);
|
|
82
103
|
}
|
|
83
104
|
render() {
|
|
84
|
-
if (!this.open) return i;
|
|
105
|
+
if (!this.open && !this._closing) return i;
|
|
85
106
|
let e = this.variant === "drawer", t = {
|
|
86
107
|
backdrop: !0,
|
|
87
108
|
"backdrop--drawer": e,
|
|
88
|
-
[`backdrop--${this.position}`]: e
|
|
109
|
+
[`backdrop--${this.position}`]: e,
|
|
110
|
+
"is-closing": this._closing
|
|
89
111
|
}, n = {
|
|
90
112
|
dialog: !e,
|
|
91
113
|
drawer: e,
|
|
92
|
-
[`drawer--${this.position}`]: e
|
|
114
|
+
[`drawer--${this.position}`]: e,
|
|
115
|
+
"is-closing": this._closing,
|
|
116
|
+
"is-settled": this._settled && !this._closing
|
|
93
117
|
};
|
|
94
118
|
return r`
|
|
95
|
-
<div class=${
|
|
119
|
+
<div class=${c(t)} @click=${this.close}>
|
|
96
120
|
<div
|
|
97
|
-
class=${
|
|
121
|
+
class=${c(n)}
|
|
98
122
|
role="dialog"
|
|
99
123
|
aria-modal="true"
|
|
100
124
|
aria-label=${this.heading}
|
|
101
125
|
tabindex="-1"
|
|
102
126
|
@click=${(e) => e.stopPropagation()}
|
|
127
|
+
@animationend=${this.handleExitAnimationEnd}
|
|
103
128
|
>
|
|
104
129
|
${this.heading ? r`
|
|
105
130
|
<div class="dialog-header">
|
|
@@ -127,6 +152,6 @@ var c = [
|
|
|
127
152
|
t([o({
|
|
128
153
|
type: Boolean,
|
|
129
154
|
reflect: !0
|
|
130
|
-
})],
|
|
155
|
+
})], f.prototype, "open", void 0), t([o()], f.prototype, "heading", void 0), t([o({ reflect: !0 })], f.prototype, "variant", void 0), t([o({ reflect: !0 })], f.prototype, "position", void 0), t([s()], f.prototype, "_closing", void 0), f = t([a("reke-dialog")], f);
|
|
131
156
|
//#endregion
|
|
132
|
-
export {
|
|
157
|
+
export { f as RekeDialog };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reke-dialog.styles.d.ts","sourceRoot":"","sources":["../../../src/components/reke-dialog/reke-dialog.styles.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,MAAM,
|
|
1
|
+
{"version":3,"file":"reke-dialog.styles.d.ts","sourceRoot":"","sources":["../../../src/components/reke-dialog/reke-dialog.styles.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,MAAM,2BA+OlB,CAAC"}
|