@ably/ui 5.3.0 → 6.0.1-dev.6103afe

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 (42) hide show
  1. package/core/Code.jsx +6 -3
  2. package/core/CompanyAutocomplete/component.css +46 -0
  3. package/core/CompanyAutocomplete/component.js +1 -0
  4. package/core/FeatureFooter.jsx +17 -0
  5. package/core/FeaturedLink/component.css +1 -2
  6. package/core/Icon/component.css +1 -0
  7. package/core/Test/component.js +59 -0
  8. package/core/Test.jsx +4 -0
  9. package/core/core.base.css +1 -0
  10. package/core/core.components.css +49 -0
  11. package/core/fonts/.DS_Store +0 -0
  12. package/core/images/.DS_Store +0 -0
  13. package/core/sprites.svg +18 -1
  14. package/core/styles.base.css +1 -0
  15. package/core/styles.components.css +49 -0
  16. package/core/styles.css +239 -11
  17. package/package.json +1 -1
  18. package/src/.DS_Store +0 -0
  19. package/src/core/.DS_Store +0 -0
  20. package/src/core/Code/component.html.erb +3 -3
  21. package/src/core/Code/component.jsx +3 -2
  22. package/src/core/Code/component.rb +2 -1
  23. package/src/core/CompanyAutocomplete/component.css +45 -0
  24. package/src/core/CompanyAutocomplete/component.js +202 -0
  25. package/src/core/FeaturedLink/component.css +1 -2
  26. package/src/core/FeaturedLink/component.html.erb +1 -1
  27. package/src/core/FeaturedLink/component.rb +3 -1
  28. package/src/core/fonts/.DS_Store +0 -0
  29. package/src/core/icons/icon-display-api-keys.svg +3 -0
  30. package/src/core/icons/icon-display-cloud-servers.svg +3 -0
  31. package/src/core/icons/icon-display-map-pin.svg +1 -1
  32. package/src/core/icons/icon-display-servers.svg +3 -0
  33. package/src/core/icons/icon-gui-history.svg +3 -0
  34. package/src/core/icons/icon-gui-refresh.svg +10 -0
  35. package/src/core/images/.DS_Store +0 -0
  36. package/src/core/styles/buttons.css +91 -4
  37. package/src/core/styles/forms.css +50 -0
  38. package/src/core/styles/properties.css +34 -6
  39. package/src/core/styles/text.css +62 -1
  40. package/src/core/styles.components.css +1 -0
  41. package/src/reset/.DS_Store +0 -0
  42. package/tailwind.config.js +22 -1
package/core/styles.css CHANGED
@@ -45,10 +45,27 @@
45
45
  --icon-color-github: #000000;
46
46
 
47
47
  --gradient-active-orange: linear-gradient(
48
- 62deg,
49
- var(--color-active-orange) 0,
50
- var(--color-active-orange) 60%,
51
- var(--color-red-orange) 100%
48
+ 61.2deg,
49
+ var(--color-active-orange) 10.46%,
50
+ #fe5215 38.63%,
51
+ #fc4a13 54.38%,
52
+ #f73c10 67.07%,
53
+ #f1280a 78.13%,
54
+ #e90f04 88.02%,
55
+ var(--color-red-orange) 92.73%
56
+ );
57
+
58
+ /* Used for smooth transitions from gradient to non-gradient backgrounds */
59
+ --gradient-transparent: linear-gradient(
60
+ 0deg,
61
+ rgba(255, 255, 255, 0),
62
+ rgba(255, 255, 255, 0)
63
+ );
64
+
65
+ --gradient-hot-pink: linear-gradient(
66
+ 80.2deg,
67
+ var(--color-bright-red) 0%,
68
+ var(--color-jazzy-pink) 100%
52
69
  );
53
70
 
54
71
  --fs-title-xl: 4rem;
@@ -73,11 +90,15 @@
73
90
  --fs-overline2: 0.875rem;
74
91
  --fs-btn1: 1.125rem;
75
92
  --fs-btn2: 1rem;
93
+ --fs-btn3: 0.875rem;
76
94
  --fs-menu1: 1.125rem;
77
95
  --fs-menu2: 1rem;
78
96
  --fs-menu3: 0.875rem;
79
97
  --fs-quote: 1.5rem;
98
+ --fs-code1: 1rem;
99
+ --fs-code2: 0.875rem;
80
100
 
101
+ --lh-dense: 1;
81
102
  --lh-tight: 1.125;
82
103
  --lh-snug: 1.15;
83
104
  --lh-normal: 1.25;
@@ -109,17 +130,24 @@
109
130
  --spacing-80: 5rem;
110
131
  --spacing-88: 5.5rem;
111
132
  --spacing-96: 6rem;
133
+ --spacing-128: 8rem;
112
134
  --spacing-160: 10rem;
113
135
  --spacing-256: 16rem;
114
136
 
