@functionalcms/svelte-components 3.5.15 → 3.5.18
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/components/Banner.svelte +1 -1
- package/dist/components/Banner.svelte.d.ts +8 -13
- package/dist/components/Link.svelte.d.ts +45 -34
- package/dist/components/Logo.svelte.d.ts +26 -22
- package/dist/components/Markdown.svelte.d.ts +5 -14
- package/dist/components/Spacer.svelte.d.ts +6 -14
- package/dist/components/Well.svelte.d.ts +11 -13
- package/dist/components/agnostic/Button/Button.svelte +333 -332
- package/dist/components/agnostic/Button/Button.svelte.d.ts +50 -39
- package/dist/components/agnostic/Button/ButtonGroup.svelte.d.ts +30 -19
- package/dist/components/agnostic/Close/Close.svelte.d.ts +22 -18
- package/dist/components/agnostic/Disclose/Disclose.svelte.d.ts +10 -13
- package/dist/components/agnostic/Divider/Divider.svelte.d.ts +21 -17
- package/dist/components/agnostic/Loader/Loader.svelte.d.ts +20 -16
- package/dist/components/blog/BlogDescription.svelte.d.ts +21 -17
- package/dist/components/blog/BlogTitle.svelte.d.ts +21 -17
- package/dist/components/form/DateTimePicker.svelte.d.ts +16 -12
- package/dist/components/form/Input.svelte +1 -1
- package/dist/components/form/Input.svelte.d.ts +46 -20
- package/dist/components/form/InputAddonItem.svelte +34 -34
- package/dist/components/form/InputAddonItem.svelte.d.ts +27 -27
- package/dist/components/form/Select.svelte.d.ts +32 -28
- package/dist/components/{agnostic/Switch → form}/Switch.svelte +1 -1
- package/dist/components/form/Switch.svelte.d.ts +30 -0
- package/dist/components/layouts/DefaultLayout.svelte.d.ts +11 -13
- package/dist/components/layouts/Meta.svelte.d.ts +10 -13
- package/dist/components/layouts/SimpleFooter.svelte.d.ts +7 -13
- package/dist/components/layouts/Tracker.svelte.d.ts +5 -13
- package/dist/components/layouts/TwoColumnsLayout.svelte.d.ts +9 -13
- package/dist/components/menu/CollapsibleMenu.svelte.d.ts +27 -23
- package/dist/components/menu/DynamicMenu.svelte.d.ts +27 -23
- package/dist/components/menu/HamburgerMenu.svelte +3 -3
- package/dist/components/menu/HamburgerMenu.svelte.d.ts +25 -21
- package/dist/components/menu/Menu.svelte.d.ts +31 -27
- package/dist/components/menu/MenuItem.svelte.d.ts +37 -25
- package/dist/components/menu/NavigationItems.svelte +9 -4
- package/dist/components/menu/NavigationItems.svelte.d.ts +27 -23
- package/dist/components/presentation/Card.svelte.d.ts +17 -13
- package/dist/components/presentation/Carousel/carousel-content.svelte +35 -0
- package/dist/components/presentation/Carousel/carousel-content.svelte.d.ts +28 -0
- package/dist/components/presentation/Carousel/carousel-item.svelte +25 -0
- package/dist/components/presentation/Carousel/carousel-item.svelte.d.ts +28 -0
- package/dist/components/presentation/Carousel/carousel-next.svelte +39 -0
- package/dist/components/presentation/Carousel/carousel-next.svelte.d.ts +18 -0
- package/dist/components/presentation/Carousel/carousel-previous.svelte +40 -0
- package/dist/components/presentation/Carousel/carousel-previous.svelte.d.ts +18 -0
- package/dist/components/presentation/Carousel/carousel.svelte +99 -0
- package/dist/components/presentation/Carousel/carousel.svelte.d.ts +31 -0
- package/dist/components/presentation/Carousel/context.d.ts +32 -0
- package/dist/components/presentation/Carousel/context.js +12 -0
- package/dist/components/presentation/Carousel.svelte +4 -0
- package/dist/components/presentation/Carousel.svelte.d.ts +18 -0
- package/dist/components/presentation/Carusele.d.ts +1 -1
- package/dist/components/presentation/Carusele.js +1 -1
- package/dist/components/presentation/Gallery.svelte.d.ts +14 -13
- package/dist/components/presentation/ImageCompare.svelte +15 -12
- package/dist/components/presentation/ImageCompare.svelte.d.ts +24 -38
- package/dist/index.d.ts +5 -4
- package/dist/index.js +12 -7
- package/package.json +24 -24
- package/dist/components/agnostic/Alert/Alert.svelte +0 -317
- package/dist/components/agnostic/Alert/Alert.svelte.d.ts +0 -29
- package/dist/components/agnostic/Avatar/Avatar.svelte +0 -127
- package/dist/components/agnostic/Avatar/Avatar.svelte.d.ts +0 -24
- package/dist/components/agnostic/Avatar/AvatarGroup.svelte +0 -106
- package/dist/components/agnostic/Avatar/AvatarGroup.svelte.d.ts +0 -27
- package/dist/components/agnostic/Breadcrumb/Breadcrumb.svelte +0 -65
- package/dist/components/agnostic/Breadcrumb/Breadcrumb.svelte.d.ts +0 -18
- package/dist/components/agnostic/Breadcrumb/api.d.ts +0 -4
- package/dist/components/agnostic/Breadcrumb/api.js +0 -1
- package/dist/components/agnostic/ChoiceInput/ChoiceInput.svelte +0 -365
- package/dist/components/agnostic/ChoiceInput/ChoiceInput.svelte.d.ts +0 -35
- package/dist/components/agnostic/ChoiceInput/api.d.ts +0 -7
- package/dist/components/agnostic/ChoiceInput/api.js +0 -1
- package/dist/components/agnostic/Dialog/Dialog.svelte +0 -278
- package/dist/components/agnostic/Dialog/Dialog.svelte.d.ts +0 -37
- package/dist/components/agnostic/Dialog/SvelteA11yDialog.svelte +0 -128
- package/dist/components/agnostic/Dialog/SvelteA11yDialog.svelte.d.ts +0 -28
- package/dist/components/agnostic/Dialog/a11y-dialog.d.ts +0 -56
- package/dist/components/agnostic/Dialog/a11y-dialog.js +0 -216
- package/dist/components/agnostic/Dialog/dom-utils.d.ts +0 -26
- package/dist/components/agnostic/Dialog/dom-utils.js +0 -206
- package/dist/components/agnostic/Drawer/Drawer.svelte +0 -34
- package/dist/components/agnostic/Drawer/Drawer.svelte.d.ts +0 -26
- package/dist/components/agnostic/Drawer/api.d.ts +0 -1
- package/dist/components/agnostic/Drawer/api.js +0 -1
- package/dist/components/agnostic/EmptyState/EmptyState.svelte +0 -49
- package/dist/components/agnostic/EmptyState/EmptyState.svelte.d.ts +0 -21
- package/dist/components/agnostic/Header/Header.svelte +0 -111
- package/dist/components/agnostic/Header/Header.svelte.d.ts +0 -24
- package/dist/components/agnostic/Header/HeaderNav.svelte +0 -29
- package/dist/components/agnostic/Header/HeaderNav.svelte.d.ts +0 -18
- package/dist/components/agnostic/Header/HeaderNavItem.svelte +0 -31
- package/dist/components/agnostic/Header/HeaderNavItem.svelte.d.ts +0 -18
- package/dist/components/agnostic/Icon/Icon.svelte +0 -188
- package/dist/components/agnostic/Icon/Icon.svelte.d.ts +0 -21
- package/dist/components/agnostic/Icon/api.d.ts +0 -2
- package/dist/components/agnostic/Icon/api.js +0 -1
- package/dist/components/agnostic/Progress/Progress.svelte +0 -51
- package/dist/components/agnostic/Progress/Progress.svelte.d.ts +0 -18
- package/dist/components/agnostic/Spinner/Spinner.svelte +0 -108
- package/dist/components/agnostic/Spinner/Spinner.svelte.d.ts +0 -17
- package/dist/components/agnostic/Switch/Switch.svelte.d.ts +0 -43
- package/dist/components/agnostic/Table/Table.svelte +0 -521
- package/dist/components/agnostic/Table/Table.svelte.d.ts +0 -34
- package/dist/components/agnostic/Table/TableCustomRenderComponent.svelte +0 -13
- package/dist/components/agnostic/Table/TableCustomRenderComponent.svelte.d.ts +0 -23
- package/dist/components/agnostic/Tabs/TabButtonCustom.svelte +0 -77
- package/dist/components/agnostic/Tabs/TabButtonCustom.svelte.d.ts +0 -33
- package/dist/components/agnostic/Tabs/Tabs.svelte +0 -399
- package/dist/components/agnostic/Tabs/Tabs.svelte.d.ts +0 -32
- package/dist/components/agnostic/Tabs/api.d.ts +0 -10
- package/dist/components/agnostic/Tabs/api.js +0 -1
- package/dist/components/agnostic/Tag/Tag.svelte +0 -78
- package/dist/components/agnostic/Tag/Tag.svelte.d.ts +0 -21
- package/dist/components/agnostic/Tag/TagSlots.svelte +0 -52
- package/dist/components/agnostic/Tag/TagSlots.svelte.d.ts +0 -14
- package/dist/components/agnostic/Toasts/Toasts.svelte +0 -56
- package/dist/components/agnostic/Toasts/Toasts.svelte.d.ts +0 -20
- package/dist/components/agnostic/Tooltip/Tooltip.svelte +0 -120
- package/dist/components/agnostic/Tooltip/Tooltip.svelte.d.ts +0 -21
- package/dist/components/agnostic/Tooltip/TooltipSlots.svelte +0 -82
- package/dist/components/agnostic/Tooltip/TooltipSlots.svelte.d.ts +0 -14
- package/dist/components/agnostic/Tooltip/api.d.ts +0 -1
- package/dist/components/agnostic/Tooltip/api.js +0 -1
- package/dist/components/presentation/Carusel.svelte +0 -109
- package/dist/components/presentation/Carusel.svelte.d.ts +0 -56
|
@@ -1,86 +1,173 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
export let mode = '';
|
|
3
|
+
export let size = '';
|
|
4
|
+
export let isBordered = false;
|
|
5
|
+
export let isCapsule = false;
|
|
6
|
+
export let isGrouped = false;
|
|
7
|
+
export let isBlock = false;
|
|
8
|
+
export let isLink = false;
|
|
9
|
+
export let isBlank = false;
|
|
10
|
+
export let isDisabled = false;
|
|
11
|
+
export let role = undefined;
|
|
12
|
+
export let isCircle = false;
|
|
13
|
+
export let isRounded = false;
|
|
14
|
+
export let isSkinned = true;
|
|
15
|
+
// The following properties can be used by consumers of Tabs which setup their own
|
|
16
|
+
// custom buttons as these aria and tabindex attributes are required for a11y
|
|
17
|
+
export let ariaSelected = undefined;
|
|
18
|
+
export let ariaControls = undefined;
|
|
19
|
+
export let tabIndex = undefined;
|
|
20
|
+
|
|
21
|
+
$: aSelected = ariaSelected || null;
|
|
22
|
+
$: tIndex = tabIndex || null;
|
|
23
|
+
/**
|
|
24
|
+
* This prop is an escape hatch for global CSS overrides. Likely, the most useful reason to
|
|
25
|
+
* leverage this is to add custom responsive media query code. Note that you'll likely need
|
|
26
|
+
* to add specificity to beat out the Svelte based CSS, and, in Svelte land you'll need to
|
|
27
|
+
* utilize globals functionality which might look like:
|
|
28
|
+
* @media all and (min-width: 769px) {
|
|
29
|
+
* :global(button.btn.button-overrides) {
|
|
30
|
+
* font-size: 18px;
|
|
31
|
+
* ...etc.
|
|
32
|
+
*/
|
|
33
|
+
export let css = '';
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Button type: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button
|
|
37
|
+
* submit: submits form data to the server
|
|
38
|
+
* reset: resets all the controls to their initial values, like <input type="reset">
|
|
39
|
+
* button: button has no default behavior, and does nothing when pressed by default.
|
|
40
|
+
*/
|
|
41
|
+
export let type = 'button';
|
|
42
|
+
|
|
43
|
+
// ******************** HEY! ************************
|
|
44
|
+
// You will need to also add these to the buttonslot:
|
|
45
|
+
// agnostic-svelte/src/stories/ButtonSlot.svelte
|
|
46
|
+
$: klasses = [
|
|
47
|
+
isSkinned ? 'btn' : 'btn-base',
|
|
48
|
+
mode ? `btn-${mode}` : '',
|
|
49
|
+
size ? `btn-${size}` : '',
|
|
50
|
+
isBordered ? 'btn-bordered' : '',
|
|
51
|
+
isCapsule ? 'btn-capsule ' : '',
|
|
52
|
+
isGrouped ? 'btn-grouped' : '',
|
|
53
|
+
isBlock ? 'btn-block' : '',
|
|
54
|
+
isCircle ? 'btn-circle' : '',
|
|
55
|
+
isRounded ? 'btn-rounded' : '',
|
|
56
|
+
isDisabled ? 'disabled' : '',
|
|
57
|
+
isBlank ? 'btn-blank' : '',
|
|
58
|
+
isLink ? 'btn-link' : '',
|
|
59
|
+
css ? `${css}` : ''
|
|
60
|
+
]
|
|
61
|
+
.filter((c) => c)
|
|
62
|
+
.join(' ');
|
|
63
|
+
</script>
|
|
64
|
+
|
|
65
|
+
<!-- https://github.com/sveltejs/svelte/issues/2324 -->
|
|
66
|
+
{#if type === 'faux'}
|
|
67
|
+
<div class={klasses}>
|
|
68
|
+
<slot />
|
|
69
|
+
</div>
|
|
70
|
+
{:else}
|
|
71
|
+
<button
|
|
72
|
+
{type}
|
|
73
|
+
class={klasses}
|
|
74
|
+
on:keydown
|
|
75
|
+
on:click
|
|
76
|
+
on:focus
|
|
77
|
+
on:blur
|
|
78
|
+
{role}
|
|
79
|
+
aria-selected={aSelected}
|
|
80
|
+
aria-controls={ariaControls}
|
|
81
|
+
tab-index={tIndex}
|
|
82
|
+
disabled={isDisabled}
|
|
83
|
+
{...$$restProps}
|
|
84
|
+
>
|
|
85
|
+
<slot />
|
|
86
|
+
</button>
|
|
87
|
+
{/if}
|
|
88
|
+
|
|
1
89
|
<style>
|
|
2
|
-
.btn-base {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
.btn {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
.btn-skin,
|
|
30
|
-
.btn {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
.btn:visited {
|
|
54
|
-
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
.btn:hover {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
.btn:active {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
.btn:focus {
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
/* In order for the focused element's box-shadow to appear above its siblings we need to
|
|
90
|
+
.btn-base {
|
|
91
|
+
display: inline-flex;
|
|
92
|
+
align-items: center;
|
|
93
|
+
justify-content: center;
|
|
94
|
+
white-space: nowrap;
|
|
95
|
+
user-select: none;
|
|
96
|
+
appearance: none;
|
|
97
|
+
cursor: pointer;
|
|
98
|
+
box-sizing: border-box;
|
|
99
|
+
transition-property: all;
|
|
100
|
+
transition-duration: var(--functional-timing-medium);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
.btn {
|
|
104
|
+
/* TODO test this fallback override syntax is correct */
|
|
105
|
+
display: inline-flex;
|
|
106
|
+
align-items: center;
|
|
107
|
+
justify-content: center;
|
|
108
|
+
white-space: nowrap;
|
|
109
|
+
user-select: none;
|
|
110
|
+
appearance: none;
|
|
111
|
+
cursor: pointer;
|
|
112
|
+
box-sizing: border-box;
|
|
113
|
+
transition-property: all;
|
|
114
|
+
transition-duration: var(--functional-timing-medium);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
.btn-skin,
|
|
118
|
+
.btn {
|
|
119
|
+
color: var(--functional-btn-font-color, var(--functional-dark));
|
|
120
|
+
background-color: var(--functional-btn-bgcolor, var(--functional-gray-light));
|
|
121
|
+
border-color: var(--functional-btn-bgcolor, var(--functional-gray-light));
|
|
122
|
+
|
|
123
|
+
/* seems like a reasonable default as chrome picks `outset` which results in a weird 3d effect */
|
|
124
|
+
border-style: solid;
|
|
125
|
+
border-width: var(--functional-btn-border-size, 1px);
|
|
126
|
+
font-family: var(--functional-btn-font-family, var(--functional-font-family-body));
|
|
127
|
+
font-weight: var(--functional-btn-font-weight, 400);
|
|
128
|
+
font-size: var(--functional-btn-font-size, 1rem);
|
|
129
|
+
|
|
130
|
+
/* this can be overriden, but it might mess with the balance of the button heights across variants */
|
|
131
|
+
line-height: var(--functional-line-height, var(--fluid-20, 1.25rem));
|
|
132
|
+
padding-block-start: var(--functional-vertical-pad, 0.5rem);
|
|
133
|
+
padding-block-end: var(--functional-vertical-pad, 0.5rem);
|
|
134
|
+
padding-inline-start: var(--functional-side-padding, 0.75rem);
|
|
135
|
+
padding-inline-end: var(--functional-side-padding, 0.75rem);
|
|
136
|
+
text-decoration: none;
|
|
137
|
+
text-align: center;
|
|
138
|
+
outline: none;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
.btn:visited {
|
|
142
|
+
color: var(--functional-btn-font-color, var(--functional-dark));
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
.btn:hover {
|
|
146
|
+
opacity: 85%;
|
|
147
|
+
text-decoration: none;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
.btn:active {
|
|
151
|
+
text-shadow: 0 1px 0 rgb(255 255 255 / 30%);
|
|
152
|
+
text-decoration: none;
|
|
153
|
+
transition-duration: 0s;
|
|
154
|
+
box-shadow: inset 0 1px 3px rgb(0 0 0 / 20%);
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
.btn:focus {
|
|
158
|
+
box-shadow: 0 0 0 var(--functional-focus-ring-outline-width) var(--functional-focus-ring-color);
|
|
159
|
+
|
|
160
|
+
/* Needed for High Contrast mode */
|
|
161
|
+
outline: var(--functional-focus-ring-outline-width) var(--functional-focus-ring-outline-style)
|
|
162
|
+
var(--functional-focus-ring-outline-color);
|
|
163
|
+
transition: box-shadow var(--functional-timing-fast) ease-out;
|
|
164
|
+
|
|
165
|
+
/* In order for the focused element's box-shadow to appear above its siblings we need to
|
|
79
166
|
establish a new stacking context: https://stackoverflow.com/a/28042700 */
|
|
80
|
-
|
|
81
|
-
}
|
|
167
|
+
isolation: isolate;
|
|
168
|
+
}
|
|
82
169
|
|
|
83
|
-
/*
|
|
170
|
+
/*
|
|
84
171
|
* Disabled State
|
|
85
172
|
*
|
|
86
173
|
* The disabled state uses the class .disabled, is-disabled,
|
|
@@ -88,283 +175,197 @@
|
|
|
88
175
|
* The use of !important is only added because this is a state
|
|
89
176
|
* that must be applied to all buttons when in a disabled state.
|
|
90
177
|
*/
|
|
91
|
-
.btn.disabled,
|
|
92
|
-
.btn:disabled {
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
178
|
+
.btn.disabled,
|
|
179
|
+
.btn:disabled {
|
|
180
|
+
top: 0 !important;
|
|
181
|
+
background: var(--functional-btn-disabled-bg, var(--functional-gray-mid-dark)) !important;
|
|
182
|
+
text-shadow: 0 1px 1px rgb(255 255 255 / 100%) !important;
|
|
96
183
|
|
|
97
|
-
|
|
184
|
+
/* primary, secondary, natural, all look same when disabled; and we don't want to
|
|
98
185
|
have an inadvertant looking blue primary border when disabled so it's transparent */
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
.btn-primary {
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
/* Border and font is primary. When hovered, we invert with primary background and white font */
|
|
114
|
-
.btn-primary.btn-bordered {
|
|
115
|
-
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
.btn-primary.btn-bordered:hover,
|
|
119
|
-
.btn-primary.btn-bordered:focus {
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
.btn-primary:visited {
|
|
125
|
-
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
.btn-secondary {
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
/* Border and font is secondary. When hovered, we invert with secondary background and white font */
|
|
135
|
-
.btn-secondary.btn-bordered {
|
|
136
|
-
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
.btn-secondary.btn-bordered:hover,
|
|
140
|
-
.btn-secondary.btn-bordered:focus {
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
.btn-secondary:visited {
|
|
146
|
-
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
/*
|
|
186
|
+
border-color: transparent;
|
|
187
|
+
color: var(--functional-btn-disabled-color, var(--functional-gray-dark)) !important;
|
|
188
|
+
cursor: default !important;
|
|
189
|
+
appearance: none !important;
|
|
190
|
+
box-shadow: none !important;
|
|
191
|
+
opacity: 80% !important;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
.btn-primary {
|
|
195
|
+
background-color: var(--functional-btn-primary, var(--functional-primary));
|
|
196
|
+
border-color: var(--functional-btn-primary, var(--functional-primary));
|
|
197
|
+
color: var(--functional-btn-primary-color, var(--functional-light));
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
/* Border and font is primary. When hovered, we invert with primary background and white font */
|
|
201
|
+
.btn-primary.btn-bordered {
|
|
202
|
+
color: var(--functional-btn-primary, var(--functional-primary));
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
.btn-primary.btn-bordered:hover,
|
|
206
|
+
.btn-primary.btn-bordered:focus {
|
|
207
|
+
background-color: var(--functional-btn-primary, var(--functional-primary));
|
|
208
|
+
color: var(--functional-btn-primary-color, var(--functional-light));
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
.btn-primary:visited {
|
|
212
|
+
color: var(--functional-btn-primary-color, var(--functional-light));
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
.btn-secondary {
|
|
216
|
+
background-color: var(--functional-btn-secondary, var(--functional-secondary));
|
|
217
|
+
border-color: var(--functional-btn-secondary, var(--functional-secondary));
|
|
218
|
+
color: var(--functional-btn-secondary-color, var(--functional-light));
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
/* Border and font is secondary. When hovered, we invert with secondary background and white font */
|
|
222
|
+
.btn-secondary.btn-bordered {
|
|
223
|
+
color: var(--functional-btn-secondary, var(--functional-secondary));
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
.btn-secondary.btn-bordered:hover,
|
|
227
|
+
.btn-secondary.btn-bordered:focus {
|
|
228
|
+
background-color: var(--functional-btn-secondary, var(--functional-secondary));
|
|
229
|
+
color: var(--functional-btn-secondary-color, var(--functional-light));
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
.btn-secondary:visited {
|
|
233
|
+
color: var(--functional-btn-secondary-color, var(--functional-light));
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
/*
|
|
150
237
|
/**
|
|
151
238
|
* Border Buttons
|
|
152
239
|
*/
|
|
153
|
-
.btn-bordered {
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
}
|
|
240
|
+
.btn-bordered {
|
|
241
|
+
border-width: 1px;
|
|
242
|
+
background: transparent;
|
|
243
|
+
}
|
|
157
244
|
|
|
158
|
-
/**
|
|
245
|
+
/**
|
|
159
246
|
* Sizes
|
|
160
247
|
*/
|
|
161
|
-
.btn-large {
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
.btn-small {
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
/**
|
|
248
|
+
.btn-large {
|
|
249
|
+
font-size: calc(var(--functional-btn-font-size, 1rem) + 0.25rem);
|
|
250
|
+
height: 3rem;
|
|
251
|
+
line-height: 3rem;
|
|
252
|
+
padding: 0 3rem;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
.btn-small {
|
|
256
|
+
font-size: calc(var(--functional-btn-font-size, 1rem) - 0.25rem);
|
|
257
|
+
height: 2rem;
|
|
258
|
+
line-height: 2rem;
|
|
259
|
+
padding: 0 2rem;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
/**
|
|
176
263
|
* Rounded
|
|
177
264
|
*/
|
|
178
|
-
.btn-rounded {
|
|
179
|
-
|
|
180
|
-
}
|
|
265
|
+
.btn-rounded {
|
|
266
|
+
border-radius: var(--functional-btn-radius, var(--functional-radius, 0.25rem));
|
|
267
|
+
}
|
|
181
268
|
|
|
182
|
-
.btn-pill {
|
|
183
|
-
|
|
184
|
-
}
|
|
269
|
+
.btn-pill {
|
|
270
|
+
border-radius: 200px;
|
|
271
|
+
}
|
|
185
272
|
|
|
186
|
-
/*
|
|
273
|
+
/*
|
|
187
274
|
* Size Adjustment for equal height & width buttons
|
|
188
275
|
*
|
|
189
276
|
* Remove padding
|
|
190
277
|
*/
|
|
191
|
-
.btn-circle {
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
.btn-circle-large {
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
.btn-circle-small {
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
/**
|
|
278
|
+
.btn-circle {
|
|
279
|
+
border-radius: 100%;
|
|
280
|
+
width: 2.5rem;
|
|
281
|
+
height: 2.5rem;
|
|
282
|
+
padding: 0 !important;
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
.btn-circle-large {
|
|
286
|
+
font-size: calc(var(--functional-btn-font-size, 1rem) + 0.25rem);
|
|
287
|
+
width: 3rem;
|
|
288
|
+
height: 3rem;
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
.btn-circle-small {
|
|
292
|
+
font-size: calc(var(--functional-btn-font-size, 1rem) - 0.25rem);
|
|
293
|
+
width: 2rem;
|
|
294
|
+
height: 2rem;
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
/**
|
|
211
298
|
* Button Block (stacked)
|
|
212
299
|
*/
|
|
213
|
-
.btn-block {
|
|
214
|
-
|
|
215
|
-
}
|
|
300
|
+
.btn-block {
|
|
301
|
+
width: 100%;
|
|
302
|
+
}
|
|
216
303
|
|
|
217
|
-
/* This is a utility class used if you literally want to stack block buttons one after another.
|
|
304
|
+
/* This is a utility class used if you literally want to stack block buttons one after another.
|
|
218
305
|
Apply this class to the nth-of-type(2) onwards to ensure the borders line up properly. */
|
|
219
|
-
.btn-block-following {
|
|
220
|
-
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
.btn-grouped {
|
|
224
|
-
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
.btn-grouped:not(:last-child) {
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
.btn-grouped:not(:first-child) {
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
.btn-capsule {
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
@media (prefers-reduced-motion), (update: slow) {
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
/**
|
|
306
|
+
.btn-block-following {
|
|
307
|
+
margin-block-start: -1px;
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
.btn-grouped {
|
|
311
|
+
border-radius: var(--functional-btn-radius, var(--functional-radius, 0.25rem));
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
.btn-grouped:not(:last-child) {
|
|
315
|
+
border-top-right-radius: 0;
|
|
316
|
+
border-bottom-right-radius: 0;
|
|
317
|
+
margin-inline-end: -1px;
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
.btn-grouped:not(:first-child) {
|
|
321
|
+
border-top-left-radius: 0;
|
|
322
|
+
border-bottom-left-radius: 0;
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
.btn-capsule {
|
|
326
|
+
--padding-side: calc(var(--functional-side-padding, 0.75rem) * 1.5);
|
|
327
|
+
|
|
328
|
+
border-radius: var(--functional-radius-capsule);
|
|
329
|
+
padding-inline-start: var(--padding-side);
|
|
330
|
+
padding-inline-end: var(--padding-side);
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
@media (prefers-reduced-motion), (update: slow) {
|
|
334
|
+
.btn,
|
|
335
|
+
.btn:focus {
|
|
336
|
+
transition-duration: 0.001ms !important;
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
/**
|
|
254
341
|
* Invisible buttons. Generally used for a Cancel or icon button that behaves like a button,
|
|
255
342
|
* semantically and for a11y, but, does so without all the typical "button chrome" behind it.
|
|
256
343
|
*/
|
|
257
|
-
:is(.btn-link, .btn-blank) {
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
/* Since blank buttons can be used for things like input addons we don't want to go crazy
|
|
344
|
+
:is(.btn-link, .btn-blank) {
|
|
345
|
+
font-family: var(--functional-btn-font-family, var(--functional-font-family-body));
|
|
346
|
+
font-size: var(--functional-btn-font-size, 1rem);
|
|
347
|
+
background-color: transparent;
|
|
348
|
+
border: 0;
|
|
349
|
+
border-radius: 0;
|
|
350
|
+
box-shadow: none;
|
|
351
|
+
transition: none;
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
/* Since blank buttons can be used for things like input addons we don't want to go crazy
|
|
268
355
|
on the side padding. As such, these have a good bit less then regular buttons. */
|
|
269
|
-
.btn-blank {
|
|
270
|
-
|
|
356
|
+
.btn-blank {
|
|
357
|
+
--functional-btn-blank-side-padding: var(--btn-blank-side-padding, 0.25rem);
|
|
271
358
|
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
}
|
|
359
|
+
padding-inline-start: var(--functional-btn-blank-side-padding);
|
|
360
|
+
padding-inline-end: var(--functional-btn-blank-side-padding);
|
|
361
|
+
}
|
|
275
362
|
|
|
276
|
-
/* A button blank with link color text */
|
|
277
|
-
.btn-link {
|
|
278
|
-
|
|
279
|
-
}
|
|
363
|
+
/* A button blank with link color text */
|
|
364
|
+
.btn-link {
|
|
365
|
+
color: var(--functional-btn-primary, var(--functional-primary));
|
|
366
|
+
}
|
|
280
367
|
|
|
281
|
-
.btn-link:hover {
|
|
282
|
-
|
|
283
|
-
}
|
|
368
|
+
.btn-link:hover {
|
|
369
|
+
cursor: pointer;
|
|
370
|
+
}
|
|
284
371
|
</style>
|
|
285
|
-
|
|
286
|
-
<script lang="ts">
|
|
287
|
-
export let mode = "";
|
|
288
|
-
export let size = "";
|
|
289
|
-
export let isBordered = false;
|
|
290
|
-
export let isCapsule = false;
|
|
291
|
-
export let isGrouped = false;
|
|
292
|
-
export let isBlock = false;
|
|
293
|
-
export let isLink = false;
|
|
294
|
-
export let isBlank = false;
|
|
295
|
-
export let isDisabled = false;
|
|
296
|
-
export let role = undefined;
|
|
297
|
-
export let isCircle = false;
|
|
298
|
-
export let isRounded = false;
|
|
299
|
-
export let isSkinned = true;
|
|
300
|
-
// The following properties can be used by consumers of Tabs which setup their own
|
|
301
|
-
// custom buttons as these aria and tabindex attributes are required for a11y
|
|
302
|
-
export let ariaSelected = undefined;
|
|
303
|
-
export let ariaControls = undefined;
|
|
304
|
-
export let tabIndex = undefined;
|
|
305
|
-
|
|
306
|
-
$: aSelected = ariaSelected || null;
|
|
307
|
-
$: tIndex = tabIndex || null;
|
|
308
|
-
/**
|
|
309
|
-
* This prop is an escape hatch for global CSS overrides. Likely, the most useful reason to
|
|
310
|
-
* leverage this is to add custom responsive media query code. Note that you'll likely need
|
|
311
|
-
* to add specificity to beat out the Svelte based CSS, and, in Svelte land you'll need to
|
|
312
|
-
* utilize globals functionality which might look like:
|
|
313
|
-
* @media all and (min-width: 769px) {
|
|
314
|
-
* :global(button.btn.button-overrides) {
|
|
315
|
-
* font-size: 18px;
|
|
316
|
-
* ...etc.
|
|
317
|
-
*/
|
|
318
|
-
export let css = "";
|
|
319
|
-
|
|
320
|
-
/**
|
|
321
|
-
* Button type: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button
|
|
322
|
-
* submit: submits form data to the server
|
|
323
|
-
* reset: resets all the controls to their initial values, like <input type="reset">
|
|
324
|
-
* button: button has no default behavior, and does nothing when pressed by default.
|
|
325
|
-
*/
|
|
326
|
-
export let type = "button";
|
|
327
|
-
|
|
328
|
-
// ******************** HEY! ************************
|
|
329
|
-
// You will need to also add these to the buttonslot:
|
|
330
|
-
// agnostic-svelte/src/stories/ButtonSlot.svelte
|
|
331
|
-
$: klasses = [
|
|
332
|
-
isSkinned ? "btn" : "btn-base",
|
|
333
|
-
mode ? `btn-${mode}` : "",
|
|
334
|
-
size ? `btn-${size}` : "",
|
|
335
|
-
isBordered ? "btn-bordered" : "",
|
|
336
|
-
isCapsule ? "btn-capsule " : "",
|
|
337
|
-
isGrouped ? "btn-grouped" : "",
|
|
338
|
-
isBlock ? "btn-block" : "",
|
|
339
|
-
isCircle ? "btn-circle" : "",
|
|
340
|
-
isRounded ? "btn-rounded" : "",
|
|
341
|
-
isDisabled ? "disabled" : "",
|
|
342
|
-
isBlank ? "btn-blank" : "",
|
|
343
|
-
isLink ? "btn-link" : "",
|
|
344
|
-
css ? `${css}` : "",
|
|
345
|
-
].filter(c => c).join(" ");
|
|
346
|
-
</script>
|
|
347
|
-
|
|
348
|
-
<!-- https://github.com/sveltejs/svelte/issues/2324 -->
|
|
349
|
-
{#if type === "faux"}
|
|
350
|
-
<div class={klasses}>
|
|
351
|
-
<slot />
|
|
352
|
-
</div>
|
|
353
|
-
{:else}
|
|
354
|
-
<button
|
|
355
|
-
type={type}
|
|
356
|
-
class={klasses}
|
|
357
|
-
on:keydown
|
|
358
|
-
on:click
|
|
359
|
-
on:focus
|
|
360
|
-
on:blur
|
|
361
|
-
role={role}
|
|
362
|
-
aria-selected={aSelected}
|
|
363
|
-
aria-controls={ariaControls}
|
|
364
|
-
tab-index={tIndex}
|
|
365
|
-
disabled={isDisabled}
|
|
366
|
-
{...$$restProps}
|
|
367
|
-
>
|
|
368
|
-
<slot />
|
|
369
|
-
</button>
|
|
370
|
-
{/if}
|