@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,210 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { r as e, t } from "./sx-Dx9JUKp5.js";
|
|
3
|
+
import { n, t as r } from "./focus-ring-BK5W5_NY.js";
|
|
4
|
+
import { n as i, r as a } from "./media-8yrN85VT.js";
|
|
5
|
+
import { n as o, r as s, t as c } from "./roving-focus-CYlo_Kf8.js";
|
|
6
|
+
import { t as l } from "./use-controlled-state-DpeVQZNR.js";
|
|
7
|
+
import { t as u } from "./part-id-D0zksy32.js";
|
|
8
|
+
import { createContext as d, useContext as f, useEffect as p, useId as m, useImperativeHandle as h, useMemo as g, useRef as _, useState as v } from "react";
|
|
9
|
+
import { vars as y } from "@jfrader/tokens/vars";
|
|
10
|
+
import { jsx as b } from "@emotion/react/jsx-runtime";
|
|
11
|
+
//#region src/components/tabs/tabs.tsx
|
|
12
|
+
var x = d(null);
|
|
13
|
+
function S(e) {
|
|
14
|
+
let t = f(x);
|
|
15
|
+
if (!t) throw Error(`Tabs.${e} must be rendered inside <Tabs>.`);
|
|
16
|
+
return t;
|
|
17
|
+
}
|
|
18
|
+
var C = {
|
|
19
|
+
itemSelector: "[role=\"tab\"]:not([disabled])",
|
|
20
|
+
ownerSelector: "[role=\"tablist\"]"
|
|
21
|
+
}, w = e({ "&[data-orientation=\"vertical\"]": {
|
|
22
|
+
display: "flex",
|
|
23
|
+
alignItems: "flex-start",
|
|
24
|
+
gap: y.space[4]
|
|
25
|
+
} }), T = {
|
|
26
|
+
horizontal: e({
|
|
27
|
+
display: "inline-flex",
|
|
28
|
+
gap: y.space[1],
|
|
29
|
+
borderBlockEnd: `1px solid ${y.color.border}`
|
|
30
|
+
}),
|
|
31
|
+
vertical: e({
|
|
32
|
+
display: "inline-flex",
|
|
33
|
+
flexDirection: "column",
|
|
34
|
+
alignItems: "stretch",
|
|
35
|
+
borderInlineEnd: `1px solid ${y.color.border}`
|
|
36
|
+
})
|
|
37
|
+
}, E = e({
|
|
38
|
+
appearance: "none",
|
|
39
|
+
border: 0,
|
|
40
|
+
background: "transparent",
|
|
41
|
+
cursor: "pointer",
|
|
42
|
+
paddingBlock: y.space[2],
|
|
43
|
+
paddingInline: y.space[3],
|
|
44
|
+
font: "inherit",
|
|
45
|
+
fontSize: y.textSize.sm,
|
|
46
|
+
fontWeight: y.fontWeight.medium,
|
|
47
|
+
color: y.color.textMuted,
|
|
48
|
+
transitionProperty: "color, border-color",
|
|
49
|
+
transitionDuration: y.motion.duration.fast,
|
|
50
|
+
transitionTimingFunction: y.motion.easeStandard,
|
|
51
|
+
"&:hover:not(:disabled):not([aria-selected=\"true\"])": { color: y.color.text },
|
|
52
|
+
"&[aria-selected=\"true\"]": {
|
|
53
|
+
color: y.color.text,
|
|
54
|
+
borderColor: y.color.accent
|
|
55
|
+
},
|
|
56
|
+
"&:disabled": {
|
|
57
|
+
opacity: .55,
|
|
58
|
+
cursor: "not-allowed"
|
|
59
|
+
},
|
|
60
|
+
"&:focus-visible": { ...r },
|
|
61
|
+
[a]: { transitionDuration: "0s" },
|
|
62
|
+
[i]: {
|
|
63
|
+
borderColor: "Canvas",
|
|
64
|
+
"&[aria-selected=\"true\"]": { borderColor: "Highlight" }
|
|
65
|
+
}
|
|
66
|
+
}), D = {
|
|
67
|
+
horizontal: e({
|
|
68
|
+
borderBlockEnd: "2px solid transparent",
|
|
69
|
+
marginBlockEnd: "-1px"
|
|
70
|
+
}),
|
|
71
|
+
vertical: e({
|
|
72
|
+
borderInlineEnd: "2px solid transparent",
|
|
73
|
+
marginInlineEnd: "-1px",
|
|
74
|
+
textAlign: "start"
|
|
75
|
+
})
|
|
76
|
+
}, O = e({
|
|
77
|
+
color: y.color.text,
|
|
78
|
+
outline: "none",
|
|
79
|
+
"&:focus-visible": { ...n },
|
|
80
|
+
"&[hidden]": { display: "none" }
|
|
81
|
+
}), k = e({ paddingBlockStart: y.space[3] });
|
|
82
|
+
function A({ ref: e, value: n, defaultValue: r, onValueChange: i, orientation: a = "horizontal", activation: o = "auto", className: s, sx: c, ...u }) {
|
|
83
|
+
let d = m(), [f, p] = l(n, r, i), [h, _] = v(null), y = g(() => ({
|
|
84
|
+
value: f,
|
|
85
|
+
setValue: p,
|
|
86
|
+
focused: h,
|
|
87
|
+
setFocused: _,
|
|
88
|
+
orientation: a,
|
|
89
|
+
activation: o,
|
|
90
|
+
baseId: d
|
|
91
|
+
}), [
|
|
92
|
+
f,
|
|
93
|
+
p,
|
|
94
|
+
h,
|
|
95
|
+
a,
|
|
96
|
+
o,
|
|
97
|
+
d
|
|
98
|
+
]);
|
|
99
|
+
return /* @__PURE__ */ b(x.Provider, {
|
|
100
|
+
value: y,
|
|
101
|
+
children: /* @__PURE__ */ b(t, {
|
|
102
|
+
className: s,
|
|
103
|
+
styles: w,
|
|
104
|
+
sx: c,
|
|
105
|
+
children: (t) => /* @__PURE__ */ b("div", {
|
|
106
|
+
...u,
|
|
107
|
+
ref: e,
|
|
108
|
+
"data-ui": "tabs-root",
|
|
109
|
+
"data-orientation": a,
|
|
110
|
+
className: t
|
|
111
|
+
})
|
|
112
|
+
})
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
A.displayName = "Tabs";
|
|
116
|
+
function j({ ref: e, onKeyDown: n, className: r, sx: i, ...a }) {
|
|
117
|
+
let { orientation: l, value: u, focused: d, setFocused: f } = S("List"), m = _(null);
|
|
118
|
+
h(e, () => m.current, []), p(() => {
|
|
119
|
+
let e = m.current;
|
|
120
|
+
if (!e) return;
|
|
121
|
+
let t = s(e, C);
|
|
122
|
+
t.length !== 0 && (t.some((e) => e.tabIndex === 0) || f((c(t, u) ?? c(t, d) ?? t[0])?.dataset.value ?? null));
|
|
123
|
+
});
|
|
124
|
+
let g = (e) => {
|
|
125
|
+
n?.(e);
|
|
126
|
+
let t = m.current;
|
|
127
|
+
!e.defaultPrevented && t && o(e, t, l, C);
|
|
128
|
+
};
|
|
129
|
+
return /* @__PURE__ */ b(t, {
|
|
130
|
+
className: r,
|
|
131
|
+
styles: T[l],
|
|
132
|
+
sx: i,
|
|
133
|
+
children: (e) => /* @__PURE__ */ b("div", {
|
|
134
|
+
...a,
|
|
135
|
+
ref: m,
|
|
136
|
+
role: "tablist",
|
|
137
|
+
"aria-orientation": l,
|
|
138
|
+
"data-ui": "tabs-list",
|
|
139
|
+
"data-orientation": l,
|
|
140
|
+
"data-roving": d ?? "",
|
|
141
|
+
"data-selected": u ?? "",
|
|
142
|
+
onKeyDown: g,
|
|
143
|
+
className: e
|
|
144
|
+
})
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
j.displayName = "Tabs.List";
|
|
148
|
+
function M({ ref: e, value: n, disabled: r, onClick: i, onFocus: a, onPointerDown: o, className: s, sx: c, ...l }) {
|
|
149
|
+
let { value: d, setValue: f, focused: p, setFocused: m, activation: h, baseId: g, orientation: v } = S("Tab"), y = d === n, x = !r && (p === null ? y : p === n), C = _(!1), w = (e) => {
|
|
150
|
+
if (i?.(e), e.defaultPrevented) return;
|
|
151
|
+
let t = C.current;
|
|
152
|
+
C.current = !1, !(h === "auto" && t && e.detail !== 0) && f(n);
|
|
153
|
+
}, T = (e) => {
|
|
154
|
+
a?.(e), !e.defaultPrevented && (C.current = !0, m(n), h === "auto" && f(n));
|
|
155
|
+
};
|
|
156
|
+
return /* @__PURE__ */ b(t, {
|
|
157
|
+
className: s,
|
|
158
|
+
styles: [E, D[v]],
|
|
159
|
+
sx: c,
|
|
160
|
+
children: (t) => /* @__PURE__ */ b("button", {
|
|
161
|
+
...l,
|
|
162
|
+
ref: e,
|
|
163
|
+
type: "button",
|
|
164
|
+
role: "tab",
|
|
165
|
+
id: u(g, "tab", n),
|
|
166
|
+
"data-ui": "tabs-tab",
|
|
167
|
+
"data-value": n,
|
|
168
|
+
"data-state": y ? "active" : "inactive",
|
|
169
|
+
"aria-selected": y,
|
|
170
|
+
"aria-controls": u(g, "panel", n),
|
|
171
|
+
tabIndex: x ? 0 : -1,
|
|
172
|
+
disabled: r,
|
|
173
|
+
onClick: w,
|
|
174
|
+
onFocus: T,
|
|
175
|
+
onPointerDown: (e) => {
|
|
176
|
+
C.current = !1, o?.(e);
|
|
177
|
+
},
|
|
178
|
+
className: t
|
|
179
|
+
})
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
M.displayName = "Tabs.Tab";
|
|
183
|
+
function N({ ref: e, value: n, tabIndex: r = 0, "aria-labelledby": i, className: a, sx: o, ...s }) {
|
|
184
|
+
let { value: c, baseId: l, orientation: d } = S("Panel"), f = c === n, p = [i, u(l, "tab", n)].filter(Boolean).join(" ") || void 0;
|
|
185
|
+
return /* @__PURE__ */ b(t, {
|
|
186
|
+
className: a,
|
|
187
|
+
styles: [O, d === "horizontal" && k],
|
|
188
|
+
sx: o,
|
|
189
|
+
children: (t) => /* @__PURE__ */ b("div", {
|
|
190
|
+
...s,
|
|
191
|
+
ref: e,
|
|
192
|
+
role: "tabpanel",
|
|
193
|
+
id: u(l, "panel", n),
|
|
194
|
+
"aria-labelledby": p,
|
|
195
|
+
tabIndex: r,
|
|
196
|
+
hidden: !f,
|
|
197
|
+
"data-ui": "tabs-panel",
|
|
198
|
+
"data-state": f ? "active" : "inactive",
|
|
199
|
+
className: t
|
|
200
|
+
})
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
N.displayName = "Tabs.Panel";
|
|
204
|
+
var P = Object.assign(A, {
|
|
205
|
+
List: j,
|
|
206
|
+
Tab: M,
|
|
207
|
+
Panel: N
|
|
208
|
+
});
|
|
209
|
+
//#endregion
|
|
210
|
+
export { P as t };
|
package/dist/tabs.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
export { t as Tabs } from "./tabs-
|
|
2
|
+
export { t as Tabs } from "./tabs-XluwRjgg.js";
|
|
@@ -0,0 +1,418 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { r as e } from "./sx-Dx9JUKp5.js";
|
|
3
|
+
import { t } from "./focus-ring-BK5W5_NY.js";
|
|
4
|
+
import { n, r, t as i } from "./media-8yrN85VT.js";
|
|
5
|
+
import { t as a } from "./use-controlled-state-DpeVQZNR.js";
|
|
6
|
+
import { t as ee } from "./visually-hidden-BJdvqqvn.js";
|
|
7
|
+
import { t as te } from "./renderable-DzcIj1Lo.js";
|
|
8
|
+
import { t as ne } from "./icon-wrapper-stN8sD7R.js";
|
|
9
|
+
import { t as re } from "./input-control-DmMuAuPS.js";
|
|
10
|
+
import { a as ie, i as ae, n as oe, r as se, t as ce } from "./field-anatomy-COVdNpf5.js";
|
|
11
|
+
import { useEffect as o, useMemo as s, useRef as c, useState as l } from "react";
|
|
12
|
+
import { vars as u } from "@jfrader/tokens/vars";
|
|
13
|
+
import { jsx as d, jsxs as f } from "@emotion/react/jsx-runtime";
|
|
14
|
+
import { useMergeRefs as le } from "@floating-ui/react";
|
|
15
|
+
//#region src/components/tag-input/tag-input.tsx
|
|
16
|
+
var ue = ["Enter", ","], de = [], fe = "8ch", pe = (e) => e.trim(), me = (e, t, n) => e.filter((r, i) => r === "" || t(r) !== r || e.findIndex((e) => n.compare(e, r) === 0) !== i);
|
|
17
|
+
function he(e) {
|
|
18
|
+
let t = new Intl.NumberFormat(e);
|
|
19
|
+
return {
|
|
20
|
+
listLabel: "Tags",
|
|
21
|
+
remove: (e) => `Remove ${e}`,
|
|
22
|
+
added: (e) => `Added ${e}`,
|
|
23
|
+
removed: (e) => `Removed ${e}`,
|
|
24
|
+
picked: (e) => `${e} selected. Press Backspace to remove it.`,
|
|
25
|
+
duplicate: (e) => `${e} is already added`,
|
|
26
|
+
limit: (e) => `Tag limit reached: ${t.format(e)}`,
|
|
27
|
+
required: "Add at least one tag."
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
var ge = (e, t) => e.length === t.length && e.every((e, n) => e === t[n]), _e = e({
|
|
31
|
+
display: "flex",
|
|
32
|
+
flexWrap: "wrap",
|
|
33
|
+
alignItems: "center",
|
|
34
|
+
gap: u.space[1],
|
|
35
|
+
minInlineSize: 0,
|
|
36
|
+
borderRadius: u.radius.sm,
|
|
37
|
+
cursor: "text",
|
|
38
|
+
"&[data-invalid]:not(:has(> input:focus-visible))": { borderColor: u.color.dangerBorder },
|
|
39
|
+
"&[data-disabled]": {
|
|
40
|
+
opacity: .55,
|
|
41
|
+
cursor: "not-allowed"
|
|
42
|
+
},
|
|
43
|
+
[n]: { borderColor: "CanvasText" }
|
|
44
|
+
}), ve = {
|
|
45
|
+
sm: e({
|
|
46
|
+
minBlockSize: u.space[8],
|
|
47
|
+
paddingBlock: `calc(${u.space[1]} / 2)`,
|
|
48
|
+
paddingInline: u.space[1],
|
|
49
|
+
fontSize: u.textSize.sm
|
|
50
|
+
}),
|
|
51
|
+
md: e({
|
|
52
|
+
minBlockSize: u.space[10],
|
|
53
|
+
paddingBlock: u.space[1],
|
|
54
|
+
paddingInline: u.space[2],
|
|
55
|
+
fontSize: u.textSize.sm
|
|
56
|
+
}),
|
|
57
|
+
lg: e({
|
|
58
|
+
minBlockSize: u.space[12],
|
|
59
|
+
paddingBlock: u.space[2],
|
|
60
|
+
paddingInline: u.space[2],
|
|
61
|
+
fontSize: u.textSize.md
|
|
62
|
+
})
|
|
63
|
+
}, ye = e({
|
|
64
|
+
display: "contents",
|
|
65
|
+
margin: 0,
|
|
66
|
+
padding: 0,
|
|
67
|
+
listStyle: "none"
|
|
68
|
+
}), be = e({
|
|
69
|
+
display: "inline-flex",
|
|
70
|
+
alignItems: "center",
|
|
71
|
+
gap: u.space[1],
|
|
72
|
+
maxInlineSize: "100%",
|
|
73
|
+
minInlineSize: 0,
|
|
74
|
+
minBlockSize: u.space[6],
|
|
75
|
+
paddingInlineStart: u.space[2],
|
|
76
|
+
border: `1px solid ${u.color.border}`,
|
|
77
|
+
borderRadius: u.radius.full,
|
|
78
|
+
backgroundColor: u.color.surfaceHover,
|
|
79
|
+
color: u.color.text,
|
|
80
|
+
fontSize: u.textSize.xs,
|
|
81
|
+
fontWeight: u.fontWeight.medium,
|
|
82
|
+
lineHeight: u.lineHeight.base,
|
|
83
|
+
cursor: "default",
|
|
84
|
+
transitionProperty: "opacity, background-color, border-color",
|
|
85
|
+
transitionDuration: u.motion.duration.fast,
|
|
86
|
+
transitionTimingFunction: u.motion.easeStandard,
|
|
87
|
+
"&[data-enter]": { "@starting-style": { opacity: 0 } },
|
|
88
|
+
"&[data-duplicate]": {
|
|
89
|
+
borderColor: u.color.accentText,
|
|
90
|
+
backgroundColor: u.color.accentSoft
|
|
91
|
+
},
|
|
92
|
+
"&[data-picked]": {
|
|
93
|
+
outline: `2px solid ${u.color.focusRing}`,
|
|
94
|
+
outlineOffset: "1px",
|
|
95
|
+
backgroundColor: u.color.accentSoft
|
|
96
|
+
},
|
|
97
|
+
"&[data-readonly]": { paddingInlineEnd: u.space[2] },
|
|
98
|
+
[r]: {
|
|
99
|
+
transitionDuration: "0s",
|
|
100
|
+
"&[data-enter]": { "@starting-style": { opacity: 1 } }
|
|
101
|
+
},
|
|
102
|
+
[n]: {
|
|
103
|
+
borderColor: "CanvasText",
|
|
104
|
+
"&[data-picked]": { outlineColor: "Highlight" },
|
|
105
|
+
"&[data-duplicate]": { borderStyle: "dashed" }
|
|
106
|
+
}
|
|
107
|
+
}), xe = {
|
|
108
|
+
sm: e({ fontSize: u.textSize.xs }),
|
|
109
|
+
md: e({ fontSize: u.textSize.sm }),
|
|
110
|
+
lg: e({ fontSize: u.textSize.sm })
|
|
111
|
+
}, Se = e({
|
|
112
|
+
minInlineSize: 0,
|
|
113
|
+
overflow: "hidden",
|
|
114
|
+
textOverflow: "ellipsis",
|
|
115
|
+
whiteSpace: "nowrap"
|
|
116
|
+
}), Ce = e({
|
|
117
|
+
display: "inline-grid",
|
|
118
|
+
placeItems: "center",
|
|
119
|
+
flexShrink: 0,
|
|
120
|
+
inlineSize: u.space[6],
|
|
121
|
+
blockSize: u.space[6],
|
|
122
|
+
padding: 0,
|
|
123
|
+
border: 0,
|
|
124
|
+
borderRadius: u.radius.full,
|
|
125
|
+
backgroundColor: "transparent",
|
|
126
|
+
color: u.color.textMuted,
|
|
127
|
+
fontSize: u.textSize.sm,
|
|
128
|
+
cursor: "pointer",
|
|
129
|
+
transitionProperty: "background-color, color",
|
|
130
|
+
transitionDuration: u.motion.duration.fast,
|
|
131
|
+
transitionTimingFunction: u.motion.easeStandard,
|
|
132
|
+
"&:hover:not(:disabled)": {
|
|
133
|
+
backgroundColor: u.color.surfaceInset,
|
|
134
|
+
color: u.color.text
|
|
135
|
+
},
|
|
136
|
+
"&:focus-visible": t,
|
|
137
|
+
"&:disabled": { cursor: "not-allowed" },
|
|
138
|
+
[r]: { transitionDuration: "0s" },
|
|
139
|
+
[n]: { color: "ButtonText" }
|
|
140
|
+
}), we = e({
|
|
141
|
+
flex: "1 1 0%",
|
|
142
|
+
minInlineSize: fe,
|
|
143
|
+
blockSize: u.space[6],
|
|
144
|
+
margin: 0,
|
|
145
|
+
paddingBlock: 0,
|
|
146
|
+
paddingInline: u.space[1],
|
|
147
|
+
border: 0,
|
|
148
|
+
outline: "none",
|
|
149
|
+
backgroundColor: "transparent",
|
|
150
|
+
color: u.color.text,
|
|
151
|
+
fontFamily: u.font.sans,
|
|
152
|
+
fontSize: "inherit",
|
|
153
|
+
lineHeight: u.lineHeight.base,
|
|
154
|
+
"&::placeholder": { color: u.color.textMuted },
|
|
155
|
+
"&:disabled": { cursor: "not-allowed" },
|
|
156
|
+
[i]: { fontSize: u.textSize.md }
|
|
157
|
+
}), Te = e({
|
|
158
|
+
fontSize: u.textSize.sm,
|
|
159
|
+
color: u.color.textMuted
|
|
160
|
+
}), Ee = /* @__PURE__ */ d("svg", {
|
|
161
|
+
viewBox: "0 0 24 24",
|
|
162
|
+
fill: "none",
|
|
163
|
+
stroke: "currentColor",
|
|
164
|
+
strokeWidth: 2,
|
|
165
|
+
strokeLinecap: "round",
|
|
166
|
+
children: /* @__PURE__ */ d("path", { d: "m7 7 10 10M17 7 7 17" })
|
|
167
|
+
}), De = (e) => e.nativeEvent.isComposing || e.nativeEvent.keyCode === 229;
|
|
168
|
+
function p({ ref: e, value: t, defaultValue: n, onValueChange: r, inputValue: i, defaultInputValue: u, onInputChange: fe, label: p, description: m, error: h, size: g = "md", separators: Oe = ue, commitOnBlur: ke = !0, normalize: _ = pe, validateToken: Ae, maxTokens: v, locale: y, messages: je, removeIcon: Me = Ee, slotProps: b, className: Ne, sx: Pe, dir: x, name: S, form: C, disabled: w = !1, readOnly: T = !1, required: E = !1, onChange: Fe, onKeyDown: Ie, onBlur: Le, onCompositionStart: Re, onCompositionEnd: ze, id: Be, "aria-labelledby": D, "aria-describedby": Ve, "aria-invalid": He, ...Ue }) {
|
|
169
|
+
let O = ie({
|
|
170
|
+
id: Be,
|
|
171
|
+
description: m,
|
|
172
|
+
error: h,
|
|
173
|
+
"aria-describedby": Ve,
|
|
174
|
+
"aria-invalid": He
|
|
175
|
+
}), k = `${O.id}-label`, A = `${O.id}-picked`, j = {
|
|
176
|
+
...s(() => he(y), [y]),
|
|
177
|
+
...je
|
|
178
|
+
}, M = s(() => new Intl.Collator(y, {
|
|
179
|
+
usage: "search",
|
|
180
|
+
sensitivity: "accent"
|
|
181
|
+
}), [y]), We = c(n ?? de), N = c(u ?? ""), [Ge, Ke, P] = a(t, We.current, (e) => r?.([...e])), F = Ge ?? de, [qe, I, L] = a(i, N.current, fe), R = qe ?? "", [z, B] = l(null), [V, H] = l(null);
|
|
182
|
+
z !== null && !F.includes(z) && B(null), V !== null && !F.includes(V) && H(null);
|
|
183
|
+
let [U, W] = l({
|
|
184
|
+
text: "",
|
|
185
|
+
rejection: !1
|
|
186
|
+
}), [G, K] = l(null), q = c(null), Je = le([q, e]), Ye = c(!1);
|
|
187
|
+
o(() => {
|
|
188
|
+
Ye.current = !0;
|
|
189
|
+
}, []);
|
|
190
|
+
let J = c(!1), Xe = c(null);
|
|
191
|
+
o(() => {
|
|
192
|
+
if (process.env.NODE_ENV === "production") return;
|
|
193
|
+
let e = me(F, _, M), t = e.length > 0 ? `TagInput: tokens must be unique, nonempty and normalized; invalid entries: ${JSON.stringify(e)}` : null;
|
|
194
|
+
t !== null && t !== Xe.current && console.warn(t), Xe.current = t;
|
|
195
|
+
}, [
|
|
196
|
+
F,
|
|
197
|
+
_,
|
|
198
|
+
M
|
|
199
|
+
]);
|
|
200
|
+
let Ze = (e) => {
|
|
201
|
+
ge(e, F) || Ke(e);
|
|
202
|
+
}, Y = (e, t = !1) => W((n) => ({
|
|
203
|
+
text: n.text === e ? `${e} ` : e,
|
|
204
|
+
rejection: t
|
|
205
|
+
}));
|
|
206
|
+
o(() => {
|
|
207
|
+
if (!G) return;
|
|
208
|
+
let e = F.includes(G.token);
|
|
209
|
+
(G.kind === "added" ? !e : e) || (Y(G.kind === "added" ? j.added(G.token) : j.removed(G.token)), K(null));
|
|
210
|
+
}, [G, F]);
|
|
211
|
+
let Qe = E && F.length === 0;
|
|
212
|
+
o(() => {
|
|
213
|
+
q.current?.setCustomValidity(Qe ? j.required : "");
|
|
214
|
+
}, [Qe, j.required]);
|
|
215
|
+
let $e = c({
|
|
216
|
+
inputValue: i,
|
|
217
|
+
draft: R
|
|
218
|
+
});
|
|
219
|
+
$e.current = {
|
|
220
|
+
inputValue: i,
|
|
221
|
+
draft: R
|
|
222
|
+
}, o(() => {
|
|
223
|
+
let e = q.current, t = e?.form;
|
|
224
|
+
if (!e || !t) return;
|
|
225
|
+
let n = !0, r = (t) => {
|
|
226
|
+
queueMicrotask(() => {
|
|
227
|
+
if (!n || t.defaultPrevented) return;
|
|
228
|
+
let r = $e.current;
|
|
229
|
+
P(), L(), B(null), H(null), K(null), W({
|
|
230
|
+
text: "",
|
|
231
|
+
rejection: !1
|
|
232
|
+
}), e.value = r.inputValue === void 0 ? N.current : r.draft;
|
|
233
|
+
});
|
|
234
|
+
};
|
|
235
|
+
return t.addEventListener("reset", r), () => {
|
|
236
|
+
n = !1, t.removeEventListener("reset", r);
|
|
237
|
+
};
|
|
238
|
+
}, [
|
|
239
|
+
C,
|
|
240
|
+
P,
|
|
241
|
+
L
|
|
242
|
+
]);
|
|
243
|
+
let X = !w && !T, Z = () => {
|
|
244
|
+
H(null), U.rejection && W({
|
|
245
|
+
text: "",
|
|
246
|
+
rejection: !1
|
|
247
|
+
});
|
|
248
|
+
}, et = () => {
|
|
249
|
+
let e = _(R);
|
|
250
|
+
if (e === "") return;
|
|
251
|
+
let t = F.find((t) => M.compare(t, e) === 0);
|
|
252
|
+
if (t !== void 0) {
|
|
253
|
+
H(t), Y(j.duplicate(t), !0);
|
|
254
|
+
return;
|
|
255
|
+
}
|
|
256
|
+
if (v !== void 0 && F.length >= v) {
|
|
257
|
+
Y(j.limit(v), !0);
|
|
258
|
+
return;
|
|
259
|
+
}
|
|
260
|
+
let n = Ae?.(e) ?? null;
|
|
261
|
+
n === null ? (B(null), H(null), Ze([...F, e]), I(""), K({
|
|
262
|
+
kind: "added",
|
|
263
|
+
token: e
|
|
264
|
+
})) : Y(n, !0);
|
|
265
|
+
}, Q = (e) => {
|
|
266
|
+
B(null), Z(), Ze(F.filter((t) => t !== e)), K({
|
|
267
|
+
kind: "removed",
|
|
268
|
+
token: e
|
|
269
|
+
});
|
|
270
|
+
}, $ = (e) => {
|
|
271
|
+
B(e), e !== null && Y(j.picked(e));
|
|
272
|
+
}, tt = (e) => {
|
|
273
|
+
Fe?.(e), X && (B(null), Z(), I(e.currentTarget.value));
|
|
274
|
+
}, nt = (e) => {
|
|
275
|
+
if (Ie?.(e), e.defaultPrevented || J.current || De(e) || !X || e.altKey || e.ctrlKey || e.metaKey) return;
|
|
276
|
+
let { key: t, currentTarget: n } = e, r = n.selectionStart === 0 && n.selectionEnd === 0, i = z === null ? -1 : F.indexOf(z);
|
|
277
|
+
if (Oe.includes(t)) {
|
|
278
|
+
if (R === "") return;
|
|
279
|
+
e.preventDefault(), et();
|
|
280
|
+
} else if (t === "Backspace" || t === "Delete") z === null ? t === "Backspace" && r && F.length > 0 && (e.preventDefault(), e.repeat || $(F[F.length - 1])) : (e.preventDefault(), e.repeat || Q(z));
|
|
281
|
+
else if (!e.shiftKey) {
|
|
282
|
+
if (t === "ArrowLeft" && (z !== null || r && F.length > 0)) {
|
|
283
|
+
e.preventDefault();
|
|
284
|
+
let t = z === null ? F[F.length - 1] : F[Math.max(i - 1, 0)];
|
|
285
|
+
t !== z && $(t);
|
|
286
|
+
} else if (t === "ArrowRight" && z !== null) {
|
|
287
|
+
e.preventDefault();
|
|
288
|
+
let t = F[i + 1];
|
|
289
|
+
t === void 0 ? (B(null), n.setSelectionRange(0, 0)) : $(t);
|
|
290
|
+
} else t === "Escape" && z !== null && (e.preventDefault(), B(null), n.setSelectionRange(0, 0));
|
|
291
|
+
}
|
|
292
|
+
}, rt = (e) => {
|
|
293
|
+
let t = e.relatedTarget;
|
|
294
|
+
t instanceof Node && e.currentTarget.contains(t) || (B(null), ke && X && !J.current && et());
|
|
295
|
+
}, it = (e) => {
|
|
296
|
+
J.current = !0, Re?.(e);
|
|
297
|
+
}, at = (e) => {
|
|
298
|
+
J.current = !1, ze?.(e);
|
|
299
|
+
}, ot = (e) => {
|
|
300
|
+
q.current?.focus(), Q(e);
|
|
301
|
+
}, st = D === void 0 ? void 0 : [te(p) && k, D].filter(Boolean).join(" "), ct = [O.describedBy, z !== null && A].filter(Boolean).join(" ") || void 0;
|
|
302
|
+
return /* @__PURE__ */ f(ae, {
|
|
303
|
+
"data-ui": "tag-input",
|
|
304
|
+
dir: x,
|
|
305
|
+
className: Ne,
|
|
306
|
+
sx: Pe,
|
|
307
|
+
part: b?.root,
|
|
308
|
+
children: [
|
|
309
|
+
/* @__PURE__ */ d(se, {
|
|
310
|
+
id: k,
|
|
311
|
+
htmlFor: O.id,
|
|
312
|
+
required: E,
|
|
313
|
+
part: b?.label,
|
|
314
|
+
children: p
|
|
315
|
+
}),
|
|
316
|
+
/* @__PURE__ */ f("div", {
|
|
317
|
+
"data-invalid": O.ariaInvalid === !0 || O.ariaInvalid === "true" ? "" : void 0,
|
|
318
|
+
"data-disabled": w ? "" : void 0,
|
|
319
|
+
onBlur: rt,
|
|
320
|
+
onMouseDown: (e) => {
|
|
321
|
+
w || e.target === q.current || (e.preventDefault(), e.target.closest("button") || q.current?.focus());
|
|
322
|
+
},
|
|
323
|
+
className: b?.control?.className,
|
|
324
|
+
css: [
|
|
325
|
+
re,
|
|
326
|
+
_e,
|
|
327
|
+
ve[g],
|
|
328
|
+
b?.control?.css
|
|
329
|
+
],
|
|
330
|
+
children: [F.length > 0 && /* @__PURE__ */ d("ul", {
|
|
331
|
+
role: "list",
|
|
332
|
+
"aria-label": j.listLabel,
|
|
333
|
+
className: b?.list?.className,
|
|
334
|
+
css: [ye, b?.list?.css],
|
|
335
|
+
children: F.map((e) => /* @__PURE__ */ f("li", {
|
|
336
|
+
"data-picked": e === z ? "" : void 0,
|
|
337
|
+
"data-duplicate": e === V ? "" : void 0,
|
|
338
|
+
"data-readonly": T ? "" : void 0,
|
|
339
|
+
"data-enter": Ye.current ? "" : void 0,
|
|
340
|
+
className: b?.token?.className,
|
|
341
|
+
css: [
|
|
342
|
+
be,
|
|
343
|
+
xe[g],
|
|
344
|
+
b?.token?.css
|
|
345
|
+
],
|
|
346
|
+
children: [/* @__PURE__ */ d("span", {
|
|
347
|
+
id: e === z ? A : void 0,
|
|
348
|
+
css: Se,
|
|
349
|
+
children: e
|
|
350
|
+
}), !T && /* @__PURE__ */ d("button", {
|
|
351
|
+
type: "button",
|
|
352
|
+
disabled: w,
|
|
353
|
+
"aria-label": j.remove(e),
|
|
354
|
+
onClick: () => ot(e),
|
|
355
|
+
className: b?.remove?.className,
|
|
356
|
+
css: [Ce, b?.remove?.css],
|
|
357
|
+
children: /* @__PURE__ */ d("span", {
|
|
358
|
+
"aria-hidden": !0,
|
|
359
|
+
css: ne,
|
|
360
|
+
children: Me
|
|
361
|
+
})
|
|
362
|
+
})]
|
|
363
|
+
}, e))
|
|
364
|
+
}), /* @__PURE__ */ d("input", {
|
|
365
|
+
autoComplete: "off",
|
|
366
|
+
...Ue,
|
|
367
|
+
ref: Je,
|
|
368
|
+
type: "text",
|
|
369
|
+
id: O.id,
|
|
370
|
+
dir: x,
|
|
371
|
+
form: C,
|
|
372
|
+
value: R,
|
|
373
|
+
disabled: w,
|
|
374
|
+
readOnly: T,
|
|
375
|
+
"aria-required": E || void 0,
|
|
376
|
+
"aria-labelledby": st,
|
|
377
|
+
"aria-describedby": ct,
|
|
378
|
+
"aria-invalid": O.ariaInvalid,
|
|
379
|
+
onChange: tt,
|
|
380
|
+
onKeyDown: nt,
|
|
381
|
+
onCompositionStart: it,
|
|
382
|
+
onCompositionEnd: at,
|
|
383
|
+
onBlur: Le,
|
|
384
|
+
className: b?.input?.className,
|
|
385
|
+
css: [we, b?.input?.css]
|
|
386
|
+
})]
|
|
387
|
+
}),
|
|
388
|
+
/* @__PURE__ */ d(ce, {
|
|
389
|
+
id: O.descriptionId,
|
|
390
|
+
part: b?.description,
|
|
391
|
+
children: m
|
|
392
|
+
}),
|
|
393
|
+
/* @__PURE__ */ d(oe, {
|
|
394
|
+
id: O.errorId,
|
|
395
|
+
part: b?.error,
|
|
396
|
+
children: h
|
|
397
|
+
}),
|
|
398
|
+
/* @__PURE__ */ d("span", {
|
|
399
|
+
role: "status",
|
|
400
|
+
"aria-live": "polite",
|
|
401
|
+
"aria-atomic": "true",
|
|
402
|
+
"data-rejection": U.rejection ? "" : void 0,
|
|
403
|
+
className: b?.status?.className,
|
|
404
|
+
css: [U.rejection ? Te : ee, b?.status?.css],
|
|
405
|
+
children: U.text
|
|
406
|
+
}),
|
|
407
|
+
S !== void 0 && !w && F.map((e) => /* @__PURE__ */ d("input", {
|
|
408
|
+
type: "hidden",
|
|
409
|
+
name: S,
|
|
410
|
+
form: C,
|
|
411
|
+
value: e
|
|
412
|
+
}, e))
|
|
413
|
+
]
|
|
414
|
+
});
|
|
415
|
+
}
|
|
416
|
+
p.displayName = "TagInput";
|
|
417
|
+
//#endregion
|
|
418
|
+
export { p as t };
|