@jfrader/ui 0.4.0 → 0.5.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/README.md +2 -0
- package/dist/{accordion-Bd-j04hW.js → accordion-xCI_u0BV.js} +2 -2
- 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-B58xempt.js +382 -0
- package/dist/announcement-bar.js +2 -0
- package/dist/avatar-group-DOQQuV51.js +138 -0
- package/dist/avatar-group.js +2 -0
- package/dist/bottom-sheet-DPJBFkie.js +673 -0
- package/dist/bottom-sheet.js +2 -0
- package/dist/{breadcrumbs-DVAOxfvL.js → breadcrumbs-Cfw_hgt2.js} +1 -1
- package/dist/breadcrumbs.js +1 -1
- package/dist/{button-P2e7_44z.js → button-C92uYFJW.js} +1 -1
- package/dist/button.js +1 -1
- package/dist/calendar-B3Svu0X2.js +447 -0
- package/dist/calendar.js +1 -1
- package/dist/carousel-IvPqN-oM.js +472 -0
- package/dist/carousel.js +2 -0
- package/dist/{checkbox-COYG6L7d.js → checkbox-cFquiSdy.js} +1 -1
- package/dist/checkbox.js +1 -1
- package/dist/chip-group-DTQd_M-G.js +289 -0
- package/dist/chip-group.js +2 -0
- package/dist/code-block/shiki.js +147 -0
- package/dist/code-block-ahnRi-g8.js +292 -0
- package/dist/code-block.js +2 -0
- package/dist/collection-registry-k6JcD3Jr.js +44 -0
- package/dist/combobox-Bhzvu9ma.js +334 -0
- package/dist/combobox.js +1 -1
- package/dist/command-palette-BQ5LleGb.js +384 -0
- package/dist/command-palette.js +1 -1
- package/dist/copy-button-ByiA6D3R.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-5zKSSuFF.js +255 -0
- package/dist/date-picker.js +1 -1
- package/dist/date-range-picker-B5uFWsm-.js +562 -0
- package/dist/date-range-picker.js +2 -0
- package/dist/{dialog-xaydbXl2.js → dialog-ciiv9H2b.js} +19 -19
- package/dist/dialog.js +1 -1
- package/dist/drawer-DsASTiP-.js +553 -0
- package/dist/drawer.js +2 -0
- package/dist/empty-state-CDgrjPPf.js +142 -0
- package/dist/empty-state.js +2 -0
- package/dist/expandable-card-C-qJcZ14.js +340 -0
- package/dist/expandable-card.js +2 -0
- package/dist/field-anatomy-COVdNpf5.js +84 -0
- package/dist/file-dropzone-pR4v7owg.js +457 -0
- package/dist/file-dropzone.js +2 -0
- package/dist/filter-toolbar-D5KEKTSe.js +312 -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-B-nrCIy2.js +347 -0
- package/dist/hover-card.js +2 -0
- package/dist/image-compare-ciuhPtQZ.js +415 -0
- package/dist/image-compare.js +2 -0
- package/dist/index.js +79 -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-BcySQfjZ.js +798 -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-BcQKX2EJ.js +599 -0
- package/dist/mention-input.js +2 -0
- package/dist/menu-xwOOUtWP.js +275 -0
- package/dist/menu.js +1 -1
- package/dist/metric-card-Bh9K4fZs.js +118 -0
- package/dist/metric-card.js +2 -0
- package/dist/multi-select-Pce_IYnz.js +590 -0
- package/dist/multi-select.js +2 -0
- package/dist/{navigation-DhnKriOp.js → navigation-sP5fiuQS.js} +4 -4
- package/dist/navigation.js +1 -1
- package/dist/overlay-layer-SeUyyEPD.js +64 -0
- package/dist/overlay-portal-C4JZFq2M.js +15 -0
- package/dist/{pagination-DYdwsxwe.js → pagination-DmXZ8E85.js} +1 -1
- package/dist/pagination.js +1 -1
- package/dist/password-field-03pWRkuY.js +250 -0
- package/dist/password-field.js +2 -0
- package/dist/popover-QHcEvf9c.js +119 -0
- package/dist/popover.js +1 -1
- package/dist/{progress-BpJswTG4.js → progress-CbOWBUdA.js} +4 -4
- package/dist/progress.js +1 -1
- package/dist/radio-cards-D2QZENI_.js +455 -0
- package/dist/radio-cards.js +2 -0
- package/dist/{radio-group-Ce0_IWQr.js → radio-group-E6mMRgo7.js} +4 -4
- package/dist/radio-group.js +1 -1
- package/dist/resizable-panels-BhjUVXZZ.js +519 -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-IxF0IJXm.js +274 -0
- package/dist/search-field.js +2 -0
- package/dist/segmented-control-yO1K1nbi.js +326 -0
- package/dist/segmented-control.js +2 -0
- package/dist/select-n_H52W1Z.js +292 -0
- package/dist/select.js +1 -1
- package/dist/signature-pad-q2SAsrdD.js +640 -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-t0B5cecO.js +477 -0
- package/dist/slider.js +2 -0
- package/dist/sortable-data-table-tirqlLY2.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-Cb3EHs64.js +268 -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-DiZC57-3.js +418 -0
- package/dist/swipe-actions.js +2 -0
- package/dist/{switch-Dr-qjmT4.js → switch-qwv8jQnR.js} +1 -1
- package/dist/switch.js +1 -1
- package/dist/{tabs-CK_g1RKa.js → tabs-CAVJndX1.js} +2 -2
- 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-C8TWG-tY.js} +6 -5
- package/dist/text-field.js +1 -1
- package/dist/{textarea-DyfjtP0A.js → textarea-BrW0XcG_.js} +6 -5
- package/dist/textarea.js +1 -1
- package/dist/time-picker-Db8D49cP.js +305 -0
- package/dist/time-picker.js +2 -0
- package/dist/timeline-k3nURuCP.js +618 -0
- package/dist/timeline.js +2 -0
- package/dist/toast-BHxI32ZA.js +352 -0
- package/dist/toast-stack-DqrAzdg5.js +183 -0
- package/dist/toast-stack.js +2 -0
- package/dist/toast.js +1 -1
- package/dist/{toggle-group-CI0e7hFm.js → toggle-group-fcjzpifI.js} +4 -4
- package/dist/toggle-group.js +1 -1
- package/dist/tooltip-CkeiW9C1.js +113 -0
- package/dist/tooltip.js +1 -1
- package/dist/tree-view-C2liIxqy.js +360 -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/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 +1 -1
- 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/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/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 +23 -5
- 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/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/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.d.ts +70 -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/tag-input/index.d.ts +2 -0
- package/dist/types/components/tag-input/tag-input.d.ts +66 -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 +1 -1
- 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 +40 -0
- package/dist/types/overlay/overlay-layer.d.ts +33 -0
- package/dist/types/overlay/use-overlay-floating.d.ts +11 -1
- 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-DvJifLpF.js +31 -0
- package/package.json +175 -3
- package/dist/calendar-C9Yad_-w.js +0 -394
- 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/popover-CdRXjQqI.js +0 -113
- package/dist/select-BgG7WgSh.js +0 -286
- 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
|
@@ -0,0 +1,352 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { r as e, t } from "./sx-Dx9JUKp5.js";
|
|
3
|
+
import { n, r } from "./media-8yrN85VT.js";
|
|
4
|
+
import { t as i } from "./renderable-DzcIj1Lo.js";
|
|
5
|
+
import { t as a } from "./button-C92uYFJW.js";
|
|
6
|
+
import { i as o, t as s } from "./theme-scope-t7nAKc2c.js";
|
|
7
|
+
import { t as c } from "./spinner-DtxvDPdM.js";
|
|
8
|
+
import { createContext as l, useCallback as u, useContext as d, useEffect as f, useId as p, useLayoutEffect as m, useMemo as h, useRef as g, useState as _ } from "react";
|
|
9
|
+
import { vars as v } from "@jfrader/tokens/vars";
|
|
10
|
+
import { Fragment as y, jsx as b, jsxs as x } from "@emotion/react/jsx-runtime";
|
|
11
|
+
import { createPortal as S } from "react-dom";
|
|
12
|
+
//#region src/components/toast/toast.tsx
|
|
13
|
+
var C = 4, w = 5e3, T = "Dismiss", E = 100, D = "min(380px, calc(100vw - 32px))", O = "3px", k = l(null), A = l(null), j = e({
|
|
14
|
+
position: "fixed",
|
|
15
|
+
insetBlockEnd: 0,
|
|
16
|
+
insetInlineEnd: 0,
|
|
17
|
+
display: "flex",
|
|
18
|
+
flexDirection: "column",
|
|
19
|
+
gap: v.space[2],
|
|
20
|
+
inlineSize: D,
|
|
21
|
+
margin: 0,
|
|
22
|
+
paddingInlineEnd: v.space[4],
|
|
23
|
+
paddingBlockEnd: v.space[4],
|
|
24
|
+
pointerEvents: "none",
|
|
25
|
+
fontFamily: v.font.sans
|
|
26
|
+
}), M = e({
|
|
27
|
+
boxSizing: "border-box",
|
|
28
|
+
display: "grid",
|
|
29
|
+
gridTemplateColumns: "minmax(0, 1fr) auto",
|
|
30
|
+
alignItems: "start",
|
|
31
|
+
gap: v.space[2],
|
|
32
|
+
backgroundColor: v.color.surfaceRaised,
|
|
33
|
+
border: `1px solid ${v.color.border}`,
|
|
34
|
+
borderRadius: v.radius.lg,
|
|
35
|
+
boxShadow: v.shadow.floating,
|
|
36
|
+
padding: v.space[3],
|
|
37
|
+
color: v.color.text,
|
|
38
|
+
lineHeight: v.lineHeight.base,
|
|
39
|
+
pointerEvents: "auto",
|
|
40
|
+
transitionProperty: "opacity, transform",
|
|
41
|
+
transitionDuration: v.motion.duration.base,
|
|
42
|
+
transitionTimingFunction: v.motion.easeStandard,
|
|
43
|
+
"&[data-populated=\"false\"][data-exposed=\"true\"]": { opacity: 0 },
|
|
44
|
+
"&[data-state=\"closing\"]": {
|
|
45
|
+
opacity: 0,
|
|
46
|
+
transform: `translateY(${v.space[2]})`,
|
|
47
|
+
pointerEvents: "none"
|
|
48
|
+
},
|
|
49
|
+
[r]: {
|
|
50
|
+
transitionDuration: "0s",
|
|
51
|
+
transform: "none"
|
|
52
|
+
},
|
|
53
|
+
[n]: {
|
|
54
|
+
backgroundColor: "Canvas",
|
|
55
|
+
color: "CanvasText",
|
|
56
|
+
borderColor: "CanvasText"
|
|
57
|
+
}
|
|
58
|
+
}), N = {
|
|
59
|
+
neutral: e({ borderInlineStart: `${O} solid ${v.color.borderStrong}` }),
|
|
60
|
+
success: e({ borderInlineStart: `${O} solid ${v.color.success}` }),
|
|
61
|
+
danger: e({ borderInlineStart: `${O} solid ${v.color.danger}` }),
|
|
62
|
+
info: e({ borderInlineStart: `${O} solid ${v.color.info}` }),
|
|
63
|
+
warning: e({ borderInlineStart: `${O} solid ${v.color.warning}` })
|
|
64
|
+
}, P = e({
|
|
65
|
+
display: "grid",
|
|
66
|
+
gap: v.space[1],
|
|
67
|
+
alignSelf: "center",
|
|
68
|
+
minInlineSize: 0
|
|
69
|
+
}), F = e({
|
|
70
|
+
margin: 0,
|
|
71
|
+
fontSize: v.textSize.sm,
|
|
72
|
+
fontWeight: v.fontWeight.semibold
|
|
73
|
+
}), I = e({
|
|
74
|
+
margin: 0,
|
|
75
|
+
fontSize: v.textSize.sm,
|
|
76
|
+
color: v.color.textMuted
|
|
77
|
+
}), L = e({
|
|
78
|
+
gridColumn: 2,
|
|
79
|
+
gridRow: 1,
|
|
80
|
+
inlineSize: "32px",
|
|
81
|
+
paddingInline: 0
|
|
82
|
+
}), R = e({ display: "contents" }), z = e({
|
|
83
|
+
gridColumn: "1 / -1",
|
|
84
|
+
display: "flex",
|
|
85
|
+
gap: v.space[2]
|
|
86
|
+
});
|
|
87
|
+
function B(e) {
|
|
88
|
+
let t = d(A);
|
|
89
|
+
if (!t) throw Error(`Toast.${e} must be rendered inside <Toast.Provider>.`);
|
|
90
|
+
return t;
|
|
91
|
+
}
|
|
92
|
+
function V() {
|
|
93
|
+
let e = d(k);
|
|
94
|
+
if (!e) throw Error("useToast() must be called inside <Toast.Provider>.");
|
|
95
|
+
return e;
|
|
96
|
+
}
|
|
97
|
+
function H({ children: e, max: t = C, duration: n = w, dismissLabel: r = T }) {
|
|
98
|
+
let i = p(), a = g(0), [o, s] = _([]), c = g([]), l = g(/* @__PURE__ */ new Map()), d = g(null), f = g(0), v = u(() => (f.current += 1, process.env.NODE_ENV !== "production" && f.current > 1 && console.warn("Mount only one Toast queue renderer per provider."), () => {
|
|
99
|
+
--f.current;
|
|
100
|
+
}), []), y = Math.max(1, Math.floor(Number.isFinite(t) ? t : C)), x = u((e, t) => {
|
|
101
|
+
t ? l.current.set(e, t) : l.current.delete(e);
|
|
102
|
+
}, []), S = u((e, t) => {
|
|
103
|
+
for (let n of e) {
|
|
104
|
+
let e = l.current.get(n.id);
|
|
105
|
+
if (!e?.contains(e.ownerDocument.activeElement)) continue;
|
|
106
|
+
let r = e.closest("[data-ui=\"toast-stack-list\"], [data-ui=\"toast-viewport\"]") ?? e.parentElement;
|
|
107
|
+
r && (d.current = {
|
|
108
|
+
container: r,
|
|
109
|
+
ids: new Set(t.filter((e) => e.state === "open").map((e) => e.id))
|
|
110
|
+
});
|
|
111
|
+
break;
|
|
112
|
+
}
|
|
113
|
+
}, []);
|
|
114
|
+
m(() => {
|
|
115
|
+
let e = d.current;
|
|
116
|
+
e && (d.current = null, Array.from(e.container.querySelectorAll("[data-ui=\"toast\"]")).find((t) => e.ids.has(t.dataset.toastId))?.querySelector("[data-toast-dismiss]")?.focus());
|
|
117
|
+
}, [o]);
|
|
118
|
+
let E = u((e) => {
|
|
119
|
+
a.current += 1;
|
|
120
|
+
let t = `${i}toast-${a.current}`, r = {
|
|
121
|
+
id: t,
|
|
122
|
+
options: {
|
|
123
|
+
...e,
|
|
124
|
+
duration: e.duration === void 0 ? e.loading ? null : n : e.duration
|
|
125
|
+
},
|
|
126
|
+
state: "open"
|
|
127
|
+
}, o = c.current, l = [...o, r].slice(-y);
|
|
128
|
+
return S(o.filter((e) => !l.includes(e)), l), c.current = l, s(l), t;
|
|
129
|
+
}, [
|
|
130
|
+
i,
|
|
131
|
+
y,
|
|
132
|
+
n,
|
|
133
|
+
S
|
|
134
|
+
]), D = u((e, t) => {
|
|
135
|
+
let r = c.current.map((r) => {
|
|
136
|
+
if (r.id !== e || r.state !== "open") return r;
|
|
137
|
+
let i = {
|
|
138
|
+
...r.options,
|
|
139
|
+
...t
|
|
140
|
+
};
|
|
141
|
+
return i.duration = t.duration === void 0 ? t.loading === void 0 ? r.options.duration : t.loading ? null : n : t.duration, {
|
|
142
|
+
...r,
|
|
143
|
+
options: i
|
|
144
|
+
};
|
|
145
|
+
});
|
|
146
|
+
c.current = r, s(r);
|
|
147
|
+
}, [n]), O = u((e) => {
|
|
148
|
+
let t = c.current;
|
|
149
|
+
S(t.filter((t) => t.id === e), t.filter((t) => t.id !== e));
|
|
150
|
+
let n = t.map((t) => t.id === e && t.state === "open" ? {
|
|
151
|
+
...t,
|
|
152
|
+
state: "closing"
|
|
153
|
+
} : t);
|
|
154
|
+
c.current = n, s(n);
|
|
155
|
+
}, [S]), j = u((e) => {
|
|
156
|
+
let t = c.current, n = t.filter((t) => t.id !== e);
|
|
157
|
+
S(t.filter((t) => t.id === e), n), c.current = n, s(n);
|
|
158
|
+
}, [S]), M = h(() => ({
|
|
159
|
+
toast: E,
|
|
160
|
+
dismiss: O,
|
|
161
|
+
update: D
|
|
162
|
+
}), [
|
|
163
|
+
E,
|
|
164
|
+
O,
|
|
165
|
+
D
|
|
166
|
+
]), N = h(() => ({
|
|
167
|
+
toasts: o,
|
|
168
|
+
dismiss: O,
|
|
169
|
+
remove: j,
|
|
170
|
+
registerRoot: x,
|
|
171
|
+
dismissLabel: r,
|
|
172
|
+
registerRenderer: v
|
|
173
|
+
}), [
|
|
174
|
+
o,
|
|
175
|
+
O,
|
|
176
|
+
j,
|
|
177
|
+
x,
|
|
178
|
+
r,
|
|
179
|
+
v
|
|
180
|
+
]);
|
|
181
|
+
return /* @__PURE__ */ b(k.Provider, {
|
|
182
|
+
value: M,
|
|
183
|
+
children: /* @__PURE__ */ b(A.Provider, {
|
|
184
|
+
value: N,
|
|
185
|
+
children: e
|
|
186
|
+
})
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
H.displayName = "Toast.Provider";
|
|
190
|
+
function U({ ref: e, className: n, sx: r, ...i }) {
|
|
191
|
+
let { toasts: a, registerRenderer: o } = B("Viewport");
|
|
192
|
+
return f(o, [o]), /* @__PURE__ */ b(W, { children: /* @__PURE__ */ b(t, {
|
|
193
|
+
className: n,
|
|
194
|
+
styles: j,
|
|
195
|
+
sx: r,
|
|
196
|
+
children: (t) => /* @__PURE__ */ b("div", {
|
|
197
|
+
...i,
|
|
198
|
+
ref: e,
|
|
199
|
+
"data-ui": "toast-viewport",
|
|
200
|
+
className: t,
|
|
201
|
+
children: a.map((e) => /* @__PURE__ */ b(G, { record: e }, e.id))
|
|
202
|
+
})
|
|
203
|
+
}) });
|
|
204
|
+
}
|
|
205
|
+
function W({ children: e, contained: t = !1 }) {
|
|
206
|
+
let n = g(null), [r, i] = _(null), a = o()?.portalContainer, c = a === void 0 ? r : a;
|
|
207
|
+
return f(() => {
|
|
208
|
+
i(n.current?.ownerDocument.body ?? null);
|
|
209
|
+
}, []), /* @__PURE__ */ x(y, { children: [/* @__PURE__ */ b("span", {
|
|
210
|
+
hidden: !0,
|
|
211
|
+
ref: n
|
|
212
|
+
}), t ? e : c && S(/* @__PURE__ */ b(s, { children: e }), c)] });
|
|
213
|
+
}
|
|
214
|
+
U.displayName = "Toast.Viewport";
|
|
215
|
+
function G({ record: e, exposed: t = !0, paused: n = !1, style: r, className: o, escapeDismiss: s = !1 }) {
|
|
216
|
+
let { dismiss: l, remove: d, registerRoot: p, dismissLabel: m } = B("Viewport"), { id: h, options: v, state: S } = e, { title: C, description: w, tone: T = "neutral", action: D, loading: O } = v, k = v.duration, A = g(null), j = u((e) => {
|
|
217
|
+
A.current = e, p(h, e);
|
|
218
|
+
}, [h, p]), [V, H] = _(!1), [U, W] = _(!1), [G, q] = _(!1), J = g(k ?? 0), [Y, X] = _(!1);
|
|
219
|
+
f(() => {
|
|
220
|
+
let e = A.current?.ownerDocument;
|
|
221
|
+
if (!e) return;
|
|
222
|
+
let t = () => X(e.hidden);
|
|
223
|
+
return t(), e.addEventListener("visibilitychange", t), () => e.removeEventListener("visibilitychange", t);
|
|
224
|
+
}, []), f(() => {
|
|
225
|
+
J.current = k ?? 0;
|
|
226
|
+
}, [k]), f(() => {
|
|
227
|
+
if (!t || V) return;
|
|
228
|
+
let e = setTimeout(() => H(!0), E);
|
|
229
|
+
return () => clearTimeout(e);
|
|
230
|
+
}, [t, V]);
|
|
231
|
+
let Z = V && t && !n && !Y && S === "open" && k !== null && !U && !G;
|
|
232
|
+
return f(() => {
|
|
233
|
+
if (!Z) return;
|
|
234
|
+
let e = performance.now(), t = setTimeout(() => l(h), J.current);
|
|
235
|
+
return () => {
|
|
236
|
+
clearTimeout(t), J.current -= performance.now() - e;
|
|
237
|
+
};
|
|
238
|
+
}, [
|
|
239
|
+
Z,
|
|
240
|
+
l,
|
|
241
|
+
h,
|
|
242
|
+
k
|
|
243
|
+
]), f(() => {
|
|
244
|
+
if (S !== "closing") return;
|
|
245
|
+
let e = A.current, t = e && typeof e.getAnimations == "function" ? e.getAnimations() : [], n = !1;
|
|
246
|
+
return Promise.allSettled(t.map((e) => e.finished)).then(() => {
|
|
247
|
+
n || d(h);
|
|
248
|
+
}), () => {
|
|
249
|
+
n = !0;
|
|
250
|
+
};
|
|
251
|
+
}, [
|
|
252
|
+
S,
|
|
253
|
+
d,
|
|
254
|
+
h
|
|
255
|
+
]), /* @__PURE__ */ x("div", {
|
|
256
|
+
ref: j,
|
|
257
|
+
inert: S === "closing" || !t,
|
|
258
|
+
"aria-hidden": S === "closing" || !t || void 0,
|
|
259
|
+
"data-toast-id": h,
|
|
260
|
+
style: r,
|
|
261
|
+
className: o,
|
|
262
|
+
onKeyDown: (e) => {
|
|
263
|
+
s && e.key === "Escape" && !e.defaultPrevented && (e.preventDefault(), e.stopPropagation(), l(h));
|
|
264
|
+
},
|
|
265
|
+
"data-ui": "toast",
|
|
266
|
+
"data-tone": T,
|
|
267
|
+
"data-state": S,
|
|
268
|
+
"data-populated": V,
|
|
269
|
+
"data-exposed": t,
|
|
270
|
+
onPointerEnter: () => W(!0),
|
|
271
|
+
onPointerLeave: () => W(!1),
|
|
272
|
+
onFocus: () => q(!0),
|
|
273
|
+
onBlur: (e) => {
|
|
274
|
+
e.currentTarget.contains(e.relatedTarget) || q(!1);
|
|
275
|
+
},
|
|
276
|
+
css: [M, N[T]],
|
|
277
|
+
children: [
|
|
278
|
+
/* @__PURE__ */ b("div", {
|
|
279
|
+
role: T === "danger" ? "alert" : "status",
|
|
280
|
+
"aria-atomic": "true",
|
|
281
|
+
css: P,
|
|
282
|
+
children: V && /* @__PURE__ */ x(y, { children: [i(C) && /* @__PURE__ */ b("div", {
|
|
283
|
+
css: F,
|
|
284
|
+
children: C
|
|
285
|
+
}), i(w) && /* @__PURE__ */ b("div", {
|
|
286
|
+
css: I,
|
|
287
|
+
children: w
|
|
288
|
+
})] })
|
|
289
|
+
}),
|
|
290
|
+
O && /* @__PURE__ */ b(c, {
|
|
291
|
+
"aria-hidden": "true",
|
|
292
|
+
label: "",
|
|
293
|
+
size: "sm"
|
|
294
|
+
}),
|
|
295
|
+
(V || s && t) && /* @__PURE__ */ x("div", {
|
|
296
|
+
css: R,
|
|
297
|
+
children: [/* @__PURE__ */ b(a, {
|
|
298
|
+
variant: "ghost",
|
|
299
|
+
size: "sm",
|
|
300
|
+
"aria-label": m,
|
|
301
|
+
"data-toast-dismiss": "",
|
|
302
|
+
onClick: () => l(h),
|
|
303
|
+
css: L,
|
|
304
|
+
children: /* @__PURE__ */ b(K, {})
|
|
305
|
+
}), D && /* @__PURE__ */ b("div", {
|
|
306
|
+
css: z,
|
|
307
|
+
children: /* @__PURE__ */ b(a, {
|
|
308
|
+
variant: "outline",
|
|
309
|
+
size: "sm",
|
|
310
|
+
onClick: (e) => {
|
|
311
|
+
D?.onClick(e), e.defaultPrevented || l(h);
|
|
312
|
+
},
|
|
313
|
+
children: D.label
|
|
314
|
+
})
|
|
315
|
+
})]
|
|
316
|
+
})
|
|
317
|
+
]
|
|
318
|
+
});
|
|
319
|
+
}
|
|
320
|
+
function K() {
|
|
321
|
+
return /* @__PURE__ */ x("svg", {
|
|
322
|
+
"aria-hidden": "true",
|
|
323
|
+
viewBox: "0 0 16 16",
|
|
324
|
+
width: "16",
|
|
325
|
+
height: "16",
|
|
326
|
+
fill: "none",
|
|
327
|
+
stroke: "currentColor",
|
|
328
|
+
strokeWidth: "2",
|
|
329
|
+
strokeLinecap: "round",
|
|
330
|
+
children: [/* @__PURE__ */ b("line", {
|
|
331
|
+
x1: "4",
|
|
332
|
+
y1: "4",
|
|
333
|
+
x2: "12",
|
|
334
|
+
y2: "12"
|
|
335
|
+
}), /* @__PURE__ */ b("line", {
|
|
336
|
+
x1: "12",
|
|
337
|
+
y1: "4",
|
|
338
|
+
x2: "4",
|
|
339
|
+
y2: "12"
|
|
340
|
+
})]
|
|
341
|
+
});
|
|
342
|
+
}
|
|
343
|
+
function q(e) {
|
|
344
|
+
return /* @__PURE__ */ b(H, { ...e });
|
|
345
|
+
}
|
|
346
|
+
q.displayName = "Toast";
|
|
347
|
+
var J = Object.assign(q, {
|
|
348
|
+
Provider: H,
|
|
349
|
+
Viewport: U
|
|
350
|
+
});
|
|
351
|
+
//#endregion
|
|
352
|
+
export { V as a, W as i, J as n, B as o, G as r, D as t };
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { r as e, t } from "./sx-Dx9JUKp5.js";
|
|
3
|
+
import { r as n } from "./media-8yrN85VT.js";
|
|
4
|
+
import { t as r } from "./button-C92uYFJW.js";
|
|
5
|
+
import { i, o as a, r as o, t as s } from "./toast-BHxI32ZA.js";
|
|
6
|
+
import { useEffect as c, useId as l, useLayoutEffect as u, useRef as d, useState as f } from "react";
|
|
7
|
+
import { vars as p } from "@jfrader/tokens/vars";
|
|
8
|
+
import { jsx as m, jsxs as h } from "@emotion/react/jsx-runtime";
|
|
9
|
+
//#region src/components/toast-stack/toast-stack.tsx
|
|
10
|
+
var g = e({
|
|
11
|
+
position: "fixed",
|
|
12
|
+
insetBlockEnd: p.space[4],
|
|
13
|
+
insetInlineEnd: p.space[4],
|
|
14
|
+
inlineSize: s,
|
|
15
|
+
fontFamily: p.font.sans,
|
|
16
|
+
display: "grid",
|
|
17
|
+
gap: p.space[2],
|
|
18
|
+
maxBlockSize: `calc(100dvh - ${p.space[8]})`,
|
|
19
|
+
overflowY: "auto",
|
|
20
|
+
pointerEvents: "auto",
|
|
21
|
+
"&[data-empty=\"true\"]": { pointerEvents: "none" },
|
|
22
|
+
"&[data-contained=\"true\"]": {
|
|
23
|
+
position: "absolute",
|
|
24
|
+
maxInlineSize: `calc(100% - ${p.space[8]})`,
|
|
25
|
+
maxBlockSize: `calc(100% - ${p.space[8]})`
|
|
26
|
+
},
|
|
27
|
+
"&[data-position=\"bottom-start\"]": {
|
|
28
|
+
insetInlineEnd: "auto",
|
|
29
|
+
insetInlineStart: p.space[4]
|
|
30
|
+
},
|
|
31
|
+
"&[data-position=\"bottom-center\"]": {
|
|
32
|
+
insetInline: p.space[4],
|
|
33
|
+
marginInline: "auto"
|
|
34
|
+
},
|
|
35
|
+
"@media (max-width: 30rem)": { "&[data-position]": {
|
|
36
|
+
insetInline: p.space[4],
|
|
37
|
+
marginInline: "auto"
|
|
38
|
+
} }
|
|
39
|
+
}), _ = e({
|
|
40
|
+
position: "relative",
|
|
41
|
+
blockSize: "var(--toast-stack-height, 0px)",
|
|
42
|
+
pointerEvents: "auto",
|
|
43
|
+
transitionProperty: "block-size",
|
|
44
|
+
transitionDuration: p.motion.duration.base,
|
|
45
|
+
transitionTimingFunction: p.motion.easeStandard,
|
|
46
|
+
[n]: { transitionDuration: "0s" }
|
|
47
|
+
}), v = e({
|
|
48
|
+
position: "absolute",
|
|
49
|
+
insetInline: 0,
|
|
50
|
+
insetBlockEnd: "var(--toast-stack-offset, 0px)",
|
|
51
|
+
zIndex: "var(--toast-stack-order)",
|
|
52
|
+
transitionProperty: "opacity, inset-block-end",
|
|
53
|
+
transitionDuration: p.motion.duration.base,
|
|
54
|
+
transitionTimingFunction: p.motion.easeStandard,
|
|
55
|
+
"&[data-stack-visible=\"false\"]": { visibility: "hidden" },
|
|
56
|
+
[n]: { transitionDuration: "0s" }
|
|
57
|
+
}), y = e({
|
|
58
|
+
pointerEvents: "auto",
|
|
59
|
+
justifySelf: "end",
|
|
60
|
+
minBlockSize: p.space[8]
|
|
61
|
+
});
|
|
62
|
+
function b({ ref: e, className: n, sx: i, variant: s = "stacked", position: b = "bottom-end", contained: x = !1, maxVisible: S = 3, label: C = "Notifications", hotkey: w = !1, expandLabel: T = "Expand notifications", collapseLabel: E = "Collapse notifications", slotProps: D, onPointerEnter: O, onPointerLeave: ee, onFocus: te, onBlur: ne, onKeyDown: k, ...A }) {
|
|
63
|
+
let { toasts: j, registerRenderer: M } = a("Stack"), N = d(null), P = d(null), F = l(), [I, L] = f(!1), [R, z] = f(!1), [B, V] = f(!1), [H, U] = f({}), W = d(/* @__PURE__ */ new Map()), G = [...j].reverse(), K = G.filter((e) => e.state === "open"), q = Math.max(1, Math.floor(Number.isFinite(S) ? S : 3)), J = s === "list" || I || R || B, Y = I || R || B;
|
|
64
|
+
c(M, [M]), c(() => {
|
|
65
|
+
K.length || V(!1);
|
|
66
|
+
}, [K.length]), u(() => {
|
|
67
|
+
let e = N.current;
|
|
68
|
+
R && e && !e.contains(e.ownerDocument.activeElement) && z(!1);
|
|
69
|
+
}, [j, R]), u(() => {
|
|
70
|
+
let e = P.current;
|
|
71
|
+
if (!e) return;
|
|
72
|
+
let t = () => {
|
|
73
|
+
let t = {};
|
|
74
|
+
e.querySelectorAll("[data-toast-id]").forEach((e) => {
|
|
75
|
+
t[e.dataset.toastId] = e.getBoundingClientRect().height;
|
|
76
|
+
}), U((e) => JSON.stringify(e) === JSON.stringify(t) ? e : t);
|
|
77
|
+
}, n = new ResizeObserver(t);
|
|
78
|
+
return Array.from(e.children).forEach((e) => n.observe(e)), t(), () => n.disconnect();
|
|
79
|
+
}, [j]), c(() => {
|
|
80
|
+
let e = N.current;
|
|
81
|
+
if (!e) return;
|
|
82
|
+
let t = e.ownerDocument, n = (t) => {
|
|
83
|
+
e.contains(t.target) || V(!1);
|
|
84
|
+
}, r = (t) => {
|
|
85
|
+
let n = t.target;
|
|
86
|
+
if (!w || !t.altKey || t.ctrlKey || t.metaKey || t.key.toLowerCase() !== "t" || t.defaultPrevented || n.closest("input, textarea, select, [contenteditable]:not([contenteditable=\"false\"])")) return;
|
|
87
|
+
let r = e.querySelector("[data-state=\"open\"] [data-toast-dismiss]");
|
|
88
|
+
r && (t.preventDefault(), V(!0), r.focus());
|
|
89
|
+
};
|
|
90
|
+
return t.addEventListener("pointerdown", n), t.addEventListener("keydown", r), () => {
|
|
91
|
+
t.removeEventListener("pointerdown", n), t.removeEventListener("keydown", r);
|
|
92
|
+
};
|
|
93
|
+
}, [w, j]);
|
|
94
|
+
let X = "0px", Z = /* @__PURE__ */ new Map(), Q = 0;
|
|
95
|
+
K.forEach((e, t) => {
|
|
96
|
+
Z.set(e.id, J ? `calc(${Q}px + ${t} * ${p.space[2]})` : `calc(${t} * ${p.space[3]})`), Q += H[e.id] ?? 0;
|
|
97
|
+
}), u(() => {
|
|
98
|
+
Z.forEach((e, t) => W.current.set(t, e));
|
|
99
|
+
for (let e of W.current.keys()) G.some((t) => t.id === e) || W.current.delete(e);
|
|
100
|
+
}), K.length && (X = J ? `calc(${Q}px + ${K.length - 1} * ${p.space[2]})` : `calc(${H[K[0].id] ?? 0}px + ${Math.min(K.length, q) - 1} * ${p.space[3]})`);
|
|
101
|
+
let $ = Math.max(0, K.length - q);
|
|
102
|
+
return /* @__PURE__ */ m(t, {
|
|
103
|
+
className: n,
|
|
104
|
+
styles: g,
|
|
105
|
+
sx: i,
|
|
106
|
+
children: (t) => /* @__PURE__ */ h("div", {
|
|
107
|
+
...A,
|
|
108
|
+
role: "region",
|
|
109
|
+
"aria-label": A["aria-label"] ?? (A["aria-labelledby"] ? void 0 : C),
|
|
110
|
+
className: t,
|
|
111
|
+
"data-ui": "toast-stack",
|
|
112
|
+
"data-empty": !K.length,
|
|
113
|
+
"data-contained": x,
|
|
114
|
+
"data-position": b,
|
|
115
|
+
"data-expanded": J,
|
|
116
|
+
ref: (t) => {
|
|
117
|
+
if (N.current = t, typeof e == "function") return e(t);
|
|
118
|
+
e && (e.current = t);
|
|
119
|
+
},
|
|
120
|
+
onPointerEnter: (e) => {
|
|
121
|
+
O?.(e), !e.defaultPrevented && e.pointerType !== "touch" && L(!0);
|
|
122
|
+
},
|
|
123
|
+
onPointerLeave: (e) => {
|
|
124
|
+
ee?.(e), e.defaultPrevented || L(!1);
|
|
125
|
+
},
|
|
126
|
+
onFocus: (e) => {
|
|
127
|
+
te?.(e), e.defaultPrevented || z(!0);
|
|
128
|
+
},
|
|
129
|
+
onBlur: (e) => {
|
|
130
|
+
ne?.(e), e.currentTarget.contains(e.relatedTarget) || z(!1);
|
|
131
|
+
},
|
|
132
|
+
onKeyDownCapture: (e) => {
|
|
133
|
+
A.onKeyDownCapture?.(e), k?.(e);
|
|
134
|
+
},
|
|
135
|
+
children: [s === "stacked" && K.length > 1 && /* @__PURE__ */ h(r, {
|
|
136
|
+
variant: "outline",
|
|
137
|
+
size: "sm",
|
|
138
|
+
"data-ui": "toast-stack-toggle",
|
|
139
|
+
"aria-expanded": J,
|
|
140
|
+
"aria-controls": F,
|
|
141
|
+
"aria-label": J ? E : T,
|
|
142
|
+
className: D?.toggle?.className,
|
|
143
|
+
css: [y, D?.toggle?.css],
|
|
144
|
+
onClick: () => V((e) => !e),
|
|
145
|
+
children: [J ? E : T, $ > 0 && ` (+${new Intl.NumberFormat().format($)})`]
|
|
146
|
+
}), /* @__PURE__ */ m("div", {
|
|
147
|
+
id: F,
|
|
148
|
+
ref: P,
|
|
149
|
+
"data-ui": "toast-stack-list",
|
|
150
|
+
className: D?.list?.className,
|
|
151
|
+
css: [_, D?.list?.css],
|
|
152
|
+
style: { "--toast-stack-height": X },
|
|
153
|
+
children: G.map((e) => {
|
|
154
|
+
let t = K.indexOf(e), n = e.state === "closing" || t >= 0 && (J || t < q);
|
|
155
|
+
return /* @__PURE__ */ m("div", {
|
|
156
|
+
"data-stack-visible": n,
|
|
157
|
+
css: v,
|
|
158
|
+
style: {
|
|
159
|
+
"--toast-stack-offset": Z.get(e.id) ?? W.current.get(e.id) ?? "0px",
|
|
160
|
+
"--toast-stack-order": G.length - G.indexOf(e)
|
|
161
|
+
},
|
|
162
|
+
children: /* @__PURE__ */ m(o, {
|
|
163
|
+
record: e,
|
|
164
|
+
exposed: t >= 0 && (J || t === 0),
|
|
165
|
+
paused: Y,
|
|
166
|
+
escapeDismiss: !0,
|
|
167
|
+
style: !J && t > 0 ? { minBlockSize: H[K[0].id] } : void 0
|
|
168
|
+
})
|
|
169
|
+
}, e.id);
|
|
170
|
+
})
|
|
171
|
+
})]
|
|
172
|
+
})
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
function x(e) {
|
|
176
|
+
return /* @__PURE__ */ m(i, {
|
|
177
|
+
contained: e.contained,
|
|
178
|
+
children: /* @__PURE__ */ m(b, { ...e })
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
x.displayName = "ToastStack";
|
|
182
|
+
//#endregion
|
|
183
|
+
export { x as t };
|
package/dist/toast.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
export {
|
|
2
|
+
export { n as Toast, a as useToast } from "./toast-BHxI32ZA.js";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { r as e, t } from "./sx-Dx9JUKp5.js";
|
|
3
3
|
import { t as n } from "./focus-ring-BK5W5_NY.js";
|
|
4
|
-
import { n as r,
|
|
4
|
+
import { n as r, r as i } from "./media-8yrN85VT.js";
|
|
5
5
|
import { n as a, r as o, t as s } from "./roving-focus-CYlo_Kf8.js";
|
|
6
|
-
import { t as c } from "./use-controlled-state-
|
|
6
|
+
import { t as c } from "./use-controlled-state-DpeVQZNR.js";
|
|
7
7
|
import { createContext as l, useContext as u, useEffect as d, useImperativeHandle as f, useMemo as p, useRef as m, useState as h } from "react";
|
|
8
8
|
import { vars as g } from "@jfrader/tokens/vars";
|
|
9
9
|
import { jsx as _ } from "@emotion/react/jsx-runtime";
|
|
@@ -72,8 +72,8 @@ var b = [], x = (e, t) => {
|
|
|
72
72
|
cursor: "not-allowed"
|
|
73
73
|
},
|
|
74
74
|
"&:focus-visible": { ...n },
|
|
75
|
-
[
|
|
76
|
-
[
|
|
75
|
+
[i]: { transitionDuration: "0s" },
|
|
76
|
+
[r]: { "&[aria-pressed=\"true\"]": {
|
|
77
77
|
backgroundColor: "SelectedItem",
|
|
78
78
|
borderColor: "SelectedItem",
|
|
79
79
|
color: "SelectedItemText"
|
package/dist/toggle-group.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
export { t as ToggleGroup } from "./toggle-group-
|
|
2
|
+
export { t as ToggleGroup } from "./toggle-group-fcjzpifI.js";
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { r as e, t } from "./sx-Dx9JUKp5.js";
|
|
3
|
+
import { t as n } from "./use-controlled-state-DpeVQZNR.js";
|
|
4
|
+
import { t as r } from "./trigger-style-B1KVC8O1.js";
|
|
5
|
+
import { t as i } from "./overlay-layer-SeUyyEPD.js";
|
|
6
|
+
import { t as a } from "./overlay-portal-C4JZFq2M.js";
|
|
7
|
+
import { t as o } from "./use-overlay-floating-DvJifLpF.js";
|
|
8
|
+
import { createContext as s, useContext as c, useMemo as l } from "react";
|
|
9
|
+
import { vars as u } from "@jfrader/tokens/vars";
|
|
10
|
+
import { jsx as d } from "@emotion/react/jsx-runtime";
|
|
11
|
+
import { useDismiss as f, useFocus as p, useHover as m, useInteractions as h, useMergeRefs as g, useRole as _ } from "@floating-ui/react";
|
|
12
|
+
//#region src/components/tooltip/tooltip.tsx
|
|
13
|
+
var v = 300, y = 100, b = s(null);
|
|
14
|
+
function x(e) {
|
|
15
|
+
let t = c(b);
|
|
16
|
+
if (!t) throw Error(`Tooltip.${e} must be rendered inside <Tooltip>.`);
|
|
17
|
+
return t;
|
|
18
|
+
}
|
|
19
|
+
var S = e({
|
|
20
|
+
boxSizing: "border-box",
|
|
21
|
+
backgroundColor: u.color.bgSoft,
|
|
22
|
+
border: `1px solid ${u.color.border}`,
|
|
23
|
+
borderRadius: u.radius.sm,
|
|
24
|
+
boxShadow: u.shadow.raised,
|
|
25
|
+
padding: `${u.space[1]} ${u.space[2]}`,
|
|
26
|
+
maxInlineSize: "260px",
|
|
27
|
+
color: u.color.text,
|
|
28
|
+
fontFamily: u.font.sans,
|
|
29
|
+
fontSize: u.textSize.sm,
|
|
30
|
+
lineHeight: u.lineHeight.base
|
|
31
|
+
});
|
|
32
|
+
function C({ open: e, defaultOpen: t = !1, onOpenChange: r, placement: i = "top", openDelay: a = v, closeDelay: s = y, children: c }) {
|
|
33
|
+
let [u = !1, g] = n(e, t, r), { refs: x, floatingStyles: S, context: C } = o({
|
|
34
|
+
open: u,
|
|
35
|
+
placement: i,
|
|
36
|
+
onOpenChange: g
|
|
37
|
+
}), w = m(C, {
|
|
38
|
+
delay: {
|
|
39
|
+
open: a,
|
|
40
|
+
close: s
|
|
41
|
+
},
|
|
42
|
+
move: !1
|
|
43
|
+
}), T = p(C), E = f(C, { escapeKey: !0 }), D = _(C, { role: "tooltip" }), { getReferenceProps: O, getFloatingProps: k } = h([
|
|
44
|
+
w,
|
|
45
|
+
T,
|
|
46
|
+
E,
|
|
47
|
+
D
|
|
48
|
+
]), A = l(() => ({
|
|
49
|
+
open: u,
|
|
50
|
+
refs: x,
|
|
51
|
+
floatingStyles: S,
|
|
52
|
+
getReferenceProps: O,
|
|
53
|
+
getFloatingProps: k
|
|
54
|
+
}), [
|
|
55
|
+
u,
|
|
56
|
+
x,
|
|
57
|
+
S,
|
|
58
|
+
O,
|
|
59
|
+
k
|
|
60
|
+
]);
|
|
61
|
+
return /* @__PURE__ */ d(b.Provider, {
|
|
62
|
+
value: A,
|
|
63
|
+
children: c
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
function w(e) {
|
|
67
|
+
return /* @__PURE__ */ d(i, { children: /* @__PURE__ */ d(C, { ...e }) });
|
|
68
|
+
}
|
|
69
|
+
w.displayName = "Tooltip";
|
|
70
|
+
function T({ ref: e, "aria-describedby": n, className: i, sx: a, ...o }) {
|
|
71
|
+
let { refs: s, getReferenceProps: c } = x("Trigger"), l = g([s.setReference, e]), u = c(o), f = [n, u["aria-describedby"]].filter(Boolean).join(" ") || void 0;
|
|
72
|
+
return /* @__PURE__ */ d(t, {
|
|
73
|
+
className: i,
|
|
74
|
+
styles: r,
|
|
75
|
+
sx: a,
|
|
76
|
+
children: (e) => /* @__PURE__ */ d("button", {
|
|
77
|
+
type: "button",
|
|
78
|
+
...u,
|
|
79
|
+
ref: l,
|
|
80
|
+
"aria-describedby": f,
|
|
81
|
+
"data-ui": "tooltip-trigger",
|
|
82
|
+
className: e
|
|
83
|
+
})
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
T.displayName = "Tooltip.Trigger";
|
|
87
|
+
function E({ ref: e, style: n, className: r, sx: i, ...o }) {
|
|
88
|
+
let { open: s, refs: c, floatingStyles: l, getFloatingProps: u } = x("Content"), f = g([c.setFloating, e]);
|
|
89
|
+
if (!s) return null;
|
|
90
|
+
let { tabIndex: p, ...m } = u(o);
|
|
91
|
+
return /* @__PURE__ */ d(a, { children: /* @__PURE__ */ d(t, {
|
|
92
|
+
className: r,
|
|
93
|
+
styles: S,
|
|
94
|
+
sx: i,
|
|
95
|
+
children: (e) => /* @__PURE__ */ d("div", {
|
|
96
|
+
...m,
|
|
97
|
+
ref: f,
|
|
98
|
+
"data-ui": "tooltip",
|
|
99
|
+
style: {
|
|
100
|
+
...n,
|
|
101
|
+
...l
|
|
102
|
+
},
|
|
103
|
+
className: e
|
|
104
|
+
})
|
|
105
|
+
}) });
|
|
106
|
+
}
|
|
107
|
+
E.displayName = "Tooltip.Content";
|
|
108
|
+
var D = Object.assign(w, {
|
|
109
|
+
Trigger: T,
|
|
110
|
+
Content: E
|
|
111
|
+
});
|
|
112
|
+
//#endregion
|
|
113
|
+
export { D as t };
|
package/dist/tooltip.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
export { t as Tooltip } from "./tooltip-
|
|
2
|
+
export { t as Tooltip } from "./tooltip-CkeiW9C1.js";
|