@reshape-biotech/design-system 2.6.4 → 2.7.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.
Files changed (77) hide show
  1. package/dist/components/activity/Activity.stories.svelte +7 -2
  2. package/dist/components/activity/Activity.svelte +6 -48
  3. package/dist/components/activity/Activity.svelte.d.ts +2 -2
  4. package/dist/components/activity/ActivityIcon.svelte +75 -0
  5. package/dist/components/activity/ActivityIcon.svelte.d.ts +10 -0
  6. package/dist/components/banner/Banner.stories.svelte +46 -9
  7. package/dist/components/banner/Banner.svelte +3 -2
  8. package/dist/components/checkbox/Checkbox.svelte +5 -3
  9. package/dist/components/collapsible/components/collapsible-trigger.svelte +3 -2
  10. package/dist/components/combobox/Combobox.stories.svelte +18 -4
  11. package/dist/components/combobox/components/combobox-add.svelte +3 -2
  12. package/dist/components/combobox/components/combobox-content.svelte +5 -3
  13. package/dist/components/combobox/components/combobox-indicator.svelte +3 -2
  14. package/dist/components/datepicker/DatePicker.stories.svelte +12 -3
  15. package/dist/components/datepicker/DatePicker.svelte +5 -3
  16. package/dist/components/drawer/components/drawer-content.svelte +3 -2
  17. package/dist/components/empty-content/EmptyContent.stories.svelte +13 -15
  18. package/dist/components/graphs/bar-chart/BarChart.svelte +1 -1
  19. package/dist/components/graphs/bar-chart/BarChart.svelte.d.ts +1 -1
  20. package/dist/components/graphs/bar-chart/StackedBarChart.svelte +1 -2
  21. package/dist/components/graphs/bar-chart/StackedBarChart.svelte.d.ts +1 -1
  22. package/dist/components/graphs/chart/Chart.svelte +16 -7
  23. package/dist/components/graphs/chart/Chart.svelte.d.ts +1 -1
  24. package/dist/components/graphs/line/LineChart.stories.svelte +1 -1
  25. package/dist/components/graphs/line/LineChart.svelte +1 -2
  26. package/dist/components/graphs/line/types.d.ts +1 -1
  27. package/dist/components/graphs/multiline/MultiLineChart.stories.svelte +1 -1
  28. package/dist/components/graphs/multiline/MultiLineChart.svelte +7 -4
  29. package/dist/components/graphs/multiline/MultiLineChart.svelte.d.ts +1 -1
  30. package/dist/components/graphs/multiline/types.d.ts +1 -1
  31. package/dist/components/graphs/scatterplot/Scatterplot.svelte +52 -21
  32. package/dist/components/graphs/scatterplot/Scatterplot.svelte.d.ts +8 -2
  33. package/dist/components/graphs/utils/tooltipFormatter.d.ts +1 -1
  34. package/dist/components/icon-button/IconButton.stories.svelte +17 -49
  35. package/dist/components/icon-button/IconButton.svelte +9 -0
  36. package/dist/components/icon-button/IconButton.svelte.d.ts +1 -1
  37. package/dist/components/icons/AnalysisIcon.svelte +10 -6
  38. package/dist/components/icons/Icon.stories.svelte +19 -37
  39. package/dist/components/icons/Icon.svelte +46 -13
  40. package/dist/components/icons/Icon.svelte.d.ts +21 -2
  41. package/dist/components/icons/PrincipalIcon.svelte +25 -5
  42. package/dist/components/icons/PrincipalIcon.svelte.d.ts +2 -1
  43. package/dist/components/icons/index.d.ts +3 -10
  44. package/dist/components/icons/index.js +2 -251
  45. package/dist/components/input/Input.svelte +3 -2
  46. package/dist/components/legend/Legend.stories.svelte +13 -3
  47. package/dist/components/list/List.stories.svelte +12 -3
  48. package/dist/components/manual-cfu-counter/ManualCFUCounter.svelte +6 -3
  49. package/dist/components/modal/Modal.stories.svelte +6 -1
  50. package/dist/components/modal/components/modal-content.svelte +3 -2
  51. package/dist/components/multi-cfu-counter/MultiCFUCounter.svelte +8 -4
  52. package/dist/components/notification-popup/NotificationPopup.stories.svelte +7 -2
  53. package/dist/components/notification-popup/NotificationPopup.svelte +3 -2
  54. package/dist/components/notifications/Notifications.stories.svelte +11 -11
  55. package/dist/components/pill/Pill.svelte +3 -2
  56. package/dist/components/required-status-indicator/RequiredStatusIndicator.svelte +4 -3
  57. package/dist/components/segmented-control-buttons/SegmentedControlButtons.stories.svelte +59 -10
  58. package/dist/components/select/components/MultiSelectTrigger.svelte +4 -6
  59. package/dist/components/select/components/MultiSelectTrigger.svelte.d.ts +0 -2
  60. package/dist/components/select/components/SelectContent.svelte +5 -3
  61. package/dist/components/select/components/SelectItem.svelte +3 -2
  62. package/dist/components/select/components/SelectTrigger.svelte +3 -2
  63. package/dist/components/slider/Slider.svelte +3 -2
  64. package/dist/components/stat-card/StatCard.svelte +5 -3
  65. package/dist/components/status-badge/StatusBadge.stories.svelte +132 -26
  66. package/dist/components/stepper/components/stepper-step.svelte +3 -2
  67. package/dist/components/table/Table.stories.svelte +7 -2
  68. package/dist/components/tag/Tag.stories.svelte +7 -2
  69. package/dist/components/toast/Toast.svelte +26 -6
  70. package/dist/components/toggle-icon-button/ToggleIconButton.stories.svelte +112 -23
  71. package/dist/echarts-config.d.ts +5 -0
  72. package/dist/echarts-config.js +33 -0
  73. package/dist/index.d.ts +3 -0
  74. package/dist/index.js +3 -0
  75. package/dist/notifications.d.ts +6 -7
  76. package/dist/notifications.js +2 -1
  77. package/package.json +1 -1
