@functionalcms/svelte-components 3.5.16 → 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.
Files changed (129) hide show
  1. package/css/functional.css +1 -1
  2. package/css/functional.css.map +1 -1
  3. package/dist/components/Banner.svelte +1 -1
  4. package/dist/components/Banner.svelte.d.ts +8 -13
  5. package/dist/components/Link.svelte.d.ts +45 -34
  6. package/dist/components/Logo.svelte.d.ts +26 -22
  7. package/dist/components/Markdown.svelte.d.ts +5 -14
  8. package/dist/components/Spacer.svelte.d.ts +6 -14
  9. package/dist/components/Well.svelte.d.ts +11 -13
  10. package/dist/components/agnostic/Button/Button.svelte +333 -332
  11. package/dist/components/agnostic/Button/Button.svelte.d.ts +50 -39
  12. package/dist/components/agnostic/Button/ButtonGroup.svelte.d.ts +30 -19
  13. package/dist/components/agnostic/Close/Close.svelte.d.ts +22 -18
  14. package/dist/components/agnostic/Disclose/Disclose.svelte.d.ts +10 -13
  15. package/dist/components/agnostic/Divider/Divider.svelte.d.ts +21 -17
  16. package/dist/components/agnostic/Loader/Loader.svelte.d.ts +20 -16
  17. package/dist/components/blog/BlogDescription.svelte.d.ts +21 -17
  18. package/dist/components/blog/BlogTitle.svelte.d.ts +21 -17
  19. package/dist/components/form/DateTimePicker.svelte.d.ts +16 -12
  20. package/dist/components/form/Input.svelte +1 -1
  21. package/dist/components/form/Input.svelte.d.ts +46 -20
  22. package/dist/components/form/InputAddonItem.svelte +34 -34
  23. package/dist/components/form/InputAddonItem.svelte.d.ts +27 -27
  24. package/dist/components/form/Select.svelte.d.ts +32 -28
  25. package/dist/components/{agnostic/Switch → form}/Switch.svelte +1 -1
  26. package/dist/components/form/Switch.svelte.d.ts +30 -0
  27. package/dist/components/layouts/DefaultLayout.svelte.d.ts +11 -13
  28. package/dist/components/layouts/Meta.svelte.d.ts +10 -13
  29. package/dist/components/layouts/SimpleFooter.svelte.d.ts +7 -13
  30. package/dist/components/layouts/Tracker.svelte.d.ts +5 -13
  31. package/dist/components/layouts/TwoColumnsLayout.svelte.d.ts +9 -13
  32. package/dist/components/menu/CollapsibleMenu.svelte.d.ts +27 -23
  33. package/dist/components/menu/DynamicMenu.svelte.d.ts +27 -23
  34. package/dist/components/menu/HamburgerMenu.svelte +3 -3
  35. package/dist/components/menu/HamburgerMenu.svelte.d.ts +25 -21
  36. package/dist/components/menu/Menu.svelte.d.ts +31 -27
  37. package/dist/components/menu/MenuItem.svelte.d.ts +37 -25
  38. package/dist/components/menu/NavigationItems.svelte +9 -4
  39. package/dist/components/menu/NavigationItems.svelte.d.ts +27 -23
  40. package/dist/components/presentation/Card.svelte.d.ts +17 -13
  41. package/dist/components/presentation/Carousel/carousel-content.svelte +35 -0
  42. package/dist/components/presentation/Carousel/carousel-content.svelte.d.ts +28 -0
  43. package/dist/components/presentation/Carousel/carousel-item.svelte +25 -0
  44. package/dist/components/presentation/Carousel/carousel-item.svelte.d.ts +28 -0
  45. package/dist/components/presentation/Carousel/carousel-next.svelte +39 -0
  46. package/dist/components/presentation/Carousel/carousel-next.svelte.d.ts +18 -0
  47. package/dist/components/presentation/Carousel/carousel-previous.svelte +40 -0
  48. package/dist/components/presentation/Carousel/carousel-previous.svelte.d.ts +18 -0
  49. package/dist/components/presentation/Carousel/carousel.svelte +99 -0
  50. package/dist/components/presentation/Carousel/carousel.svelte.d.ts +31 -0
  51. package/dist/components/presentation/Carousel/context.d.ts +32 -0
  52. package/dist/components/presentation/Carousel/context.js +12 -0
  53. package/dist/components/presentation/Carousel.svelte +4 -0
  54. package/dist/components/presentation/Carousel.svelte.d.ts +18 -0
  55. package/dist/components/presentation/Carusele.d.ts +1 -1
  56. package/dist/components/presentation/Carusele.js +1 -1
  57. package/dist/components/presentation/Gallery.svelte.d.ts +14 -13
  58. package/dist/components/presentation/ImageCompare.svelte +15 -12
  59. package/dist/components/presentation/ImageCompare.svelte.d.ts +24 -38
  60. package/dist/index.d.ts +4 -4
  61. package/dist/index.js +11 -6
  62. package/package.json +24 -24
  63. package/dist/components/agnostic/Alert/Alert.svelte +0 -317
  64. package/dist/components/agnostic/Alert/Alert.svelte.d.ts +0 -29
  65. package/dist/components/agnostic/Avatar/Avatar.svelte +0 -127
  66. package/dist/components/agnostic/Avatar/Avatar.svelte.d.ts +0 -24
  67. package/dist/components/agnostic/Avatar/AvatarGroup.svelte +0 -106
  68. package/dist/components/agnostic/Avatar/AvatarGroup.svelte.d.ts +0 -27
  69. package/dist/components/agnostic/Breadcrumb/Breadcrumb.svelte +0 -65
  70. package/dist/components/agnostic/Breadcrumb/Breadcrumb.svelte.d.ts +0 -18
  71. package/dist/components/agnostic/Breadcrumb/api.d.ts +0 -4
  72. package/dist/components/agnostic/Breadcrumb/api.js +0 -1
  73. package/dist/components/agnostic/ChoiceInput/ChoiceInput.svelte +0 -365
  74. package/dist/components/agnostic/ChoiceInput/ChoiceInput.svelte.d.ts +0 -35
  75. package/dist/components/agnostic/ChoiceInput/api.d.ts +0 -7
  76. package/dist/components/agnostic/ChoiceInput/api.js +0 -1
  77. package/dist/components/agnostic/Dialog/Dialog.svelte +0 -278
  78. package/dist/components/agnostic/Dialog/Dialog.svelte.d.ts +0 -37
  79. package/dist/components/agnostic/Dialog/SvelteA11yDialog.svelte +0 -128
  80. package/dist/components/agnostic/Dialog/SvelteA11yDialog.svelte.d.ts +0 -28
  81. package/dist/components/agnostic/Dialog/a11y-dialog.d.ts +0 -56
  82. package/dist/components/agnostic/Dialog/a11y-dialog.js +0 -216
  83. package/dist/components/agnostic/Dialog/dom-utils.d.ts +0 -26
  84. package/dist/components/agnostic/Dialog/dom-utils.js +0 -206
  85. package/dist/components/agnostic/Drawer/Drawer.svelte +0 -34
  86. package/dist/components/agnostic/Drawer/Drawer.svelte.d.ts +0 -26
  87. package/dist/components/agnostic/Drawer/api.d.ts +0 -1
  88. package/dist/components/agnostic/Drawer/api.js +0 -1
  89. package/dist/components/agnostic/EmptyState/EmptyState.svelte +0 -49
  90. package/dist/components/agnostic/EmptyState/EmptyState.svelte.d.ts +0 -21
  91. package/dist/components/agnostic/Header/Header.svelte +0 -111
  92. package/dist/components/agnostic/Header/Header.svelte.d.ts +0 -24
  93. package/dist/components/agnostic/Header/HeaderNav.svelte +0 -29
  94. package/dist/components/agnostic/Header/HeaderNav.svelte.d.ts +0 -18
  95. package/dist/components/agnostic/Header/HeaderNavItem.svelte +0 -31
  96. package/dist/components/agnostic/Header/HeaderNavItem.svelte.d.ts +0 -18
  97. package/dist/components/agnostic/Icon/Icon.svelte +0 -188
  98. package/dist/components/agnostic/Icon/Icon.svelte.d.ts +0 -21
  99. package/dist/components/agnostic/Icon/api.d.ts +0 -2
  100. package/dist/components/agnostic/Icon/api.js +0 -1
  101. package/dist/components/agnostic/Progress/Progress.svelte +0 -51
  102. package/dist/components/agnostic/Progress/Progress.svelte.d.ts +0 -18
  103. package/dist/components/agnostic/Spinner/Spinner.svelte +0 -108
  104. package/dist/components/agnostic/Spinner/Spinner.svelte.d.ts +0 -17
  105. package/dist/components/agnostic/Switch/Switch.svelte.d.ts +0 -43
  106. package/dist/components/agnostic/Table/Table.svelte +0 -521
  107. package/dist/components/agnostic/Table/Table.svelte.d.ts +0 -34
  108. package/dist/components/agnostic/Table/TableCustomRenderComponent.svelte +0 -13
  109. package/dist/components/agnostic/Table/TableCustomRenderComponent.svelte.d.ts +0 -23
  110. package/dist/components/agnostic/Tabs/TabButtonCustom.svelte +0 -77
  111. package/dist/components/agnostic/Tabs/TabButtonCustom.svelte.d.ts +0 -33
  112. package/dist/components/agnostic/Tabs/Tabs.svelte +0 -399
  113. package/dist/components/agnostic/Tabs/Tabs.svelte.d.ts +0 -32
  114. package/dist/components/agnostic/Tabs/api.d.ts +0 -10
  115. package/dist/components/agnostic/Tabs/api.js +0 -1
  116. package/dist/components/agnostic/Tag/Tag.svelte +0 -78
  117. package/dist/components/agnostic/Tag/Tag.svelte.d.ts +0 -21
  118. package/dist/components/agnostic/Tag/TagSlots.svelte +0 -52
  119. package/dist/components/agnostic/Tag/TagSlots.svelte.d.ts +0 -14
  120. package/dist/components/agnostic/Toasts/Toasts.svelte +0 -56
  121. package/dist/components/agnostic/Toasts/Toasts.svelte.d.ts +0 -20
  122. package/dist/components/agnostic/Tooltip/Tooltip.svelte +0 -120
  123. package/dist/components/agnostic/Tooltip/Tooltip.svelte.d.ts +0 -21
  124. package/dist/components/agnostic/Tooltip/TooltipSlots.svelte +0 -82
  125. package/dist/components/agnostic/Tooltip/TooltipSlots.svelte.d.ts +0 -14
  126. package/dist/components/agnostic/Tooltip/api.d.ts +0 -1
  127. package/dist/components/agnostic/Tooltip/api.js +0 -1
  128. package/dist/components/presentation/Carusel.svelte +0 -109
  129. package/dist/components/presentation/Carusel.svelte.d.ts +0 -56
