ai-design-system 0.1.100 → 0.1.101

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.
@@ -14,6 +14,7 @@ const meta = {
14
14
  tags: ["autodocs"],
15
15
  parameters: { layout: "fullscreen" },
16
16
  args: {
17
+ onBack: fn(),
17
18
  onClose: fn(),
18
19
  onPublish: fn(),
19
20
  onSceneChange: fn(),
@@ -25,6 +25,7 @@ export interface ScenePlayerProps extends React.HTMLAttributes<HTMLDivElement> {
25
25
  avatarColor?: string;
26
26
  initialSceneIndex?: number;
27
27
  isMuted?: boolean;
28
+ onBack?: () => void;
28
29
  onClose?: () => void;
29
30
  onPublish?: (currentScene: SceneItem) => void;
30
31
  publishPlaceholder?: string;
@@ -40,6 +41,7 @@ export const ScenePlayer = React.forwardRef<HTMLDivElement, ScenePlayerProps>(
40
41
  avatarColor = "bg-indigo-600",
41
42
  initialSceneIndex = 0,
42
43
  isMuted: initialMuted = false,
44
+ onBack,
43
45
  onClose,
44
46
  onPublish,
45
47
  publishPlaceholder = "Ready to publish...",
@@ -49,6 +51,8 @@ export const ScenePlayer = React.forwardRef<HTMLDivElement, ScenePlayerProps>(
49
51
  },
50
52
  ref
51
53
  ) => {
54
+ const handleBack = onBack || onClose;
55
+
52
56
  const [currentSceneIndex, setCurrentSceneIndex] = React.useState<number>(() => {
53
57
  if (initialSceneIndex >= 0 && initialSceneIndex < scenes.length) {
54
58
  return initialSceneIndex;
@@ -117,7 +121,7 @@ export const ScenePlayer = React.forwardRef<HTMLDivElement, ScenePlayerProps>(
117
121
  handleNext();
118
122
  } else if (e.key === "Escape") {
119
123
  e.preventDefault();
120
- onClose?.();
124
+ handleBack?.();
121
125
  } else if (e.key === "m" || e.key === "M") {
122
126
  e.preventDefault();
123
127
  setIsMuted((prev) => !prev);
@@ -126,7 +130,7 @@ export const ScenePlayer = React.forwardRef<HTMLDivElement, ScenePlayerProps>(
126
130
 
127
131
  window.addEventListener("keydown", handleKeyDown);
128
132
  return () => window.removeEventListener("keydown", handleKeyDown);
129
- }, [handlePrev, handleNext, onClose]);
133
+ }, [handlePrev, handleNext, handleBack]);
130
134
 
131
135
  if (!scenes || scenes.length === 0) {
132
136
  return (
@@ -137,14 +141,14 @@ export const ScenePlayer = React.forwardRef<HTMLDivElement, ScenePlayerProps>(
137
141
  {...props}
138
142
  >
139
143
  <p className="text-white/70 text-sm">No scenes available</p>
140
- {onClose && (
144
+ {handleBack && (
141
145
  <Button
142
146
  variant="ghost"
143
- onClick={onClose}
147
+ onClick={handleBack}
144
148
  className="mt-4 text-white hover:bg-white/20"
145
- data-testid="btn-close"
149
+ data-testid="btn-back"
146
150
  >
147
- Close
151
+ Back
148
152
  </Button>
149
153
  )}
150
154
  </div>
@@ -183,8 +187,22 @@ export const ScenePlayer = React.forwardRef<HTMLDivElement, ScenePlayerProps>(
183
187
  </div>
184
188
 
185
189
  {/* Story Header Overlay */}
186
- <div className="flex items-center justify-between px-4 py-2.5 z-20 shrink-0">
187
- <div className="flex items-center gap-2.5 min-w-0">
190
+ <div className="flex items-center justify-between px-3 py-2.5 z-20 shrink-0">
191
+ <div className="flex items-center gap-2 min-w-0">
192
+ {/* Back Button */}
193
+ {handleBack && (
194
+ <Button
195
+ variant="ghost"
196
+ size="icon"
197
+ data-testid="btn-back"
198
+ aria-label="Back"
199
+ onClick={handleBack}
200
+ className="h-8 w-8 rounded-full bg-black/40 hover:bg-white/20 text-white p-0 cursor-pointer shrink-0"
201
+ >
202
+ <Icon name="arrow-left" className="w-5 h-5 text-white" />
203
+ </Button>
204
+ )}
205
+
188
206
  <div
189
207
  className={cn(
190
208
  "w-9 h-9 rounded-full flex items-center justify-center font-bold text-sm text-white shrink-0 ring-1.5 ring-white/80 overflow-hidden",
@@ -215,20 +233,6 @@ export const ScenePlayer = React.forwardRef<HTMLDivElement, ScenePlayerProps>(
215
233
  >
216
234
  <Icon name={isMuted ? "volume-x" : "volume-2"} className="w-4 h-4" />
217
235
  </Button>
218
-
219
- {/* Close Button */}
220
- {onClose && (
221
- <Button
222
- variant="ghost"
223
- size="icon"
224
- data-testid="btn-close"
225
- aria-label="Close scenes view"
226
- onClick={onClose}
227
- className="h-8 w-8 rounded-full bg-black/40 hover:bg-white/20 text-white p-0 cursor-pointer"
228
- >
229
- <Icon name="x" className="w-4 h-4" />
230
- </Button>
231
- )}
232
236
  </div>
233
237
  </div>
234
238
 
package/dist/index.cjs CHANGED
@@ -14575,6 +14575,7 @@ var ScenePlayer = React3__namespace.forwardRef(
14575
14575
  avatarColor = "bg-indigo-600",
14576
14576
  initialSceneIndex = 0,
14577
14577
  isMuted: initialMuted = false,
14578
+ onBack,
14578
14579
  onClose,
14579
14580
  onPublish,
14580
14581
  publishPlaceholder = "Ready to publish...",
@@ -14587,6 +14588,7 @@ var ScenePlayer = React3__namespace.forwardRef(
14587
14588
  "avatarColor",
14588
14589
  "initialSceneIndex",
14589
14590
  "isMuted",
14591
+ "onBack",
14590
14592
  "onClose",
14591
14593
  "onPublish",
14592
14594
  "publishPlaceholder",
@@ -14594,6 +14596,7 @@ var ScenePlayer = React3__namespace.forwardRef(
14594
14596
  "className"
14595
14597
  ]);
14596
14598
  var _a2;
14599
+ const handleBack = onBack || onClose;
14597
14600
  const [currentSceneIndex, setCurrentSceneIndex] = React3__namespace.useState(() => {
14598
14601
  if (initialSceneIndex >= 0 && initialSceneIndex < scenes.length) {
14599
14602
  return initialSceneIndex;
@@ -14653,7 +14656,7 @@ var ScenePlayer = React3__namespace.forwardRef(
14653
14656
  handleNext();
14654
14657
  } else if (e.key === "Escape") {
14655
14658
  e.preventDefault();
14656
- onClose == null ? void 0 : onClose();
14659
+ handleBack == null ? void 0 : handleBack();
14657
14660
  } else if (e.key === "m" || e.key === "M") {
14658
14661
  e.preventDefault();
14659
14662
  setIsMuted((prev) => !prev);
@@ -14661,7 +14664,7 @@ var ScenePlayer = React3__namespace.forwardRef(
14661
14664
  };
14662
14665
  window.addEventListener("keydown", handleKeyDown);
14663
14666
  return () => window.removeEventListener("keydown", handleKeyDown);
14664
- }, [handlePrev, handleNext, onClose]);
14667
+ }, [handlePrev, handleNext, handleBack]);
14665
14668
  if (!scenes || scenes.length === 0) {
14666
14669
  return /* @__PURE__ */ jsxRuntime.jsxs(
14667
14670
  "div",
@@ -14672,14 +14675,14 @@ var ScenePlayer = React3__namespace.forwardRef(
14672
14675
  }, props), {
14673
14676
  children: [
14674
14677
  /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-white/70 text-sm", children: "No scenes available" }),
14675
- onClose && /* @__PURE__ */ jsxRuntime.jsx(
14678
+ handleBack && /* @__PURE__ */ jsxRuntime.jsx(
14676
14679
  Button2,
14677
14680
  {
14678
14681
  variant: "ghost",
14679
- onClick: onClose,
14682
+ onClick: handleBack,
14680
14683
  className: "mt-4 text-white hover:bg-white/20",
14681
- "data-testid": "btn-close",
14682
- children: "Close"
14684
+ "data-testid": "btn-back",
14685
+ children: "Back"
14683
14686
  }
14684
14687
  )
14685
14688
  ]
@@ -14717,8 +14720,20 @@ var ScenePlayer = React3__namespace.forwardRef(
14717
14720
  scene.id || `scene-${idx}`
14718
14721
  );
14719
14722
  }) }),
14720
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between px-4 py-2.5 z-20 shrink-0", children: [
14721
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2.5 min-w-0", children: [
14723
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between px-3 py-2.5 z-20 shrink-0", children: [
14724
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 min-w-0", children: [
14725
+ handleBack && /* @__PURE__ */ jsxRuntime.jsx(
14726
+ Button2,
14727
+ {
14728
+ variant: "ghost",
14729
+ size: "icon",
14730
+ "data-testid": "btn-back",
14731
+ "aria-label": "Back",
14732
+ onClick: handleBack,
14733
+ className: "h-8 w-8 rounded-full bg-black/40 hover:bg-white/20 text-white p-0 cursor-pointer shrink-0",
14734
+ children: /* @__PURE__ */ jsxRuntime.jsx(Icon, { name: "arrow-left", className: "w-5 h-5 text-white" })
14735
+ }
14736
+ ),
14722
14737
  /* @__PURE__ */ jsxRuntime.jsx(
14723
14738
  "div",
14724
14739
  {
@@ -14739,32 +14754,18 @@ var ScenePlayer = React3__namespace.forwardRef(
14739
14754
  ] })
14740
14755
  ] })
14741
14756
  ] }),
14742
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 shrink-0", children: [
14743
- /* @__PURE__ */ jsxRuntime.jsx(
14744
- Button2,
14745
- {
14746
- variant: "ghost",
14747
- size: "icon",
14748
- "data-testid": "btn-toggle-mute",
14749
- "aria-label": isMuted ? "Unmute audio" : "Mute audio",
14750
- onClick: () => setIsMuted((prev) => !prev),
14751
- className: "h-8 w-8 rounded-full bg-black/40 hover:bg-white/20 text-white p-0 cursor-pointer",
14752
- children: /* @__PURE__ */ jsxRuntime.jsx(Icon, { name: isMuted ? "volume-x" : "volume-2", className: "w-4 h-4" })
14753
- }
14754
- ),
14755
- onClose && /* @__PURE__ */ jsxRuntime.jsx(
14756
- Button2,
14757
- {
14758
- variant: "ghost",
14759
- size: "icon",
14760
- "data-testid": "btn-close",
14761
- "aria-label": "Close scenes view",
14762
- onClick: onClose,
14763
- className: "h-8 w-8 rounded-full bg-black/40 hover:bg-white/20 text-white p-0 cursor-pointer",
14764
- children: /* @__PURE__ */ jsxRuntime.jsx(Icon, { name: "x", className: "w-4 h-4" })
14765
- }
14766
- )
14767
- ] })
14757
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center gap-2 shrink-0", children: /* @__PURE__ */ jsxRuntime.jsx(
14758
+ Button2,
14759
+ {
14760
+ variant: "ghost",
14761
+ size: "icon",
14762
+ "data-testid": "btn-toggle-mute",
14763
+ "aria-label": isMuted ? "Unmute audio" : "Mute audio",
14764
+ onClick: () => setIsMuted((prev) => !prev),
14765
+ className: "h-8 w-8 rounded-full bg-black/40 hover:bg-white/20 text-white p-0 cursor-pointer",
14766
+ children: /* @__PURE__ */ jsxRuntime.jsx(Icon, { name: isMuted ? "volume-x" : "volume-2", className: "w-4 h-4" })
14767
+ }
14768
+ ) })
14768
14769
  ] }),
14769
14770
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex-1 relative flex items-center justify-center bg-black overflow-hidden min-h-0", children: [
14770
14771
  /* @__PURE__ */ jsxRuntime.jsx(