@reshape-biotech/design-system 0.0.54 → 1.1.2
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/components/activity/Activity.stories.svelte +21 -8
- package/dist/components/activity/Activity.svelte +44 -6
- package/dist/components/activity/Activity.svelte.d.ts +1 -1
- package/dist/components/avatar/Avatar.stories.svelte +7 -17
- package/dist/components/avatar/Avatar.svelte +2 -2
- package/dist/components/avatar/Avatar.svelte.d.ts +2 -2
- package/dist/components/banner/Banner.stories.svelte +5 -5
- package/dist/components/banner/Banner.svelte +1 -1
- package/dist/components/button/Button.stories.svelte +54 -21
- package/dist/components/button/Button.svelte +58 -11
- package/dist/components/button/Button.svelte.d.ts +4 -3
- package/dist/components/card/Card.stories.svelte +130 -0
- package/dist/components/card/Card.stories.svelte.d.ts +19 -0
- package/dist/components/card/Card.svelte +25 -0
- package/dist/components/card/Card.svelte.d.ts +10 -0
- package/dist/components/card/index.d.ts +1 -0
- package/dist/components/card/index.js +1 -0
- package/dist/components/checkbox/Checkbox.stories.svelte +7 -15
- package/dist/components/checkbox/Checkbox.svelte +7 -7
- package/dist/components/checkbox/Checkbox.svelte.d.ts +3 -5
- package/dist/components/collapsible/Collapsible.stories.svelte +5 -4
- package/dist/components/combobox/Combobox.stories.svelte +7 -5
- package/dist/components/datepicker/DatePicker.stories.svelte +13 -18
- package/dist/components/datepicker/DatePicker.svelte +1 -0
- package/dist/components/divider/Divider.stories.svelte +1 -3
- package/dist/components/divider/Divider.svelte +8 -2
- package/dist/components/divider/Divider.svelte.d.ts +2 -0
- package/dist/components/drawer/Drawer.stories.svelte +3 -3
- package/dist/components/dropdown/Dropdown.stories.svelte +8 -8
- package/dist/components/empty-content/EmptyContent.stories.svelte +2 -2
- package/dist/components/graphs/bar-chart/BarChart.stories.svelte +81 -0
- package/dist/components/graphs/bar-chart/BarChart.stories.svelte.d.ts +19 -0
- package/dist/components/graphs/bar-chart/BarChart.svelte +136 -0
- package/dist/components/graphs/bar-chart/BarChart.svelte.d.ts +15 -0
- package/dist/components/graphs/bar-chart/StackedBarChart.stories.svelte +42 -0
- package/dist/components/graphs/bar-chart/StackedBarChart.stories.svelte.d.ts +19 -0
- package/dist/components/graphs/bar-chart/StackedBarChart.svelte +177 -0
- package/dist/components/graphs/bar-chart/StackedBarChart.svelte.d.ts +16 -0
- package/dist/components/graphs/chart/Chart.stories.svelte +30 -25
- package/dist/components/graphs/chart/Chart.svelte +104 -32
- package/dist/components/graphs/chart/Chart.svelte.d.ts +15 -5
- package/dist/components/graphs/index.d.ts +3 -0
- package/dist/components/graphs/index.js +3 -0
- package/dist/components/graphs/line/LineChart.stories.svelte +97 -17
- package/dist/components/graphs/line/LineChart.svelte +90 -51
- package/dist/components/graphs/line/LineChart.svelte.d.ts +6 -13
- package/dist/components/graphs/matrix/Matrix.stories.svelte +142 -0
- package/dist/components/graphs/matrix/Matrix.stories.svelte.d.ts +19 -0
- package/dist/components/graphs/matrix/Matrix.svelte +149 -0
- package/dist/components/graphs/matrix/Matrix.svelte.d.ts +24 -0
- package/dist/components/graphs/matrix/index.d.ts +3 -0
- package/dist/components/graphs/matrix/index.js +3 -0
- package/dist/components/graphs/multiline/MultiLineChart.stories.svelte +115 -28
- package/dist/components/graphs/multiline/MultiLineChart.svelte +187 -50
- package/dist/components/graphs/multiline/MultiLineChart.svelte.d.ts +9 -12
- package/dist/components/graphs/scatterplot/Scatterplot.stories.svelte +68 -41
- package/dist/components/graphs/scatterplot/Scatterplot.svelte +312 -45
- package/dist/components/graphs/scatterplot/Scatterplot.svelte.d.ts +23 -13
- package/dist/components/graphs/utils/tooltipFormatter.d.ts +10 -0
- package/dist/components/graphs/utils/tooltipFormatter.js +52 -0
- package/dist/components/icon-button/IconButton.stories.svelte +6 -6
- package/dist/components/icon-button/IconButton.svelte +50 -9
- package/dist/components/icon-button/IconButton.svelte.d.ts +3 -5
- package/dist/components/icons/AnalysisIcon.stories.svelte +15 -21
- package/dist/components/icons/AnalysisIcon.svelte +63 -44
- package/dist/components/icons/AnalysisIcon.svelte.d.ts +1 -0
- package/dist/components/icons/Icon.stories.svelte +4 -4
- package/dist/components/icons/Icon.svelte +1 -1
- package/dist/components/icons/PrincipalIcon.svelte +96 -0
- package/dist/components/icons/PrincipalIcon.svelte.d.ts +10 -0
- package/dist/components/icons/custom/Halo.svelte +14 -8
- package/dist/components/icons/custom/Halo.svelte.d.ts +7 -25
- package/dist/components/icons/custom/Well.svelte +14 -6
- package/dist/components/icons/custom/Well.svelte.d.ts +7 -25
- package/dist/components/icons/index.d.ts +3 -2
- package/dist/components/icons/index.js +34 -0
- package/dist/components/input/Input.stories.svelte +16 -22
- package/dist/components/input/Input.svelte +140 -134
- package/dist/components/input/Input.svelte.d.ts +12 -13
- package/dist/components/label/Label.stories.svelte +28 -0
- package/dist/components/label/Label.stories.svelte.d.ts +19 -0
- package/dist/components/label/Label.svelte +17 -0
- package/dist/components/label/Label.svelte.d.ts +9 -0
- package/dist/components/list/List.stories.svelte +3 -3
- package/dist/components/logo/Logo.stories.svelte +1 -1
- package/dist/components/manual-cfu-counter/ManualCFUCounter.stories.svelte +125 -0
- package/dist/components/manual-cfu-counter/ManualCFUCounter.stories.svelte.d.ts +3 -0
- package/dist/components/manual-cfu-counter/ManualCFUCounter.svelte +577 -0
- package/dist/components/manual-cfu-counter/ManualCFUCounter.svelte.d.ts +16 -0
- package/dist/components/manual-cfu-counter/index.d.ts +1 -0
- package/dist/components/manual-cfu-counter/index.js +1 -0
- package/dist/components/manual-cfu-counter/test/ManualCFUCounterTestWrapper.svelte +22 -0
- package/dist/components/manual-cfu-counter/test/ManualCFUCounterTestWrapper.svelte.d.ts +19 -0
- package/dist/components/markdown/Markdown.stories.svelte +1 -1
- package/dist/components/markdown/Markdown.svelte +1 -1
- package/dist/components/modal/Modal.stories.svelte +2 -2
- package/dist/components/modal/Modal.svelte +27 -22
- package/dist/components/modal/Modal.svelte.d.ts +4 -1
- package/dist/components/notification-popup/NotificationPopup.stories.svelte +1 -1
- package/dist/components/pill/Pill.stories.svelte +13 -0
- package/dist/components/pill/Pill.stories.svelte.d.ts +19 -0
- package/dist/components/progress-circle/ProgressCircle.stories.svelte +15 -0
- package/dist/components/progress-circle/ProgressCircle.stories.svelte.d.ts +19 -0
- package/dist/components/required-status-indicator/RequiredStatusIndicator.stories.svelte +28 -0
- package/dist/components/required-status-indicator/RequiredStatusIndicator.stories.svelte.d.ts +19 -0
- package/dist/components/required-status-indicator/RequiredStatusIndicator.svelte +22 -0
- package/dist/components/required-status-indicator/RequiredStatusIndicator.svelte.d.ts +8 -0
- package/dist/components/required-status-indicator/index.d.ts +1 -0
- package/dist/components/required-status-indicator/index.js +1 -0
- package/dist/components/segmented-control-buttons/SegmentedControlButtons.stories.svelte +3 -3
- package/dist/components/select/Select.stories.svelte +12 -12
- package/dist/components/select/Select.svelte +0 -2
- package/dist/components/select-new/Select.stories.svelte +219 -0
- package/dist/components/select-new/Select.stories.svelte.d.ts +19 -0
- package/dist/components/select-new/components/Group.svelte +24 -0
- package/dist/components/select-new/components/Group.svelte.d.ts +11 -0
- package/dist/components/select-new/components/MultiSelectTrigger.svelte +66 -0
- package/dist/components/select-new/components/MultiSelectTrigger.svelte.d.ts +17 -0
- package/dist/components/select-new/components/SelectContent.svelte +33 -0
- package/dist/components/select-new/components/SelectContent.svelte.d.ts +10 -0
- package/dist/components/select-new/components/SelectGroupHeading.svelte +19 -0
- package/dist/components/select-new/components/SelectGroupHeading.svelte.d.ts +9 -0
- package/dist/components/select-new/components/SelectItem.svelte +41 -0
- package/dist/components/select-new/components/SelectItem.svelte.d.ts +9 -0
- package/dist/components/select-new/components/SelectTrigger.svelte +48 -0
- package/dist/components/select-new/components/SelectTrigger.svelte.d.ts +12 -0
- package/dist/components/select-new/index.d.ts +10 -0
- package/dist/components/select-new/index.js +12 -0
- package/dist/components/select-new/types.d.ts +25 -0
- package/dist/components/select-new/types.js +1 -0
- package/dist/components/sjsf-wrappers/SjsfNumberInputWrapper.svelte +92 -0
- package/dist/components/sjsf-wrappers/SjsfNumberInputWrapper.svelte.d.ts +3 -0
- package/dist/components/sjsf-wrappers/SjsfTextInputWrapper.svelte +65 -0
- package/dist/components/sjsf-wrappers/SjsfTextInputWrapper.svelte.d.ts +3 -0
- package/dist/components/sjsf-wrappers/index.d.ts +2 -0
- package/dist/components/sjsf-wrappers/index.js +2 -0
- package/dist/components/sjsf-wrappers/sjsfCustomTheme.d.ts +2 -0
- package/dist/components/sjsf-wrappers/sjsfCustomTheme.js +8 -0
- package/dist/components/skeleton-loader/SkeletonLoader.stories.svelte +4 -4
- package/dist/components/slider/Slider.stories.svelte +4 -4
- package/dist/components/spinner/Spinner.stories.svelte +13 -0
- package/dist/components/spinner/Spinner.stories.svelte.d.ts +19 -0
- package/dist/components/stat-card/StatCard.stories.svelte +27 -19
- package/dist/components/stat-card/StatCard.svelte +100 -6
- package/dist/components/stat-card/StatCard.svelte.d.ts +3 -0
- package/dist/components/status-badge/StatusBadge.stories.svelte +6 -6
- package/dist/components/status-badge/StatusBadge.svelte +5 -3
- package/dist/components/stepper/Stepper.stories.svelte +243 -0
- package/dist/components/stepper/Stepper.stories.svelte.d.ts +19 -0
- package/dist/components/stepper/components/stepper-root.svelte +20 -0
- package/dist/components/stepper/components/stepper-root.svelte.d.ts +9 -0
- package/dist/components/stepper/components/stepper-step.svelte +100 -0
- package/dist/components/stepper/components/stepper-step.svelte.d.ts +11 -0
- package/dist/components/stepper/index.d.ts +15 -0
- package/dist/components/stepper/index.js +2 -0
- package/dist/components/table/Table.stories.svelte +1 -1
- package/dist/components/table/components/Td.svelte +3 -2
- package/dist/components/table/components/Td.svelte.d.ts +1 -0
- package/dist/components/table/components/Tr.svelte +3 -2
- package/dist/components/table/components/Tr.svelte.d.ts +1 -0
- package/dist/components/tabs/Tabs.stories.svelte +1 -1
- package/dist/components/tag/Tag.stories.svelte +9 -9
- package/dist/components/tag/Tag.svelte +0 -18
- package/dist/components/textarea/Textarea.stories.svelte +97 -0
- package/dist/components/textarea/Textarea.stories.svelte.d.ts +19 -0
- package/dist/components/textarea/Textarea.svelte +94 -0
- package/dist/components/textarea/Textarea.svelte.d.ts +17 -0
- package/dist/components/textarea/index.d.ts +1 -0
- package/dist/components/textarea/index.js +1 -0
- package/dist/components/toggle/Toggle.stories.svelte +1 -1
- package/dist/components/toggle/Toggle.svelte +3 -2
- package/dist/components/toggle/Toggle.svelte.d.ts +1 -0
- package/dist/components/toggle-icon-button/ToggleIconButton.stories.svelte +6 -6
- package/dist/components/tooltip/Tooltip.stories.svelte +6 -6
- package/dist/components/tooltip/Tooltip.svelte +1 -1
- package/dist/index.d.ts +7 -0
- package/dist/index.js +7 -0
- package/dist/tailwind.preset.d.ts +5 -0
- package/dist/tokens.d.ts +10 -0
- package/dist/tokens.js +6 -4
- package/package.json +1 -2
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
import type { GroupProps as PrimitiveGroupProps } from '../types';
|
|
3
|
+
interface Props extends PrimitiveGroupProps {
|
|
4
|
+
label?: string;
|
|
5
|
+
children: Snippet;
|
|
6
|
+
class?: string;
|
|
7
|
+
contentClass?: string;
|
|
8
|
+
}
|
|
9
|
+
declare const Group: import("svelte").Component<Props, {}, "">;
|
|
10
|
+
type Group = ReturnType<typeof Group>;
|
|
11
|
+
export default Group;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import * as Select from '../index';
|
|
3
|
+
import { Icon, type IconName } from '../../icons';
|
|
4
|
+
import IconButton from '../../icon-button/IconButton.svelte';
|
|
5
|
+
|
|
6
|
+
type ItemType = {
|
|
7
|
+
value: string;
|
|
8
|
+
label: string;
|
|
9
|
+
iconName?: IconName | string;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
interface Props {
|
|
13
|
+
selectedValues: string[];
|
|
14
|
+
items: ItemType[];
|
|
15
|
+
onRemoveItem: (itemValue: string) => void;
|
|
16
|
+
placeholder?: string;
|
|
17
|
+
class?: string;
|
|
18
|
+
[key: string]: any;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
let {
|
|
22
|
+
selectedValues,
|
|
23
|
+
items,
|
|
24
|
+
onRemoveItem,
|
|
25
|
+
placeholder = 'Select items...',
|
|
26
|
+
class: className,
|
|
27
|
+
...restProps
|
|
28
|
+
}: Props = $props();
|
|
29
|
+
</script>
|
|
30
|
+
|
|
31
|
+
<Select.Trigger
|
|
32
|
+
class={'bg-background ring-offset-background placeholder:text-muted-foreground focus:ring-ring flex h-10 w-full items-center justify-between rounded-md border border-input px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50' +
|
|
33
|
+
(className || '')}
|
|
34
|
+
{...restProps}
|
|
35
|
+
>
|
|
36
|
+
{#if selectedValues.length === 0}
|
|
37
|
+
<span class="flex-grow px-2 text-tertiary">{placeholder}</span>
|
|
38
|
+
{:else}
|
|
39
|
+
<div class="flex flex-grow flex-wrap items-center gap-1">
|
|
40
|
+
{#each selectedValues as selectedVal (selectedVal)}
|
|
41
|
+
{@const item = items.find((i) => i.value === selectedVal)}
|
|
42
|
+
{#if item}
|
|
43
|
+
<div
|
|
44
|
+
class="flex w-fit items-center gap-1 rounded-sm bg-neutral px-1 py-0.5 text-sm"
|
|
45
|
+
aria-label={`Selected item ${item.label}`}
|
|
46
|
+
>
|
|
47
|
+
{#if item.iconName}
|
|
48
|
+
<Icon iconName={item.iconName as IconName} />
|
|
49
|
+
{/if}
|
|
50
|
+
<span>{item.label}</span>
|
|
51
|
+
<IconButton
|
|
52
|
+
type="button"
|
|
53
|
+
aria-label={`Remove ${item.label}`}
|
|
54
|
+
onclick={() => onRemoveItem(item.value)}
|
|
55
|
+
size="xs"
|
|
56
|
+
variant="transparent"
|
|
57
|
+
class="text-primary focus:outline-none"
|
|
58
|
+
>
|
|
59
|
+
<Icon iconName="X" />
|
|
60
|
+
</IconButton>
|
|
61
|
+
</div>
|
|
62
|
+
{/if}
|
|
63
|
+
{/each}
|
|
64
|
+
</div>
|
|
65
|
+
{/if}
|
|
66
|
+
</Select.Trigger>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type IconName } from '../../icons';
|
|
2
|
+
type ItemType = {
|
|
3
|
+
value: string;
|
|
4
|
+
label: string;
|
|
5
|
+
iconName?: IconName | string;
|
|
6
|
+
};
|
|
7
|
+
interface Props {
|
|
8
|
+
selectedValues: string[];
|
|
9
|
+
items: ItemType[];
|
|
10
|
+
onRemoveItem: (itemValue: string) => void;
|
|
11
|
+
placeholder?: string;
|
|
12
|
+
class?: string;
|
|
13
|
+
[key: string]: any;
|
|
14
|
+
}
|
|
15
|
+
declare const MultiSelectTrigger: import("svelte").Component<Props, {}, "">;
|
|
16
|
+
type MultiSelectTrigger = ReturnType<typeof MultiSelectTrigger>;
|
|
17
|
+
export default MultiSelectTrigger;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { Select as SelectPrimitive } from 'bits-ui';
|
|
3
|
+
import type { ContentProps } from '../types';
|
|
4
|
+
|
|
5
|
+
import type { Snippet } from 'svelte';
|
|
6
|
+
import Icon from '../../icons/Icon.svelte';
|
|
7
|
+
|
|
8
|
+
interface Props extends ContentProps {
|
|
9
|
+
children: Snippet;
|
|
10
|
+
class?: string;
|
|
11
|
+
sideOffset?: number;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
let { class: className = '', sideOffset = 4, children, ...restProps }: Props = $props();
|
|
15
|
+
|
|
16
|
+
const baseClasses = `
|
|
17
|
+
w-[var(--bits-select-anchor-width)] relative z-50 min-w-[8rem] overflow-hidden rounded-md border bg-surface text-surface-foreground shadow-md
|
|
18
|
+
`;
|
|
19
|
+
</script>
|
|
20
|
+
|
|
21
|
+
<SelectPrimitive.Portal>
|
|
22
|
+
<SelectPrimitive.Content {...restProps} {sideOffset} class={baseClasses + ' ' + className}>
|
|
23
|
+
<SelectPrimitive.ScrollUpButton class="flex justify-center">
|
|
24
|
+
<Icon iconName="CaretUp" />
|
|
25
|
+
</SelectPrimitive.ScrollUpButton>
|
|
26
|
+
<SelectPrimitive.Viewport class="p-1 ">
|
|
27
|
+
{@render children()}
|
|
28
|
+
</SelectPrimitive.Viewport>
|
|
29
|
+
<SelectPrimitive.ScrollDownButton class="flex justify-center">
|
|
30
|
+
<Icon iconName="CaretDown" />
|
|
31
|
+
</SelectPrimitive.ScrollDownButton>
|
|
32
|
+
</SelectPrimitive.Content>
|
|
33
|
+
</SelectPrimitive.Portal>
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ContentProps } from '../types';
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
interface Props extends ContentProps {
|
|
4
|
+
children: Snippet;
|
|
5
|
+
class?: string;
|
|
6
|
+
sideOffset?: number;
|
|
7
|
+
}
|
|
8
|
+
declare const SelectContent: import("svelte").Component<Props, {}, "">;
|
|
9
|
+
type SelectContent = ReturnType<typeof SelectContent>;
|
|
10
|
+
export default SelectContent;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { Select as SelectPrimitive } from 'bits-ui';
|
|
3
|
+
import type { GroupHeadingProps } from '../types';
|
|
4
|
+
|
|
5
|
+
import type { Snippet } from 'svelte';
|
|
6
|
+
|
|
7
|
+
interface Props extends GroupHeadingProps {
|
|
8
|
+
children: Snippet;
|
|
9
|
+
class?: string;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
let { class: className = '', children, ...restProps }: Props = $props();
|
|
13
|
+
|
|
14
|
+
const baseClasses = 'py-1.5 pl-2 pr-2 text-sm font-semibold text-muted-foreground';
|
|
15
|
+
</script>
|
|
16
|
+
|
|
17
|
+
<SelectPrimitive.GroupHeading {...restProps} class="{baseClasses} {className}">
|
|
18
|
+
{@render children()}
|
|
19
|
+
</SelectPrimitive.GroupHeading>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { GroupHeadingProps } from '../types';
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
interface Props extends GroupHeadingProps {
|
|
4
|
+
children: Snippet;
|
|
5
|
+
class?: string;
|
|
6
|
+
}
|
|
7
|
+
declare const SelectGroupHeading: import("svelte").Component<Props, {}, "">;
|
|
8
|
+
type SelectGroupHeading = ReturnType<typeof SelectGroupHeading>;
|
|
9
|
+
export default SelectGroupHeading;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { Select as SelectPrimitive } from 'bits-ui';
|
|
3
|
+
import type { ItemProps, ItemSlotProps } from '../types';
|
|
4
|
+
|
|
5
|
+
import type { Snippet } from 'svelte';
|
|
6
|
+
import Check from 'phosphor-svelte/lib/Check';
|
|
7
|
+
|
|
8
|
+
interface Props extends ItemProps {
|
|
9
|
+
children?: Snippet<[ItemSlotProps]>;
|
|
10
|
+
class?: string;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
let { class: className = '', children, ...restProps }: Props = $props();
|
|
14
|
+
|
|
15
|
+
const baseClasses = `
|
|
16
|
+
relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none
|
|
17
|
+
focus:bg-accent focus:text-accent-foreground
|
|
18
|
+
data-[disabled]:pointer-events-none data-[disabled]:opacity-50
|
|
19
|
+
data-[highlighted]:bg-accent data-[highlighted]:text-accent-foreground
|
|
20
|
+
`;
|
|
21
|
+
</script>
|
|
22
|
+
|
|
23
|
+
<SelectPrimitive.Item {...restProps} class={baseClasses + ' ' + className}>
|
|
24
|
+
{#snippet children(params: ItemSlotProps)}
|
|
25
|
+
{#if children}
|
|
26
|
+
{@render children(params)}
|
|
27
|
+
{:else}
|
|
28
|
+
<span>
|
|
29
|
+
{restProps.label ??
|
|
30
|
+
(typeof restProps.value === 'string' || typeof restProps.value === 'number'
|
|
31
|
+
? restProps.value
|
|
32
|
+
: 'Item')}</span
|
|
33
|
+
>
|
|
34
|
+
{/if}
|
|
35
|
+
{#if params.selected}
|
|
36
|
+
<span class="absolute right-2 flex h-3.5 w-3.5 items-center justify-center">
|
|
37
|
+
<Check class="h-4 w-4" />
|
|
38
|
+
</span>
|
|
39
|
+
{/if}
|
|
40
|
+
{/snippet}
|
|
41
|
+
</SelectPrimitive.Item>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ItemProps, ItemSlotProps } from '../types';
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
interface Props extends ItemProps {
|
|
4
|
+
children?: Snippet<[ItemSlotProps]>;
|
|
5
|
+
class?: string;
|
|
6
|
+
}
|
|
7
|
+
declare const SelectItem: import("svelte").Component<Props, {}, "">;
|
|
8
|
+
type SelectItem = ReturnType<typeof SelectItem>;
|
|
9
|
+
export default SelectItem;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { Select as SelectPrimitive } from 'bits-ui';
|
|
3
|
+
import type { TriggerProps, IconSnippet } from '../types';
|
|
4
|
+
|
|
5
|
+
import type { Snippet } from 'svelte';
|
|
6
|
+
import { Icon } from '../../icons';
|
|
7
|
+
|
|
8
|
+
interface Props extends TriggerProps {
|
|
9
|
+
TriggerIcon?: IconSnippet;
|
|
10
|
+
children?: Snippet;
|
|
11
|
+
class?: string;
|
|
12
|
+
placeholder?: string;
|
|
13
|
+
displayValue?: string;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
let {
|
|
17
|
+
class: className = '',
|
|
18
|
+
TriggerIcon = undefined,
|
|
19
|
+
children,
|
|
20
|
+
placeholder = 'Select an option',
|
|
21
|
+
displayValue = undefined,
|
|
22
|
+
...restProps
|
|
23
|
+
}: Props = $props();
|
|
24
|
+
|
|
25
|
+
const baseClasses =
|
|
26
|
+
'flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50';
|
|
27
|
+
</script>
|
|
28
|
+
|
|
29
|
+
<SelectPrimitive.Trigger
|
|
30
|
+
{...restProps}
|
|
31
|
+
class={baseClasses + ' ' + className}
|
|
32
|
+
aria-label={placeholder}
|
|
33
|
+
>
|
|
34
|
+
<div class="flex-1 truncate text-left">
|
|
35
|
+
{#if children}
|
|
36
|
+
{@render children()}
|
|
37
|
+
{:else if displayValue !== undefined}
|
|
38
|
+
{displayValue}
|
|
39
|
+
{:else}
|
|
40
|
+
<span class="text-tertiary">{placeholder}</span>
|
|
41
|
+
{/if}
|
|
42
|
+
</div>
|
|
43
|
+
{#if TriggerIcon}
|
|
44
|
+
{@render TriggerIcon()}
|
|
45
|
+
{:else}
|
|
46
|
+
<Icon iconName="CaretDown" class="ml-2 h-4 w-4 shrink-0 opacity-50" />
|
|
47
|
+
{/if}
|
|
48
|
+
</SelectPrimitive.Trigger>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { TriggerProps, IconSnippet } from '../types';
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
interface Props extends TriggerProps {
|
|
4
|
+
TriggerIcon?: IconSnippet;
|
|
5
|
+
children?: Snippet;
|
|
6
|
+
class?: string;
|
|
7
|
+
placeholder?: string;
|
|
8
|
+
displayValue?: string;
|
|
9
|
+
}
|
|
10
|
+
declare const SelectTrigger: import("svelte").Component<Props, {}, "">;
|
|
11
|
+
type SelectTrigger = ReturnType<typeof SelectTrigger>;
|
|
12
|
+
export default SelectTrigger;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import Content from './components/SelectContent.svelte';
|
|
2
|
+
import Item from './components/SelectItem.svelte';
|
|
3
|
+
import GroupHeading from './components/SelectGroupHeading.svelte';
|
|
4
|
+
import Trigger from './components/SelectTrigger.svelte';
|
|
5
|
+
import MultiSelectTrigger from './components/MultiSelectTrigger.svelte';
|
|
6
|
+
import Group from './components/Group.svelte';
|
|
7
|
+
export declare const Root: import("svelte").Component<import("bits-ui").ComboboxRootPropsWithoutHTML, {}, "open" | "value">;
|
|
8
|
+
export declare const Portal: import("svelte").Component<import("bits-ui").PortalProps, {}, "">;
|
|
9
|
+
export { Content, Item, Group, GroupHeading, Trigger, MultiSelectTrigger };
|
|
10
|
+
export * from './types';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Select as SelectPrimitive } from 'bits-ui';
|
|
2
|
+
// Custom Svelte components
|
|
3
|
+
import Content from './components/SelectContent.svelte';
|
|
4
|
+
import Item from './components/SelectItem.svelte';
|
|
5
|
+
import GroupHeading from './components/SelectGroupHeading.svelte';
|
|
6
|
+
import Trigger from './components/SelectTrigger.svelte';
|
|
7
|
+
import MultiSelectTrigger from './components/MultiSelectTrigger.svelte';
|
|
8
|
+
import Group from './components/Group.svelte';
|
|
9
|
+
export const Root = SelectPrimitive.Root;
|
|
10
|
+
export const Portal = SelectPrimitive.Portal;
|
|
11
|
+
export { Content, Item, Group, GroupHeading, Trigger, MultiSelectTrigger };
|
|
12
|
+
export * from './types';
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Select as SelectPrimitive } from 'bits-ui';
|
|
2
|
+
import type { HTMLAttributes, HTMLButtonAttributes } from 'svelte/elements';
|
|
3
|
+
import type { Snippet } from 'svelte';
|
|
4
|
+
export type Props = SelectPrimitive.RootProps;
|
|
5
|
+
export type TriggerProps = SelectPrimitive.TriggerProps;
|
|
6
|
+
export type TriggerAttributes = HTMLButtonAttributes;
|
|
7
|
+
export type ContentProps = SelectPrimitive.ContentProps;
|
|
8
|
+
export type ContentAttributes = HTMLAttributes<HTMLElement>;
|
|
9
|
+
export type ItemProps = SelectPrimitive.ItemProps;
|
|
10
|
+
export type ItemAttributes = HTMLAttributes<HTMLElement>;
|
|
11
|
+
export type GroupProps = SelectPrimitive.GroupProps;
|
|
12
|
+
export type GroupAttributes = HTMLAttributes<HTMLElement>;
|
|
13
|
+
export type GroupHeadingProps = SelectPrimitive.GroupHeadingProps;
|
|
14
|
+
export type GroupHeadingAttributes = HTMLAttributes<HTMLElement>;
|
|
15
|
+
export type Option = {
|
|
16
|
+
value: string | number;
|
|
17
|
+
label: string;
|
|
18
|
+
disabled?: boolean;
|
|
19
|
+
[key: string]: unknown;
|
|
20
|
+
};
|
|
21
|
+
export type ItemSlotProps = {
|
|
22
|
+
selected: boolean;
|
|
23
|
+
highlighted: boolean;
|
|
24
|
+
};
|
|
25
|
+
export type IconSnippet = Snippet;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import { Select as SelectPrimitive } from 'bits-ui';
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { ComponentProps } from '@sjsf/form';
|
|
3
|
+
import { getFormContext, inputAttributes } from '@sjsf/form';
|
|
4
|
+
import Input from '../input/Input.svelte';
|
|
5
|
+
import type { FocusEventHandler } from 'svelte/elements';
|
|
6
|
+
|
|
7
|
+
type Props = ComponentProps['numberWidget'];
|
|
8
|
+
|
|
9
|
+
let { value = $bindable(), config, handlers, errors }: Props = $props();
|
|
10
|
+
|
|
11
|
+
const ctx = getFormContext();
|
|
12
|
+
|
|
13
|
+
const derivedAttrs = $derived(
|
|
14
|
+
inputAttributes(ctx, config, 'number', handlers, {
|
|
15
|
+
type: 'number'
|
|
16
|
+
})
|
|
17
|
+
);
|
|
18
|
+
const placeholder = $derived(
|
|
19
|
+
config?.uiSchema?.['ui:placeholder'] ||
|
|
20
|
+
config?.schema?.description ||
|
|
21
|
+
(Array.isArray(config?.schema?.examples) && config.schema.examples.length > 0
|
|
22
|
+
? String(config.schema.examples[0]) // Ensure the example is also a string
|
|
23
|
+
: '') ||
|
|
24
|
+
''
|
|
25
|
+
);
|
|
26
|
+
|
|
27
|
+
const readonly = $derived(config?.schema?.readOnly ?? false);
|
|
28
|
+
const currentClass = $derived(derivedAttrs?.class ?? 'w-full');
|
|
29
|
+
|
|
30
|
+
const onBlurHandler = $derived(
|
|
31
|
+
derivedAttrs.onblur
|
|
32
|
+
? (event: FocusEvent) =>
|
|
33
|
+
(derivedAttrs.onblur as FocusEventHandler<HTMLInputElement>)(event as any)
|
|
34
|
+
: undefined
|
|
35
|
+
);
|
|
36
|
+
|
|
37
|
+
const onChangeHandler = $derived(
|
|
38
|
+
derivedAttrs.onchange
|
|
39
|
+
? (event: Event) =>
|
|
40
|
+
(derivedAttrs.onchange as FocusEventHandler<HTMLInputElement>)(event as any)
|
|
41
|
+
: undefined
|
|
42
|
+
);
|
|
43
|
+
|
|
44
|
+
const onInputHandler = $derived(
|
|
45
|
+
derivedAttrs.oninput
|
|
46
|
+
? (event: Event) =>
|
|
47
|
+
(derivedAttrs.oninput as FocusEventHandler<HTMLInputElement>)(event as any)
|
|
48
|
+
: undefined
|
|
49
|
+
);
|
|
50
|
+
|
|
51
|
+
const getStringValue = () => {
|
|
52
|
+
if (value === undefined || value === null || isNaN(value)) {
|
|
53
|
+
return '';
|
|
54
|
+
}
|
|
55
|
+
return String(value);
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
const setNumericValue = (newValueFromInput: unknown) => {
|
|
59
|
+
const stringifiedInput =
|
|
60
|
+
newValueFromInput === null || newValueFromInput === undefined
|
|
61
|
+
? ''
|
|
62
|
+
: String(newValueFromInput);
|
|
63
|
+
|
|
64
|
+
if (stringifiedInput.trim() === '') {
|
|
65
|
+
value = undefined;
|
|
66
|
+
} else {
|
|
67
|
+
const num = parseFloat(stringifiedInput);
|
|
68
|
+
value = isNaN(num) ? undefined : num;
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
</script>
|
|
72
|
+
|
|
73
|
+
<Input
|
|
74
|
+
bind:value={() => getStringValue(), (v) => setNumericValue(v)}
|
|
75
|
+
placeholder={String(placeholder)}
|
|
76
|
+
type={'number'}
|
|
77
|
+
{readonly}
|
|
78
|
+
id={String(derivedAttrs.id)}
|
|
79
|
+
name={String(derivedAttrs.name)}
|
|
80
|
+
disabled={derivedAttrs.disabled}
|
|
81
|
+
required={derivedAttrs.required}
|
|
82
|
+
step={config?.schema?.multipleOf ?? (config?.schema?.type === 'integer' ? 1 : 'any')}
|
|
83
|
+
min={config?.schema?.minimum ?? config?.schema?.exclusiveMinimum}
|
|
84
|
+
max={config?.schema?.maximum ?? config?.schema?.exclusiveMaximum}
|
|
85
|
+
aria-invalid={errors && errors.length > 0 ? true : undefined}
|
|
86
|
+
aria-describedby={errors && errors.length > 0 ? `${String(derivedAttrs.id)}-errors` : undefined}
|
|
87
|
+
class={String(currentClass)}
|
|
88
|
+
autocomplete="off"
|
|
89
|
+
oninput={onInputHandler}
|
|
90
|
+
onchange={onChangeHandler}
|
|
91
|
+
onblur={onBlurHandler}
|
|
92
|
+
/>
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { ComponentProps } from '@sjsf/form';
|
|
3
|
+
import { getFormContext, inputAttributes } from '@sjsf/form';
|
|
4
|
+
import Input from '../input/Input.svelte';
|
|
5
|
+
import type { FormEventHandler, FocusEventHandler } from 'svelte/elements';
|
|
6
|
+
|
|
7
|
+
type Props = ComponentProps['textWidget'];
|
|
8
|
+
|
|
9
|
+
let { value = $bindable(), config, handlers, errors }: Props = $props();
|
|
10
|
+
|
|
11
|
+
const ctx = getFormContext();
|
|
12
|
+
|
|
13
|
+
const derivedAttrs = $derived(
|
|
14
|
+
inputAttributes(ctx, config, 'text', handlers, {
|
|
15
|
+
type: 'text'
|
|
16
|
+
})
|
|
17
|
+
);
|
|
18
|
+
|
|
19
|
+
const placeholder = $derived(
|
|
20
|
+
config?.uiSchema?.['ui:placeholder'] ||
|
|
21
|
+
config?.schema?.description ||
|
|
22
|
+
(Array.isArray(config?.schema?.examples) && config.schema.examples.length > 0
|
|
23
|
+
? String(config.schema.examples[0])
|
|
24
|
+
: '') ||
|
|
25
|
+
''
|
|
26
|
+
);
|
|
27
|
+
|
|
28
|
+
const readonly = $derived(config?.schema?.readOnly ?? false);
|
|
29
|
+
const currentClass = $derived(derivedAttrs?.class ?? 'w-full');
|
|
30
|
+
|
|
31
|
+
const onInput = $derived(
|
|
32
|
+
derivedAttrs.oninput
|
|
33
|
+
? (event: Event) => (derivedAttrs.oninput as FormEventHandler<HTMLInputElement>)(event as any)
|
|
34
|
+
: undefined
|
|
35
|
+
);
|
|
36
|
+
const onChange = $derived(
|
|
37
|
+
derivedAttrs.onchange
|
|
38
|
+
? (event: Event) =>
|
|
39
|
+
(derivedAttrs.onchange as FormEventHandler<HTMLInputElement>)(event as any)
|
|
40
|
+
: undefined
|
|
41
|
+
);
|
|
42
|
+
const onBlur = $derived(
|
|
43
|
+
derivedAttrs.onblur
|
|
44
|
+
? (event: FocusEvent) =>
|
|
45
|
+
(derivedAttrs.onblur as FocusEventHandler<HTMLInputElement>)(event as any)
|
|
46
|
+
: undefined
|
|
47
|
+
);
|
|
48
|
+
</script>
|
|
49
|
+
|
|
50
|
+
<Input
|
|
51
|
+
bind:value
|
|
52
|
+
placeholder={String(placeholder)}
|
|
53
|
+
type="text"
|
|
54
|
+
{readonly}
|
|
55
|
+
id={String(derivedAttrs.id)}
|
|
56
|
+
name={String(derivedAttrs.name)}
|
|
57
|
+
disabled={derivedAttrs.disabled}
|
|
58
|
+
required={derivedAttrs.required}
|
|
59
|
+
oninput={onInput}
|
|
60
|
+
onchange={onChange}
|
|
61
|
+
onblur={onBlur}
|
|
62
|
+
aria-invalid={errors && errors.length > 0 ? true : undefined}
|
|
63
|
+
aria-describedby={errors && errors.length > 0 ? `${String(derivedAttrs.id)}-errors` : undefined}
|
|
64
|
+
class={String(currentClass)}
|
|
65
|
+
/>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { theme as BasicTheme } from '@sjsf/basic-theme';
|
|
2
|
+
import { overrideByRecord } from '@sjsf/form/lib/resolver';
|
|
3
|
+
import SjsfNumberInputWrapper from './SjsfNumberInputWrapper.svelte';
|
|
4
|
+
import SjsfTextInputWrapper from './SjsfTextInputWrapper.svelte';
|
|
5
|
+
export const sjsfCustomTheme = overrideByRecord(BasicTheme, {
|
|
6
|
+
numberWidget: SjsfNumberInputWrapper,
|
|
7
|
+
textWidget: SjsfTextInputWrapper
|
|
8
|
+
});
|
|
@@ -10,15 +10,15 @@
|
|
|
10
10
|
});
|
|
11
11
|
</script>
|
|
12
12
|
|
|
13
|
-
<Story name="Primary">
|
|
14
|
-
<SkeletonLoader class="h-[
|
|
13
|
+
<Story name="Primary" asChild>
|
|
14
|
+
<SkeletonLoader class="h-[50px] w-[200px]">
|
|
15
15
|
{#snippet children({ Skeleton })}
|
|
16
16
|
<Skeleton class="h-full w-full" />
|
|
17
17
|
{/snippet}
|
|
18
18
|
</SkeletonLoader>
|
|
19
19
|
</Story>
|
|
20
20
|
|
|
21
|
-
<Story name="ImagePlaceholder">
|
|
21
|
+
<Story name="ImagePlaceholder" asChild>
|
|
22
22
|
<SkeletonLoader class="h-[100px] w-[500px]">
|
|
23
23
|
{#snippet children({ Skeleton, SkeletonImage })}
|
|
24
24
|
<div class="flex h-full gap-2">
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
</SkeletonLoader>
|
|
37
37
|
</Story>
|
|
38
38
|
|
|
39
|
-
<Story name="StatCard">
|
|
39
|
+
<Story name="StatCard" asChild>
|
|
40
40
|
<div class="flex w-[900px] gap-4">
|
|
41
41
|
<StatcardSkeleton />
|
|
42
42
|
<StatcardSkeleton />
|
|
@@ -12,19 +12,19 @@
|
|
|
12
12
|
let value = 3;
|
|
13
13
|
</script>
|
|
14
14
|
|
|
15
|
-
<Story name="Default">
|
|
15
|
+
<Story name="Default" asChild>
|
|
16
16
|
Value: {value + 1}
|
|
17
17
|
<Slider bind:value bind:buffer={value} max={4}></Slider>
|
|
18
18
|
</Story>
|
|
19
|
-
<Story name="Playback Controls Running Job">
|
|
19
|
+
<Story name="Playback Controls Running Job" asChild>
|
|
20
20
|
Value: {value + 1}
|
|
21
21
|
<Slider bind:value buffer={35} max={49} bufferColorClass="bg-warning-inverse"></Slider>
|
|
22
22
|
</Story>
|
|
23
|
-
<Story name="Modern stepStyle">
|
|
23
|
+
<Story name="Modern stepStyle" asChild>
|
|
24
24
|
Value: {value + 1}
|
|
25
25
|
<Slider bind:value bind:buffer={value} max={4} showSteps={true}></Slider>
|
|
26
26
|
</Story>
|
|
27
|
-
<Story name="Create Job Capture Interval">
|
|
27
|
+
<Story name="Create Job Capture Interval" asChild>
|
|
28
28
|
Value: {value + 1}
|
|
29
29
|
<Slider
|
|
30
30
|
bind:value
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<script lang="ts" module>
|
|
2
|
+
import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
3
|
+
import Spinner from './Spinner.svelte';
|
|
4
|
+
|
|
5
|
+
// More on how to set up stories at: https://storybook.js.org/docs/writing-stories
|
|
6
|
+
const { Story } = defineMeta({
|
|
7
|
+
title: 'Design System/Spinner',
|
|
8
|
+
component: Spinner,
|
|
9
|
+
tags: ['autodocs']
|
|
10
|
+
});
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
<Story name="Base" />
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import Spinner from './Spinner.svelte';
|
|
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 Spinner: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
|
|
16
|
+
[evt: string]: CustomEvent<any>;
|
|
17
|
+
}, {}, {}, string>;
|
|
18
|
+
type Spinner = InstanceType<typeof Spinner>;
|
|
19
|
+
export default Spinner;
|