@salla.sa/ui-ai-kit-react 1.1.0 → 2.0.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.
- package/dist/generated/components.d.ts +20 -3
- package/dist/generated/components.d.ts.map +1 -1
- package/dist/generated/components.js +32 -2
- package/dist/generated/components.js.map +1 -1
- package/dist/stories/ai-card.stories.d.ts +9 -0
- package/dist/stories/ai-card.stories.d.ts.map +1 -0
- package/dist/stories/ai-card.stories.js +28 -0
- package/dist/stories/ai-card.stories.js.map +1 -0
- package/dist/stories/ai-chat-container.stories.d.ts +9 -0
- package/dist/stories/ai-chat-container.stories.d.ts.map +1 -0
- package/dist/stories/ai-chat-container.stories.js +135 -0
- package/dist/stories/ai-chat-container.stories.js.map +1 -0
- package/dist/stories/ai-chat-header.stories.d.ts +15 -0
- package/dist/stories/ai-chat-header.stories.d.ts.map +1 -0
- package/dist/stories/ai-chat-header.stories.js +172 -0
- package/dist/stories/ai-chat-header.stories.js.map +1 -0
- package/dist/stories/ai-chat-message.stories.d.ts +11 -0
- package/dist/stories/ai-chat-message.stories.d.ts.map +1 -0
- package/dist/stories/ai-chat-message.stories.js +83 -0
- package/dist/stories/ai-chat-message.stories.js.map +1 -0
- package/dist/stories/ai-conversation-list.stories.d.ts +10 -0
- package/dist/stories/ai-conversation-list.stories.d.ts.map +1 -0
- package/dist/stories/ai-conversation-list.stories.js +82 -0
- package/dist/stories/ai-conversation-list.stories.js.map +1 -0
- package/dist/stories/ai-conversation-summary.stories.d.ts +12 -0
- package/dist/stories/ai-conversation-summary.stories.d.ts.map +1 -0
- package/dist/stories/ai-conversation-summary.stories.js +91 -0
- package/dist/stories/ai-conversation-summary.stories.js.map +1 -0
- package/dist/stories/ai-link.stories.d.ts +10 -0
- package/dist/stories/ai-link.stories.d.ts.map +1 -0
- package/dist/stories/ai-link.stories.js +35 -0
- package/dist/stories/ai-link.stories.js.map +1 -0
- package/dist/stories/ai-loading.stories.d.ts +22 -0
- package/dist/stories/ai-loading.stories.d.ts.map +1 -0
- package/dist/stories/ai-loading.stories.js +174 -0
- package/dist/stories/ai-loading.stories.js.map +1 -0
- package/dist/stories/ai-message-input.stories.d.ts +9 -0
- package/dist/stories/ai-message-input.stories.d.ts.map +1 -0
- package/dist/stories/ai-message-input.stories.js +88 -0
- package/dist/stories/ai-message-input.stories.js.map +1 -0
- package/dist/stories/ai-rating.stories.d.ts +10 -0
- package/dist/stories/ai-rating.stories.d.ts.map +1 -0
- package/dist/stories/ai-rating.stories.js +42 -0
- package/dist/stories/ai-rating.stories.js.map +1 -0
- package/dist/stories/ai-route-decision.stories.d.ts +11 -0
- package/dist/stories/ai-route-decision.stories.d.ts.map +1 -0
- package/dist/stories/ai-route-decision.stories.js +102 -0
- package/dist/stories/ai-route-decision.stories.js.map +1 -0
- package/dist/stories/ai-suggestion.stories.d.ts +10 -0
- package/dist/stories/ai-suggestion.stories.d.ts.map +1 -0
- package/dist/stories/ai-suggestion.stories.js +38 -0
- package/dist/stories/ai-suggestion.stories.js.map +1 -0
- package/dist/stories/ai-voice-input.stories.d.ts +13 -0
- package/dist/stories/ai-voice-input.stories.d.ts.map +1 -0
- package/dist/stories/ai-voice-input.stories.js +130 -0
- package/dist/stories/ai-voice-input.stories.js.map +1 -0
- package/package.json +16 -3
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ai-loading.stories.js","sourceRoot":"","sources":["../../src/stories/ai-loading.stories.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAEpD,MAAM,IAAI,GAA2B;IACnC,KAAK,EAAE,cAAc;IACrB,SAAS,EAAE,SAAS;IACpB,IAAI,EAAE,CAAC,UAAU,CAAC;IAClB,QAAQ,EAAE;QACR,IAAI,EAAE;YACJ,OAAO,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;YAC3B,OAAO,EAAE,CAAC,UAAU,EAAE,OAAO,CAAC;YAC9B,WAAW,E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OAAO;QACb,KAAK,EAAE,eAAe;QACtB,QAAQ,EAAE,KAAK;QACf,WAAW,EAAE,IAAI;KAClB;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,oBAAoB,GAAU;IACzC,IAAI,EAAE,2BAA2B;IACjC,MAAM,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,CAChB,cAAK,KAAK,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,YAC/B,KAAC,SAAS,OAAK,IAAI,GAAI,GACnB,CACP;IACD,IAAI,EAAE;QACJ,IAAI,EAAE,OAAO;QACb,KAAK,EAAE,eAAe;QACtB,eAAe,EAAE,IAAI;QACrB,YAAY,EAAE,mBAAmB;QACjC,QAAQ,EAAE,IAAI;QACd,WAAW,EAAE,IAAI;KAClB;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,qBAAqB,GAAU;IAC1C,IAAI,EAAE,mCAAmC;IACzC,MAAM,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,CAChB,cAAK,KAAK,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,YAC/B,KAAC,SAAS,OAAK,IAAI,GAAI,GACnB,CACP;IACD,IAAI,EAAE;QACJ,IAAI,EAAE,OAAO;QACb,KAAK,EAAE,eAAe;QACtB,YAAY,EAAE,cAAc;QAC5B,QAAQ,EAAE,IAAI;QACd,WAAW,EAAE,IAAI;KAClB;CACF,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import { AiMessageInput } from "../generated/components";
|
|
3
|
+
declare const meta: Meta<typeof AiMessageInput>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof meta>;
|
|
6
|
+
export declare const Default: Story;
|
|
7
|
+
export declare const Disabled: Story;
|
|
8
|
+
export declare const WithVoiceToggle: Story;
|
|
9
|
+
//# sourceMappingURL=ai-message-input.stories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ai-message-input.stories.d.ts","sourceRoot":"","sources":["../../src/stories/ai-message-input.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAEvD,OAAO,EAAE,cAAc,EAAgB,MAAM,yBAAyB,CAAC;AAEvE,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,cAAc,CAkCrC,CAAC;AAEF,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAEnC,eAAO,MAAM,OAAO,EAAE,KAcrB,CAAC;AAEF,eAAO,MAAM,QAAQ,EAAE,KAEtB,CAAC;AA6EF,eAAO,MAAM,eAAe,EAAE,KAE7B,CAAC"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useRef, useState } from "react";
|
|
3
|
+
import { AiMessageInput, AiVoiceInput } from "../generated/components";
|
|
4
|
+
const meta = {
|
|
5
|
+
title: "Chat/Message Input",
|
|
6
|
+
component: AiMessageInput,
|
|
7
|
+
tags: ["autodocs"],
|
|
8
|
+
argTypes: {
|
|
9
|
+
placeholder: {
|
|
10
|
+
control: "text",
|
|
11
|
+
description: "Placeholder text for the textarea",
|
|
12
|
+
},
|
|
13
|
+
disabled: {
|
|
14
|
+
control: "boolean",
|
|
15
|
+
description: "Whether the input is disabled",
|
|
16
|
+
},
|
|
17
|
+
showVoiceButton: {
|
|
18
|
+
control: "boolean",
|
|
19
|
+
description: "Show the mic button — emits voiceButtonClick when pressed",
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
parameters: {
|
|
23
|
+
docs: {
|
|
24
|
+
description: {
|
|
25
|
+
component: `
|
|
26
|
+
A pill-shaped chat input component.
|
|
27
|
+
|
|
28
|
+
## Events
|
|
29
|
+
- \`sendMessage\` — emitted with the trimmed message string when the user sends
|
|
30
|
+
- \`voiceButtonClick\` — emitted when the mic button is pressed
|
|
31
|
+
|
|
32
|
+
## Methods
|
|
33
|
+
- \`setInputValue(text: string)\` — populates the textarea programmatically
|
|
34
|
+
`,
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
};
|
|
39
|
+
export default meta;
|
|
40
|
+
export const Default = {
|
|
41
|
+
render: (args) => (_jsx(AiMessageInput, { placeholder: args.placeholder || "ايش في بالك؟", disabled: args.disabled, showVoiceButton: args.showVoiceButton !== false, onSendMessage: (e) => console.log("sendMessage:", e.detail) })),
|
|
42
|
+
args: {
|
|
43
|
+
placeholder: "ايش في بالك؟",
|
|
44
|
+
disabled: false,
|
|
45
|
+
showVoiceButton: true,
|
|
46
|
+
},
|
|
47
|
+
};
|
|
48
|
+
export const Disabled = {
|
|
49
|
+
render: () => _jsx(AiMessageInput, { placeholder: "\u0627\u064A\u0634 \u0641\u064A \u0628\u0627\u0644\u0643\u061F", disabled: true }),
|
|
50
|
+
};
|
|
51
|
+
const VoiceToggleDemo = () => {
|
|
52
|
+
const [showVoice, setShowVoice] = useState(false);
|
|
53
|
+
const [log, setLog] = useState([]);
|
|
54
|
+
const msgRef = useRef(null);
|
|
55
|
+
return (_jsxs("div", { style: { maxWidth: "600px" }, children: [!showVoice ? (_jsx(AiMessageInput, { ref: msgRef, placeholder: "\u0627\u0643\u062A\u0628 \u0631\u0633\u0627\u0644\u0629 \u0623\u0648 \u0627\u0636\u063A\u0637 \u0639\u0644\u0649 \u0627\u0644\u0645\u064A\u0643\u0631\u0648\u0641\u0648\u0646", onSendMessage: (e) => setLog((prev) => [...prev, `✓ Message sent: "${e.detail}"`]) })) : (_jsx(AiVoiceInput, { autoStart: true, onAudioRecorded: (e) => {
|
|
56
|
+
setShowVoice(false);
|
|
57
|
+
if (msgRef.current) {
|
|
58
|
+
msgRef.current.setInputValue(`[Audio ${e.detail.duration}s — paste transcription here]`);
|
|
59
|
+
}
|
|
60
|
+
setLog((prev) => [
|
|
61
|
+
...prev,
|
|
62
|
+
`🎤 Audio recorded (${e.detail.duration}s, ${(e.detail.blob.size / 1024).toFixed(1)} KB)`,
|
|
63
|
+
]);
|
|
64
|
+
}, onRecordingCancel: () => {
|
|
65
|
+
setShowVoice(false);
|
|
66
|
+
setLog((prev) => [...prev, "✕ Recording cancelled"]);
|
|
67
|
+
} })), _jsxs("div", { style: {
|
|
68
|
+
marginTop: "1rem",
|
|
69
|
+
padding: "1rem",
|
|
70
|
+
background: "#f5f5f5",
|
|
71
|
+
borderRadius: "8px",
|
|
72
|
+
fontFamily: "monospace",
|
|
73
|
+
fontSize: "13px",
|
|
74
|
+
minHeight: "80px",
|
|
75
|
+
maxHeight: "200px",
|
|
76
|
+
overflowY: "auto",
|
|
77
|
+
}, children: [_jsx("div", { style: { color: "#666", fontWeight: "bold", marginBottom: "4px" }, children: "Event log:" }), log.map((entry, i) => (_jsx("div", { style: {
|
|
78
|
+
color: entry.startsWith("✓")
|
|
79
|
+
? "#10b981"
|
|
80
|
+
: entry.startsWith("🎤")
|
|
81
|
+
? "#8b5cf6"
|
|
82
|
+
: "#737373",
|
|
83
|
+
}, children: entry }, i)))] })] }));
|
|
84
|
+
};
|
|
85
|
+
export const WithVoiceToggle = {
|
|
86
|
+
render: () => _jsx(VoiceToggleDemo, {}),
|
|
87
|
+
};
|
|
88
|
+
//# sourceMappingURL=ai-message-input.stories.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ai-message-input.stories.js","sourceRoot":"","sources":["../../src/stories/ai-message-input.stories.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACzC,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAEvE,MAAM,IAAI,GAAgC;IACxC,KAAK,EAAE,oBAAoB;IAC3B,SAAS,EAAE,cAAc;IACzB,IAAI,EAAE,CAAC,UAAU,CAAC;IA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,EAAE,MAAM;oBAChB,SAAS,EAAE,MAAM;oBACjB,SAAS,EAAE,OAAO;oBAClB,SAAS,EAAE,MAAM;iBAClB,aAED,cAAK,KAAK,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE,2BAEhE,EACL,GAAG,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,CAAC,EAAE,EAAE,CAAC,CACrB,cAEE,KAAK,EAAE;4BACL,KAAK,EAAE,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC;gCAC1B,CAAC,CAAC,SAAS;gCACX,CAAC,CAAC,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC;oCACxB,CAAC,CAAC,SAAS;oCACX,CAAC,CAAC,SAAS;yBACd,YAEA,KAAK,IATD,CAAC,CAUF,CACP,CAAC,IACE,IACF,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,eAAe,GAAU;IACpC,MAAM,EAAE,GAAG,EAAE,CAAC,KAAC,eAAe,KAAG;CAClC,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { AiRating } from '../generated/components';
|
|
3
|
+
declare const meta: Meta<typeof AiRating>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof meta>;
|
|
6
|
+
export declare const Standalone: Story;
|
|
7
|
+
export declare const InsideCard: Story;
|
|
8
|
+
export declare const PreSelected: Story;
|
|
9
|
+
export declare const Disabled: Story;
|
|
10
|
+
//# sourceMappingURL=ai-rating.stories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ai-rating.stories.d.ts","sourceRoot":"","sources":["../../src/stories/ai-rating.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,EAAU,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAE3D,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,QAAQ,CAa/B,CAAC;AAEF,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AASnC,eAAO,MAAM,UAAU,EAAE,KAkBxB,CAAC;AAEF,eAAO,MAAM,UAAU,EAAE,KAWxB,CAAC;AAEF,eAAO,MAAM,WAAW,EAAE,KAYzB,CAAC;AAEF,eAAO,MAAM,QAAQ,EAAE,KAatB,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { AiCard, AiRating } from '../generated/components';
|
|
3
|
+
const meta = {
|
|
4
|
+
title: 'UI/Rating',
|
|
5
|
+
component: AiRating,
|
|
6
|
+
tags: ['autodocs'],
|
|
7
|
+
argTypes: {
|
|
8
|
+
question: { control: 'text' },
|
|
9
|
+
subtitle: { control: 'text' },
|
|
10
|
+
value: {
|
|
11
|
+
control: { type: 'select' },
|
|
12
|
+
options: [undefined, 1, 2, 3, 4, 5],
|
|
13
|
+
},
|
|
14
|
+
disabled: { control: 'boolean' },
|
|
15
|
+
},
|
|
16
|
+
};
|
|
17
|
+
export default meta;
|
|
18
|
+
const wrapStyle = {
|
|
19
|
+
padding: '24px',
|
|
20
|
+
background: '#f3f4f6',
|
|
21
|
+
direction: 'rtl',
|
|
22
|
+
maxWidth: '420px',
|
|
23
|
+
};
|
|
24
|
+
export const Standalone = {
|
|
25
|
+
render: (args) => (_jsx("div", { style: wrapStyle, children: _jsx(AiRating, { question: args.question, subtitle: args.subtitle, value: args.value, disabled: args.disabled, onRatingChange: (e) => console.log('ratingChange:', e.detail) }) })),
|
|
26
|
+
args: {
|
|
27
|
+
question: 'كيف كانت تجربتك؟',
|
|
28
|
+
subtitle: 'رأيك يساعدنا نحسن الخدمة',
|
|
29
|
+
value: undefined,
|
|
30
|
+
disabled: false,
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
export const InsideCard = {
|
|
34
|
+
render: () => (_jsx("div", { style: wrapStyle, children: _jsx(AiCard, { children: _jsx(AiRating, { question: "\u0643\u064A\u0641 \u0643\u0627\u0646\u062A \u062A\u062C\u0631\u0628\u062A\u0643\u061F", subtitle: "\u0631\u0623\u064A\u0643 \u064A\u0633\u0627\u0639\u062F\u0646\u0627 \u0646\u062D\u0633\u0646 \u0627\u0644\u062E\u062F\u0645\u0629" }) }) })),
|
|
35
|
+
};
|
|
36
|
+
export const PreSelected = {
|
|
37
|
+
render: () => (_jsx("div", { style: wrapStyle, children: _jsx(AiCard, { children: _jsx(AiRating, { question: "\u0643\u064A\u0641 \u0643\u0627\u0646\u062A \u062A\u062C\u0631\u0628\u062A\u0643\u061F", subtitle: "\u0631\u0623\u064A\u0643 \u064A\u0633\u0627\u0639\u062F\u0646\u0627 \u0646\u062D\u0633\u0646 \u0627\u0644\u062E\u062F\u0645\u0629", value: 5 }) }) })),
|
|
38
|
+
};
|
|
39
|
+
export const Disabled = {
|
|
40
|
+
render: () => (_jsx("div", { style: wrapStyle, children: _jsx(AiCard, { children: _jsx(AiRating, { question: "\u0643\u064A\u0641 \u0643\u0627\u0646\u062A \u062A\u062C\u0631\u0628\u062A\u0643\u061F", subtitle: "\u062A\u0645 \u0625\u0631\u0633\u0627\u0644 \u062A\u0642\u064A\u064A\u0645\u0643", value: 4, disabled: true }) }) })),
|
|
41
|
+
};
|
|
42
|
+
//# sourceMappingURL=ai-rating.stories.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ai-rating.stories.js","sourceRoot":"","sources":["../../src/stories/ai-rating.stories.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAE3D,MAAM,IAAI,GAA0B;IAClC,KAAK,EAAE,WAAW;IAClB,SAAS,EAAE,QAAQ;IACnB,IAAI,E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AQ,EAAC,wFAAkB,EAC3B,QAAQ,EAAC,mIAA0B,GACnC,GACK,GACL,CACP;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,WAAW,GAAU;IAChC,MAAM,EAAE,GAAG,EAAE,CAAC,CACZ,cAAK,KAAK,EAAE,SAAS,YACnB,KAAC,MAAM,cACL,KAAC,QAAQ,IACP,QAAQ,EAAC,wFAAkB,EAC3B,QAAQ,EAAC,mIAA0B,EACnC,KAAK,EAAE,CAAC,GACR,GACK,GACL,CACP;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,QAAQ,GAAU;IAC7B,MAAM,EAAE,GAAG,EAAE,CAAC,CACZ,cAAK,KAAK,EAAE,SAAS,YACnB,KAAC,MAAM,cACL,KAAC,QAAQ,IACP,QAAQ,EAAC,wFAAkB,EAC3B,QAAQ,EAAC,kFAAiB,EAC1B,KAAK,EAAE,CAAC,EACR,QAAQ,SACR,GACK,GACL,CACP;CACF,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { AiRouteDecision } from '../generated/components';
|
|
3
|
+
declare const meta: Meta<typeof AiRouteDecision>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof meta>;
|
|
6
|
+
export declare const Collapsed: Story;
|
|
7
|
+
export declare const Expanded: Story;
|
|
8
|
+
export declare const HighConfidence: Story;
|
|
9
|
+
export declare const LowConfidence: Story;
|
|
10
|
+
export declare const NoIcon: Story;
|
|
11
|
+
//# sourceMappingURL=ai-route-decision.stories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ai-route-decision.stories.d.ts","sourceRoot":"","sources":["../../src/stories/ai-route-decision.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE1D,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,eAAe,CA8BtC,CAAC;AAEF,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAWnC,eAAO,MAAM,SAAS,EAAE,KAevB,CAAC;AAIF,eAAO,MAAM,QAAQ,EAAE,KAkBtB,CAAC;AAIF,eAAO,MAAM,cAAc,EAAE,KAe5B,CAAC;AAIF,eAAO,MAAM,aAAa,EAAE,KAe3B,CAAC;AAIF,eAAO,MAAM,MAAM,EAAE,KAcpB,CAAC"}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { AiRouteDecision } from '../generated/components';
|
|
3
|
+
const meta = {
|
|
4
|
+
title: 'Chat/RouteDecision',
|
|
5
|
+
component: AiRouteDecision,
|
|
6
|
+
tags: ['autodocs'],
|
|
7
|
+
argTypes: {
|
|
8
|
+
selectedAgent: {
|
|
9
|
+
control: 'text',
|
|
10
|
+
description: 'Selected agent name',
|
|
11
|
+
},
|
|
12
|
+
agentIcon: {
|
|
13
|
+
control: 'text',
|
|
14
|
+
description: 'Agent icon — emoji or short text displayed before the agent name',
|
|
15
|
+
},
|
|
16
|
+
reason: {
|
|
17
|
+
control: 'text',
|
|
18
|
+
description: 'Reason for routing decision (shown when expanded)',
|
|
19
|
+
},
|
|
20
|
+
confidence: {
|
|
21
|
+
control: { type: 'range', min: 0, max: 100, step: 1 },
|
|
22
|
+
description: 'Routing confidence percentage 0–100',
|
|
23
|
+
},
|
|
24
|
+
detectedLanguage: {
|
|
25
|
+
control: 'text',
|
|
26
|
+
description: 'Detected language label (shown when expanded)',
|
|
27
|
+
},
|
|
28
|
+
expanded: {
|
|
29
|
+
control: 'boolean',
|
|
30
|
+
description: 'Whether the pill is expanded',
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
};
|
|
34
|
+
export default meta;
|
|
35
|
+
const wrapStyle = {
|
|
36
|
+
padding: '24px',
|
|
37
|
+
background: '#f3f4f6',
|
|
38
|
+
direction: 'rtl',
|
|
39
|
+
maxWidth: '420px',
|
|
40
|
+
};
|
|
41
|
+
// ── Collapsed ────────────────────────────────────────────
|
|
42
|
+
export const Collapsed = {
|
|
43
|
+
render: (args) => (_jsx("div", { style: wrapStyle, children: _jsx(AiRouteDecision, { ...args, onRouteExpand: (e) => console.log('expand:', e.detail) }) })),
|
|
44
|
+
args: {
|
|
45
|
+
selectedAgent: 'وكيل المخزون',
|
|
46
|
+
agentIcon: '📦',
|
|
47
|
+
confidence: 92,
|
|
48
|
+
expanded: false,
|
|
49
|
+
},
|
|
50
|
+
};
|
|
51
|
+
// ── Expanded ─────────────────────────────────────────────
|
|
52
|
+
export const Expanded = {
|
|
53
|
+
name: 'Expanded — With reason and language',
|
|
54
|
+
render: (args) => (_jsx("div", { style: wrapStyle, children: _jsx(AiRouteDecision, { ...args, onRouteExpand: (e) => console.log('expand:', e.detail) }) })),
|
|
55
|
+
args: {
|
|
56
|
+
selectedAgent: 'وكيل المخزون',
|
|
57
|
+
agentIcon: '📦',
|
|
58
|
+
reason: 'تم اكتشاف سؤال عن حالة المخزون، لذا تم توجيه الطلب إلى الوكيل المختص.',
|
|
59
|
+
confidence: 92,
|
|
60
|
+
detectedLanguage: 'عربي',
|
|
61
|
+
expanded: true,
|
|
62
|
+
},
|
|
63
|
+
};
|
|
64
|
+
// ── High confidence ───────────────────────────────────────
|
|
65
|
+
export const HighConfidence = {
|
|
66
|
+
name: 'High Confidence (100%)',
|
|
67
|
+
render: (args) => (_jsx("div", { style: wrapStyle, children: _jsx(AiRouteDecision, { ...args }) })),
|
|
68
|
+
args: {
|
|
69
|
+
selectedAgent: 'وكيل الدعم',
|
|
70
|
+
agentIcon: '🎧',
|
|
71
|
+
reason: 'الرسالة تحتوي على طلب مساعدة صريح.',
|
|
72
|
+
confidence: 100,
|
|
73
|
+
detectedLanguage: 'عربي',
|
|
74
|
+
expanded: true,
|
|
75
|
+
},
|
|
76
|
+
};
|
|
77
|
+
// ── Low confidence ────────────────────────────────────────
|
|
78
|
+
export const LowConfidence = {
|
|
79
|
+
name: 'Low Confidence (45%)',
|
|
80
|
+
render: (args) => (_jsx("div", { style: wrapStyle, children: _jsx(AiRouteDecision, { ...args }) })),
|
|
81
|
+
args: {
|
|
82
|
+
selectedAgent: 'وكيل عام',
|
|
83
|
+
agentIcon: '🤖',
|
|
84
|
+
reason: 'لم يتمكن النظام من تصنيف الطلب بثقة عالية.',
|
|
85
|
+
confidence: 45,
|
|
86
|
+
detectedLanguage: 'إنجليزي',
|
|
87
|
+
expanded: true,
|
|
88
|
+
},
|
|
89
|
+
};
|
|
90
|
+
// ── No icon ───────────────────────────────────────────────
|
|
91
|
+
export const NoIcon = {
|
|
92
|
+
name: 'No Agent Icon',
|
|
93
|
+
render: (args) => (_jsx("div", { style: wrapStyle, children: _jsx(AiRouteDecision, { ...args }) })),
|
|
94
|
+
args: {
|
|
95
|
+
selectedAgent: 'وكيل الطلبات',
|
|
96
|
+
reason: 'تم اكتشاف استفسار عن حالة الطلب.',
|
|
97
|
+
confidence: 78,
|
|
98
|
+
detectedLanguage: 'عربي',
|
|
99
|
+
expanded: true,
|
|
100
|
+
},
|
|
101
|
+
};
|
|
102
|
+
//# sourceMappingURL=ai-route-decision.stories.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ai-route-decision.stories.js","sourceRoot":"","sources":["../../src/stories/ai-route-decision.stories.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE1D,MAAM,IAAI,GAAiC;IACzC,KAAK,EAAE,oBAAoB;IAC3B,SAAS,EAAE,eAAe;IAC1B,IAAI,EAAE,CAAC,UAAU,CAAC;IAClB,QAAQ,EAAE;QACR,aAAa,EAAE;YACb,OAAO,EAAE,MAAM;YACf,WAAW,EAAE,qBAAqB;SACnC;QACD,SAAS,EAAE;YAC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eAAe,OAAK,IAAI,GAAI,GACzB,CACP;IACD,IAAI,EAAE;QACJ,aAAa,EAAE,cAAc;QAC7B,MAAM,EAAE,kCAAkC;QAC1C,UAAU,EAAE,EAAE;QACd,gBAAgB,EAAE,MAAM;QACxB,QAAQ,EAAE,IAAI;KACf;CACF,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { AiSuggestion } from '../generated/components';
|
|
3
|
+
declare const meta: Meta<typeof AiSuggestion>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof meta>;
|
|
6
|
+
export declare const Playground: Story;
|
|
7
|
+
export declare const SuggestionGroup: Story;
|
|
8
|
+
export declare const Disabled: Story;
|
|
9
|
+
export declare const InChatContext: Story;
|
|
10
|
+
//# sourceMappingURL=ai-suggestion.stories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ai-suggestion.stories.d.ts","sourceRoot":"","sources":["../../src/stories/ai-suggestion.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,EAAU,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAE/D,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,YAAY,CAQnC,CAAC;AAEF,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAYnC,eAAO,MAAM,UAAU,EAAE,KAcxB,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,KAS7B,CAAC;AAEF,eAAO,MAAM,QAAQ,EAAE,KAOtB,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,KAa3B,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { AiCard, AiSuggestion } from '../generated/components';
|
|
3
|
+
const meta = {
|
|
4
|
+
title: 'UI/Suggestion',
|
|
5
|
+
component: AiSuggestion,
|
|
6
|
+
tags: ['autodocs'],
|
|
7
|
+
argTypes: {
|
|
8
|
+
label: { control: 'text' },
|
|
9
|
+
disabled: { control: 'boolean' },
|
|
10
|
+
},
|
|
11
|
+
};
|
|
12
|
+
export default meta;
|
|
13
|
+
const wrapStyle = {
|
|
14
|
+
padding: '24px',
|
|
15
|
+
background: '#f3f4f6',
|
|
16
|
+
direction: 'rtl',
|
|
17
|
+
display: 'flex',
|
|
18
|
+
gap: '8px',
|
|
19
|
+
flexWrap: 'wrap',
|
|
20
|
+
alignItems: 'flex-start',
|
|
21
|
+
};
|
|
22
|
+
export const Playground = {
|
|
23
|
+
render: (args) => (_jsx("div", { style: wrapStyle, children: _jsx(AiSuggestion, { label: args.label, disabled: args.disabled, onSuggestionClick: (e) => console.log('suggestionClick:', e.detail) }) })),
|
|
24
|
+
args: {
|
|
25
|
+
label: 'وش الفرق بين باقة بلس وبرو',
|
|
26
|
+
disabled: false,
|
|
27
|
+
},
|
|
28
|
+
};
|
|
29
|
+
export const SuggestionGroup = {
|
|
30
|
+
render: () => (_jsxs("div", { style: wrapStyle, children: [_jsx(AiSuggestion, { label: "\u0648\u0634 \u0627\u0644\u0641\u0631\u0642 \u0628\u064A\u0646 \u0628\u0627\u0642\u0629 \u0628\u0644\u0633 \u0648\u0628\u0631\u0648" }), _jsx(AiSuggestion, { label: "\u0643\u064A\u0641 \u0623\u0636\u064A\u0641 \u0645\u0646\u062A\u062C \u062C\u062F\u064A\u062F\u061F" }), _jsx(AiSuggestion, { label: "\u0623\u0638\u0647\u0631 \u0644\u064A \u0627\u0644\u0639\u0645\u0644\u0627\u0621 \u0627\u0644\u0644\u064A \u0645\u0627 \u0627\u0634\u062A\u0631\u0648\u0627 \u0647\u0630\u0627 \u0627\u0644\u0634\u0647\u0631" }), _jsx(AiSuggestion, { label: "\u0645\u0627 \u0647\u064A \u0623\u0641\u0636\u0644 \u0648\u0642\u062A \u0644\u0625\u0631\u0633\u0627\u0644 \u062D\u0645\u0644\u0629 \u062A\u0633\u0648\u064A\u0642\u064A\u0629\u061F" })] })),
|
|
31
|
+
};
|
|
32
|
+
export const Disabled = {
|
|
33
|
+
render: () => (_jsxs("div", { style: wrapStyle, children: [_jsx(AiSuggestion, { label: "\u0648\u0634 \u0627\u0644\u0641\u0631\u0642 \u0628\u064A\u0646 \u0628\u0627\u0642\u0629 \u0628\u0644\u0633 \u0648\u0628\u0631\u0648", disabled: true }), _jsx(AiSuggestion, { label: "\u0643\u064A\u0641 \u0623\u0636\u064A\u0641 \u0645\u0646\u062A\u062C \u062C\u062F\u064A\u062F\u061F", disabled: true })] })),
|
|
34
|
+
};
|
|
35
|
+
export const InChatContext = {
|
|
36
|
+
render: () => (_jsxs("div", { style: { padding: '24px', background: '#f3f4f6', direction: 'rtl', maxWidth: '480px', display: 'flex', flexDirection: 'column', gap: '16px' }, children: [_jsx(AiCard, { children: _jsx("p", { style: { margin: 0, fontSize: '14px', fontWeight: 500, color: '#333' }, children: "\u0623\u0647\u0644\u0627\u064B! \u0643\u064A\u0641 \u064A\u0645\u0643\u0646\u0646\u064A \u0645\u0633\u0627\u0639\u062F\u062A\u0643 \u0627\u0644\u064A\u0648\u0645\u061F" }) }), _jsxs("div", { style: { display: 'flex', gap: '8px', flexWrap: 'wrap' }, children: [_jsx(AiSuggestion, { label: "\u0648\u0634 \u0627\u0644\u0641\u0631\u0642 \u0628\u064A\u0646 \u0628\u0627\u0642\u0629 \u0628\u0644\u0633 \u0648\u0628\u0631\u0648" }), _jsx(AiSuggestion, { label: "\u0623\u0638\u0647\u0631 \u0644\u064A \u0623\u0641\u0636\u0644 \u0627\u0644\u0645\u0646\u062A\u062C\u0627\u062A \u0645\u0628\u064A\u0639\u0627\u064B" }), _jsx(AiSuggestion, { label: "\u0643\u064A\u0641 \u0623\u062D\u0633\u0646 \u0645\u0639\u062F\u0644 \u0627\u0644\u062A\u062D\u0648\u064A\u0644\u061F" })] })] })),
|
|
37
|
+
};
|
|
38
|
+
//# sourceMappingURL=ai-suggestion.stories.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ai-suggestion.stories.js","sourceRoot":"","sources":["../../src/stories/ai-suggestion.stories.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAE/D,MAAM,IAAI,GAA8B;IACtC,KAAK,EAAE,eAAe;IACtB,SAAS,EAAE,YAAY;IACvB,IAAI,EAAE,CAAC,UAAU,CAAC;IAClB,QAAQ,EAAE;QACR,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE;QAC1B,QAAQ,EAAE,EAAE,OAAO,EAAE,SAAS,EAAE;KACjC;CACF,CAAC;AAEF,eAAe,IAAI,CAAC;AAGpB,MAAM,SAAS,GAAwB;IACrC,OAAO,EAAE,MAAM;IACf,UAAU,EAAE,SAAS;IACrB,SAAS,EAAE,KAAK;IAChB,OAAO,EAAE,MAAM;IACf,GAAG,EAAE,KAAK;IACV,QAAQ,EAAE,MAAM;IAChB,UAAU,EAAE,YAAY;CACzB,CAAC;AAEF,MAAM,CAAC,MAAM,UAAU,GAAU;IAC/B,MAAM,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,CAChB,cAAK,KAAK,EAAE,SAAS,YACnB,KAAC,YAAY,IACX,KAAK,EAAE,IAAI,CAAC,KAAK,EACjB,QAAQ,EAAE,IAAI,CAAC,QAAQ,EACvB,iBAAiB,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,kBAAkB,EAAE,CAAC,CAAC,MAAM,CAAC,GACnE,GACE,CACP;IACD,IAAI,EAAE;QACJ,KAAK,EAAE,4BAA4B;QACnC,QAAQ,EAAE,KAAK;KAChB;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,eAAe,GAAU;IACpC,MAAM,EAA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ACP;CACF,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { AiVoiceInput } from '../generated/components';
|
|
3
|
+
declare const meta: Meta<typeof AiVoiceInput>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof meta>;
|
|
6
|
+
export declare const Default: Story;
|
|
7
|
+
export declare const AutoStart: Story;
|
|
8
|
+
export declare const WithoutWaveform: Story;
|
|
9
|
+
export declare const Disabled: Story;
|
|
10
|
+
export declare const CustomWaveformColor: Story;
|
|
11
|
+
export declare const CustomErrorText: Story;
|
|
12
|
+
export declare const WithEventHandlers: Story;
|
|
13
|
+
//# sourceMappingURL=ai-voice-input.stories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ai-voice-input.stories.d.ts","sourceRoot":"","sources":["../../src/stories/ai-voice-input.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAEvD,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAEvD,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,YAAY,CAkDnC,CAAC;AAEF,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAEnC,eAAO,MAAM,OAAO,EAAE,KAmBrB,CAAC;AAEF,eAAO,MAAM,SAAS,EAAE,KAcvB,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,KAe7B,CAAC;AAEF,eAAO,MAAM,QAAQ,EAAE,KAOtB,CAAC;AAEF,eAAO,MAAM,mBAAmB,EAAE,KAejC,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,KAe7B,CAAC;AA8BF,eAAO,MAAM,iBAAiB,EAAE,KAQ/B,CAAC"}
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
import { AiVoiceInput } from '../generated/components';
|
|
4
|
+
const meta = {
|
|
5
|
+
title: 'Chat/Voice Input',
|
|
6
|
+
component: AiVoiceInput,
|
|
7
|
+
tags: ['autodocs'],
|
|
8
|
+
argTypes: {
|
|
9
|
+
disabled: {
|
|
10
|
+
control: 'boolean',
|
|
11
|
+
description: 'Whether the component is disabled',
|
|
12
|
+
},
|
|
13
|
+
showWaveform: {
|
|
14
|
+
control: 'boolean',
|
|
15
|
+
description: 'Show the waveform visualization while recording',
|
|
16
|
+
},
|
|
17
|
+
autoStart: {
|
|
18
|
+
control: 'boolean',
|
|
19
|
+
description: 'Start recording immediately on mount (ignored when disabled)',
|
|
20
|
+
},
|
|
21
|
+
errorText: {
|
|
22
|
+
control: 'text',
|
|
23
|
+
description: 'Custom error message shown on mic access failure. Defaults to Arabic or English based on document lang.',
|
|
24
|
+
},
|
|
25
|
+
waveformColor: {
|
|
26
|
+
control: 'color',
|
|
27
|
+
description: 'Waveform bar color. Falls back to --ai-waveform-color CSS var, then #9ca3af.',
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
parameters: {
|
|
31
|
+
docs: {
|
|
32
|
+
description: {
|
|
33
|
+
component: `
|
|
34
|
+
A standalone voice recorder designed to visually replace \`ai-message-input\` while the user records.
|
|
35
|
+
|
|
36
|
+
## Events
|
|
37
|
+
- \`audioRecorded\` — emitted with \`{ blob: Blob, duration: number }\` when the user submits the recording
|
|
38
|
+
- \`recordingCancel\` — emitted when the user cancels
|
|
39
|
+
|
|
40
|
+
## Props
|
|
41
|
+
- \`autoStart\` — start recording immediately on mount (skipped when \`disabled\`)
|
|
42
|
+
- \`showWaveform\` — toggle the frequency bar visualization
|
|
43
|
+
- \`disabled\` — disable the start button
|
|
44
|
+
- \`errorText\` — custom mic-denied error string; auto-detects Arabic/English via \`document.lang\` when omitted
|
|
45
|
+
- \`waveformColor\` — bar fill color; also readable via \`--ai-waveform-color\` CSS custom property
|
|
46
|
+
|
|
47
|
+
## Behaviour notes
|
|
48
|
+
- **Safari / iOS**: MIME type is detected at runtime (\`audio/webm\` → \`audio/ogg\` → browser default) to avoid silent failures.
|
|
49
|
+
- **Minimum duration**: submitting before 1 second of audio pulses the send button instead of emitting.
|
|
50
|
+
`,
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
};
|
|
55
|
+
export default meta;
|
|
56
|
+
export const Default = {
|
|
57
|
+
render: (args) => (_jsx(AiVoiceInput, { disabled: args.disabled, showWaveform: args.showWaveform !== false, autoStart: args.autoStart, errorText: args.errorText, waveformColor: args.waveformColor, onAudioRecorded: (e) => console.log('audioRecorded:', e.detail), onRecordingCancel: () => console.log('recordingCancel') })),
|
|
58
|
+
args: {
|
|
59
|
+
disabled: false,
|
|
60
|
+
showWaveform: true,
|
|
61
|
+
autoStart: false,
|
|
62
|
+
errorText: '',
|
|
63
|
+
waveformColor: '',
|
|
64
|
+
},
|
|
65
|
+
};
|
|
66
|
+
export const AutoStart = {
|
|
67
|
+
name: 'Auto Start',
|
|
68
|
+
render: () => (_jsx(AiVoiceInput, { autoStart: true, onAudioRecorded: (e) => console.log('audioRecorded:', e.detail), onRecordingCancel: () => console.log('recordingCancel') })),
|
|
69
|
+
parameters: {
|
|
70
|
+
docs: {
|
|
71
|
+
description: { story: 'Starts recording immediately on mount — the typical mode when toggled from `ai-message-input`.' },
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
};
|
|
75
|
+
export const WithoutWaveform = {
|
|
76
|
+
name: 'Without Waveform',
|
|
77
|
+
render: () => (_jsx(AiVoiceInput, { autoStart: true, showWaveform: false, onAudioRecorded: (e) => console.log('audioRecorded:', e.detail), onRecordingCancel: () => console.log('recordingCancel') })),
|
|
78
|
+
parameters: {
|
|
79
|
+
docs: {
|
|
80
|
+
description: { story: 'Waveform disabled — useful when `showWaveform={false}` is passed from the parent.' },
|
|
81
|
+
},
|
|
82
|
+
},
|
|
83
|
+
};
|
|
84
|
+
export const Disabled = {
|
|
85
|
+
render: () => _jsx(AiVoiceInput, { disabled: true }),
|
|
86
|
+
parameters: {
|
|
87
|
+
docs: {
|
|
88
|
+
description: { story: '`autoStart` is ignored when `disabled` is true.' },
|
|
89
|
+
},
|
|
90
|
+
},
|
|
91
|
+
};
|
|
92
|
+
export const CustomWaveformColor = {
|
|
93
|
+
name: 'Custom Waveform Color',
|
|
94
|
+
render: () => (_jsx(AiVoiceInput, { autoStart: true, waveformColor: "#8b5cf6", onAudioRecorded: (e) => console.log('audioRecorded:', e.detail), onRecordingCancel: () => console.log('recordingCancel') })),
|
|
95
|
+
parameters: {
|
|
96
|
+
docs: {
|
|
97
|
+
description: { story: 'Bar color set via the `waveformColor` prop. Can also be themed with `--ai-waveform-color` CSS variable.' },
|
|
98
|
+
},
|
|
99
|
+
},
|
|
100
|
+
};
|
|
101
|
+
export const CustomErrorText = {
|
|
102
|
+
name: 'Custom Error Text',
|
|
103
|
+
render: () => (_jsxs("div", { style: { maxWidth: '600px' }, children: [_jsx("p", { style: { fontFamily: 'sans-serif', fontSize: '13px', color: '#666', marginBottom: '8px' }, children: "Deny microphone access in the browser to see the custom error message." }), _jsx(AiVoiceInput, { errorText: "No mic access \u2014 check browser settings" })] })),
|
|
104
|
+
parameters: {
|
|
105
|
+
docs: {
|
|
106
|
+
description: { story: 'Override the default Arabic/English error string with a custom message via `errorText`.' },
|
|
107
|
+
},
|
|
108
|
+
},
|
|
109
|
+
};
|
|
110
|
+
const WithEventHandlersDemo = () => {
|
|
111
|
+
const [log, setLog] = useState([]);
|
|
112
|
+
return (_jsxs("div", { style: { maxWidth: '600px' }, children: [_jsx(AiVoiceInput, { autoStart: true, onAudioRecorded: (e) => {
|
|
113
|
+
setLog((prev) => [
|
|
114
|
+
...prev,
|
|
115
|
+
`🎤 Audio recorded — ${e.detail.duration}s / ${(e.detail.blob.size / 1024).toFixed(1)} KB`,
|
|
116
|
+
]);
|
|
117
|
+
}, onRecordingCancel: () => {
|
|
118
|
+
setLog((prev) => [...prev, '✕ Cancelled']);
|
|
119
|
+
} }), _jsxs("div", { style: { marginTop: '1rem', padding: '1rem', background: '#f5f5f5', borderRadius: '8px', fontFamily: 'monospace', fontSize: '13px', minHeight: '80px', maxHeight: '200px', overflowY: 'auto' }, children: [_jsx("div", { style: { color: '#666', fontWeight: 'bold', marginBottom: '4px' }, children: "Event log:" }), log.length === 0 && _jsx("div", { style: { color: '#aaa' }, children: "Record and submit or cancel to see events\u2026" }), log.map((entry, i) => (_jsx("div", { style: { color: entry.startsWith('🎤') ? '#8b5cf6' : '#737373' }, children: entry }, i)))] })] }));
|
|
120
|
+
};
|
|
121
|
+
export const WithEventHandlers = {
|
|
122
|
+
name: 'With Event Handlers',
|
|
123
|
+
render: () => _jsx(WithEventHandlersDemo, {}),
|
|
124
|
+
parameters: {
|
|
125
|
+
docs: {
|
|
126
|
+
description: { story: 'Live event log. Submit before 1 second to see the send button pulse (minimum duration guard).' },
|
|
127
|
+
},
|
|
128
|
+
},
|
|
129
|
+
};
|
|
130
|
+
//# sourceMappingURL=ai-voice-input.stories.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ai-voice-input.stories.js","sourceRoot":"","sources":["../../src/stories/ai-voice-input.stories.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjC,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAEvD,MAAM,IAAI,GAA8B;IACtC,KAAK,EAAE,kBAAkB;IACzB,SAAS,EAAE,YAAY;IACvB,IAAI,EAAE,CAAC,UAAU,CAAC;IAClB,QAAQ,EAAE;QACR,QAAQ,EAAE;YACR,OAAO,EAAE,SAAS;YAClB,WAAW,EAAE,mCAAmC;SACjD;QACD,YAAY,EAAE;YACZ,OAAO,EAAE,SAAS;YAClB,WAAW,EAAE,iDAAiD;SAC/D;QAC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ACF,eAAK,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,aACjM,cAAK,KAAK,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE,2BAAkB,EACvF,GAAG,CAAC,MAAM,KAAK,CAAC,IAAI,cAAK,KAAK,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,gEAAkD,EACnG,GAAG,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,CAAC,EAAE,EAAE,CAAC,CACrB,cAAa,KAAK,EAAE,EAAE,KAAK,EAAE,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,EAAE,YAAG,KAAK,IAA3E,CAAC,CAAiF,CAC7F,CAAC,IACE,IACF,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,iBAAiB,GAAU;IACtC,IAAI,EAAE,qBAAqB;IAC3B,MAAM,EAAE,GAAG,EAAE,CAAC,KAAC,qBAAqB,KAAG;IACvC,UAAU,EAAE;QACV,IAAI,EAAE;YACJ,WAAW,EAAE,EAAE,KAAK,EAAE,+FAA+F,EAAE;SACxH;KACF;CACF,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salla.sa/ui-ai-kit-react",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"module": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -29,19 +29,32 @@
|
|
|
29
29
|
"scripts": {
|
|
30
30
|
"build": "tsc",
|
|
31
31
|
"start": "tsc -w",
|
|
32
|
-
"clean": "rm -rf dist"
|
|
32
|
+
"clean": "rm -rf dist",
|
|
33
|
+
"dev": "storybook dev -p 6006",
|
|
34
|
+
"storybook": "storybook dev -p 6006",
|
|
35
|
+
"build-storybook": "storybook build"
|
|
33
36
|
},
|
|
34
37
|
"peerDependencies": {
|
|
38
|
+
"@salla.sa/ui-merchant-styles": ">=0.307.5",
|
|
35
39
|
"react": "^18.0.0 || ^19.0.0",
|
|
36
40
|
"react-dom": "^18.0.0 || ^19.0.0"
|
|
37
41
|
},
|
|
38
42
|
"dependencies": {
|
|
39
|
-
"@salla.sa/ui-ai-kit-core": "
|
|
43
|
+
"@salla.sa/ui-ai-kit-core": "2.0.0",
|
|
40
44
|
"@stencil/react-output-target": "^1.4.2"
|
|
41
45
|
},
|
|
42
46
|
"devDependencies": {
|
|
47
|
+
"@chromatic-com/storybook": "^5.0.1",
|
|
48
|
+
"@salla.sa/ui-merchant-styles": "0.307.5",
|
|
49
|
+
"@storybook/addon-a11y": "^10.2.16",
|
|
50
|
+
"@storybook/addon-docs": "^10.2.16",
|
|
51
|
+
"@storybook/addon-vitest": "^10.2.16",
|
|
52
|
+
"@storybook/react-vite": "^10.2.16",
|
|
43
53
|
"@types/react": "^19.2.14",
|
|
44
54
|
"@types/react-dom": "^19.2.3",
|
|
55
|
+
"react": "^19.0.0",
|
|
56
|
+
"react-dom": "^19.0.0",
|
|
57
|
+
"storybook": "^10.2.16",
|
|
45
58
|
"typescript": "^5.9.3"
|
|
46
59
|
}
|
|
47
60
|
}
|