@reshape-biotech/design-system 2.5.4 → 2.6.1
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/card/Card.svelte +7 -3
- package/dist/components/collapsible/components/collapsible-trigger.svelte +1 -1
- package/dist/components/empty-content/EmptyContent.svelte +2 -2
- package/dist/components/icon-button/IconButton.svelte +4 -4
- package/dist/components/icons/index.d.ts +1 -1
- package/dist/components/icons/index.js +2 -0
- package/dist/components/input/Input.stories.svelte +24 -4
- package/dist/components/input/Input.stories.svelte.d.ts +6 -14
- package/dist/components/input/Input.svelte +72 -12
- package/dist/components/input/Input.svelte.d.ts +3 -1
- package/dist/components/select/components/MultiSelectTrigger.svelte +3 -3
- package/dist/components/select/components/SelectContent.svelte +2 -2
- package/dist/components/select/components/SelectItem.svelte +1 -1
- package/dist/components/select/components/SelectTrigger.svelte +1 -1
- package/dist/components/slider/Slider.svelte +1 -0
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -1
- package/package.json +1 -7
- package/dist/components/sjsf-wrappers/SjsfNumberInputWrapper.svelte +0 -107
- package/dist/components/sjsf-wrappers/SjsfNumberInputWrapper.svelte.d.ts +0 -3
- package/dist/components/sjsf-wrappers/SjsfSelectWidgetWrapper.svelte +0 -77
- package/dist/components/sjsf-wrappers/SjsfSelectWidgetWrapper.svelte.d.ts +0 -3
- package/dist/components/sjsf-wrappers/SjsfTextInputWrapper.svelte +0 -65
- package/dist/components/sjsf-wrappers/SjsfTextInputWrapper.svelte.d.ts +0 -3
- package/dist/components/sjsf-wrappers/index.d.ts +0 -2
- package/dist/components/sjsf-wrappers/index.js +0 -2
- package/dist/components/sjsf-wrappers/sjsfCustomTheme.d.ts +0 -2
- package/dist/components/sjsf-wrappers/sjsfCustomTheme.js +0 -12
|
@@ -11,14 +11,18 @@
|
|
|
11
11
|
const { Header, children, headerBorder = false, class: additionalClasses = '' }: Props = $props();
|
|
12
12
|
</script>
|
|
13
13
|
|
|
14
|
-
<div class="rounded-
|
|
14
|
+
<div class="rounded-xl border border-static bg-surface shadow-container {additionalClasses}">
|
|
15
15
|
{#if Header}
|
|
16
|
-
<header
|
|
16
|
+
<header
|
|
17
|
+
class="flex h-12 items-center px-4"
|
|
18
|
+
class:border-b={headerBorder}
|
|
19
|
+
class:border-static={headerBorder}
|
|
20
|
+
>
|
|
17
21
|
{@render Header()}
|
|
18
22
|
</header>
|
|
19
23
|
{/if}
|
|
20
24
|
{#if children}
|
|
21
|
-
<div class="p-
|
|
25
|
+
<div class="p-4 pb-5">
|
|
22
26
|
{@render children()}
|
|
23
27
|
</div>
|
|
24
28
|
{/if}
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
<div class="container h-8">
|
|
11
11
|
{@render children()}
|
|
12
12
|
{#if withIcon}
|
|
13
|
-
<Icon iconName="CaretDown" color="secondary" class="icon
|
|
13
|
+
<Icon iconName="CaretDown" color="secondary" class="icon m-1" />
|
|
14
14
|
{/if}
|
|
15
15
|
</div>
|
|
16
16
|
</Collapsible.Trigger>
|
|
@@ -10,9 +10,9 @@
|
|
|
10
10
|
</script>
|
|
11
11
|
|
|
12
12
|
<div class="flex w-full justify-center">
|
|
13
|
-
<div class="flex max-w-
|
|
13
|
+
<div class="flex max-w-96 flex-col items-center justify-center gap-5 py-5 text-tertiary">
|
|
14
14
|
{@render icon()}
|
|
15
|
-
<div class="flex w-full flex-col items-center justify-center gap-2">
|
|
15
|
+
<div class="flex w-full flex-col items-center justify-center gap-2 text-center">
|
|
16
16
|
{@render children()}
|
|
17
17
|
</div>
|
|
18
18
|
</div>
|
|
@@ -118,8 +118,8 @@
|
|
|
118
118
|
height: 2.5rem
|
|
119
119
|
}
|
|
120
120
|
.size-md :global(svg) {
|
|
121
|
-
width:
|
|
122
|
-
height:
|
|
121
|
+
width: 1rem;
|
|
122
|
+
height: 1rem
|
|
123
123
|
}
|
|
124
124
|
|
|
125
125
|
.size-lg {
|
|
@@ -128,8 +128,8 @@
|
|
|
128
128
|
}
|
|
129
129
|
|
|
130
130
|
.size-lg :global(svg) {
|
|
131
|
-
width: 1.
|
|
132
|
-
height: 1.
|
|
131
|
+
width: 1.25rem;
|
|
132
|
+
height: 1.25rem
|
|
133
133
|
}
|
|
134
134
|
|
|
135
135
|
.color-outline {
|
|
@@ -4,7 +4,7 @@ import type { textColor, backgroundColor } from './../../tokens';
|
|
|
4
4
|
export * from './custom';
|
|
5
5
|
import type { CustomIconName } from './custom';
|
|
6
6
|
export type PhosphorIconProps = Component<IconComponentProps, object, ''>;
|
|
7
|
-
export type IconName = 'Aperture' | 'Archive' | 'ArrowFatLineRight' | 'ArrowCounterClockwise' | 'ArrowRight' | 'ArrowUpRight' | 'ArrowUpLeft' | 'ArrowUUpLeft' | 'Barcode' | 'Bell' | 'BookOpen' | 'BookOpenText' | 'BowlingBall' | 'BugBeetle' | 'Calendar' | 'CalendarBlank' | 'Camera' | 'CameraSlash' | 'CaretDown' | 'CaretLeft' | 'CaretRight' | 'CaretUp' | 'CaretUpDown' | 'ChatTeardropDots' | 'Check' | 'CheckCircle' | 'CheckFat' | 'Circle' | 'CircleDashed' | 'CircleHalf' | 'CirclesFour' | 'CirclesThreePlus' | 'Clock' | 'ClockCountdown' | 'Copy' | 'Crop' | 'Cube' | 'CursorClick' | 'CraneTower' | 'Database' | 'Dna' | 'DotsThree' | 'DotsThreeOutlineVertical' | 'DownloadSimple' | 'Drop' | 'EnvelopeSimple' | 'Eye' | 'Eyedropper' | 'EyeSlash' | 'FileCsv' | 'Flag' | 'Flask' | 'Folder' | 'FolderDashed' | 'FolderSimplePlus' | 'FunnelSimple' | 'Gear' | 'GlobeSimple' | 'GlobeSimpleX' | 'GridFour' | 'Hash' | 'House' | 'ImageSquare' | 'ImagesSquare' | 'Info' | 'Lock' | 'LineSegments' | 'List' | 'Link' | 'ListMagnifyingGlass' | 'MagnifyingGlass' | 'MegaphoneSimple' | 'MicrosoftExcelLogo' | 'Moon' | 'Minus' | 'Palette' | 'Pause' | 'Pencil' | 'PencilSimple' | 'Percent' | 'Phone' | 'Plant' | 'Play' | 'Plus' | 'PlusMinus' | 'Ruler' | 'Question' | 'SealCheck' | 'RadioButton' | 'SealQuestion' | 'SealWarning' | 'SelectionAll' | 'Share' | 'SidebarSimple' | 'SkipBack' | 'SkipForward' | 'SignIn' | 'SignOut' | 'SortAscending' | 'Sparkle' | 'SpinnerGap' | 'SquaresFour' | 'Star' | 'Stop' | 'StopCircle' | 'Sun' | 'Table' | 'Tag' | 'Target' | 'TestTube' | 'Trash' | 'TrashSimple' | 'TreeStructure' | 'UserCircle' | 'UserPlus' | 'Video' | 'Warning' | 'WarningCircle' | 'WifiSlash' | 'X';
|
|
7
|
+
export type IconName = 'Aperture' | 'Archive' | 'ArrowFatLineRight' | 'ArrowCounterClockwise' | 'ArrowRight' | 'ArrowUpRight' | 'ArrowUpLeft' | 'ArrowUUpLeft' | 'Barcode' | 'Bell' | 'BookOpen' | 'BookOpenText' | 'BowlingBall' | 'BugBeetle' | 'Calendar' | 'CalendarBlank' | 'Camera' | 'CameraSlash' | 'CaretDown' | 'CaretLeft' | 'CaretRight' | 'CaretUp' | 'CaretUpDown' | 'ChatTeardropDots' | 'Check' | 'CheckCircle' | 'CheckFat' | 'Circle' | 'CircleDashed' | 'CircleHalf' | 'CirclesFour' | 'CirclesThreePlus' | 'Clock' | 'ClockCountdown' | 'Copy' | 'Crop' | 'Cube' | 'CursorClick' | 'CraneTower' | 'Database' | 'Dna' | 'DotsThree' | 'DotsThreeOutlineVertical' | 'DownloadSimple' | 'Drop' | 'EnvelopeSimple' | 'Eye' | 'Eyedropper' | 'EyeSlash' | 'FileCsv' | 'Flag' | 'Flask' | 'Folder' | 'FolderDashed' | 'FolderSimplePlus' | 'FunnelSimple' | 'Gear' | 'GlobeSimple' | 'GlobeSimpleX' | 'GridFour' | 'Hash' | 'House' | 'ImageSquare' | 'ImagesSquare' | 'Info' | 'Lock' | 'LineSegments' | 'List' | 'Link' | 'ListMagnifyingGlass' | 'MagnifyingGlass' | 'MegaphoneSimple' | 'MicrosoftExcelLogo' | 'Moon' | 'Minus' | 'Palette' | 'Pause' | 'Pencil' | 'PencilSimple' | 'Percent' | 'Phone' | 'Plant' | 'Play' | 'Plus' | 'PlusMinus' | 'Ruler' | 'Question' | 'SealCheck' | 'RadioButton' | 'SealQuestion' | 'SealWarning' | 'SelectionAll' | 'Share' | 'SidebarSimple' | 'SkipBack' | 'SkipForward' | 'SignIn' | 'SignOut' | 'SortAscending' | 'Sparkle' | 'SpinnerGap' | 'SquaresFour' | 'Star' | 'Stop' | 'StopCircle' | 'Sun' | 'Table' | 'Tag' | 'Target' | 'TestTube' | 'Trash' | 'TrashSimple' | 'TreeStructure' | 'UserCircle' | 'UserPlus' | 'Video' | 'Warning' | 'WarningCircle' | 'WifiSlash' | 'X' | 'XCircle';
|
|
8
8
|
export type AllIconName = IconName | CustomIconName;
|
|
9
9
|
export declare const iconMap: Record<IconName, PhosphorIconProps>;
|
|
10
10
|
export declare function renderIcon(iconName: keyof typeof iconMap): PhosphorIconProps;
|
|
@@ -118,6 +118,7 @@ import Warning from 'phosphor-svelte/lib/Warning';
|
|
|
118
118
|
import WarningCircle from 'phosphor-svelte/lib/WarningCircle';
|
|
119
119
|
import WifiSlash from 'phosphor-svelte/lib/WifiSlash';
|
|
120
120
|
import X from 'phosphor-svelte/lib/X';
|
|
121
|
+
import XCircle from 'phosphor-svelte/lib/XCircle';
|
|
121
122
|
// Custom Icons
|
|
122
123
|
export * from './custom';
|
|
123
124
|
export const iconMap = {
|
|
@@ -241,6 +242,7 @@ export const iconMap = {
|
|
|
241
242
|
WarningCircle,
|
|
242
243
|
WifiSlash,
|
|
243
244
|
X,
|
|
245
|
+
XCircle,
|
|
244
246
|
};
|
|
245
247
|
export function renderIcon(iconName) {
|
|
246
248
|
const Icon = iconMap[iconName];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
<script module>
|
|
2
|
-
import Input from './Input.svelte';
|
|
1
|
+
<script module lang="ts">
|
|
2
|
+
import Input, { type InputVariant, type InputSize } from './Input.svelte';
|
|
3
3
|
|
|
4
4
|
import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
5
5
|
|
|
@@ -20,13 +20,33 @@
|
|
|
20
20
|
let password = 'wordpass';
|
|
21
21
|
|
|
22
22
|
let textareaValue = '';
|
|
23
|
+
|
|
24
|
+
const variants = ['primary', 'secondary', 'transparent', 'borderless'];
|
|
25
|
+
|
|
26
|
+
const sizes = ['xs', 'sm', 'md', 'lg', 'dynamic'];
|
|
23
27
|
</script>
|
|
24
28
|
|
|
25
29
|
<Story name="Base" args={{ autofocus: true, value: 'Hello' }} />
|
|
26
30
|
|
|
27
|
-
<Story name="
|
|
31
|
+
<Story name="Variants" asChild>
|
|
32
|
+
<div class="flex flex-col gap-4">
|
|
33
|
+
{#each variants as variant}
|
|
34
|
+
{#if variant === 'secondary-inverse'}
|
|
35
|
+
<Input label={variant} variant={variant as InputVariant} placeholder="Placeholder" />
|
|
36
|
+
{:else}
|
|
37
|
+
<Input label={variant} variant={variant as InputVariant} placeholder="Placeholder" />
|
|
38
|
+
{/if}
|
|
39
|
+
{/each}
|
|
40
|
+
</div>
|
|
41
|
+
</Story>
|
|
28
42
|
|
|
29
|
-
<Story name="
|
|
43
|
+
<Story name="Sizes" asChild>
|
|
44
|
+
<div class="flex flex-col gap-4">
|
|
45
|
+
{#each sizes as size}
|
|
46
|
+
<Input label={size} size={size as InputSize} placeholder="Placeholder" />
|
|
47
|
+
{/each}
|
|
48
|
+
</div>
|
|
49
|
+
</Story>
|
|
30
50
|
|
|
31
51
|
<Story name="Login" asChild>
|
|
32
52
|
<div class="flex flex-col gap-2">
|
|
@@ -1,19 +1,6 @@
|
|
|
1
|
-
export default Input;
|
|
2
|
-
type Input = SvelteComponent<{
|
|
3
|
-
[x: string]: never;
|
|
4
|
-
}, {
|
|
5
|
-
[evt: string]: CustomEvent<any>;
|
|
6
|
-
}, {}> & {
|
|
7
|
-
$$bindings?: string | undefined;
|
|
8
|
-
};
|
|
9
|
-
declare const Input: $$__sveltets_2_IsomorphicComponent<{
|
|
10
|
-
[x: string]: never;
|
|
11
|
-
}, {
|
|
12
|
-
[evt: string]: CustomEvent<any>;
|
|
13
|
-
}, {}, {}, string>;
|
|
14
1
|
import Input from './Input.svelte';
|
|
15
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> {
|
|
16
|
-
new (options: import(
|
|
3
|
+
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
17
4
|
$$bindings?: Bindings;
|
|
18
5
|
} & Exports;
|
|
19
6
|
(internal: unknown, props: {
|
|
@@ -25,3 +12,8 @@ interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> =
|
|
|
25
12
|
};
|
|
26
13
|
z_$$bindings?: Bindings;
|
|
27
14
|
}
|
|
15
|
+
declare const Input: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
|
|
16
|
+
[evt: string]: CustomEvent<any>;
|
|
17
|
+
}, {}, {}, string>;
|
|
18
|
+
type Input = InstanceType<typeof Input>;
|
|
19
|
+
export default Input;
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
interface InputProps extends Omit<HTMLInputAttributes, 'size' | 'prefix' | 'suffix'> {
|
|
8
8
|
label?: string | null;
|
|
9
9
|
id?: string | undefined;
|
|
10
|
-
variant?: '
|
|
10
|
+
variant?: 'primary' | 'secondary' | 'transparent' | 'borderless';
|
|
11
11
|
validator?: (a: string | number) => boolean;
|
|
12
12
|
prefix?: Snippet<[any]>;
|
|
13
13
|
suffix?: Snippet;
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
|
|
24
24
|
let {
|
|
25
25
|
label = null,
|
|
26
|
-
variant = '
|
|
26
|
+
variant = 'primary',
|
|
27
27
|
value = $bindable(),
|
|
28
28
|
type = 'text',
|
|
29
29
|
validator = (_) => {
|
|
@@ -61,11 +61,15 @@
|
|
|
61
61
|
valid = validator(value);
|
|
62
62
|
onblur?.(event);
|
|
63
63
|
}
|
|
64
|
+
|
|
65
|
+
export type InputVariant = 'primary' | 'secondary' | 'transparent' | 'borderless';
|
|
66
|
+
|
|
67
|
+
export type InputSize = 'xs' | 'sm' | 'md' | 'lg' | 'dynamic';
|
|
64
68
|
</script>
|
|
65
69
|
|
|
66
|
-
<div class="w-full">
|
|
70
|
+
<div class="flex w-full flex-col gap-2">
|
|
67
71
|
{#if label}
|
|
68
|
-
<label for={id ?? inputId} class="block px-1
|
|
72
|
+
<label for={id ?? inputId} class="block px-1 text-sm capitalize text-secondary">
|
|
69
73
|
{label}
|
|
70
74
|
{#if rest.required}
|
|
71
75
|
<span class="ml-0.5 text-danger">*</span>
|
|
@@ -74,10 +78,11 @@
|
|
|
74
78
|
{/if}
|
|
75
79
|
|
|
76
80
|
<div
|
|
77
|
-
class="flex w-full items-center gap-1
|
|
78
|
-
class:border-transparent={variant === 'transparent'}
|
|
79
|
-
class:shadow-input={!(variant === 'transparent')}
|
|
81
|
+
class="flex w-full items-center gap-1 size-{size} transition-colors"
|
|
80
82
|
class:!border-error={!valid}
|
|
83
|
+
class:primary={variant === 'primary'}
|
|
84
|
+
class:secondary={variant === 'secondary'}
|
|
85
|
+
class:transparent={variant === 'transparent'}
|
|
81
86
|
class:borderless={variant === 'borderless'}
|
|
82
87
|
>
|
|
83
88
|
<div class="whitespace-nowrap text-secondary">
|
|
@@ -126,6 +131,8 @@
|
|
|
126
131
|
|
|
127
132
|
resize: none;
|
|
128
133
|
|
|
134
|
+
background-color: transparent;
|
|
135
|
+
|
|
129
136
|
padding: 0.25rem;
|
|
130
137
|
|
|
131
138
|
outline: 2px solid transparent;
|
|
@@ -133,6 +140,20 @@
|
|
|
133
140
|
outline-offset: 2px
|
|
134
141
|
}
|
|
135
142
|
|
|
143
|
+
input::-moz-placeholder {
|
|
144
|
+
|
|
145
|
+
--tw-text-opacity: 1;
|
|
146
|
+
|
|
147
|
+
color: rgb(136 140 148 / var(--tw-text-opacity, 1))
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
input::placeholder {
|
|
151
|
+
|
|
152
|
+
--tw-text-opacity: 1;
|
|
153
|
+
|
|
154
|
+
color: rgb(136 140 148 / var(--tw-text-opacity, 1))
|
|
155
|
+
}
|
|
156
|
+
|
|
136
157
|
div:not(:focus-within):hover {
|
|
137
158
|
|
|
138
159
|
border-color: #5750ee40
|
|
@@ -145,17 +166,46 @@
|
|
|
145
166
|
border-color: rgb(87 80 238 / var(--tw-border-opacity, 1))
|
|
146
167
|
}
|
|
147
168
|
|
|
148
|
-
.
|
|
169
|
+
.primary {
|
|
149
170
|
|
|
150
|
-
border-
|
|
171
|
+
border-width: 1px;
|
|
172
|
+
|
|
173
|
+
border-color: #12192A1A;
|
|
151
174
|
|
|
152
|
-
--tw-
|
|
175
|
+
--tw-bg-opacity: 1;
|
|
153
176
|
|
|
154
|
-
--tw-
|
|
177
|
+
background-color: rgb(255 255 255 / var(--tw-bg-opacity, 1));
|
|
178
|
+
|
|
179
|
+
--tw-shadow: 0 1px 4px 0 rgba(18, 25, 42, 0.02);
|
|
180
|
+
|
|
181
|
+
--tw-shadow-colored: 0 1px 4px 0 var(--tw-shadow-color);
|
|
155
182
|
|
|
156
183
|
box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)
|
|
157
184
|
}
|
|
158
185
|
|
|
186
|
+
.secondary {
|
|
187
|
+
|
|
188
|
+
border-width: 1px;
|
|
189
|
+
|
|
190
|
+
border-color: #12192A1A;
|
|
191
|
+
|
|
192
|
+
--tw-bg-opacity: 1;
|
|
193
|
+
|
|
194
|
+
background-color: rgb(251 251 251 / var(--tw-bg-opacity, 1))
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
.transparent {
|
|
198
|
+
|
|
199
|
+
border-width: 1px;
|
|
200
|
+
|
|
201
|
+
border-color: transparent
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
.borderless {
|
|
205
|
+
|
|
206
|
+
border-style: none
|
|
207
|
+
}
|
|
208
|
+
|
|
159
209
|
.borderless input {
|
|
160
210
|
|
|
161
211
|
border-style: none;
|
|
@@ -175,6 +225,8 @@
|
|
|
175
225
|
|
|
176
226
|
height: 1.5rem;
|
|
177
227
|
|
|
228
|
+
border-radius: 0.375rem;
|
|
229
|
+
|
|
178
230
|
padding: 0.25rem;
|
|
179
231
|
|
|
180
232
|
font-size: 0.75rem;
|
|
@@ -186,6 +238,8 @@
|
|
|
186
238
|
|
|
187
239
|
height: 2rem;
|
|
188
240
|
|
|
241
|
+
border-radius: 0.375rem;
|
|
242
|
+
|
|
189
243
|
padding: 0.25rem
|
|
190
244
|
}
|
|
191
245
|
|
|
@@ -193,13 +247,17 @@
|
|
|
193
247
|
|
|
194
248
|
height: 2.5rem;
|
|
195
249
|
|
|
196
|
-
|
|
250
|
+
border-radius: 0.5rem;
|
|
251
|
+
|
|
252
|
+
padding: 0.25rem
|
|
197
253
|
}
|
|
198
254
|
|
|
199
255
|
.size-lg {
|
|
200
256
|
|
|
201
257
|
height: 3rem;
|
|
202
258
|
|
|
259
|
+
border-radius: 0.5rem;
|
|
260
|
+
|
|
203
261
|
padding-left: 0.5rem;
|
|
204
262
|
|
|
205
263
|
padding-right: 0.5rem;
|
|
@@ -217,6 +275,8 @@
|
|
|
217
275
|
|
|
218
276
|
height: auto;
|
|
219
277
|
|
|
278
|
+
border-radius: 0.5rem;
|
|
279
|
+
|
|
220
280
|
padding-left: 0.75rem;
|
|
221
281
|
|
|
222
282
|
padding-right: 0.75rem;
|
|
@@ -3,7 +3,7 @@ import type { HTMLInputAttributes } from 'svelte/elements';
|
|
|
3
3
|
interface InputProps extends Omit<HTMLInputAttributes, 'size' | 'prefix' | 'suffix'> {
|
|
4
4
|
label?: string | null;
|
|
5
5
|
id?: string | undefined;
|
|
6
|
-
variant?: '
|
|
6
|
+
variant?: 'primary' | 'secondary' | 'transparent' | 'borderless';
|
|
7
7
|
validator?: (a: string | number) => boolean;
|
|
8
8
|
prefix?: Snippet<[any]>;
|
|
9
9
|
suffix?: Snippet;
|
|
@@ -16,6 +16,8 @@ interface InputProps extends Omit<HTMLInputAttributes, 'size' | 'prefix' | 'suff
|
|
|
16
16
|
oninput?: (event: Event) => void;
|
|
17
17
|
onblur?: (event: FocusEvent) => void;
|
|
18
18
|
}
|
|
19
|
+
export type InputVariant = 'primary' | 'secondary' | 'transparent' | 'borderless';
|
|
20
|
+
export type InputSize = 'xs' | 'sm' | 'md' | 'lg' | 'dynamic';
|
|
19
21
|
declare const Input: import("svelte").Component<InputProps, {
|
|
20
22
|
focus: () => void;
|
|
21
23
|
}, "value" | "input">;
|
|
@@ -30,19 +30,19 @@
|
|
|
30
30
|
</script>
|
|
31
31
|
|
|
32
32
|
<Select.Trigger
|
|
33
|
-
class={'flex h-fit min-h-10 w-full items-center justify-between rounded-lg border border-input bg-surface py-1
|
|
33
|
+
class={'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' +
|
|
34
34
|
(className || '')}
|
|
35
35
|
{...restProps}
|
|
36
36
|
>
|
|
37
37
|
{#if selectedValues.length === 0}
|
|
38
|
-
<span class="flex-grow px-
|
|
38
|
+
<span class="flex-grow px-1 text-tertiary">{placeholder}</span>
|
|
39
39
|
{:else}
|
|
40
40
|
<div class="flex flex-grow flex-wrap items-center gap-1">
|
|
41
41
|
{#each selectedValues as selectedVal (selectedVal)}
|
|
42
42
|
{@const item = items.find((i) => i.value === selectedVal)}
|
|
43
43
|
{#if item}
|
|
44
44
|
<div
|
|
45
|
-
class="flex h-7 w-fit items-center gap-1 rounded bg-neutral py-0.5 pl-2 pr-0.5 text-sm"
|
|
45
|
+
class="flex h-7 w-fit items-center gap-1 rounded-md bg-neutral py-0.5 pl-2 pr-0.5 text-sm"
|
|
46
46
|
aria-label={`Selected item ${item.label}`}
|
|
47
47
|
>
|
|
48
48
|
{#if item.iconName}
|
|
@@ -21,13 +21,13 @@
|
|
|
21
21
|
<SelectPrimitive.Portal>
|
|
22
22
|
<SelectPrimitive.Content {...restProps} {sideOffset} class={baseClasses + ' ' + className}>
|
|
23
23
|
<SelectPrimitive.ScrollUpButton class="flex justify-center">
|
|
24
|
-
<Icon iconName="CaretUp" />
|
|
24
|
+
<Icon iconName="CaretUp" color="tertiary" />
|
|
25
25
|
</SelectPrimitive.ScrollUpButton>
|
|
26
26
|
<SelectPrimitive.Viewport class="p-1 ">
|
|
27
27
|
{@render children()}
|
|
28
28
|
</SelectPrimitive.Viewport>
|
|
29
29
|
<SelectPrimitive.ScrollDownButton class="flex justify-center">
|
|
30
|
-
<Icon iconName="CaretDown" />
|
|
30
|
+
<Icon iconName="CaretDown" color="tertiary" />
|
|
31
31
|
</SelectPrimitive.ScrollDownButton>
|
|
32
32
|
</SelectPrimitive.Content>
|
|
33
33
|
</SelectPrimitive.Portal>
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
let { class: className = '', children, ...restProps }: Props = $props();
|
|
14
14
|
|
|
15
15
|
const baseClasses = `
|
|
16
|
-
relative flex w-full h-auto gap-2 cursor-default select-none items-center justify-between rounded-
|
|
16
|
+
relative flex w-full h-auto gap-2 cursor-default select-none items-center justify-between rounded-md p-3 text-sm outline-none
|
|
17
17
|
focus:bg-neutral focus:text-accent-foreground
|
|
18
18
|
data-[disabled]:pointer-events-none data-[disabled]:opacity-50
|
|
19
19
|
data-[highlighted]:bg-neutral data-[highlighted]:text-accent-foreground
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
}: Props = $props();
|
|
24
24
|
|
|
25
25
|
const baseClasses =
|
|
26
|
-
'flex h-10 w-full items-center justify-between rounded-lg border border-input bg-surface p-2 text-sm placeholder:text-tertiary focus:outline-none hover:border-hover focus:border-accent disabled:cursor-not-allowed disabled:opacity-
|
|
26
|
+
'flex h-10 w-full items-center justify-between !rounded-lg border border-input bg-surface p-2 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';
|
|
27
27
|
</script>
|
|
28
28
|
|
|
29
29
|
<SelectPrimitive.Trigger
|
package/dist/index.d.ts
CHANGED
|
@@ -44,7 +44,6 @@ export * from './components/textarea/index';
|
|
|
44
44
|
export * from './components/tooltip/';
|
|
45
45
|
export * from './components/toggle/';
|
|
46
46
|
export * from './components/checkbox/';
|
|
47
|
-
export * from './components/sjsf-wrappers/';
|
|
48
47
|
export { tokens } from './tokens';
|
|
49
48
|
export { notifications } from './notifications';
|
|
50
49
|
export { colors, borderColor, textColor, backgroundColor, boxShadow, outlineColor } from './tokens';
|
package/dist/index.js
CHANGED
|
@@ -45,7 +45,6 @@ export * from './components/textarea/index';
|
|
|
45
45
|
export * from './components/tooltip/';
|
|
46
46
|
export * from './components/toggle/';
|
|
47
47
|
export * from './components/checkbox/';
|
|
48
|
-
export * from './components/sjsf-wrappers/';
|
|
49
48
|
// Styles and Tokens
|
|
50
49
|
export { tokens } from './tokens';
|
|
51
50
|
export { notifications } from './notifications';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reshape-biotech/design-system",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.6.1",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"dev": "vite dev",
|
|
6
6
|
"build": "vite build",
|
|
@@ -70,12 +70,6 @@
|
|
|
70
70
|
"import": "./dist/components/datepicker/index.js",
|
|
71
71
|
"default": "./dist/components/datepicker/index.js"
|
|
72
72
|
},
|
|
73
|
-
"./components/sjsf-wrappers": {
|
|
74
|
-
"types": "./dist/components/sjsf-wrappers/index.d.ts",
|
|
75
|
-
"svelte": "./dist/components/sjsf-wrappers/index.js",
|
|
76
|
-
"import": "./dist/components/sjsf-wrappers/index.js",
|
|
77
|
-
"default": "./dist/components/sjsf-wrappers/index.js"
|
|
78
|
-
},
|
|
79
73
|
"./components/empty-content": {
|
|
80
74
|
"types": "./dist/components/empty-content/index.d.ts",
|
|
81
75
|
"svelte": "./dist/components/empty-content/index.js",
|
|
@@ -1,107 +0,0 @@
|
|
|
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
|
-
let displayValue = $state('');
|
|
52
|
-
|
|
53
|
-
const getStringValue = () => {
|
|
54
|
-
if (displayValue !== '') {
|
|
55
|
-
return displayValue;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
if (value === undefined || value === null || isNaN(value)) {
|
|
59
|
-
return '';
|
|
60
|
-
}
|
|
61
|
-
return String(value);
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
const setNumericValue = (newValueFromInput: unknown) => {
|
|
65
|
-
const stringifiedInput =
|
|
66
|
-
newValueFromInput === null || newValueFromInput === undefined
|
|
67
|
-
? ''
|
|
68
|
-
: String(newValueFromInput);
|
|
69
|
-
|
|
70
|
-
const validNumberPattern = /^-?\d*\.?\d*$/;
|
|
71
|
-
if (stringifiedInput !== '' && !validNumberPattern.test(stringifiedInput)) {
|
|
72
|
-
return;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
displayValue = stringifiedInput;
|
|
76
|
-
|
|
77
|
-
if (stringifiedInput.trim() === '') {
|
|
78
|
-
value = undefined;
|
|
79
|
-
} else {
|
|
80
|
-
const num = parseFloat(stringifiedInput);
|
|
81
|
-
value = isNaN(num) ? undefined : num;
|
|
82
|
-
}
|
|
83
|
-
};
|
|
84
|
-
</script>
|
|
85
|
-
|
|
86
|
-
<Input
|
|
87
|
-
bind:value={() => getStringValue(), (v) => setNumericValue(v)}
|
|
88
|
-
placeholder={String(placeholder)}
|
|
89
|
-
type={'text'}
|
|
90
|
-
inputmode={'decimal'}
|
|
91
|
-
pattern={config?.schema?.type === 'integer' ? '-?\\d*' : '-?\\d*\\.?\\d*'}
|
|
92
|
-
{readonly}
|
|
93
|
-
id={String(derivedAttrs.id)}
|
|
94
|
-
name={String(derivedAttrs.name)}
|
|
95
|
-
disabled={derivedAttrs.disabled}
|
|
96
|
-
required={derivedAttrs.required}
|
|
97
|
-
step={config?.schema?.multipleOf ?? (config?.schema?.type === 'integer' ? 1 : 'any')}
|
|
98
|
-
min={config?.schema?.minimum ?? config?.schema?.exclusiveMinimum}
|
|
99
|
-
max={config?.schema?.maximum ?? config?.schema?.exclusiveMaximum}
|
|
100
|
-
aria-invalid={errors && errors.length > 0 ? true : undefined}
|
|
101
|
-
aria-describedby={errors && errors.length > 0 ? `${String(derivedAttrs.id)}-errors` : undefined}
|
|
102
|
-
class={String(currentClass)}
|
|
103
|
-
autocomplete="off"
|
|
104
|
-
oninput={onInputHandler}
|
|
105
|
-
onchange={onChangeHandler}
|
|
106
|
-
onblur={onBlurHandler}
|
|
107
|
-
/>
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
import { getFormContext, selectAttributes } from '@sjsf/form';
|
|
3
|
-
import type { ComponentProps } from '@sjsf/form';
|
|
4
|
-
import * as Select from '../select';
|
|
5
|
-
|
|
6
|
-
type Props = ComponentProps['selectWidget'];
|
|
7
|
-
let { handlers, value = $bindable(), options = [], config }: Props = $props();
|
|
8
|
-
|
|
9
|
-
const ctx = getFormContext();
|
|
10
|
-
const attributes = $derived(
|
|
11
|
-
selectAttributes(ctx, config, 'select', handlers, { style: 'flex-grow: 1' })
|
|
12
|
-
);
|
|
13
|
-
|
|
14
|
-
const isPrimitive = (v: unknown): v is string | number | boolean =>
|
|
15
|
-
['string', 'number', 'boolean'].includes(typeof v);
|
|
16
|
-
|
|
17
|
-
let domValue = $derived.by(() => {
|
|
18
|
-
const primitiveMatch = options.find((o) => isPrimitive(o.value) && o.value === value);
|
|
19
|
-
if (primitiveMatch) return String(primitiveMatch.value);
|
|
20
|
-
const idx = options.findIndex((o) => o.value === value);
|
|
21
|
-
return idx >= 0 ? String(idx) : '';
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
const onSelectChange = (v: string | undefined) => {
|
|
25
|
-
if (v === undefined || v === '') {
|
|
26
|
-
value = undefined;
|
|
27
|
-
} else {
|
|
28
|
-
const primitiveMatch = options.find((o) => isPrimitive(o.value) && String(o.value) === v);
|
|
29
|
-
if (primitiveMatch) {
|
|
30
|
-
value = primitiveMatch.value;
|
|
31
|
-
} else {
|
|
32
|
-
const idx = Number(v);
|
|
33
|
-
if (!Number.isNaN(idx) && options[idx]) {
|
|
34
|
-
value = options[idx].value;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
if (typeof (attributes as any).onchange === 'function') {
|
|
39
|
-
(attributes as any).onchange(new Event('change'));
|
|
40
|
-
}
|
|
41
|
-
};
|
|
42
|
-
</script>
|
|
43
|
-
|
|
44
|
-
<input
|
|
45
|
-
type="hidden"
|
|
46
|
-
name={String(attributes.name)}
|
|
47
|
-
id={String(attributes.id)}
|
|
48
|
-
value={domValue}
|
|
49
|
-
disabled={attributes.disabled}
|
|
50
|
-
/>
|
|
51
|
-
|
|
52
|
-
<Select.Root value={domValue} type="single" items={[]} onValueChange={onSelectChange}>
|
|
53
|
-
<Select.Trigger
|
|
54
|
-
placeholder={attributes.placeholder ?? undefined}
|
|
55
|
-
displayValue={options.find((o) => isPrimitive(o.value) && String(o.value) === domValue)
|
|
56
|
-
?.label || options.find((o, idx) => String(idx) === domValue && !isPrimitive(o.value))?.label}
|
|
57
|
-
disabled={attributes.disabled}
|
|
58
|
-
/>
|
|
59
|
-
<Select.Portal>
|
|
60
|
-
<Select.Content>
|
|
61
|
-
{#if config.schema.default === undefined}
|
|
62
|
-
<Select.Item value="" label={attributes.placeholder ?? undefined} />
|
|
63
|
-
{/if}
|
|
64
|
-
{#each options as option, index (option.id)}
|
|
65
|
-
{#if isPrimitive(option.value)}
|
|
66
|
-
<Select.Item
|
|
67
|
-
value={String(option.value)}
|
|
68
|
-
label={option.label}
|
|
69
|
-
disabled={option.disabled}
|
|
70
|
-
/>
|
|
71
|
-
{:else}
|
|
72
|
-
<Select.Item value={String(index)} label={option.label} disabled={option.disabled} />
|
|
73
|
-
{/if}
|
|
74
|
-
{/each}
|
|
75
|
-
</Select.Content>
|
|
76
|
-
</Select.Portal>
|
|
77
|
-
</Select.Root>
|
|
@@ -1,65 +0,0 @@
|
|
|
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
|
-
/>
|
|
@@ -1,12 +0,0 @@
|
|
|
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
|
-
import EnumField from '@sjsf/form/fields/extra-fields/enum.svelte';
|
|
6
|
-
import SjsfSelectWidgetWrapper from './SjsfSelectWidgetWrapper.svelte';
|
|
7
|
-
export const sjsfCustomTheme = overrideByRecord(BasicTheme, {
|
|
8
|
-
numberWidget: SjsfNumberInputWrapper,
|
|
9
|
-
textWidget: SjsfTextInputWrapper,
|
|
10
|
-
enumField: EnumField,
|
|
11
|
-
selectWidget: SjsfSelectWidgetWrapper,
|
|
12
|
-
});
|