@reshape-biotech/design-system 0.0.45 → 0.0.48
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 +43 -31
- package/dist/components/activity/Activity.stories.svelte +100 -0
- package/dist/components/activity/Activity.stories.svelte.d.ts +19 -0
- package/dist/components/activity/Activity.svelte +80 -0
- package/dist/components/activity/Activity.svelte.d.ts +18 -0
- package/dist/components/activity/index.d.ts +1 -0
- package/dist/components/activity/index.js +1 -0
- package/dist/components/avatar/Avatar.svelte +3 -3
- package/dist/components/banner/Banner.svelte +2 -2
- package/dist/components/button/Button.svelte +94 -7
- package/dist/components/button/Button.svelte.d.ts +8 -5
- package/dist/components/collapsible/Collapsible.stories.svelte +40 -0
- package/dist/components/collapsible/Collapsible.stories.svelte.d.ts +19 -0
- package/dist/components/collapsible/components/collapsible-content.svelte +26 -0
- package/dist/components/collapsible/components/collapsible-content.svelte.d.ts +10 -0
- package/dist/components/collapsible/components/collapsible-trigger.svelte +36 -0
- package/dist/components/collapsible/components/collapsible-trigger.svelte.d.ts +4 -0
- package/dist/components/collapsible/index.d.ts +5 -0
- package/dist/components/collapsible/index.js +4 -0
- package/dist/components/collapsible/types.d.ts +9 -0
- package/dist/components/collapsible/types.js +1 -0
- package/dist/components/combobox/Combobox.stories.svelte +119 -0
- package/dist/components/combobox/Combobox.stories.svelte.d.ts +19 -0
- package/dist/components/combobox/components/combobox-add.svelte +30 -0
- package/dist/components/combobox/components/combobox-add.svelte.d.ts +8 -0
- package/dist/components/combobox/components/combobox-content.svelte +137 -0
- package/dist/components/combobox/components/combobox-content.svelte.d.ts +4 -0
- package/dist/components/combobox/components/combobox-indicator.svelte +5 -0
- package/dist/components/combobox/components/combobox-indicator.svelte.d.ts +18 -0
- package/dist/components/combobox/index.d.ts +14 -0
- package/dist/components/combobox/index.js +15 -0
- package/dist/components/combobox/types.d.ts +20 -0
- package/dist/components/combobox/types.js +1 -0
- package/dist/components/datepicker/DatePicker.svelte +158 -97
- package/dist/components/divider/Divider.svelte +1 -1
- package/dist/components/drawer/Drawer.svelte +1 -1
- package/dist/components/drawer/DrawerLabel.svelte +2 -2
- package/dist/components/dropdown/components/DropdownContent.svelte +4 -1
- package/dist/components/dropdown/components/DropdownMenu.svelte +1 -1
- package/dist/components/dropdown/components/DropdownTrigger.svelte +4 -2
- package/dist/components/dropdown/components/DropdownTrigger.svelte.d.ts +1 -0
- package/dist/components/dropdown/components/OutlinedButton.svelte +2 -2
- package/dist/components/empty-content/EmptyContent.svelte +19 -0
- package/dist/components/empty-content/EmptyContent.svelte.d.ts +8 -0
- package/dist/components/graphs/chart/Chart.stories.svelte +128 -0
- package/dist/components/graphs/chart/Chart.stories.svelte.d.ts +19 -0
- package/dist/components/graphs/chart/Chart.svelte +145 -0
- package/dist/components/graphs/chart/Chart.svelte.d.ts +17 -0
- package/dist/components/graphs/index.d.ts +4 -0
- package/dist/components/graphs/index.js +4 -0
- package/dist/components/graphs/line/LineChart.stories.svelte +73 -0
- package/dist/components/graphs/line/LineChart.stories.svelte.d.ts +19 -0
- package/dist/components/graphs/line/LineChart.svelte +102 -0
- package/dist/components/graphs/line/LineChart.svelte.d.ts +18 -0
- package/dist/components/graphs/multiline/MultiLineChart.stories.svelte +77 -0
- package/dist/components/graphs/multiline/MultiLineChart.stories.svelte.d.ts +19 -0
- package/dist/components/graphs/multiline/MultiLineChart.svelte +108 -0
- package/dist/components/graphs/multiline/MultiLineChart.svelte.d.ts +22 -0
- package/dist/components/graphs/scatterplot/Scatterplot.stories.svelte +78 -0
- package/dist/components/graphs/scatterplot/Scatterplot.stories.svelte.d.ts +19 -0
- package/dist/components/graphs/scatterplot/Scatterplot.svelte +67 -0
- package/dist/components/graphs/scatterplot/Scatterplot.svelte.d.ts +16 -0
- package/dist/components/icon-button/IconButton.svelte +18 -5
- package/dist/components/icon-button/IconButton.svelte.d.ts +2 -2
- package/dist/components/icons/AnalysisIcon.stories.svelte +38 -0
- package/dist/components/icons/AnalysisIcon.stories.svelte.d.ts +27 -0
- package/dist/components/icons/AnalysisIcon.svelte +110 -0
- package/dist/components/icons/AnalysisIcon.svelte.d.ts +10 -0
- package/dist/components/icons/Icon.svelte +23 -0
- package/dist/components/icons/Icon.svelte.d.ts +4 -0
- package/dist/components/icons/custom/Halo.svelte +32 -0
- package/dist/components/icons/custom/Halo.svelte.d.ts +26 -0
- package/dist/components/icons/custom/Well.svelte +26 -0
- package/dist/components/icons/custom/Well.svelte.d.ts +26 -0
- package/dist/components/icons/index.d.ts +17 -0
- package/dist/components/icons/index.js +21 -0
- package/dist/components/icons/types.d.ts +0 -0
- package/dist/components/icons/types.js +1 -0
- package/dist/components/image/Image.svelte +5 -6
- package/dist/components/input/Input.svelte +63 -41
- package/dist/components/input/Input.svelte.d.ts +7 -4
- package/dist/components/list/List.svelte +4 -10
- package/dist/components/logo/Logo.svelte +8 -5
- package/dist/components/logo/Logo.svelte.d.ts +1 -0
- package/dist/components/modal/Modal.svelte +1 -1
- package/dist/components/notification-popup/NotificationPopup.stories.svelte +2 -2
- package/dist/components/notification-popup/NotificationPopup.svelte +4 -2
- package/dist/components/segmented-control-buttons/ControlButton.svelte +2 -4
- package/dist/components/select/Select.svelte +7 -4
- package/dist/components/skeleton-loader/StatcardSkeleton.svelte +2 -5
- package/dist/components/slider/Slider.svelte +32 -23
- package/dist/components/slider/Slider.svelte.d.ts +2 -0
- package/dist/components/stat-card/StatCard.svelte +6 -6
- package/dist/components/table/Table.svelte +1 -1
- package/dist/components/table/components/Th.svelte +1 -1
- package/dist/components/tag/Tag.svelte +3 -5
- package/dist/components/tag/Tag.svelte.d.ts +5 -4
- package/dist/components/toggle/Toggle.svelte.d.ts +3 -2
- package/dist/fonts/afAnotherSans-Medium.woff2 +0 -0
- package/dist/fonts/afAnotherSans-Regular.woff2 +0 -0
- package/dist/fonts/afAnotherSans-SemiBold.woff2 +0 -0
- package/dist/fonts/afAnotherSans.woff2 +0 -0
- package/dist/fonts/index.d.ts +1 -3
- package/dist/fonts/index.js +2 -6
- package/dist/index.d.ts +5 -0
- package/dist/index.js +5 -0
- package/dist/tailwind-safelist.js +1 -1
- package/dist/tailwind.preset.d.ts +19 -6
- package/dist/tailwind.preset.js +5 -4
- package/dist/tokens.d.ts +39 -11
- package/dist/tokens.js +34 -16
- package/package.json +18 -15
- package/dist/fonts/MDSystem-Medium.woff +0 -0
- package/dist/fonts/MDSystem-Medium.woff2 +0 -0
- package/dist/fonts/MDSystem-Regular.woff +0 -0
- package/dist/fonts/MDSystem-Regular.woff2 +0 -0
- package/dist/fonts/MDSystem-Semibold.woff +0 -0
- package/dist/fonts/MDSystem-Semibold.woff2 +0 -0
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import * as Collapsible from './index';
|
|
2
|
+
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> {
|
|
3
|
+
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
4
|
+
$$bindings?: Bindings;
|
|
5
|
+
} & Exports;
|
|
6
|
+
(internal: unknown, props: {
|
|
7
|
+
$$events?: Events;
|
|
8
|
+
$$slots?: Slots;
|
|
9
|
+
}): Exports & {
|
|
10
|
+
$set?: any;
|
|
11
|
+
$on?: any;
|
|
12
|
+
};
|
|
13
|
+
z_$$bindings?: Bindings;
|
|
14
|
+
}
|
|
15
|
+
declare const Collapsible: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
|
|
16
|
+
[evt: string]: CustomEvent<any>;
|
|
17
|
+
}, {}, {}, string>;
|
|
18
|
+
type Collapsible = InstanceType<typeof Collapsible>;
|
|
19
|
+
export default Collapsible;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { Collapsible, type WithoutChildrenOrChild } from 'bits-ui';
|
|
3
|
+
import { slide } from 'svelte/transition';
|
|
4
|
+
import type { Snippet } from 'svelte';
|
|
5
|
+
import type { CollapsibleContentProps } from '../types';
|
|
6
|
+
|
|
7
|
+
let {
|
|
8
|
+
ref = $bindable(null),
|
|
9
|
+
duration = 200,
|
|
10
|
+
children,
|
|
11
|
+
...restProps
|
|
12
|
+
}: WithoutChildrenOrChild<CollapsibleContentProps> & {
|
|
13
|
+
duration?: number;
|
|
14
|
+
children?: Snippet;
|
|
15
|
+
} = $props();
|
|
16
|
+
</script>
|
|
17
|
+
|
|
18
|
+
<Collapsible.Content forceMount bind:ref {...restProps}>
|
|
19
|
+
{#snippet child({ props, open })}
|
|
20
|
+
{#if open}
|
|
21
|
+
<div {...props} transition:slide={{ duration }}>
|
|
22
|
+
{@render children?.()}
|
|
23
|
+
</div>
|
|
24
|
+
{/if}
|
|
25
|
+
{/snippet}
|
|
26
|
+
</Collapsible.Content>
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type WithoutChildrenOrChild } from 'bits-ui';
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
import type { CollapsibleContentProps } from '../types';
|
|
4
|
+
type $$ComponentProps = WithoutChildrenOrChild<CollapsibleContentProps> & {
|
|
5
|
+
duration?: number;
|
|
6
|
+
children?: Snippet;
|
|
7
|
+
};
|
|
8
|
+
declare const CollapsibleContent: import("svelte").Component<$$ComponentProps, {}, "ref">;
|
|
9
|
+
type CollapsibleContent = ReturnType<typeof CollapsibleContent>;
|
|
10
|
+
export default CollapsibleContent;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { Collapsible } from 'bits-ui';
|
|
3
|
+
import { CaretDown } from 'phosphor-svelte';
|
|
4
|
+
import type { CollapsibleTriggerProps } from '../types';
|
|
5
|
+
|
|
6
|
+
let { children, withIcon = true, ...props }: CollapsibleTriggerProps = $props();
|
|
7
|
+
</script>
|
|
8
|
+
|
|
9
|
+
<Collapsible.Trigger {...props} class="transition-all {props.class}">
|
|
10
|
+
<div class="container">
|
|
11
|
+
{@render children()}
|
|
12
|
+
{#if withIcon}
|
|
13
|
+
<CaretDown class="icon" />
|
|
14
|
+
{/if}
|
|
15
|
+
</div>
|
|
16
|
+
</Collapsible.Trigger>
|
|
17
|
+
|
|
18
|
+
<style>
|
|
19
|
+
:global([data-state='open']) :global(.icon) {
|
|
20
|
+
|
|
21
|
+
--tw-rotate: 180deg;
|
|
22
|
+
|
|
23
|
+
transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.container {
|
|
27
|
+
|
|
28
|
+
display: flex;
|
|
29
|
+
|
|
30
|
+
align-items: center;
|
|
31
|
+
|
|
32
|
+
justify-content: space-between;
|
|
33
|
+
|
|
34
|
+
gap: 0.5rem
|
|
35
|
+
}
|
|
36
|
+
</style>
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Collapsible } from 'bits-ui';
|
|
2
|
+
export declare const Root: import("svelte").Component<Collapsible.RootProps, {}, "open" | "ref">;
|
|
3
|
+
export { default as Trigger } from './components/collapsible-trigger.svelte';
|
|
4
|
+
export { default as Content } from './components/collapsible-content.svelte';
|
|
5
|
+
export type { CollapsibleTriggerProps, CollapsibleContentProps } from './types';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type CollapsibleContentProps as BitsCollapsibleContentProps, type CollapsibleTriggerProps as BitsCollapsibleTriggerProps } from 'bits-ui';
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
export type CollapsibleTriggerProps = {
|
|
4
|
+
children: Snippet;
|
|
5
|
+
withIcon?: boolean;
|
|
6
|
+
} & BitsCollapsibleTriggerProps;
|
|
7
|
+
export type CollapsibleContentProps = {
|
|
8
|
+
children: Snippet;
|
|
9
|
+
} & BitsCollapsibleContentProps;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import {} from 'bits-ui';
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
<script module lang="ts">
|
|
2
|
+
import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
3
|
+
import * as Combobox from './index';
|
|
4
|
+
import { Plus } from 'phosphor-svelte';
|
|
5
|
+
import IconButton from '../icon-button/IconButton.svelte';
|
|
6
|
+
import Divider from '../divider/Divider.svelte';
|
|
7
|
+
import Tag from '../tag/Tag.svelte';
|
|
8
|
+
|
|
9
|
+
const { Story } = defineMeta({
|
|
10
|
+
component: Combobox.Root,
|
|
11
|
+
title: 'Design System/Combobox',
|
|
12
|
+
tags: ['autodocs']
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
const fruits = [
|
|
16
|
+
{ value: 'mango', label: 'Mango' },
|
|
17
|
+
{ value: 'watermelon', label: 'Watermelon' },
|
|
18
|
+
{ value: 'apple', label: 'Apple' },
|
|
19
|
+
{ value: 'pineapple', label: 'Pineapple' },
|
|
20
|
+
{ value: 'orange', label: 'Orange' },
|
|
21
|
+
{ value: 'grape', label: 'Grape' },
|
|
22
|
+
{ value: 'strawberry', label: 'Strawberry' },
|
|
23
|
+
{ value: 'banana', label: 'Banana' },
|
|
24
|
+
{ value: 'kiwi', label: 'Kiwi' },
|
|
25
|
+
{ value: 'peach', label: 'Peach' },
|
|
26
|
+
{ value: 'cherry', label: 'Cherry' },
|
|
27
|
+
{ value: 'blueberry', label: 'Blueberry' },
|
|
28
|
+
{ value: 'raspberry', label: 'Raspberry' },
|
|
29
|
+
{ value: 'blackberry', label: 'Blackberry' },
|
|
30
|
+
{ value: 'plum', label: 'Plum' },
|
|
31
|
+
{ value: 'apricot', label: 'Apricot' },
|
|
32
|
+
{ value: 'pear', label: 'Pear' },
|
|
33
|
+
{ value: 'grapefruit', label: 'Grapefruit' }
|
|
34
|
+
];
|
|
35
|
+
|
|
36
|
+
let searchValue = $state('');
|
|
37
|
+
|
|
38
|
+
let selected = $state<string[]>([]);
|
|
39
|
+
|
|
40
|
+
const filteredFruits = $derived(
|
|
41
|
+
searchValue === ''
|
|
42
|
+
? fruits
|
|
43
|
+
: fruits.filter((fruit) => fruit.label.toLowerCase().includes(searchValue.toLowerCase()))
|
|
44
|
+
);
|
|
45
|
+
const exactMatch = $derived(
|
|
46
|
+
filteredFruits.find((fruit) => fruit.value.toLowerCase() === searchValue.toLowerCase())
|
|
47
|
+
);
|
|
48
|
+
let customAnchor = $state<HTMLElement>(null!);
|
|
49
|
+
</script>
|
|
50
|
+
|
|
51
|
+
<Story name="Base">
|
|
52
|
+
<Combobox.Root
|
|
53
|
+
onOpenChange={(o) => {
|
|
54
|
+
if (!o) searchValue = '';
|
|
55
|
+
}}
|
|
56
|
+
type="multiple"
|
|
57
|
+
name="favoriteFruit"
|
|
58
|
+
items={filteredFruits}
|
|
59
|
+
bind:value={selected}
|
|
60
|
+
>
|
|
61
|
+
<div class="flex gap-2">
|
|
62
|
+
{#each selected as fruit}
|
|
63
|
+
<Tag>
|
|
64
|
+
{fruit}
|
|
65
|
+
</Tag>
|
|
66
|
+
{/each}
|
|
67
|
+
</div>
|
|
68
|
+
<Combobox.Trigger>
|
|
69
|
+
<div bind:this={customAnchor}>
|
|
70
|
+
<IconButton rounded={false}>
|
|
71
|
+
<Plus size={16} />
|
|
72
|
+
</IconButton>
|
|
73
|
+
</div>
|
|
74
|
+
</Combobox.Trigger>
|
|
75
|
+
<Combobox.Content {customAnchor} class="flex flex-col justify-between">
|
|
76
|
+
<div>
|
|
77
|
+
<Combobox.Input
|
|
78
|
+
placeholder="Search a fruit"
|
|
79
|
+
oninput={(e: Event) => (searchValue = (e.target as HTMLInputElement).value)}
|
|
80
|
+
autofocus
|
|
81
|
+
/>
|
|
82
|
+
<Divider />
|
|
83
|
+
</div>
|
|
84
|
+
<div class="flex flex-grow flex-col">
|
|
85
|
+
{#if filteredFruits.length > 0}
|
|
86
|
+
<Combobox.Group>
|
|
87
|
+
<Combobox.GroupHeading>Fruits</Combobox.GroupHeading>
|
|
88
|
+
{#each filteredFruits as fruit (fruit.value)}
|
|
89
|
+
<Combobox.Item value={fruit.value} label={fruit.label}>
|
|
90
|
+
{#snippet children({ selected })}
|
|
91
|
+
{fruit.label}
|
|
92
|
+
{#if selected}
|
|
93
|
+
<Combobox.Indicator />
|
|
94
|
+
{/if}
|
|
95
|
+
{/snippet}
|
|
96
|
+
</Combobox.Item>
|
|
97
|
+
{:else}
|
|
98
|
+
<span class="block px-5 py-2 text-sm text-muted-foreground"> No results found </span>
|
|
99
|
+
{/each}
|
|
100
|
+
</Combobox.Group>
|
|
101
|
+
{/if}
|
|
102
|
+
</div>
|
|
103
|
+
{#if !exactMatch && searchValue !== ''}
|
|
104
|
+
<Divider />
|
|
105
|
+
|
|
106
|
+
<Combobox.Add
|
|
107
|
+
class=""
|
|
108
|
+
onclick={() => {
|
|
109
|
+
selected.push(searchValue);
|
|
110
|
+
fruits.push({ value: searchValue, label: searchValue });
|
|
111
|
+
searchValue = '';
|
|
112
|
+
}}
|
|
113
|
+
>
|
|
114
|
+
<p>Add new fruit</p>
|
|
115
|
+
</Combobox.Add>
|
|
116
|
+
{/if}
|
|
117
|
+
</Combobox.Content>
|
|
118
|
+
</Combobox.Root>
|
|
119
|
+
</Story>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import * as Combobox from './index';
|
|
2
|
+
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> {
|
|
3
|
+
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
4
|
+
$$bindings?: Bindings;
|
|
5
|
+
} & Exports;
|
|
6
|
+
(internal: unknown, props: {
|
|
7
|
+
$$events?: Events;
|
|
8
|
+
$$slots?: Slots;
|
|
9
|
+
}): Exports & {
|
|
10
|
+
$set?: any;
|
|
11
|
+
$on?: any;
|
|
12
|
+
};
|
|
13
|
+
z_$$bindings?: Bindings;
|
|
14
|
+
}
|
|
15
|
+
declare const Combobox: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
|
|
16
|
+
[evt: string]: CustomEvent<any>;
|
|
17
|
+
}, {}, {}, string>;
|
|
18
|
+
type Combobox = InstanceType<typeof Combobox>;
|
|
19
|
+
export default Combobox;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { Plus } from 'phosphor-svelte';
|
|
3
|
+
import type { Snippet } from 'svelte';
|
|
4
|
+
import type { HTMLButtonAttributes } from 'svelte/elements';
|
|
5
|
+
|
|
6
|
+
type Props = { children: Snippet } & HTMLButtonAttributes;
|
|
7
|
+
|
|
8
|
+
let { children, ...props }: Props = $props();
|
|
9
|
+
</script>
|
|
10
|
+
|
|
11
|
+
<button {...props}>
|
|
12
|
+
<Plus />
|
|
13
|
+
{@render children()}
|
|
14
|
+
</button>
|
|
15
|
+
|
|
16
|
+
<style>
|
|
17
|
+
button {
|
|
18
|
+
display: flex;
|
|
19
|
+
height: 2.5rem;
|
|
20
|
+
flex-direction: row;
|
|
21
|
+
align-items: center;
|
|
22
|
+
gap: 0.5rem;
|
|
23
|
+
padding-left: 0.75rem;
|
|
24
|
+
padding-right: 0.75rem;
|
|
25
|
+
padding-top: 0.5rem;
|
|
26
|
+
padding-bottom: 0.5rem;
|
|
27
|
+
font-size: 0.875rem;
|
|
28
|
+
line-height: 1.25rem
|
|
29
|
+
}
|
|
30
|
+
</style>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
import type { HTMLButtonAttributes } from 'svelte/elements';
|
|
3
|
+
type Props = {
|
|
4
|
+
children: Snippet;
|
|
5
|
+
} & HTMLButtonAttributes;
|
|
6
|
+
declare const ComboboxAdd: import("svelte").Component<Props, {}, "">;
|
|
7
|
+
type ComboboxAdd = ReturnType<typeof ComboboxAdd>;
|
|
8
|
+
export default ComboboxAdd;
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { Combobox } from 'bits-ui';
|
|
3
|
+
import type { ComboboxContentProps } from '../types';
|
|
4
|
+
import { CaretDown, CaretUp } from 'phosphor-svelte';
|
|
5
|
+
|
|
6
|
+
let {
|
|
7
|
+
children,
|
|
8
|
+
class: className,
|
|
9
|
+
showScroll = true,
|
|
10
|
+
portalled = true,
|
|
11
|
+
...props
|
|
12
|
+
}: ComboboxContentProps = $props();
|
|
13
|
+
</script>
|
|
14
|
+
|
|
15
|
+
{#snippet content()}
|
|
16
|
+
<Combobox.Content {...props} class={className}>
|
|
17
|
+
{#if showScroll}
|
|
18
|
+
<Combobox.ScrollUpButton class="flex justify-center">
|
|
19
|
+
<CaretUp />
|
|
20
|
+
</Combobox.ScrollUpButton>
|
|
21
|
+
<Combobox.Viewport class="p-1">
|
|
22
|
+
{@render children()}
|
|
23
|
+
</Combobox.Viewport>
|
|
24
|
+
<Combobox.ScrollDownButton class="flex justify-center">
|
|
25
|
+
<CaretDown />
|
|
26
|
+
</Combobox.ScrollDownButton>
|
|
27
|
+
{:else}
|
|
28
|
+
{@render children()}
|
|
29
|
+
{/if}
|
|
30
|
+
</Combobox.Content>
|
|
31
|
+
{/snippet}
|
|
32
|
+
|
|
33
|
+
{#if portalled}
|
|
34
|
+
<Combobox.Portal>
|
|
35
|
+
{@render content()}
|
|
36
|
+
</Combobox.Portal>
|
|
37
|
+
{:else}
|
|
38
|
+
{@render content()}
|
|
39
|
+
{/if}
|
|
40
|
+
|
|
41
|
+
<style>
|
|
42
|
+
:global([data-combobox-content]) {
|
|
43
|
+
|
|
44
|
+
width: 100%;
|
|
45
|
+
|
|
46
|
+
border-radius: 0.75rem;
|
|
47
|
+
|
|
48
|
+
border-width: 1px;
|
|
49
|
+
|
|
50
|
+
--tw-bg-opacity: 1;
|
|
51
|
+
|
|
52
|
+
background-color: rgb(255 255 255 / var(--tw-bg-opacity, 1));
|
|
53
|
+
|
|
54
|
+
--tw-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
|
|
55
|
+
|
|
56
|
+
--tw-shadow-colored: 0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);
|
|
57
|
+
|
|
58
|
+
box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);
|
|
59
|
+
|
|
60
|
+
outline: 2px solid transparent;
|
|
61
|
+
|
|
62
|
+
outline-offset: 2px
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
:global([data-combobox-input]) {
|
|
66
|
+
|
|
67
|
+
width: 100%;
|
|
68
|
+
|
|
69
|
+
--tw-bg-opacity: 1;
|
|
70
|
+
|
|
71
|
+
background-color: rgb(255 255 255 / var(--tw-bg-opacity, 1));
|
|
72
|
+
|
|
73
|
+
padding-left: 0.75rem;
|
|
74
|
+
|
|
75
|
+
padding-right: 0.75rem;
|
|
76
|
+
|
|
77
|
+
padding-top: 0.5rem;
|
|
78
|
+
|
|
79
|
+
padding-bottom: 0.5rem;
|
|
80
|
+
|
|
81
|
+
font-size: 0.875rem;
|
|
82
|
+
|
|
83
|
+
line-height: 1.25rem;
|
|
84
|
+
|
|
85
|
+
outline: 2px solid transparent;
|
|
86
|
+
|
|
87
|
+
outline-offset: 2px
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
:global([data-combobox-item]) {
|
|
91
|
+
|
|
92
|
+
display: flex;
|
|
93
|
+
|
|
94
|
+
height: 2.5rem;
|
|
95
|
+
|
|
96
|
+
width: 100%;
|
|
97
|
+
|
|
98
|
+
cursor: pointer;
|
|
99
|
+
|
|
100
|
+
align-items: center;
|
|
101
|
+
|
|
102
|
+
justify-content: space-between;
|
|
103
|
+
|
|
104
|
+
border-radius: 0.375rem;
|
|
105
|
+
|
|
106
|
+
padding-left: 0.75rem;
|
|
107
|
+
|
|
108
|
+
padding-right: 0.75rem;
|
|
109
|
+
|
|
110
|
+
font-size: 0.875rem;
|
|
111
|
+
|
|
112
|
+
line-height: 1.25rem
|
|
113
|
+
}
|
|
114
|
+
:global([data-combobox-item][data-highlighted]) {
|
|
115
|
+
|
|
116
|
+
background-color: #12192a0d
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
:global([data-combobox-group-label]) {
|
|
120
|
+
|
|
121
|
+
padding-left: 0.75rem;
|
|
122
|
+
|
|
123
|
+
padding-right: 0.75rem;
|
|
124
|
+
|
|
125
|
+
padding-top: 0.5rem;
|
|
126
|
+
|
|
127
|
+
padding-bottom: 0.5rem;
|
|
128
|
+
|
|
129
|
+
font-size: 0.75rem;
|
|
130
|
+
|
|
131
|
+
line-height: 1rem;
|
|
132
|
+
|
|
133
|
+
--tw-text-opacity: 1;
|
|
134
|
+
|
|
135
|
+
color: rgb(136 140 148 / var(--tw-text-opacity, 1))
|
|
136
|
+
}
|
|
137
|
+
</style>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
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> {
|
|
2
|
+
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
3
|
+
$$bindings?: Bindings;
|
|
4
|
+
} & Exports;
|
|
5
|
+
(internal: unknown, props: {
|
|
6
|
+
$$events?: Events;
|
|
7
|
+
$$slots?: Slots;
|
|
8
|
+
}): Exports & {
|
|
9
|
+
$set?: any;
|
|
10
|
+
$on?: any;
|
|
11
|
+
};
|
|
12
|
+
z_$$bindings?: Bindings;
|
|
13
|
+
}
|
|
14
|
+
declare const ComboboxIndicator: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
|
|
15
|
+
[evt: string]: CustomEvent<any>;
|
|
16
|
+
}, {}, {}, string>;
|
|
17
|
+
type ComboboxIndicator = InstanceType<typeof ComboboxIndicator>;
|
|
18
|
+
export default ComboboxIndicator;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Combobox } from 'bits-ui';
|
|
2
|
+
export declare const Root: import("svelte").Component<import("bits-ui").ComboboxRootPropsWithoutHTML, {}, "open" | "value">;
|
|
3
|
+
export declare const Item: import("svelte").Component<Combobox.ItemProps, {}, "ref">;
|
|
4
|
+
export declare const Group: import("svelte").Component<Combobox.GroupProps, {}, "ref">;
|
|
5
|
+
export declare const GroupHeading: import("svelte").Component<Combobox.GroupHeadingProps, {}, "ref">;
|
|
6
|
+
export declare const Separator: import("svelte").Component<import("bits-ui").SeparatorRootProps, {}, "ref">;
|
|
7
|
+
export declare const Trigger: import("svelte").Component<Combobox.TriggerProps, {}, "ref">;
|
|
8
|
+
export declare const Portal: import("svelte").Component<import("bits-ui").PortalProps, {}, "">;
|
|
9
|
+
export declare const Input: import("svelte").Component<Combobox.InputProps, {}, "ref">;
|
|
10
|
+
export declare const Arrow: import("svelte").Component<import("bits-ui/dist/bits/utilities/arrow").ArrowProps, {}, "">;
|
|
11
|
+
export { default as Add } from './components/combobox-add.svelte';
|
|
12
|
+
export { default as Content } from './components/combobox-content.svelte';
|
|
13
|
+
export { default as Indicator } from './components/combobox-indicator.svelte';
|
|
14
|
+
export * from './types';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Combobox } from 'bits-ui';
|
|
2
|
+
// Non-modified components
|
|
3
|
+
export const Root = Combobox.Root;
|
|
4
|
+
export const Item = Combobox.Item;
|
|
5
|
+
export const Group = Combobox.Group;
|
|
6
|
+
export const GroupHeading = Combobox.GroupHeading;
|
|
7
|
+
export const Separator = Combobox.Separator;
|
|
8
|
+
export const Trigger = Combobox.Trigger;
|
|
9
|
+
export const Portal = Combobox.Portal;
|
|
10
|
+
export const Input = Combobox.Input;
|
|
11
|
+
export const Arrow = Combobox.Arrow;
|
|
12
|
+
export { default as Add } from './components/combobox-add.svelte';
|
|
13
|
+
export { default as Content } from './components/combobox-content.svelte';
|
|
14
|
+
export { default as Indicator } from './components/combobox-indicator.svelte';
|
|
15
|
+
export * from './types';
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { type ComboboxContentProps as BitsComboboxContentProps, type ComboboxRootProps as BitsComboboxRootProps, type ComboboxItemProps as BitsComboboxItemProps, type ComboboxInputProps as BitsComboboxInputProps, type ComboboxTriggerProps as BitsComboboxTriggerProps, type ComboboxArrowProps as BitsComboboxArrowProps, type ComboboxContentStaticProps as BitsComboboxContentStaticProps, type ComboboxGroupHeadingProps as BitsComboboxGroupHeadingProps, type SelectItemSnippetProps } from 'bits-ui';
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
export type ComboboxRootProps = BitsComboboxRootProps;
|
|
4
|
+
export type ComboboxContentProps = {
|
|
5
|
+
children: Snippet;
|
|
6
|
+
showScroll?: boolean;
|
|
7
|
+
portalled?: boolean;
|
|
8
|
+
} & BitsComboboxContentProps;
|
|
9
|
+
export type ComboboxTriggerProps = {
|
|
10
|
+
children: Snippet;
|
|
11
|
+
} & BitsComboboxTriggerProps;
|
|
12
|
+
export type ComboboxItemProps = {
|
|
13
|
+
children?: Snippet<[SelectItemSnippetProps]>;
|
|
14
|
+
} & BitsComboboxItemProps;
|
|
15
|
+
export type ComboboxGroupHeadingProps = {
|
|
16
|
+
children: Snippet;
|
|
17
|
+
} & BitsComboboxGroupHeadingProps;
|
|
18
|
+
export type ComboboxInputProps = BitsComboboxInputProps;
|
|
19
|
+
export type ComboboxContentStatic = BitsComboboxContentStaticProps;
|
|
20
|
+
export type ComboboxArrowProps = BitsComboboxArrowProps;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import {} from 'bits-ui';
|