@dreamtree-org/twreact-ui 1.1.2 → 1.1.4
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.css +1 -1
- package/dist/index.esm.css +1 -1
- package/dist/index.esm.js +298 -62
- package/dist/index.js +297 -60
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3366,8 +3366,8 @@ function _defineProperty$4(e, r, t) {
|
|
|
3366
3366
|
}
|
|
3367
3367
|
|
|
3368
3368
|
var _excluded$l = ["options", "value", "onChange", "placeholder", "label", "error", "disabled", "required", "multiSelect", "searchable", "grouped", "onMenuItemRender", "className", "allowClear", "creatable", "onCreateOption", "onSearch", "loading", "selectAllOption", "closeOnSelect", "maxTagCount", "renderGroupLabel", "name"];
|
|
3369
|
-
function ownKeys$
|
|
3370
|
-
function _objectSpread$
|
|
3369
|
+
function ownKeys$a(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3370
|
+
function _objectSpread$a(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$a(Object(t), true).forEach(function (r) { _defineProperty$4(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$a(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
3371
3371
|
|
|
3372
3372
|
/**
|
|
3373
3373
|
* Enhanced Select component (debounce removed)
|
|
@@ -3390,7 +3390,7 @@ var flattenGroups = function flattenGroups() {
|
|
|
3390
3390
|
return groups.reduce(function (acc, g) {
|
|
3391
3391
|
var groupLabel = g.label;
|
|
3392
3392
|
g.options.forEach(function (opt) {
|
|
3393
|
-
return acc.push(_objectSpread$
|
|
3393
|
+
return acc.push(_objectSpread$a(_objectSpread$a({}, opt), {}, {
|
|
3394
3394
|
_group: groupLabel
|
|
3395
3395
|
}));
|
|
3396
3396
|
});
|
|
@@ -3480,7 +3480,7 @@ var Select = /*#__PURE__*/React.forwardRef(function (_ref, forwardedRef) {
|
|
|
3480
3480
|
var flatOptions = React.useMemo(function () {
|
|
3481
3481
|
if (grouped) return flattenGroups(options);
|
|
3482
3482
|
return options.map(function (opt) {
|
|
3483
|
-
return _objectSpread$
|
|
3483
|
+
return _objectSpread$a({}, opt);
|
|
3484
3484
|
});
|
|
3485
3485
|
}, [options, grouped]);
|
|
3486
3486
|
var selectedValues = multiSelect ? Array.isArray(value) ? value : [] : value;
|
|
@@ -3507,7 +3507,7 @@ var Select = /*#__PURE__*/React.forwardRef(function (_ref, forwardedRef) {
|
|
|
3507
3507
|
}
|
|
3508
3508
|
if (grouped) {
|
|
3509
3509
|
return options.map(function (g) {
|
|
3510
|
-
return _objectSpread$
|
|
3510
|
+
return _objectSpread$a(_objectSpread$a({}, g), {}, {
|
|
3511
3511
|
options: g.options.filter(function (o) {
|
|
3512
3512
|
return o.label.toLowerCase().includes(searchTerm.toLowerCase());
|
|
3513
3513
|
})
|
|
@@ -3734,7 +3734,7 @@ var Select = /*#__PURE__*/React.forwardRef(function (_ref, forwardedRef) {
|
|
|
3734
3734
|
className: "text-xs border border-slate-200 p-0.5 rounded-md cursor-pointer hover:bg-gray-100",
|
|
3735
3735
|
onClick: function onClick() {
|
|
3736
3736
|
return setCollapsedGroups(function (prev) {
|
|
3737
|
-
return _objectSpread$
|
|
3737
|
+
return _objectSpread$a(_objectSpread$a({}, prev), {}, _defineProperty$4({}, group.label, !prev[group.label]));
|
|
3738
3738
|
});
|
|
3739
3739
|
}
|
|
3740
3740
|
}, /*#__PURE__*/React.createElement(ChevronDown, {
|
|
@@ -4205,78 +4205,137 @@ function MobileFilters(_ref) {
|
|
|
4205
4205
|
})));
|
|
4206
4206
|
}
|
|
4207
4207
|
|
|
4208
|
-
function
|
|
4209
|
-
function _objectSpread$a(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$a(Object(t), true).forEach(function (r) { _defineProperty$4(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$a(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4210
|
-
|
|
4211
|
-
/**
|
|
4212
|
-
* Action menu dropdown component for table row actions
|
|
4213
|
-
* Uses fixed positioning with smart placement above/below anchor
|
|
4214
|
-
*/
|
|
4215
|
-
var ActionMenu = /*#__PURE__*/React.memo(function ActionMenu(_ref) {
|
|
4208
|
+
function ActionMenu(_ref) {
|
|
4216
4209
|
var _ref$actions = _ref.actions,
|
|
4217
4210
|
actions = _ref$actions === void 0 ? [] : _ref$actions,
|
|
4218
4211
|
row = _ref.row,
|
|
4219
4212
|
onAction = _ref.onAction,
|
|
4213
|
+
onClose = _ref.onClose,
|
|
4220
4214
|
menuRef = _ref.menuRef,
|
|
4221
|
-
anchorEl = _ref.anchorEl
|
|
4222
|
-
onClose = _ref.onClose;
|
|
4215
|
+
anchorEl = _ref.anchorEl;
|
|
4223
4216
|
var _useState = React.useState({
|
|
4224
|
-
top: 0,
|
|
4225
4217
|
left: 0,
|
|
4226
|
-
|
|
4218
|
+
top: 0,
|
|
4219
|
+
transformOrigin: "top right",
|
|
4220
|
+
maxHeight: 300,
|
|
4221
|
+
width: 180,
|
|
4222
|
+
opacity: 0
|
|
4227
4223
|
}),
|
|
4228
4224
|
_useState2 = _slicedToArray(_useState, 2),
|
|
4229
|
-
|
|
4230
|
-
|
|
4225
|
+
style = _useState2[0],
|
|
4226
|
+
setStyle = _useState2[1];
|
|
4227
|
+
var menuWidth = 180;
|
|
4228
|
+
var maxMenuHeight = 320;
|
|
4229
|
+
var minMenuHeight = 80;
|
|
4230
|
+
var margin = 8;
|
|
4231
4231
|
React.useLayoutEffect(function () {
|
|
4232
|
-
|
|
4233
|
-
|
|
4234
|
-
|
|
4235
|
-
|
|
4236
|
-
});
|
|
4232
|
+
computePosition();
|
|
4233
|
+
var handleResize = function handleResize() {
|
|
4234
|
+
window.requestAnimationFrame(function () {
|
|
4235
|
+
return computePosition();
|
|
4237
4236
|
});
|
|
4238
|
-
|
|
4239
|
-
|
|
4240
|
-
|
|
4237
|
+
};
|
|
4238
|
+
var handleScroll = function handleScroll() {
|
|
4239
|
+
onClose === null || onClose === void 0 || onClose();
|
|
4240
|
+
};
|
|
4241
|
+
window.addEventListener("resize", handleResize);
|
|
4242
|
+
window.addEventListener("scroll", handleScroll, true);
|
|
4243
|
+
return function () {
|
|
4244
|
+
window.removeEventListener("resize", handleResize);
|
|
4245
|
+
window.removeEventListener("scroll", handleScroll, true);
|
|
4246
|
+
};
|
|
4247
|
+
}, [anchorEl, actions, menuRef, onClose]);
|
|
4248
|
+
var computePosition = function computePosition() {
|
|
4249
|
+
if (!anchorEl || typeof window === "undefined") return;
|
|
4241
4250
|
var rect = anchorEl.getBoundingClientRect();
|
|
4242
|
-
var menuWidth = menu.offsetWidth || 176;
|
|
4243
|
-
var menuHeight = menu.offsetHeight || menu.scrollHeight || 200;
|
|
4244
|
-
var viewportWidth = window.innerWidth;
|
|
4245
|
-
var viewportHeight = window.innerHeight;
|
|
4246
|
-
var scrollX = window.scrollX || window.pageXOffset || 0;
|
|
4247
4251
|
var scrollY = window.scrollY || window.pageYOffset || 0;
|
|
4248
|
-
var
|
|
4249
|
-
var
|
|
4252
|
+
var scrollX = window.scrollX || window.pageXOffset || 0;
|
|
4253
|
+
var spaceBelow = window.innerHeight - rect.bottom;
|
|
4254
|
+
var spaceAbove = rect.top;
|
|
4250
4255
|
|
|
4251
|
-
//
|
|
4252
|
-
var
|
|
4253
|
-
|
|
4254
|
-
|
|
4255
|
-
|
|
4256
|
+
// allowed max height based on available space
|
|
4257
|
+
var allowedMaxHeight = Math.min(maxMenuHeight, Math.max(minMenuHeight, Math.max(spaceBelow - margin, spaceAbove - margin)));
|
|
4258
|
+
|
|
4259
|
+
// decide placement
|
|
4260
|
+
var placement = "bottom";
|
|
4261
|
+
if (spaceBelow < 160 && spaceAbove > spaceBelow) {
|
|
4262
|
+
placement = "top";
|
|
4263
|
+
allowedMaxHeight = Math.min(maxMenuHeight, Math.max(minMenuHeight, spaceAbove - margin));
|
|
4264
|
+
} else {
|
|
4265
|
+
allowedMaxHeight = Math.min(maxMenuHeight, Math.max(minMenuHeight, spaceBelow - margin));
|
|
4266
|
+
}
|
|
4267
|
+
|
|
4268
|
+
// measure content height if available
|
|
4269
|
+
var measuredMenuHeight = allowedMaxHeight;
|
|
4270
|
+
var menuEl = menuRef === null || menuRef === void 0 ? void 0 : menuRef.current;
|
|
4271
|
+
if (menuEl) {
|
|
4272
|
+
var contentHeight = menuEl.scrollHeight || menuEl.offsetHeight || allowedMaxHeight;
|
|
4273
|
+
measuredMenuHeight = Math.min(contentHeight, allowedMaxHeight);
|
|
4256
4274
|
}
|
|
4257
4275
|
|
|
4258
|
-
//
|
|
4276
|
+
// compute top based on placement
|
|
4259
4277
|
var top;
|
|
4260
|
-
if (
|
|
4261
|
-
top =
|
|
4262
|
-
} else if (preferAboveTop >= scrollY + 8) {
|
|
4263
|
-
top = preferAboveTop;
|
|
4278
|
+
if (placement === "top") {
|
|
4279
|
+
top = rect.top + scrollY - measuredMenuHeight - margin;
|
|
4264
4280
|
} else {
|
|
4265
|
-
top =
|
|
4281
|
+
top = rect.bottom + scrollY + margin;
|
|
4266
4282
|
}
|
|
4267
|
-
|
|
4268
|
-
|
|
4283
|
+
|
|
4284
|
+
// clamp top to viewport
|
|
4285
|
+
var minTop = margin + scrollY;
|
|
4286
|
+
var maxTop = window.innerHeight + scrollY - measuredMenuHeight - margin;
|
|
4287
|
+
if (top < minTop) top = minTop;
|
|
4288
|
+
if (top > maxTop) top = maxTop;
|
|
4289
|
+
|
|
4290
|
+
// compute left and clamp horizontally (align right edge of menu to anchor right)
|
|
4291
|
+
var left = rect.right + scrollX - menuWidth;
|
|
4292
|
+
if (left < margin) left = margin;
|
|
4293
|
+
if (left + menuWidth > window.innerWidth - margin) {
|
|
4294
|
+
left = Math.max(margin, window.innerWidth - menuWidth - margin);
|
|
4295
|
+
}
|
|
4296
|
+
var transformOrigin = placement === "bottom" ? "top right" : "bottom right";
|
|
4297
|
+
|
|
4298
|
+
// Apply style (fade-in by setting opacity to 1)
|
|
4299
|
+
setStyle({
|
|
4269
4300
|
left: left,
|
|
4270
|
-
|
|
4301
|
+
top: top,
|
|
4302
|
+
transformOrigin: transformOrigin,
|
|
4303
|
+
maxHeight: allowedMaxHeight,
|
|
4304
|
+
width: menuWidth,
|
|
4305
|
+
opacity: 1
|
|
4271
4306
|
});
|
|
4272
|
-
}
|
|
4273
|
-
|
|
4307
|
+
};
|
|
4308
|
+
|
|
4309
|
+
// measure & position before paint
|
|
4310
|
+
React.useLayoutEffect(function () {
|
|
4311
|
+
computePosition();
|
|
4312
|
+
var onScrollOrResize = function onScrollOrResize() {
|
|
4313
|
+
window.requestAnimationFrame(function () {
|
|
4314
|
+
return computePosition();
|
|
4315
|
+
});
|
|
4316
|
+
};
|
|
4317
|
+
window.addEventListener("resize", onScrollOrResize);
|
|
4318
|
+
window.addEventListener("scroll", onScrollOrResize, true);
|
|
4319
|
+
return function () {
|
|
4320
|
+
window.removeEventListener("resize", onScrollOrResize);
|
|
4321
|
+
window.removeEventListener("scroll", onScrollOrResize, true);
|
|
4322
|
+
};
|
|
4323
|
+
// recompute when anchor or actions change (content height may change)
|
|
4324
|
+
}, [anchorEl, actions, menuRef]);
|
|
4325
|
+
|
|
4326
|
+
// Render into body
|
|
4327
|
+
return /*#__PURE__*/ReactDOM.createPortal(/*#__PURE__*/React.createElement("div", {
|
|
4274
4328
|
ref: menuRef,
|
|
4275
|
-
className: "absolute right-0 z-50 bg-white rounded-lg shadow-lg ring-1 ring-black ring-opacity-5",
|
|
4276
4329
|
style: {
|
|
4277
|
-
|
|
4278
|
-
|
|
4330
|
+
position: "absolute",
|
|
4331
|
+
top: style.top,
|
|
4332
|
+
left: style.left,
|
|
4333
|
+
width: style.width,
|
|
4334
|
+
maxHeight: style.maxHeight,
|
|
4335
|
+
transformOrigin: style.transformOrigin,
|
|
4336
|
+
opacity: style.opacity
|
|
4279
4337
|
},
|
|
4338
|
+
className: "absolute z-50 bg-white rounded-lg shadow-lg ring-1 ring-black ring-opacity-5 overflow-y-auto transition-opacity duration-150 ease-out",
|
|
4280
4339
|
onClick: function onClick(e) {
|
|
4281
4340
|
return e.stopPropagation();
|
|
4282
4341
|
}
|
|
@@ -4288,18 +4347,25 @@ var ActionMenu = /*#__PURE__*/React.memo(function ActionMenu(_ref) {
|
|
|
4288
4347
|
return /*#__PURE__*/React.createElement("div", {
|
|
4289
4348
|
key: action.name,
|
|
4290
4349
|
className: "px-1"
|
|
4291
|
-
}, /*#__PURE__*/React.createElement("button", {
|
|
4350
|
+
}, action.render ? /*#__PURE__*/React.createElement("button", {
|
|
4351
|
+
className: "w-full text-left px-3 py-2 text-sm hover:bg-gray-100 flex items-center gap-2 rounded-md",
|
|
4352
|
+
onClick: function onClick(e) {
|
|
4353
|
+
e.stopPropagation();
|
|
4354
|
+
onAction === null || onAction === void 0 || onAction(action, row);
|
|
4355
|
+
onClose === null || onClose === void 0 || onClose();
|
|
4356
|
+
}
|
|
4357
|
+
}, action.render(row)) : /*#__PURE__*/React.createElement("button", {
|
|
4292
4358
|
className: "w-full text-left px-3 py-2 text-sm hover:bg-gray-100 flex items-center gap-2 rounded-md",
|
|
4293
4359
|
onClick: function onClick(e) {
|
|
4294
4360
|
e.stopPropagation();
|
|
4295
4361
|
onAction === null || onAction === void 0 || onAction(action, row);
|
|
4296
4362
|
onClose === null || onClose === void 0 || onClose();
|
|
4297
4363
|
}
|
|
4298
|
-
}, action.
|
|
4364
|
+
}, action.icon && /*#__PURE__*/React.createElement("span", {
|
|
4299
4365
|
className: "inline-flex"
|
|
4300
|
-
}, action.icon), /*#__PURE__*/React.createElement("span", null, action.label)))
|
|
4301
|
-
})));
|
|
4302
|
-
}
|
|
4366
|
+
}, action.icon), /*#__PURE__*/React.createElement("span", null, action.label)));
|
|
4367
|
+
}))), document.body);
|
|
4368
|
+
}
|
|
4303
4369
|
|
|
4304
4370
|
/**
|
|
4305
4371
|
* Desktop table row component
|
|
@@ -15867,6 +15933,176 @@ function LocationPicker(_ref) {
|
|
|
15867
15933
|
}, iconButton)));
|
|
15868
15934
|
}
|
|
15869
15935
|
|
|
15936
|
+
var SpeechToText = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
15937
|
+
var _ref$lang = _ref.lang,
|
|
15938
|
+
lang = _ref$lang === void 0 ? "en-US" : _ref$lang,
|
|
15939
|
+
_ref$continuous = _ref.continuous,
|
|
15940
|
+
continuous = _ref$continuous === void 0 ? true : _ref$continuous,
|
|
15941
|
+
_ref$interimResults = _ref.interimResults,
|
|
15942
|
+
interimResults = _ref$interimResults === void 0 ? true : _ref$interimResults,
|
|
15943
|
+
_ref$onSpeechComplete = _ref.onSpeechComplete,
|
|
15944
|
+
onSpeechComplete = _ref$onSpeechComplete === void 0 ? function () {} : _ref$onSpeechComplete,
|
|
15945
|
+
_ref$onSpeaking = _ref.onSpeaking,
|
|
15946
|
+
onSpeaking = _ref$onSpeaking === void 0 ? function () {} : _ref$onSpeaking,
|
|
15947
|
+
_ref$onError = _ref.onError,
|
|
15948
|
+
onError = _ref$onError === void 0 ? function () {} : _ref$onError,
|
|
15949
|
+
_ref$onStart = _ref.onStart,
|
|
15950
|
+
onStart = _ref$onStart === void 0 ? function () {} : _ref$onStart,
|
|
15951
|
+
_ref$onStop = _ref.onStop,
|
|
15952
|
+
onStop = _ref$onStop === void 0 ? function () {} : _ref$onStop,
|
|
15953
|
+
_ref$renderButton = _ref.renderButton,
|
|
15954
|
+
renderButton = _ref$renderButton === void 0 ? null : _ref$renderButton,
|
|
15955
|
+
_ref$autoStart = _ref.autoStart,
|
|
15956
|
+
autoStart = _ref$autoStart === void 0 ? false : _ref$autoStart,
|
|
15957
|
+
_ref$disabled = _ref.disabled,
|
|
15958
|
+
disabled = _ref$disabled === void 0 ? false : _ref$disabled;
|
|
15959
|
+
var recognitionRef = React.useRef(null);
|
|
15960
|
+
var finalTranscriptRef = React.useRef("");
|
|
15961
|
+
var _useState = React.useState(false),
|
|
15962
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
15963
|
+
_isListening = _useState2[0],
|
|
15964
|
+
setIsListening = _useState2[1];
|
|
15965
|
+
var _useState3 = React.useState(true),
|
|
15966
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
15967
|
+
_isSupported = _useState4[0],
|
|
15968
|
+
setIsSupported = _useState4[1];
|
|
15969
|
+
React.useEffect(function () {
|
|
15970
|
+
if (!("webkitSpeechRecognition" in window) && !("SpeechRecognition" in window)) {
|
|
15971
|
+
setIsSupported(false);
|
|
15972
|
+
} else {
|
|
15973
|
+
setIsSupported(true);
|
|
15974
|
+
}
|
|
15975
|
+
}, []);
|
|
15976
|
+
React.useEffect(function () {
|
|
15977
|
+
if (autoStart && _isSupported) {
|
|
15978
|
+
startListening();
|
|
15979
|
+
}
|
|
15980
|
+
return function () {
|
|
15981
|
+
if (recognitionRef.current) {
|
|
15982
|
+
try {
|
|
15983
|
+
recognitionRef.current.onresult = null;
|
|
15984
|
+
recognitionRef.current.onerror = null;
|
|
15985
|
+
recognitionRef.current.onend = null;
|
|
15986
|
+
recognitionRef.current.onstart = null;
|
|
15987
|
+
recognitionRef.current.stop();
|
|
15988
|
+
} catch (e) {}
|
|
15989
|
+
}
|
|
15990
|
+
};
|
|
15991
|
+
}, [autoStart, _isSupported]);
|
|
15992
|
+
function initializeRecognition() {
|
|
15993
|
+
if (recognitionRef.current) return recognitionRef.current;
|
|
15994
|
+
var SpeechRecognition = window.SpeechRecognition || window.webkitSpeechRecognition;
|
|
15995
|
+
if (!SpeechRecognition) {
|
|
15996
|
+
var err = new Error("SpeechRecognition API not available");
|
|
15997
|
+
onError(err);
|
|
15998
|
+
return null;
|
|
15999
|
+
}
|
|
16000
|
+
var recognition = new SpeechRecognition();
|
|
16001
|
+
recognition.continuous = !!continuous;
|
|
16002
|
+
recognition.interimResults = !!interimResults;
|
|
16003
|
+
recognition.lang = lang;
|
|
16004
|
+
recognition.onstart = function () {
|
|
16005
|
+
finalTranscriptRef.current = finalTranscriptRef.current || "";
|
|
16006
|
+
setIsListening(true);
|
|
16007
|
+
onStart();
|
|
16008
|
+
};
|
|
16009
|
+
recognition.onresult = function (event) {
|
|
16010
|
+
var interim = "";
|
|
16011
|
+
var finalPart = "";
|
|
16012
|
+
for (var i = event.resultIndex; i < event.results.length; i++) {
|
|
16013
|
+
var piece = event.results[i][0].transcript;
|
|
16014
|
+
if (event.results[i].isFinal) {
|
|
16015
|
+
finalPart += piece + " ";
|
|
16016
|
+
} else {
|
|
16017
|
+
interim += piece;
|
|
16018
|
+
}
|
|
16019
|
+
}
|
|
16020
|
+
if (interim) {
|
|
16021
|
+
onSpeaking(interim);
|
|
16022
|
+
}
|
|
16023
|
+
if (finalPart) {
|
|
16024
|
+
finalTranscriptRef.current = (finalTranscriptRef.current || "") + finalPart;
|
|
16025
|
+
onSpeechComplete(finalTranscriptRef.current.trim());
|
|
16026
|
+
}
|
|
16027
|
+
};
|
|
16028
|
+
recognition.onerror = function (event) {
|
|
16029
|
+
var err = event && event.error ? new Error(event.error) : new Error("Speech recognition error");
|
|
16030
|
+
onError(err);
|
|
16031
|
+
setIsListening(false);
|
|
16032
|
+
};
|
|
16033
|
+
recognition.onend = function () {
|
|
16034
|
+
setIsListening(false);
|
|
16035
|
+
onStop();
|
|
16036
|
+
onSpeechComplete((finalTranscriptRef.current || "").trim());
|
|
16037
|
+
};
|
|
16038
|
+
recognitionRef.current = recognition;
|
|
16039
|
+
return recognition;
|
|
16040
|
+
}
|
|
16041
|
+
function startListening() {
|
|
16042
|
+
if (!_isSupported) {
|
|
16043
|
+
onError(new Error("Speech recognition not supported in this browser"));
|
|
16044
|
+
return;
|
|
16045
|
+
}
|
|
16046
|
+
try {
|
|
16047
|
+
var rec = initializeRecognition();
|
|
16048
|
+
if (!rec) return;
|
|
16049
|
+
rec.start();
|
|
16050
|
+
} catch (err) {
|
|
16051
|
+
onError(err);
|
|
16052
|
+
}
|
|
16053
|
+
}
|
|
16054
|
+
function stopListening() {
|
|
16055
|
+
if (recognitionRef.current) {
|
|
16056
|
+
try {
|
|
16057
|
+
recognitionRef.current.stop();
|
|
16058
|
+
} catch (e) {}
|
|
16059
|
+
}
|
|
16060
|
+
}
|
|
16061
|
+
function toggleListening() {
|
|
16062
|
+
if (disabled) return;
|
|
16063
|
+
if (_isListening) {
|
|
16064
|
+
stopListening();
|
|
16065
|
+
} else {
|
|
16066
|
+
startListening();
|
|
16067
|
+
}
|
|
16068
|
+
}
|
|
16069
|
+
React.useImperativeHandle(ref, function () {
|
|
16070
|
+
return {
|
|
16071
|
+
start: startListening,
|
|
16072
|
+
stop: stopListening,
|
|
16073
|
+
toggle: toggleListening,
|
|
16074
|
+
isListening: function isListening() {
|
|
16075
|
+
return _isListening;
|
|
16076
|
+
},
|
|
16077
|
+
isSupported: function isSupported() {
|
|
16078
|
+
return _isSupported;
|
|
16079
|
+
},
|
|
16080
|
+
getTranscript: function getTranscript() {
|
|
16081
|
+
return (finalTranscriptRef.current || "").trim();
|
|
16082
|
+
},
|
|
16083
|
+
clearTranscript: function clearTranscript() {
|
|
16084
|
+
finalTranscriptRef.current = "";
|
|
16085
|
+
}
|
|
16086
|
+
};
|
|
16087
|
+
}, [_isListening, _isSupported]);
|
|
16088
|
+
if (renderButton && typeof renderButton === "function") {
|
|
16089
|
+
return renderButton({
|
|
16090
|
+
isListening: _isListening,
|
|
16091
|
+
isSupported: _isSupported,
|
|
16092
|
+
start: startListening,
|
|
16093
|
+
stop: stopListening,
|
|
16094
|
+
toggle: toggleListening,
|
|
16095
|
+
disabled: disabled
|
|
16096
|
+
});
|
|
16097
|
+
}
|
|
16098
|
+
return /*#__PURE__*/React.createElement("button", {
|
|
16099
|
+
type: "button",
|
|
16100
|
+
"aria-pressed": _isListening,
|
|
16101
|
+
onClick: toggleListening,
|
|
16102
|
+
disabled: disabled || !_isSupported
|
|
16103
|
+
}, _isListening ? "Stop" : "Start");
|
|
16104
|
+
});
|
|
16105
|
+
|
|
15870
16106
|
var _excluded$d = ["items", "collapsed", "onToggle", "className", "logo", "user", "onUserClick", "drawerPosition", "isMobileOpen", "setIsMobileOpen", "showCollapsedTooltips", "tooltipOptions"];
|
|
15871
16107
|
|
|
15872
16108
|
/**
|
|
@@ -16499,7 +16735,7 @@ var Navbar = function Navbar(_ref3) {
|
|
|
16499
16735
|
"text-gray-700 hover:bg-gray-50": !item.active
|
|
16500
16736
|
})
|
|
16501
16737
|
}, item.label);
|
|
16502
|
-
}))));
|
|
16738
|
+
}))), /*#__PURE__*/React.createElement("h1", null, "asddddddddddddd"));
|
|
16503
16739
|
};
|
|
16504
16740
|
Navbar.displayName = "Navbar";
|
|
16505
16741
|
Navbar.propTypes = {
|
|
@@ -26571,6 +26807,7 @@ exports.RoundedTag = RoundedTag;
|
|
|
26571
26807
|
exports.Select = Select;
|
|
26572
26808
|
exports.Sidebar = Sidebar;
|
|
26573
26809
|
exports.Skeleton = Skeleton;
|
|
26810
|
+
exports.SpeechToText = SpeechToText;
|
|
26574
26811
|
exports.Stepper = Stepper;
|
|
26575
26812
|
exports.StoreProvider = StoreProvider;
|
|
26576
26813
|
exports.Switch = Switch;
|