@clubmed/trident-ui 2.1.0-beta.3 → 2.1.0-beta.5
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.
- package/README.md +1 -0
- package/chunks/ChatMessage.js +282 -265
- package/chunks/ChatMessage.js.map +1 -1
- package/chunks/Layer.js +2022 -0
- package/chunks/Layer.js.map +1 -0
- package/chunks/useTransitionState.js +69 -0
- package/chunks/useTransitionState.js.map +1 -0
- package/examples/backdrop-demo.js +1 -1
- package/examples/chat-body-demo.js +4 -2
- package/examples/chat-body-demo.js.map +1 -1
- package/examples/chat-button-demo.js +2 -1
- package/examples/chat-button-demo.js.map +1 -1
- package/examples/chat-button-offset-demo.js +2 -1
- package/examples/chat-button-offset-demo.js.map +1 -1
- package/examples/chat-header-demo.js +2 -1
- package/examples/chat-header-demo.js.map +1 -1
- package/examples/chat-input-demo.js +2 -1
- package/examples/chat-input-demo.js.map +1 -1
- package/examples/chat-input-streaming-demo.d.ts +1 -0
- package/examples/chat-input-streaming-demo.js +30 -0
- package/examples/chat-input-streaming-demo.js.map +1 -0
- package/examples/chat-input-submit-on-enter-demo.d.ts +1 -0
- package/examples/chat-input-submit-on-enter-demo.js +23 -0
- package/examples/chat-input-submit-on-enter-demo.js.map +1 -0
- package/examples/chat-message-actions-demo.d.ts +1 -0
- package/examples/chat-message-actions-demo.js +29 -0
- package/examples/chat-message-actions-demo.js.map +1 -0
- package/examples/chat-message-demo.js +1 -0
- package/examples/chat-message-demo.js.map +1 -1
- package/examples/chat-message-editor-demo.d.ts +1 -0
- package/examples/chat-message-editor-demo.js +30 -0
- package/examples/chat-message-editor-demo.js.map +1 -0
- package/examples/chat-message-with-actions-demo.d.ts +1 -0
- package/examples/chat-message-with-actions-demo.js +26 -0
- package/examples/chat-message-with-actions-demo.js.map +1 -0
- package/examples/chat-typing-indicator-demo.js +2 -1
- package/examples/chat-typing-indicator-demo.js.map +1 -1
- package/examples/chat-window-csat-demo.js +2 -1
- package/examples/chat-window-csat-demo.js.map +1 -1
- package/examples/chat-window-csat-prompt-demo.js +2 -1
- package/examples/chat-window-csat-prompt-demo.js.map +1 -1
- package/examples/chat-window-demo.js +2 -1
- package/examples/chat-window-demo.js.map +1 -1
- package/examples/chat-window-quote-demo.js +2 -1
- package/examples/chat-window-quote-demo.js.map +1 -1
- package/examples/chat-window-quotes-demo.js +2 -1
- package/examples/chat-window-quotes-demo.js.map +1 -1
- package/examples/layer-buttons-demo.d.ts +1 -0
- package/examples/layer-buttons-demo.js +43 -0
- package/examples/layer-buttons-demo.js.map +1 -0
- package/examples/layer-demo.d.ts +1 -0
- package/examples/layer-demo.js +30 -0
- package/examples/layer-demo.js.map +1 -0
- package/examples/layer-header-demo.d.ts +1 -0
- package/examples/layer-header-demo.js +27 -0
- package/examples/layer-header-demo.js.map +1 -0
- package/examples/layer-nested-demo.d.ts +1 -0
- package/examples/layer-nested-demo.js +51 -0
- package/examples/layer-nested-demo.js.map +1 -0
- package/examples/layer-pinned-demo.d.ts +1 -0
- package/examples/layer-pinned-demo.js +36 -0
- package/examples/layer-pinned-demo.js.map +1 -0
- package/examples/layer-scale-demo.d.ts +1 -0
- package/examples/layer-scale-demo.js +34 -0
- package/examples/layer-scale-demo.js.map +1 -0
- package/examples/layer-use-layer-demo.d.ts +1 -0
- package/examples/layer-use-layer-demo.js +33 -0
- package/examples/layer-use-layer-demo.js.map +1 -0
- package/package.json +2 -1
- package/ui/Backdrop.d.ts +5 -0
- package/ui/Backdrop.js +54 -2
- package/ui/Backdrop.js.map +1 -0
- package/ui/ChatBody.d.ts +1 -25
- package/ui/ChatBody.js +2 -88
- package/ui/ChatButton.d.ts +1 -6
- package/ui/ChatButton.js +2 -33
- package/ui/ChatHeader.d.ts +1 -6
- package/ui/ChatHeader.js +2 -43
- package/ui/ChatInput.d.ts +1 -10
- package/ui/ChatInput.js +2 -148
- package/ui/ChatMessage.d.ts +1 -6
- package/ui/ChatMessage.js +1 -0
- package/ui/ChatTypingIndicator.d.ts +1 -2
- package/ui/ChatTypingIndicator.js +2 -30
- package/ui/ChatWindow.d.ts +1 -34
- package/ui/ChatWindow.js +2 -57
- package/ui/ChatWindowCsatPrompt.d.ts +1 -15
- package/ui/ChatWindowCsatPrompt.js +2 -70
- package/ui/ChatWindowCsatThankYou.d.ts +1 -9
- package/ui/ChatWindowCsatThankYou.js +2 -28
- package/ui/ChatWindowQuote.d.ts +1 -22
- package/ui/ChatWindowQuote.js +2 -140
- package/ui/Layer.d.ts +72 -0
- package/ui/Layer.js +2 -0
- package/ui/LayerHeader.d.ts +33 -0
- package/ui/LayerHeader.js +45 -0
- package/ui/LayerHeader.js.map +1 -0
- package/ui/Loader.js +2 -1
- package/ui/Loader.js.map +1 -1
- package/ui/Popin.d.ts +6 -0
- package/ui/Popin.js +11 -10
- package/ui/Popin.js.map +1 -1
- package/ui/chat/ChatBody.d.ts +31 -0
- package/ui/chat/ChatBody.js +92 -0
- package/ui/chat/ChatBody.js.map +1 -0
- package/ui/chat/ChatButton.d.ts +6 -0
- package/ui/chat/ChatButton.js +33 -0
- package/ui/chat/ChatButton.js.map +1 -0
- package/ui/chat/ChatHeader.d.ts +6 -0
- package/ui/chat/ChatHeader.js +43 -0
- package/ui/chat/ChatHeader.js.map +1 -0
- package/ui/chat/ChatInput.d.ts +28 -0
- package/ui/chat/ChatInput.js +165 -0
- package/ui/chat/ChatInput.js.map +1 -0
- package/ui/chat/ChatMessage.d.ts +17 -0
- package/ui/chat/ChatMessage.js +2 -0
- package/ui/chat/ChatMessageActions.d.ts +23 -0
- package/ui/chat/ChatMessageActions.js +69 -0
- package/ui/chat/ChatMessageActions.js.map +1 -0
- package/ui/chat/ChatMessageEditor.d.ts +9 -0
- package/ui/chat/ChatMessageEditor.js +57 -0
- package/ui/chat/ChatMessageEditor.js.map +1 -0
- package/ui/chat/ChatTypingIndicator.d.ts +2 -0
- package/ui/chat/ChatTypingIndicator.js +30 -0
- package/ui/chat/ChatTypingIndicator.js.map +1 -0
- package/ui/chat/ChatWindow.d.ts +37 -0
- package/ui/chat/ChatWindow.js +65 -0
- package/ui/chat/ChatWindow.js.map +1 -0
- package/ui/chat/ChatWindowCsatPrompt.d.ts +15 -0
- package/ui/chat/ChatWindowCsatPrompt.js +71 -0
- package/ui/chat/ChatWindowCsatPrompt.js.map +1 -0
- package/ui/chat/ChatWindowCsatThankYou.d.ts +9 -0
- package/ui/chat/ChatWindowCsatThankYou.js +29 -0
- package/ui/chat/ChatWindowCsatThankYou.js.map +1 -0
- package/ui/chat/ChatWindowQuote.d.ts +22 -0
- package/ui/chat/ChatWindowQuote.js +141 -0
- package/ui/chat/ChatWindowQuote.js.map +1 -0
- package/ui/hooks/useIsomorphicLayoutEffect.d.ts +6 -0
- package/ui/hooks/useIsomorphicLayoutEffect.js +7 -0
- package/ui/hooks/useIsomorphicLayoutEffect.js.map +1 -0
- package/ui/hooks/useLayer.d.ts +13 -0
- package/ui/hooks/useLayer.js +31 -0
- package/ui/hooks/useLayer.js.map +1 -0
- package/ui/hooks/useTransitionState.d.ts +7 -0
- package/ui/hooks/useTransitionState.js +15 -0
- package/ui/hooks/useTransitionState.js.map +1 -0
- package/ui/hooks/useVisualViewportBox.d.ts +7 -0
- package/ui/hooks/useVisualViewportBox.js +22 -0
- package/ui/hooks/useVisualViewportBox.js.map +1 -0
- package/chunks/Backdrop.js +0 -105
- package/chunks/Backdrop.js.map +0 -1
- package/ui/ChatBody.js.map +0 -1
- package/ui/ChatButton.js.map +0 -1
- package/ui/ChatHeader.js.map +0 -1
- package/ui/ChatInput.js.map +0 -1
- package/ui/ChatTypingIndicator.js.map +0 -1
- package/ui/ChatWindow.js.map +0 -1
- package/ui/ChatWindowCsatPrompt.js.map +0 -1
- package/ui/ChatWindowCsatThankYou.js.map +0 -1
- package/ui/ChatWindowQuote.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function LayerDemo(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Button as e } from "../ui/buttons/Button.js";
|
|
3
|
+
import { t } from "../chunks/Layer.js";
|
|
4
|
+
import { useState as n } from "react";
|
|
5
|
+
import { jsx as r, jsxs as i } from "react/jsx-runtime";
|
|
6
|
+
//#region lib/examples/layer-demo.tsx
|
|
7
|
+
function a() {
|
|
8
|
+
let [a, o] = n(!1), s = () => o(!1);
|
|
9
|
+
return /* @__PURE__ */ i("div", { children: [/* @__PURE__ */ r(e, {
|
|
10
|
+
onClick: () => o(!0),
|
|
11
|
+
children: "Open Layer"
|
|
12
|
+
}), /* @__PURE__ */ r(t, {
|
|
13
|
+
heading: "Your stay",
|
|
14
|
+
isOpen: a,
|
|
15
|
+
onClose: s,
|
|
16
|
+
rightButton: {
|
|
17
|
+
label: "Close",
|
|
18
|
+
icon: "CrossDefault",
|
|
19
|
+
onClick: s
|
|
20
|
+
},
|
|
21
|
+
children: /* @__PURE__ */ i("div", {
|
|
22
|
+
className: "space-y-20 p-20",
|
|
23
|
+
children: [/* @__PURE__ */ r("p", { children: "A Layer covers the whole screen and slides in from the side. Press Escape or use the close button to dismiss it." }), /* @__PURE__ */ r("p", { children: "Its body scrolls on its own, below the header, while the page behind it stays locked." })]
|
|
24
|
+
})
|
|
25
|
+
})] });
|
|
26
|
+
}
|
|
27
|
+
//#endregion
|
|
28
|
+
export { a as default };
|
|
29
|
+
|
|
30
|
+
//# sourceMappingURL=layer-demo.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"layer-demo.js","names":[],"sources":["../../lib/examples/layer-demo.tsx"],"sourcesContent":["'use client';\n\nimport { useState } from 'react';\nimport { Layer } from '@/ui/Layer';\nimport { Button } from '@/ui/buttons/Button';\n\nexport default function LayerDemo() {\n const [isOpen, setIsOpen] = useState(false);\n const close = () => setIsOpen(false);\n\n return (\n <div>\n <Button onClick={() => setIsOpen(true)}>Open Layer</Button>\n <Layer\n heading=\"Your stay\"\n isOpen={isOpen}\n onClose={close}\n rightButton={{ label: 'Close', icon: 'CrossDefault', onClick: close }}\n >\n <div className=\"space-y-20 p-20\">\n <p>\n A Layer covers the whole screen and slides in from the side. Press Escape or use the\n close button to dismiss it.\n </p>\n <p>\n Its body scrolls on its own, below the header, while the page behind it stays locked.\n </p>\n </div>\n </Layer>\n </div>\n );\n}\n"],"mappings":";;;;;;AAMA,SAAwB,IAAY;CAClC,IAAM,CAAC,GAAQ,KAAa,EAAS,GAAM,EACrC,UAAc,EAAU,GAAM;AAEpC,QACE,kBAAC,OAAD,EAAA,UAAA,CACE,kBAAC,GAAD;EAAQ,eAAe,EAAU,GAAK;YAAE;EAAmB,CAAA,EAC3D,kBAAC,GAAD;EACE,SAAQ;EACA;EACR,SAAS;EACT,aAAa;GAAE,OAAO;GAAS,MAAM;GAAgB,SAAS;GAAO;YAErE,kBAAC,OAAD;GAAK,WAAU;aAAf,CACE,kBAAC,KAAD,EAAA,UAAG,oHAGC,CAAA,EACJ,kBAAC,KAAD,EAAA,UAAG,yFAEC,CAAA,CAAA;;EAEA,CAAA,CACJ,EAAA,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function LayerHeaderDemo(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { LayerHeader as e } from "../ui/LayerHeader.js";
|
|
3
|
+
import { jsx as t } from "react/jsx-runtime";
|
|
4
|
+
//#region lib/examples/layer-header-demo.tsx
|
|
5
|
+
function n() {
|
|
6
|
+
return /* @__PURE__ */ t("div", {
|
|
7
|
+
className: "border-lightGrey w-full border",
|
|
8
|
+
children: /* @__PURE__ */ t(e, {
|
|
9
|
+
hLevel: 2,
|
|
10
|
+
leftButton: {
|
|
11
|
+
label: "Back",
|
|
12
|
+
icon: "ArrowDefaultLeft",
|
|
13
|
+
onClick: () => {}
|
|
14
|
+
},
|
|
15
|
+
rightButton: {
|
|
16
|
+
label: "Close",
|
|
17
|
+
icon: "CrossDefault",
|
|
18
|
+
onClick: () => {}
|
|
19
|
+
},
|
|
20
|
+
children: "Search filters"
|
|
21
|
+
})
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
//#endregion
|
|
25
|
+
export { n as default };
|
|
26
|
+
|
|
27
|
+
//# sourceMappingURL=layer-header-demo.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"layer-header-demo.js","names":[],"sources":["../../lib/examples/layer-header-demo.tsx"],"sourcesContent":["'use client';\n\nimport { LayerHeader } from '@/ui/LayerHeader';\n\nexport default function LayerHeaderDemo() {\n return (\n <div className=\"border-lightGrey w-full border\">\n <LayerHeader\n hLevel={2}\n leftButton={{ label: 'Back', icon: 'ArrowDefaultLeft', onClick: () => {} }}\n rightButton={{ label: 'Close', icon: 'CrossDefault', onClick: () => {} }}\n >\n Search filters\n </LayerHeader>\n </div>\n );\n}\n"],"mappings":";;;;AAIA,SAAwB,IAAkB;AACxC,QACE,kBAAC,OAAD;EAAK,WAAU;YACb,kBAAC,GAAD;GACE,QAAQ;GACR,YAAY;IAAE,OAAO;IAAQ,MAAM;IAAoB,eAAe;IAAI;GAC1E,aAAa;IAAE,OAAO;IAAS,MAAM;IAAgB,eAAe;IAAI;aACzE;GAEa,CAAA;EACV,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function LayerNestedDemo(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Button as e } from "../ui/buttons/Button.js";
|
|
3
|
+
import { t } from "../chunks/Layer.js";
|
|
4
|
+
import { useState as n } from "react";
|
|
5
|
+
import { jsx as r, jsxs as i } from "react/jsx-runtime";
|
|
6
|
+
//#region lib/examples/layer-nested-demo.tsx
|
|
7
|
+
function a() {
|
|
8
|
+
let [a, o] = n(!1), [s, c] = n(!1), l = () => o(!1), u = () => c(!1);
|
|
9
|
+
return /* @__PURE__ */ i("div", { children: [
|
|
10
|
+
/* @__PURE__ */ r(e, {
|
|
11
|
+
onClick: () => o(!0),
|
|
12
|
+
children: "Filters"
|
|
13
|
+
}),
|
|
14
|
+
/* @__PURE__ */ r(t, {
|
|
15
|
+
heading: "Filters",
|
|
16
|
+
isOpen: a,
|
|
17
|
+
onClose: l,
|
|
18
|
+
rightButton: {
|
|
19
|
+
label: "Close",
|
|
20
|
+
icon: "CrossDefault",
|
|
21
|
+
onClick: l
|
|
22
|
+
},
|
|
23
|
+
children: /* @__PURE__ */ i("div", {
|
|
24
|
+
className: "space-y-20 p-20",
|
|
25
|
+
children: [/* @__PURE__ */ r("p", { children: "A second layer can open on top of this one." }), /* @__PURE__ */ r(e, {
|
|
26
|
+
onClick: () => c(!0),
|
|
27
|
+
children: "Choose dates"
|
|
28
|
+
})]
|
|
29
|
+
})
|
|
30
|
+
}),
|
|
31
|
+
/* @__PURE__ */ r(t, {
|
|
32
|
+
heading: "Dates",
|
|
33
|
+
hLevel: 2,
|
|
34
|
+
isOpen: s,
|
|
35
|
+
onClose: u,
|
|
36
|
+
leftButton: {
|
|
37
|
+
label: "Back to filters",
|
|
38
|
+
icon: "ArrowDefaultLeft",
|
|
39
|
+
onClick: u
|
|
40
|
+
},
|
|
41
|
+
children: /* @__PURE__ */ r("div", {
|
|
42
|
+
className: "p-20",
|
|
43
|
+
children: /* @__PURE__ */ r("p", { children: "Escape closes this layer only, and returns to the filters." })
|
|
44
|
+
})
|
|
45
|
+
})
|
|
46
|
+
] });
|
|
47
|
+
}
|
|
48
|
+
//#endregion
|
|
49
|
+
export { a as default };
|
|
50
|
+
|
|
51
|
+
//# sourceMappingURL=layer-nested-demo.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"layer-nested-demo.js","names":[],"sources":["../../lib/examples/layer-nested-demo.tsx"],"sourcesContent":["'use client';\n\nimport { useState } from 'react';\nimport { Layer } from '@/ui/Layer';\nimport { Button } from '@/ui/buttons/Button';\n\nexport default function LayerNestedDemo() {\n const [isFiltersOpen, setIsFiltersOpen] = useState(false);\n const [isDatesOpen, setIsDatesOpen] = useState(false);\n\n const closeFilters = () => setIsFiltersOpen(false);\n const closeDates = () => setIsDatesOpen(false);\n\n return (\n <div>\n <Button onClick={() => setIsFiltersOpen(true)}>Filters</Button>\n <Layer\n heading=\"Filters\"\n isOpen={isFiltersOpen}\n onClose={closeFilters}\n rightButton={{ label: 'Close', icon: 'CrossDefault', onClick: closeFilters }}\n >\n <div className=\"space-y-20 p-20\">\n <p>A second layer can open on top of this one.</p>\n <Button onClick={() => setIsDatesOpen(true)}>Choose dates</Button>\n </div>\n </Layer>\n <Layer\n heading=\"Dates\"\n hLevel={2}\n isOpen={isDatesOpen}\n onClose={closeDates}\n leftButton={{ label: 'Back to filters', icon: 'ArrowDefaultLeft', onClick: closeDates }}\n >\n <div className=\"p-20\">\n <p>Escape closes this layer only, and returns to the filters.</p>\n </div>\n </Layer>\n </div>\n );\n}\n"],"mappings":";;;;;;AAMA,SAAwB,IAAkB;CACxC,IAAM,CAAC,GAAe,KAAoB,EAAS,GAAM,EACnD,CAAC,GAAa,KAAkB,EAAS,GAAM,EAE/C,UAAqB,EAAiB,GAAM,EAC5C,UAAmB,EAAe,GAAM;AAE9C,QACE,kBAAC,OAAD,EAAA,UAAA;EACE,kBAAC,GAAD;GAAQ,eAAe,EAAiB,GAAK;aAAE;GAAgB,CAAA;EAC/D,kBAAC,GAAD;GACE,SAAQ;GACR,QAAQ;GACR,SAAS;GACT,aAAa;IAAE,OAAO;IAAS,MAAM;IAAgB,SAAS;IAAc;aAE5E,kBAAC,OAAD;IAAK,WAAU;cAAf,CACE,kBAAC,KAAD,EAAA,UAAG,+CAA+C,CAAA,EAClD,kBAAC,GAAD;KAAQ,eAAe,EAAe,GAAK;eAAE;KAAqB,CAAA,CAAA;;GAE9D,CAAA;EACR,kBAAC,GAAD;GACE,SAAQ;GACR,QAAQ;GACR,QAAQ;GACR,SAAS;GACT,YAAY;IAAE,OAAO;IAAmB,MAAM;IAAoB,SAAS;IAAY;aAEvF,kBAAC,OAAD;IAAK,WAAU;cACb,kBAAC,KAAD,EAAA,UAAG,8DAA8D,CAAA;IAC7D,CAAA;GACA,CAAA;EACJ,EAAA,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function LayerPinnedDemo(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Button as e } from "../ui/buttons/Button.js";
|
|
3
|
+
import { t } from "../chunks/Layer.js";
|
|
4
|
+
import { useState as n } from "react";
|
|
5
|
+
import { jsx as r, jsxs as i } from "react/jsx-runtime";
|
|
6
|
+
//#region lib/examples/layer-pinned-demo.tsx
|
|
7
|
+
function a() {
|
|
8
|
+
let [a, o] = n(!1), s = () => o(!1);
|
|
9
|
+
return /* @__PURE__ */ i("div", { children: [/* @__PURE__ */ r(e, {
|
|
10
|
+
onClick: () => o(!0),
|
|
11
|
+
icon: "Search",
|
|
12
|
+
children: "Search a resort"
|
|
13
|
+
}), /* @__PURE__ */ r(t, {
|
|
14
|
+
heading: "Search",
|
|
15
|
+
isOpen: a,
|
|
16
|
+
onClose: s,
|
|
17
|
+
pinToVisualViewport: !0,
|
|
18
|
+
rightButton: {
|
|
19
|
+
label: "Close",
|
|
20
|
+
icon: "CrossDefault",
|
|
21
|
+
onClick: s
|
|
22
|
+
},
|
|
23
|
+
children: /* @__PURE__ */ r("div", {
|
|
24
|
+
className: "p-20",
|
|
25
|
+
children: /* @__PURE__ */ r("input", {
|
|
26
|
+
"aria-label": "Destination",
|
|
27
|
+
className: "w-full rounded-pill border border-black px-20 py-12",
|
|
28
|
+
placeholder: "Where do you want to go?"
|
|
29
|
+
})
|
|
30
|
+
})
|
|
31
|
+
})] });
|
|
32
|
+
}
|
|
33
|
+
//#endregion
|
|
34
|
+
export { a as default };
|
|
35
|
+
|
|
36
|
+
//# sourceMappingURL=layer-pinned-demo.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"layer-pinned-demo.js","names":[],"sources":["../../lib/examples/layer-pinned-demo.tsx"],"sourcesContent":["'use client';\n\nimport { useState } from 'react';\nimport { Layer } from '@/ui/Layer';\nimport { Button } from '@/ui/buttons/Button';\n\nexport default function LayerPinnedDemo() {\n const [isOpen, setIsOpen] = useState(false);\n const close = () => setIsOpen(false);\n\n return (\n <div>\n <Button onClick={() => setIsOpen(true)} icon=\"Search\">\n Search a resort\n </Button>\n <Layer\n heading=\"Search\"\n isOpen={isOpen}\n onClose={close}\n pinToVisualViewport\n rightButton={{ label: 'Close', icon: 'CrossDefault', onClick: close }}\n >\n <div className=\"p-20\">\n <input\n aria-label=\"Destination\"\n className=\"w-full rounded-pill border border-black px-20 py-12\"\n placeholder=\"Where do you want to go?\"\n />\n </div>\n </Layer>\n </div>\n );\n}\n"],"mappings":";;;;;;AAMA,SAAwB,IAAkB;CACxC,IAAM,CAAC,GAAQ,KAAa,EAAS,GAAM,EACrC,UAAc,EAAU,GAAM;AAEpC,QACE,kBAAC,OAAD,EAAA,UAAA,CACE,kBAAC,GAAD;EAAQ,eAAe,EAAU,GAAK;EAAE,MAAK;YAAS;EAE7C,CAAA,EACT,kBAAC,GAAD;EACE,SAAQ;EACA;EACR,SAAS;EACT,qBAAA;EACA,aAAa;GAAE,OAAO;GAAS,MAAM;GAAgB,SAAS;GAAO;YAErE,kBAAC,OAAD;GAAK,WAAU;aACb,kBAAC,SAAD;IACE,cAAW;IACX,WAAU;IACV,aAAY;IACZ,CAAA;GACE,CAAA;EACA,CAAA,CACJ,EAAA,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function LayerScaleDemo(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Button as e } from "../ui/buttons/Button.js";
|
|
3
|
+
import { t } from "../chunks/Layer.js";
|
|
4
|
+
import { useRef as n, useState as r } from "react";
|
|
5
|
+
import { jsx as i, jsxs as a } from "react/jsx-runtime";
|
|
6
|
+
//#region lib/examples/layer-scale-demo.tsx
|
|
7
|
+
function o() {
|
|
8
|
+
let [o, s] = r(!1), c = n(null), l = () => s(!1);
|
|
9
|
+
return /* @__PURE__ */ a("div", { children: [/* @__PURE__ */ i(e, {
|
|
10
|
+
ref: c,
|
|
11
|
+
onClick: () => s(!0),
|
|
12
|
+
icon: "ArrowDefaultRight",
|
|
13
|
+
children: "See the gallery"
|
|
14
|
+
}), /* @__PURE__ */ i(t, {
|
|
15
|
+
animation: "scale",
|
|
16
|
+
origin: c,
|
|
17
|
+
heading: "Gallery",
|
|
18
|
+
isOpen: o,
|
|
19
|
+
onClose: l,
|
|
20
|
+
rightButton: {
|
|
21
|
+
label: "Close",
|
|
22
|
+
icon: "CrossDefault",
|
|
23
|
+
onClick: l
|
|
24
|
+
},
|
|
25
|
+
children: /* @__PURE__ */ i("div", {
|
|
26
|
+
className: "grid grid-cols-2 gap-8 p-20 md:grid-cols-3",
|
|
27
|
+
children: Array.from({ length: 9 }, (e, t) => /* @__PURE__ */ i("div", { className: "bg-lightSand rounded-16 aspect-square" }, t))
|
|
28
|
+
})
|
|
29
|
+
})] });
|
|
30
|
+
}
|
|
31
|
+
//#endregion
|
|
32
|
+
export { o as default };
|
|
33
|
+
|
|
34
|
+
//# sourceMappingURL=layer-scale-demo.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"layer-scale-demo.js","names":[],"sources":["../../lib/examples/layer-scale-demo.tsx"],"sourcesContent":["'use client';\n\nimport { useRef, useState } from 'react';\nimport { Layer } from '@/ui/Layer';\nimport { Button } from '@/ui/buttons/Button';\n\nexport default function LayerScaleDemo() {\n const [isOpen, setIsOpen] = useState(false);\n const trigger = useRef<HTMLButtonElement>(null);\n const close = () => setIsOpen(false);\n\n return (\n <div>\n <Button ref={trigger} onClick={() => setIsOpen(true)} icon=\"ArrowDefaultRight\">\n See the gallery\n </Button>\n <Layer\n animation=\"scale\"\n origin={trigger}\n heading=\"Gallery\"\n isOpen={isOpen}\n onClose={close}\n rightButton={{ label: 'Close', icon: 'CrossDefault', onClick: close }}\n >\n <div className=\"grid grid-cols-2 gap-8 p-20 md:grid-cols-3\">\n {Array.from({ length: 9 }, (_, index) => (\n <div key={index} className=\"bg-lightSand rounded-16 aspect-square\" />\n ))}\n </div>\n </Layer>\n </div>\n );\n}\n"],"mappings":";;;;;;AAMA,SAAwB,IAAiB;CACvC,IAAM,CAAC,GAAQ,KAAa,EAAS,GAAM,EACrC,IAAU,EAA0B,KAAK,EACzC,UAAc,EAAU,GAAM;AAEpC,QACE,kBAAC,OAAD,EAAA,UAAA,CACE,kBAAC,GAAD;EAAQ,KAAK;EAAS,eAAe,EAAU,GAAK;EAAE,MAAK;YAAoB;EAEtE,CAAA,EACT,kBAAC,GAAD;EACE,WAAU;EACV,QAAQ;EACR,SAAQ;EACA;EACR,SAAS;EACT,aAAa;GAAE,OAAO;GAAS,MAAM;GAAgB,SAAS;GAAO;YAErE,kBAAC,OAAD;GAAK,WAAU;aACZ,MAAM,KAAK,EAAE,QAAQ,GAAG,GAAG,GAAG,MAC7B,kBAAC,OAAD,EAAiB,WAAU,yCAA0C,EAA3D,EAA2D,CAAA;GAEnE,CAAA;EACA,CAAA,CACJ,EAAA,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function LayerUseLayerDemo(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Button as e } from "../ui/buttons/Button.js";
|
|
3
|
+
import { t } from "../chunks/Layer.js";
|
|
4
|
+
import { useLayer as n } from "../ui/hooks/useLayer.js";
|
|
5
|
+
import { jsx as r, jsxs as i } from "react/jsx-runtime";
|
|
6
|
+
//#region lib/examples/layer-use-layer-demo.tsx
|
|
7
|
+
function a() {
|
|
8
|
+
let { close: a, isOpen: o, open: s } = n({
|
|
9
|
+
onClose: () => console.log("Layer closed"),
|
|
10
|
+
onOpen: () => console.log("Layer opened")
|
|
11
|
+
});
|
|
12
|
+
return /* @__PURE__ */ i("div", { children: [/* @__PURE__ */ r(e, {
|
|
13
|
+
onClick: s,
|
|
14
|
+
children: "Open with useLayer"
|
|
15
|
+
}), /* @__PURE__ */ r(t, {
|
|
16
|
+
heading: "Driven by useLayer",
|
|
17
|
+
isOpen: o,
|
|
18
|
+
onClose: a,
|
|
19
|
+
rightButton: {
|
|
20
|
+
label: "Close",
|
|
21
|
+
icon: "CrossDefault",
|
|
22
|
+
onClick: a
|
|
23
|
+
},
|
|
24
|
+
children: /* @__PURE__ */ r("div", {
|
|
25
|
+
className: "p-20",
|
|
26
|
+
children: /* @__PURE__ */ r("p", { children: "`open` and `close` keep the same identity across renders." })
|
|
27
|
+
})
|
|
28
|
+
})] });
|
|
29
|
+
}
|
|
30
|
+
//#endregion
|
|
31
|
+
export { a as default };
|
|
32
|
+
|
|
33
|
+
//# sourceMappingURL=layer-use-layer-demo.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"layer-use-layer-demo.js","names":[],"sources":["../../lib/examples/layer-use-layer-demo.tsx"],"sourcesContent":["'use client';\n\nimport { Layer } from '@/ui/Layer';\nimport { Button } from '@/ui/buttons/Button';\nimport { useLayer } from '@/ui/hooks/useLayer';\n\nexport default function LayerUseLayerDemo() {\n const { close, isOpen, open } = useLayer({\n onClose: () => console.log('Layer closed'),\n onOpen: () => console.log('Layer opened'),\n });\n\n return (\n <div>\n <Button onClick={open}>Open with useLayer</Button>\n <Layer\n heading=\"Driven by useLayer\"\n isOpen={isOpen}\n onClose={close}\n rightButton={{ label: 'Close', icon: 'CrossDefault', onClick: close }}\n >\n <div className=\"p-20\">\n <p>`open` and `close` keep the same identity across renders.</p>\n </div>\n </Layer>\n </div>\n );\n}\n"],"mappings":";;;;;;AAMA,SAAwB,IAAoB;CAC1C,IAAM,EAAE,UAAO,WAAQ,YAAS,EAAS;EACvC,eAAe,QAAQ,IAAI,eAAe;EAC1C,cAAc,QAAQ,IAAI,eAAA;EAC3B,CAAC;AAEF,QACE,kBAAC,OAAD,EAAA,UAAA,CACE,kBAAC,GAAD;EAAQ,SAAS;YAAM;EAA2B,CAAA,EAClD,kBAAC,GAAD;EACE,SAAQ;EACA;EACR,SAAS;EACT,aAAa;GAAE,OAAO;GAAS,MAAM;GAAgB,SAAS;GAAO;YAErE,kBAAC,OAAD;GAAK,WAAU;aACb,kBAAC,KAAD,EAAA,UAAG,6DAA6D,CAAA;GAC5D,CAAA;EACA,CAAA,CACJ,EAAA,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@clubmed/trident-ui",
|
|
3
|
-
"version": "2.1.0-beta.
|
|
3
|
+
"version": "2.1.0-beta.5",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Shared ClubMed React UI components",
|
|
6
6
|
"keywords": [
|
|
@@ -87,6 +87,7 @@
|
|
|
87
87
|
"embla-carousel-react": "^8.6.0",
|
|
88
88
|
"embla-carousel-wheel-gestures": "^8.1.0",
|
|
89
89
|
"react-day-picker": ">=8.10.0",
|
|
90
|
+
"react-focus-on": ">=3.10.2",
|
|
90
91
|
"react-hot-toast": ">=2.4.1",
|
|
91
92
|
"react-transition-state": ">=2.3.2",
|
|
92
93
|
"react-use-measure": ">=2.1.1",
|
package/ui/Backdrop.d.ts
CHANGED
|
@@ -19,5 +19,10 @@ export interface BackdropProps extends ComponentProps<'div'> {
|
|
|
19
19
|
* Target ID for the Portal component
|
|
20
20
|
*/
|
|
21
21
|
target?: ComponentProps<typeof Portal>['target'];
|
|
22
|
+
/**
|
|
23
|
+
* Whether backdrop click should trigger onClose
|
|
24
|
+
* @default true
|
|
25
|
+
*/
|
|
26
|
+
dismissable?: boolean;
|
|
22
27
|
}
|
|
23
28
|
export declare const Backdrop: FunctionComponent<PropsWithChildren<BackdropProps>>;
|
package/ui/Backdrop.js
CHANGED
|
@@ -1,2 +1,54 @@
|
|
|
1
|
-
import { t as e } from "../chunks/
|
|
2
|
-
|
|
1
|
+
import { t as e } from "../chunks/clsx.js";
|
|
2
|
+
import { t } from "../chunks/useTransitionState.js";
|
|
3
|
+
import { Portal as n } from "./Portal.js";
|
|
4
|
+
import { useEffect as r } from "react";
|
|
5
|
+
import { jsx as i, jsxs as a } from "react/jsx-runtime";
|
|
6
|
+
//#region lib/ui/Backdrop.tsx
|
|
7
|
+
var o = ({ children: o, className: s = "flex justify-center", onClose: c, isVisible: l, target: u = "backdrop", sweep: d = !1, dismissable: f = !0, ...p }) => {
|
|
8
|
+
let [m, h] = t({
|
|
9
|
+
timeout: {
|
|
10
|
+
enter: 0,
|
|
11
|
+
exit: 500
|
|
12
|
+
},
|
|
13
|
+
mountOnEnter: !0,
|
|
14
|
+
unmountOnExit: !0,
|
|
15
|
+
preEnter: !0
|
|
16
|
+
}), { status: g, isMounted: _ } = m;
|
|
17
|
+
r(() => {
|
|
18
|
+
h(l);
|
|
19
|
+
}, [l, h]), r(() => {
|
|
20
|
+
if (!_ || !f || !c) return;
|
|
21
|
+
let e = (e) => {
|
|
22
|
+
e.key === "Escape" && c(e);
|
|
23
|
+
};
|
|
24
|
+
return document.addEventListener("keydown", e), () => document.removeEventListener("keydown", e);
|
|
25
|
+
}, [
|
|
26
|
+
_,
|
|
27
|
+
f,
|
|
28
|
+
c
|
|
29
|
+
]);
|
|
30
|
+
let v = g === "preEnter" || g === "exiting";
|
|
31
|
+
return /* @__PURE__ */ i(n, {
|
|
32
|
+
target: u,
|
|
33
|
+
children: _ && /* @__PURE__ */ a("div", {
|
|
34
|
+
...p,
|
|
35
|
+
role: "presentation",
|
|
36
|
+
className: e(s, "fixed inset-0 isolate items-center"),
|
|
37
|
+
children: [/* @__PURE__ */ i("button", {
|
|
38
|
+
"aria-hidden": "true",
|
|
39
|
+
className: e("absolute inset-0 -z-1 transition-all duration-500 outline-none focus-visible:ring-4 focus-visible:ring-black focus-visible:ring-offset-2", {
|
|
40
|
+
"bg-white/80 backdrop-blur": !v,
|
|
41
|
+
"bg-white/0 backdrop-blur-none": v,
|
|
42
|
+
"-translate-x-full": d && (g === "preEnter" || g === "entering"),
|
|
43
|
+
"translate-x-full": d && g === "exiting"
|
|
44
|
+
}),
|
|
45
|
+
onClick: f ? c : void 0,
|
|
46
|
+
type: "button"
|
|
47
|
+
}), o]
|
|
48
|
+
})
|
|
49
|
+
});
|
|
50
|
+
};
|
|
51
|
+
//#endregion
|
|
52
|
+
export { o as Backdrop };
|
|
53
|
+
|
|
54
|
+
//# sourceMappingURL=Backdrop.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Backdrop.js","names":[],"sources":["../../lib/ui/Backdrop.tsx"],"sourcesContent":["import {\n type ComponentProps,\n type FunctionComponent,\n type MouseEvent,\n type PropsWithChildren,\n useEffect,\n} from 'react';\nimport clsx from 'clsx';\nimport { useTransitionState } from 'react-transition-state';\nimport { Portal } from './Portal';\n\nexport interface BackdropProps extends ComponentProps<'div'> {\n /**\n * On close\n * @param event\n */\n onClose?: (event: MouseEvent<HTMLButtonElement>) => void;\n /**\n * Is visible\n */\n isVisible?: boolean;\n /**\n * Sweep Mode™\n * (makes it appear from the sides instead of from everywhere)\n */\n sweep?: boolean;\n /**\n * Target ID for the Portal component\n */\n target?: ComponentProps<typeof Portal>['target'];\n /**\n * Whether backdrop click should trigger onClose\n * @default true\n */\n dismissable?: boolean;\n}\n\nexport const Backdrop: FunctionComponent<PropsWithChildren<BackdropProps>> = ({\n children,\n className = 'flex justify-center',\n onClose,\n isVisible,\n target = 'backdrop',\n sweep = false,\n dismissable = true,\n ...attrs\n}) => {\n const [state, toggle] = useTransitionState({\n timeout: { enter: 0, exit: 500 },\n mountOnEnter: true,\n unmountOnExit: true,\n preEnter: true,\n });\n\n const { status, isMounted } = state;\n\n useEffect(() => {\n toggle(isVisible);\n }, [isVisible, toggle]);\n\n useEffect(() => {\n if (!isMounted || !dismissable || !onClose) return;\n\n const handleEscape = (event: KeyboardEvent) => {\n if (event.key === 'Escape') {\n onClose(event as unknown as MouseEvent<HTMLButtonElement>);\n }\n };\n\n document.addEventListener('keydown', handleEscape);\n return () => document.removeEventListener('keydown', handleEscape);\n }, [isMounted, dismissable, onClose]);\n\n const animated = status === 'preEnter' || status === 'exiting';\n\n return (\n <Portal target={target}>\n {isMounted && (\n <div\n {...attrs}\n role=\"presentation\"\n className={clsx(className, 'fixed inset-0 isolate items-center')}\n >\n <button\n aria-hidden=\"true\"\n className={clsx(\n 'absolute inset-0 -z-1 transition-all duration-500 outline-none focus-visible:ring-4 focus-visible:ring-black focus-visible:ring-offset-2',\n {\n 'bg-white/80 backdrop-blur': !animated,\n 'bg-white/0 backdrop-blur-none': animated,\n '-translate-x-full': sweep && (status === 'preEnter' || status === 'entering'),\n 'translate-x-full': sweep && status === 'exiting',\n },\n )}\n onClick={dismissable ? onClose : undefined}\n type=\"button\"\n />\n {children}\n </div>\n )}\n </Portal>\n );\n};\n"],"mappings":";;;;;;AAqCA,IAAa,KAAiE,EAC5E,aACA,eAAY,uBACZ,YACA,cACA,YAAS,YACT,WAAQ,IACR,iBAAc,IACd,GAAG,QACC;CACJ,IAAM,CAAC,GAAO,KAAU,EAAmB;EACzC,SAAS;GAAE,OAAO;GAAG,MAAM;GAAK;EAChC,cAAc;EACd,eAAe;EACf,UAAU;EACX,CAAC,EAEI,EAAE,WAAQ,iBAAc;AAM9B,CAJA,QAAgB;AACd,IAAO,EAAU;IAChB,CAAC,GAAW,EAAO,CAAC,EAEvB,QAAgB;AACd,MAAI,CAAC,KAAa,CAAC,KAAe,CAAC,EAAS;EAE5C,IAAM,KAAgB,MAAyB;AAC7C,GAAI,EAAM,QAAQ,YAChB,EAAQ,EAAkD;;AAK9D,SADA,SAAS,iBAAiB,WAAW,EAAa,QACrC,SAAS,oBAAoB,WAAW,EAAa;IACjE;EAAC;EAAW;EAAa;EAAQ,CAAC;CAErC,IAAM,IAAW,MAAW,cAAc,MAAW;AAErD,QACE,kBAAC,GAAD;EAAgB;YACb,KACC,kBAAC,OAAD;GACE,GAAI;GACJ,MAAK;GACL,WAAW,EAAK,GAAW,qCAAqC;aAHlE,CAKE,kBAAC,UAAD;IACE,eAAY;IACZ,WAAW,EACT,4IACA;KACE,6BAA6B,CAAC;KAC9B,iCAAiC;KACjC,qBAAqB,MAAU,MAAW,cAAc,MAAW;KACnE,oBAAoB,KAAS,MAAW;KACzC,CACF;IACD,SAAS,IAAc,IAAU,KAAA;IACjC,MAAK;IACL,CAAA,EACD,EACG;;EAED,CAAA"}
|
package/ui/ChatBody.d.ts
CHANGED
|
@@ -1,25 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { ChatWindowCsatPromptLabels } from './ChatWindowCsatPrompt';
|
|
3
|
-
import { ChatWindowCsatThankYouLabels } from './ChatWindowCsatThankYou';
|
|
4
|
-
import { ChatWindowQuoteItem } from './ChatWindowQuote';
|
|
5
|
-
import { HTMLAttributes, ReactNode } from 'react';
|
|
6
|
-
export interface ChatMessage {
|
|
7
|
-
id: string;
|
|
8
|
-
sender: ChatMessageSender;
|
|
9
|
-
content: ReactNode;
|
|
10
|
-
}
|
|
11
|
-
export interface ChatBodyProps extends Omit<HTMLAttributes<HTMLDivElement>, 'children'> {
|
|
12
|
-
greeting?: string;
|
|
13
|
-
messages: ChatMessage[];
|
|
14
|
-
isTyping?: boolean;
|
|
15
|
-
onFeedbackRate?: (rating: number) => void;
|
|
16
|
-
csatLabels?: ChatWindowCsatPromptLabels;
|
|
17
|
-
csatRenderRatingLabel?: (rating: number) => ReactNode;
|
|
18
|
-
csatThankYouLabels?: ChatWindowCsatThankYouLabels;
|
|
19
|
-
onQuoteCtaClick?: (quote: ChatWindowQuoteItem) => void;
|
|
20
|
-
}
|
|
21
|
-
export interface ChatHandle {
|
|
22
|
-
askForFeedback: () => void;
|
|
23
|
-
showQuotes: (quotes: ChatWindowQuoteItem[]) => void;
|
|
24
|
-
}
|
|
25
|
-
export declare const ChatBody: import('react').ForwardRefExoticComponent<ChatBodyProps & import('react').RefAttributes<ChatHandle>>;
|
|
1
|
+
export * from './chat/ChatBody';
|
package/ui/ChatBody.js
CHANGED
|
@@ -1,88 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
import { ChatTypingIndicator as n } from "./ChatTypingIndicator.js";
|
|
4
|
-
import { ChatWindowCsatPrompt as r } from "./ChatWindowCsatPrompt.js";
|
|
5
|
-
import { ChatWindowCsatThankYou as i } from "./ChatWindowCsatThankYou.js";
|
|
6
|
-
import { ChatWindowQuote as a } from "./ChatWindowQuote.js";
|
|
7
|
-
import { forwardRef as o, useEffect as s, useImperativeHandle as c, useRef as l, useState as u } from "react";
|
|
8
|
-
import { jsx as d, jsxs as f } from "react/jsx-runtime";
|
|
9
|
-
//#region lib/ui/ChatBody.tsx
|
|
10
|
-
function p({ messages: e, isTyping: t, csatRenderRatingLabel: n, onFeedbackRate: r, csatLabels: i }, a) {
|
|
11
|
-
let o = l(null), [d, f] = u(!1), [p, m] = u(null), [h, g] = u([]);
|
|
12
|
-
c(a, () => ({
|
|
13
|
-
askForFeedback() {
|
|
14
|
-
f(!0);
|
|
15
|
-
},
|
|
16
|
-
showQuotes(e) {
|
|
17
|
-
g((t) => [...t, e]);
|
|
18
|
-
}
|
|
19
|
-
})), s(() => {
|
|
20
|
-
let e = o.current;
|
|
21
|
-
e && e.scrollTo({
|
|
22
|
-
top: e.scrollHeight,
|
|
23
|
-
behavior: "smooth"
|
|
24
|
-
});
|
|
25
|
-
}, [
|
|
26
|
-
e,
|
|
27
|
-
t,
|
|
28
|
-
d,
|
|
29
|
-
p,
|
|
30
|
-
h
|
|
31
|
-
]);
|
|
32
|
-
function _(e) {
|
|
33
|
-
m(String(n ? n(e) : e)), r?.(e);
|
|
34
|
-
}
|
|
35
|
-
return {
|
|
36
|
-
logRef: o,
|
|
37
|
-
csatRatingMessage: p,
|
|
38
|
-
quoteGroups: h,
|
|
39
|
-
handleRate: _,
|
|
40
|
-
csatReady: d && i && n
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
|
-
var m = o(function(o, s) {
|
|
44
|
-
let { logRef: c, csatRatingMessage: l, quoteGroups: u, handleRate: m, csatReady: h } = p(o, s), { greeting: g, messages: _, isTyping: v = !1, csatLabels: y, csatRenderRatingLabel: b, csatThankYouLabels: x, onQuoteCtaClick: S, className: C, ...w } = o;
|
|
45
|
-
return /* @__PURE__ */ f("div", {
|
|
46
|
-
...w,
|
|
47
|
-
ref: c,
|
|
48
|
-
role: "log",
|
|
49
|
-
"aria-label": "Chat messages",
|
|
50
|
-
"aria-live": "polite",
|
|
51
|
-
className: e("chat-message-log flex flex-col flex-1 gap-20 overflow-y-auto py-20", C),
|
|
52
|
-
children: [
|
|
53
|
-
g ? /* @__PURE__ */ d("div", {
|
|
54
|
-
className: "px-20",
|
|
55
|
-
children: /* @__PURE__ */ d("p", {
|
|
56
|
-
className: "text-b3 text-black",
|
|
57
|
-
children: g
|
|
58
|
-
})
|
|
59
|
-
}) : null,
|
|
60
|
-
_.map((e) => /* @__PURE__ */ d(t, {
|
|
61
|
-
sender: e.sender,
|
|
62
|
-
children: e.content
|
|
63
|
-
}, e.id)),
|
|
64
|
-
v && /* @__PURE__ */ d("div", {
|
|
65
|
-
className: "px-12",
|
|
66
|
-
children: /* @__PURE__ */ d(n, {})
|
|
67
|
-
}),
|
|
68
|
-
h && /* @__PURE__ */ d(r, {
|
|
69
|
-
onRate: m,
|
|
70
|
-
labels: y,
|
|
71
|
-
renderRatingLabel: b
|
|
72
|
-
}),
|
|
73
|
-
l && /* @__PURE__ */ d(t, {
|
|
74
|
-
sender: "user",
|
|
75
|
-
children: l
|
|
76
|
-
}),
|
|
77
|
-
l && x && /* @__PURE__ */ d(i, { labels: x }),
|
|
78
|
-
u.map((e, t) => /* @__PURE__ */ d(a, {
|
|
79
|
-
quotes: e,
|
|
80
|
-
onCtaClick: S
|
|
81
|
-
}, t))
|
|
82
|
-
]
|
|
83
|
-
});
|
|
84
|
-
});
|
|
85
|
-
//#endregion
|
|
86
|
-
export { m as ChatBody };
|
|
87
|
-
|
|
88
|
-
//# sourceMappingURL=ChatBody.js.map
|
|
1
|
+
import { ChatBody as e } from "./chat/ChatBody.js";
|
|
2
|
+
export { e as ChatBody };
|
package/ui/ChatButton.d.ts
CHANGED
|
@@ -1,6 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export type ChatButtonProps = ButtonHTMLAttributes<HTMLButtonElement> & {
|
|
3
|
-
offset?: boolean;
|
|
4
|
-
unfoldOn?: 'hover' | 'active';
|
|
5
|
-
};
|
|
6
|
-
export declare function ChatButton({ children, className, type, 'aria-label': ariaLabel, tabIndex, offset, unfoldOn, ...rest }: ChatButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
1
|
+
export * from './chat/ChatButton';
|
package/ui/ChatButton.js
CHANGED
|
@@ -1,33 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
import { Icon as r } from "@clubmed/trident-icons";
|
|
4
|
-
//#region lib/ui/ChatButton.tsx
|
|
5
|
-
var i = "AI Agent: Have you got a question?", a = "Chat with your assistant";
|
|
6
|
-
function o({ children: o = i, className: s, type: c = "button", "aria-label": l, tabIndex: u, offset: d, unfoldOn: f = "hover", ...p }) {
|
|
7
|
-
let m = l ?? (typeof o == "string" && o.trim().length > 0 ? o.trim() : a);
|
|
8
|
-
return /* @__PURE__ */ n("button", {
|
|
9
|
-
type: c,
|
|
10
|
-
"aria-label": m,
|
|
11
|
-
tabIndex: u ?? 0,
|
|
12
|
-
...p,
|
|
13
|
-
className: e("chat-border grid grid-cols-[24px_0fr] transition-[grid-template-columns] justify-center items-center overflow-hidden cursor-pointer transition-all rounded-pill px-8 md:px-16 outline-none group/Chatbutton focus-visible:ring-4 focus-visible:ring-black focus-visible:ring-offset-2 pointer-events-auto h-48 min-h-48 md:min-w-80 md:h-80 active:scale-[0.98]", d && "md:translate-x-[40px] focus-visible:translate-x-0", f === "hover" && "group/hoverChatbutton hover:grid-cols-[24px_1fr] hover:translate-x-0", f === "active" && "group/activeChatbutton active:grid-cols-[24px_1fr] active:translate-x-0", "focus-visible:grid-cols-[24px_1fr]", s),
|
|
14
|
-
children: [/* @__PURE__ */ t(r, {
|
|
15
|
-
name: "Sparkles",
|
|
16
|
-
className: e("chat-button-icon w-24 transition-all", d && "relative md:start-[calc(-16px)] group-focus-visible/Chatbutton:start-0 group-hover/hoverChatbutton:start-0 group-active/activeChatbutton:start-0")
|
|
17
|
-
}), /* @__PURE__ */ t("div", {
|
|
18
|
-
className: "grid grid-cols-[0fr] overflow-hidden opacity-0 transition-opacity group-hover/hoverChatbutton:opacity-100 group-focus-visible/Chatbutton:opacity-100 group-active/activeChatbutton:opacity-100 duration-500",
|
|
19
|
-
children: /* @__PURE__ */ n("span", {
|
|
20
|
-
"aria-hidden": "true",
|
|
21
|
-
className: "chat-button-text items-center ps-20 flex gap-10 whitespace-nowrap font-semibold text-b3 text-black",
|
|
22
|
-
children: [o, /* @__PURE__ */ t(r, {
|
|
23
|
-
name: "ArrowTailRight",
|
|
24
|
-
width: "24px"
|
|
25
|
-
})]
|
|
26
|
-
})
|
|
27
|
-
})]
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
//#endregion
|
|
31
|
-
export { o as ChatButton };
|
|
32
|
-
|
|
33
|
-
//# sourceMappingURL=ChatButton.js.map
|
|
1
|
+
import { ChatButton as e } from "./chat/ChatButton.js";
|
|
2
|
+
export { e as ChatButton };
|
package/ui/ChatHeader.d.ts
CHANGED
package/ui/ChatHeader.js
CHANGED
|
@@ -1,43 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
//#region lib/ui/ChatHeader.tsx
|
|
4
|
-
var r = /* @__PURE__ */ e("svg", {
|
|
5
|
-
className: "absolute top-full inset-x-[50%] -translate-x-1/2",
|
|
6
|
-
width: "118",
|
|
7
|
-
height: "27",
|
|
8
|
-
viewBox: "0 0 118 27",
|
|
9
|
-
children: /* @__PURE__ */ e("path", {
|
|
10
|
-
d: "M0 0C10.8283 0 21.1946 5.40419 28.7327 13.2062L30.2673 14.7945C45.991 31.0685 72.009 31.0685 87.7327 14.7945L89.2673 13.2062C96.8054 5.40419 107.172 0 118 0C118 0 80.6853 0 0 0Z",
|
|
11
|
-
fill: "#F6EFE7"
|
|
12
|
-
})
|
|
13
|
-
});
|
|
14
|
-
function i({ title: i = "Ask me a question", logo: a }) {
|
|
15
|
-
return /* @__PURE__ */ t("div", {
|
|
16
|
-
className: "relative flex flex-col items-center shrink-0 pt-4 px-4 h-118 overflow-hidden",
|
|
17
|
-
children: [/* @__PURE__ */ e("div", {
|
|
18
|
-
className: "absolute inset-x-4 top-4 h-87 bg-lightSand rounded-[24px]",
|
|
19
|
-
children: r
|
|
20
|
-
}), /* @__PURE__ */ t("div", {
|
|
21
|
-
className: "relative flex flex-col flex-1 items-center justify-end pb-8 w-full z-10",
|
|
22
|
-
children: [/* @__PURE__ */ e("div", {
|
|
23
|
-
className: "flex items-center justify-center px-12 py-8 w-full",
|
|
24
|
-
children: /* @__PURE__ */ e("p", {
|
|
25
|
-
className: "font-serif font-bold italic text-h5 text-center text-black line-clamp-2",
|
|
26
|
-
children: i
|
|
27
|
-
})
|
|
28
|
-
}), a ?? /* @__PURE__ */ e("button", {
|
|
29
|
-
type: "button",
|
|
30
|
-
"aria-label": "AI assistant",
|
|
31
|
-
className: "chat-border flex items-center justify-center size-48 rounded-full bg-white outline-none focus-visible:ring-4 focus-visible:ring-black focus-visible:ring-offset-2",
|
|
32
|
-
children: /* @__PURE__ */ e(n, {
|
|
33
|
-
name: "Sparkles",
|
|
34
|
-
width: "24px"
|
|
35
|
-
})
|
|
36
|
-
})]
|
|
37
|
-
})]
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
//#endregion
|
|
41
|
-
export { i as ChatHeader };
|
|
42
|
-
|
|
43
|
-
//# sourceMappingURL=ChatHeader.js.map
|
|
1
|
+
import { ChatHeader as e } from "./chat/ChatHeader.js";
|
|
2
|
+
export { e as ChatHeader };
|
package/ui/ChatInput.d.ts
CHANGED
|
@@ -1,10 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export interface ChatInputProps extends FormHTMLAttributes<HTMLFormElement> {
|
|
3
|
-
value: string;
|
|
4
|
-
placeholder?: string;
|
|
5
|
-
onValueChange: (value: string) => void;
|
|
6
|
-
onSubmit: () => void;
|
|
7
|
-
/** Fallback for when the browser does not support the Web Speech API */
|
|
8
|
-
onAudioClick?: () => void;
|
|
9
|
-
}
|
|
10
|
-
export declare function ChatInput({ value, placeholder, onValueChange, onSubmit, onAudioClick, className, ...props }: ChatInputProps): import("react/jsx-runtime").JSX.Element;
|
|
1
|
+
export * from './chat/ChatInput';
|