@netlify/spark-ui 1.12.4 → 1.13.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.
@@ -1,10 +1,11 @@
1
1
  import "../../../chunks/jsxRuntime.module.Bzuv3cXw.js";
2
2
  import "../../../chunks/hooks.module.DGkdD5n9.js";
3
- import { A as f } from "../../../chunks/AskNetlify.1ejGUA_O.js";
3
+ import { A as d } from "../../../chunks/AskNetlify.CNYCiNSp.js";
4
4
  import "./components/QuestionList/questions.js";
5
5
  import "./components/QuestionList/QuestionList.js";
6
6
  import "./components/BackButton.js";
7
7
  import "./components/ChatMessages.js";
8
+ import "../Popover/Popover.js";
8
9
  export {
9
- f as default
10
+ d as default
10
11
  };
@@ -0,0 +1,10 @@
1
+ import { FunctionComponent } from 'preact';
2
+ interface Props {
3
+ id?: string;
4
+ content: string;
5
+ position?: 'top' | 'bottom' | 'left' | 'right';
6
+ class?: string;
7
+ children: preact.ComponentChildren;
8
+ }
9
+ declare const Popover: FunctionComponent<Props>;
10
+ export default Popover;
@@ -0,0 +1,27 @@
1
+ import { u as r } from "../../../chunks/jsxRuntime.module.Bzuv3cXw.js";
2
+ import { g as a } from "../../../chunks/hooks.module.DGkdD5n9.js";
3
+ import '../../../assets/Popover.css';const v = ({
4
+ id: e,
5
+ content: t,
6
+ position: p = "top",
7
+ class: n = "",
8
+ children: s,
9
+ ...i
10
+ }) => {
11
+ const d = a(), o = e || d;
12
+ return /* @__PURE__ */ r("div", { id: o, class: `n-popover-container n-popover-${p} ${n}`, ...i, children: [
13
+ /* @__PURE__ */ r("button", { class: "n-popover-trigger", "aria-describedby": `${o}-popover`, type: "button", children: s }),
14
+ /* @__PURE__ */ r(
15
+ "div",
16
+ {
17
+ id: `${o}-popover`,
18
+ class: "n-popover",
19
+ role: "tooltip",
20
+ dangerouslySetInnerHTML: { __html: t }
21
+ }
22
+ )
23
+ ] });
24
+ };
25
+ export {
26
+ v as default
27
+ };
@@ -1,6 +1,6 @@
1
1
  import { u as e } from "../../../../../chunks/jsxRuntime.module.Bzuv3cXw.js";
2
2
  import { A as g, y as h, d as k } from "../../../../../chunks/hooks.module.DGkdD5n9.js";
3
- import { A as w, K as b } from "../../../../../chunks/AskNetlify.1ejGUA_O.js";
3
+ import { A as w, K as b } from "../../../../../chunks/AskNetlify.CNYCiNSp.js";
4
4
  import K from "../../../Modal/Modal.js";
5
5
  import d from "../../../KeyboardKey/KeyboardKey.js";
6
6
  import L from "../SearchWindow.js";
@@ -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.1ejGUA_O.js";
7
+ import { A as S } from "../../chunks/AskNetlify.CNYCiNSp.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.12.4",
4
+ "version": "1.13.0",
5
5
  "type": "module",
6
6
  "main": "dist/components/preact/index.js",
7
7
  "types": "dist/components/preact/index.d.ts",
@@ -3,6 +3,10 @@
3
3
  /* ----------------------------- */
4
4
  /* Layout Containers */
5
5
  /* ----------------------------- */
6
+ .grecaptcha-badge {
7
+ visibility: hidden;
8
+ }
9
+
6
10
  .n-ask-chat-container {
7
11
  opacity: 0;
8
12
  animation: appearContainer 120ms ease-in-out forwards;
@@ -10,6 +14,7 @@
10
14
  }
11
15
 
