@contui/ui 0.0.0-stage → 0.1.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/LICENSE +30 -0
- package/README.md +150 -2
- package/cli/contui.mjs +250 -0
- package/dist/charts/area-chart.d.ts +8 -0
- package/dist/charts/area-chart.js +9 -0
- package/dist/charts/bar-chart.d.ts +9 -0
- package/dist/charts/bar-chart.js +10 -0
- package/dist/charts/bubble-chart.d.ts +60 -0
- package/dist/charts/bubble-chart.js +392 -0
- package/dist/charts/bullet-chart.d.ts +53 -0
- package/dist/charts/bullet-chart.js +123 -0
- package/dist/charts/candlestick-chart.d.ts +77 -0
- package/dist/charts/candlestick-chart.js +558 -0
- package/dist/charts/cartesian.d.ts +121 -0
- package/dist/charts/cartesian.js +625 -0
- package/dist/charts/chart-card.d.ts +80 -0
- package/dist/charts/chart-card.js +114 -0
- package/dist/charts/donut-chart.d.ts +40 -0
- package/dist/charts/donut-chart.js +88 -0
- package/dist/charts/funnel-chart.d.ts +16 -0
- package/dist/charts/funnel-chart.js +164 -0
- package/dist/charts/horizontal-bar-chart.d.ts +67 -0
- package/dist/charts/horizontal-bar-chart.js +481 -0
- package/dist/charts/index.d.ts +21 -0
- package/dist/charts/index.js +32 -0
- package/dist/charts/legend.d.ts +23 -0
- package/dist/charts/legend.js +22 -0
- package/dist/charts/lib/candlestick-window.d.ts +15 -0
- package/dist/charts/lib/candlestick-window.js +23 -0
- package/dist/charts/lib/color.d.ts +39 -0
- package/dist/charts/lib/color.js +83 -0
- package/dist/charts/lib/format.d.ts +11 -0
- package/dist/charts/lib/format.js +33 -0
- package/dist/charts/lib/frame.d.ts +6 -0
- package/dist/charts/lib/frame.js +6 -0
- package/dist/charts/lib/layout.d.ts +11 -0
- package/dist/charts/lib/layout.js +71 -0
- package/dist/charts/lib/path.d.ts +35 -0
- package/dist/charts/lib/path.js +203 -0
- package/dist/charts/lib/scale.d.ts +41 -0
- package/dist/charts/lib/scale.js +80 -0
- package/dist/charts/lib/use-active.d.ts +18 -0
- package/dist/charts/lib/use-active.js +71 -0
- package/dist/charts/lib/use-size.d.ts +9 -0
- package/dist/charts/lib/use-size.js +40 -0
- package/dist/charts/line-chart.d.ts +7 -0
- package/dist/charts/line-chart.js +8 -0
- package/dist/charts/radar-chart.d.ts +27 -0
- package/dist/charts/radar-chart.js +165 -0
- package/dist/charts/rose-chart.d.ts +35 -0
- package/dist/charts/rose-chart.js +242 -0
- package/dist/charts/sparkline.d.ts +35 -0
- package/dist/charts/sparkline.js +110 -0
- package/dist/charts/tooltip.d.ts +35 -0
- package/dist/charts/tooltip.js +22 -0
- package/dist/charts/treemap.d.ts +28 -0
- package/dist/charts/treemap.js +103 -0
- package/dist/charts/uptime-strip.d.ts +40 -0
- package/dist/charts/uptime-strip.js +178 -0
- package/dist/components/accordion.d.ts +31 -0
- package/dist/components/accordion.js +34 -0
- package/dist/components/activity-item.d.ts +12 -0
- package/dist/components/activity-item.js +6 -0
- package/dist/components/alert.d.ts +21 -0
- package/dist/components/alert.js +58 -0
- package/dist/components/assistant-answer.d.ts +52 -0
- package/dist/components/assistant-answer.js +40 -0
- package/dist/components/assistant-prompt.d.ts +63 -0
- package/dist/components/assistant-prompt.js +122 -0
- package/dist/components/avatar.d.ts +28 -0
- package/dist/components/avatar.js +75 -0
- package/dist/components/badge.d.ts +16 -0
- package/dist/components/badge.js +33 -0
- package/dist/components/bar-list.d.ts +65 -0
- package/dist/components/bar-list.js +119 -0
- package/dist/components/block-slider.d.ts +43 -0
- package/dist/components/block-slider.js +63 -0
- package/dist/components/branch-graph.d.ts +87 -0
- package/dist/components/branch-graph.js +231 -0
- package/dist/components/breadcrumb.d.ts +41 -0
- package/dist/components/breadcrumb.js +53 -0
- package/dist/components/button.d.ts +23 -0
- package/dist/components/button.js +108 -0
- package/dist/components/calendar.d.ts +5 -0
- package/dist/components/calendar.js +90 -0
- package/dist/components/card.d.ts +65 -0
- package/dist/components/card.js +104 -0
- package/dist/components/chat-attachment.d.ts +47 -0
- package/dist/components/chat-attachment.js +63 -0
- package/dist/components/chat-event.d.ts +7 -0
- package/dist/components/chat-event.js +7 -0
- package/dist/components/chat-message.d.ts +59 -0
- package/dist/components/chat-message.js +91 -0
- package/dist/components/chat-reference.d.ts +20 -0
- package/dist/components/chat-reference.js +41 -0
- package/dist/components/chat-shared.d.ts +21 -0
- package/dist/components/chat-shared.js +23 -0
- package/dist/components/chat-suggestions.d.ts +59 -0
- package/dist/components/chat-suggestions.js +88 -0
- package/dist/components/chat-thread.d.ts +39 -0
- package/dist/components/chat-thread.js +172 -0
- package/dist/components/chat-typing.d.ts +35 -0
- package/dist/components/chat-typing.js +66 -0
- package/dist/components/checkbox.d.ts +18 -0
- package/dist/components/checkbox.js +33 -0
- package/dist/components/checklist.d.ts +26 -0
- package/dist/components/checklist.js +18 -0
- package/dist/components/chip.d.ts +29 -0
- package/dist/components/chip.js +61 -0
- package/dist/components/code-input.d.ts +40 -0
- package/dist/components/code-input.js +285 -0
- package/dist/components/color-picker.d.ts +38 -0
- package/dist/components/color-picker.js +855 -0
- package/dist/components/combobox.d.ts +75 -0
- package/dist/components/combobox.js +112 -0
- package/dist/components/command-menu.d.ts +58 -0
- package/dist/components/command-menu.js +166 -0
- package/dist/components/copy-button.d.ts +16 -0
- package/dist/components/copy-button.js +31 -0
- package/dist/components/data-grid.d.ts +50 -0
- package/dist/components/data-grid.js +599 -0
- package/dist/components/date-picker.d.ts +109 -0
- package/dist/components/date-picker.js +268 -0
- package/dist/components/description-list.d.ts +12 -0
- package/dist/components/description-list.js +10 -0
- package/dist/components/dialog.d.ts +57 -0
- package/dist/components/dialog.js +140 -0
- package/dist/components/dock.d.ts +45 -0
- package/dist/components/dock.js +79 -0
- package/dist/components/drop-zone.d.ts +46 -0
- package/dist/components/drop-zone.js +101 -0
- package/dist/components/dropdown-menu.d.ts +50 -0
- package/dist/components/dropdown-menu.js +78 -0
- package/dist/components/editable-cell.d.ts +34 -0
- package/dist/components/editable-cell.js +89 -0
- package/dist/components/empty-state.d.ts +17 -0
- package/dist/components/empty-state.js +9 -0
- package/dist/components/field.d.ts +43 -0
- package/dist/components/field.js +75 -0
- package/dist/components/filter-condition.d.ts +188 -0
- package/dist/components/filter-condition.js +113 -0
- package/dist/components/filter-menu.d.ts +57 -0
- package/dist/components/filter-menu.js +46 -0
- package/dist/components/header-bar.d.ts +84 -0
- package/dist/components/header-bar.js +94 -0
- package/dist/components/hold-button.d.ts +15 -0
- package/dist/components/hold-button.js +88 -0
- package/dist/components/icon-tile.d.ts +12 -0
- package/dist/components/icon-tile.js +29 -0
- package/dist/components/info-tip.d.ts +13 -0
- package/dist/components/info-tip.js +26 -0
- package/dist/components/input.d.ts +17 -0
- package/dist/components/input.js +83 -0
- package/dist/components/kbd.d.ts +6 -0
- package/dist/components/kbd.js +7 -0
- package/dist/components/menu-item.d.ts +56 -0
- package/dist/components/menu-item.js +94 -0
- package/dist/components/message-composer.d.ts +75 -0
- package/dist/components/message-composer.js +199 -0
- package/dist/components/nav-rail.d.ts +31 -0
- package/dist/components/nav-rail.js +85 -0
- package/dist/components/notice.d.ts +45 -0
- package/dist/components/notice.js +66 -0
- package/dist/components/optimistic-undo.d.ts +28 -0
- package/dist/components/optimistic-undo.js +43 -0
- package/dist/components/option-row.d.ts +15 -0
- package/dist/components/option-row.js +14 -0
- package/dist/components/page-content.d.ts +11 -0
- package/dist/components/page-content.js +31 -0
- package/dist/components/pagination.d.ts +34 -0
- package/dist/components/pagination.js +41 -0
- package/dist/components/popover.d.ts +27 -0
- package/dist/components/popover.js +25 -0
- package/dist/components/progress.d.ts +33 -0
- package/dist/components/progress.js +75 -0
- package/dist/components/radio-group.d.ts +7 -0
- package/dist/components/radio-group.js +33 -0
- package/dist/components/readonly-field.d.ts +33 -0
- package/dist/components/readonly-field.js +80 -0
- package/dist/components/segmented-control.d.ts +21 -0
- package/dist/components/segmented-control.js +108 -0
- package/dist/components/select.d.ts +42 -0
- package/dist/components/select.js +86 -0
- package/dist/components/separator.d.ts +10 -0
- package/dist/components/separator.js +7 -0
- package/dist/components/setting-row.d.ts +53 -0
- package/dist/components/setting-row.js +93 -0
- package/dist/components/sidebar-switcher.d.ts +47 -0
- package/dist/components/sidebar-switcher.js +20 -0
- package/dist/components/sidebar.d.ts +220 -0
- package/dist/components/sidebar.js +327 -0
- package/dist/components/skeleton.d.ts +18 -0
- package/dist/components/skeleton.js +23 -0
- package/dist/components/slider.d.ts +15 -0
- package/dist/components/slider.js +28 -0
- package/dist/components/spinner.d.ts +14 -0
- package/dist/components/spinner.js +19 -0
- package/dist/components/status-dot.d.ts +24 -0
- package/dist/components/status-dot.js +35 -0
- package/dist/components/stepper.d.ts +60 -0
- package/dist/components/stepper.js +197 -0
- package/dist/components/switch.d.ts +9 -0
- package/dist/components/switch.js +26 -0
- package/dist/components/table-cell.d.ts +38 -0
- package/dist/components/table-cell.js +107 -0
- package/dist/components/table-context.d.ts +48 -0
- package/dist/components/table-context.js +69 -0
- package/dist/components/table-head.d.ts +42 -0
- package/dist/components/table-head.js +188 -0
- package/dist/components/table-tree.d.ts +96 -0
- package/dist/components/table-tree.js +137 -0
- package/dist/components/table.d.ts +78 -0
- package/dist/components/table.js +119 -0
- package/dist/components/tabs.d.ts +27 -0
- package/dist/components/tabs.js +79 -0
- package/dist/components/textarea.d.ts +3 -0
- package/dist/components/textarea.js +20 -0
- package/dist/components/theme.d.ts +41 -0
- package/dist/components/theme.js +60 -0
- package/dist/components/thinking.d.ts +68 -0
- package/dist/components/thinking.js +94 -0
- package/dist/components/toast.d.ts +39 -0
- package/dist/components/toast.js +110 -0
- package/dist/components/toolbar.d.ts +25 -0
- package/dist/components/toolbar.js +92 -0
- package/dist/components/tooltip.d.ts +23 -0
- package/dist/components/tooltip.js +27 -0
- package/dist/components/top-nav.d.ts +129 -0
- package/dist/components/top-nav.js +211 -0
- package/dist/components/truncate.d.ts +29 -0
- package/dist/components/truncate.js +138 -0
- package/dist/deprecated.d.ts +43 -0
- package/dist/deprecated.js +47 -0
- package/dist/index.d.ts +93 -0
- package/dist/index.js +93 -0
- package/dist/lib/cn.d.ts +5 -0
- package/dist/lib/cn.js +14 -0
- package/dist/lib/color.d.ts +136 -0
- package/dist/lib/color.js +307 -0
- package/dist/lib/contrast.d.ts +53 -0
- package/dist/lib/contrast.js +169 -0
- package/dist/lib/create-theme.d.ts +240 -0
- package/dist/lib/create-theme.js +461 -0
- package/dist/lib/harmony.d.ts +102 -0
- package/dist/lib/harmony.js +426 -0
- package/dist/lib/import-theme.d.ts +22 -0
- package/dist/lib/import-theme.js +221 -0
- package/dist/lib/overflow-scroll.d.ts +25 -0
- package/dist/lib/overflow-scroll.js +66 -0
- package/dist/lib/radio-toggle-render.d.ts +3 -0
- package/dist/lib/radio-toggle-render.js +9 -0
- package/dist/lib/reorder.d.ts +38 -0
- package/dist/lib/reorder.js +193 -0
- package/dist/lib/spacing.d.ts +101 -0
- package/dist/lib/spacing.js +118 -0
- package/dist/lib/tailwind-palette.d.ts +5 -0
- package/dist/lib/tailwind-palette.js +351 -0
- package/dist/lib/truncate.d.ts +18 -0
- package/dist/lib/truncate.js +69 -0
- package/dist/lib/use-single-value.d.ts +5 -0
- package/dist/lib/use-single-value.js +17 -0
- package/dist/styles.css +7988 -0
- package/mcp/server.mjs +87590 -0
- package/package.json +58 -5
- package/skills/continuum-fix-padding/SKILL.md +69 -0
- package/skills/continuum-fix-padding/scripts/compute.ts +155 -0
- package/skills/continuum-fix-padding/scripts/spacing.ts +189 -0
- package/skills/continuum-taste/SKILL.md +186 -0
- package/skills/continuum-taste/assets/tokens.css +647 -0
- package/skills/continuum-taste/references/charts.md +375 -0
- package/skills/continuum-taste/references/components.md +1369 -0
- package/skills/continuum-taste/references/foundations.md +539 -0
- package/skills/continuum-taste/references/media/canvas.md +75 -0
- package/skills/continuum-taste/references/media/css.md +61 -0
- package/skills/continuum-taste/references/media/react.md +161 -0
- package/skills/continuum-taste/references/method.md +87 -0
- package/skills/continuum-taste/references/pages.md +391 -0
- package/skills/continuum-taste/references/patterns.md +77 -0
- package/skills/continuum-taste/references/screens/agent.tsx +450 -0
- package/skills/continuum-taste/references/screens/analytics-overview.tsx +377 -0
- package/skills/continuum-taste/references/screens/checkout-funnel.tsx +193 -0
- package/skills/continuum-taste/references/screens/customer.tsx +475 -0
- package/skills/continuum-taste/references/screens/customers.tsx +608 -0
- package/skills/continuum-taste/references/screens/index.tsx +72 -0
- package/skills/continuum-taste/references/screens/invoice-editor.tsx +558 -0
- package/skills/continuum-taste/references/screens/new-customer.tsx +205 -0
- package/skills/continuum-taste/references/screens/overview.tsx +196 -0
- package/skills/continuum-taste/references/screens/report-generator.tsx +329 -0
- package/skills/continuum-taste/references/screens/risk-report.tsx +577 -0
- package/skills/continuum-taste/references/screens/sequence-editor.tsx +455 -0
- package/skills/continuum-taste/references/screens/settings.tsx +288 -0
- package/skills/continuum-taste/references/screens/shared.tsx +204 -0
- package/skills/continuum-taste/references/screens/sign-in.tsx +104 -0
- package/skills/continuum-taste/references/screens/workspace.tsx +596 -0
- package/skills/continuum-taste/references/theming.md +95 -0
- package/src/charts/area-chart.tsx +17 -0
- package/src/charts/bar-chart.tsx +15 -0
- package/src/charts/bubble-chart.tsx +913 -0
- package/src/charts/bullet-chart.tsx +419 -0
- package/src/charts/candlestick-chart.tsx +1242 -0
- package/src/charts/cartesian.tsx +1437 -0
- package/src/charts/chart-card.tsx +394 -0
- package/src/charts/donut-chart.tsx +299 -0
- package/src/charts/funnel-chart.tsx +373 -0
- package/src/charts/horizontal-bar-chart.tsx +991 -0
- package/src/charts/index.ts +76 -0
- package/src/charts/legend.tsx +59 -0
- package/src/charts/lib/candlestick-window.ts +42 -0
- package/src/charts/lib/color.ts +110 -0
- package/src/charts/lib/format.ts +42 -0
- package/src/charts/lib/frame.ts +6 -0
- package/src/charts/lib/layout.ts +78 -0
- package/src/charts/lib/path.ts +225 -0
- package/src/charts/lib/scale.ts +91 -0
- package/src/charts/lib/use-active.ts +87 -0
- package/src/charts/lib/use-size.ts +45 -0
- package/src/charts/line-chart.tsx +16 -0
- package/src/charts/radar-chart.tsx +485 -0
- package/src/charts/rose-chart.tsx +553 -0
- package/src/charts/sparkline.tsx +293 -0
- package/src/charts/tooltip.tsx +105 -0
- package/src/charts/treemap.tsx +271 -0
- package/src/charts/uptime-strip.tsx +469 -0
- package/src/components/accordion.tsx +136 -0
- package/src/components/activity-item.tsx +43 -0
- package/src/components/alert.tsx +135 -0
- package/src/components/assistant-answer.tsx +185 -0
- package/src/components/assistant-prompt.tsx +352 -0
- package/src/components/avatar.tsx +157 -0
- package/src/components/badge.tsx +55 -0
- package/src/components/bar-list.tsx +350 -0
- package/src/components/block-slider.tsx +189 -0
- package/src/components/branch-graph.tsx +580 -0
- package/src/components/breadcrumb.tsx +173 -0
- package/src/components/button.tsx +157 -0
- package/src/components/calendar.tsx +154 -0
- package/src/components/card.tsx +296 -0
- package/src/components/chat-attachment.tsx +255 -0
- package/src/components/chat-event.tsx +34 -0
- package/src/components/chat-message.tsx +332 -0
- package/src/components/chat-reference.tsx +100 -0
- package/src/components/chat-shared.ts +41 -0
- package/src/components/chat-suggestions.tsx +188 -0
- package/src/components/chat-thread.tsx +348 -0
- package/src/components/chat-typing.tsx +155 -0
- package/src/components/checkbox.tsx +83 -0
- package/src/components/checklist.tsx +146 -0
- package/src/components/chip.tsx +152 -0
- package/src/components/code-input.tsx +406 -0
- package/src/components/color-picker.tsx +1385 -0
- package/src/components/combobox.tsx +420 -0
- package/src/components/command-menu.tsx +405 -0
- package/src/components/copy-button.tsx +87 -0
- package/src/components/data-grid.tsx +965 -0
- package/src/components/date-picker.tsx +652 -0
- package/src/components/description-list.tsx +39 -0
- package/src/components/dialog.tsx +367 -0
- package/src/components/dock.tsx +192 -0
- package/src/components/drop-zone.tsx +283 -0
- package/src/components/dropdown-menu.tsx +323 -0
- package/src/components/editable-cell.tsx +219 -0
- package/src/components/empty-state.tsx +50 -0
- package/src/components/field.tsx +148 -0
- package/src/components/filter-condition.tsx +463 -0
- package/src/components/filter-menu.tsx +196 -0
- package/src/components/header-bar.tsx +220 -0
- package/src/components/hold-button.tsx +146 -0
- package/src/components/icon-tile.tsx +43 -0
- package/src/components/info-tip.tsx +87 -0
- package/src/components/input.tsx +136 -0
- package/src/components/kbd.tsx +17 -0
- package/src/components/menu-item.tsx +216 -0
- package/src/components/message-composer.tsx +458 -0
- package/src/components/nav-rail.tsx +235 -0
- package/src/components/notice.tsx +133 -0
- package/src/components/optimistic-undo.ts +68 -0
- package/src/components/option-row.tsx +54 -0
- package/src/components/page-content.tsx +44 -0
- package/src/components/pagination.tsx +182 -0
- package/src/components/popover.tsx +113 -0
- package/src/components/progress.tsx +222 -0
- package/src/components/radio-group.tsx +80 -0
- package/src/components/readonly-field.tsx +251 -0
- package/src/components/segmented-control.tsx +205 -0
- package/src/components/select.tsx +259 -0
- package/src/components/separator.tsx +30 -0
- package/src/components/setting-row.tsx +277 -0
- package/src/components/sidebar-switcher.tsx +134 -0
- package/src/components/sidebar.tsx +804 -0
- package/src/components/skeleton.tsx +57 -0
- package/src/components/slider.tsx +106 -0
- package/src/components/spinner.tsx +43 -0
- package/src/components/status-dot.tsx +100 -0
- package/src/components/stepper.tsx +459 -0
- package/src/components/switch.tsx +54 -0
- package/src/components/table-cell.tsx +239 -0
- package/src/components/table-context.ts +135 -0
- package/src/components/table-head.tsx +393 -0
- package/src/components/table-tree.tsx +357 -0
- package/src/components/table.tsx +295 -0
- package/src/components/tabs.tsx +191 -0
- package/src/components/textarea.tsx +44 -0
- package/src/components/theme.tsx +120 -0
- package/src/components/thinking.tsx +295 -0
- package/src/components/toast.tsx +308 -0
- package/src/components/toolbar.tsx +166 -0
- package/src/components/tooltip.tsx +84 -0
- package/src/components/top-nav.tsx +660 -0
- package/src/components/truncate.tsx +234 -0
- package/src/deprecated.ts +61 -0
- package/src/index.ts +184 -0
- package/src/lib/cn.ts +22 -0
- package/src/lib/color.ts +469 -0
- package/src/lib/contrast.ts +220 -0
- package/src/lib/create-theme.ts +659 -0
- package/src/lib/harmony.ts +609 -0
- package/src/lib/import-theme.ts +272 -0
- package/src/lib/overflow-scroll.tsx +108 -0
- package/src/lib/radio-toggle-render.tsx +15 -0
- package/src/lib/reorder.ts +222 -0
- package/src/lib/spacing.ts +189 -0
- package/src/lib/tailwind-palette.ts +355 -0
- package/src/lib/truncate.ts +79 -0
- package/src/lib/use-single-value.ts +23 -0
- package/src/styles/continuum.css +3 -0
- package/src/styles/theme.css +524 -0
- package/src/styles/tokens.css +647 -0
|
@@ -0,0 +1,405 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { Dialog as DialogPrimitive } from '@base-ui/react/dialog';
|
|
4
|
+
import { Search, X } from 'lucide-react';
|
|
5
|
+
import {
|
|
6
|
+
type ComponentProps,
|
|
7
|
+
createContext,
|
|
8
|
+
type KeyboardEvent,
|
|
9
|
+
type ReactNode,
|
|
10
|
+
type RefObject,
|
|
11
|
+
useCallback,
|
|
12
|
+
useContext,
|
|
13
|
+
useEffect,
|
|
14
|
+
useId,
|
|
15
|
+
useLayoutEffect,
|
|
16
|
+
useRef,
|
|
17
|
+
useState,
|
|
18
|
+
} from 'react';
|
|
19
|
+
import { cn } from '../lib/cn';
|
|
20
|
+
import { Button } from './button';
|
|
21
|
+
import { Dialog, DialogContent, type DialogContentProps } from './dialog';
|
|
22
|
+
import { MenuItem } from './menu-item';
|
|
23
|
+
|
|
24
|
+
type CommandMenuContextValue = {
|
|
25
|
+
query: string;
|
|
26
|
+
setQuery: (query: string) => void;
|
|
27
|
+
active?: string;
|
|
28
|
+
setActive: (id: string | undefined) => void;
|
|
29
|
+
listId: string;
|
|
30
|
+
listRef: RefObject<HTMLDivElement | null>;
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
const CommandMenuContext = createContext<CommandMenuContextValue | null>(null);
|
|
34
|
+
|
|
35
|
+
const useCommandMenu = () => {
|
|
36
|
+
const context = useContext(CommandMenuContext);
|
|
37
|
+
if (!context) throw new Error('Command menu parts must be inside <CommandMenu>.');
|
|
38
|
+
return context;
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
/** Whether every word typed appears in the label or one of its keywords. */
|
|
42
|
+
export const matchesCommand = (query: string, ...fields: (string | undefined)[]) => {
|
|
43
|
+
const words = query.trim().toLowerCase().split(/\s+/).filter(Boolean);
|
|
44
|
+
const haystack = fields.filter(Boolean).join(' ').toLowerCase();
|
|
45
|
+
return words.every(word => haystack.includes(word));
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
/** Opens a command menu with ⌘K or Ctrl+K from anywhere on the page. */
|
|
49
|
+
export const useCommandMenuShortcut = (onOpen: () => void, key = 'k') => {
|
|
50
|
+
useEffect(() => {
|
|
51
|
+
const listener = (event: globalThis.KeyboardEvent) => {
|
|
52
|
+
if ((event.metaKey || event.ctrlKey) && event.key.toLowerCase() === key) {
|
|
53
|
+
event.preventDefault();
|
|
54
|
+
onOpen();
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
window.addEventListener('keydown', listener);
|
|
58
|
+
return () => window.removeEventListener('keydown', listener);
|
|
59
|
+
}, [onOpen, key]);
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
export type CommandMenuProps = Omit<DialogPrimitive.Root.Props, 'children'> & {
|
|
63
|
+
children?: ReactNode;
|
|
64
|
+
/** The search, controlled; it is cleared each time the menu opens otherwise. */
|
|
65
|
+
query?: string;
|
|
66
|
+
onQueryChange?: (query: string) => void;
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Search and run anything from the keyboard: a dialog pinned near the top with a borderless search,
|
|
71
|
+
* commands in groups below it, arrows to move and Enter to run. Items hide themselves when they do
|
|
72
|
+
* not match what is typed, and a group with nothing left hides with them.
|
|
73
|
+
*/
|
|
74
|
+
export const CommandMenu = ({
|
|
75
|
+
query: queryProp,
|
|
76
|
+
onQueryChange,
|
|
77
|
+
open,
|
|
78
|
+
onOpenChange,
|
|
79
|
+
children,
|
|
80
|
+
...props
|
|
81
|
+
}: CommandMenuProps) => {
|
|
82
|
+
const [ownQuery, setOwnQuery] = useState('');
|
|
83
|
+
const query = queryProp ?? ownQuery;
|
|
84
|
+
const [active, setActive] = useState<string>();
|
|
85
|
+
const listId = useId();
|
|
86
|
+
const listRef = useRef<HTMLDivElement>(null);
|
|
87
|
+
|
|
88
|
+
const setQuery = useCallback(
|
|
89
|
+
(next: string) => {
|
|
90
|
+
setOwnQuery(next);
|
|
91
|
+
onQueryChange?.(next);
|
|
92
|
+
},
|
|
93
|
+
[onQueryChange],
|
|
94
|
+
);
|
|
95
|
+
|
|
96
|
+
// Opened through `open` (a shortcut, a button elsewhere), it never hears onOpenChange, so the
|
|
97
|
+
// search is cleared here as well.
|
|
98
|
+
// biome-ignore lint/correctness/useExhaustiveDependencies: runs as the menu opens, not as the query changes
|
|
99
|
+
useLayoutEffect(() => {
|
|
100
|
+
if (open && queryProp === undefined) setOwnQuery('');
|
|
101
|
+
}, [open]);
|
|
102
|
+
|
|
103
|
+
return (
|
|
104
|
+
<Dialog
|
|
105
|
+
onOpenChange={(next, details) => {
|
|
106
|
+
if (next && queryProp === undefined) setOwnQuery('');
|
|
107
|
+
onOpenChange?.(next, details);
|
|
108
|
+
}}
|
|
109
|
+
open={open}
|
|
110
|
+
{...props}
|
|
111
|
+
>
|
|
112
|
+
<CommandMenuContext.Provider
|
|
113
|
+
value={{ query, setQuery, active, setActive, listId, listRef }}
|
|
114
|
+
>
|
|
115
|
+
{children}
|
|
116
|
+
</CommandMenuContext.Provider>
|
|
117
|
+
</Dialog>
|
|
118
|
+
);
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
/** The panel: 560px, pinned at a sixth of the screen from the top, so it does not jump as results change. */
|
|
122
|
+
export const CommandMenuContent = ({
|
|
123
|
+
className,
|
|
124
|
+
'aria-label': label = 'Command menu',
|
|
125
|
+
...props
|
|
126
|
+
}: DialogContentProps) => (
|
|
127
|
+
<DialogContent
|
|
128
|
+
aria-label={label}
|
|
129
|
+
className={cn(
|
|
130
|
+
'mt-[16cqh] mb-auto w-[min(var(--spacing-command),calc(100%-32px))]',
|
|
131
|
+
className,
|
|
132
|
+
)}
|
|
133
|
+
data-slot="command-menu-content"
|
|
134
|
+
{...props}
|
|
135
|
+
/>
|
|
136
|
+
);
|
|
137
|
+
|
|
138
|
+
/** The items showing now, in order, read from the list itself. */
|
|
139
|
+
const visibleItems = (list: HTMLElement | null) =>
|
|
140
|
+
Array.from(
|
|
141
|
+
list?.querySelectorAll<HTMLElement>(
|
|
142
|
+
'[data-slot="command-menu-item"]:not([data-disabled])',
|
|
143
|
+
) ?? [],
|
|
144
|
+
);
|
|
145
|
+
|
|
146
|
+
export type CommandMenuInputProps = Omit<ComponentProps<'input'>, 'value' | 'onChange'> & {
|
|
147
|
+
/** Trailing in the search row, such as an Esc key. */
|
|
148
|
+
trailing?: ReactNode;
|
|
149
|
+
/** The close button's name for screen readers. */
|
|
150
|
+
closeLabel?: string;
|
|
151
|
+
};
|
|
152
|
+
|
|
153
|
+
/**
|
|
154
|
+
* The search: no box, a 16px icon, the text at 14px, ruled off from the list full width. On a touch
|
|
155
|
+
* screen, with no Esc key to press, it ends in the dialog header's close button.
|
|
156
|
+
*/
|
|
157
|
+
export const CommandMenuInput = ({
|
|
158
|
+
trailing,
|
|
159
|
+
closeLabel = 'Close',
|
|
160
|
+
className,
|
|
161
|
+
placeholder = 'Search or run a command',
|
|
162
|
+
onKeyDown,
|
|
163
|
+
...props
|
|
164
|
+
}: CommandMenuInputProps) => {
|
|
165
|
+
const { query, setQuery, active, setActive, listId, listRef } = useCommandMenu();
|
|
166
|
+
|
|
167
|
+
const move = (by: number) => {
|
|
168
|
+
const items = visibleItems(listRef.current);
|
|
169
|
+
if (items.length === 0) return;
|
|
170
|
+
const index = items.findIndex(item => item.id === active);
|
|
171
|
+
const next = items[(index + by + items.length) % items.length];
|
|
172
|
+
setActive(next?.id);
|
|
173
|
+
};
|
|
174
|
+
|
|
175
|
+
const handleKeyDown = (event: KeyboardEvent<HTMLInputElement>) => {
|
|
176
|
+
onKeyDown?.(event);
|
|
177
|
+
if (event.defaultPrevented) return;
|
|
178
|
+
if (event.key === 'ArrowDown' || event.key === 'ArrowUp') {
|
|
179
|
+
event.preventDefault();
|
|
180
|
+
move(event.key === 'ArrowDown' ? 1 : -1);
|
|
181
|
+
} else if (event.key === 'Home' || event.key === 'End') {
|
|
182
|
+
const items = visibleItems(listRef.current);
|
|
183
|
+
event.preventDefault();
|
|
184
|
+
setActive((event.key === 'Home' ? items[0] : items.at(-1))?.id);
|
|
185
|
+
} else if (event.key === 'Enter' && active) {
|
|
186
|
+
event.preventDefault();
|
|
187
|
+
document.getElementById(active)?.click();
|
|
188
|
+
}
|
|
189
|
+
};
|
|
190
|
+
|
|
191
|
+
return (
|
|
192
|
+
<div
|
|
193
|
+
className="flex h-bar shrink-0 items-center gap-2.5 border-neutral-200 border-b px-4 text-neutral-500 [&_svg:not([class*=size-])]:size-4 [&_svg]:shrink-0"
|
|
194
|
+
data-slot="command-menu-search"
|
|
195
|
+
>
|
|
196
|
+
<Search aria-hidden strokeWidth={2} />
|
|
197
|
+
<input
|
|
198
|
+
aria-activedescendant={active}
|
|
199
|
+
aria-autocomplete="list"
|
|
200
|
+
aria-controls={listId}
|
|
201
|
+
aria-expanded
|
|
202
|
+
autoComplete="off"
|
|
203
|
+
className={cn(
|
|
204
|
+
// 16px on a touch screen, or iOS zooms the page in when the search takes focus.
|
|
205
|
+
'h-full min-w-0 flex-1 bg-transparent pointer-coarse:text-base text-neutral-950 text-sm outline-none placeholder:text-neutral-600',
|
|
206
|
+
className,
|
|
207
|
+
)}
|
|
208
|
+
data-slot="command-menu-input"
|
|
209
|
+
onChange={event => setQuery(event.target.value)}
|
|
210
|
+
onKeyDown={handleKeyDown}
|
|
211
|
+
placeholder={placeholder}
|
|
212
|
+
role="combobox"
|
|
213
|
+
spellCheck={false}
|
|
214
|
+
value={query}
|
|
215
|
+
{...props}
|
|
216
|
+
/>
|
|
217
|
+
{trailing}
|
|
218
|
+
{/* A fine pointer has Esc and the scrim; a finger needs something to tap. It sits the
|
|
219
|
+
dialog header's 11px from the edge. */}
|
|
220
|
+
<DialogPrimitive.Close
|
|
221
|
+
aria-label={closeLabel}
|
|
222
|
+
render={
|
|
223
|
+
<Button
|
|
224
|
+
className="-mr-1.25 pointer-fine:hidden size-[calc(var(--spacing-bar)-22px)] rounded-control"
|
|
225
|
+
size="icon-sm"
|
|
226
|
+
variant="secondary"
|
|
227
|
+
/>
|
|
228
|
+
}
|
|
229
|
+
>
|
|
230
|
+
<X className="size-3.5" strokeWidth={2} />
|
|
231
|
+
</DialogPrimitive.Close>
|
|
232
|
+
</div>
|
|
233
|
+
);
|
|
234
|
+
};
|
|
235
|
+
|
|
236
|
+
/** The commands, scrolling under the search once there are more than fit. */
|
|
237
|
+
export const CommandMenuList = ({ className, children, ...props }: ComponentProps<'div'>) => {
|
|
238
|
+
const { query, active, setActive, listId, listRef } = useCommandMenu();
|
|
239
|
+
|
|
240
|
+
// After every change to what shows, keep an item highlighted: the same one if it is still there.
|
|
241
|
+
useLayoutEffect(() => {
|
|
242
|
+
const items = visibleItems(listRef.current);
|
|
243
|
+
if (!items.some(item => item.id === active)) setActive(items[0]?.id);
|
|
244
|
+
});
|
|
245
|
+
|
|
246
|
+
// Typing starts again from the top of the list.
|
|
247
|
+
// biome-ignore lint/correctness/useExhaustiveDependencies: runs on each new query on purpose
|
|
248
|
+
useLayoutEffect(() => {
|
|
249
|
+
setActive(visibleItems(listRef.current)[0]?.id);
|
|
250
|
+
listRef.current?.scrollTo({ top: 0 });
|
|
251
|
+
}, [query]);
|
|
252
|
+
|
|
253
|
+
// The highlighted item kept in view by scrolling the list alone: scrollIntoView would scroll every
|
|
254
|
+
// ancestor too, the page included, so a menu shown open on a page pulled the page to itself.
|
|
255
|
+
// biome-ignore lint/correctness/useExhaustiveDependencies: runs on each new active item; the list is read from its ref
|
|
256
|
+
useEffect(() => {
|
|
257
|
+
const list = listRef.current;
|
|
258
|
+
const item = active ? document.getElementById(active) : null;
|
|
259
|
+
if (!list || !item) return;
|
|
260
|
+
const bounds = list.getBoundingClientRect();
|
|
261
|
+
const box = item.getBoundingClientRect();
|
|
262
|
+
if (box.top < bounds.top) list.scrollTop -= bounds.top - box.top;
|
|
263
|
+
else if (box.bottom > bounds.bottom) list.scrollTop += box.bottom - bounds.bottom;
|
|
264
|
+
}, [active]);
|
|
265
|
+
|
|
266
|
+
return (
|
|
267
|
+
<div
|
|
268
|
+
className={cn(
|
|
269
|
+
'group/command-list flex max-h-[min(360px,50cqh)] flex-col gap-1 overflow-y-auto p-1.5',
|
|
270
|
+
className,
|
|
271
|
+
)}
|
|
272
|
+
data-slot="command-menu-list"
|
|
273
|
+
id={listId}
|
|
274
|
+
ref={listRef}
|
|
275
|
+
role="listbox"
|
|
276
|
+
{...props}
|
|
277
|
+
>
|
|
278
|
+
{children}
|
|
279
|
+
</div>
|
|
280
|
+
);
|
|
281
|
+
};
|
|
282
|
+
|
|
283
|
+
export type CommandMenuGroupProps = Omit<ComponentProps<'div'>, 'title'> & {
|
|
284
|
+
label: ReactNode;
|
|
285
|
+
};
|
|
286
|
+
|
|
287
|
+
/** A labelled run of commands; it hides once none of them match. */
|
|
288
|
+
export const CommandMenuGroup = ({
|
|
289
|
+
label,
|
|
290
|
+
className,
|
|
291
|
+
children,
|
|
292
|
+
...props
|
|
293
|
+
}: CommandMenuGroupProps) => {
|
|
294
|
+
const labelId = useId();
|
|
295
|
+
|
|
296
|
+
return (
|
|
297
|
+
// biome-ignore lint/a11y/useSemanticElements: a group of options in a listbox, which a fieldset is not
|
|
298
|
+
<div
|
|
299
|
+
aria-labelledby={labelId}
|
|
300
|
+
className={cn('flex not-has-data-[slot=command-menu-item]:hidden flex-col', className)}
|
|
301
|
+
data-slot="command-menu-group"
|
|
302
|
+
role="group"
|
|
303
|
+
{...props}
|
|
304
|
+
>
|
|
305
|
+
<div
|
|
306
|
+
className="px-2.5 pt-2 pb-1 font-medium text-neutral-600 text-xxs"
|
|
307
|
+
data-slot="command-menu-label"
|
|
308
|
+
id={labelId}
|
|
309
|
+
>
|
|
310
|
+
{label}
|
|
311
|
+
</div>
|
|
312
|
+
{children}
|
|
313
|
+
</div>
|
|
314
|
+
);
|
|
315
|
+
};
|
|
316
|
+
|
|
317
|
+
export type CommandMenuItemProps = Omit<ComponentProps<'div'>, 'onSelect'> & {
|
|
318
|
+
/** What the item is matched by, along with `keywords`. */
|
|
319
|
+
value: string;
|
|
320
|
+
/** Other words it answers to: "invoice" for "Billing". */
|
|
321
|
+
keywords?: string[];
|
|
322
|
+
/** Leading 16px icon. */
|
|
323
|
+
icon?: ReactNode;
|
|
324
|
+
/** Trailing, quiet: a Kbd shortcut or where the item lives. */
|
|
325
|
+
hint?: ReactNode;
|
|
326
|
+
disabled?: boolean;
|
|
327
|
+
/** Runs the command, from a click or Enter. */
|
|
328
|
+
onSelect?: () => void;
|
|
329
|
+
};
|
|
330
|
+
|
|
331
|
+
/** One command: a 36px row, highlighted with the 5% wash as the arrows reach it. */
|
|
332
|
+
export const CommandMenuItem = ({
|
|
333
|
+
value,
|
|
334
|
+
keywords,
|
|
335
|
+
icon,
|
|
336
|
+
hint,
|
|
337
|
+
disabled = false,
|
|
338
|
+
onSelect,
|
|
339
|
+
className,
|
|
340
|
+
children,
|
|
341
|
+
...props
|
|
342
|
+
}: CommandMenuItemProps) => {
|
|
343
|
+
const { query, active, setActive } = useCommandMenu();
|
|
344
|
+
const id = useId();
|
|
345
|
+
|
|
346
|
+
if (!matchesCommand(query, value, ...(keywords ?? []))) return null;
|
|
347
|
+
|
|
348
|
+
const highlighted = active === id;
|
|
349
|
+
|
|
350
|
+
return (
|
|
351
|
+
// Never focused itself: the search keeps focus and points at the highlighted option.
|
|
352
|
+
<MenuItem
|
|
353
|
+
aria-disabled={disabled || undefined}
|
|
354
|
+
aria-selected={highlighted}
|
|
355
|
+
// A size up from a popup row and set on the search row's lines: its icon 16px in
|
|
356
|
+
// from the panel edge (6px of list plus 10px of row) and 10px from the label.
|
|
357
|
+
className={cn('gap-2.5 rounded-item px-2.5', className)}
|
|
358
|
+
data-disabled={disabled || undefined}
|
|
359
|
+
data-highlighted={highlighted || undefined}
|
|
360
|
+
data-slot="command-menu-item"
|
|
361
|
+
id={id}
|
|
362
|
+
onClick={disabled ? undefined : onSelect}
|
|
363
|
+
onPointerMove={() => {
|
|
364
|
+
if (!disabled && !highlighted) setActive(id);
|
|
365
|
+
}}
|
|
366
|
+
role="option"
|
|
367
|
+
tabIndex={-1}
|
|
368
|
+
leading={icon}
|
|
369
|
+
trailing={hint}
|
|
370
|
+
{...props}
|
|
371
|
+
>
|
|
372
|
+
{children ?? value}
|
|
373
|
+
</MenuItem>
|
|
374
|
+
);
|
|
375
|
+
};
|
|
376
|
+
|
|
377
|
+
/** Shown in place of the list once nothing matches what is typed. */
|
|
378
|
+
export const CommandMenuEmpty = ({ className, children, ...props }: ComponentProps<'p'>) => {
|
|
379
|
+
const { query } = useCommandMenu();
|
|
380
|
+
|
|
381
|
+
return (
|
|
382
|
+
<p
|
|
383
|
+
className={cn(
|
|
384
|
+
'hidden px-2.5 py-3 text-neutral-600 text-xs group-not-has-[[data-slot=command-menu-item]]/command-list:block',
|
|
385
|
+
className,
|
|
386
|
+
)}
|
|
387
|
+
data-slot="command-menu-empty"
|
|
388
|
+
{...props}
|
|
389
|
+
>
|
|
390
|
+
{children ?? `Nothing matches “${query.trim()}”.`}
|
|
391
|
+
</p>
|
|
392
|
+
);
|
|
393
|
+
};
|
|
394
|
+
|
|
395
|
+
/** Keys to drive the list, under it and ruled off full width. */
|
|
396
|
+
export const CommandMenuFooter = ({ className, ...props }: ComponentProps<'div'>) => (
|
|
397
|
+
<div
|
|
398
|
+
className={cn(
|
|
399
|
+
'flex pointer-coarse:hidden h-row shrink-0 items-center gap-4 overflow-hidden whitespace-nowrap border-neutral-200 border-t px-4 text-neutral-600 text-xxs',
|
|
400
|
+
className,
|
|
401
|
+
)}
|
|
402
|
+
data-slot="command-menu-footer"
|
|
403
|
+
{...props}
|
|
404
|
+
/>
|
|
405
|
+
);
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { Check, Copy } from 'lucide-react';
|
|
4
|
+
import { type ComponentProps, useEffect, useRef, useState } from 'react';
|
|
5
|
+
import { cn } from '../lib/cn';
|
|
6
|
+
import { focusRing, touchTarget } from './button';
|
|
7
|
+
import { Tooltip, TooltipContent, TooltipTrigger } from './tooltip';
|
|
8
|
+
|
|
9
|
+
export type CopyButtonProps = Omit<ComponentProps<'button'>, 'onCopy' | 'children'> & {
|
|
10
|
+
/** The text put on the clipboard. */
|
|
11
|
+
text: string;
|
|
12
|
+
/** Its name and tooltip; "Copy" by default. */
|
|
13
|
+
label?: string;
|
|
14
|
+
/** What it says once it has copied. */
|
|
15
|
+
copiedLabel?: string;
|
|
16
|
+
onCopy?: (text: string) => void;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* A 24 square ghost button with a 14 copy icon, for a value that sits in a line of text (a table
|
|
21
|
+
* cell): small enough to sit inside a 17 line without growing it. Once copied, the icon crossfades
|
|
22
|
+
* to a tick for 1.5s and the change is announced; the tooltip says what it does.
|
|
23
|
+
*/
|
|
24
|
+
export const CopyButton = ({
|
|
25
|
+
text,
|
|
26
|
+
label = 'Copy',
|
|
27
|
+
copiedLabel = 'Copied',
|
|
28
|
+
onCopy,
|
|
29
|
+
className,
|
|
30
|
+
'aria-label': name,
|
|
31
|
+
...props
|
|
32
|
+
}: CopyButtonProps) => {
|
|
33
|
+
const [copied, setCopied] = useState(false);
|
|
34
|
+
const timer = useRef<ReturnType<typeof setTimeout>>(undefined);
|
|
35
|
+
|
|
36
|
+
useEffect(() => () => clearTimeout(timer.current), []);
|
|
37
|
+
|
|
38
|
+
const copy = async () => {
|
|
39
|
+
try {
|
|
40
|
+
await navigator.clipboard.writeText(text);
|
|
41
|
+
} catch {
|
|
42
|
+
// No clipboard (an insecure origin or a denied permission): leave the state alone rather than lie.
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
onCopy?.(text);
|
|
46
|
+
setCopied(true);
|
|
47
|
+
clearTimeout(timer.current);
|
|
48
|
+
timer.current = setTimeout(() => setCopied(false), 1500);
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
return (
|
|
52
|
+
<>
|
|
53
|
+
<Tooltip>
|
|
54
|
+
<TooltipTrigger
|
|
55
|
+
render={
|
|
56
|
+
<button
|
|
57
|
+
{...props}
|
|
58
|
+
aria-label={copied ? copiedLabel : (name ?? label)}
|
|
59
|
+
className={cn(
|
|
60
|
+
'inline-flex size-6 shrink-0 cursor-pointer items-center justify-center rounded-chip text-neutral-600 transition-[background-color,color,opacity] duration-150 ease-out-strong hover:bg-neutral-950/5 hover:text-neutral-950',
|
|
61
|
+
'data-copied:text-neutral-950',
|
|
62
|
+
touchTarget,
|
|
63
|
+
focusRing,
|
|
64
|
+
className,
|
|
65
|
+
)}
|
|
66
|
+
data-copied={copied || undefined}
|
|
67
|
+
data-slot="copy-button"
|
|
68
|
+
onClick={copy}
|
|
69
|
+
type="button"
|
|
70
|
+
/>
|
|
71
|
+
}
|
|
72
|
+
>
|
|
73
|
+
{/* Both stacked in one cell, so the tick crossfades in over the copy icon and back. */}
|
|
74
|
+
<span className="grid place-items-center *:col-start-1 *:row-start-1 *:size-3.5 *:transition-[opacity,scale] *:duration-150 *:ease-out-strong motion-reduce:*:scale-100">
|
|
75
|
+
<Copy className={cn(copied && 'scale-[0.8] opacity-0')} strokeWidth={2} />
|
|
76
|
+
<Check className={cn(!copied && 'scale-[0.8] opacity-0')} strokeWidth={2} />
|
|
77
|
+
</span>
|
|
78
|
+
</TooltipTrigger>
|
|
79
|
+
<TooltipContent>{copied ? copiedLabel : label}</TooltipContent>
|
|
80
|
+
</Tooltip>
|
|
81
|
+
{/* The tooltip is visual only, so the confirmation is announced separately. */}
|
|
82
|
+
<span aria-live="polite" className="sr-only">
|
|
83
|
+
{copied ? copiedLabel : ''}
|
|
84
|
+
</span>
|
|
85
|
+
</>
|
|
86
|
+
);
|
|
87
|
+
};
|