@reshape-biotech/design-system 0.0.2 → 0.0.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/README.md ADDED
@@ -0,0 +1,58 @@
1
+ # create-svelte
2
+
3
+ Everything you need to build a Svelte library, powered by [`create-svelte`](https://github.com/sveltejs/kit/tree/main/packages/create-svelte).
4
+
5
+ Read more about creating a library [in the docs](https://svelte.dev/docs/kit/packaging).
6
+
7
+ ## Creating a project
8
+
9
+ If you're seeing this, you've probably already done this step. Congrats!
10
+
11
+ ```bash
12
+ # create a new project in the current directory
13
+ npx sv create
14
+
15
+ # create a new project in my-app
16
+ npx sv create my-app
17
+ ```
18
+
19
+ ## Developing
20
+
21
+ Once you've created a project and installed dependencies with `npm install` (or `pnpm install` or `yarn`), start a development server:
22
+
23
+ ```bash
24
+ npm run dev
25
+
26
+ # or start the server and open the app in a new browser tab
27
+ npm run dev -- --open
28
+ ```
29
+
30
+ Everything inside `src/lib` is part of your library, everything inside `src/routes` can be used as a showcase or preview app.
31
+
32
+ ## Building
33
+
34
+ To build your library:
35
+
36
+ ```bash
37
+ npm run package
38
+ ```
39
+
40
+ To create a production version of your showcase app:
41
+
42
+ ```bash
43
+ npm run build
44
+ ```
45
+
46
+ You can preview the production build with `npm run preview`.
47
+
48
+ > To deploy your app, you may need to install an [adapter](https://svelte.dev/docs/kit/adapters) for your target environment.
49
+
50
+ ## Publishing
51
+
52
+ Go into the `package.json` and give your package the desired name through the `"name"` option. Also consider adding a `"license"` field and point it to a `LICENSE` file which you can create from a template (one popular option is the [MIT license](https://opensource.org/license/mit/)).
53
+
54
+ To publish your library to [npm](https://www.npmjs.com):
55
+
56
+ ```bash
57
+ npm publish
58
+ ```
@@ -0,0 +1,67 @@
1
+ <script lang="ts">
2
+ import Tooltip from '../tooltip/Tooltip.svelte';
3
+
4
+ interface Props {
5
+ name: string | null | undefined;
6
+ size?: 'sm' | 'md';
7
+ showTooltip?: boolean;
8
+ }
9
+
10
+ let { name, size = 'md', showTooltip = true }: Props = $props();
11
+ const sizes = {
12
+ sm: 'h-5 w-5 min-w-5 text-xxs font-medium',
13
+ md: 'h-7 w-7 min-w-7 text-xs font-medium',
14
+ };
15
+
16
+ let sizeClassName = $derived(sizes[size]);
17
+
18
+ const getInitials = (name: string | null | undefined) => {
19
+ if (!name) {
20
+ return '?'; // You can use any default value here
21
+ }
22
+ // Check if the name is an email
23
+ const isEmail = name.includes('@');
24
+ if (isEmail) {
25
+ return name.slice(0, 2).toUpperCase();
26
+ }
27
+
28
+ // Split the name by space
29
+ const splitName = name.split(' ');
30
+
31
+ // Check if the name is a single word or already initials
32
+ if (splitName.length === 1 || (splitName.length === 1 && splitName[0].length <= 2)) {
33
+ return name.slice(0, 2).toUpperCase();
34
+ }
35
+
36
+ // If the name is multiple words, use the first letter of the first and last word
37
+ const firstInitial = splitName[0][0];
38
+ const lastInitial = splitName[splitName.length - 1][0];
39
+
40
+ return (firstInitial + lastInitial).toUpperCase();
41
+ };
42
+ let initials = $derived(getInitials(name));
43
+ </script>
44
+
45
+ {#snippet avatar()}
46
+ <div
47
+ class="{sizeClassName} flex items-center justify-center rounded-full bg-accent-inverse text-primary-inverse"
48
+ >
49
+ {initials}
50
+ </div>
51
+ {/snippet}
52
+
53
+ {#if showTooltip}
54
+ <Tooltip>
55
+ {#snippet trigger()}
56
+ {@render avatar()}
57
+ {/snippet}
58
+ {#snippet content()}
59
+ <span>{name ? name : 'Unknown'}</span>
60
+ {/snippet}
61
+ </Tooltip>
62
+ {:else}
63
+ {@render avatar()}
64
+ {/if}
65
+
66
+ <style>
67
+ </style>
@@ -0,0 +1,8 @@
1
+ interface Props {
2
+ name: string | null | undefined;
3
+ size?: 'sm' | 'md';
4
+ showTooltip?: boolean;
5
+ }
6
+ declare const Avatar: import("svelte").Component<Props, {}, "">;
7
+ type Avatar = ReturnType<typeof Avatar>;
8
+ export default Avatar;
@@ -0,0 +1,126 @@
1
+ <script module>
2
+ import Tooltip from './Tooltip.svelte';
3
+
4
+ import { defineMeta } from '@storybook/addon-svelte-csf';
5
+ const { Story } = defineMeta({
6
+ component: Tooltip,
7
+ title: 'Components/Tooltip',
8
+ tags: ['autodocs'],
9
+ });
10
+ </script>
11
+
12
+ <Story name="Base">
13
+ <div class="flex justify-center">
14
+ <Tooltip>
15
+ {#snippet trigger()}
16
+ <button>Hover me</button>
17
+ {/snippet}
18
+ {#snippet content()}
19
+ <span>Hello World</span>
20
+ {/snippet}
21
+ </Tooltip>
22
+ </div>
23
+ </Story>
24
+
25
+ <Story name="Force Open">
26
+ <div class="flex justify-center">
27
+ <Tooltip forceOpen={true}>
28
+ {#snippet trigger()}
29
+ <button>Hover me</button>
30
+ {/snippet}
31
+ {#snippet content()}
32
+ <span>Hello World</span>
33
+ {/snippet}
34
+ </Tooltip>
35
+ </div>
36
+ </Story>
37
+
38
+ <Story name="No Arrow">
39
+ <div class="flex justify-center">
40
+ <Tooltip showArrow={false}>
41
+ {#snippet trigger()}
42
+ <button>This one has no arrow</button>
43
+ {/snippet}
44
+ {#snippet content()}
45
+ <span>Wow, no arrow</span>
46
+ {/snippet}
47
+ </Tooltip>
48
+ </div>
49
+ </Story>
50
+
51
+ <Story name="Different Placements">
52
+ <div class="flex justify-center gap-4 py-8">
53
+ <div>
54
+ <Tooltip placement="top">
55
+ {#snippet trigger()}
56
+ <button>Top</button>
57
+ {/snippet}
58
+ {#snippet content()}
59
+ <span>Tooltip on top</span>
60
+ {/snippet}
61
+ </Tooltip>
62
+ </div>
63
+ <div>
64
+ <Tooltip placement="right">
65
+ {#snippet trigger()}
66
+ <button>Right</button>
67
+ {/snippet}
68
+ {#snippet content()}
69
+ <span>Tooltip on right</span>
70
+ {/snippet}
71
+ </Tooltip>
72
+ </div>
73
+ <div>
74
+ <Tooltip placement="bottom">
75
+ {#snippet trigger()}
76
+ <button>Bottom</button>
77
+ {/snippet}
78
+ {#snippet content()}
79
+ <span>Tooltip on bottom</span>
80
+ {/snippet}
81
+ </Tooltip>
82
+ </div>
83
+ <div>
84
+ <Tooltip placement="left">
85
+ {#snippet trigger()}
86
+ <button>Left</button>
87
+ {/snippet}
88
+ {#snippet content()}
89
+ <span>Tooltip on left</span>
90
+ {/snippet}
91
+ </Tooltip>
92
+ </div>
93
+ </div>
94
+ </Story>
95
+
96
+ <Story name="Custom Content">
97
+ <div class="flex h-28 items-end justify-center">
98
+ <Tooltip>
99
+ {#snippet trigger()}
100
+ <button>Hover me</button>
101
+ {/snippet}
102
+ {#snippet content()}
103
+ <div>
104
+ <h3>Custom Heading</h3>
105
+ <p>This is some custom content inside the tooltip.</p>
106
+ </div>
107
+ {/snippet}
108
+ </Tooltip>
109
+ </div>
110
+ </Story>
111
+
112
+ <Story name="Custom Content Forced Open">
113
+ <div class="flex h-28 items-end justify-center">
114
+ <Tooltip forceOpen={true}>
115
+ {#snippet trigger()}
116
+ <button>Hover me</button>
117
+ {/snippet}
118
+ {#snippet content()}
119
+ <div>
120
+ <h3>Custom Heading</h3>
121
+ <p>This is some custom content inside the tooltip.</p>
122
+ </div>
123
+ {/snippet}
124
+ </Tooltip>
125
+ </div>
126
+ </Story>
@@ -0,0 +1,27 @@
1
+ export default Tooltip;
2
+ type Tooltip = SvelteComponent<{
3
+ [x: string]: never;
4
+ }, {
5
+ [evt: string]: CustomEvent<any>;
6
+ }, {}> & {
7
+ $$bindings?: string | undefined;
8
+ };
9
+ declare const Tooltip: $$__sveltets_2_IsomorphicComponent<{
10
+ [x: string]: never;
11
+ }, {
12
+ [evt: string]: CustomEvent<any>;
13
+ }, {}, {}, string>;
14
+ import Tooltip from './Tooltip.svelte';
15
+ interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
16
+ new (options: import("svelte").ComponentConstructorOptions<Props>): import("svelte").SvelteComponent<Props, Events, Slots> & {
17
+ $$bindings?: Bindings;
18
+ } & Exports;
19
+ (internal: unknown, props: {
20
+ $$events?: Events;
21
+ $$slots?: Slots;
22
+ }): Exports & {
23
+ $set?: any;
24
+ $on?: any;
25
+ };
26
+ z_$$bindings?: Bindings;
27
+ }
@@ -0,0 +1,41 @@
1
+ <script lang="ts">
2
+ import { Tooltip } from 'flowbite-svelte';
3
+ import type { Snippet } from 'svelte';
4
+
5
+ interface Props {
6
+ class?: string;
7
+ forceOpen?: boolean;
8
+ showArrow?: boolean;
9
+ placement?: 'top' | 'right' | 'bottom' | 'left';
10
+ trigger?: Snippet;
11
+ content?: Snippet;
12
+ }
13
+
14
+ let {
15
+ class: className = '',
16
+ forceOpen = false,
17
+ showArrow = true,
18
+ placement = 'top',
19
+ trigger,
20
+ content,
21
+ }: Props = $props();
22
+
23
+ let tooltipClass = $derived(`${className} ${showArrow ? 'with-arrow' : ''}`);
24
+ </script>
25
+
26
+ {@render trigger?.()}
27
+ <Tooltip
28
+ open={forceOpen}
29
+ arrow={showArrow}
30
+ {placement}
31
+ class={`${tooltipClass} rounded bg-base-inverse px-2 py-1 text-sm font-normal text-primary-inverse shadow`}
32
+ >
33
+ {@render content?.()}
34
+ </Tooltip>
35
+
36
+ <style>
37
+ /* Hack to get the arrow styling to work */
38
+ :global(.tooltip.with-arrow > :last-child) {
39
+ @apply pointer-events-none absolute block h-2 w-2 rotate-45 transform border-inherit bg-inherit;
40
+ }
41
+ </style>
@@ -0,0 +1,13 @@
1
+ import { Tooltip } from 'flowbite-svelte';
2
+ import type { Snippet } from 'svelte';
3
+ interface Props {
4
+ class?: string;
5
+ forceOpen?: boolean;
6
+ showArrow?: boolean;
7
+ placement?: 'top' | 'right' | 'bottom' | 'left';
8
+ trigger?: Snippet;
9
+ content?: Snippet;
10
+ }
11
+ declare const Tooltip: import("svelte").Component<Props, {}, "">;
12
+ type Tooltip = ReturnType<typeof Tooltip>;
13
+ export default Tooltip;
@@ -0,0 +1,3 @@
1
+ export { default as Avatar } from './components/avatar/Avatar.svelte';
2
+ export { default as Tooltip } from './components/tooltip/Tooltip.svelte';
3
+ export { tokens } from './tokens.js';
package/dist/index.js ADDED
@@ -0,0 +1,5 @@
1
+ // Reexport your entry components here
2
+ export { default as Avatar } from './components/avatar/Avatar.svelte';
3
+ export { default as Tooltip } from './components/tooltip/Tooltip.svelte';
4
+ // Tokens
5
+ export { tokens } from './tokens.js';
@@ -0,0 +1,564 @@
1
+ export declare const colors: {
2
+ base: {
3
+ mist: string;
4
+ snow: string;
5
+ white: {
6
+ default: string;
7
+ 5: string;
8
+ 10: string;
9
+ 15: string;
10
+ 25: string;
11
+ 50: string;
12
+ 70: string;
13
+ 90: string;
14
+ };
15
+ midnight: {
16
+ default: string;
17
+ 5: string;
18
+ 10: string;
19
+ 15: string;
20
+ 25: string;
21
+ 50: string;
22
+ 70: string;
23
+ 90: string;
24
+ };
25
+ };
26
+ gray: {
27
+ 1: string;
28
+ 2: string;
29
+ 3: string;
30
+ 4: string;
31
+ 5: string;
32
+ 6: string;
33
+ };
34
+ periwinkle: {
35
+ 1: string;
36
+ 2: string;
37
+ 3: {
38
+ default: string;
39
+ 10: string;
40
+ 25: string;
41
+ };
42
+ 4: {
43
+ default: string;
44
+ 10: string;
45
+ 25: string;
46
+ };
47
+ 5: {
48
+ default: string;
49
+ 10: string;
50
+ 25: string;
51
+ };
52
+ 6: string;
53
+ };
54
+ orange: {
55
+ 1: string;
56
+ 2: string;
57
+ 3: string;
58
+ 4: {
59
+ default: string;
60
+ 10: string;
61
+ 25: string;
62
+ };
63
+ 5: {
64
+ default: string;
65
+ 10: string;
66
+ 25: string;
67
+ };
68
+ 6: string;
69
+ };
70
+ sky: {
71
+ 1: string;
72
+ 2: string;
73
+ 3: string;
74
+ 4: {
75
+ default: string;
76
+ 10: string;
77
+ 25: string;
78
+ };
79
+ 5: {
80
+ default: string;
81
+ 10: string;
82
+ 25: string;
83
+ };
84
+ 6: string;
85
+ };
86
+ blue: {
87
+ 1: string;
88
+ 2: string;
89
+ 3: string;
90
+ 4: {
91
+ default: string;
92
+ 10: string;
93
+ 25: string;
94
+ };
95
+ 5: {
96
+ default: string;
97
+ 10: string;
98
+ 25: string;
99
+ };
100
+ 6: string;
101
+ };
102
+ green: {
103
+ 1: string;
104
+ 2: string;
105
+ 3: string;
106
+ 4: {
107
+ default: string;
108
+ 10: string;
109
+ 25: string;
110
+ };
111
+ 5: {
112
+ default: string;
113
+ 10: string;
114
+ 25: string;
115
+ };
116
+ 6: string;
117
+ };
118
+ yellow: {
119
+ 1: string;
120
+ 2: string;
121
+ 3: string;
122
+ 4: {
123
+ default: string;
124
+ 10: string;
125
+ 25: string;
126
+ };
127
+ 5: {
128
+ default: string;
129
+ 10: string;
130
+ 25: string;
131
+ };
132
+ 6: string;
133
+ };
134
+ red: {
135
+ 1: string;
136
+ 2: string;
137
+ 3: string;
138
+ 4: {
139
+ default: string;
140
+ 10: string;
141
+ 25: string;
142
+ };
143
+ 5: {
144
+ default: string;
145
+ 10: string;
146
+ 25: string;
147
+ };
148
+ 6: string;
149
+ };
150
+ shadow: {
151
+ 2: string;
152
+ 4: string;
153
+ 8: string;
154
+ 12: string;
155
+ 16: string;
156
+ };
157
+ };
158
+ export declare const borderColor: {
159
+ 'dark-static': string;
160
+ 'dark-interactive': string;
161
+ 'dark-hover': string;
162
+ 'dark-focus': string;
163
+ 'dark-danger': string;
164
+ static: string;
165
+ interactive: string;
166
+ hover: string;
167
+ focus: string;
168
+ danger: string;
169
+ };
170
+ export declare const textColor: {
171
+ 'icon-primary': string;
172
+ 'icon-secondary': string;
173
+ 'icon-tertiary': string;
174
+ 'icon-primary-inverse': string;
175
+ 'icon-accent': string;
176
+ 'icon-success': string;
177
+ 'icon-warning': string;
178
+ 'icon-danger': string;
179
+ 'icon-blue': string;
180
+ 'icon-orange': string;
181
+ 'icon-sky': string;
182
+ 'dark-primary': string;
183
+ 'dark-secondary': string;
184
+ 'dark-tertiary': string;
185
+ 'dark-primary-inverse': string;
186
+ 'dark-secondary-inverse': string;
187
+ 'dark-tertiary-inverse': string;
188
+ 'dark-accent': string;
189
+ 'dark-success': string;
190
+ 'dark-warning': string;
191
+ 'dark-danger': string;
192
+ primary: string;
193
+ secondary: string;
194
+ tertiary: string;
195
+ 'primary-inverse': string;
196
+ 'secondary-inverse': string;
197
+ 'tertiary-inverse': string;
198
+ accent: string;
199
+ success: string;
200
+ warning: string;
201
+ danger: string;
202
+ };
203
+ export declare const backgroundColor: {
204
+ 'dark-neutral': string;
205
+ 'dark-neutral-hover': string;
206
+ 'dark-neutral-darker': string;
207
+ 'dark-neutral-darker-hover': string;
208
+ 'dark-accent': string;
209
+ 'dark-accent-hover': string;
210
+ 'dark-accent-inverse': string;
211
+ 'dark-accent-inverse-hover': string;
212
+ 'dark-success': string;
213
+ 'dark-success-hover': string;
214
+ 'dark-success-inverse': string;
215
+ 'dark-success-inverse-hover': string;
216
+ 'dark-warning': string;
217
+ 'dark-warning-hover': string;
218
+ 'dark-warning-inverse': string;
219
+ 'dark-warning-inverse-hover': string;
220
+ 'dark-danger': string;
221
+ 'dark-danger-hover': string;
222
+ 'dark-danger-inverse': string;
223
+ 'dark-danger-inverse-hover': string;
224
+ 'dark-blue': string;
225
+ 'dark-blue-hover': string;
226
+ 'dark-orange': string;
227
+ 'dark-orange-hover': string;
228
+ 'dark-sky': string;
229
+ 'dark-sky-hover': string;
230
+ 'dark-primary': string;
231
+ 'dark-secondary': string;
232
+ 'dark-base': string;
233
+ 'dark-base-inverse': string;
234
+ 'dark-overlay': string;
235
+ surface: string;
236
+ 'surface-secondary': string;
237
+ base: string;
238
+ 'base-inverse': string;
239
+ overlay: string;
240
+ neutral: string;
241
+ 'neutral-hover': string;
242
+ 'neutral-darker': string;
243
+ 'neutral-darker-hover': string;
244
+ 'neutral-inverse': string;
245
+ 'neutral-inverse-hover': string;
246
+ accent: string;
247
+ 'accent-hover': string;
248
+ 'accent-inverse': string;
249
+ 'accent-inverse-hover': string;
250
+ success: string;
251
+ 'success-hover': string;
252
+ 'success-inverse': string;
253
+ 'success-inverse-hover': string;
254
+ warning: string;
255
+ 'warning-hover': string;
256
+ 'warning-inverse': string;
257
+ 'warning-inverse-hover': string;
258
+ danger: string;
259
+ 'danger-hover': string;
260
+ 'danger-inverse': string;
261
+ 'danger-inverse-hover': string;
262
+ blue: string;
263
+ 'blue-hover': string;
264
+ orange: string;
265
+ 'orange-hover': string;
266
+ 'orange-inverse': string;
267
+ 'orange-inverse-hover': string;
268
+ sky: string;
269
+ 'sky-hover': string;
270
+ 'sky-inverse': string;
271
+ 'sky-inverse-hover': string;
272
+ };
273
+ export declare const boxShadow: {
274
+ field: string;
275
+ nav: string;
276
+ calendar: string;
277
+ container: string;
278
+ panel: string;
279
+ outline: string;
280
+ focus: string;
281
+ };
282
+ export declare const tokens: {
283
+ colors: {
284
+ base: {
285
+ mist: string;
286
+ snow: string;
287
+ white: {
288
+ default: string;
289
+ 5: string;
290
+ 10: string;
291
+ 15: string;
292
+ 25: string;
293
+ 50: string;
294
+ 70: string;
295
+ 90: string;
296
+ };
297
+ midnight: {
298
+ default: string;
299
+ 5: string;
300
+ 10: string;
301
+ 15: string;
302
+ 25: string;
303
+ 50: string;
304
+ 70: string;
305
+ 90: string;
306
+ };
307
+ };
308
+ gray: {
309
+ 1: string;
310
+ 2: string;
311
+ 3: string;
312
+ 4: string;
313
+ 5: string;
314
+ 6: string;
315
+ };
316
+ periwinkle: {
317
+ 1: string;
318
+ 2: string;
319
+ 3: {
320
+ default: string;
321
+ 10: string;
322
+ 25: string;
323
+ };
324
+ 4: {
325
+ default: string;
326
+ 10: string;
327
+ 25: string;
328
+ };
329
+ 5: {
330
+ default: string;
331
+ 10: string;
332
+ 25: string;
333
+ };
334
+ 6: string;
335
+ };
336
+ orange: {
337
+ 1: string;
338
+ 2: string;
339
+ 3: string;
340
+ 4: {
341
+ default: string;
342
+ 10: string;
343
+ 25: string;
344
+ };
345
+ 5: {
346
+ default: string;
347
+ 10: string;
348
+ 25: string;
349
+ };
350
+ 6: string;
351
+ };
352
+ sky: {
353
+ 1: string;
354
+ 2: string;
355
+ 3: string;
356
+ 4: {
357
+ default: string;
358
+ 10: string;
359
+ 25: string;
360
+ };
361
+ 5: {
362
+ default: string;
363
+ 10: string;
364
+ 25: string;
365
+ };
366
+ 6: string;
367
+ };
368
+ blue: {
369
+ 1: string;
370
+ 2: string;
371
+ 3: string;
372
+ 4: {
373
+ default: string;
374
+ 10: string;
375
+ 25: string;
376
+ };
377
+ 5: {
378
+ default: string;
379
+ 10: string;
380
+ 25: string;
381
+ };
382
+ 6: string;
383
+ };
384
+ green: {
385
+ 1: string;
386
+ 2: string;
387
+ 3: string;
388
+ 4: {
389
+ default: string;
390
+ 10: string;
391
+ 25: string;
392
+ };
393
+ 5: {
394
+ default: string;
395
+ 10: string;
396
+ 25: string;
397
+ };
398
+ 6: string;
399
+ };
400
+ yellow: {
401
+ 1: string;
402
+ 2: string;
403
+ 3: string;
404
+ 4: {
405
+ default: string;
406
+ 10: string;
407
+ 25: string;
408
+ };
409
+ 5: {
410
+ default: string;
411
+ 10: string;
412
+ 25: string;
413
+ };
414
+ 6: string;
415
+ };
416
+ red: {
417
+ 1: string;
418
+ 2: string;
419
+ 3: string;
420
+ 4: {
421
+ default: string;
422
+ 10: string;
423
+ 25: string;
424
+ };
425
+ 5: {
426
+ default: string;
427
+ 10: string;
428
+ 25: string;
429
+ };
430
+ 6: string;
431
+ };
432
+ shadow: {
433
+ 2: string;
434
+ 4: string;
435
+ 8: string;
436
+ 12: string;
437
+ 16: string;
438
+ };
439
+ };
440
+ borderColor: {
441
+ 'dark-static': string;
442
+ 'dark-interactive': string;
443
+ 'dark-hover': string;
444
+ 'dark-focus': string;
445
+ 'dark-danger': string;
446
+ static: string;
447
+ interactive: string;
448
+ hover: string;
449
+ focus: string;
450
+ danger: string;
451
+ };
452
+ textColor: {
453
+ 'icon-primary': string;
454
+ 'icon-secondary': string;
455
+ 'icon-tertiary': string;
456
+ 'icon-primary-inverse': string;
457
+ 'icon-accent': string;
458
+ 'icon-success': string;
459
+ 'icon-warning': string;
460
+ 'icon-danger': string;
461
+ 'icon-blue': string;
462
+ 'icon-orange': string;
463
+ 'icon-sky': string;
464
+ 'dark-primary': string;
465
+ 'dark-secondary': string;
466
+ 'dark-tertiary': string;
467
+ 'dark-primary-inverse': string;
468
+ 'dark-secondary-inverse': string;
469
+ 'dark-tertiary-inverse': string;
470
+ 'dark-accent': string;
471
+ 'dark-success': string;
472
+ 'dark-warning': string;
473
+ 'dark-danger': string;
474
+ primary: string;
475
+ secondary: string;
476
+ tertiary: string;
477
+ 'primary-inverse': string;
478
+ 'secondary-inverse': string;
479
+ 'tertiary-inverse': string;
480
+ accent: string;
481
+ success: string;
482
+ warning: string;
483
+ danger: string;
484
+ };
485
+ backgroundColor: {
486
+ 'dark-neutral': string;
487
+ 'dark-neutral-hover': string;
488
+ 'dark-neutral-darker': string;
489
+ 'dark-neutral-darker-hover': string;
490
+ 'dark-accent': string;
491
+ 'dark-accent-hover': string;
492
+ 'dark-accent-inverse': string;
493
+ 'dark-accent-inverse-hover': string;
494
+ 'dark-success': string;
495
+ 'dark-success-hover': string;
496
+ 'dark-success-inverse': string;
497
+ 'dark-success-inverse-hover': string;
498
+ 'dark-warning': string;
499
+ 'dark-warning-hover': string;
500
+ 'dark-warning-inverse': string;
501
+ 'dark-warning-inverse-hover': string;
502
+ 'dark-danger': string;
503
+ 'dark-danger-hover': string;
504
+ 'dark-danger-inverse': string;
505
+ 'dark-danger-inverse-hover': string;
506
+ 'dark-blue': string;
507
+ 'dark-blue-hover': string;
508
+ 'dark-orange': string;
509
+ 'dark-orange-hover': string;
510
+ 'dark-sky': string;
511
+ 'dark-sky-hover': string;
512
+ 'dark-primary': string;
513
+ 'dark-secondary': string;
514
+ 'dark-base': string;
515
+ 'dark-base-inverse': string;
516
+ 'dark-overlay': string;
517
+ surface: string;
518
+ 'surface-secondary': string;
519
+ base: string;
520
+ 'base-inverse': string;
521
+ overlay: string;
522
+ neutral: string;
523
+ 'neutral-hover': string;
524
+ 'neutral-darker': string;
525
+ 'neutral-darker-hover': string;
526
+ 'neutral-inverse': string;
527
+ 'neutral-inverse-hover': string;
528
+ accent: string;
529
+ 'accent-hover': string;
530
+ 'accent-inverse': string;
531
+ 'accent-inverse-hover': string;
532
+ success: string;
533
+ 'success-hover': string;
534
+ 'success-inverse': string;
535
+ 'success-inverse-hover': string;
536
+ warning: string;
537
+ 'warning-hover': string;
538
+ 'warning-inverse': string;
539
+ 'warning-inverse-hover': string;
540
+ danger: string;
541
+ 'danger-hover': string;
542
+ 'danger-inverse': string;
543
+ 'danger-inverse-hover': string;
544
+ blue: string;
545
+ 'blue-hover': string;
546
+ orange: string;
547
+ 'orange-hover': string;
548
+ 'orange-inverse': string;
549
+ 'orange-inverse-hover': string;
550
+ sky: string;
551
+ 'sky-hover': string;
552
+ 'sky-inverse': string;
553
+ 'sky-inverse-hover': string;
554
+ };
555
+ boxShadow: {
556
+ field: string;
557
+ nav: string;
558
+ calendar: string;
559
+ container: string;
560
+ panel: string;
561
+ outline: string;
562
+ focus: string;
563
+ };
564
+ };
package/dist/tokens.js ADDED
@@ -0,0 +1,265 @@
1
+ export const colors = {
2
+ base: {
3
+ mist: '#fbfbfb',
4
+ snow: '#f6f7f7',
5
+ white: {
6
+ default: '#FFFFFF',
7
+ 5: '#FFFFFF0D',
8
+ 10: '#FFFFFF1A',
9
+ 15: '#FFFFFF26',
10
+ 25: '#FFFFFF40',
11
+ 50: '#FFFFFF80',
12
+ 70: '#FFFFFFB3',
13
+ 90: '#FFFFFFE6',
14
+ },
15
+ midnight: {
16
+ default: '#12192a',
17
+ 5: '#12192a0d',
18
+ 10: '#12192A1A',
19
+ 15: '#12192A26',
20
+ 25: '#12192A40',
21
+ 50: '#12192A80',
22
+ 70: '#12192AB3',
23
+ 90: '#12192AE6',
24
+ },
25
+ },
26
+ gray: {
27
+ 1: '#ecedee',
28
+ 2: '#dbdddf',
29
+ 3: '#c4c6ca',
30
+ 4: '#888c94',
31
+ 5: '#595e6a',
32
+ 6: '#2A303F',
33
+ },
34
+ periwinkle: {
35
+ 1: '#eeeefd',
36
+ 2: '#cbc9fa',
37
+ 3: { default: '#8e8af4', 10: '#8e8af41A', 25: '#8e8af440' },
38
+ 4: { default: '#7973f1', 10: '#7973f11A', 25: '#7973f140' },
39
+ 5: { default: '#5750ee', 10: '#5750ee1A', 25: '#5750ee40' },
40
+ 6: '#4741c1',
41
+ },
42
+ orange: {
43
+ 1: '#fff2e6',
44
+ 2: '#ffd6b0',
45
+ 3: '#ffa654',
46
+ 4: { default: '#ff9533', 10: '#ff95331A', 25: '#ff953340' },
47
+ 5: { default: '#ff7a00', 10: '#ff7a001A', 25: '#ff7a0040' },
48
+ 6: '#cf6300',
49
+ },
50
+ sky: {
51
+ 1: '#f3fafc',
52
+ 2: '#D2F0F6',
53
+ 3: '#89D8E6',
54
+ 4: { default: '#65CCDF', 10: '#65CCDF1A', 25: '#65CCDF40' },
55
+ 5: { default: '#43C1D8', 10: '#43C1D81A', 25: '#43C1D840' },
56
+ 6: '#3597a9',
57
+ },
58
+ blue: {
59
+ 1: '#e8f4fe',
60
+ 2: '#b8defd',
61
+ 3: '#66b8fb',
62
+ 4: { default: '#49aafa', 10: '#49aafa1A', 25: '#49aafa40' },
63
+ 5: { default: '#1b95f9', 10: '#1b95f91A', 25: '#1b95f940' },
64
+ 6: '#146db6',
65
+ },
66
+ green: {
67
+ 1: '#e7f7f1',
68
+ 2: '#c4ebdc',
69
+ 3: '#65cba4',
70
+ 4: { default: '#36bc88', 10: '#36bc881A', 25: '#36bc8840' },
71
+ 5: { default: '#0aad6e', 10: '#0aad6e1A', 25: '#0aad6e40' },
72
+ 6: '#088756',
73
+ },
74
+ yellow: {
75
+ 1: '#fff8e9',
76
+ 2: '#feeabb',
77
+ 3: '#fed16c',
78
+ 4: { default: '#fdc850', 10: '#fdc8501A', 25: '#fdc85040' },
79
+ 5: { default: '#f1b123', 10: '#f1b1231A', 25: '#f1b12340' },
80
+ 6: '#cc951e',
81
+ },
82
+ red: {
83
+ 1: '#fdeded',
84
+ 2: '#f9c6c6',
85
+ 3: '#f28384',
86
+ 4: { default: '#ef6b6c', 10: '#ef6b6c1A', 25: '#ef6b6c40' },
87
+ 5: { default: '#eb4647', 10: '#eb46471A', 25: '#eb464740' },
88
+ 6: '#bf393a',
89
+ },
90
+ shadow: {
91
+ 2: 'rgba(18, 25, 42 0.02)',
92
+ 4: 'rgba(18, 25, 42, 0.04)',
93
+ 8: 'rgba(18, 25, 42, 0.08)',
94
+ 12: 'rgba(18, 25, 42, 0.12)',
95
+ 16: 'rgba(18, 25, 42, 0.16)',
96
+ },
97
+ };
98
+ const lightTextColor = {
99
+ primary: colors.base.midnight.default,
100
+ secondary: colors.gray[5],
101
+ tertiary: colors.gray[4],
102
+ 'primary-inverse': colors.base.white.default,
103
+ 'secondary-inverse': colors.base.white[70],
104
+ 'tertiary-inverse': colors.base.white[50],
105
+ accent: colors.periwinkle[6],
106
+ success: colors.green[6],
107
+ warning: colors.yellow[6],
108
+ danger: colors.red[6],
109
+ };
110
+ const lightIconColor = {
111
+ 'icon-primary': colors.base.midnight.default,
112
+ 'icon-secondary': colors.gray[5],
113
+ 'icon-tertiary': colors.gray[4],
114
+ 'icon-primary-inverse': colors.base.white.default,
115
+ 'icon-accent': colors.periwinkle[5].default,
116
+ 'icon-success': colors.green[5].default,
117
+ 'icon-warning': colors.yellow[5].default,
118
+ 'icon-danger': colors.red[5].default,
119
+ 'icon-blue': colors.blue[5].default,
120
+ 'icon-orange': colors.orange[5].default,
121
+ 'icon-sky': colors.sky[5].default,
122
+ };
123
+ const lightBorderColor = {
124
+ static: colors.base.midnight[5],
125
+ interactive: colors.base.midnight[15],
126
+ hover: colors.periwinkle[5][25],
127
+ focus: colors.periwinkle[5].default,
128
+ danger: colors.red[5].default,
129
+ };
130
+ const lightBackgroundColor = {
131
+ surface: colors.base.white.default,
132
+ 'surface-secondary': colors.base.snow,
133
+ base: colors.sky[1],
134
+ 'base-inverse': colors.gray[6],
135
+ overlay: '#090D1566', // TODO: MAP TO A COLOR
136
+ neutral: colors.base.midnight[5],
137
+ 'neutral-hover': colors.base.midnight[10],
138
+ 'neutral-darker': colors.base.midnight[15],
139
+ 'neutral-darker-hover': colors.base.midnight[25],
140
+ 'neutral-inverse': colors.base.white[5],
141
+ 'neutral-inverse-hover': colors.base.white[15],
142
+ accent: colors.periwinkle[5][10],
143
+ 'accent-hover': colors.periwinkle[5][25],
144
+ 'accent-inverse': colors.periwinkle[5].default,
145
+ 'accent-inverse-hover': colors.periwinkle[6],
146
+ success: colors.green[5][10],
147
+ 'success-hover': colors.green[5][25],
148
+ 'success-inverse': colors.green[5].default,
149
+ 'success-inverse-hover': colors.green[6],
150
+ warning: colors.yellow[5][10],
151
+ 'warning-hover': colors.yellow[5][25],
152
+ 'warning-inverse': colors.yellow[5].default,
153
+ 'warning-inverse-hover': colors.yellow[6],
154
+ danger: colors.red[5][10],
155
+ 'danger-hover': colors.red[5][25],
156
+ 'danger-inverse': colors.red[5].default,
157
+ 'danger-inverse-hover': colors.red[6],
158
+ blue: colors.blue[5][10],
159
+ 'blue-hover': colors.blue[5][25],
160
+ orange: colors.orange[5][10],
161
+ 'orange-hover': colors.orange[5][25],
162
+ 'orange-inverse': colors.orange[5].default,
163
+ 'orange-inverse-hover': colors.orange[6],
164
+ sky: colors.sky[5][10],
165
+ 'sky-hover': colors.sky[5][25],
166
+ 'sky-inverse': colors.sky[5].default,
167
+ 'sky-inverse-hover': colors.sky[6],
168
+ };
169
+ const darkTextColor = {
170
+ 'dark-primary': colors.base.white.default,
171
+ 'dark-secondary': colors.gray[3],
172
+ 'dark-tertiary': colors.gray[4],
173
+ 'dark-primary-inverse': colors.base.midnight.default,
174
+ 'dark-secondary-inverse': colors.base.midnight[70],
175
+ 'dark-tertiary-inverse': colors.base.midnight[50],
176
+ 'dark-accent': colors.periwinkle[3].default,
177
+ 'dark-success': colors.green[3],
178
+ 'dark-warning': colors.yellow[3],
179
+ 'dark-danger': colors.red[3],
180
+ };
181
+ const darkIconColor = {
182
+ 'dark-primary': colors.base.white.default,
183
+ 'dark-secondary': colors.gray[3],
184
+ 'dark-tertiary': colors.gray[4],
185
+ 'dark-primary-inverse': colors.base.midnight.default,
186
+ 'dark-accent': colors.periwinkle[4].default,
187
+ 'dark-success': colors.green[4].default,
188
+ 'dark-warning': colors.yellow[4].default,
189
+ 'dark-danger': colors.red[4].default,
190
+ 'dark-blue': colors.blue[4].default,
191
+ 'dark-orange': colors.orange[4].default,
192
+ 'dark-sky': colors.sky[4].default,
193
+ };
194
+ const darkBorderColor = {
195
+ 'dark-static': colors.base.white[5],
196
+ 'dark-interactive': colors.base.white[15],
197
+ 'dark-hover': colors.periwinkle[3][25],
198
+ 'dark-focus': colors.periwinkle[4].default,
199
+ 'dark-danger': colors.red[4].default,
200
+ };
201
+ const darkSurfaceColor = {
202
+ 'dark-primary': colors.gray[6],
203
+ 'dark-secondary': colors.base.midnight.default,
204
+ 'dark-base': colors.base.midnight.default,
205
+ 'dark-base-inverse': colors.base.snow,
206
+ 'dark-overlay': '#090D1566', // TODO: MAP TO A COLOR
207
+ };
208
+ const darkBackgroundColor = {
209
+ ...darkSurfaceColor,
210
+ 'dark-neutral': colors.base.white[5],
211
+ 'dark-neutral-hover': colors.base.white[15],
212
+ 'dark-neutral-darker': colors.base.white[15],
213
+ 'dark-neutral-darker-hover': colors.base.white[25],
214
+ 'dark-accent': colors.periwinkle[3][10],
215
+ 'dark-accent-hover': colors.periwinkle[3][25],
216
+ 'dark-accent-inverse': colors.periwinkle[4].default,
217
+ 'dark-accent-inverse-hover': colors.periwinkle[5].default,
218
+ 'dark-success': colors.green[4][10],
219
+ 'dark-success-hover': colors.green[4][25],
220
+ 'dark-success-inverse': colors.green[4].default,
221
+ 'dark-success-inverse-hover': colors.green[5].default,
222
+ 'dark-warning': colors.yellow[4][10],
223
+ 'dark-warning-hover': colors.yellow[4][25],
224
+ 'dark-warning-inverse': colors.yellow[4].default,
225
+ 'dark-warning-inverse-hover': colors.yellow[5].default,
226
+ 'dark-danger': colors.red[4][10],
227
+ 'dark-danger-hover': colors.red[4][25],
228
+ 'dark-danger-inverse': colors.red[4].default,
229
+ 'dark-danger-inverse-hover': colors.red[5].default,
230
+ 'dark-blue': colors.blue[4][10],
231
+ 'dark-blue-hover': colors.blue[4][25],
232
+ 'dark-orange': colors.orange[4][10],
233
+ 'dark-orange-hover': colors.orange[4][25],
234
+ 'dark-sky': colors.sky[4][10],
235
+ 'dark-sky-hover': colors.sky[4][25],
236
+ };
237
+ export const borderColor = {
238
+ ...lightBorderColor,
239
+ ...darkBorderColor,
240
+ };
241
+ export const textColor = {
242
+ ...lightTextColor,
243
+ ...darkTextColor,
244
+ ...lightIconColor,
245
+ };
246
+ export const backgroundColor = {
247
+ ...lightBackgroundColor,
248
+ ...darkBackgroundColor,
249
+ };
250
+ export const boxShadow = {
251
+ field: `0px 8px 12px 0px ${colors.shadow[4]}`,
252
+ nav: `0px 0px 24px 0px ${colors.shadow[12]}`,
253
+ calendar: `0px 16px 24px 0px ${colors.shadow[16]}`,
254
+ container: `0px 4px 17px 0px ${colors.shadow[2]}`,
255
+ panel: `0px 2px 8px 0px ${colors.shadow[8]}`,
256
+ outline: `0px 0px 0px 1px ${colors.periwinkle[5][25]}`,
257
+ focus: `0px 0px 0px 1px ${colors.periwinkle[5].default}`,
258
+ };
259
+ export const tokens = {
260
+ colors,
261
+ borderColor,
262
+ textColor,
263
+ backgroundColor,
264
+ boxShadow,
265
+ };
package/package.json CHANGED
@@ -1,17 +1,55 @@
1
1
  {
2
- "name": "@reshape-biotech/design-system",
3
- "version": "0.0.2",
4
- "main": "index.js",
5
- "public": true,
6
- "files": [
7
- "**/*"
8
- ],
9
- "dependencies": {
10
- "daisyui": "^4.10.5",
11
- "tailwindcss": "^3.3.3",
12
- "postcss": "^8.4.24"
13
- },
14
- "peerDependencies": {
15
- "svelte": "^5.0.0"
16
- }
2
+ "name": "@reshape-biotech/design-system",
3
+ "version": "0.0.4",
4
+ "public": false,
5
+ "scripts": {
6
+ "dev": "vite dev",
7
+ "build": "vite build && npm run package",
8
+ "preview": "vite preview",
9
+ "package": "svelte-kit sync && svelte-package && publint",
10
+ "prepublishOnly": "npm run package",
11
+ "check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
12
+ "check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
13
+ "lint": "eslint . && prettier --check .",
14
+ "format": "prettier --write ."
15
+ },
16
+ "files": [
17
+ "dist",
18
+ "!dist/**/*.test.*",
19
+ "!dist/**/*.spec.*"
20
+ ],
21
+ "sideEffects": [
22
+ "**/*.css"
23
+ ],
24
+ "svelte": "./dist/index.js",
25
+ "types": "./dist/index.d.ts",
26
+ "type": "module",
27
+ "exports": {
28
+ ".": {
29
+ "types": "./dist/index.d.ts",
30
+ "svelte": "./dist/index.js"
31
+ }
32
+ },
33
+ "peerDependencies": {
34
+ "svelte": "^5.0.0"
35
+ },
36
+ "devDependencies": {
37
+ "@eslint/compat": "^1.2.3",
38
+ "@sveltejs/adapter-auto": "^3.0.0",
39
+ "@sveltejs/kit": "^2.9.0",
40
+ "@sveltejs/package": "^2.0.0",
41
+ "@sveltejs/vite-plugin-svelte": "^5.0.0",
42
+ "eslint": "^9.7.0",
43
+ "eslint-config-prettier": "^9.1.0",
44
+ "eslint-plugin-svelte": "^2.36.0",
45
+ "globals": "^15.0.0",
46
+ "prettier": "^3.3.2",
47
+ "prettier-plugin-svelte": "^3.2.6",
48
+ "publint": "^0.2.0",
49
+ "svelte": "^5.0.0",
50
+ "svelte-check": "^4.0.0",
51
+ "typescript": "^5.0.0",
52
+ "typescript-eslint": "^8.0.0",
53
+ "vite": "^6.0.0"
54
+ }
17
55
  }
package/index.ts DELETED
@@ -1,3 +0,0 @@
1
- export * from '$lib/tokens';
2
-
3
- export * from '$lib/components/avatar';