@reshape-biotech/design-system 2.6.4 → 2.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.
@@ -1,5 +1,5 @@
1
1
  <script lang="ts">
2
- import { backgroundColor } from '../../../tokens';
2
+ import { backgroundColor, textColor } from '../../../tokens';
3
3
  import Icon from '../../icons/Icon.svelte';
4
4
  import Chart, { type GenericChartProps } from '../chart/Chart.svelte';
5
5
  import type {
@@ -11,7 +11,13 @@
11
11
  import Tooltip from '../../tooltip/Tooltip.svelte';
12
12
  import type { Snippet } from 'svelte';
13
13
 
14
- export type DataPoint = { value: [number, number]; metadata: any; error_value?: number };
14
+ export type DataPoint = {
15
+ value: [number, number];
16
+ metadata: any;
17
+ error_value?: number;
18
+ disagreement?: boolean | null;
19
+ highlighted?: boolean | null;
20
+ };
15
21
 
16
22
  export type ScatterPlotEchartsEvent = echarts.ECElementEvent & {
17
23
  data: DataPoint;
@@ -29,6 +35,7 @@
29
35
  showConfidenceBand?: boolean;
30
36
  showLegend?: boolean;
31
37
  legendItems?: LegendItem[];
38
+ highlightIndex?: number | null;
32
39
  children?: Snippet;
33
40
  } & Omit<GenericChartProps, 'timeIndex'>;
34
41
 
@@ -46,6 +53,7 @@
46
53
  { label: 'Count', color: backgroundColor['blue-inverse'], type: 'point' },
47
54
  { label: 'Perfect agreement', color: backgroundColor['lilac-inverse'], type: 'line' },
48
55
  ],
56
+ highlightIndex = null,
49
57
  children,
50
58
  ...props
51
59
  }: ScatterPlotProps = $props();
@@ -85,6 +93,7 @@
85
93
  const xValue = api.value(0) as number;
86
94
  const yValue = api.value(1) as number;
87
95
  const error = api.value(2) as number;
96
+ const disagreement = api.value(3) as number;
88
97
 
89
98
  const highPoint = api.coord([xValue, yValue + error]);
90
99
  const lowPoint = api.coord([xValue, yValue - error]);
@@ -98,8 +107,7 @@
98
107
  const baseWidth = Array.isArray(sizeValue) ? sizeValue[0] : 10;
99
108
  const halfWidth = Math.min((baseWidth ?? 10) * 1.5, 3);
100
109
  const style = {
101
- stroke: api.visual('color') as string,
102
- fill: undefined,
110
+ stroke: disagreement ? textColor['icon-tertiary'] : backgroundColor['blue-inverse'],
103
111
  };
104
112
 
105
113
  return {
@@ -148,7 +156,7 @@
148
156
  const series: SeriesOption[] = [];
149
157
  const errorBarData = data
150
158
  .filter((d) => d.error_value != 0)
151
- .map((d) => [...d.value, d.error_value]);
159
+ .map((d) => [...d.value, d.error_value, d.disagreement ? 1 : 0]);
152
160
 
153
161
  if (props.lineData && props.lineData.length > 0) {
154
162
  const extendedLineData = [
@@ -170,7 +178,6 @@
170
178
  disabled: true,
171
179
  },
172
180
  silent: true,
173
- zlevel: 0,
174
181
  });
175
182
 
176
183
  if (showConfidenceBand && props.lineData && props.lineData.length > 0) {
@@ -205,7 +212,6 @@
205
212
  disabled: true,
206
213
  },
207
214
  silent: true,
208
- zlevel: 0,
209
215
  });
210
216
  }
211
217
  }
@@ -215,17 +221,43 @@
215
221
  data,
216
222
  type: 'scatter',
217
223
  itemStyle: {
218
- color: backgroundColor['blue-inverse'],
219
- opacity: 0.8,
224
+ color: (params: any) =>
225
+ params?.data?.disagreement ? textColor['icon-tertiary'] : backgroundColor['blue-inverse'],
226
+ opacity: 1,
220
227
  },
221
228
  emphasis: {
222
229
  itemStyle: {
223
- color: backgroundColor['blue-inverse'],
230
+ color: (params: any) => {
231
+ const point = params?.data as DataPoint;
232
+ return point?.disagreement
233
+ ? textColor['icon-tertiary']
234
+ : backgroundColor['blue-inverse'];
235
+ },
224
236
  opacity: 1,
225
237
  },
226
238
  },
227
239
  animation: false,
228
- zlevel: 1,
240
+ });
241
+
242
+ const p =
243
+ highlightIndex !== null && highlightIndex >= 0 && highlightIndex < data.length
244
+ ? data[highlightIndex]
245
+ : null;
246
+ series.push({
247
+ id: 'highlight-overlay',
248
+ type: 'scatter',
249
+ data: [p],
250
+ symbolSize: 16,
251
+ itemStyle: {
252
+ color: (params: any) => {
253
+ const point = params?.data as DataPoint;
254
+ return point?.disagreement
255
+ ? backgroundColor['neutral-hover']
256
+ : backgroundColor['blue-hover'];
257
+ },
258
+ },
259
+ z: -1,
260
+ silent: true,
229
261
  });
