@internetarchive/histogram-date-range 1.2.2-alpha-webdev7377.8 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/ci.yml +2 -2
- package/demo/index.html +4 -4
- package/dist/index.js.map +1 -1
- package/dist/src/histogram-date-range.d.ts +13 -2
- package/dist/src/histogram-date-range.js +271 -251
- package/dist/src/histogram-date-range.js.map +1 -1
- package/dist/test/histogram-date-range.test.js +254 -109
- package/dist/test/histogram-date-range.test.js.map +1 -1
- package/docs/_snowpack/pkg/common/directive-d639fc45.js +8 -0
- package/docs/_snowpack/pkg/import-map.json +1 -0
- package/docs/_snowpack/pkg/lit/directives/class-map.js +10 -0
- package/docs/_snowpack/pkg/lit/directives/live.js +3 -9
- package/docs/demo/index.html +4 -4
- package/docs/dist/src/histogram-date-range.js +25 -18
- package/index.ts +4 -4
- package/package.json +1 -1
- package/src/histogram-date-range.ts +1080 -1057
- package/test/histogram-date-range.test.ts +860 -684
|
@@ -5,6 +5,7 @@ import customParseFormat from 'dayjs/esm/plugin/customParseFormat';
|
|
|
5
5
|
import { css, html, LitElement, nothing, svg, } from 'lit';
|
|
6
6
|
import { customElement, property, state } from 'lit/decorators.js';
|
|
7
7
|
import { live } from 'lit/directives/live.js';
|
|
8
|
+
import { classMap } from 'lit/directives/class-map.js';
|
|
8
9
|
dayjs.extend(customParseFormat);
|
|
9
10
|
// these values can be overridden via the component's HTML (camelCased) attributes
|
|
10
11
|
const WIDTH = 180;
|
|
@@ -51,7 +52,17 @@ let HistogramDateRange = class HistogramDateRange extends LitElement {
|
|
|
51
52
|
this.bins = [];
|
|
52
53
|
/** If true, update events will not be canceled by the date inputs receiving focus */
|
|
53
54
|
this.updateWhileFocused = false;
|
|
54
|
-
/**
|
|
55
|
+
/**
|
|
56
|
+
* What interval bins should be snapped to for determining their time ranges.
|
|
57
|
+
* - `none` (default): Bins should each represent an identical duration of time,
|
|
58
|
+
* without regard for the actual dates represented.
|
|
59
|
+
* - `month`: Bins should each represent one or more full, non-overlapping months.
|
|
60
|
+
* The bin ranges will be "snapped" to the nearest month boundaries, which can
|
|
61
|
+
* result in bins that represent different amounts of time, particularly if the
|
|
62
|
+
* provided bins do not evenly divide the provided date range, or if the months
|
|
63
|
+
* represented are of different lengths.
|
|
64
|
+
* - `year`: Same as `month`, but snapping to year boundaries instead of months.
|
|
65
|
+
*/
|
|
55
66
|
this.binSnapping = 'none';
|
|
56
67
|
// internal reactive properties not exposed as attributes
|
|
57
68
|
this._tooltipOffset = 0;
|
|
@@ -141,7 +152,8 @@ let HistogramDateRange = class HistogramDateRange extends LitElement {
|
|
|
141
152
|
}
|
|
142
153
|
this._histWidth = this.width - this.sliderWidth * 2;
|
|
143
154
|
this._minDateMS = this.snapTimestamp(this.getMSFromString(this.minDate));
|
|
144
|
-
// NB: The max date string, converted as-is to ms, represents the
|
|
155
|
+
// NB: The max date string, converted as-is to ms, represents the *start* of the
|
|
156
|
+
// final date interval; we want the *end*, so we add any snap interval/offset.
|
|
145
157
|
this._maxDateMS =
|
|
146
158
|
this.snapTimestamp(this.getMSFromString(this.maxDate) + this.snapInterval) + this.snapEndOffset;
|
|
147
159
|
this._binWidth = this._histWidth / this._numBins;
|
|
@@ -196,6 +208,7 @@ let HistogramDateRange = class HistogramDateRange extends LitElement {
|
|
|
196
208
|
return this.snapToMonth(timestamp);
|
|
197
209
|
case 'none':
|
|
198
210
|
default:
|
|
211
|
+
// We still align it to second boundaries to resolve minor discrepancies
|
|
199
212
|
return this.snapToNextSecond(timestamp);
|
|
200
213
|
}
|
|
201
214
|
}
|
|
@@ -263,7 +276,8 @@ let HistogramDateRange = class HistogramDateRange extends LitElement {
|
|
|
263
276
|
}
|
|
264
277
|
}
|
|
265
278
|
/**
|
|
266
|
-
* Offset added to the end of each bin to ensure
|
|
279
|
+
* Offset added to the end of each bin to ensure disjoint intervals,
|
|
280
|
+
* depending on whether snapping is enabled and there are multiple bins.
|
|
267
281
|
*/
|
|
268
282
|
get snapEndOffset() {
|
|
269
283
|
return this.binSnapping !== 'none' && this._numBins > 1 ? -1 : 0;
|
|
@@ -273,8 +287,8 @@ let HistogramDateRange = class HistogramDateRange extends LitElement {
|
|
|
273
287
|
* Falls back to `dateFormat` if not provided.
|
|
274
288
|
*/
|
|
275
289
|
get tooltipDateFormat() {
|
|
276
|
-
var _a
|
|
277
|
-
return (
|
|
290
|
+
var _a;
|
|
291
|
+
return (_a = this._tooltipDateFormat) !== null && _a !== void 0 ? _a : this.dateFormat;
|
|
278
292
|
}
|
|
279
293
|
set tooltipDateFormat(value) {
|
|
280
294
|
this._tooltipDateFormat = value;
|
|
@@ -354,9 +368,9 @@ let HistogramDateRange = class HistogramDateRange extends LitElement {
|
|
|
354
368
|
const formattedNumItems = Number(dataset.numItems).toLocaleString();
|
|
355
369
|
this._tooltipOffset =
|
|
356
370
|
x + (this._binWidth - this.sliderWidth - this.tooltipWidth) / 2;
|
|
357
|
-
this._tooltipContent = html `
|
|
358
|
-
${formattedNumItems} ${itemsText}<br />
|
|
359
|
-
${dataset.tooltip}
|
|
371
|
+
this._tooltipContent = html `
|
|
372
|
+
${formattedNumItems} ${itemsText}<br />
|
|
373
|
+
${dataset.tooltip}
|
|
360
374
|
`;
|
|
361
375
|
this._tooltipVisible = true;
|
|
362
376
|
}
|
|
@@ -552,25 +566,25 @@ let HistogramDateRange = class HistogramDateRange extends LitElement {
|
|
|
552
566
|
// border-radius); used as part of a SVG quadratic curve. see
|
|
553
567
|
// https://developer.mozilla.org/en-US/docs/Web/SVG/Tutorial/Paths#curve_commands
|
|
554
568
|
const cs = SLIDER_CORNER_SIZE;
|
|
555
|
-
const sliderShape = `
|
|
556
|
-
M${this.minSliderX},0
|
|
557
|
-
h-${this.sliderWidth - cs}
|
|
558
|
-
q-${cs},0 -${cs},${cs}
|
|
559
|
-
v${this.height - cs * 2}
|
|
560
|
-
q0,${cs} ${cs},${cs}
|
|
561
|
-
h${this.sliderWidth - cs}
|
|
569
|
+
const sliderShape = `
|
|
570
|
+
M${this.minSliderX},0
|
|
571
|
+
h-${this.sliderWidth - cs}
|
|
572
|
+
q-${cs},0 -${cs},${cs}
|
|
573
|
+
v${this.height - cs * 2}
|
|
574
|
+
q0,${cs} ${cs},${cs}
|
|
575
|
+
h${this.sliderWidth - cs}
|
|
562
576
|
`;
|
|
563
577
|
return this.generateSliderSVG(this.minSliderX, 'slider-min', sliderShape);
|
|
564
578
|
}
|
|
565
579
|
get maxSliderTemplate() {
|
|
566
580
|
const cs = SLIDER_CORNER_SIZE;
|
|
567
|
-
const sliderShape = `
|
|
568
|
-
M${this.maxSliderX},0
|
|
569
|
-
h${this.sliderWidth - cs}
|
|
570
|
-
q${cs},0 ${cs},${cs}
|
|
571
|
-
v${this.height - cs * 2}
|
|
572
|
-
q0,${cs} -${cs},${cs}
|
|
573
|
-
h-${this.sliderWidth - cs}
|
|
581
|
+
const sliderShape = `
|
|
582
|
+
M${this.maxSliderX},0
|
|
583
|
+
h${this.sliderWidth - cs}
|
|
584
|
+
q${cs},0 ${cs},${cs}
|
|
585
|
+
v${this.height - cs * 2}
|
|
586
|
+
q0,${cs} -${cs},${cs}
|
|
587
|
+
h-${this.sliderWidth - cs}
|
|
574
588
|
`;
|
|
575
589
|
return this.generateSliderSVG(this.maxSliderX, 'slider-max', sliderShape);
|
|
576
590
|
}
|
|
@@ -578,40 +592,43 @@ let HistogramDateRange = class HistogramDateRange extends LitElement {
|
|
|
578
592
|
// whether the curved part of the slider is facing towards the left (1), ie
|
|
579
593
|
// minimum, or facing towards the right (-1), ie maximum
|
|
580
594
|
const k = id === 'slider-min' ? 1 : -1;
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
595
|
+
const sliderClasses = classMap({
|
|
596
|
+
slider: true,
|
|
597
|
+
draggable: !this.disabled,
|
|
598
|
+
dragging: this._isDragging,
|
|
599
|
+
});
|
|
600
|
+
return svg `
|
|
601
|
+
<svg
|
|
602
|
+
id=${id}
|
|
603
|
+
class=${sliderClasses}
|
|
604
|
+
@pointerdown=${this.drag}
|
|
605
|
+
>
|
|
606
|
+
<path d="${sliderShape} z" fill="${sliderColor}" />
|
|
607
|
+
<rect
|
|
608
|
+
x="${sliderPositionX - this.sliderWidth * k + this.sliderWidth * 0.4 * k}"
|
|
609
|
+
y="${this.height / 3}"
|
|
610
|
+
width="1"
|
|
611
|
+
height="${this.height / 3}"
|
|
612
|
+
fill="white"
|
|
613
|
+
/>
|
|
614
|
+
<rect
|
|
615
|
+
x="${sliderPositionX - this.sliderWidth * k + this.sliderWidth * 0.6 * k}"
|
|
616
|
+
y="${this.height / 3}"
|
|
617
|
+
width="1"
|
|
618
|
+
height="${this.height / 3}"
|
|
619
|
+
fill="white"
|
|
620
|
+
/>
|
|
621
|
+
</svg>
|
|
605
622
|
`;
|
|
606
623
|
}
|
|
607
624
|
get selectedRangeTemplate() {
|
|
608
|
-
return svg `
|
|
609
|
-
<rect
|
|
610
|
-
x="${this.minSliderX}"
|
|
611
|
-
y="0"
|
|
612
|
-
width="${this.maxSliderX - this.minSliderX}"
|
|
613
|
-
height="${this.height}"
|
|
614
|
-
fill="${selectedRangeColor}"
|
|
625
|
+
return svg `
|
|
626
|
+
<rect
|
|
627
|
+
x="${this.minSliderX}"
|
|
628
|
+
y="0"
|
|
629
|
+
width="${this.maxSliderX - this.minSliderX}"
|
|
630
|
+
height="${this.height}"
|
|
631
|
+
fill="${selectedRangeColor}"
|
|
615
632
|
/>`;
|
|
616
633
|
}
|
|
617
634
|
get histogramTemplate() {
|
|
@@ -629,22 +646,22 @@ let HistogramDateRange = class HistogramDateRange extends LitElement {
|
|
|
629
646
|
// between adjacent bars (eg when viewing the tooltips or when trying to
|
|
630
647
|
// extend the range by clicking on a bar)
|
|
631
648
|
const barStyle = `stroke-dasharray: 0 ${barWidth} ${barHeight} ${barWidth} 0 ${barHeight}`;
|
|
632
|
-
const bar = svg `
|
|
633
|
-
<rect
|
|
634
|
-
class="bar"
|
|
635
|
-
style=${barStyle}
|
|
636
|
-
x=${x}
|
|
637
|
-
y=${this.height - barHeight}
|
|
638
|
-
width=${barWidth}
|
|
639
|
-
height=${barHeight}
|
|
640
|
-
@pointerenter=${this.showTooltip}
|
|
641
|
-
@pointerleave=${this.hideTooltip}
|
|
642
|
-
@click=${this.handleBarClick}
|
|
643
|
-
fill=${barFill}
|
|
644
|
-
data-num-items=${data.value}
|
|
645
|
-
data-bin-start=${data.binStart}
|
|
646
|
-
data-bin-end=${data.binEnd}
|
|
647
|
-
data-tooltip=${data.tooltip}
|
|
649
|
+
const bar = svg `
|
|
650
|
+
<rect
|
|
651
|
+
class="bar"
|
|
652
|
+
style=${barStyle}
|
|
653
|
+
x=${x}
|
|
654
|
+
y=${this.height - barHeight}
|
|
655
|
+
width=${barWidth}
|
|
656
|
+
height=${barHeight}
|
|
657
|
+
@pointerenter=${this.showTooltip}
|
|
658
|
+
@pointerleave=${this.hideTooltip}
|
|
659
|
+
@click=${this.handleBarClick}
|
|
660
|
+
fill=${barFill}
|
|
661
|
+
data-num-items=${data.value}
|
|
662
|
+
data-bin-start=${data.binStart}
|
|
663
|
+
data-bin-end=${data.binEnd}
|
|
664
|
+
data-tooltip=${data.tooltip}
|
|
648
665
|
/>`;
|
|
649
666
|
x += xScale;
|
|
650
667
|
return bar;
|
|
@@ -681,31 +698,31 @@ let HistogramDateRange = class HistogramDateRange extends LitElement {
|
|
|
681
698
|
* https://lit.dev/docs/templates/directives/#live
|
|
682
699
|
*/
|
|
683
700
|
get minInputTemplate() {
|
|
684
|
-
return html `
|
|
685
|
-
<input
|
|
686
|
-
id="date-min"
|
|
687
|
-
placeholder
|
|
688
|
-
type="text"
|
|
689
|
-
@focus
|
|
690
|
-
@blur
|
|
691
|
-
@keyup
|
|
692
|
-
.value
|
|
693
|
-
?disabled
|
|
694
|
-
/>
|
|
701
|
+
return html `
|
|
702
|
+
<input
|
|
703
|
+
id="date-min"
|
|
704
|
+
placeholder=${this.dateFormat}
|
|
705
|
+
type="text"
|
|
706
|
+
@focus=${this.handleInputFocus}
|
|
707
|
+
@blur=${this.handleMinDateInput}
|
|
708
|
+
@keyup=${this.handleKeyUp}
|
|
709
|
+
.value=${live(this.minSelectedDate)}
|
|
710
|
+
?disabled=${this.disabled}
|
|
711
|
+
/>
|
|
695
712
|
`;
|
|
696
713
|
}
|
|
697
714
|
get maxInputTemplate() {
|
|
698
|
-
return html `
|
|
699
|
-
<input
|
|
700
|
-
id="date-max"
|
|
701
|
-
placeholder
|
|
702
|
-
type="text"
|
|
703
|
-
@focus
|
|
704
|
-
@blur
|
|
705
|
-
@keyup
|
|
706
|
-
.value
|
|
707
|
-
?disabled
|
|
708
|
-
/>
|
|
715
|
+
return html `
|
|
716
|
+
<input
|
|
717
|
+
id="date-max"
|
|
718
|
+
placeholder=${this.dateFormat}
|
|
719
|
+
type="text"
|
|
720
|
+
@focus=${this.handleInputFocus}
|
|
721
|
+
@blur=${this.handleMaxDateInput}
|
|
722
|
+
@keyup=${this.handleKeyUp}
|
|
723
|
+
.value=${live(this.maxSelectedDate)}
|
|
724
|
+
?disabled=${this.disabled}
|
|
725
|
+
/>
|
|
709
726
|
`;
|
|
710
727
|
}
|
|
711
728
|
get minLabelTemplate() {
|
|
@@ -715,184 +732,187 @@ let HistogramDateRange = class HistogramDateRange extends LitElement {
|
|
|
715
732
|
return html `<label for="date-max" class="sr-only">Maximum date:</label>`;
|
|
716
733
|
}
|
|
717
734
|
get tooltipTemplate() {
|
|
718
|
-
return html `
|
|
719
|
-
<style>
|
|
720
|
-
#tooltip {
|
|
721
|
-
width: ${this.tooltipWidth}px;
|
|
722
|
-
height: ${this.tooltipHeight}px;
|
|
723
|
-
top: ${-9 - this.tooltipHeight}px;
|
|
724
|
-
left: ${this._tooltipOffset}px;
|
|
725
|
-
display: ${this._tooltipVisible ? 'block' : 'none'};
|
|
726
|
-
}
|
|
727
|
-
#tooltip:after {
|
|
728
|
-
left: ${this.tooltipWidth / 2}px;
|
|
729
|
-
}
|
|
730
|
-
</style>
|
|
731
|
-
<div id="tooltip">${this._tooltipContent}</div>
|
|
735
|
+
return html `
|
|
736
|
+
<style>
|
|
737
|
+
#tooltip {
|
|
738
|
+
width: ${this.tooltipWidth}px;
|
|
739
|
+
height: ${this.tooltipHeight}px;
|
|
740
|
+
top: ${-9 - this.tooltipHeight}px;
|
|
741
|
+
left: ${this._tooltipOffset}px;
|
|
742
|
+
display: ${this._tooltipVisible ? 'block' : 'none'};
|
|
743
|
+
}
|
|
744
|
+
#tooltip:after {
|
|
745
|
+
left: ${this.tooltipWidth / 2}px;
|
|
746
|
+
}
|
|
747
|
+
</style>
|
|
748
|
+
<div id="tooltip">${this._tooltipContent}</div>
|
|
732
749
|
`;
|
|
733
750
|
}
|
|
734
751
|
get noDataTemplate() {
|
|
735
|
-
return html `
|
|
736
|
-
<div class="missing-data-message">${this.missingDataMessage}</div>
|
|
752
|
+
return html `
|
|
753
|
+
<div class="missing-data-message">${this.missingDataMessage}</div>
|
|
737
754
|
`;
|
|
738
755
|
}
|
|
739
756
|
get activityIndicatorTemplate() {
|
|
740
757
|
if (!this.loading) {
|
|
741
758
|
return nothing;
|
|
742
759
|
}
|
|
743
|
-
return html `
|
|
744
|
-
<ia-activity-indicator mode="processing"> </ia-activity-indicator>
|
|
760
|
+
return html `
|
|
761
|
+
<ia-activity-indicator mode="processing"> </ia-activity-indicator>
|
|
745
762
|
`;
|
|
746
763
|
}
|
|
747
764
|
render() {
|
|
748
765
|
if (!this.hasBinData) {
|
|
749
766
|
return this.noDataTemplate;
|
|
750
767
|
}
|
|
751
|
-
return html `
|
|
752
|
-
<div
|
|
753
|
-
id="container"
|
|
754
|
-
class="
|
|
755
|
-
noselect
|
|
756
|
-
${this._isDragging ? 'dragging' : ''}
|
|
757
|
-
"
|
|
758
|
-
style="width: ${this.width}px"
|
|
759
|
-
>
|
|
760
|
-
${this.activityIndicatorTemplate} ${this.tooltipTemplate}
|
|
761
|
-
<div
|
|
762
|
-
class="inner-container
|
|
763
|
-
${this.disabled ? 'disabled' : ''}"
|
|
764
|
-
>
|
|
765
|
-
<svg
|
|
766
|
-
width="${this.width}"
|
|
767
|
-
height="${this.height}"
|
|
768
|
-
@pointerleave="${this.drop}"
|
|
769
|
-
>
|
|
770
|
-
${this.selectedRangeTemplate}
|
|
771
|
-
<svg id="histogram">${this.histogramTemplate}</svg>
|
|
772
|
-
${this.minSliderTemplate} ${this.maxSliderTemplate}
|
|
773
|
-
</svg>
|
|
774
|
-
<div id="inputs">
|
|
775
|
-
${this.minLabelTemplate} ${this.minInputTemplate}
|
|
776
|
-
<div class="dash">-</div>
|
|
777
|
-
${this.maxLabelTemplate} ${this.maxInputTemplate}
|
|
778
|
-
<slot name="inputs-right-side"></slot>
|
|
779
|
-
</div>
|
|
780
|
-
</div>
|
|
781
|
-
</div>
|
|
768
|
+
return html `
|
|
769
|
+
<div
|
|
770
|
+
id="container"
|
|
771
|
+
class="
|
|
772
|
+
noselect
|
|
773
|
+
${this._isDragging ? 'dragging' : ''}
|
|
774
|
+
"
|
|
775
|
+
style="width: ${this.width}px"
|
|
776
|
+
>
|
|
777
|
+
${this.activityIndicatorTemplate} ${this.tooltipTemplate}
|
|
778
|
+
<div
|
|
779
|
+
class="inner-container
|
|
780
|
+
${this.disabled ? 'disabled' : ''}"
|
|
781
|
+
>
|
|
782
|
+
<svg
|
|
783
|
+
width="${this.width}"
|
|
784
|
+
height="${this.height}"
|
|
785
|
+
@pointerleave="${this.drop}"
|
|
786
|
+
>
|
|
787
|
+
${this.selectedRangeTemplate}
|
|
788
|
+
<svg id="histogram">${this.histogramTemplate}</svg>
|
|
789
|
+
${this.minSliderTemplate} ${this.maxSliderTemplate}
|
|
790
|
+
</svg>
|
|
791
|
+
<div id="inputs">
|
|
792
|
+
${this.minLabelTemplate} ${this.minInputTemplate}
|
|
793
|
+
<div class="dash">-</div>
|
|
794
|
+
${this.maxLabelTemplate} ${this.maxInputTemplate}
|
|
795
|
+
<slot name="inputs-right-side"></slot>
|
|
796
|
+
</div>
|
|
797
|
+
</div>
|
|
798
|
+
</div>
|
|
782
799
|
`;
|
|
783
800
|
}
|
|
784
801
|
};
|
|
785
|
-
HistogramDateRange.styles = css `
|
|
786
|
-
.missing-data-message {
|
|
787
|
-
text-align: center;
|
|
788
|
-
}
|
|
789
|
-
#container {
|
|
790
|
-
margin: 0;
|
|
791
|
-
touch-action: none;
|
|
792
|
-
position: relative;
|
|
793
|
-
}
|
|
794
|
-
.disabled {
|
|
795
|
-
opacity: 0.3;
|
|
796
|
-
}
|
|
797
|
-
ia-activity-indicator {
|
|
798
|
-
position: absolute;
|
|
799
|
-
left: calc(50% - 10px);
|
|
800
|
-
top: 10px;
|
|
801
|
-
width: 20px;
|
|
802
|
-
height: 20px;
|
|
803
|
-
--activityIndicatorLoadingDotColor: rgba(0, 0, 0, 0);
|
|
804
|
-
--activityIndicatorLoadingRingColor: ${activityIndicatorColor};
|
|
805
|
-
}
|
|
806
|
-
|
|
807
|
-
/* prevent selection from interfering with tooltip, especially on mobile */
|
|
808
|
-
/* https://stackoverflow.com/a/4407335/1163042 */
|
|
809
|
-
.noselect {
|
|
810
|
-
-webkit-touch-callout: none; /* iOS Safari */
|
|
811
|
-
-webkit-user-select: none; /* Safari */
|
|
812
|
-
-moz-user-select: none; /* Old versions of Firefox */
|
|
813
|
-
-ms-user-select: none; /* Internet Explorer/Edge */
|
|
814
|
-
user-select: none; /* current Chrome, Edge, Opera and Firefox */
|
|
815
|
-
}
|
|
816
|
-
.bar {
|
|
817
|
-
/* create a transparent border around the hist bars to prevent "gaps" and
|
|
818
|
-
flickering when moving around between bars. this also helps with handling
|
|
819
|
-
clicks on the bars, preventing users from being able to click in between
|
|
820
|
-
bars */
|
|
821
|
-
stroke: rgba(0, 0, 0, 0);
|
|
822
|
-
/* ensure transparent stroke wide enough to cover gap between bars */
|
|
823
|
-
stroke-width: 2px;
|
|
824
|
-
}
|
|
825
|
-
.bar:hover {
|
|
826
|
-
/* highlight currently hovered bar */
|
|
827
|
-
fill-opacity: 0.7;
|
|
828
|
-
}
|
|
829
|
-
.disabled .bar:hover {
|
|
830
|
-
/* ensure no visual hover interaction when disabled */
|
|
831
|
-
fill-opacity: 1;
|
|
832
|
-
}
|
|
833
|
-
/****** histogram ********/
|
|
834
|
-
#tooltip {
|
|
835
|
-
position: absolute;
|
|
836
|
-
background: ${tooltipBackgroundColor};
|
|
837
|
-
color: ${tooltipTextColor};
|
|
838
|
-
text-align: center;
|
|
839
|
-
border-radius: 3px;
|
|
840
|
-
padding: 2px;
|
|
841
|
-
font-size: ${tooltipFontSize};
|
|
842
|
-
font-family: ${tooltipFontFamily};
|
|
843
|
-
touch-action: none;
|
|
844
|
-
pointer-events: none;
|
|
845
|
-
}
|
|
846
|
-
#tooltip:after {
|
|
847
|
-
content: '';
|
|
848
|
-
position: absolute;
|
|
849
|
-
margin-left: -5px;
|
|
850
|
-
top: 100%;
|
|
851
|
-
/* arrow */
|
|
852
|
-
border: 5px solid ${tooltipTextColor};
|
|
853
|
-
border-color: ${tooltipBackgroundColor} transparent transparent
|
|
854
|
-
transparent;
|
|
855
|
-
}
|
|
856
|
-
/****** slider ********/
|
|
857
|
-
.
|
|
858
|
-
|
|
859
|
-
}
|
|
860
|
-
.
|
|
861
|
-
cursor:
|
|
862
|
-
}
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
802
|
+
HistogramDateRange.styles = css `
|
|
803
|
+
.missing-data-message {
|
|
804
|
+
text-align: center;
|
|
805
|
+
}
|
|
806
|
+
#container {
|
|
807
|
+
margin: 0;
|
|
808
|
+
touch-action: none;
|
|
809
|
+
position: relative;
|
|
810
|
+
}
|
|
811
|
+
.disabled {
|
|
812
|
+
opacity: 0.3;
|
|
813
|
+
}
|
|
814
|
+
ia-activity-indicator {
|
|
815
|
+
position: absolute;
|
|
816
|
+
left: calc(50% - 10px);
|
|
817
|
+
top: 10px;
|
|
818
|
+
width: 20px;
|
|
819
|
+
height: 20px;
|
|
820
|
+
--activityIndicatorLoadingDotColor: rgba(0, 0, 0, 0);
|
|
821
|
+
--activityIndicatorLoadingRingColor: ${activityIndicatorColor};
|
|
822
|
+
}
|
|
823
|
+
|
|
824
|
+
/* prevent selection from interfering with tooltip, especially on mobile */
|
|
825
|
+
/* https://stackoverflow.com/a/4407335/1163042 */
|
|
826
|
+
.noselect {
|
|
827
|
+
-webkit-touch-callout: none; /* iOS Safari */
|
|
828
|
+
-webkit-user-select: none; /* Safari */
|
|
829
|
+
-moz-user-select: none; /* Old versions of Firefox */
|
|
830
|
+
-ms-user-select: none; /* Internet Explorer/Edge */
|
|
831
|
+
user-select: none; /* current Chrome, Edge, Opera and Firefox */
|
|
832
|
+
}
|
|
833
|
+
.bar {
|
|
834
|
+
/* create a transparent border around the hist bars to prevent "gaps" and
|
|
835
|
+
flickering when moving around between bars. this also helps with handling
|
|
836
|
+
clicks on the bars, preventing users from being able to click in between
|
|
837
|
+
bars */
|
|
838
|
+
stroke: rgba(0, 0, 0, 0);
|
|
839
|
+
/* ensure transparent stroke wide enough to cover gap between bars */
|
|
840
|
+
stroke-width: 2px;
|
|
841
|
+
}
|
|
842
|
+
.bar:hover {
|
|
843
|
+
/* highlight currently hovered bar */
|
|
844
|
+
fill-opacity: 0.7;
|
|
845
|
+
}
|
|
846
|
+
.disabled .bar:hover {
|
|
847
|
+
/* ensure no visual hover interaction when disabled */
|
|
848
|
+
fill-opacity: 1;
|
|
849
|
+
}
|
|
850
|
+
/****** histogram ********/
|
|
851
|
+
#tooltip {
|
|
852
|
+
position: absolute;
|
|
853
|
+
background: ${tooltipBackgroundColor};
|
|
854
|
+
color: ${tooltipTextColor};
|
|
855
|
+
text-align: center;
|
|
856
|
+
border-radius: 3px;
|
|
857
|
+
padding: 2px;
|
|
858
|
+
font-size: ${tooltipFontSize};
|
|
859
|
+
font-family: ${tooltipFontFamily};
|
|
860
|
+
touch-action: none;
|
|
861
|
+
pointer-events: none;
|
|
862
|
+
}
|
|
863
|
+
#tooltip:after {
|
|
864
|
+
content: '';
|
|
865
|
+
position: absolute;
|
|
866
|
+
margin-left: -5px;
|
|
867
|
+
top: 100%;
|
|
868
|
+
/* arrow */
|
|
869
|
+
border: 5px solid ${tooltipTextColor};
|
|
870
|
+
border-color: ${tooltipBackgroundColor} transparent transparent
|
|
871
|
+
transparent;
|
|
872
|
+
}
|
|
873
|
+
/****** slider ********/
|
|
874
|
+
.slider {
|
|
875
|
+
shape-rendering: crispEdges; /* So the slider doesn't get blurry if dragged between pixels */
|
|
876
|
+
}
|
|
877
|
+
.draggable:hover {
|
|
878
|
+
cursor: grab;
|
|
879
|
+
}
|
|
880
|
+
.dragging {
|
|
881
|
+
cursor: grabbing !important;
|
|
882
|
+
}
|
|
883
|
+
/****** inputs ********/
|
|
884
|
+
#inputs {
|
|
885
|
+
display: flex;
|
|
886
|
+
justify-content: center;
|
|
887
|
+
margin: ${inputRowMargin};
|
|
888
|
+
}
|
|
889
|
+
#inputs .dash {
|
|
890
|
+
position: relative;
|
|
891
|
+
bottom: -1px;
|
|
892
|
+
align-self: center; /* Otherwise the dash sticks to the top while the inputs grow */
|
|
893
|
+
}
|
|
894
|
+
input {
|
|
895
|
+
width: ${inputWidth};
|
|
896
|
+
margin: 0 3px;
|
|
897
|
+
border: ${inputBorder};
|
|
898
|
+
border-radius: 2px !important;
|
|
899
|
+
text-align: center;
|
|
900
|
+
font-size: ${inputFontSize};
|
|
901
|
+
font-family: ${inputFontFamily};
|
|
902
|
+
}
|
|
903
|
+
.sr-only {
|
|
904
|
+
position: absolute !important;
|
|
905
|
+
width: 1px !important;
|
|
906
|
+
height: 1px !important;
|
|
907
|
+
margin: 0 !important;
|
|
908
|
+
padding: 0 !important;
|
|
909
|
+
border: 0 !important;
|
|
910
|
+
overflow: hidden !important;
|
|
911
|
+
white-space: nowrap !important;
|
|
912
|
+
clip: rect(1px, 1px, 1px, 1px) !important;
|
|
913
|
+
-webkit-clip-path: inset(50%) !important;
|
|
914
|
+
clip-path: inset(50%) !important;
|
|
915
|
+
}
|
|
896
916
|
`;
|
|
897
917
|
__decorate([
|
|
898
918
|
property({ type: Number })
|