@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
|
@@ -1,14 +1,19 @@
|
|
|
1
1
|
import Aperture from 'phosphor-svelte/lib/Aperture';
|
|
2
2
|
import ArrowFatLineRight from 'phosphor-svelte/lib/ArrowFatLineRight';
|
|
3
|
+
import ArrowCounterClockwise from 'phosphor-svelte/lib/ArrowCounterClockwise';
|
|
3
4
|
import ArrowRight from 'phosphor-svelte/lib/ArrowRight';
|
|
4
5
|
import ArrowUpRight from 'phosphor-svelte/lib/ArrowUpRight';
|
|
6
|
+
import ArrowUpLeft from 'phosphor-svelte/lib/ArrowUpLeft';
|
|
7
|
+
import ArrowUUpLeft from 'phosphor-svelte/lib/ArrowUUpLeft';
|
|
5
8
|
import Barcode from 'phosphor-svelte/lib/Barcode';
|
|
6
9
|
import Bell from 'phosphor-svelte/lib/Bell';
|
|
7
10
|
import BookOpen from 'phosphor-svelte/lib/BookOpen';
|
|
8
11
|
import BookOpenText from 'phosphor-svelte/lib/BookOpenText';
|
|
9
12
|
import BowlingBall from 'phosphor-svelte/lib/BowlingBall';
|
|
13
|
+
import BugBeetle from 'phosphor-svelte/lib/BugBeetle';
|
|
10
14
|
import Calendar from 'phosphor-svelte/lib/Calendar';
|
|
11
15
|
import CalendarBlank from 'phosphor-svelte/lib/CalendarBlank';
|
|
16
|
+
import Camera from 'phosphor-svelte/lib/CameraSlash';
|
|
12
17
|
import CameraSlash from 'phosphor-svelte/lib/CameraSlash';
|
|
13
18
|
import CaretDown from 'phosphor-svelte/lib/CaretDown';
|
|
14
19
|
import CaretLeft from 'phosphor-svelte/lib/CaretLeft';
|
|
@@ -30,6 +35,7 @@ import Copy from 'phosphor-svelte/lib/Copy';
|
|
|
30
35
|
import Crop from 'phosphor-svelte/lib/Crop';
|
|
31
36
|
import Cube from 'phosphor-svelte/lib/Cube';
|
|
32
37
|
import Database from 'phosphor-svelte/lib/Database';
|
|
38
|
+
import Dna from 'phosphor-svelte/lib/Dna';
|
|
33
39
|
import DotsThree from 'phosphor-svelte/lib/DotsThree';
|
|
34
40
|
import DotsThreeOutlineVertical from 'phosphor-svelte/lib/DotsThreeOutlineVertical';
|
|
35
41
|
import DownloadSimple from 'phosphor-svelte/lib/DownloadSimple';
|
|
@@ -53,13 +59,18 @@ import House from 'phosphor-svelte/lib/House';
|
|
|
53
59
|
import ImageSquare from 'phosphor-svelte/lib/ImageSquare';
|
|
54
60
|
import ImagesSquare from 'phosphor-svelte/lib/ImagesSquare';
|
|
55
61
|
import Info from 'phosphor-svelte/lib/Info';
|
|
62
|
+
import Link from 'phosphor-svelte/lib/Link';
|
|
56
63
|
import Lock from 'phosphor-svelte/lib/Lock';
|
|
57
64
|
import LineSegments from 'phosphor-svelte/lib/LineSegments';
|
|
58
65
|
import List from 'phosphor-svelte/lib/List';
|
|
66
|
+
import ListMagnifyingGlass from 'phosphor-svelte/lib/ListMagnifyingGlass';
|
|
59
67
|
import MagnifyingGlass from 'phosphor-svelte/lib/MagnifyingGlass';
|
|
60
68
|
import MegaphoneSimple from 'phosphor-svelte/lib/MegaphoneSimple';
|
|
69
|
+
import MicrosoftExcelLogo from 'phosphor-svelte/lib/MicrosoftExcelLogo';
|
|
61
70
|
import Moon from 'phosphor-svelte/lib/Moon';
|
|
71
|
+
import Minus from 'phosphor-svelte/lib/Minus';
|
|
62
72
|
import Pause from 'phosphor-svelte/lib/Pause';
|
|
73
|
+
import Palette from 'phosphor-svelte/lib/Palette';
|
|
63
74
|
import Pencil from 'phosphor-svelte/lib/Pencil';
|
|
64
75
|
import PencilSimple from 'phosphor-svelte/lib/PencilSimple';
|
|
65
76
|
import Percent from 'phosphor-svelte/lib/Percent';
|
|
@@ -69,11 +80,15 @@ import Play from 'phosphor-svelte/lib/Play';
|
|
|
69
80
|
import Plus from 'phosphor-svelte/lib/Plus';
|
|
70
81
|
import PlusMinus from 'phosphor-svelte/lib/PlusMinus';
|
|
71
82
|
import Question from 'phosphor-svelte/lib/Question';
|
|
83
|
+
import SealCheck from 'phosphor-svelte/lib/SealCheck';
|
|
72
84
|
import RadioButton from 'phosphor-svelte/lib/RadioButton';
|
|
73
85
|
import SealQuestion from 'phosphor-svelte/lib/SealQuestion';
|
|
86
|
+
import SealWarning from 'phosphor-svelte/lib/SealWarning';
|
|
74
87
|
import SelectionAll from 'phosphor-svelte/lib/SelectionAll';
|
|
75
88
|
import Share from 'phosphor-svelte/lib/Share';
|
|
76
89
|
import SidebarSimple from 'phosphor-svelte/lib/SidebarSimple';
|
|
90
|
+
import SignIn from 'phosphor-svelte/lib/SignIn';
|
|
91
|
+
import SignOut from 'phosphor-svelte/lib/SignOut';
|
|
77
92
|
import SkipBack from 'phosphor-svelte/lib/SkipBack';
|
|
78
93
|
import SkipForward from 'phosphor-svelte/lib/SkipForward';
|
|
79
94
|
import SortAscending from 'phosphor-svelte/lib/SortAscending';
|
|
@@ -86,9 +101,11 @@ import StopCircle from 'phosphor-svelte/lib/StopCircle';
|
|
|
86
101
|
import Sun from 'phosphor-svelte/lib/Sun';
|
|
87
102
|
import Table from 'phosphor-svelte/lib/Table';
|
|
88
103
|
import Tag from 'phosphor-svelte/lib/Tag';
|
|
104
|
+
import Target from 'phosphor-svelte/lib/Target';
|
|
89
105
|
import TestTube from 'phosphor-svelte/lib/TestTube';
|
|
90
106
|
import Trash from 'phosphor-svelte/lib/Trash';
|
|
91
107
|
import TrashSimple from 'phosphor-svelte/lib/TrashSimple';
|
|
108
|
+
import TreeStructure from 'phosphor-svelte/lib/TreeStructure';
|
|
92
109
|
import UserCircle from 'phosphor-svelte/lib/UserCircle';
|
|
93
110
|
import UserPlus from 'phosphor-svelte/lib/UserPlus';
|
|
94
111
|
import Video from 'phosphor-svelte/lib/Video';
|
|
@@ -99,15 +116,20 @@ import X from 'phosphor-svelte/lib/X';
|
|
|
99
116
|
export const iconMap = {
|
|
100
117
|
Aperture,
|
|
101
118
|
ArrowFatLineRight,
|
|
119
|
+
ArrowCounterClockwise,
|
|
102
120
|
ArrowRight,
|
|
103
121
|
ArrowUpRight,
|
|
122
|
+
ArrowUpLeft,
|
|
123
|
+
ArrowUUpLeft,
|
|
104
124
|
Barcode,
|
|
105
125
|
Bell,
|
|
106
126
|
BookOpen,
|
|
107
127
|
BookOpenText,
|
|
108
128
|
BowlingBall,
|
|
129
|
+
BugBeetle,
|
|
109
130
|
Calendar,
|
|
110
131
|
CalendarBlank,
|
|
132
|
+
Camera,
|
|
111
133
|
CameraSlash,
|
|
112
134
|
CaretDown,
|
|
113
135
|
CaretLeft,
|
|
@@ -129,6 +151,7 @@ export const iconMap = {
|
|
|
129
151
|
Crop,
|
|
130
152
|
Cube,
|
|
131
153
|
Database,
|
|
154
|
+
Dna,
|
|
132
155
|
DotsThree,
|
|
133
156
|
DotsThreeOutlineVertical,
|
|
134
157
|
DownloadSimple,
|
|
@@ -155,9 +178,14 @@ export const iconMap = {
|
|
|
155
178
|
Lock,
|
|
156
179
|
LineSegments,
|
|
157
180
|
List,
|
|
181
|
+
Link,
|
|
182
|
+
ListMagnifyingGlass,
|
|
158
183
|
MagnifyingGlass,
|
|
159
184
|
MegaphoneSimple,
|
|
185
|
+
MicrosoftExcelLogo,
|
|
160
186
|
Moon,
|
|
187
|
+
Minus,
|
|
188
|
+
Palette,
|
|
161
189
|
Pause,
|
|
162
190
|
Pencil,
|
|
163
191
|
PencilSimple,
|
|
@@ -169,10 +197,14 @@ export const iconMap = {
|
|
|
169
197
|
PlusMinus,
|
|
170
198
|
RadioButton,
|
|
171
199
|
Question,
|
|
200
|
+
SealCheck,
|
|
172
201
|
SealQuestion,
|
|
202
|
+
SealWarning,
|
|
173
203
|
SelectionAll,
|
|
174
204
|
Share,
|
|
175
205
|
SidebarSimple,
|
|
206
|
+
SignIn,
|
|
207
|
+
SignOut,
|
|
176
208
|
SkipBack,
|
|
177
209
|
SkipForward,
|
|
178
210
|
SortAscending,
|
|
@@ -185,9 +217,11 @@ export const iconMap = {
|
|
|
185
217
|
Sun,
|
|
186
218
|
Table,
|
|
187
219
|
Tag,
|
|
220
|
+
Target,
|
|
188
221
|
TestTube,
|
|
189
222
|
Trash,
|
|
190
223
|
TrashSimple,
|
|
224
|
+
TreeStructure,
|
|
191
225
|
UserCircle,
|
|
192
226
|
UserPlus,
|
|
193
227
|
Video,
|
|
@@ -22,33 +22,25 @@
|
|
|
22
22
|
let textareaValue = '';
|
|
23
23
|
</script>
|
|
24
24
|
|
|
25
|
-
<Story name="Base"
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
<Story name="XSmall">
|
|
29
|
-
<Input bind:value autofocus size="xs" />
|
|
30
|
-
</Story>
|
|
31
|
-
<Story name="Small">
|
|
32
|
-
<Input bind:value autofocus size="sm" />
|
|
33
|
-
</Story>
|
|
25
|
+
<Story name="Base" args={{ autofocus: true, value: 'Hello' }} />
|
|
26
|
+
|
|
27
|
+
<Story name="XSmall" args={{ size: 'xs' }} />
|
|
34
28
|
|
|
35
|
-
<Story name="
|
|
29
|
+
<Story name="Small" args={{ size: 'sm' }} />
|
|
30
|
+
|
|
31
|
+
<Story name="Login" asChild>
|
|
36
32
|
<div class="flex flex-col gap-2">
|
|
37
33
|
<Input bind:value={email} label="Email" type="text" required id="email-select" autofocus />
|
|
38
34
|
<Input bind:value={password} label="Password" id="password-select" type="password" required />
|
|
39
35
|
</div>
|
|
40
36
|
</Story>
|
|
41
37
|
|
|
42
|
-
<Story
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
type="textarea"
|
|
47
|
-
placeholder="Add a description..."
|
|
48
|
-
/>
|
|
49
|
-
</Story>
|
|
38
|
+
<Story
|
|
39
|
+
name="Textarea"
|
|
40
|
+
args={{ label: 'Description', type: 'textarea', placeholder: 'Add a description...' }}
|
|
41
|
+
/>
|
|
50
42
|
|
|
51
|
-
<Story name="Prefix">
|
|
43
|
+
<Story name="Prefix" asChild>
|
|
52
44
|
<Input value="Bob">
|
|
53
45
|
{#snippet prefix()}
|
|
54
46
|
<div>Mr.</div>
|
|
@@ -56,7 +48,7 @@
|
|
|
56
48
|
</Input>
|
|
57
49
|
</Story>
|
|
58
50
|
|
|
59
|
-
<Story name="Suffix">
|
|
51
|
+
<Story name="Suffix" asChild>
|
|
60
52
|
<Input value="30">
|
|
61
53
|
{#snippet suffix()}
|
|
62
54
|
<div>± 1°C</div>
|
|
@@ -64,7 +56,7 @@
|
|
|
64
56
|
</Input>
|
|
65
57
|
</Story>
|
|
66
58
|
|
|
67
|
-
<Story name="Prefix & Suffix">
|
|
59
|
+
<Story name="Prefix & Suffix" asChild>
|
|
68
60
|
<Input value="9001">
|
|
69
61
|
{#snippet prefix()}
|
|
70
62
|
<div>$</div>
|
|
@@ -75,7 +67,7 @@
|
|
|
75
67
|
</Input>
|
|
76
68
|
</Story>
|
|
77
69
|
|
|
78
|
-
<Story name="Validation">
|
|
70
|
+
<Story name="Validation" asChild>
|
|
79
71
|
<Input value="Focus me, then click away" validator={(val) => val.toString().length < 10}>
|
|
80
72
|
{#snippet prefix({ valid })}
|
|
81
73
|
<div>
|
|
@@ -91,3 +83,5 @@
|
|
|
91
83
|
{/snippet}
|
|
92
84
|
</Input>
|
|
93
85
|
</Story>
|
|
86
|
+
|
|
87
|
+
<Story name="Clearable" args={{ clearable: true, value: 'Focus me, then click away' }} />
|
|
@@ -1,204 +1,210 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import type { Snippet } from 'svelte';
|
|
3
|
+
import { IconButton } from '../icon-button';
|
|
4
|
+
import { Icon } from '../icons';
|
|
5
|
+
import type { HTMLInputAttributes } from 'svelte/elements';
|
|
3
6
|
|
|
4
|
-
interface
|
|
7
|
+
interface InputProps extends Omit<HTMLInputAttributes, 'size' | 'prefix' | 'suffix'> {
|
|
5
8
|
label?: string | null;
|
|
6
|
-
value: string | number;
|
|
7
|
-
type?: 'text' | 'password' | 'textarea' | 'number';
|
|
8
|
-
name?: string;
|
|
9
|
-
required?: boolean;
|
|
10
|
-
autofocus?: boolean;
|
|
11
|
-
placeholder?: string;
|
|
12
9
|
id?: string | undefined;
|
|
13
10
|
validator?: (a: string | number) => boolean;
|
|
14
|
-
onBlur?: (e: Event) => void;
|
|
15
|
-
onkeydown?: (e: KeyboardEvent) => void;
|
|
16
11
|
prefix?: Snippet<[any]>;
|
|
17
12
|
suffix?: Snippet;
|
|
18
13
|
error?: Snippet;
|
|
19
|
-
input?: HTMLInputElement
|
|
20
|
-
maxlength?: number | null;
|
|
14
|
+
input?: HTMLInputElement;
|
|
21
15
|
size?: 'xs' | 'sm' | 'md' | 'lg' | 'dynamic';
|
|
22
|
-
|
|
16
|
+
transparent?: boolean;
|
|
17
|
+
clearable?: boolean;
|
|
18
|
+
onclear?: () => void;
|
|
19
|
+
class?: string;
|
|
20
|
+
oninput?: (event: Event) => void;
|
|
21
|
+
onblur?: (event: FocusEvent) => void;
|
|
23
22
|
}
|
|
24
23
|
|
|
25
24
|
let {
|
|
26
25
|
label = null,
|
|
27
26
|
value = $bindable(),
|
|
28
27
|
type = 'text',
|
|
29
|
-
required = false,
|
|
30
|
-
autofocus = false,
|
|
31
|
-
placeholder = '',
|
|
32
|
-
id = undefined,
|
|
33
|
-
name,
|
|
34
28
|
validator = (_) => {
|
|
35
29
|
return true;
|
|
36
30
|
},
|
|
37
|
-
onBlur = () => {},
|
|
38
|
-
onkeydown = () => {},
|
|
39
31
|
prefix,
|
|
40
32
|
suffix,
|
|
41
33
|
error,
|
|
42
34
|
input = $bindable(),
|
|
43
|
-
maxlength = null,
|
|
44
35
|
size = 'md',
|
|
45
|
-
|
|
46
|
-
|
|
36
|
+
transparent = false,
|
|
37
|
+
clearable = false,
|
|
38
|
+
onclear = () => {},
|
|
39
|
+
class: className,
|
|
40
|
+
oninput,
|
|
41
|
+
onblur,
|
|
42
|
+
...rest
|
|
43
|
+
}: InputProps = $props();
|
|
44
|
+
|
|
45
|
+
export function focus() {
|
|
46
|
+
input?.focus();
|
|
47
|
+
}
|
|
47
48
|
|
|
48
49
|
let valid = $state(true);
|
|
49
50
|
|
|
50
|
-
const inputId =
|
|
51
|
-
|
|
51
|
+
const inputId = crypto.randomUUID();
|
|
52
|
+
const id = $derived(rest.id ?? inputId);
|
|
52
53
|
function handleInput(event: Event) {
|
|
53
|
-
if (readonly) return;
|
|
54
|
-
const target = event.target as
|
|
54
|
+
if (rest.readonly) return;
|
|
55
|
+
const target = event.target as HTMLInputElement;
|
|
55
56
|
value = target.value;
|
|
56
|
-
|
|
57
|
-
if (type === 'textarea') {
|
|
58
|
-
autoResizeTextarea(target as HTMLTextAreaElement);
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
function autoResizeTextarea(textarea: HTMLTextAreaElement) {
|
|
62
|
-
// Set a maximum height for the textarea (e.g., 200px)
|
|
63
|
-
const maxHeight = 200;
|
|
64
|
-
|
|
65
|
-
// Reset height to auto to get the correct scrollHeight
|
|
66
|
-
textarea.style.height = 'auto';
|
|
67
|
-
|
|
68
|
-
// If scrollHeight is less than maxHeight, set height to scrollHeight
|
|
69
|
-
// Otherwise, set height to maxHeight and enable scrolling
|
|
70
|
-
if (textarea.scrollHeight < maxHeight) {
|
|
71
|
-
textarea.style.height = `${textarea.scrollHeight}px`;
|
|
72
|
-
textarea.style.overflowY = 'hidden';
|
|
73
|
-
} else {
|
|
74
|
-
textarea.style.height = `${maxHeight}px`;
|
|
75
|
-
textarea.style.overflowY = 'auto';
|
|
76
|
-
}
|
|
57
|
+
oninput?.(event);
|
|
77
58
|
}
|
|
78
59
|
|
|
79
|
-
function handleBlur(event:
|
|
60
|
+
function handleBlur(event: FocusEvent & { currentTarget: EventTarget & HTMLInputElement }) {
|
|
80
61
|
valid = validator(value);
|
|
81
|
-
|
|
62
|
+
onblur?.(event);
|
|
82
63
|
}
|
|
83
64
|
</script>
|
|
84
65
|
|
|
85
66
|
<div class="w-full">
|
|
86
67
|
{#if label}
|
|
87
|
-
<label for={id ?? inputId} class="block px-1 py-2 text-sm text-secondary">
|
|
68
|
+
<label for={id ?? inputId} class="block px-1 py-2 text-sm text-secondary">
|
|
69
|
+
{label}
|
|
70
|
+
{#if rest.required}
|
|
71
|
+
<span class="ml-0.5 text-danger">*</span>
|
|
72
|
+
{/if}
|
|
73
|
+
</label>
|
|
88
74
|
{/if}
|
|
75
|
+
|
|
89
76
|
<div
|
|
90
77
|
class="flex w-full items-center gap-1 rounded-lg border border-input bg-surface shadow-input size-{size}"
|
|
78
|
+
class:border-transparent={transparent}
|
|
79
|
+
class:shadow-input={!transparent}
|
|
91
80
|
class:!border-error={!valid}
|
|
92
81
|
>
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
oninput={handleInput}
|
|
126
|
-
onblur={handleBlur}
|
|
127
|
-
{onkeydown}
|
|
128
|
-
bind:this={input}
|
|
129
|
-
{value}
|
|
130
|
-
{autofocus}
|
|
131
|
-
{placeholder}
|
|
132
|
-
{maxlength}
|
|
133
|
-
{readonly}
|
|
134
|
-
/>
|
|
135
|
-
<div class="whitespace-nowrap text-secondary">
|
|
136
|
-
{@render suffix?.()}
|
|
137
|
-
</div>
|
|
82
|
+
<div class="whitespace-nowrap text-secondary">
|
|
83
|
+
{@render prefix?.({ valid })}
|
|
84
|
+
</div>
|
|
85
|
+
<input
|
|
86
|
+
{id}
|
|
87
|
+
class="inline leading-none"
|
|
88
|
+
class:has-text={value}
|
|
89
|
+
class:has-placeholder={rest.placeholder}
|
|
90
|
+
aria-label={label}
|
|
91
|
+
{type}
|
|
92
|
+
oninput={handleInput}
|
|
93
|
+
onblur={handleBlur}
|
|
94
|
+
bind:this={input}
|
|
95
|
+
bind:value
|
|
96
|
+
{...rest}
|
|
97
|
+
/>
|
|
98
|
+
<div class="whitespace-nowrap text-secondary">
|
|
99
|
+
{@render suffix?.()}
|
|
100
|
+
</div>
|
|
101
|
+
|
|
102
|
+
{#if clearable && value}
|
|
103
|
+
<IconButton
|
|
104
|
+
variant="transparent"
|
|
105
|
+
size="xs"
|
|
106
|
+
onclick={() => {
|
|
107
|
+
value = '';
|
|
108
|
+
input?.focus();
|
|
109
|
+
onclear();
|
|
110
|
+
}}
|
|
111
|
+
>
|
|
112
|
+
<Icon iconName="X" />
|
|
113
|
+
</IconButton>
|
|
138
114
|
{/if}
|
|
139
115
|
</div>
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
{/if}
|
|
116
|
+
|
|
117
|
+
{@render error?.()}
|
|
143
118
|
</div>
|
|
144
119
|
|
|
145
120
|
<style>
|
|
146
|
-
input
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
121
|
+
input {
|
|
122
|
+
|
|
123
|
+
width: 100%;
|
|
124
|
+
|
|
125
|
+
resize: none;
|
|
126
|
+
|
|
127
|
+
outline: 2px solid transparent;
|
|
128
|
+
|
|
129
|
+
outline-offset: 2px
|
|
153
130
|
}
|
|
154
131
|
|
|
155
132
|
div:not(:focus-within):hover {
|
|
156
|
-
|
|
133
|
+
|
|
134
|
+
border-color: #5750ee40
|
|
157
135
|
}
|
|
158
136
|
|
|
159
137
|
div:focus-within {
|
|
160
|
-
|
|
161
|
-
|
|
138
|
+
|
|
139
|
+
--tw-border-opacity: 1;
|
|
140
|
+
|
|
141
|
+
border-color: rgb(87 80 238 / var(--tw-border-opacity, 1))
|
|
162
142
|
}
|
|
163
143
|
|
|
164
144
|
.size-xs {
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
145
|
+
|
|
146
|
+
height: 1.5rem;
|
|
147
|
+
|
|
148
|
+
padding: 0.5rem;
|
|
149
|
+
|
|
150
|
+
font-size: 0.75rem;
|
|
151
|
+
|
|
152
|
+
line-height: 1rem
|
|
169
153
|
}
|
|
170
154
|
|
|
171
155
|
.size-sm {
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
156
|
+
|
|
157
|
+
height: 2rem;
|
|
158
|
+
|
|
159
|
+
padding-left: 0.75rem;
|
|
160
|
+
|
|
161
|
+
padding-right: 0.75rem;
|
|
162
|
+
|
|
163
|
+
padding-top: 0.5rem;
|
|
164
|
+
|
|
165
|
+
padding-bottom: 0.5rem
|
|
177
166
|
}
|
|
178
167
|
|
|
179
168
|
.size-md {
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
169
|
+
|
|
170
|
+
height: 2.5rem;
|
|
171
|
+
|
|
172
|
+
padding-left: 0.75rem;
|
|
173
|
+
|
|
174
|
+
padding-right: 0.75rem;
|
|
175
|
+
|
|
176
|
+
padding-top: 0.5rem;
|
|
177
|
+
|
|
178
|
+
padding-bottom: 0.5rem
|
|
185
179
|
}
|
|
186
180
|
|
|
187
181
|
.size-lg {
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
182
|
+
|
|
183
|
+
height: 3rem;
|
|
184
|
+
|
|
185
|
+
padding-left: 0.75rem;
|
|
186
|
+
|
|
187
|
+
padding-right: 0.75rem;
|
|
188
|
+
|
|
189
|
+
padding-top: 0.75rem;
|
|
190
|
+
|
|
191
|
+
padding-bottom: 0.75rem;
|
|
192
|
+
|
|
193
|
+
font-size: 1rem;
|
|
194
|
+
|
|
195
|
+
line-height: 1.5rem
|
|
195
196
|
}
|
|
196
197
|
|
|
197
198
|
.size-dynamic {
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
199
|
+
|
|
200
|
+
height: auto;
|
|
201
|
+
|
|
202
|
+
padding-left: 0.75rem;
|
|
203
|
+
|
|
204
|
+
padding-right: 0.75rem;
|
|
205
|
+
|
|
206
|
+
padding-top: 0.5rem;
|
|
207
|
+
|
|
208
|
+
padding-bottom: 0.5rem
|
|
203
209
|
}
|
|
204
210
|
</style>
|
|
@@ -1,24 +1,23 @@
|
|
|
1
1
|
import type { Snippet } from 'svelte';
|
|
2
|
-
|
|
2
|
+
import type { HTMLInputAttributes } from 'svelte/elements';
|
|
3
|
+
interface InputProps extends Omit<HTMLInputAttributes, 'size' | 'prefix' | 'suffix'> {
|
|
3
4
|
label?: string | null;
|
|
4
|
-
value: string | number;
|
|
5
|
-
type?: 'text' | 'password' | 'textarea' | 'number';
|
|
6
|
-
name?: string;
|
|
7
|
-
required?: boolean;
|
|
8
|
-
autofocus?: boolean;
|
|
9
|
-
placeholder?: string;
|
|
10
5
|
id?: string | undefined;
|
|
11
6
|
validator?: (a: string | number) => boolean;
|
|
12
|
-
onBlur?: (e: Event) => void;
|
|
13
|
-
onkeydown?: (e: KeyboardEvent) => void;
|
|
14
7
|
prefix?: Snippet<[any]>;
|
|
15
8
|
suffix?: Snippet;
|
|
16
9
|
error?: Snippet;
|
|
17
|
-
input?: HTMLInputElement
|
|
18
|
-
maxlength?: number | null;
|
|
10
|
+
input?: HTMLInputElement;
|
|
19
11
|
size?: 'xs' | 'sm' | 'md' | 'lg' | 'dynamic';
|
|
20
|
-
|
|
12
|
+
transparent?: boolean;
|
|
13
|
+
clearable?: boolean;
|
|
14
|
+
onclear?: () => void;
|
|
15
|
+
class?: string;
|
|
16
|
+
oninput?: (event: Event) => void;
|
|
17
|
+
onblur?: (event: FocusEvent) => void;
|
|
21
18
|
}
|
|
22
|
-
declare const Input: import("svelte").Component<
|
|
19
|
+
declare const Input: import("svelte").Component<InputProps, {
|
|
20
|
+
focus: () => void;
|
|
21
|
+
}, "value" | "input">;
|
|
23
22
|
type Input = ReturnType<typeof Input>;
|
|
24
23
|
export default Input;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
<script module lang="ts">
|
|
2
|
+
import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
3
|
+
import Label from './Label.svelte';
|
|
4
|
+
|
|
5
|
+
const { Story } = defineMeta({
|
|
6
|
+
title: 'Design System/Label',
|
|
7
|
+
component: Label,
|
|
8
|
+
argTypes: {
|
|
9
|
+
text: { control: 'text' },
|
|
10
|
+
forId: { control: 'text' },
|
|
11
|
+
required: { control: 'boolean' },
|
|
12
|
+
class: { control: 'text' }
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
</script>
|
|
16
|
+
|
|
17
|
+
<Story name="Default" args={{ text: 'Email Address', forId: 'email' }} />
|
|
18
|
+
|
|
19
|
+
<Story name="Required" args={{ text: 'Password', forId: 'password', required: true }} />
|
|
20
|
+
|
|
21
|
+
<Story
|
|
22
|
+
name="With Custom Class"
|
|
23
|
+
args={{
|
|
24
|
+
text: 'Custom Styled Label',
|
|
25
|
+
forId: 'custom',
|
|
26
|
+
class: 'text-lg text-primary font-bold'
|
|
27
|
+
}}
|
|
28
|
+
/>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import Label from './Label.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 Label: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
|
|
16
|
+
[evt: string]: CustomEvent<any>;
|
|
17
|
+
}, {}, {}, string>;
|
|
18
|
+
type Label = InstanceType<typeof Label>;
|
|
19
|
+
export default Label;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
interface Props {
|
|
3
|
+
forId: string;
|
|
4
|
+
text: string;
|
|
5
|
+
required?: boolean;
|
|
6
|
+
class?: string;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const { forId, text, required = false, class: className }: Props = $props();
|
|
10
|
+
</script>
|
|
11
|
+
|
|
12
|
+
<label for={forId} class="block text-sm text-secondary {className ?? ''}">
|
|
13
|
+
{text}
|
|
14
|
+
{#if required}
|
|
15
|
+
<span class="ml-0.5 text-danger">*</span>
|
|
16
|
+
{/if}
|
|
17
|
+
</label>
|