@@ -1,6 +1,13 @@
1
1
  <script lang="ts">
2
- import { init } from 'echarts';
3
- import type { EChartsOption, ECElementEvent, ECharts, SeriesOption } from 'echarts';
2
+ import {
3
+ init,
4
+ type EChartsOption,
5
+ type ECharts,
6
+ type SeriesOption,
7
+ type ECElementEvent,
8
+ } from '../../../echarts-config';
9
+ import type { EChartsType } from 'echarts/core';
10
+
4
11
  import { onMount, type Snippet } from 'svelte';
5
12
  import { colors, textColor } from '../../../tokens';
6
13
 
@@ -45,7 +52,7 @@
45
52
  onChartReady,
46
53
  }: ChartProps = $props();
47
54
 
48
- let chart = $state<ECharts | null>(null);
55
+ let chart = $state<EChartsType | null>(null);
49
56
  let container: HTMLElement;
50
57
 
51
58
  const defaultOptions: EChartsOption = {
@@ -110,15 +117,17 @@
110
117
  function initChart() {
111
118
  if (container) {
112
119
  chart = init(container, theme, { renderer });
120
+ if (!chart) return;
121
+
113
122
  chart.setOption(defaultOptions);
114
123
  chart.setOption(options, { notMerge: false });
115
- if (onitemclick) chart.on('click', onitemclick);
116
- if (onmouseover) chart.on('mouseover', onmouseover);
117
- if (onmouseout) chart.on('mouseout', onmouseout);
124
+ if (onitemclick) chart.on('click', (params) => onitemclick(params as ECElementEvent));
125
+ if (onmouseover) chart.on('mouseover', (params) => onmouseover(params as ECElementEvent));
126
+ if (onmouseout) chart.on('mouseout', () => onmouseout());
118
127
 
119
128
  if (loading) chart.showLoading();
120
129
 
121
- onChartReady?.(chart);
130
+ onChartReady?.(chart as unknown as ECharts);
122
131
  }
123
132
  }
124
133
 
@@ -1,4 +1,4 @@
1
- import type { EChartsOption, ECElementEvent, ECharts } from 'echarts';
1
+ import { type EChartsOption, type ECharts, type ECElementEvent } from '../../../echarts-config';
2
2
  import { type Snippet } from 'svelte';
3
3
  type ChartProps = {
4
4
  options: EChartsOption;
@@ -1,6 +1,6 @@
1
1
  <script module lang="ts">
2
2
  import { defineMeta } from '@storybook/addon-svelte-csf';
3
- import type { ECElementEvent } from 'echarts';
3
+ import type { ECElementEvent } from '../../../echarts-config';
4
4
  import { within, userEvent } from '@storybook/test';
5
5
  import LineChart from './LineChart.svelte';
6
6
 
@@ -1,8 +1,7 @@
1
1
  <script lang="ts">
2
2
  import { textColor, borderColor, chartColor, boxShadow } from '../../../tokens';
3
3
  import Chart from '../chart/Chart.svelte';
4
- import type { EChartsOption } from 'echarts';
5
- import * as echarts from 'echarts/core';
4
+ import echarts, { type EChartsOption } from '../../../echarts-config';
6
5
  import { createTooltipFormatter } from '../utils/tooltipFormatter';
7
6
  import { formattedDurationCompact } from '../utils/duration';
8
7
  import type { LineChartProps } from './types';
@@ -1,4 +1,4 @@
1
- import type { EChartsOption } from 'echarts';
1
+ import type { EChartsOption } from '../../../echarts-config';
2
2
  import type { GenericChartProps } from '../chart/Chart.svelte';
3
3
  export interface LineChartProps extends GenericChartProps {
4
4
  data: (number | null)[];
@@ -1,6 +1,6 @@
1
1
  <script module lang="ts">
2
2
  import { defineMeta } from '@storybook/addon-svelte-csf';
3
- import type { ECElementEvent } from 'echarts';
3
+ import type { ECElementEvent } from '../../../echarts-config';
4
4
  import MultiLineChart from './MultiLineChart.svelte';
5
5
 
6
6
  const { Story } = defineMeta({
@@ -1,8 +1,11 @@
1
1
  <script lang="ts">
2
2
  import { textColor, borderColor, chartColor, boxShadow } from '../../../tokens';
3
3
  import Chart, { type GenericChartProps } from '../chart/Chart.svelte';
4
- import type { ECElementEvent, EChartsOption, LineSeriesOption } from 'echarts';
5
- import * as echarts from 'echarts/core';
4
+ import echarts, {
5
+ type ECElementEvent,
6
+ type EChartsOption,
7
+ type LineSeriesOption,
8
+ } from '../../../echarts-config';
6
9
  import { createTooltipFormatter } from '../utils/tooltipFormatter';
7
10
  import { formattedDurationCompact } from '../utils/duration';
8
11
 
@@ -63,7 +66,7 @@
63
66
 
64
67
  function handleMouseOver(params: ECElementEvent) {
65
68
  focusedSeries = params.seriesName;
66
- props.onmouseover?.(params);
69
+ props.onmouseover?.(params as any);
67
70
  }
68
71
 
69
72
  function handleMouseOut() {
@@ -257,7 +260,7 @@
257
260
  ...props,
258
261
  xAxisName,
259
262
  yAxisName,
260
- onmouseover: handleMouseOver,
263
+ onmouseover: (params: any) => handleMouseOver(params),
261
264
  onmouseout: handleMouseOut,
262
265
  }}
263
266
  />
@@ -1,5 +1,5 @@
1
1
  import { type GenericChartProps } from '../chart/Chart.svelte';
2
- import type { EChartsOption } from 'echarts';
2
+ import { type EChartsOption } from '../../../echarts-config';
3
3
  interface Groups {
4
4
  key: string;
5
5
  series: (number | null)[];
@@ -1,4 +1,4 @@
1
- import type { EChartsOption } from 'echarts';
1
+ import type { EChartsOption } from '../../../echarts-config';
2
2
  import type { GenericChartProps } from '../chart/Chart.svelte';
3
3
  interface Groups {
4
4
  key: string;
@@ -1,6 +1,7 @@
1
1
  <script lang="ts">
2
- import { backgroundColor } from '../../../tokens';
3
- import Icon from '../../icons/Icon.svelte';
2
+ import Info from 'phosphor-svelte/lib/Info';
3
+ import { Icon } from '../../icons';
4
+ import { backgroundColor, textColor } from '../../../tokens';
4
5
  import Chart, { type GenericChartProps } from '../chart/Chart.svelte';
5
6
  import type {
6
7
  EChartsOption,
@@ -8,12 +9,19 @@
8
9
  CustomSeriesRenderItemAPI,
9
10
  CustomSeriesRenderItemParams,
10
11
  } from 'echarts';
12
+ import type { ECElementEvent } from '../../../echarts-config';
11
13
  import Tooltip from '../../tooltip/Tooltip.svelte';
12
14
  import type { Snippet } from 'svelte';
13
15
 
14
- export type DataPoint = { value: [number, number]; metadata: any; error_value?: number };
16
+ export type DataPoint = {
17
+ value: [number, number];
18
+ metadata: any;
19
+ error_value?: number;
20
+ disagreement?: boolean | null;
21
+ highlighted?: boolean | null;
22
+ };
15
23
 
16
- export type ScatterPlotEchartsEvent = echarts.ECElementEvent & {
24
+ export type ScatterPlotEchartsEvent = ECElementEvent & {
17
25
  data: DataPoint;
18
26
  };
19
27
 
@@ -28,9 +36,12 @@
28
36
  lineData?: [[number, number], [number, number]];
29
37
  showConfidenceBand?: boolean;
30
38
  showLegend?: boolean;
39
+ onitemclick?: (params: ScatterPlotEchartsEvent) => void;
40
+ onmouseover?: (params: ScatterPlotEchartsEvent) => void;
31
41
  legendItems?: LegendItem[];
42
+ highlightIndex?: number | null;
32
43
  children?: Snippet;
33
- } & Omit<GenericChartProps, 'timeIndex'>;
44
+ } & Omit<GenericChartProps, 'timeIndex' | 'onmouseover' | 'onitemclick'>;
34
45
 
35
46
  const {
36
47
  data,
@@ -46,6 +57,7 @@
46
57
  { label: 'Count', color: backgroundColor['blue-inverse'], type: 'point' },
47
58
  { label: 'Perfect agreement', color: backgroundColor['lilac-inverse'], type: 'line' },
48
59
  ],
60
+ highlightIndex = null,
49
61
  children,
50
62
  ...props
51
63
  }: ScatterPlotProps = $props();
@@ -85,6 +97,7 @@
85
97
  const xValue = api.value(0) as number;
86
98
  const yValue = api.value(1) as number;
87
99
  const error = api.value(2) as number;
100
+ const disagreement = api.value(3) as number;
88
101
 
89
102
  const highPoint = api.coord([xValue, yValue + error]);
90
103
  const lowPoint = api.coord([xValue, yValue - error]);
@@ -98,8 +111,7 @@
98
111
  const baseWidth = Array.isArray(sizeValue) ? sizeValue[0] : 10;
99
112
  const halfWidth = Math.min((baseWidth ?? 10) * 1.5, 3);
100
113
  const style = {
101
- stroke: api.visual('color') as string,
102
- fill: undefined,
114
+ stroke: disagreement ? textColor['icon-tertiary'] : backgroundColor['blue-inverse'],
103
115
  };
104
116
 
105
117
  return {
@@ -148,7 +160,7 @@
148
160
  const series: SeriesOption[] = [];
149
161
  const errorBarData = data
150
162
  .filter((d) => d.error_value != 0)
151
- .map((d) => [...d.value, d.error_value]);
163
+ .map((d) => [...d.value, d.error_value, d.disagreement ? 1 : 0]);
152
164
 
153
165
  if (props.lineData && props.lineData.length > 0) {
154
166
  const extendedLineData = [
@@ -170,7 +182,6 @@
170
182
  disabled: true,
171
183
  },
172
184
  silent: true,
173
- zlevel: 0,
174
185
  });
175
186
 
176
187
  if (showConfidenceBand && props.lineData && props.lineData.length > 0) {
@@ -205,7 +216,6 @@
205
216
  disabled: true,
206
217
  },
207
218
  silent: true,
208
- zlevel: 0,
209
219
  });
210
220
  }
211
221
  }
