@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.
Files changed (103) 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/Dialog/SvelteA11yDialog.svelte +103 -0
  33. package/dist/components/agnostic/Dialog/SvelteA11yDialog.svelte.d.ts +30 -0
  34. package/dist/components/agnostic/Dialog/a11y-dialog.d.ts +56 -0
  35. package/dist/components/agnostic/Dialog/a11y-dialog.js +216 -0
  36. package/dist/components/agnostic/Dialog/dom-utils.d.ts +26 -0
  37. package/dist/components/agnostic/Dialog/dom-utils.js +206 -0
  38. package/dist/components/agnostic/Disclose/Disclose.svelte +102 -0
  39. package/dist/components/agnostic/Disclose/Disclose.svelte.d.ts +23 -0
  40. package/dist/components/agnostic/Divider/Divider.svelte +139 -0
  41. package/dist/components/agnostic/Divider/Divider.svelte.d.ts +25 -0
  42. package/dist/components/agnostic/Divider/api.d.ts +3 -0
  43. package/dist/components/agnostic/Divider/api.js +1 -0
  44. package/dist/components/agnostic/Drawer/Drawer.svelte +30 -0
  45. package/dist/components/agnostic/Drawer/Drawer.svelte.d.ts +28 -0
  46. package/dist/components/agnostic/Drawer/api.d.ts +1 -0
  47. package/dist/components/agnostic/Drawer/api.js +1 -0
  48. package/dist/components/agnostic/EmptyState/EmptyState.svelte +46 -0
  49. package/dist/components/agnostic/EmptyState/EmptyState.svelte.d.ts +23 -0
  50. package/dist/components/agnostic/Header/Header.svelte +104 -0
  51. package/dist/components/agnostic/Header/Header.svelte.d.ts +26 -0
  52. package/dist/components/agnostic/Header/HeaderNav.svelte +28 -0
  53. package/dist/components/agnostic/Header/HeaderNav.svelte.d.ts +20 -0
  54. package/dist/components/agnostic/Header/HeaderNavItem.svelte +30 -0
  55. package/dist/components/agnostic/Header/HeaderNavItem.svelte.d.ts +20 -0
  56. package/dist/components/agnostic/Icon/Icon.svelte +180 -0
  57. package/dist/components/agnostic/Icon/Icon.svelte.d.ts +23 -0
  58. package/dist/components/agnostic/Icon/api.d.ts +2 -0
  59. package/dist/components/agnostic/Icon/api.js +1 -0
  60. package/dist/components/agnostic/Input/Input.svelte +415 -0
  61. package/dist/components/agnostic/Input/Input.svelte.d.ts +45 -0
  62. package/dist/components/agnostic/Input/InputAddonItem.svelte +42 -0
  63. package/dist/components/agnostic/Input/InputAddonItem.svelte.d.ts +33 -0
  64. package/dist/components/agnostic/Loader/Loader.svelte +113 -0
  65. package/dist/components/agnostic/Loader/Loader.svelte.d.ts +20 -0
  66. package/dist/components/agnostic/Menu/Menu.svelte +466 -0
  67. package/dist/components/agnostic/Menu/Menu.svelte.d.ts +31 -0
  68. package/dist/components/agnostic/Menu/MenuItem.svelte +117 -0
  69. package/dist/components/agnostic/Menu/MenuItem.svelte.d.ts +29 -0
  70. package/dist/components/agnostic/Progress/Progress.svelte +50 -0
  71. package/dist/components/agnostic/Progress/Progress.svelte.d.ts +20 -0
  72. package/dist/components/agnostic/Select/Select.svelte +141 -0
  73. package/dist/components/agnostic/Select/Select.svelte.d.ts +32 -0
  74. package/dist/components/agnostic/Spinner/Spinner.svelte +105 -0
  75. package/dist/components/agnostic/Spinner/Spinner.svelte.d.ts +19 -0
  76. package/dist/components/agnostic/Switch/Switch.svelte +275 -0
  77. package/dist/components/agnostic/Switch/Switch.svelte.d.ts +45 -0
  78. package/dist/components/agnostic/Table/Table.svelte +508 -0
  79. package/dist/components/agnostic/Table/Table.svelte.d.ts +36 -0
  80. package/dist/components/agnostic/Table/TableCustomRenderComponent.svelte +13 -0
  81. package/dist/components/agnostic/Table/TableCustomRenderComponent.svelte.d.ts +25 -0
  82. package/dist/components/agnostic/Tabs/TabButtonCustom.svelte +65 -0
  83. package/dist/components/agnostic/Tabs/TabButtonCustom.svelte.d.ts +35 -0
  84. package/dist/components/agnostic/Tabs/Tabs.svelte +330 -0
  85. package/dist/components/agnostic/Tabs/Tabs.svelte.d.ts +34 -0
  86. package/dist/components/agnostic/Tabs/api.d.ts +10 -0
  87. package/dist/components/agnostic/Tabs/api.js +1 -0
  88. package/dist/components/agnostic/Tag/Tag.svelte +74 -0
  89. package/dist/components/agnostic/Tag/Tag.svelte.d.ts +23 -0
  90. package/dist/components/agnostic/Tag/TagSlots.svelte +51 -0
  91. package/dist/components/agnostic/Tag/TagSlots.svelte.d.ts +16 -0
  92. package/dist/components/agnostic/Toasts/Toasts.svelte +46 -0
  93. package/dist/components/agnostic/Toasts/Toasts.svelte.d.ts +22 -0
  94. package/dist/components/agnostic/Tooltip/Tooltip.svelte +103 -0
  95. package/dist/components/agnostic/Tooltip/Tooltip.svelte.d.ts +23 -0
  96. package/dist/components/agnostic/Tooltip/TooltipSlots.svelte +81 -0
  97. package/dist/components/agnostic/Tooltip/TooltipSlots.svelte.d.ts +16 -0
  98. package/dist/components/agnostic/Tooltip/api.d.ts +1 -0
  99. package/dist/components/agnostic/Tooltip/api.js +1 -0
  100. package/dist/components/agnostic/animation.css +37 -0
  101. package/dist/index.d.ts +30 -1
  102. package/dist/index.js +30 -1
  103. package/package.json +1 -4
