@superinterface/react 2.1.1 → 2.1.2

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.cjs CHANGED
@@ -3443,9 +3443,14 @@ var import_jsx_runtime58 = require("react/jsx-runtime");
3443
3443
  var barCount = 4;
3444
3444
  var BarsVisualizer = function(param) {
3445
3445
  var visualizationAnalyser = param.visualizationAnalyser, color = param.color, height = param.height, barWidth = param.barWidth;
3446
- var _ref = _sliced_to_array((0, import_react49.useState)(function() {
3447
- return new AudioContext().createAnalyser();
3448
- }), 1), emptyVisualizer = _ref[0];
3446
+ var _ref = _sliced_to_array((0, import_react49.useState)(null), 2), cachedEmptyVisualizer = _ref[0], setCachedEmptyVisualizer = _ref[1];
3447
+ var getEmptyVisualizer = (0, import_react49.useCallback)(function() {
3448
+ var result = new AudioContext().createAnalyser();
3449
+ setCachedEmptyVisualizer(result);
3450
+ return result;
3451
+ }, [
3452
+ cachedEmptyVisualizer
3453
+ ]);
3449
3454
  var _ref1 = _sliced_to_array((0, import_react49.useState)([]), 2), barHeights = _ref1[0], setBarHeights = _ref1[1];
3450
3455
  var draw = (0, import_react49.useCallback)(function(param) {
3451
3456
  var visualizationAnalyser2 = param.visualizationAnalyser;
@@ -3463,12 +3468,13 @@ var BarsVisualizer = function(param) {
3463
3468
  }, []);
3464
3469
  (0, import_react49.useEffect)(function() {
3465
3470
  draw({
3466
- visualizationAnalyser: visualizationAnalyser || emptyVisualizer
3471
+ visualizationAnalyser: visualizationAnalyser || cachedEmptyVisualizer || getEmptyVisualizer()
3467
3472
  });
3468
3473
  }, [
3469
3474
  draw,
3470
3475
  visualizationAnalyser,
3471
- emptyVisualizer
3476
+ cachedEmptyVisualizer,
3477
+ getEmptyVisualizer
3472
3478
  ]);
3473
3479
  return /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(import_themes42.Grid, {
3474
3480
  columns: "".concat(barCount),
@@ -3550,21 +3556,16 @@ var ActionButton = function() {
3550
3556
  children: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(import_react_icons9.PauseIcon, {})
3551
3557
  })
3552
3558
  }),
3553
- /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(import_themes44.Tooltip, {
3554
- open: true,
3555
- content: "Send your message",
3556
- side: "bottom",
3557
- children: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(import_themes44.IconButton, {
3558
- onClick: audioThreadContext.recorderProps.stop,
3559
- color: "gray",
3560
- highContrast: true,
3561
- radius: "full",
3562
- size: "4",
3563
- style: {
3564
- border: "2px solid var(--gray-8)"
3565
- },
3566
- children: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(import_react_icons9.ArrowUpIcon, {})
3567
- })
3559
+ /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(import_themes44.IconButton, {
3560
+ onClick: audioThreadContext.recorderProps.stop,
3561
+ color: "gray",
3562
+ highContrast: true,
3563
+ radius: "full",
3564
+ size: "4",
3565
+ style: {
3566
+ border: "2px solid var(--gray-8)"
3567
+ },
3568
+ children: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(import_react_icons9.ArrowUpIcon, {})
3568
3569
  })
3569
3570
  ]
3570
3571
  });