@@ -215,17 +225,43 @@
215
225
  data,
216
226
  type: 'scatter',
217
227
  itemStyle: {
218
- color: backgroundColor['blue-inverse'],
219
- opacity: 0.8,
228
+ color: (params: any) =>
229
+ params?.data?.disagreement ? textColor['icon-tertiary'] : backgroundColor['blue-inverse'],
230
+ opacity: 1,
220
231
  },
221
232
  emphasis: {
222
233
  itemStyle: {
223
- color: backgroundColor['blue-inverse'],
234
+ color: (params: any) => {
235
+ const point = params?.data as DataPoint;
236
+ return point?.disagreement
237
+ ? textColor['icon-tertiary']
238
+ : backgroundColor['blue-inverse'];
239
+ },
224
240
  opacity: 1,
225
241
  },
226
242
  },
227
243
  animation: false,
228
- zlevel: 1,
244
+ });
245
+
246
+ const p =
247
+ highlightIndex !== null && highlightIndex >= 0 && highlightIndex < data.length
248
+ ? data[highlightIndex]
249
+ : null;
250
+ series.push({
251
+ id: 'highlight-overlay',
252
+ type: 'scatter',
253
+ data: [p],
254
+ symbolSize: 16,
255
+ itemStyle: {
256
+ color: (params: any) => {
257
+ const point = params?.data as DataPoint;
258
+ return point?.disagreement
259
+ ? backgroundColor['neutral-hover']
260
+ : backgroundColor['blue-hover'];
261
+ },
262
+ },
263
+ z: -1,
264
+ silent: true,
229
265
  });