115
- --spacing-btn: 0.9375rem 1.5rem; /* 15px 24px */
116
- --spacing-btn-small: 0.6875rem 1rem; /* 11px 16px */
137
+ --spacing-btn-small: 0.875rem 1.25rem; /* 14px 16px */
138
+ --spacing-btn-xsmall: 0.875rem 1rem; /* 14px 16px */
139
+ --spacing-btn: 0.875rem 1.5rem; /* 14px 24px */
140
+ --spacing-btn-large: 0.875rem 1.75rem; /* 14px 28px */
117
141
  --spacing-menu-row: 0.625rem 0.5rem 0.6875rem; /* 10px 8px 11px */
118
142
  --spacing-menu-row-snug: 0.4375rem 0.5rem 0.375rem; /* 7px 8px 6px */
119
143
  --spacing-menu-row-title: 0.6875rem 0.5rem; /* 11px 8px */
120
144
  --spacing-media: 0.5rem; /* 8px */
121
145
  --spacing-input: 0.8125rem 1rem 0.75rem; /* 13px 16px 12px */
122
146
  --spacing-overline: 0.6875rem 0; /* 11px 0 */
147
+ --spacing-chip-xsmall: 0.375rem 0.5rem; /* 6px 8px */
148
+ --spacing-chip-small: 0.5rem 0.75rem; /* 8px 12px */
149
+ --spacing-chip: 0.75rem 1rem; /* 6px 8px */
150
+ --spacing-chip-large: 1rem 1.25rem; /* 16px 20px */
123
151
 
