@netlify/spark-ui 0.0.34 → 0.0.35

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.
@@ -1,8 +1,8 @@
1
- import { A as u, y as p, d as S } from "../../../../chunks/hooks.module.BFfOesdf.js";
2
- import { getSiteIcon as w } from "../utils/index.js";
3
- function T(s, r) {
1
+ import { A as u, y as w, d as T } from "../../../../chunks/hooks.module.BFfOesdf.js";
2
+ import { getSiteIcon as L } from "../utils/index.js";
3
+ function b(s, r) {
4
4
  const t = u(null), c = u("");
5
- return p(() => () => {
5
+ return w(() => () => {
6
6
  t.current && clearTimeout(t.current);
7
7
  }, []), { reset: () => {
8
8
  t.current && clearTimeout(t.current);
@@ -13,12 +13,12 @@ function T(s, r) {
13
13
  );
14
14
  } };
15
15
  }
16
- function x() {
17
- const [s, r] = S({
16
+ function _() {
17
+ const [s, r] = T({
18
18
  searchTerm: "",
19
19
  results: [],
20
20
  isLoading: !1
21
- }), t = u(/* @__PURE__ */ new Map()), { reset: c, run: l } = T((e) => {
21
+ }), t = u(/* @__PURE__ */ new Map()), { reset: c, run: l } = b((e) => {
22
22
  (e.length > 2 || e.length === 0) && o(e);
23
23
  }, 150), o = async (e) => {
24
24
  if (!(window != null && window.pagefind)) return;
@@ -30,22 +30,22 @@ function x() {
30
30
  }));
31
31
  return;
32
32
  }
33
- const i = await window.pagefind.debouncedSearch(e), g = await Promise.all(
33
+ const i = await window.pagefind.debouncedSearch(e), p = await Promise.all(
34
34
  i.results.slice(0, 15).map(async (n) => {
35
35
  var m, f, d;
36
- const a = await n.data();
36
+ const a = await n.data(), g = (S) => S.replace("#", "");
37
37
  return {
38
- icon: w((m = a.meta) == null ? void 0 : m.content_type),
38
+ icon: L((m = a.meta) == null ? void 0 : m.content_type),
39
39
  content_type: (f = a.meta) == null ? void 0 : f.content_type,
40
40
  label: (d = a.meta) == null ? void 0 : d.title,
41
41
  url: a.url,
42
- excerpt: a.excerpt
42
+ excerpt: g(a.excerpt)
43
43
  };
44
44
  })
45
45
  );
46
46
  r((n) => ({
47
47
  ...n,
48
- results: g,
48
+ results: p,
49
49
  isLoading: !1
50
50
  }));
51
51
  };
@@ -60,5 +60,5 @@ function x() {
60
60
  };
61
61
  }
62
62
  export {
63
- x as useSearch
63
+ _ as useSearch
64
64
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@netlify/spark-ui",
3
3
  "description": "Assets, design tokens, components, and utilities",
4
- "version": "0.0.34",
4
+ "version": "0.0.35",
5
5
  "type": "module",
6
6
  "main": "dist/components/preact/index.js",
7
7
  "types": "dist/components/preact/index.d.ts",
@@ -7,14 +7,14 @@ interface Props {
7
7
  const { id, class: className, ...rest } = Astro.props;
8
8
  ---
9
9
 
10
- <x-tabs id={id} class={className} {...rest}>
10
+ <n-tabs id={id} class={className} {...rest}>
11
11
  <slot />
12
- </x-tabs>
12
+ </n-tabs>
13
13
 
14
14
  <script>
15
15
  /**
16
16
  * Slightly altered version of another tabs component
17
- * Adds "tabs-change" event that includes selected tab info
17
+ * Adds "tabs-change" event that returns selected tab info
18
18
  * {@link https://www.mayank.co/blog/tabs}
19
19
  */
20
20
  class Tabs extends HTMLElement {
@@ -102,5 +102,5 @@ const { id, class: className, ...rest } = Astro.props;
102
102
  }
103
103
  }
104
104
 
105
- customElements.define('x-tabs', Tabs);
105
+ customElements.define('n-tabs', Tabs);
106
106
  </script>
@@ -44,12 +44,14 @@ export function useSearch() {
44
44
  const results = await Promise.all(
45
45
  search.results.slice(0, 15).map(async (result: any) => {
46
46
  const data = await result.data();
47
+ const removeAnchorLink = (text: string) => text.replace("#", '')
48
+
47
49
  return {
48
50
  icon: getSiteIcon(data.meta?.content_type),
49
51
  content_type: data.meta?.content_type,
50
52
  label: data.meta?.title,
51
53
  url: data.url,
52
- excerpt: data.excerpt,
54
+ excerpt: removeAnchorLink(data.excerpt),
53
55
  };
54
56
  })
55
57
  );
@@ -16,20 +16,25 @@ button,
16
16
  border: 1px solid var(--color-border);
17
17
  border-radius: var(--radius-m);
18
18
 
19
- /* Button press */
20
- &:active:not(:disabled) {
21
- top: 1px;
22
- }
23
-
24
19
  /* Button icons */
25
20
  svg {
26
21
  flex: none;
27
22
  height: var(--button-icon-size, 1.2cap);
28
23
  width: auto;
29
24
  }
30
- }
31
25
 
32
- :where(button, .button) {
26
+ /* Button states */
27
+ &:active:not(:disabled) {
28
+ top: 1px;
29
+ }
30
+
31
+ &:disabled {
32
+ color: var(--color-disabled-bg);
33
+ background-color: var(--color-disabled-bg);
34
+ border-color: var(--color-disabled-bg);
35
+ }
36
+
37
+ /* Button variants */
33
38
  &[data-button-variant='primary'] {
34
39
  color: var(--color-text-inverse);
35
40
  background-color: var(--color-brand);
@@ -40,4 +45,16 @@ button,
40
45
  background-color: var(--color-brand-alt);
41
46
  border-color: var(--color-brand-alt);
42
47
  }
48
+
49
+ &[data-button-variant='text'] {
50
+ color: currentColor;
51
+ background-color: transparent;
52
+ border-color: transparent;
53
+ }
54
+
55
+ &[data-button-variant='ghost'] {
56
+ color: currentColor;
57
+ background-color: transparent;
58
+ border-color: currentColor;
59
+ }
43
60
  }
@@ -1,16 +1,26 @@
1
- [role='tablist'] {
1
+ .tabs [role='tablist'] {
2
2
  display: flex;
3
- gap: 2rem;
3
+ isolation: isolate;
4
+ border: var(--_border);
4
5
  }
5
6
 
6
- [role='tab'] {
7
- border-bottom: 2px solid transparent;
7
+ .tabs [role='tab'] {
8
+ position: relative;
9
+ border-color: transparent;
8
10
 
9
- &[aria-selected='true'] {
10
- border-color: var(--color-border);
11
+ /* Remove button push/click style */
12
+ &:active:not(:disabled) {
13
+ top: unset;
11
14
  }
12
15
  }
13
16
 
14
- [role='tabpanel'] {
15
- margin-block-start: 1rem;
17
+ .tabs [role='tab'][aria-selected='true'] {
18
+ /* Bring selected tab to layer above others to avoid clipping outline styles */
19
+ z-index: 1;
20
+ }
21
+
22
+ .tabs [role='tabpanel'] {
23
+ border: var(--_border);
24
+ border-block-start: unset;
25
+ padding: var(--_padding);
16
26
  }
@@ -16,6 +16,7 @@
16
16
  --color-bg-1: var(--neutral-000);
17
17
  --color-bg-2: var(--neutral-100);
18
18
  --color-bg-3: var(--neutral-200);
19
+ --color-border: var(--neutral-200);
19
20
  --color-brand: var(--blue-700);
20
21
  --color-disabled-bg: var(--neutral-200);
21
22
  --color-disabled-border: var(--neutral-400);
@@ -146,6 +147,7 @@
146
147
  --color-bg-1: var(--neutral-000);
147
148
  --color-bg-2: var(--neutral-100);
148
149
  --color-bg-3: var(--neutral-200);
150
+ --color-border: var(--neutral-200);
149
151
  --color-brand: var(--blue-700);
150
152
  --color-disabled-bg: var(--neutral-200);
151
153
  --color-disabled-border: var(--neutral-400);
@@ -180,6 +182,7 @@
180
182
  --color-bg-1: var(--neutral-000);
181
183
  --color-bg-2: var(--neutral-100);
182
184
  --color-bg-3: var(--neutral-200);
185
+ --color-border: var(--neutral-200);
183
186
  --color-brand: var(--blue-700);
184
187
  --color-disabled-bg: var(--neutral-200);
185
188
  --color-disabled-border: var(--neutral-400);
@@ -214,6 +217,7 @@
214
217
  --color-bg-1: var(--neutral-800);
215
218
  --color-bg-2: var(--neutral-700);
216
219
  --color-bg-3: var(--neutral-600);
220
+ --color-border: var(--neutral-200);
217
221
  --color-brand: var(--teal-200);
218
222
  --color-disabled-bg: var(--neutral-600);
219
223
  --color-disabled-border: var(--neutral-400);
@@ -248,6 +252,7 @@
248
252
  --color-bg-1: var(--neutral-800);
249
253
  --color-bg-2: var(--neutral-700);
250
254
  --color-bg-3: var(--neutral-600);
255
+ --color-border: var(--neutral-200);
251
256
  --color-brand: var(--teal-200);
252
257
  --color-disabled-bg: var(--neutral-600);
253
258
  --color-disabled-border: var(--neutral-400);