@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.
Files changed (98) hide show
  1. package/dist/components/Link.svelte +290 -290
  2. package/dist/components/agnostic/Alert/Alert.svelte +310 -0
  3. package/dist/components/agnostic/Alert/Alert.svelte.d.ts +31 -0
  4. package/dist/components/agnostic/Avatar/Avatar.svelte +123 -0
  5. package/dist/components/agnostic/Avatar/Avatar.svelte.d.ts +26 -0
  6. package/dist/components/agnostic/Avatar/AvatarGroup.svelte +106 -0
  7. package/dist/components/agnostic/Avatar/AvatarGroup.svelte.d.ts +29 -0
  8. package/dist/components/agnostic/Breadcrumb/Breadcrumb.svelte +56 -0
  9. package/dist/components/agnostic/Breadcrumb/Breadcrumb.svelte.d.ts +20 -0
  10. package/dist/components/agnostic/Breadcrumb/api.d.ts +4 -0
  11. package/dist/components/agnostic/Breadcrumb/api.js +1 -0
  12. package/dist/components/agnostic/Button/Button.svelte +345 -0
  13. package/dist/components/agnostic/Button/Button.svelte.d.ts +43 -0
  14. package/dist/components/agnostic/Button/ButtonGroup.svelte +20 -0
  15. package/dist/components/agnostic/Button/ButtonGroup.svelte.d.ts +23 -0
  16. package/dist/components/agnostic/Button/button-base.css +12 -0
  17. package/dist/components/agnostic/Button/button-core.css +237 -0
  18. package/dist/components/agnostic/Button/button-empty.css +31 -0
  19. package/dist/components/agnostic/Button/button-group.css +8 -0
  20. package/dist/components/agnostic/Card/Card.svelte +133 -0
  21. package/dist/components/agnostic/Card/Card.svelte.d.ts +31 -0
  22. package/dist/components/agnostic/ChoiceInput/ChoiceInput.svelte +337 -0
  23. package/dist/components/agnostic/ChoiceInput/ChoiceInput.svelte.d.ts +37 -0
  24. package/dist/components/agnostic/ChoiceInput/api.d.ts +7 -0
  25. package/dist/components/agnostic/ChoiceInput/api.js +1 -0
  26. package/dist/components/agnostic/Close/Close.svelte +120 -0
  27. package/dist/components/agnostic/Close/Close.svelte.d.ts +23 -0
  28. package/dist/components/agnostic/Close/api.d.ts +1 -0
  29. package/dist/components/agnostic/Close/api.js +1 -0
  30. package/dist/components/agnostic/Dialog/Dialog.svelte +265 -0
  31. package/dist/components/agnostic/Dialog/Dialog.svelte.d.ts +39 -0
  32. package/dist/components/agnostic/Disclose/Disclose.svelte +102 -0
  33. package/dist/components/agnostic/Disclose/Disclose.svelte.d.ts +23 -0
  34. package/dist/components/agnostic/Divider/Divider.svelte +139 -0
  35. package/dist/components/agnostic/Divider/Divider.svelte.d.ts +25 -0
  36. package/dist/components/agnostic/Divider/api.d.ts +3 -0
  37. package/dist/components/agnostic/Divider/api.js +1 -0
  38. package/dist/components/agnostic/Drawer/Drawer.svelte +30 -0
  39. package/dist/components/agnostic/Drawer/Drawer.svelte.d.ts +28 -0
  40. package/dist/components/agnostic/Drawer/api.d.ts +1 -0
  41. package/dist/components/agnostic/Drawer/api.js +1 -0
  42. package/dist/components/agnostic/EmptyState/EmptyState.svelte +46 -0
  43. package/dist/components/agnostic/EmptyState/EmptyState.svelte.d.ts +23 -0
  44. package/dist/components/agnostic/Header/Header.svelte +104 -0
  45. package/dist/components/agnostic/Header/Header.svelte.d.ts +26 -0
  46. package/dist/components/agnostic/Header/HeaderNav.svelte +28 -0
  47. package/dist/components/agnostic/Header/HeaderNav.svelte.d.ts +20 -0
  48. package/dist/components/agnostic/Header/HeaderNavItem.svelte +30 -0
  49. package/dist/components/agnostic/Header/HeaderNavItem.svelte.d.ts +20 -0
  50. package/dist/components/agnostic/Icon/Icon.svelte +180 -0
  51. package/dist/components/agnostic/Icon/Icon.svelte.d.ts +23 -0
  52. package/dist/components/agnostic/Icon/api.d.ts +2 -0
  53. package/dist/components/agnostic/Icon/api.js +1 -0
  54. package/dist/components/agnostic/Input/Input.svelte +415 -0
  55. package/dist/components/agnostic/Input/Input.svelte.d.ts +45 -0
  56. package/dist/components/agnostic/Input/InputAddonItem.svelte +42 -0
  57. package/dist/components/agnostic/Input/InputAddonItem.svelte.d.ts +33 -0
  58. package/dist/components/agnostic/Loader/Loader.svelte +113 -0
  59. package/dist/components/agnostic/Loader/Loader.svelte.d.ts +20 -0
  60. package/dist/components/agnostic/Menu/Menu.svelte +466 -0
  61. package/dist/components/agnostic/Menu/Menu.svelte.d.ts +31 -0
  62. package/dist/components/agnostic/Menu/MenuItem.svelte +117 -0
  63. package/dist/components/agnostic/Menu/MenuItem.svelte.d.ts +29 -0
  64. package/dist/components/agnostic/Progress/Progress.svelte +50 -0
  65. package/dist/components/agnostic/Progress/Progress.svelte.d.ts +20 -0
  66. package/dist/components/agnostic/Select/Select.svelte +141 -0
  67. package/dist/components/agnostic/Select/Select.svelte.d.ts +32 -0
  68. package/dist/components/agnostic/Spinner/Spinner.svelte +105 -0
  69. package/dist/components/agnostic/Spinner/Spinner.svelte.d.ts +19 -0
  70. package/dist/components/agnostic/Switch/Switch.svelte +275 -0
  71. package/dist/components/agnostic/Switch/Switch.svelte.d.ts +45 -0
  72. package/dist/components/agnostic/Table/Table.svelte +508 -0
  73. package/dist/components/agnostic/Table/Table.svelte.d.ts +36 -0
  74. package/dist/components/agnostic/Table/TableCustomRenderComponent.svelte +13 -0
  75. package/dist/components/agnostic/Table/TableCustomRenderComponent.svelte.d.ts +25 -0
  76. package/dist/components/agnostic/Tabs/TabButtonCustom.svelte +65 -0
  77. package/dist/components/agnostic/Tabs/TabButtonCustom.svelte.d.ts +35 -0
  78. package/dist/components/agnostic/Tabs/Tabs.svelte +330 -0
  79. package/dist/components/agnostic/Tabs/Tabs.svelte.d.ts +34 -0
  80. package/dist/components/agnostic/Tabs/api.d.ts +10 -0
  81. package/dist/components/agnostic/Tabs/api.js +1 -0
  82. package/dist/components/agnostic/Tag/Tag.svelte +74 -0
  83. package/dist/components/agnostic/Tag/Tag.svelte.d.ts +23 -0
  84. package/dist/components/agnostic/Tag/TagSlots.svelte +51 -0
  85. package/dist/components/agnostic/Tag/TagSlots.svelte.d.ts +16 -0
  86. package/dist/components/agnostic/Toasts/Toasts.svelte +46 -0
  87. package/dist/components/agnostic/Toasts/Toasts.svelte.d.ts +22 -0
  88. package/dist/components/agnostic/Tooltip/Tooltip.svelte +103 -0
  89. package/dist/components/agnostic/Tooltip/Tooltip.svelte.d.ts +23 -0
  90. package/dist/components/agnostic/Tooltip/TooltipSlots.svelte +81 -0
  91. package/dist/components/agnostic/Tooltip/TooltipSlots.svelte.d.ts +16 -0
  92. package/dist/components/agnostic/Tooltip/api.d.ts +1 -0
  93. package/dist/components/agnostic/Tooltip/api.js +1 -0
  94. package/dist/components/agnostic/animation.css +37 -0
  95. package/dist/components/files/utils.js +1 -1
  96. package/dist/index.d.ts +30 -1
  97. package/dist/index.js +30 -1
  98. package/package.json +1 -4