124
152
  /* In components, when looking at implementing viewport margin and spacing between elements,
125
153
  the values in the comments can be used as guide as they represent the grid the elements (should) sit on.
@@ -145,8 +173,39 @@
145
173
  @apply hover:text-white hover:bg-active-orange;
146
174
  @apply active:text-white active:bg-red-orange;
147
175
  @apply focus:text-white focus:bg-cool-black focus:outline-gui-focus;
148
- @apply disabled:text-mid-grey disabled:bg-gui-unavailable;
176
+ @apply disabled:text-mid-grey disabled:bg-gui-unavailable disabled:cursor-not-allowed;
149
177
  @apply transition-colors;
178
+ @apply inline-flex items-center justify-center;
179
+ }
180
+
181
+ .ui-btn-alt {
182
+ transition: background-position 0.2s;
183
+ background: linear-gradient(
184
+ 61.2deg,
185
+ var(--color-active-orange) 5%,
186
+ #fe5215 19%,
187
+ #fc4a13 27%,
188
+ #f73c10 33%,
189
+ #f1280a 39%,
190
+ #e90f04 44%,
191
+ var(--color-red-orange) 50%
192
+ );
193
+ background-size: 200% 100%;
194
+ background-position: 0% 0%;
195
+
196
+ @apply text-white text-btn2 font-sans font-medium inline-block rounded p-btn;
197
+ @apply focus:outline-gui-focus;
198
+ @apply inline-flex items-center justify-center;
199
+ }
200
+
201
+ .ui-btn-alt:hover,
202
+ .ui-btn-alt:focus {
203
+ background-position: 100% 0%;
204
+ }
205
+
206
+ .ui-btn-alt:disabled {
207
+ background: linear-gradient(var(--gradient-transparent));
208
+ @apply bg-gui-unavailable text-mid-grey cursor-not-allowed;
150
209
  }
151
210
 
152
211
  .ui-btn-invert {
@@ -154,8 +213,9 @@
154
213
  @apply hover:text-white hover:bg-active-orange;
155
214
  @apply active:text-white active:bg-red-orange;
156
215
  @apply focus:text-white focus:bg-cool-black focus:outline-gui-focus;
157
- @apply disabled:text-mid-grey disabled:bg-gui-unavailable;
216
+ @apply disabled:text-mid-grey disabled:bg-gui-unavailable disabled:cursor-not-allowed;
158
217
  @apply transition-colors;
218
+ @apply inline-flex items-center justify-center;
159
219
  }
160
220
 
161
221
  .ui-btn-secondary {
@@ -163,8 +223,9 @@
163
223
  @apply hover:text-cool-black hover:border-active-orange hover:bg-white;
164
224
  @apply active:border-red-orange active:bg-white;
165
225
  @apply focus:border-cool-black focus:bg-white focus:outline-gui-focus;
166
- @apply disabled:text-gui-unavailable disabled:border-gui-unavailable disabled:bg-white;
226
+ @apply disabled:text-gui-unavailable disabled:border-gui-unavailable disabled:bg-white disabled:cursor-not-allowed;
167
227
  @apply transition-colors;
228
+ @apply inline-flex items-center justify-center;
168
229
  }
169
230
 
170
231
  .ui-btn-secondary-invert {
@@ -172,9 +233,63 @@
172
233
  @apply hover:text-white hover:border-active-orange;
173
234
  @apply active:border-red-orange;
174
235
  @apply focus:outline-gui-focus;
175
- @apply disabled:text-gui-unavailable disabled:border-gui-unavailable;
236
+ @apply disabled:text-gui-unavailable disabled:border-gui-unavailable disabled:cursor-not-allowed;
237
+ @apply transition-colors;
238
+ @apply inline-flex items-center justify-center;
239
+ }
240
+
241
+ .ui-btn-icon {
242
+ @apply w-24 h-24 mr-16;
243
+ }
244
+
245
+ .ui-btn-icon-small {
246
+ @apply w-20 h-20 mr-12;
247
+ }
248
+
249
+ .ui-btn-icon-xsmall {
250
+ @apply w-16 h-16 mr-8;
251
+ }
252
+
253
+ .ui-chip {
254
+ @apply text-btn3 p-chip rounded text-cool-black;
255
+ @apply hover:bg-mid-grey;
256
+ @apply active:bg-red-orange active:text-white;
257
+ @apply focus:bg-red-orange focus:text-white focus:outline-none;
258
+ @apply disabled:text-mid-grey disabled:bg-gui-unavailable disabled:cursor-not-allowed;
176
259
  @apply transition-colors;
177
260
  }
261
+
262
+ .ui-chip[data-selected] {
263
+ @apply bg-active-orange text-white;
264
+ }
265
+
266
+ .ui-chip[data-selected]:hover {
267
+ @apply bg-mid-grey text-cool-black;
268
+ }
269
+
270
+ .ui-chip[data-selected]:focus {
271
+ @apply bg-red-orange text-white;
272
+ }
273
+
274
+ .ui-chip-alt {
275
+ @apply text-btn3 p-chip rounded text-white;
276
+ @apply hover:bg-gui-hover;
277
+ @apply active:bg-gui-active active:text-white;
278
+ @apply focus:bg-gui-active focus:text-white focus:outline-none;
279
+ @apply disabled:text-mid-grey disabled:bg-gui-unavailable disabled:cursor-not-allowed;
280
+ @apply transition-colors;
281
+ }
282
+
283
+ .ui-chip-alt[data-selected] {
284
+ @apply bg-dark-grey text-white;
285
+ }
286
+ .ui-chip-alt[data-selected]:hover {
287
+ @apply bg-gui-hover text-white;
288
+ }
289
+
290
+ .ui-chip-alt[data-selected]:focus {
291
+ @apply bg-gui-active text-white;
292
+ }
178
293
  }
179
294
  @layer components {
180
295
  .ui-standard-container {
@@ -209,7 +324,7 @@
209
324
  .ui-text-h2 {
210
325
  @apply font-sans font-medium text-cool-black;
211
326
  @apply text-h2-xs xs:text-h2 xl:text-h2-xl;
212
- @apply tracking-tighten-0.01;
327
+ @apply tracking-tighten-0.005;
213
328
  }
214
329
 
215
330
  .ui-text-h3 {
@@ -283,6 +398,119 @@
283
398
  @apply font-sans font-light text-cool-black;
284
399
  @apply text-menu3;
285
400
  }
401
+
402
+ .ui-text-code1 {
403
+ @apply font-mono font-normal text-code1;
404
+ }
405
+
406
+ .ui-text-code2 {
407
+ @apply font-mono font-normal text-code2;
408
+ }
409
+
410
+ .ui-unordered-list {
411
+ @apply text-p1 font-light text-cool-black;
412
+ @apply list-disc ml-32 mb-24;
413
+ }
414
+
415
+ .ui-unordered-list ul {
416
+ @apply ml-24 mt-16 list-circle;
417
+ }
418
+
419
+ .ui-unordered-list ul ul {
420
+ @apply list-square;
421
+ }
422
+
423
+ .ui-unordered-list-with-emphasis {
424
+ @apply text-p1 font-light text-cool-black;
425
+ @apply list-disc ml-32 mt-32 -mb-12;
426
+ }
427
+
428
+ .ui-unordered-list-with-emphasis li div {
429
+ @apply relative -top-12;
430
+ }
431
+
432
+ .ui-unordered-list-with-emphasis li div > strong {
433
+ @apply block;
434
+ }
435
+
436
+ .ui-unordered-list-with-emphasis ul {
437
+ margin-top: calc(var(--spacing-16) + var(--spacing-8));
438
+ @apply ml-24 list-disc;
439
+ }
440
+
441
+ .ui-unordered-list-with-emphasis ul ul {
442
+ @apply list-circle;
443
+ }
444
+
445
+ /* visited needs to come before :hover et all else it overrides them */
446
+ .ui-link:visited {
447
+ @apply text-gui-viewed;
448
+ }
449
+
450
+ .ui-link {
451
+ @apply hover:text-active-orange active:text-red-orange;
452
+ -webkit-text-decoration-color: var(--color-active-orange);
453
+ text-decoration-color: var(--color-active-orange);
454
+ text-underline-offset: 4px; /* px used here as behaves weird with rem's */
455
+ -webkit-text-decoration-line: underline;
456
+ text-decoration-line: underline;
457
+ text-decoration-thickness: 0.125rem;
458
+ }
459
+
460
+ .ui-link:focus {
461
+ @apply focus:text-white focus:bg-active-orange focus:outline-none;
462
+ text-decoration: none;
463
+ }
464
+ }
465
+ @layer components {
466
+ .ui-checkbox-p1 {
467
+ @apply flex items-start mb-16 font-sans;
468
+ }
469
+
470
+ .ui-checkbox-p2 {
471
+ @apply flex items-start mb-12 font-sans;
472
+ }
473
+
474
+ .ui-checkbox-input {
475
+ @apply opacity-0 absolute h-20 w-20;
476
+ }
477
+
478
+ .ui-checkbox-styled {
479
+ @apply w-20 h-20 mr-16;
480
+ @apply bg-white flex flex-shrink-0 justify-center items-center;
481
+ @apply border border-dark-grey rounded-md focus-within:border-active-orange;
482
+ }
483
+
484
+ .ui-checkbox-styled-tick {
485
+ @apply hidden text-white;
486
+ }
487
+
488
+ .ui-checkbox-label-p1 {
489
+ @apply select-none;
490
+ @apply text-p1 font-light text-cool-black;
491
+ }
492
+
493
+ .ui-checkbox-label-p2 {
494
+ @apply select-none;
495
+ @apply text-p2 font-light text-cool-black;
496
+ }
497
+
498
+ .ui-checkbox-input:disabled + .ui-checkbox-styled {
499
+ @apply bg-gui-unavailable border;
500
+ }
501
+
502
+ .ui-checkbox-input:focus + .ui-checkbox-styled {
503
+ border-width: 0.125rem;
504
+ @apply border-gui-focus;
505
+ }
506
+
507
+ .ui-checkbox-input:checked + .ui-checkbox-styled {
508
+ @apply bg-active-orange border-dark-grey border;
509
+ }
510
+
511
+ .ui-checkbox-input:checked + .ui-checkbox-styled svg {
512
+ @apply block;
513
+ }
286
514
  }
