@ai-matrx/design-system 0.86.328 → 0.86.330
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/CHANGELOG.md +3 -8281
- package/dist/item.cjs +3 -27
- package/dist/item.cjs.map +1 -1
- package/dist/item.d.cts +1 -9
- package/dist/item.d.ts +1 -9
- package/dist/item.js +3 -27
- package/dist/item.js.map +1 -1
- package/dist/menu-look.cjs +27 -8
- package/dist/menu-look.cjs.map +1 -1
- package/dist/menu-look.css +29 -0
- package/dist/menu-look.d.cts +25 -7
- package/dist/menu-look.d.ts +25 -7
- package/dist/menu-look.js +27 -8
- package/dist/menu-look.js.map +1 -1
- package/dist/writing-field.cjs +225 -524
- package/dist/writing-field.cjs.map +1 -1
- package/dist/writing-field.d.cts +5 -49
- package/dist/writing-field.d.ts +5 -49
- package/dist/writing-field.js +97 -393
- package/dist/writing-field.js.map +1 -1
- package/package.json +2 -2
package/dist/writing-field.cjs
CHANGED
|
@@ -60,8 +60,7 @@ __export(writing_field_exports, {
|
|
|
60
60
|
proTextareaClusterPlacement: () => proTextareaClusterPlacement,
|
|
61
61
|
reservedRightPaddingPx: () => reservedRightPaddingPx,
|
|
62
62
|
splitAddOnProps: () => splitAddOnProps,
|
|
63
|
-
useWritingFieldAddOns: () => useWritingFieldAddOns
|
|
64
|
-
useWritingFieldDoor: () => useWritingFieldDoor
|
|
63
|
+
useWritingFieldAddOns: () => useWritingFieldAddOns
|
|
65
64
|
});
|
|
66
65
|
module.exports = __toCommonJS(writing_field_exports);
|
|
67
66
|
|
|
@@ -224,12 +223,6 @@ function MicIcon(props) {
|
|
|
224
223
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M12 19v3" })
|
|
225
224
|
] });
|
|
226
225
|
}
|
|
227
|
-
function RotateCcwIcon(props) {
|
|
228
|
-
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("svg", { ...lucideProps("rotate-ccw", props), children: [
|
|
229
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8" }),
|
|
230
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M3 3v5h5" })
|
|
231
|
-
] });
|
|
232
|
-
}
|
|
233
226
|
function SlidersHorizontalIcon(props) {
|
|
234
227
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("svg", { ...lucideProps("sliders-horizontal", props), children: [
|
|
235
228
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M10 5H3" }),
|
|
@@ -2502,13 +2495,120 @@ function clusterPlacementProblems(p) {
|
|
|
2502
2495
|
}
|
|
2503
2496
|
|
|
2504
2497
|
// src/writing-field/add-ons.tsx
|
|
2498
|
+
var React10 = __toESM(require("react"), 1);
|
|
2499
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
2500
|
+
var ADD_ON_PROP_NAMES = [
|
|
2501
|
+
"surfaceName",
|
|
2502
|
+
"getApplicationScope",
|
|
2503
|
+
"sourceFeature",
|
|
2504
|
+
"surfaceContextItems",
|
|
2505
|
+
"enableBoundAgents",
|
|
2506
|
+
"enableContextMenu",
|
|
2507
|
+
"enableCleanup",
|
|
2508
|
+
"cleanupAgentId",
|
|
2509
|
+
"cleanupContextItems",
|
|
2510
|
+
"enableHelpWithThis",
|
|
2511
|
+
"helpMandateKey",
|
|
2512
|
+
"helpContextItems",
|
|
2513
|
+
"enableCustomAgent",
|
|
2514
|
+
"customAgentMandateKey",
|
|
2515
|
+
"customAgentContextItems",
|
|
2516
|
+
"uploadImage"
|
|
2517
|
+
];
|
|
2518
|
+
function splitAddOnProps(props, extra = []) {
|
|
2519
|
+
const dom = {};
|
|
2520
|
+
const addOnProps = {};
|
|
2521
|
+
for (const [key, value] of Object.entries(props)) {
|
|
2522
|
+
if (ADD_ON_PROP_NAMES.includes(key) || extra.includes(key)) addOnProps[key] = value;
|
|
2523
|
+
else dom[key] = value;
|
|
2524
|
+
}
|
|
2525
|
+
return { dom, addOnProps };
|
|
2526
|
+
}
|
|
2527
|
+
var KEY = /* @__PURE__ */ Symbol.for("@ai-matrx/design-system/writing-field-add-ons");
|
|
2528
|
+
var registry3 = globalThis;
|
|
2529
|
+
var AddOnsContext = registry3[KEY] ?? (registry3[KEY] = React10.createContext(null));
|
|
2530
|
+
function WritingFieldAddOnsProvider({
|
|
2531
|
+
addOns,
|
|
2532
|
+
children
|
|
2533
|
+
}) {
|
|
2534
|
+
const first = React10.useRef(addOns);
|
|
2535
|
+
if (first.current !== addOns) {
|
|
2536
|
+
announceStandIn(
|
|
2537
|
+
"writing-field-add-ons-swap",
|
|
2538
|
+
"WritingFieldAddOnsProvider received a different addOns object; the first one is kept (hook ports must be module-constant)."
|
|
2539
|
+
);
|
|
2540
|
+
}
|
|
2541
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(AddOnsContext.Provider, { value: first.current, children });
|
|
2542
|
+
}
|
|
2543
|
+
var EMPTY = {};
|
|
2544
|
+
function useWritingFieldAddOns() {
|
|
2545
|
+
return React10.useContext(AddOnsContext) ?? EMPTY;
|
|
2546
|
+
}
|
|
2547
|
+
function announceMissingPort(port) {
|
|
2548
|
+
announceStandIn(
|
|
2549
|
+
`writing-field:${port}`,
|
|
2550
|
+
`A writing field drew without its "${port}" add-on: the host did not register it in <WritingFieldAddOnsProvider addOns={{ ${port} }}>.`
|
|
2551
|
+
);
|
|
2552
|
+
}
|
|
2553
|
+
var INERT = () => void 0;
|
|
2554
|
+
function useStandInVoice(options) {
|
|
2555
|
+
React10.useEffect(() => {
|
|
2556
|
+
if (options.enabled) announceMissingPort("useVoice");
|
|
2557
|
+
}, [options.enabled]);
|
|
2558
|
+
return {
|
|
2559
|
+
microphone: false,
|
|
2560
|
+
available: false,
|
|
2561
|
+
isRecording: false,
|
|
2562
|
+
isTranscribing: false,
|
|
2563
|
+
audioLevel: 0,
|
|
2564
|
+
liveTranscript: "",
|
|
2565
|
+
handleVoiceClick: INERT,
|
|
2566
|
+
startDictation: async () => void 0,
|
|
2567
|
+
stopDictation: INERT,
|
|
2568
|
+
requestClose: () => options.onRequestClose?.(),
|
|
2569
|
+
showProtectionDialog: false,
|
|
2570
|
+
setShowProtectionDialog: INERT,
|
|
2571
|
+
confirmClose: () => options.onRequestClose?.(),
|
|
2572
|
+
cancelClose: INERT
|
|
2573
|
+
};
|
|
2574
|
+
}
|
|
2575
|
+
var STAND_IN_NOTIFY = {
|
|
2576
|
+
error: (message) => {
|
|
2577
|
+
announceMissingPort("notify");
|
|
2578
|
+
console.error(`[writing-field] ${message}`);
|
|
2579
|
+
},
|
|
2580
|
+
info: (message) => {
|
|
2581
|
+
announceMissingPort("notify");
|
|
2582
|
+
console.info(`[writing-field] ${message}`);
|
|
2583
|
+
},
|
|
2584
|
+
success: (message) => {
|
|
2585
|
+
announceMissingPort("notify");
|
|
2586
|
+
console.info(`[writing-field] ${message}`);
|
|
2587
|
+
}
|
|
2588
|
+
};
|
|
2589
|
+
function useNoFormatting() {
|
|
2590
|
+
}
|
|
2591
|
+
function useNoAudioSettings() {
|
|
2592
|
+
return () => announceMissingPort("useOpenAudioSettings");
|
|
2593
|
+
}
|
|
2594
|
+
function resolveHookPorts(addOns) {
|
|
2595
|
+
return {
|
|
2596
|
+
useVoice: addOns.useVoice ?? useStandInVoice,
|
|
2597
|
+
useFormatting: addOns.useFormatting ?? useNoFormatting,
|
|
2598
|
+
useOpenAudioSettings: addOns.useOpenAudioSettings ?? useNoAudioSettings,
|
|
2599
|
+
notify: addOns.notify ?? STAND_IN_NOTIFY
|
|
2600
|
+
};
|
|
2601
|
+
}
|
|
2602
|
+
|
|
2603
|
+
// src/controls/surfaces.tsx
|
|
2604
|
+
var import_react_slot4 = require("@radix-ui/react-slot");
|
|
2505
2605
|
var React15 = __toESM(require("react"), 1);
|
|
2506
2606
|
|
|
2507
2607
|
// src/button.tsx
|
|
2508
2608
|
var import_react_slot2 = require("@radix-ui/react-slot");
|
|
2509
2609
|
var import_class_variance_authority = require("class-variance-authority");
|
|
2510
|
-
var
|
|
2511
|
-
var
|
|
2610
|
+
var React11 = __toESM(require("react"), 1);
|
|
2611
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
2512
2612
|
var buttonVariants = (0, import_class_variance_authority.cva)(
|
|
2513
2613
|
"matrx-glyph-trim inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all duration-200 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-0 disabled:opacity-50 active:scale-[0.98] [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",
|
|
2514
2614
|
{
|
|
@@ -2575,14 +2675,14 @@ function swallowClick(event) {
|
|
|
2575
2675
|
event.preventDefault();
|
|
2576
2676
|
event.stopPropagation();
|
|
2577
2677
|
}
|
|
2578
|
-
var Button =
|
|
2678
|
+
var Button = React11.forwardRef(
|
|
2579
2679
|
({ className, variant, size, asChild = false, onClick, ...props }, ref) => {
|
|
2580
2680
|
const Component = asChild ? import_react_slot2.Slot : "button";
|
|
2581
2681
|
const resolvedSize = size ?? "default";
|
|
2582
2682
|
const disabledChild = asChild && Boolean(props.disabled);
|
|
2583
2683
|
const ariaDisabled = props["aria-disabled"];
|
|
2584
2684
|
const inert = disabledChild || ariaDisabled === true || ariaDisabled === "true";
|
|
2585
|
-
return /* @__PURE__ */ (0,
|
|
2685
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
2586
2686
|
Component,
|
|
2587
2687
|
{
|
|
2588
2688
|
className: cn(buttonVariants({ variant, size, className })),
|
|
@@ -2600,25 +2700,21 @@ var Button = React10.forwardRef(
|
|
|
2600
2700
|
);
|
|
2601
2701
|
Button.displayName = "Button";
|
|
2602
2702
|
|
|
2603
|
-
// src/controls/surfaces.tsx
|
|
2604
|
-
var import_react_slot4 = require("@radix-ui/react-slot");
|
|
2605
|
-
var React14 = __toESM(require("react"), 1);
|
|
2606
|
-
|
|
2607
2703
|
// src/alert-dialog.tsx
|
|
2608
2704
|
var AlertDialogPrimitive = __toESM(require("@radix-ui/react-alert-dialog"), 1);
|
|
2609
2705
|
var import_react_tree2 = require("@ai-matrx/kit/react-tree");
|
|
2610
|
-
var
|
|
2611
|
-
var
|
|
2706
|
+
var React12 = __toESM(require("react"), 1);
|
|
2707
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
2612
2708
|
var AlertDialog = AlertDialogPrimitive.Root;
|
|
2613
2709
|
var AlertDialogPortal = ({
|
|
2614
2710
|
container,
|
|
2615
2711
|
...props
|
|
2616
2712
|
}) => {
|
|
2617
2713
|
const resolved = usePortalContainer(container);
|
|
2618
|
-
return /* @__PURE__ */ (0,
|
|
2714
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(AlertDialogPrimitive.Portal, { container: resolved ?? null, ...props });
|
|
2619
2715
|
};
|
|
2620
2716
|
AlertDialogPortal.displayName = "AlertDialogPortal";
|
|
2621
|
-
var AlertDialogOverlay =
|
|
2717
|
+
var AlertDialogOverlay = React12.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2622
2718
|
AlertDialogPrimitive.Overlay,
|
|
2623
2719
|
{
|
|
2624
2720
|
ref,
|
|
@@ -2632,12 +2728,12 @@ var AlertDialogOverlay = React11.forwardRef(({ className, ...props }, ref) => /*
|
|
|
2632
2728
|
}
|
|
2633
2729
|
));
|
|
2634
2730
|
AlertDialogOverlay.displayName = AlertDialogPrimitive.Overlay.displayName;
|
|
2635
|
-
var AlertDialogContentPrimitive =
|
|
2731
|
+
var AlertDialogContentPrimitive = React12.forwardRef(({ onCloseAutoFocus, ...props }, ref) => {
|
|
2636
2732
|
useModalLayer(true);
|
|
2637
|
-
return /* @__PURE__ */ (0,
|
|
2733
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(AlertDialogPrimitive.Content, { ...props, ref, "aria-modal": "true", onCloseAutoFocus: keepMovedFocus(onCloseAutoFocus) });
|
|
2638
2734
|
});
|
|
2639
2735
|
AlertDialogContentPrimitive.displayName = "AlertDialogContentPrimitive";
|
|
2640
|
-
var AlertDialogDescription =
|
|
2736
|
+
var AlertDialogDescription = React12.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2641
2737
|
AlertDialogPrimitive.Description,
|
|
2642
2738
|
{
|
|
2643
2739
|
ref,
|
|
@@ -2647,11 +2743,11 @@ var AlertDialogDescription = React11.forwardRef(({ className, ...props }, ref) =
|
|
|
2647
2743
|
}
|
|
2648
2744
|
));
|
|
2649
2745
|
AlertDialogDescription.displayName = AlertDialogPrimitive.Description.displayName;
|
|
2650
|
-
var AlertDialogContent =
|
|
2746
|
+
var AlertDialogContent = React12.forwardRef(({ className, children, container, animated = true, ...props }, ref) => {
|
|
2651
2747
|
const hasDescription = (0, import_react_tree2.treeContainsComponent)(children, AlertDialogDescription) || (0, import_react_tree2.treeContainsComponent)(children, AlertDialogPrimitive.Description);
|
|
2652
|
-
return /* @__PURE__ */ (0,
|
|
2653
|
-
/* @__PURE__ */ (0,
|
|
2654
|
-
/* @__PURE__ */ (0,
|
|
2748
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(AlertDialogPortal, { container, children: [
|
|
2749
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(AlertDialogOverlay, {}),
|
|
2750
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
2655
2751
|
AlertDialogContentPrimitive,
|
|
2656
2752
|
{
|
|
2657
2753
|
ref,
|
|
@@ -2671,7 +2767,7 @@ var AlertDialogContent = React11.forwardRef(({ className, children, container, a
|
|
|
2671
2767
|
),
|
|
2672
2768
|
...props,
|
|
2673
2769
|
children: [
|
|
2674
|
-
hasDescription ? null : /* @__PURE__ */ (0,
|
|
2770
|
+
hasDescription ? null : /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(AlertDialogPrimitive.Description, { className: "sr-only", children: "Please confirm the action described in this dialog." }),
|
|
2675
2771
|
children
|
|
2676
2772
|
]
|
|
2677
2773
|
}
|
|
@@ -2682,7 +2778,7 @@ AlertDialogContent.displayName = AlertDialogPrimitive.Content.displayName;
|
|
|
2682
2778
|
var AlertDialogHeader = ({
|
|
2683
2779
|
className,
|
|
2684
2780
|
...props
|
|
2685
|
-
}) => /* @__PURE__ */ (0,
|
|
2781
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2686
2782
|
"div",
|
|
2687
2783
|
{
|
|
2688
2784
|
"data-slot": "alert-dialog-header",
|
|
@@ -2694,7 +2790,7 @@ AlertDialogHeader.displayName = "AlertDialogHeader";
|
|
|
2694
2790
|
var AlertDialogFooter = ({
|
|
2695
2791
|
className,
|
|
2696
2792
|
...props
|
|
2697
|
-
}) => /* @__PURE__ */ (0,
|
|
2793
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2698
2794
|
"div",
|
|
2699
2795
|
{
|
|
2700
2796
|
"data-slot": "alert-dialog-footer",
|
|
@@ -2726,7 +2822,7 @@ var AlertDialogFooter = ({
|
|
|
2726
2822
|
}
|
|
2727
2823
|
);
|
|
2728
2824
|
AlertDialogFooter.displayName = "AlertDialogFooter";
|
|
2729
|
-
var AlertDialogTitle =
|
|
2825
|
+
var AlertDialogTitle = React12.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2730
2826
|
AlertDialogPrimitive.Title,
|
|
2731
2827
|
{
|
|
2732
2828
|
ref,
|
|
@@ -2736,7 +2832,7 @@ var AlertDialogTitle = React11.forwardRef(({ className, ...props }, ref) => /* @
|
|
|
2736
2832
|
}
|
|
2737
2833
|
));
|
|
2738
2834
|
AlertDialogTitle.displayName = AlertDialogPrimitive.Title.displayName;
|
|
2739
|
-
var AlertDialogAction =
|
|
2835
|
+
var AlertDialogAction = React12.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2740
2836
|
AlertDialogPrimitive.Action,
|
|
2741
2837
|
{
|
|
2742
2838
|
ref,
|
|
@@ -2746,7 +2842,7 @@ var AlertDialogAction = React11.forwardRef(({ className, ...props }, ref) => /*
|
|
|
2746
2842
|
}
|
|
2747
2843
|
));
|
|
2748
2844
|
AlertDialogAction.displayName = AlertDialogPrimitive.Action.displayName;
|
|
2749
|
-
var AlertDialogCancel =
|
|
2845
|
+
var AlertDialogCancel = React12.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2750
2846
|
AlertDialogPrimitive.Cancel,
|
|
2751
2847
|
{
|
|
2752
2848
|
ref,
|
|
@@ -2764,14 +2860,14 @@ AlertDialogCancel.displayName = AlertDialogPrimitive.Cancel.displayName;
|
|
|
2764
2860
|
// src/controls/controls.tsx
|
|
2765
2861
|
var SwitchPrimitives = __toESM(require("@radix-ui/react-switch"), 1);
|
|
2766
2862
|
var import_react_slot3 = require("@radix-ui/react-slot");
|
|
2767
|
-
var
|
|
2863
|
+
var React14 = __toESM(require("react"), 1);
|
|
2768
2864
|
|
|
2769
2865
|
// src/field-surface.ts
|
|
2770
2866
|
var FIELD_SURFACE_CLASS = "border border-border bg-card";
|
|
2771
2867
|
|
|
2772
2868
|
// src/textarea.tsx
|
|
2773
|
-
var
|
|
2774
|
-
var
|
|
2869
|
+
var React13 = __toESM(require("react"), 1);
|
|
2870
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
2775
2871
|
var FILL_HEIGHT_REGEX = /(?:^|\s)(h-full|h-dvh|flex-1|grow)(?:\s|$)/;
|
|
2776
2872
|
var FILL_WIDTH_REGEX = /(?:^|\s)(w-full|w-screen)(?:\s|$)/;
|
|
2777
2873
|
function getStretchClasses(className) {
|
|
@@ -2784,7 +2880,7 @@ function getStretchClasses(className) {
|
|
|
2784
2880
|
var TEXTAREA_ELEVATED_CLASS = `flex h-auto w-full rounded-md ${FIELD_SURFACE_CLASS} px-3 py-2 text-sm text-foreground shadow-textarea transition duration-400 placeholder:text-muted-foreground focus-visible:outline-none focus-visible:border-primary focus-visible:ring-[3px] focus-visible:ring-primary/15 disabled:cursor-not-allowed disabled:opacity-50`;
|
|
2785
2881
|
var TEXTAREA_CONTROL_CLASS = `flex w-full rounded-md ${FIELD_SURFACE_CLASS} px-3 py-2 text-sm text-foreground shadow-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:border-primary focus-visible:ring-[3px] focus-visible:ring-primary/15 disabled:cursor-not-allowed disabled:opacity-50`;
|
|
2786
2882
|
function useAutoGrow(ref, value, autoGrow = false, minHeight, maxHeight) {
|
|
2787
|
-
|
|
2883
|
+
React13.useEffect(() => {
|
|
2788
2884
|
if (!autoGrow || !ref.current) return;
|
|
2789
2885
|
const textarea = ref.current;
|
|
2790
2886
|
textarea.style.height = "auto";
|
|
@@ -2800,8 +2896,8 @@ function useAutoGrow(ref, value, autoGrow = false, minHeight, maxHeight) {
|
|
|
2800
2896
|
}, [value, autoGrow, minHeight, maxHeight, ref]);
|
|
2801
2897
|
}
|
|
2802
2898
|
function useMergedTextareaRef(forwarded) {
|
|
2803
|
-
const internal =
|
|
2804
|
-
const callback =
|
|
2899
|
+
const internal = React13.useRef(null);
|
|
2900
|
+
const callback = React13.useCallback(
|
|
2805
2901
|
(node) => {
|
|
2806
2902
|
internal.current = node;
|
|
2807
2903
|
if (typeof forwarded === "function") forwarded(node);
|
|
@@ -2818,13 +2914,13 @@ function boxStyle(minHeight, maxHeight) {
|
|
|
2818
2914
|
maxHeight: maxHeight ? `${maxHeight}px` : void 0
|
|
2819
2915
|
};
|
|
2820
2916
|
}
|
|
2821
|
-
var Textarea =
|
|
2917
|
+
var Textarea = React13.forwardRef(
|
|
2822
2918
|
({ className, autoGrow, minHeight, maxHeight, wrapperClassName, ...props }, forwarded) => {
|
|
2823
2919
|
const { ref, callback } = useMergedTextareaRef(forwarded);
|
|
2824
2920
|
const stretchClasses = getStretchClasses(className);
|
|
2825
2921
|
const needsWrapper = Boolean(wrapperClassName || stretchClasses);
|
|
2826
2922
|
useAutoGrow(ref, props.value, autoGrow, minHeight, maxHeight);
|
|
2827
|
-
const textarea = /* @__PURE__ */ (0,
|
|
2923
|
+
const textarea = /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
2828
2924
|
"textarea",
|
|
2829
2925
|
{
|
|
2830
2926
|
ref: callback,
|
|
@@ -2840,15 +2936,15 @@ var Textarea = React12.forwardRef(
|
|
|
2840
2936
|
}
|
|
2841
2937
|
);
|
|
2842
2938
|
if (!needsWrapper) return textarea;
|
|
2843
|
-
return /* @__PURE__ */ (0,
|
|
2939
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: cn(stretchClasses, wrapperClassName), children: textarea });
|
|
2844
2940
|
}
|
|
2845
2941
|
);
|
|
2846
2942
|
Textarea.displayName = "Textarea";
|
|
2847
|
-
var BasicTextarea =
|
|
2943
|
+
var BasicTextarea = React13.forwardRef(
|
|
2848
2944
|
({ className, autoGrow, minHeight, maxHeight, ...props }, forwarded) => {
|
|
2849
2945
|
const { ref, callback } = useMergedTextareaRef(forwarded);
|
|
2850
2946
|
useAutoGrow(ref, props.value, autoGrow, minHeight, maxHeight);
|
|
2851
|
-
return /* @__PURE__ */ (0,
|
|
2947
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
2852
2948
|
"textarea",
|
|
2853
2949
|
{
|
|
2854
2950
|
ref: callback,
|
|
@@ -2866,7 +2962,7 @@ var BasicTextarea = React12.forwardRef(
|
|
|
2866
2962
|
}
|
|
2867
2963
|
);
|
|
2868
2964
|
BasicTextarea.displayName = "BasicTextarea";
|
|
2869
|
-
var TextareaWithPrefix =
|
|
2965
|
+
var TextareaWithPrefix = React13.forwardRef(
|
|
2870
2966
|
({
|
|
2871
2967
|
prefix,
|
|
2872
2968
|
className,
|
|
@@ -2878,13 +2974,13 @@ var TextareaWithPrefix = React12.forwardRef(
|
|
|
2878
2974
|
}, forwarded) => {
|
|
2879
2975
|
const { ref, callback } = useMergedTextareaRef(forwarded);
|
|
2880
2976
|
useAutoGrow(ref, props.value, autoGrow, minHeight, maxHeight);
|
|
2881
|
-
return /* @__PURE__ */ (0,
|
|
2977
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
|
|
2882
2978
|
"div",
|
|
2883
2979
|
{
|
|
2884
2980
|
className: cn("relative", getStretchClasses(className), wrapperClassName),
|
|
2885
2981
|
children: [
|
|
2886
|
-
prefix ? /* @__PURE__ */ (0,
|
|
2887
|
-
/* @__PURE__ */ (0,
|
|
2982
|
+
prefix ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "pointer-events-none absolute left-3 top-3 z-10 text-muted-foreground", children: prefix }) : null,
|
|
2983
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
2888
2984
|
"textarea",
|
|
2889
2985
|
{
|
|
2890
2986
|
ref: callback,
|
|
@@ -2908,9 +3004,9 @@ var TextareaWithPrefix = React12.forwardRef(
|
|
|
2908
3004
|
TextareaWithPrefix.displayName = "TextareaWithPrefix";
|
|
2909
3005
|
|
|
2910
3006
|
// src/controls/controls.tsx
|
|
2911
|
-
var
|
|
2912
|
-
var ControlRow =
|
|
2913
|
-
({ className, nowrap, ...props }, ref) => /* @__PURE__ */ (0,
|
|
3007
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
3008
|
+
var ControlRow = React14.forwardRef(
|
|
3009
|
+
({ className, nowrap, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
2914
3010
|
"div",
|
|
2915
3011
|
{
|
|
2916
3012
|
ref,
|
|
@@ -2922,8 +3018,8 @@ var ControlRow = React13.forwardRef(
|
|
|
2922
3018
|
)
|
|
2923
3019
|
);
|
|
2924
3020
|
ControlRow.displayName = "ControlRow";
|
|
2925
|
-
var ControlScope =
|
|
2926
|
-
(props, ref) => /* @__PURE__ */ (0,
|
|
3021
|
+
var ControlScope = React14.forwardRef(
|
|
3022
|
+
(props, ref) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { ref, "data-matrx-controls": "", ...props })
|
|
2927
3023
|
);
|
|
2928
3024
|
ControlScope.displayName = "ControlScope";
|
|
2929
3025
|
function glyphSlot(icon, iconEnd, label) {
|
|
@@ -2933,16 +3029,16 @@ function glyphSlot(icon, iconEnd, label) {
|
|
|
2933
3029
|
if (iconEnd) return "end";
|
|
2934
3030
|
return void 0;
|
|
2935
3031
|
}
|
|
2936
|
-
var Button2 =
|
|
3032
|
+
var Button2 = React14.forwardRef(
|
|
2937
3033
|
({ className, variant = "outline", tone, icon, iconEnd, asChild = false, collapse, pressed, badge, glyphTone, removes, meta, width, hero, children, onClick, type, ...props }, ref) => {
|
|
2938
3034
|
const Component = asChild ? import_react_slot3.Slot : "button";
|
|
2939
3035
|
const badgeText = typeof badge === "number" ? badge > 0 ? badge > 99 ? "99+" : String(badge) : null : badge ? "" : null;
|
|
2940
3036
|
const ariaDisabled = props["aria-disabled"];
|
|
2941
3037
|
const disabledChild = asChild && Boolean(props.disabled);
|
|
2942
3038
|
const inert = disabledChild || ariaDisabled === true || ariaDisabled === "true";
|
|
2943
|
-
const label = asChild &&
|
|
3039
|
+
const label = asChild && React14.isValidElement(children) ? children.props.children : children;
|
|
2944
3040
|
const collapses = collapse === "container" && Boolean(icon) && Boolean(label);
|
|
2945
|
-
return /* @__PURE__ */ (0,
|
|
3041
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
2946
3042
|
Component,
|
|
2947
3043
|
{
|
|
2948
3044
|
ref,
|
|
@@ -2968,22 +3064,22 @@ var Button2 = React13.forwardRef(
|
|
|
2968
3064
|
onClick: inert ? swallowClick : onClick,
|
|
2969
3065
|
children: [
|
|
2970
3066
|
icon,
|
|
2971
|
-
/* @__PURE__ */ (0,
|
|
2972
|
-
meta === void 0 || meta === null || meta === false ? null : /* @__PURE__ */ (0,
|
|
3067
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_react_slot3.Slottable, { children: !asChild && (typeof children === "string" || typeof children === "number") ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "matrx-control-button-label", children }) : children }),
|
|
3068
|
+
meta === void 0 || meta === null || meta === false ? null : /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "matrx-control-button-meta", children: meta }),
|
|
2973
3069
|
iconEnd,
|
|
2974
|
-
badgeText === null ? null : /* @__PURE__ */ (0,
|
|
3070
|
+
badgeText === null ? null : /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "matrx-control-button-badge", "aria-hidden": "true", children: badgeText })
|
|
2975
3071
|
]
|
|
2976
3072
|
}
|
|
2977
3073
|
);
|
|
2978
3074
|
}
|
|
2979
3075
|
);
|
|
2980
3076
|
Button2.displayName = "Button";
|
|
2981
|
-
var SplitButton =
|
|
2982
|
-
({ className, ...props }, ref) => /* @__PURE__ */ (0,
|
|
3077
|
+
var SplitButton = React14.forwardRef(
|
|
3078
|
+
({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { ref, role: "group", "data-matrx-control": "split", className: cn("matrx-control-split", className), ...props })
|
|
2983
3079
|
);
|
|
2984
3080
|
SplitButton.displayName = "SplitButton";
|
|
2985
|
-
var Field =
|
|
2986
|
-
({ className, style, icon, end, width, hero, filled, ...props }, ref) => /* @__PURE__ */ (0,
|
|
3081
|
+
var Field = React14.forwardRef(
|
|
3082
|
+
({ className, style, icon, end, width, hero, filled, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
2987
3083
|
"label",
|
|
2988
3084
|
{
|
|
2989
3085
|
"data-matrx-control": "field",
|
|
@@ -2995,20 +3091,20 @@ var Field = React13.forwardRef(
|
|
|
2995
3091
|
style,
|
|
2996
3092
|
children: [
|
|
2997
3093
|
icon,
|
|
2998
|
-
/* @__PURE__ */ (0,
|
|
3094
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("input", { ref, ...props }),
|
|
2999
3095
|
end
|
|
3000
3096
|
]
|
|
3001
3097
|
}
|
|
3002
3098
|
)
|
|
3003
3099
|
);
|
|
3004
3100
|
Field.displayName = "Field";
|
|
3005
|
-
var SearchField =
|
|
3006
|
-
({ placeholder = "Search", ...props }, ref) => /* @__PURE__ */ (0,
|
|
3101
|
+
var SearchField = React14.forwardRef(
|
|
3102
|
+
({ placeholder = "Search", ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
3007
3103
|
Field,
|
|
3008
3104
|
{
|
|
3009
3105
|
ref,
|
|
3010
3106
|
type: "search",
|
|
3011
|
-
icon: /* @__PURE__ */ (0,
|
|
3107
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(MagnifyingGlassIcon, { "aria-hidden": "true" }),
|
|
3012
3108
|
placeholder,
|
|
3013
3109
|
"aria-label": props["aria-label"] ?? placeholder,
|
|
3014
3110
|
...props
|
|
@@ -3016,13 +3112,13 @@ var SearchField = React13.forwardRef(
|
|
|
3016
3112
|
)
|
|
3017
3113
|
);
|
|
3018
3114
|
SearchField.displayName = "SearchField";
|
|
3019
|
-
var Chip =
|
|
3115
|
+
var Chip = React14.forwardRef(
|
|
3020
3116
|
({ label, variant = "item", tone, icon, asChild = false, pressed, children, className, title, ...props }, ref) => {
|
|
3021
3117
|
const Component = asChild ? import_react_slot3.Slot : "span";
|
|
3022
|
-
const glyph = variant === "add" ? /* @__PURE__ */ (0,
|
|
3118
|
+
const glyph = variant === "add" ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(PlusIcon, { className: "lucide lucide-plus" }) : icon;
|
|
3023
3119
|
const toggle = pressed !== void 0 && variant === "item";
|
|
3024
3120
|
const resolvedTone = tone ?? (toggle ? "primary" : "neutral");
|
|
3025
|
-
return /* @__PURE__ */ (0,
|
|
3121
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
3026
3122
|
Component,
|
|
3027
3123
|
{
|
|
3028
3124
|
ref,
|
|
@@ -3038,16 +3134,16 @@ var Chip = React13.forwardRef(
|
|
|
3038
3134
|
children: [
|
|
3039
3135
|
glyph,
|
|
3040
3136
|
variant === "add" ? icon : null,
|
|
3041
|
-
asChild ? /* @__PURE__ */ (0,
|
|
3042
|
-
/* @__PURE__ */ (0,
|
|
3137
|
+
asChild ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_react_slot3.Slottable, { children }) : null,
|
|
3138
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "matrx-control-chip-label", children: label })
|
|
3043
3139
|
]
|
|
3044
3140
|
}
|
|
3045
3141
|
);
|
|
3046
3142
|
}
|
|
3047
3143
|
);
|
|
3048
3144
|
Chip.displayName = "Chip";
|
|
3049
|
-
var ChipSet =
|
|
3050
|
-
({ layout = "flow", className, ...props }, ref) => /* @__PURE__ */ (0,
|
|
3145
|
+
var ChipSet = React14.forwardRef(
|
|
3146
|
+
({ layout = "flow", className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
3051
3147
|
"div",
|
|
3052
3148
|
{
|
|
3053
3149
|
ref,
|
|
@@ -3059,24 +3155,24 @@ var ChipSet = React13.forwardRef(
|
|
|
3059
3155
|
)
|
|
3060
3156
|
);
|
|
3061
3157
|
ChipSet.displayName = "ChipSet";
|
|
3062
|
-
var Switch =
|
|
3063
|
-
({ className, ...props }, ref) => /* @__PURE__ */ (0,
|
|
3158
|
+
var Switch = React14.forwardRef(
|
|
3159
|
+
({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
3064
3160
|
SwitchPrimitives.Root,
|
|
3065
3161
|
{
|
|
3066
3162
|
ref,
|
|
3067
3163
|
"data-matrx-control": "switch",
|
|
3068
3164
|
className: cn("matrx-control matrx-control-switch", className),
|
|
3069
3165
|
...props,
|
|
3070
|
-
children: /* @__PURE__ */ (0,
|
|
3166
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "matrx-control-switch-track", children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(SwitchPrimitives.Thumb, { className: "matrx-control-switch-thumb" }) })
|
|
3071
3167
|
}
|
|
3072
3168
|
)
|
|
3073
3169
|
);
|
|
3074
3170
|
Switch.displayName = "Switch";
|
|
3075
|
-
var Textarea2 =
|
|
3171
|
+
var Textarea2 = React14.forwardRef(
|
|
3076
3172
|
({ className, style, variant = "field", mono, hero, joinedBottom, autoGrow, minHeight, maxHeight, reservedInlineEnd, reservedBlockEnd, ...props }, forwarded) => {
|
|
3077
3173
|
const { ref, callback } = useMergedTextareaRef(forwarded);
|
|
3078
3174
|
useAutoGrow(ref, props.value, autoGrow, minHeight, maxHeight);
|
|
3079
|
-
return /* @__PURE__ */ (0,
|
|
3175
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
3080
3176
|
"textarea",
|
|
3081
3177
|
{
|
|
3082
3178
|
ref: callback,
|
|
@@ -3100,21 +3196,21 @@ var Textarea2 = React13.forwardRef(
|
|
|
3100
3196
|
Textarea2.displayName = "Textarea";
|
|
3101
3197
|
|
|
3102
3198
|
// src/controls/surfaces.tsx
|
|
3103
|
-
var
|
|
3104
|
-
var Tile =
|
|
3199
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
3200
|
+
var Tile = React15.forwardRef(
|
|
3105
3201
|
({ layout = "row", variant = "outline", icon, title, wrapTitle, line, end, selected, selectedStyle, tooltip, level, fit, endInset, oneLine, dashed, hoverStyle, danger, dimmed, glyphTone, hero, tone, dense, asChild = false, className, children, onClick, type, ...props }, ref) => {
|
|
3106
3202
|
const Component = asChild ? import_react_slot4.Slot : "button";
|
|
3107
3203
|
const ariaDisabled = props["aria-disabled"];
|
|
3108
3204
|
const inert = ariaDisabled === true || ariaDisabled === "true";
|
|
3109
|
-
const body = /* @__PURE__ */ (0,
|
|
3110
|
-
icon ? /* @__PURE__ */ (0,
|
|
3111
|
-
/* @__PURE__ */ (0,
|
|
3112
|
-
/* @__PURE__ */ (0,
|
|
3113
|
-
line ? /* @__PURE__ */ (0,
|
|
3205
|
+
const body = /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [
|
|
3206
|
+
icon ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "matrx-tile-icon", children: icon }) : null,
|
|
3207
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("span", { className: "matrx-tile-text", children: [
|
|
3208
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "matrx-tile-title", children: title }),
|
|
3209
|
+
line ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "matrx-tile-line", children: line }) : null
|
|
3114
3210
|
] }),
|
|
3115
|
-
end ? /* @__PURE__ */ (0,
|
|
3211
|
+
end ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "matrx-tile-end", children: end }) : null
|
|
3116
3212
|
] });
|
|
3117
|
-
return /* @__PURE__ */ (0,
|
|
3213
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
3118
3214
|
Component,
|
|
3119
3215
|
{
|
|
3120
3216
|
ref,
|
|
@@ -3142,14 +3238,14 @@ var Tile = React14.forwardRef(
|
|
|
3142
3238
|
className: cn("matrx-tile", className),
|
|
3143
3239
|
...props,
|
|
3144
3240
|
onClick: inert ? swallowClick : onClick,
|
|
3145
|
-
children: asChild &&
|
|
3241
|
+
children: asChild && React15.isValidElement(children) ? React15.cloneElement(children, void 0, body) : body
|
|
3146
3242
|
}
|
|
3147
3243
|
);
|
|
3148
3244
|
}
|
|
3149
3245
|
);
|
|
3150
3246
|
Tile.displayName = "Tile";
|
|
3151
|
-
var DisclosureHeader =
|
|
3152
|
-
({ open, variant = "row", icon, glyphTone, title, meta, end, line, chevron = "start", className, type, ...props }, ref) => /* @__PURE__ */ (0,
|
|
3247
|
+
var DisclosureHeader = React15.forwardRef(
|
|
3248
|
+
({ open, variant = "row", icon, glyphTone, title, meta, end, line, chevron = "start", className, type, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
3153
3249
|
"button",
|
|
3154
3250
|
{
|
|
3155
3251
|
ref,
|
|
@@ -3162,33 +3258,33 @@ var DisclosureHeader = React14.forwardRef(
|
|
|
3162
3258
|
className: cn("matrx-disclosure", className),
|
|
3163
3259
|
...props,
|
|
3164
3260
|
children: [
|
|
3165
|
-
chevron === "start" ? /* @__PURE__ */ (0,
|
|
3166
|
-
icon ? /* @__PURE__ */ (0,
|
|
3167
|
-
line ? /* @__PURE__ */ (0,
|
|
3168
|
-
/* @__PURE__ */ (0,
|
|
3169
|
-
/* @__PURE__ */ (0,
|
|
3170
|
-
] }) : /* @__PURE__ */ (0,
|
|
3171
|
-
meta === void 0 || meta === null || meta === false ? null : /* @__PURE__ */ (0,
|
|
3172
|
-
end ? /* @__PURE__ */ (0,
|
|
3173
|
-
chevron === "end" ? /* @__PURE__ */ (0,
|
|
3261
|
+
chevron === "start" ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "matrx-disclosure-chevron", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ChevronRightIcon, {}) }) : null,
|
|
3262
|
+
icon ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "matrx-disclosure-icon", "data-glyph-tone": glyphTone, children: icon }) : null,
|
|
3263
|
+
line ? /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("span", { className: "matrx-disclosure-text", children: [
|
|
3264
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "matrx-disclosure-title", children: title }),
|
|
3265
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "matrx-disclosure-line", children: line })
|
|
3266
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "matrx-disclosure-title", children: title }),
|
|
3267
|
+
meta === void 0 || meta === null || meta === false ? null : /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "matrx-disclosure-meta", children: meta }),
|
|
3268
|
+
end ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "matrx-disclosure-end", children: end }) : null,
|
|
3269
|
+
chevron === "end" ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "matrx-disclosure-chevron", "data-end": "", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ChevronRightIcon, {}) }) : null
|
|
3174
3270
|
]
|
|
3175
3271
|
}
|
|
3176
3272
|
)
|
|
3177
3273
|
);
|
|
3178
3274
|
DisclosureHeader.displayName = "DisclosureHeader";
|
|
3179
|
-
var DeleteButton =
|
|
3275
|
+
var DeleteButton = React15.forwardRef((props, ref) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Button2, { ref, variant: "quiet", icon: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Trash2Icon, {}), "data-delete": "", title: props["aria-label"], ...props }));
|
|
3180
3276
|
DeleteButton.displayName = "DeleteButton";
|
|
3181
3277
|
|
|
3182
3278
|
// src/writing-field/voice-chrome.tsx
|
|
3183
|
-
var
|
|
3279
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
3184
3280
|
function ListeningStrip({ liveTranscript, className }) {
|
|
3185
|
-
return /* @__PURE__ */ (0,
|
|
3186
|
-
/* @__PURE__ */ (0,
|
|
3187
|
-
/* @__PURE__ */ (0,
|
|
3281
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: cn("absolute flex items-center gap-1.5 px-2 py-1 rounded-md", className), children: [
|
|
3282
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { "aria-hidden": true, className: "w-2 h-2 bg-primary rounded-full flex-shrink-0 animate-pulse" }),
|
|
3283
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "type-secondary text-primary font-medium truncate", children: liveTranscript ? liveTranscript.slice(-60) : "Listening..." })
|
|
3188
3284
|
] });
|
|
3189
3285
|
}
|
|
3190
3286
|
function FinalizingStrip({ className }) {
|
|
3191
|
-
return /* @__PURE__ */ (0,
|
|
3287
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
3192
3288
|
"div",
|
|
3193
3289
|
{
|
|
3194
3290
|
className: cn(
|
|
@@ -3196,8 +3292,8 @@ function FinalizingStrip({ className }) {
|
|
|
3196
3292
|
className
|
|
3197
3293
|
),
|
|
3198
3294
|
children: [
|
|
3199
|
-
/* @__PURE__ */ (0,
|
|
3200
|
-
/* @__PURE__ */ (0,
|
|
3295
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Loader2Icon, { className: "w-3 h-3 animate-spin text-blue-600 dark:text-blue-400" }),
|
|
3296
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "type-secondary text-blue-600 dark:text-blue-400 font-medium", children: "Finalizing..." })
|
|
3201
3297
|
]
|
|
3202
3298
|
}
|
|
3203
3299
|
);
|
|
@@ -3205,20 +3301,20 @@ function FinalizingStrip({ className }) {
|
|
|
3205
3301
|
function VoiceProtectionDialog({ voice }) {
|
|
3206
3302
|
const { isRecording, isTranscribing } = voice;
|
|
3207
3303
|
const busy = isRecording || isTranscribing;
|
|
3208
|
-
return /* @__PURE__ */ (0,
|
|
3209
|
-
/* @__PURE__ */ (0,
|
|
3210
|
-
/* @__PURE__ */ (0,
|
|
3211
|
-
/* @__PURE__ */ (0,
|
|
3212
|
-
/* @__PURE__ */ (0,
|
|
3213
|
-
] }) : /* @__PURE__ */ (0,
|
|
3214
|
-
/* @__PURE__ */ (0,
|
|
3215
|
-
/* @__PURE__ */ (0,
|
|
3304
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(AlertDialog, { open: voice.showProtectionDialog, onOpenChange: voice.setShowProtectionDialog, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(AlertDialogContent, { children: [
|
|
3305
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(AlertDialogHeader, { children: [
|
|
3306
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "flex items-center gap-3 mb-2", children: busy ? /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_jsx_runtime22.Fragment, { children: [
|
|
3307
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Loader2Icon, { className: "h-5 w-5 animate-spin text-blue-500" }),
|
|
3308
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(AlertDialogTitle, { children: isRecording ? "Recording in Progress" : "Transcription in Progress" })
|
|
3309
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_jsx_runtime22.Fragment, { children: [
|
|
3310
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(CheckIcon, { className: "h-5 w-5 text-green-500" }),
|
|
3311
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(AlertDialogTitle, { children: "Voice Input Complete" })
|
|
3216
3312
|
] }) }),
|
|
3217
|
-
/* @__PURE__ */ (0,
|
|
3313
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(AlertDialogDescription, { children: isRecording ? "Your voice is currently being recorded. If you close now, the recording will be stopped and lost." : isTranscribing ? "Your voice recording is currently being transcribed. If you close now, the transcription will be lost." : "Your voice input has been processed successfully! You can now safely close this panel." })
|
|
3218
3314
|
] }),
|
|
3219
|
-
/* @__PURE__ */ (0,
|
|
3220
|
-
/* @__PURE__ */ (0,
|
|
3221
|
-
/* @__PURE__ */ (0,
|
|
3315
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(AlertDialogFooter, { children: busy ? /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_jsx_runtime22.Fragment, { children: [
|
|
3316
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(AlertDialogCancel, { onClick: voice.cancelClose, children: "Cancel & Wait" }),
|
|
3317
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
3222
3318
|
AlertDialogAction,
|
|
3223
3319
|
{
|
|
3224
3320
|
onClick: voice.confirmClose,
|
|
@@ -3226,7 +3322,7 @@ function VoiceProtectionDialog({ voice }) {
|
|
|
3226
3322
|
children: isRecording ? "Stop Recording" : "End Transcription"
|
|
3227
3323
|
}
|
|
3228
3324
|
)
|
|
3229
|
-
] }) : /* @__PURE__ */ (0,
|
|
3325
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(AlertDialogAction, { onClick: voice.confirmClose, children: "Close" }) })
|
|
3230
3326
|
] }) });
|
|
3231
3327
|
}
|
|
3232
3328
|
function FieldMenuRow({
|
|
@@ -3235,7 +3331,7 @@ function FieldMenuRow({
|
|
|
3235
3331
|
onClick,
|
|
3236
3332
|
disabled
|
|
3237
3333
|
}) {
|
|
3238
|
-
return /* @__PURE__ */ (0,
|
|
3334
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
3239
3335
|
Tile,
|
|
3240
3336
|
{
|
|
3241
3337
|
type: "button",
|
|
@@ -3253,352 +3349,6 @@ function micAriaLabel(isRecording, label) {
|
|
|
3253
3349
|
return label ? `Start voice input for ${label}` : "Start voice input";
|
|
3254
3350
|
}
|
|
3255
3351
|
|
|
3256
|
-
// src/writing-field/add-ons.tsx
|
|
3257
|
-
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
3258
|
-
var ADD_ON_PROP_NAMES = [
|
|
3259
|
-
"surfaceName",
|
|
3260
|
-
"getApplicationScope",
|
|
3261
|
-
"sourceFeature",
|
|
3262
|
-
"surfaceContextItems",
|
|
3263
|
-
"enableBoundAgents",
|
|
3264
|
-
"enableContextMenu",
|
|
3265
|
-
"enableCleanup",
|
|
3266
|
-
"cleanupAgentId",
|
|
3267
|
-
"cleanupContextItems",
|
|
3268
|
-
"enableHelpWithThis",
|
|
3269
|
-
"helpMandateKey",
|
|
3270
|
-
"helpContextItems",
|
|
3271
|
-
"enableCustomAgent",
|
|
3272
|
-
"customAgentMandateKey",
|
|
3273
|
-
"customAgentContextItems",
|
|
3274
|
-
"uploadImage"
|
|
3275
|
-
];
|
|
3276
|
-
function splitAddOnProps(props, extra = []) {
|
|
3277
|
-
const dom = {};
|
|
3278
|
-
const addOnProps = {};
|
|
3279
|
-
for (const [key, value] of Object.entries(props)) {
|
|
3280
|
-
if (ADD_ON_PROP_NAMES.includes(key) || extra.includes(key)) addOnProps[key] = value;
|
|
3281
|
-
else dom[key] = value;
|
|
3282
|
-
}
|
|
3283
|
-
return { dom, addOnProps };
|
|
3284
|
-
}
|
|
3285
|
-
var KEY = /* @__PURE__ */ Symbol.for("@ai-matrx/design-system/writing-field-door");
|
|
3286
|
-
var registry3 = globalThis;
|
|
3287
|
-
var DoorContext = registry3[KEY] ?? (registry3[KEY] = React15.createContext(null));
|
|
3288
|
-
var EMPTY = {};
|
|
3289
|
-
var NO_LIGHT = {};
|
|
3290
|
-
function WritingFieldAddOnsProvider({
|
|
3291
|
-
addOns,
|
|
3292
|
-
load,
|
|
3293
|
-
light = NO_LIGHT,
|
|
3294
|
-
children
|
|
3295
|
-
}) {
|
|
3296
|
-
const first = React15.useRef(addOns);
|
|
3297
|
-
if (addOns && first.current !== addOns) {
|
|
3298
|
-
announceStandIn(
|
|
3299
|
-
"writing-field-add-ons-swap",
|
|
3300
|
-
"WritingFieldAddOnsProvider received a different addOns object; the first one is kept (hook ports must be module-constant)."
|
|
3301
|
-
);
|
|
3302
|
-
}
|
|
3303
|
-
const loader = React15.useRef(load);
|
|
3304
|
-
const [loaded, setLoaded] = React15.useState(first.current ?? null);
|
|
3305
|
-
const [failed, setFailed] = React15.useState(false);
|
|
3306
|
-
const inflight = React15.useRef(null);
|
|
3307
|
-
const engage = React15.useCallback(() => {
|
|
3308
|
-
if (first.current) return Promise.resolve(first.current);
|
|
3309
|
-
if (inflight.current) return inflight.current;
|
|
3310
|
-
const run = loader.current;
|
|
3311
|
-
if (!run) return Promise.resolve(null);
|
|
3312
|
-
setFailed(false);
|
|
3313
|
-
inflight.current = run().then(
|
|
3314
|
-
(next) => {
|
|
3315
|
-
setLoaded(next);
|
|
3316
|
-
return next;
|
|
3317
|
-
},
|
|
3318
|
-
(error) => {
|
|
3319
|
-
inflight.current = null;
|
|
3320
|
-
setFailed(true);
|
|
3321
|
-
console.error("[writing-field] the writing-field add-ons failed to load; the next press retries.", error);
|
|
3322
|
-
return null;
|
|
3323
|
-
}
|
|
3324
|
-
);
|
|
3325
|
-
return inflight.current;
|
|
3326
|
-
}, []);
|
|
3327
|
-
const pendingSet = React15.useMemo(
|
|
3328
|
-
() => ({
|
|
3329
|
-
MicButton: PendingMicButton,
|
|
3330
|
-
Menu: PendingMenu,
|
|
3331
|
-
menuHasItems: light.menuHasItems ?? (() => true),
|
|
3332
|
-
TextStats: light.TextStats,
|
|
3333
|
-
propNames: light.propNames,
|
|
3334
|
-
notify: {
|
|
3335
|
-
error: (message, options) => void engage().then((a) => (a?.notify ?? STAND_IN_NOTIFY).error(message, options)),
|
|
3336
|
-
info: (message) => void engage().then((a) => (a?.notify ?? STAND_IN_NOTIFY).info(message)),
|
|
3337
|
-
success: (message) => void engage().then((a) => (a?.notify ?? STAND_IN_NOTIFY).success(message))
|
|
3338
|
-
}
|
|
3339
|
-
}),
|
|
3340
|
-
[light, engage]
|
|
3341
|
-
);
|
|
3342
|
-
const pending = !loaded && !!loader.current;
|
|
3343
|
-
const door = React15.useMemo(
|
|
3344
|
-
() => ({ addOns: loaded, pending, failed, light, engage, effective: loaded ?? (pending ? pendingSet : EMPTY) }),
|
|
3345
|
-
[loaded, pending, failed, light, engage, pendingSet]
|
|
3346
|
-
);
|
|
3347
|
-
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(DoorContext.Provider, { value: door, children });
|
|
3348
|
-
}
|
|
3349
|
-
var NO_DOOR = {
|
|
3350
|
-
addOns: null,
|
|
3351
|
-
pending: false,
|
|
3352
|
-
failed: false,
|
|
3353
|
-
light: NO_LIGHT,
|
|
3354
|
-
engage: () => Promise.resolve(null),
|
|
3355
|
-
effective: EMPTY
|
|
3356
|
-
};
|
|
3357
|
-
function useDoor() {
|
|
3358
|
-
return React15.useContext(DoorContext) ?? NO_DOOR;
|
|
3359
|
-
}
|
|
3360
|
-
function useWritingFieldAddOns() {
|
|
3361
|
-
return useDoor().effective;
|
|
3362
|
-
}
|
|
3363
|
-
function useWritingFieldDoor() {
|
|
3364
|
-
const door = useDoor();
|
|
3365
|
-
return { pending: door.pending, failed: door.failed, engage: door.engage };
|
|
3366
|
-
}
|
|
3367
|
-
function announceMissingPort(port) {
|
|
3368
|
-
announceStandIn(
|
|
3369
|
-
`writing-field:${port}`,
|
|
3370
|
-
`A writing field drew without its "${port}" add-on: the host did not register it in <WritingFieldAddOnsProvider addOns={{ ${port} }}>.`
|
|
3371
|
-
);
|
|
3372
|
-
}
|
|
3373
|
-
var INERT = () => void 0;
|
|
3374
|
-
function useStandInVoice(options) {
|
|
3375
|
-
React15.useEffect(() => {
|
|
3376
|
-
if (options.enabled) announceMissingPort("useVoice");
|
|
3377
|
-
}, [options.enabled]);
|
|
3378
|
-
return {
|
|
3379
|
-
microphone: false,
|
|
3380
|
-
available: false,
|
|
3381
|
-
isRecording: false,
|
|
3382
|
-
isTranscribing: false,
|
|
3383
|
-
audioLevel: 0,
|
|
3384
|
-
liveTranscript: "",
|
|
3385
|
-
handleVoiceClick: INERT,
|
|
3386
|
-
startDictation: async () => void 0,
|
|
3387
|
-
stopDictation: INERT,
|
|
3388
|
-
requestClose: () => options.onRequestClose?.(),
|
|
3389
|
-
showProtectionDialog: false,
|
|
3390
|
-
setShowProtectionDialog: INERT,
|
|
3391
|
-
confirmClose: () => options.onRequestClose?.(),
|
|
3392
|
-
cancelClose: INERT
|
|
3393
|
-
};
|
|
3394
|
-
}
|
|
3395
|
-
var STAND_IN_NOTIFY = {
|
|
3396
|
-
error: (message) => {
|
|
3397
|
-
announceMissingPort("notify");
|
|
3398
|
-
console.error(`[writing-field] ${message}`);
|
|
3399
|
-
},
|
|
3400
|
-
info: (message) => {
|
|
3401
|
-
announceMissingPort("notify");
|
|
3402
|
-
console.info(`[writing-field] ${message}`);
|
|
3403
|
-
},
|
|
3404
|
-
success: (message) => {
|
|
3405
|
-
announceMissingPort("notify");
|
|
3406
|
-
console.info(`[writing-field] ${message}`);
|
|
3407
|
-
}
|
|
3408
|
-
};
|
|
3409
|
-
function useNoFormatting() {
|
|
3410
|
-
}
|
|
3411
|
-
function useNoAudioSettings() {
|
|
3412
|
-
return () => announceMissingPort("useOpenAudioSettings");
|
|
3413
|
-
}
|
|
3414
|
-
function resolveHookPorts(addOns) {
|
|
3415
|
-
return {
|
|
3416
|
-
useVoice: addOns.useVoice ?? useStandInVoice,
|
|
3417
|
-
useFormatting: addOns.useFormatting ?? useNoFormatting,
|
|
3418
|
-
useOpenAudioSettings: addOns.useOpenAudioSettings ?? useNoAudioSettings,
|
|
3419
|
-
notify: addOns.notify ?? STAND_IN_NOTIFY
|
|
3420
|
-
};
|
|
3421
|
-
}
|
|
3422
|
-
var SNAPSHOT_KEYS = [
|
|
3423
|
-
"microphone",
|
|
3424
|
-
"available",
|
|
3425
|
-
"isRecording",
|
|
3426
|
-
"isTranscribing",
|
|
3427
|
-
"audioLevel",
|
|
3428
|
-
"liveTranscript",
|
|
3429
|
-
"showProtectionDialog"
|
|
3430
|
-
];
|
|
3431
|
-
var PENDING_SNAPSHOT = {
|
|
3432
|
-
microphone: false,
|
|
3433
|
-
available: true,
|
|
3434
|
-
isRecording: false,
|
|
3435
|
-
isTranscribing: false,
|
|
3436
|
-
audioLevel: 0,
|
|
3437
|
-
liveTranscript: "",
|
|
3438
|
-
showProtectionDialog: false
|
|
3439
|
-
};
|
|
3440
|
-
function useFieldPorts(addOns) {
|
|
3441
|
-
const door = useDoor();
|
|
3442
|
-
const live = !door.pending;
|
|
3443
|
-
const shared = React15.useRef({ voice: null, openAudioSettings: null, queue: [], options: null, drain: null }).current;
|
|
3444
|
-
const [snapshot, setSnapshot] = React15.useState(null);
|
|
3445
|
-
const [micApi, setMicApi] = React15.useState(false);
|
|
3446
|
-
React15.useEffect(() => {
|
|
3447
|
-
if (!live) setMicApi(typeof navigator !== "undefined" && !!navigator.mediaDevices?.getUserMedia);
|
|
3448
|
-
}, [live]);
|
|
3449
|
-
const fns = React15.useState(() => {
|
|
3450
|
-
const run = (fn, fail) => {
|
|
3451
|
-
if (shared.voice && shared.openAudioSettings) {
|
|
3452
|
-
fn(shared.voice, shared.openAudioSettings);
|
|
3453
|
-
return;
|
|
3454
|
-
}
|
|
3455
|
-
shared.queue.push({ fn, fail });
|
|
3456
|
-
void door.engage().then((addOnsNow) => {
|
|
3457
|
-
if (addOnsNow) setTimeout(() => shared.drain?.(), 0);
|
|
3458
|
-
else {
|
|
3459
|
-
const dropped = shared.queue.splice(0);
|
|
3460
|
-
for (const q of dropped) q.fail?.(new Error("The writing field's add-ons did not load."));
|
|
3461
|
-
}
|
|
3462
|
-
});
|
|
3463
|
-
};
|
|
3464
|
-
return {
|
|
3465
|
-
run,
|
|
3466
|
-
handleVoiceClick: () => run((v) => void v.handleVoiceClick()),
|
|
3467
|
-
startDictation: () => new Promise(
|
|
3468
|
-
(resolve, reject) => run((v) => void Promise.resolve(v.startDictation()).then(resolve, reject), reject)
|
|
3469
|
-
),
|
|
3470
|
-
stopDictation: () => shared.voice?.stopDictation(),
|
|
3471
|
-
requestClose: () => shared.voice ? shared.voice.requestClose() : shared.options?.onRequestClose?.(),
|
|
3472
|
-
setShowProtectionDialog: (open) => shared.voice?.setShowProtectionDialog(open),
|
|
3473
|
-
confirmClose: () => shared.voice ? shared.voice.confirmClose() : shared.options?.onRequestClose?.(),
|
|
3474
|
-
cancelClose: () => shared.voice?.cancelClose(),
|
|
3475
|
-
openAudioSettings: () => run((_v, open) => open())
|
|
3476
|
-
};
|
|
3477
|
-
})[0];
|
|
3478
|
-
const args = {};
|
|
3479
|
-
return {
|
|
3480
|
-
/** The add-ons are still on the way (draw the light stand-ins, open the door on engagement). */
|
|
3481
|
-
pending: door.pending,
|
|
3482
|
-
failed: door.failed,
|
|
3483
|
-
/** Hold the first right-click for the add-ons' menu (only where it will open one). */
|
|
3484
|
-
holdsContextMenu: (field) => door.pending && !door.failed && (door.light.holdsContextMenu?.(field) ?? false),
|
|
3485
|
-
/** Open the door now (a press, a key, a right-click, the mic, "…"). */
|
|
3486
|
-
engage: door.engage,
|
|
3487
|
-
notify: addOns.notify ?? STAND_IN_NOTIFY,
|
|
3488
|
-
useOpenAudioSettings: () => fns.openAudioSettings,
|
|
3489
|
-
useFormatting: (element, on, props) => {
|
|
3490
|
-
args.formatting = [element, on, props];
|
|
3491
|
-
},
|
|
3492
|
-
useVoice: (options) => {
|
|
3493
|
-
args.voice = options;
|
|
3494
|
-
shared.options = options;
|
|
3495
|
-
const s = snapshot ?? { ...PENDING_SNAPSHOT, microphone: live ? false : micApi };
|
|
3496
|
-
return {
|
|
3497
|
-
...s,
|
|
3498
|
-
handleVoiceClick: fns.handleVoiceClick,
|
|
3499
|
-
startDictation: fns.startDictation,
|
|
3500
|
-
stopDictation: fns.stopDictation,
|
|
3501
|
-
requestClose: fns.requestClose,
|
|
3502
|
-
setShowProtectionDialog: fns.setShowProtectionDialog,
|
|
3503
|
-
confirmClose: fns.confirmClose,
|
|
3504
|
-
cancelClose: fns.cancelClose,
|
|
3505
|
-
dialogs: null
|
|
3506
|
-
};
|
|
3507
|
-
},
|
|
3508
|
-
/** The runner element: render it once inside the field (it draws the voice port's dialogs). */
|
|
3509
|
-
renderRunner: () => live && args.voice ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
3510
|
-
PortRunner,
|
|
3511
|
-
{
|
|
3512
|
-
addOns,
|
|
3513
|
-
voiceOptions: args.voice,
|
|
3514
|
-
formatting: args.formatting ?? null,
|
|
3515
|
-
shared,
|
|
3516
|
-
publish: setSnapshot
|
|
3517
|
-
}
|
|
3518
|
-
) : null
|
|
3519
|
-
};
|
|
3520
|
-
}
|
|
3521
|
-
function PortRunner({
|
|
3522
|
-
addOns,
|
|
3523
|
-
voiceOptions,
|
|
3524
|
-
formatting,
|
|
3525
|
-
shared,
|
|
3526
|
-
publish
|
|
3527
|
-
}) {
|
|
3528
|
-
const ports = resolveHookPorts(addOns);
|
|
3529
|
-
const openAudioSettings = ports.useOpenAudioSettings();
|
|
3530
|
-
ports.useFormatting(formatting?.[0] ?? null, formatting?.[1] ?? false, formatting?.[2] ?? EMPTY_PROPS);
|
|
3531
|
-
const voice = ports.useVoice(voiceOptions);
|
|
3532
|
-
const last = React15.useRef(null);
|
|
3533
|
-
React15.useLayoutEffect(() => {
|
|
3534
|
-
shared.voice = voice;
|
|
3535
|
-
shared.openAudioSettings = openAudioSettings;
|
|
3536
|
-
shared.drain = () => {
|
|
3537
|
-
if (!shared.voice || !shared.openAudioSettings) return;
|
|
3538
|
-
for (const q of shared.queue.splice(0)) q.fn(shared.voice, shared.openAudioSettings);
|
|
3539
|
-
};
|
|
3540
|
-
const prev = last.current;
|
|
3541
|
-
if (!prev || SNAPSHOT_KEYS.some((k) => prev[k] !== voice[k])) {
|
|
3542
|
-
const next = Object.fromEntries(SNAPSHOT_KEYS.map((k) => [k, voice[k]]));
|
|
3543
|
-
last.current = next;
|
|
3544
|
-
publish(next);
|
|
3545
|
-
}
|
|
3546
|
-
});
|
|
3547
|
-
React15.useEffect(() => {
|
|
3548
|
-
if (shared.queue.length) shared.drain?.();
|
|
3549
|
-
});
|
|
3550
|
-
React15.useEffect(
|
|
3551
|
-
() => () => {
|
|
3552
|
-
shared.voice = null;
|
|
3553
|
-
shared.openAudioSettings = null;
|
|
3554
|
-
shared.drain = null;
|
|
3555
|
-
},
|
|
3556
|
-
[shared]
|
|
3557
|
-
);
|
|
3558
|
-
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_jsx_runtime22.Fragment, { children: voice.dialogs });
|
|
3559
|
-
}
|
|
3560
|
-
var EMPTY_PROPS = {};
|
|
3561
|
-
function PendingMicButton({ onMicClick, disabled, micAriaLabel: label = "Start voice input", tabIndex, dense = false }) {
|
|
3562
|
-
const { engage, failed } = useWritingFieldDoor();
|
|
3563
|
-
const title = failed ? "Voice input did not load. Press to try again." : label;
|
|
3564
|
-
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: cn("relative mx-[3px] inline-flex shrink-0 items-center", dense ? "h-6" : "h-7 pointer-coarse:h-10"), children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: cn("relative flex items-stretch rounded-full", dense ? "h-6" : "h-7 pointer-coarse:h-9"), children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
3565
|
-
Button,
|
|
3566
|
-
{
|
|
3567
|
-
type: "button",
|
|
3568
|
-
variant: "ghost",
|
|
3569
|
-
size: "xs",
|
|
3570
|
-
tabIndex,
|
|
3571
|
-
onClick: onMicClick,
|
|
3572
|
-
onContextMenu: (e) => {
|
|
3573
|
-
e.preventDefault();
|
|
3574
|
-
e.stopPropagation();
|
|
3575
|
-
void engage();
|
|
3576
|
-
},
|
|
3577
|
-
disabled,
|
|
3578
|
-
"aria-label": title,
|
|
3579
|
-
title,
|
|
3580
|
-
"data-touch-exempt": "The field row owns the microphone touch target.",
|
|
3581
|
-
className: cn(
|
|
3582
|
-
"relative z-[1] h-full touch-manipulation select-none rounded-full transition-colors focus-visible:ring-primary/40 disabled:opacity-40 hover:bg-muted/60 hover:text-muted-foreground active:bg-muted-foreground/15 active:scale-100 text-muted-foreground",
|
|
3583
|
-
dense ? "px-1 [&_svg]:size-3.5" : "px-1.5 pointer-coarse:px-3 [&_svg]:size-4",
|
|
3584
|
-
failed && "text-destructive"
|
|
3585
|
-
),
|
|
3586
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(MicIcon, { className: dense ? "h-3.5 w-3.5" : "h-4 w-4" })
|
|
3587
|
-
}
|
|
3588
|
-
) }) });
|
|
3589
|
-
}
|
|
3590
|
-
function PendingMenu({ ownRows, trailingRows }) {
|
|
3591
|
-
const { engage, failed } = useWritingFieldDoor();
|
|
3592
|
-
React15.useEffect(() => {
|
|
3593
|
-
void engage();
|
|
3594
|
-
}, [engage]);
|
|
3595
|
-
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex w-48 flex-col p-1", "data-writing-field-host": "pending", children: [
|
|
3596
|
-
ownRows,
|
|
3597
|
-
failed ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(FieldMenuRow, { icon: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(RotateCcwIcon, {}), onClick: () => void engage(), children: "Actions did not load. Retry" }) : /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "flex items-center justify-center py-2 text-muted-foreground", role: "status", "aria-label": "Loading actions", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Loader2Icon, { className: "h-4 w-4 animate-spin" }) }),
|
|
3598
|
-
trailingRows
|
|
3599
|
-
] });
|
|
3600
|
-
}
|
|
3601
|
-
|
|
3602
3352
|
// src/writing-field/pro-textarea.tsx
|
|
3603
3353
|
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
3604
3354
|
var FILL_HEIGHT_REGEX2 = /(?:^|\s)(h-full|h-dvh|flex-1|grow|inset-0|min-h-0)(?:\s|$)/;
|
|
@@ -3652,7 +3402,7 @@ var ProTextarea = React16.forwardRef(
|
|
|
3652
3402
|
...rest
|
|
3653
3403
|
}, ref) => {
|
|
3654
3404
|
const addOns = useWritingFieldAddOns();
|
|
3655
|
-
const ports =
|
|
3405
|
+
const ports = resolveHookPorts(addOns);
|
|
3656
3406
|
const { dom: props, addOnProps } = splitAddOnProps(
|
|
3657
3407
|
rest,
|
|
3658
3408
|
addOns.propNames
|
|
@@ -3716,51 +3466,11 @@ var ProTextarea = React16.forwardRef(
|
|
|
3716
3466
|
const [showTextStatsBar, setShowTextStatsBar] = React16.useState(defaultShowTextStatsBar);
|
|
3717
3467
|
const internalRef = React16.useRef(null);
|
|
3718
3468
|
const textareaRef = internalRef;
|
|
3719
|
-
const
|
|
3720
|
-
const valueRef = React16.useRef(value);
|
|
3721
|
-
valueRef.current = value;
|
|
3722
|
-
const setTextareaRef = React16.useCallback((node) => {
|
|
3723
|
-
const prev = internalRef.current;
|
|
3724
|
-
if (!node && prev) {
|
|
3725
|
-
handoff.current = {
|
|
3726
|
-
from: prev,
|
|
3727
|
-
value: prev.value,
|
|
3728
|
-
start: prev.selectionStart ?? 0,
|
|
3729
|
-
end: prev.selectionEnd ?? 0,
|
|
3730
|
-
scroll: prev.scrollTop,
|
|
3731
|
-
focused: typeof document !== "undefined" && document.activeElement === prev
|
|
3732
|
-
};
|
|
3733
|
-
} else if (node && handoff.current) {
|
|
3734
|
-
const carried = handoff.current;
|
|
3735
|
-
handoff.current = null;
|
|
3736
|
-
if (carried.from !== node) {
|
|
3737
|
-
if (valueRef.current === void 0 && node.value !== carried.value) node.value = carried.value;
|
|
3738
|
-
node.scrollTop = carried.scroll;
|
|
3739
|
-
if (carried.focused) {
|
|
3740
|
-
node.focus({ preventScroll: true });
|
|
3741
|
-
node.setSelectionRange(carried.start, carried.end);
|
|
3742
|
-
}
|
|
3743
|
-
}
|
|
3744
|
-
}
|
|
3469
|
+
const setTextareaRef = (node) => {
|
|
3745
3470
|
internalRef.current = node;
|
|
3746
3471
|
if (typeof ref === "function") ref(node);
|
|
3747
3472
|
else if (ref) ref.current = node;
|
|
3748
|
-
}, [ref]);
|
|
3749
|
-
const heldContextMenu = React16.useRef(null);
|
|
3750
|
-
const holdContextMenuUntilLoaded = (e) => {
|
|
3751
|
-
e.preventDefault();
|
|
3752
|
-
heldContextMenu.current = { x: e.clientX, y: e.clientY };
|
|
3753
|
-
void ports.engage();
|
|
3754
3473
|
};
|
|
3755
|
-
React16.useEffect(() => {
|
|
3756
|
-
const held = heldContextMenu.current;
|
|
3757
|
-
if (ports.pending || !held) return;
|
|
3758
|
-
heldContextMenu.current = null;
|
|
3759
|
-
if (!addOns.ContextMenu) return;
|
|
3760
|
-
internalRef.current?.dispatchEvent(
|
|
3761
|
-
new MouseEvent("contextmenu", { bubbles: true, cancelable: true, clientX: held.x, clientY: held.y })
|
|
3762
|
-
);
|
|
3763
|
-
}, [ports.pending, addOns.ContextMenu]);
|
|
3764
3474
|
const formattingOn = markdownFormatting ?? (!editor && !submitOnEnter && (props.rows === void 0 || Number(props.rows) >= 2));
|
|
3765
3475
|
const [formatElement, setFormatElement] = React16.useState(null);
|
|
3766
3476
|
React16.useLayoutEffect(() => {
|
|
@@ -3952,8 +3662,8 @@ var ProTextarea = React16.forwardRef(
|
|
|
3952
3662
|
const Stats = addOns.TextStats;
|
|
3953
3663
|
const showTextStats = enableTextStats && showMenu && !!Stats;
|
|
3954
3664
|
React16.useEffect(() => {
|
|
3955
|
-
if (enableTextStats && !addOns.TextStats
|
|
3956
|
-
}, [enableTextStats, addOns.TextStats
|
|
3665
|
+
if (enableTextStats && !addOns.TextStats) announceMissingPort("TextStats");
|
|
3666
|
+
}, [enableTextStats, addOns.TextStats]);
|
|
3957
3667
|
const showPinnedTextStatsBar = showTextStats && showTextStatsBar;
|
|
3958
3668
|
const fillHeight = !autoGrow && wantsFillHeight(className, wrapperClassName);
|
|
3959
3669
|
React16.useEffect(() => {
|
|
@@ -4141,11 +3851,7 @@ var ProTextarea = React16.forwardRef(
|
|
|
4141
3851
|
{
|
|
4142
3852
|
ref: setFieldBoxNode,
|
|
4143
3853
|
className: cn("relative group", wrapperClassName),
|
|
4144
|
-
"data-writing-field":
|
|
4145
|
-
"data-writing-field-host": ports.pending ? "pending" : addOns.Menu && addOns.useVoice ? void 0 : UNCONFIGURED,
|
|
4146
|
-
onPointerDownCapture: ports.pending ? () => void ports.engage() : void 0,
|
|
4147
|
-
onKeyDownCapture: ports.pending ? () => void ports.engage() : void 0,
|
|
4148
|
-
onContextMenuCapture: !disabled && ports.holdsContextMenu({ kind: "textarea", addOnProps }) ? holdContextMenuUntilLoaded : void 0,
|
|
3854
|
+
"data-writing-field-host": addOns.Menu && addOns.useVoice ? void 0 : UNCONFIGURED,
|
|
4149
3855
|
onMouseEnter: () => setIsHovered(true),
|
|
4150
3856
|
onMouseMove: () => {
|
|
4151
3857
|
if (!isHovered) setIsHovered(true);
|
|
@@ -4234,7 +3940,6 @@ var ProTextarea = React16.forwardRef(
|
|
|
4234
3940
|
enableVoice && isTranscribing && !isRecording && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(FinalizingStrip, { className: inlineControls ? "left-0 bottom-full mb-1.5" : "left-2 bottom-2" })
|
|
4235
3941
|
] }),
|
|
4236
3942
|
voice.dialogs,
|
|
4237
|
-
ports.renderRunner(),
|
|
4238
3943
|
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(VoiceProtectionDialog, { voice }),
|
|
4239
3944
|
showPinnedTextStatsBar && Stats ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "hidden sm:block", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Stats.Bar, { text: valueAsString }) }) : null
|
|
4240
3945
|
] })
|
|
@@ -4336,7 +4041,7 @@ var ProInput = React17.forwardRef(
|
|
|
4336
4041
|
...rest
|
|
4337
4042
|
}, ref) => {
|
|
4338
4043
|
const addOns = useWritingFieldAddOns();
|
|
4339
|
-
const ports =
|
|
4044
|
+
const ports = resolveHookPorts(addOns);
|
|
4340
4045
|
const { dom: props, addOnProps } = splitAddOnProps(rest, addOns.propNames);
|
|
4341
4046
|
const generatedId = React17.useId();
|
|
4342
4047
|
const { size: _nativeSize, width: nativeWidth, style: nativeStyle, ...fieldProps } = props;
|
|
@@ -4576,10 +4281,7 @@ var ProInput = React17.forwardRef(
|
|
|
4576
4281
|
"div",
|
|
4577
4282
|
{
|
|
4578
4283
|
className: cn("relative group", wrapperClassName),
|
|
4579
|
-
"data-writing-field":
|
|
4580
|
-
"data-writing-field-host": ports.pending ? "pending" : addOns.Menu && addOns.useVoice ? void 0 : UNCONFIGURED,
|
|
4581
|
-
onPointerDownCapture: ports.pending ? () => void ports.engage() : void 0,
|
|
4582
|
-
onKeyDownCapture: ports.pending ? () => void ports.engage() : void 0,
|
|
4284
|
+
"data-writing-field-host": addOns.Menu && addOns.useVoice ? void 0 : UNCONFIGURED,
|
|
4583
4285
|
onMouseEnter: () => setIsHovered(true),
|
|
4584
4286
|
onMouseMove: () => {
|
|
4585
4287
|
if (!isHovered) setIsHovered(true);
|
|
@@ -4714,7 +4416,6 @@ var ProInput = React17.forwardRef(
|
|
|
4714
4416
|
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "type-secondary text-primary font-medium truncate", children: voice.liveTranscript ? voice.liveTranscript.slice(-60) : "Listening..." })
|
|
4715
4417
|
] }) : /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(FinalizingStrip, { className: "relative" }) }),
|
|
4716
4418
|
voice.dialogs,
|
|
4717
|
-
ports.renderRunner(),
|
|
4718
4419
|
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(VoiceProtectionDialog, { voice })
|
|
4719
4420
|
]
|
|
4720
4421
|
}
|