@@ -0,0 +1,180 @@
1
+ <style>
2
+ .icon-base {
3
+ display: inline-flex;
4
+ text-align: center;
5
+
6
+ /* Ensures no "stretching" of icons to reach 100% of container's width */
7
+ max-width: 100%;
8
+
9
+ /* Ensure SVGs don't have click events -- typically we want enclosing button to handle */
10
+ pointer-events: none;
11
+ user-select: none;
12
+ }
13
+
14
+ /* We need to make both the span and svg same height (span .icon-svg) */
15
+ .icon,
16
+ .icon-skin {
17
+ width: var(--fluid-16);
18
+ height: var(--fluid-16);
19
+ }
20
+
21
+ .icon-14 {
22
+ width: var(--fluid-14);
23
+ height: var(--fluid-14);
24
+ }
25
+
26
+ .icon-16 {
27
+ width: var(--fluid-16);
28
+ height: var(--fluid-16);
29
+ }
30
+
31
+ .icon-18 {
32
+ width: var(--fluid-18);
33
+ height: var(--fluid-18);
34
+ }
35
+
36
+ .icon-20 {
37
+ width: var(--fluid-20);
38
+ height: var(--fluid-20);
39
+ }
40
+
41
+ .icon-24,
42
+ .icon-svg-24 {
43
+ width: var(--fluid-24);
44
+ height: var(--fluid-24);
45
+ }
46
+
47
+ .icon-32 {
48
+ width: var(--fluid-32);
49
+ height: var(--fluid-32);
50
+ }
51
+
52
+ .icon-36 {
53
+ width: var(--fluid-36);
54
+ height: var(--fluid-36);
55
+ }
56
+
57
+ .icon-40 {
58
+ width: var(--fluid-40);
59
+ height: var(--fluid-40);
60
+ }
61
+
62
+ .icon-48 {
63
+ width: var(--fluid-48);
64
+ height: var(--fluid-48);
65
+ }
66
+
67
+ .icon-56 {
68
+ width: var(--fluid-56);
69
+ height: var(--fluid-56);
70
+ }
71
+
72
+ .icon-64 {
73
+ width: var(--fluid-64);
74
+ height: var(--fluid-64);
75
+ }
76
+
77
+ :global(.icon-svg) {
78
+ width: var(--fluid-16);
79
+ height: var(--fluid-16);
80
+ fill: currentColor;
81
+ }
82
+
83
+ :global(.icon-svg-14) {
84
+ width: var(--fluid-14);
85
+ height: var(--fluid-14);
86
+ }
87
+
88
+ :global(.icon-svg-16) {
89
+ width: var(--fluid-16);
90
+ height: var(--fluid-16);
91
+ }
92
+
93
+ :global(.icon-svg-18) {
94
+ width: var(--fluid-18);
95
+ height: var(--fluid-18);
96
+ }
97
+
98
+ :global(.icon-svg-20) {
99
+ width: var(--fluid-20);
100
+ height: var(--fluid-20);
101
+ }
102
+
103
+ :global(.icon-svg-24) {
104
+ width: var(--fluid-24);
105
+ height: var(--fluid-24);
106
+ }
107
+
108
+ :global(.icon-svg-32) {
109
+ width: var(--fluid-32);
110
+ height: var(--fluid-32);
111
+ }
112
+
113
+ :global(.icon-svg-36) {
114
+ width: var(--fluid-36);
115
+ height: var(--fluid-36);
116
+ }
117
+
118
+ :global(.icon-svg-40) {
119
+ width: var(--fluid-40);
120
+ height: var(--fluid-40);
121
+ }
122
+
123
+ :global(.icon-svg-48) {
124
+ width: var(--fluid-48);
125
+ height: var(--fluid-48);
126
+ }
127
+
128
+ :global(.icon-svg-56) {
129
+ width: var(--fluid-56);
130
+ height: var(--fluid-56);
131
+ }
132
+
133
+ :global(.icon-svg-64) {
134
+ width: var(--fluid-64);
135
+ height: var(--fluid-64);
136
+ }
137
+
138
+ :global(.icon-svg-info) {
139
+ color: var(--functional-primary);
140
+ }
141
+
142
+ :global(.icon-svg-action),
143
+ :global(.icon-svg-success) {
144
+ color: var(--functional-action);
145
+ }
146
+
147
+ :global(.icon-svg-warning) {
148
+ color: var(--functional-warning-border-accent);
149
+ }
150
+
151
+ :global(.icon-svg-error) {
152
+ color: var(--functional-error);
153
+ }
154
+ </style>
155
+
156
+ <script>import { onMount } from "svelte";
157
+ export let type = "";
158
+ export let size = 14;
159
+ export let isSkinned = true;
160
+ let spanRef;
161
+ const iconClasses = [
162
+ "screenreader-only",
163
+ isSkinned ? "icon" : "icon-base",
164
+ type ? `icon-${type}` : "",
165
+ size ? `icon-${size}` : ""
166
+ ].filter((cls) => cls).join(" ");
167
+ onMount(() => {
168
+ const svg = spanRef.querySelector("svg");
169
+ svg.classList.add("icon-svg");
170
+ if (svg) {
171
+ if (size) svg.classList.add(`icon-svg-${size}`);
172
+ if (type) svg.classList.add(`icon-svg-${type}`);
173
+ spanRef.classList.remove("screenreader-only");
174
+ }
175
+ });
176
+ </script>
177
+
178
+ <span bind:this={spanRef} class={iconClasses}>
179
+ <slot />
180
+ </span>
@@ -0,0 +1,23 @@
1
+ import { SvelteComponent } from "svelte";
2
+ import type { IconSize, IconType } from './api';
3
+ declare const __propDef: {
4
+ props: {
5
+ type?: IconType;
6
+ size?: IconSize;
7
+ isSkinned?: boolean;
8
+ };
9
+ events: {
10
+ [evt: string]: CustomEvent<any>;
11
+ };
12
+ slots: {
13
+ default: {};
14
+ };
15
+ exports?: {} | undefined;
16
+ bindings?: string | undefined;
17
+ };
18
+ export type IconProps = typeof __propDef.props;
19
+ export type IconEvents = typeof __propDef.events;
20
+ export type IconSlots = typeof __propDef.slots;
21
+ export default class Icon extends SvelteComponent<IconProps, IconEvents, IconSlots> {
22
+ }
23
+ export {};
@@ -0,0 +1,2 @@
1
+ export type IconSize = 14 | 16 | 18 | 20 | 24 | 32 | 36 | 40 | 48 | 56 | 64;
2
+ export type IconType = "warning" | "error" | "info" | "success" | "";
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,415 @@
1
+ <style>
2
+ .input-base,
3
+ .input {
4
+ /* Note this cannot be user-select: none else mobile safari won't accept input:
5
+ https://stackoverflow.com/questions/49889003/cannot-write-into-input-field-on-safari/49901069
6
+ */
7
+ user-select: initial;
8
+ appearance: none;
9
+ box-sizing: border-box;
10
+
11
+ /* Use the same color for the cursor */
12
+ caret-color: currentColor;
13
+ }
14
+
15
+ .label,
16
+ .label-base {
17
+ padding: 0;
18
+ border: 0;
19
+ box-sizing: border-box;
20
+ font-family: inherit;
21
+ }
22
+
23
+ /* Electing to scope these as opposed to doing :root level definitions */
24
+ .field-help,
25
+ .field-help-large,
26
+ .field-help-small,
27
+ .field-error,
28
+ .field-error-large,
29
+ .field-error-small,
30
+ .label-skin,
31
+ .label,
32
+ .input-addon-container,
33
+ .input-small,
34
+ .input-large,
35
+ .input-skin,
36
+ .input-underlined,
37
+ .input-underlined-bg,
38
+ .input {
39
+ color: var(--functional-font-color, var(--functional-dark));
40
+ font-family: var(--functional-font-family-body);
41
+ font-weight: var(--functional-font-weight, 300);
42
+ font-size: var(--functional-font-size, 1rem);
43
+ line-height: var(--functional-line-height, var(--fluid-20, 1.25rem));
44
+ width: 100%;
45
+ max-width: 100%;
46
+ }
47
+
48
+ .input-skin,
49
+ .input {
50
+ /* seems like a reasonable default as chrome picks `outset` which results in a weird 3d effect */
51
+ border-style: solid;
52
+
53
+ /* this can be overriden, but it might mess with the balance of the button heights across variants */
54
+ border-width: var(--functional-input-border-size, 1px);
55
+ border-color: var(--functional-input-border-color, var(--functional-gray-light));
56
+
57
+ /* these can be overriden, but it might mess with the balance of the inputheights across variants */
58
+ padding-block-start: var(--functional-input-vertical-pad, 0.5rem);
59
+ padding-block-end: var(--functional-input-vertical-pad, 0.5rem);
60
+ padding-inline-start: var(--functional-input-side-padding, 0.75rem);
61
+ padding-inline-end: var(--functional-input-side-padding, 0.75rem);
62
+
63
+ /* Note we only want to set properties that we actually want
64
+ to transition in. For example, if we transition "all", the
65
+ inputs will "grow in" on page load—not a happy effect :) */
66
+ transition-property: box-shadow;
67
+ transition-duration: var(--functional-input-timing, var(--functional-timing-medium));
68
+ }
69
+
70
+ .label {
71
+ display: inline-block;
72
+
73
+ /* Provided --functional-input-vertical-pad isn't overriden we'll get 20px
74
+ label w/a 6px margin then a 38px input = 64 which is on the 8pt grid */
75
+ margin-block-start: 0;
76
+ margin-inline-start: 0;
77
+ margin-inline-end: 0;
78
+ margin-block-end: var(--functional-input-label-pad, 0.375rem);
79
+ vertical-align: initial;
80
+ }
81
+
82
+ /* Reset field errors and help text to be 2px less then input font size */
83
+ .field-help,
84
+ .field-error {
85
+ font-size: calc(var(--functional-font-size, 1rem) - 2px);
86
+ }
87
+
88
+ .label-inline,
89
+ .input-inline {
90
+ width: auto;
91
+ }
92
+
93
+ /* When inlined, the margin-block-end will throw the label off-center with adjacent input */
94
+ .label-inline {
95
+ margin-block-start: 0;
96
+ margin-block-end: 0;
97
+ margin-inline-start: 0;
98
+ margin-inline-end: var(--functional-input-side-padding, 0.75rem);
99
+ }
100
+
101
+ /**
102
+ * Placeholder
103
+ */
104
+
105
+ /* stylelint-disable-next-line */
106
+ .input::-webkit-input-placeholder {
107
+ color: currentColor;
108
+ opacity: 50%;
109
+ transition: opacity var(--functional-timing-fast) ease-out;
110
+ }
111
+
112
+ /* stylelint-disable-next-line */
113
+ .input::placeholder {
114
+ color: currentColor;
115
+ opacity: 50%;
116
+ transition: opacity var(--functional-timing-fast) ease-out;
117
+ }
118
+
119
+ /* stylelint-disable-next-line */
120
+ .input::-ms-placeholder {
121
+ color: currentColor;
122
+ opacity: 50%;
123
+ transition: opacity var(--functional-timing-fast) ease-out;
124
+ }
125
+
126
+ /* stylelint-disable-next-line */
127
+ .input:-ms-placeholder {
128
+ color: currentColor;
129
+ opacity: 50%;
130
+ transition: opacity var(--functional-timing-fast) ease-out;
131
+ }
132
+
133
+ /**
134
+ * Underlined inputs
135
+ */
136
+ .input-underlined {
137
+ border-top: 0;
138
+ border-left: 0;
139
+ border-right: 0;
140
+ border-color: var(--functional-input-underlined-color, var(--functional-gray-mid-dark));
141
+ background-color: transparent;
142
+ }
143
+
144
+ .input-underlined-bg {
145
+ background-color: var(--functional-input-underlined-bg-color, var(--functional-gray-extra-light));
146
+ }
147
+
148
+ /**
149
+ * Rounded inputs
150
+ */
151
+ .input-rounded {
152
+ border-radius: var(--functional-radius, 0.25rem);
153
+ }
154
+
155
+ /**
156
+ * Errors
157
+ * We provide a class-based approach to setting errors which means we do
158
+ * not support :invalid, so it requires custom use of html4 validation API
159
+ * (see https://developer.mozilla.org/en-US/docs/Learn/Forms/Form_validation
160
+ * of the example in corresponding input.html file). The reason I elected to
161
+ * not include :invalid, is it seems to result in "shouting" at the user as
162
+ * I did not find an easy way to only kick in errors after a certain number
163
+ * of characters have been type (blur is actually better but I did not
164
+ * implement that in the contrived example).
165
+ */
166
+ .label-error {
167
+ color: var(--functional-input-error-color, var(--functional-error));
168
+ }
169
+
170
+ .input-error {
171
+ border-color: var(--functional-input-error-color, var(--functional-error));
172
+ }
173
+
174
+ .label-error,
175
+ .field-error,
176
+ .field-error-small,
177
+ .field-error-large {
178
+ color: var(--functional-input-error-color, var(--functional-error));
179
+ }
180
+
181
+ .field-help,
182
+ .field-help-small,
183
+ .field-help-large {
184
+ color: var(--functional-input-help-color, var(--functional-gray-dark));
185
+ }
186
+
187
+ .field-help,
188
+ .field-help-small,
189
+ .field-help-large,
190
+ .field-error,
191
+ .field-error-small,
192
+ .field-error-large {
193
+ display: inline-block;
194
+ width: 100%;
195
+ margin-block-start: calc(var(--functional-input-vertical-pad, 0.5rem) / 2);
196
+ }
197
+
198
+ /**
199
+ * Sizes
200
+ */
201
+ .input-large {
202
+ font-size: calc(var(--functional-font-size, 1rem) + 0.25rem);
203
+ line-height: 1.6rem;
204
+ }
205
+
206
+ .field-help-large,
207
+ .field-error-large {
208
+ /* We initially remove -2px from font-size so setting to font-size essentially adds the 2px back */
209
+ font-size: var(--functional-font-size, 1rem);
210
+ }
211
+
212
+ .label-large {
213
+ font-size: calc(var(--functional-font-size, 1rem) + 0.25rem);
214
+ }
215
+
216
+ .input-small {
217
+ font-size: calc(var(--functional-font-size, 1rem) - 0.25rem);
218
+ line-height: 1rem;
219
+ }
220
+
221
+ .field-help-small,
222
+ .field-error-small,
223
+ .label-small {
224
+ font-size: calc(var(--functional-font-size, 1rem) - 0.25rem);
225
+ }
226
+
227
+ .input:focus {
228
+ box-shadow: 0 0 0 var(--functional-focus-ring-outline-width) var(--functional-focus-ring-color);
229
+
230
+ /* Needed for High Contrast mode */
231
+ outline:
232
+ var(--functional-focus-ring-outline-width) var(--functional-focus-ring-outline-style)
233
+ var(--functional-focus-ring-outline-color);
234
+ transition: box-shadow var(--functional-timing-fast) ease-out;
235
+ }
236
+
237
+ /* Set the focus to transparent when there's an error since we use
238
+ borders that visually conflict. */
239
+ .input-error:focus {
240
+ box-shadow: 0 0 0 3px transparent;
241
+ }
242
+
243
+ /*
244
+ * Disabled State
245
+ *
246
+ * The disabled state uses the class .disabled,
247
+ * and the form attribute disabled="disabled".
248
+ * The use of !important is only added because this is a state
249
+ * that must be applied to all inputs when in a disabled state.
250
+ */
251
+ .input.disabled, /* DEPRECATED -- TODO remove class based disabled */
252
+ .input:disabled {
253
+ background: var(--functional-input-disabled-bg, var(--functional-disabled-bg)) !important;
254
+ color: var(--functional-input-disabled-color, var(--functional-disabled-color)) !important;
255
+ appearance: none !important;
256
+ box-shadow: none !important;
257
+ cursor: not-allowed !important;
258
+ opacity: 80% !important;
259
+ }
260
+
261
+ @media screen and (-ms-high-contrast: active) {
262
+ /* High contrast mode outline hacks */
263
+
264
+ /* styleint-disable-next-line no-descending-specificity */
265
+ .input:disabled {
266
+ outline: 2px solid transparent;
267
+ outline-offset: -2px;
268
+ }
269
+ }
270
+
271
+ /**
272
+ * Input "has addon"
273
+ */
274
+
275
+ .input-addon-container {
276
+ display: flex;
277
+ position: relative;
278
+ width: 100%;
279
+ min-height: 100%;
280
+ }
281
+
282
+ .input-has-left-addon {
283
+ padding-left: calc(var(--functional-side-padding) * 3);
284
+ }
285
+
286
+ .input-has-right-addon {
287
+ padding-right: calc(var(--functional-side-padding) * 3);
288
+ }
289
+
290
+ .input-addon-left {
291
+ left: var(--functional-input-side-padding);
292
+ }
293
+
294
+ .input-addon-right {
295
+ right: var(--functional-input-side-padding);
296
+ }
297
+
298
+ @media (prefers-reduced-motion), (update: slow) {
299
+ /* stylelint-disable selector-no-vendor-prefix */
300
+ .input-skin,
301
+ .input,
302
+ .input::placeholder,
303
+ .input::-webkit-input-placeholder,
304
+ .input::-ms-placeholder,
305
+ .input:-ms-placeholder,
306
+ .input:focus {
307
+ transition-duration: 0.001ms !important;
308
+ }
309
+ }
310
+
311
+ </style>
312
+ <script>export let label = "";
313
+ export let id = "";
314
+ export let labelCss = "";
315
+ export let isLabelHidden = false;
316
+ export let helpText = "";
317
+ export let invalidText = "";
318
+ export let hasLeftAddon = false;
319
+ export let hasRightAddon = false;
320
+ export let isInvalid = false;
321
+ export let isInline = false;
322
+ export let isRounded = false;
323
+ export let isDisabled = void 0;
324
+ export let css = "";
325
+ export let isSkinned = true;
326
+ export let isUnderlinedWithBackground = false;
327
+ export let isUnderlined = false;
328
+ export let size = "";
329
+ export let type = "text";
330
+ export let value = "";
331
+ $: if (!value) value = "";
332
+ $: inputType = type;
333
+ $: labelClasses = [
334
+ "label",
335
+ isInvalid ? "label-error" : "",
336
+ isInline ? "label-inline" : "",
337
+ size ? `label-${size}` : "",
338
+ isLabelHidden ? "screenreader-only" : "",
339
+ labelCss ? labelCss : ""
340
+ ].filter((c) => c).join(" ");
341
+ $: inputClasses = [
342
+ isSkinned ? "input" : "input-base",
343
+ isRounded ? "input-rounded" : "",
344
+ isUnderlined ? "input-underlined" : "",
345
+ hasLeftAddon ? "input-has-left-addon" : "",
346
+ hasRightAddon ? "input-has-right-addon" : "",
347
+ isDisabled ? "disabled" : "",
348
+ isInvalid ? "input-error" : "",
349
+ isInline ? "input-inline" : "",
350
+ isUnderlinedWithBackground ? "input-underlined-bg" : "",
351
+ css ? css : "",
352
+ size ? `input-${size}` : ""
353
+ ].filter((c) => c).join(" ");
354
+ $: invalidClasses = () => {
355
+ return size ? `field-error-${size}` : "field-error";
356
+ };
357
+ $: helpClasses = () => {
358
+ return size ? `field-help-${size}` : "field-help";
359
+ };
360
+ $: addonContainerClasses = () => "input-addon-container";
361
+ const handleInput = (e) => {
362
+ value = e.target.value;
363
+ };
364
+ </script>
365
+ <div class="w-100">
366
+ <label class={labelClasses} for={id}>{label}</label>
367
+ {#if type == "textarea"}
368
+ <textarea
369
+ id={id}
370
+ class={inputClasses}
371
+ on:blur
372
+ on:change
373
+ bind:value
374
+ on:click
375
+ on:focus
376
+ {...$$restProps}></textarea>
377
+ {:else if hasLeftAddon || hasRightAddon}
378
+ <div class={addonContainerClasses()}>
379
+ <slot name="addonLeft" />
380
+ <input
381
+ id={id}
382
+ type={inputType}
383
+ value={value}
384
+ class={inputClasses}
385
+ disabled={isDisabled}
386
+ on:blur
387
+ on:change
388
+ on:input={handleInput}
389
+ on:click
390
+ on:focus
391
+ {...$$restProps}
392
+ />
393
+ <slot name="addonRight" />
394
+ </div>
395
+ {:else}
396
+ <input
397
+ id={id}
398
+ type={inputType}
399
+ value={value}
400
+ class={inputClasses}
401
+ disabled={isDisabled}
402
+ on:blur
403
+ on:change
404
+ on:input={handleInput}
405
+ on:click
406
+ on:focus
407
+ {...$$restProps}
408
+ />
409
+ {/if}
410
+ {#if isInvalid}
411
+ <span role="status" aria-live="polite" class={invalidClasses()}>
412
+ {invalidText}
413
+ </span>
414
+ {:else if helpText}<span class={helpClasses()}>{helpText}</span>{/if}
415
+ </div>
@@ -0,0 +1,45 @@
1
+ import { SvelteComponent } from "svelte";
2
+ declare const __propDef: {
3
+ props: {
4
+ [x: string]: any;
5
+ label?: string | undefined;
6
+ id?: string | undefined;
7
+ labelCss?: string | undefined;
8
+ isLabelHidden?: boolean | undefined;
9
+ helpText?: string | undefined;
10
+ invalidText?: string | undefined;
11
+ hasLeftAddon?: boolean | undefined;
12
+ hasRightAddon?: boolean | undefined;
13
+ isInvalid?: boolean | undefined;
14
+ isInline?: boolean | undefined;
15
+ isRounded?: boolean | undefined;
16
+ isDisabled?: undefined;
17
+ css?: string | undefined;
18
+ isSkinned?: boolean | undefined;
19
+ isUnderlinedWithBackground?: boolean | undefined;
20
+ isUnderlined?: boolean | undefined;
21
+ size?: ("small" | "large" | "") | undefined;
22
+ type?: ("text" | "textarea" | "email" | "search" | "password" | "tel" | "number" | "url" | "month" | "time" | "week" | "date" | "datetime-local" | "color") | undefined;
23
+ value?: string | undefined;
24
+ };
25
+ events: {
26
+ blur: FocusEvent;
27
+ change: Event;
28
+ click: MouseEvent;
29
+ focus: FocusEvent;
30
+ } & {
31
+ [evt: string]: CustomEvent<any>;
32
+ };
33
+ slots: {
34
+ addonLeft: {};
35
+ addonRight: {};
36
+ };
37
+ exports?: undefined;
38
+ bindings?: undefined;
39
+ };
40
+ export type InputProps = typeof __propDef.props;
41
+ export type InputEvents = typeof __propDef.events;
42
+ export type InputSlots = typeof __propDef.slots;
43
+ export default class Input extends SvelteComponent<InputProps, InputEvents, InputSlots> {
44
+ }
45
+ export {};
@@ -0,0 +1,42 @@
1
+ <style>
2
+ /*
3
+ * Input addons e.g. icons inside the input
4
+ */
5
+ .input-addon-right,
6
+ .input-addon-left {
7
+ display: flex;
8
+ align-items: center;
9
+ justify-content: center;
10
+ position: absolute;
11
+ top: 0;
12
+
13
+ /* This allows an icon to sit in the vertical center regardless
14
+ of if we've applied input-large or input-small */
15
+ min-height: 100%;
16
+ }
17
+
18
+ .input-addon-left {
19
+ left: var(--functional-input-side-padding);
20
+ }
21
+
22
+ .input-addon-right {
23
+ right: var(--functional-input-side-padding);
24
+ }
25
+
26
+ </style>
27
+
28
+ <script>
29
+ export let css = "";
30
+ export let addonLeft = false;
31
+ export let addonRight = false;
32
+ $: klasses = [
33
+ addonLeft ? "input-addon-left" : "",
34
+ addonRight ? "input-addon-right" : "",
35
+ css ? `${css}` : "",
36
+ ].filter(c => c).join(" ");
37
+ </script>
38
+
39
+ <div class={klasses}>
40
+ <slot />
41
+ </div>
42
+