@superinterface/react 2.12.0 → 2.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -3232,6 +3232,7 @@ var Root8 = function(param) {
3232
3232
  });
3233
3233
  };
3234
3234
  // src/components/threads/AudioThread/Visualization/index.tsx
3235
+ import { useContext as useContext13 } from "react";
3235
3236
  import { Flex as Flex22 } from "@radix-ui/themes";
3236
3237
  // src/hooks/threads/useAudioThreadContext/index.ts
3237
3238
  import { useContext as useContext12 } from "react";
@@ -3303,99 +3304,161 @@ var BarsVisualizer = function(param) {
3303
3304
  });
3304
3305
  };
3305
3306
  // src/components/threads/AudioThread/Visualization/index.tsx
3306
- import { jsx as jsx57 } from "react/jsx-runtime";
3307
+ import { jsx as jsx57, jsxs as jsxs18 } from "react/jsx-runtime";
3307
3308
  var Visualization = function() {
3308
3309
  var audioThreadContext = useAudioThreadContext();
3309
- return /* @__PURE__ */ jsx57(Flex22, {
3310
+ var assistantNameContext = useContext13(AssistantNameContext);
3311
+ return /* @__PURE__ */ jsxs18(Flex22, {
3310
3312
  direction: "column",
3311
3313
  align: "center",
3312
3314
  justify: "center",
3313
3315
  mb: "3",
3314
3316
  flexGrow: "1",
3315
- children: /* @__PURE__ */ jsx57(Flex22, {
3316
- align: "center",
3317
- justify: "center",
3318
- height: "200px",
3319
- width: "200px",
3320
- style: {
3321
- backgroundColor: audioThreadContext.status === "playing" ? "var(--accent-4)" : "var(--gray-4)",
3322
- borderRadius: "9999px"
3323
- },
3324
- children: /* @__PURE__ */ jsx57(BarsVisualizer, {
3325
- visualizationAnalyser: audioThreadContext.messageAudioProps.visualizationAnalyser,
3326
- backgroundColor: audioThreadContext.status === "playing" ? "var(--accent-11)" : "var(--gray-11)",
3327
- height: "40px",
3328
- barWidth: "24px"
3317
+ children: [
3318
+ /* @__PURE__ */ jsx57(Flex22, {
3319
+ align: "center",
3320
+ justify: "center",
3321
+ height: "200px",
3322
+ width: "200px",
3323
+ style: {
3324
+ backgroundColor: audioThreadContext.status === "playing" ? "var(--accent-4)" : "var(--gray-4)",
3325
+ borderRadius: "9999px"
3326
+ },
3327
+ children: /* @__PURE__ */ jsx57(BarsVisualizer, {
3328
+ visualizationAnalyser: audioThreadContext.messageAudioProps.visualizationAnalyser,
3329
+ backgroundColor: audioThreadContext.status === "playing" ? "var(--accent-11)" : "var(--gray-11)",
3330
+ height: "40px",
3331
+ barWidth: "24px"
3332
+ })
3333
+ }),
3334
+ /* @__PURE__ */ jsxs18(Flex22, {
3335
+ ml: "-22.5px",
3336
+ gap: "3",
3337
+ pt: "5",
3338
+ children: [
3339
+ /* @__PURE__ */ jsx57(AssistantAvatar, {}),
3340
+ /* @__PURE__ */ jsx57(Name, {
3341
+ children: assistantNameContext
3342
+ })
3343
+ ]
3329
3344
  })
3345
+ ]
3346
+ });
3347
+ };
3348
+ // src/components/threads/AudioThread/Status/StatusMessage.tsx
3349
+ import { Flex as Flex23, Text as Text7 } from "@radix-ui/themes";
3350
+ import { jsx as jsx58 } from "react/jsx-runtime";
3351
+ var StatusMessage = function(param) {
3352
+ var children = param.children;
3353
+ return /* @__PURE__ */ jsx58(Flex23, {
3354
+ justify: "center",
3355
+ pb: "9",
3356
+ children: /* @__PURE__ */ jsx58(Text7, {
3357
+ size: "2",
3358
+ weight: "regular",
3359
+ color: "gray",
3360
+ children: children
3330
3361
  })
3331
3362
  });
3332
3363
  };
3364
+ // src/components/threads/AudioThread/Status/index.tsx
3365
+ import { jsx as jsx59 } from "react/jsx-runtime";
3366
+ var Status = function() {
3367
+ var audioThreadContext = useAudioThreadContext();
3368
+ if (audioThreadContext.status === "recording") {
3369
+ return /* @__PURE__ */ jsx59(StatusMessage, {
3370
+ children: "Listening"
3371
+ });
3372
+ }
3373
+ if ([
3374
+ "recorderPaused",
3375
+ "idle",
3376
+ "playerPaused"
3377
+ ].includes(audioThreadContext.status)) {
3378
+ return /* @__PURE__ */ jsx59(StatusMessage, {
3379
+ children: "Click to activate"
3380
+ });
3381
+ }
3382
+ if (audioThreadContext.status === "playing") {
3383
+ return /* @__PURE__ */ jsx59(StatusMessage, {
3384
+ children: "Click to interrupt"
3385
+ });
3386
+ }
3387
+ return /* @__PURE__ */ jsx59(StatusMessage, {
3388
+ children: "Thinking"
3389
+ });
3390
+ };
3333
3391
  // src/components/threads/AudioThread/Form/index.tsx
3334
- import { Flex as Flex24 } from "@radix-ui/themes";
3392
+ import { Flex as Flex25 } from "@radix-ui/themes";
3393
+ // src/components/threads/AudioThread/Form/MicIcon.tsx
3394
+ import { jsx as jsx60 } from "react/jsx-runtime";
3395
+ var MicIcon = function(props) {
3396
+ return /* @__PURE__ */ jsx60("svg", _object_spread_props(_object_spread({
3397
+ xmlns: "http://www.w3.org/2000/svg",
3398
+ fill: "currentColor",
3399
+ stroke: "currentColor",
3400
+ strokeWidth: 0,
3401
+ viewBox: "0 0 384 512",
3402
+ height: "15",
3403
+ width: "15"
3404
+ }, props), {
3405
+ children: /* @__PURE__ */ jsx60("path", {
3406
+ stroke: "none",
3407
+ d: "M192 0c-53 0-96 43-96 96v160c0 53 43 96 96 96s96-43 96-96V96c0-53-43-96-96-96zM64 216c0-13.3-10.7-24-24-24s-24 10.7-24 24v40c0 89.1 66.2 162.7 152 174.4V464h-48c-13.3 0-24 10.7-24 24s10.7 24 24 24h144c13.3 0 24-10.7 24-24s-10.7-24-24-24h-48v-33.6c85.8-11.7 152-85.3 152-174.4v-40c0-13.3-10.7-24-24-24s-24 10.7-24 24v40c0 70.7-57.3 128-128 128S64 326.7 64 256v-40z"
3408
+ })
3409
+ }));
3410
+ };
3335
3411
  // src/components/threads/AudioThread/Form/ActionButton/index.tsx
3336
- import { Flex as Flex23, IconButton as IconButton4 } from "@radix-ui/themes";
3412
+ import { Flex as Flex24, IconButton as IconButton4 } from "@radix-ui/themes";
3337
3413
  import { StopIcon as StopIcon2, PauseIcon, ArrowUpIcon as ArrowUpIcon2, ResumeIcon } from "@radix-ui/react-icons";
3338
- import { jsx as jsx58, jsxs as jsxs18 } from "react/jsx-runtime";
3414
+ import { jsx as jsx61, jsxs as jsxs19 } from "react/jsx-runtime";
3339
3415
  var ActionButton = function() {
3340
3416
  var audioThreadContext = useAudioThreadContext();
3341
3417
  var superinterfaceContext = useSuperinterfaceContext();
3342
3418
  if (audioThreadContext.status === "recording") {
3343
- return /* @__PURE__ */ jsxs18(Flex23, {
3419
+ return /* @__PURE__ */ jsxs19(Flex24, {
3344
3420
  align: "center",
3345
3421
  children: [
3346
- /* @__PURE__ */ jsx58(Flex23, {
3422
+ /* @__PURE__ */ jsx61(Flex24, {
3347
3423
  mr: "3",
3348
3424
  ml: "-7",
3349
- children: /* @__PURE__ */ jsx58(IconButton4, {
3425
+ children: /* @__PURE__ */ jsx61(IconButton4, {
3350
3426
  onClick: audioThreadContext.recorderProps.pause,
3351
3427
  color: "gray",
3352
- radius: "full",
3353
3428
  variant: "soft",
3354
3429
  size: "1",
3355
- children: /* @__PURE__ */ jsx58(PauseIcon, {})
3430
+ children: /* @__PURE__ */ jsx61(PauseIcon, {})
3356
3431
  })
3357
3432
  }),
3358
- /* @__PURE__ */ jsx58(IconButton4, {
3433
+ /* @__PURE__ */ jsx61(IconButton4, {
3359
3434
  onClick: audioThreadContext.recorderProps.stop,
3360
3435
  highContrast: true,
3361
- radius: "full",
3362
3436
  variant: "soft",
3363
3437
  size: "4",
3364
- style: {
3365
- border: "2px solid var(--gray-8)"
3366
- },
3367
- children: /* @__PURE__ */ jsx58(ArrowUpIcon2, {})
3438
+ children: /* @__PURE__ */ jsx61(ArrowUpIcon2, {})
3368
3439
  })
3369
3440
  ]
3370
3441
  });
3371
3442
  }
3372
3443
  if (audioThreadContext.status === "recorderPaused") {
3373
- return /* @__PURE__ */ jsx58(IconButton4, {
3444
+ return /* @__PURE__ */ jsx61(IconButton4, {
3374
3445
  onClick: audioThreadContext.recorderProps.resume,
3375
3446
  color: "red",
3376
- radius: "full",
3377
3447
  size: "4",
3378
- style: {
3379
- border: "2px solid var(--gray-8)"
3380
- },
3381
- children: /* @__PURE__ */ jsx58(ResumeIcon, {})
3448
+ children: /* @__PURE__ */ jsx61(ResumeIcon, {})
3382
3449
  });
3383
3450
  }
3384
3451
  if (audioThreadContext.status === "idle") {
3385
- return /* @__PURE__ */ jsx58(IconButton4, {
3452
+ return /* @__PURE__ */ jsx61(IconButton4, {
3386
3453
  onClick: function() {
3387
3454
  return audioThreadContext.recorderProps.start();
3388
3455
  },
3389
3456
  size: "4",
3390
- color: "red",
3391
- radius: "full",
3392
- style: {
3393
- border: "2px solid var(--gray-8)"
3394
- }
3457
+ color: "red"
3395
3458
  });
3396
3459
  }
3397
3460
  if (audioThreadContext.status === "playing") {
3398
- return /* @__PURE__ */ jsx58(IconButton4, {
3461
+ return /* @__PURE__ */ jsx61(IconButton4, {
3399
3462
  onClick: function() {
3400
3463
  var _superinterfaceContext_createMessageAbortControllerRef_current;
3401
3464
  audioThreadContext.messageAudioProps.stop();
@@ -3404,74 +3467,75 @@ var ActionButton = function() {
3404
3467
  },
3405
3468
  size: "4",
3406
3469
  color: "gray",
3407
- radius: "full",
3408
3470
  variant: "soft",
3409
- style: {
3410
- border: "2px solid var(--gray-8)"
3411
- },
3412
- children: /* @__PURE__ */ jsx58(StopIcon2, {})
3471
+ children: /* @__PURE__ */ jsx61(StopIcon2, {})
3413
3472
  });
3414
3473
  }
3415
3474
  if (audioThreadContext.status === "playerPaused") {
3416
- return /* @__PURE__ */ jsx58(IconButton4, {
3475
+ return /* @__PURE__ */ jsx61(IconButton4, {
3417
3476
  onClick: function() {
3418
3477
  return audioThreadContext.messageAudioProps.play();
3419
3478
  },
3420
3479
  size: "4",
3421
- radius: "full",
3422
- style: {
3423
- border: "2px solid var(--gray-8)"
3424
- },
3425
- children: /* @__PURE__ */ jsx58(ResumeIcon, {})
3480
+ children: /* @__PURE__ */ jsx61(ResumeIcon, {})
3426
3481
  });
3427
3482
  }
3428
- return /* @__PURE__ */ jsx58(IconButton4, {
3483
+ return /* @__PURE__ */ jsx61(IconButton4, {
3429
3484
  size: "4",
3430
- radius: "full",
3431
3485
  variant: "soft",
3432
- disabled: true,
3433
- style: {
3434
- border: "2px solid var(--gray-8)"
3435
- }
3486
+ disabled: true
3436
3487
  });
3437
3488
  };
3438
3489
  // src/components/threads/AudioThread/Form/index.tsx
3439
- import { jsx as jsx59, jsxs as jsxs19 } from "react/jsx-runtime";
3490
+ import { jsx as jsx62, jsxs as jsxs20 } from "react/jsx-runtime";
3440
3491
  var Form = function() {
3441
3492
  var audioThreadContext = useAudioThreadContext();
3442
- return /* @__PURE__ */ jsxs19(Flex24, {
3493
+ return /* @__PURE__ */ jsxs20(Flex25, {
3443
3494
  direction: "column",
3444
3495
  align: "center",
3445
3496
  children: [
3446
- /* @__PURE__ */ jsx59(Flex24, {
3497
+ /* @__PURE__ */ jsxs20(Flex25, {
3447
3498
  pb: "3",
3448
3499
  align: "center",
3449
- children: /* @__PURE__ */ jsx59(Flex24, {
3450
- px: "2",
3451
- py: "1",
3452
- style: {
3453
- backgroundColor: audioThreadContext.status === "recording" ? "var(--accent-4)" : "var(--gray-4)",
3454
- borderRadius: "var(--radius-6)"
3455
- },
3456
- children: /* @__PURE__ */ jsx59(BarsVisualizer, {
3457
- visualizationAnalyser: audioThreadContext.recorderProps.visualizationAnalyser,
3458
- backgroundColor: audioThreadContext.status === "recording" ? "var(--accent-11)" : "var(--gray-11)",
3459
- height: "20px",
3460
- barWidth: "12px"
3500
+ children: [
3501
+ /* @__PURE__ */ jsx62(Flex25, {
3502
+ ml: "-22.5px",
3503
+ mr: "2",
3504
+ align: "center",
3505
+ children: /* @__PURE__ */ jsx62(MicIcon, {
3506
+ style: {
3507
+ color: audioThreadContext.status === "recording" ? "var(--accent-11)" : "var(--gray-11)"
3508
+ }
3509
+ })
3510
+ }),
3511
+ /* @__PURE__ */ jsx62(Flex25, {
3512
+ px: "2",
3513
+ py: "1",
3514
+ style: {
3515
+ backgroundColor: audioThreadContext.status === "recording" ? "var(--accent-4)" : "var(--gray-4)",
3516
+ borderRadius: "var(--radius-6)"
3517
+ },
3518
+ children: /* @__PURE__ */ jsx62(BarsVisualizer, {
3519
+ visualizationAnalyser: audioThreadContext.recorderProps.visualizationAnalyser,
3520
+ backgroundColor: audioThreadContext.status === "recording" ? "var(--accent-11)" : "var(--gray-11)",
3521
+ height: "20px",
3522
+ barWidth: "12px"
3523
+ })
3461
3524
  })
3462
- })
3525
+ ]
3463
3526
  }),
3464
- /* @__PURE__ */ jsx59(ActionButton, {})
3527
+ /* @__PURE__ */ jsx62(ActionButton, {})
3465
3528
  ]
3466
3529
  });
3467
3530
  };
3468
3531
  // src/components/threads/AudioThread/index.tsx
3469
- import { jsx as jsx60, jsxs as jsxs20 } from "react/jsx-runtime";
3532
+ import { jsx as jsx63, jsxs as jsxs21 } from "react/jsx-runtime";
3470
3533
  var AudioThread = function(props) {
3471
- return /* @__PURE__ */ jsxs20(Root8, _object_spread_props(_object_spread({}, props), {
3534
+ return /* @__PURE__ */ jsxs21(Root8, _object_spread_props(_object_spread({}, props), {
3472
3535
  children: [
3473
- /* @__PURE__ */ jsx60(Visualization, {}),
3474
- /* @__PURE__ */ jsx60(Form, {})
3536
+ /* @__PURE__ */ jsx63(Visualization, {}),
3537
+ /* @__PURE__ */ jsx63(Status, {}),
3538
+ /* @__PURE__ */ jsx63(Form, {})
3475
3539
  ]
3476
3540
  }));
3477
3541
  };
@@ -3479,15 +3543,15 @@ AudioThread.Root = Root8;
3479
3543
  AudioThread.Visualization = Visualization;
3480
3544
  AudioThread.Form = Form;
3481
3545
  // src/components/threads/AudioThreadDialog/index.tsx
3482
- import { jsx as jsx61, jsxs as jsxs21 } from "react/jsx-runtime";
3546
+ import { jsx as jsx64, jsxs as jsxs22 } from "react/jsx-runtime";
3483
3547
  var AudioThreadDialog = function() {
3484
- return /* @__PURE__ */ jsxs21(Root6, {
3548
+ return /* @__PURE__ */ jsxs22(Root6, {
3485
3549
  children: [
3486
- /* @__PURE__ */ jsx61(Content4.Root, {
3487
- children: /* @__PURE__ */ jsx61(AudioThread, {})
3550
+ /* @__PURE__ */ jsx64(Content4.Root, {
3551
+ children: /* @__PURE__ */ jsx64(AudioThread, {})
3488
3552
  }),
3489
- /* @__PURE__ */ jsx61(Trigger, {
3490
- children: /* @__PURE__ */ jsx61(Button2, {})
3553
+ /* @__PURE__ */ jsx64(Trigger, {
3554
+ children: /* @__PURE__ */ jsx64(Button2, {})
3491
3555
  })
3492
3556
  ]
3493
3557
  });
@@ -3502,15 +3566,15 @@ import { useMemo as useMemo14 } from "react";
3502
3566
  import { useMemo as useMemo13 } from "react";
3503
3567
  import { isEmpty as isEmpty2 } from "radash";
3504
3568
  import { onlyText } from "react-children-utilities";
3505
- import { Flex as Flex25 } from "@radix-ui/themes";
3569
+ import { Flex as Flex26 } from "@radix-ui/themes";
3506
3570
  // src/components/suggestions/Suggestions/Item.tsx
3507
3571
  import { ArrowUpIcon as ArrowUpIcon3 } from "@radix-ui/react-icons";
3508
- import { Text as Text7, Button as Button3, Spinner } from "@radix-ui/themes";
3509
- import { jsx as jsx62, jsxs as jsxs22 } from "react/jsx-runtime";
3572
+ import { Text as Text8, Button as Button3, Spinner } from "@radix-ui/themes";
3573
+ import { jsx as jsx65, jsxs as jsxs23 } from "react/jsx-runtime";
3510
3574
  var Item = function(param) {
3511
3575
  var suggestion = param.suggestion, isDisabled = param.isDisabled;
3512
3576
  var _useCreateMessage = useCreateMessage(), createMessage = _useCreateMessage.createMessage, isPending = _useCreateMessage.isPending;
3513
- return /* @__PURE__ */ jsx62(Content5, {
3577
+ return /* @__PURE__ */ jsx65(Content5, {
3514
3578
  onClick: function() {
3515
3579
  createMessage({
3516
3580
  // @ts-ignore-next-line
@@ -3524,7 +3588,7 @@ var Item = function(param) {
3524
3588
  };
3525
3589
  var Content5 = function(param) {
3526
3590
  var onClick = param.onClick, isDisabled = param.isDisabled, isPending = param.isPending, children = param.children;
3527
- return /* @__PURE__ */ jsxs22(Button3, {
3591
+ return /* @__PURE__ */ jsxs23(Button3, {
3528
3592
  variant: "soft",
3529
3593
  onClick: onClick,
3530
3594
  disabled: isDisabled,
@@ -3534,14 +3598,14 @@ var Content5 = function(param) {
3534
3598
  flexShrink: 1
3535
3599
  },
3536
3600
  children: [
3537
- /* @__PURE__ */ jsx62(Text7, {
3601
+ /* @__PURE__ */ jsx65(Text8, {
3538
3602
  size: "1",
3539
3603
  weight: "regular",
3540
3604
  children: children
3541
3605
  }),
3542
- /* @__PURE__ */ jsx62(Spinner, {
3606
+ /* @__PURE__ */ jsx65(Spinner, {
3543
3607
  loading: isPending,
3544
- children: /* @__PURE__ */ jsx62(ArrowUpIcon3, {
3608
+ children: /* @__PURE__ */ jsx65(ArrowUpIcon3, {
3545
3609
  style: {
3546
3610
  flexShrink: 0
3547
3611
  }
@@ -3552,7 +3616,7 @@ var Content5 = function(param) {
3552
3616
  };
3553
3617
  Item.Content = Content5;
3554
3618
  // src/components/suggestions/Suggestions/Content.tsx
3555
- import { jsx as jsx63 } from "react/jsx-runtime";
3619
+ import { jsx as jsx66 } from "react/jsx-runtime";
3556
3620
  var Content6 = function(param) {
3557
3621
  var children = param.children;
3558
3622
  var isMutatingMessage = useIsMutatingMessage();
@@ -3566,12 +3630,12 @@ var Content6 = function(param) {
3566
3630
  children
3567
3631
  ]);
3568
3632
  if (isEmpty2(suggestions)) return null;
3569
- return /* @__PURE__ */ jsx63(Flex25, {
3633
+ return /* @__PURE__ */ jsx66(Flex26, {
3570
3634
  gap: "2",
3571
3635
  py: "2",
3572
3636
  wrap: "wrap",
3573
3637
  children: suggestions.map(function(suggestion) {
3574
- return /* @__PURE__ */ jsx63(Item, {
3638
+ return /* @__PURE__ */ jsx66(Item, {
3575
3639
  suggestion: suggestion,
3576
3640
  isDisabled: isMutatingMessage
3577
3641
  }, suggestion);
@@ -3579,7 +3643,7 @@ var Content6 = function(param) {
3579
3643
  });
3580
3644
  };
3581
3645
  // src/components/suggestions/Suggestions/index.tsx
3582
- import { jsx as jsx64 } from "react/jsx-runtime";
3646
+ import { jsx as jsx67 } from "react/jsx-runtime";
3583
3647
  var Suggestions = function(param) {
3584
3648
  var children = param.children;
3585
3649
  var latestMessageProps = useLatestMessage();
@@ -3592,14 +3656,14 @@ var Suggestions = function(param) {
3592
3656
  ]);
3593
3657
  if (latestMessageProps.isLoading) return null;
3594
3658
  if (isDisabled) return null;
3595
- return /* @__PURE__ */ jsx64(Content6, {
3659
+ return /* @__PURE__ */ jsx67(Content6, {
3596
3660
  children: children
3597
3661
  });
3598
3662
  };
3599
3663
  Suggestions.Item = Item;
3600
3664
  // src/components/markdown/MarkdownProvider/index.tsx
3601
3665
  import { useMemo as useMemo15 } from "react";
3602
- import { jsx as jsx65 } from "react/jsx-runtime";
3666
+ import { jsx as jsx68 } from "react/jsx-runtime";
3603
3667
  var MarkdownProvider = function(_param) {
3604
3668
  var children = _param.children, rest = _object_without_properties(_param, [
3605
3669
  "children"
@@ -3611,7 +3675,7 @@ var MarkdownProvider = function(_param) {
3611
3675
  rest,
3612
3676
  prevMarkdownContext
3613
3677
  ]);
3614
- return /* @__PURE__ */ jsx65(MarkdownContext.Provider, {
3678
+ return /* @__PURE__ */ jsx68(MarkdownContext.Provider, {
3615
3679
  value: value,
3616
3680
  children: children
3617
3681
  });