287
515
  @layer components {
288
516
  .ui-input {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ably/ui",
3
- "version": "5.3.0",
3
+ "version": "6.0.1-dev.6103afe",
4
4
  "description": "Home of the Ably design system library ([design.ably.com](https://design.ably.com)). It provides a showcase, development/test environment and a publishing pipeline for different distributables.",
5
5
  "repository": {
6
6
  "type": "git",
package/src/.DS_Store ADDED
Binary file
Binary file
@@ -1,3 +1,3 @@
1
- <div class="hljs p-32 overflow-auto" data-id="code">
2
- <pre lang="<%= @language %>"><code class="font-mono language-<%= @language %>"><%= @snippet %></code></pre>
3
- </div>
1
+ <%= tag.div class: "hljs p-32 overflow-auto", data: { id: "code" } do %>
2
+ <%= tag.pre lang: @language do %><%= tag.code class: "language-#{@language} #{@text_size}" do %><%= @snippet %><% end %><% end %>
3
+ <% end %>
@@ -4,9 +4,9 @@ import T from "prop-types";
4
4
  import "./component.css";
5
5
  import { highlight } from "./component.js";
6
6
 
7
- const Code = ({ language, snippet }) => {
7
+ const Code = ({ language, snippet, textSize = "ui-text-code1" }) => {
8
8
  const HTMLraw = highlight(language, `${snippet}`.trim());
9
- const className = `font-mono language-${language}`;
9
+ const className = `language-${language} ${textSize}`;
10
10
  return (
11
11
  <div className="hljs p-32 overflow-auto" data-id="code">
12
12
  <pre lang={language}>
@@ -19,6 +19,7 @@ const Code = ({ language, snippet }) => {
19
19
  Code.propTypes = {
20
20
  language: T.string,
21
21
  snippet: T.string,
22
+ textSize: T.string,
22
23
  };
23
24
 
24
25
  export default Code;
@@ -2,9 +2,10 @@ module AblyUi
2
2
  module Core
3
3
  class Code < ViewComponent::Base
4
4
  include AblyUi::Core::Util
5
- def initialize(language:, snippet:)
5
+ def initialize(language:, snippet:, text_size: 'ui-text-code1')
6
6
  @language = language
7
7
  @snippet = snippet.try(:strip)
8
+ @text_size = text_size
8
9
  end
9
10
  end
10
11
  end
@@ -0,0 +1,45 @@
1
+ @layer components {
2
+ .ui-company-autocomplete-container {
3
+ @apply shadow-container absolute bg-white w-full z-10 font-sans;
4
+ }
5
+
6
+ .ui-company-autocomplete-list {
7
+ @apply border border-mid-grey border-t-0;
8
+ }
9
+
10
+ .ui-company-autocomplete-listitem {
11
+ @apply border-b border-mid-grey h-48;
12
+ }
13
+
14
+ .ui-company-autocomplete-btn {
15
+ @apply h-full w-full flex items-center py-4 px-12;
16
+ }
17
+
18
+ .ui-company-autocomplete-btn:focus {
19
+ @apply focus:text-gui-focus;
20
+ }
21
+
22
+ .ui-company-autocomplete-listitem:last-child {
23
+ @apply border-b-0;
24
+ }
25
+
26
+ .ui-company-autocomplete-listitem:hover {
27
+ @apply bg-light-grey cursor-pointer;
28
+ }
29
+
30
+ .ui-company-autocomplete-listitem:hover .ui-company-autocomplete-name {
31
+ @apply text-gui-hover;
32
+ }
33
+
34
+ .ui-company-autocomplete-logo {
35
+ @apply w-32;
36
+ }
37
+
38
+ .ui-company-autocomplete-name {
39
+ @apply font-sans font-light text-cool-black ml-8 text-p3 text-left;
40
+ }
41
+
42
+ .ui-company-autocomplete-domain {
43
+ @apply font-sans font-light text-dark-grey ml-auto text-p3;
44
+ }
45
+ }
@@ -0,0 +1,202 @@
1
+ import "./component.css";
2
+
3
+ import throttle from "lodash.throttle";
4
+
5
+ const COMPANY_AUTOCOMPLETE_DROPDOWN = "[data-id=company-autocomplete-dropdown]";
6
+
7
+ const getContainer = (input) =>
8
+ input.parentNode.querySelector(COMPANY_AUTOCOMPLETE_DROPDOWN);
9
+ const getItems = (container) =>
10
+ container ? container.querySelectorAll("li > button") : [];
11
+ const getFocusedItemIndex = (items) =>
12
+ Array.from(items).indexOf(document.activeElement);
13
+
14
+ const clearList = (input) => {
15
+ const container = getContainer(input);
16
+
17
+ if (container) {
18
+ container.classList.add("hidden");
19
+ container.querySelector("ol").innerHTML = "";
20
+ }
21
+ };
22
+
23
+ const renderItems = (data) =>
24
+ data.map((element) => {
25
+ const listItem = document.createElement("li");
26
+ listItem.classList.add("ui-company-autocomplete-listitem");
27
+
28
+ const btn = document.createElement("button");
29
+ btn.classList.add("ui-company-autocomplete-btn");
30
+ btn.dataset.name = element.name;
31
+
32
+ const logo = document.createElement("img");
33
+ logo.alt = `${element.name} logo`;
34
+ logo.src = element.logo;
35
+ logo.classList.add("ui-company-autocomplete-logo");
36
+
37
+ const name = document.createElement("p");
38
+ name.textContent = element.name;
39
+ name.classList.add("ui-company-autocomplete-name");
40
+
41
+ const domain = document.createElement("p");
42
+ domain.textContent = element.domain;
43
+ domain.classList.add("ui-company-autocomplete-domain");
44
+
45
+ btn.append(logo);
46
+ btn.append(name);
47
+ btn.append(domain);
48
+ listItem.append(btn);
49
+
50
+ return listItem;
51
+ });
52
+
53
+ const renderContainer = (input) => {
54
+ let container = getContainer(input);
55
+
56
+ if (!container) {
57
+ input.parentNode.style.position = "relative";
58
+
59
+ container = document.createElement("div");
60
+ container.dataset.id = "company-autocomplete-dropdown";
61
+ container.classList.add("ui-company-autocomplete-container");
62
+
63
+ const list = document.createElement("ol");
64
+ list.classList.add("ui-company-autocomplete-list");
65
+
66
+ return { container, list };
67
+ }
68
+
69
+ return { container, list: container.querySelector("ol") };
70
+ };
71
+
72
+ const renderDropdown = (input, data) => {
73
+ const parent = input.parentNode;
74
+ const { container, list } = renderContainer(input);
75
+ const items = renderItems(data);
76
+
77
+ clearList(input);
78
+
79
+ items.forEach((item, index) => {
80
+ list.append(item);
81
+ item.addEventListener("click", (event) => {
82
+ input.value = data[index].name;
83
+ event.preventDefault();
84
+ });
85
+ });
86
+
87
+ container.append(list);
88
+ container.classList.remove("hidden");
89
+ parent.append(container);
90
+ };
91
+
92
+ const fetchData = async (url, query) => {
93
+ try {
94
+ if (!query) {
95
+ return [];
96
+ }
97
+
98
+ const res = await fetch(`${url}?query=${query}`);
99
+ const payload = await res.json();
100
+
101
+ return payload;
102
+ } catch (e) {
103
+ // eslint-disable-next-line no-console
104
+ console.error(e);
105
+ return [];
106
+ }
107
+ };
108
+
109
+ const handleDownArrow = (input, event) => {
110
+ const container = getContainer(input);
111
+ const items = getItems(container);
112
+ const focusedItemIndex = getFocusedItemIndex(items);
113
+
114
+ if (items.length === 0) {
115
+ return;
116
+ } else if (document.activeElement === input) {
117
+ items[0].focus();
118
+ } else if (focusedItemIndex >= 0 && focusedItemIndex < items.length - 1) {
119
+ items[focusedItemIndex + 1].focus();
120
+ }
121
+
122
+ event.preventDefault();
123
+ };
124
+
125
+ const handleUpArrow = (input, event) => {
126
+ const container = getContainer(input);
127
+ const items = getItems(container);
128
+ const focusedItemIndex = getFocusedItemIndex(items);
129
+
130
+ if (items.length === 0) {
131
+ return;
132
+ } else if (focusedItemIndex === 0) {
133
+ input.focus();
134
+ } else if (focusedItemIndex > 0) {
135
+ items[focusedItemIndex - 1].focus();
136
+ }
137
+
138
+ event.preventDefault();
139
+ };
140
+
141
+ const handleTab = (input, event) => {
142
+ const container = getContainer(input);
143
+ const items = getItems(container);
144
+ const focusedItemIndex = getFocusedItemIndex(items);
145
+
146
+ if (document.activeElement === input && event.shiftKey) {
147
+ clearList(input);
148
+ } else if (focusedItemIndex === items.length - 1) {
149
+ clearList(input);
150
+ }
151
+ };
152
+
153
+ const handleEnter = (input, event) => {
154
+ if (event.target.dataset.name) {
155
+ input.value = event.target.dataset.name;
156
+ clearList(input);
157
+ input.focus();
158
+ event.preventDefault();
159
+ }
160
+ };
161
+
162
+ const CompanyAutocomplete = (input, url) => {
163
+ if (!input || !url) return;
164
+
165
+ input.addEventListener(
166
+ "keyup",
167
+ throttle(
168
+ async (event) => {
169
+ if (["Enter", "Space", "Tab", "Escape"].includes(event.code)) return;
170
+
171
+ const query = event.target.value;
172
+ const data = await fetchData(url, query);
173
+
174
+ if (data && data.length > 0) {
175
+ renderDropdown(input, data);
176
+ }
177
+ },
178
+ 100,
179
+ { trailing: true }
180
+ )
181
+ );
182
+
183
+ input.parentNode.addEventListener("keydown", (event) => {
184
+ if (event.code === "ArrowDown") {
185
+ handleDownArrow(input, event);
186
+ } else if (event.code === "ArrowUp") {
187
+ handleUpArrow(input, event);
188
+ } else if (event.code === "Enter" || event.code === "Space") {
189
+ handleEnter(input, event);
190
+ } else if (event.code === "Tab") {
191
+ handleTab(input, event);
192
+ } else if (event.code === "Escape") {
193
+ clearList(input);
194
+ }
195
+ });
196
+
197
+ document.body.addEventListener("click", () => {
198
+ clearList(input);
199
+ });
200
+ };
201
+
202
+ export default CompanyAutocomplete;
@@ -1,7 +1,6 @@
1
1
  @layer components {
2
2
  .ui-featured-link {
3
- max-width: calc(100% - 1.25rem);
4
- @apply font-medium block;
3
+ @apply font-sans font-medium block;
5
4
  @apply text-gui-default hover:text-gui-hover focus:text-gui-focus focus:outline-gui-focus;
6
5
  }
7
6
 
@@ -1,4 +1,4 @@
1
- <%= link_to(@url, class: "ui-featured-link #{@text_size} #{@flush ? '' : 'py-8'}", style: "--featured-link-icon-size: var(#{@text_size.gsub("text", "--fs")})") do %>
1
+ <%= link_to(@url, class: "ui-featured-link #{@text_size} #{@flush ? '' : 'py-8'} #{@additional_css}", style: "--featured-link-icon-size: var(#{@text_size.gsub("text", "--fs")})") do %>
2
2
  <%= content -%><%= render(AblyUi::Core::Icon.new(name: "icon-gui-link-arrow",
3
3
  size: "calc(var(--featured-link-icon-size) * 1.25)",
4
4
  color: @icon_color,
@@ -5,12 +5,14 @@ module AblyUi
5
5
  url:,
6
6
  text_size: 'text-menu3',
7
7
  icon_color: 'text-cool-black',
8
- flush: false
8
+ flush: false,
9
+ additional_css: ''
9
10
  )
10
11
  @url = url
11
12
  @text_size = text_size
12
13
  @icon_color = icon_color
13
14
  @flush = flush
15
+ @additional_css = additional_css
14
16
  end
15
17
  end
16
18
  end
Binary file
@@ -0,0 +1,3 @@
1
+ <svg width="48" height="48" viewBox="0 0 48 48" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M23.9975 1.25001L24 1.25C30.2947 1.25 34.8666 5.48148 36.9677 11.5435C39.9369 11.7908 42.5707 12.9175 44.499 14.8032C46.5441 16.8032 47.75 19.6133 47.75 23C47.75 26.4402 46.5053 29.2339 44.403 31.1816C42.3094 33.1213 39.4195 34.1729 36.2009 34.2498L36.183 34.25H36C34.2051 34.25 32.75 35.7051 32.75 37.5V41.5C32.75 41.538 32.7472 41.5754 32.7417 41.6119C33.7603 41.9279 34.5 42.8775 34.5 44C34.5 45.3807 33.3807 46.5 32 46.5C30.6193 46.5 29.5 45.3807 29.5 44C29.5 42.8775 30.2397 41.9279 31.2583 41.6119C31.2528 41.5754 31.25 41.538 31.25 41.5V37.5C31.25 34.8766 33.3766 32.75 36 32.75H36.1739C39.0895 32.6786 41.6049 31.7291 43.3835 30.0813C45.1552 28.44 46.25 26.0569 46.25 23C46.25 19.9872 45.1862 17.5733 43.4502 15.8757C41.7085 14.1724 39.2446 13.1467 36.3792 13.0077C36.0667 12.9926 35.7964 12.7851 35.7011 12.4871C33.8169 6.59587 29.6288 2.75057 24.0012 2.75C16.999 2.77388 13.4625 5.84333 11.6103 9.01639C9.90907 11.9307 9.59656 14.9789 9.47898 16.1258C9.46599 16.2525 9.45537 16.356 9.44553 16.4335C9.40186 16.7776 9.1279 17.0469 8.78309 17.0846C4.68819 17.5327 1.75 20.5577 1.75 25C1.75 27.3994 2.61404 29.3228 4.00756 30.6484C5.40559 31.9784 7.38279 32.75 9.678 32.75H12C14.6234 32.75 16.75 34.8766 16.75 37.5V41.5C16.75 41.538 16.7472 41.5754 16.7417 41.6119C17.7603 41.9279 18.5 42.8775 18.5 44C18.5 45.3807 17.3807 46.5 16 46.5C14.6193 46.5 13.5 45.3807 13.5 44C13.5 42.8775 14.2397 41.9279 15.2583 41.6119C15.2528 41.5754 15.25 41.538 15.25 41.5V37.5C15.25 35.7051 13.7949 34.25 12 34.25H9.678C7.04421 34.25 4.68241 33.3607 2.97369 31.7352C1.26046 30.1054 0.25 27.7788 0.25 25C0.25 19.9901 3.49532 16.4323 8.01664 15.6768C8.15873 14.3389 8.57927 11.2334 10.3148 8.2602C12.4266 4.6425 16.4461 1.27535 23.9975 1.25001ZM24 32.75C24.4142 32.75 24.75 33.0858 24.75 33.5V41.6145C25.7643 41.933 26.5 42.8806 26.5 44C26.5 45.3807 25.3807 46.5 24 46.5C22.6193 46.5 21.5 45.3807 21.5 44C21.5 42.8806 22.2357 41.933 23.25 41.6145V33.5C23.25 33.0858 23.5858 32.75 24 32.75ZM14.5 44C14.5 43.1716 15.1716 42.5 16 42.5C16.8284 42.5 17.5 43.1716 17.5 44C17.5 44.8284 16.8284 45.5 16 45.5C15.1716 45.5 14.5 44.8284 14.5 44ZM32 42.5C31.1716 42.5 30.5 43.1716 30.5 44C30.5 44.8284 31.1716 45.5 32 45.5C32.8284 45.5 33.5 44.8284 33.5 44C33.5 43.1716 32.8284 42.5 32 42.5ZM22.5 44C22.5 43.1716 23.1716 42.5 24 42.5C24.8284 42.5 25.5 43.1716 25.5 44C25.5 44.8284 24.8284 45.5 24 45.5C23.1716 45.5 22.5 44.8284 22.5 44ZM17 17.75C14.1005 17.75 11.75 20.1005 11.75 23C11.75 25.8995 14.1005 28.25 17 28.25C18.9423 28.25 20.6392 27.1956 21.5481 25.6245L21.6444 25.458L24.1049 23.968C24.9592 23.4507 26.0267 23.4372 26.8938 23.9326L28.3798 24.7818C28.7641 25.0014 29.2359 25.0014 29.6202 24.7818L31.1356 23.9158C31.9811 23.4327 33.0189 23.4327 33.8644 23.9158L34.9166 24.5171C35.4428 24.8178 36.109 24.6977 36.497 24.232L37.3904 23.16C37.4676 23.0673 37.4676 22.9327 37.3903 22.84L35.7237 20.84C35.6762 20.783 35.6058 20.75 35.5316 20.75H21.7647L21.5481 20.3755C20.6392 18.8044 18.9423 17.75 17 17.75ZM10.25 23C10.25 19.2721 13.2721 16.25 17 16.25C19.3413 16.25 21.4033 17.4424 22.6132 19.25H35.5316C36.051 19.25 36.5435 19.4807 36.876 19.8797L38.5427 21.8797C39.0835 22.5287 39.0835 23.4713 38.5427 24.1203L37.6494 25.1923C36.7957 26.2167 35.3301 26.481 34.1724 25.8195L33.1202 25.2182C32.7359 24.9986 32.2641 24.9986 31.8798 25.2182L30.3644 26.0842C29.5189 26.5673 28.4811 26.5673 27.6356 26.0842L26.1496 25.235C25.7555 25.0098 25.2702 25.0159 24.8819 25.2511L22.7451 26.5451C21.5568 28.467 19.4287 29.75 17 29.75C13.2721 29.75 10.25 26.7279 10.25 23ZM14.5 23C14.5 22.4477 14.9477 22 15.5 22C16.0523 22 16.5 22.4477 16.5 23C16.5 23.5523 16.0523 24 15.5 24C14.9477 24 14.5 23.5523 14.5 23ZM15.5 21C14.3954 21 13.5 21.8954 13.5 23C13.5 24.1046 14.3954 25 15.5 25C16.6046 25 17.5 24.1046 17.5 23C17.5 21.8954 16.6046 21 15.5 21Z" fill="#03020D"/>
3
+ </svg>
@@ -0,0 +1,3 @@
1
+ <svg width="48" height="48" viewBox="0 0 48 48" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M22.9305 1.25L22.928 1.25001C19.1663 1.26263 16.3209 2.16727 14.179 3.58598C12.0396 5.00308 10.6518 6.89994 9.74914 8.81907C8.26167 11.9815 8.06171 15.3211 7.9923 16.6843C3.42863 17.5061 0 21.7056 0 26.6695C0 32.2864 4.35972 36.25 9.678 36.25C10.0922 36.25 10.428 35.9142 10.428 35.5C10.428 35.0858 10.0922 34.75 9.678 34.75C5.13828 34.75 1.5 31.409 1.5 26.6695C1.5 22.1862 4.72837 18.5284 8.78309 18.0846C9.1279 18.0469 9.40186 17.7776 9.44553 17.4335C9.46441 17.2847 9.47723 17.0562 9.49373 16.7619C9.57379 15.3345 9.7405 12.3616 11.1065 9.45752C11.9185 7.73117 13.1435 6.0711 15.0074 4.83653C16.8686 3.60372 19.4169 2.762 22.9317 2.75C28.6269 2.75058 33.8404 6.66921 35.7011 12.4871C35.7964 12.7851 36.0667 12.9926 36.3792 13.0077C41.9981 13.2802 46.5 18.103 46.5 24.1293C46.5 30.207 41.9083 34.6131 36.1651 34.7502C35.751 34.7601 35.4233 35.1038 35.4332 35.5179C35.4431 35.932 35.7868 36.2597 36.2009 36.2498C42.7337 36.0938 48 31.0459 48 24.1293C48 17.5374 43.19 12.1193 36.9665 11.5457C34.791 5.41533 29.1621 1.25 22.9305 1.25ZM33 26.5H13C12.1716 26.5 11.5 27.1716 11.5 28V32C11.5 32.8284 12.1716 33.5 13 33.5H33C33.8284 33.5 34.5 32.8284 34.5 32V28C34.5 27.1716 33.8284 26.5 33 26.5ZM13 25C11.3431 25 10 26.3431 10 28V32C10 33.6569 11.3431 35 13 35H33C34.6569 35 36 33.6569 36 32V28C36 26.3431 34.6569 25 33 25H13ZM14 27.75C14.4142 27.75 14.75 28.0858 14.75 28.5V31.5C14.75 31.9142 14.4142 32.25 14 32.25C13.5858 32.25 13.25 31.9142 13.25 31.5V28.5C13.25 28.0858 13.5858 27.75 14 27.75ZM17.25 28.5C17.25 28.0858 16.9142 27.75 16.5 27.75C16.0858 27.75 15.75 28.0858 15.75 28.5V31.5C15.75 31.9142 16.0858 32.25 16.5 32.25C16.9142 32.25 17.25 31.9142 17.25 31.5V28.5ZM33 30C33 30.5523 32.5523 31 32 31C31.4477 31 31 30.5523 31 30C31 29.4477 31.4477 29 32 29C32.5523 29 33 29.4477 33 30ZM29 31C29.5523 31 30 30.5523 30 30C30 29.4477 29.5523 29 29 29C28.4477 29 28 29.4477 28 30C28 30.5523 28.4477 31 29 31ZM33 37.5H13C12.1716 37.5 11.5 38.1716 11.5 39V43C11.5 43.8284 12.1716 44.5 13 44.5H33C33.8284 44.5 34.5 43.8284 34.5 43V39C34.5 38.1716 33.8284 37.5 33 37.5ZM13 36C11.3431 36 10 37.3431 10 39V43C10 44.6569 11.3431 46 13 46H33C34.6569 46 36 44.6569 36 43V39C36 37.3431 34.6569 36 33 36H13ZM14.75 39.5C14.75 39.0858 14.4142 38.75 14 38.75C13.5858 38.75 13.25 39.0858 13.25 39.5V42.5C13.25 42.9142 13.5858 43.25 14 43.25C14.4142 43.25 14.75 42.9142 14.75 42.5V39.5ZM16.5 38.75C16.9142 38.75 17.25 39.0858 17.25 39.5V42.5C17.25 42.9142 16.9142 43.25 16.5 43.25C16.0858 43.25 15.75 42.9142 15.75 42.5V39.5C15.75 39.0858 16.0858 38.75 16.5 38.75ZM32 42C32.5523 42 33 41.5523 33 41C33 40.4477 32.5523 40 32 40C31.4477 40 31 40.4477 31 41C31 41.5523 31.4477 42 32 42ZM30 41C30 41.5523 29.5523 42 29 42C28.4477 42 28 41.5523 28 41C28 40.4477 28.4477 40 29 40C29.5523 40 30 40.4477 30 41Z" fill="#03020D"/>
3
+ </svg>