230
266
 
231
267
  if (errorBarData.length > 0) {
@@ -233,16 +269,11 @@
233
269
  type: 'custom',
234
270
  name: 'error',
235
271
  silent: true,
236
- itemStyle: {
237
- borderWidth: 1.5,
238
- color: backgroundColor['blue-inverse'],
239
- },
272
+ itemStyle: { borderWidth: 1.5 },
240
273
  renderItem: renderErrorBarItem,
241
274
  data: errorBarData,
242
- zlevel: 0,
243
275
  });
244
276
  }
245
-
246
277
  return {
247
278
  xAxis: {
248
279
  type: 'value',
@@ -320,7 +351,7 @@
320
351
  {#if item.label === 'Error margin'}
321
352
  <Tooltip placement="right">
322
353
  {#snippet trigger()}
323
- <Icon iconName="Info" color="icon-tertiary" />
354
+ <Icon color="icon-tertiary" icon={Info} />
324
355
  {/snippet}
325
356
  {#snippet content()}
326
357
  {@render confBandTooltip()}
@@ -1,11 +1,14 @@
1
1
  import { type GenericChartProps } from '../chart/Chart.svelte';
2
+ import type { ECElementEvent } from '../../../echarts-config';
2
3
  import type { Snippet } from 'svelte';
3
4
  export type DataPoint = {
4
5
  value: [number, number];
5
6
  metadata: any;
6
7
  error_value?: number;
8
+ disagreement?: boolean | null;
9
+ highlighted?: boolean | null;
7
10
  };
8
- export type ScatterPlotEchartsEvent = echarts.ECElementEvent & {
11
+ export type ScatterPlotEchartsEvent = ECElementEvent & {
9
12
  data: DataPoint;
10
13
  };
11
14
  type LegendItem = {
@@ -18,9 +21,12 @@ type ScatterPlotProps = {
18
21
  lineData?: [[number, number], [number, number]];
19
22
  showConfidenceBand?: boolean;
20
23
  showLegend?: boolean;
24
+ onitemclick?: (params: ScatterPlotEchartsEvent) => void;
25
+ onmouseover?: (params: ScatterPlotEchartsEvent) => void;
21
26
  legendItems?: LegendItem[];
27
+ highlightIndex?: number | null;
22
28
  children?: Snippet;
23
- } & Omit<GenericChartProps, 'timeIndex'>;
29
+ } & Omit<GenericChartProps, 'timeIndex' | 'onmouseover' | 'onitemclick'>;
24
30
  declare const Scatterplot: import("svelte").Component<ScatterPlotProps, {}, "">;
25
31
  type Scatterplot = ReturnType<typeof Scatterplot>;
26
32
  export default Scatterplot;
@@ -1,4 +1,4 @@
1
- import type { CallbackDataParams } from 'echarts/types/dist/shared';
1
+ import type { CallbackDataParams } from '../../../echarts-config';
2
2
  interface ExtendedCallbackDataParams extends CallbackDataParams {
3
3
  prefix?: string;
4
4
  textColor?: string;
@@ -1,7 +1,7 @@
1
1
  <script module lang="ts">
2
+ import Plus from 'phosphor-svelte/lib/Plus';
2
3
  import { defineMeta } from '@storybook/addon-svelte-csf';
3
4
  import IconButton from '../icon-button/IconButton.svelte';
4
- import { Icon } from '../icons';
5
5
 
6
6
  const { Story } = defineMeta({
7
7
  component: IconButton,
@@ -12,71 +12,39 @@
12
12
 
13
13
  <Story name="Base" asChild>
14
14
  <div class="flex flex-col gap-2">
15
- <IconButton variant="primary">
16
- <Icon iconName="Plus" />
17
- </IconButton>
18
- <IconButton variant="secondary">
19
- <Icon iconName="Plus" />
20
- </IconButton>
21
- <IconButton variant="danger">
22
- <Icon iconName="Plus" />
23
- </IconButton>
24
- <IconButton variant="transparent">
25
- <Icon iconName="Plus" />
26
- </IconButton>
15
+ <IconButton aria-label="Add" variant="primary" icon={Plus} />
16
+ <IconButton aria-label="Add" variant="secondary" icon={Plus} />
17
+ <IconButton aria-label="Add" variant="danger" icon={Plus} />
18
+ <IconButton aria-label="Add" variant="transparent" icon={Plus} />
27
19
  </div>
28
20
  </Story>
29
21
 
30
22
  <Story name="Sizes" asChild>
31
23
  <div class="flex flex-col gap-2">
32
- <IconButton variant="secondary" size="xs">
33
- <Icon iconName="Plus" />
34
- </IconButton>
35
- <IconButton variant="secondary" size="sm">
36
- <Icon iconName="Plus" />
37
- </IconButton>
38
- <IconButton variant="secondary" size="md">
39
- <Icon iconName="Plus" />
40
- </IconButton>
24
+ <IconButton aria-label="Add" icon={Plus} variant="secondary" size="xs" />
25
+ <IconButton aria-label="Add" icon={Plus} variant="secondary" size="sm" />
26
+ <IconButton aria-label="Add" icon={Plus} variant="secondary" size="md" />
41
27
  </div>
42
28
  </Story>
43
29
  <Story name="Not rounded base" asChild>
44
30
  <div class="flex flex-col gap-2">
45
- <IconButton variant="primary" rounded={false}>
46
- <Icon iconName="Plus" />
47
- </IconButton>
48
- <IconButton variant="secondary" rounded={false}>
49
- <Icon iconName="Plus" />
50
- </IconButton>
51
- <IconButton variant="danger" rounded={false}>
52
- <Icon iconName="Plus" />
53
- </IconButton>
54
- <IconButton variant="transparent" rounded={false}>
55
- <Icon iconName="Plus" />
56
- </IconButton>
31
+ <IconButton aria-label="Add" icon={Plus} variant="primary" rounded={false} />
32
+ <IconButton aria-label="Add" icon={Plus} variant="secondary" rounded={false} />
33
+ <IconButton aria-label="Add" icon={Plus} variant="danger" rounded={false} />
34
+ <IconButton aria-label="Add" icon={Plus} variant="transparent" rounded={false} />
57
35
  </div>
58
36
  </Story>
59
37
 
60
38
  <Story name="Not rounded sizes" asChild>
61
39
  <div class="flex flex-col gap-2">
62
- <IconButton variant="secondary" size="xs" rounded={false}>
63
- <Icon iconName="Plus" />
64
- </IconButton>
65
- <IconButton variant="secondary" size="sm" rounded={false}>
66
- <Icon iconName="Plus" />
67
- </IconButton>
68
- <IconButton variant="secondary" size="md" rounded={false}>
69
- <Icon iconName="Plus" />
70
- </IconButton>
40
+ <IconButton aria-label="Add" icon={Plus} variant="secondary" size="xs" rounded={false} />
41
+ <IconButton aria-label="Add" icon={Plus} variant="secondary" size="sm" rounded={false} />
42
+ <IconButton aria-label="Add" icon={Plus} variant="secondary" size="md" rounded={false} />
71
43
  </div>
72
44
  </Story>
73
45
  <Story name="Disabled" asChild>
74
- <IconButton disabled>
75
- <Icon iconName="Plus" />
76
- </IconButton>
46
+ <IconButton aria-label="Add" disabled icon={Plus} />
77
47
  </Story>
78
48
  <Story name="Loading" asChild>
79
- <IconButton loading>
80
- <Icon iconName="Plus" />
81
- </IconButton>
49
+ <IconButton aria-label="Add" icon={Plus} loading />
82
50
  </Story>
@@ -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;
@@ -1,5 +1,9 @@
1
1
  <script lang="ts">
2
- import Icon from './Icon.svelte';
2
+ import RadioButton from 'phosphor-svelte/lib/RadioButton';
3
+ import BugBeetle from 'phosphor-svelte/lib/BugBeetle';
4
+ import Plant from 'phosphor-svelte/lib/Plant';
5
+ import LineSegments from 'phosphor-svelte/lib/LineSegments';
6
+ import { Icon } from './index';
3
7
  import { Well, Halo } from './custom';
4
8
  import type { IconColor, SupportedAnalysisModelIcons } from '.';
5
9
 
@@ -82,17 +86,17 @@
82
86
  {#if model === 'pipeline_halos'}
83
87
  <Halo size={getIconSize().toString()} color={mapAnalysisToColor(model)} />
84
88
  {:else if ['sgs_enteros'].includes(model)}
85
- <Icon iconName="RadioButton" color={mapAnalysisToColor(model)} size={getIconSize()} />
89
+ <Icon color={mapAnalysisToColor(model)} size={getIconSize()} icon={RadioButton} />
86
90
  {:else if model === 'pipeline_large_colonies' || model === 'pipeline_radial_growth'}
87
- <Icon iconName="RadioButton" color={mapAnalysisToColor(model)} size={getIconSize()} />
91
+ <Icon color={mapAnalysisToColor(model)} size={getIconSize()} icon={RadioButton} />
88
92
  {:else if model === 'pipeline_small_colonies'}
89
93
  <Well size={getIconSize().toString()} color={mapAnalysisToColor(model)} />
90
94
  {:else if model === 'pipeline_insects'}
91
- <Icon iconName="BugBeetle" color={mapAnalysisToColor(model)} size={getIconSize()} />
95
+ <Icon color={mapAnalysisToColor(model)} size={getIconSize()} icon={BugBeetle} />
92
96
  {:else if model === 'pipeline_seed_germination'}
93
- <Icon iconName="Plant" color={mapAnalysisToColor(model)} size={getIconSize()} />
97
+ <Icon color={mapAnalysisToColor(model)} size={getIconSize()} icon={Plant} />
94
98
  {:else}
95
- <Icon iconName="LineSegments" color={mapAnalysisToColor(model)} size={getIconSize()} />
99
+ <Icon color={mapAnalysisToColor(model)} size={getIconSize()} icon={LineSegments} />
96
100
  {/if}
97
101
  </div>
98
102
 
@@ -1,6 +1,7 @@
1
1
  <script module lang="ts">
2
+ import Star from 'phosphor-svelte/lib/Star';
2
3
  import { defineMeta } from '@storybook/addon-svelte-csf';
3
- import { Icon, iconMap, type IconName } from './index';
4
+ import { Icon } from './index';
4
5
 
5
6
  const { Story } = defineMeta({
6
7
  component: Icon,
@@ -13,49 +14,30 @@
13
14
  },
14
15
  },
15
16
  });
16
-
17
- // Get all icon names from the iconMap
18
- const iconNames = Object.keys(iconMap);
19
17
  </script>
20
18
 
21
- <Story name="All Icons" asChild>
22
- <div class="p-4">
23
- <h2 class="mb-6 text-xl font-semibold">Icon Gallery</h2>
24
- <div class="grid grid-cols-1 gap-6 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4">
25
- {#each iconNames as iconName}
26
- <div class="flex flex-col items-center rounded-lg border border-neutral p-4 text-center">
27
- <div class="mb-3 flex h-12 w-12 items-center justify-center rounded-full bg-neutral">
28
- <Icon iconName={iconName as IconName} size={24} />
29
- </div>
30
- <span class="text-sm">{iconName}</span>
31
- </div>
32
- {/each}
33
- </div>
34
- </div>
35
- </Story>
36
-
37
19
  <Story name="Icon Sizes" asChild>
38
20
  <div class="p-4">
39
21
  <h2 class="mb-6 text-xl font-semibold">Icon Sizes</h2>
40
22
  <div class="flex flex-wrap items-end gap-8">
41
23
  <div class="flex flex-col items-center">
42
- <Icon iconName="Star" size={16} />
24
+ <Icon icon={Star} size={16} />
43
25
  <span class="mt-2 text-xs">16px</span>
44
26
  </div>
45
27
  <div class="flex flex-col items-center">
46
- <Icon iconName="Star" size={20} />
28
+ <Icon icon={Star} size={20} />
47
29
  <span class="mt-2 text-xs">20px</span>
48
30
  </div>
49
31
  <div class="flex flex-col items-center">
50
- <Icon iconName="Star" size={24} />
32
+ <Icon icon={Star} size={24} />
51
33
  <span class="mt-2 text-xs">24px</span>
52
34
  </div>
53
35
  <div class="flex flex-col items-center">
54
- <Icon iconName="Star" size={32} />
36
+ <Icon icon={Star} size={32} />
55
37
  <span class="mt-2 text-xs">32px</span>
56
38
  </div>
57
39
  <div class="flex flex-col items-center">
58
- <Icon iconName="Star" size={48} />
40
+ <Icon icon={Star} size={48} />
59
41
  <span class="mt-2 text-xs">48px</span>
60
42
  </div>
61
43
  </div>
@@ -67,27 +49,27 @@
67
49
  <h2 class="mb-6 text-xl font-semibold">Icon Weights</h2>
68
50
  <div class="flex flex-wrap gap-8">
69
51
  <div class="flex flex-col items-center">
70
- <Icon iconName="Star" size={24} weight="thin" />
52
+ <Icon icon={Star} size={24} weight="thin" />
71
53
  <span class="mt-2 text-xs">Thin</span>
72
54
  </div>
73
55
  <div class="flex flex-col items-center">
74
- <Icon iconName="Star" size={24} weight="light" />
56
+ <Icon icon={Star} size={24} weight="light" />
75
57
  <span class="mt-2 text-xs">Light</span>
76
58
  </div>
77
59
  <div class="flex flex-col items-center">
78
- <Icon iconName="Star" size={24} weight="regular" />
60
+ <Icon icon={Star} size={24} weight="regular" />
79
61
  <span class="mt-2 text-xs">Regular</span>
80
62
  </div>
81
63
  <div class="flex flex-col items-center">
82
- <Icon iconName="Star" size={24} weight="bold" />
64
+ <Icon icon={Star} size={24} weight="bold" />
83
65
  <span class="mt-2 text-xs">Bold</span>
84
66
  </div>
85
67
  <div class="flex flex-col items-center">
86
- <Icon iconName="Star" size={24} weight="fill" />
68
+ <Icon icon={Star} size={24} weight="fill" />
87
69
  <span class="mt-2 text-xs">Fill</span>
88
70
  </div>
89
71
  <div class="flex flex-col items-center">
90
- <Icon iconName="Star" size={24} weight="duotone" />
72
+ <Icon icon={Star} size={24} weight="duotone" />
91
73
  <span class="mt-2 text-xs">Duotone</span>
92
74
  </div>
93
75
  </div>
@@ -99,27 +81,27 @@
99
81
  <h2 class="mb-6 text-xl font-semibold">Icon Colors</h2>
100
82
  <div class="flex flex-wrap gap-8">
101
83
  <div class="flex flex-col items-center">
102
- <Icon iconName="Star" size={24} color="primary" />
84
+ <Icon icon={Star} size={24} color="primary" />
103
85
  <span class="mt-2 text-xs">Primary</span>
104
86
  </div>
105
87
  <div class="flex flex-col items-center">
106
- <Icon iconName="Star" size={24} color="secondary" />
88
+ <Icon icon={Star} size={24} color="secondary" />
107
89
  <span class="mt-2 text-xs">Secondary</span>
108
90
  </div>
109
91
  <div class="flex flex-col items-center">
110
- <Icon iconName="Star" size={24} color="tertiary" />
92
+ <Icon icon={Star} size={24} color="tertiary" />
111
93
  <span class="mt-2 text-xs">Tertiary</span>
112
94
  </div>
113
95
  <div class="flex flex-col items-center">
114
- <Icon iconName="Star" size={24} color="success" />
96
+ <Icon icon={Star} size={24} color="success" />
115
97
  <span class="mt-2 text-xs">Success</span>
116
98
  </div>
117
99
  <div class="flex flex-col items-center">
118
- <Icon iconName="Star" size={24} color="warning" />
100
+ <Icon icon={Star} size={24} color="warning" />
119
101
  <span class="mt-2 text-xs">Warning</span>
120
102
  </div>
121
103
  <div class="flex flex-col items-center">
122
- <Icon iconName="Star" size={24} color="danger" />
104
+ <Icon icon={Star} size={24} color="danger" />
123
105
  <span class="mt-2 text-xs">Danger</span>
124
106
  </div>
125
107
  </div>