@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,133 @@
|
|
|
1
|
+
<style>
|
|
2
|
+
/**
|
|
3
|
+
* Cards
|
|
4
|
+
*
|
|
5
|
+
* I drew some inspiration from the article on media-query less cards:
|
|
6
|
+
* https://css-tricks.com/how-to-make-a-media-query-less-card-component/
|
|
7
|
+
*/
|
|
8
|
+
.card,
|
|
9
|
+
.card-base {
|
|
10
|
+
display: flex;
|
|
11
|
+
flex-wrap: wrap;
|
|
12
|
+
align-items: center;
|
|
13
|
+
position: relative;
|
|
14
|
+
box-sizing: border-box;
|
|
15
|
+
width: 100%;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.card-border {
|
|
19
|
+
border: 1px solid var(--functional-card-border-color, var(--functional-gray-light));
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.card-rounded {
|
|
23
|
+
border-radius: var(--functional-radius, 0.25rem);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.card-shadow {
|
|
27
|
+
box-shadow:
|
|
28
|
+
var(--functional-card-boxshadow1-offset-x, 0)
|
|
29
|
+
var(--functional-card-boxshadow1-offset-y, 0.375rem)
|
|
30
|
+
var(--functional-card-boxshadow1-blur, 0.5625rem)
|
|
31
|
+
var(--functional-card-boxshadow1-color, rgb(6 6 6 / 7.5%)),
|
|
32
|
+
var(--functional-card-boxshadow2-offset-x, 0) var(--functional-card-boxshadow2-offset-y, 0)
|
|
33
|
+
var(--functional-card-boxshadow2-blur, 1px)
|
|
34
|
+
var(--functional-card-boxshadow2-color, rgb(5 5 5 / 10%));
|
|
35
|
+
border-radius: var(--functional-card-border-radius, var(--functional-radius, 0.25rem));
|
|
36
|
+
overflow: hidden;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.card-shadow:hover {
|
|
40
|
+
box-shadow:
|
|
41
|
+
var(--functional-card-boxshadow1-offset-x, 0)
|
|
42
|
+
var(--functional-card-boxshadow1-offset-y, 0.375rem)
|
|
43
|
+
var(--functional-card-boxshadow1-blur, 0.875rem)
|
|
44
|
+
var(--functional-card-boxshadow1-color, rgb(4 4 4 / 10%)),
|
|
45
|
+
var(--functional-card-boxshadow2-offset-x, 0) var(--functional-card-boxshadow2-offset-y, 0)
|
|
46
|
+
var(--functional-card-boxshadow2-blur, 2px)
|
|
47
|
+
var(--functional-card-boxshadow2-color, rgb(3 3 3 / 10%));
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Animates the y position and box shadow on hover
|
|
52
|
+
*/
|
|
53
|
+
.card-animated {
|
|
54
|
+
transition:
|
|
55
|
+
box-shadow ease-out 5s,
|
|
56
|
+
transform var(--functional-timing-fast)
|
|
57
|
+
cubic-bezier(
|
|
58
|
+
var(--functional-card-cubic-1, 0.39),
|
|
59
|
+
var(--functional-card-cubic-2, 0.575),
|
|
60
|
+
var(--functional-card-cubic-3, 0.565),
|
|
61
|
+
var(--functional-card-cubic-4, 1)
|
|
62
|
+
);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.card-animated:hover {
|
|
66
|
+
transform: translateY(var(--functional-card-translate-y-hover, -3px));
|
|
67
|
+
transition:
|
|
68
|
+
box-shadow ease-out var(--functional-timing-fast),
|
|
69
|
+
transform var(--functional-timing-slow)
|
|
70
|
+
cubic-bezier(
|
|
71
|
+
var(--functional-card-cubic-1, 0.39),
|
|
72
|
+
var(--functional-card-cubic-2, 0.575),
|
|
73
|
+
var(--functional-card-cubic-3, 0.565),
|
|
74
|
+
var(--functional-card-cubic-4, 1)
|
|
75
|
+
);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
@media (prefers-reduced-motion), (update: slow) {
|
|
79
|
+
.card-animated,
|
|
80
|
+
.card-animated:hover {
|
|
81
|
+
transition-duration: 0.001ms !important;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.card-stacked {
|
|
86
|
+
flex-direction: column;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.card-success {
|
|
90
|
+
background: var(--functional-action-light);
|
|
91
|
+
color: var(--functional-action-dark);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.card-info {
|
|
95
|
+
background: var(--functional-primary-light);
|
|
96
|
+
color: var(--functional-primary-dark);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.card-error {
|
|
100
|
+
background: var(--functional-error-light);
|
|
101
|
+
color: var(--functional-error-dark);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
.card-warning {
|
|
105
|
+
background: var(--functional-warning-light);
|
|
106
|
+
color: var(--functional-warning-dark);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
</style>
|
|
110
|
+
|
|
111
|
+
<script>export let isAnimated = false;
|
|
112
|
+
export let isSkinned = true;
|
|
113
|
+
export let isStacked = false;
|
|
114
|
+
export let isShadow = false;
|
|
115
|
+
export let isBorder = false;
|
|
116
|
+
export let isRounded = false;
|
|
117
|
+
export let type = "";
|
|
118
|
+
export let css = "";
|
|
119
|
+
let klasses = [
|
|
120
|
+
isSkinned ? "card" : "card-base",
|
|
121
|
+
isAnimated ? "card-animated" : "",
|
|
122
|
+
isStacked ? "card-stacked" : "",
|
|
123
|
+
isShadow ? "card-shadow" : "",
|
|
124
|
+
isRounded ? "card-rounded" : "",
|
|
125
|
+
isBorder ? "card-border" : "",
|
|
126
|
+
type ? `card-${type}` : "",
|
|
127
|
+
css ? `${css}` : ""
|
|
128
|
+
].filter((klass) => klass.length).join(" ");
|
|
129
|
+
</script>
|
|
130
|
+
|
|
131
|
+
<div class={klasses} on:click on:focus on:blur>
|
|
132
|
+
<slot />
|
|
133
|
+
</div>
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { SvelteComponent } from "svelte";
|
|
2
|
+
declare const __propDef: {
|
|
3
|
+
props: {
|
|
4
|
+
isAnimated?: boolean;
|
|
5
|
+
isSkinned?: boolean;
|
|
6
|
+
isStacked?: boolean;
|
|
7
|
+
isShadow?: boolean;
|
|
8
|
+
isBorder?: boolean;
|
|
9
|
+
isRounded?: boolean;
|
|
10
|
+
type?: string;
|
|
11
|
+
css?: string;
|
|
12
|
+
};
|
|
13
|
+
events: {
|
|
14
|
+
click: MouseEvent;
|
|
15
|
+
focus: FocusEvent;
|
|
16
|
+
blur: FocusEvent;
|
|
17
|
+
} & {
|
|
18
|
+
[evt: string]: CustomEvent<any>;
|
|
19
|
+
};
|
|
20
|
+
slots: {
|
|
21
|
+
default: {};
|
|
22
|
+
};
|
|
23
|
+
exports?: {} | undefined;
|
|
24
|
+
bindings?: string | undefined;
|
|
25
|
+
};
|
|
26
|
+
export type CardProps = typeof __propDef.props;
|
|
27
|
+
export type CardEvents = typeof __propDef.events;
|
|
28
|
+
export type CardSlots = typeof __propDef.slots;
|
|
29
|
+
export default class Card extends SvelteComponent<CardProps, CardEvents, CardSlots> {
|
|
30
|
+
}
|
|
31
|
+
export {};
|
|
@@ -0,0 +1,337 @@
|
|
|
1
|
+
<style>
|
|
2
|
+
/**
|
|
3
|
+
* These radio and checkbox customizations are an amalgamation of various resources I've
|
|
4
|
+
* found on the internets; from Heydon Pickering's radio article (and his Inclusive Components
|
|
5
|
+
* book), to Sara Soueidan, Scott O'Hara, MDO, and Adrian Roselli's research on the matter
|
|
6
|
+
* of inclusive hiding and custom radio/checkbox inputs.
|
|
7
|
+
*/
|
|
8
|
+
.checkbox-group,
|
|
9
|
+
.radio-group {
|
|
10
|
+
--width-28: calc(7 * var(--fluid-4)); /* 1.75rem/28px */
|
|
11
|
+
|
|
12
|
+
border: 1px solid var(--functional-checkbox-border-color, var(--functional-gray-light));
|
|
13
|
+
padding: var(--fluid-24);
|
|
14
|
+
padding-top: var(--fluid-14);
|
|
15
|
+
border-radius: var(--fluid-8);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.checkbox-group-large,
|
|
19
|
+
.radio-group-large {
|
|
20
|
+
padding: var(--width-28);
|
|
21
|
+
padding-top: var(--fluid-16);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.checkbox-legend,
|
|
25
|
+
.radio-legend {
|
|
26
|
+
padding: var(--fluid-2) var(--fluid-14);
|
|
27
|
+
border-radius: var(--fluid-2);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/* Hiding technique from https://www.sarasoueidan.com/blog/inclusively-hiding-and-styling-checkboxes-and-radio-buttons/
|
|
31
|
+
*/
|
|
32
|
+
.checkbox,
|
|
33
|
+
.radio {
|
|
34
|
+
position: absolute;
|
|
35
|
+
width: var(--fluid-14);
|
|
36
|
+
height: var(--fluid-14);
|
|
37
|
+
opacity: 0%;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.checkbox-small,
|
|
41
|
+
.radio-small {
|
|
42
|
+
width: var(--fluid-12);
|
|
43
|
+
height: var(--fluid-12);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.checkbox-large,
|
|
47
|
+
.radio-large {
|
|
48
|
+
width: var(--fluid-16);
|
|
49
|
+
height: var(--fluid-16);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.checkbox-label-wrap,
|
|
53
|
+
.radio-label-wrap {
|
|
54
|
+
display: flex;
|
|
55
|
+
align-items: center;
|
|
56
|
+
cursor: pointer;
|
|
57
|
+
user-select: none;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.checkbox-label-wrap-inline,
|
|
61
|
+
.radio-label-wrap-inline {
|
|
62
|
+
display: inline-flex;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.checkbox-label-wrap-inline:not(:last-child),
|
|
66
|
+
.radio-label-wrap-inline:not(:last-child) {
|
|
67
|
+
margin-inline-end: var(--fluid-8);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/* These are not actual <label> elements but the <span> label copy elements */
|
|
71
|
+
.checkbox-label-copy,
|
|
72
|
+
.radio-label-copy,
|
|
73
|
+
.checkbox-label,
|
|
74
|
+
.radio-label {
|
|
75
|
+
display: inline-flex;
|
|
76
|
+
position: relative;
|
|
77
|
+
align-items: center;
|
|
78
|
+
flex-wrap: wrap;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.checkbox-label-copy-small,
|
|
82
|
+
.radio-label-copy-small {
|
|
83
|
+
font-size: var(--functional-small); /* 0.875rem */
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
.checkbox-label-copy-large,
|
|
87
|
+
.radio-label-copy-large {
|
|
88
|
+
font-size: calc(var(--functional-body) + 2px); /* 1rem + 2px (~18px) */
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/* The checkmark itself */
|
|
92
|
+
.checkbox-label::after {
|
|
93
|
+
content: "";
|
|
94
|
+
position: absolute;
|
|
95
|
+
left: var(--fluid-6);
|
|
96
|
+
top: 1px;
|
|
97
|
+
width: var(--fluid-6);
|
|
98
|
+
height: var(--fluid-12);
|
|
99
|
+
border: solid var(--functional-light);
|
|
100
|
+
border-width: 0 var(--fluid-2) var(--fluid-2) 0;
|
|
101
|
+
transform-origin: center center;
|
|
102
|
+
transform: rotate(40deg) scale(0);
|
|
103
|
+
transition-property: border, background-color, transform;
|
|
104
|
+
transition-duration: var(--functional-timing-fast);
|
|
105
|
+
transition-timing-function: ease-in-out;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
.checkbox-label::before,
|
|
109
|
+
.radio-label::before {
|
|
110
|
+
content: "";
|
|
111
|
+
display: inline-block;
|
|
112
|
+
margin-inline-end: var(--functional-checkbox-spacing-end, 0.75rem);
|
|
113
|
+
transition: var(--functional-timing-fast) ease-out all;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/* Since we build up the radio size outwardly, it's naturally larger then the checkboxes
|
|
117
|
+
so we add a multiplyer to even those out initially */
|
|
118
|
+
.checkbox-label::before {
|
|
119
|
+
border: 2px solid var(--functional-checkbox-border-color, var(--functional-gray-light));
|
|
120
|
+
width: var(--fluid-16);
|
|
121
|
+
height: var(--fluid-16);
|
|
122
|
+
transition: box-shadow var(--functional-timing-fast) ease-out;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
.radio-label::before {
|
|
126
|
+
width: var(--fluid-14);
|
|
127
|
+
height: var(--fluid-14);
|
|
128
|
+
vertical-align: calc(-1 * var(--fluid-2));
|
|
129
|
+
border-radius: 50%;
|
|
130
|
+
border: var(--fluid-2) solid var(--functional-checkbox-light, var(--functional-light));
|
|
131
|
+
box-shadow: 0 0 0 var(--fluid-2) var(--functional-checkbox-border-color, var(--functional-gray-light));
|
|
132
|
+
transition: box-shadow var(--functional-timing-fast) ease-out;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
@media (prefers-reduced-motion), (update: slow) {
|
|
136
|
+
.checkbox-label::after,
|
|
137
|
+
.checkbox-label::before,
|
|
138
|
+
.radio-label::before {
|
|
139
|
+
transition-duration: 0.001ms !important;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
.checkbox-label-small::after {
|
|
144
|
+
left: calc(1.25 * var(--fluid-4));
|
|
145
|
+
top: 0;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
.checkbox-label-small::before {
|
|
149
|
+
width: var(--fluid-14);
|
|
150
|
+
height: var(--fluid-14);
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
.radio-label-small::before {
|
|
154
|
+
width: var(--fluid-12);
|
|
155
|
+
height: var(--fluid-12);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
.checkbox-label-large::after {
|
|
159
|
+
left: calc(1.75 * var(--fluid-4));
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
.checkbox-label-large::before {
|
|
163
|
+
width: var(--fluid-18);
|
|
164
|
+
height: var(--fluid-18);
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
.radio-label-large::before {
|
|
168
|
+
width: var(--fluid-16);
|
|
169
|
+
height: var(--fluid-16);
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
/* the checked style using the :checked pseudo class */
|
|
173
|
+
.radio:checked + .radio-label::before {
|
|
174
|
+
background: var(--functional-checkbox-fill-color, #08a880);
|
|
175
|
+
box-shadow: 0 0 0 var(--fluid-2) var(--functional-checkbox-border-color, var(--functional-gray-light));
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
.radio:focus + .radio-label::before {
|
|
179
|
+
/* stylelint-disable-next-line max-line-length */
|
|
180
|
+
box-shadow: 0 0 0 var(--fluid-2) var(--functional-checkbox-border-color, var(--functional-gray-light)), 0 0 0 calc(1.5 * var(--fluid-2)) var(--functional-light), 0 0 0 calc(2.25 * var(--fluid-2)) var(--functional-focus-ring-color);
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
.checkbox:focus + .checkbox-label::before {
|
|
184
|
+
box-shadow: 0 0 0 var(--functional-focus-ring-outline-width) var(--functional-focus-ring-color);
|
|
185
|
+
|
|
186
|
+
/* Needed for High Contrast mode */
|
|
187
|
+
/* stylelint-disable-next-line max-line-length */
|
|
188
|
+
outline: var(--functional-focus-ring-outline-width) var(--functional-focus-ring-outline-style) var(--functional-focus-ring-outline-color);
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
.checkbox:checked + .checkbox-label::after {
|
|
192
|
+
transform: rotate(40deg) scale(1);
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
.checkbox:checked + .checkbox-label::before {
|
|
196
|
+
background: var(--functional-checkbox-fill-color, #08a880);
|
|
197
|
+
border: 2px solid var(--functional-checkbox-fill-color, #08a880);
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
/**
|
|
201
|
+
* Consumer styles <legend> themselves, and can opt to use the .screenreader-only from
|
|
202
|
+
* utilities.css if they're design requires it.
|
|
203
|
+
*/
|
|
204
|
+
.checkbox-group-hidden,
|
|
205
|
+
.radio-group-hidden {
|
|
206
|
+
border: 0;
|
|
207
|
+
margin-block-start: 0;
|
|
208
|
+
margin-inline-start: 0;
|
|
209
|
+
margin-inline-end: 0;
|
|
210
|
+
margin-block-end: 0;
|
|
211
|
+
padding-block-start: 0;
|
|
212
|
+
padding-inline-start: 0;
|
|
213
|
+
padding-inline-end: 0;
|
|
214
|
+
padding-block-end: 0;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
/* Targets both the label container and the span label that is used
|
|
218
|
+
to style the custom radio / checkbox. Note it does NOT target the input
|
|
219
|
+
itself. */
|
|
220
|
+
.checkbox[disabled] ~ .checkbox-label-copy,
|
|
221
|
+
.radio[disabled] ~ .radio-label-copy,
|
|
222
|
+
.checkbox-label-wrap[class="disabled"],
|
|
223
|
+
.radio-label-wrap[class="disabled"],
|
|
224
|
+
.checkbox-label-wrap-inline[class="disabled"],
|
|
225
|
+
.radio-label-wrap-inline[class="disabled"] {
|
|
226
|
+
color: var(--functional-input-disabled-color, var(--functional-disabled-color)) !important;
|
|
227
|
+
appearance: none !important;
|
|
228
|
+
box-shadow: none !important;
|
|
229
|
+
cursor: not-allowed !important;
|
|
230
|
+
opacity: 80% !important;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
.choice-input-error {
|
|
234
|
+
color: var(--functional-input-error-color, var(--functional-error));
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
@media screen and (-ms-high-contrast: active) {
|
|
238
|
+
/* High contrast mode outline hacks */
|
|
239
|
+
.checkbox-label-wrap[class="disabled"],
|
|
240
|
+
.radio-label-wrap[class="disabled"],
|
|
241
|
+
.checkbox-label-wrap-inline[class="disabled"],
|
|
242
|
+
.radio-label-wrap-inline[class="disabled"] {
|
|
243
|
+
outline: 2px solid transparent;
|
|
244
|
+
outline-offset: -2px;
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
</style>
|
|
249
|
+
|
|
250
|
+
<script>export let id;
|
|
251
|
+
export let isSkinned = true;
|
|
252
|
+
export let isFieldset = true;
|
|
253
|
+
export let isInline = false;
|
|
254
|
+
export let isDisabled = void 0;
|
|
255
|
+
export let isInvalid = false;
|
|
256
|
+
export let options = [];
|
|
257
|
+
export let disabledOptions = [];
|
|
258
|
+
export let checkedOptions = [];
|
|
259
|
+
export let type = "checkbox";
|
|
260
|
+
export let legendLabel = type || "choice input";
|
|
261
|
+
export let size = "";
|
|
262
|
+
export let checked = [];
|
|
263
|
+
$: labelClasses = [
|
|
264
|
+
type ? `${type}-label-wrap` : "",
|
|
265
|
+
isInline ? `${type}-label-wrap-inline` : "",
|
|
266
|
+
isDisabled ? "disabled" : ""
|
|
267
|
+
].filter((c) => c.length).join(" ");
|
|
268
|
+
$: labelSpanClasses = [
|
|
269
|
+
type ? `${type}-label` : "",
|
|
270
|
+
isInvalid ? "choice-input-error" : "",
|
|
271
|
+
size ? `${type}-label-${size}` : ""
|
|
272
|
+
].filter((c) => c.length).join(" ");
|
|
273
|
+
$: skin = isSkinned ? `${type}-legend` : "";
|
|
274
|
+
$: labelCopyClasses = [
|
|
275
|
+
// Will also need to work in the small
|
|
276
|
+
// and large sizes here for the text copy
|
|
277
|
+
type ? `${type}-label-copy` : "",
|
|
278
|
+
size ? `${type}-label-copy-${size}` : "",
|
|
279
|
+
isInvalid ? "choice-input-error" : ""
|
|
280
|
+
].filter((c) => c.length).join(" ");
|
|
281
|
+
$: legendClasses = [
|
|
282
|
+
skin,
|
|
283
|
+
// .screenreader-only is expected to be globally available via common.min.css
|
|
284
|
+
isFieldset === false ? "screenreader-only" : ""
|
|
285
|
+
].filter((c) => c).join(" ");
|
|
286
|
+
$: fieldsetClasses = () => {
|
|
287
|
+
const skin2 = isSkinned ? `${type}-group` : "";
|
|
288
|
+
const sizeSkin = isSkinned && size === "large" ? `${type}-group-${size}` : "";
|
|
289
|
+
let klasses = [
|
|
290
|
+
skin2,
|
|
291
|
+
sizeSkin,
|
|
292
|
+
isFieldset === false ? `${type}-group-hidden` : ""
|
|
293
|
+
];
|
|
294
|
+
klasses = klasses.filter((klass) => klass.length);
|
|
295
|
+
return klasses.join(" ");
|
|
296
|
+
};
|
|
297
|
+
$: inputClasses = () => {
|
|
298
|
+
let inputKlasses = [
|
|
299
|
+
type ? `${type}` : "",
|
|
300
|
+
size ? `${type}-${size}` : ""
|
|
301
|
+
// isDisabled ? "disabled" : "",
|
|
302
|
+
];
|
|
303
|
+
inputKlasses = inputKlasses.filter((klass) => klass.length);
|
|
304
|
+
return inputKlasses.join(" ");
|
|
305
|
+
};
|
|
306
|
+
$: onChange = (e) => {
|
|
307
|
+
checked = Array.from(document.getElementsByName(e.target.name)).filter((el) => el.checked).map((el) => el.value);
|
|
308
|
+
};
|
|
309
|
+
</script>
|
|
310
|
+
|
|
311
|
+
<fieldset class={fieldsetClasses()}>
|
|
312
|
+
<legend class={legendClasses}>{legendLabel}</legend>
|
|
313
|
+
{#each options as { name, value, label }, index}
|
|
314
|
+
<label
|
|
315
|
+
class={labelClasses}
|
|
316
|
+
class:disabled={isDisabled || disabledOptions.includes(value) || undefined}
|
|
317
|
+
>
|
|
318
|
+
<input
|
|
319
|
+
class={inputClasses()}
|
|
320
|
+
id="{id}-{name}-{index}"
|
|
321
|
+
type={type}
|
|
322
|
+
name={name}
|
|
323
|
+
value={value}
|
|
324
|
+
disabled={isDisabled || disabledOptions.includes(value)}
|
|
325
|
+
checked={checkedOptions.includes(value)}
|
|
326
|
+
on:blur
|
|
327
|
+
on:change={onChange}
|
|
328
|
+
on:input
|
|
329
|
+
on:click
|
|
330
|
+
on:focus
|
|
331
|
+
{...$$restProps}
|
|
332
|
+
/>
|
|
333
|
+
<span class={labelSpanClasses} aria-hidden="true"></span>
|
|
334
|
+
<span class={labelCopyClasses}>{label}</span>
|
|
335
|
+
</label>
|
|
336
|
+
{/each}
|
|
337
|
+
</fieldset>
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { SvelteComponent } from "svelte";
|
|
2
|
+
import type { ChoiceInputOption, ChoiceInputSize, ChoiceInputType } from './api';
|
|
3
|
+
declare const __propDef: {
|
|
4
|
+
props: {
|
|
5
|
+
[x: string]: any;
|
|
6
|
+
id: any;
|
|
7
|
+
isSkinned?: boolean | undefined;
|
|
8
|
+
isFieldset?: boolean | undefined;
|
|
9
|
+
isInline?: boolean | undefined;
|
|
10
|
+
isDisabled?: undefined;
|
|
11
|
+
isInvalid?: boolean | undefined;
|
|
12
|
+
options?: ChoiceInputOption[] | undefined;
|
|
13
|
+
disabledOptions?: any[] | undefined;
|
|
14
|
+
checkedOptions?: any[] | undefined;
|
|
15
|
+
type?: ChoiceInputType | undefined;
|
|
16
|
+
legendLabel?: ChoiceInputType | undefined;
|
|
17
|
+
size?: ChoiceInputSize | undefined;
|
|
18
|
+
checked?: any[] | undefined;
|
|
19
|
+
};
|
|
20
|
+
events: {
|
|
21
|
+
blur: FocusEvent;
|
|
22
|
+
input: Event;
|
|
23
|
+
click: MouseEvent;
|
|
24
|
+
focus: FocusEvent;
|
|
25
|
+
} & {
|
|
26
|
+
[evt: string]: CustomEvent<any>;
|
|
27
|
+
};
|
|
28
|
+
slots: {};
|
|
29
|
+
exports?: undefined;
|
|
30
|
+
bindings?: undefined;
|
|
31
|
+
};
|
|
32
|
+
export type ChoiceInputProps = typeof __propDef.props;
|
|
33
|
+
export type ChoiceInputEvents = typeof __propDef.events;
|
|
34
|
+
export type ChoiceInputSlots = typeof __propDef.slots;
|
|
35
|
+
export default class ChoiceInput extends SvelteComponent<ChoiceInputProps, ChoiceInputEvents, ChoiceInputSlots> {
|
|
36
|
+
}
|
|
37
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
<style>
|
|
2
|
+
.close-button {
|
|
3
|
+
display: inline-flex;
|
|
4
|
+
align-items: center;
|
|
5
|
+
justify-content: center;
|
|
6
|
+
background-color: transparent;
|
|
7
|
+
border: 0;
|
|
8
|
+
border-radius: 0;
|
|
9
|
+
box-shadow: none;
|
|
10
|
+
width: var(--fluid-24);
|
|
11
|
+
height: var(--fluid-24);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.close-button:hover,
|
|
15
|
+
.close-button:active,
|
|
16
|
+
.close-button:focus {
|
|
17
|
+
background: none;
|
|
18
|
+
|
|
19
|
+
/* Needed for High Contrast mode */
|
|
20
|
+
outline:
|
|
21
|
+
var(--functional-focus-ring-outline-width) var(--functional-focus-ring-outline-style)
|
|
22
|
+
var(--functional-focus-ring-outline-color);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.close-button:focus {
|
|
26
|
+
box-shadow: 0 0 0 3px var(--functional-focus-ring-color);
|
|
27
|
+
transition: box-shadow var(--functional-timing-fast) ease-out;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.close {
|
|
31
|
+
width: var(--fluid-12);
|
|
32
|
+
height: var(--fluid-12);
|
|
33
|
+
display: inline-block;
|
|
34
|
+
vertical-align: middle;
|
|
35
|
+
line-height: 1em;
|
|
36
|
+
flex-shrink: 0;
|
|
37
|
+
color: currentColor;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.close-button .close {
|
|
41
|
+
opacity: 80%;
|
|
42
|
+
transition: opacity var(--functional-timing-medium);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
@media (prefers-reduced-motion), (update: slow) {
|
|
46
|
+
.close-button:focus,
|
|
47
|
+
.close-button .close {
|
|
48
|
+
transition-duration: 0.001ms !important;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.close-button-small {
|
|
53
|
+
width: var(--fluid-18);
|
|
54
|
+
height: var(--fluid-18);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.close-button-large {
|
|
58
|
+
width: var(--fluid-32);
|
|
59
|
+
height: var(--fluid-32);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.close-button-xlarge {
|
|
63
|
+
width: var(--fluid-40);
|
|
64
|
+
height: var(--fluid-40);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.close-button-small > .close {
|
|
68
|
+
width: 0.5625rem;
|
|
69
|
+
height: 0.5625rem;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.close-button-large > .close {
|
|
73
|
+
width: var(--fluid-16);
|
|
74
|
+
height: var(--fluid-16);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.close-button-xlarge > .close {
|
|
78
|
+
width: var(--fluid-20);
|
|
79
|
+
height: var(--fluid-20);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.close-button:hover .close {
|
|
83
|
+
opacity: 100%;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
</style>
|
|
87
|
+
|
|
88
|
+
<script>export let size = "";
|
|
89
|
+
export let isFaux = false;
|
|
90
|
+
export let color = "inherit";
|
|
91
|
+
const closeButtonClasses = [
|
|
92
|
+
"close-button",
|
|
93
|
+
size ? `close-button-${size}` : ""
|
|
94
|
+
].filter((c) => c).join(" ");
|
|
95
|
+
</script>
|
|
96
|
+
|
|
97
|
+
{#if isFaux}
|
|
98
|
+
<div class={closeButtonClasses}>
|
|
99
|
+
<svg class="close" viewBox="0 0 24 24" aria-hidden="true">
|
|
100
|
+
<path
|
|
101
|
+
fill="currentColor"
|
|
102
|
+
d="M.439 21.44a1.5 1.5 0 0 0 2.122 2.121l9.262-9.261a.25.25 0 0 1 .354 0l9.262 9.263a1.5 1.5 0 1 0 2.122-2.121L14.3 12.177a.25.25 0 0 1 0-.354l9.263-9.262A1.5 1.5 0 0 0 21.439.44L12.177 9.7a.25.25 0 0 1-.354 0L2.561.44A1.5 1.5 0 0 0 .439 2.561L9.7 11.823a.25.25 0 0 1 0 .354Z"
|
|
103
|
+
></path>
|
|
104
|
+
</svg>
|
|
105
|
+
</div>
|
|
106
|
+
{:else}
|
|
107
|
+
<button on:click class={closeButtonClasses} aria-label="Close">
|
|
108
|
+
<svg
|
|
109
|
+
class="close"
|
|
110
|
+
style:color={color}
|
|
111
|
+
viewBox="0 0 24 24"
|
|
112
|
+
aria-hidden="true"
|
|
113
|
+
>
|
|
114
|
+
<path
|
|
115
|
+
fill="currentColor"
|
|
116
|
+
d="M.439 21.44a1.5 1.5 0 0 0 2.122 2.121l9.262-9.261a.25.25 0 0 1 .354 0l9.262 9.263a1.5 1.5 0 1 0 2.122-2.121L14.3 12.177a.25.25 0 0 1 0-.354l9.263-9.262A1.5 1.5 0 0 0 21.439.44L12.177 9.7a.25.25 0 0 1-.354 0L2.561.44A1.5 1.5 0 0 0 .439 2.561L9.7 11.823a.25.25 0 0 1 0 .354Z"
|
|
117
|
+
></path>
|
|
118
|
+
</svg>
|
|
119
|
+
</button>
|
|
120
|
+
{/if}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { SvelteComponent } from "svelte";
|
|
2
|
+
import type { CloseSizes } from './api';
|
|
3
|
+
declare const __propDef: {
|
|
4
|
+
props: {
|
|
5
|
+
size?: CloseSizes;
|
|
6
|
+
isFaux?: boolean;
|
|
7
|
+
color?: string;
|
|
8
|
+
};
|
|
9
|
+
events: {
|
|
10
|
+
click: MouseEvent;
|
|
11
|
+
} & {
|
|
12
|
+
[evt: string]: CustomEvent<any>;
|
|
13
|
+
};
|
|
14
|
+
slots: {};
|
|
15
|
+
exports?: {} | undefined;
|
|
16
|
+
bindings?: string | undefined;
|
|
17
|
+
};
|
|
18
|
+
export type CloseProps = typeof __propDef.props;
|
|
19
|
+
export type CloseEvents = typeof __propDef.events;
|
|
20
|
+
export type CloseSlots = typeof __propDef.slots;
|
|
21
|
+
export default class Close extends SvelteComponent<CloseProps, CloseEvents, CloseSlots> {
|
|
22
|
+
}
|
|
23
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type CloseSizes = 'small' | 'large' | 'xlarge' | '';
|