@netlify/spark-ui 1.14.5 → 1.15.0

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.
@@ -4137,7 +4137,7 @@ function is({ setModalState: e, searchQuery: a, urlParamQuery: t }) {
4137
4137
  return se(() => {
4138
4138
  r && l.current && (l.current.scrollIntoView({ behavior: "smooth" }), o(!1));
4139
4139
  }, [r]), se(() => {
4140
- a && (i && n(""), p(a.trim()), o(!0));
4140
+ a && (n(""), p(a.trim()), o(!0));
4141
4141
  }, [a, n, o]), se(() => {
4142
4142
  !a && t && n(t);
4143
4143
  }, [t, a, n]), /* @__PURE__ */ O("div", { className: "n-ask-chat-container", children: [
@@ -1,6 +1,6 @@
1
1
  import "../../../chunks/jsxRuntime.module.Bzuv3cXw.js";
2
2
  import "../../../chunks/hooks.module.DGkdD5n9.js";
3
- import { A as d } from "../../../chunks/AskNetlify.5UxkBfoE.js";
3
+ import { A as d } from "../../../chunks/AskNetlify.xyk4QsqP.js";
4
4
  import "./components/QuestionList/questions.js";
5
5
  import "./components/QuestionList/QuestionList.js";
6
6
  import "./components/BackButton.js";
@@ -1,6 +1,6 @@
1
1
  import { u as e } from "../../../../../chunks/jsxRuntime.module.Bzuv3cXw.js";
2
2
  import { A as g, y as f, d } from "../../../../../chunks/hooks.module.DGkdD5n9.js";
3
- import { A as K, K as L } from "../../../../../chunks/AskNetlify.5UxkBfoE.js";
3
+ import { A as K, K as L } from "../../../../../chunks/AskNetlify.xyk4QsqP.js";
4
4
  import P from "../../../Modal/Modal.js";
5
5
  import h from "../../../KeyboardKey/KeyboardKey.js";
6
6
  import M from "../SearchWindow.js";
@@ -1,24 +1,24 @@
1
- import { d as h, y as t } from "../../../../chunks/hooks.module.DGkdD5n9.js";
2
- function l(r, a, c, s) {
3
- const [i, d] = h(!1);
4
- t(() => {
5
- let n;
6
- const e = () => {
7
- window.pagefind && (d(!0), n && clearInterval(n));
1
+ import { d as u, y as g } from "../../../../chunks/hooks.module.DGkdD5n9.js";
2
+ function m(a, c, i, r) {
3
+ const [o, h] = u(!1);
4
+ g(() => {
5
+ let e;
6
+ const s = () => {
7
+ window.pagefind && (h(!0), e && clearInterval(e));
8
8
  };
9
- return e(), n = setInterval(e, 100), () => clearInterval(n);
10
- }, []), t(() => {
11
- if (typeof location > "u" || i) return;
12
- const n = new URLSearchParams(location.search), e = n.has("ask"), f = n.get("msg") || n.get("message"), o = n.get("search"), u = (g) => {
13
- g && c(g), s == null || s({ current: "ask" }), r();
14
- };
15
- if (e || f) {
16
- u(f);
9
+ return s(), e = setInterval(s, 100), () => clearInterval(e);
10
+ }, []), g(() => {
11
+ if (typeof location > "u" || o) return;
12
+ const e = new URLSearchParams(location.search), s = e.has("ask"), n = e.get("msg") || e.get("message"), f = e.get("search"), t = new URL(location.href);
13
+ if (["ask", "msg", "message", "search"].forEach((d) => {
14
+ t.searchParams.delete(d);
15
+ }), window.history.replaceState({}, "", t), s || n) {
16
+ n && i(n), r == null || r({ current: "ask" }), a();
17
17
  return;
18
18
  }
19
- o && (a(o), r());
20
- }, [i, r, s, a, c]);
19
+ f && (c(f), a());
20
+ }, [o, a, r, c, i]);
21
21
  }
22
22
  export {
23
- l as useSearchParams
23
+ m as useSearchParams
24
24
  };
@@ -4,7 +4,7 @@ import { default as m } from "./Icon/index.js";
4
4
  import { default as s } from "./SearchModal/components/SearchLink/SearchLink.js";
5
5
  import { default as u } from "./SearchModal/components/SearchHeading/SearchHeading.js";
6
6
  import { default as i } from "./SearchModal/components/SearchToggle/SearchToggle.js";
7
- import { A as S } from "../../chunks/AskNetlify.5UxkBfoE.js";
7
+ import { A as S } from "../../chunks/AskNetlify.xyk4QsqP.js";
8
8
  import "preact";
9
9
  import "../../chunks/hooks.module.DGkdD5n9.js";
10
10
  import { default as n } from "./SearchModal/components/SearchModal/SearchModal.js";
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": "1.14.5",
4
+ "version": "1.15.0",
5
5
  "type": "module",
6
6
  "main": "dist/components/preact/index.js",
7
7
  "types": "dist/components/preact/index.d.ts",
@@ -0,0 +1,32 @@
1
+ ---
2
+ import HeadingBlock from './HeadingBlock.astro';
3
+ import PageSection from './PageSection.astro';
4
+
5
+ const { class: className, heading, text, ctas, ...rest } = Astro.props;
6
+ ---
7
+
8
+ <PageSection class:list={['n-page-hero-graphic', className]} {...rest}>
9
+ <div class="n-page-hero-graphic-container n-flex-grid">
10
+ <HeadingBlock heading={heading} headingLevel="1" text={text} alignment="start" ctas={ctas} />
11
+ <slot name="graphic" />
12
+ </div>
13
+ <slot />
14
+ </PageSection>
15
+
16
+ <style>
17
+ .n-page-hero {
18
+ --n-page-section-space: var(--space-4xl);
19
+ --n-page-section-bg-color: var(
20
+ --n-page-section-bg,
21
+ linear-gradient(to bottom, var(--color-bg) 50%, var(--teal-800))
22
+ );
23
+ --n-heading-block-heading-font-size: var(--font-size-display-3xl);
24
+ --n-heading-block-text-font-size: var(--font-size-text-xl);
25
+ }
26
+
27
+ .n-page-hero-graphic-container {
28
+ --n-grid-column-min-size: var(--n--column-min-size, min(400px, 100%));
29
+ align-items: var(--n-hero-align, center);
30
+ grid-column-gap: var(--n-hero-column-gap, var(--space-l));
31
+ }
32
+ </style>
@@ -53,7 +53,7 @@ export default function AskNetlify({ setModalState, searchQuery, urlParamQuery }
53
53
 
54
54
  useEffect(() => {
55
55
  if (searchQuery) {
56
- message && setMessage('');
56
+ setMessage('');
57
57
  submitQuery(searchQuery.trim());
58
58
  setNewMessageReady(true);
59
59
  }
@@ -54,14 +54,17 @@ export function useSearchParams(
54
54
  const msg = params.get('msg') || params.get('message');
55
55
  const search = params.get('search');
56
56
 
57
- const openAskModal = (term?: string | null) => {
58
- if (term) setUrlParamTerm(term);
59
- setModalState?.({ current: 'ask' });
60
- onOpen();
61
- };
57
+ // Remove params from window URL
58
+ const url = new URL(location.href);
59
+ ['ask', 'msg', 'message', 'search'].forEach(param => {
60
+ url.searchParams.delete(param);
61
+ });
62
+ window.history.replaceState({}, '', url);
62
63
 
63
64
  if (hasAsk || msg) {
64
- openAskModal(msg);
65
+ msg && setUrlParamTerm(msg);
66
+ setModalState?.({ current: 'ask' });
67
+ onOpen();
65
68
  return;
66
69
  }
67
70