12
16
  .n-ask-conversation {
17
+ position: relative;
13
18
  display: grid;
14
19
  align-items: flex-end;
15
20
  gap: var(--space-s);
@@ -23,6 +28,7 @@
23
28
  .n-ask-form {
24
29
  display: flex;
25
30
  align-items: center;
31
+ gap: var(--space-s);
26
32
  position: relative;
27
33
  height: var(--n-search-input-height);
28
34
  background-color: var(--search-input-bg-color);
@@ -5,6 +5,8 @@ import { QuestionList } from './components/QuestionList/QuestionList';
5
5
  import { BackButton } from './components/BackButton';
6
6
  import { ChatMessages } from './components/ChatMessages';
7
7
 
8
+ import Popover from '../Popover/Popover';
9
+
8
10
  import './AskNetlify.css';
9
11
 
10
12
  interface Props {
@@ -78,6 +80,18 @@ export default function AskNetlify({ setModalState, initialQuery }: Props) {
78
80
  placeholder="Ask a question..."
79
81
  disabled={isPreparingAnswer || isGeneratingAnswer}
80
82
  />
83
+ {
84
+ <Popover
85
+ id="recaptcha"
86
+ content={`<p>
87
+ This site is protected by reCAPTCHA and the Google
88
+ <a href="https://policies.google.com/privacy">Privacy Policy</a> and
89
+ <a href="https://policies.google.com/terms">Terms of Service</a> apply.
90
+ </p>`}
91
+ >
92
+ protected by reCAPTCHA
93
+ </Popover>
94
+ }
81
95
 
82
96
  {isGeneratingAnswer ? (
83
97
  <button
@@ -0,0 +1,101 @@
1
+ .n-popover-container {
2
+ position: relative;
3
+ display: inline-block;
4
+ font-size: var(--font-size-text-xs);
5
+ }
6
+
7
+ .n-popover-trigger {
8
+ background-color: transparent;
9
+ border: none;
10
+ padding: 0;
11
+ font: inherit;
12
+ color: var(--color-text-weak);
13
+ cursor: pointer;
14
+ }
15
+
16
+ .n-popover {
17
+ position: absolute;
18
+ background-color: var(--color-bg-2);
19
+ color: var(--color-text);
20
+ padding: var(--space-xs) var(--space-s);
21
+ border-radius: var(--radius-s);
22
+ opacity: 0;
23
+ pointer-events: none;
24
+ transition: opacity 0.2s ease-in-out;
25
+ z-index: 10;
26
+ }
27
+
28
+ .n-popover::after {
29
+ content: '';
30
+ position: absolute;
31
+ border-style: solid;
32
+ }
33
+
34
+ .n-popover-container:focus-within .n-popover,
35
+ .n-popover-container:hover .n-popover {
36
+ opacity: 1;
37
+ pointer-events: auto;
38
+ }
39
+
40
+ .n-popover-container:focus-within .n-popover-trigger,
41
+ .n-popover-container:hover .n-popover-trigger {
42
+ box-shadow: 0px 1px 0px 0px var(--neutral-300);
43
+ }
44
+
45
+ .n-popover-top .n-popover {
46
+ bottom: 145%;
47
+ left: 50%;
48
+ transform: translateX(-50%);
49
+ width: 260px;
50
+ box-shadow: var(--shadow-light);
51
+ }
52
+
53
+ .n-popover-top .n-popover::after {
54
+ top: 100%;
55
+ left: 50%;
56
+ margin-left: -5px;
57
+ border-width: 5px;
58
+ border-color: var(--color-bg-2) transparent transparent transparent;
59
+ }
60
+
61
+ .n-popover-bottom .n-popover {
62
+ top: 145%;
63
+ left: 50%;
64
+ transform: translateX(-50%);
65
+ }
66
+
67
+ .n-popover-bottom .n-popover::after {
68
+ bottom: 100%;
69
+ left: 50%;
70
+ margin-left: -5px;
71
+ border-width: 5px;
72
+ border-color: transparent transparent var(--color-bg-2) transparent;
73
+ }
74
+
75
+ .n-popover-left .n-popover {
76
+ right: 125%;
77
+ top: 50%;
78
+ transform: translateY(-50%);
79
+ }
80
+
81
+ .n-popover-left .n-popover::after {
82
+ top: 50%;
83
+ left: 100%;
84
+ margin-top: -5px;
85
+ border-width: 5px;
86
+ border-color: transparent transparent transparent var(--color-bg-2);
87
+ }
88
+
89
+ .n-popover-right .n-popover {
90
+ left: 125%;
91
+ top: 50%;
92
+ transform: translateY(-50%);
93
+ }
94
+
95
+ .n-popover-right .n-popover::after {
96
+ top: 50%;
97
+ right: 100%;
98
+ margin-top: -5px;
99
+ border-width: 5px;
100
+ border-color: transparent var(--color-bg-2) transparent transparent;
101
+ }
@@ -0,0 +1,40 @@
1
+ import { useId } from 'preact/hooks';
2
+ import type { FunctionComponent } from 'preact';
3
+
4
+ import './Popover.css';
5
+
6
+ interface Props {
7
+ id?: string;
8
+ content: string;
9
+ position?: 'top' | 'bottom' | 'left' | 'right';
10
+ class?: string;
11
+ children: preact.ComponentChildren;
12
+ }
13
+
14
+ const Popover: FunctionComponent<Props> = ({
15
+ id,
16
+ content,
17
+ position = 'top',
18
+ class: className = '',
19
+ children,
20
+ ...rest
21
+ }) => {
22
+ const generatedId = useId();
23
+ const tooltipId = id || generatedId;
24
+
25
+ return (
26
+ <div id={tooltipId} class={`n-popover-container n-popover-${position} ${className}`} {...rest}>
27
+ <button class="n-popover-trigger" aria-describedby={`${tooltipId}-popover`} type="button">
28
+ {children}
29
+ </button>
30
+ <div
31
+ id={`${tooltipId}-popover`}
32
+ class="n-popover"
33
+ role="tooltip"
34
+ dangerouslySetInnerHTML={{ __html: content }}
35
+ />
36
+ </div>
37
+ );
38
+ };
39
+
40
+ export default Popover;