@@ -0,0 +1,345 @@
1
+ <style>
2
+ .btn-base {
3
+ display: inline-flex;
4
+ align-items: center;
5
+ justify-content: center;
6
+ white-space: nowrap;
7
+ user-select: none;
8
+ appearance: none;
9
+ cursor: pointer;
10
+ box-sizing: border-box;
11
+ transition-property: all;
12
+ transition-duration: var(--functional-timing-medium);
13
+ }
14
+
15
+ .btn {
16
+ /* TODO test this fallback override syntax is correct */
17
+ display: inline-flex;
18
+ align-items: center;
19
+ justify-content: center;
20
+ white-space: nowrap;
21
+ user-select: none;
22
+ appearance: none;
23
+ cursor: pointer;
24
+ box-sizing: border-box;
25
+ transition-property: all;
26
+ transition-duration: var(--functional-timing-medium);
27
+ }
28
+
29
+ .btn-skin,
30
+ .btn {
31
+ color: var(--functional-btn-font-color, var(--functional-dark));
32
+ background-color: var(--functional-btn-bgcolor, var(--functional-gray-light));
33
+ border-color: var(--functional-btn-bgcolor, var(--functional-gray-light));
34
+
35
+ /* seems like a reasonable default as chrome picks `outset` which results in a weird 3d effect */
36
+ border-style: solid;
37
+ border-width: var(--functional-btn-border-size, 1px);
38
+ font-family: var(--functional-btn-font-family, var(--functional-font-family-body));
39
+ font-weight: var(--functional-btn-font-weight, 400);
40
+ font-size: var(--functional-btn-font-size, 1rem);
41
+
42
+ /* this can be overriden, but it might mess with the balance of the button heights across variants */
43
+ line-height: var(--functional-line-height, var(--fluid-20, 1.25rem));
44
+ padding-block-start: var(--functional-vertical-pad, 0.5rem);
45
+ padding-block-end: var(--functional-vertical-pad, 0.5rem);
46
+ padding-inline-start: var(--functional-side-padding, 0.75rem);
47
+ padding-inline-end: var(--functional-side-padding, 0.75rem);
48
+ text-decoration: none;
49
+ text-align: center;
50
+ outline: none;
51
+ }
52
+
53
+ .btn:visited {
54
+ color: var(--functional-btn-font-color, var(--functional-dark));
55
+ }
56
+
57
+ .btn:hover {
58
+ opacity: 85%;
59
+ text-decoration: none;
60
+ }
61
+
62
+ .btn:active {
63
+ text-shadow: 0 1px 0 rgb(255 255 255 / 30%);
64
+ text-decoration: none;
65
+ transition-duration: 0s;
66
+ box-shadow: inset 0 1px 3px rgb(0 0 0 / 20%);
67
+ }
68
+
69
+ .btn:focus {
70
+ box-shadow: 0 0 0 var(--functional-focus-ring-outline-width) var(--functional-focus-ring-color);
71
+
72
+ /* Needed for High Contrast mode */
73
+ outline:
74
+ var(--functional-focus-ring-outline-width) var(--functional-focus-ring-outline-style)
75
+ var(--functional-focus-ring-outline-color);
76
+ transition: box-shadow var(--functional-timing-fast) ease-out;
77
+
78
+ /* In order for the focused element's box-shadow to appear above its siblings we need to
79
+ establish a new stacking context: https://stackoverflow.com/a/28042700 */
80
+ isolation: isolate;
81
+ }
82
+
83
+ /*
84
+ * Disabled State
85
+ *
86
+ * The disabled state uses the class .disabled, is-disabled,
87
+ * and the form attribute disabled="disabled".
88
+ * The use of !important is only added because this is a state
89
+ * that must be applied to all buttons when in a disabled state.
90
+ */
91
+ .btn.disabled,
92
+ .btn:disabled {
93
+ top: 0 !important;
94
+ background: var(--functional-btn-disabled-bg, var(--functional-gray-mid-dark)) !important;
95
+ text-shadow: 0 1px 1px rgb(255 255 255 / 100%) !important;
96
+
97
+ /* primary, secondary, natural, all look same when disabled; and we don't want to
98
+ have an inadvertant looking blue primary border when disabled so it's transparent */
99
+ border-color: transparent;
100
+ color: var(--functional-btn-disabled-color, var(--functional-gray-dark)) !important;
101
+ cursor: default !important;
102
+ appearance: none !important;
103
+ box-shadow: none !important;
104
+ opacity: 80% !important;
105
+ }
106
+
107
+ .btn-primary {
108
+ background-color: var(--functional-btn-primary, var(--functional-primary));
109
+ border-color: var(--functional-btn-primary, var(--functional-primary));
110
+ color: var(--functional-btn-primary-color, var(--functional-light));
111
+ }
112
+
113
+ /* Border and font is primary. When hovered, we invert with primary background and white font */
114
+ .btn-primary.btn-bordered {
115
+ color: var(--functional-btn-primary, var(--functional-primary));
116
+ }
117
+
118
+ .btn-primary.btn-bordered:hover,
119
+ .btn-primary.btn-bordered:focus {
120
+ background-color: var(--functional-btn-primary, var(--functional-primary));
121
+ color: var(--functional-btn-primary-color, var(--functional-light));
122
+ }
123
+
124
+ .btn-primary:visited {
125
+ color: var(--functional-btn-primary-color, var(--functional-light));
126
+ }
127
+
128
+ .btn-secondary {
129
+ background-color: var(--functional-btn-secondary, var(--functional-secondary));
130
+ border-color: var(--functional-btn-secondary, var(--functional-secondary));
131
+ color: var(--functional-btn-secondary-color, var(--functional-light));
132
+ }
133
+
134
+ /* Border and font is secondary. When hovered, we invert with secondary background and white font */
135
+ .btn-secondary.btn-bordered {
136
+ color: var(--functional-btn-secondary, var(--functional-secondary));
137
+ }
138
+
139
+ .btn-secondary.btn-bordered:hover,
140
+ .btn-secondary.btn-bordered:focus {
141
+ background-color: var(--functional-btn-secondary, var(--functional-secondary));
142
+ color: var(--functional-btn-secondary-color, var(--functional-light));
143
+ }
144
+
145
+ .btn-secondary:visited {
146
+ color: var(--functional-btn-secondary-color, var(--functional-light));
147
+ }
148
+
149
+ /*
150
+ /**
151
+ * Border Buttons
152
+ */
153
+ .btn-bordered {
154
+ border-width: 1px;
155
+ background: transparent;
156
+ }
157
+
158
+ /**
159
+ * Sizes
160
+ */
161
+ .btn-large {
162
+ font-size: calc(var(--functional-btn-font-size, 1rem) + 0.25rem);
163
+ height: 3rem;
164
+ line-height: 3rem;
165
+ padding: 0 3rem;
166
+ }
167
+
168
+ .btn-small {
169
+ font-size: calc(var(--functional-btn-font-size, 1rem) - 0.25rem);
170
+ height: 2rem;
171
+ line-height: 2rem;
172
+ padding: 0 2rem;
173
+ }
174
+
175
+ /**
176
+ * Rounded
177
+ */
178
+ .btn-rounded {
179
+ border-radius: var(--functional-btn-radius, var(--functional-radius, 0.25rem));
180
+ }
181
+
182
+ .btn-pill {
183
+ border-radius: 200px;
184
+ }
185
+
186
+ /*
187
+ * Size Adjustment for equal height & width buttons
188
+ *
189
+ * Remove padding
190
+ */
191
+ .btn-circle {
192
+ border-radius: 100%;
193
+ width: 2.5rem;
194
+ height: 2.5rem;
195
+ padding: 0 !important;
196
+ }
197
+
198
+ .btn-circle-large {
199
+ font-size: calc(var(--functional-btn-font-size, 1rem) + 0.25rem);
200
+ width: 3rem;
201
+ height: 3rem;
202
+ }
203
+
204
+ .btn-circle-small {
205
+ font-size: calc(var(--functional-btn-font-size, 1rem) - 0.25rem);
206
+ width: 2rem;
207
+ height: 2rem;
208
+ }
209
+
210
+ /**
211
+ * Button Block (stacked)
212
+ */
213
+ .btn-block {
214
+ width: 100%;
215
+ }
216
+
217
+ /* This is a utility class used if you literally want to stack block buttons one after another.
218
+ Apply this class to the nth-of-type(2) onwards to ensure the borders line up properly. */
219
+ .btn-block-following {
220
+ margin-block-start: -1px;
221
+ }
222
+
223
+ .btn-grouped {
224
+ border-radius: var(--functional-btn-radius, var(--functional-radius, 0.25rem));
225
+ }
226
+
227
+ .btn-grouped:not(:last-child) {
228
+ border-top-right-radius: 0;
229
+ border-bottom-right-radius: 0;
230
+ margin-inline-end: -1px;
231
+ }
232
+
233
+ .btn-grouped:not(:first-child) {
234
+ border-top-left-radius: 0;
235
+ border-bottom-left-radius: 0;
236
+ }
237
+
238
+ .btn-capsule {
239
+ --padding-side: calc(var(--functional-side-padding, 0.75rem) * 1.5);
240
+
241
+ border-radius: var(--functional-radius-capsule);
242
+ padding-inline-start: var(--padding-side);
243
+ padding-inline-end: var(--padding-side);
244
+ }
245
+
246
+ @media (prefers-reduced-motion), (update: slow) {
247
+ .btn,
248
+ .btn:focus {
249
+ transition-duration: 0.001ms !important;
250
+ }
251
+ }
252
+
253
+ /**
254
+ * Invisible buttons. Generally used for a Cancel or icon button that behaves like a button,
255
+ * semantically and for a11y, but, does so without all the typical "button chrome" behind it.
256
+ */
257
+ :is(.btn-link, .btn-blank) {
258
+ font-family: var(--functional-btn-font-family, var(--functional-font-family-body));
259
+ font-size: var(--functional-btn-font-size, 1rem);
260
+ background-color: transparent;
261
+ border: 0;
262
+ border-radius: 0;
263
+ box-shadow: none;
264
+ transition: none;
265
+ }
266
+
267
+ /* Since blank buttons can be used for things like input addons we don't want to go crazy
268
+ on the side padding. As such, these have a good bit less then regular buttons. */
269
+ .btn-blank {
270
+ --functional-btn-blank-side-padding: var(--btn-blank-side-padding, 0.25rem);
271
+
272
+ padding-inline-start: var(--functional-btn-blank-side-padding);
273
+ padding-inline-end: var(--functional-btn-blank-side-padding);
274
+ }
275
+
276
+ /* A button blank with link color text */
277
+ .btn-link {
278
+ color: var(--functional-btn-primary, var(--functional-primary));
279
+ }
280
+
281
+ .btn-link:hover {
282
+ cursor: pointer;
283
+ }
284
+ </style>
285
+
286
+ <script>export let mode = "";
287
+ export let size = "";
288
+ export let isBordered = false;
289
+ export let isCapsule = false;
290
+ export let isGrouped = false;
291
+ export let isBlock = false;
292
+ export let isLink = false;
293
+ export let isBlank = false;
294
+ export let isDisabled = false;
295
+ export let role = void 0;
296
+ export let isCircle = false;
297
+ export let isRounded = false;
298
+ export let isSkinned = true;
299
+ export let ariaSelected = void 0;
300
+ export let ariaControls = void 0;
301
+ export let tabIndex = void 0;
302
+ $: aSelected = ariaSelected || null;
303
+ $: tIndex = tabIndex || null;
304
+ export let css = "";
305
+ export let type = "button";
306
+ $: klasses = [
307
+ isSkinned ? "btn" : "btn-base",
308
+ mode ? `btn-${mode}` : "",
309
+ size ? `btn-${size}` : "",
310
+ isBordered ? "btn-bordered" : "",
311
+ isCapsule ? "btn-capsule " : "",
312
+ isGrouped ? "btn-grouped" : "",
313
+ isBlock ? "btn-block" : "",
314
+ isCircle ? "btn-circle" : "",
315
+ isRounded ? "btn-rounded" : "",
316
+ isDisabled ? "disabled" : "",
317
+ isBlank ? "btn-blank" : "",
318
+ isLink ? "btn-link" : "",
319
+ css ? `${css}` : ""
320
+ ].filter((c) => c).join(" ");
321
+ </script>
322
+
323
+ <!-- https://github.com/sveltejs/svelte/issues/2324 -->
324
+ {#if type === "faux"}
325
+ <div class={klasses}>
326
+ <slot />
327
+ </div>
328
+ {:else}
329
+ <button
330
+ type={type}
331
+ class={klasses}
332
+ on:keydown
333
+ on:click
334
+ on:focus
335
+ on:blur
336
+ role={role}
337
+ aria-selected={aSelected}
338
+ aria-controls={ariaControls}
339
+ tab-index={tIndex}
340
+ disabled={isDisabled}
341
+ {...$$restProps}
342
+ >
343
+ <slot />
344
+ </button>
345
+ {/if}
@@ -0,0 +1,43 @@
1
+ import { SvelteComponent } from "svelte";
2
+ declare const __propDef: {
3
+ props: {
4
+ [x: string]: any;
5
+ mode?: string | undefined;
6
+ size?: string | undefined;
7
+ isBordered?: boolean | undefined;
8
+ isCapsule?: boolean | undefined;
9
+ isGrouped?: boolean | undefined;
10
+ isBlock?: boolean | undefined;
11
+ isLink?: boolean | undefined;
12
+ isBlank?: boolean | undefined;
13
+ isDisabled?: boolean | undefined;
14
+ role?: undefined;
15
+ isCircle?: boolean | undefined;
16
+ isRounded?: boolean | undefined;
17
+ isSkinned?: boolean | undefined;
18
+ ariaSelected?: undefined;
19
+ ariaControls?: undefined;
20
+ tabIndex?: undefined;
21
+ css?: string | undefined;
22
+ type?: string | undefined;
23
+ };
24
+ events: {
25
+ keydown: KeyboardEvent;
26
+ click: MouseEvent;
27
+ focus: FocusEvent;
28
+ blur: FocusEvent;
29
+ } & {
30
+ [evt: string]: CustomEvent<any>;
31
+ };
32
+ slots: {
33
+ default: {};
34
+ };
35
+ exports?: undefined;
36
+ bindings?: undefined;
37
+ };
38
+ export type ButtonProps = typeof __propDef.props;
39
+ export type ButtonEvents = typeof __propDef.events;
40
+ export type ButtonSlots = typeof __propDef.slots;
41
+ export default class Button extends SvelteComponent<ButtonProps, ButtonEvents, ButtonSlots> {
42
+ }
43
+ export {};
@@ -0,0 +1,20 @@
1
+ <style>
2
+ /**
3
+ * Button Groups. See also button-core.css which has btn-grouped which needs to be
4
+ * applied to the buttons that are projected within a button group.
5
+ */
6
+ .btn-group {
7
+ display: inline-flex;
8
+ flex-direction: row;
9
+ }
10
+
11
+ </style>
12
+
13
+ <script>export let ariaLabel = "";
14
+ export let css = "";
15
+ let klasses = ["btn-group", css ? `${css}` : ""].filter((cl) => cl.length).join(" ");
16
+ </script>
17
+
18
+ <div class={klasses} role="group" aria-label={ariaLabel} on:click>
19
+ <slot />
20
+ </div>
@@ -0,0 +1,23 @@
1
+ import { SvelteComponent } from "svelte";
2
+ declare const __propDef: {
3
+ props: {
4
+ ariaLabel?: string;
5
+ css?: string;
6
+ };
7
+ events: {
8
+ click: MouseEvent;
9
+ } & {
10
+ [evt: string]: CustomEvent<any>;
11
+ };
12
+ slots: {
13
+ default: {};
14
+ };
15
+ exports?: {} | undefined;
16
+ bindings?: string | undefined;
17
+ };
18
+ export type ButtonGroupProps = typeof __propDef.props;
19
+ export type ButtonGroupEvents = typeof __propDef.events;
20
+ export type ButtonGroupSlots = typeof __propDef.slots;
21
+ export default class ButtonGroup extends SvelteComponent<ButtonGroupProps, ButtonGroupEvents, ButtonGroupSlots> {
22
+ }
23
+ export {};
@@ -0,0 +1,12 @@
1
+ .btn-base {
2
+ display: inline-flex;
3
+ align-items: center;
4
+ justify-content: center;
5
+ white-space: nowrap;
6
+ user-select: none;
7
+ appearance: none;
8
+ cursor: pointer;
9
+ box-sizing: border-box;
10
+ transition-property: all;
11
+ transition-duration: var(--agnostic-timing-medium);
12
+ }
@@ -0,0 +1,237 @@
1
+ .btn {
2
+ /* TODO test this fallback override syntax is correct */
3
+ display: inline-flex;
4
+ align-items: center;
5
+ justify-content: center;
6
+ white-space: nowrap;
7
+ user-select: none;
8
+ appearance: none;
9
+ cursor: pointer;
10
+ box-sizing: border-box;
11
+ transition-property: all;
12
+ transition-duration: var(--agnostic-timing-medium);
13
+ }
14
+
15
+ .btn-skin,
16
+ .btn {
17
+ color: var(--agnostic-btn-font-color, var(--agnostic-dark));
18
+ background-color: var(--agnostic-btn-bgcolor, var(--agnostic-gray-light));
19
+ border-color: var(--agnostic-btn-bgcolor, var(--agnostic-gray-light));
20
+
21
+ /* seems like a reasonable default as chrome picks `outset` which results in a weird 3d effect */
22
+ border-style: solid;
23
+ border-width: var(--agnostic-btn-border-size, 1px);
24
+ font-family: var(--agnostic-btn-font-family, var(--agnostic-font-family-body));
25
+ font-weight: var(--agnostic-btn-font-weight, 400);
26
+ font-size: var(--agnostic-btn-font-size, 1rem);
27
+
28
+ /* this can be overriden, but it might mess with the balance of the button heights across variants */
29
+ line-height: var(--agnostic-line-height, var(--fluid-20, 1.25rem));
30
+ padding-block-start: var(--agnostic-vertical-pad, 0.5rem);
31
+ padding-block-end: var(--agnostic-vertical-pad, 0.5rem);
32
+ padding-inline-start: var(--agnostic-side-padding, 0.75rem);
33
+ padding-inline-end: var(--agnostic-side-padding, 0.75rem);
34
+ text-decoration: none;
35
+ text-align: center;
36
+ outline: none;
37
+ }
38
+
39
+ .btn:visited {
40
+ color: var(--agnostic-btn-font-color, var(--agnostic-dark));
41
+ }
42
+
43
+ .btn:hover {
44
+ opacity: 85%;
45
+ text-decoration: none;
46
+ }
47
+
48
+ .btn:active {
49
+ text-shadow: 0 1px 0 rgb(255 255 255 / 30%);
50
+ text-decoration: none;
51
+ transition-duration: 0s;
52
+ box-shadow: inset 0 1px 3px rgb(0 0 0 / 20%);
53
+ }
54
+
55
+ .btn:focus {
56
+ box-shadow: 0 0 0 var(--agnostic-focus-ring-outline-width) var(--agnostic-focus-ring-color);
57
+
58
+ /* Needed for High Contrast mode */
59
+ outline:
60
+ var(--agnostic-focus-ring-outline-width) var(--agnostic-focus-ring-outline-style)
61
+ var(--agnostic-focus-ring-outline-color);
62
+ transition: box-shadow var(--agnostic-timing-fast) ease-out;
63
+
64
+ /* In order for the focused element's box-shadow to appear above its siblings we need to
65
+ establish a new stacking context: https://stackoverflow.com/a/28042700 */
66
+ isolation: isolate;
67
+ }
68
+
69
+ /*
70
+ * Disabled State
71
+ *
72
+ * The disabled state uses the class .disabled, is-disabled,
73
+ * and the form attribute disabled="disabled".
74
+ * The use of !important is only added because this is a state
75
+ * that must be applied to all buttons when in a disabled state.
76
+ */
77
+ .btn.disabled,
78
+ .btn:disabled {
79
+ top: 0 !important;
80
+ background: var(--agnostic-btn-disabled-bg, var(--agnostic-gray-mid-dark)) !important;
81
+ text-shadow: 0 1px 1px rgb(255 255 255 / 100%) !important;
82
+
83
+ /* primary, secondary, natural, all look same when disabled; and we don't want to
84
+ have an inadvertant looking blue primary border when disabled so it's transparent */
85
+ border-color: transparent;
86
+ color: var(--agnostic-btn-disabled-color, var(--agnostic-gray-dark)) !important;
87
+ cursor: default !important;
88
+ appearance: none !important;
89
+ box-shadow: none !important;
90
+ opacity: 80% !important;
91
+ }
92
+
93
+ .btn-primary {
94
+ background-color: var(--agnostic-btn-primary, var(--agnostic-primary));
95
+ border-color: var(--agnostic-btn-primary, var(--agnostic-primary));
96
+ color: var(--agnostic-btn-primary-color, var(--agnostic-light));
97
+ }
98
+
99
+ /* Border and font is primary. When hovered, we invert with primary background and white font */
100
+ .btn-primary.btn-bordered {
101
+ color: var(--agnostic-btn-primary, var(--agnostic-primary));
102
+ }
103
+
104
+ .btn-primary.btn-bordered:hover,
105
+ .btn-primary.btn-bordered:focus {
106
+ background-color: var(--agnostic-btn-primary, var(--agnostic-primary));
107
+ color: var(--agnostic-btn-primary-color, var(--agnostic-light));
108
+ }
109
+
110
+ .btn-primary:visited {
111
+ color: var(--agnostic-btn-primary-color, var(--agnostic-light));
112
+ }
113
+
114
+ .btn-secondary {
115
+ background-color: var(--agnostic-btn-secondary, var(--agnostic-secondary));
116
+ border-color: var(--agnostic-btn-secondary, var(--agnostic-secondary));
117
+ color: var(--agnostic-btn-secondary-color, var(--agnostic-light));
118
+ }
119
+
120
+ /* Border and font is secondary. When hovered, we invert with secondary background and white font */
121
+ .btn-secondary.btn-bordered {
122
+ color: var(--agnostic-btn-secondary, var(--agnostic-secondary));
123
+ }
124
+
125
+ .btn-secondary.btn-bordered:hover,
126
+ .btn-secondary.btn-bordered:focus {
127
+ background-color: var(--agnostic-btn-secondary, var(--agnostic-secondary));
128
+ color: var(--agnostic-btn-secondary-color, var(--agnostic-light));
129
+ }
130
+
131
+ .btn-secondary:visited {
132
+ color: var(--agnostic-btn-secondary-color, var(--agnostic-light));
133
+ }
134
+
135
+ /*
136
+ /**
137
+ * Border Buttons
138
+ */
139
+ .btn-bordered {
140
+ border-width: 1px;
141
+ background: transparent;
142
+ }
143
+
144
+ /**
145
+ * Sizes
146
+ */
147
+ .btn-large {
148
+ font-size: calc(var(--agnostic-btn-font-size, 1rem) + 0.25rem);
149
+ height: 3rem;
150
+ line-height: 3rem;
151
+ padding: 0 3rem;
152
+ }
153
+
154
+ .btn-small {
155
+ font-size: calc(var(--agnostic-btn-font-size, 1rem) - 0.25rem);
156
+ height: 2rem;
157
+ line-height: 2rem;
158
+ padding: 0 2rem;
159
+ }
160
+
161
+ /**
162
+ * Rounded
163
+ */
164
+ .btn-rounded {
165
+ border-radius: var(--agnostic-btn-radius, var(--agnostic-radius, 0.25rem));
166
+ }
167
+
168
+ .btn-pill {
169
+ border-radius: 200px;
170
+ }
171
+
172
+ /*
173
+ * Size Adjustment for equal height & width buttons
174
+ *
175
+ * Remove padding
176
+ */
177
+ .btn-circle {
178
+ border-radius: 100%;
179
+ width: 2.5rem;
180
+ height: 2.5rem;
181
+ padding: 0 !important;
182
+ }
183
+
184
+ .btn-circle-large {
185
+ font-size: calc(var(--agnostic-btn-font-size, 1rem) + 0.25rem);
186
+ width: 3rem;
187
+ height: 3rem;
188
+ }
189
+
190
+ .btn-circle-small {
191
+ font-size: calc(var(--agnostic-btn-font-size, 1rem) - 0.25rem);
192
+ width: 2rem;
193
+ height: 2rem;
194
+ }
195
+
196
+ /**
197
+ * Button Block (stacked)
198
+ */
199
+ .btn-block {
200
+ width: 100%;
201
+ }
202
+
203
+ /* This is a utility class used if you literally want to stack block buttons one after another.
204
+ Apply this class to the nth-of-type(2) onwards to ensure the borders line up properly. */
205
+ .btn-block-following {
206
+ margin-block-start: -1px;
207
+ }
208
+
209
+ .btn-grouped {
210
+ border-radius: var(--agnostic-btn-radius, var(--agnostic-radius, 0.25rem));
211
+ }
212
+
213
+ .btn-grouped:not(:last-child) {
214
+ border-top-right-radius: 0;
215
+ border-bottom-right-radius: 0;
216
+ margin-inline-end: -1px;
217
+ }
218
+
219
+ .btn-grouped:not(:first-child) {
220
+ border-top-left-radius: 0;
221
+ border-bottom-left-radius: 0;
222
+ }
223
+
224
+ .btn-capsule {
225
+ --padding-side: calc(var(--agnostic-side-padding, 0.75rem) * 1.5);
226
+
227
+ border-radius: var(--agnostic-radius-capsule);
228
+ padding-inline-start: var(--padding-side);
229
+ padding-inline-end: var(--padding-side);
230
+ }
231
+
232
+ @media (prefers-reduced-motion), (update: slow) {
233
+ .btn,
234
+ .btn:focus {
235
+ transition-duration: 0.001ms !important;
236
+ }
237
+ }
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Invisible buttons. Generally used for a Cancel or icon button that behaves like a button,
3
+ * semantically and for a11y, but, does so without all the typical "button chrome" behind it.
4
+ */
5
+ :is(.btn-link, .btn-blank) {
6
+ font-family: var(--agnostic-btn-font-family, var(--agnostic-font-family-body));
7
+ font-size: var(--agnostic-btn-font-size, 1rem);
8
+ background-color: transparent;
9
+ border: 0;
10
+ border-radius: 0;
11
+ box-shadow: none;
12
+ transition: none;
13
+ }
14
+
15
+ /* Since blank buttons can be used for things like input addons we don't want to go crazy
16
+ on the side padding. As such, these have a good bit less then regular buttons. */
17
+ .btn-blank {
18
+ --agnostic-btn-blank-side-padding: var(--btn-blank-side-padding, 0.25rem);
19
+
20
+ padding-inline-start: var(--agnostic-btn-blank-side-padding);
21
+ padding-inline-end: var(--agnostic-btn-blank-side-padding);
22
+ }
23
+
24
+ /* A button blank with link color text */
25
+ .btn-link {
26
+ color: var(--agnostic-btn-primary, var(--agnostic-primary));
27
+ }
28
+
29
+ .btn-link:hover {
30
+ cursor: pointer;
31
+ }