@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,420 @@
|
|
|
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-DDKgmK2F.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;
|
|
301
|
+
e.pointerType === "mouse" && e.preventDefault();
|
|
302
|
+
let r = (e) => {
|
|
303
|
+
t.contains(e.target) || Q(e.pointerId, !0);
|
|
304
|
+
};
|
|
305
|
+
n.addEventListener("pointerup", r, !0), n.addEventListener("pointercancel", r, !0), z.current = {
|
|
306
|
+
pointer: e.pointerId,
|
|
307
|
+
startX: e.clientX,
|
|
308
|
+
startY: e.clientY,
|
|
309
|
+
origin: U.get(),
|
|
310
|
+
lastX: e.clientX,
|
|
311
|
+
lastTime: e.timeStamp,
|
|
312
|
+
velocity: 0,
|
|
313
|
+
locked: !1,
|
|
314
|
+
vertical: !1,
|
|
315
|
+
direction: Pe(),
|
|
316
|
+
unlisten: () => {
|
|
317
|
+
n.removeEventListener("pointerup", r, !0), n.removeEventListener("pointercancel", r, !0);
|
|
318
|
+
}
|
|
319
|
+
};
|
|
320
|
+
},
|
|
321
|
+
onPointerMove: (e) => {
|
|
322
|
+
Ce?.(e);
|
|
323
|
+
let t = z.current;
|
|
324
|
+
if (!t || t.pointer !== e.pointerId || t.vertical) return;
|
|
325
|
+
let n = e.clientX - t.startX, r = e.clientY - t.startY;
|
|
326
|
+
if (!t.locked) {
|
|
327
|
+
if (Math.max(Math.abs(n), Math.abs(r)) < ie) return;
|
|
328
|
+
if (Math.abs(r) >= Math.abs(n)) {
|
|
329
|
+
t.vertical = !0;
|
|
330
|
+
return;
|
|
331
|
+
}
|
|
332
|
+
t.locked = !0, U.stop(), K(!1), e.currentTarget.setPointerCapture(e.pointerId);
|
|
333
|
+
}
|
|
334
|
+
e.preventDefault();
|
|
335
|
+
let i = e.timeStamp - t.lastTime;
|
|
336
|
+
i > 0 && (t.velocity = (e.clientX - t.lastX) / i * 1e3), t.lastX = e.clientX, t.lastTime = e.timeStamp;
|
|
337
|
+
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;
|
|
338
|
+
U.set(J(o) ? Math.sign(a) * Math.min(d, s) : 0);
|
|
339
|
+
},
|
|
340
|
+
onPointerUp: (e) => {
|
|
341
|
+
E?.(e), Q(e.pointerId, !1);
|
|
342
|
+
},
|
|
343
|
+
onPointerCancel: (e) => {
|
|
344
|
+
D?.(e), Q(e.pointerId, !0);
|
|
345
|
+
},
|
|
346
|
+
onLostPointerCapture: (e) => {
|
|
347
|
+
O?.(e), Q(e.pointerId, !0);
|
|
348
|
+
},
|
|
349
|
+
onClickCapture: (e) => {
|
|
350
|
+
k?.(e), V.current && (V.current = !1, e.preventDefault(), e.stopPropagation());
|
|
351
|
+
},
|
|
352
|
+
children: [["leading", "trailing"].map((e) => q[e].length > 0 && /* @__PURE__ */ v("div", {
|
|
353
|
+
ref: e === "leading" ? L : R,
|
|
354
|
+
"data-side": e,
|
|
355
|
+
"data-ui": "swipe-actions-rail",
|
|
356
|
+
css: ve,
|
|
357
|
+
"aria-hidden": !0,
|
|
358
|
+
children: q[e].map((t) => /* @__PURE__ */ v("button", {
|
|
359
|
+
type: "button",
|
|
360
|
+
tabIndex: -1,
|
|
361
|
+
disabled: l || t.disabled || Le !== e || !G,
|
|
362
|
+
"data-ui": "swipe-actions-action",
|
|
363
|
+
className: w?.action?.className,
|
|
364
|
+
css: [
|
|
365
|
+
ye,
|
|
366
|
+
be[t.tone ?? "neutral"],
|
|
367
|
+
w?.action?.css
|
|
368
|
+
],
|
|
369
|
+
onPointerDown: (e) => e.preventDefault(),
|
|
370
|
+
onClick: () => Z(t),
|
|
371
|
+
children: $(t)
|
|
372
|
+
}, t.id))
|
|
373
|
+
}, e)), /* @__PURE__ */ y(x.div, {
|
|
374
|
+
"data-ui": "swipe-actions-content",
|
|
375
|
+
className: w?.content?.className,
|
|
376
|
+
css: [ge, w?.content?.css],
|
|
377
|
+
style: { x: U },
|
|
378
|
+
children: [/* @__PURE__ */ v("div", {
|
|
379
|
+
"data-ui": "swipe-actions-body",
|
|
380
|
+
className: w?.body?.className,
|
|
381
|
+
css: [_e, w?.body?.css],
|
|
382
|
+
children: ne
|
|
383
|
+
}), /* @__PURE__ */ y(o, {
|
|
384
|
+
open: Ae && G,
|
|
385
|
+
onOpenChange: (e) => {
|
|
386
|
+
e && M(null), K(e);
|
|
387
|
+
},
|
|
388
|
+
children: [/* @__PURE__ */ v(o.Trigger, {
|
|
389
|
+
ref: De,
|
|
390
|
+
disabled: l || !i.length && !s.length,
|
|
391
|
+
"aria-label": r,
|
|
392
|
+
title: n,
|
|
393
|
+
className: w?.trigger?.className,
|
|
394
|
+
css: [Se, w?.trigger?.css],
|
|
395
|
+
children: "⋯"
|
|
396
|
+
}), /* @__PURE__ */ v(o.Content, {
|
|
397
|
+
ref: (t) => {
|
|
398
|
+
I.current = t;
|
|
399
|
+
let n = N.get(e);
|
|
400
|
+
n && (n.menu = t);
|
|
401
|
+
},
|
|
402
|
+
className: w?.menu?.className,
|
|
403
|
+
css: w?.menu?.css,
|
|
404
|
+
children: [...i, ...s].map((e) => /* @__PURE__ */ v(o.Item, {
|
|
405
|
+
disabled: l || e.disabled,
|
|
406
|
+
className: w?.menuItem?.className,
|
|
407
|
+
css: w?.menuItem?.css,
|
|
408
|
+
onSelect: () => Z(e),
|
|
409
|
+
children: $(e)
|
|
410
|
+
}, e.id))
|
|
411
|
+
})]
|
|
412
|
+
})]
|
|
413
|
+
})]
|
|
414
|
+
})
|
|
415
|
+
});
|
|
416
|
+
}
|
|
417
|
+
O.displayName = "SwipeActions.Row";
|
|
418
|
+
var k = Object.assign(E, { Row: O });
|
|
419
|
+
//#endregion
|
|
420
|
+
export { k as t };
|
|
@@ -0,0 +1,145 @@
|
|
|
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 { i as a, n as o, r as s, t as c } from "./choice-control-5kJkLXgv.js";
|
|
6
|
+
import { useId as l } from "react";
|
|
7
|
+
import { vars as u } from "@jfrader/tokens/vars";
|
|
8
|
+
import { jsx as d, jsxs as f } from "@emotion/react/jsx-runtime";
|
|
9
|
+
//#region src/components/switch/switch.tsx
|
|
10
|
+
var p = {
|
|
11
|
+
sm: "36px",
|
|
12
|
+
md: "44px"
|
|
13
|
+
}, m = e({
|
|
14
|
+
position: "relative",
|
|
15
|
+
display: "inline-block",
|
|
16
|
+
flexShrink: 0,
|
|
17
|
+
boxSizing: "border-box",
|
|
18
|
+
border: `1px solid ${u.color.borderControl}`,
|
|
19
|
+
borderRadius: u.radius.full,
|
|
20
|
+
backgroundColor: u.color.surfaceHover,
|
|
21
|
+
transitionProperty: "background-color, border-color",
|
|
22
|
+
transitionDuration: u.motion.duration.fast,
|
|
23
|
+
transitionTimingFunction: u.motion.easeStandard,
|
|
24
|
+
"&::after": {
|
|
25
|
+
content: "\"\"",
|
|
26
|
+
position: "absolute",
|
|
27
|
+
insetBlockStart: "2px",
|
|
28
|
+
insetInlineStart: "2px",
|
|
29
|
+
borderRadius: u.radius.full,
|
|
30
|
+
backgroundColor: u.color.text,
|
|
31
|
+
transitionProperty: "transform, background-color",
|
|
32
|
+
transitionDuration: u.motion.duration.fast,
|
|
33
|
+
transitionTimingFunction: u.motion.easeStandard
|
|
34
|
+
},
|
|
35
|
+
[r]: {
|
|
36
|
+
transitionDuration: "0s",
|
|
37
|
+
"&::after": { transitionDuration: "0s" }
|
|
38
|
+
},
|
|
39
|
+
[n]: { "&::after": { backgroundColor: "CanvasText" } }
|
|
40
|
+
}), h = {
|
|
41
|
+
sm: e({
|
|
42
|
+
inlineSize: p.sm,
|
|
43
|
+
blockSize: "20px",
|
|
44
|
+
"&::after": {
|
|
45
|
+
inlineSize: "14px",
|
|
46
|
+
blockSize: "14px"
|
|
47
|
+
}
|
|
48
|
+
}),
|
|
49
|
+
md: e({
|
|
50
|
+
inlineSize: p.md,
|
|
51
|
+
blockSize: "24px",
|
|
52
|
+
"&::after": {
|
|
53
|
+
inlineSize: "18px",
|
|
54
|
+
blockSize: "18px"
|
|
55
|
+
}
|
|
56
|
+
})
|
|
57
|
+
}, g = {
|
|
58
|
+
sm: e({
|
|
59
|
+
"input:checked + span::after": {
|
|
60
|
+
transform: "translateX(16px)",
|
|
61
|
+
backgroundColor: u.color.accentContrast
|
|
62
|
+
},
|
|
63
|
+
"&:dir(rtl) input:checked + span::after": { transform: "translateX(-16px)" },
|
|
64
|
+
[n]: { "input:checked + span::after": { backgroundColor: "CanvasText" } }
|
|
65
|
+
}),
|
|
66
|
+
md: e({
|
|
67
|
+
"input:checked + span::after": {
|
|
68
|
+
transform: "translateX(20px)",
|
|
69
|
+
backgroundColor: u.color.accentContrast
|
|
70
|
+
},
|
|
71
|
+
"&:dir(rtl) input:checked + span::after": { transform: "translateX(-20px)" },
|
|
72
|
+
[n]: { "input:checked + span::after": { backgroundColor: "CanvasText" } }
|
|
73
|
+
})
|
|
74
|
+
}, _ = {
|
|
75
|
+
sm: e({ fontSize: u.textSize.sm }),
|
|
76
|
+
md: e({ fontSize: u.textSize.md })
|
|
77
|
+
}, v = e({
|
|
78
|
+
fontSize: u.textSize.sm,
|
|
79
|
+
color: u.color.textMuted
|
|
80
|
+
}), y = {
|
|
81
|
+
sm: e({ marginInlineStart: `calc(${p.sm} + ${u.space[2]})` }),
|
|
82
|
+
md: e({ marginInlineStart: `calc(${p.md} + ${u.space[2]})` })
|
|
83
|
+
};
|
|
84
|
+
function b({ ref: e, label: n, description: r, size: u = "md", onChange: p, onCheckedChange: b, slotProps: x, className: S, sx: C, dir: w, "aria-labelledby": T, "aria-describedby": E, ...D }) {
|
|
85
|
+
let O = l(), k = `${O}-label`, A = `${O}-description`, j = i(n), M = i(r), N = [T, j && k].filter(Boolean).join(" ") || void 0, P = [E, M && A].filter(Boolean).join(" ") || void 0, F = [S, x?.root?.className].filter(Boolean).join(" ") || void 0, I = (e) => {
|
|
86
|
+
p?.(e), b?.(e.currentTarget.checked);
|
|
87
|
+
};
|
|
88
|
+
return /* @__PURE__ */ d(t, {
|
|
89
|
+
className: F,
|
|
90
|
+
styles: [
|
|
91
|
+
s,
|
|
92
|
+
o,
|
|
93
|
+
g[u],
|
|
94
|
+
x?.root?.css
|
|
95
|
+
],
|
|
96
|
+
sx: C,
|
|
97
|
+
children: (t) => /* @__PURE__ */ f("label", {
|
|
98
|
+
"data-ui": "switch",
|
|
99
|
+
dir: w,
|
|
100
|
+
className: t,
|
|
101
|
+
children: [/* @__PURE__ */ f("span", {
|
|
102
|
+
css: a,
|
|
103
|
+
children: [
|
|
104
|
+
/* @__PURE__ */ d("input", {
|
|
105
|
+
...D,
|
|
106
|
+
ref: e,
|
|
107
|
+
type: "checkbox",
|
|
108
|
+
role: "switch",
|
|
109
|
+
"aria-labelledby": N,
|
|
110
|
+
"aria-describedby": P,
|
|
111
|
+
onChange: I,
|
|
112
|
+
css: c
|
|
113
|
+
}),
|
|
114
|
+
/* @__PURE__ */ d("span", {
|
|
115
|
+
"aria-hidden": "true",
|
|
116
|
+
className: x?.control?.className,
|
|
117
|
+
css: [
|
|
118
|
+
m,
|
|
119
|
+
h[u],
|
|
120
|
+
x?.control?.css
|
|
121
|
+
]
|
|
122
|
+
}),
|
|
123
|
+
j && /* @__PURE__ */ d("span", {
|
|
124
|
+
id: k,
|
|
125
|
+
className: x?.label?.className,
|
|
126
|
+
css: [_[u], x?.label?.css],
|
|
127
|
+
children: n
|
|
128
|
+
})
|
|
129
|
+
]
|
|
130
|
+
}), M && /* @__PURE__ */ d("span", {
|
|
131
|
+
id: A,
|
|
132
|
+
className: x?.description?.className,
|
|
133
|
+
css: [
|
|
134
|
+
v,
|
|
135
|
+
y[u],
|
|
136
|
+
x?.description?.css
|
|
137
|
+
],
|
|
138
|
+
children: r
|
|
139
|
+
})]
|
|
140
|
+
})
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
b.displayName = "Switch";
|
|
144
|
+
//#endregion
|
|
145
|
+
export { b as t };
|
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-C1WrKrf-.js";
|