@inkeep/cxkit-react 0.5.29 → 0.5.31
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 client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),d=require("@inkeep/cxkit-styled"),
|
|
1
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),d=require("@inkeep/cxkit-styled"),l=require("react"),i=require("./widget-toggle.cjs"),S=require("./modal.cjs");function b(s){const{baseSettings:r,searchSettings:t}=s;return e.jsx(d.Shadow,{children:e.jsx(d.RootProvider,{config:{baseSettings:r,searchSettings:t},componentType:d.WebWidgetInteractionType.EmbeddedSearch,children:e.jsx(o,{...s})})})}function h(s){const{children:r,onToggleView:t,isHidden:c,shouldAutoFocusInput:n=!t}=s;return e.jsx(d.EmbeddedSearch.Provider,{isHidden:c,shouldAutoFocusInput:n,children:r})}function o(s){return e.jsx(h,{...s,children:e.jsx(m,{...s})})}function m(s){const{onToggleView:r,shouldShowAskAICard:t}=s,c=d.useModal(),n=d.useWidget(),a=c&&!n?S.ModalContent:l.Fragment;return e.jsx(a,{children:e.jsx(d.EmbeddedSearch.Wrapper,{"data-show-ask-ai-card":d.dataAttr(t),"data-composite":d.dataAttr(!!r||c?.isOpen),children:e.jsxs(d.EmbeddedSearch.Root,{children:[e.jsx(x,{...s}),e.jsxs(d.EmbeddedSearch.Content,{children:[e.jsx(j,{...s}),e.jsx(E,{})]}),e.jsx(R,{})]})})})}function x(s){const{onToggleView:r,askAILabel:t,searchLabel:c}=s,{query:n}=d.useSearch();return e.jsxs(d.EmbeddedSearch.InputGroup,{children:[e.jsx(d.EmbeddedSearch.InputIcon,{}),e.jsx(d.EmbeddedSearch.Input,{}),e.jsx(d.EmbeddedSearch.Loading,{}),r&&e.jsx(i.WidgetToggle,{onToggleView:r,query:n,askAILabel:t,searchLabel:c,view:"search"}),e.jsx(d.Modal.Close,{})]})}function j(s){const{searchSettings:{view:r}}=d.useInkeepConfig(),{askAILabel:t,onToggleView:c,shouldShowAskAICard:n=!!c&&r!=="dual-pane"}=s,{query:a}=d.useSearch(),{handleToggle:u}=i.useToggleView({onToggleView:c,query:a});return n?e.jsxs(d.EmbeddedSearch.AskAITrigger,{onSelect:()=>u("chat",!0),children:[e.jsx(d.EmbeddedSearch.AskAITriggerIcon,{}),e.jsxs(d.EmbeddedSearch.AskAITriggerLabel,{children:[t||"Ask AI",a&&` "${a}"`]}),e.jsx(d.EmbeddedSearch.AskAITriggerIndicator,{})]}):null}function E(){return e.jsxs(d.EmbeddedSearch.Results,{children:[e.jsx(d.EmbeddedSearch.ResultsLoading,{}),e.jsx(d.EmbeddedSearch.ResultsTabList,{children:s=>s.map(r=>e.jsx(d.EmbeddedSearch.ResultsTab,{tab:r},r))}),e.jsx(d.EmbeddedSearch.ResultsEmpty,{}),e.jsxs(d.EmbeddedSearch.ResultsContent,{children:[e.jsx(I,{}),e.jsx(g,{})]})]})}function I(){return e.jsxs(d.EmbeddedSearch.ResultsScrollArea,{children:[e.jsx(d.EmbeddedSearch.ResultsScrollAreaViewport,{children:e.jsx(d.EmbeddedSearch.ResultsList,{children:s=>s.map(r=>e.jsxs(d.EmbeddedSearch.ResultsItem,{item:r,children:[e.jsx(d.EmbeddedSearch.ResultsItemBreadcrumbs,{children:t=>t.map((c,n)=>e.jsxs(l.Fragment,{children:[c,e.jsx(d.EmbeddedSearch.ResultsItemBreadcrumbIcon,{})]},`${c}-${n}`))}),e.jsx(d.EmbeddedSearch.ResultsItemIcon,{}),e.jsx(d.EmbeddedSearch.ResultsItemTitle,{}),e.jsx(d.EmbeddedSearch.ResultsItemTag,{}),e.jsx(d.EmbeddedSearch.ResultsItemDescription,{children:t=>t.map((c,n)=>e.jsx(d.EmbeddedSearch.ResultsItemDescriptionPart,{part:c},`part-${n}`))}),e.jsx(d.EmbeddedSearch.ResultsItemIndicator,{})]},r.id))})}),e.jsx(d.EmbeddedSearch.ResultsScrollAreaScrollbar,{children:e.jsx(d.EmbeddedSearch.ResultsScrollAreaThumb,{})}),e.jsx(d.EmbeddedSearch.ResultsScrollAreaCorner,{})]})}function g(){return e.jsxs(d.EmbeddedSearch.ResultsScrollArea,{children:[e.jsx(d.EmbeddedSearch.ResultsScrollAreaViewport,{children:e.jsxs(d.EmbeddedSearch.ResultsItemPreview,{children:[e.jsxs(d.EmbeddedSearch.ResultsItemPreviewHeader,{children:[e.jsxs(d.EmbeddedSearch.ResultsItemPreviewHeading,{children:[e.jsx(d.EmbeddedSearch.ResultsItemPreviewTitle,{}),e.jsx(d.EmbeddedSearch.ResultsItemPreviewTitleLinkIcon,{})]}),e.jsx(d.EmbeddedSearch.ResultsItemPreviewBreadcrumbs,{children:s=>s.map((r,t)=>e.jsxs(l.Fragment,{children:[r,e.jsx(d.EmbeddedSearch.ResultsItemPreviewBreadcrumbIcon,{})]},`${r}-${t}`))})]}),e.jsx(d.EmbeddedSearch.ResultsItemPreviewBody,{}),e.jsxs(d.EmbeddedSearch.ResultsItemPreviewOutline,{children:[e.jsx(d.EmbeddedSearch.ResultsItemPreviewOutlineTitle,{}),e.jsx(d.EmbeddedSearch.ResultsItemPreviewOutlineList,{children:s=>s.map((r,t)=>e.jsxs(d.EmbeddedSearch.ResultsItemPreviewOutlineItem,{href:r.url??void 0,"data-is-match":d.dataAttr(r.isMatch),children:[e.jsx(d.EmbeddedSearch.ResultsItemPreviewOutlineItemIcon,{}),e.jsx(d.EmbeddedSearch.ResultsItemPreviewOutlineItemText,{children:r.content}),r.url&&e.jsx(d.EmbeddedSearch.ResultsItemPreviewOutlineItemLinkIcon,{})]},`${r.anchor}-${t}`))})]})]})}),e.jsx(d.EmbeddedSearch.ResultsScrollAreaScrollbar,{children:e.jsx(d.EmbeddedSearch.ResultsScrollAreaThumb,{})}),e.jsx(d.EmbeddedSearch.ResultsScrollAreaCorner,{})]})}function R(){return e.jsx(d.EmbeddedSearch.Footer,{children:e.jsxs(d.EmbeddedSearch.TaglineContainer,{children:[e.jsx(d.EmbeddedSearch.TaglineText,{}),e.jsx(d.EmbeddedSearch.TaglineLogo,{}),e.jsx(d.EmbeddedSearch.TaglineBrandName,{})]})})}exports.InkeepEmbeddedSearch=b;exports.InkeepEmbeddedSearchImpl=o;exports.InkeepEmbeddedSearchImplContent=m;exports.InkeepEmbeddedSearchProvider=h;
|
|
@@ -1,116 +1,166 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as
|
|
3
|
-
import { Shadow as
|
|
4
|
-
import { Fragment as
|
|
5
|
-
import { WidgetToggle as
|
|
6
|
-
import { ModalContent as
|
|
7
|
-
function
|
|
8
|
-
const { baseSettings:
|
|
9
|
-
return /* @__PURE__ */
|
|
10
|
-
|
|
2
|
+
import { jsx as t, jsxs as l } from "react/jsx-runtime";
|
|
3
|
+
import { Shadow as I, RootProvider as m, WebWidgetInteractionType as R, EmbeddedSearch as e, useModal as g, useWidget as p, dataAttr as u, useSearch as a, Modal as w, useInkeepConfig as A } from "@inkeep/cxkit-styled";
|
|
4
|
+
import { Fragment as d } from "react";
|
|
5
|
+
import { WidgetToggle as T, useToggleView as S } from "./widget-toggle.js";
|
|
6
|
+
import { ModalContent as v } from "./modal.js";
|
|
7
|
+
function F(n) {
|
|
8
|
+
const { baseSettings: r, searchSettings: s } = n;
|
|
9
|
+
return /* @__PURE__ */ t(I, { children: /* @__PURE__ */ t(
|
|
10
|
+
m,
|
|
11
11
|
{
|
|
12
12
|
config: {
|
|
13
|
-
baseSettings:
|
|
14
|
-
searchSettings:
|
|
13
|
+
baseSettings: r,
|
|
14
|
+
searchSettings: s
|
|
15
15
|
},
|
|
16
|
-
componentType:
|
|
17
|
-
children: /* @__PURE__ */
|
|
16
|
+
componentType: R.EmbeddedSearch,
|
|
17
|
+
children: /* @__PURE__ */ t(f, { ...n })
|
|
18
18
|
}
|
|
19
19
|
) });
|
|
20
20
|
}
|
|
21
|
-
function
|
|
22
|
-
const { children:
|
|
23
|
-
return /* @__PURE__ */ e
|
|
21
|
+
function P(n) {
|
|
22
|
+
const { children: r, onToggleView: s, isHidden: i, shouldAutoFocusInput: o = !s } = n;
|
|
23
|
+
return /* @__PURE__ */ t(e.Provider, { isHidden: i, shouldAutoFocusInput: o, children: r });
|
|
24
24
|
}
|
|
25
|
-
function
|
|
26
|
-
return /* @__PURE__ */
|
|
25
|
+
function f(n) {
|
|
26
|
+
return /* @__PURE__ */ t(P, { ...n, children: /* @__PURE__ */ t(k, { ...n }) });
|
|
27
27
|
}
|
|
28
|
-
function k(
|
|
29
|
-
const { onToggleView:
|
|
30
|
-
return /* @__PURE__ */
|
|
31
|
-
|
|
28
|
+
function k(n) {
|
|
29
|
+
const { onToggleView: r, shouldShowAskAICard: s } = n, i = g(), o = p();
|
|
30
|
+
return /* @__PURE__ */ t(i && !o ? v : d, { children: /* @__PURE__ */ t(
|
|
31
|
+
e.Wrapper,
|
|
32
32
|
{
|
|
33
|
-
"data-show-ask-ai-card":
|
|
34
|
-
"data-composite":
|
|
35
|
-
children: /* @__PURE__ */
|
|
36
|
-
/* @__PURE__ */
|
|
37
|
-
/* @__PURE__ */
|
|
38
|
-
/* @__PURE__ */
|
|
39
|
-
/* @__PURE__ */
|
|
33
|
+
"data-show-ask-ai-card": u(s),
|
|
34
|
+
"data-composite": u(!!r || i?.isOpen),
|
|
35
|
+
children: /* @__PURE__ */ l(e.Root, { children: [
|
|
36
|
+
/* @__PURE__ */ t(b, { ...n }),
|
|
37
|
+
/* @__PURE__ */ l(e.Content, { children: [
|
|
38
|
+
/* @__PURE__ */ t(C, { ...n }),
|
|
39
|
+
/* @__PURE__ */ t(L, {})
|
|
40
40
|
] }),
|
|
41
|
-
/* @__PURE__ */
|
|
41
|
+
/* @__PURE__ */ t(E, {})
|
|
42
42
|
] })
|
|
43
43
|
}
|
|
44
44
|
) });
|
|
45
45
|
}
|
|
46
|
-
function
|
|
47
|
-
const { onToggleView:
|
|
48
|
-
return /* @__PURE__ */
|
|
49
|
-
/* @__PURE__ */ e
|
|
50
|
-
/* @__PURE__ */ e
|
|
51
|
-
/* @__PURE__ */ e
|
|
52
|
-
|
|
53
|
-
|
|
46
|
+
function b(n) {
|
|
47
|
+
const { onToggleView: r, askAILabel: s, searchLabel: i } = n, { query: o } = a();
|
|
48
|
+
return /* @__PURE__ */ l(e.InputGroup, { children: [
|
|
49
|
+
/* @__PURE__ */ t(e.InputIcon, {}),
|
|
50
|
+
/* @__PURE__ */ t(e.Input, {}),
|
|
51
|
+
/* @__PURE__ */ t(e.Loading, {}),
|
|
52
|
+
r && /* @__PURE__ */ t(
|
|
53
|
+
T,
|
|
54
54
|
{
|
|
55
|
-
onToggleView:
|
|
56
|
-
query:
|
|
57
|
-
askAILabel:
|
|
58
|
-
searchLabel:
|
|
55
|
+
onToggleView: r,
|
|
56
|
+
query: o,
|
|
57
|
+
askAILabel: s,
|
|
58
|
+
searchLabel: i,
|
|
59
59
|
view: "search"
|
|
60
60
|
}
|
|
61
61
|
),
|
|
62
|
-
/* @__PURE__ */
|
|
62
|
+
/* @__PURE__ */ t(w.Close, {})
|
|
63
63
|
] });
|
|
64
64
|
}
|
|
65
|
-
function C(
|
|
66
|
-
const {
|
|
67
|
-
|
|
68
|
-
|
|
65
|
+
function C(n) {
|
|
66
|
+
const {
|
|
67
|
+
searchSettings: { view: r }
|
|
68
|
+
} = A(), {
|
|
69
|
+
askAILabel: s,
|
|
70
|
+
onToggleView: i,
|
|
71
|
+
shouldShowAskAICard: o = !!i && r !== "dual-pane"
|
|
72
|
+
} = n, { query: c } = a(), { handleToggle: h } = S({
|
|
73
|
+
onToggleView: i,
|
|
74
|
+
query: c
|
|
69
75
|
});
|
|
70
|
-
return
|
|
71
|
-
/* @__PURE__ */ e
|
|
72
|
-
/* @__PURE__ */
|
|
73
|
-
|
|
74
|
-
|
|
76
|
+
return o ? /* @__PURE__ */ l(e.AskAITrigger, { onSelect: () => h("chat", !0), children: [
|
|
77
|
+
/* @__PURE__ */ t(e.AskAITriggerIcon, {}),
|
|
78
|
+
/* @__PURE__ */ l(e.AskAITriggerLabel, { children: [
|
|
79
|
+
s || "Ask AI",
|
|
80
|
+
c && ` "${c}"`
|
|
75
81
|
] }),
|
|
76
|
-
/* @__PURE__ */ e
|
|
82
|
+
/* @__PURE__ */ t(e.AskAITriggerIndicator, {})
|
|
77
83
|
] }) : null;
|
|
78
84
|
}
|
|
79
85
|
function L() {
|
|
80
|
-
return /* @__PURE__ */
|
|
81
|
-
/* @__PURE__ */ e
|
|
82
|
-
/* @__PURE__ */ e
|
|
83
|
-
/* @__PURE__ */ e
|
|
84
|
-
/* @__PURE__ */
|
|
85
|
-
/* @__PURE__ */
|
|
86
|
-
/* @__PURE__ */
|
|
87
|
-
/* @__PURE__ */ e(t.ResultsScrollAreaCorner, {})
|
|
86
|
+
return /* @__PURE__ */ l(e.Results, { children: [
|
|
87
|
+
/* @__PURE__ */ t(e.ResultsLoading, {}),
|
|
88
|
+
/* @__PURE__ */ t(e.ResultsTabList, { children: (n) => n.map((r) => /* @__PURE__ */ t(e.ResultsTab, { tab: r }, r)) }),
|
|
89
|
+
/* @__PURE__ */ t(e.ResultsEmpty, {}),
|
|
90
|
+
/* @__PURE__ */ l(e.ResultsContent, { children: [
|
|
91
|
+
/* @__PURE__ */ t(O, {}),
|
|
92
|
+
/* @__PURE__ */ t($, {})
|
|
88
93
|
] })
|
|
89
94
|
] });
|
|
90
95
|
}
|
|
91
|
-
function
|
|
92
|
-
return /* @__PURE__ */ e
|
|
93
|
-
/* @__PURE__ */ e(
|
|
94
|
-
s,
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
96
|
+
function O() {
|
|
97
|
+
return /* @__PURE__ */ l(e.ResultsScrollArea, { children: [
|
|
98
|
+
/* @__PURE__ */ t(e.ResultsScrollAreaViewport, { children: /* @__PURE__ */ t(e.ResultsList, { children: (n) => n.map((r) => /* @__PURE__ */ l(e.ResultsItem, { item: r, children: [
|
|
99
|
+
/* @__PURE__ */ t(e.ResultsItemBreadcrumbs, { children: (s) => s.map((i, o) => /* @__PURE__ */ l(d, { children: [
|
|
100
|
+
i,
|
|
101
|
+
/* @__PURE__ */ t(e.ResultsItemBreadcrumbIcon, {})
|
|
102
|
+
] }, `${i}-${o}`)) }),
|
|
103
|
+
/* @__PURE__ */ t(e.ResultsItemIcon, {}),
|
|
104
|
+
/* @__PURE__ */ t(e.ResultsItemTitle, {}),
|
|
105
|
+
/* @__PURE__ */ t(e.ResultsItemTag, {}),
|
|
106
|
+
/* @__PURE__ */ t(e.ResultsItemDescription, { children: (s) => s.map((i, o) => /* @__PURE__ */ t(
|
|
107
|
+
e.ResultsItemDescriptionPart,
|
|
108
|
+
{
|
|
109
|
+
part: i
|
|
110
|
+
},
|
|
111
|
+
`part-${o}`
|
|
112
|
+
)) }),
|
|
113
|
+
/* @__PURE__ */ t(e.ResultsItemIndicator, {})
|
|
114
|
+
] }, r.id)) }) }),
|
|
115
|
+
/* @__PURE__ */ t(e.ResultsScrollAreaScrollbar, { children: /* @__PURE__ */ t(e.ResultsScrollAreaThumb, {}) }),
|
|
116
|
+
/* @__PURE__ */ t(e.ResultsScrollAreaCorner, {})
|
|
117
|
+
] });
|
|
103
118
|
}
|
|
104
|
-
function
|
|
105
|
-
return /* @__PURE__ */ e
|
|
106
|
-
/* @__PURE__ */ e(
|
|
107
|
-
|
|
108
|
-
|
|
119
|
+
function $() {
|
|
120
|
+
return /* @__PURE__ */ l(e.ResultsScrollArea, { children: [
|
|
121
|
+
/* @__PURE__ */ t(e.ResultsScrollAreaViewport, { children: /* @__PURE__ */ l(e.ResultsItemPreview, { children: [
|
|
122
|
+
/* @__PURE__ */ l(e.ResultsItemPreviewHeader, { children: [
|
|
123
|
+
/* @__PURE__ */ l(e.ResultsItemPreviewHeading, { children: [
|
|
124
|
+
/* @__PURE__ */ t(e.ResultsItemPreviewTitle, {}),
|
|
125
|
+
/* @__PURE__ */ t(e.ResultsItemPreviewTitleLinkIcon, {})
|
|
126
|
+
] }),
|
|
127
|
+
/* @__PURE__ */ t(e.ResultsItemPreviewBreadcrumbs, { children: (n) => n.map((r, s) => /* @__PURE__ */ l(d, { children: [
|
|
128
|
+
r,
|
|
129
|
+
/* @__PURE__ */ t(e.ResultsItemPreviewBreadcrumbIcon, {})
|
|
130
|
+
] }, `${r}-${s}`)) })
|
|
131
|
+
] }),
|
|
132
|
+
/* @__PURE__ */ t(e.ResultsItemPreviewBody, {}),
|
|
133
|
+
/* @__PURE__ */ l(e.ResultsItemPreviewOutline, { children: [
|
|
134
|
+
/* @__PURE__ */ t(e.ResultsItemPreviewOutlineTitle, {}),
|
|
135
|
+
/* @__PURE__ */ t(e.ResultsItemPreviewOutlineList, { children: (n) => n.map((r, s) => /* @__PURE__ */ l(
|
|
136
|
+
e.ResultsItemPreviewOutlineItem,
|
|
137
|
+
{
|
|
138
|
+
href: r.url ?? void 0,
|
|
139
|
+
"data-is-match": u(r.isMatch),
|
|
140
|
+
children: [
|
|
141
|
+
/* @__PURE__ */ t(e.ResultsItemPreviewOutlineItemIcon, {}),
|
|
142
|
+
/* @__PURE__ */ t(e.ResultsItemPreviewOutlineItemText, { children: r.content }),
|
|
143
|
+
r.url && /* @__PURE__ */ t(e.ResultsItemPreviewOutlineItemLinkIcon, {})
|
|
144
|
+
]
|
|
145
|
+
},
|
|
146
|
+
`${r.anchor}-${s}`
|
|
147
|
+
)) })
|
|
148
|
+
] })
|
|
149
|
+
] }) }),
|
|
150
|
+
/* @__PURE__ */ t(e.ResultsScrollAreaScrollbar, { children: /* @__PURE__ */ t(e.ResultsScrollAreaThumb, {}) }),
|
|
151
|
+
/* @__PURE__ */ t(e.ResultsScrollAreaCorner, {})
|
|
152
|
+
] });
|
|
153
|
+
}
|
|
154
|
+
function E() {
|
|
155
|
+
return /* @__PURE__ */ t(e.Footer, { children: /* @__PURE__ */ l(e.TaglineContainer, { children: [
|
|
156
|
+
/* @__PURE__ */ t(e.TaglineText, {}),
|
|
157
|
+
/* @__PURE__ */ t(e.TaglineLogo, {}),
|
|
158
|
+
/* @__PURE__ */ t(e.TaglineBrandName, {})
|
|
109
159
|
] }) });
|
|
110
160
|
}
|
|
111
161
|
export {
|
|
112
|
-
|
|
113
|
-
|
|
162
|
+
F as InkeepEmbeddedSearch,
|
|
163
|
+
f as InkeepEmbeddedSearchImpl,
|
|
114
164
|
k as InkeepEmbeddedSearchImplContent,
|
|
115
|
-
|
|
165
|
+
P as InkeepEmbeddedSearchProvider
|
|
116
166
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inkeep/cxkit-react",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.31",
|
|
4
4
|
"description": "",
|
|
5
5
|
"license": "Inkeep, Inc. Customer License (IICL) v1.1",
|
|
6
6
|
"homepage": "",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"sideEffects": false,
|
|
22
22
|
"dependencies": {
|
|
23
23
|
"@radix-ui/react-use-controllable-state": "^1.1.0",
|
|
24
|
-
"@inkeep/cxkit-styled": "0.5.
|
|
24
|
+
"@inkeep/cxkit-styled": "0.5.31"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
27
|
"@biomejs/biome": "1.9.4",
|
|
@@ -44,8 +44,8 @@
|
|
|
44
44
|
"typescript": "5.7.3",
|
|
45
45
|
"vite": "5.4.11",
|
|
46
46
|
"vite-plugin-dts": "4.4.0",
|
|
47
|
-
"@inkeep/cxkit-color-mode": "0.5.
|
|
48
|
-
"@inkeep/cxkit-types": "0.5.
|
|
47
|
+
"@inkeep/cxkit-color-mode": "0.5.31",
|
|
48
|
+
"@inkeep/cxkit-types": "0.5.31"
|
|
49
49
|
},
|
|
50
50
|
"module": "dist/index.js",
|
|
51
51
|
"types": "dist/index.d.ts",
|