@functionalcms/svelte-components 2.33.1 → 2.34.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/Link.svelte +290 -290
- package/dist/components/agnostic/Alert/Alert.svelte +310 -0
- package/dist/components/agnostic/Alert/Alert.svelte.d.ts +31 -0
- package/dist/components/agnostic/Avatar/Avatar.svelte +123 -0
- package/dist/components/agnostic/Avatar/Avatar.svelte.d.ts +26 -0
- package/dist/components/agnostic/Avatar/AvatarGroup.svelte +106 -0
- package/dist/components/agnostic/Avatar/AvatarGroup.svelte.d.ts +29 -0
- package/dist/components/agnostic/Breadcrumb/Breadcrumb.svelte +56 -0
- package/dist/components/agnostic/Breadcrumb/Breadcrumb.svelte.d.ts +20 -0
- package/dist/components/agnostic/Breadcrumb/api.d.ts +4 -0
- package/dist/components/agnostic/Breadcrumb/api.js +1 -0
- package/dist/components/agnostic/Button/Button.svelte +345 -0
- package/dist/components/agnostic/Button/Button.svelte.d.ts +43 -0
- package/dist/components/agnostic/Button/ButtonGroup.svelte +20 -0
- package/dist/components/agnostic/Button/ButtonGroup.svelte.d.ts +23 -0
- package/dist/components/agnostic/Button/button-base.css +12 -0
- package/dist/components/agnostic/Button/button-core.css +237 -0
- package/dist/components/agnostic/Button/button-empty.css +31 -0
- package/dist/components/agnostic/Button/button-group.css +8 -0
- package/dist/components/agnostic/Card/Card.svelte +133 -0
- package/dist/components/agnostic/Card/Card.svelte.d.ts +31 -0
- package/dist/components/agnostic/ChoiceInput/ChoiceInput.svelte +337 -0
- package/dist/components/agnostic/ChoiceInput/ChoiceInput.svelte.d.ts +37 -0
- package/dist/components/agnostic/ChoiceInput/api.d.ts +7 -0
- package/dist/components/agnostic/ChoiceInput/api.js +1 -0
- package/dist/components/agnostic/Close/Close.svelte +120 -0
- package/dist/components/agnostic/Close/Close.svelte.d.ts +23 -0
- package/dist/components/agnostic/Close/api.d.ts +1 -0
- package/dist/components/agnostic/Close/api.js +1 -0
- package/dist/components/agnostic/Dialog/Dialog.svelte +265 -0
- package/dist/components/agnostic/Dialog/Dialog.svelte.d.ts +39 -0
- package/dist/components/agnostic/Disclose/Disclose.svelte +102 -0
- package/dist/components/agnostic/Disclose/Disclose.svelte.d.ts +23 -0
- package/dist/components/agnostic/Divider/Divider.svelte +139 -0
- package/dist/components/agnostic/Divider/Divider.svelte.d.ts +25 -0
- package/dist/components/agnostic/Divider/api.d.ts +3 -0
- package/dist/components/agnostic/Divider/api.js +1 -0
- package/dist/components/agnostic/Drawer/Drawer.svelte +30 -0
- package/dist/components/agnostic/Drawer/Drawer.svelte.d.ts +28 -0
- package/dist/components/agnostic/Drawer/api.d.ts +1 -0
- package/dist/components/agnostic/Drawer/api.js +1 -0
- package/dist/components/agnostic/EmptyState/EmptyState.svelte +46 -0
- package/dist/components/agnostic/EmptyState/EmptyState.svelte.d.ts +23 -0
- package/dist/components/agnostic/Header/Header.svelte +104 -0
- package/dist/components/agnostic/Header/Header.svelte.d.ts +26 -0
- package/dist/components/agnostic/Header/HeaderNav.svelte +28 -0
- package/dist/components/agnostic/Header/HeaderNav.svelte.d.ts +20 -0
- package/dist/components/agnostic/Header/HeaderNavItem.svelte +30 -0
- package/dist/components/agnostic/Header/HeaderNavItem.svelte.d.ts +20 -0
- package/dist/components/agnostic/Icon/Icon.svelte +180 -0
- package/dist/components/agnostic/Icon/Icon.svelte.d.ts +23 -0
- package/dist/components/agnostic/Icon/api.d.ts +2 -0
- package/dist/components/agnostic/Icon/api.js +1 -0
- package/dist/components/agnostic/Input/Input.svelte +415 -0
- package/dist/components/agnostic/Input/Input.svelte.d.ts +45 -0
- package/dist/components/agnostic/Input/InputAddonItem.svelte +42 -0
- package/dist/components/agnostic/Input/InputAddonItem.svelte.d.ts +33 -0
- package/dist/components/agnostic/Loader/Loader.svelte +113 -0
- package/dist/components/agnostic/Loader/Loader.svelte.d.ts +20 -0
- package/dist/components/agnostic/Menu/Menu.svelte +466 -0
- package/dist/components/agnostic/Menu/Menu.svelte.d.ts +31 -0
- package/dist/components/agnostic/Menu/MenuItem.svelte +117 -0
- package/dist/components/agnostic/Menu/MenuItem.svelte.d.ts +29 -0
- package/dist/components/agnostic/Progress/Progress.svelte +50 -0
- package/dist/components/agnostic/Progress/Progress.svelte.d.ts +20 -0
- package/dist/components/agnostic/Select/Select.svelte +141 -0
- package/dist/components/agnostic/Select/Select.svelte.d.ts +32 -0
- package/dist/components/agnostic/Spinner/Spinner.svelte +105 -0
- package/dist/components/agnostic/Spinner/Spinner.svelte.d.ts +19 -0
- package/dist/components/agnostic/Switch/Switch.svelte +275 -0
- package/dist/components/agnostic/Switch/Switch.svelte.d.ts +45 -0
- package/dist/components/agnostic/Table/Table.svelte +508 -0
- package/dist/components/agnostic/Table/Table.svelte.d.ts +36 -0
- package/dist/components/agnostic/Table/TableCustomRenderComponent.svelte +13 -0
- package/dist/components/agnostic/Table/TableCustomRenderComponent.svelte.d.ts +25 -0
- package/dist/components/agnostic/Tabs/TabButtonCustom.svelte +65 -0
- package/dist/components/agnostic/Tabs/TabButtonCustom.svelte.d.ts +35 -0
- package/dist/components/agnostic/Tabs/Tabs.svelte +330 -0
- package/dist/components/agnostic/Tabs/Tabs.svelte.d.ts +34 -0
- package/dist/components/agnostic/Tabs/api.d.ts +10 -0
- package/dist/components/agnostic/Tabs/api.js +1 -0
- package/dist/components/agnostic/Tag/Tag.svelte +74 -0
- package/dist/components/agnostic/Tag/Tag.svelte.d.ts +23 -0
- package/dist/components/agnostic/Tag/TagSlots.svelte +51 -0
- package/dist/components/agnostic/Tag/TagSlots.svelte.d.ts +16 -0
- package/dist/components/agnostic/Toasts/Toasts.svelte +46 -0
- package/dist/components/agnostic/Toasts/Toasts.svelte.d.ts +22 -0
- package/dist/components/agnostic/Tooltip/Tooltip.svelte +103 -0
- package/dist/components/agnostic/Tooltip/Tooltip.svelte.d.ts +23 -0
- package/dist/components/agnostic/Tooltip/TooltipSlots.svelte +81 -0
- package/dist/components/agnostic/Tooltip/TooltipSlots.svelte.d.ts +16 -0
- package/dist/components/agnostic/Tooltip/api.d.ts +1 -0
- package/dist/components/agnostic/Tooltip/api.js +1 -0
- package/dist/components/agnostic/animation.css +37 -0
- package/dist/components/files/utils.js +1 -1
- package/dist/index.d.ts +30 -1
- package/dist/index.js +30 -1
- package/package.json +1 -4
|
@@ -0,0 +1,415 @@
|
|
|
1
|
+
<style>
|
|
2
|
+
.input-base,
|
|
3
|
+
.input {
|
|
4
|
+
/* Note this cannot be user-select: none else mobile safari won't accept input:
|
|
5
|
+
https://stackoverflow.com/questions/49889003/cannot-write-into-input-field-on-safari/49901069
|
|
6
|
+
*/
|
|
7
|
+
user-select: initial;
|
|
8
|
+
appearance: none;
|
|
9
|
+
box-sizing: border-box;
|
|
10
|
+
|
|
11
|
+
/* Use the same color for the cursor */
|
|
12
|
+
caret-color: currentColor;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.label,
|
|
16
|
+
.label-base {
|
|
17
|
+
padding: 0;
|
|
18
|
+
border: 0;
|
|
19
|
+
box-sizing: border-box;
|
|
20
|
+
font-family: inherit;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/* Electing to scope these as opposed to doing :root level definitions */
|
|
24
|
+
.field-help,
|
|
25
|
+
.field-help-large,
|
|
26
|
+
.field-help-small,
|
|
27
|
+
.field-error,
|
|
28
|
+
.field-error-large,
|
|
29
|
+
.field-error-small,
|
|
30
|
+
.label-skin,
|
|
31
|
+
.label,
|
|
32
|
+
.input-addon-container,
|
|
33
|
+
.input-small,
|
|
34
|
+
.input-large,
|
|
35
|
+
.input-skin,
|
|
36
|
+
.input-underlined,
|
|
37
|
+
.input-underlined-bg,
|
|
38
|
+
.input {
|
|
39
|
+
color: var(--functional-font-color, var(--functional-dark));
|
|
40
|
+
font-family: var(--functional-font-family-body);
|
|
41
|
+
font-weight: var(--functional-font-weight, 300);
|
|
42
|
+
font-size: var(--functional-font-size, 1rem);
|
|
43
|
+
line-height: var(--functional-line-height, var(--fluid-20, 1.25rem));
|
|
44
|
+
width: 100%;
|
|
45
|
+
max-width: 100%;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.input-skin,
|
|
49
|
+
.input {
|
|
50
|
+
/* seems like a reasonable default as chrome picks `outset` which results in a weird 3d effect */
|
|
51
|
+
border-style: solid;
|
|
52
|
+
|
|
53
|
+
/* this can be overriden, but it might mess with the balance of the button heights across variants */
|
|
54
|
+
border-width: var(--functional-input-border-size, 1px);
|
|
55
|
+
border-color: var(--functional-input-border-color, var(--functional-gray-light));
|
|
56
|
+
|
|
57
|
+
/* these can be overriden, but it might mess with the balance of the inputheights across variants */
|
|
58
|
+
padding-block-start: var(--functional-input-vertical-pad, 0.5rem);
|
|
59
|
+
padding-block-end: var(--functional-input-vertical-pad, 0.5rem);
|
|
60
|
+
padding-inline-start: var(--functional-input-side-padding, 0.75rem);
|
|
61
|
+
padding-inline-end: var(--functional-input-side-padding, 0.75rem);
|
|
62
|
+
|
|
63
|
+
/* Note we only want to set properties that we actually want
|
|
64
|
+
to transition in. For example, if we transition "all", the
|
|
65
|
+
inputs will "grow in" on page load—not a happy effect :) */
|
|
66
|
+
transition-property: box-shadow;
|
|
67
|
+
transition-duration: var(--functional-input-timing, var(--functional-timing-medium));
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.label {
|
|
71
|
+
display: inline-block;
|
|
72
|
+
|
|
73
|
+
/* Provided --functional-input-vertical-pad isn't overriden we'll get 20px
|
|
74
|
+
label w/a 6px margin then a 38px input = 64 which is on the 8pt grid */
|
|
75
|
+
margin-block-start: 0;
|
|
76
|
+
margin-inline-start: 0;
|
|
77
|
+
margin-inline-end: 0;
|
|
78
|
+
margin-block-end: var(--functional-input-label-pad, 0.375rem);
|
|
79
|
+
vertical-align: initial;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/* Reset field errors and help text to be 2px less then input font size */
|
|
83
|
+
.field-help,
|
|
84
|
+
.field-error {
|
|
85
|
+
font-size: calc(var(--functional-font-size, 1rem) - 2px);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.label-inline,
|
|
89
|
+
.input-inline {
|
|
90
|
+
width: auto;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/* When inlined, the margin-block-end will throw the label off-center with adjacent input */
|
|
94
|
+
.label-inline {
|
|
95
|
+
margin-block-start: 0;
|
|
96
|
+
margin-block-end: 0;
|
|
97
|
+
margin-inline-start: 0;
|
|
98
|
+
margin-inline-end: var(--functional-input-side-padding, 0.75rem);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Placeholder
|
|
103
|
+
*/
|
|
104
|
+
|
|
105
|
+
/* stylelint-disable-next-line */
|
|
106
|
+
.input::-webkit-input-placeholder {
|
|
107
|
+
color: currentColor;
|
|
108
|
+
opacity: 50%;
|
|
109
|
+
transition: opacity var(--functional-timing-fast) ease-out;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/* stylelint-disable-next-line */
|
|
113
|
+
.input::placeholder {
|
|
114
|
+
color: currentColor;
|
|
115
|
+
opacity: 50%;
|
|
116
|
+
transition: opacity var(--functional-timing-fast) ease-out;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/* stylelint-disable-next-line */
|
|
120
|
+
.input::-ms-placeholder {
|
|
121
|
+
color: currentColor;
|
|
122
|
+
opacity: 50%;
|
|
123
|
+
transition: opacity var(--functional-timing-fast) ease-out;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
/* stylelint-disable-next-line */
|
|
127
|
+
.input:-ms-placeholder {
|
|
128
|
+
color: currentColor;
|
|
129
|
+
opacity: 50%;
|
|
130
|
+
transition: opacity var(--functional-timing-fast) ease-out;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* Underlined inputs
|
|
135
|
+
*/
|
|
136
|
+
.input-underlined {
|
|
137
|
+
border-top: 0;
|
|
138
|
+
border-left: 0;
|
|
139
|
+
border-right: 0;
|
|
140
|
+
border-color: var(--functional-input-underlined-color, var(--functional-gray-mid-dark));
|
|
141
|
+
background-color: transparent;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
.input-underlined-bg {
|
|
145
|
+
background-color: var(--functional-input-underlined-bg-color, var(--functional-gray-extra-light));
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* Rounded inputs
|
|
150
|
+
*/
|
|
151
|
+
.input-rounded {
|
|
152
|
+
border-radius: var(--functional-radius, 0.25rem);
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* Errors
|
|
157
|
+
* We provide a class-based approach to setting errors which means we do
|
|
158
|
+
* not support :invalid, so it requires custom use of html4 validation API
|
|
159
|
+
* (see https://developer.mozilla.org/en-US/docs/Learn/Forms/Form_validation
|
|
160
|
+
* of the example in corresponding input.html file). The reason I elected to
|
|
161
|
+
* not include :invalid, is it seems to result in "shouting" at the user as
|
|
162
|
+
* I did not find an easy way to only kick in errors after a certain number
|
|
163
|
+
* of characters have been type (blur is actually better but I did not
|
|
164
|
+
* implement that in the contrived example).
|
|
165
|
+
*/
|
|
166
|
+
.label-error {
|
|
167
|
+
color: var(--functional-input-error-color, var(--functional-error));
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
.input-error {
|
|
171
|
+
border-color: var(--functional-input-error-color, var(--functional-error));
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
.label-error,
|
|
175
|
+
.field-error,
|
|
176
|
+
.field-error-small,
|
|
177
|
+
.field-error-large {
|
|
178
|
+
color: var(--functional-input-error-color, var(--functional-error));
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
.field-help,
|
|
182
|
+
.field-help-small,
|
|
183
|
+
.field-help-large {
|
|
184
|
+
color: var(--functional-input-help-color, var(--functional-gray-dark));
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
.field-help,
|
|
188
|
+
.field-help-small,
|
|
189
|
+
.field-help-large,
|
|
190
|
+
.field-error,
|
|
191
|
+
.field-error-small,
|
|
192
|
+
.field-error-large {
|
|
193
|
+
display: inline-block;
|
|
194
|
+
width: 100%;
|
|
195
|
+
margin-block-start: calc(var(--functional-input-vertical-pad, 0.5rem) / 2);
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
/**
|
|
199
|
+
* Sizes
|
|
200
|
+
*/
|
|
201
|
+
.input-large {
|
|
202
|
+
font-size: calc(var(--functional-font-size, 1rem) + 0.25rem);
|
|
203
|
+
line-height: 1.6rem;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
.field-help-large,
|
|
207
|
+
.field-error-large {
|
|
208
|
+
/* We initially remove -2px from font-size so setting to font-size essentially adds the 2px back */
|
|
209
|
+
font-size: var(--functional-font-size, 1rem);
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
.label-large {
|
|
213
|
+
font-size: calc(var(--functional-font-size, 1rem) + 0.25rem);
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
.input-small {
|
|
217
|
+
font-size: calc(var(--functional-font-size, 1rem) - 0.25rem);
|
|
218
|
+
line-height: 1rem;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
.field-help-small,
|
|
222
|
+
.field-error-small,
|
|
223
|
+
.label-small {
|
|
224
|
+
font-size: calc(var(--functional-font-size, 1rem) - 0.25rem);
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
.input:focus {
|
|
228
|
+
box-shadow: 0 0 0 var(--functional-focus-ring-outline-width) var(--functional-focus-ring-color);
|
|
229
|
+
|
|
230
|
+
/* Needed for High Contrast mode */
|
|
231
|
+
outline:
|
|
232
|
+
var(--functional-focus-ring-outline-width) var(--functional-focus-ring-outline-style)
|
|
233
|
+
var(--functional-focus-ring-outline-color);
|
|
234
|
+
transition: box-shadow var(--functional-timing-fast) ease-out;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
/* Set the focus to transparent when there's an error since we use
|
|
238
|
+
borders that visually conflict. */
|
|
239
|
+
.input-error:focus {
|
|
240
|
+
box-shadow: 0 0 0 3px transparent;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
/*
|
|
244
|
+
* Disabled State
|
|
245
|
+
*
|
|
246
|
+
* The disabled state uses the class .disabled,
|
|
247
|
+
* and the form attribute disabled="disabled".
|
|
248
|
+
* The use of !important is only added because this is a state
|
|
249
|
+
* that must be applied to all inputs when in a disabled state.
|
|
250
|
+
*/
|
|
251
|
+
.input.disabled, /* DEPRECATED -- TODO remove class based disabled */
|
|
252
|
+
.input:disabled {
|
|
253
|
+
background: var(--functional-input-disabled-bg, var(--functional-disabled-bg)) !important;
|
|
254
|
+
color: var(--functional-input-disabled-color, var(--functional-disabled-color)) !important;
|
|
255
|
+
appearance: none !important;
|
|
256
|
+
box-shadow: none !important;
|
|
257
|
+
cursor: not-allowed !important;
|
|
258
|
+
opacity: 80% !important;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
@media screen and (-ms-high-contrast: active) {
|
|
262
|
+
/* High contrast mode outline hacks */
|
|
263
|
+
|
|
264
|
+
/* styleint-disable-next-line no-descending-specificity */
|
|
265
|
+
.input:disabled {
|
|
266
|
+
outline: 2px solid transparent;
|
|
267
|
+
outline-offset: -2px;
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
/**
|
|
272
|
+
* Input "has addon"
|
|
273
|
+
*/
|
|
274
|
+
|
|
275
|
+
.input-addon-container {
|
|
276
|
+
display: flex;
|
|
277
|
+
position: relative;
|
|
278
|
+
width: 100%;
|
|
279
|
+
min-height: 100%;
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
.input-has-left-addon {
|
|
283
|
+
padding-left: calc(var(--functional-side-padding) * 3);
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
.input-has-right-addon {
|
|
287
|
+
padding-right: calc(var(--functional-side-padding) * 3);
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
.input-addon-left {
|
|
291
|
+
left: var(--functional-input-side-padding);
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
.input-addon-right {
|
|
295
|
+
right: var(--functional-input-side-padding);
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
@media (prefers-reduced-motion), (update: slow) {
|
|
299
|
+
/* stylelint-disable selector-no-vendor-prefix */
|
|
300
|
+
.input-skin,
|
|
301
|
+
.input,
|
|
302
|
+
.input::placeholder,
|
|
303
|
+
.input::-webkit-input-placeholder,
|
|
304
|
+
.input::-ms-placeholder,
|
|
305
|
+
.input:-ms-placeholder,
|
|
306
|
+
.input:focus {
|
|
307
|
+
transition-duration: 0.001ms !important;
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
</style>
|
|
312
|
+
<script>export let label = "";
|
|
313
|
+
export let id = "";
|
|
314
|
+
export let labelCss = "";
|
|
315
|
+
export let isLabelHidden = false;
|
|
316
|
+
export let helpText = "";
|
|
317
|
+
export let invalidText = "";
|
|
318
|
+
export let hasLeftAddon = false;
|
|
319
|
+
export let hasRightAddon = false;
|
|
320
|
+
export let isInvalid = false;
|
|
321
|
+
export let isInline = false;
|
|
322
|
+
export let isRounded = false;
|
|
323
|
+
export let isDisabled = void 0;
|
|
324
|
+
export let css = "";
|
|
325
|
+
export let isSkinned = true;
|
|
326
|
+
export let isUnderlinedWithBackground = false;
|
|
327
|
+
export let isUnderlined = false;
|
|
328
|
+
export let size = "";
|
|
329
|
+
export let type = "text";
|
|
330
|
+
export let value = "";
|
|
331
|
+
$: if (!value) value = "";
|
|
332
|
+
$: inputType = type;
|
|
333
|
+
$: labelClasses = [
|
|
334
|
+
"label",
|
|
335
|
+
isInvalid ? "label-error" : "",
|
|
336
|
+
isInline ? "label-inline" : "",
|
|
337
|
+
size ? `label-${size}` : "",
|
|
338
|
+
isLabelHidden ? "screenreader-only" : "",
|
|
339
|
+
labelCss ? labelCss : ""
|
|
340
|
+
].filter((c) => c).join(" ");
|
|
341
|
+
$: inputClasses = [
|
|
342
|
+
isSkinned ? "input" : "input-base",
|
|
343
|
+
isRounded ? "input-rounded" : "",
|
|
344
|
+
isUnderlined ? "input-underlined" : "",
|
|
345
|
+
hasLeftAddon ? "input-has-left-addon" : "",
|
|
346
|
+
hasRightAddon ? "input-has-right-addon" : "",
|
|
347
|
+
isDisabled ? "disabled" : "",
|
|
348
|
+
isInvalid ? "input-error" : "",
|
|
349
|
+
isInline ? "input-inline" : "",
|
|
350
|
+
isUnderlinedWithBackground ? "input-underlined-bg" : "",
|
|
351
|
+
css ? css : "",
|
|
352
|
+
size ? `input-${size}` : ""
|
|
353
|
+
].filter((c) => c).join(" ");
|
|
354
|
+
$: invalidClasses = () => {
|
|
355
|
+
return size ? `field-error-${size}` : "field-error";
|
|
356
|
+
};
|
|
357
|
+
$: helpClasses = () => {
|
|
358
|
+
return size ? `field-help-${size}` : "field-help";
|
|
359
|
+
};
|
|
360
|
+
$: addonContainerClasses = () => "input-addon-container";
|
|
361
|
+
const handleInput = (e) => {
|
|
362
|
+
value = e.target.value;
|
|
363
|
+
};
|
|
364
|
+
</script>
|
|
365
|
+
<div class="w-100">
|
|
366
|
+
<label class={labelClasses} for={id}>{label}</label>
|
|
367
|
+
{#if type == "textarea"}
|
|
368
|
+
<textarea
|
|
369
|
+
id={id}
|
|
370
|
+
class={inputClasses}
|
|
371
|
+
on:blur
|
|
372
|
+
on:change
|
|
373
|
+
bind:value
|
|
374
|
+
on:click
|
|
375
|
+
on:focus
|
|
376
|
+
{...$$restProps}></textarea>
|
|
377
|
+
{:else if hasLeftAddon || hasRightAddon}
|
|
378
|
+
<div class={addonContainerClasses()}>
|
|
379
|
+
<slot name="addonLeft" />
|
|
380
|
+
<input
|
|
381
|
+
id={id}
|
|
382
|
+
type={inputType}
|
|
383
|
+
value={value}
|
|
384
|
+
class={inputClasses}
|
|
385
|
+
disabled={isDisabled}
|
|
386
|
+
on:blur
|
|
387
|
+
on:change
|
|
388
|
+
on:input={handleInput}
|
|
389
|
+
on:click
|
|
390
|
+
on:focus
|
|
391
|
+
{...$$restProps}
|
|
392
|
+
/>
|
|
393
|
+
<slot name="addonRight" />
|
|
394
|
+
</div>
|
|
395
|
+
{:else}
|
|
396
|
+
<input
|
|
397
|
+
id={id}
|
|
398
|
+
type={inputType}
|
|
399
|
+
value={value}
|
|
400
|
+
class={inputClasses}
|
|
401
|
+
disabled={isDisabled}
|
|
402
|
+
on:blur
|
|
403
|
+
on:change
|
|
404
|
+
on:input={handleInput}
|
|
405
|
+
on:click
|
|
406
|
+
on:focus
|
|
407
|
+
{...$$restProps}
|
|
408
|
+
/>
|
|
409
|
+
{/if}
|
|
410
|
+
{#if isInvalid}
|
|
411
|
+
<span role="status" aria-live="polite" class={invalidClasses()}>
|
|
412
|
+
{invalidText}
|
|
413
|
+
</span>
|
|
414
|
+
{:else if helpText}<span class={helpClasses()}>{helpText}</span>{/if}
|
|
415
|
+
</div>
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { SvelteComponent } from "svelte";
|
|
2
|
+
declare const __propDef: {
|
|
3
|
+
props: {
|
|
4
|
+
[x: string]: any;
|
|
5
|
+
label?: string | undefined;
|
|
6
|
+
id?: string | undefined;
|
|
7
|
+
labelCss?: string | undefined;
|
|
8
|
+
isLabelHidden?: boolean | undefined;
|
|
9
|
+
helpText?: string | undefined;
|
|
10
|
+
invalidText?: string | undefined;
|
|
11
|
+
hasLeftAddon?: boolean | undefined;
|
|
12
|
+
hasRightAddon?: boolean | undefined;
|
|
13
|
+
isInvalid?: boolean | undefined;
|
|
14
|
+
isInline?: boolean | undefined;
|
|
15
|
+
isRounded?: boolean | undefined;
|
|
16
|
+
isDisabled?: undefined;
|
|
17
|
+
css?: string | undefined;
|
|
18
|
+
isSkinned?: boolean | undefined;
|
|
19
|
+
isUnderlinedWithBackground?: boolean | undefined;
|
|
20
|
+
isUnderlined?: boolean | undefined;
|
|
21
|
+
size?: ("small" | "large" | "") | undefined;
|
|
22
|
+
type?: ("text" | "textarea" | "email" | "search" | "password" | "tel" | "number" | "url" | "month" | "time" | "week" | "date" | "datetime-local" | "color") | undefined;
|
|
23
|
+
value?: string | undefined;
|
|
24
|
+
};
|
|
25
|
+
events: {
|
|
26
|
+
blur: FocusEvent;
|
|
27
|
+
change: Event;
|
|
28
|
+
click: MouseEvent;
|
|
29
|
+
focus: FocusEvent;
|
|
30
|
+
} & {
|
|
31
|
+
[evt: string]: CustomEvent<any>;
|
|
32
|
+
};
|
|
33
|
+
slots: {
|
|
34
|
+
addonLeft: {};
|
|
35
|
+
addonRight: {};
|
|
36
|
+
};
|
|
37
|
+
exports?: undefined;
|
|
38
|
+
bindings?: undefined;
|
|
39
|
+
};
|
|
40
|
+
export type InputProps = typeof __propDef.props;
|
|
41
|
+
export type InputEvents = typeof __propDef.events;
|
|
42
|
+
export type InputSlots = typeof __propDef.slots;
|
|
43
|
+
export default class Input extends SvelteComponent<InputProps, InputEvents, InputSlots> {
|
|
44
|
+
}
|
|
45
|
+
export {};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
<style>
|
|
2
|
+
/*
|
|
3
|
+
* Input addons e.g. icons inside the input
|
|
4
|
+
*/
|
|
5
|
+
.input-addon-right,
|
|
6
|
+
.input-addon-left {
|
|
7
|
+
display: flex;
|
|
8
|
+
align-items: center;
|
|
9
|
+
justify-content: center;
|
|
10
|
+
position: absolute;
|
|
11
|
+
top: 0;
|
|
12
|
+
|
|
13
|
+
/* This allows an icon to sit in the vertical center regardless
|
|
14
|
+
of if we've applied input-large or input-small */
|
|
15
|
+
min-height: 100%;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.input-addon-left {
|
|
19
|
+
left: var(--functional-input-side-padding);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.input-addon-right {
|
|
23
|
+
right: var(--functional-input-side-padding);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
</style>
|
|
27
|
+
|
|
28
|
+
<script>
|
|
29
|
+
export let css = "";
|
|
30
|
+
export let addonLeft = false;
|
|
31
|
+
export let addonRight = false;
|
|
32
|
+
$: klasses = [
|
|
33
|
+
addonLeft ? "input-addon-left" : "",
|
|
34
|
+
addonRight ? "input-addon-right" : "",
|
|
35
|
+
css ? `${css}` : "",
|
|
36
|
+
].filter(c => c).join(" ");
|
|
37
|
+
</script>
|
|
38
|
+
|
|
39
|
+
<div class={klasses}>
|
|
40
|
+
<slot />
|
|
41
|
+
</div>
|
|
42
|
+
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/** @typedef {typeof __propDef.props} InputAddonItemProps */
|
|
2
|
+
/** @typedef {typeof __propDef.events} InputAddonItemEvents */
|
|
3
|
+
/** @typedef {typeof __propDef.slots} InputAddonItemSlots */
|
|
4
|
+
export default class InputAddonItem extends SvelteComponent<{
|
|
5
|
+
css?: string | undefined;
|
|
6
|
+
addonLeft?: boolean | undefined;
|
|
7
|
+
addonRight?: boolean | undefined;
|
|
8
|
+
}, {
|
|
9
|
+
[evt: string]: CustomEvent<any>;
|
|
10
|
+
}, {
|
|
11
|
+
default: {};
|
|
12
|
+
}> {
|
|
13
|
+
}
|
|
14
|
+
export type InputAddonItemProps = typeof __propDef.props;
|
|
15
|
+
export type InputAddonItemEvents = typeof __propDef.events;
|
|
16
|
+
export type InputAddonItemSlots = typeof __propDef.slots;
|
|
17
|
+
import { SvelteComponent } from "svelte";
|
|
18
|
+
declare const __propDef: {
|
|
19
|
+
props: {
|
|
20
|
+
css?: string | undefined;
|
|
21
|
+
addonLeft?: boolean | undefined;
|
|
22
|
+
addonRight?: boolean | undefined;
|
|
23
|
+
};
|
|
24
|
+
events: {
|
|
25
|
+
[evt: string]: CustomEvent<any>;
|
|
26
|
+
};
|
|
27
|
+
slots: {
|
|
28
|
+
default: {};
|
|
29
|
+
};
|
|
30
|
+
exports?: undefined;
|
|
31
|
+
bindings?: undefined;
|
|
32
|
+
};
|
|
33
|
+
export {};
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
<style>
|
|
2
|
+
.loader {
|
|
3
|
+
--loading-color: var(--functional-loading-color, var(--functional-dark));
|
|
4
|
+
--loading-size: var(--fluid-16);
|
|
5
|
+
--loading-size-small: var(--fluid-12);
|
|
6
|
+
--loading-size-large: var(--fluid-18);
|
|
7
|
+
|
|
8
|
+
position: relative;
|
|
9
|
+
box-sizing: border-box;
|
|
10
|
+
animation: blink 1s infinite;
|
|
11
|
+
animation-delay: 250ms;
|
|
12
|
+
|
|
13
|
+
/* Make up for negative positioning */
|
|
14
|
+
margin-left: var(--loading-size);
|
|
15
|
+
|
|
16
|
+
/* Initially set zero until aria-busy becomes true */
|
|
17
|
+
opacity: 0%;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.loader,
|
|
21
|
+
.loader::before,
|
|
22
|
+
.loader::after {
|
|
23
|
+
width: calc(var(--loading-size) / 2);
|
|
24
|
+
height: calc(var(--loading-size) / 2);
|
|
25
|
+
border-radius: var(--fluid-6);
|
|
26
|
+
background-color: var(--loading-color);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/* SMALL */
|
|
30
|
+
.loader-small,
|
|
31
|
+
.loader-small::before,
|
|
32
|
+
.loader-small::after {
|
|
33
|
+
width: calc(var(--loading-size-small) / 2);
|
|
34
|
+
height: calc(var(--loading-size-small) / 2);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/* LARGE */
|
|
38
|
+
.loader-large,
|
|
39
|
+
.loader-large::before,
|
|
40
|
+
.loader-large::after {
|
|
41
|
+
width: calc(var(--loading-size-large) / 2);
|
|
42
|
+
height: calc(var(--loading-size-large) / 2);
|
|
43
|
+
border-radius: var(--fluid-8);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.loader::before,
|
|
47
|
+
.loader::after {
|
|
48
|
+
content: "";
|
|
49
|
+
display: inline-block;
|
|
50
|
+
position: absolute;
|
|
51
|
+
top: 0;
|
|
52
|
+
animation: blink 1s infinite;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.loader::before {
|
|
56
|
+
left: calc(-1 * var(--loading-size));
|
|
57
|
+
animation-delay: 0s;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.loader::after {
|
|
61
|
+
left: var(--loading-size);
|
|
62
|
+
animation-delay: 500ms;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/* SMALL */
|
|
66
|
+
.loader-small::before {
|
|
67
|
+
left: calc(-1 * var(--loading-size-small));
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.loader-small::after {
|
|
71
|
+
left: var(--loading-size-small);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/* LARGE */
|
|
75
|
+
.loader-large::before {
|
|
76
|
+
left: calc(-1 * var(--loading-size-large));
|
|
77
|
+
animation-delay: 0s;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.loader-large::after {
|
|
81
|
+
left: var(--loading-size-large);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Setting aria-busy to true results in corresponding opacity change to visually show spinner.
|
|
86
|
+
*/
|
|
87
|
+
.loader[aria-busy="true"] {
|
|
88
|
+
opacity: 100%;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
@keyframes blink {
|
|
92
|
+
50% {
|
|
93
|
+
background-color: transparent;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
@media (prefers-reduced-motion), (update: slow) {
|
|
98
|
+
.loader,
|
|
99
|
+
.loader::before,
|
|
100
|
+
.loader::after {
|
|
101
|
+
transition-duration: 0.001ms !important;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
</style>
|
|
106
|
+
<script>export let ariaLabel = "Loading\u2026";
|
|
107
|
+
export let size = "";
|
|
108
|
+
export let loaderClasses = ["loader", size ? `loader-${size}` : ""].filter((c) => c).join(" ");
|
|
109
|
+
</script>
|
|
110
|
+
|
|
111
|
+
<div class={loaderClasses} role="status" aria-live="polite" aria-busy="true">
|
|
112
|
+
<span class="screenreader-only">{ariaLabel}</span>
|
|
113
|
+
</div>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { SvelteComponent } from "svelte";
|
|
2
|
+
declare const __propDef: {
|
|
3
|
+
props: {
|
|
4
|
+
ariaLabel?: string;
|
|
5
|
+
size?: "small" | "large" | "";
|
|
6
|
+
loaderClasses?: string;
|
|
7
|
+
};
|
|
8
|
+
events: {
|
|
9
|
+
[evt: string]: CustomEvent<any>;
|
|
10
|
+
};
|
|
11
|
+
slots: {};
|
|
12
|
+
exports?: {} | undefined;
|
|
13
|
+
bindings?: string | undefined;
|
|
14
|
+
};
|
|
15
|
+
export type LoaderProps = typeof __propDef.props;
|
|
16
|
+
export type LoaderEvents = typeof __propDef.events;
|
|
17
|
+
export type LoaderSlots = typeof __propDef.slots;
|
|
18
|
+
export default class Loader extends SvelteComponent<LoaderProps, LoaderEvents, LoaderSlots> {
|
|
19
|
+
}
|
|
20
|
+
export {};
|