@functionalcms/svelte-components 3.5.20 → 4.0.0-pre-2.0
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/css/functional.css +1 -1
- package/css/functional.css.map +1 -1
- package/dist/auth/authenticationHandle.js +0 -4
- package/dist/auth/redisSessionProvider.js +1 -2
- package/dist/auth/sessionIdGenerator.d.ts +1 -1
- package/dist/components/form/Button.svelte +379 -0
- package/dist/components/form/Button.svelte.d.ts +27 -0
- package/dist/components/form/Input.d.ts +21 -0
- package/dist/components/form/Input.js +23 -0
- package/dist/components/form/Input.svelte +142 -177
- package/dist/components/form/Input.svelte.d.ts +24 -46
- package/dist/components/{Banner.svelte → layouts/Banner.svelte} +5 -5
- package/dist/components/layouts/DefaultLayout.svelte +5 -5
- package/dist/components/layouts/DefaultLayout.svelte.d.ts +4 -4
- package/dist/components/layouts/SimpleFooter.svelte +4 -4
- package/dist/components/layouts/SimpleFooter.svelte.d.ts +3 -3
- package/dist/components/layouts/Well.svelte +46 -0
- package/dist/components/layouts/Well.svelte.d.ts +12 -0
- package/dist/components/menu/CollapsibleMenu.svelte +2 -2
- package/dist/components/menu/CollapsibleMenu.svelte.d.ts +3 -16
- package/dist/components/menu/DynamicMenu.svelte +25 -13
- package/dist/components/menu/DynamicMenu.svelte.d.ts +10 -28
- package/dist/components/menu/HamburgerMenu.svelte +29 -21
- package/dist/components/menu/HamburgerMenu.svelte.d.ts +11 -24
- package/dist/components/menu/ListMenu.svelte +53 -0
- package/dist/components/menu/ListMenu.svelte.d.ts +17 -0
- package/dist/components/menu/{Menu.d.ts → types.d.ts} +2 -0
- package/dist/components/menu/{Menu.js → types.js} +5 -0
- package/dist/components/presentation/Card.svelte +77 -92
- package/dist/components/presentation/Card.svelte.d.ts +10 -13
- package/dist/components/presentation/{Carusele.d.ts → Carousel.d.ts} +1 -1
- package/dist/components/presentation/Carousel.svelte +98 -1
- package/dist/components/presentation/Carousel.svelte.d.ts +14 -15
- package/dist/components/{agnostic/Disclose → presentation}/Disclose.svelte +2 -2
- package/dist/components/presentation/Drawer.svelte +131 -0
- package/dist/components/presentation/Drawer.svelte.d.ts +13 -0
- package/dist/components/presentation/Gallery.svelte +7 -7
- package/dist/components/presentation/Gallery.svelte.d.ts +3 -3
- package/dist/components/presentation/ImageCompare.svelte +39 -46
- package/dist/components/presentation/ImageCompare.svelte.d.ts +8 -26
- package/dist/components/presentation/Link.svelte +362 -0
- package/dist/components/presentation/Link.svelte.d.ts +27 -0
- package/dist/components/presentation/Logo.svelte +36 -0
- package/dist/components/presentation/Logo.svelte.d.ts +8 -0
- package/dist/components/presentation/ShowItem.d.ts +7 -7
- package/dist/components/presentation/ShowItem.js +1 -8
- package/dist/index-server.d.ts +0 -1
- package/dist/index-server.js +0 -3
- package/dist/index.d.ts +17 -22
- package/dist/index.js +40 -57
- package/dist/server-side/getServices.d.ts +1 -1
- package/dist/server-side/types.d.ts +1 -2
- package/dist/utils.d.ts +1 -0
- package/dist/utils.js +54 -0
- package/package.json +27 -24
- package/dist/components/CssHelper.d.ts +0 -1
- package/dist/components/CssHelper.js +0 -3
- package/dist/components/Link.svelte +0 -349
- package/dist/components/Link.svelte.d.ts +0 -48
- package/dist/components/Logo.svelte +0 -38
- package/dist/components/Logo.svelte.d.ts +0 -28
- package/dist/components/Spacer.svelte +0 -22
- package/dist/components/Spacer.svelte.d.ts +0 -6
- package/dist/components/Well.svelte +0 -40
- package/dist/components/Well.svelte.d.ts +0 -12
- package/dist/components/agnostic/Button/Button.svelte +0 -371
- package/dist/components/agnostic/Button/Button.svelte.d.ts +0 -52
- package/dist/components/agnostic/Button/ButtonGroup.svelte +0 -21
- package/dist/components/agnostic/Button/ButtonGroup.svelte.d.ts +0 -32
- package/dist/components/agnostic/Button/button-base.css +0 -12
- package/dist/components/agnostic/Button/button-core.css +0 -237
- package/dist/components/agnostic/Button/button-empty.css +0 -31
- package/dist/components/agnostic/Button/button-group.css +0 -8
- package/dist/components/agnostic/Close/Close.svelte +0 -124
- package/dist/components/agnostic/Close/Close.svelte.d.ts +0 -25
- package/dist/components/agnostic/Close/api.d.ts +0 -1
- package/dist/components/agnostic/Divider/Divider.svelte +0 -141
- package/dist/components/agnostic/Divider/Divider.svelte.d.ts +0 -24
- package/dist/components/agnostic/Divider/api.d.ts +0 -3
- package/dist/components/agnostic/Divider/api.js +0 -1
- package/dist/components/agnostic/Loader/Loader.svelte +0 -116
- package/dist/components/agnostic/Loader/Loader.svelte.d.ts +0 -22
- package/dist/components/agnostic/animation.css +0 -37
- package/dist/components/blog/BlogDescription.svelte +0 -9
- package/dist/components/blog/BlogDescription.svelte.d.ts +0 -23
- package/dist/components/blog/BlogPost.d.ts +0 -13
- package/dist/components/blog/BlogPost.js +0 -1
- package/dist/components/blog/BlogTitle.svelte +0 -19
- package/dist/components/blog/BlogTitle.svelte.d.ts +0 -23
- package/dist/components/blog/blog.d.ts +0 -8
- package/dist/components/blog/blog.js +0 -29
- package/dist/components/converters/ShowItemToNavigationItems.d.ts +0 -3
- package/dist/components/converters/ShowItemToNavigationItems.js +0 -10
- package/dist/components/form/DateTimePicker.svelte +0 -59
- package/dist/components/form/DateTimePicker.svelte.d.ts +0 -18
- package/dist/components/form/InputAddonItem.svelte +0 -42
- package/dist/components/form/InputAddonItem.svelte.d.ts +0 -31
- package/dist/components/form/InputTypes.d.ts +0 -9
- package/dist/components/form/InputTypes.js +0 -10
- package/dist/components/form/Select.svelte +0 -157
- package/dist/components/form/Select.svelte.d.ts +0 -34
- package/dist/components/form/Switch.svelte +0 -275
- package/dist/components/form/Switch.svelte.d.ts +0 -30
- package/dist/components/menu/Menu.svelte +0 -526
- package/dist/components/menu/Menu.svelte.d.ts +0 -33
- package/dist/components/menu/MenuItem.svelte +0 -121
- package/dist/components/menu/MenuItem.svelte.d.ts +0 -39
- package/dist/components/menu/NavigationItems.svelte +0 -44
- package/dist/components/menu/NavigationItems.svelte.d.ts +0 -32
- package/dist/components/menu/authentication.d.ts +0 -1
- package/dist/components/menu/authentication.js +0 -6
- package/dist/components/presentation/Carousel/carousel-content.svelte +0 -35
- package/dist/components/presentation/Carousel/carousel-content.svelte.d.ts +0 -28
- package/dist/components/presentation/Carousel/carousel-item.svelte +0 -25
- package/dist/components/presentation/Carousel/carousel-item.svelte.d.ts +0 -28
- package/dist/components/presentation/Carousel/carousel-next.svelte +0 -39
- package/dist/components/presentation/Carousel/carousel-next.svelte.d.ts +0 -18
- package/dist/components/presentation/Carousel/carousel-previous.svelte +0 -40
- package/dist/components/presentation/Carousel/carousel-previous.svelte.d.ts +0 -18
- package/dist/components/presentation/Carousel/carousel.svelte +0 -99
- package/dist/components/presentation/Carousel/carousel.svelte.d.ts +0 -31
- package/dist/components/presentation/Carousel/context.d.ts +0 -32
- package/dist/components/presentation/Carousel/context.js +0 -12
- package/dist/components/presentation/Carusele.js +0 -5
- /package/dist/components/{Markdown.svelte → content/Markdown.svelte} +0 -0
- /package/dist/components/{Markdown.svelte.d.ts → content/Markdown.svelte.d.ts} +0 -0
- /package/dist/components/{Banner.svelte.d.ts → layouts/Banner.svelte.d.ts} +0 -0
- /package/dist/components/{agnostic/Close/api.js → presentation/Carousel.js} +0 -0
- /package/dist/components/{agnostic/Disclose → presentation}/Disclose.svelte.d.ts +0 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export declare enum Type {
|
|
2
|
+
Text = "text",
|
|
3
|
+
Textarea = "textarea",
|
|
4
|
+
Email = "email",
|
|
5
|
+
Search = "search",
|
|
6
|
+
Password = "password",
|
|
7
|
+
Tel = "tel",
|
|
8
|
+
Number = "number",
|
|
9
|
+
Url = "url",
|
|
10
|
+
Month = "month",
|
|
11
|
+
Time = "time",
|
|
12
|
+
Week = "week",
|
|
13
|
+
Date = "date",
|
|
14
|
+
DatetimeLocal = "datetime-local",
|
|
15
|
+
Color = "color"
|
|
16
|
+
}
|
|
17
|
+
export declare enum Size {
|
|
18
|
+
Small = "small",
|
|
19
|
+
Large = "large",
|
|
20
|
+
Normal = ""
|
|
21
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export var Type;
|
|
2
|
+
(function (Type) {
|
|
3
|
+
Type["Text"] = "text";
|
|
4
|
+
Type["Textarea"] = "textarea";
|
|
5
|
+
Type["Email"] = "email";
|
|
6
|
+
Type["Search"] = "search";
|
|
7
|
+
Type["Password"] = "password";
|
|
8
|
+
Type["Tel"] = "tel";
|
|
9
|
+
Type["Number"] = "number";
|
|
10
|
+
Type["Url"] = "url";
|
|
11
|
+
Type["Month"] = "month";
|
|
12
|
+
Type["Time"] = "time";
|
|
13
|
+
Type["Week"] = "week";
|
|
14
|
+
Type["Date"] = "date";
|
|
15
|
+
Type["DatetimeLocal"] = "datetime-local";
|
|
16
|
+
Type["Color"] = "color";
|
|
17
|
+
})(Type || (Type = {}));
|
|
18
|
+
export var Size;
|
|
19
|
+
(function (Size) {
|
|
20
|
+
Size["Small"] = "small";
|
|
21
|
+
Size["Large"] = "large";
|
|
22
|
+
Size["Normal"] = "";
|
|
23
|
+
})(Size || (Size = {}));
|
|
@@ -1,15 +1,38 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import {
|
|
3
|
-
|
|
2
|
+
import { cn } from '../../utils.js';
|
|
3
|
+
import type { Snippet } from 'svelte';
|
|
4
|
+
import { Size, Type } from './Input.js';
|
|
5
|
+
|
|
6
|
+
interface Props {
|
|
7
|
+
label?: string;
|
|
8
|
+
id?: string;
|
|
9
|
+
labelCss?: string;
|
|
10
|
+
isLabelHidden?: boolean;
|
|
11
|
+
helpText?: string;
|
|
12
|
+
invalidText?: string;
|
|
13
|
+
isInvalid?: boolean;
|
|
14
|
+
isInline?: boolean;
|
|
15
|
+
isRounded?: boolean;
|
|
16
|
+
isDisabled?: boolean | undefined;
|
|
17
|
+
css?: string;
|
|
18
|
+
isSkinned?: boolean;
|
|
19
|
+
isUnderlinedWithBackground?: boolean;
|
|
20
|
+
isUnderlined?: boolean;
|
|
21
|
+
size?: Size;
|
|
22
|
+
type?: Type;
|
|
23
|
+
value?: string;
|
|
24
|
+
addonLeft?: Snippet;
|
|
25
|
+
addonRight?: Snippet;
|
|
26
|
+
}
|
|
4
27
|
let {
|
|
28
|
+
addonLeft,
|
|
29
|
+
addonRight,
|
|
5
30
|
label = '',
|
|
6
31
|
id = '',
|
|
7
32
|
labelCss = '',
|
|
8
33
|
isLabelHidden = false,
|
|
9
34
|
helpText = '',
|
|
10
35
|
invalidText = '',
|
|
11
|
-
hasLeftAddon = false,
|
|
12
|
-
hasRightAddon = false,
|
|
13
36
|
isInvalid = false,
|
|
14
37
|
isInline = false,
|
|
15
38
|
isRounded = false,
|
|
@@ -18,52 +41,14 @@
|
|
|
18
41
|
isSkinned = true,
|
|
19
42
|
isUnderlinedWithBackground = false,
|
|
20
43
|
isUnderlined = false,
|
|
21
|
-
size =
|
|
22
|
-
type =
|
|
23
|
-
value =
|
|
24
|
-
|
|
25
|
-
}:
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
isLabelHidden: boolean,
|
|
30
|
-
helpText: string,
|
|
31
|
-
invalidText: string,
|
|
32
|
-
hasLeftAddon: boolean,
|
|
33
|
-
hasRightAddon: boolean,
|
|
34
|
-
isInvalid: boolean,
|
|
35
|
-
isInline: boolean,
|
|
36
|
-
isRounded: boolean,
|
|
37
|
-
isDisabled: boolean | undefined,
|
|
38
|
-
css: string,
|
|
39
|
-
isSkinned: boolean,
|
|
40
|
-
isUnderlinedWithBackground: boolean,
|
|
41
|
-
isUnderlined: boolean,
|
|
42
|
-
size: 'small' | 'large' | '',
|
|
43
|
-
type:
|
|
44
|
-
| 'text'
|
|
45
|
-
| 'textarea'
|
|
46
|
-
| 'email'
|
|
47
|
-
| 'search'
|
|
48
|
-
| 'password'
|
|
49
|
-
| 'tel'
|
|
50
|
-
| 'number'
|
|
51
|
-
| 'url'
|
|
52
|
-
| 'month'
|
|
53
|
-
| 'time'
|
|
54
|
-
| 'week'
|
|
55
|
-
| 'date'
|
|
56
|
-
| 'datetime-local'
|
|
57
|
-
| 'color',
|
|
58
|
-
value: string,
|
|
59
|
-
restProps: any
|
|
60
|
-
} = $props();
|
|
61
|
-
|
|
62
|
-
// $: if (!value) value = '';
|
|
63
|
-
const inputType = $derived(type);
|
|
64
|
-
|
|
65
|
-
const labelClasses = $derived(
|
|
66
|
-
mergedClasses(
|
|
44
|
+
size = Size.Normal,
|
|
45
|
+
type = Type.Text,
|
|
46
|
+
value = '',
|
|
47
|
+
...restProps
|
|
48
|
+
}: Props = $props();
|
|
49
|
+
|
|
50
|
+
let labelClasses = $derived(
|
|
51
|
+
cn(
|
|
67
52
|
'label',
|
|
68
53
|
isInvalid ? 'label-error' : '',
|
|
69
54
|
isInline ? 'label-inline' : '',
|
|
@@ -73,13 +58,13 @@
|
|
|
73
58
|
)
|
|
74
59
|
);
|
|
75
60
|
|
|
76
|
-
|
|
77
|
-
|
|
61
|
+
let inputClasses = $derived(
|
|
62
|
+
cn(
|
|
78
63
|
isSkinned ? 'input' : 'input-base',
|
|
79
64
|
isRounded ? 'input-rounded' : '',
|
|
80
65
|
isUnderlined ? 'input-underlined' : '',
|
|
81
|
-
|
|
82
|
-
|
|
66
|
+
addonLeft ? 'input-has-left-addon' : '',
|
|
67
|
+
addonRight ? 'input-has-right-addon' : '',
|
|
83
68
|
isDisabled ? 'disabled' : '',
|
|
84
69
|
isInvalid ? 'input-error' : '',
|
|
85
70
|
isInline ? 'input-inline' : '',
|
|
@@ -89,62 +74,45 @@
|
|
|
89
74
|
)
|
|
90
75
|
);
|
|
91
76
|
|
|
92
|
-
|
|
77
|
+
let invalidClasses = $derived(size ? `field-error-${size}` : 'field-error');
|
|
93
78
|
|
|
94
|
-
|
|
79
|
+
let helpClasses = $derived(size ? `field-help-${size}` : 'field-help');
|
|
95
80
|
|
|
96
|
-
|
|
81
|
+
let addonContainerClasses = () => 'input-addon-container';
|
|
97
82
|
|
|
98
83
|
const handleInput = (e: Event) => {
|
|
99
84
|
value = (e.target as HTMLInputElement).value;
|
|
100
85
|
};
|
|
101
86
|
</script>
|
|
102
87
|
|
|
88
|
+
{#snippet input()}
|
|
89
|
+
<input
|
|
90
|
+
{id}
|
|
91
|
+
{type}
|
|
92
|
+
bind:value
|
|
93
|
+
class={inputClasses}
|
|
94
|
+
disabled={isDisabled}
|
|
95
|
+
oninput={handleInput}
|
|
96
|
+
{...restProps}
|
|
97
|
+
/>
|
|
98
|
+
{/snippet}
|
|
99
|
+
|
|
103
100
|
<div class="w-100">
|
|
104
101
|
<label class={labelClasses} for={id}>{label}</label>
|
|
105
102
|
{#if type == 'textarea'}
|
|
106
|
-
<textarea
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
{:else if hasLeftAddon || hasRightAddon}
|
|
117
|
-
<div class={addonContainerClasses}>
|
|
118
|
-
<slot name="addonLeft" />
|
|
119
|
-
<input
|
|
120
|
-
{id}
|
|
121
|
-
type={inputType}
|
|
122
|
-
{value}
|
|
123
|
-
class={inputClasses}
|
|
124
|
-
disabled={isDisabled}
|
|
125
|
-
on:blur
|
|
126
|
-
on:change
|
|
127
|
-
on:input={handleInput}
|
|
128
|
-
on:click
|
|
129
|
-
on:focus
|
|
130
|
-
{...restProps}
|
|
131
|
-
/>
|
|
132
|
-
<slot name="addonRight" />
|
|
103
|
+
<textarea {id} class={inputClasses} bind:value {...restProps}></textarea>
|
|
104
|
+
{:else if addonLeft || addonRight}
|
|
105
|
+
<div class={addonContainerClasses()}>
|
|
106
|
+
{#if addonLeft}
|
|
107
|
+
{@render addonLeft()}
|
|
108
|
+
{/if}
|
|
109
|
+
{@render input()}
|
|
110
|
+
{#if addonRight}
|
|
111
|
+
{@render addonRight()}
|
|
112
|
+
{/if}
|
|
133
113
|
</div>
|
|
134
114
|
{:else}
|
|
135
|
-
|
|
136
|
-
{id}
|
|
137
|
-
type={inputType}
|
|
138
|
-
{value}
|
|
139
|
-
class={inputClasses}
|
|
140
|
-
disabled={isDisabled}
|
|
141
|
-
on:blur
|
|
142
|
-
on:change
|
|
143
|
-
on:input={handleInput}
|
|
144
|
-
on:click
|
|
145
|
-
on:focus
|
|
146
|
-
{...restProps}
|
|
147
|
-
/>
|
|
115
|
+
{@render input()}
|
|
148
116
|
{/if}
|
|
149
117
|
{#if isInvalid}
|
|
150
118
|
<span role="status" aria-live="polite" class={invalidClasses}>
|
|
@@ -157,8 +125,8 @@
|
|
|
157
125
|
.input-base,
|
|
158
126
|
.input {
|
|
159
127
|
/* Note this cannot be user-select: none else mobile safari won't accept input:
|
|
160
|
-
|
|
161
|
-
|
|
128
|
+
https://stackoverflow.com/questions/49889003/cannot-write-into-input-field-on-safari/49901069
|
|
129
|
+
*/
|
|
162
130
|
user-select: initial;
|
|
163
131
|
appearance: none;
|
|
164
132
|
box-sizing: border-box;
|
|
@@ -191,11 +159,11 @@
|
|
|
191
159
|
.input-underlined,
|
|
192
160
|
.input-underlined-bg,
|
|
193
161
|
.input {
|
|
194
|
-
color: var(--
|
|
195
|
-
font-family: var(--
|
|
196
|
-
font-weight: var(--
|
|
197
|
-
font-size: var(--
|
|
198
|
-
line-height: var(--
|
|
162
|
+
color: var(--agnostic-font-color, var(--agnostic-dark));
|
|
163
|
+
font-family: var(--agnostic-font-family-body);
|
|
164
|
+
font-weight: var(--agnostic-font-weight, 300);
|
|
165
|
+
font-size: var(--agnostic-font-size, 1rem);
|
|
166
|
+
line-height: var(--agnostic-line-height, var(--fluid-20, 1.25rem));
|
|
199
167
|
width: 100%;
|
|
200
168
|
max-width: 100%;
|
|
201
169
|
}
|
|
@@ -206,38 +174,38 @@
|
|
|
206
174
|
border-style: solid;
|
|
207
175
|
|
|
208
176
|
/* this can be overriden, but it might mess with the balance of the button heights across variants */
|
|
209
|
-
border-width: var(--
|
|
210
|
-
border-color: var(--
|
|
177
|
+
border-width: var(--agnostic-input-border-size, 1px);
|
|
178
|
+
border-color: var(--agnostic-input-border-color, var(--agnostic-gray-light));
|
|
211
179
|
|
|
212
180
|
/* these can be overriden, but it might mess with the balance of the inputheights across variants */
|
|
213
|
-
padding-block-start: var(--
|
|
214
|
-
padding-block-end: var(--
|
|
215
|
-
padding-inline-start: var(--
|
|
216
|
-
padding-inline-end: var(--
|
|
181
|
+
padding-block-start: var(--agnostic-input-vertical-pad, 0.5rem);
|
|
182
|
+
padding-block-end: var(--agnostic-input-vertical-pad, 0.5rem);
|
|
183
|
+
padding-inline-start: var(--agnostic-input-side-padding, 0.75rem);
|
|
184
|
+
padding-inline-end: var(--agnostic-input-side-padding, 0.75rem);
|
|
217
185
|
|
|
218
186
|
/* Note we only want to set properties that we actually want
|
|
219
|
-
|
|
220
|
-
|
|
187
|
+
to transition in. For example, if we transition "all", the
|
|
188
|
+
inputs will "grow in" on page load—not a happy effect :) */
|
|
221
189
|
transition-property: box-shadow;
|
|
222
|
-
transition-duration: var(--
|
|
190
|
+
transition-duration: var(--agnostic-input-timing, var(--agnostic-timing-medium));
|
|
223
191
|
}
|
|
224
192
|
|
|
225
193
|
.label {
|
|
226
194
|
display: inline-block;
|
|
227
195
|
|
|
228
|
-
/* Provided --
|
|
229
|
-
|
|
196
|
+
/* Provided --agnostic-input-vertical-pad isn't overriden we'll get 20px
|
|
197
|
+
label w/a 6px margin then a 38px input = 64 which is on the 8pt grid */
|
|
230
198
|
margin-block-start: 0;
|
|
231
199
|
margin-inline-start: 0;
|
|
232
200
|
margin-inline-end: 0;
|
|
233
|
-
margin-block-end: var(--
|
|
201
|
+
margin-block-end: var(--agnostic-input-label-pad, 0.375rem);
|
|
234
202
|
vertical-align: initial;
|
|
235
203
|
}
|
|
236
204
|
|
|
237
205
|
/* Reset field errors and help text to be 2px less then input font size */
|
|
238
206
|
.field-help,
|
|
239
207
|
.field-error {
|
|
240
|
-
font-size: calc(var(--
|
|
208
|
+
font-size: calc(var(--agnostic-font-size, 1rem) - 2px);
|
|
241
209
|
}
|
|
242
210
|
|
|
243
211
|
.label-inline,
|
|
@@ -250,96 +218,93 @@
|
|
|
250
218
|
margin-block-start: 0;
|
|
251
219
|
margin-block-end: 0;
|
|
252
220
|
margin-inline-start: 0;
|
|
253
|
-
margin-inline-end: var(--
|
|
221
|
+
margin-inline-end: var(--agnostic-input-side-padding, 0.75rem);
|
|
254
222
|
}
|
|
255
223
|
|
|
256
224
|
/**
|
|
257
|
-
* Placeholder
|
|
258
|
-
*/
|
|
225
|
+
* Placeholder
|
|
226
|
+
*/
|
|
259
227
|
|
|
260
228
|
/* stylelint-disable-next-line */
|
|
261
229
|
.input::-webkit-input-placeholder {
|
|
262
230
|
color: currentColor;
|
|
263
231
|
opacity: 50%;
|
|
264
|
-
transition: opacity var(--
|
|
232
|
+
transition: opacity var(--agnostic-timing-fast) ease-out;
|
|
265
233
|
}
|
|
266
234
|
|
|
267
235
|
/* stylelint-disable-next-line */
|
|
268
236
|
.input::placeholder {
|
|
269
237
|
color: currentColor;
|
|
270
238
|
opacity: 50%;
|
|
271
|
-
transition: opacity var(--
|
|
239
|
+
transition: opacity var(--agnostic-timing-fast) ease-out;
|
|
272
240
|
}
|
|
273
241
|
|
|
274
242
|
/* stylelint-disable-next-line */
|
|
275
243
|
.input::-ms-placeholder {
|
|
276
244
|
color: currentColor;
|
|
277
245
|
opacity: 50%;
|
|
278
|
-
transition: opacity var(--
|
|
246
|
+
transition: opacity var(--agnostic-timing-fast) ease-out;
|
|
279
247
|
}
|
|
280
248
|
|
|
281
249
|
/* stylelint-disable-next-line */
|
|
282
250
|
.input:-ms-placeholder {
|
|
283
251
|
color: currentColor;
|
|
284
252
|
opacity: 50%;
|
|
285
|
-
transition: opacity var(--
|
|
253
|
+
transition: opacity var(--agnostic-timing-fast) ease-out;
|
|
286
254
|
}
|
|
287
255
|
|
|
288
256
|
/**
|
|
289
|
-
* Underlined inputs
|
|
290
|
-
*/
|
|
257
|
+
* Underlined inputs
|
|
258
|
+
*/
|
|
291
259
|
.input-underlined {
|
|
292
260
|
border-top: 0;
|
|
293
261
|
border-left: 0;
|
|
294
262
|
border-right: 0;
|
|
295
|
-
border-color: var(--
|
|
263
|
+
border-color: var(--agnostic-input-underlined-color, var(--agnostic-gray-mid-dark));
|
|
296
264
|
background-color: transparent;
|
|
297
265
|
}
|
|
298
266
|
|
|
299
267
|
.input-underlined-bg {
|
|
300
|
-
background-color: var(
|
|
301
|
-
--functional-input-underlined-bg-color,
|
|
302
|
-
var(--functional-gray-extra-light)
|
|
303
|
-
);
|
|
268
|
+
background-color: var(--agnostic-input-underlined-bg-color, var(--agnostic-gray-extra-light));
|
|
304
269
|
}
|
|
305
270
|
|
|
306
271
|
/**
|
|
307
|
-
* Rounded inputs
|
|
308
|
-
*/
|
|
272
|
+
* Rounded inputs
|
|
273
|
+
*/
|
|
309
274
|
.input-rounded {
|
|
310
|
-
border-radius: var(--
|
|
275
|
+
border-radius: var(--agnostic-radius, 0.25rem);
|
|
311
276
|
}
|
|
312
277
|
|
|
313
278
|
/**
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
279
|
+
* Errors
|
|
280
|
+
* We provide a class-based approach to setting errors which means we do
|
|
281
|
+
* not support :invalid, so it requires custom use of html4 validation API
|
|
282
|
+
* (see https://developer.mozilla.org/en-US/docs/Learn/Forms/Form_validation
|
|
283
|
+
* of the example in corresponding input.html file). The reason I elected to
|
|
284
|
+
* not include :invalid, is it seems to result in "shouting" at the user as
|
|
285
|
+
* I did not find an easy way to only kick in errors after a certain number
|
|
286
|
+
* of characters have been type (blur is actually better but I did not
|
|
287
|
+
* implement that in the contrived example).
|
|
288
|
+
*/
|
|
324
289
|
.label-error {
|
|
325
|
-
color: var(--
|
|
290
|
+
color: var(--agnostic-input-error-color, var(--agnostic-error));
|
|
326
291
|
}
|
|
327
292
|
|
|
328
293
|
.input-error {
|
|
329
|
-
border-color: var(--
|
|
294
|
+
border-color: var(--agnostic-input-error-color, var(--agnostic-error));
|
|
330
295
|
}
|
|
331
296
|
|
|
332
297
|
.label-error,
|
|
333
298
|
.field-error,
|
|
334
299
|
.field-error-small,
|
|
335
300
|
.field-error-large {
|
|
336
|
-
color: var(--
|
|
301
|
+
color: var(--agnostic-input-error-color, var(--agnostic-error));
|
|
337
302
|
}
|
|
338
303
|
|
|
339
304
|
.field-help,
|
|
340
305
|
.field-help-small,
|
|
341
306
|
.field-help-large {
|
|
342
|
-
color: var(--
|
|
307
|
+
color: var(--agnostic-input-help-color, var(--agnostic-gray-dark));
|
|
343
308
|
}
|
|
344
309
|
|
|
345
310
|
.field-help,
|
|
@@ -350,65 +315,65 @@
|
|
|
350
315
|
.field-error-large {
|
|
351
316
|
display: inline-block;
|
|
352
317
|
width: 100%;
|
|
353
|
-
margin-block-start: calc(var(--
|
|
318
|
+
margin-block-start: calc(var(--agnostic-input-vertical-pad, 0.5rem) / 2);
|
|
354
319
|
}
|
|
355
320
|
|
|
356
321
|
/**
|
|
357
|
-
|
|
358
|
-
|
|
322
|
+
* Sizes
|
|
323
|
+
*/
|
|
359
324
|
.input-large {
|
|
360
|
-
font-size: calc(var(--
|
|
325
|
+
font-size: calc(var(--agnostic-font-size, 1rem) + 0.25rem);
|
|
361
326
|
line-height: 1.6rem;
|
|
362
327
|
}
|
|
363
328
|
|
|
364
329
|
.field-help-large,
|
|
365
330
|
.field-error-large {
|
|
366
331
|
/* We initially remove -2px from font-size so setting to font-size essentially adds the 2px back */
|
|
367
|
-
font-size: var(--
|
|
332
|
+
font-size: var(--agnostic-font-size, 1rem);
|
|
368
333
|
}
|
|
369
334
|
|
|
370
335
|
.label-large {
|
|
371
|
-
font-size: calc(var(--
|
|
336
|
+
font-size: calc(var(--agnostic-font-size, 1rem) + 0.25rem);
|
|
372
337
|
}
|
|
373
338
|
|
|
374
339
|
.input-small {
|
|
375
|
-
font-size: calc(var(--
|
|
340
|
+
font-size: calc(var(--agnostic-font-size, 1rem) - 0.25rem);
|
|
376
341
|
line-height: 1rem;
|
|
377
342
|
}
|
|
378
343
|
|
|
379
344
|
.field-help-small,
|
|
380
345
|
.field-error-small,
|
|
381
346
|
.label-small {
|
|
382
|
-
font-size: calc(var(--
|
|
347
|
+
font-size: calc(var(--agnostic-font-size, 1rem) - 0.25rem);
|
|
383
348
|
}
|
|
384
349
|
|
|
385
350
|
.input:focus {
|
|
386
|
-
box-shadow: 0 0 0 var(--
|
|
351
|
+
box-shadow: 0 0 0 var(--agnostic-focus-ring-outline-width) var(--agnostic-focus-ring-color);
|
|
387
352
|
|
|
388
353
|
/* Needed for High Contrast mode */
|
|
389
|
-
outline: var(--
|
|
390
|
-
var(--
|
|
391
|
-
transition: box-shadow var(--
|
|
354
|
+
outline: var(--agnostic-focus-ring-outline-width) var(--agnostic-focus-ring-outline-style)
|
|
355
|
+
var(--agnostic-focus-ring-outline-color);
|
|
356
|
+
transition: box-shadow var(--agnostic-timing-fast) ease-out;
|
|
392
357
|
}
|
|
393
358
|
|
|
394
359
|
/* Set the focus to transparent when there's an error since we use
|
|
395
|
-
borders that visually conflict. */
|
|
360
|
+
borders that visually conflict. */
|
|
396
361
|
.input-error:focus {
|
|
397
362
|
box-shadow: 0 0 0 3px transparent;
|
|
398
363
|
}
|
|
399
364
|
|
|
400
365
|
/*
|
|
401
|
-
* Disabled State
|
|
402
|
-
*
|
|
403
|
-
* The disabled state uses the class .disabled,
|
|
404
|
-
* and the form attribute disabled="disabled".
|
|
405
|
-
* The use of !important is only added because this is a state
|
|
406
|
-
* that must be applied to all inputs when in a disabled state.
|
|
407
|
-
*/
|
|
366
|
+
* Disabled State
|
|
367
|
+
*
|
|
368
|
+
* The disabled state uses the class .disabled,
|
|
369
|
+
* and the form attribute disabled="disabled".
|
|
370
|
+
* The use of !important is only added because this is a state
|
|
371
|
+
* that must be applied to all inputs when in a disabled state.
|
|
372
|
+
*/
|
|
408
373
|
.input.disabled, /* DEPRECATED -- TODO remove class based disabled */
|
|
409
|
-
.input:disabled {
|
|
410
|
-
background: var(--
|
|
411
|
-
color: var(--
|
|
374
|
+
.input:disabled {
|
|
375
|
+
background: var(--agnostic-input-disabled-bg, var(--agnostic-disabled-bg)) !important;
|
|
376
|
+
color: var(--agnostic-input-disabled-color, var(--agnostic-disabled-color)) !important;
|
|
412
377
|
appearance: none !important;
|
|
413
378
|
box-shadow: none !important;
|
|
414
379
|
cursor: not-allowed !important;
|
|
@@ -426,8 +391,8 @@ borders that visually conflict. */
|
|
|
426
391
|
}
|
|
427
392
|
|
|
428
393
|
/**
|
|
429
|
-
|
|
430
|
-
|
|
394
|
+
* Input "has addon"
|
|
395
|
+
*/
|
|
431
396
|
|
|
432
397
|
.input-addon-container {
|
|
433
398
|
display: flex;
|
|
@@ -437,19 +402,19 @@ borders that visually conflict. */
|
|
|
437
402
|
}
|
|
438
403
|
|
|
439
404
|
.input-has-left-addon {
|
|
440
|
-
padding-left: calc(var(--
|
|
405
|
+
padding-left: calc(var(--agnostic-side-padding) * 3);
|
|
441
406
|
}
|
|
442
407
|
|
|
443
408
|
.input-has-right-addon {
|
|
444
|
-
padding-right: calc(var(--
|
|
409
|
+
padding-right: calc(var(--agnostic-side-padding) * 3);
|
|
445
410
|
}
|
|
446
411
|
|
|
447
412
|
.input-addon-left {
|
|
448
|
-
left: var(--
|
|
413
|
+
left: var(--agnostic-input-side-padding);
|
|
449
414
|
}
|
|
450
415
|
|
|
451
416
|
.input-addon-right {
|
|
452
|
-
right: var(--
|
|
417
|
+
right: var(--agnostic-input-side-padding);
|
|
453
418
|
}
|
|
454
419
|
|
|
455
420
|
@media (prefers-reduced-motion), (update: slow) {
|
|
@@ -1,48 +1,26 @@
|
|
|
1
|
-
type
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
isInvalid
|
|
11
|
-
isInline
|
|
12
|
-
isRounded
|
|
13
|
-
isDisabled
|
|
14
|
-
css
|
|
15
|
-
isSkinned
|
|
16
|
-
isUnderlinedWithBackground
|
|
17
|
-
isUnderlined
|
|
18
|
-
size
|
|
19
|
-
type
|
|
20
|
-
value
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
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> {
|
|
24
|
-
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
25
|
-
$$bindings?: Bindings;
|
|
26
|
-
} & Exports;
|
|
27
|
-
(internal: unknown, props: Props & {
|
|
28
|
-
$$events?: Events;
|
|
29
|
-
$$slots?: Slots;
|
|
30
|
-
}): Exports & {
|
|
31
|
-
$set?: any;
|
|
32
|
-
$on?: any;
|
|
33
|
-
};
|
|
34
|
-
z_$$bindings?: Bindings;
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
import { Size, Type } from './Input.js';
|
|
3
|
+
interface Props {
|
|
4
|
+
label?: string;
|
|
5
|
+
id?: string;
|
|
6
|
+
labelCss?: string;
|
|
7
|
+
isLabelHidden?: boolean;
|
|
8
|
+
helpText?: string;
|
|
9
|
+
invalidText?: string;
|
|
10
|
+
isInvalid?: boolean;
|
|
11
|
+
isInline?: boolean;
|
|
12
|
+
isRounded?: boolean;
|
|
13
|
+
isDisabled?: boolean | undefined;
|
|
14
|
+
css?: string;
|
|
15
|
+
isSkinned?: boolean;
|
|
16
|
+
isUnderlinedWithBackground?: boolean;
|
|
17
|
+
isUnderlined?: boolean;
|
|
18
|
+
size?: Size;
|
|
19
|
+
type?: Type;
|
|
20
|
+
value?: string;
|
|
21
|
+
addonLeft?: Snippet;
|
|
22
|
+
addonRight?: Snippet;
|
|
35
23
|
}
|
|
36
|
-
declare const Input:
|
|
37
|
-
|
|
38
|
-
change: Event;
|
|
39
|
-
click: MouseEvent;
|
|
40
|
-
focus: FocusEvent;
|
|
41
|
-
} & {
|
|
42
|
-
[evt: string]: CustomEvent<any>;
|
|
43
|
-
}, {
|
|
44
|
-
addonLeft: {};
|
|
45
|
-
addonRight: {};
|
|
46
|
-
}, {}, "value">;
|
|
47
|
-
type Input = InstanceType<typeof Input>;
|
|
24
|
+
declare const Input: import("svelte").Component<Props, {}, "">;
|
|
25
|
+
type Input = ReturnType<typeof Input>;
|
|
48
26
|
export default Input;
|
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import type { Snippet } from 'svelte';
|
|
3
|
-
import {
|
|
3
|
+
import { cn } from '../../utils.js';
|
|
4
4
|
|
|
5
5
|
interface Props {
|
|
6
6
|
children: Snippet;
|
|
7
7
|
background?: string;
|
|
8
8
|
css?: string;
|
|
9
9
|
}
|
|
10
|
+
|
|
10
11
|
let { children, background = '', css = '' }: Props = $props();
|
|
11
12
|
|
|
12
|
-
|
|
13
|
-
const bannerKlasses = 'banner';
|
|
13
|
+
const bannerKlasses = cn('banner', css);
|
|
14
14
|
</script>
|
|
15
15
|
|
|
16
|
-
<div class={bannerKlasses} style="--
|
|
16
|
+
<div class={bannerKlasses} style="--banner-background: {background};">
|
|
17
17
|
{@render children()}
|
|
18
18
|
</div>
|
|
19
19
|
|
|
20
20
|
<style>
|
|
21
21
|
div.banner {
|
|
22
|
-
background: var(--
|
|
22
|
+
background: var(--banner-background);
|
|
23
23
|
height: 100%;
|
|
24
24
|
width: 100%;
|
|
25
25
|
}
|