@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,418 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { r as e, t } from "./sx-Dx9JUKp5.js";
|
|
3
|
+
import { t as n } from "./focus-ring-BK5W5_NY.js";
|
|
4
|
+
import { n as r } from "./media-8yrN85VT.js";
|
|
5
|
+
import { t as i } from "./use-controlled-state-DpeVQZNR.js";
|
|
6
|
+
import { t as a } from "./renderable-DzcIj1Lo.js";
|
|
7
|
+
import { t as o } from "./menu-xwOOUtWP.js";
|
|
8
|
+
import { Children as s, createContext as c, isValidElement as l, useContext as u, useEffect as d, useLayoutEffect as f, useMemo as p, useRef as m, useState as h } from "react";
|
|
9
|
+
import { vars as g } from "@jfrader/tokens/vars";
|
|
10
|
+
import { Fragment as _, jsx as v, jsxs as y } from "@emotion/react/jsx-runtime";
|
|
11
|
+
import { useMergeRefs as ee } from "@floating-ui/react";
|
|
12
|
+
import { AnimatePresence as te, MotionConfig as ne, animate as b, motion as x, useIsPresent as S, useMotionValue as C, useReducedMotion as re } from "motion/react";
|
|
13
|
+
import { base as w } from "@jfrader/tokens";
|
|
14
|
+
//#region src/components/swipe-actions/swipe-actions.tsx
|
|
15
|
+
var ie = 8, ae = 48, oe = .56, se = 900, ce = .1, le = .2, ue = {
|
|
16
|
+
type: "spring",
|
|
17
|
+
stiffness: 420,
|
|
18
|
+
damping: 40,
|
|
19
|
+
mass: 1
|
|
20
|
+
}, de = Number.parseFloat(w.motion.duration.fast) / 1e3, fe = Number.parseFloat(w.motion.duration.slow) / 1e3, pe = [], me = "button,a,input,select,textarea,[contenteditable]:not([contenteditable=\"false\"]),[role=\"button\"]", T = e({
|
|
21
|
+
label: "swipe-actions",
|
|
22
|
+
listStyle: "none",
|
|
23
|
+
padding: 0,
|
|
24
|
+
margin: 0,
|
|
25
|
+
display: "grid",
|
|
26
|
+
gap: g.space[2],
|
|
27
|
+
fontFamily: g.font.sans,
|
|
28
|
+
color: g.color.text,
|
|
29
|
+
"&:focus": n
|
|
30
|
+
}), he = e({
|
|
31
|
+
label: "swipe-actions-row",
|
|
32
|
+
display: "grid",
|
|
33
|
+
gridTemplateColumns: "minmax(0, 1fr)",
|
|
34
|
+
position: "relative",
|
|
35
|
+
overflow: "hidden",
|
|
36
|
+
minInlineSize: 0,
|
|
37
|
+
border: `1px solid ${g.color.borderControl}`,
|
|
38
|
+
borderRadius: g.radius.md
|
|
39
|
+
}), ge = e({
|
|
40
|
+
gridArea: "1 / 1",
|
|
41
|
+
position: "relative",
|
|
42
|
+
display: "flex",
|
|
43
|
+
alignItems: "center",
|
|
44
|
+
gap: g.space[2],
|
|
45
|
+
padding: g.space[4],
|
|
46
|
+
minBlockSize: `calc(${g.space[8]} * 2)`,
|
|
47
|
+
boxSizing: "border-box",
|
|
48
|
+
background: g.color.surface,
|
|
49
|
+
touchAction: "pan-y"
|
|
50
|
+
}), _e = e({
|
|
51
|
+
flex: "1 1 0",
|
|
52
|
+
minInlineSize: 0,
|
|
53
|
+
overflowWrap: "anywhere"
|
|
54
|
+
}), ve = e({
|
|
55
|
+
position: "relative",
|
|
56
|
+
gridArea: "1 / 1",
|
|
57
|
+
display: "flex",
|
|
58
|
+
maxInlineSize: "100%",
|
|
59
|
+
"&[data-side=\"leading\"]": { justifySelf: "start" },
|
|
60
|
+
"&[data-side=\"trailing\"]": { justifySelf: "end" }
|
|
61
|
+
}), ye = e({
|
|
62
|
+
display: "flex",
|
|
63
|
+
flexDirection: "column",
|
|
64
|
+
justifyContent: "center",
|
|
65
|
+
alignItems: "center",
|
|
66
|
+
gap: g.space[1],
|
|
67
|
+
inlineSize: `calc(${g.space[10]} * 2)`,
|
|
68
|
+
minInlineSize: g.space[8],
|
|
69
|
+
minBlockSize: g.space[12],
|
|
70
|
+
padding: g.space[2],
|
|
71
|
+
boxSizing: "border-box",
|
|
72
|
+
border: `1px solid ${g.color.borderControl}`,
|
|
73
|
+
font: "inherit",
|
|
74
|
+
fontSize: g.textSize.sm,
|
|
75
|
+
overflowWrap: "anywhere",
|
|
76
|
+
cursor: "pointer",
|
|
77
|
+
"&:disabled": { cursor: "not-allowed" },
|
|
78
|
+
[r]: { borderColor: "ButtonText" }
|
|
79
|
+
}), be = {
|
|
80
|
+
neutral: e({
|
|
81
|
+
background: g.color.surfaceHover,
|
|
82
|
+
color: g.color.text
|
|
83
|
+
}),
|
|
84
|
+
accent: e({
|
|
85
|
+
background: g.color.accent,
|
|
86
|
+
color: g.color.accentContrast
|
|
87
|
+
}),
|
|
88
|
+
danger: e({
|
|
89
|
+
background: g.color.danger,
|
|
90
|
+
color: g.color.dangerContrast
|
|
91
|
+
})
|
|
92
|
+
}, xe = e({
|
|
93
|
+
display: "inline-flex",
|
|
94
|
+
inlineSize: "1em",
|
|
95
|
+
blockSize: "1em"
|
|
96
|
+
}), Se = e({
|
|
97
|
+
minInlineSize: g.space[8],
|
|
98
|
+
minBlockSize: g.space[8],
|
|
99
|
+
flexShrink: 0
|
|
100
|
+
});
|
|
101
|
+
function Ce({ nativeProps: e, ...t }) {
|
|
102
|
+
return /* @__PURE__ */ v("li", {
|
|
103
|
+
...e,
|
|
104
|
+
...t,
|
|
105
|
+
style: {
|
|
106
|
+
...e.style,
|
|
107
|
+
...t.style
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
var we = x.create(Ce), Te = c(null);
|
|
112
|
+
function E({ ref: e, className: n, sx: r, value: a, defaultValue: o = null, onValueChange: c, children: u, onKeyDown: f, ...h }) {
|
|
113
|
+
let [g = null, _] = i(a, o, c), y = m(null), b = m(/* @__PURE__ */ new Map()).current, x = ee([y, e]), S = s.toArray(u).flatMap((e) => l(e) ? [e.props.id] : []), C = p(() => ({
|
|
114
|
+
value: g,
|
|
115
|
+
rows: b,
|
|
116
|
+
list: y,
|
|
117
|
+
ids: S,
|
|
118
|
+
request: (e) => {
|
|
119
|
+
(g?.id !== e?.id || g?.side !== e?.side) && _(e);
|
|
120
|
+
}
|
|
121
|
+
}), [
|
|
122
|
+
g,
|
|
123
|
+
b,
|
|
124
|
+
_,
|
|
125
|
+
S.join("\0")
|
|
126
|
+
]);
|
|
127
|
+
return d(() => {
|
|
128
|
+
let e = y.current;
|
|
129
|
+
if (!e || !g) return;
|
|
130
|
+
let t = (e) => {
|
|
131
|
+
let t = b.get(g.id), n = e.target;
|
|
132
|
+
n && !t?.element.contains(n) && !t?.menu?.contains(n) && C.request(null);
|
|
133
|
+
}, n = (t) => {
|
|
134
|
+
t.key !== "Escape" || t.defaultPrevented || t.isComposing || D(e) || e.ownerDocument.querySelector("[role=\"menu\"], [role=\"listbox\"], [role=\"dialog\"], dialog[open]") || (t.preventDefault(), C.request(null));
|
|
135
|
+
};
|
|
136
|
+
return e.ownerDocument.addEventListener("pointerdown", t), e.ownerDocument.addEventListener("keydown", n), () => {
|
|
137
|
+
e.ownerDocument.removeEventListener("pointerdown", t), e.ownerDocument.removeEventListener("keydown", n);
|
|
138
|
+
};
|
|
139
|
+
}, [
|
|
140
|
+
g,
|
|
141
|
+
b,
|
|
142
|
+
C
|
|
143
|
+
]), /* @__PURE__ */ v(ne, {
|
|
144
|
+
reducedMotion: "user",
|
|
145
|
+
children: /* @__PURE__ */ v(Te.Provider, {
|
|
146
|
+
value: C,
|
|
147
|
+
children: /* @__PURE__ */ v(t, {
|
|
148
|
+
className: n,
|
|
149
|
+
styles: T,
|
|
150
|
+
sx: r,
|
|
151
|
+
children: (e) => /* @__PURE__ */ v("ul", {
|
|
152
|
+
...h,
|
|
153
|
+
ref: x,
|
|
154
|
+
className: e,
|
|
155
|
+
"data-ui": "swipe-actions",
|
|
156
|
+
tabIndex: h.tabIndex ?? -1,
|
|
157
|
+
onKeyDown: (e) => {
|
|
158
|
+
f?.(e), !e.defaultPrevented && g !== null && e.key === "Escape" && !e.nativeEvent.isComposing && !e.target.closest("[role=\"menu\"]") && !D(y.current) && (e.stopPropagation(), e.preventDefault(), C.request(null));
|
|
159
|
+
},
|
|
160
|
+
children: /* @__PURE__ */ v(te, {
|
|
161
|
+
initial: !1,
|
|
162
|
+
children: u
|
|
163
|
+
})
|
|
164
|
+
})
|
|
165
|
+
})
|
|
166
|
+
})
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
function D(e) {
|
|
170
|
+
return !!e?.querySelector("[aria-expanded=\"true\"]");
|
|
171
|
+
}
|
|
172
|
+
E.displayName = "SwipeActions";
|
|
173
|
+
function O({ id: e, label: n, actionsLabel: r, leading: i = pe, trailing: s = pe, fullSwipe: c = !0, disabled: l = !1, ref: p, className: g, sx: te, children: ne, slotProps: w, onPointerDown: T, onPointerMove: Ce, onPointerUp: E, onPointerCancel: D, onLostPointerCapture: O, onClickCapture: k, ...Ee }) {
|
|
174
|
+
let A = u(Te);
|
|
175
|
+
if (!A) throw Error("SwipeActions.Row must be rendered inside SwipeActions.");
|
|
176
|
+
let { value: j, request: M, rows: N, list: P } = A, F = m(null), De = m(null), I = m(null), Oe = m(!1), ke = m(A.ids), L = m(null), R = m(null), z = m(null), B = m(0), V = m(!1), H = m(void 0), U = C(0), W = re(), G = S(), [Ae, K] = h(!1), [je, Me] = h(0), Ne = ee([F, p]), q = {
|
|
177
|
+
leading: i,
|
|
178
|
+
trailing: s
|
|
179
|
+
}, J = (e) => !l && q[e].some((e) => !e.disabled), Y = (e) => Math.min(F.current?.getBoundingClientRect().width ?? 0, (e === "leading" ? L : R).current?.getBoundingClientRect().width ?? 0), Pe = () => F.current?.matches(":dir(rtl)") ? -1 : 1, Fe = () => j?.id === e && J(j.side) ? Y(j.side) * (j.side === "leading" ? 1 : -1) * Pe() : 0, X = () => {
|
|
180
|
+
let e = Fe(), t = e - U.get(), n = e !== 0 && Math.sign(t) === Math.sign(B.current) ? Math.max(-900, Math.min(se, B.current)) : 0;
|
|
181
|
+
if (B.current = 0, W) U.jump(e);
|
|
182
|
+
else return b(U, e, {
|
|
183
|
+
...ue,
|
|
184
|
+
velocity: n
|
|
185
|
+
});
|
|
186
|
+
}, Ie = m(X);
|
|
187
|
+
Ie.current = X, d(() => {
|
|
188
|
+
if (z.current?.locked) return;
|
|
189
|
+
let e = X();
|
|
190
|
+
return () => e?.stop();
|
|
191
|
+
}, [
|
|
192
|
+
j,
|
|
193
|
+
l,
|
|
194
|
+
i,
|
|
195
|
+
s,
|
|
196
|
+
W,
|
|
197
|
+
je
|
|
198
|
+
]), d(() => {
|
|
199
|
+
let e = F.current, t = e?.ownerDocument.defaultView?.ResizeObserver;
|
|
200
|
+
if (!e || !t) return;
|
|
201
|
+
let n = new t(() => {
|
|
202
|
+
z.current?.locked || Ie.current();
|
|
203
|
+
});
|
|
204
|
+
return n.observe(e), L.current && n.observe(L.current), R.current && n.observe(R.current), () => n.disconnect();
|
|
205
|
+
}, []), f(() => {
|
|
206
|
+
A.ids.includes(e) && (ke.current = A.ids);
|
|
207
|
+
}, [A.ids, e]), f(() => {
|
|
208
|
+
if (!G) return;
|
|
209
|
+
let t = F.current;
|
|
210
|
+
if (!t) return;
|
|
211
|
+
let n = {
|
|
212
|
+
element: t,
|
|
213
|
+
trigger: De.current,
|
|
214
|
+
menu: I.current
|
|
215
|
+
};
|
|
216
|
+
return N.set(e, n), () => {
|
|
217
|
+
let n = t.ownerDocument.activeElement, r = t.contains(n) || I.current?.contains(n) || Oe.current && (!n || n === t.ownerDocument.body), i = ke.current, a = i.indexOf(e);
|
|
218
|
+
N.delete(e), r && t.ownerDocument.defaultView?.queueMicrotask(() => {
|
|
219
|
+
!N.has(e) && P.current?.isConnected && (i.slice(a + 1).concat(i.slice(0, a).reverse()).map((e) => N.get(e)?.trigger).find((e) => e?.isConnected && !e.disabled) ?? P.current)?.focus();
|
|
220
|
+
});
|
|
221
|
+
};
|
|
222
|
+
}, [
|
|
223
|
+
e,
|
|
224
|
+
N,
|
|
225
|
+
G,
|
|
226
|
+
P
|
|
227
|
+
]), d(() => {
|
|
228
|
+
let e = F.current?.ownerDocument.defaultView;
|
|
229
|
+
return () => {
|
|
230
|
+
z.current?.unlisten(), z.current = null, U.stop(), H.current !== void 0 && e?.clearTimeout(H.current);
|
|
231
|
+
};
|
|
232
|
+
}, [U]);
|
|
233
|
+
let Z = (e) => {
|
|
234
|
+
l || e.disabled || !G || (M(null), K(!1), Oe.current = !!I.current?.contains(I.current.ownerDocument.activeElement), e.onSelect(), Me((e) => e + 1));
|
|
235
|
+
}, Q = (t, n) => {
|
|
236
|
+
let r = z.current;
|
|
237
|
+
if (!r || r.pointer !== t) return;
|
|
238
|
+
z.current = null, r.unlisten(), B.current = n ? 0 : r.velocity;
|
|
239
|
+
let i = F.current;
|
|
240
|
+
if (r.locked) {
|
|
241
|
+
V.current = !0;
|
|
242
|
+
let a = i?.ownerDocument.defaultView;
|
|
243
|
+
H.current !== void 0 && a?.clearTimeout(H.current), H.current = a?.setTimeout(() => {
|
|
244
|
+
V.current = !1;
|
|
245
|
+
}, 0);
|
|
246
|
+
let o = U.get() * r.direction, s = o >= 0 ? "leading" : "trailing", l = Y(s), u = r.velocity * (s === "leading" ? 1 : -1) * r.direction, d = Math.max(l + ae, (i?.getBoundingClientRect().width ?? 0) * oe), f = Math.abs(o), p = f >= d || u >= se && f + u * ce >= d;
|
|
247
|
+
if (!n && c && J(s) && p && u > -900) {
|
|
248
|
+
let e = q[s].filter((e) => !e.disabled), t = s === "leading" ? e[0] : e.at(-1);
|
|
249
|
+
t && Z(t);
|
|
250
|
+
} else n || M(J(s) && f >= l / 2 ? {
|
|
251
|
+
id: e,
|
|
252
|
+
side: s
|
|
253
|
+
} : null);
|
|
254
|
+
i?.hasPointerCapture(t) && i.releasePointerCapture(t);
|
|
255
|
+
}
|
|
256
|
+
Me((e) => e + 1);
|
|
257
|
+
}, Le = j?.id === e && J(j.side) ? j.side : void 0, $ = (e) => /* @__PURE__ */ y(_, { children: [a(e.icon) && e.icon !== "" && /* @__PURE__ */ v("span", {
|
|
258
|
+
"aria-hidden": !0,
|
|
259
|
+
"data-ui": "swipe-actions-action-icon",
|
|
260
|
+
className: w?.actionIcon?.className,
|
|
261
|
+
css: [xe, w?.actionIcon?.css],
|
|
262
|
+
children: e.icon
|
|
263
|
+
}), /* @__PURE__ */ v("span", {
|
|
264
|
+
"data-ui": "swipe-actions-action-label",
|
|
265
|
+
className: w?.actionLabel?.className,
|
|
266
|
+
css: w?.actionLabel?.css,
|
|
267
|
+
children: e.label
|
|
268
|
+
})] });
|
|
269
|
+
return /* @__PURE__ */ v(t, {
|
|
270
|
+
className: g,
|
|
271
|
+
styles: he,
|
|
272
|
+
sx: te,
|
|
273
|
+
children: (t) => /* @__PURE__ */ y(we, {
|
|
274
|
+
nativeProps: Ee,
|
|
275
|
+
id: e,
|
|
276
|
+
ref: Ne,
|
|
277
|
+
className: t,
|
|
278
|
+
"data-ui": "swipe-actions-row",
|
|
279
|
+
"data-state": Le ?? "closed",
|
|
280
|
+
inert: !G || Ee.inert || void 0,
|
|
281
|
+
initial: !W && {
|
|
282
|
+
height: 0,
|
|
283
|
+
opacity: 0
|
|
284
|
+
},
|
|
285
|
+
animate: {
|
|
286
|
+
height: "auto",
|
|
287
|
+
opacity: 1
|
|
288
|
+
},
|
|
289
|
+
exit: W ? void 0 : {
|
|
290
|
+
height: 0,
|
|
291
|
+
opacity: 0,
|
|
292
|
+
minHeight: 0
|
|
293
|
+
},
|
|
294
|
+
transition: {
|
|
295
|
+
duration: W ? 0 : fe,
|
|
296
|
+
opacity: { duration: W ? 0 : de }
|
|
297
|
+
},
|
|
298
|
+
onPointerDown: (e) => {
|
|
299
|
+
if (T?.(e), e.defaultPrevented || l || !G || z.current || !e.isPrimary || e.button !== 0 || e.target.closest(me)) return;
|
|
300
|
+
let t = e.currentTarget, n = t.ownerDocument, r = (e) => {
|
|
301
|
+
t.contains(e.target) || Q(e.pointerId, !0);
|
|
302
|
+
};
|
|
303
|
+
n.addEventListener("pointerup", r, !0), n.addEventListener("pointercancel", r, !0), z.current = {
|
|
304
|
+
pointer: e.pointerId,
|
|
305
|
+
startX: e.clientX,
|
|
306
|
+
startY: e.clientY,
|
|
307
|
+
origin: U.get(),
|
|
308
|
+
lastX: e.clientX,
|
|
309
|
+
lastTime: e.timeStamp,
|
|
310
|
+
velocity: 0,
|
|
311
|
+
locked: !1,
|
|
312
|
+
vertical: !1,
|
|
313
|
+
direction: Pe(),
|
|
314
|
+
unlisten: () => {
|
|
315
|
+
n.removeEventListener("pointerup", r, !0), n.removeEventListener("pointercancel", r, !0);
|
|
316
|
+
}
|
|
317
|
+
};
|
|
318
|
+
},
|
|
319
|
+
onPointerMove: (e) => {
|
|
320
|
+
Ce?.(e);
|
|
321
|
+
let t = z.current;
|
|
322
|
+
if (!t || t.pointer !== e.pointerId || t.vertical) return;
|
|
323
|
+
let n = e.clientX - t.startX, r = e.clientY - t.startY;
|
|
324
|
+
if (!t.locked) {
|
|
325
|
+
if (Math.max(Math.abs(n), Math.abs(r)) < ie) return;
|
|
326
|
+
if (Math.abs(r) >= Math.abs(n)) {
|
|
327
|
+
t.vertical = !0;
|
|
328
|
+
return;
|
|
329
|
+
}
|
|
330
|
+
t.locked = !0, U.stop(), K(!1), e.currentTarget.setPointerCapture(e.pointerId);
|
|
331
|
+
}
|
|
332
|
+
e.preventDefault();
|
|
333
|
+
let i = e.timeStamp - t.lastTime;
|
|
334
|
+
i > 0 && (t.velocity = (e.clientX - t.lastX) / i * 1e3), t.lastX = e.clientX, t.lastTime = e.timeStamp;
|
|
335
|
+
let a = t.origin + n, o = a * t.direction >= 0 ? "leading" : "trailing", s = F.current?.getBoundingClientRect().width ?? 0, l = c ? Math.max(Y(o) + ae, s * oe) : Y(o), u = Math.abs(a), d = u > l ? l + (u - l) * le : u;
|
|
336
|
+
U.set(J(o) ? Math.sign(a) * Math.min(d, s) : 0);
|
|
337
|
+
},
|
|
338
|
+
onPointerUp: (e) => {
|
|
339
|
+
E?.(e), Q(e.pointerId, !1);
|
|
340
|
+
},
|
|
341
|
+
onPointerCancel: (e) => {
|
|
342
|
+
D?.(e), Q(e.pointerId, !0);
|
|
343
|
+
},
|
|
344
|
+
onLostPointerCapture: (e) => {
|
|
345
|
+
O?.(e), Q(e.pointerId, !0);
|
|
346
|
+
},
|
|
347
|
+
onClickCapture: (e) => {
|
|
348
|
+
k?.(e), V.current && (V.current = !1, e.preventDefault(), e.stopPropagation());
|
|
349
|
+
},
|
|
350
|
+
children: [["leading", "trailing"].map((e) => q[e].length > 0 && /* @__PURE__ */ v("div", {
|
|
351
|
+
ref: e === "leading" ? L : R,
|
|
352
|
+
"data-side": e,
|
|
353
|
+
"data-ui": "swipe-actions-rail",
|
|
354
|
+
css: ve,
|
|
355
|
+
"aria-hidden": !0,
|
|
356
|
+
children: q[e].map((t) => /* @__PURE__ */ v("button", {
|
|
357
|
+
type: "button",
|
|
358
|
+
tabIndex: -1,
|
|
359
|
+
disabled: l || t.disabled || Le !== e || !G,
|
|
360
|
+
"data-ui": "swipe-actions-action",
|
|
361
|
+
className: w?.action?.className,
|
|
362
|
+
css: [
|
|
363
|
+
ye,
|
|
364
|
+
be[t.tone ?? "neutral"],
|
|
365
|
+
w?.action?.css
|
|
366
|
+
],
|
|
367
|
+
onPointerDown: (e) => e.preventDefault(),
|
|
368
|
+
onClick: () => Z(t),
|
|
369
|
+
children: $(t)
|
|
370
|
+
}, t.id))
|
|
371
|
+
}, e)), /* @__PURE__ */ y(x.div, {
|
|
372
|
+
"data-ui": "swipe-actions-content",
|
|
373
|
+
className: w?.content?.className,
|
|
374
|
+
css: [ge, w?.content?.css],
|
|
375
|
+
style: { x: U },
|
|
376
|
+
children: [/* @__PURE__ */ v("div", {
|
|
377
|
+
"data-ui": "swipe-actions-body",
|
|
378
|
+
className: w?.body?.className,
|
|
379
|
+
css: [_e, w?.body?.css],
|
|
380
|
+
children: ne
|
|
381
|
+
}), /* @__PURE__ */ y(o, {
|
|
382
|
+
open: Ae && G,
|
|
383
|
+
onOpenChange: (e) => {
|
|
384
|
+
e && M(null), K(e);
|
|
385
|
+
},
|
|
386
|
+
children: [/* @__PURE__ */ v(o.Trigger, {
|
|
387
|
+
ref: De,
|
|
388
|
+
disabled: l || !i.length && !s.length,
|
|
389
|
+
"aria-label": r,
|
|
390
|
+
title: n,
|
|
391
|
+
className: w?.trigger?.className,
|
|
392
|
+
css: [Se, w?.trigger?.css],
|
|
393
|
+
children: "⋯"
|
|
394
|
+
}), /* @__PURE__ */ v(o.Content, {
|
|
395
|
+
ref: (t) => {
|
|
396
|
+
I.current = t;
|
|
397
|
+
let n = N.get(e);
|
|
398
|
+
n && (n.menu = t);
|
|
399
|
+
},
|
|
400
|
+
className: w?.menu?.className,
|
|
401
|
+
css: w?.menu?.css,
|
|
402
|
+
children: [...i, ...s].map((e) => /* @__PURE__ */ v(o.Item, {
|
|
403
|
+
disabled: l || e.disabled,
|
|
404
|
+
className: w?.menuItem?.className,
|
|
405
|
+
css: w?.menuItem?.css,
|
|
406
|
+
onSelect: () => Z(e),
|
|
407
|
+
children: $(e)
|
|
408
|
+
}, e.id))
|
|
409
|
+
})]
|
|
410
|
+
})]
|
|
411
|
+
})]
|
|
412
|
+
})
|
|
413
|
+
});
|
|
414
|
+
}
|
|
415
|
+
O.displayName = "SwipeActions.Row";
|
|
416
|
+
var k = Object.assign(E, { Row: O });
|
|
417
|
+
//#endregion
|
|
418
|
+
export { k as t };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { r as e, t } from "./sx-Dx9JUKp5.js";
|
|
3
|
-
import { n } from "./media-
|
|
3
|
+
import { r as n } from "./media-8yrN85VT.js";
|
|
4
4
|
import { t as r } from "./renderable-DzcIj1Lo.js";
|
|
5
5
|
import { i, n as a, r as o, t as s } from "./choice-control-5kJkLXgv.js";
|
|
6
6
|
import { useId as c } from "react";
|
package/dist/switch.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
export { t as Switch } from "./switch-
|
|
2
|
+
export { t as Switch } from "./switch-qwv8jQnR.js";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { r as e, t } from "./sx-Dx9JUKp5.js";
|
|
3
3
|
import { n, t as r } from "./focus-ring-BK5W5_NY.js";
|
|
4
|
-
import {
|
|
4
|
+
import { 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 { t as l } from "./part-id-D0zksy32.js";
|
|
8
8
|
import { createContext as u, useContext as d, useEffect as f, useId as p, useImperativeHandle as m, useMemo as h, useRef as g, useState as _ } from "react";
|
|
9
9
|
import { vars as v } from "@jfrader/tokens/vars";
|
package/dist/tabs.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
export { t as Tabs } from "./tabs-
|
|
2
|
+
export { t as Tabs } from "./tabs-CAVJndX1.js";
|