230
262
 
231
263
  if (errorBarData.length > 0) {
@@ -233,16 +265,11 @@
233
265
  type: 'custom',
234
266
  name: 'error',
235
267
  silent: true,
236
- itemStyle: {
237
- borderWidth: 1.5,
238
- color: backgroundColor['blue-inverse'],
239
- },
268
+ itemStyle: { borderWidth: 1.5 },
240
269
  renderItem: renderErrorBarItem,
241
270
  data: errorBarData,
242
- zlevel: 0,
243
271
  });
244
272
  }
245
-
246
273
  return {
247
274
  xAxis: {
248
275
  type: 'value',
@@ -4,6 +4,8 @@ export type DataPoint = {
4
4
  value: [number, number];
5
5
  metadata: any;
6
6
  error_value?: number;
7
+ disagreement?: boolean | null;
8
+ highlighted?: boolean | null;
7
9
  };
8
10
  export type ScatterPlotEchartsEvent = echarts.ECElementEvent & {
9
11
  data: DataPoint;
@@ -19,6 +21,7 @@ type ScatterPlotProps = {
19
21
  showConfidenceBand?: boolean;
20
22
  showLegend?: boolean;
21
23
  legendItems?: LegendItem[];
24
+ highlightIndex?: number | null;
22
25
  children?: Snippet;
23
26
  } & Omit<GenericChartProps, 'timeIndex'>;
24
27
  declare const Scatterplot: import("svelte").Component<ScatterPlotProps, {}, "">;
@@ -8,6 +8,7 @@
8
8
  | 'secondary'
9
9
  | 'transparent'
10
10
  | 'outline'
11
+ | 'accent'
11
12
  | 'danger'
12
13
  | 'secondary-inverse'
13
14
  | 'transparent-inverse';
@@ -164,6 +165,14 @@
164
165
  }
165
166
  .color-secondary:hover {
166
167
  background-color: #12192A1A
168
+ }
169
+ .color-accent {
170
+ background-color: #5750ee1A;
171
+ --tw-text-opacity: 1;
172
+ color: rgb(255 255 255 / var(--tw-text-opacity, 1))
173
+ }
174
+ .color-accent:hover {
175
+ background-color: #5750ee40
167
176
  }
168
177
  .color-transparent {
169
178
  background-color: transparent;
@@ -1,6 +1,6 @@
1
1
  import type { Snippet } from 'svelte';
2
2
  import type { HTMLButtonAttributes } from 'svelte/elements';
3
- type Variant = 'primary' | 'secondary' | 'transparent' | 'outline' | 'danger' | 'secondary-inverse' | 'transparent-inverse';
3
+ type Variant = 'primary' | 'secondary' | 'transparent' | 'outline' | 'accent' | 'danger' | 'secondary-inverse' | 'transparent-inverse';
4
4
  interface Props extends HTMLButtonAttributes {
5
5
  variant?: Variant;
6
6
  type?: 'button' | 'submit' | 'reset' | null | undefined;
@@ -4,7 +4,7 @@ import type { textColor, backgroundColor } from './../../tokens';
4
4
  export * from './custom';
5
5
  import type { CustomIconName } from './custom';
6
6
  export type PhosphorIconProps = Component<IconComponentProps, object, ''>;
7
- export type IconName = 'Aperture' | 'Archive' | 'ArrowFatLineRight' | 'ArrowCounterClockwise' | 'ArrowRight' | 'ArrowUpRight' | 'ArrowUpLeft' | 'ArrowUUpLeft' | 'Barcode' | 'Bell' | 'BookOpen' | 'BookOpenText' | 'BowlingBall' | 'BugBeetle' | 'Calendar' | 'CalendarBlank' | 'Camera' | 'CameraSlash' | 'CaretDown' | 'CaretLeft' | 'CaretRight' | 'CaretUp' | 'CaretUpDown' | 'ChatTeardropDots' | 'Check' | 'CheckCircle' | 'CheckFat' | 'Circle' | 'CircleDashed' | 'CircleHalf' | 'CirclesFour' | 'CirclesThreePlus' | 'Clock' | 'ClockCountdown' | 'Copy' | 'Crop' | 'Cube' | 'CursorClick' | 'CraneTower' | 'Database' | 'Dna' | 'DotsThree' | 'DotsThreeOutlineVertical' | 'DownloadSimple' | 'Drop' | 'EnvelopeSimple' | 'Eye' | 'Eyedropper' | 'EyeSlash' | 'FileCsv' | 'Flag' | 'Flask' | 'Folder' | 'FolderDashed' | 'FolderSimplePlus' | 'FunnelSimple' | 'Gear' | 'GlobeSimple' | 'GlobeSimpleX' | 'GridFour' | 'Hash' | 'House' | 'ImageSquare' | 'ImagesSquare' | 'Info' | 'IntersectThree' | 'Lock' | 'LineSegments' | 'List' | 'Link' | 'ListMagnifyingGlass' | 'MagnifyingGlass' | 'MegaphoneSimple' | 'MicrosoftExcelLogo' | 'Moon' | 'Minus' | 'Palette' | 'Pause' | 'Pencil' | 'PencilSimple' | 'Percent' | 'Phone' | 'Plant' | 'Play' | 'Plus' | 'PlusMinus' | 'Ruler' | 'Question' | 'SealCheck' | 'RadioButton' | 'SealQuestion' | 'SealWarning' | 'SelectionAll' | 'Share' | 'SidebarSimple' | 'SkipBack' | 'SkipForward' | 'SignIn' | 'SignOut' | 'SortAscending' | 'Sparkle' | 'SpinnerGap' | 'SquaresFour' | 'Star' | 'Stop' | 'StopCircle' | 'Sun' | 'Table' | 'Tag' | 'Target' | 'TestTube' | 'Trash' | 'TrashSimple' | 'TreeStructure' | 'UserCircle' | 'UserPlus' | 'Video' | 'Warning' | 'WarningCircle' | 'WifiSlash' | 'X' | 'XCircle';
7
+ export type IconName = 'Aperture' | 'Archive' | 'ArrowFatLineRight' | 'ArrowCounterClockwise' | 'ArrowRight' | 'ArrowUpRight' | 'ArrowUpLeft' | 'ArrowUUpLeft' | 'Barcode' | 'Bell' | 'BookOpen' | 'BookOpenText' | 'BowlingBall' | 'BugBeetle' | 'Calendar' | 'CalendarBlank' | 'Camera' | 'CameraSlash' | 'CaretDown' | 'CaretLeft' | 'CaretRight' | 'CaretUp' | 'CaretUpDown' | 'ChatTeardropDots' | 'Check' | 'CheckCircle' | 'CheckFat' | 'Circle' | 'CircleDashed' | 'CircleHalf' | 'CirclesFour' | 'CirclesThreePlus' | 'Clock' | 'ClockCountdown' | 'Copy' | 'Crop' | 'Cube' | 'CursorClick' | 'CraneTower' | 'Database' | 'Dna' | 'DotsThree' | 'DotsThreeOutlineVertical' | 'DownloadSimple' | 'Drop' | 'EnvelopeSimple' | 'Eye' | 'Eyedropper' | 'EyeSlash' | 'FileCsv' | 'Flag' | 'Flask' | 'Folder' | 'FolderDashed' | 'FolderSimplePlus' | 'FunnelSimple' | 'Gear' | 'GlobeSimple' | 'GlobeSimpleX' | 'GridFour' | 'Hash' | 'House' | 'ImageSquare' | 'ImagesSquare' | 'Info' | 'IntersectThree' | 'Lock' | 'LineSegments' | 'List' | 'Link' | 'ListMagnifyingGlass' | 'MagnifyingGlass' | 'MegaphoneSimple' | 'MicrosoftExcelLogo' | 'Moon' | 'Minus' | 'Palette' | 'Pause' | 'Pencil' | 'PencilSimple' | 'Percent' | 'Phone' | 'Plant' | 'Play' | 'Plus' | 'PlusMinus' | 'Ruler' | 'Question' | 'SealCheck' | 'RadioButton' | 'SealQuestion' | 'SealWarning' | 'SelectionAll' | 'Share' | 'SidebarSimple' | 'SkipBack' | 'SkipForward' | 'SignIn' | 'SignOut' | 'SortAscending' | 'Sparkle' | 'SpinnerGap' | 'SquaresFour' | 'Star' | 'Stop' | 'StopCircle' | 'Sun' | 'Table' | 'Tag' | 'Target' | 'TestTube' | 'Trash' | 'TrashSimple' | 'TreeStructure' | 'UserCircle' | 'UserPlus' | 'Users' | 'Video' | 'Warning' | 'WarningCircle' | 'WifiSlash' | 'X' | 'XCircle';
8
8
  export type AllIconName = IconName | CustomIconName;
9
9
  export declare const iconMap: Record<IconName, PhosphorIconProps>;
10
10
  export declare function renderIcon(iconName: keyof typeof iconMap): PhosphorIconProps;
@@ -115,6 +115,7 @@ import TrashSimple from 'phosphor-svelte/lib/TrashSimple';
115
115
  import TreeStructure from 'phosphor-svelte/lib/TreeStructure';
116
116
  import UserCircle from 'phosphor-svelte/lib/UserCircle';
117
117
  import UserPlus from 'phosphor-svelte/lib/UserPlus';
118
+ import Users from 'phosphor-svelte/lib/Users';
118
119
  import Video from 'phosphor-svelte/lib/Video';
119
120
  import Warning from 'phosphor-svelte/lib/Warning';
120
121
  import WarningCircle from 'phosphor-svelte/lib/WarningCircle';
@@ -240,6 +241,7 @@ export const iconMap = {
240
241
  TreeStructure,
241
242
  UserCircle,
242
243
  UserPlus,
244
+ Users,
243
245
  Video,
244
246
  Warning,
245
247
  WarningCircle,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reshape-biotech/design-system",
3
- "version": "2.6.4",
3
+ "version": "2.6.5",
4
4
  "scripts": {
5
5
  "dev": "vite dev",
6
6
  "build": "vite build",