quirk-ui 0.1.115 → 0.1.116

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 +1 @@
1
- "use strict";const t=require("react/jsx-runtime"),e=require("../../../react.esm-C_9Ma9mj.cjs"),o=require("./index.cjs");require("../../../index-CW_Ehh1q.cjs");e.vi.mock("./styles.module.css",()=>({default:new Proxy({},{get:(n,c)=>c})}));e.vi.mock("lucide-react",()=>({X:({size:n,...c})=>t.jsx("svg",{"data-testid":"x-icon","data-size":n,...c})}));e.describe("Announcement",()=>{e.describe("rendering",()=>{e.it("renders the announcement region when content is a plain string",()=>{e.render(t.jsx(o.Announcement,{content:"Site maintenance tonight at 10pm"})),e.globalExpect(e.screen.getByRole("region",{name:"Announcement"})).toBeInTheDocument(),e.globalExpect(e.screen.getByText("Site maintenance tonight at 10pm")).toBeInTheDocument()}),e.it("renders nothing when content is a string and renderRichText returns null",()=>{const n=e.vi.fn().mockReturnValue(null),{container:c}=e.render(t.jsx(o.Announcement,{content:"hello",renderRichText:n}));e.globalExpect(c).toBeEmptyDOMElement()}),e.it("renders nothing when content is portableText and no renderRichText is provided",()=>{const n={type:"portableText",content:[{_type:"block"}]},{container:c}=e.render(t.jsx(o.Announcement,{content:n}));e.globalExpect(c).toBeEmptyDOMElement()}),e.it("renders nothing when content is markdown and no renderRichText is provided",()=>{const n={type:"markdown",content:"**Bold announcement**"},{container:c}=e.render(t.jsx(o.Announcement,{content:n}));e.globalExpect(c).toBeEmptyDOMElement()}),e.it("calls renderRichText with the content and a className when provided",()=>{const n=e.vi.fn().mockReturnValue(t.jsx("span",{children:"Rendered content"})),c={type:"portableText",content:[{_type:"block"}]};e.render(t.jsx(o.Announcement,{content:c,renderRichText:n})),e.globalExpect(n).toHaveBeenCalledWith(c,e.globalExpect.any(String)),e.globalExpect(e.screen.getByText("Rendered content")).toBeInTheDocument()}),e.it("renders the output of renderRichText when it returns a node",()=>{const n=e.vi.fn().mockReturnValue(t.jsx("span",{children:"Free shipping this weekend"}));e.render(t.jsx(o.Announcement,{content:{type:"portableText",content:[]},renderRichText:n})),e.globalExpect(e.screen.getByText("Free shipping this weekend")).toBeInTheDocument()}),e.it("wraps plain string content in a span",()=>{const{container:n}=e.render(t.jsx(o.Announcement,{content:"Plain text announcement"})),c=n.querySelector("span");e.globalExpect(c).toHaveTextContent("Plain text announcement")}),e.it("applies a custom className to the announcement wrapper",()=>{const{container:n}=e.render(t.jsx(o.Announcement,{content:"Hello",className:"custom-class"}));e.globalExpect(n.firstChild).toHaveClass("custom-class")})}),e.describe("accessibility",()=>{e.it("has role=region on the outer wrapper",()=>{e.render(t.jsx(o.Announcement,{content:"Accessibility test"})),e.globalExpect(e.screen.getByRole("region")).toBeInTheDocument()}),e.it("has aria-label='Announcement' on the region",()=>{e.render(t.jsx(o.Announcement,{content:"Accessibility test"})),e.globalExpect(e.screen.getByRole("region",{name:"Announcement"})).toBeInTheDocument()}),e.it("renders a dismiss button with aria-label='Dismiss announcement'",()=>{e.render(t.jsx(o.Announcement,{content:"Accessibility test"})),e.globalExpect(e.screen.getByRole("button",{name:"Dismiss announcement"})).toBeInTheDocument()}),e.it("renders the X icon with aria-hidden=true so screen readers skip it",()=>{e.render(t.jsx(o.Announcement,{content:"Accessibility test"}));const n=e.screen.getByTestId("x-icon");e.globalExpect(n).toHaveAttribute("aria-hidden","true")})}),e.describe("dismiss behaviour",()=>{e.it("hides the announcement when the dismiss button is clicked",()=>{e.render(t.jsx(o.Announcement,{content:"Click X to dismiss"}));const n=e.screen.getByRole("button",{name:"Dismiss announcement"});e.fireEvent.click(n),e.globalExpect(e.screen.queryByRole("region",{name:"Announcement"})).not.toBeInTheDocument()}),e.it("removes the text content from the DOM after dismissal",()=>{e.render(t.jsx(o.Announcement,{content:"I will disappear"})),e.fireEvent.click(e.screen.getByRole("button",{name:"Dismiss announcement"})),e.globalExpect(e.screen.queryByText("I will disappear")).not.toBeInTheDocument()}),e.it("is visible before the dismiss button is clicked",()=>{e.render(t.jsx(o.Announcement,{content:"Still here"})),e.globalExpect(e.screen.getByRole("region",{name:"Announcement"})).toBeInTheDocument()}),e.it("does not dismiss when content area is clicked — only the button dismisses",()=>{e.render(t.jsx(o.Announcement,{content:"Click me"})),e.fireEvent.click(e.screen.getByText("Click me")),e.globalExpect(e.screen.getByRole("region",{name:"Announcement"})).toBeInTheDocument()})})});
1
+ "use strict";const t=require("react/jsx-runtime"),e=require("../../../react.esm-C_9Ma9mj.cjs"),c=require("./index.cjs");require("../../../index-CW_Ehh1q.cjs");e.vi.mock("./styles.module.css",()=>({default:new Proxy({},{get:(n,s)=>s})}));e.vi.mock("lucide-react",()=>({X:({size:n,...s})=>t.jsx("svg",{"data-testid":"x-icon","data-size":n,...s})}));const r=[{_type:"block",_key:"a",children:[{_type:"span",_key:"b",text:"Free shipping this weekend"}],markDefs:[],style:"normal"}];e.describe("Announcement",()=>{e.describe("rendering",()=>{e.it("renders the announcement region when blocks and renderRichText are provided",()=>{const n=e.vi.fn().mockReturnValue(t.jsx("span",{children:"Free shipping this weekend"}));e.render(t.jsx(c.Announcement,{blocks:r,renderRichText:n})),e.globalExpect(e.screen.getByRole("region",{name:"Announcement"})).toBeInTheDocument(),e.globalExpect(e.screen.getByText("Free shipping this weekend")).toBeInTheDocument()}),e.it("renders nothing when blocks is empty",()=>{const n=e.vi.fn().mockReturnValue(t.jsx("span",{children:"text"})),{container:s}=e.render(t.jsx(c.Announcement,{blocks:[],renderRichText:n}));e.globalExpect(s).toBeEmptyDOMElement()}),e.it("renders nothing when renderRichText returns null",()=>{const n=e.vi.fn().mockReturnValue(null),{container:s}=e.render(t.jsx(c.Announcement,{blocks:r,renderRichText:n}));e.globalExpect(s).toBeEmptyDOMElement()}),e.it("renders nothing when renderRichText is not provided",()=>{const{container:n}=e.render(t.jsx(c.Announcement,{blocks:r}));e.globalExpect(n).toBeEmptyDOMElement()}),e.it("calls renderRichText with blocks and a className",()=>{const n=e.vi.fn().mockReturnValue(t.jsx("span",{children:"content"}));e.render(t.jsx(c.Announcement,{blocks:r,renderRichText:n})),e.globalExpect(n).toHaveBeenCalledWith({blocks:r,className:e.globalExpect.any(String)})}),e.it("applies a custom className to the announcement wrapper",()=>{const n=e.vi.fn().mockReturnValue(t.jsx("span",{children:"content"})),{container:s}=e.render(t.jsx(c.Announcement,{blocks:r,renderRichText:n,className:"custom-class"}));e.globalExpect(s.firstChild).toHaveClass("custom-class")})}),e.describe("accessibility",()=>{e.it("has role=region on the outer wrapper",()=>{const n=e.vi.fn().mockReturnValue(t.jsx("span",{children:"content"}));e.render(t.jsx(c.Announcement,{blocks:r,renderRichText:n})),e.globalExpect(e.screen.getByRole("region")).toBeInTheDocument()}),e.it("has aria-label='Announcement' on the region",()=>{const n=e.vi.fn().mockReturnValue(t.jsx("span",{children:"content"}));e.render(t.jsx(c.Announcement,{blocks:r,renderRichText:n})),e.globalExpect(e.screen.getByRole("region",{name:"Announcement"})).toBeInTheDocument()}),e.it("renders a dismiss button with aria-label='Dismiss announcement'",()=>{const n=e.vi.fn().mockReturnValue(t.jsx("span",{children:"content"}));e.render(t.jsx(c.Announcement,{blocks:r,renderRichText:n})),e.globalExpect(e.screen.getByRole("button",{name:"Dismiss announcement"})).toBeInTheDocument()}),e.it("renders the X icon with aria-hidden=true so screen readers skip it",()=>{const n=e.vi.fn().mockReturnValue(t.jsx("span",{children:"content"}));e.render(t.jsx(c.Announcement,{blocks:r,renderRichText:n})),e.globalExpect(e.screen.getByTestId("x-icon")).toHaveAttribute("aria-hidden","true")})}),e.describe("dismiss behaviour",()=>{e.it("hides the announcement when the dismiss button is clicked",()=>{const n=e.vi.fn().mockReturnValue(t.jsx("span",{children:"content"}));e.render(t.jsx(c.Announcement,{blocks:r,renderRichText:n})),e.fireEvent.click(e.screen.getByRole("button",{name:"Dismiss announcement"})),e.globalExpect(e.screen.queryByRole("region",{name:"Announcement"})).not.toBeInTheDocument()}),e.it("removes rendered content from the DOM after dismissal",()=>{const n=e.vi.fn().mockReturnValue(t.jsx("span",{children:"I will disappear"}));e.render(t.jsx(c.Announcement,{blocks:r,renderRichText:n})),e.fireEvent.click(e.screen.getByRole("button",{name:"Dismiss announcement"})),e.globalExpect(e.screen.queryByText("I will disappear")).not.toBeInTheDocument()}),e.it("is visible before the dismiss button is clicked",()=>{const n=e.vi.fn().mockReturnValue(t.jsx("span",{children:"Still here"}));e.render(t.jsx(c.Announcement,{blocks:r,renderRichText:n})),e.globalExpect(e.screen.getByRole("region",{name:"Announcement"})).toBeInTheDocument()}),e.it("does not dismiss when content area is clicked — only the button dismisses",()=>{const n=e.vi.fn().mockReturnValue(t.jsx("span",{children:"Click me"}));e.render(t.jsx(c.Announcement,{blocks:r,renderRichText:n})),e.fireEvent.click(e.screen.getByText("Click me")),e.globalExpect(e.screen.getByRole("region",{name:"Announcement"})).toBeInTheDocument()})})});
@@ -1,106 +1,108 @@
1
- import { jsx as t } from "react/jsx-runtime";
2
- import { v as a, d as m, i as o, r as i, g as n, s as c, f as l } from "../../../react.esm-DjxyacK8.js";
3
- import { Announcement as s } from "./index.mjs";
1
+ import { jsx as n } from "react/jsx-runtime";
2
+ import { v as o, d as m, i as s, r, g as t, s as a, f as d } from "../../../react.esm-DjxyacK8.js";
3
+ import { Announcement as c } from "./index.mjs";
4
4
  import "../../../index-DPGXWTtt.js";
