@reshape-biotech/design-system 2.7.35 → 2.7.37
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/dist/app.css +2 -2
- package/dist/components/activity/Activity.svelte +6 -4
- package/dist/components/button/Button.stories.svelte +27 -7
- package/dist/components/button/Button.svelte +109 -25
- package/dist/components/card/Card.svelte +7 -5
- package/dist/components/card/CardWrapper.svelte +10 -13
- package/dist/components/checkbox/Checkbox.svelte +3 -2
- package/dist/components/combobox/Combobox.stories.svelte +386 -115
- package/dist/components/combobox/components/combobox-add.svelte +10 -4
- package/dist/components/combobox/components/combobox-content.svelte +36 -60
- package/dist/components/combobox/components/combobox-indicator.svelte +1 -1
- package/dist/components/combobox/types.d.ts +1 -0
- package/dist/components/datepicker/DatePicker.svelte +8 -5
- package/dist/components/divider/Divider.svelte +7 -3
- package/dist/components/drawer/components/drawer-content.svelte +2 -1
- package/dist/components/drawer/components/drawer-title.svelte +2 -1
- package/dist/components/dropdown/Dropdown.stories.svelte +17 -17
- package/dist/components/dropdown/components/dropdown-content.svelte +6 -3
- package/dist/components/dropdown/components/dropdown-item.svelte +9 -1
- package/dist/components/dropdown/components/dropdown-separator.svelte +10 -0
- package/dist/components/dropdown/components/dropdown-separator.svelte.d.ts +5 -0
- package/dist/components/dropdown/components/dropdown-sub-content.svelte +4 -2
- package/dist/components/dropdown/components/dropdown-sub-trigger.svelte +11 -3
- package/dist/components/dropdown/index.d.ts +2 -2
- package/dist/components/dropdown/index.js +2 -2
- package/dist/components/dropdown/types.d.ts +1 -0
- package/dist/components/icon-button/IconButton.svelte +4 -3
- package/dist/components/icons/AnalysisIcon.svelte +7 -7
- package/dist/components/input/Input.svelte +2 -1
- package/dist/components/label/Label.svelte +3 -1
- package/dist/components/list/List.svelte +4 -1
- package/dist/components/markdown/Markdown.svelte +2 -1
- package/dist/components/modal/Modal.stories.svelte +3 -0
- package/dist/components/modal/components/modal-title.svelte +7 -2
- package/dist/components/modal/types.d.ts +1 -0
- package/dist/components/segmented-control-buttons/ControlButton.svelte +7 -1
- package/dist/components/segmented-control-buttons/SegmentedControlButtons.svelte +2 -1
- package/dist/components/select/Select.stories.svelte +89 -14
- package/dist/components/select/components/MultiSelectTrigger.svelte +5 -2
- package/dist/components/select/components/SelectContent.svelte +1 -1
- package/dist/components/select/components/SelectGroupHeading.svelte +1 -1
- package/dist/components/select/components/SelectItem.svelte +3 -2
- package/dist/components/select/components/SelectTrigger.svelte +14 -5
- package/dist/components/select/components/SelectTrigger.svelte.d.ts +1 -0
- package/dist/components/skeleton-loader/SkeletonLoader.svelte +6 -1
- package/dist/components/slider/Slider.svelte +6 -3
- package/dist/components/stat-card/StatCard.stories.svelte +113 -47
- package/dist/components/stat-card/StatCard.svelte +27 -6
- package/dist/components/stat-card/StatCard.svelte.d.ts +4 -0
- package/dist/components/status-badge/StatusBadge.svelte +8 -5
- package/dist/components/status-badge/StatusBadge.svelte.d.ts +1 -0
- package/dist/components/stepper/components/stepper-step.svelte +3 -3
- package/dist/components/table/Table.svelte +2 -1
- package/dist/components/table/components/TBody.svelte +2 -1
- package/dist/components/table/components/THead.svelte +2 -1
- package/dist/components/table/components/Td.svelte +2 -1
- package/dist/components/table/components/Th.svelte +2 -1
- package/dist/components/table/components/Tr.svelte +2 -1
- package/dist/components/tabs/components/Tab.svelte +2 -1
- package/dist/components/tabs/components/Tabs.svelte +2 -1
- package/dist/components/tag/Tag.svelte +3 -2
- package/dist/components/tooltip/Tooltip.svelte +2 -1
- package/package.json +1 -1
|
@@ -60,21 +60,21 @@
|
|
|
60
60
|
|
|
61
61
|
switch (analysis) {
|
|
62
62
|
case 'pipeline_halos':
|
|
63
|
-
return 'warning';
|
|
63
|
+
return 'icon-warning';
|
|
64
64
|
case 'pipeline_large_colonies':
|
|
65
65
|
case 'pipeline_radial_growth':
|
|
66
|
-
return 'accent';
|
|
66
|
+
return 'icon-accent';
|
|
67
67
|
case 'pipeline_microbial_colonies':
|
|
68
68
|
case 'pipeline_small_colonies':
|
|
69
|
-
return 'blue';
|
|
69
|
+
return 'icon-blue';
|
|
70
70
|
case 'sgs_enteros':
|
|
71
|
-
return 'lilac';
|
|
71
|
+
return 'icon-lilac';
|
|
72
72
|
case 'pipeline_insects':
|
|
73
|
-
return 'orange';
|
|
73
|
+
return 'icon-orange';
|
|
74
74
|
case 'pipeline_seed_germination':
|
|
75
|
-
return 'success';
|
|
75
|
+
return 'icon-success';
|
|
76
76
|
default:
|
|
77
|
-
return 'secondary';
|
|
77
|
+
return 'icon-secondary';
|
|
78
78
|
}
|
|
79
79
|
};
|
|
80
80
|
</script>
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
+
import { twMerge } from 'tailwind-merge';
|
|
2
3
|
import X from 'phosphor-svelte/lib/X';
|
|
3
4
|
import { Icon } from '../icons/index.js';
|
|
4
5
|
import type { Snippet } from 'svelte';
|
|
@@ -91,7 +92,7 @@
|
|
|
91
92
|
|
|
92
93
|
<div class="flex-1">
|
|
93
94
|
<div
|
|
94
|
-
class=
|
|
95
|
+
class={twMerge('flex w-full items-center gap-1 transition-colors', `size-${size}`, className)}
|
|
95
96
|
class:!border-error={!valid}
|
|
96
97
|
class:primary={variant === 'primary'}
|
|
97
98
|
class:secondary={variant === 'secondary'}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
+
import { twMerge } from 'tailwind-merge';
|
|
3
|
+
|
|
2
4
|
interface Props {
|
|
3
5
|
forId: string;
|
|
4
6
|
text: string;
|
|
@@ -9,7 +11,7 @@
|
|
|
9
11
|
const { forId, text, required = false, class: className }: Props = $props();
|
|
10
12
|
</script>
|
|
11
13
|
|
|
12
|
-
<label for={forId} class=
|
|
14
|
+
<label for={forId} class={twMerge('block text-sm text-secondary', className)}>
|
|
13
15
|
{text}
|
|
14
16
|
{#if required}
|
|
15
17
|
<span class="ml-0.5 text-danger">*</span>
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
<script lang="ts" generics="T">
|
|
2
2
|
import type { Overflow } from '../../tailwind';
|
|
3
3
|
import type { Snippet } from 'svelte';
|
|
4
|
+
import { twMerge } from 'tailwind-merge';
|
|
4
5
|
|
|
5
6
|
type Props = {
|
|
6
7
|
items: T[];
|
|
@@ -11,7 +12,9 @@
|
|
|
11
12
|
let { items, item, overflow = 'overflow-y-auto', variant = 'default' }: Props = $props();
|
|
12
13
|
</script>
|
|
13
14
|
|
|
14
|
-
<div
|
|
15
|
+
<div
|
|
16
|
+
class={twMerge('listStyles', variant === 'compact' ? 'compact' : 'default', overflow)}
|
|
17
|
+
>
|
|
15
18
|
{#each items as currentItem, i}
|
|
16
19
|
<div class="item">
|
|
17
20
|
{@render item(currentItem)}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { marked } from 'marked';
|
|
3
|
+
import { twMerge } from 'tailwind-merge';
|
|
3
4
|
interface Props {
|
|
4
5
|
markdown: string;
|
|
5
6
|
variant?: 'light' | 'dark';
|
|
@@ -8,6 +9,6 @@
|
|
|
8
9
|
let { markdown, variant = 'light' }: Props = $props();
|
|
9
10
|
</script>
|
|
10
11
|
|
|
11
|
-
<div class=
|
|
12
|
+
<div class={twMerge('prose prose-slate text-sm', variant === 'dark' && 'dark:prose-invert')}>
|
|
12
13
|
{@html marked.parse(markdown ?? '')}
|
|
13
14
|
</div>
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import type { ModalTitleProps } from '../types';
|
|
4
4
|
import { twMerge } from 'tailwind-merge';
|
|
5
5
|
|
|
6
|
-
let { children, class: className = '', icon, sticky = false, ...restProps }: ModalTitleProps = $props();
|
|
6
|
+
let { children, class: className = '', icon, sticky = false, rightSlot, ...restProps }: ModalTitleProps = $props();
|
|
7
7
|
|
|
8
8
|
const baseClasses = $derived(sticky
|
|
9
9
|
? 'text-base font-semibold tracking-tight text-primary'
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
{#if sticky}
|
|
15
15
|
<div class="sticky top-0 z-10 w-full h-12 shrink-0 bg-surface border-b border-static">
|
|
16
16
|
<div class="flex h-12 items-center justify-between overflow-hidden px-4 py-2 w-full">
|
|
17
|
-
<div class="flex gap-2 items-center relative shrink-0">
|
|
17
|
+
<div class="flex flex-1 gap-2 items-center relative shrink-0">
|
|
18
18
|
{#if icon}
|
|
19
19
|
<div class="relative shrink-0 text-icon-secondary">
|
|
20
20
|
{@render icon()}
|
|
@@ -24,6 +24,11 @@
|
|
|
24
24
|
{@render children()}
|
|
25
25
|
</Dialog.Title>
|
|
26
26
|
</div>
|
|
27
|
+
{#if rightSlot}
|
|
28
|
+
<div class="flex-shrink-0 mr-8">
|
|
29
|
+
{@render rightSlot()}
|
|
30
|
+
</div>
|
|
31
|
+
{/if}
|
|
27
32
|
</div>
|
|
28
33
|
</div>
|
|
29
34
|
{:else}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import type { Snippet } from 'svelte';
|
|
3
|
+
import { twMerge } from 'tailwind-merge';
|
|
3
4
|
|
|
4
5
|
type Color = 'primary' | 'secondary';
|
|
5
6
|
|
|
@@ -32,7 +33,12 @@
|
|
|
32
33
|
<div class="join-item flex h-full flex-1">
|
|
33
34
|
<button
|
|
34
35
|
{onclick}
|
|
35
|
-
class={
|
|
36
|
+
class={twMerge(
|
|
37
|
+
'control-button flex flex-1 items-center justify-center gap-2 rounded-md text-sm leading-4',
|
|
38
|
+
colors[color],
|
|
39
|
+
color,
|
|
40
|
+
className
|
|
41
|
+
)}
|
|
36
42
|
class:active
|
|
37
43
|
type="button"
|
|
38
44
|
{disabled}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import type { Snippet } from 'svelte';
|
|
3
|
+
import { twMerge } from 'tailwind-merge';
|
|
3
4
|
import ControlButton from './ControlButton.svelte';
|
|
4
5
|
|
|
5
6
|
interface Props {
|
|
@@ -16,6 +17,6 @@
|
|
|
16
17
|
};
|
|
17
18
|
</script>
|
|
18
19
|
|
|
19
|
-
<div class={
|
|
20
|
+
<div class={twMerge('join flex gap-1 rounded-lg bg-neutral p-1', sizes[size], size, className)}>
|
|
20
21
|
{@render children?.({ ControlButton })}
|
|
21
22
|
</div>
|
|
@@ -2,6 +2,11 @@
|
|
|
2
2
|
import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
3
3
|
import * as Select from './index';
|
|
4
4
|
import { Icon } from '../icons';
|
|
5
|
+
import Hash from 'phosphor-svelte/lib/Hash';
|
|
6
|
+
import Ruler from 'phosphor-svelte/lib/Ruler';
|
|
7
|
+
import Timer from 'phosphor-svelte/lib/Timer';
|
|
8
|
+
import ChartLine from 'phosphor-svelte/lib/ChartLine';
|
|
9
|
+
import Database from 'phosphor-svelte/lib/Database';
|
|
5
10
|
|
|
6
11
|
const { Story } = defineMeta({
|
|
7
12
|
title: 'Design System/Select(New)',
|
|
@@ -33,6 +38,8 @@
|
|
|
33
38
|
let selectedValueMultiple = $state<string[]>([]);
|
|
34
39
|
let selectedValueSinglePreselected = $state<string | undefined>('vegetables');
|
|
35
40
|
let selectedValueMultiplePreselected = $state<string[]>(['fruits', 'grains']);
|
|
41
|
+
let selectedValueSm = $state<string | undefined>(undefined);
|
|
42
|
+
let selectedValueMd = $state<string | undefined>(undefined);
|
|
36
43
|
|
|
37
44
|
const customIconItems = [
|
|
38
45
|
{ value: 'insect_count', label: 'Insect count', iconName: 'Hash' },
|
|
@@ -42,6 +49,15 @@
|
|
|
42
49
|
];
|
|
43
50
|
let selectedCustomItems = $state<string[]>(['insect_count', 'leaf_area']);
|
|
44
51
|
|
|
52
|
+
const itemsWithIcons = [
|
|
53
|
+
{ value: 'analytics', label: 'Analytics', icon: Hash },
|
|
54
|
+
{ value: 'measurements', label: 'Measurements', icon: Ruler },
|
|
55
|
+
{ value: 'tracking', label: 'Time Tracking', icon: Timer },
|
|
56
|
+
{ value: 'charts', label: 'Charts', icon: ChartLine },
|
|
57
|
+
{ value: 'database', label: 'Database', icon: Database },
|
|
58
|
+
];
|
|
59
|
+
let selectedValueWithIcons = $state<string | undefined>(undefined);
|
|
60
|
+
|
|
45
61
|
const handleRemoveCustomItem = (itemValue: string) => {
|
|
46
62
|
selectedCustomItems = selectedCustomItems.filter((v) => v !== itemValue);
|
|
47
63
|
};
|
|
@@ -100,6 +116,55 @@
|
|
|
100
116
|
let selectedCountry = $state<string | undefined>(undefined);
|
|
101
117
|
</script>
|
|
102
118
|
|
|
119
|
+
<Story name="Size Variants" asChild>
|
|
120
|
+
<div class="p-4">
|
|
121
|
+
<div class="flex flex-col gap-6">
|
|
122
|
+
<div class="flex flex-col gap-2">
|
|
123
|
+
<p class="text-sm font-medium text-secondary">Small (sm)</p>
|
|
124
|
+
<Select.Root bind:value={selectedValueSm} items={foodGroups} type="single">
|
|
125
|
+
<Select.Trigger
|
|
126
|
+
class="w-[250px]"
|
|
127
|
+
size="sm"
|
|
128
|
+
placeholder={'Select a food group'}
|
|
129
|
+
displayValue={foodGroups.find((f) => f.value === selectedValueSm)?.label}
|
|
130
|
+
/>
|
|
131
|
+
<Select.Portal>
|
|
132
|
+
<Select.Content>
|
|
133
|
+
{#each foodGroups as item (item.value)}
|
|
134
|
+
<Select.Item value={item.value} label={item.label} />
|
|
135
|
+
{/each}
|
|
136
|
+
</Select.Content>
|
|
137
|
+
</Select.Portal>
|
|
138
|
+
</Select.Root>
|
|
139
|
+
<div class="text-xs text-tertiary">
|
|
140
|
+
Selected: {selectedValueSm ?? 'Nothing'}
|
|
141
|
+
</div>
|
|
142
|
+
</div>
|
|
143
|
+
<div class="flex flex-col gap-2">
|
|
144
|
+
<p class="text-sm font-medium text-secondary">Medium (md) - Default</p>
|
|
145
|
+
<Select.Root bind:value={selectedValueMd} items={foodGroups} type="single">
|
|
146
|
+
<Select.Trigger
|
|
147
|
+
class="w-[250px]"
|
|
148
|
+
size="md"
|
|
149
|
+
placeholder={'Select a food group'}
|
|
150
|
+
displayValue={foodGroups.find((f) => f.value === selectedValueMd)?.label}
|
|
151
|
+
/>
|
|
152
|
+
<Select.Portal>
|
|
153
|
+
<Select.Content>
|
|
154
|
+
{#each foodGroups as item (item.value)}
|
|
155
|
+
<Select.Item value={item.value} label={item.label} />
|
|
156
|
+
{/each}
|
|
157
|
+
</Select.Content>
|
|
158
|
+
</Select.Portal>
|
|
159
|
+
</Select.Root>
|
|
160
|
+
<div class="text-xs text-tertiary">
|
|
161
|
+
Selected: {selectedValueMd ?? 'Nothing'}
|
|
162
|
+
</div>
|
|
163
|
+
</div>
|
|
164
|
+
</div>
|
|
165
|
+
</div>
|
|
166
|
+
</Story>
|
|
167
|
+
|
|
103
168
|
<Story name="Default (Single Select)" asChild>
|
|
104
169
|
<div class="p-4">
|
|
105
170
|
<Select.Root bind:value={selectedValueSingle} items={foodGroups} type="single" open>
|
|
@@ -232,23 +297,33 @@
|
|
|
232
297
|
</div>
|
|
233
298
|
</Story>
|
|
234
299
|
|
|
235
|
-
<Story name="
|
|
300
|
+
<Story name="With Icons (Single Select)" asChild>
|
|
236
301
|
<div class="p-4">
|
|
237
|
-
<Select.Root bind:value={
|
|
238
|
-
<Select.
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
302
|
+
<Select.Root bind:value={selectedValueWithIcons} items={itemsWithIcons} type="single">
|
|
303
|
+
<Select.Trigger class="w-[250px]" placeholder={'Select an option'}>
|
|
304
|
+
{#snippet children()}
|
|
305
|
+
{#if selectedValueWithIcons}
|
|
306
|
+
{@const selectedItem = itemsWithIcons.find((item) => item.value === selectedValueWithIcons)}
|
|
307
|
+
{#if selectedItem}
|
|
308
|
+
<div class="flex items-center gap-2 pl-1">
|
|
309
|
+
<Icon icon={selectedItem.icon} color="secondary" />
|
|
310
|
+
<span>{selectedItem.label}</span>
|
|
311
|
+
</div>
|
|
312
|
+
{:else}
|
|
313
|
+
<span class="text-tertiary pl-1">Select an option</span>
|
|
314
|
+
{/if}
|
|
315
|
+
{:else}
|
|
316
|
+
<span class="text-tertiary pl-1">Select an option</span>
|
|
317
|
+
{/if}
|
|
318
|
+
{/snippet}
|
|
319
|
+
</Select.Trigger>
|
|
245
320
|
<Select.Portal>
|
|
246
321
|
<Select.Content>
|
|
247
|
-
{#each
|
|
322
|
+
{#each itemsWithIcons as item (item.value)}
|
|
248
323
|
<Select.Item value={item.value} label={item.label}>
|
|
249
324
|
{#snippet children()}
|
|
250
325
|
<div class="flex items-center gap-2">
|
|
251
|
-
<Icon icon={item.
|
|
326
|
+
<Icon icon={item.icon} color="secondary" />
|
|
252
327
|
<span>{item.label}</span>
|
|
253
328
|
</div>
|
|
254
329
|
{/snippet}
|
|
@@ -257,13 +332,13 @@
|
|
|
257
332
|
</Select.Content>
|
|
258
333
|
</Select.Portal>
|
|
259
334
|
</Select.Root>
|
|
260
|
-
<div class="mt-2 rounded bg-
|
|
261
|
-
Selected
|
|
335
|
+
<div class="mt-2 rounded bg-gray-100 p-2 text-sm">
|
|
336
|
+
Selected: {selectedValueWithIcons ?? 'Nothing'}
|
|
262
337
|
</div>
|
|
263
338
|
</div>
|
|
264
339
|
</Story>
|
|
265
340
|
|
|
266
|
-
<Story name="Long List with Scrolling
|
|
341
|
+
<Story name="Long List with Scrolling" asChild>
|
|
267
342
|
<div class="p-4">
|
|
268
343
|
<Select.Root bind:value={selectedCountry} items={countries} type="single">
|
|
269
344
|
<Select.Trigger
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
import Icon from '../../icons/Icon.svelte';
|
|
4
4
|
import * as Select from '../index';
|
|
5
5
|
import IconButton from '../../icon-button/IconButton.svelte';
|
|
6
|
+
import { twMerge } from 'tailwind-merge';
|
|
6
7
|
|
|
7
8
|
type ItemType = {
|
|
8
9
|
value: string;
|
|
@@ -30,8 +31,10 @@
|
|
|
30
31
|
</script>
|
|
31
32
|
|
|
32
33
|
<Select.Trigger
|
|
33
|
-
class={
|
|
34
|
-
|
|
34
|
+
class={twMerge(
|
|
35
|
+
'flex h-fit min-h-10 w-full items-center justify-between rounded-lg border border-input bg-surface py-1 text-sm placeholder:text-tertiary focus:outline-none disabled:cursor-not-allowed disabled:border-transparent disabled:bg-neutral disabled:opacity-75',
|
|
36
|
+
className
|
|
37
|
+
)}
|
|
35
38
|
{...restProps}
|
|
36
39
|
>
|
|
37
40
|
{#if selectedValues.length === 0}
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
{...restProps}
|
|
22
22
|
{sideOffset}
|
|
23
23
|
class={twMerge(
|
|
24
|
-
'relative z-50 w-[var(--bits-select-anchor-width)] min-w-[8rem] max-h-[
|
|
24
|
+
'relative z-50 w-[var(--bits-select-anchor-width)] min-w-[8rem] max-h-[min(calc(var(--bits-select-content-available-height)-40px),800px)] overflow-hidden rounded-lg bg-surface text-primary shadow-menu',
|
|
25
25
|
className
|
|
26
26
|
)}
|
|
27
27
|
>
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
|
|
12
12
|
let { class: className = '', children, ...restProps }: Props = $props();
|
|
13
13
|
|
|
14
|
-
const baseClasses = 'py-1.5 pl-2 pr-2 text-
|
|
14
|
+
const baseClasses = 'py-1.5 pl-2 pr-2 text-label font-medium text-tertiary';
|
|
15
15
|
</script>
|
|
16
16
|
|
|
17
17
|
<SelectPrimitive.GroupHeading {...restProps} class="{baseClasses} {className}">
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import Check from 'phosphor-svelte/lib/Check';
|
|
3
3
|
import { Icon } from '../../icons/index.js';
|
|
4
4
|
import { Select as SelectPrimitive } from 'bits-ui';
|
|
5
|
+
import { twMerge } from 'tailwind-merge';
|
|
5
6
|
import type { ItemProps, ItemSlotProps } from '../types';
|
|
6
7
|
|
|
7
8
|
import type { Snippet } from 'svelte';
|
|
@@ -14,14 +15,14 @@
|
|
|
14
15
|
let { class: className = '', children, ...restProps }: Props = $props();
|
|
15
16
|
|
|
16
17
|
const baseClasses = `
|
|
17
|
-
relative flex w-full h-auto gap-2 cursor-default select-none items-center justify-between rounded-md
|
|
18
|
+
relative flex w-full h-auto min-h-10 gap-2 cursor-default select-none items-center justify-between rounded-md px-3 py-2 text-sm outline-none cursor-pointer
|
|
18
19
|
focus:bg-neutral focus:text-accent-foreground
|
|
19
20
|
data-[disabled]:pointer-events-none data-[disabled]:opacity-50
|
|
20
21
|
data-[highlighted]:bg-neutral data-[highlighted]:text-accent-foreground
|
|
21
22
|
`;
|
|
22
23
|
</script>
|
|
23
24
|
|
|
24
|
-
<SelectPrimitive.Item {...restProps} class={baseClasses
|
|
25
|
+
<SelectPrimitive.Item {...restProps} class={twMerge(baseClasses, className)}>
|
|
25
26
|
{#snippet children(params: ItemSlotProps)}
|
|
26
27
|
{#if children}
|
|
27
28
|
{@render children(params)}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import CaretDown from 'phosphor-svelte/lib/CaretDown';
|
|
3
3
|
import { Icon } from '../../icons/index.js';
|
|
4
4
|
import { Select as SelectPrimitive } from 'bits-ui';
|
|
5
|
+
import { twMerge } from 'tailwind-merge';
|
|
5
6
|
import type { TriggerProps, IconSnippet } from '../types';
|
|
6
7
|
|
|
7
8
|
import type { Snippet } from 'svelte';
|
|
@@ -12,6 +13,7 @@
|
|
|
12
13
|
class?: string;
|
|
13
14
|
placeholder?: string;
|
|
14
15
|
displayValue?: string;
|
|
16
|
+
size?: 'sm' | 'md';
|
|
15
17
|
}
|
|
16
18
|
|
|
17
19
|
let {
|
|
@@ -20,25 +22,32 @@
|
|
|
20
22
|
children,
|
|
21
23
|
placeholder = 'Select an option',
|
|
22
24
|
displayValue = undefined,
|
|
25
|
+
size = 'md',
|
|
23
26
|
...restProps
|
|
24
27
|
}: Props = $props();
|
|
25
28
|
|
|
26
|
-
const
|
|
27
|
-
'
|
|
29
|
+
const sizeClasses = {
|
|
30
|
+
sm: 'h-8 p-1',
|
|
31
|
+
md: 'h-10 p-1.5',
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
const baseClasses = $derived(
|
|
35
|
+
`flex w-full items-center justify-between !rounded-lg border border-input bg-surface text-sm placeholder:text-tertiary focus:outline-none hover:border-hover focus:border-accent focus:ring-0 disabled:cursor-not-allowed disabled:border-transparent disabled:bg-neutral disabled:opacity-75 transition-colors shadow-input ${sizeClasses[size]}`
|
|
36
|
+
);
|
|
28
37
|
</script>
|
|
29
38
|
|
|
30
39
|
<SelectPrimitive.Trigger
|
|
31
40
|
{...restProps}
|
|
32
|
-
class={baseClasses
|
|
41
|
+
class={twMerge(baseClasses, className)}
|
|
33
42
|
aria-label={placeholder}
|
|
34
43
|
>
|
|
35
44
|
<div class="flex-1 truncate text-left">
|
|
36
45
|
{#if children}
|
|
37
46
|
{@render children()}
|
|
38
47
|
{:else if displayValue !== undefined}
|
|
39
|
-
{displayValue}
|
|
48
|
+
<span class="pl-1">{displayValue}</span>
|
|
40
49
|
{:else}
|
|
41
|
-
<span class="text-tertiary">{placeholder}</span>
|
|
50
|
+
<span class="text-tertiary pl-1">{placeholder}</span>
|
|
42
51
|
{/if}
|
|
43
52
|
</div>
|
|
44
53
|
{#if TriggerIcon}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import type { Snippet } from 'svelte';
|
|
3
3
|
import Skeleton from './components/Skeleton.svelte';
|
|
4
4
|
import SkeletonImage from './components/SkeletonImage.svelte';
|
|
5
|
+
import { twMerge } from 'tailwind-merge';
|
|
5
6
|
|
|
6
7
|
interface Props {
|
|
7
8
|
class?: string;
|
|
@@ -12,6 +13,10 @@
|
|
|
12
13
|
let { class: className = '', dataTestId = '', children }: Props = $props();
|
|
13
14
|
</script>
|
|
14
15
|
|
|
15
|
-
<div
|
|
16
|
+
<div
|
|
17
|
+
role="status"
|
|
18
|
+
class={twMerge('h-full w-full animate-pulse', className)}
|
|
19
|
+
data-testid={dataTestId}
|
|
20
|
+
>
|
|
16
21
|
{@render children?.({ Skeleton, SkeletonImage })}
|
|
17
22
|
</div>
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import CaretUpDown from 'phosphor-svelte/lib/CaretUpDown';
|
|
3
3
|
import { Icon } from '../icons/index.js';
|
|
4
|
+
import { twMerge } from 'tailwind-merge';
|
|
4
5
|
|
|
5
6
|
let className = '';
|
|
6
7
|
export { className as class };
|
|
@@ -31,10 +32,12 @@
|
|
|
31
32
|
}
|
|
32
33
|
</script>
|
|
33
34
|
|
|
34
|
-
<div
|
|
35
|
+
<div
|
|
36
|
+
class={twMerge('relative flex h-10 items-center', disabled && 'opacity-40', className)}
|
|
37
|
+
>
|
|
35
38
|
<div class="track-overlay"></div>
|
|
36
39
|
<div
|
|
37
|
-
class=
|
|
40
|
+
class={twMerge('pointer-events-none absolute h-2.5 rounded-full', bufferColorClass)}
|
|
38
41
|
style="
|
|
39
42
|
width: {calculatePosition(buffer - bufferMin)} + 1rem);
|
|
40
43
|
left: {calculatePosition(bufferMin)}
|
|
@@ -42,7 +45,7 @@
|
|
|
42
45
|
></div>
|
|
43
46
|
{#if showFilled}
|
|
44
47
|
<div
|
|
45
|
-
class=
|
|
48
|
+
class={twMerge('absolute h-2.5 rounded-full', filledColorClass)}
|
|
46
49
|
style="width: {calculatePosition(value)} + 1rem);left: 0;"
|
|
47
50
|
></div>
|
|
48
51
|
{/if}
|