@functionalcms/svelte-components 2.33.2 → 2.34.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/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/Dialog/SvelteA11yDialog.svelte +103 -0
- package/dist/components/agnostic/Dialog/SvelteA11yDialog.svelte.d.ts +30 -0
- package/dist/components/agnostic/Dialog/a11y-dialog.d.ts +56 -0
- package/dist/components/agnostic/Dialog/a11y-dialog.js +216 -0
- package/dist/components/agnostic/Dialog/dom-utils.d.ts +26 -0
- package/dist/components/agnostic/Dialog/dom-utils.js +206 -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/index.d.ts +30 -1
- package/dist/index.js +30 -1
- package/package.json +1 -4
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
<script>export let disabled = false;
|
|
2
|
+
export let isSelected = false;
|
|
3
|
+
export let classes;
|
|
4
|
+
let btn;
|
|
5
|
+
export function focus() {
|
|
6
|
+
return btn.focus();
|
|
7
|
+
}
|
|
8
|
+
export function isDisabled() {
|
|
9
|
+
return btn.disabled;
|
|
10
|
+
}
|
|
11
|
+
</script>
|
|
12
|
+
<button
|
|
13
|
+
on:click
|
|
14
|
+
on:keydown
|
|
15
|
+
bind:this={btn}
|
|
16
|
+
role="menuitem"
|
|
17
|
+
tabindex={isSelected ? 0 : -1}
|
|
18
|
+
disabled={disabled}
|
|
19
|
+
class={classes}
|
|
20
|
+
>
|
|
21
|
+
<slot />
|
|
22
|
+
</button>
|
|
23
|
+
|
|
24
|
+
<style>
|
|
25
|
+
.menu-item {
|
|
26
|
+
--menu-item-background-color: var(--functional-menu-item-background-color, inherit);
|
|
27
|
+
|
|
28
|
+
text-align: left;
|
|
29
|
+
|
|
30
|
+
/* TODO -- can we compose some of this from the button styles? */
|
|
31
|
+
border-color: var(--functional-btn-bgcolor, var(--functional-gray-light));
|
|
32
|
+
border-style: solid;
|
|
33
|
+
border-width: var(--functional-btn-border-size, 1px);
|
|
34
|
+
font-size: inherit;
|
|
35
|
+
|
|
36
|
+
/* this can be overriden, but it might mess with the balance of the button heights across variants */
|
|
37
|
+
line-height: var(--functional-line-height, var(--fluid-20, 1.25rem));
|
|
38
|
+
padding-block-start: var(--functional-vertical-pad, 0.5rem);
|
|
39
|
+
padding-block-end: var(--functional-vertical-pad, 0.5rem);
|
|
40
|
+
padding-inline-start: var(--functional-side-padding, 0.75rem);
|
|
41
|
+
padding-inline-end: var(--functional-side-padding, 0.75rem);
|
|
42
|
+
background-color: var(--menu-item-background-color);
|
|
43
|
+
display: block;
|
|
44
|
+
min-width: 100%;
|
|
45
|
+
white-space: nowrap;
|
|
46
|
+
cursor: default;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.menu-item[disabled] {
|
|
50
|
+
background: var(--functional-input-disabled-bg, var(--functional-disabled-bg)) !important;
|
|
51
|
+
color: var(--functional-input-disabled-color, var(--functional-disabled-color)) !important;
|
|
52
|
+
cursor: not-allowed !important;
|
|
53
|
+
opacity: 80% !important;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.menu-item:focus {
|
|
57
|
+
box-shadow: 0 0 0 var(--functional-focus-ring-outline-width) var(--functional-focus-ring-color);
|
|
58
|
+
|
|
59
|
+
/* Needed for High Contrast mode */
|
|
60
|
+
outline:
|
|
61
|
+
var(--functional-focus-ring-outline-width) var(--functional-focus-ring-outline-style)
|
|
62
|
+
var(--functional-focus-ring-outline-color);
|
|
63
|
+
transition: box-shadow var(--functional-timing-fast) ease-out;
|
|
64
|
+
|
|
65
|
+
/* In order for the focused element's box-shadow to appear above its siblings we need to
|
|
66
|
+
establish a new stacking context: https://stackoverflow.com/a/28042700 */
|
|
67
|
+
isolation: isolate;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.menu-item:not(:first-of-type) {
|
|
71
|
+
border-top: 0;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.menu-item-selected {
|
|
75
|
+
color: var(--functional-light);
|
|
76
|
+
background-color: var(--functional-primary);
|
|
77
|
+
border-color: var(--functional-primary);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.menu-item:active:not(.menu-item-selected) {
|
|
81
|
+
color: var(--functional-primary);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.menu-item [aria-checked="true"]::before {
|
|
85
|
+
/* TODO make this more flexible eventually */
|
|
86
|
+
content: "\2713\0020";
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/* Sizes */
|
|
90
|
+
.menu-item-large {
|
|
91
|
+
font-size: calc(var(--functional-btn-font-size, 1rem) + 0.25rem);
|
|
92
|
+
height: 3rem;
|
|
93
|
+
line-height: 2rem;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
.menu-item-small {
|
|
97
|
+
font-size: calc(var(--functional-btn-font-size, 1rem) - 0.25rem);
|
|
98
|
+
height: 2rem;
|
|
99
|
+
line-height: 1rem;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
.menu-item-rounded:first-of-type {
|
|
103
|
+
border-top-left-radius: var(--functional-radius);
|
|
104
|
+
border-top-right-radius: var(--functional-radius);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
.menu-item-rounded:last-of-type {
|
|
108
|
+
border-bottom-left-radius: var(--functional-radius);
|
|
109
|
+
border-bottom-right-radius: var(--functional-radius);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
.menu-item:hover:not([disabled]):not(.menu-item-selected) {
|
|
113
|
+
background-color: var(--functional-gray-extra-light);
|
|
114
|
+
cursor: pointer;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
</style>
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { SvelteComponent } from "svelte";
|
|
2
|
+
declare const __propDef: {
|
|
3
|
+
props: {
|
|
4
|
+
disabled?: boolean;
|
|
5
|
+
isSelected?: boolean;
|
|
6
|
+
classes: any;
|
|
7
|
+
focus?: () => any;
|
|
8
|
+
isDisabled?: () => any;
|
|
9
|
+
};
|
|
10
|
+
events: {
|
|
11
|
+
click: MouseEvent;
|
|
12
|
+
keydown: KeyboardEvent;
|
|
13
|
+
} & {
|
|
14
|
+
[evt: string]: CustomEvent<any>;
|
|
15
|
+
};
|
|
16
|
+
slots: {
|
|
17
|
+
default: {};
|
|
18
|
+
};
|
|
19
|
+
exports?: {} | undefined;
|
|
20
|
+
bindings?: string | undefined;
|
|
21
|
+
};
|
|
22
|
+
export type MenuItemProps = typeof __propDef.props;
|
|
23
|
+
export type MenuItemEvents = typeof __propDef.events;
|
|
24
|
+
export type MenuItemSlots = typeof __propDef.slots;
|
|
25
|
+
export default class MenuItem extends SvelteComponent<MenuItemProps, MenuItemEvents, MenuItemSlots> {
|
|
26
|
+
get focus(): () => any;
|
|
27
|
+
get isDisabled(): () => any;
|
|
28
|
+
}
|
|
29
|
+
export {};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
<style>
|
|
2
|
+
/* https://stackoverflow.com/questions/45507970/how-can-i-change-the-color-of-a-progress-bar-value-in-html */
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Most examples show styling directly to the <progress> element itself. However,
|
|
6
|
+
* my tests (chrome, ff, safari on mac mini 2020), showed it's perfectly possibly
|
|
7
|
+
* to use a class selector instead. The reason I'd prefer that here, is that I can
|
|
8
|
+
* then use CSS Modules composes against .progress (e.g. for React/Vue components)
|
|
9
|
+
*/
|
|
10
|
+
.progress {
|
|
11
|
+
appearance: none;
|
|
12
|
+
height: var(--functional-progress-height, var(--fluid-10, 0.625rem));
|
|
13
|
+
width: 100%;
|
|
14
|
+
border: none;
|
|
15
|
+
|
|
16
|
+
/* Next couple of rules are required to be here for FF (but not chrome) */
|
|
17
|
+
background-color: var(--functional-progress-background, var(--functional-gray-light, #ededed));
|
|
18
|
+
border-radius: var(--functional-progress-radius, var(--fluid-10, 0.625rem));
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.progress[value]::-webkit-progress-bar {
|
|
22
|
+
/* In my tests chrome requires this whereas FF wants it on the progress {} rule */
|
|
23
|
+
background-color: var(--functional-progress-background, var(--functional-gray-light, #ededed));
|
|
24
|
+
border-radius: var(--functional-progress-radius, var(--fluid-10, 0.625rem));
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.progress[value]::-webkit-progress-value {
|
|
28
|
+
background-color: var(--functional-progress-fill-color, var(--functional-primary, #077acb));
|
|
29
|
+
border-radius: var(--functional-progress-radius, var(--fluid-10, 0.625rem));
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.progress[value]::-moz-progress-bar {
|
|
33
|
+
background-color: var(--functional-progress-fill-color, var(--functional-primary, #077acb));
|
|
34
|
+
border-radius: var(--functional-progress-radius, var(--fluid-10, 0.625rem));
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.progress[value]::-ms-fill {
|
|
38
|
+
background-color: var(--functional-progress-fill-color, var(--functional-primary, #077acb));
|
|
39
|
+
border-radius: var(--functional-progress-radius, var(--fluid-10, 0.625rem));
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
</style>
|
|
43
|
+
|
|
44
|
+
<script>export let value = 0;
|
|
45
|
+
export let max;
|
|
46
|
+
export let css = "";
|
|
47
|
+
let klasses = ["progress", css ? `${css}` : ""].filter((cl) => cl && cl.length).join(" ");
|
|
48
|
+
</script>
|
|
49
|
+
|
|
50
|
+
<progress class={klasses} value={value} max={max}></progress>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { SvelteComponent } from "svelte";
|
|
2
|
+
declare const __propDef: {
|
|
3
|
+
props: {
|
|
4
|
+
value?: number;
|
|
5
|
+
max: any;
|
|
6
|
+
css?: string;
|
|
7
|
+
};
|
|
8
|
+
events: {
|
|
9
|
+
[evt: string]: CustomEvent<any>;
|
|
10
|
+
};
|
|
11
|
+
slots: {};
|
|
12
|
+
exports?: {} | undefined;
|
|
13
|
+
bindings?: string | undefined;
|
|
14
|
+
};
|
|
15
|
+
export type ProgressProps = typeof __propDef.props;
|
|
16
|
+
export type ProgressEvents = typeof __propDef.events;
|
|
17
|
+
export type ProgressSlots = typeof __propDef.slots;
|
|
18
|
+
export default class Progress extends SvelteComponent<ProgressProps, ProgressEvents, ProgressSlots> {
|
|
19
|
+
}
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
<style>
|
|
2
|
+
.select,
|
|
3
|
+
.select-base {
|
|
4
|
+
display: block;
|
|
5
|
+
width: 100%;
|
|
6
|
+
/* stylelint-disable-next-line property-no-vendor-prefix */
|
|
7
|
+
-webkit-appearance: none;
|
|
8
|
+
/* stylelint-disable-next-line property-no-vendor-prefix */
|
|
9
|
+
-moz-appearance: none;
|
|
10
|
+
appearance: none;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.select,
|
|
14
|
+
.select-skin {
|
|
15
|
+
padding: var(--fluid-6) var(--fluid-32) var(--fluid-6) var(--fluid-12);
|
|
16
|
+
-moz-padding-start: calc(var(--fluid-12) - 3px);
|
|
17
|
+
font-size: var(--fluid-16);
|
|
18
|
+
font-weight: 400;
|
|
19
|
+
line-height: 1.5;
|
|
20
|
+
color: var(--functional-dark);
|
|
21
|
+
border: 1px solid var(--functional-select-border-color, var(--functional-gray-light));
|
|
22
|
+
border-radius: var(--functional-radius);
|
|
23
|
+
transition:
|
|
24
|
+
border-color var(--functional-timing-fast) ease-in-out,
|
|
25
|
+
box-shadow var(--functional-timing-fast) ease-in-out;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/* Only shows the down arrow SVG if in single mode */
|
|
29
|
+
.select:not([multiple]) {
|
|
30
|
+
background-color: inherit;
|
|
31
|
+
background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23333330' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
|
|
32
|
+
background-repeat: no-repeat;
|
|
33
|
+
background-position: right var(--fluid-12) center;
|
|
34
|
+
background-size: var(--fluid-16) var(--fluid-12);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.select:focus {
|
|
38
|
+
border-color: var(--functional-focus-ring-color);
|
|
39
|
+
box-shadow: 0 0 0 var(--functional-focus-ring-outline-width) var(--functional-focus-ring-color);
|
|
40
|
+
|
|
41
|
+
/* Needed for High Contrast mode */
|
|
42
|
+
outline:
|
|
43
|
+
var(--functional-focus-ring-outline-width) var(--functional-focus-ring-outline-style)
|
|
44
|
+
var(--functional-focus-ring-outline-color);
|
|
45
|
+
transition: box-shadow var(--functional-timing-fast) ease-out;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.select-base,
|
|
49
|
+
.select:disabled {
|
|
50
|
+
background-color: var(--functional-disabled-bg);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.select-base,
|
|
54
|
+
.select:-moz-focusring {
|
|
55
|
+
color: transparent;
|
|
56
|
+
text-shadow: 0 0 0 var(--functional-dark);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
@media (prefers-reduced-motion), (update: slow) {
|
|
60
|
+
.select,
|
|
61
|
+
.select-base,
|
|
62
|
+
.select:focus {
|
|
63
|
+
transition: none;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.select-small {
|
|
68
|
+
padding-top: var(--fluid-4);
|
|
69
|
+
padding-bottom: var(--fluid-4);
|
|
70
|
+
padding-left: var(--fluid-8);
|
|
71
|
+
font-size: var(--fluid-14);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.select-large {
|
|
75
|
+
padding-top: var(--fluid-8);
|
|
76
|
+
padding-bottom: var(--fluid-8);
|
|
77
|
+
padding-left: var(--fluid-16);
|
|
78
|
+
font-size: var(--fluid-18);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
</style>
|
|
82
|
+
|
|
83
|
+
<script>import { createEventDispatcher } from "svelte";
|
|
84
|
+
export let uniqueId = "";
|
|
85
|
+
export let name = "";
|
|
86
|
+
export let labelCopy = "";
|
|
87
|
+
export let options = [];
|
|
88
|
+
export let size = "";
|
|
89
|
+
export let multipleSize = 1;
|
|
90
|
+
export let isMultiple = false;
|
|
91
|
+
export let defaultOptionLabel = "Please select an option";
|
|
92
|
+
export let isDisabled = false;
|
|
93
|
+
export let isSkinned = true;
|
|
94
|
+
export let css = "";
|
|
95
|
+
export let singleSelected = "";
|
|
96
|
+
export let multiSelected = [];
|
|
97
|
+
const dispatch = createEventDispatcher();
|
|
98
|
+
const changeHandler = () => {
|
|
99
|
+
dispatch("selected", isMultiple ? multiSelected : singleSelected);
|
|
100
|
+
};
|
|
101
|
+
$: disable = isDisabled;
|
|
102
|
+
$: classes = [
|
|
103
|
+
isSkinned ? "select" : "select-base",
|
|
104
|
+
size ? `select-${size}` : "",
|
|
105
|
+
css ? `${css}` : ""
|
|
106
|
+
].filter((cl) => cl).join(" ");
|
|
107
|
+
</script>
|
|
108
|
+
|
|
109
|
+
<label class="screenreader-only" for={uniqueId}> {labelCopy} </label>
|
|
110
|
+
{#if isMultiple}
|
|
111
|
+
<select
|
|
112
|
+
id={uniqueId}
|
|
113
|
+
class={classes}
|
|
114
|
+
name={name}
|
|
115
|
+
disabled={disable}
|
|
116
|
+
multiple
|
|
117
|
+
size={multipleSize}
|
|
118
|
+
bind:value={multiSelected}
|
|
119
|
+
on:change={changeHandler}
|
|
120
|
+
>
|
|
121
|
+
{#each options as { value, label }}
|
|
122
|
+
<option value={value}>{label}</option>
|
|
123
|
+
{/each}
|
|
124
|
+
</select>
|
|
125
|
+
{:else}
|
|
126
|
+
<select
|
|
127
|
+
id={uniqueId}
|
|
128
|
+
class={classes}
|
|
129
|
+
name={name}
|
|
130
|
+
disabled={disable}
|
|
131
|
+
bind:value={singleSelected}
|
|
132
|
+
on:change={changeHandler}
|
|
133
|
+
>
|
|
134
|
+
<option value="" disabled selected>
|
|
135
|
+
{defaultOptionLabel}
|
|
136
|
+
</option>
|
|
137
|
+
{#each options as { value, label }}
|
|
138
|
+
<option value={value}>{label}</option>
|
|
139
|
+
{/each}
|
|
140
|
+
</select>
|
|
141
|
+
{/if}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { SvelteComponent } from "svelte";
|
|
2
|
+
declare const __propDef: {
|
|
3
|
+
props: {
|
|
4
|
+
uniqueId?: string;
|
|
5
|
+
name?: string;
|
|
6
|
+
labelCopy?: string;
|
|
7
|
+
options?: any[];
|
|
8
|
+
size?: "small" | "large" | "";
|
|
9
|
+
multipleSize?: number;
|
|
10
|
+
isMultiple?: boolean;
|
|
11
|
+
defaultOptionLabel?: string;
|
|
12
|
+
isDisabled?: boolean;
|
|
13
|
+
isSkinned?: boolean;
|
|
14
|
+
css?: string;
|
|
15
|
+
singleSelected?: string;
|
|
16
|
+
multiSelected?: any[];
|
|
17
|
+
};
|
|
18
|
+
events: {
|
|
19
|
+
selected: CustomEvent<any>;
|
|
20
|
+
} & {
|
|
21
|
+
[evt: string]: CustomEvent<any>;
|
|
22
|
+
};
|
|
23
|
+
slots: {};
|
|
24
|
+
exports?: {} | undefined;
|
|
25
|
+
bindings?: string | undefined;
|
|
26
|
+
};
|
|
27
|
+
export type SelectProps = typeof __propDef.props;
|
|
28
|
+
export type SelectEvents = typeof __propDef.events;
|
|
29
|
+
export type SelectSlots = typeof __propDef.slots;
|
|
30
|
+
export default class Select extends SvelteComponent<SelectProps, SelectEvents, SelectSlots> {
|
|
31
|
+
}
|
|
32
|
+
export {};
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
<style>
|
|
2
|
+
.spinner {
|
|
3
|
+
--spinner-color: var(--functional-spinner-color, var(--functional-dark));
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Inspiration to utilize grid for this from
|
|
7
|
+
* https://dockyard.com/blog/2020/03/02/accessible-loading-indicatorswith-no-extra-elements
|
|
8
|
+
*/
|
|
9
|
+
display: grid;
|
|
10
|
+
grid-template: "content" 100% / auto;
|
|
11
|
+
place-items: center;
|
|
12
|
+
box-sizing: border-box;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.spinner::before,
|
|
16
|
+
.spinner::after {
|
|
17
|
+
grid-area: content;
|
|
18
|
+
width: var(--fluid-32);
|
|
19
|
+
height: var(--fluid-32);
|
|
20
|
+
content: "";
|
|
21
|
+
display: block;
|
|
22
|
+
border-radius: 50%;
|
|
23
|
+
border-width: 3px;
|
|
24
|
+
border-style: solid;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.spinner-small::before,
|
|
28
|
+
.spinner-small::after {
|
|
29
|
+
width: var(--fluid-24);
|
|
30
|
+
height: var(--fluid-24);
|
|
31
|
+
border-width: var(--fluid-2);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.spinner-large::before,
|
|
35
|
+
.spinner-large::after {
|
|
36
|
+
width: var(--fluid-40);
|
|
37
|
+
height: var(--fluid-40);
|
|
38
|
+
border-width: var(--fluid-4);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.spinner-xlarge::before,
|
|
42
|
+
.spinner-xlarge::after {
|
|
43
|
+
width: var(--fluid-56);
|
|
44
|
+
height: var(--fluid-56);
|
|
45
|
+
border-width: var(--fluid-6);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Before is the muted background
|
|
50
|
+
*/
|
|
51
|
+
.spinner::before {
|
|
52
|
+
opacity: 0%;
|
|
53
|
+
border-color: var(--spinner-color);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* After is the inner "snake"
|
|
58
|
+
*/
|
|
59
|
+
.spinner::after {
|
|
60
|
+
opacity: 0%;
|
|
61
|
+
border-color: transparent var(--spinner-color) transparent transparent;
|
|
62
|
+
transition: opacity 0.1s;
|
|
63
|
+
pointer-events: none;
|
|
64
|
+
animation: loading-circle 1s ease-in-out infinite;
|
|
65
|
+
|
|
66
|
+
/* TODO Research the whole null transform hack. It is quite confusing to figure out if it
|
|
67
|
+
is beneficial or detrimental: See
|
|
68
|
+
https://newbedev.com/css-keyframe-animation-cpu-usage-is-high-should-it-be-this-way
|
|
69
|
+
transform: translateZ(0);
|
|
70
|
+
will-change: transform; */
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Setting aria-busy to true results in corresponding opacity change to visually show spinner.
|
|
75
|
+
*/
|
|
76
|
+
.spinner[aria-busy="true"]::before {
|
|
77
|
+
opacity: 12%;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.spinner[aria-busy="true"]::after {
|
|
81
|
+
opacity: 100%;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
@keyframes loading-circle {
|
|
85
|
+
to {
|
|
86
|
+
transform: rotate(360deg);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
@media (prefers-reduced-motion), (update: slow) {
|
|
91
|
+
.spinner::after {
|
|
92
|
+
transition-duration: 0.001ms !important;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
</style>
|
|
97
|
+
|
|
98
|
+
<script>export let ariaLabel = "Loading\u2026";
|
|
99
|
+
export let size = "";
|
|
100
|
+
$: spinnerClasses = ["spinner", size ? `spinner-${size}` : ""].filter((c) => c).join(" ");
|
|
101
|
+
</script>
|
|
102
|
+
|
|
103
|
+
<div class={spinnerClasses} role="status" aria-live="polite" aria-busy="true">
|
|
104
|
+
<span class="screenreader-only">{ariaLabel}</span>
|
|
105
|
+
</div>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { SvelteComponent } from "svelte";
|
|
2
|
+
declare const __propDef: {
|
|
3
|
+
props: {
|
|
4
|
+
ariaLabel?: string;
|
|
5
|
+
size?: "small" | "large" | "xlarge" | "";
|
|
6
|
+
};
|
|
7
|
+
events: {
|
|
8
|
+
[evt: string]: CustomEvent<any>;
|
|
9
|
+
};
|
|
10
|
+
slots: {};
|
|
11
|
+
exports?: {} | undefined;
|
|
12
|
+
bindings?: string | undefined;
|
|
13
|
+
};
|
|
14
|
+
export type SpinnerProps = typeof __propDef.props;
|
|
15
|
+
export type SpinnerEvents = typeof __propDef.events;
|
|
16
|
+
export type SpinnerSlots = typeof __propDef.slots;
|
|
17
|
+
export default class Spinner extends SvelteComponent<SpinnerProps, SpinnerEvents, SpinnerSlots> {
|
|
18
|
+
}
|
|
19
|
+
export {};
|