@netlify/spark-ui 0.0.15 → 0.0.17

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,3 +1,3 @@
1
- import { ResultProps } from '../types/search.types';
2
- declare const SearchLink: ({ icon, label, url, excerpt }: ResultProps) => import("preact").JSX.Element;
1
+ import { SearchLinkProps } from '../types/search.types';
2
+ declare const SearchLink: ({ icon, label, url, excerpt }: SearchLinkProps) => import("preact").JSX.Element;
3
3
  export default SearchLink;
@@ -1,7 +1,7 @@
1
1
  import { ComponentChildren } from 'preact';
2
2
  interface Props {
3
3
  children: ComponentChildren;
4
- className: string;
4
+ className?: string;
5
5
  }
6
- declare function SearchModal(props: Props): import("preact").JSX.Element;
6
+ declare function SearchModal(props?: Props): import("preact").JSX.Element;
7
7
  export default SearchModal;
@@ -64,9 +64,9 @@ function k(t) {
64
64
  };
65
65
  }, [t]), a;
66
66
  }
67
- function W(t) {
68
- const { children: a, className: n, ...i } = t, { state: c, actions: e } = b(), [r, o] = v(!1), m = () => o(!0), l = () => o(!1), u = h(null), y = k(l);
69
- return j(m), g(e.setSearchTerm, m), E(r, m, l), w(u, r, l), S(() => {
67
+ function W(t = { className: "", children: null }) {
68
+ const { children: a, className: n, ...i } = t, { state: c, actions: e } = b(), [r, o] = v(!1), l = () => o(!0), m = () => o(!1), u = h(null), y = k(m);
69
+ return j(l), g(e.setSearchTerm, l), E(r, l, m), w(u, r, m), S(() => {
70
70
  u.current && (r ? u.current.showModal() : u.current.close());
71
71
  }, [r]), /* @__PURE__ */ s(N, { ref: u, className: M(n, "n-search-modal"), ...i, children: /* @__PURE__ */ s("div", { ref: y, className: "n-search-container", children: [
72
72
  /* @__PURE__ */ s("form", { className: "n-search-bar", children: /* @__PURE__ */ s(T, { setSearchTerm: e.setSearchTerm, initialValue: c.searchTerm }) }),
@@ -30,7 +30,7 @@ function y() {
30
30
  return {
31
31
  icon: S((u = a.meta) == null ? void 0 : u.content_type),
32
32
  content_type: (l = a.meta) == null ? void 0 : l.content_type,
33
- title: (m = a.meta) == null ? void 0 : m.title,
33
+ label: (m = a.meta) == null ? void 0 : m.title,
34
34
  url: a.url,
35
35
  excerpt: a.excerpt
36
36
  };
@@ -1,6 +1,6 @@
1
1
  import { ComponentChildren } from 'preact';
2
2
  import { IconName } from '../../Icon';
3
- export interface ResultProps {
3
+ export interface SearchLinkProps {
4
4
  icon: IconName;
5
5
  label: string;
6
6
  content_type?: string;
@@ -10,16 +10,16 @@ export interface ResultProps {
10
10
  export interface SearchWindowProps {
11
11
  searchLoading: boolean;
12
12
  searchTerm?: string;
13
- results?: ResultProps[];
13
+ results?: SearchLinkProps[];
14
14
  children: ComponentChildren;
15
15
  }
16
16
  export interface SearchResultsProps {
17
17
  searchLoading: boolean;
18
18
  searchTerm?: string;
19
- results?: ResultProps[];
19
+ results?: SearchLinkProps[];
20
20
  }
21
21
  export interface SearchState {
22
22
  searchTerm: string;
23
- results: ResultProps[];
23
+ results: SearchLinkProps[];
24
24
  isLoading: boolean;
25
25
  }
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.15",
4
+ "version": "0.0.17",
5
5
  "type": "module",
6
6
  "main": "dist/components/preact/index.js",
7
7
  "types": "dist/components/preact/index.d.ts",
@@ -1,8 +1,8 @@
1
- import type { ResultProps} from "../types/search.types"
1
+ import type { SearchLinkProps} from "../types/search.types"
2
2
 
3
3
  import Icon from '../../Icon';
4
4
 
5
- const SearchLink = ({ icon, label, url, excerpt }: ResultProps) => {
5
+ const SearchLink = ({ icon, label, url, excerpt }: SearchLinkProps) => {
6
6
  return (
7
7
  <a className="n-result-link" href={url}>
8
8
  <div className="n-result-header">
@@ -19,10 +19,10 @@ import './SearchModal.css';
19
19
 
20
20
  interface Props {
21
21
  children: ComponentChildren;
22
- className: string;
22
+ className?: string;
23
23
  }
24
24
 
25
- function SearchModal(props: Props) {
25
+ function SearchModal(props: Props = {className: '', children: null}) {
26
26
  const { children, className, ...rest } = props;
27
27
  const { state, actions } = useSearch();
28
28
  const [searchOpen, setSearchOpen] = useState(false);
@@ -1,5 +1,5 @@
1
1
  import type { FunctionComponent } from 'preact';
2
- import type { ResultProps, SearchResultsProps, SearchWindowProps } from '../types/search.types';
2
+ import type { SearchLinkProps, SearchResultsProps, SearchWindowProps } from '../types/search.types';
3
3
  import SearchHeading from './SearchHeading/SearchHeading';
4
4
  import SearchLink from './SearchLink';
5
5
 
@@ -43,7 +43,7 @@ export default function SearchWindow({
43
43
  results,
44
44
  children: DefaultWindow,
45
45
  }: SearchWindowProps) {
46
- const askNetlify: ResultProps = {
46
+ const askNetlify: SearchLinkProps = {
47
47
  icon: 'askNetlify',
48
48
  label: 'Ask Netlify AI',
49
49
  url: 'https://docs.netlify.com/ask-netlify/',
@@ -38,7 +38,7 @@ export function useSearch() {
38
38
  return {
39
39
  icon: getSiteIcon(data.meta?.content_type),
40
40
  content_type: data.meta?.content_type,
41
- title: data.meta?.title,
41
+ label: data.meta?.title,
42
42
  url: data.url,
43
43
  excerpt: data.excerpt,
44
44
  };
@@ -1,7 +1,7 @@
1
1
  import type { ComponentChildren } from 'preact';
2
2
  import type { IconName } from '../../Icon';
3
3
 
4
- export interface ResultProps {
4
+ export interface SearchLinkProps {
5
5
  icon: IconName;
6
6
  label: string;
7
7
  content_type?: string;
@@ -12,18 +12,18 @@ export interface ResultProps {
12
12
  export interface SearchWindowProps {
13
13
  searchLoading: boolean;
14
14
  searchTerm?: string;
15
- results?: ResultProps[];
15
+ results?: SearchLinkProps[];
16
16
  children: ComponentChildren;
17
17
  }
18
18
 
19
19
  export interface SearchResultsProps {
20
20
  searchLoading: boolean;
21
21
  searchTerm?: string;
22
- results?: ResultProps[];
22
+ results?: SearchLinkProps[];
23
23
  }
24
24
 
25
25
  export interface SearchState {
26
26
  searchTerm: string;
27
- results: ResultProps[];
27
+ results: SearchLinkProps[];
28
28
  isLoading: boolean;
29
29
  }