@genspectrum/dashboard-components 0.6.3 → 0.6.5
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 +1 -1
- package/dist/dashboard-components.js +121 -41
- package/dist/dashboard-components.js.map +1 -1
- package/dist/genspectrum-components.d.ts +11 -0
- package/dist/style.css +6 -0
- package/package.json +1 -1
- package/src/preact/components/tooltip.stories.tsx +54 -0
- package/src/preact/components/tooltip.tsx +31 -0
- package/src/preact/mutationsOverTime/__mockData__/aggregated_tooManyMutations.json +1470 -0
- package/src/preact/mutationsOverTime/__mockData__/nucleotideMutations_tooManyMutations.json +16453 -0
- package/src/preact/mutationsOverTime/getFilteredMutationsOverTime.spec.ts +23 -11
- package/src/preact/mutationsOverTime/getFilteredMutationsOverTimeData.ts +6 -2
- package/src/preact/mutationsOverTime/mutations-over-time-grid.tsx +77 -41
- package/src/preact/mutationsOverTime/mutations-over-time.stories.tsx +62 -8
- package/src/query/queryMutationsOverTime.spec.ts +50 -24
- package/src/query/queryMutationsOverTime.ts +20 -5
- package/src/utils/temporal.spec.ts +5 -0
- package/src/utils/temporal.ts +29 -5
- package/src/web-components/visualization/gs-mutations-over-time.tsx +11 -0
|
@@ -501,6 +501,17 @@ export declare class MutationsComponent extends PreactLitAdapterWithGridJsStyles
|
|
|
501
501
|
*
|
|
502
502
|
* The grid view shows the proportion for each mutation over date ranges.
|
|
503
503
|
*
|
|
504
|
+
* The grid limits the number of rows columns for browser performance reasons.
|
|
505
|
+
* Too much data might make the browser unresponsive.
|
|
506
|
+
*
|
|
507
|
+
* The number of columns is limited to 200.
|
|
508
|
+
* If this number are exceeded, an error message will be shown.
|
|
509
|
+
* It is your responsibility to make sure that this does not happen.
|
|
510
|
+
* Depending on the selected date range in the `lapisFilter`, you can adapt the granularity accordingly
|
|
511
|
+
* (e.g. use months instead of days).
|
|
512
|
+
*
|
|
513
|
+
* The number of rows is limited to 100.
|
|
514
|
+
* If there are more, the component will only show 100 mutations and notify the user.
|
|
504
515
|
*/
|
|
505
516
|
export declare class MutationsOverTimeComponent extends PreactLitAdapterWithGridJsStyles {
|
|
506
517
|
/**
|
package/dist/style.css
CHANGED
|
@@ -3029,6 +3029,9 @@ input.tab:checked + .tab-content,
|
|
|
3029
3029
|
padding-top: 1rem;
|
|
3030
3030
|
padding-bottom: 1rem;
|
|
3031
3031
|
}
|
|
3032
|
+
.pl-2 {
|
|
3033
|
+
padding-left: 0.5rem;
|
|
3034
|
+
}
|
|
3032
3035
|
.text-center {
|
|
3033
3036
|
text-align: center;
|
|
3034
3037
|
}
|
|
@@ -3150,6 +3153,9 @@ input.tab:checked + .tab-content,
|
|
|
3150
3153
|
--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);
|
|
3151
3154
|
--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color);
|
|
3152
3155
|
box-shadow: var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000);
|
|
3156
|
+
}
|
|
3157
|
+
.peer:hover ~ .peer-hover\:block {
|
|
3158
|
+
display: block;
|
|
3153
3159
|
}.flatpickr-calendar{background:transparent;opacity:0;display:none;text-align:center;visibility:hidden;padding:0;-webkit-animation:none;animation:none;direction:ltr;border:0;font-size:14px;line-height:24px;border-radius:5px;position:absolute;width:307.875px;-webkit-box-sizing:border-box;box-sizing:border-box;-ms-touch-action:manipulation;touch-action:manipulation;background:#fff;-webkit-box-shadow:1px 0 0 #e6e6e6,-1px 0 0 #e6e6e6,0 1px 0 #e6e6e6,0 -1px 0 #e6e6e6,0 3px 13px rgba(0,0,0,0.08);box-shadow:1px 0 0 #e6e6e6,-1px 0 0 #e6e6e6,0 1px 0 #e6e6e6,0 -1px 0 #e6e6e6,0 3px 13px rgba(0,0,0,0.08)}.flatpickr-calendar.open,.flatpickr-calendar.inline{opacity:1;max-height:640px;visibility:visible}.flatpickr-calendar.open{display:inline-block;z-index:99999}.flatpickr-calendar.animate.open{-webkit-animation:fpFadeInDown 300ms cubic-bezier(.23,1,.32,1);animation:fpFadeInDown 300ms cubic-bezier(.23,1,.32,1)}.flatpickr-calendar.inline{display:block;position:relative;top:2px}.flatpickr-calendar.static{position:absolute;top:calc(100% + 2px)}.flatpickr-calendar.static.open{z-index:999;display:block}.flatpickr-calendar.multiMonth .flatpickr-days .dayContainer:nth-child(n+1) .flatpickr-day.inRange:nth-child(7n+7){-webkit-box-shadow:none !important;box-shadow:none !important}.flatpickr-calendar.multiMonth .flatpickr-days .dayContainer:nth-child(n+2) .flatpickr-day.inRange:nth-child(7n+1){-webkit-box-shadow:-2px 0 0 #e6e6e6,5px 0 0 #e6e6e6;box-shadow:-2px 0 0 #e6e6e6,5px 0 0 #e6e6e6}.flatpickr-calendar .hasWeeks .dayContainer,.flatpickr-calendar .hasTime .dayContainer{border-bottom:0;border-bottom-right-radius:0;border-bottom-left-radius:0}.flatpickr-calendar .hasWeeks .dayContainer{border-left:0}.flatpickr-calendar.hasTime .flatpickr-time{height:40px;border-top:1px solid #e6e6e6}.flatpickr-calendar.noCalendar.hasTime .flatpickr-time{height:auto}.flatpickr-calendar:before,.flatpickr-calendar:after{position:absolute;display:block;pointer-events:none;border:solid transparent;content:'';height:0;width:0;left:22px}.flatpickr-calendar.rightMost:before,.flatpickr-calendar.arrowRight:before,.flatpickr-calendar.rightMost:after,.flatpickr-calendar.arrowRight:after{left:auto;right:22px}.flatpickr-calendar.arrowCenter:before,.flatpickr-calendar.arrowCenter:after{left:50%;right:50%}.flatpickr-calendar:before{border-width:5px;margin:0 -5px}.flatpickr-calendar:after{border-width:4px;margin:0 -4px}.flatpickr-calendar.arrowTop:before,.flatpickr-calendar.arrowTop:after{bottom:100%}.flatpickr-calendar.arrowTop:before{border-bottom-color:#e6e6e6}.flatpickr-calendar.arrowTop:after{border-bottom-color:#fff}.flatpickr-calendar.arrowBottom:before,.flatpickr-calendar.arrowBottom:after{top:100%}.flatpickr-calendar.arrowBottom:before{border-top-color:#e6e6e6}.flatpickr-calendar.arrowBottom:after{border-top-color:#fff}.flatpickr-calendar:focus{outline:0}.flatpickr-wrapper{position:relative;display:inline-block}.flatpickr-months{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex}.flatpickr-months .flatpickr-month{background:transparent;color:rgba(0,0,0,0.9);fill:rgba(0,0,0,0.9);height:34px;line-height:1;text-align:center;position:relative;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;overflow:hidden;-webkit-box-flex:1;-webkit-flex:1;-ms-flex:1;flex:1}.flatpickr-months .flatpickr-prev-month,.flatpickr-months .flatpickr-next-month{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;text-decoration:none;cursor:pointer;position:absolute;top:0;height:34px;padding:10px;z-index:3;color:rgba(0,0,0,0.9);fill:rgba(0,0,0,0.9)}.flatpickr-months .flatpickr-prev-month.flatpickr-disabled,.flatpickr-months .flatpickr-next-month.flatpickr-disabled{display:none}.flatpickr-months .flatpickr-prev-month i,.flatpickr-months .flatpickr-next-month i{position:relative}.flatpickr-months .flatpickr-prev-month.flatpickr-prev-month,.flatpickr-months .flatpickr-next-month.flatpickr-prev-month{/*
|
|
3154
3160
|
/*rtl:begin:ignore*/left:0/*
|
|
3155
3161
|
/*rtl:end:ignore*/}/*
|
package/package.json
CHANGED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { type Meta, type StoryObj } from '@storybook/preact';
|
|
2
|
+
import { expect, waitFor, within } from '@storybook/test';
|
|
3
|
+
|
|
4
|
+
import Tooltip, { type TooltipProps } from './tooltip';
|
|
5
|
+
|
|
6
|
+
const meta: Meta<TooltipProps> = {
|
|
7
|
+
title: 'Component/Tooltip',
|
|
8
|
+
component: Tooltip,
|
|
9
|
+
parameters: { fetchMock: {} },
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export default meta;
|
|
13
|
+
|
|
14
|
+
const tooltipContent = 'This is some content.';
|
|
15
|
+
|
|
16
|
+
export const TooltipStory: StoryObj<TooltipProps> = {
|
|
17
|
+
render: (args) => (
|
|
18
|
+
<div class='flex justify-center px-4 py-16'>
|
|
19
|
+
<Tooltip {...args}>
|
|
20
|
+
<div>Hover me</div>
|
|
21
|
+
</Tooltip>
|
|
22
|
+
</div>
|
|
23
|
+
),
|
|
24
|
+
args: {
|
|
25
|
+
content: tooltipContent,
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export const RendersStringContent: StoryObj<TooltipProps> = {
|
|
30
|
+
...TooltipStory,
|
|
31
|
+
play: async ({ canvasElement }) => {
|
|
32
|
+
const canvas = within(canvasElement);
|
|
33
|
+
const tooltipBase = canvas.getByText('Hover me');
|
|
34
|
+
|
|
35
|
+
await waitFor(() => expect(tooltipBase).toBeInTheDocument());
|
|
36
|
+
|
|
37
|
+
await waitFor(() => expect(canvas.queryByText(tooltipContent, { exact: false })).toBeInTheDocument());
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
export const RendersComponentConent: StoryObj<TooltipProps> = {
|
|
42
|
+
...TooltipStory,
|
|
43
|
+
args: {
|
|
44
|
+
content: <div>{tooltipContent}</div>,
|
|
45
|
+
},
|
|
46
|
+
play: async ({ canvasElement }) => {
|
|
47
|
+
const canvas = within(canvasElement);
|
|
48
|
+
const tooltipBase = canvas.getByText('Hover me');
|
|
49
|
+
|
|
50
|
+
await waitFor(() => expect(tooltipBase).toBeInTheDocument());
|
|
51
|
+
|
|
52
|
+
await waitFor(() => expect(canvas.queryByText(tooltipContent, { exact: false })).toBeInTheDocument());
|
|
53
|
+
},
|
|
54
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { flip, offset, shift } from '@floating-ui/dom';
|
|
2
|
+
import { type FunctionComponent } from 'preact';
|
|
3
|
+
import { useRef } from 'preact/hooks';
|
|
4
|
+
import { type JSXInternal } from 'preact/src/jsx';
|
|
5
|
+
|
|
6
|
+
import { dropdownClass } from './dropdown';
|
|
7
|
+
import { useFloatingUi } from '../shared/floating-ui/hooks';
|
|
8
|
+
|
|
9
|
+
export type TooltipProps = {
|
|
10
|
+
content: string | JSXInternal.Element;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
const Tooltip: FunctionComponent<TooltipProps> = ({ children, content }) => {
|
|
14
|
+
const referenceRef = useRef<HTMLDivElement>(null);
|
|
15
|
+
const floatingRef = useRef<HTMLDivElement>(null);
|
|
16
|
+
|
|
17
|
+
useFloatingUi(referenceRef, floatingRef, [offset(5), shift(), flip()]);
|
|
18
|
+
|
|
19
|
+
return (
|
|
20
|
+
<div className='relative'>
|
|
21
|
+
<div className='peer' ref={referenceRef}>
|
|
22
|
+
{children}
|
|
23
|
+
</div>
|
|
24
|
+
<div ref={floatingRef} className={`${dropdownClass} hidden peer-hover:block`}>
|
|
25
|
+
{content}
|
|
26
|
+
</div>
|
|
27
|
+
</div>
|
|
28
|
+
);
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export default Tooltip;
|