5
- a.mock("./styles.module.css", () => ({
6
- default: new Proxy({}, { get: (e, r) => r })
5
+ o.mock("./styles.module.css", () => ({
6
+ default: new Proxy({}, { get: (e, l) => l })
7
7
  }));
8
- a.mock("lucide-react", () => ({
9
- X: ({ size: e, ...r }) => /* @__PURE__ */ t("svg", { "data-testid": "x-icon", "data-size": e, ...r })
8
+ o.mock("lucide-react", () => ({
9
+ X: ({ size: e, ...l }) => /* @__PURE__ */ n("svg", { "data-testid": "x-icon", "data-size": e, ...l })
10
10
  }));
11
+ const i = [
12
+ {
13
+ _type: "block",
14
+ _key: "a",
15
+ children: [
16
+ { _type: "span", _key: "b", text: "Free shipping this weekend" }
17
+ ],
18
+ markDefs: [],
19
+ style: "normal"
20
+ }
21
+ ];
11
22
  m("Announcement", () => {
12
23
  m("rendering", () => {
13
- o("renders the announcement region when content is a plain string", () => {
14
- i(/* @__PURE__ */ t(s, { content: "Site maintenance tonight at 10pm" })), n(
15
- c.getByRole("region", { name: "Announcement" })
16
- ).toBeInTheDocument(), n(
17
- c.getByText("Site maintenance tonight at 10pm")
24
+ s("renders the announcement region when blocks and renderRichText are provided", () => {
25
+ const e = o.fn().mockReturnValue(/* @__PURE__ */ n("span", { children: "Free shipping this weekend" }));
26
+ r(/* @__PURE__ */ n(c, { blocks: i, renderRichText: e })), t(
27
+ a.getByRole("region", { name: "Announcement" })
28
+ ).toBeInTheDocument(), t(
29
+ a.getByText("Free shipping this weekend")
18
30
  ).toBeInTheDocument();
19
- }), o("renders nothing when content is a string and renderRichText returns null", () => {
20
- const e = a.fn().mockReturnValue(null), { container: r } = i(
21
- /* @__PURE__ */ t(s, { content: "hello", renderRichText: e })
31
+ }), s("renders nothing when blocks is empty", () => {
32
+ const e = o.fn().mockReturnValue(/* @__PURE__ */ n("span", { children: "text" })), { container: l } = r(
33
+ /* @__PURE__ */ n(c, { blocks: [], renderRichText: e })
22
34
  );
23
- n(r).toBeEmptyDOMElement();
24
- }), o("renders nothing when content is portableText and no renderRichText is provided", () => {
25
- const e = {
26
- type: "portableText",
27
- content: [{ _type: "block" }]
28
- }, { container: r } = i(/* @__PURE__ */ t(s, { content: e }));
29
- n(r).toBeEmptyDOMElement();
30
- }), o("renders nothing when content is markdown and no renderRichText is provided", () => {
31
- const e = {
32
- type: "markdown",
33
- content: "**Bold announcement**"
34
- }, { container: r } = i(/* @__PURE__ */ t(s, { content: e }));
35
- n(r).toBeEmptyDOMElement();
36
- }), o("calls renderRichText with the content and a className when provided", () => {
37
- const e = a.fn().mockReturnValue(/* @__PURE__ */ t("span", { children: "Rendered content" })), r = {
38
- type: "portableText",
39
- content: [{ _type: "block" }]
40
- };
41
- i(
42
- /* @__PURE__ */ t(s, { content: r, renderRichText: e })
43
- ), n(e).toHaveBeenCalledWith(r, n.any(String)), n(c.getByText("Rendered content")).toBeInTheDocument();
44
- }), o("renders the output of renderRichText when it returns a node", () => {
45
- const e = a.fn().mockReturnValue(/* @__PURE__ */ t("span", { children: "Free shipping this weekend" }));
46
- i(
47
- /* @__PURE__ */ t(
48
- s,
35
+ t(l).toBeEmptyDOMElement();
36
+ }), s("renders nothing when renderRichText returns null", () => {
37
+ const e = o.fn().mockReturnValue(null), { container: l } = r(
38
+ /* @__PURE__ */ n(c, { blocks: i, renderRichText: e })
39
+ );
40
+ t(l).toBeEmptyDOMElement();
41
+ }), s("renders nothing when renderRichText is not provided", () => {
42
+ const { container: e } = r(/* @__PURE__ */ n(c, { blocks: i }));
43
+ t(e).toBeEmptyDOMElement();
44
+ }), s("calls renderRichText with blocks and a className", () => {
45
+ const e = o.fn().mockReturnValue(/* @__PURE__ */ n("span", { children: "content" }));
46
+ r(/* @__PURE__ */ n(c, { blocks: i, renderRichText: e })), t(e).toHaveBeenCalledWith({
47
+ blocks: i,
48
+ className: t.any(String)
49
+ });
50
+ }), s("applies a custom className to the announcement wrapper", () => {
51
+ const e = o.fn().mockReturnValue(/* @__PURE__ */ n("span", { children: "content" })), { container: l } = r(
52
+ /* @__PURE__ */ n(
53
+ c,
49
54
  {
50
- content: { type: "portableText", content: [] },
51
- renderRichText: e
55
+ blocks: i,
56
+ renderRichText: e,
57
+ className: "custom-class"
52
58
  }
53
59
  )
54
- ), n(
55
- c.getByText("Free shipping this weekend")
56
- ).toBeInTheDocument();
57
- }), o("wraps plain string content in a span", () => {
58
- const { container: e } = i(
59
- /* @__PURE__ */ t(s, { content: "Plain text announcement" })
60
- ), r = e.querySelector("span");
61
- n(r).toHaveTextContent("Plain text announcement");
62
- }), o("applies a custom className to the announcement wrapper", () => {
63
- const { container: e } = i(
64
- /* @__PURE__ */ t(s, { content: "Hello", className: "custom-class" })
65
60
  );
66
- n(e.firstChild).toHaveClass("custom-class");
61
+ t(l.firstChild).toHaveClass("custom-class");
67
62
  });
68
63
  }), m("accessibility", () => {
69
- o("has role=region on the outer wrapper", () => {
70
- i(/* @__PURE__ */ t(s, { content: "Accessibility test" })), n(c.getByRole("region")).toBeInTheDocument();
71
- }), o("has aria-label='Announcement' on the region", () => {
72
- i(/* @__PURE__ */ t(s, { content: "Accessibility test" })), n(
73
- c.getByRole("region", { name: "Announcement" })
64
+ s("has role=region on the outer wrapper", () => {
65
+ const e = o.fn().mockReturnValue(/* @__PURE__ */ n("span", { children: "content" }));
66
+ r(/* @__PURE__ */ n(c, { blocks: i, renderRichText: e })), t(a.getByRole("region")).toBeInTheDocument();
67
+ }), s("has aria-label='Announcement' on the region", () => {
68
+ const e = o.fn().mockReturnValue(/* @__PURE__ */ n("span", { children: "content" }));
69
+ r(/* @__PURE__ */ n(c, { blocks: i, renderRichText: e })), t(
70
+ a.getByRole("region", { name: "Announcement" })
74
71
  ).toBeInTheDocument();
75
- }), o("renders a dismiss button with aria-label='Dismiss announcement'", () => {
76
- i(/* @__PURE__ */ t(s, { content: "Accessibility test" })), n(
77
- c.getByRole("button", { name: "Dismiss announcement" })
72
+ }), s("renders a dismiss button with aria-label='Dismiss announcement'", () => {
73
+ const e = o.fn().mockReturnValue(/* @__PURE__ */ n("span", { children: "content" }));
74
+ r(/* @__PURE__ */ n(c, { blocks: i, renderRichText: e })), t(
75
+ a.getByRole("button", { name: "Dismiss announcement" })
78
76
  ).toBeInTheDocument();
79
- }), o("renders the X icon with aria-hidden=true so screen readers skip it", () => {
80
- i(/* @__PURE__ */ t(s, { content: "Accessibility test" }));
81
- const e = c.getByTestId("x-icon");
82
- n(e).toHaveAttribute("aria-hidden", "true");
77
+ }), s("renders the X icon with aria-hidden=true so screen readers skip it", () => {
78
+ const e = o.fn().mockReturnValue(/* @__PURE__ */ n("span", { children: "content" }));
79
+ r(/* @__PURE__ */ n(c, { blocks: i, renderRichText: e })), t(a.getByTestId("x-icon")).toHaveAttribute(
80
+ "aria-hidden",
81
+ "true"
82
+ );
83
83
  });
84
84
  }), m("dismiss behaviour", () => {
85
- o("hides the announcement when the dismiss button is clicked", () => {
86
- i(/* @__PURE__ */ t(s, { content: "Click X to dismiss" }));
87
- const e = c.getByRole("button", {
88
- name: "Dismiss announcement"
89
- });
90
- l.click(e), n(
91
- c.queryByRole("region", { name: "Announcement" })
85
+ s("hides the announcement when the dismiss button is clicked", () => {
86
+ const e = o.fn().mockReturnValue(/* @__PURE__ */ n("span", { children: "content" }));
87
+ r(/* @__PURE__ */ n(c, { blocks: i, renderRichText: e })), d.click(
88
+ a.getByRole("button", { name: "Dismiss announcement" })
89
+ ), t(
90
+ a.queryByRole("region", { name: "Announcement" })
92
91
  ).not.toBeInTheDocument();
93
- }), o("removes the text content from the DOM after dismissal", () => {
94
- i(/* @__PURE__ */ t(s, { content: "I will disappear" })), l.click(
95
- c.getByRole("button", { name: "Dismiss announcement" })
96
- ), n(c.queryByText("I will disappear")).not.toBeInTheDocument();
97
- }), o("is visible before the dismiss button is clicked", () => {
98
- i(/* @__PURE__ */ t(s, { content: "Still here" })), n(
99
- c.getByRole("region", { name: "Announcement" })
92
+ }), s("removes rendered content from the DOM after dismissal", () => {
93
+ const e = o.fn().mockReturnValue(/* @__PURE__ */ n("span", { children: "I will disappear" }));
94
+ r(/* @__PURE__ */ n(c, { blocks: i, renderRichText: e })), d.click(
95
+ a.getByRole("button", { name: "Dismiss announcement" })
96
+ ), t(a.queryByText("I will disappear")).not.toBeInTheDocument();
97
+ }), s("is visible before the dismiss button is clicked", () => {
98
+ const e = o.fn().mockReturnValue(/* @__PURE__ */ n("span", { children: "Still here" }));
99
+ r(/* @__PURE__ */ n(c, { blocks: i, renderRichText: e })), t(
100
+ a.getByRole("region", { name: "Announcement" })
100
101
  ).toBeInTheDocument();
101
- }), o("does not dismiss when content area is clicked — only the button dismisses", () => {
102
- i(/* @__PURE__ */ t(s, { content: "Click me" })), l.click(c.getByText("Click me")), n(
103
- c.getByRole("region", { name: "Announcement" })
102
+ }), s("does not dismiss when content area is clicked — only the button dismisses", () => {
103
+ const e = o.fn().mockReturnValue(/* @__PURE__ */ n("span", { children: "Click me" }));
104
+ r(/* @__PURE__ */ n(c, { blocks: i, renderRichText: e })), d.click(a.getByText("Click me")), t(
105
+ a.getByRole("region", { name: "Announcement" })
104
106
  ).toBeInTheDocument();
105
107
  });
106
108
  });
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../../index44.css');const n=require("react/jsx-runtime"),l=require("react"),a=require("../../../x-Dft9NVe_.cjs"),u="_announcement_1t134_1",m="_inner_1t134_9",d="_content_1t134_22",_="_close_1t134_48",e={announcement:u,inner:m,content:d,close:_};function j({content:t,renderRichText:s,className:i}){const[o,r]=l.useState(!1);if(o)return null;const c=s?s(t,e.content):typeof t=="string"?n.jsx("span",{className:e.content,children:t}):null;return c?n.jsx("div",{role:"region","aria-label":"Announcement",className:`${e.announcement} ${i??""}`.trim(),children:n.jsxs("div",{className:e.inner,children:[n.jsx("div",{className:e.content,children:c}),n.jsx("button",{className:e.close,onClick:()=>r(!0),"aria-label":"Dismiss announcement",children:n.jsx(a.X,{size:16,"aria-hidden":"true"})})]})}):null}exports.Announcement=j;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../../index44.css');const n=require("react/jsx-runtime"),a=require("react"),l=require("../../../x-Dft9NVe_.cjs"),u="_announcement_1t134_1",m="_inner_1t134_9",d="_content_1t134_22",_="_close_1t134_48",e={announcement:u,inner:m,content:d,close:_};function j({blocks:t,renderRichText:s,className:i}){const[r,o]=a.useState(!1);if(r||!(t!=null&&t.length))return null;const c=s?s({blocks:t,className:e.content}):null;return c?n.jsx("div",{role:"region","aria-label":"Announcement",className:`${e.announcement} ${i??""}`.trim(),children:n.jsxs("div",{className:e.inner,children:[n.jsx("div",{className:e.content,children:c}),n.jsx("button",{className:e.close,onClick:()=>o(!0),"aria-label":"Dismiss announcement",children:n.jsx(l.X,{size:16,"aria-hidden":"true"})})]})}):null}exports.Announcement=j;
@@ -1,5 +1,5 @@
1
- import { jsx as e, jsxs as l } from "react/jsx-runtime";
2
- import { useState as a } from "react";
1
+ import { jsx as t, jsxs as a } from "react/jsx-runtime";
2
+ import { useState as l } from "react";
3
3
  import { X as m } from "../../../x-CnsEH4Ox.js";
4
4
  import '../../../index44.css';const u = "_announcement_1t134_1", d = "_inner_1t134_9", _ = "_content_1t134_22", f = "_close_1t134_48", n = {
5
5
  announcement: u,
@@ -7,29 +7,29 @@ import '../../../index44.css';const u = "_announcement_1t134_1", d = "_inner_1t1
7
7
  content: _,
8
8
  close: f
9
9
  };
10
- function b({
11
- content: t,
10
+ function v({
11
+ blocks: e,
12
12
  renderRichText: s,
13
- className: c
13
+ className: o
14
14
  }) {
15
- const [i, r] = a(!1);
16
- if (i) return null;
17
- const o = s ? s(t, n.content) : typeof t == "string" ? /* @__PURE__ */ e("span", { className: n.content, children: t }) : null;
18
- return o ? /* @__PURE__ */ e(
15
+ const [r, c] = l(!1);
16
+ if (r || !(e != null && e.length)) return null;
17
+ const i = s ? s({ blocks: e, className: n.content }) : null;
18
+ return i ? /* @__PURE__ */ t(
19
19
  "div",
20
20
  {
21
21
  role: "region",
22
22
  "aria-label": "Announcement",
23
- className: `${n.announcement} ${c ?? ""}`.trim(),
24
- children: /* @__PURE__ */ l("div", { className: n.inner, children: [
25
- /* @__PURE__ */ e("div", { className: n.content, children: o }),
26
- /* @__PURE__ */ e(
23
+ className: `${n.announcement} ${o ?? ""}`.trim(),
24
+ children: /* @__PURE__ */ a("div", { className: n.inner, children: [
25
+ /* @__PURE__ */ t("div", { className: n.content, children: i }),
26
+ /* @__PURE__ */ t(
27
27
  "button",
28
28
  {
29
29
  className: n.close,
30
- onClick: () => r(!0),
30
+ onClick: () => c(!0),
31
31
  "aria-label": "Dismiss announcement",
32
- children: /* @__PURE__ */ e(m, { size: 16, "aria-hidden": "true" })
32
+ children: /* @__PURE__ */ t(m, { size: 16, "aria-hidden": "true" })
33
33
  }
34
34
  )
35
35
  ] })
@@ -37,5 +37,5 @@ function b({
37
37
  ) : null;
38
38
  }
39
39
  export {
40
- b as Announcement
40
+ v as Announcement
41
41
  };
package/dist/core.d.ts CHANGED
@@ -4,6 +4,7 @@ import { FormEvent } from 'react';
4
4
  import { ImageAdapter } from './core/types/adapters';
5
5
  import { JSX } from 'react/jsx-runtime';
6
6
  import { LinkAdapter } from './core/types/adapters';
7
+ import { PortableTextBlock } from '@portabletext/types';
7
8
  import { ReactNode } from 'react';
8
9
  import { RenderCallToActionProps } from './core/types/renderers';
9
10
  import { RenderImageProps } from './core/types/renderers';
@@ -70,19 +71,14 @@ declare type AnchorTypeProps = {
70
71
  rel?: string;
71
72
  } & Omit<default_2.AnchorHTMLAttributes<HTMLAnchorElement>, "href" | "target" | "rel">;
72
73
 
73
- export declare function Announcement({ content, renderRichText, className, }: AnnouncementProps): JSX.Element | null;
74
-
75
- export declare type AnnouncementContent = {
76
- type: "portableText";
77
- content: unknown[];
78
- } | {
79
- type: "markdown";
80
- content: string;
81
- } | string;
74
+ export declare function Announcement({ blocks, renderRichText, className, }: AnnouncementProps): JSX.Element | null;
82
75
 
83
76
  export declare type AnnouncementProps = {
84
- content: AnnouncementContent;
85
- renderRichText?: (content: AnnouncementContent, className?: string) => React.ReactNode;
77
+ blocks: PortableTextBlock[];
78
+ renderRichText?: (props: {
79
+ blocks: PortableTextBlock[];
80
+ className?: string;
81
+ }) => React.ReactNode;
86
82
  className?: string;
87
83
  };
88
84
 
package/dist/main.d.ts CHANGED
@@ -38,8 +38,8 @@ import { MetricType } from './sanity/types/metric';
38
38
  import { NavigationData } from './sanity/types/navigation';
39
39
  import { PageProps } from './sanity/types/page';
40
40
  import { PageSection } from './sanity/types/pageSection';
41
- import { PortableTextBlock } from '@portabletext/react';
42
- import { PortableTextBlock as PortableTextBlock_2 } from '@portabletext/types';
41
+ import { PortableTextBlock } from '@portabletext/types';
42
+ import { PortableTextBlock as PortableTextBlock_2 } from '@portabletext/react';
43
43
  import { QuoteBlockProps } from './next/blocks/QuoteBlock/QuoteBlock.types';
44
44
  import { QuoteBlockProps as QuoteBlockProps_2 } from './QuoteBlock.types';
45
45
  import { ReactNode } from 'react';
@@ -136,19 +136,14 @@ declare type AnchorTypeProps = {
136
136
  rel?: string;
137
137
  } & Omit<default_2.AnchorHTMLAttributes<HTMLAnchorElement>, "href" | "target" | "rel">;
138
138
 
139
- export declare function Announcement({ content, renderRichText, className, }: AnnouncementProps): JSX.Element | null;
140
-
141
- export declare type AnnouncementContent = {
142
- type: "portableText";
143
- content: unknown[];
144
- } | {
145
- type: "markdown";
146
- content: string;
147
- } | string;
139
+ export declare function Announcement({ blocks, renderRichText, className, }: AnnouncementProps): JSX.Element | null;
148
140
 
149
141
  export declare type AnnouncementProps = {
150
- content: AnnouncementContent;
151
- renderRichText?: (content: AnnouncementContent, className?: string) => React.ReactNode;
142
+ blocks: PortableTextBlock[];
143
+ renderRichText?: (props: {
144
+ blocks: PortableTextBlock[];
145
+ className?: string;
146
+ }) => React.ReactNode;
152
147
  className?: string;
153
148
  };
154
149
 
@@ -234,7 +229,7 @@ declare type BioCardProps = ItemType_3 & {
234
229
  className?: string;
235
230
  }) => default_2.ReactElement | null;
236
231
  renderRichText?: (props: {
237
- blocks: PortableTextBlock_2[];
232
+ blocks: PortableTextBlock[];
238
233
  className?: string;
239
234
  }) => default_2.ReactElement | null;
240
235
  };
@@ -363,7 +358,7 @@ export { CardGridBlockProps }
363
358
  */
364
359
  export declare type CardProps = ItemType_2 & {
365
360
  renderRichText?: (props: {
366
- blocks: PortableTextBlock_2[];
361
+ blocks: PortableTextBlock[];
367
362
  className?: string;
368
363
  }) => default_2.ReactElement | null;
369
364
  renderImage?: (props: {
@@ -576,7 +571,7 @@ export declare type DrawerSize = keyof typeof sizeClassMap_2;
576
571
  * Flattens all span children into a single string — suitable for Badge labels,
577
572
  * aria attributes, and any context that needs a plain string from rich text.
578
573
  */
579
- export declare function extractText(blocks: PortableTextBlock_2[]): string;
574
+ export declare function extractText(blocks: PortableTextBlock[]): string;
580
575
 
581
576
  declare type FABPosition = "bottom-right" | "bottom-left" | "top-right" | "top-left";
582
577
 
@@ -741,7 +736,7 @@ declare type GridCardProps = ItemType_3 & {
741
736
  style?: default_2.CSSProperties;
742
737
  }) => default_2.ReactElement | null;
743
738
  renderRichText?: (props: {
744
- blocks: PortableTextBlock_2[];
739
+ blocks: PortableTextBlock[];
745
740
  className?: string;
746
741
  }) => default_2.ReactElement | null;
747
742
  };
@@ -1404,7 +1399,7 @@ declare type ProductCardProps = ItemType_3 & {
1404
1399
  style?: default_2.CSSProperties;
1405
1400
  }) => default_2.ReactElement | null;
1406
1401
  renderRichText?: (props: {
1407
- blocks: PortableTextBlock_2[];
1402
+ blocks: PortableTextBlock[];
1408
1403
  className?: string;
1409
1404
  }) => default_2.ReactElement | null;
1410
1405
  };
@@ -1556,7 +1551,7 @@ declare type ReviewCardProps = ItemType_3 & {
1556
1551
  priority?: boolean;
1557
1552
  }) => default_2.ReactElement | null;
1558
1553
  renderRichText?: (props: {
1559
- blocks: PortableTextBlock_2[];
1554
+ blocks: PortableTextBlock[];
1560
1555
  className?: string;
1561
1556
  }) => default_2.ReactElement | null;
1562
1557
  };
@@ -1576,7 +1571,7 @@ export declare function RichTextBlock({ text, styleOptions, id, renderRichText,
1576
1571
  export { RichTextBlockProps }
1577
1572
 
1578
1573
  declare interface RichTextProps {
1579
- blocks: PortableTextBlock[] | string;
1574
+ blocks: PortableTextBlock_2[] | string;
1580
1575
  className?: string;
1581
1576
  textOverride?: string;
1582
1577
  animateText?: boolean;
@@ -1607,7 +1602,7 @@ declare type SegmentCardProps = ItemType_3 & {
1607
1602
  style?: default_2.CSSProperties;
1608
1603
  }) => default_2.ReactElement | null;
1609
1604
  renderRichText?: (props: {
1610
- blocks: PortableTextBlock_2[];
1605
+ blocks: PortableTextBlock[];
1611
1606
  className?: string;
1612
1607
  }) => default_2.ReactElement | null;
1613
1608
  };
@@ -1654,7 +1649,7 @@ declare type ServiceCardProps = ItemType_3 & {
1654
1649
  onHover?: () => void;
1655
1650
  onLeave?: () => void;
1656
1651
  renderRichText?: (props: {
1657
- blocks: PortableTextBlock_2[];
1652
+ blocks: PortableTextBlock[];
1658
1653
  className?: string;
1659
1654
  }) => default_2.ReactElement | null;
1660
1655
  };
@@ -1824,7 +1819,7 @@ declare interface SpotlightCardProps {
1824
1819
  priority?: boolean;
1825
1820
  }) => default_2.ReactElement | null;
1826
1821
  renderRichText?: (props: {
1827
- blocks: PortableTextBlock_2[];
1822
+ blocks: PortableTextBlock[];
1828
1823
  className?: string;
1829
1824
  }) => default_2.ReactElement | null;
1830
1825
  }
@@ -1952,7 +1947,7 @@ declare type TestimonialCardProps = ItemType_3 & {
1952
1947
  draggable?: boolean;
1953
1948
  }) => default_2.ReactElement | null;
1954
1949
  renderRichText?: (props: {
1955
- blocks: PortableTextBlock_2[];
1950
+ blocks: PortableTextBlock[];
1956
1951
  className?: string;
1957
1952
  }) => default_2.ReactElement | null;
1958
1953
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "quirk-ui",
3
3
  "private": false,
4
- "version": "0.1.115",
4
+ "version": "0.1.116",
5
5
  "type": "module",
6
6
  "exports": {
7
7
  ".": {