@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,292 @@
|
|
|
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 ee } from "./button-C92uYFJW.js";
|
|
7
|
+
import { t as o } from "./copy-button-ByiA6D3R.js";
|
|
8
|
+
import { Fragment as te, useCallback as s, useEffect as c, useId as ne, useLayoutEffect as re, useRef as l, useState as ie } from "react";
|
|
9
|
+
import { vars as u } from "@jfrader/tokens/vars";
|
|
10
|
+
import { Fragment as d, jsx as f, jsxs as p } from "@emotion/react/jsx-runtime";
|
|
11
|
+
//#region src/components/code-block/code-block.tsx
|
|
12
|
+
var m = 2, h = `calc(${u.radius.lg} - ${u.space[1]})`, ae = e({
|
|
13
|
+
label: "code-block",
|
|
14
|
+
boxSizing: "border-box",
|
|
15
|
+
display: "flex",
|
|
16
|
+
flexDirection: "column",
|
|
17
|
+
gap: u.space[1],
|
|
18
|
+
minInlineSize: 0,
|
|
19
|
+
maxInlineSize: "100%",
|
|
20
|
+
padding: u.space[1],
|
|
21
|
+
backgroundColor: u.color.surfaceRaised,
|
|
22
|
+
color: u.color.text,
|
|
23
|
+
border: `1px solid ${u.color.border}`,
|
|
24
|
+
borderRadius: u.radius.lg,
|
|
25
|
+
boxShadow: u.shadow.raised,
|
|
26
|
+
fontFamily: u.font.sans,
|
|
27
|
+
fontSize: u.textSize.sm,
|
|
28
|
+
lineHeight: u.lineHeight.base,
|
|
29
|
+
[r]: {
|
|
30
|
+
borderColor: "CanvasText",
|
|
31
|
+
color: "CanvasText"
|
|
32
|
+
}
|
|
33
|
+
}), g = e({
|
|
34
|
+
display: "flex",
|
|
35
|
+
alignItems: "center",
|
|
36
|
+
gap: u.space[2],
|
|
37
|
+
minBlockSize: u.space[8],
|
|
38
|
+
paddingInlineStart: u.space[3]
|
|
39
|
+
}), _ = e({
|
|
40
|
+
minInlineSize: 0,
|
|
41
|
+
fontWeight: u.fontWeight.medium,
|
|
42
|
+
overflowWrap: "anywhere"
|
|
43
|
+
}), v = e({
|
|
44
|
+
flexShrink: 0,
|
|
45
|
+
maxInlineSize: "50%",
|
|
46
|
+
paddingInline: u.space[2],
|
|
47
|
+
border: `1px solid ${u.color.border}`,
|
|
48
|
+
borderRadius: u.radius.full,
|
|
49
|
+
color: u.color.textMuted,
|
|
50
|
+
fontFamily: u.font.mono,
|
|
51
|
+
fontSize: u.textSize.xs,
|
|
52
|
+
overflowWrap: "anywhere"
|
|
53
|
+
}), y = e({ marginInlineStart: "auto" }), b = e({
|
|
54
|
+
position: "relative",
|
|
55
|
+
display: "flex",
|
|
56
|
+
direction: "ltr",
|
|
57
|
+
minInlineSize: 0,
|
|
58
|
+
overflow: "hidden",
|
|
59
|
+
backgroundColor: u.color.surfaceInset,
|
|
60
|
+
border: `1px solid ${u.color.borderSubtle}`,
|
|
61
|
+
borderRadius: h,
|
|
62
|
+
"&[data-state=\"collapsed\"]::after": {
|
|
63
|
+
content: "\"\"",
|
|
64
|
+
position: "absolute",
|
|
65
|
+
insetInline: 0,
|
|
66
|
+
insetBlockEnd: 0,
|
|
67
|
+
blockSize: u.space[8],
|
|
68
|
+
backgroundImage: `linear-gradient(to bottom, transparent, ${u.color.surfaceInset})`,
|
|
69
|
+
pointerEvents: "none"
|
|
70
|
+
},
|
|
71
|
+
[r]: {
|
|
72
|
+
borderColor: "CanvasText",
|
|
73
|
+
"&[data-state=\"collapsed\"]::after": { display: "none" }
|
|
74
|
+
}
|
|
75
|
+
}), x = e({
|
|
76
|
+
fontFamily: u.font.mono,
|
|
77
|
+
fontSize: u.textSize.sm,
|
|
78
|
+
lineHeight: u.lineHeight.relaxed,
|
|
79
|
+
fontVariantNumeric: "tabular-nums",
|
|
80
|
+
whiteSpace: "pre",
|
|
81
|
+
tabSize: m
|
|
82
|
+
}), oe = e({
|
|
83
|
+
flexShrink: 0,
|
|
84
|
+
paddingBlock: u.space[3],
|
|
85
|
+
paddingInline: u.space[3],
|
|
86
|
+
textAlign: "end",
|
|
87
|
+
color: u.color.textSubtle,
|
|
88
|
+
userSelect: "none",
|
|
89
|
+
borderInlineEnd: `1px solid ${u.color.border}`
|
|
90
|
+
}), se = e({
|
|
91
|
+
flex: "1 1 auto",
|
|
92
|
+
minInlineSize: 0,
|
|
93
|
+
margin: 0,
|
|
94
|
+
paddingBlock: u.space[3],
|
|
95
|
+
paddingInline: u.space[4],
|
|
96
|
+
overflow: "auto",
|
|
97
|
+
unicodeBidi: "isolate",
|
|
98
|
+
borderRadius: "inherit",
|
|
99
|
+
scrollbarWidth: "thin",
|
|
100
|
+
scrollbarColor: `${u.color.borderStrong} transparent`,
|
|
101
|
+
"[data-ui=\"code-block-gutter\"] + &": {
|
|
102
|
+
borderStartStartRadius: 0,
|
|
103
|
+
borderEndStartRadius: 0
|
|
104
|
+
},
|
|
105
|
+
"&:focus-visible": n
|
|
106
|
+
}), ce = e({ font: "inherit" }), le = e({
|
|
107
|
+
inlineSize: "100%",
|
|
108
|
+
blockSize: "auto",
|
|
109
|
+
minBlockSize: u.space[8],
|
|
110
|
+
borderRadius: h,
|
|
111
|
+
color: u.color.textMuted,
|
|
112
|
+
whiteSpace: "normal",
|
|
113
|
+
overflowWrap: "anywhere",
|
|
114
|
+
"& svg": {
|
|
115
|
+
transitionProperty: "transform",
|
|
116
|
+
transitionDuration: u.motion.duration.base,
|
|
117
|
+
transitionTimingFunction: u.motion.easeStandard
|
|
118
|
+
},
|
|
119
|
+
"&[aria-expanded=\"true\"] svg": { transform: "rotate(180deg)" },
|
|
120
|
+
[i]: { "& svg": { transitionDuration: "0s" } }
|
|
121
|
+
}), ue = /* @__PURE__ */ f("svg", {
|
|
122
|
+
viewBox: "0 0 16 16",
|
|
123
|
+
fill: "none",
|
|
124
|
+
stroke: "currentColor",
|
|
125
|
+
strokeWidth: 1.5,
|
|
126
|
+
strokeLinecap: "round",
|
|
127
|
+
strokeLinejoin: "round",
|
|
128
|
+
children: /* @__PURE__ */ f("path", { d: "M4 6l4 4 4-4" })
|
|
129
|
+
}), S = new Intl.PluralRules("en");
|
|
130
|
+
function de(e, t) {
|
|
131
|
+
return `Show all ${t} ${S.select(e) === "one" ? "line" : "lines"}`;
|
|
132
|
+
}
|
|
133
|
+
function C(e) {
|
|
134
|
+
process.env.NODE_ENV !== "production" && console.warn("CodeBlock: highlighting failed; showing plain text.", e);
|
|
135
|
+
}
|
|
136
|
+
function fe(e, t) {
|
|
137
|
+
let n = t?.map((e) => e.content).join("");
|
|
138
|
+
return t === void 0 || n === void 0 || !e.startsWith(n) ? e : /* @__PURE__ */ p(d, { children: [t.map((e, t) => /* @__PURE__ */ f("span", {
|
|
139
|
+
style: {
|
|
140
|
+
color: e.color,
|
|
141
|
+
fontStyle: e.fontStyle
|
|
142
|
+
},
|
|
143
|
+
children: e.content
|
|
144
|
+
}, t)), e.slice(n.length)] });
|
|
145
|
+
}
|
|
146
|
+
function w({ ref: e, code: n, filename: r, language: i, label: u = "Source code", sourceLabel: d = "Selectable source code", maxLines: m, open: h, defaultOpen: S = !1, onOpenChange: w, lineNumbers: T = !1, locale: E, getExpandLabel: D = de, collapseLabel: O = "Show fewer lines", copyable: k = !0, copyButtonProps: A, preRef: j, highlight: M, slotProps: N, className: P, sx: F, "aria-label": I, "aria-labelledby": L, ...R }) {
|
|
147
|
+
let z = ne(), B = `${z}-label`, V = `${z}-source`, [H, pe] = a(h, S, w), U = n.match(/[^\n]*\n|[^\n]+$/g) ?? [], W = m !== void 0 && Number.isFinite(m) && m > 0 ? Math.max(1, Math.floor(m)) : void 0, G = W !== void 0 && U.length > W, K = !G || H, q = K ? U : U.slice(0, W), J = new Intl.NumberFormat(E), Y = l(null), me = s((e) => {
|
|
148
|
+
if (e) return () => {
|
|
149
|
+
e.ownerDocument.activeElement === e && (Y.current = e.ownerDocument);
|
|
150
|
+
};
|
|
151
|
+
}, []), X = l(M), [Z, he] = ie(null), Q = M !== void 0;
|
|
152
|
+
c(() => {
|
|
153
|
+
X.current = M;
|
|
154
|
+
}), c(() => {
|
|
155
|
+
let e = X.current;
|
|
156
|
+
if (!e || n === "") return;
|
|
157
|
+
let t = !0, r;
|
|
158
|
+
try {
|
|
159
|
+
r = e({
|
|
160
|
+
code: n,
|
|
161
|
+
language: i
|
|
162
|
+
});
|
|
163
|
+
} catch (e) {
|
|
164
|
+
C(e);
|
|
165
|
+
return;
|
|
166
|
+
}
|
|
167
|
+
return Promise.resolve(r).then((e) => {
|
|
168
|
+
t && he(e ? {
|
|
169
|
+
code: n,
|
|
170
|
+
language: i,
|
|
171
|
+
lines: e
|
|
172
|
+
} : null);
|
|
173
|
+
}, (e) => {
|
|
174
|
+
t && C(e);
|
|
175
|
+
}), () => {
|
|
176
|
+
t = !1;
|
|
177
|
+
};
|
|
178
|
+
}, [
|
|
179
|
+
n,
|
|
180
|
+
i,
|
|
181
|
+
Q,
|
|
182
|
+
M
|
|
183
|
+
]);
|
|
184
|
+
let $ = Q && Z?.code === n && Z.language === i ? Z.lines : void 0;
|
|
185
|
+
return re(() => {
|
|
186
|
+
Y.current &&= (Y.current.getElementById(V)?.focus(), null);
|
|
187
|
+
}), /* @__PURE__ */ f(t, {
|
|
188
|
+
className: P,
|
|
189
|
+
styles: ae,
|
|
190
|
+
sx: F,
|
|
191
|
+
children: (t) => /* @__PURE__ */ p("section", {
|
|
192
|
+
...R,
|
|
193
|
+
ref: e,
|
|
194
|
+
"data-ui": "code-block",
|
|
195
|
+
className: t,
|
|
196
|
+
"aria-label": I,
|
|
197
|
+
"aria-labelledby": L ? `${L} ${B}` : I === void 0 ? B : void 0,
|
|
198
|
+
"data-highlighted": $ ? "" : void 0,
|
|
199
|
+
children: [
|
|
200
|
+
/* @__PURE__ */ p("header", {
|
|
201
|
+
"data-ui": "code-block-header",
|
|
202
|
+
className: N?.header?.className,
|
|
203
|
+
css: [g, N?.header?.css],
|
|
204
|
+
children: [
|
|
205
|
+
/* @__PURE__ */ f("span", {
|
|
206
|
+
id: B,
|
|
207
|
+
"data-ui": "code-block-label",
|
|
208
|
+
className: N?.label?.className,
|
|
209
|
+
css: [_, N?.label?.css],
|
|
210
|
+
children: r || u
|
|
211
|
+
}),
|
|
212
|
+
i !== void 0 && i !== "" && /* @__PURE__ */ f("span", {
|
|
213
|
+
"data-ui": "code-block-language",
|
|
214
|
+
className: N?.language?.className,
|
|
215
|
+
css: [v, N?.language?.css],
|
|
216
|
+
children: i
|
|
217
|
+
}),
|
|
218
|
+
k && /* @__PURE__ */ f(o, {
|
|
219
|
+
label: "Copy code",
|
|
220
|
+
pendingLabel: "Copying code",
|
|
221
|
+
copiedLabel: "Code copied",
|
|
222
|
+
errorLabel: "Could not copy code",
|
|
223
|
+
variant: "ghost",
|
|
224
|
+
iconOnly: !0,
|
|
225
|
+
...A,
|
|
226
|
+
css: [y, A?.css],
|
|
227
|
+
text: n
|
|
228
|
+
})
|
|
229
|
+
]
|
|
230
|
+
}),
|
|
231
|
+
/* @__PURE__ */ p("div", {
|
|
232
|
+
"data-ui": "code-block-source-frame",
|
|
233
|
+
"data-state": G ? K ? "expanded" : "collapsed" : void 0,
|
|
234
|
+
className: N?.sourceFrame?.className,
|
|
235
|
+
css: [b, N?.sourceFrame?.css],
|
|
236
|
+
children: [T && q.length > 0 && /* @__PURE__ */ f("div", {
|
|
237
|
+
"aria-hidden": "true",
|
|
238
|
+
"data-ui": "code-block-gutter",
|
|
239
|
+
className: N?.gutter?.className,
|
|
240
|
+
css: [
|
|
241
|
+
x,
|
|
242
|
+
oe,
|
|
243
|
+
N?.gutter?.css
|
|
244
|
+
],
|
|
245
|
+
children: q.map((e, t) => J.format(t + 1)).join("\n")
|
|
246
|
+
}), /* @__PURE__ */ f("pre", {
|
|
247
|
+
id: V,
|
|
248
|
+
ref: j,
|
|
249
|
+
role: "group",
|
|
250
|
+
tabIndex: 0,
|
|
251
|
+
dir: "ltr",
|
|
252
|
+
"aria-label": d,
|
|
253
|
+
"data-ui": "code-block-pre",
|
|
254
|
+
className: N?.pre?.className,
|
|
255
|
+
css: [
|
|
256
|
+
x,
|
|
257
|
+
se,
|
|
258
|
+
N?.pre?.css
|
|
259
|
+
],
|
|
260
|
+
children: /* @__PURE__ */ f("code", {
|
|
261
|
+
"data-ui": "code-block-code",
|
|
262
|
+
className: N?.code?.className,
|
|
263
|
+
css: [ce, N?.code?.css],
|
|
264
|
+
children: $ ? q.map((e, t) => /* @__PURE__ */ f(te, { children: fe(e, $[t]) }, t)) : K ? n : q.join("")
|
|
265
|
+
})
|
|
266
|
+
})]
|
|
267
|
+
}),
|
|
268
|
+
G && /* @__PURE__ */ f(ee, {
|
|
269
|
+
ref: me,
|
|
270
|
+
variant: "ghost",
|
|
271
|
+
tone: "neutral",
|
|
272
|
+
size: "sm",
|
|
273
|
+
endIcon: ue,
|
|
274
|
+
"aria-expanded": !!H,
|
|
275
|
+
"aria-controls": V,
|
|
276
|
+
"data-ui": "code-block-toggle",
|
|
277
|
+
className: N?.toggle?.className,
|
|
278
|
+
css: [le, N?.toggle?.css],
|
|
279
|
+
render: (e) => /* @__PURE__ */ f("button", {
|
|
280
|
+
...e,
|
|
281
|
+
type: "button"
|
|
282
|
+
}),
|
|
283
|
+
onClick: () => pe(!H),
|
|
284
|
+
children: H ? O : D(U.length, J.format(U.length))
|
|
285
|
+
})
|
|
286
|
+
]
|
|
287
|
+
})
|
|
288
|
+
});
|
|
289
|
+
}
|
|
290
|
+
w.displayName = "CodeBlock";
|
|
291
|
+
//#endregion
|
|
292
|
+
export { w as t };
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { t as e } from "./part-id-D0zksy32.js";
|
|
3
|
+
import { useCallback as t, useLayoutEffect as n, useMemo as r, useState as i } from "react";
|
|
4
|
+
import { useListItem as a } from "@floating-ui/react";
|
|
5
|
+
//#region src/utils/collection-registry.ts
|
|
6
|
+
var o = (e, t) => e !== void 0 && Object.keys(t).every((n) => e[n] === t[n]), s = (t, n) => `${e(t, "opt", n)}-item`;
|
|
7
|
+
function c() {
|
|
8
|
+
let [e, n] = i(() => /* @__PURE__ */ new Map()), a = t((e, t) => n((n) => o(n.get(e), t) ? n : new Map(n).set(e, t)), []), s = t((e) => n((t) => {
|
|
9
|
+
if (!t.has(e)) return t;
|
|
10
|
+
let n = new Map(t);
|
|
11
|
+
return n.delete(e), n;
|
|
12
|
+
}), []);
|
|
13
|
+
return [e, r(() => ({
|
|
14
|
+
register: a,
|
|
15
|
+
unregister: s
|
|
16
|
+
}), [a, s])];
|
|
17
|
+
}
|
|
18
|
+
function l(e) {
|
|
19
|
+
return a(e);
|
|
20
|
+
}
|
|
21
|
+
function u(e, t, r) {
|
|
22
|
+
n(() => {
|
|
23
|
+
if (t && e !== -1) return r.add(e), () => {
|
|
24
|
+
r.delete(e);
|
|
25
|
+
};
|
|
26
|
+
}, [
|
|
27
|
+
t,
|
|
28
|
+
e,
|
|
29
|
+
r
|
|
30
|
+
]);
|
|
31
|
+
}
|
|
32
|
+
function d(e, t, r, i, a) {
|
|
33
|
+
let o = l(), { index: s } = o;
|
|
34
|
+
return n(() => {
|
|
35
|
+
let n = r.current?.textContent ?? "";
|
|
36
|
+
if (t.register(e, i(s, n)), a === void 0 || s === -1) return;
|
|
37
|
+
let { labelsRef: o, include: c } = a;
|
|
38
|
+
return o.current[s] = c ? n : null, () => {
|
|
39
|
+
o.current[s] = null;
|
|
40
|
+
};
|
|
41
|
+
}), n(() => () => t.unregister(e), [e, t]), o;
|
|
42
|
+
}
|
|
43
|
+
//#endregion
|
|
44
|
+
export { c as a, l as i, u as n, d as r, s as t };
|
|
@@ -0,0 +1,334 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { r as e, t } from "./sx-Dx9JUKp5.js";
|
|
3
|
+
import { t as n } from "./use-latest-callback-cj1OOQL6.js";
|
|
4
|
+
import { t as r } from "./use-controlled-state-DpeVQZNR.js";
|
|
5
|
+
import { t as i } from "./renderable-DzcIj1Lo.js";
|
|
6
|
+
import { t as a } from "./overlay-layer-SeUyyEPD.js";
|
|
7
|
+
import { a as o, i as s, n as c, o as l, r as u, s as d, t as f } from "./listbox-style-WX-RASp1.js";
|
|
8
|
+
import { a as p, r as m, t as h } from "./collection-registry-k6JcD3Jr.js";
|
|
9
|
+
import { t as g } from "./overlay-portal-C4JZFq2M.js";
|
|
10
|
+
import { t as _ } from "./use-overlay-floating-DvJifLpF.js";
|
|
11
|
+
import { t as v } from "./text-field-C8TWG-tY.js";
|
|
12
|
+
import { createContext as y, useCallback as b, useContext as x, useId as S, useLayoutEffect as C, useMemo as w, useRef as T, useState as E } from "react";
|
|
13
|
+
import { vars as D } from "@jfrader/tokens/vars";
|
|
14
|
+
import { jsx as O, jsxs as ee } from "@emotion/react/jsx-runtime";
|
|
15
|
+
import { FloatingList as k, useDismiss as te, useInteractions as A, useListNavigation as j, useMergeRefs as M } from "@floating-ui/react";
|
|
16
|
+
//#region src/components/combobox/combobox.tsx
|
|
17
|
+
var N = "bottom-start", P = "✓", F = "No results", I = (e, t) => e.toLocaleLowerCase().includes(t.toLocaleLowerCase()), L = y(null), R = y(!1);
|
|
18
|
+
function z(e) {
|
|
19
|
+
let t = x(L);
|
|
20
|
+
if (!t) throw Error(`Combobox.${e} must be rendered inside <Combobox>.`);
|
|
21
|
+
return t;
|
|
22
|
+
}
|
|
23
|
+
function B(e) {
|
|
24
|
+
let t = z(e);
|
|
25
|
+
if (!x(R)) throw Error(`Combobox.${e} must be rendered inside <Combobox.List>.`);
|
|
26
|
+
return t;
|
|
27
|
+
}
|
|
28
|
+
var ne = e({ "&[hidden]": { display: "none" } }), V = e({
|
|
29
|
+
paddingBlock: D.space[1],
|
|
30
|
+
paddingInline: D.space[2],
|
|
31
|
+
fontSize: D.textSize.sm,
|
|
32
|
+
color: D.color.textMuted
|
|
33
|
+
});
|
|
34
|
+
function H({ value: e, defaultValue: t, onValueChange: i, open: a, defaultOpen: o = !1, onOpenChange: s, name: c, filter: l = I, onInputChange: u, children: d }) {
|
|
35
|
+
let f = S(), [m, h] = E(`${f}-listbox`), [g, v] = E(!1), [y = null, x] = r(e, t ?? null, i), [C = !1, D] = r(a, o, s), [k, M] = E(null), [P, F] = E(""), [R, z] = p(), [B, ne] = E(null), V = T([]), H = T(null), U = n(u), W = b((e, t) => t === "" || l(e, t), [l]), { valuesByIndex: G, skippedIndices: K, matchCount: q } = w(() => {
|
|
36
|
+
let e = [], t = /* @__PURE__ */ new Set(), n = 0;
|
|
37
|
+
return R.forEach((r, i) => {
|
|
38
|
+
if (r.index === -1) return;
|
|
39
|
+
e[r.index] = i;
|
|
40
|
+
let a = W(r.label, P);
|
|
41
|
+
a && (n += 1), (r.disabled || !a) && t.add(r.index);
|
|
42
|
+
}), {
|
|
43
|
+
valuesByIndex: e,
|
|
44
|
+
skippedIndices: t,
|
|
45
|
+
matchCount: n
|
|
46
|
+
};
|
|
47
|
+
}, [
|
|
48
|
+
R,
|
|
49
|
+
P,
|
|
50
|
+
W
|
|
51
|
+
]), { refs: J, floatingStyles: Y, context: X } = _({
|
|
52
|
+
open: C,
|
|
53
|
+
placement: N,
|
|
54
|
+
onOpenChange: (e) => D(e)
|
|
55
|
+
}), Z = te(X, {
|
|
56
|
+
escapeKey: !0,
|
|
57
|
+
outsidePress: !0
|
|
58
|
+
}), re = j(X, {
|
|
59
|
+
listRef: V,
|
|
60
|
+
activeIndex: k,
|
|
61
|
+
onNavigate: M,
|
|
62
|
+
virtual: !0,
|
|
63
|
+
loop: !0,
|
|
64
|
+
disabledIndices: (e) => K.has(e)
|
|
65
|
+
}), { getReferenceProps: Q, getFloatingProps: $, getItemProps: ie } = A([Z, re]), ae = w(() => {
|
|
66
|
+
let e = (e) => {
|
|
67
|
+
x(e), D(!1), H.current?.commitLabel(R.get(e)?.label ?? "");
|
|
68
|
+
};
|
|
69
|
+
return {
|
|
70
|
+
baseId: f,
|
|
71
|
+
listId: m,
|
|
72
|
+
setListId: h,
|
|
73
|
+
setInputDisabled: v,
|
|
74
|
+
open: C,
|
|
75
|
+
selectedValue: y,
|
|
76
|
+
activeIndex: k,
|
|
77
|
+
options: R,
|
|
78
|
+
matchCount: q,
|
|
79
|
+
inputLabelling: B,
|
|
80
|
+
inputHandleRef: H,
|
|
81
|
+
refs: J,
|
|
82
|
+
floatingStyles: Y,
|
|
83
|
+
elementsRef: V,
|
|
84
|
+
getReferenceProps: Q,
|
|
85
|
+
getFloatingProps: $,
|
|
86
|
+
getItemProps: ie,
|
|
87
|
+
onInputChange: U,
|
|
88
|
+
isVisible: (e) => W(e, P),
|
|
89
|
+
findMatches: (e) => {
|
|
90
|
+
let t = 0, n = null, r = null;
|
|
91
|
+
return R.forEach((i) => {
|
|
92
|
+
i.index !== -1 && W(i.label, e) && (t += 1, !i.disabled && ((n === null || i.index < n) && (n = i.index), (r === null || i.index > r) && (r = i.index)));
|
|
93
|
+
}), {
|
|
94
|
+
count: t,
|
|
95
|
+
first: n,
|
|
96
|
+
last: r
|
|
97
|
+
};
|
|
98
|
+
},
|
|
99
|
+
setQuery: F,
|
|
100
|
+
setActiveIndex: M,
|
|
101
|
+
selectValue: e,
|
|
102
|
+
selectIndex: (t) => {
|
|
103
|
+
let n = G[t];
|
|
104
|
+
n === void 0 || K.has(t) || e(n);
|
|
105
|
+
},
|
|
106
|
+
clearValue: () => x(null),
|
|
107
|
+
requestOpenChange: D,
|
|
108
|
+
registration: z,
|
|
109
|
+
setInputLabelling: ne
|
|
110
|
+
};
|
|
111
|
+
}, [
|
|
112
|
+
f,
|
|
113
|
+
m,
|
|
114
|
+
C,
|
|
115
|
+
y,
|
|
116
|
+
k,
|
|
117
|
+
R,
|
|
118
|
+
P,
|
|
119
|
+
q,
|
|
120
|
+
B,
|
|
121
|
+
J,
|
|
122
|
+
Y,
|
|
123
|
+
Q,
|
|
124
|
+
$,
|
|
125
|
+
ie,
|
|
126
|
+
U,
|
|
127
|
+
W,
|
|
128
|
+
G,
|
|
129
|
+
K,
|
|
130
|
+
x,
|
|
131
|
+
D,
|
|
132
|
+
z
|
|
133
|
+
]);
|
|
134
|
+
return /* @__PURE__ */ ee(L.Provider, {
|
|
135
|
+
value: ae,
|
|
136
|
+
children: [d, c !== void 0 && /* @__PURE__ */ O("input", {
|
|
137
|
+
type: "hidden",
|
|
138
|
+
name: c,
|
|
139
|
+
value: y ?? "",
|
|
140
|
+
disabled: g
|
|
141
|
+
})]
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
function U(e) {
|
|
145
|
+
return /* @__PURE__ */ O(a, { children: /* @__PURE__ */ O(H, { ...e }) });
|
|
146
|
+
}
|
|
147
|
+
U.displayName = "Combobox";
|
|
148
|
+
function W({ ref: e, inputValue: t, defaultInputValue: n, label: a, description: o, error: s, size: c, slotProps: l, className: u, sx: d, id: f, onChange: p, onKeyDown: m, onBlur: h, disabled: g = !1, ..._ }) {
|
|
149
|
+
let { listId: y, open: b, selectedValue: x, activeIndex: w, options: T, inputHandleRef: D, refs: ee, getReferenceProps: k, onInputChange: te, findMatches: A, setQuery: j, setActiveIndex: N, selectIndex: P, clearValue: F, requestOpenChange: I, setInputLabelling: L, setInputDisabled: R } = z("Input"), B = M([ee.setReference, e]), ne = S(), V = f ?? ne, H = `${V}-label`, U = i(a), W = _["aria-labelledby"], G = _["aria-label"], [K, q] = E(n), [J, Y] = E(() => (t ?? n) !== void 0), X = x === null ? void 0 : T.get(x)?.label, Z = t ?? (J ? K ?? "" : X ?? K ?? ""), [, re] = r(Z, void 0, te), Q = (e) => {
|
|
150
|
+
re(e), t === void 0 && q(e);
|
|
151
|
+
}, $ = t !== void 0 || J ? Z : "", ie = (e) => {
|
|
152
|
+
Y(!1), Q(e);
|
|
153
|
+
};
|
|
154
|
+
C(() => {
|
|
155
|
+
j($);
|
|
156
|
+
}, [$, j]), C(() => (R(g), () => R(!1)), [g, R]), C(() => (D.current = { commitLabel: ie }, () => {
|
|
157
|
+
D.current = null;
|
|
158
|
+
})), C(() => (L(W !== void 0 || !U ? {
|
|
159
|
+
labelledBy: W,
|
|
160
|
+
label: G
|
|
161
|
+
} : { labelledBy: H }), () => L(null)), [
|
|
162
|
+
W,
|
|
163
|
+
G,
|
|
164
|
+
U,
|
|
165
|
+
H,
|
|
166
|
+
L
|
|
167
|
+
]);
|
|
168
|
+
let ae = (e) => {
|
|
169
|
+
p?.(e);
|
|
170
|
+
let n = e.currentTarget.value;
|
|
171
|
+
Y(!0), Q(n), n === "" && F();
|
|
172
|
+
let r = t ?? n;
|
|
173
|
+
if (r === "") {
|
|
174
|
+
N(null), I(!1);
|
|
175
|
+
return;
|
|
176
|
+
}
|
|
177
|
+
let i = A(r);
|
|
178
|
+
N(i.first), i.count > 0 && I(!0);
|
|
179
|
+
}, oe = (e) => {
|
|
180
|
+
if (m?.(e), !e.defaultPrevented) {
|
|
181
|
+
if (e.key === "Escape") J && X !== void 0 && ie(X);
|
|
182
|
+
else if (b) {
|
|
183
|
+
if (e.key === "Enter" && w !== null) e.preventDefault(), P(w);
|
|
184
|
+
else if (e.key === "Home" || e.key === "End") {
|
|
185
|
+
let t = A($), n = e.key === "Home" ? t.first : t.last;
|
|
186
|
+
if (n === null) return;
|
|
187
|
+
e.preventDefault(), N(n);
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
}, se = (e) => {
|
|
192
|
+
h?.(e), b && I(!1);
|
|
193
|
+
};
|
|
194
|
+
return /* @__PURE__ */ O(v, {
|
|
195
|
+
...k({
|
|
196
|
+
..._,
|
|
197
|
+
onKeyDown: oe,
|
|
198
|
+
onBlur: se
|
|
199
|
+
}),
|
|
200
|
+
ref: B,
|
|
201
|
+
id: V,
|
|
202
|
+
label: U ? /* @__PURE__ */ O("span", {
|
|
203
|
+
id: H,
|
|
204
|
+
children: a
|
|
205
|
+
}) : a,
|
|
206
|
+
description: o,
|
|
207
|
+
error: s,
|
|
208
|
+
size: c,
|
|
209
|
+
slotProps: l,
|
|
210
|
+
className: u,
|
|
211
|
+
sx: d,
|
|
212
|
+
value: Z,
|
|
213
|
+
disabled: g,
|
|
214
|
+
onChange: ae,
|
|
215
|
+
role: "combobox",
|
|
216
|
+
autoComplete: "off",
|
|
217
|
+
"aria-autocomplete": "list",
|
|
218
|
+
"aria-expanded": b,
|
|
219
|
+
"aria-controls": b ? y : void 0,
|
|
220
|
+
"data-state": b ? "open" : "closed",
|
|
221
|
+
"data-ui": "combobox-input"
|
|
222
|
+
});
|
|
223
|
+
}
|
|
224
|
+
W.displayName = "Combobox.Input";
|
|
225
|
+
function G({ ref: e, id: n, style: r, onMouseDown: i, children: a, className: o, sx: s, ...c }) {
|
|
226
|
+
let { baseId: u, setListId: f, open: p, inputLabelling: m, refs: h, floatingStyles: _, elementsRef: v, getFloatingProps: y } = z("List"), b = n ?? `${u}-listbox`;
|
|
227
|
+
C(() => (f(b), () => f(`${u}-listbox`)), [
|
|
228
|
+
u,
|
|
229
|
+
b,
|
|
230
|
+
f
|
|
231
|
+
]);
|
|
232
|
+
let x = M([p ? h.setFloating : null, e]), S = c["aria-labelledby"] !== void 0 || c["aria-label"] !== void 0 ? {} : m?.labelledBy === void 0 ? { "aria-label": m?.label } : { "aria-labelledby": m.labelledBy }, w = (e) => {
|
|
233
|
+
i?.(e), e.preventDefault();
|
|
234
|
+
};
|
|
235
|
+
return /* @__PURE__ */ O(g, { children: /* @__PURE__ */ O(t, {
|
|
236
|
+
className: o,
|
|
237
|
+
styles: [d, l],
|
|
238
|
+
sx: s,
|
|
239
|
+
children: (e) => /* @__PURE__ */ O("div", {
|
|
240
|
+
...y({
|
|
241
|
+
id: b,
|
|
242
|
+
...S,
|
|
243
|
+
...c,
|
|
244
|
+
onMouseDown: w
|
|
245
|
+
}),
|
|
246
|
+
ref: x,
|
|
247
|
+
role: "listbox",
|
|
248
|
+
hidden: !p,
|
|
249
|
+
"data-state": p ? "open" : "closed",
|
|
250
|
+
"data-ui": "combobox-list",
|
|
251
|
+
style: {
|
|
252
|
+
...r,
|
|
253
|
+
..._
|
|
254
|
+
},
|
|
255
|
+
className: e,
|
|
256
|
+
children: /* @__PURE__ */ O(k, {
|
|
257
|
+
elementsRef: v,
|
|
258
|
+
children: /* @__PURE__ */ O(R.Provider, {
|
|
259
|
+
value: !0,
|
|
260
|
+
children: a
|
|
261
|
+
})
|
|
262
|
+
})
|
|
263
|
+
})
|
|
264
|
+
}) });
|
|
265
|
+
}
|
|
266
|
+
G.displayName = "Combobox.List";
|
|
267
|
+
function K({ ref: e, value: n, disabled: r = !1, onClick: i, children: a, className: l, sx: d, ...p }) {
|
|
268
|
+
let { baseId: g, selectedValue: _, activeIndex: v, options: y, isVisible: b, getItemProps: x, selectValue: S, registration: C } = B("Item"), w = T(null), { ref: E, index: D } = m(n, C, w, (e, t) => ({
|
|
269
|
+
index: e,
|
|
270
|
+
label: t,
|
|
271
|
+
disabled: r
|
|
272
|
+
})), k = M([E, e]), te = y.get(n)?.label, A = te !== void 0 && !b(te), j = D !== -1 && v === D, N = _ === n, F = (e) => {
|
|
273
|
+
i?.(e), !(r || e.defaultPrevented) && S(n);
|
|
274
|
+
};
|
|
275
|
+
return /* @__PURE__ */ O(t, {
|
|
276
|
+
className: l,
|
|
277
|
+
styles: [
|
|
278
|
+
c,
|
|
279
|
+
f,
|
|
280
|
+
s,
|
|
281
|
+
ne
|
|
282
|
+
],
|
|
283
|
+
sx: d,
|
|
284
|
+
children: (e) => /* @__PURE__ */ ee("div", {
|
|
285
|
+
...x({
|
|
286
|
+
id: h(g, n),
|
|
287
|
+
...p,
|
|
288
|
+
onClick: F
|
|
289
|
+
}),
|
|
290
|
+
ref: k,
|
|
291
|
+
role: "option",
|
|
292
|
+
hidden: A,
|
|
293
|
+
"aria-selected": N,
|
|
294
|
+
"aria-disabled": r || void 0,
|
|
295
|
+
"data-active": j || void 0,
|
|
296
|
+
"data-ui": "combobox-item",
|
|
297
|
+
className: e,
|
|
298
|
+
children: [/* @__PURE__ */ O("span", {
|
|
299
|
+
ref: w,
|
|
300
|
+
css: o,
|
|
301
|
+
children: a
|
|
302
|
+
}), N && /* @__PURE__ */ O("span", {
|
|
303
|
+
"aria-hidden": "true",
|
|
304
|
+
css: u,
|
|
305
|
+
children: P
|
|
306
|
+
})]
|
|
307
|
+
})
|
|
308
|
+
});
|
|
309
|
+
}
|
|
310
|
+
K.displayName = "Combobox.Item";
|
|
311
|
+
function q({ ref: e, children: n, className: r, sx: a, ...o }) {
|
|
312
|
+
let { matchCount: s } = B("Empty");
|
|
313
|
+
return s > 0 ? null : /* @__PURE__ */ O(t, {
|
|
314
|
+
className: r,
|
|
315
|
+
styles: V,
|
|
316
|
+
sx: a,
|
|
317
|
+
children: (t) => /* @__PURE__ */ O("div", {
|
|
318
|
+
...o,
|
|
319
|
+
ref: e,
|
|
320
|
+
"data-ui": "combobox-empty",
|
|
321
|
+
className: t,
|
|
322
|
+
children: i(n) ? n : F
|
|
323
|
+
})
|
|
324
|
+
});
|
|
325
|
+
}
|
|
326
|
+
q.displayName = "Combobox.Empty";
|
|
327
|
+
var J = Object.assign(U, {
|
|
328
|
+
Input: W,
|
|
329
|
+
List: G,
|
|
330
|
+
Item: K,
|
|
331
|
+
Empty: q
|
|
332
|
+
});
|
|
333
|
+
//#endregion
|
|
334
|
+
export { J as t };
|
package/dist/combobox.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
export { t as Combobox } from "./combobox-
|
|
2
|
+
export { t as Combobox } from "./combobox-Bhzvu9ma.js";
|