@jfrader/ui 0.3.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/theme-root-BbTBuLMQ.js +46 -0
- package/dist/theme-root.js +1 -1
- package/dist/theme-scope-t7nAKc2c.js +27 -0
- 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/theme-root/theme-root.d.ts +9 -3
- 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/overlay-portal.d.ts +7 -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-scope.d.ts +19 -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-DrmjBbo7.js +0 -327
- package/dist/command-palette-V_2pEay7.js +0 -379
- package/dist/date-picker-ClUYBIBh.js +0 -250
- package/dist/field-anatomy-D2ToMeRa.js +0 -109
- package/dist/menu-DU60SMdt.js +0 -216
- package/dist/popover-BtN_0ejj.js +0 -113
- package/dist/select-BCS0-LVW.js +0 -286
- package/dist/theme-root-BiXXvQvr.js +0 -42
- package/dist/toast-iqelR-r0.js +0 -282
- package/dist/tooltip-CB-HC1js.js +0 -108
- package/dist/use-controlled-state-CVXDa-qM.js +0 -21
- package/dist/use-overlay-floating-efeqppiw.js +0 -19
|
@@ -0,0 +1,365 @@
|
|
|
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, r as i } from "./media-8yrN85VT.js";
|
|
5
|
+
import { t as a } from "./use-controlled-state-DpeVQZNR.js";
|
|
6
|
+
import { t as o } from "./visually-hidden-BJdvqqvn.js";
|
|
7
|
+
import { t as s } from "./renderable-DzcIj1Lo.js";
|
|
8
|
+
import { t as ee } from "./button-C92uYFJW.js";
|
|
9
|
+
import { t as c } from "./checkbox-cFquiSdy.js";
|
|
10
|
+
import { useEffect as te, useId as ne, useLayoutEffect as re, useMemo as l, useRef as u, useState as ie } from "react";
|
|
11
|
+
import { vars as d } from "@jfrader/tokens/vars";
|
|
12
|
+
import { jsx as f, jsxs as p } from "@emotion/react/jsx-runtime";
|
|
13
|
+
//#region src/components/sortable-data-table/sortable-data-table.tsx
|
|
14
|
+
var ae = {
|
|
15
|
+
empty: "No records",
|
|
16
|
+
missing: "—",
|
|
17
|
+
clear: "Clear selection",
|
|
18
|
+
scrollLabel: "Scrollable table",
|
|
19
|
+
sortButton: (e, t) => `${e}: sort ${t === "asc" ? "descending" : "ascending"}`,
|
|
20
|
+
sortStatus: (e, t) => `${e}, ${t === "asc" ? "ascending" : "descending"}`,
|
|
21
|
+
selectRow: (e) => `Select ${e}`,
|
|
22
|
+
selectAll: "Select all visible rows",
|
|
23
|
+
selectionStatus: (e, t, n, r) => `${r.visibleSelected} of ${r.visibleRows} visible selected; ${r.totalSelected} selected in total`
|
|
24
|
+
}, oe = e({
|
|
25
|
+
minInlineSize: 0,
|
|
26
|
+
maxInlineSize: "100%",
|
|
27
|
+
color: d.color.text,
|
|
28
|
+
backgroundColor: d.color.surface,
|
|
29
|
+
fontFamily: d.font.sans,
|
|
30
|
+
fontSize: d.textSize.sm,
|
|
31
|
+
lineHeight: d.lineHeight.base
|
|
32
|
+
}), se = e({
|
|
33
|
+
overflowX: "auto",
|
|
34
|
+
maxInlineSize: "100%",
|
|
35
|
+
border: `1px solid ${d.color.border}`,
|
|
36
|
+
borderRadius: d.radius.md,
|
|
37
|
+
"&:focus-visible": n
|
|
38
|
+
}), ce = e({
|
|
39
|
+
inlineSize: "100%",
|
|
40
|
+
borderCollapse: "separate",
|
|
41
|
+
borderSpacing: 0,
|
|
42
|
+
tableLayout: "auto"
|
|
43
|
+
}), le = e({
|
|
44
|
+
textAlign: "start",
|
|
45
|
+
padding: d.space[4],
|
|
46
|
+
fontWeight: d.fontWeight.medium
|
|
47
|
+
}), m = e({
|
|
48
|
+
paddingInline: d.space[3],
|
|
49
|
+
textAlign: "start",
|
|
50
|
+
verticalAlign: "middle",
|
|
51
|
+
overflowWrap: "anywhere",
|
|
52
|
+
borderBlockEnd: `1px solid ${d.color.borderSubtle}`,
|
|
53
|
+
"&[data-numeric]": {
|
|
54
|
+
textAlign: "end",
|
|
55
|
+
fontVariantNumeric: "tabular-nums",
|
|
56
|
+
"& button": { justifyContent: "flex-end" }
|
|
57
|
+
}
|
|
58
|
+
}), h = {
|
|
59
|
+
sm: e({ paddingBlock: d.space[2] }),
|
|
60
|
+
md: e({ paddingBlock: d.space[3] })
|
|
61
|
+
}, g = e({
|
|
62
|
+
position: "sticky",
|
|
63
|
+
insetBlockStart: 0,
|
|
64
|
+
zIndex: 1,
|
|
65
|
+
backgroundColor: d.color.surfaceRaised,
|
|
66
|
+
fontWeight: d.fontWeight.medium
|
|
67
|
+
}), ue = e({
|
|
68
|
+
display: "inline-flex",
|
|
69
|
+
alignItems: "center",
|
|
70
|
+
justifyContent: "space-between",
|
|
71
|
+
gap: d.space[2],
|
|
72
|
+
inlineSize: "100%",
|
|
73
|
+
minBlockSize: d.space[8],
|
|
74
|
+
minInlineSize: d.space[8],
|
|
75
|
+
paddingInline: d.space[2],
|
|
76
|
+
paddingBlock: d.space[1],
|
|
77
|
+
border: `1px solid ${d.color.borderControl}`,
|
|
78
|
+
borderRadius: d.radius.sm,
|
|
79
|
+
backgroundColor: "transparent",
|
|
80
|
+
color: "inherit",
|
|
81
|
+
font: "inherit",
|
|
82
|
+
textAlign: "inherit",
|
|
83
|
+
cursor: "pointer",
|
|
84
|
+
transitionProperty: "background-color, color",
|
|
85
|
+
transitionDuration: d.motion.duration.fast,
|
|
86
|
+
transitionTimingFunction: d.motion.easeStandard,
|
|
87
|
+
"&:hover": { backgroundColor: d.color.surfaceHover },
|
|
88
|
+
"&:focus-visible": n,
|
|
89
|
+
[i]: { transitionDuration: "0s" },
|
|
90
|
+
[r]: {
|
|
91
|
+
borderColor: "ButtonText",
|
|
92
|
+
color: "ButtonText"
|
|
93
|
+
}
|
|
94
|
+
}), de = e({
|
|
95
|
+
"&[data-selected]": { backgroundColor: d.color.accentSoft },
|
|
96
|
+
[r]: { "&[data-selected]": {
|
|
97
|
+
outline: "1px solid Highlight",
|
|
98
|
+
outlineOffset: "-1px"
|
|
99
|
+
} }
|
|
100
|
+
}), fe = e({
|
|
101
|
+
display: "flex",
|
|
102
|
+
flexWrap: "wrap",
|
|
103
|
+
alignItems: "center",
|
|
104
|
+
justifyContent: "space-between",
|
|
105
|
+
gap: d.space[3],
|
|
106
|
+
padding: d.space[3]
|
|
107
|
+
}), pe = e({
|
|
108
|
+
minBlockSize: d.space[8],
|
|
109
|
+
minInlineSize: d.space[8],
|
|
110
|
+
justifyContent: "center"
|
|
111
|
+
}), me = [], _ = (e) => e.sortable !== !1 && !!(e.accessor || e.compare), he = (e) => e.sortLabel ?? (typeof e.header == "string" ? e.header : ""), v = (e) => e == null || e === "" || typeof e == "number" && !Number.isFinite(e) || e instanceof Date && !Number.isFinite(e.getTime()), y = (e) => [...new Set(e)], ge = (e, t) => {
|
|
112
|
+
let n = new Set(t);
|
|
113
|
+
return e.length === n.size && e.every((e) => n.has(e));
|
|
114
|
+
};
|
|
115
|
+
function _e(e, t, n) {
|
|
116
|
+
return typeof e == "number" && typeof t == "number" ? e - t : e instanceof Date && t instanceof Date ? e.getTime() - t.getTime() : typeof e == "string" && typeof t == "string" ? n.compare(e, t) : 0;
|
|
117
|
+
}
|
|
118
|
+
function b({ ref: e, rows: n, columns: r, getRowId: i, caption: d, captionHidden: b = !1, value: ve, defaultValue: ye = null, onValueChange: be, sortMode: x = "client", selectable: S = !1, getRowLabel: xe, selectedKeys: Se, defaultSelectedKeys: Ce = me, onSelectionChange: we, locale: C, dateFormatOptions: w, timeZone: T, messages: Te, empty: E, loading: Ee = !1, size: D = "md", tableRef: De, slotProps: O, className: Oe, sx: ke, ...k }) {
|
|
119
|
+
let A = {
|
|
120
|
+
...ae,
|
|
121
|
+
...Te
|
|
122
|
+
}, Ae = ne(), [j, je] = a(ve, ye, be), [Me, Ne] = a(Se, Ce, we), M = y(Me ?? me), N = new Set(M), P = r.find((e) => e.id === j?.columnId && _(e)), F = P && j ? j : null, I = l(() => new Intl.NumberFormat(C), [C]), Pe = l(() => new Intl.DateTimeFormat(C, {
|
|
123
|
+
...w,
|
|
124
|
+
...T ? { timeZone: T } : {}
|
|
125
|
+
}), [
|
|
126
|
+
C,
|
|
127
|
+
w,
|
|
128
|
+
T
|
|
129
|
+
]), L = l(() => new Intl.Collator(C, {
|
|
130
|
+
numeric: !0,
|
|
131
|
+
sensitivity: "base"
|
|
132
|
+
}), [C]), R = l(() => x === "manual" || !F || !P ? n : n.map((e, t) => ({
|
|
133
|
+
row: e,
|
|
134
|
+
index: t
|
|
135
|
+
})).sort((e, t) => {
|
|
136
|
+
let n = P.accessor?.(e.row), r = P.accessor?.(t.row);
|
|
137
|
+
if (P.accessor && (v(n) || v(r))) return Number(v(n)) - Number(v(r)) || e.index - t.index;
|
|
138
|
+
let i = P.compare ? P.compare(e.row, t.row) : _e(n, r, L);
|
|
139
|
+
return (Number.isFinite(i) ? i : 0) * (F.direction === "asc" ? 1 : -1) || e.index - t.index;
|
|
140
|
+
}).map(({ row: e }) => e), [
|
|
141
|
+
n,
|
|
142
|
+
F?.columnId,
|
|
143
|
+
F?.direction,
|
|
144
|
+
x,
|
|
145
|
+
P,
|
|
146
|
+
L
|
|
147
|
+
]), z = R.map(i), B = z.filter((e) => N.has(e)).length, V = z.length > 0 && B === z.length, Fe = B > 0 && !V, H = A.selectionStatus(B, M.length, z.length, {
|
|
148
|
+
visibleSelected: I.format(B),
|
|
149
|
+
totalSelected: I.format(M.length),
|
|
150
|
+
visibleRows: I.format(z.length)
|
|
151
|
+
}), U = u(null), W = u(null), G = u(null), K = u(!1), q = u(null), J = u(null), Y = u(null), X = F ? `${F.columnId}:${F.direction}` : "", Z = JSON.stringify([...M].sort()), Q = u({
|
|
152
|
+
sort: X,
|
|
153
|
+
selection: Z
|
|
154
|
+
}), [Ie, Le] = ie("");
|
|
155
|
+
te(() => {
|
|
156
|
+
let e = Q.current.sort !== X || Q.current.selection !== Z, t = [];
|
|
157
|
+
Q.current.sort !== X && F && P && t.push(A.sortStatus(he(P), F.direction)), Q.current.selection !== Z && S && t.push(H), Q.current = {
|
|
158
|
+
sort: X,
|
|
159
|
+
selection: Z
|
|
160
|
+
}, e && Le(t.join(". "));
|
|
161
|
+
}, [
|
|
162
|
+
X,
|
|
163
|
+
Z,
|
|
164
|
+
S,
|
|
165
|
+
H,
|
|
166
|
+
P,
|
|
167
|
+
A.sortStatus,
|
|
168
|
+
F?.direction
|
|
169
|
+
]), re(() => {
|
|
170
|
+
if (K.current && M.length === 0) {
|
|
171
|
+
K.current = !1;
|
|
172
|
+
let e = W.current?.ownerDocument;
|
|
173
|
+
e?.activeElement === e?.body && W.current?.focus();
|
|
174
|
+
}
|
|
175
|
+
let e = q.current;
|
|
176
|
+
if (!e) return;
|
|
177
|
+
let t = z.indexOf(e.key);
|
|
178
|
+
if (t >= 0) {
|
|
179
|
+
e.index = t;
|
|
180
|
+
return;
|
|
181
|
+
}
|
|
182
|
+
let n = J.current;
|
|
183
|
+
if (n && n.ownerDocument.activeElement === n.ownerDocument.body) {
|
|
184
|
+
let t = n.rows[Math.min(e.index, n.rows.length - 1)]?.querySelectorAll("input, button, a[href], select, textarea, [tabindex=\"0\"]");
|
|
185
|
+
(t?.[Math.min(e.control, t.length - 1)] ?? W.current ?? Y.current)?.focus();
|
|
186
|
+
}
|
|
187
|
+
q.current = null;
|
|
188
|
+
});
|
|
189
|
+
let Re = (e) => {
|
|
190
|
+
let t = y(e);
|
|
191
|
+
ge(M, t) || Ne(t);
|
|
192
|
+
}, $ = (e, t) => Re(t ? [...M, ...e] : M.filter((t) => !e.includes(t))), ze = (e, t) => {
|
|
193
|
+
if (e.cell) return e.cell(t);
|
|
194
|
+
let n = e.accessor?.(t);
|
|
195
|
+
return v(n) ? A.missing : typeof n == "number" ? I.format(n) : n instanceof Date ? Pe.format(n) : n;
|
|
196
|
+
}, Be = (e, t) => /* @__PURE__ */ f(c, {
|
|
197
|
+
"aria-label": A.selectRow(xe(e)),
|
|
198
|
+
checked: N.has(t),
|
|
199
|
+
slotProps: { root: { css: pe } },
|
|
200
|
+
onChange: (e) => {
|
|
201
|
+
if (e.defaultPrevented || e.nativeEvent.defaultPrevented) return;
|
|
202
|
+
let n = e.nativeEvent, r = U.current === null ? -1 : z.indexOf(U.current), i = z.indexOf(t), a = n.shiftKey && r >= 0 ? z.slice(Math.min(r, i), Math.max(r, i) + 1) : [t];
|
|
203
|
+
$(a, e.currentTarget.checked), U.current = t;
|
|
204
|
+
}
|
|
205
|
+
});
|
|
206
|
+
return /* @__PURE__ */ f(t, {
|
|
207
|
+
className: Oe,
|
|
208
|
+
styles: [oe],
|
|
209
|
+
sx: ke,
|
|
210
|
+
children: (t) => /* @__PURE__ */ p("div", {
|
|
211
|
+
...k,
|
|
212
|
+
ref: e,
|
|
213
|
+
className: t,
|
|
214
|
+
"data-ui": "sortable-data-table",
|
|
215
|
+
children: [
|
|
216
|
+
/* @__PURE__ */ f("div", {
|
|
217
|
+
ref: Y,
|
|
218
|
+
role: "region",
|
|
219
|
+
"aria-label": A.scrollLabel,
|
|
220
|
+
"aria-describedby": k["aria-describedby"],
|
|
221
|
+
tabIndex: 0,
|
|
222
|
+
"data-ui": "sortable-data-table-scroller",
|
|
223
|
+
className: O?.scroller?.className,
|
|
224
|
+
css: [se, O?.scroller?.css],
|
|
225
|
+
children: /* @__PURE__ */ p("table", {
|
|
226
|
+
ref: De,
|
|
227
|
+
"aria-busy": Ee || void 0,
|
|
228
|
+
className: O?.table?.className,
|
|
229
|
+
css: [ce, O?.table?.css],
|
|
230
|
+
children: [
|
|
231
|
+
s(d) && /* @__PURE__ */ f("caption", {
|
|
232
|
+
id: Ae,
|
|
233
|
+
className: O?.caption?.className,
|
|
234
|
+
css: [
|
|
235
|
+
le,
|
|
236
|
+
b && o,
|
|
237
|
+
O?.caption?.css
|
|
238
|
+
],
|
|
239
|
+
children: d
|
|
240
|
+
}),
|
|
241
|
+
/* @__PURE__ */ p("colgroup", { children: [S && /* @__PURE__ */ f("col", {}), r.map((e) => /* @__PURE__ */ f("col", { style: { width: e.width } }, e.id))] }),
|
|
242
|
+
/* @__PURE__ */ f("thead", { children: /* @__PURE__ */ p("tr", { children: [S && /* @__PURE__ */ f("th", {
|
|
243
|
+
scope: "col",
|
|
244
|
+
css: [
|
|
245
|
+
m,
|
|
246
|
+
h[D],
|
|
247
|
+
g
|
|
248
|
+
],
|
|
249
|
+
children: /* @__PURE__ */ f(c, {
|
|
250
|
+
ref: W,
|
|
251
|
+
"aria-label": A.selectAll,
|
|
252
|
+
checked: V,
|
|
253
|
+
indeterminate: Fe,
|
|
254
|
+
disabled: !z.length,
|
|
255
|
+
slotProps: { root: { css: pe } },
|
|
256
|
+
onChange: (e) => {
|
|
257
|
+
!e.defaultPrevented && !e.nativeEvent.defaultPrevented && $(z, e.currentTarget.checked);
|
|
258
|
+
}
|
|
259
|
+
})
|
|
260
|
+
}), r.map((e) => /* @__PURE__ */ f("th", {
|
|
261
|
+
scope: "col",
|
|
262
|
+
"data-numeric": e.numeric || void 0,
|
|
263
|
+
"aria-sort": F?.columnId === e.id ? F.direction === "asc" ? "ascending" : "descending" : void 0,
|
|
264
|
+
className: O?.headerCell?.className,
|
|
265
|
+
css: [
|
|
266
|
+
m,
|
|
267
|
+
h[D],
|
|
268
|
+
g,
|
|
269
|
+
O?.headerCell?.css
|
|
270
|
+
],
|
|
271
|
+
children: _(e) ? /* @__PURE__ */ p("button", {
|
|
272
|
+
type: "button",
|
|
273
|
+
"aria-label": A.sortButton(he(e), F?.columnId === e.id ? F.direction : null),
|
|
274
|
+
className: O?.sortButton?.className,
|
|
275
|
+
css: [ue, O?.sortButton?.css],
|
|
276
|
+
onClick: (t) => {
|
|
277
|
+
t.defaultPrevented || je({
|
|
278
|
+
columnId: e.id,
|
|
279
|
+
direction: F?.columnId === e.id && F.direction === "asc" ? "desc" : "asc"
|
|
280
|
+
});
|
|
281
|
+
},
|
|
282
|
+
children: [s(e.header) && e.header, /* @__PURE__ */ f("span", {
|
|
283
|
+
"aria-hidden": "true",
|
|
284
|
+
children: F?.columnId === e.id ? F.direction === "asc" ? "▲" : "▼" : "♢"
|
|
285
|
+
})]
|
|
286
|
+
}) : s(e.header) && e.header
|
|
287
|
+
}, e.id))] }) }),
|
|
288
|
+
/* @__PURE__ */ f("tbody", {
|
|
289
|
+
ref: J,
|
|
290
|
+
children: R.length ? R.map((e, t) => {
|
|
291
|
+
let n = i(e);
|
|
292
|
+
return /* @__PURE__ */ p("tr", {
|
|
293
|
+
"data-selected": S && N.has(n) || void 0,
|
|
294
|
+
className: O?.row?.className,
|
|
295
|
+
css: [de, O?.row?.css],
|
|
296
|
+
onFocusCapture: (e) => {
|
|
297
|
+
let r = Array.from(e.currentTarget.querySelectorAll("input, button, a[href], select, textarea, [tabindex=\"0\"]"));
|
|
298
|
+
q.current = {
|
|
299
|
+
key: n,
|
|
300
|
+
index: t,
|
|
301
|
+
control: r.indexOf(e.target)
|
|
302
|
+
};
|
|
303
|
+
},
|
|
304
|
+
onBlurCapture: (e) => {
|
|
305
|
+
e.relatedTarget && !J.current?.contains(e.relatedTarget) && (q.current = null);
|
|
306
|
+
},
|
|
307
|
+
children: [S && /* @__PURE__ */ f("td", {
|
|
308
|
+
css: [m, h[D]],
|
|
309
|
+
children: Be(e, n)
|
|
310
|
+
}), r.map((t) => /* @__PURE__ */ f("td", {
|
|
311
|
+
"data-numeric": t.numeric || void 0,
|
|
312
|
+
className: O?.cell?.className,
|
|
313
|
+
css: [
|
|
314
|
+
m,
|
|
315
|
+
h[D],
|
|
316
|
+
O?.cell?.css
|
|
317
|
+
],
|
|
318
|
+
children: ze(t, e)
|
|
319
|
+
}, t.id))]
|
|
320
|
+
}, n);
|
|
321
|
+
}) : /* @__PURE__ */ f("tr", { children: /* @__PURE__ */ f("td", {
|
|
322
|
+
colSpan: r.length + Number(S),
|
|
323
|
+
className: O?.cell?.className,
|
|
324
|
+
css: [
|
|
325
|
+
m,
|
|
326
|
+
h[D],
|
|
327
|
+
O?.cell?.css
|
|
328
|
+
],
|
|
329
|
+
children: E === void 0 ? A.empty : s(E) && E
|
|
330
|
+
}) })
|
|
331
|
+
})
|
|
332
|
+
]
|
|
333
|
+
})
|
|
334
|
+
}),
|
|
335
|
+
S && /* @__PURE__ */ p("div", {
|
|
336
|
+
className: O?.footer?.className,
|
|
337
|
+
css: [fe, O?.footer?.css],
|
|
338
|
+
children: [/* @__PURE__ */ f("span", { children: H }), M.length > 0 && /* @__PURE__ */ f(ee, {
|
|
339
|
+
ref: G,
|
|
340
|
+
size: "sm",
|
|
341
|
+
variant: "ghost",
|
|
342
|
+
onClick: (e) => {
|
|
343
|
+
e.defaultPrevented || (K.current = G.current?.ownerDocument.activeElement === G.current, Re([]));
|
|
344
|
+
},
|
|
345
|
+
onBlur: (e) => {
|
|
346
|
+
e.relatedTarget && (K.current = !1);
|
|
347
|
+
},
|
|
348
|
+
children: A.clear
|
|
349
|
+
})]
|
|
350
|
+
}),
|
|
351
|
+
/* @__PURE__ */ f("p", {
|
|
352
|
+
role: "status",
|
|
353
|
+
"aria-live": "polite",
|
|
354
|
+
"aria-atomic": "true",
|
|
355
|
+
className: O?.status?.className,
|
|
356
|
+
css: [o, O?.status?.css],
|
|
357
|
+
children: Ie
|
|
358
|
+
})
|
|
359
|
+
]
|
|
360
|
+
})
|
|
361
|
+
});
|
|
362
|
+
}
|
|
363
|
+
b.displayName = "SortableDataTable";
|
|
364
|
+
//#endregion
|
|
365
|
+
export { b 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 "./visually-hidden-BJdvqqvn.js";
|
|
5
5
|
import { n as i, t as a } from "./loading-ring-B8-30Dl1.js";
|
|
6
6
|
import { vars as o } from "@jfrader/tokens/vars";
|
package/dist/spinner.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
export { t as Spinner } from "./spinner-
|
|
2
|
+
export { t as Spinner } from "./spinner-DtxvDPdM.js";
|
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { i as e, r as t, t as n } from "./sx-Dx9JUKp5.js";
|
|
3
|
+
import { n as r, r as i } from "./media-8yrN85VT.js";
|
|
4
|
+
import { t as a } from "./use-controlled-state-DpeVQZNR.js";
|
|
5
|
+
import { t as o } from "./renderable-DzcIj1Lo.js";
|
|
6
|
+
import { t as s } from "./button-C92uYFJW.js";
|
|
7
|
+
import { s as c } from "./listbox-style-WX-RASp1.js";
|
|
8
|
+
import { a as l, i as u, n as d, o as f, r as p, s as m, t as h } from "./menu-xwOOUtWP.js";
|
|
9
|
+
import { createContext as g, useContext as _, useEffect as v, useLayoutEffect as y, useMemo as b, useRef as x, useState as S } from "react";
|
|
10
|
+
import { vars as C } from "@jfrader/tokens/vars";
|
|
11
|
+
import { jsx as w, jsxs as T } from "@emotion/react/jsx-runtime";
|
|
12
|
+
import { useMergeRefs as E } from "@floating-ui/react";
|
|
13
|
+
//#region src/components/split-button/split-button.tsx
|
|
14
|
+
var D = "SplitButton", O = g(null);
|
|
15
|
+
function k(e) {
|
|
16
|
+
let t = _(O);
|
|
17
|
+
if (!t) throw Error(`${D}.${e} must be rendered inside <${D}>.`);
|
|
18
|
+
return t;
|
|
19
|
+
}
|
|
20
|
+
var A = {
|
|
21
|
+
solid: "soft",
|
|
22
|
+
soft: "soft",
|
|
23
|
+
outline: "outline",
|
|
24
|
+
ghost: "ghost"
|
|
25
|
+
}, j = {
|
|
26
|
+
sm: "32px",
|
|
27
|
+
md: "40px",
|
|
28
|
+
lg: "48px"
|
|
29
|
+
}, M = t({
|
|
30
|
+
label: "split-button",
|
|
31
|
+
display: "inline-flex",
|
|
32
|
+
alignItems: "stretch",
|
|
33
|
+
maxInlineSize: "100%",
|
|
34
|
+
verticalAlign: "middle",
|
|
35
|
+
isolation: "isolate"
|
|
36
|
+
}), N = { "&:focus-visible": {
|
|
37
|
+
position: "relative",
|
|
38
|
+
zIndex: 1
|
|
39
|
+
} }, P = t({
|
|
40
|
+
label: "split-button-action",
|
|
41
|
+
flex: "0 1 auto",
|
|
42
|
+
minInlineSize: 0,
|
|
43
|
+
blockSize: "auto",
|
|
44
|
+
paddingBlock: C.space[1],
|
|
45
|
+
whiteSpace: "normal",
|
|
46
|
+
textAlign: "center",
|
|
47
|
+
borderStartEndRadius: 0,
|
|
48
|
+
borderEndEndRadius: 0,
|
|
49
|
+
borderInlineEndWidth: 0,
|
|
50
|
+
...N,
|
|
51
|
+
[r]: { borderColor: "ButtonText" }
|
|
52
|
+
}), F = t({
|
|
53
|
+
label: "split-button-trigger",
|
|
54
|
+
flexShrink: 0,
|
|
55
|
+
blockSize: "auto",
|
|
56
|
+
paddingInline: 0,
|
|
57
|
+
borderStartStartRadius: 0,
|
|
58
|
+
borderEndStartRadius: 0,
|
|
59
|
+
borderInlineStartColor: C.color.borderControl,
|
|
60
|
+
...N,
|
|
61
|
+
[r]: { borderColor: "ButtonText" }
|
|
62
|
+
}), I = Object.fromEntries(Object.entries(j).map(([e, n]) => [e, t({ minBlockSize: n })])), L = Object.fromEntries(Object.entries(j).map(([e, n]) => [e, t({
|
|
63
|
+
minBlockSize: n,
|
|
64
|
+
inlineSize: n
|
|
65
|
+
})])), R = t({
|
|
66
|
+
display: "inline-flex",
|
|
67
|
+
transitionProperty: "transform",
|
|
68
|
+
transitionDuration: C.motion.duration.fast,
|
|
69
|
+
transitionTimingFunction: C.motion.easeStandard,
|
|
70
|
+
"& svg": {
|
|
71
|
+
inlineSize: "1em",
|
|
72
|
+
blockSize: "1em"
|
|
73
|
+
},
|
|
74
|
+
"[aria-expanded=\"true\"] > &": { transform: "rotate(180deg)" },
|
|
75
|
+
[i]: {
|
|
76
|
+
transitionDuration: "0s",
|
|
77
|
+
"[aria-expanded=\"true\"] > &": { transform: "none" }
|
|
78
|
+
},
|
|
79
|
+
[r]: { color: "ButtonText" }
|
|
80
|
+
}), z = e({
|
|
81
|
+
from: { opacity: 0 },
|
|
82
|
+
to: { opacity: 1 }
|
|
83
|
+
}), B = t({
|
|
84
|
+
display: "inline-grid",
|
|
85
|
+
justifyItems: "center",
|
|
86
|
+
"& > *": { gridArea: "1 / 1" }
|
|
87
|
+
}), V = t({ visibility: "hidden" }), H = t({
|
|
88
|
+
"&[data-swapped]": { animation: `${z} ${C.motion.duration.base} ${C.motion.easeStandard}` },
|
|
89
|
+
[i]: { "&[data-swapped]": { animation: "none" } }
|
|
90
|
+
}), U = {
|
|
91
|
+
neutral: t({}),
|
|
92
|
+
danger: t({
|
|
93
|
+
color: C.color.dangerText,
|
|
94
|
+
"&:hover:not([aria-disabled=\"true\"]), &[data-active]:not([aria-disabled=\"true\"])": { backgroundColor: C.color.dangerSoft }
|
|
95
|
+
})
|
|
96
|
+
}, W = /* @__PURE__ */ w("svg", {
|
|
97
|
+
viewBox: "0 0 16 16",
|
|
98
|
+
fill: "none",
|
|
99
|
+
stroke: "currentColor",
|
|
100
|
+
strokeWidth: "1.5",
|
|
101
|
+
strokeLinecap: "round",
|
|
102
|
+
strokeLinejoin: "round",
|
|
103
|
+
children: /* @__PURE__ */ w("path", { d: "M4 6l4 4 4-4" })
|
|
104
|
+
});
|
|
105
|
+
function G({ ref: e, variant: t = "solid", tone: r = "accent", size: i = "md", disabled: o = !1, open: s, defaultOpen: c = !1, onOpenChange: l, placement: u = "bottom-end", className: d, sx: f, children: p, ...m }) {
|
|
106
|
+
let [g = !1, _] = a(s, c, l), C = x(null), T = E([C, e]), [D, k] = S(), [A, j] = S(), N = x(!1);
|
|
107
|
+
y(() => {
|
|
108
|
+
C.current && k(getComputedStyle(C.current).direction === "rtl" ? "rtl" : "ltr");
|
|
109
|
+
}, [g]), v(() => {
|
|
110
|
+
o ? g && !N.current && (N.current = !0, _(!1)) : N.current = !1;
|
|
111
|
+
}, [
|
|
112
|
+
o,
|
|
113
|
+
g,
|
|
114
|
+
_
|
|
115
|
+
]);
|
|
116
|
+
let P = (e) => {
|
|
117
|
+
e && o || _(e);
|
|
118
|
+
}, F = b(() => ({
|
|
119
|
+
variant: t,
|
|
120
|
+
tone: r,
|
|
121
|
+
size: i,
|
|
122
|
+
disabled: o,
|
|
123
|
+
direction: D,
|
|
124
|
+
triggerLabelledBy: A,
|
|
125
|
+
setTriggerLabelledBy: j
|
|
126
|
+
}), [
|
|
127
|
+
t,
|
|
128
|
+
r,
|
|
129
|
+
i,
|
|
130
|
+
o,
|
|
131
|
+
D,
|
|
132
|
+
A
|
|
133
|
+
]);
|
|
134
|
+
return /* @__PURE__ */ w(h, {
|
|
135
|
+
open: g,
|
|
136
|
+
onOpenChange: P,
|
|
137
|
+
placement: u,
|
|
138
|
+
children: /* @__PURE__ */ w(O.Provider, {
|
|
139
|
+
value: F,
|
|
140
|
+
children: /* @__PURE__ */ w(n, {
|
|
141
|
+
className: d,
|
|
142
|
+
styles: M,
|
|
143
|
+
sx: f,
|
|
144
|
+
children: (e) => /* @__PURE__ */ w("div", {
|
|
145
|
+
...m,
|
|
146
|
+
ref: T,
|
|
147
|
+
role: "group",
|
|
148
|
+
"data-ui": "split-button",
|
|
149
|
+
className: e,
|
|
150
|
+
children: p
|
|
151
|
+
})
|
|
152
|
+
})
|
|
153
|
+
})
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
G.displayName = "SplitButton";
|
|
157
|
+
var K = (e) => typeof e == "string" || typeof e == "number" ? String(e) : void 0;
|
|
158
|
+
function q({ reserveLabels: e, children: t }) {
|
|
159
|
+
let n = K(t), [r, i] = S(n), [a, o] = S(!1);
|
|
160
|
+
return n !== r && (i(n), o(!0)), /* @__PURE__ */ T("span", {
|
|
161
|
+
css: B,
|
|
162
|
+
"data-ui": "split-button-label",
|
|
163
|
+
children: [e.map((e) => /* @__PURE__ */ w("span", {
|
|
164
|
+
css: V,
|
|
165
|
+
"aria-hidden": !0,
|
|
166
|
+
children: e
|
|
167
|
+
}, e)), /* @__PURE__ */ w("span", {
|
|
168
|
+
css: H,
|
|
169
|
+
"data-swapped": a || void 0,
|
|
170
|
+
children: t
|
|
171
|
+
}, n)]
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
function J({ ref: e, variant: t, tone: n, size: r, disabled: i = !1, reserveLabels: a, children: o, className: c, sx: l, ...u }) {
|
|
175
|
+
let d = k("Action"), f = d.disabled || i, p = r ?? d.size;
|
|
176
|
+
return /* @__PURE__ */ w(s, {
|
|
177
|
+
...u,
|
|
178
|
+
ref: e,
|
|
179
|
+
variant: t ?? d.variant,
|
|
180
|
+
tone: n ?? d.tone,
|
|
181
|
+
size: p,
|
|
182
|
+
disabled: f,
|
|
183
|
+
"data-ui": "split-button-action",
|
|
184
|
+
css: [P, I[p]],
|
|
185
|
+
className: c,
|
|
186
|
+
sx: l,
|
|
187
|
+
render: ({ "data-ui": e, ...t }) => /* @__PURE__ */ w("button", {
|
|
188
|
+
...t,
|
|
189
|
+
type: t.type ?? "button",
|
|
190
|
+
"data-ui": e,
|
|
191
|
+
disabled: f
|
|
192
|
+
}),
|
|
193
|
+
children: a !== void 0 && a.length > 0 ? /* @__PURE__ */ w(q, {
|
|
194
|
+
reserveLabels: a,
|
|
195
|
+
children: o
|
|
196
|
+
}) : o
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
J.displayName = "SplitButton.Action";
|
|
200
|
+
function Y({ ref: e, disabled: t = !1, children: n = W, className: r, sx: i, ...a }) {
|
|
201
|
+
let c = k("Trigger"), u = c.disabled || t, d = "aria-labelledby" in a ? a["aria-labelledby"] : void 0, { setTriggerLabelledBy: f } = c;
|
|
202
|
+
return y(() => (f(d), () => f(void 0)), [d, f]), /* @__PURE__ */ w(s, {
|
|
203
|
+
...a,
|
|
204
|
+
ref: e,
|
|
205
|
+
variant: A[c.variant],
|
|
206
|
+
tone: c.tone,
|
|
207
|
+
size: c.size,
|
|
208
|
+
disabled: u,
|
|
209
|
+
"data-ui": "split-button-trigger",
|
|
210
|
+
css: [F, L[c.size]],
|
|
211
|
+
className: r,
|
|
212
|
+
sx: i,
|
|
213
|
+
render: ({ "data-ui": e, ref: t, ...n }) => /* @__PURE__ */ w(l, {
|
|
214
|
+
...n,
|
|
215
|
+
ref: t,
|
|
216
|
+
type: "button",
|
|
217
|
+
disabled: u,
|
|
218
|
+
family: D,
|
|
219
|
+
marker: e
|
|
220
|
+
}),
|
|
221
|
+
children: o(n) && n !== "" && /* @__PURE__ */ w("span", {
|
|
222
|
+
css: R,
|
|
223
|
+
"aria-hidden": !0,
|
|
224
|
+
children: n
|
|
225
|
+
})
|
|
226
|
+
});
|
|
227
|
+
}
|
|
228
|
+
Y.displayName = "SplitButton.Trigger";
|
|
229
|
+
function X({ dir: e, "aria-labelledby": t, ...n }) {
|
|
230
|
+
let { direction: r, triggerLabelledBy: i } = k("Content"), a = [t, n["aria-label"] === void 0 ? i : void 0].filter(Boolean).join(" ");
|
|
231
|
+
return /* @__PURE__ */ w(d, {
|
|
232
|
+
...n,
|
|
233
|
+
"aria-labelledby": a || void 0,
|
|
234
|
+
dir: e ?? r,
|
|
235
|
+
family: D,
|
|
236
|
+
marker: "split-button-content",
|
|
237
|
+
styles: c
|
|
238
|
+
});
|
|
239
|
+
}
|
|
240
|
+
X.displayName = "SplitButton.Content";
|
|
241
|
+
function Z({ tone: e = "neutral", disabled: t = !1, ...n }) {
|
|
242
|
+
let r = k("Item");
|
|
243
|
+
return /* @__PURE__ */ w(p, {
|
|
244
|
+
...n,
|
|
245
|
+
disabled: r.disabled || t,
|
|
246
|
+
family: D,
|
|
247
|
+
marker: "split-button-item",
|
|
248
|
+
styles: [f, U[e]]
|
|
249
|
+
});
|
|
250
|
+
}
|
|
251
|
+
Z.displayName = "SplitButton.Item";
|
|
252
|
+
function Q(e) {
|
|
253
|
+
return k("Separator"), /* @__PURE__ */ w(u, {
|
|
254
|
+
...e,
|
|
255
|
+
marker: "split-button-separator",
|
|
256
|
+
styles: m
|
|
257
|
+
});
|
|
258
|
+
}
|
|
259
|
+
Q.displayName = "SplitButton.Separator";
|
|
260
|
+
var $ = Object.assign(G, {
|
|
261
|
+
Action: J,
|
|
262
|
+
Trigger: Y,
|
|
263
|
+
Content: X,
|
|
264
|
+
Item: Z,
|
|
265
|
+
Separator: Q
|
|
266
|
+
});
|
|
267
|
+
//#endregion
|
|
268
|
+
export { $ as t };
|