@@ -1,106 +0,0 @@
1
- <style>
2
- .avatar,
3
- .avatar-base {
4
- position: relative;
5
- display: inline-flex;
6
- align-items: center;
7
- justify-content: center;
8
- overflow: hidden;
9
- }
10
-
11
- .avatar,
12
- .avatar-skin {
13
- width: var(--fluid-40);
14
- height: var(--fluid-40);
15
- max-width: 100%;
16
- background: var(--functional-gray-extra-light);
17
- border-radius: 50%;
18
- }
19
-
20
- .avatar-square {
21
- border-radius: 0;
22
- }
23
-
24
- .avatar-rounded {
25
- border-radius: var(--functional-radius);
26
- }
27
-
28
- .avatar-small {
29
- font-size: var(--fluid-12);
30
- width: var(--fluid-32);
31
- height: var(--fluid-32);
32
- }
33
-
34
- .avatar-large {
35
- width: var(--fluid-48);
36
- height: var(--fluid-48);
37
- }
38
-
39
- .avatar-xlarge {
40
- font-size: var(--fluid-20);
41
- width: var(--fluid-64);
42
- height: var(--fluid-64);
43
- }
44
-
45
- .avatar::before {
46
- content: attr(data-text);
47
- }
48
-
49
- .avatar-image {
50
- width: 100%;
51
- height: 100%;
52
- object-fit: cover;
53
- }
54
-
55
- .avatar-info {
56
- background: var(--functional-primary-light);
57
- color: var(--functional-primary-dark);
58
- }
59
-
60
- .avatar-warning {
61
- background: var(--functional-warning-light);
62
- color: var(--functional-warning-dark);
63
- }
64
-
65
- .avatar-success {
66
- background: var(--functional-action-light);
67
- color: var(--functional-action-dark);
68
- }
69
-
70
- .avatar-error {
71
- background: var(--functional-error-light);
72
- color: var(--functional-error-dark);
73
- }
74
-
75
- /* Must come after avatar-success, avatatar-warning, etc. so specificity is higher */
76
- .avatar-transparent {
77
- background: transparent;
78
- }
79
-
80
- .avatar-group {
81
- display: flex;
82
- flex-direction: row;
83
-
84
- /* TBD -- should we stack these on mobile? */
85
- }
86
-
87
- /* Helpful for Vue / Svelte SFC where the .avatar child will not be a global
88
- but CSS Modules class. Unfortunately, it means those have to be spans though.
89
- This should be ok -- it's our Avatar.vue and Avatar.svelte, for example, that
90
- respectively generate the <span> tag in their own templates (not the consumer) */
91
- .avatar-group > :global(span),
92
- .avatar-group .avatar {
93
- border: 2px solid var(--functional-light);
94
- }
95
-
96
- .avatar-group > :global(span:not(:first-child)),
97
- .avatar-group .avatar:not(:first-child) {
98
- margin-inline-start: calc(-1 * var(--fluid-10));
99
- }
100
-
101
- </style>
102
-
103
- <div class="avatar-group">
104
- <slot />
105
- </div>
106
-
@@ -1,27 +0,0 @@
1
- /** @typedef {typeof __propDef.props} AvatarGroupProps */
2
- /** @typedef {typeof __propDef.events} AvatarGroupEvents */
3
- /** @typedef {typeof __propDef.slots} AvatarGroupSlots */
4
- export default class AvatarGroup extends SvelteComponentTyped<{
5
- [x: string]: never;
6
- }, {
7
- [evt: string]: CustomEvent<any>;
8
- }, {
9
- default: {};
10
- }> {
11
- }
12
- export type AvatarGroupProps = typeof __propDef.props;
13
- export type AvatarGroupEvents = typeof __propDef.events;
14
- export type AvatarGroupSlots = typeof __propDef.slots;
15
- import { SvelteComponentTyped } from "svelte";
16
- declare const __propDef: {
17
- props: {
18
- [x: string]: never;
19
- };
20
- events: {
21
- [evt: string]: CustomEvent<any>;
22
- };
23
- slots: {
24
- default: {};
25
- };
26
- };
27
- export {};
@@ -1,65 +0,0 @@
1
- <style>
2
- .breadcrumb {
3
- display: flex;
4
- flex-wrap: wrap;
5
- padding: 0;
6
- white-space: nowrap;
7
- list-style: none;
8
- }
9
-
10
- .breadcrumb-item + .breadcrumb-item {
11
- padding-inline-start: var(--fluid-6);
12
- }
13
-
14
- .breadcrumb-item + .breadcrumb-item::before {
15
- padding-inline-end: var(--fluid-6);
16
- color: var(--functional-gray-mid-dark);
17
- content: "\203A";
18
- }
19
-
20
- .breadcrumb-slash .breadcrumb-item + .breadcrumb-item::before {
21
- content: "\0002f";
22
- }
23
-
24
- .breadcrumb-arrow .breadcrumb-item + .breadcrumb-item::before {
25
- content: "\02192";
26
- }
27
-
28
- .breadcrumb-bullet .breadcrumb-item + .breadcrumb-item::before {
29
- content: "\02022";
30
- }
31
-
32
- </style>
33
-
34
- <script lang="ts">
35
- import type { BreadcrumbRoute } from './api';
36
- export let routes: BreadcrumbRoute[] = [];
37
- export let type = "";
38
-
39
- const breadcrumbClasses = ["breadcrumb", type ? `breadcrumb-${type}` : ""]
40
- .filter((cls) => cls)
41
- .join(" ");
42
-
43
- const isLast = (idx): boolean => {
44
- return idx === routes.length - 1;
45
- };
46
-
47
- const crumbClasses = (index): string => {
48
- const isLastCrumb = isLast(index);
49
- return ["breadcrumb-item", isLastCrumb ? "active" : ""]
50
- .filter((cl) => cl)
51
- .join(" ");
52
- };
53
- </script>
54
-
55
- <nav aria-label="breadcrumbs">
56
- <ol class={breadcrumbClasses}>
57
- {#each routes as route, i}
58
- <li class={crumbClasses(i)}>
59
- {#if !isLast(i) && route.url}
60
- <a href={route.url}>{route.label}</a>
61
- {:else}<span v-else>{route.label}</span>{/if}
62
- </li>
63
- {/each}
64
- </ol>
65
- </nav>
@@ -1,18 +0,0 @@
1
- import { SvelteComponentTyped } from "svelte";
2
- import type { BreadcrumbRoute } from './api';
3
- declare const __propDef: {
4
- props: {
5
- routes?: BreadcrumbRoute[];
6
- type?: string;
7
- };
8
- events: {
9
- [evt: string]: CustomEvent<any>;
10
- };
11
- slots: {};
12
- };
13
- export type BreadcrumbProps = typeof __propDef.props;
14
- export type BreadcrumbEvents = typeof __propDef.events;
15
- export type BreadcrumbSlots = typeof __propDef.slots;
16
- export default class Breadcrumb extends SvelteComponentTyped<BreadcrumbProps, BreadcrumbEvents, BreadcrumbSlots> {
17
- }
18
- export {};
@@ -1,4 +0,0 @@
1
- export type BreadcrumbRoute = {
2
- label: string;
3
- url: string;
4
- };
@@ -1 +0,0 @@
1
- export {};
@@ -1,365 +0,0 @@
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 lang="ts">
251
- import type { ChoiceInputOption, ChoiceInputSize, ChoiceInputType } from './api';
252
- export let id;
253
- export let isSkinned = true;
254
- export let isFieldset = true;
255
- export let isInline = false;
256
- export let isDisabled = undefined;
257
- export let isInvalid = false;
258
- export let options: ChoiceInputOption[] = [];
259
- export let disabledOptions = [];
260
- export let checkedOptions = [];
261
- // If isFieldset falsy this will be screenreader only. If legendLabel is not passed
262
- // in, it will fallback to the type prop or string choice input. Some content must be
263
- // within the <legenc>CONTENT</legend> element to meet accessibility requirements
264
- export let type: ChoiceInputType = "checkbox";
265
- export let legendLabel = type || "choice input";
266
- export let size: ChoiceInputSize = "";
267
-
268
- // Provides bind:checked capabilities that consumer can use
269
- export let checked = [];
270
-
271
- $: labelClasses = [
272
- type ? `${type}-label-wrap` : "",
273
- isInline ? `${type}-label-wrap-inline` : "",
274
- isDisabled ? "disabled" : "",
275
- ].filter((c) => c.length).join(" ");
276
-
277
- $: labelSpanClasses = [
278
- type ? `${type}-label` : "",
279
- isInvalid ? 'choice-input-error' : "",
280
- size ? `${type}-label-${size}` : "",
281
- ].filter((c) => c.length).join(" ");
282
-
283
- // If consumer sets is skinned to false we don't style the legend
284
- $: skin = isSkinned ? `${type}-legend` : "";
285
-
286
- $: labelCopyClasses = [
287
- // Will also need to work in the small
288
- // and large sizes here for the text copy
289
- type ? `${type}-label-copy` : "",
290
- size ? `${type}-label-copy-${size}` : "",
291
- isInvalid ? 'choice-input-error' : "",
292
- ].filter((c) => c.length).join(" ");
293
-
294
- $: legendClasses = [
295
- skin,
296
- // .screenreader-only is expected to be globally available via common.min.css
297
- isFieldset === false ? "screenreader-only" : ""
298
- ].filter(c => c).join(" ");
299
-
300
- $: fieldsetClasses = (): string => {
301
- // If consumer sets is skinned to false we don't style the fieldset
302
- const skin = isSkinned ? `${type}-group` : "";
303
-
304
- // we only add the fieldset class for large (not small) e.g. radio|checkbox-group-large
305
- const sizeSkin =
306
- isSkinned && size === "large" ? `${type}-group-${size}` : "";
307
-
308
- let klasses = [
309
- skin,
310
- sizeSkin,
311
- isFieldset === false ? `${type}-group-hidden` : "",
312
- ];
313
- klasses = klasses.filter((klass) => klass.length);
314
- return klasses.join(" ");
315
- };
316
-
317
- $: inputClasses = (): string => {
318
- let inputKlasses = [
319
- type ? `${type}` : "",
320
- size ? `${type}-${size}` : "",
321
- // isDisabled ? "disabled" : "",
322
- ];
323
- inputKlasses = inputKlasses.filter((klass) => klass.length);
324
- return inputKlasses.join(" ");
325
- };
326
-
327
- $: onChange = (e) => {
328
- // This allows the consumer to use bind:checked={checkedValues} idiom.
329
- // We cannot use the bind:group idiom as we're using dynamic type above,
330
- // So, essentially, we're manually implementing two-way binding here ;-)
331
- checked =
332
- Array.from(document.getElementsByName(e.target.name))
333
- .filter(el => (el as HTMLInputElement).checked)
334
- .map(el => (el as HTMLInputElement).value);
335
-
336
- }
337
- </script>
338
-
339
- <fieldset class={fieldsetClasses()}>
340
- <legend class={legendClasses}>{legendLabel}</legend>
341
- {#each options as { name, value, label }, index}
342
- <label
343
- class={labelClasses}
344
- class:disabled={isDisabled || disabledOptions.includes(value) || undefined}
345
- >
346
- <input
347
- class={inputClasses()}
348
- id="{id}-{name}-{index}"
349
- type={type}
350
- name={name}
351
- value={value}
352
- disabled={isDisabled || disabledOptions.includes(value)}
353
- checked={checkedOptions.includes(value)}
354
- on:blur
355
- on:change={onChange}
356
- on:input
357
- on:click
358
- on:focus
359
- {...$$restProps}
360
- />
361
- <span class={labelSpanClasses} aria-hidden="true"></span>
362
- <span class={labelCopyClasses}>{label}</span>
363
- </label>
364
- {/each}
365
- </fieldset>
@@ -1,35 +0,0 @@
1
- import { SvelteComponentTyped } 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
- };
30
- export type ChoiceInputProps = typeof __propDef.props;
31
- export type ChoiceInputEvents = typeof __propDef.events;
32
- export type ChoiceInputSlots = typeof __propDef.slots;
33
- export default class ChoiceInput extends SvelteComponentTyped<ChoiceInputProps, ChoiceInputEvents, ChoiceInputSlots> {
34
- }
35
- export {};
@@ -1,7 +0,0 @@
1
- export type ChoiceInputOption = {
2
- name: string;
3
- value: string;
4
- label: string;
5
- };
6
- export type ChoiceInputType = "checkbox" | "radio";
7
- export type ChoiceInputSize = "small" | "large" | "";
@@ -1 +0,0 @@
1
- export {};