@studiolxd/brand 49.12.0 → 49.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.
@@ -0,0 +1 @@
1
+ .site-search{gap:var(--site-search-gap);flex-direction:column;display:flex}.site-search__form{align-items:flex-end;gap:var(--site-search-form-gap);flex-wrap:wrap;display:flex}.site-search__field{flex:1 1 var(--site-search-field-basis);min-inline-size:0}.site-search__submit{flex:none}.site-search__status{align-items:center;gap:var(--site-search-status-gap);font-size:var(--site-search-status-font-size);line-height:var(--site-search-status-line-height);color:var(--site-search-status-color);margin-block:0;margin-inline:0;display:flex}.site-search__status-text{overflow-wrap:anywhere;min-inline-size:0}.site-search__suggestions{gap:var(--site-search-suggestions-gap);flex-direction:column;display:flex}.site-search__suggestions-label{font-size:var(--site-search-suggestions-label-font-size);color:var(--site-search-suggestions-label-color)}.site-search__suggestions-list{gap:var(--site-search-suggestions-gap);flex-wrap:wrap;margin-block:0;margin-inline:0;padding-block:0;padding-inline:0;list-style:none;display:flex}.site-search__loading{gap:var(--site-search-results-gap);flex-direction:column;display:flex}.site-search__ghost{gap:var(--site-search-skeleton-gap);flex-direction:column;display:flex}.site-search__ghost-section{inline-size:var(--site-search-ghost-section-inline-size)}.site-search__ghost-title{inline-size:var(--site-search-ghost-title-inline-size)}.site-search__ghost-url{inline-size:var(--site-search-ghost-url-inline-size)}.site-search__results{gap:var(--site-search-results-gap);flex-direction:column;margin-block:0;margin-inline:0;padding-block:0;padding-inline:0;list-style:none;display:flex}.site-search__result{gap:var(--site-search-result-gap);flex-direction:column;display:flex}.site-search__result+.site-search__result{border-block-start:var(--site-search-result-separator-width) solid var(--site-search-result-separator-color);padding-block-start:var(--site-search-result-padding-block)}.site-search__result-section,.site-search__result-excerpt,.site-search__result-url{margin-block:0;margin-inline:0}.site-search__result-section{font-size:var(--site-search-result-section-font-size);color:var(--site-search-result-section-color)}.site-search__result-title{font-size:var(--site-search-result-title-font-size);font-weight:var(--site-search-result-title-font-weight);color:var(--site-search-result-title-color);margin-block:0;margin-inline:0}.site-search .site-search__result-link{box-shadow:none;color:inherit;padding-block-end:0}.site-search .site-search__result-link:hover{box-shadow:inset 0 calc(-1 * var(--site-search-result-link-hover-line-width)) 0 0 currentColor;padding-block-end:var(--site-search-result-link-hover-line-offset)}.site-search .site-search__result-link:focus-visible{outline:var(--site-search-result-focus-ring-width) solid var(--site-search-result-focus-ring-color);outline-offset:var(--site-search-result-focus-ring-offset)}.site-search__result-excerpt{font-size:var(--site-search-result-excerpt-font-size);line-height:var(--site-search-result-excerpt-line-height);color:var(--site-search-result-excerpt-color);max-inline-size:var(--site-search-result-measure);overflow-wrap:anywhere}.site-search__result-excerpt mark{background-color:var(--site-search-result-mark-bg);color:var(--site-search-result-mark-color)}.site-search__result-url{font-size:var(--site-search-result-url-font-size);color:var(--site-search-result-url-color);overflow-wrap:anywhere}
@@ -0,0 +1,161 @@
1
+ 'use client';
2
+ import './site-search.css';
3
+ import { n as e } from "./_shared/brandmessagescontext.js";
4
+ import { Spinner as t } from "./spinner.js";
5
+ import { Button as n } from "./button.js";
6
+ import { Skeleton as r } from "./skeleton.js";
7
+ import { Alert as i } from "./alert.js";
8
+ import { InputField as a } from "./input-field.js";
9
+ import { EmptyState as o } from "./empty-state.js";
10
+ import { forwardRef as s, useId as c } from "react";
11
+ import { jsx as l, jsxs as u } from "react/jsx-runtime";
12
+ //#region src/stories/organisms/SiteSearch/SiteSearch.tsx
13
+ function d(e) {
14
+ return /* @__PURE__ */ l("a", { ...e });
15
+ }
16
+ var f = s(function({ query: s, onQueryChange: f, onSubmit: p, action: m, name: h = "q", status: g = "idle", results: _ = [], total: v, minLength: y = 2, suggestions: b, onSuggestionSelect: x, onRetry: S, toolbar: C, footer: w, headingLevel: T = 2, size: E, loadingRows: D = 3, onSelect: O, renderLink: k = d, label: A, labelHidden: j = !0, placeholder: M, submitLabel: N, resultsLabel: P, className: F, id: I, ...L }, R) {
17
+ let z = e("siteSearch"), B = c(), V = I ?? B, H = `${V}-input`, U = `${V}-status`, W = `${V}-results`, G = `h${T}`, K = s.trim(), q = v ?? _.length, J = g === "ready" && _.length > 0, Y = g === "idle" ? z("idle") : g === "typing" ? K.length < y ? z("minLength")(y) : z("pending") : g === "loading" ? z("loading") : g === "error" ? null : z("results")(q, K);
18
+ function X(e) {
19
+ if (p) {
20
+ e.preventDefault(), K && p(K);
21
+ return;
22
+ }
23
+ K || e.preventDefault();
24
+ }
25
+ return /* @__PURE__ */ u("div", {
26
+ className: ["site-search", F].filter(Boolean).join(" "),
27
+ ...L,
28
+ children: [
29
+ /* @__PURE__ */ u("form", {
30
+ className: "site-search__form",
31
+ role: "search",
32
+ "aria-label": z("label", A),
33
+ action: m,
34
+ method: "get",
35
+ onSubmit: X,
36
+ children: [/* @__PURE__ */ l(a, {
37
+ ref: R,
38
+ className: "site-search__field",
39
+ id: H,
40
+ name: h,
41
+ kind: "search",
42
+ clearable: !0,
43
+ label: z("label", A),
44
+ labelHidden: j,
45
+ placeholder: z("placeholder", M),
46
+ value: s,
47
+ onChange: (e) => f(e.target.value),
48
+ onClear: () => f(""),
49
+ "aria-describedby": U,
50
+ ...J ? { "aria-controls": W } : {},
51
+ ...E ? { size: E } : {}
52
+ }), /* @__PURE__ */ l(n, {
53
+ className: "site-search__submit",
54
+ type: "submit",
55
+ ...E ? { size: E } : {},
56
+ children: z("submit", N)
57
+ })]
58
+ }),
59
+ C ? /* @__PURE__ */ l("div", {
60
+ className: "site-search__toolbar",
61
+ children: C
62
+ }) : null,
63
+ /* @__PURE__ */ u("p", {
64
+ className: "site-search__status",
65
+ id: U,
66
+ role: "status",
67
+ "aria-live": "polite",
68
+ children: [g === "loading" ? /* @__PURE__ */ l(t, {
69
+ size: "sm",
70
+ "aria-hidden": !0
71
+ }) : null, /* @__PURE__ */ l("span", {
72
+ className: "site-search__status-text",
73
+ children: Y
74
+ })]
75
+ }),
76
+ g === "idle" && b && b.length > 0 && x ? /* @__PURE__ */ u("div", {
77
+ className: "site-search__suggestions",
78
+ children: [/* @__PURE__ */ l("span", {
79
+ className: "site-search__suggestions-label",
80
+ id: `${V}-suggestions`,
81
+ children: z("suggestionsLabel")
82
+ }), /* @__PURE__ */ l("ul", {
83
+ className: "site-search__suggestions-list",
84
+ "aria-labelledby": `${V}-suggestions`,
85
+ children: b.map((e) => /* @__PURE__ */ l("li", { children: /* @__PURE__ */ l(n, {
86
+ variant: "outline",
87
+ size: "sm",
88
+ onClick: () => x(e),
89
+ children: e
90
+ }) }, e))
91
+ })]
92
+ }) : null,
93
+ g === "loading" ? /* @__PURE__ */ l("div", {
94
+ className: "site-search__loading",
95
+ "aria-hidden": !0,
96
+ children: Array.from({ length: D }, (e, t) => /* @__PURE__ */ u("div", {
97
+ className: "site-search__ghost",
98
+ children: [
99
+ /* @__PURE__ */ l(r, { className: "site-search__ghost-section" }),
100
+ /* @__PURE__ */ l(r, { className: "site-search__ghost-title" }),
101
+ /* @__PURE__ */ l(r, {}),
102
+ /* @__PURE__ */ l(r, { className: "site-search__ghost-url" })
103
+ ]
104
+ }, t))
105
+ }) : null,
106
+ J ? /* @__PURE__ */ l("ol", {
107
+ className: "site-search__results",
108
+ id: W,
109
+ "aria-label": z("resultsLabel", P),
110
+ children: _.map((e) => /* @__PURE__ */ u("li", {
111
+ className: "site-search__result",
112
+ children: [
113
+ e.section ? /* @__PURE__ */ l("p", {
114
+ className: "site-search__result-section",
115
+ children: e.section
116
+ }) : null,
117
+ /* @__PURE__ */ l(G, {
118
+ className: "site-search__result-title",
119
+ children: k({
120
+ href: e.href,
121
+ className: "site-search__result-link",
122
+ children: e.title,
123
+ onClick: () => O?.(e)
124
+ })
125
+ }),
126
+ e.excerpt ? /* @__PURE__ */ l("p", {
127
+ className: "site-search__result-excerpt",
128
+ children: e.excerpt
129
+ }) : null,
130
+ e.displayUrl ? /* @__PURE__ */ l("p", {
131
+ className: "site-search__result-url",
132
+ children: e.displayUrl
133
+ }) : null
134
+ ]
135
+ }, e.href))
136
+ }) : null,
137
+ g === "ready" && _.length === 0 ? /* @__PURE__ */ l(o, {
138
+ className: "site-search__empty",
139
+ title: z("emptyTitle"),
140
+ description: z("emptyDescription")
141
+ }) : null,
142
+ g === "error" ? /* @__PURE__ */ l(i, {
143
+ className: "site-search__error",
144
+ variant: "error",
145
+ title: z("errorTitle"),
146
+ description: z("errorDescription"),
147
+ actions: S ? /* @__PURE__ */ l(n, {
148
+ variant: "outline",
149
+ onClick: S,
150
+ children: z("retry")
151
+ }) : void 0
152
+ }) : null,
153
+ w && J ? /* @__PURE__ */ l("div", {
154
+ className: "site-search__footer",
155
+ children: w
156
+ }) : null
157
+ ]
158
+ });
159
+ });
160
+ //#endregion
161
+ export { f as SiteSearch };