@refraction-ui/react 0.19.1 → 0.20.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/chunk-533MCMSU.js +2355 -0
- package/dist/chunk-533MCMSU.js.map +7 -0
- package/dist/chunk-AMK4VCBG.js +250 -0
- package/dist/chunk-AMK4VCBG.js.map +7 -0
- package/dist/chunk-BOLFYVI6.js +90 -0
- package/dist/chunk-BOLFYVI6.js.map +7 -0
- package/dist/chunk-F7B64KT3.js +187 -0
- package/dist/chunk-F7B64KT3.js.map +7 -0
- package/dist/chunk-FD37DFCC.js +77 -0
- package/dist/chunk-FD37DFCC.js.map +7 -0
- package/dist/chunk-H54FLNAF.js +132 -0
- package/dist/chunk-H54FLNAF.js.map +7 -0
- package/dist/chunk-INP46354.js +664 -0
- package/dist/chunk-INP46354.js.map +7 -0
- package/dist/chunk-ONACRMG4.js +116 -0
- package/dist/chunk-ONACRMG4.js.map +7 -0
- package/dist/chunk-SDZ3LROZ.js +7 -0
- package/dist/chunk-SDZ3LROZ.js.map +7 -0
- package/dist/chunk-TOZBR4GL.js +154 -0
- package/dist/chunk-TOZBR4GL.js.map +7 -0
- package/dist/chunk-UNEM2TRI.js +225 -0
- package/dist/chunk-UNEM2TRI.js.map +7 -0
- package/dist/chunk-VK3EQ34F.js +92 -0
- package/dist/chunk-VK3EQ34F.js.map +7 -0
- package/dist/chunk-WK2IIUFO.js +316 -0
- package/dist/chunk-WK2IIUFO.js.map +7 -0
- package/dist/chunk-WSPJTQAV.js +59 -0
- package/dist/chunk-WSPJTQAV.js.map +7 -0
- package/dist/chunk-XWP763SH.js +3 -2
- package/dist/chunk-XWP763SH.js.map +7 -1
- package/dist/chunk-Y2FNNAIL.js +80 -0
- package/dist/chunk-Y2FNNAIL.js.map +1 -0
- package/dist/{chunk-4A4BW3GR.js → chunk-ZF3OHCGV.js} +28 -5
- package/dist/chunk-ZF3OHCGV.js.map +7 -0
- package/dist/form.cjs +5 -11
- package/dist/form.cjs.map +1 -1
- package/dist/form.js +6 -12
- package/dist/form.js.map +1 -1
- package/dist/index.cjs +2879 -33936
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +126 -28780
- package/dist/internal/react-app-shell/index.d.cts +2 -22
- package/dist/internal/react-app-shell/index.d.ts +2 -22
- package/dist/internal/react-badge/index.d.cts +5 -0
- package/dist/internal/react-badge/index.d.ts +5 -0
- package/dist/internal/react-callout/index.d.cts +4 -0
- package/dist/internal/react-callout/index.d.ts +4 -0
- package/dist/internal/react-card/index.d.cts +8 -1
- package/dist/internal/react-card/index.d.ts +8 -1
- package/dist/internal/react-collapsible/index.d.cts +0 -3
- package/dist/internal/react-collapsible/index.d.ts +0 -3
- package/dist/internal/react-combobox/index.d.cts +0 -3
- package/dist/internal/react-combobox/index.d.ts +0 -3
- package/dist/internal/react-command/index.d.cts +0 -3
- package/dist/internal/react-command/index.d.ts +0 -3
- package/dist/internal/react-data-table/index.d.cts +0 -3
- package/dist/internal/react-data-table/index.d.ts +0 -3
- package/dist/internal/react-dialog/index.d.cts +0 -3
- package/dist/internal/react-dialog/index.d.ts +0 -3
- package/dist/internal/react-dropdown-menu/index.d.cts +0 -3
- package/dist/internal/react-dropdown-menu/index.d.ts +0 -3
- package/dist/internal/react-feedback-dialog/index.d.cts +0 -3
- package/dist/internal/react-feedback-dialog/index.d.ts +0 -3
- package/dist/internal/react-form/index.d.cts +2 -21
- package/dist/internal/react-form/index.d.ts +2 -21
- package/dist/internal/react-keyboard-shortcut/index.d.cts +0 -6
- package/dist/internal/react-keyboard-shortcut/index.d.ts +0 -6
- package/dist/internal/react-link-card/index.d.cts +8 -2
- package/dist/internal/react-link-card/index.d.ts +8 -2
- package/dist/internal/react-popover/index.d.cts +0 -3
- package/dist/internal/react-popover/index.d.ts +0 -3
- package/dist/internal/react-sheet/index.d.cts +0 -3
- package/dist/internal/react-sheet/index.d.ts +0 -3
- package/dist/internal/react-slot/index.d.cts +23 -0
- package/dist/internal/react-slot/index.d.ts +23 -0
- package/dist/internal/react-toast/index.d.cts +0 -3
- package/dist/internal/react-toast/index.d.ts +0 -3
- package/dist/internal/react-tooltip/index.d.cts +0 -3
- package/dist/internal/react-tooltip/index.d.ts +0 -3
- package/dist/react-accordion.js +125 -0
- package/dist/react-accordion.js.map +7 -0
- package/dist/react-ai.js +257 -0
- package/dist/react-ai.js.map +7 -0
- package/dist/react-analytics.js +1698 -0
- package/dist/react-analytics.js.map +7 -0
- package/dist/react-animated-text.js +164 -0
- package/dist/react-animated-text.js.map +7 -0
- package/dist/react-app-shell.js +631 -0
- package/dist/react-app-shell.js.map +7 -0
- package/dist/react-audience-feature-card.js +53 -0
- package/dist/react-audience-feature-card.js.map +7 -0
- package/dist/react-audio-room.js +166 -0
- package/dist/react-audio-room.js.map +7 -0
- package/dist/react-auth.js +211 -0
- package/dist/react-auth.js.map +7 -0
- package/dist/react-avatar-group.js +154 -0
- package/dist/react-avatar-group.js.map +7 -0
- package/dist/react-avatar.js +168 -0
- package/dist/react-avatar.js.map +7 -0
- package/dist/react-badge.js +86 -0
- package/dist/react-badge.js.map +7 -0
- package/dist/react-bottom-nav.js +67 -0
- package/dist/react-bottom-nav.js.map +7 -0
- package/dist/react-brand-network-cell.js +92 -0
- package/dist/react-brand-network-cell.js.map +7 -0
- package/dist/react-breadcrumbs.js +104 -0
- package/dist/react-breadcrumbs.js.map +7 -0
- package/dist/react-browser-chrome-mock.js +89 -0
- package/dist/react-browser-chrome-mock.js.map +7 -0
- package/dist/react-button.js +13 -0
- package/dist/react-button.js.map +7 -0
- package/dist/react-calendar.js +301 -0
- package/dist/react-calendar.js.map +7 -0
- package/dist/react-call-controls.js +113 -0
- package/dist/react-call-controls.js.map +7 -0
- package/dist/react-callout.js +152 -0
- package/dist/react-callout.js.map +7 -0
- package/dist/react-card-grid.js +34 -0
- package/dist/react-card-grid.js.map +7 -0
- package/dist/react-card.js +200 -0
- package/dist/react-card.js.map +7 -0
- package/dist/react-carousel.js +132 -0
- package/dist/react-carousel.js.map +7 -0
- package/dist/react-charts.js +509 -0
- package/dist/react-charts.js.map +7 -0
- package/dist/react-checkbox.js +156 -0
- package/dist/react-checkbox.js.map +7 -0
- package/dist/react-checklist.js +168 -0
- package/dist/react-checklist.js.map +7 -0
- package/dist/react-code-block.js +78 -0
- package/dist/react-code-block.js.map +7 -0
- package/dist/react-code-editor.js +184 -0
- package/dist/react-code-editor.js.map +7 -0
- package/dist/react-collapsible.js +192 -0
- package/dist/react-collapsible.js.map +7 -0
- package/dist/react-combobox.js +609 -0
- package/dist/react-combobox.js.map +7 -0
- package/dist/react-command-input.js +202 -0
- package/dist/react-command-input.js.map +7 -0
- package/dist/react-command.js +364 -0
- package/dist/react-command.js.map +7 -0
- package/dist/react-composer.js +2036 -0
- package/dist/react-composer.js.map +7 -0
- package/dist/react-content-protection.js +133 -0
- package/dist/react-content-protection.js.map +7 -0
- package/dist/react-conversation.js +1226 -0
- package/dist/react-conversation.js.map +7 -0
- package/dist/react-cookie-consent.js +291 -0
- package/dist/react-cookie-consent.js.map +7 -0
- package/dist/react-data-table.js +310 -0
- package/dist/react-data-table.js.map +7 -0
- package/dist/react-date-picker.js +95 -0
- package/dist/react-date-picker.js.map +7 -0
- package/dist/react-device-frame.js +137 -0
- package/dist/react-device-frame.js.map +7 -0
- package/dist/react-dialog.js +218 -0
- package/dist/react-dialog.js.map +7 -0
- package/dist/react-diff-viewer.js +460 -0
- package/dist/react-diff-viewer.js.map +7 -0
- package/dist/react-dropdown-menu.js +292 -0
- package/dist/react-dropdown-menu.js.map +7 -0
- package/dist/react-editor-status-bar.js +148 -0
- package/dist/react-editor-status-bar.js.map +7 -0
- package/dist/react-editor-tabs.js +159 -0
- package/dist/react-editor-tabs.js.map +7 -0
- package/dist/react-emoji-picker.js +238 -0
- package/dist/react-emoji-picker.js.map +7 -0
- package/dist/react-empty-state.js +90 -0
- package/dist/react-empty-state.js.map +7 -0
- package/dist/react-feedback-dialog.js +275 -0
- package/dist/react-feedback-dialog.js.map +7 -0
- package/dist/react-file-tree.js +376 -0
- package/dist/react-file-tree.js.map +7 -0
- package/dist/react-file-upload.js +360 -0
- package/dist/react-file-upload.js.map +7 -0
- package/dist/react-floating-reactions.js +124 -0
- package/dist/react-floating-reactions.js.map +7 -0
- package/dist/react-flow-editor.js +198 -0
- package/dist/react-flow-editor.js.map +7 -0
- package/dist/react-footer.js +67 -0
- package/dist/react-footer.js.map +7 -0
- package/dist/react-graph-view.js +197 -0
- package/dist/react-graph-view.js.map +7 -0
- package/dist/react-icon-system.js +9 -0
- package/dist/react-icon-system.js.map +7 -0
- package/dist/react-infinite-canvas.js +8 -0
- package/dist/react-infinite-canvas.js.map +7 -0
- package/dist/react-inline-editor.js +216 -0
- package/dist/react-inline-editor.js.map +7 -0
- package/dist/react-input-group.js +150 -0
- package/dist/react-input-group.js.map +7 -0
- package/dist/react-input.js +10 -0
- package/dist/react-input.js.map +7 -0
- package/dist/react-install-prompt.js +132 -0
- package/dist/react-install-prompt.js.map +7 -0
- package/dist/react-kanban-board.js +198 -0
- package/dist/react-kanban-board.js.map +7 -0
- package/dist/react-keyboard-shortcut.js +36 -0
- package/dist/react-keyboard-shortcut.js.map +7 -0
- package/dist/react-language-selector.js +311 -0
- package/dist/react-language-selector.js.map +7 -0
- package/dist/react-link-card.js +48 -0
- package/dist/react-link-card.js.map +7 -0
- package/dist/react-live-captions.js +92 -0
- package/dist/react-live-captions.js.map +7 -0
- package/dist/react-live-cursors.js +145 -0
- package/dist/react-live-cursors.js.map +7 -0
- package/dist/react-live-transcript.js +117 -0
- package/dist/react-live-transcript.js.map +7 -0
- package/dist/react-location-selector.js +252 -0
- package/dist/react-location-selector.js.map +7 -0
- package/dist/react-logger.js +415 -0
- package/dist/react-logger.js.map +7 -0
- package/dist/react-markdown-renderer.js +12 -0
- package/dist/react-markdown-renderer.js.map +7 -0
- package/dist/react-marquee-strip.js +62 -0
- package/dist/react-marquee-strip.js.map +7 -0
- package/dist/react-mascot.js +367 -0
- package/dist/react-mascot.js.map +7 -0
- package/dist/react-mastery-bar.js +97 -0
- package/dist/react-mastery-bar.js.map +7 -0
- package/dist/react-mini-map.js +207 -0
- package/dist/react-mini-map.js.map +7 -0
- package/dist/react-mobile-nav.js +216 -0
- package/dist/react-mobile-nav.js.map +7 -0
- package/dist/react-navbar.js +96 -0
- package/dist/react-navbar.js.map +7 -0
- package/dist/react-numbered-steps.js +67 -0
- package/dist/react-numbered-steps.js.map +7 -0
- package/dist/react-otp-input.js +318 -0
- package/dist/react-otp-input.js.map +7 -0
- package/dist/react-pagination.js +199 -0
- package/dist/react-pagination.js.map +7 -0
- package/dist/react-password-input.js +104 -0
- package/dist/react-password-input.js.map +7 -0
- package/dist/react-payment.js +81 -0
- package/dist/react-payment.js.map +7 -0
- package/dist/react-popover.js +176 -0
- package/dist/react-popover.js.map +7 -0
- package/dist/react-pre-call-lobby.js +309 -0
- package/dist/react-pre-call-lobby.js.map +7 -0
- package/dist/react-presence-indicator.js +86 -0
- package/dist/react-presence-indicator.js.map +7 -0
- package/dist/react-pricing-card.js +142 -0
- package/dist/react-pricing-card.js.map +7 -0
- package/dist/react-progress-display.js +188 -0
- package/dist/react-progress-display.js.map +7 -0
- package/dist/react-radial-gauge.js +193 -0
- package/dist/react-radial-gauge.js.map +7 -0
- package/dist/react-radio.js +169 -0
- package/dist/react-radio.js.map +7 -0
- package/dist/react-rating-scale.js +171 -0
- package/dist/react-rating-scale.js.map +7 -0
- package/dist/react-reaction-bar.js +111 -0
- package/dist/react-reaction-bar.js.map +7 -0
- package/dist/react-resizable-layout.js +298 -0
- package/dist/react-resizable-layout.js.map +7 -0
- package/dist/react-rich-editor.js +1 -0
- package/dist/react-rich-editor.js.map +7 -0
- package/dist/react-search-bar.js +285 -0
- package/dist/react-search-bar.js.map +7 -0
- package/dist/react-section-head.js +65 -0
- package/dist/react-section-head.js.map +7 -0
- package/dist/react-segmented-control.js +215 -0
- package/dist/react-segmented-control.js.map +7 -0
- package/dist/react-select.js +389 -0
- package/dist/react-select.js.map +7 -0
- package/dist/react-separator.js +86 -0
- package/dist/react-separator.js.map +7 -0
- package/dist/react-sheet.js +310 -0
- package/dist/react-sheet.js.map +7 -0
- package/dist/react-sidebar.js +100 -0
- package/dist/react-sidebar.js.map +7 -0
- package/dist/react-skeleton.js +91 -0
- package/dist/react-skeleton.js.map +7 -0
- package/dist/react-skip-to-content.js +38 -0
- package/dist/react-skip-to-content.js.map +7 -0
- package/dist/react-slide-viewer.js +264 -0
- package/dist/react-slide-viewer.js.map +7 -0
- package/dist/react-slider.js +105 -0
- package/dist/react-slider.js.map +7 -0
- package/dist/react-slot-picker.js +184 -0
- package/dist/react-slot-picker.js.map +7 -0
- package/dist/react-slot.js +7 -0
- package/dist/react-slot.js.map +7 -0
- package/dist/react-social-auth-button.js +169 -0
- package/dist/react-social-auth-button.js.map +7 -0
- package/dist/react-sortable-list.js +204 -0
- package/dist/react-sortable-list.js.map +7 -0
- package/dist/react-stat-grid.js +69 -0
- package/dist/react-stat-grid.js.map +7 -0
- package/dist/react-status-indicator.js +117 -0
- package/dist/react-status-indicator.js.map +7 -0
- package/dist/react-steps.js +167 -0
- package/dist/react-steps.js.map +7 -0
- package/dist/react-sticky-note.js +131 -0
- package/dist/react-sticky-note.js.map +7 -0
- package/dist/react-switch.js +139 -0
- package/dist/react-switch.js.map +7 -0
- package/dist/react-table-of-contents.js +80 -0
- package/dist/react-table-of-contents.js.map +7 -0
- package/dist/react-tabs.js +230 -0
- package/dist/react-tabs.js.map +7 -0
- package/dist/react-terminal.js +101 -0
- package/dist/react-terminal.js.map +7 -0
- package/dist/react-test-results.js +158 -0
- package/dist/react-test-results.js.map +7 -0
- package/dist/react-textarea.js +89 -0
- package/dist/react-textarea.js.map +7 -0
- package/dist/react-thread-view.js +139 -0
- package/dist/react-thread-view.js.map +7 -0
- package/dist/react-timeline.js +153 -0
- package/dist/react-timeline.js.map +7 -0
- package/dist/react-toast.js +253 -0
- package/dist/react-toast.js.map +7 -0
- package/dist/react-tooltip.js +221 -0
- package/dist/react-tooltip.js.map +7 -0
- package/dist/react-version-selector.js +270 -0
- package/dist/react-version-selector.js.map +7 -0
- package/dist/react-video-grid.js +129 -0
- package/dist/react-video-grid.js.map +7 -0
- package/dist/react-video-player.js +206 -0
- package/dist/react-video-player.js.map +7 -0
- package/dist/react-video-tile.js +8 -0
- package/dist/react-video-tile.js.map +7 -0
- package/dist/react-voice-pill.js +314 -0
- package/dist/react-voice-pill.js.map +7 -0
- package/dist/react-waveform.js +558 -0
- package/dist/react-waveform.js.map +7 -0
- package/dist/react-wizard.js +337 -0
- package/dist/react-wizard.js.map +7 -0
- package/dist/styles.css +7 -0
- package/dist/theme.js +1 -1
- package/package.json +3 -2
- package/dist/applicationinsights-web-H7OBLIVJ.js +0 -23393
- package/dist/applicationinsights-web-H7OBLIVJ.js.map +0 -1
- package/dist/chunk-4A4BW3GR.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/module-X3HTTRQK.js +0 -6438
- package/dist/module-X3HTTRQK.js.map +0 -1
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Slot
|
|
3
|
+
} from "./chunk-WSPJTQAV.js";
|
|
4
|
+
import {
|
|
5
|
+
cn
|
|
6
|
+
} from "./chunk-ZF3OHCGV.js";
|
|
7
|
+
|
|
8
|
+
// ../react-link-card/dist/index.js
|
|
9
|
+
import * as React from "react";
|
|
10
|
+
|
|
11
|
+
// ../link-card/dist/index.js
|
|
12
|
+
function createLinkCard(_props = {}) {
|
|
13
|
+
return {
|
|
14
|
+
dataAttributes: { "data-slot": "link-card" }
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
// ../react-link-card/dist/index.js
|
|
19
|
+
import { jsx } from "react/jsx-runtime";
|
|
20
|
+
var LinkCard = React.forwardRef(
|
|
21
|
+
function LinkCard2({ className, asChild = false, ...props }, ref) {
|
|
22
|
+
const api = createLinkCard(props);
|
|
23
|
+
if (asChild) {
|
|
24
|
+
return /* @__PURE__ */ jsx(
|
|
25
|
+
Slot,
|
|
26
|
+
{
|
|
27
|
+
ref,
|
|
28
|
+
className: cn(className),
|
|
29
|
+
...api.dataAttributes,
|
|
30
|
+
...props
|
|
31
|
+
}
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
return /* @__PURE__ */ jsx(
|
|
35
|
+
"a",
|
|
36
|
+
{
|
|
37
|
+
ref,
|
|
38
|
+
className: cn(className),
|
|
39
|
+
...api.dataAttributes,
|
|
40
|
+
...props
|
|
41
|
+
}
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
);
|
|
45
|
+
export {
|
|
46
|
+
LinkCard
|
|
47
|
+
};
|
|
48
|
+
//# sourceMappingURL=react-link-card.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../link-card/src/link-card.ts", "../../react-link-card/src/link-card.tsx"],
|
|
4
|
+
"sourcesContent": ["export interface LinkCardProps {\n href?: string\n}\n\nexport function createLinkCard(_props: LinkCardProps = {}) {\n return {\n dataAttributes: { 'data-slot': 'link-card' }\n }\n}", "import * as React from 'react'\nimport { createLinkCard } from '@refraction-ui/link-card'\nimport { cn } from '@refraction-ui/shared'\nimport { Slot } from '@refraction-ui/react-slot'\n\nexport interface LinkCardProps extends React.AnchorHTMLAttributes<HTMLAnchorElement> {\n /** Merge the link card's classes/props onto the single child element\n * instead of rendering an `<a>` (Radix-style `asChild`) — e.g. compose with\n * a router `<Link>`. Expects exactly one React element child. */\n asChild?: boolean\n}\n\nexport const LinkCard = React.forwardRef<HTMLAnchorElement, LinkCardProps>(\n function LinkCard({ className, asChild = false, ...props }, ref) {\n const api = createLinkCard(props)\n\n if (asChild) {\n return (\n <Slot\n ref={ref as React.Ref<HTMLElement>}\n className={cn(className)}\n {...api.dataAttributes}\n {...props}\n />\n )\n }\n\n return (\n <a\n ref={ref}\n className={cn(className)}\n {...api.dataAttributes}\n {...props}\n />\n )\n }\n)\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;AAIO,SAAS,eAAe,SAAwB,CAAA,GAAI;AACzD,SAAO;IACL,gBAAgB,EAAE,aAAa,YAAA;EAAY;AAE/C;;;;ACIO,IAAM,WAAiB;EAC5B,SAASA,UAAS,EAAE,WAAW,UAAU,OAAO,GAAG,MAAA,GAAS,KAAK;AAC/D,UAAM,MAAM,eAAe,KAAK;AAEhC,QAAI,SAAS;AACX,aACE;QAAC;QAAA;UACC;UACA,WAAW,GAAG,SAAS;UACtB,GAAG,IAAI;UACP,GAAG;QAAA;MAAA;IAGV;AAEA,WACE;MAAC;MAAA;QACC;QACA,WAAW,GAAG,SAAS;QACtB,GAAG,IAAI;QACP,GAAG;MAAA;IAAA;EAGV;AACF;",
|
|
6
|
+
"names": ["LinkCard"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import {
|
|
2
|
+
cn,
|
|
3
|
+
cva
|
|
4
|
+
} from "./chunk-ZF3OHCGV.js";
|
|
5
|
+
|
|
6
|
+
// ../react-live-captions/dist/index.js
|
|
7
|
+
import * as React from "react";
|
|
8
|
+
|
|
9
|
+
// ../live-captions/dist/index.js
|
|
10
|
+
function visibleCues(cues, maxLines = 2) {
|
|
11
|
+
if (maxLines <= 0) return [];
|
|
12
|
+
return cues.slice(-maxLines);
|
|
13
|
+
}
|
|
14
|
+
function createLiveCaptions() {
|
|
15
|
+
const ariaProps = {
|
|
16
|
+
role: "log",
|
|
17
|
+
"aria-live": "polite",
|
|
18
|
+
"aria-atomic": false
|
|
19
|
+
};
|
|
20
|
+
const dataAttributes = {
|
|
21
|
+
"data-component": "live-captions"
|
|
22
|
+
};
|
|
23
|
+
return { ariaProps, dataAttributes };
|
|
24
|
+
}
|
|
25
|
+
var liveCaptionsVariants = cva({
|
|
26
|
+
base: [
|
|
27
|
+
"relative mx-auto w-full max-w-2xl rounded-xl",
|
|
28
|
+
"bg-card/80 backdrop-blur-sm",
|
|
29
|
+
"px-4 py-3 space-y-1"
|
|
30
|
+
].join(" "),
|
|
31
|
+
variants: {
|
|
32
|
+
/** Controls how the container is positioned in the layout. */
|
|
33
|
+
position: {
|
|
34
|
+
/** Sits in normal document flow (default). */
|
|
35
|
+
static: "",
|
|
36
|
+
/** Absolutely positioned — consumer places it with inset utilities. */
|
|
37
|
+
absolute: "absolute"
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
defaultVariants: {
|
|
41
|
+
position: "static"
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
var liveCaptionsCueVariants = cva({
|
|
45
|
+
base: "text-sm leading-snug text-foreground",
|
|
46
|
+
variants: {
|
|
47
|
+
interim: {
|
|
48
|
+
true: "opacity-60 italic",
|
|
49
|
+
false: ""
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
defaultVariants: {
|
|
53
|
+
interim: "false"
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
var liveCaptionsSpeakerClass = "font-medium text-muted-foreground";
|
|
57
|
+
|
|
58
|
+
// ../react-live-captions/dist/index.js
|
|
59
|
+
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
60
|
+
var LiveCaptions = React.forwardRef(
|
|
61
|
+
function LiveCaptions2({ cues, maxLines = 2, position = "static", className, ...props }, ref) {
|
|
62
|
+
const { ariaProps, dataAttributes } = createLiveCaptions();
|
|
63
|
+
const shown = visibleCues(cues, maxLines);
|
|
64
|
+
return /* @__PURE__ */ jsx(
|
|
65
|
+
"div",
|
|
66
|
+
{
|
|
67
|
+
ref,
|
|
68
|
+
className: cn(liveCaptionsVariants({ position }), className),
|
|
69
|
+
...ariaProps,
|
|
70
|
+
...dataAttributes,
|
|
71
|
+
...props,
|
|
72
|
+
children: shown.map((cue) => /* @__PURE__ */ jsx(
|
|
73
|
+
"p",
|
|
74
|
+
{
|
|
75
|
+
className: liveCaptionsCueVariants({
|
|
76
|
+
interim: cue.final === false ? "true" : "false"
|
|
77
|
+
}),
|
|
78
|
+
children: cue.speaker ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
79
|
+
/* @__PURE__ */ jsx("span", { className: liveCaptionsSpeakerClass, children: cue.speaker }),
|
|
80
|
+
`: ${cue.text}`
|
|
81
|
+
] }) : cue.text
|
|
82
|
+
},
|
|
83
|
+
cue.id
|
|
84
|
+
))
|
|
85
|
+
}
|
|
86
|
+
);
|
|
87
|
+
}
|
|
88
|
+
);
|
|
89
|
+
export {
|
|
90
|
+
LiveCaptions
|
|
91
|
+
};
|
|
92
|
+
//# sourceMappingURL=react-live-captions.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../live-captions/src/live-captions.ts", "../../live-captions/src/live-captions.styles.ts", "../../react-live-captions/src/live-captions.tsx"],
|
|
4
|
+
"sourcesContent": ["/** A single caption cue — may be interim (non-final) while speech is in flight. */\nexport interface CaptionCue {\n /** Unique identifier for this cue. */\n id: string\n /** Speaker name, shown as a prefix when present. */\n speaker?: string\n /** The caption text. */\n text: string\n /** Whether this cue is finalised (true) or still being transcribed (false/absent). */\n final?: boolean\n}\n\n/**\n * Return the last `maxLines` cues to display in the caption overlay.\n * Preserves ordering (oldest first within the slice) so the overlay reads top-to-bottom.\n */\nexport function visibleCues(cues: CaptionCue[], maxLines = 2): CaptionCue[] {\n if (maxLines <= 0) return []\n return cues.slice(-maxLines)\n}\n\n/**\n * Format a single cue for display.\n * When `speaker` is present the result is `'Maya: the bottleneck is review capacity'`.\n * Without a speaker it is just the text.\n */\nexport function formatCue(cue: CaptionCue): string {\n return cue.speaker ? `${cue.speaker}: ${cue.text}` : cue.text\n}\n\nexport interface LiveCaptionsAPI {\n /** ARIA attributes to spread on the caption container element. */\n ariaProps: Record<string, string | number | boolean>\n /** Data attributes for styling hooks. */\n dataAttributes: Record<string, string>\n}\n\n/**\n * Build the framework-agnostic accessibility props for a live-caption overlay.\n *\n * Returns `role=\"log\"` with `aria-live=\"polite\"` and `aria-atomic=false` so\n * screen readers announce individual cues as they arrive without re-reading the\n * whole log. Adapters spread these onto the container element.\n */\nexport function createLiveCaptions(): LiveCaptionsAPI {\n const ariaProps: Record<string, string | number | boolean> = {\n role: 'log',\n 'aria-live': 'polite',\n 'aria-atomic': false,\n }\n\n const dataAttributes: Record<string, string> = {\n 'data-component': 'live-captions',\n }\n\n return { ariaProps, dataAttributes }\n}\n", "import { cva } from '@refraction-ui/shared'\n\n/**\n * Caption overlay container — an absolute-friendly, translucent dark surface\n * centred over its positioned ancestor (e.g. a video element).\n */\nexport const liveCaptionsVariants = cva({\n base: [\n 'relative mx-auto w-full max-w-2xl rounded-xl',\n 'bg-card/80 backdrop-blur-sm',\n 'px-4 py-3 space-y-1',\n ].join(' '),\n variants: {\n /** Controls how the container is positioned in the layout. */\n position: {\n /** Sits in normal document flow (default). */\n static: '',\n /** Absolutely positioned — consumer places it with inset utilities. */\n absolute: 'absolute',\n },\n },\n defaultVariants: {\n position: 'static',\n },\n})\n\n/**\n * A single cue line inside the overlay.\n * Non-final (interim) cues get a dimmed italic treatment to signal they may change.\n */\nexport const liveCaptionsCueVariants = cva({\n base: 'text-sm leading-snug text-foreground',\n variants: {\n interim: {\n true: 'opacity-60 italic',\n false: '',\n },\n },\n defaultVariants: {\n interim: 'false',\n },\n})\n\n/** Speaker-name prefix — rendered slightly muted to distinguish it from the speech text. */\nexport const liveCaptionsSpeakerClass = 'font-medium text-muted-foreground'\n", "import * as React from 'react'\nimport {\n visibleCues,\n createLiveCaptions,\n liveCaptionsVariants,\n liveCaptionsCueVariants,\n liveCaptionsSpeakerClass,\n type CaptionCue,\n} from '@refraction-ui/live-captions'\nimport { cn } from '@refraction-ui/shared'\n\nexport type { CaptionCue }\n\nexport interface LiveCaptionsProps\n extends Omit<React.HTMLAttributes<HTMLDivElement>, 'content' | 'color'> {\n /** The full ordered list of caption cues. */\n cues: CaptionCue[]\n /**\n * Maximum number of cue lines to display at once.\n * @default 2\n */\n maxLines?: number\n /**\n * How the container is positioned in the layout.\n * @default 'static'\n */\n position?: 'static' | 'absolute'\n}\n\n/**\n * LiveCaptions — a rolling caption overlay for meeting / video surfaces.\n *\n * Renders `role=\"log\"` with `aria-live=\"polite\"` so screen readers announce\n * incoming cues without replaying the full history. Only the last `maxLines`\n * cues are shown; non-final (interim) cues are rendered dimmed and italic.\n * Logic and styles come from the headless `@refraction-ui/live-captions` core.\n */\nexport const LiveCaptions = React.forwardRef<HTMLDivElement, LiveCaptionsProps>(\n function LiveCaptions({ cues, maxLines = 2, position = 'static', className, ...props }, ref) {\n const { ariaProps, dataAttributes } = createLiveCaptions()\n const shown = visibleCues(cues, maxLines)\n\n return (\n <div\n ref={ref}\n className={cn(liveCaptionsVariants({ position }), className)}\n {...ariaProps}\n {...dataAttributes}\n {...props}\n >\n {shown.map((cue) => (\n <p\n key={cue.id}\n className={liveCaptionsCueVariants({\n interim: cue.final === false ? 'true' : 'false',\n })}\n >\n {cue.speaker ? (\n <>\n <span className={liveCaptionsSpeakerClass}>{cue.speaker}</span>\n {`: ${cue.text}`}\n </>\n ) : (\n cue.text\n )}\n </p>\n ))}\n </div>\n )\n },\n)\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;AAgBO,SAAS,YAAY,MAAoB,WAAW,GAAiB;AAC1E,MAAI,YAAY,EAAG,QAAO,CAAA;AAC1B,SAAO,KAAK,MAAM,CAAC,QAAQ;AAC7B;AAyBO,SAAS,qBAAsC;AACpD,QAAM,YAAuD;IAC3D,MAAM;IACN,aAAa;IACb,eAAe;EAAA;AAGjB,QAAM,iBAAyC;IAC7C,kBAAkB;EAAA;AAGpB,SAAO,EAAE,WAAW,eAAA;AACtB;AClDO,IAAM,uBAAuB,IAAI;EACtC,MAAM;IACJ;IACA;IACA;EAAA,EACA,KAAK,GAAG;EACV,UAAU;;IAER,UAAU;;MAER,QAAQ;;MAER,UAAU;IAAA;EACZ;EAEF,iBAAiB;IACf,UAAU;EAAA;AAEd,CAAC;AAMM,IAAM,0BAA0B,IAAI;EACzC,MAAM;EACN,UAAU;IACR,SAAS;MACP,MAAM;MACN,OAAO;IAAA;EACT;EAEF,iBAAiB;IACf,SAAS;EAAA;AAEb,CAAC;AAGM,IAAM,2BAA2B;;;;ACPjC,IAAM,eAAqB;EAChC,SAASA,cAAa,EAAE,MAAM,WAAW,GAAG,WAAW,UAAU,WAAW,GAAG,MAAA,GAAS,KAAK;AAC3F,UAAM,EAAE,WAAW,eAAA,IAAmB,mBAAA;AACtC,UAAM,QAAQ,YAAY,MAAM,QAAQ;AAExC,WACE;MAAC;MAAA;QACC;QACA,WAAW,GAAG,qBAAqB,EAAE,SAAA,CAAU,GAAG,SAAS;QAC1D,GAAG;QACH,GAAG;QACH,GAAG;QAEH,UAAA,MAAM,IAAI,CAAC,QACV;UAAC;UAAA;YAEC,WAAW,wBAAwB;cACjC,SAAS,IAAI,UAAU,QAAQ,SAAS;YAAA,CACzC;YAEA,UAAA,IAAI,UACH,qBAAA,UAAA,EACE,UAAA;cAAA,oBAAC,QAAA,EAAK,WAAW,0BAA2B,UAAA,IAAI,QAAA,CAAQ;cACvD,KAAK,IAAI,IAAI;YAAA,EAAA,CAChB,IAEA,IAAI;UAAA;UAXD,IAAI;QAAA,CAcZ;MAAA;IAAA;EAGP;AACF;",
|
|
6
|
+
"names": ["LiveCaptions"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import {
|
|
2
|
+
cn,
|
|
3
|
+
cva
|
|
4
|
+
} from "./chunk-ZF3OHCGV.js";
|
|
5
|
+
|
|
6
|
+
// ../react-live-cursors/dist/index.js
|
|
7
|
+
import * as React from "react";
|
|
8
|
+
|
|
9
|
+
// ../live-cursors/dist/index.js
|
|
10
|
+
var CURSOR_COLORS = [
|
|
11
|
+
"#E94560",
|
|
12
|
+
// red
|
|
13
|
+
"#F57C00",
|
|
14
|
+
// orange
|
|
15
|
+
"#F9C840",
|
|
16
|
+
// yellow
|
|
17
|
+
"#4CAF50",
|
|
18
|
+
// green
|
|
19
|
+
"#00ACC1",
|
|
20
|
+
// cyan
|
|
21
|
+
"#5C6BC0",
|
|
22
|
+
// indigo
|
|
23
|
+
"#AB47BC",
|
|
24
|
+
// purple
|
|
25
|
+
"#EC407A"
|
|
26
|
+
// pink
|
|
27
|
+
];
|
|
28
|
+
function assignCursorColor(id, index) {
|
|
29
|
+
if (index !== void 0) {
|
|
30
|
+
return CURSOR_COLORS[index % CURSOR_COLORS.length];
|
|
31
|
+
}
|
|
32
|
+
let hash = 5381;
|
|
33
|
+
for (let i = 0; i < id.length; i++) {
|
|
34
|
+
hash = (hash << 5) + hash ^ id.charCodeAt(i);
|
|
35
|
+
hash = hash >>> 0;
|
|
36
|
+
}
|
|
37
|
+
return CURSOR_COLORS[hash % CURSOR_COLORS.length];
|
|
38
|
+
}
|
|
39
|
+
function createLiveCursors() {
|
|
40
|
+
const ariaProps = {
|
|
41
|
+
role: "group",
|
|
42
|
+
"aria-label": "Collaborators",
|
|
43
|
+
"aria-hidden": true
|
|
44
|
+
};
|
|
45
|
+
const dataAttributes = {
|
|
46
|
+
"data-live-cursors": ""
|
|
47
|
+
};
|
|
48
|
+
return { ariaProps, dataAttributes };
|
|
49
|
+
}
|
|
50
|
+
var liveCursorsVariants = cva({
|
|
51
|
+
base: "absolute inset-0 overflow-hidden pointer-events-none",
|
|
52
|
+
variants: {
|
|
53
|
+
/** Future variant hook — reserved for theming overrides. */
|
|
54
|
+
hidden: {
|
|
55
|
+
true: "invisible",
|
|
56
|
+
false: ""
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
defaultVariants: {
|
|
60
|
+
hidden: "false"
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
var cursorWrapperClass = "absolute flex flex-col items-start transition-[left,top] duration-100 ease-linear";
|
|
64
|
+
var cursorArrowClass = "h-5 w-5 drop-shadow-sm";
|
|
65
|
+
var cursorLabelClass = "mt-0.5 ml-2 rounded px-1.5 py-0.5 text-xs font-medium text-white shadow-sm whitespace-nowrap";
|
|
66
|
+
|
|
67
|
+
// ../react-live-cursors/dist/index.js
|
|
68
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
69
|
+
var Cursor = React.memo(function Cursor2({
|
|
70
|
+
name,
|
|
71
|
+
x,
|
|
72
|
+
y,
|
|
73
|
+
color
|
|
74
|
+
}) {
|
|
75
|
+
return /* @__PURE__ */ jsxs(
|
|
76
|
+
"div",
|
|
77
|
+
{
|
|
78
|
+
className: cursorWrapperClass,
|
|
79
|
+
style: { left: `${x}px`, top: `${y}px` },
|
|
80
|
+
"data-cursor-name": name,
|
|
81
|
+
children: [
|
|
82
|
+
/* @__PURE__ */ jsx(
|
|
83
|
+
"svg",
|
|
84
|
+
{
|
|
85
|
+
className: cursorArrowClass,
|
|
86
|
+
viewBox: "0 0 20 20",
|
|
87
|
+
fill: "none",
|
|
88
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
89
|
+
"aria-hidden": "true",
|
|
90
|
+
style: { fill: color },
|
|
91
|
+
children: /* @__PURE__ */ jsx(
|
|
92
|
+
"path",
|
|
93
|
+
{
|
|
94
|
+
d: "M3 2L17 9.5L10.5 11.5L8 18L3 2Z",
|
|
95
|
+
stroke: "white",
|
|
96
|
+
strokeWidth: "1.5",
|
|
97
|
+
strokeLinejoin: "round"
|
|
98
|
+
}
|
|
99
|
+
)
|
|
100
|
+
}
|
|
101
|
+
),
|
|
102
|
+
/* @__PURE__ */ jsx(
|
|
103
|
+
"span",
|
|
104
|
+
{
|
|
105
|
+
className: cursorLabelClass,
|
|
106
|
+
style: { backgroundColor: color },
|
|
107
|
+
children: name
|
|
108
|
+
}
|
|
109
|
+
)
|
|
110
|
+
]
|
|
111
|
+
}
|
|
112
|
+
);
|
|
113
|
+
});
|
|
114
|
+
var LiveCursors = React.forwardRef(
|
|
115
|
+
function LiveCursors2({ cursors, className, ...props }, ref) {
|
|
116
|
+
const api = createLiveCursors();
|
|
117
|
+
return /* @__PURE__ */ jsx(
|
|
118
|
+
"div",
|
|
119
|
+
{
|
|
120
|
+
ref,
|
|
121
|
+
className: cn(liveCursorsVariants(), className),
|
|
122
|
+
...api.ariaProps,
|
|
123
|
+
...api.dataAttributes,
|
|
124
|
+
...props,
|
|
125
|
+
children: cursors.map((cursor, index) => /* @__PURE__ */ jsx(
|
|
126
|
+
Cursor,
|
|
127
|
+
{
|
|
128
|
+
name: cursor.name,
|
|
129
|
+
x: cursor.x,
|
|
130
|
+
y: cursor.y,
|
|
131
|
+
color: cursor.color ?? assignCursorColor(cursor.id, index)
|
|
132
|
+
},
|
|
133
|
+
cursor.id
|
|
134
|
+
))
|
|
135
|
+
}
|
|
136
|
+
);
|
|
137
|
+
}
|
|
138
|
+
);
|
|
139
|
+
export {
|
|
140
|
+
CURSOR_COLORS,
|
|
141
|
+
Cursor,
|
|
142
|
+
LiveCursors,
|
|
143
|
+
assignCursorColor
|
|
144
|
+
};
|
|
145
|
+
//# sourceMappingURL=react-live-cursors.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../live-cursors/src/live-cursors.ts", "../../live-cursors/src/live-cursors.styles.ts", "../../react-live-cursors/src/live-cursors.tsx"],
|
|
4
|
+
"sourcesContent": ["/** Data for a single collaborator cursor. */\nexport type CursorData = {\n id: string\n name: string\n x: number\n y: number\n color?: string\n}\n\n/**\n * A fixed palette of 8 hex colors for distinguishing collaborator cursors.\n * Each color is vivid enough to be visible against both light and dark surfaces.\n */\nexport const CURSOR_COLORS: string[] = [\n '#E94560', // red\n '#F57C00', // orange\n '#F9C840', // yellow\n '#4CAF50', // green\n '#00ACC1', // cyan\n '#5C6BC0', // indigo\n '#AB47BC', // purple\n '#EC407A', // pink\n]\n\n/**\n * Assign a stable color to a cursor.\n *\n * When `index` is supplied the color is simply `CURSOR_COLORS[index % length]`\n * (deterministic for ordered participant lists). Otherwise a lightweight\n * djb2-style hash of the `id` string is used so the same id always maps to the\n * same color across renders without using Math.random or Date.now.\n */\nexport function assignCursorColor(id: string, index?: number): string {\n if (index !== undefined) {\n return CURSOR_COLORS[index % CURSOR_COLORS.length]\n }\n\n // djb2 hash — deterministic, no side-effects\n let hash = 5381\n for (let i = 0; i < id.length; i++) {\n hash = ((hash << 5) + hash) ^ id.charCodeAt(i)\n hash = hash >>> 0 // keep unsigned 32-bit\n }\n return CURSOR_COLORS[hash % CURSOR_COLORS.length]\n}\n\nexport interface LiveCursorsAPI {\n /** ARIA attributes to spread on the overlay container. */\n ariaProps: Record<string, string | number | boolean>\n /** Data attributes for styling hooks. */\n dataAttributes: Record<string, string>\n}\n\n/**\n * Build the framework-agnostic props for the live-cursors overlay.\n *\n * Cursors are purely decorative real-time presence indicators — aria-hidden\n * true keeps them out of the accessibility tree. The group role is present for\n * semantic correctness should a developer choose to un-hide it.\n */\nexport function createLiveCursors(): LiveCursorsAPI {\n const ariaProps: Record<string, string | number | boolean> = {\n role: 'group',\n 'aria-label': 'Collaborators',\n 'aria-hidden': true,\n }\n\n const dataAttributes: Record<string, string> = {\n 'data-live-cursors': '',\n }\n\n return { ariaProps, dataAttributes }\n}\n", "import { cva } from '@refraction-ui/shared'\n\n/**\n * Full-bleed overlay that contains all cursor elements.\n * `pointer-events-none` and `overflow-hidden` ensure cursors are decorative\n * and don't interfere with the underlying canvas interactions.\n */\nexport const liveCursorsVariants = cva({\n base: 'absolute inset-0 overflow-hidden pointer-events-none',\n variants: {\n /** Future variant hook — reserved for theming overrides. */\n hidden: {\n true: 'invisible',\n false: '',\n },\n },\n defaultVariants: {\n hidden: 'false',\n },\n})\n\n/**\n * Wrapper for a single cursor (SVG + label). Absolutely positioned via inline\n * `left`/`top` style; the transition provides smooth movement when coordinates\n * update.\n */\nexport const cursorWrapperClass =\n 'absolute flex flex-col items-start transition-[left,top] duration-100 ease-linear'\n\n/**\n * The SVG cursor arrow container. Fill is applied via inline style (per\n * collaborator color) so no utility class is needed here.\n */\nexport const cursorArrowClass = 'h-5 w-5 drop-shadow-sm'\n\n/**\n * Name-label chip that appears below the cursor arrow. Background is applied\n * via inline style (per collaborator color); text is always white for contrast.\n */\nexport const cursorLabelClass =\n 'mt-0.5 ml-2 rounded px-1.5 py-0.5 text-xs font-medium text-white shadow-sm whitespace-nowrap'\n", "import * as React from 'react'\nimport {\n createLiveCursors,\n assignCursorColor,\n liveCursorsVariants,\n cursorWrapperClass,\n cursorArrowClass,\n cursorLabelClass,\n type CursorData,\n} from '@refraction-ui/live-cursors'\nimport { cn } from '@refraction-ui/shared'\n\nexport type { CursorData }\n\nexport interface CursorProps {\n /** Collaborator display name shown in the label chip. */\n name: string\n /** Horizontal position in pixels from the left of the container. */\n x: number\n /** Vertical position in pixels from the top of the container. */\n y: number\n /** Hex color applied to both the SVG arrow and the label chip. */\n color: string\n}\n\n/**\n * Cursor — a single labeled collaborator cursor (SVG arrow + name chip).\n *\n * Positioned absolutely via inline `left`/`top` style so it can be placed\n * anywhere within its containing overlay. Color is applied via inline style\n * (not a utility class) so each collaborator gets a unique hue without\n * generating a CSS class per color.\n */\nexport const Cursor = React.memo(function Cursor({\n name,\n x,\n y,\n color,\n}: CursorProps) {\n return (\n <div\n className={cursorWrapperClass}\n style={{ left: `${x}px`, top: `${y}px` }}\n data-cursor-name={name}\n >\n {/* SVG cursor arrow — fill via inline style for per-user color */}\n <svg\n className={cursorArrowClass}\n viewBox=\"0 0 20 20\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n aria-hidden=\"true\"\n style={{ fill: color }}\n >\n <path\n d=\"M3 2L17 9.5L10.5 11.5L8 18L3 2Z\"\n stroke=\"white\"\n strokeWidth=\"1.5\"\n strokeLinejoin=\"round\"\n />\n </svg>\n {/* Name label chip */}\n <span\n className={cursorLabelClass}\n style={{ backgroundColor: color }}\n >\n {name}\n </span>\n </div>\n )\n})\n\nexport interface LiveCursorsProps\n extends Omit<React.HTMLAttributes<HTMLDivElement>, 'color' | 'content'> {\n /** Array of collaborator cursor data to render. */\n cursors: CursorData[]\n}\n\n/**\n * LiveCursors — an absolutely-positioned overlay that renders one `<Cursor>`\n * per collaborator.\n *\n * Drop this as a direct child of a `position: relative` container (e.g. a\n * canvas or whiteboard surface). It fills the container via `absolute inset-0`\n * and is `pointer-events-none` so it never blocks interaction.\n *\n * Colors are resolved via `assignCursorColor` when a cursor entry has no\n * explicit `color`. The overlay is marked `aria-hidden` — cursors are\n * decorative presence indicators, not interactive elements.\n */\nexport const LiveCursors = React.forwardRef<HTMLDivElement, LiveCursorsProps>(\n function LiveCursors({ cursors, className, ...props }, ref) {\n const api = createLiveCursors()\n\n return (\n <div\n ref={ref}\n className={cn(liveCursorsVariants(), className)}\n {...api.ariaProps}\n {...api.dataAttributes}\n {...props}\n >\n {cursors.map((cursor, index) => (\n <Cursor\n key={cursor.id}\n name={cursor.name}\n x={cursor.x}\n y={cursor.y}\n color={cursor.color ?? assignCursorColor(cursor.id, index)}\n />\n ))}\n </div>\n )\n },\n)\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;AAaO,IAAM,gBAA0B;EACrC;;EACA;;EACA;;EACA;;EACA;;EACA;;EACA;;EACA;;AACF;AAUO,SAAS,kBAAkB,IAAY,OAAwB;AACpE,MAAI,UAAU,QAAW;AACvB,WAAO,cAAc,QAAQ,cAAc,MAAM;EACnD;AAGA,MAAI,OAAO;AACX,WAAS,IAAI,GAAG,IAAI,GAAG,QAAQ,KAAK;AAClC,YAAS,QAAQ,KAAK,OAAQ,GAAG,WAAW,CAAC;AAC7C,WAAO,SAAS;EAClB;AACA,SAAO,cAAc,OAAO,cAAc,MAAM;AAClD;AAgBO,SAAS,oBAAoC;AAClD,QAAM,YAAuD;IAC3D,MAAM;IACN,cAAc;IACd,eAAe;EAAA;AAGjB,QAAM,iBAAyC;IAC7C,qBAAqB;EAAA;AAGvB,SAAO,EAAE,WAAW,eAAA;AACtB;ACjEO,IAAM,sBAAsB,IAAI;EACrC,MAAM;EACN,UAAU;;IAER,QAAQ;MACN,MAAM;MACN,OAAO;IAAA;EACT;EAEF,iBAAiB;IACf,QAAQ;EAAA;AAEZ,CAAC;AAOM,IAAM,qBACX;AAMK,IAAM,mBAAmB;AAMzB,IAAM,mBACX;;;;ACPK,IAAM,SAAe,WAAK,SAASA,QAAO;EAC/C;EACA;EACA;EACA;AACF,GAAgB;AACd,SACE;IAAC;IAAA;MACC,WAAW;MACX,OAAO,EAAE,MAAM,GAAG,CAAC,MAAM,KAAK,GAAG,CAAC,KAAA;MAClC,oBAAkB;MAGlB,UAAA;QAAA;UAAC;UAAA;YACC,WAAW;YACX,SAAQ;YACR,MAAK;YACL,OAAM;YACN,eAAY;YACZ,OAAO,EAAE,MAAM,MAAA;YAEf,UAAA;cAAC;cAAA;gBACC,GAAE;gBACF,QAAO;gBACP,aAAY;gBACZ,gBAAe;cAAA;YAAA;UACjB;QAAA;QAGF;UAAC;UAAA;YACC,WAAW;YACX,OAAO,EAAE,iBAAiB,MAAA;YAEzB,UAAA;UAAA;QAAA;MACH;IAAA;EAAA;AAGN,CAAC;AAoBM,IAAM,cAAoB;EAC/B,SAASC,aAAY,EAAE,SAAS,WAAW,GAAG,MAAA,GAAS,KAAK;AAC1D,UAAM,MAAM,kBAAA;AAEZ,WACE;MAAC;MAAA;QACC;QACA,WAAW,GAAG,oBAAA,GAAuB,SAAS;QAC7C,GAAG,IAAI;QACP,GAAG,IAAI;QACP,GAAG;QAEH,UAAA,QAAQ,IAAI,CAAC,QAAQ,UACpB;UAAC;UAAA;YAEC,MAAM,OAAO;YACb,GAAG,OAAO;YACV,GAAG,OAAO;YACV,OAAO,OAAO,SAAS,kBAAkB,OAAO,IAAI,KAAK;UAAA;UAJpD,OAAO;QAAA,CAMf;MAAA;IAAA;EAGP;AACF;",
|
|
6
|
+
"names": ["Cursor", "LiveCursors"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import {
|
|
2
|
+
cn,
|
|
3
|
+
cva
|
|
4
|
+
} from "./chunk-ZF3OHCGV.js";
|
|
5
|
+
|
|
6
|
+
// ../react-live-transcript/dist/index.js
|
|
7
|
+
import * as React from "react";
|
|
8
|
+
|
|
9
|
+
// ../live-transcript/dist/index.js
|
|
10
|
+
function groupConsecutiveBySpeaker(entries) {
|
|
11
|
+
const blocks = [];
|
|
12
|
+
for (const entry of entries) {
|
|
13
|
+
const last = blocks[blocks.length - 1];
|
|
14
|
+
if (last && last.speaker === entry.speaker) {
|
|
15
|
+
last.texts.push(entry.text);
|
|
16
|
+
} else {
|
|
17
|
+
blocks.push({
|
|
18
|
+
speaker: entry.speaker,
|
|
19
|
+
timestamp: entry.timestamp,
|
|
20
|
+
speakerColor: entry.speakerColor,
|
|
21
|
+
texts: [entry.text]
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
return blocks;
|
|
26
|
+
}
|
|
27
|
+
function createLiveTranscript() {
|
|
28
|
+
const ariaProps = {
|
|
29
|
+
role: "log",
|
|
30
|
+
"aria-live": "polite"
|
|
31
|
+
};
|
|
32
|
+
const dataAttributes = {
|
|
33
|
+
"data-component": "live-transcript"
|
|
34
|
+
};
|
|
35
|
+
return { ariaProps, dataAttributes };
|
|
36
|
+
}
|
|
37
|
+
var liveTranscriptVariants = cva({
|
|
38
|
+
base: "flex flex-col overflow-y-auto p-4 gap-4",
|
|
39
|
+
variants: {
|
|
40
|
+
compact: {
|
|
41
|
+
true: "gap-2 p-3",
|
|
42
|
+
false: ""
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
defaultVariants: {
|
|
46
|
+
compact: "false"
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
var transcriptBlockVariants = cva({
|
|
50
|
+
base: "flex flex-col gap-1",
|
|
51
|
+
variants: {
|
|
52
|
+
compact: {
|
|
53
|
+
true: "gap-0.5",
|
|
54
|
+
false: ""
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
defaultVariants: {
|
|
58
|
+
compact: "false"
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
var transcriptSpeakerRowClass = "flex items-baseline gap-2";
|
|
62
|
+
var transcriptSpeakerNameClass = "text-sm font-semibold text-foreground leading-snug";
|
|
63
|
+
var transcriptTimestampClass = "text-xs text-muted-foreground tabular-nums";
|
|
64
|
+
var transcriptTextLineClass = "text-sm text-foreground/80 leading-relaxed";
|
|
65
|
+
|
|
66
|
+
// ../react-live-transcript/dist/index.js
|
|
67
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
68
|
+
var LiveTranscript = React.forwardRef(function LiveTranscript2({ entries, compact = false, className, ...props }, ref) {
|
|
69
|
+
const api = createLiveTranscript();
|
|
70
|
+
const blocks = React.useMemo(
|
|
71
|
+
() => groupConsecutiveBySpeaker(entries),
|
|
72
|
+
[entries]
|
|
73
|
+
);
|
|
74
|
+
const compactVariant = compact ? "true" : "false";
|
|
75
|
+
return /* @__PURE__ */ jsx(
|
|
76
|
+
"div",
|
|
77
|
+
{
|
|
78
|
+
ref,
|
|
79
|
+
className: cn(liveTranscriptVariants({ compact: compactVariant }), className),
|
|
80
|
+
...api.ariaProps,
|
|
81
|
+
...api.dataAttributes,
|
|
82
|
+
...props,
|
|
83
|
+
children: blocks.map((block, blockIndex) => /* @__PURE__ */ jsxs(
|
|
84
|
+
"div",
|
|
85
|
+
{
|
|
86
|
+
className: transcriptBlockVariants({ compact: compactVariant }),
|
|
87
|
+
children: [
|
|
88
|
+
/* @__PURE__ */ jsxs("div", { className: transcriptSpeakerRowClass, children: [
|
|
89
|
+
/* @__PURE__ */ jsx(
|
|
90
|
+
"span",
|
|
91
|
+
{
|
|
92
|
+
className: transcriptSpeakerNameClass,
|
|
93
|
+
style: block.speakerColor ? { color: block.speakerColor } : void 0,
|
|
94
|
+
children: block.speaker
|
|
95
|
+
}
|
|
96
|
+
),
|
|
97
|
+
block.timestamp && /* @__PURE__ */ jsx("span", { className: transcriptTimestampClass, children: block.timestamp })
|
|
98
|
+
] }),
|
|
99
|
+
block.texts.map((text, textIndex) => /* @__PURE__ */ jsx(
|
|
100
|
+
"p",
|
|
101
|
+
{
|
|
102
|
+
className: transcriptTextLineClass,
|
|
103
|
+
children: text
|
|
104
|
+
},
|
|
105
|
+
textIndex
|
|
106
|
+
))
|
|
107
|
+
]
|
|
108
|
+
},
|
|
109
|
+
`${block.speaker}-${blockIndex}`
|
|
110
|
+
))
|
|
111
|
+
}
|
|
112
|
+
);
|
|
113
|
+
});
|
|
114
|
+
export {
|
|
115
|
+
LiveTranscript
|
|
116
|
+
};
|
|
117
|
+
//# sourceMappingURL=react-live-transcript.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../live-transcript/src/live-transcript.ts", "../../live-transcript/src/live-transcript.styles.ts", "../../react-live-transcript/src/live-transcript.tsx"],
|
|
4
|
+
"sourcesContent": ["/** A single transcript entry from one speaker at a point in time. */\nexport interface TranscriptEntry {\n /** Unique identifier for this entry. */\n id: string\n /** Display name of the speaker. */\n speaker: string\n /** The spoken text. */\n text: string\n /** Optional formatted timestamp string (e.g. \"0:42\"). */\n timestamp?: string\n /** Optional CSS color for the speaker's name (e.g. \"#3b82f6\"). */\n speakerColor?: string\n}\n\n/** A merged block of consecutive entries from the same speaker. */\nexport interface TranscriptBlock {\n /** Speaker display name. */\n speaker: string\n /** Timestamp of the first entry in the run (if present). */\n timestamp?: string\n /** Optional CSS color for the speaker name. */\n speakerColor?: string\n /** All text segments from the consecutive run, in order. */\n texts: string[]\n}\n\n/**\n * Merge consecutive `TranscriptEntry` items from the same speaker into\n * `TranscriptBlock` objects. A new block is started whenever the speaker\n * changes; the block uses the timestamp of the *first* entry in that run.\n */\nexport function groupConsecutiveBySpeaker(\n entries: TranscriptEntry[],\n): TranscriptBlock[] {\n const blocks: TranscriptBlock[] = []\n\n for (const entry of entries) {\n const last = blocks[blocks.length - 1]\n if (last && last.speaker === entry.speaker) {\n last.texts.push(entry.text)\n } else {\n blocks.push({\n speaker: entry.speaker,\n timestamp: entry.timestamp,\n speakerColor: entry.speakerColor,\n texts: [entry.text],\n })\n }\n }\n\n return blocks\n}\n\nexport interface LiveTranscriptAPI {\n /**\n * ARIA attributes to spread on the scroll container.\n * Typed as a plain record so frameworks can spread without fighting their\n * aria-* type narrowing.\n */\n ariaProps: Record<string, string | number | boolean>\n /** Data attributes for styling hooks. */\n dataAttributes: Record<string, string>\n}\n\n/**\n * Build the framework-agnostic container props for a live transcript panel.\n *\n * Returns `role=\"log\"` and `aria-live=\"polite\"` so screen readers announce\n * new transcript entries without interrupting the user.\n */\nexport function createLiveTranscript(): LiveTranscriptAPI {\n const ariaProps: Record<string, string | number | boolean> = {\n role: 'log',\n 'aria-live': 'polite',\n }\n\n const dataAttributes: Record<string, string> = {\n 'data-component': 'live-transcript',\n }\n\n return { ariaProps, dataAttributes }\n}\n", "import { cva } from '@refraction-ui/shared'\n\n/**\n * Scroll container that wraps all speaker blocks.\n * The `compact` variant tightens the gap between blocks.\n */\nexport const liveTranscriptVariants = cva({\n base: 'flex flex-col overflow-y-auto p-4 gap-4',\n variants: {\n compact: {\n true: 'gap-2 p-3',\n false: '',\n },\n },\n defaultVariants: {\n compact: 'false',\n },\n})\n\n/** A single grouped speaker block (header + text lines). */\nexport const transcriptBlockVariants = cva({\n base: 'flex flex-col gap-1',\n variants: {\n compact: {\n true: 'gap-0.5',\n false: '',\n },\n },\n defaultVariants: {\n compact: 'false',\n },\n})\n\n/** The row containing the speaker name and optional timestamp. */\nexport const transcriptSpeakerRowClass =\n 'flex items-baseline gap-2'\n\n/** Speaker name badge / label. */\nexport const transcriptSpeakerNameClass =\n 'text-sm font-semibold text-foreground leading-snug'\n\n/** Timestamp displayed beside the speaker name. */\nexport const transcriptTimestampClass =\n 'text-xs text-muted-foreground tabular-nums'\n\n/** A single line of transcript text. */\nexport const transcriptTextLineClass =\n 'text-sm text-foreground/80 leading-relaxed'\n", "import * as React from 'react'\nimport {\n createLiveTranscript,\n groupConsecutiveBySpeaker,\n liveTranscriptVariants,\n transcriptBlockVariants,\n transcriptSpeakerRowClass,\n transcriptSpeakerNameClass,\n transcriptTimestampClass,\n transcriptTextLineClass,\n type TranscriptEntry,\n} from '@refraction-ui/live-transcript'\nimport { cn } from '@refraction-ui/shared'\n\nexport type { TranscriptEntry }\n\nexport interface LiveTranscriptProps\n extends Omit<React.HTMLAttributes<HTMLDivElement>, 'content' | 'color'> {\n /** The ordered list of transcript entries to display. */\n entries: TranscriptEntry[]\n /** Tightens spacing between speaker blocks. */\n compact?: boolean\n}\n\n/**\n * LiveTranscript — a speaker-attributed transcript panel for audio rooms and\n * meetings.\n *\n * Consecutive entries from the same speaker are merged into a single block\n * (one speaker header followed by all their text lines) so the panel stays\n * readable. The container carries `role=\"log\"` and `aria-live=\"polite\"` so\n * screen readers announce new entries without interrupting the user.\n */\nexport const LiveTranscript = React.forwardRef<\n HTMLDivElement,\n LiveTranscriptProps\n>(function LiveTranscript({ entries, compact = false, className, ...props }, ref) {\n const api = createLiveTranscript()\n const blocks = React.useMemo(\n () => groupConsecutiveBySpeaker(entries),\n [entries],\n )\n const compactVariant = compact ? 'true' : 'false'\n\n return (\n <div\n ref={ref}\n className={cn(liveTranscriptVariants({ compact: compactVariant }), className)}\n {...api.ariaProps}\n {...api.dataAttributes}\n {...props}\n >\n {blocks.map((block, blockIndex) => (\n <div\n key={`${block.speaker}-${blockIndex}`}\n className={transcriptBlockVariants({ compact: compactVariant })}\n >\n <div className={transcriptSpeakerRowClass}>\n <span\n className={transcriptSpeakerNameClass}\n style={block.speakerColor ? { color: block.speakerColor } : undefined}\n >\n {block.speaker}\n </span>\n {block.timestamp && (\n <span className={transcriptTimestampClass}>{block.timestamp}</span>\n )}\n </div>\n {block.texts.map((text, textIndex) => (\n <p\n key={textIndex}\n className={transcriptTextLineClass}\n >\n {text}\n </p>\n ))}\n </div>\n ))}\n </div>\n )\n})\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;AA+BO,SAAS,0BACd,SACmB;AACnB,QAAM,SAA4B,CAAA;AAElC,aAAW,SAAS,SAAS;AAC3B,UAAM,OAAO,OAAO,OAAO,SAAS,CAAC;AACrC,QAAI,QAAQ,KAAK,YAAY,MAAM,SAAS;AAC1C,WAAK,MAAM,KAAK,MAAM,IAAI;IAC5B,OAAO;AACL,aAAO,KAAK;QACV,SAAS,MAAM;QACf,WAAW,MAAM;QACjB,cAAc,MAAM;QACpB,OAAO,CAAC,MAAM,IAAI;MAAA,CACnB;IACH;EACF;AAEA,SAAO;AACT;AAmBO,SAAS,uBAA0C;AACxD,QAAM,YAAuD;IAC3D,MAAM;IACN,aAAa;EAAA;AAGf,QAAM,iBAAyC;IAC7C,kBAAkB;EAAA;AAGpB,SAAO,EAAE,WAAW,eAAA;AACtB;AC3EO,IAAM,yBAAyB,IAAI;EACxC,MAAM;EACN,UAAU;IACR,SAAS;MACP,MAAM;MACN,OAAO;IAAA;EACT;EAEF,iBAAiB;IACf,SAAS;EAAA;AAEb,CAAC;AAGM,IAAM,0BAA0B,IAAI;EACzC,MAAM;EACN,UAAU;IACR,SAAS;MACP,MAAM;MACN,OAAO;IAAA;EACT;EAEF,iBAAiB;IACf,SAAS;EAAA;AAEb,CAAC;AAGM,IAAM,4BACX;AAGK,IAAM,6BACX;AAGK,IAAM,2BACX;AAGK,IAAM,0BACX;;;;ACdK,IAAM,iBAAuB,iBAGlC,SAASA,gBAAe,EAAE,SAAS,UAAU,OAAO,WAAW,GAAG,MAAA,GAAS,KAAK;AAChF,QAAM,MAAM,qBAAA;AACZ,QAAM,SAAe;IACnB,MAAM,0BAA0B,OAAO;IACvC,CAAC,OAAO;EAAA;AAEV,QAAM,iBAAiB,UAAU,SAAS;AAE1C,SACE;IAAC;IAAA;MACC;MACA,WAAW,GAAG,uBAAuB,EAAE,SAAS,eAAA,CAAgB,GAAG,SAAS;MAC3E,GAAG,IAAI;MACP,GAAG,IAAI;MACP,GAAG;MAEH,UAAA,OAAO,IAAI,CAAC,OAAO,eAClB;QAAC;QAAA;UAEC,WAAW,wBAAwB,EAAE,SAAS,eAAA,CAAgB;UAE9D,UAAA;YAAA,qBAAC,OAAA,EAAI,WAAW,2BACd,UAAA;cAAA;gBAAC;gBAAA;kBACC,WAAW;kBACX,OAAO,MAAM,eAAe,EAAE,OAAO,MAAM,aAAA,IAAiB;kBAE3D,UAAA,MAAM;gBAAA;cAAA;cAER,MAAM,aACL,oBAAC,QAAA,EAAK,WAAW,0BAA2B,UAAA,MAAM,UAAA,CAAU;YAAA,EAAA,CAEhE;YACC,MAAM,MAAM,IAAI,CAAC,MAAM,cACtB;cAAC;cAAA;gBAEC,WAAW;gBAEV,UAAA;cAAA;cAHI;YAAA,CAKR;UAAA;QAAA;QArBI,GAAG,MAAM,OAAO,IAAI,UAAU;MAAA,CAuBtC;IAAA;EAAA;AAGP,CAAC;",
|
|
6
|
+
"names": ["LiveTranscript"]
|
|
7
|
+
}
|