@jfrader/ui 0.4.0 → 0.5.1
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/README.md +2 -0
- package/dist/accordion-DLul6vIl.js +205 -0
- package/dist/accordion.js +1 -1
- package/dist/{alert-BBqaKI4k.js → alert-DS_einpy.js} +1 -1
- package/dist/alert.js +1 -1
- package/dist/announcement-bar-Dlbq5-9D.js +382 -0
- package/dist/announcement-bar.js +2 -0
- package/dist/avatar-CaGJHy1N.js +145 -0
- package/dist/avatar-group-M1opAQEG.js +138 -0
- package/dist/avatar-group.js +2 -0
- package/dist/avatar.js +1 -1
- package/dist/badge-CjM5Agqk.js +119 -0
- package/dist/badge.js +1 -1
- package/dist/bottom-sheet-DjZOPq4k.js +674 -0
- package/dist/bottom-sheet.js +2 -0
- package/dist/{breadcrumbs-DVAOxfvL.js → breadcrumbs-BDK_LiwH.js} +11 -4
- package/dist/breadcrumbs.js +1 -1
- package/dist/{button-P2e7_44z.js → button-NLY0h6EJ.js} +8 -8
- package/dist/button.js +1 -1
- package/dist/calendar-BzJdv_SZ.js +449 -0
- package/dist/calendar.js +1 -1
- package/dist/card-Ca4KQKYQ.js +154 -0
- package/dist/card.js +1 -1
- package/dist/carousel-B7OrvD6J.js +474 -0
- package/dist/carousel.js +2 -0
- package/dist/{checkbox-COYG6L7d.js → checkbox-DKSzExj2.js} +17 -16
- package/dist/checkbox.js +1 -1
- package/dist/chip-group-DjQ0_6Y9.js +290 -0
- package/dist/chip-group.js +2 -0
- package/dist/code-block/shiki.js +147 -0
- package/dist/code-block-B5we2lZa.js +293 -0
- package/dist/code-block.js +2 -0
- package/dist/collection-registry-k6JcD3Jr.js +44 -0
- package/dist/combobox-DFFqOBCi.js +339 -0
- package/dist/combobox.js +1 -1
- package/dist/command-palette-BmQu2w4H.js +391 -0
- package/dist/command-palette.js +1 -1
- package/dist/comment-thread-ASaXDcGo.js +1410 -0
- package/dist/comment-thread.js +2 -0
- package/dist/context-menu-__1c2Dk9.js +370 -0
- package/dist/context-menu.js +2 -0
- package/dist/copy-button-DCSLcYS-.js +252 -0
- package/dist/copy-button.js +2 -0
- package/dist/countdown-Dp_TD1VP.js +293 -0
- package/dist/countdown.js +2 -0
- package/dist/date-picker-BiPN7yeK.js +255 -0
- package/dist/date-picker.js +1 -1
- package/dist/date-range-picker-DQpUeKqV.js +570 -0
- package/dist/date-range-picker.js +2 -0
- package/dist/{dialog-xaydbXl2.js → dialog-BX1zYMs-.js} +21 -20
- package/dist/dialog.js +1 -1
- package/dist/{divider-DYoJf0I_.js → divider-Cp7aNbhM.js} +21 -20
- package/dist/divider.js +1 -1
- package/dist/drawer-DsASTiP-.js +553 -0
- package/dist/drawer.js +2 -0
- package/dist/elastic-slider-BG6K019r.js +395 -0
- package/dist/elastic-slider.js +2 -0
- package/dist/empty-state-CDgrjPPf.js +142 -0
- package/dist/empty-state.js +2 -0
- package/dist/expandable-card-rUATve0o.js +347 -0
- package/dist/expandable-card.js +2 -0
- package/dist/expanding-search-BxOwtdwt.js +238 -0
- package/dist/expanding-search.js +2 -0
- package/dist/field-anatomy-COVdNpf5.js +84 -0
- package/dist/file-dropzone-BuXm3Tea.js +457 -0
- package/dist/file-dropzone.js +2 -0
- package/dist/filter-toolbar-Cy5Hqur-.js +314 -0
- package/dist/filter-toolbar.js +2 -0
- package/dist/hold-to-confirm-DjB2EVjM.js +294 -0
- package/dist/hold-to-confirm.js +2 -0
- package/dist/hover-card-CoMJKg1g.js +347 -0
- package/dist/hover-card.js +2 -0
- package/dist/image-compare-BxY8Ykzt.js +415 -0
- package/dist/image-compare.js +2 -0
- package/dist/index.js +84 -38
- package/dist/inline-edit-C0eeml65.js +535 -0
- package/dist/inline-edit.js +2 -0
- package/dist/input-control-DmMuAuPS.js +34 -0
- package/dist/json-viewer-DgWqyU75.js +802 -0
- package/dist/json-viewer.js +2 -0
- package/dist/listbox-style-WX-RASp1.js +59 -0
- package/dist/{media-D_eA_I-e.js → media-8yrN85VT.js} +2 -2
- package/dist/mention-input-sq61si9L.js +600 -0
- package/dist/mention-input.js +2 -0
- package/dist/menu-DDKgmK2F.js +295 -0
- package/dist/menu.js +1 -1
- package/dist/metric-card--lVTz5Wn.js +118 -0
- package/dist/metric-card.js +2 -0
- package/dist/multi-select-DG1BCFX7.js +598 -0
- package/dist/multi-select.js +2 -0
- package/dist/{navigation-DhnKriOp.js → navigation-CC26JDr-.js} +24 -18
- package/dist/navigation.js +1 -1
- package/dist/overlay-layer-qEbpEtb8.js +78 -0
- package/dist/overlay-portal-C4JZFq2M.js +15 -0
- package/dist/{pagination-DYdwsxwe.js → pagination-BfkeWbmP.js} +24 -23
- package/dist/pagination.js +1 -1
- package/dist/password-field-03pWRkuY.js +250 -0
- package/dist/password-field.js +2 -0
- package/dist/pill-BaS-uIbn.js +58 -0
- package/dist/pill.js +1 -1
- package/dist/popover-CErIw2q3.js +125 -0
- package/dist/popover.js +1 -1
- package/dist/{progress-BpJswTG4.js → progress-DAQkfhPd.js} +5 -5
- package/dist/progress.js +1 -1
- package/dist/radio-cards-Cu9cBssN.js +456 -0
- package/dist/radio-cards.js +2 -0
- package/dist/{radio-group-Ce0_IWQr.js → radio-group-TIK0-iPX.js} +22 -19
- package/dist/radio-group.js +1 -1
- package/dist/resizable-panels-DUpQEpwG.js +520 -0
- package/dist/resizable-panels.js +2 -0
- package/dist/scroll-area-CcZyiSOQ.js +371 -0
- package/dist/scroll-area.js +2 -0
- package/dist/search-field-DMvho0KQ.js +274 -0
- package/dist/search-field.js +2 -0
- package/dist/segmented-control-8ZUGnsZm.js +327 -0
- package/dist/segmented-control.js +2 -0
- package/dist/select-D5rhJ8gi.js +293 -0
- package/dist/select.js +1 -1
- package/dist/signature-pad-_bTeguN9.js +645 -0
- package/dist/signature-pad.js +2 -0
- package/dist/{skeleton-OoFlOEXO.js → skeleton-XQQDkCHd.js} +1 -1
- package/dist/skeleton.js +1 -1
- package/dist/slider-DVG6-Awh.js +308 -0
- package/dist/slider.js +2 -0
- package/dist/sortable-data-table-CYKT_Ng7.js +365 -0
- package/dist/sortable-data-table.js +2 -0
- package/dist/{spinner-C2YDoiMn.js → spinner-DtxvDPdM.js} +1 -1
- package/dist/spinner.js +1 -1
- package/dist/split-button-BCw4zZom.js +262 -0
- package/dist/split-button.js +2 -0
- package/dist/stepper-CruHbXxX.js +480 -0
- package/dist/stepper.js +2 -0
- package/dist/swipe-actions-CBuJREU1.js +420 -0
- package/dist/swipe-actions.js +2 -0
- package/dist/switch-C1WrKrf-.js +145 -0
- package/dist/switch.js +1 -1
- package/dist/tabs-XluwRjgg.js +210 -0
- package/dist/tabs.js +1 -1
- package/dist/tag-input-DSRCyrX2.js +418 -0
- package/dist/tag-input.js +2 -0
- package/dist/{text-field-D60ok14S.js → text-field-hU72iSVS.js} +20 -17
- package/dist/text-field.js +1 -1
- package/dist/{textarea-DyfjtP0A.js → textarea-3k4Y0QQ3.js} +23 -20
- package/dist/textarea.js +1 -1
- package/dist/theme-root.js +1 -1
- package/dist/theme-switch-C505TtU8.js +166 -0
- package/dist/theme-switch.js +2 -0
- package/dist/time-picker-CPlhW0tr.js +311 -0
- package/dist/time-picker.js +2 -0
- package/dist/timeline-B0uAAVfT.js +624 -0
- package/dist/timeline.js +2 -0
- package/dist/toast-B7wo3sX1.js +371 -0
- package/dist/toast-stack-B40VpS4M.js +197 -0
- package/dist/toast-stack.js +2 -0
- package/dist/toast.js +1 -1
- package/dist/{toggle-group-CI0e7hFm.js → toggle-group-B2fpFZwV.js} +5 -5
- package/dist/toggle-group.js +1 -1
- package/dist/tooltip-BvgVTCTN.js +120 -0
- package/dist/tooltip.js +1 -1
- package/dist/tree-view-j8qLqkb_.js +364 -0
- package/dist/tree-view.js +2 -0
- package/dist/types/components/announcement-bar/announcement-bar.d.ts +75 -0
- package/dist/types/components/announcement-bar/index.d.ts +2 -0
- package/dist/types/components/avatar-group/avatar-group.d.ts +43 -0
- package/dist/types/components/avatar-group/index.d.ts +2 -0
- package/dist/types/components/bottom-sheet/bottom-sheet.d.ts +60 -0
- package/dist/types/components/bottom-sheet/index.d.ts +2 -0
- package/dist/types/components/calendar/calendar.d.ts +25 -1
- package/dist/types/components/calendar/index.d.ts +1 -1
- package/dist/types/components/carousel/carousel.d.ts +73 -0
- package/dist/types/components/carousel/index.d.ts +2 -0
- package/dist/types/components/checkbox/checkbox.d.ts +1 -1
- package/dist/types/components/chip-group/chip-group.d.ts +54 -0
- package/dist/types/components/chip-group/index.d.ts +1 -0
- package/dist/types/components/code-block/code-block.d.ts +58 -0
- package/dist/types/components/code-block/index.d.ts +1 -0
- package/dist/types/components/code-block/shiki.d.ts +3 -0
- package/dist/types/components/combobox/combobox.d.ts +1 -1
- package/dist/types/components/command-palette/command-palette.d.ts +2 -2
- package/dist/types/components/comment-thread/comment-thread.d.ts +118 -0
- package/dist/types/components/comment-thread/index.d.ts +1 -0
- package/dist/types/components/comment-thread/thread-core.d.ts +96 -0
- package/dist/types/components/comment-thread/thread-parts.d.ts +114 -0
- package/dist/types/components/context-menu/context-menu.d.ts +55 -0
- package/dist/types/components/context-menu/index.d.ts +2 -0
- package/dist/types/components/copy-button/copy-button.d.ts +49 -0
- package/dist/types/components/copy-button/index.d.ts +2 -0
- package/dist/types/components/countdown/countdown.d.ts +37 -0
- package/dist/types/components/countdown/index.d.ts +1 -0
- package/dist/types/components/date-picker/date-picker.d.ts +1 -1
- package/dist/types/components/date-range-picker/date-range-picker.d.ts +103 -0
- package/dist/types/components/date-range-picker/index.d.ts +2 -0
- package/dist/types/components/drawer/drawer.d.ts +59 -0
- package/dist/types/components/drawer/index.d.ts +2 -0
- package/dist/types/components/elastic-slider/elastic-slider.d.ts +53 -0
- package/dist/types/components/elastic-slider/index.d.ts +1 -0
- package/dist/types/components/empty-state/empty-state.d.ts +36 -0
- package/dist/types/components/empty-state/index.d.ts +2 -0
- package/dist/types/components/expandable-card/expandable-card.d.ts +28 -0
- package/dist/types/components/expandable-card/index.d.ts +2 -0
- package/dist/types/components/expanding-search/expanding-search.d.ts +22 -0
- package/dist/types/components/expanding-search/index.d.ts +1 -0
- package/dist/types/components/field/field-anatomy.d.ts +4 -2
- package/dist/types/components/file-dropzone/file-dropzone.d.ts +93 -0
- package/dist/types/components/file-dropzone/index.d.ts +2 -0
- package/dist/types/components/filter-toolbar/filter-toolbar.d.ts +70 -0
- package/dist/types/components/filter-toolbar/index.d.ts +1 -0
- package/dist/types/components/hold-to-confirm/hold-to-confirm.d.ts +32 -0
- package/dist/types/components/hold-to-confirm/index.d.ts +2 -0
- package/dist/types/components/hover-card/hover-card.d.ts +97 -0
- package/dist/types/components/hover-card/index.d.ts +2 -0
- package/dist/types/components/image-compare/image-compare.d.ts +54 -0
- package/dist/types/components/image-compare/index.d.ts +1 -0
- package/dist/types/components/inline-edit/index.d.ts +2 -0
- package/dist/types/components/inline-edit/inline-edit.d.ts +93 -0
- package/dist/types/components/json-viewer/index.d.ts +2 -0
- package/dist/types/components/json-viewer/json-viewer.d.ts +82 -0
- package/dist/types/components/mention-input/index.d.ts +2 -0
- package/dist/types/components/mention-input/mention-input.d.ts +87 -0
- package/dist/types/components/menu/menu.d.ts +68 -7
- package/dist/types/components/metric-card/index.d.ts +1 -0
- package/dist/types/components/metric-card/metric-card.d.ts +37 -0
- package/dist/types/components/multi-select/index.d.ts +2 -0
- package/dist/types/components/multi-select/multi-select.d.ts +73 -0
- package/dist/types/components/pagination/pagination.d.ts +1 -1
- package/dist/types/components/password-field/index.d.ts +2 -0
- package/dist/types/components/password-field/password-field.d.ts +34 -0
- package/dist/types/components/popover/popover.d.ts +1 -1
- package/dist/types/components/radio-cards/index.d.ts +1 -0
- package/dist/types/components/radio-cards/radio-cards.d.ts +42 -0
- package/dist/types/components/radio-group/radio-group.d.ts +1 -1
- package/dist/types/components/resizable-panels/index.d.ts +2 -0
- package/dist/types/components/resizable-panels/resizable-panels.d.ts +42 -0
- package/dist/types/components/scroll-area/index.d.ts +2 -0
- package/dist/types/components/scroll-area/scroll-area.d.ts +34 -0
- package/dist/types/components/search-field/index.d.ts +1 -0
- package/dist/types/components/search-field/search-field.d.ts +31 -0
- package/dist/types/components/segmented-control/index.d.ts +2 -0
- package/dist/types/components/segmented-control/segmented-control.d.ts +32 -0
- package/dist/types/components/select/select.d.ts +1 -1
- package/dist/types/components/signature-pad/index.d.ts +2 -0
- package/dist/types/components/signature-pad/signature-pad.d.ts +104 -0
- package/dist/types/components/slider/index.d.ts +1 -0
- package/dist/types/components/slider/slider-style.d.ts +14 -0
- package/dist/types/components/slider/slider.d.ts +62 -0
- package/dist/types/components/slider/use-slider-interaction.d.ts +79 -0
- package/dist/types/components/sortable-data-table/index.d.ts +1 -0
- package/dist/types/components/sortable-data-table/sortable-data-table.d.ts +76 -0
- package/dist/types/components/split-button/index.d.ts +2 -0
- package/dist/types/components/split-button/split-button.d.ts +55 -0
- package/dist/types/components/stepper/index.d.ts +2 -0
- package/dist/types/components/stepper/stepper.d.ts +85 -0
- package/dist/types/components/swipe-actions/index.d.ts +2 -0
- package/dist/types/components/swipe-actions/swipe-actions.d.ts +44 -0
- package/dist/types/components/tabs/tabs.d.ts +1 -1
- package/dist/types/components/tag-input/index.d.ts +2 -0
- package/dist/types/components/tag-input/tag-input.d.ts +66 -0
- package/dist/types/components/text-field/text-field.d.ts +1 -1
- package/dist/types/components/textarea/textarea.d.ts +1 -1
- package/dist/types/components/theme-switch/index.d.ts +1 -0
- package/dist/types/components/theme-switch/theme-switch.d.ts +33 -0
- package/dist/types/components/time-picker/index.d.ts +2 -0
- package/dist/types/components/time-picker/time-picker.d.ts +48 -0
- package/dist/types/components/timeline/index.d.ts +2 -0
- package/dist/types/components/timeline/timeline.d.ts +66 -0
- package/dist/types/components/toast/toast.d.ts +37 -2
- package/dist/types/components/toast-stack/index.d.ts +2 -0
- package/dist/types/components/toast-stack/toast-stack.d.ts +28 -0
- package/dist/types/components/tooltip/tooltip.d.ts +2 -2
- package/dist/types/components/tree-view/index.d.ts +1 -0
- package/dist/types/components/tree-view/tree-view.d.ts +47 -0
- package/dist/types/components/usage-meter/index.d.ts +2 -0
- package/dist/types/components/usage-meter/usage-meter.d.ts +83 -0
- package/dist/types/index.d.ts +45 -0
- package/dist/types/overlay/overlay-layer.d.ts +53 -0
- package/dist/types/overlay/use-overlay-floating.d.ts +19 -2
- package/dist/types/styling/media.d.ts +1 -0
- package/dist/types/styling/theme.d.ts +12 -0
- package/dist/types/utils/use-controlled-state.d.ts +2 -1
- package/dist/usage-meter-qyQ3rYVv.js +463 -0
- package/dist/usage-meter.js +2 -0
- package/dist/use-controlled-state-DpeVQZNR.js +20 -0
- package/dist/use-latest-callback-cj1OOQL6.js +11 -0
- package/dist/use-overlay-floating-Bx2jBKAA.js +33 -0
- package/dist/use-slider-interaction-ChL-208h.js +234 -0
- package/package.json +195 -3
- package/dist/accordion-Bd-j04hW.js +0 -198
- package/dist/avatar-BahDVO9t.js +0 -132
- package/dist/badge-B_sLygxU.js +0 -108
- package/dist/calendar-C9Yad_-w.js +0 -394
- package/dist/card-D-aI2QHx.js +0 -158
- package/dist/collection-registry-BTYi6zGh.js +0 -98
- package/dist/combobox-DiMC2g_u.js +0 -327
- package/dist/command-palette-V_2pEay7.js +0 -379
- package/dist/date-picker-C29Uo4Tx.js +0 -250
- package/dist/field-anatomy-D2ToMeRa.js +0 -109
- package/dist/menu-CGPTNRnF.js +0 -216
- package/dist/pill-DO2gHzMb.js +0 -56
- package/dist/popover-CdRXjQqI.js +0 -113
- package/dist/select-BgG7WgSh.js +0 -286
- package/dist/switch-Dr-qjmT4.js +0 -142
- package/dist/tabs-CK_g1RKa.js +0 -203
- package/dist/toast-CjmELMZZ.js +0 -283
- package/dist/tooltip-CaL3rKbV.js +0 -108
- package/dist/use-controlled-state-CVXDa-qM.js +0 -21
- package/dist/use-overlay-floating-Bit-f0FU.js +0 -31
- package/dist/{theme-root-BbTBuLMQ.js → theme-root-Bs1U3uPA.js} +2 -2
|
@@ -0,0 +1,370 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { i as e, r as t, t as n } from "./sx-Dx9JUKp5.js";
|
|
3
|
+
import { n as r, r as i } from "./media-8yrN85VT.js";
|
|
4
|
+
import { t as a } from "./use-latest-callback-cj1OOQL6.js";
|
|
5
|
+
import { t as o } from "./use-controlled-state-DpeVQZNR.js";
|
|
6
|
+
import { t as s } from "./renderable-DzcIj1Lo.js";
|
|
7
|
+
import { t as c } from "./icon-wrapper-stN8sD7R.js";
|
|
8
|
+
import { t as l } from "./trigger-style-B1KVC8O1.js";
|
|
9
|
+
import { s as u } from "./listbox-style-WX-RASp1.js";
|
|
10
|
+
import { a as d, c as f, d as p, i as m, l as h, n as g, r as _, s as v, u as y } from "./menu-DDKgmK2F.js";
|
|
11
|
+
import { createContext as b, useCallback as x, useContext as S, useEffect as C, useId as w, useLayoutEffect as T, useMemo as ee, useRef as E, useState as D } from "react";
|
|
12
|
+
import { vars as O } from "@jfrader/tokens/vars";
|
|
13
|
+
import { Fragment as te, jsx as k, jsxs as A } from "@emotion/react/jsx-runtime";
|
|
14
|
+
import { useMergeRefs as j } from "@floating-ui/react";
|
|
15
|
+
import { isEventTargetWithin as ne } from "@floating-ui/react/utils";
|
|
16
|
+
//#region src/components/context-menu/context-menu.tsx
|
|
17
|
+
var M = "ContextMenu", N = "13rem", P = "300px", re = 4, F = "--context-menu-origin", I = "--context-menu-available-inline", L = "--context-menu-available-block", R = b(null);
|
|
18
|
+
function z(e) {
|
|
19
|
+
let t = S(R);
|
|
20
|
+
if (!t) throw Error(`${M}.${e} must be rendered inside <${M}>.`);
|
|
21
|
+
return t;
|
|
22
|
+
}
|
|
23
|
+
var B = (e) => {
|
|
24
|
+
let { x: t, y: n, width: r, height: i } = e.getBoundingClientRect();
|
|
25
|
+
return {
|
|
26
|
+
x: t,
|
|
27
|
+
y: n,
|
|
28
|
+
width: r,
|
|
29
|
+
height: i
|
|
30
|
+
};
|
|
31
|
+
}, V = (e) => getComputedStyle(e).direction === "rtl", H = (e) => {
|
|
32
|
+
let t = B(e);
|
|
33
|
+
return {
|
|
34
|
+
...t,
|
|
35
|
+
x: V(e) ? t.x + t.width : t.x,
|
|
36
|
+
width: 0
|
|
37
|
+
};
|
|
38
|
+
}, U = (e, t) => ({
|
|
39
|
+
x: e,
|
|
40
|
+
y: t,
|
|
41
|
+
width: 0,
|
|
42
|
+
height: 0
|
|
43
|
+
}), ie = (e) => e.nativeEvent.pointerType === "" || e.clientX === 0 && e.clientY === 0, ae = (e) => e.key === "ContextMenu" || e.key === "F10" && e.shiftKey, oe = (e) => e.key === "Enter" || e.key === " ", se = (e) => Object.fromEntries(Object.entries(e).filter(([e]) => e.startsWith("aria-"))), ce = e({
|
|
44
|
+
from: {
|
|
45
|
+
opacity: 0,
|
|
46
|
+
scale: "0.98"
|
|
47
|
+
},
|
|
48
|
+
to: {
|
|
49
|
+
opacity: 1,
|
|
50
|
+
scale: "1"
|
|
51
|
+
}
|
|
52
|
+
}), le = t({
|
|
53
|
+
label: "context-menu-target",
|
|
54
|
+
"&:focus-visible": {
|
|
55
|
+
outline: `2px solid ${O.color.focusRing}`,
|
|
56
|
+
outlineOffset: "2px"
|
|
57
|
+
}
|
|
58
|
+
}), ue = t({
|
|
59
|
+
label: "context-menu",
|
|
60
|
+
borderColor: O.color.borderControl,
|
|
61
|
+
inlineSize: N,
|
|
62
|
+
minInlineSize: 0,
|
|
63
|
+
maxInlineSize: `var(${I}, ${N})`,
|
|
64
|
+
maxBlockSize: `min(${P}, var(${L}, ${P}))`,
|
|
65
|
+
overflowY: "auto",
|
|
66
|
+
overscrollBehavior: "contain",
|
|
67
|
+
fontSize: O.textSize.sm,
|
|
68
|
+
transformOrigin: `var(${F}, top left)`,
|
|
69
|
+
animation: `${ce} ${O.motion.duration.base} ${O.motion.easeStandard}`,
|
|
70
|
+
"&:focus-visible": {
|
|
71
|
+
outline: `2px solid ${O.color.focusRing}`,
|
|
72
|
+
outlineOffset: "2px"
|
|
73
|
+
},
|
|
74
|
+
[i]: { animation: "none" },
|
|
75
|
+
[r]: { borderColor: "ButtonText" }
|
|
76
|
+
}), W = t({
|
|
77
|
+
gap: O.space[2],
|
|
78
|
+
lineHeight: O.lineHeight.base,
|
|
79
|
+
[r]: { "&[data-active]": {
|
|
80
|
+
outline: "2px solid Highlight",
|
|
81
|
+
outlineOffset: "-2px"
|
|
82
|
+
} }
|
|
83
|
+
}), de = t({
|
|
84
|
+
flex: 1,
|
|
85
|
+
minInlineSize: 0,
|
|
86
|
+
overflowWrap: "anywhere"
|
|
87
|
+
}), fe = t({
|
|
88
|
+
boxSizing: "border-box",
|
|
89
|
+
display: "inline-flex",
|
|
90
|
+
alignItems: "center",
|
|
91
|
+
justifyContent: "center",
|
|
92
|
+
flexShrink: 0,
|
|
93
|
+
inlineSize: "1rem",
|
|
94
|
+
blockSize: "1rem",
|
|
95
|
+
border: `1px solid ${O.color.borderControl}`,
|
|
96
|
+
borderRadius: O.radius.sm,
|
|
97
|
+
"& svg": {
|
|
98
|
+
inlineSize: "0.75rem",
|
|
99
|
+
blockSize: "0.75rem",
|
|
100
|
+
visibility: "hidden"
|
|
101
|
+
},
|
|
102
|
+
"&[data-state=\"checked\"] svg": { visibility: "visible" },
|
|
103
|
+
[r]: { borderColor: "ButtonText" }
|
|
104
|
+
}), pe = /* @__PURE__ */ k("svg", {
|
|
105
|
+
viewBox: "0 0 16 16",
|
|
106
|
+
fill: "none",
|
|
107
|
+
stroke: "currentColor",
|
|
108
|
+
strokeWidth: "2",
|
|
109
|
+
strokeLinecap: "round",
|
|
110
|
+
strokeLinejoin: "round",
|
|
111
|
+
children: /* @__PURE__ */ k("path", { d: "M3.5 8.5l3 3 6-7" })
|
|
112
|
+
});
|
|
113
|
+
function me({ available: e, children: t }) {
|
|
114
|
+
let { open: n, refs: r, requestOpen: i, requestClose: o } = p(M, "Root"), s = E(null), c = E(null), l = E(!1), [u, d] = D(null), [f, m] = D(), [h, g] = D(), _ = a(() => o(!1)), v = x((e, t) => {
|
|
115
|
+
r.setReference(e), r.setPositionReference({
|
|
116
|
+
getBoundingClientRect: () => DOMRect.fromRect(t),
|
|
117
|
+
contextElement: e
|
|
118
|
+
}), d(t), l.current = !0, queueMicrotask(() => l.current = !1);
|
|
119
|
+
}, [r]);
|
|
120
|
+
T(() => {
|
|
121
|
+
if (!n) return;
|
|
122
|
+
let e = s.current;
|
|
123
|
+
e && (m(V(e) ? "rtl" : "ltr"), l.current || v(e, H(e)));
|
|
124
|
+
}, [n, v]), C(() => {
|
|
125
|
+
let e = r.domReference.current;
|
|
126
|
+
if (!n || !e) return;
|
|
127
|
+
let t = e.ownerDocument, i = t.defaultView, a = !1, o = (e) => {
|
|
128
|
+
a || e.type === "scroll" && ne(e, r.floating.current) || (a = !0, _());
|
|
129
|
+
};
|
|
130
|
+
return t.addEventListener("scroll", o, {
|
|
131
|
+
capture: !0,
|
|
132
|
+
passive: !0
|
|
133
|
+
}), i?.addEventListener("resize", o), () => {
|
|
134
|
+
t.removeEventListener("scroll", o, { capture: !0 }), i?.removeEventListener("resize", o);
|
|
135
|
+
};
|
|
136
|
+
}, [
|
|
137
|
+
n,
|
|
138
|
+
r,
|
|
139
|
+
_
|
|
140
|
+
]);
|
|
141
|
+
let y = ee(() => ({
|
|
142
|
+
targetRef: s,
|
|
143
|
+
triggerRef: c,
|
|
144
|
+
anchorTo: v,
|
|
145
|
+
invoke: (e, t) => {
|
|
146
|
+
v(e, t), i();
|
|
147
|
+
},
|
|
148
|
+
anchor: u,
|
|
149
|
+
available: e,
|
|
150
|
+
direction: f,
|
|
151
|
+
targetLabel: h,
|
|
152
|
+
setTargetLabel: g
|
|
153
|
+
}), [
|
|
154
|
+
v,
|
|
155
|
+
i,
|
|
156
|
+
u,
|
|
157
|
+
e,
|
|
158
|
+
f,
|
|
159
|
+
h
|
|
160
|
+
]);
|
|
161
|
+
return /* @__PURE__ */ k(R.Provider, {
|
|
162
|
+
value: y,
|
|
163
|
+
children: t
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
function G({ open: e, defaultOpen: t = !1, onOpenChange: n, children: r }) {
|
|
167
|
+
let [i, a] = D();
|
|
168
|
+
return /* @__PURE__ */ k(_, {
|
|
169
|
+
open: e,
|
|
170
|
+
defaultOpen: t,
|
|
171
|
+
onOpenChange: n,
|
|
172
|
+
placement: "bottom-start",
|
|
173
|
+
positioning: {
|
|
174
|
+
strategy: "fixed",
|
|
175
|
+
gap: re,
|
|
176
|
+
transform: !1,
|
|
177
|
+
onAvailableSize: (e) => a((t) => t?.width === e.width && t.height === e.height ? t : e)
|
|
178
|
+
},
|
|
179
|
+
children: /* @__PURE__ */ k(me, {
|
|
180
|
+
available: i,
|
|
181
|
+
children: r
|
|
182
|
+
})
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
G.displayName = "ContextMenu";
|
|
186
|
+
function K({ ref: e, id: t, openOnClick: r = !1, disabled: i = !1, "aria-labelledby": a, className: o, sx: s, ...c }) {
|
|
187
|
+
let l = z("Target"), { open: u, refs: d, requestClose: f, getReferenceProps: m } = p(M, "Target"), h = w(), g = t ?? h, _ = j([l.targetRef, e]), { setTargetLabel: y, triggerRef: b } = l;
|
|
188
|
+
T(() => (y(a ?? g), () => y(void 0)), [
|
|
189
|
+
a,
|
|
190
|
+
g,
|
|
191
|
+
y
|
|
192
|
+
]);
|
|
193
|
+
let x = (e) => b.current?.contains(e.target) ?? !1, S = i ? {} : {
|
|
194
|
+
...se(m()),
|
|
195
|
+
onContextMenu: (e) => {
|
|
196
|
+
e.preventDefault();
|
|
197
|
+
let t = e.currentTarget;
|
|
198
|
+
l.invoke(t, ie(e) ? H(t) : U(e.clientX, e.clientY));
|
|
199
|
+
},
|
|
200
|
+
onKeyDown: (e) => {
|
|
201
|
+
let t = r && oe(e) && e.target === e.currentTarget;
|
|
202
|
+
(ae(e) || t) && (e.preventDefault(), l.invoke(e.currentTarget, H(e.currentTarget)));
|
|
203
|
+
},
|
|
204
|
+
onMouseDown: (e) => {
|
|
205
|
+
u && e.button === 2 && e.preventDefault();
|
|
206
|
+
},
|
|
207
|
+
onPointerDown: (e) => {
|
|
208
|
+
!u || r || e.button !== 0 || e.ctrlKey || d.domReference.current !== e.currentTarget || x(e) || f(!1);
|
|
209
|
+
},
|
|
210
|
+
onClick: r ? (e) => {
|
|
211
|
+
e.detail === 0 || x(e) || l.invoke(e.currentTarget, U(e.clientX, e.clientY));
|
|
212
|
+
} : void 0
|
|
213
|
+
};
|
|
214
|
+
return /* @__PURE__ */ k(n, {
|
|
215
|
+
className: o,
|
|
216
|
+
styles: le,
|
|
217
|
+
sx: s,
|
|
218
|
+
children: (e) => /* @__PURE__ */ k("div", {
|
|
219
|
+
role: "group",
|
|
220
|
+
tabIndex: 0,
|
|
221
|
+
...v(c, (e) => ({
|
|
222
|
+
...e,
|
|
223
|
+
...S
|
|
224
|
+
})),
|
|
225
|
+
ref: _,
|
|
226
|
+
id: g,
|
|
227
|
+
"aria-labelledby": a,
|
|
228
|
+
"data-ui": "context-menu-target",
|
|
229
|
+
"data-disabled": i || void 0,
|
|
230
|
+
className: e
|
|
231
|
+
})
|
|
232
|
+
});
|
|
233
|
+
}
|
|
234
|
+
K.displayName = "ContextMenu.Target";
|
|
235
|
+
function q({ ref: e, id: t, className: r, sx: i, ...a }) {
|
|
236
|
+
let o = z("Trigger"), { open: s, getReferenceProps: c } = p(M, "Trigger"), u = w(), d = j([o.triggerRef, e]), f = (e) => (t) => {
|
|
237
|
+
s || o.anchorTo(t.currentTarget, B(t.currentTarget)), typeof e == "function" && e(t);
|
|
238
|
+
}, m = (e) => {
|
|
239
|
+
let t = c(e);
|
|
240
|
+
return {
|
|
241
|
+
...t,
|
|
242
|
+
onClick: f(t.onClick),
|
|
243
|
+
onKeyDown: f(t.onKeyDown)
|
|
244
|
+
};
|
|
245
|
+
};
|
|
246
|
+
return /* @__PURE__ */ k(n, {
|
|
247
|
+
className: r,
|
|
248
|
+
styles: l,
|
|
249
|
+
sx: i,
|
|
250
|
+
children: (e) => /* @__PURE__ */ k("button", {
|
|
251
|
+
type: "button",
|
|
252
|
+
...v(a, m),
|
|
253
|
+
ref: d,
|
|
254
|
+
id: t ?? u,
|
|
255
|
+
"data-ui": "context-menu-trigger",
|
|
256
|
+
className: e
|
|
257
|
+
})
|
|
258
|
+
});
|
|
259
|
+
}
|
|
260
|
+
q.displayName = "ContextMenu.Trigger";
|
|
261
|
+
function J({ ref: e, style: t, dir: n, onKeyDown: r, ...i }) {
|
|
262
|
+
let { anchor: a, available: o, direction: s, targetLabel: c } = z("Content"), { floatingContext: l, refs: d } = p(M, "Content"), [f, m] = D(null), h = j([m, e]);
|
|
263
|
+
C(() => {
|
|
264
|
+
f && !f.querySelector("[role^=\"menuitem\"]:not([aria-disabled=\"true\"])") && f.focus({ preventScroll: !0 });
|
|
265
|
+
}, [f]);
|
|
266
|
+
let { x: _, y: v, placement: y } = l, b = n ?? s, x = a && `${(b === "rtl" ? a.x + a.width : a.x) - _}px ${(y.startsWith("top") ? a.y : a.y + a.height) - v}px`, S = {
|
|
267
|
+
[F]: x || void 0,
|
|
268
|
+
[I]: o ? `${o.width}px` : void 0,
|
|
269
|
+
[L]: o ? `${o.height}px` : void 0
|
|
270
|
+
};
|
|
271
|
+
return /* @__PURE__ */ k(g, {
|
|
272
|
+
...i,
|
|
273
|
+
ref: h,
|
|
274
|
+
dir: b,
|
|
275
|
+
style: {
|
|
276
|
+
...t,
|
|
277
|
+
...S
|
|
278
|
+
},
|
|
279
|
+
onKeyDown: (e) => {
|
|
280
|
+
r?.(e);
|
|
281
|
+
let t = d.domReference.current;
|
|
282
|
+
!e.defaultPrevented && e.key === "Tab" && e.shiftKey && t && (e.preventDefault(), t.focus());
|
|
283
|
+
},
|
|
284
|
+
defaultLabelledBy: c,
|
|
285
|
+
family: M,
|
|
286
|
+
marker: "context-menu",
|
|
287
|
+
styles: [u, ue]
|
|
288
|
+
});
|
|
289
|
+
}
|
|
290
|
+
J.displayName = "ContextMenu.Content";
|
|
291
|
+
var Y = (e) => s(e) && e !== "";
|
|
292
|
+
function X({ icon: e, children: t }) {
|
|
293
|
+
return /* @__PURE__ */ A(te, { children: [Y(e) && /* @__PURE__ */ k("span", {
|
|
294
|
+
css: c,
|
|
295
|
+
"aria-hidden": !0,
|
|
296
|
+
"data-ui": "context-menu-item-icon",
|
|
297
|
+
children: e
|
|
298
|
+
}), Y(t) && /* @__PURE__ */ k("span", {
|
|
299
|
+
css: de,
|
|
300
|
+
children: t
|
|
301
|
+
})] });
|
|
302
|
+
}
|
|
303
|
+
function Z({ tone: e = "neutral", icon: t, children: n, ...r }) {
|
|
304
|
+
return z("Item"), /* @__PURE__ */ k(m, {
|
|
305
|
+
...r,
|
|
306
|
+
part: "Item",
|
|
307
|
+
family: M,
|
|
308
|
+
marker: "context-menu-item",
|
|
309
|
+
styles: [
|
|
310
|
+
f,
|
|
311
|
+
W,
|
|
312
|
+
h[e]
|
|
313
|
+
],
|
|
314
|
+
children: /* @__PURE__ */ k(X, {
|
|
315
|
+
icon: t,
|
|
316
|
+
children: n
|
|
317
|
+
})
|
|
318
|
+
});
|
|
319
|
+
}
|
|
320
|
+
Z.displayName = "ContextMenu.Item";
|
|
321
|
+
function Q({ value: e, defaultValue: t = !1, onValueChange: n, onSelect: r, closeOnSelect: i = !1, tone: a = "neutral", icon: s, children: c, ...l }) {
|
|
322
|
+
z("CheckboxItem");
|
|
323
|
+
let [u = !1, d] = o(e, t, n);
|
|
324
|
+
return /* @__PURE__ */ A(m, {
|
|
325
|
+
...l,
|
|
326
|
+
"aria-checked": u,
|
|
327
|
+
onSelect: () => {
|
|
328
|
+
d(!u), r?.();
|
|
329
|
+
},
|
|
330
|
+
itemRole: "menuitemcheckbox",
|
|
331
|
+
closeOnSelect: i,
|
|
332
|
+
part: "CheckboxItem",
|
|
333
|
+
family: M,
|
|
334
|
+
marker: "context-menu-checkbox-item",
|
|
335
|
+
styles: [
|
|
336
|
+
f,
|
|
337
|
+
W,
|
|
338
|
+
h[a]
|
|
339
|
+
],
|
|
340
|
+
children: [/* @__PURE__ */ k("span", {
|
|
341
|
+
css: fe,
|
|
342
|
+
"aria-hidden": !0,
|
|
343
|
+
"data-state": u ? "checked" : "unchecked",
|
|
344
|
+
"data-ui": "context-menu-check",
|
|
345
|
+
children: pe
|
|
346
|
+
}), /* @__PURE__ */ k(X, {
|
|
347
|
+
icon: s,
|
|
348
|
+
children: c
|
|
349
|
+
})]
|
|
350
|
+
});
|
|
351
|
+
}
|
|
352
|
+
Q.displayName = "ContextMenu.CheckboxItem";
|
|
353
|
+
function $(e) {
|
|
354
|
+
return z("Separator"), /* @__PURE__ */ k(d, {
|
|
355
|
+
...e,
|
|
356
|
+
marker: "context-menu-separator",
|
|
357
|
+
styles: y
|
|
358
|
+
});
|
|
359
|
+
}
|
|
360
|
+
$.displayName = "ContextMenu.Separator";
|
|
361
|
+
var he = Object.assign(G, {
|
|
362
|
+
Target: K,
|
|
363
|
+
Trigger: q,
|
|
364
|
+
Content: J,
|
|
365
|
+
Item: Z,
|
|
366
|
+
CheckboxItem: Q,
|
|
367
|
+
Separator: $
|
|
368
|
+
});
|
|
369
|
+
//#endregion
|
|
370
|
+
export { he as t };
|
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { r as e } from "./sx-Dx9JUKp5.js";
|
|
3
|
+
import { n as t, r as n } from "./media-8yrN85VT.js";
|
|
4
|
+
import { t as r } from "./use-controlled-state-DpeVQZNR.js";
|
|
5
|
+
import { t as i } from "./visually-hidden-BJdvqqvn.js";
|
|
6
|
+
import { t as a } from "./renderable-DzcIj1Lo.js";
|
|
7
|
+
import { t as o } from "./loading-ring-B8-30Dl1.js";
|
|
8
|
+
import { t as ee } from "./button-NLY0h6EJ.js";
|
|
9
|
+
import { useEffect as s, useRef as c, useState as l } from "react";
|
|
10
|
+
import { vars as u } from "@jfrader/tokens/vars";
|
|
11
|
+
import { Fragment as d, jsx as f, jsxs as p } from "@emotion/react/jsx-runtime";
|
|
12
|
+
import { flushSync as te } from "react-dom";
|
|
13
|
+
//#region src/components/copy-button/copy-button.tsx
|
|
14
|
+
var m = 1900, h = [
|
|
15
|
+
"idle",
|
|
16
|
+
"pending",
|
|
17
|
+
"copied",
|
|
18
|
+
"error"
|
|
19
|
+
], ne = e({
|
|
20
|
+
label: "copy-button",
|
|
21
|
+
position: "relative",
|
|
22
|
+
maxInlineSize: "100%"
|
|
23
|
+
}), re = e({
|
|
24
|
+
whiteSpace: "normal",
|
|
25
|
+
blockSize: "auto",
|
|
26
|
+
paddingBlock: u.space[1]
|
|
27
|
+
}), g = {
|
|
28
|
+
sm: e({ minBlockSize: u.space[8] }),
|
|
29
|
+
md: e({ minBlockSize: u.space[10] }),
|
|
30
|
+
lg: e({ minBlockSize: u.space[12] })
|
|
31
|
+
}, ie = {
|
|
32
|
+
sm: e({
|
|
33
|
+
inlineSize: u.space[8],
|
|
34
|
+
paddingInline: 0
|
|
35
|
+
}),
|
|
36
|
+
md: e({
|
|
37
|
+
inlineSize: u.space[10],
|
|
38
|
+
paddingInline: 0
|
|
39
|
+
}),
|
|
40
|
+
lg: e({
|
|
41
|
+
inlineSize: u.space[12],
|
|
42
|
+
paddingInline: 0
|
|
43
|
+
})
|
|
44
|
+
}, _ = e({
|
|
45
|
+
display: "grid",
|
|
46
|
+
minInlineSize: 0
|
|
47
|
+
}), v = e({
|
|
48
|
+
flexShrink: 0,
|
|
49
|
+
inlineSize: u.space[4],
|
|
50
|
+
blockSize: u.space[4]
|
|
51
|
+
}), y = e({ textAlign: "start" }), b = e({
|
|
52
|
+
gridArea: "1 / 1",
|
|
53
|
+
minInlineSize: 0,
|
|
54
|
+
opacity: 0,
|
|
55
|
+
transitionProperty: "opacity",
|
|
56
|
+
transitionDuration: u.motion.duration.base,
|
|
57
|
+
transitionTimingFunction: u.motion.easeStandard,
|
|
58
|
+
"&[data-active]": { opacity: 1 },
|
|
59
|
+
[n]: { transitionDuration: "0s" }
|
|
60
|
+
}), ae = e({ overflowWrap: "anywhere" }), oe = e({
|
|
61
|
+
display: "inline-flex",
|
|
62
|
+
alignItems: "center",
|
|
63
|
+
justifyContent: "center",
|
|
64
|
+
"& svg": {
|
|
65
|
+
inlineSize: "100%",
|
|
66
|
+
blockSize: "100%"
|
|
67
|
+
}
|
|
68
|
+
}), x = {
|
|
69
|
+
copied: e({
|
|
70
|
+
color: u.color.success,
|
|
71
|
+
[t]: { color: "ButtonText" }
|
|
72
|
+
}),
|
|
73
|
+
error: e({
|
|
74
|
+
color: u.color.dangerText,
|
|
75
|
+
[t]: { color: "ButtonText" }
|
|
76
|
+
})
|
|
77
|
+
}, se = {
|
|
78
|
+
solid: {},
|
|
79
|
+
soft: x,
|
|
80
|
+
outline: x,
|
|
81
|
+
ghost: x
|
|
82
|
+
}, S = e({
|
|
83
|
+
...o,
|
|
84
|
+
boxSizing: "border-box",
|
|
85
|
+
inlineSize: "100%",
|
|
86
|
+
blockSize: "100%",
|
|
87
|
+
[n]: { animation: "none" }
|
|
88
|
+
}), C = {
|
|
89
|
+
viewBox: "0 0 16 16",
|
|
90
|
+
fill: "none",
|
|
91
|
+
stroke: "currentColor",
|
|
92
|
+
strokeWidth: 1.5,
|
|
93
|
+
strokeLinecap: "round",
|
|
94
|
+
strokeLinejoin: "round"
|
|
95
|
+
}, ce = {
|
|
96
|
+
idle: /* @__PURE__ */ p("svg", {
|
|
97
|
+
...C,
|
|
98
|
+
children: [/* @__PURE__ */ f("rect", {
|
|
99
|
+
x: "5.5",
|
|
100
|
+
y: "5.5",
|
|
101
|
+
width: "8",
|
|
102
|
+
height: "8",
|
|
103
|
+
rx: "1.5"
|
|
104
|
+
}), /* @__PURE__ */ f("path", { d: "M10.5 3.5v-.5a1 1 0 0 0-1-1h-6a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h.5" })]
|
|
105
|
+
}),
|
|
106
|
+
pending: /* @__PURE__ */ f("span", { css: S }),
|
|
107
|
+
copied: /* @__PURE__ */ f("svg", {
|
|
108
|
+
...C,
|
|
109
|
+
children: /* @__PURE__ */ f("path", { d: "M3 8.5l3.25 3.25L13 5" })
|
|
110
|
+
}),
|
|
111
|
+
error: /* @__PURE__ */ f("svg", {
|
|
112
|
+
...C,
|
|
113
|
+
children: /* @__PURE__ */ f("path", { d: "M4.5 4.5l7 7M11.5 4.5l-7 7" })
|
|
114
|
+
})
|
|
115
|
+
}, w = (e) => e === "copied" || e === "error", T = (e) => e === !0 || e === "true";
|
|
116
|
+
function E({ ref: e, text: t, label: n, pendingLabel: o, copiedLabel: u, errorLabel: x, iconOnly: S = !1, icons: C, value: E, defaultValue: le = "idle", onValueChange: ue, onCopied: D, onCopyError: O, resetAfterMs: k = m, variant: A = "outline", tone: j = "neutral", size: M = "sm", slotProps: N, disabled: P, onClick: F, className: I, css: L, sx: R, ...z }) {
|
|
117
|
+
let [B, V] = r(E, le, ue), H = B ?? "idle", U = c(null), [W, G] = l(!1), K = c(!1), q = c(V), J = c({
|
|
118
|
+
onCopied: D,
|
|
119
|
+
onCopyError: O
|
|
120
|
+
});
|
|
121
|
+
s(() => {
|
|
122
|
+
q.current = V, J.current = {
|
|
123
|
+
onCopied: D,
|
|
124
|
+
onCopyError: O
|
|
125
|
+
};
|
|
126
|
+
}), s(() => (K.current = !0, () => {
|
|
127
|
+
K.current = !1, U.current = null;
|
|
128
|
+
}), []);
|
|
129
|
+
let Y = Number.isFinite(k) && k > 0 ? k : 0;
|
|
130
|
+
s(() => {
|
|
131
|
+
if (W || !w(H) || Y === 0) return;
|
|
132
|
+
let e = setTimeout(() => q.current("idle"), Y);
|
|
133
|
+
return () => clearTimeout(e);
|
|
134
|
+
}, [
|
|
135
|
+
H,
|
|
136
|
+
W,
|
|
137
|
+
Y
|
|
138
|
+
]);
|
|
139
|
+
let X = (e, t) => {
|
|
140
|
+
K.current && U.current === e && (U.current = null, G(!1), t.ok ? (q.current("copied"), J.current.onCopied?.(t.text)) : (q.current("error"), J.current.onCopyError?.(t.error)));
|
|
141
|
+
}, de = (e) => {
|
|
142
|
+
if (U.current || (F?.(e), e.defaultPrevented)) return;
|
|
143
|
+
let n = t, r = e.currentTarget.ownerDocument.defaultView?.navigator.clipboard, i = {};
|
|
144
|
+
if (U.current = i, te(() => {
|
|
145
|
+
G(!0), V("pending");
|
|
146
|
+
}), typeof r?.writeText != "function") {
|
|
147
|
+
X(i, {
|
|
148
|
+
ok: !1,
|
|
149
|
+
error: /* @__PURE__ */ Error("Clipboard API is unavailable")
|
|
150
|
+
});
|
|
151
|
+
return;
|
|
152
|
+
}
|
|
153
|
+
let a;
|
|
154
|
+
try {
|
|
155
|
+
a = r.writeText(n);
|
|
156
|
+
} catch (e) {
|
|
157
|
+
X(i, {
|
|
158
|
+
ok: !1,
|
|
159
|
+
error: e
|
|
160
|
+
});
|
|
161
|
+
return;
|
|
162
|
+
}
|
|
163
|
+
Promise.resolve(a).then(() => X(i, {
|
|
164
|
+
ok: !0,
|
|
165
|
+
text: n
|
|
166
|
+
}), (e) => X(i, {
|
|
167
|
+
ok: !1,
|
|
168
|
+
error: e
|
|
169
|
+
}));
|
|
170
|
+
}, Z = H === "pending", Q = {
|
|
171
|
+
idle: n,
|
|
172
|
+
pending: o,
|
|
173
|
+
copied: u,
|
|
174
|
+
error: x
|
|
175
|
+
}, $ = h.map((e) => C?.[e] === void 0 ? ce[e] : C[e]), fe = $.some(a), { css: pe, ...me } = N?.icon ?? {}, { css: he, ...ge } = N?.label ?? {}, { css: _e, ...ve } = N?.status ?? {};
|
|
176
|
+
return /* @__PURE__ */ p(d, { children: [/* @__PURE__ */ p(ee, {
|
|
177
|
+
...z,
|
|
178
|
+
ref: e,
|
|
179
|
+
type: "button",
|
|
180
|
+
variant: A,
|
|
181
|
+
tone: j,
|
|
182
|
+
size: M,
|
|
183
|
+
"data-ui": "copy-button",
|
|
184
|
+
"data-state": H,
|
|
185
|
+
"aria-busy": Z ? !0 : z["aria-busy"],
|
|
186
|
+
"aria-disabled": Z || T(z["aria-disabled"]) ? !0 : z["aria-disabled"],
|
|
187
|
+
onClick: de,
|
|
188
|
+
className: I,
|
|
189
|
+
css: [
|
|
190
|
+
ne,
|
|
191
|
+
S ? ie[M] : [re, g[M]],
|
|
192
|
+
L
|
|
193
|
+
],
|
|
194
|
+
sx: R,
|
|
195
|
+
render: (e) => /* @__PURE__ */ f("button", {
|
|
196
|
+
...e,
|
|
197
|
+
type: "button",
|
|
198
|
+
disabled: P
|
|
199
|
+
}),
|
|
200
|
+
children: [
|
|
201
|
+
/* @__PURE__ */ f("span", {
|
|
202
|
+
css: i,
|
|
203
|
+
children: n
|
|
204
|
+
}),
|
|
205
|
+
fe && /* @__PURE__ */ f("span", {
|
|
206
|
+
...me,
|
|
207
|
+
"aria-hidden": "true",
|
|
208
|
+
"data-ui": "copy-button-icon",
|
|
209
|
+
css: [
|
|
210
|
+
_,
|
|
211
|
+
v,
|
|
212
|
+
pe
|
|
213
|
+
],
|
|
214
|
+
children: h.map((e, t) => /* @__PURE__ */ f("span", {
|
|
215
|
+
"data-active": e === H || void 0,
|
|
216
|
+
css: [
|
|
217
|
+
b,
|
|
218
|
+
oe,
|
|
219
|
+
se[A][e]
|
|
220
|
+
],
|
|
221
|
+
children: $[t]
|
|
222
|
+
}, e))
|
|
223
|
+
}),
|
|
224
|
+
!S && /* @__PURE__ */ f("span", {
|
|
225
|
+
...ge,
|
|
226
|
+
"aria-hidden": "true",
|
|
227
|
+
"data-ui": "copy-button-label",
|
|
228
|
+
css: [
|
|
229
|
+
_,
|
|
230
|
+
y,
|
|
231
|
+
he
|
|
232
|
+
],
|
|
233
|
+
children: h.map((e) => /* @__PURE__ */ f("span", {
|
|
234
|
+
"data-active": e === H || void 0,
|
|
235
|
+
css: [b, ae],
|
|
236
|
+
children: Q[e]
|
|
237
|
+
}, e))
|
|
238
|
+
})
|
|
239
|
+
]
|
|
240
|
+
}), /* @__PURE__ */ f("span", {
|
|
241
|
+
...ve,
|
|
242
|
+
role: "status",
|
|
243
|
+
"aria-live": "polite",
|
|
244
|
+
"aria-atomic": "true",
|
|
245
|
+
"data-ui": "copy-button-status",
|
|
246
|
+
css: [i, _e],
|
|
247
|
+
children: H === "idle" ? "" : Q[H]
|
|
248
|
+
})] });
|
|
249
|
+
}
|
|
250
|
+
E.displayName = "CopyButton";
|
|
251
|
+
//#endregion
|
|
252
|
+
export { E as t };
|