@jfrader/ui 0.5.1 → 0.6.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 +18 -1
- package/dist/{accordion-DLul6vIl.js → accordion-D6myONB9.js} +36 -35
- package/dist/accordion.js +1 -1
- package/dist/activity-rings-Uszvwqdl.js +528 -0
- package/dist/activity-rings.js +2 -0
- package/dist/{alert-DS_einpy.js → alert-Bhj-qSMs.js} +15 -14
- package/dist/alert.js +1 -1
- package/dist/{announcement-bar-Dlbq5-9D.js → announcement-bar-B5J33QUh.js} +132 -131
- package/dist/announcement-bar.js +1 -1
- package/dist/{avatar-CaGJHy1N.js → avatar-B6idYC59.js} +11 -10
- package/dist/{avatar-group-M1opAQEG.js → avatar-group-DvP8mAE-.js} +10 -9
- package/dist/avatar-group.js +1 -1
- package/dist/avatar.js +1 -1
- package/dist/{badge-CjM5Agqk.js → badge-CfhTcA-Z.js} +10 -9
- package/dist/badge.js +1 -1
- package/dist/billing-toggle-CgC7yxxo.js +349 -0
- package/dist/billing-toggle.js +2 -0
- package/dist/{bottom-sheet-DjZOPq4k.js → bottom-sheet-BFQKO0Wo.js} +282 -264
- package/dist/bottom-sheet.js +1 -1
- package/dist/{breadcrumbs-BDK_LiwH.js → breadcrumbs-CG3akw-b.js} +19 -18
- package/dist/breadcrumbs.js +1 -1
- package/dist/{button-NLY0h6EJ.js → button-C6OV0C7J.js} +14 -13
- package/dist/button-group-B9wP2ddS.js +611 -0
- package/dist/button-group.js +2 -0
- package/dist/button.js +1 -1
- package/dist/calendar-Bg6D2sul.js +377 -0
- package/dist/calendar.js +1 -1
- package/dist/calendar.utils-azmB4Ej7.js +79 -0
- package/dist/card-C008OQCp.js +164 -0
- package/dist/card.js +1 -1
- package/dist/{carousel-B7OrvD6J.js → carousel-lTH4Foke.js} +13 -12
- package/dist/carousel.js +1 -1
- package/dist/chat-thread-DVa17BRC.js +864 -0
- package/dist/chat-thread.js +2 -0
- package/dist/{checkbox-DKSzExj2.js → checkbox-CClE61GV.js} +9 -8
- package/dist/checkbox.js +1 -1
- package/dist/{chip-group-DjQ0_6Y9.js → chip-group-BZUX9KPF.js} +17 -16
- package/dist/chip-group.js +1 -1
- package/dist/{choice-control-5kJkLXgv.js → choice-control-BsWOZPc9.js} +1 -1
- package/dist/{code-block-B5we2lZa.js → code-block-CYP89_6h.js} +35 -34
- package/dist/code-block.js +1 -1
- package/dist/{combobox-DFFqOBCi.js → combobox-D2Oc-co7.js} +21 -20
- package/dist/combobox.js +1 -1
- package/dist/command-palette-BrT1n9bb.js +394 -0
- package/dist/command-palette.js +1 -1
- package/dist/comment-thread-BnUHxviq.js +772 -0
- package/dist/comment-thread.js +1 -1
- package/dist/{container-BOaSptJa.js → container-BxtwJSSD.js} +3 -2
- package/dist/container.js +1 -1
- package/dist/{context-menu-__1c2Dk9.js → context-menu-I4i0LRpm.js} +52 -51
- package/dist/context-menu.js +1 -1
- package/dist/{copy-button-DCSLcYS-.js → copy-button-C0p_qrgf.js} +4 -4
- package/dist/copy-button.js +1 -1
- package/dist/{countdown-Dp_TD1VP.js → countdown-EcpV6rXy.js} +18 -17
- package/dist/countdown.js +1 -1
- package/dist/css-BYJhdGh-.js +2 -0
- package/dist/{date-picker-BiPN7yeK.js → date-picker-D-bn-iHs.js} +14 -13
- package/dist/date-picker.js +1 -1
- package/dist/date-range-picker-rXcZsI1Y.js +589 -0
- package/dist/date-range-picker.js +1 -1
- package/dist/dialog-CR1xdkrC.js +222 -0
- package/dist/dialog.js +1 -1
- package/dist/{divider-Cp7aNbhM.js → divider-zOJzkcHh.js} +7 -6
- package/dist/divider.js +1 -1
- package/dist/drawer-CceaEhCr.js +590 -0
- package/dist/drawer.js +1 -1
- package/dist/{empty-state-CDgrjPPf.js → empty-state-DO0ApylK.js} +2 -1
- package/dist/empty-state.js +1 -1
- package/dist/{expandable-card-rUATve0o.js → expandable-card-W97vjix9.js} +52 -51
- package/dist/expandable-card.js +1 -1
- package/dist/{expanding-search-BxOwtdwt.js → expanding-search-Bb2_YfNx.js} +16 -15
- package/dist/expanding-search.js +1 -1
- package/dist/{field-anatomy-COVdNpf5.js → field-anatomy-BDIP42MI.js} +2 -1
- package/dist/{file-dropzone-BuXm3Tea.js → file-dropzone-Bi5ikRIz.js} +14 -13
- package/dist/file-dropzone.js +1 -1
- package/dist/{filter-toolbar-Cy5Hqur-.js → filter-toolbar-QRnC4S_H.js} +33 -32
- package/dist/filter-toolbar.js +1 -1
- package/dist/{flex-Dh-_J5-U.js → flex-CS7eMRcK.js} +2 -2
- package/dist/flex.js +1 -1
- package/dist/{hold-to-confirm-DjB2EVjM.js → hold-to-confirm-CVBA0wNT.js} +18 -17
- package/dist/hold-to-confirm.js +1 -1
- package/dist/{hover-card-CoMJKg1g.js → hover-card-DN1EAlQA.js} +20 -19
- package/dist/hover-card.js +1 -1
- package/dist/{icon-wrapper-stN8sD7R.js → icon-wrapper-C-zMD0uL.js} +1 -1
- package/dist/{image-compare-BxY8Ykzt.js → image-compare-Ln2UUqTU.js} +20 -19
- package/dist/image-compare.js +1 -1
- package/dist/index.js +98 -83
- package/dist/{inline-edit-C0eeml65.js → inline-edit-D-pR2RPC.js} +22 -21
- package/dist/inline-edit.js +1 -1
- package/dist/{input-control-DmMuAuPS.js → input-control-B6HVBgwl.js} +1 -1
- package/dist/{json-viewer-DgWqyU75.js → json-viewer-Dro3WrjS.js} +31 -30
- package/dist/json-viewer.js +1 -1
- package/dist/{kbd-C3ACoMoE.js → kbd-BI_9qzYr.js} +2 -1
- package/dist/kbd.js +1 -1
- package/dist/keycap-keyboard-Cdx-OAS1.js +311 -0
- package/dist/keycap-keyboard.js +2 -0
- package/dist/{layout-style-Cbd1Vilw.js → layout-style-BE0gSqrH.js} +1 -1
- package/dist/lightbox-gallery-D0YaSTut.js +777 -0
- package/dist/lightbox-gallery.js +2 -0
- package/dist/link-unfurl-CReyIjyy.js +695 -0
- package/dist/link-unfurl.js +2 -0
- package/dist/{listbox-style-WX-RASp1.js → listbox-style-DNOxAulu.js} +1 -1
- package/dist/{loading-ring-B8-30Dl1.js → loading-ring-D0lGrK8z.js} +1 -1
- package/dist/locale-switcher-CZF7XNYG.js +295 -0
- package/dist/locale-switcher.js +2 -0
- package/dist/{mention-input-sq61si9L.js → mention-input-BjjAbJCf.js} +6 -6
- package/dist/mention-input.js +1 -1
- package/dist/{menu-DDKgmK2F.js → menu-CVzpsyXn.js} +113 -96
- package/dist/menu.js +1 -1
- package/dist/{metric-card--lVTz5Wn.js → metric-card-BnFssTXj.js} +12 -11
- package/dist/metric-card.js +1 -1
- package/dist/{multi-select-DG1BCFX7.js → multi-select-B3puEVo0.js} +67 -66
- package/dist/multi-select.js +1 -1
- package/dist/{navigation-CC26JDr-.js → navigation-C_JD43gA.js} +41 -40
- package/dist/navigation.js +1 -1
- package/dist/next.js +65 -0
- package/dist/now-playing-DjVm1Phm.js +439 -0
- package/dist/now-playing.js +2 -0
- package/dist/overlay-motion-Cr77ihn2.js +90 -0
- package/dist/{overlay-portal-C4JZFq2M.js → overlay-portal-C9igMHnC.js} +1 -1
- package/dist/{pagination-BfkeWbmP.js → pagination-Dkh4bJQh.js} +10 -9
- package/dist/pagination.js +1 -1
- package/dist/{password-field-03pWRkuY.js → password-field-Da58GP1g.js} +4 -4
- package/dist/password-field.js +1 -1
- package/dist/photo-grid-Dtl17D74.js +830 -0
- package/dist/photo-grid.js +2 -0
- package/dist/{pill-BaS-uIbn.js → pill-Dd7pog19.js} +10 -9
- package/dist/pill.js +1 -1
- package/dist/{popover-CErIw2q3.js → popover-CUMOcMtj.js} +5 -4
- package/dist/popover.js +1 -1
- package/dist/presence-spring-4zwtUDQN.js +12 -0
- package/dist/{progress-DAQkfhPd.js → progress-Bcuz3Ob4.js} +11 -10
- package/dist/progress.js +1 -1
- package/dist/{radio-cards-Cu9cBssN.js → radio-cards-FkAhESb5.js} +35 -34
- package/dist/radio-cards.js +1 -1
- package/dist/{radio-group-TIK0-iPX.js → radio-group-DItMf2YM.js} +18 -17
- package/dist/radio-group.js +1 -1
- package/dist/{resizable-panels-DUpQEpwG.js → resizable-panels-61h9hA3B.js} +13 -12
- package/dist/resizable-panels.js +1 -1
- package/dist/{scroll-area-CcZyiSOQ.js → scroll-area-B8KkCPOM.js} +16 -15
- package/dist/scroll-area.js +1 -1
- package/dist/{search-field-DMvho0KQ.js → search-field-CbsajaZb.js} +93 -92
- package/dist/search-field.js +1 -1
- package/dist/{segmented-control-8ZUGnsZm.js → segmented-control-DCh-4ca-.js} +26 -25
- package/dist/segmented-control.js +1 -1
- package/dist/{select-D5rhJ8gi.js → select-SrcQqZjo.js} +27 -26
- package/dist/select.js +1 -1
- package/dist/sheet-stack-DYX1SGSB.js +820 -0
- package/dist/sheet-stack.js +2 -0
- package/dist/shortcut-recorder-VgTQdjjn.js +688 -0
- package/dist/shortcut-recorder.js +2 -0
- package/dist/{signature-pad-_bTeguN9.js → signature-pad-khL2yhQI.js} +15 -14
- package/dist/signature-pad.js +1 -1
- package/dist/{skeleton-XQQDkCHd.js → skeleton-LJsQsveI.js} +9 -8
- package/dist/skeleton.js +1 -1
- package/dist/slider-DjAnGmlC.js +535 -0
- package/dist/slider.js +1 -1
- package/dist/{sortable-data-table-CYKT_Ng7.js → sortable-data-table-Bpitup_d.js} +29 -28
- package/dist/sortable-data-table.js +1 -1
- package/dist/{spinner-DtxvDPdM.js → spinner-CvzajSg9.js} +11 -10
- package/dist/spinner.js +1 -1
- package/dist/{split-button-BCw4zZom.js → split-button-Bu41f2AY.js} +20 -19
- package/dist/split-button.js +1 -1
- package/dist/{stack-DC3IbtWk.js → stack-Bac4sJeI.js} +2 -2
- package/dist/stack.js +1 -1
- package/dist/{stepper-CruHbXxX.js → stepper-C8Ncavbr.js} +22 -21
- package/dist/stepper.js +1 -1
- package/dist/stretch-refresh-OrnTEj7P.js +349 -0
- package/dist/stretch-refresh.js +2 -0
- package/dist/{surface-DZ4d-2aL.js → surface-C69kwSuk.js} +13 -3
- package/dist/{swipe-actions-CBuJREU1.js → swipe-actions-1H5UOZKE.js} +26 -25
- package/dist/swipe-actions.js +1 -1
- package/dist/{switch-C1WrKrf-.js → switch-79-hkQqg.js} +15 -14
- package/dist/switch.js +1 -1
- package/dist/sx-BJXJ2xJK.js +23 -0
- package/dist/{tabs-XluwRjgg.js → tabs-Bb5-noYE.js} +43 -42
- package/dist/tabs.js +1 -1
- package/dist/{tag-input-DSRCyrX2.js → tag-input-BQaueKEb.js} +5 -5
- package/dist/tag-input.js +1 -1
- package/dist/{text-field-hU72iSVS.js → text-field-D0VP7b4P.js} +3 -3
- package/dist/text-field.js +1 -1
- package/dist/{textarea-3k4Y0QQ3.js → textarea-D1YwEPmn.js} +3 -3
- package/dist/textarea.js +1 -1
- package/dist/theme-provider-BvcY-iJu.js +20 -0
- package/dist/theme-root-BrYVcTzt.js +163 -0
- package/dist/theme-root.js +1 -1
- package/dist/theme-scope-DGWy4H0C.js +62 -0
- package/dist/{theme-switch-C505TtU8.js → theme-switch-CP42mVDb.js} +12 -11
- package/dist/theme-switch.js +1 -1
- package/dist/thread-parts-DfZNz70v.js +683 -0
- package/dist/{time-picker-CPlhW0tr.js → time-picker-Tnd-JBLC.js} +16 -15
- package/dist/time-picker.js +1 -1
- package/dist/{timeline-B0uAAVfT.js → timeline-DaldDMX7.js} +22 -21
- package/dist/timeline.js +1 -1
- package/dist/{toast-B7wo3sX1.js → toast-CSAbl5yK.js} +12 -11
- package/dist/{toast-stack-B40VpS4M.js → toast-stack-BCR4Cu7V.js} +10 -9
- package/dist/toast-stack.js +1 -1
- package/dist/toast.js +1 -1
- package/dist/{toggle-group-B2fpFZwV.js → toggle-group-C7ye1v4s.js} +23 -22
- package/dist/toggle-group.js +1 -1
- package/dist/{tooltip-BvgVTCTN.js → tooltip-IajLwdUb.js} +48 -39
- package/dist/tooltip.js +1 -1
- package/dist/{tree-view-j8qLqkb_.js → tree-view-CoW4oJIZ.js} +15 -14
- package/dist/tree-view.js +1 -1
- package/dist/{trigger-style-B1KVC8O1.js → trigger-style-CtOrdPk4.js} +1 -1
- package/dist/types/components/activity-rings/activity-rings.d.ts +115 -0
- package/dist/types/components/activity-rings/index.d.ts +2 -0
- package/dist/types/components/billing-toggle/billing-toggle.d.ts +57 -0
- package/dist/types/components/billing-toggle/index.d.ts +2 -0
- package/dist/types/components/button-group/button-group.d.ts +72 -0
- package/dist/types/components/button-group/index.d.ts +2 -0
- package/dist/types/components/card/card.d.ts +4 -1
- package/dist/types/components/chat-thread/chat-thread.d.ts +130 -0
- package/dist/types/components/chat-thread/index.d.ts +2 -0
- package/dist/types/components/comment-thread/comment-thread.d.ts +3 -3
- package/dist/types/components/drawer/drawer.d.ts +7 -1
- package/dist/types/components/keycap-keyboard/index.d.ts +2 -0
- package/dist/types/components/keycap-keyboard/keycap-keyboard.d.ts +32 -0
- package/dist/types/components/lightbox-gallery/index.d.ts +2 -0
- package/dist/types/components/lightbox-gallery/lightbox-gallery.d.ts +74 -0
- package/dist/types/components/link-unfurl/index.d.ts +2 -0
- package/dist/types/components/link-unfurl/link-unfurl.d.ts +94 -0
- package/dist/types/components/locale-switcher/index.d.ts +2 -0
- package/dist/types/components/locale-switcher/locale-switcher.d.ts +58 -0
- package/dist/types/components/menu/menu.d.ts +29 -5
- package/dist/types/components/next/emotion-registry.d.ts +16 -0
- package/dist/types/components/next/index.d.ts +2 -0
- package/dist/types/components/next/registry.d.ts +21 -0
- package/dist/types/components/now-playing/index.d.ts +1 -0
- package/dist/types/components/now-playing/now-playing.d.ts +88 -0
- package/dist/types/components/photo-grid/index.d.ts +2 -0
- package/dist/types/components/photo-grid/photo-grid.d.ts +82 -0
- package/dist/types/components/sheet-stack/index.d.ts +2 -0
- package/dist/types/components/sheet-stack/sheet-stack.d.ts +78 -0
- package/dist/types/components/shortcut-recorder/index.d.ts +2 -0
- package/dist/types/components/shortcut-recorder/shortcut-recorder.d.ts +117 -0
- package/dist/types/components/stretch-refresh/index.d.ts +1 -0
- package/dist/types/components/stretch-refresh/stretch-refresh.d.ts +49 -0
- package/dist/types/components/theme-root/index.d.ts +1 -0
- package/dist/types/components/theme-root/theme-root.d.ts +9 -1
- package/dist/types/components/{comment-thread → thread}/thread-parts.d.ts +7 -2
- package/dist/types/components/tooltip/tooltip.d.ts +8 -1
- package/dist/types/components/usage-meter/usage-meter.d.ts +2 -12
- package/dist/types/components/usage-meter/usage-model.d.ts +30 -0
- package/dist/types/components/user-menu/index.d.ts +2 -0
- package/dist/types/components/user-menu/user-menu.d.ts +119 -0
- package/dist/types/index.d.ts +14 -1
- package/dist/types/overlay/exit-motion.d.ts +24 -0
- package/dist/types/overlay/presence-spring.d.ts +12 -0
- package/dist/types/overlay/use-native-dialog.d.ts +10 -1
- package/dist/types/styling/create-theme.d.ts +24 -0
- package/dist/types/styling/css.d.ts +1 -1
- package/dist/types/styling/overlay-motion.d.ts +95 -0
- package/dist/types/styling/surface.d.ts +7 -0
- package/dist/types/styling/theme-scope.d.ts +29 -3
- package/dist/types/styling/theme.d.ts +5 -0
- package/dist/{usage-meter-qyQ3rYVv.js → usage-meter-CYvlB6l3.js} +165 -175
- package/dist/usage-meter.js +1 -1
- package/dist/usage-model-C0fS47w4.js +32 -0
- package/dist/use-native-dialog-FB0p7lkg.js +93 -0
- package/dist/use-scroll-lock-40gXwwAy.js +23 -0
- package/dist/user-menu-DzELTg1x.js +757 -0
- package/dist/user-menu.js +2 -0
- package/dist/{visually-hidden-BJdvqqvn.js → visually-hidden-DgVO3NaB.js} +1 -1
- package/package.json +72 -6
- package/dist/calendar-BzJdv_SZ.js +0 -449
- package/dist/card-Ca4KQKYQ.js +0 -154
- package/dist/command-palette-BmQu2w4H.js +0 -391
- package/dist/comment-thread-ASaXDcGo.js +0 -1410
- package/dist/date-range-picker-DQpUeKqV.js +0 -570
- package/dist/dialog-BX1zYMs-.js +0 -219
- package/dist/drawer-DsASTiP-.js +0 -553
- package/dist/elastic-slider-BG6K019r.js +0 -395
- package/dist/elastic-slider.js +0 -2
- package/dist/slider-DVG6-Awh.js +0 -308
- package/dist/sx-Dx9JUKp5.js +0 -23
- package/dist/theme-root-Bs1U3uPA.js +0 -46
- package/dist/theme-scope-t7nAKc2c.js +0 -27
- package/dist/types/components/elastic-slider/elastic-slider.d.ts +0 -53
- package/dist/types/components/elastic-slider/index.d.ts +0 -1
- package/dist/use-native-dialog-DWpIUVO1.js +0 -84
- package/dist/use-slider-interaction-ChL-208h.js +0 -234
- /package/dist/types/components/{comment-thread → thread}/thread-core.d.ts +0 -0
|
@@ -0,0 +1,683 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { i as e } from "./css-BYJhdGh-.js";
|
|
3
|
+
import { n as t } from "./media-8yrN85VT.js";
|
|
4
|
+
import { n } from "./roving-focus-CYlo_Kf8.js";
|
|
5
|
+
import { t as r } from "./visually-hidden-DgVO3NaB.js";
|
|
6
|
+
import { t as i } from "./button-C6OV0C7J.js";
|
|
7
|
+
import { t as a } from "./avatar-B6idYC59.js";
|
|
8
|
+
import { n as o, o as s, s as c, t as l } from "./listbox-style-DNOxAulu.js";
|
|
9
|
+
import { t as u } from "./overlay-portal-C9igMHnC.js";
|
|
10
|
+
import { t as d } from "./part-id-D0zksy32.js";
|
|
11
|
+
import { t as f } from "./textarea-D1YwEPmn.js";
|
|
12
|
+
import { useId as p, useLayoutEffect as m, useRef as h, useState as g } from "react";
|
|
13
|
+
import { vars as _ } from "@jfrader/tokens/vars";
|
|
14
|
+
import { Fragment as ee, jsx as v, jsxs as y } from "@emotion/react/jsx-runtime";
|
|
15
|
+
import { autoUpdate as te, flip as ne, offset as re, shift as ie, useDismiss as ae, useFloating as oe, useInteractions as se, useMergeRefs as ce } from "@floating-ui/react";
|
|
16
|
+
var b = [], x = 864e13, S = 1e3, C = 60 * S, w = 60 * C, T = 24 * w, E = 365.2425 * T, D = [
|
|
17
|
+
["year", E],
|
|
18
|
+
["month", E / 12],
|
|
19
|
+
["week", 7 * T],
|
|
20
|
+
["day", T],
|
|
21
|
+
["hour", w],
|
|
22
|
+
["minute", C]
|
|
23
|
+
], O = /^(\d{4})-(\d{2})-(\d{2})T\d{2}:\d{2}(?::\d{2}(?:\.\d+)?)?(?:Z|[+-]\d{2}:\d{2})$/, k = "en-US", A = (e) => Number.isFinite(e) && Math.abs(e) <= x;
|
|
24
|
+
function j(e) {
|
|
25
|
+
if (typeof e == "number") return A(e) ? e : null;
|
|
26
|
+
if (e instanceof Date) return A(e.getTime()) ? e.getTime() : null;
|
|
27
|
+
if (typeof e != "string") return null;
|
|
28
|
+
let t = O.exec(e);
|
|
29
|
+
if (!t) return null;
|
|
30
|
+
let [n, r, i] = t.slice(1, 4).map(Number), a = new Date(Date.UTC(n, r - 1, i));
|
|
31
|
+
if (a.getUTCMonth() !== r - 1 || a.getUTCDate() !== i) return null;
|
|
32
|
+
let o = Date.parse(e);
|
|
33
|
+
return A(o) ? o : null;
|
|
34
|
+
}
|
|
35
|
+
function M(e, t, n) {
|
|
36
|
+
let r = e - t;
|
|
37
|
+
for (let [e, t] of D) if (Math.abs(r) >= t) return n.format(Math.trunc(r / t), e);
|
|
38
|
+
return n.format(Math.trunc(r / S), "second");
|
|
39
|
+
}
|
|
40
|
+
function N(e, t) {
|
|
41
|
+
return {
|
|
42
|
+
relative: new Intl.RelativeTimeFormat(e, { numeric: "auto" }),
|
|
43
|
+
full: new Intl.DateTimeFormat(e, {
|
|
44
|
+
timeZone: t,
|
|
45
|
+
dateStyle: "full",
|
|
46
|
+
timeStyle: "short"
|
|
47
|
+
}),
|
|
48
|
+
number: new Intl.NumberFormat(e),
|
|
49
|
+
plural: new Intl.PluralRules(e),
|
|
50
|
+
people: new Intl.ListFormat(e, { type: "conjunction" }),
|
|
51
|
+
facts: new Intl.ListFormat(e, {
|
|
52
|
+
type: "unit",
|
|
53
|
+
style: "short"
|
|
54
|
+
})
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
function P(e, t, n) {
|
|
58
|
+
let r = [], i = t;
|
|
59
|
+
try {
|
|
60
|
+
Intl.getCanonicalLocales(t);
|
|
61
|
+
} catch {
|
|
62
|
+
r.push(`${e}: locale ${JSON.stringify(String(t))} is not a valid language tag; using the default locale.`), i = void 0;
|
|
63
|
+
}
|
|
64
|
+
let a = n;
|
|
65
|
+
try {
|
|
66
|
+
new Intl.DateTimeFormat(k, { timeZone: n });
|
|
67
|
+
} catch {
|
|
68
|
+
r.push(`${e}: timeZone ${JSON.stringify(n)} is not a valid IANA time zone; using UTC.`), a = "UTC";
|
|
69
|
+
}
|
|
70
|
+
return {
|
|
71
|
+
formatters: N(i, a),
|
|
72
|
+
problems: r
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
var le = (e, t, n, r) => `${e.number.format(t)} ${e.plural.select(t) === "one" ? n : r}`;
|
|
76
|
+
function F(e) {
|
|
77
|
+
let t = /* @__PURE__ */ new Map(), n = [], r = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Set(), a = !1, o = (e, s, c) => {
|
|
78
|
+
for (let l of e) i.has(l) ? a = !0 : (t.has(l.id) ? r.add(l.id) : (t.set(l.id, {
|
|
79
|
+
comment: l,
|
|
80
|
+
parentId: s,
|
|
81
|
+
depth: c
|
|
82
|
+
}), n.push(l.id)), i.add(l), o(l.replies ?? b, l.id, c + 1), i.delete(l));
|
|
83
|
+
};
|
|
84
|
+
return o(e, null, 0), {
|
|
85
|
+
entries: t,
|
|
86
|
+
order: n,
|
|
87
|
+
duplicates: [...r],
|
|
88
|
+
cyclic: a
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
function I(e, t, n, r = /* @__PURE__ */ new Set()) {
|
|
92
|
+
for (let [i, a] of e.entries()) {
|
|
93
|
+
if (r.has(a)) continue;
|
|
94
|
+
if (a.id === t) {
|
|
95
|
+
let t = n(a);
|
|
96
|
+
if (t === a) return e;
|
|
97
|
+
let r = [...e];
|
|
98
|
+
return t === null ? r.splice(i, 1) : r[i] = t, r;
|
|
99
|
+
}
|
|
100
|
+
let o = a.replies;
|
|
101
|
+
if (!o?.length) continue;
|
|
102
|
+
let s = I(o, t, n, new Set(r).add(a));
|
|
103
|
+
if (s !== o) return e.with(i, {
|
|
104
|
+
...a,
|
|
105
|
+
replies: s
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
return e;
|
|
109
|
+
}
|
|
110
|
+
function L(e, t, n) {
|
|
111
|
+
if (t === null) return null;
|
|
112
|
+
let r = e.entries.get(t);
|
|
113
|
+
if (r) {
|
|
114
|
+
if (n <= 0) return null;
|
|
115
|
+
for (; r.depth + 1 > n && r.parentId !== null;) r = e.entries.get(r.parentId);
|
|
116
|
+
return r.comment.id;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
function R(e, t, n) {
|
|
120
|
+
return t === null ? [...e, n] : I(e, t, (e) => ({
|
|
121
|
+
...e,
|
|
122
|
+
replies: [...e.replies ?? b, n]
|
|
123
|
+
}));
|
|
124
|
+
}
|
|
125
|
+
function z(e, t, n) {
|
|
126
|
+
return I(e, t, (e) => e.deleted || e.body === n ? e : {
|
|
127
|
+
...e,
|
|
128
|
+
body: n,
|
|
129
|
+
edited: !0
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
function B(e, t) {
|
|
133
|
+
return I(e, t, (e) => e.deleted ? e : e.replies?.length ? {
|
|
134
|
+
...e,
|
|
135
|
+
deleted: !0,
|
|
136
|
+
body: "",
|
|
137
|
+
reactions: []
|
|
138
|
+
} : null);
|
|
139
|
+
}
|
|
140
|
+
function V(e, t, n) {
|
|
141
|
+
let r = e.find((e) => e.emoji === t);
|
|
142
|
+
if (!r) return {
|
|
143
|
+
reactions: [...e, {
|
|
144
|
+
emoji: t,
|
|
145
|
+
users: [n]
|
|
146
|
+
}],
|
|
147
|
+
added: !0
|
|
148
|
+
};
|
|
149
|
+
let i = !r.users.includes(n), a = i ? [...r.users, n] : r.users.filter((e) => e !== n);
|
|
150
|
+
return {
|
|
151
|
+
reactions: a.length === 0 ? e.filter((e) => e !== r) : e.map((e) => e === r ? {
|
|
152
|
+
emoji: t,
|
|
153
|
+
users: a
|
|
154
|
+
} : e),
|
|
155
|
+
added: i
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
function H(e, t, n, r) {
|
|
159
|
+
let i = !1;
|
|
160
|
+
return {
|
|
161
|
+
comments: I(e, t, (e) => {
|
|
162
|
+
if (e.deleted) return e;
|
|
163
|
+
let t = V(e.reactions ?? [], n, r);
|
|
164
|
+
return i = t.added, {
|
|
165
|
+
...e,
|
|
166
|
+
reactions: t.reactions
|
|
167
|
+
};
|
|
168
|
+
}),
|
|
169
|
+
added: i
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
function ue(e, t) {
|
|
173
|
+
let n = /* @__PURE__ */ new Set();
|
|
174
|
+
return e.filter((e) => {
|
|
175
|
+
let r = t(e);
|
|
176
|
+
return !n.has(r) && (n.add(r), !0);
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
//#endregion
|
|
180
|
+
//#region src/components/thread/thread-parts.tsx
|
|
181
|
+
var de = "@", U = 8, fe = 4, W = 8, G = /\s/u, K = (e, t) => `${e}-${t}`, pe = (e) => e.nativeEvent.isComposing || e.nativeEvent.keyCode === 229, me = {
|
|
182
|
+
sm: "sm",
|
|
183
|
+
md: "md"
|
|
184
|
+
}, q = e({
|
|
185
|
+
fontSize: _.textSize.xs,
|
|
186
|
+
color: _.color.textMuted,
|
|
187
|
+
fontVariantNumeric: "tabular-nums",
|
|
188
|
+
whiteSpace: "nowrap"
|
|
189
|
+
});
|
|
190
|
+
function J({ epoch: e, now: t, formatters: n, invalidLabel: i, id: a, fullId: o, ui: s, part: c }) {
|
|
191
|
+
return e === null ? /* @__PURE__ */ v("span", {
|
|
192
|
+
id: a,
|
|
193
|
+
"data-ui": K(s, "time"),
|
|
194
|
+
className: c?.className,
|
|
195
|
+
css: [q, c?.css],
|
|
196
|
+
children: i
|
|
197
|
+
}) : /* @__PURE__ */ y(ee, { children: [/* @__PURE__ */ v("time", {
|
|
198
|
+
id: a,
|
|
199
|
+
dateTime: new Date(e).toISOString(),
|
|
200
|
+
"data-ui": K(s, "time"),
|
|
201
|
+
className: c?.className,
|
|
202
|
+
css: [q, c?.css],
|
|
203
|
+
children: t === null ? n.full.format(e) : M(e, t, n.relative)
|
|
204
|
+
}), /* @__PURE__ */ v("span", {
|
|
205
|
+
id: o,
|
|
206
|
+
css: r,
|
|
207
|
+
children: n.full.format(e)
|
|
208
|
+
})] });
|
|
209
|
+
}
|
|
210
|
+
var Y = e({
|
|
211
|
+
display: "grid",
|
|
212
|
+
gridTemplateColumns: "auto minmax(0, 1fr)",
|
|
213
|
+
columnGap: "var(--thread-column-gap)",
|
|
214
|
+
alignItems: "start"
|
|
215
|
+
}), he = e({ display: "inline-flex" }), X = e({
|
|
216
|
+
display: "grid",
|
|
217
|
+
rowGap: _.space[1],
|
|
218
|
+
minInlineSize: 0
|
|
219
|
+
}), Z = e({
|
|
220
|
+
display: "flex",
|
|
221
|
+
flexWrap: "wrap",
|
|
222
|
+
alignItems: "baseline",
|
|
223
|
+
columnGap: _.space[2],
|
|
224
|
+
rowGap: _.space[1],
|
|
225
|
+
minInlineSize: 0
|
|
226
|
+
}), ge = e({
|
|
227
|
+
fontWeight: _.fontWeight.semibold,
|
|
228
|
+
color: _.color.text,
|
|
229
|
+
overflowWrap: "anywhere"
|
|
230
|
+
}), _e = e({
|
|
231
|
+
fontSize: _.textSize.xs,
|
|
232
|
+
color: _.color.textMuted
|
|
233
|
+
});
|
|
234
|
+
function ve({ ui: e, author: t, label: n, epoch: r, now: i, formatters: o, invalidTimeLabel: s, meta: c, size: l, baseId: u, messageId: f, children: p, slots: m }) {
|
|
235
|
+
let h = d(u, "author", f), g = d(u, "time", f), _ = d(u, "when", f);
|
|
236
|
+
return /* @__PURE__ */ y("article", {
|
|
237
|
+
"aria-label": n,
|
|
238
|
+
"aria-labelledby": n === void 0 ? `${h} ${g}` : void 0,
|
|
239
|
+
"aria-describedby": r === null ? void 0 : _,
|
|
240
|
+
"data-ui": K(e, "article"),
|
|
241
|
+
className: m?.article?.className,
|
|
242
|
+
css: [Y, m?.article?.css],
|
|
243
|
+
children: [/* @__PURE__ */ v("span", {
|
|
244
|
+
"aria-hidden": "true",
|
|
245
|
+
css: he,
|
|
246
|
+
children: /* @__PURE__ */ v(a, {
|
|
247
|
+
name: t.name,
|
|
248
|
+
src: t.avatar,
|
|
249
|
+
size: me[l]
|
|
250
|
+
})
|
|
251
|
+
}), /* @__PURE__ */ y("div", {
|
|
252
|
+
css: X,
|
|
253
|
+
children: [/* @__PURE__ */ y("div", {
|
|
254
|
+
css: Z,
|
|
255
|
+
children: [
|
|
256
|
+
/* @__PURE__ */ v("span", {
|
|
257
|
+
id: h,
|
|
258
|
+
"data-ui": K(e, "author"),
|
|
259
|
+
css: ge,
|
|
260
|
+
children: t.name
|
|
261
|
+
}),
|
|
262
|
+
/* @__PURE__ */ v(J, {
|
|
263
|
+
epoch: r,
|
|
264
|
+
now: i,
|
|
265
|
+
formatters: o,
|
|
266
|
+
invalidLabel: s,
|
|
267
|
+
id: g,
|
|
268
|
+
fullId: _,
|
|
269
|
+
ui: e,
|
|
270
|
+
part: m?.time
|
|
271
|
+
}),
|
|
272
|
+
c ? /* @__PURE__ */ v("span", {
|
|
273
|
+
css: _e,
|
|
274
|
+
children: c
|
|
275
|
+
}) : null
|
|
276
|
+
]
|
|
277
|
+
}), p]
|
|
278
|
+
})]
|
|
279
|
+
});
|
|
280
|
+
}
|
|
281
|
+
var ye = e({
|
|
282
|
+
display: "flex",
|
|
283
|
+
flexWrap: "wrap",
|
|
284
|
+
alignItems: "center",
|
|
285
|
+
gap: _.space[1]
|
|
286
|
+
}), be = e({
|
|
287
|
+
gap: _.space[1],
|
|
288
|
+
paddingInline: _.space[2],
|
|
289
|
+
fontVariantNumeric: "tabular-nums",
|
|
290
|
+
"&[aria-pressed=\"true\"]": {
|
|
291
|
+
borderWidth: "2px",
|
|
292
|
+
borderColor: _.color.accentBorder,
|
|
293
|
+
backgroundColor: _.color.accentSoft,
|
|
294
|
+
color: _.color.accentText,
|
|
295
|
+
fontWeight: _.fontWeight.semibold
|
|
296
|
+
},
|
|
297
|
+
[t]: { "&[aria-pressed=\"true\"]": { borderColor: "Highlight" } }
|
|
298
|
+
}), xe = e({
|
|
299
|
+
display: "inline-flex",
|
|
300
|
+
alignItems: "center",
|
|
301
|
+
gap: _.space[1],
|
|
302
|
+
minBlockSize: _.space[6],
|
|
303
|
+
paddingInline: _.space[2],
|
|
304
|
+
border: `1px solid ${_.color.border}`,
|
|
305
|
+
borderRadius: _.radius.full,
|
|
306
|
+
fontSize: _.textSize.sm,
|
|
307
|
+
fontVariantNumeric: "tabular-nums"
|
|
308
|
+
}), Q = e({
|
|
309
|
+
minInlineSize: _.space[8],
|
|
310
|
+
paddingInline: _.space[2]
|
|
311
|
+
}), Se = e({
|
|
312
|
+
display: "flex",
|
|
313
|
+
flexWrap: "wrap",
|
|
314
|
+
alignItems: "center",
|
|
315
|
+
gap: _.space[1],
|
|
316
|
+
padding: _.space[1],
|
|
317
|
+
border: `1px solid ${_.color.border}`,
|
|
318
|
+
borderRadius: _.radius.md,
|
|
319
|
+
backgroundColor: _.color.surface,
|
|
320
|
+
[t]: { borderColor: "CanvasText" }
|
|
321
|
+
}), Ce = e({
|
|
322
|
+
display: "block",
|
|
323
|
+
inlineSize: "1em",
|
|
324
|
+
blockSize: "1em"
|
|
325
|
+
}), we = /* @__PURE__ */ y("svg", {
|
|
326
|
+
viewBox: "0 0 16 16",
|
|
327
|
+
fill: "none",
|
|
328
|
+
stroke: "currentColor",
|
|
329
|
+
strokeWidth: "1.5",
|
|
330
|
+
css: Ce,
|
|
331
|
+
"aria-hidden": "true",
|
|
332
|
+
children: [/* @__PURE__ */ v("circle", {
|
|
333
|
+
cx: "8",
|
|
334
|
+
cy: "8",
|
|
335
|
+
r: "6.25"
|
|
336
|
+
}), /* @__PURE__ */ v("path", {
|
|
337
|
+
d: "M5.5 9.5c.6.9 1.4 1.3 2.5 1.3s1.9-.4 2.5-1.3M6 6.25h.01M10 6.25h.01",
|
|
338
|
+
strokeLinecap: "round"
|
|
339
|
+
})]
|
|
340
|
+
}), Te = /* @__PURE__ */ v("svg", {
|
|
341
|
+
viewBox: "0 0 16 16",
|
|
342
|
+
fill: "none",
|
|
343
|
+
stroke: "currentColor",
|
|
344
|
+
strokeWidth: "1.5",
|
|
345
|
+
css: Ce,
|
|
346
|
+
"aria-hidden": "true",
|
|
347
|
+
children: /* @__PURE__ */ v("path", {
|
|
348
|
+
d: "M4 4l8 8M12 4l-8 8",
|
|
349
|
+
strokeLinecap: "round"
|
|
350
|
+
})
|
|
351
|
+
});
|
|
352
|
+
function Ee({ ui: e, reactions: t, offered: a, currentUserId: o, formatters: s, labels: c, readOnly: l, disabled: u, pickerOpen: d, onPickerOpenChange: f, onToggle: p, pickerId: _, part: b, overlay: x = !1, counts: S }) {
|
|
353
|
+
let C = h(null), w = h(!1), [T, E] = g(0), D = {
|
|
354
|
+
itemSelector: "[data-part=\"emoji\"]",
|
|
355
|
+
ownerSelector: `[data-ui="${K(e, "picker")}"]`
|
|
356
|
+
}, O = !l && a.length > 0, k = O && d, { refs: A, context: j, floatingStyles: M } = oe({
|
|
357
|
+
open: x && k,
|
|
358
|
+
onOpenChange: f,
|
|
359
|
+
placement: "bottom-start",
|
|
360
|
+
middleware: [
|
|
361
|
+
re(fe),
|
|
362
|
+
ne(),
|
|
363
|
+
ie({ padding: W })
|
|
364
|
+
],
|
|
365
|
+
whileElementsMounted: te
|
|
366
|
+
}), N = ae(j, {
|
|
367
|
+
enabled: x,
|
|
368
|
+
escapeKey: !1
|
|
369
|
+
}), { getFloatingProps: P } = se([N]), le = ce([C, A.setReference]);
|
|
370
|
+
m(() => {
|
|
371
|
+
!d && w.current && (w.current = !1, C.current?.focus());
|
|
372
|
+
}, [d]);
|
|
373
|
+
let F = () => {
|
|
374
|
+
w.current = !0, f(!1);
|
|
375
|
+
};
|
|
376
|
+
if (t.length === 0 && !O) return null;
|
|
377
|
+
let I = (e) => {
|
|
378
|
+
e.key === "Escape" ? (e.preventDefault(), e.stopPropagation(), F()) : n(e, e.currentTarget, "horizontal", D);
|
|
379
|
+
};
|
|
380
|
+
return /* @__PURE__ */ y("div", {
|
|
381
|
+
"data-ui": K(e, "reactions"),
|
|
382
|
+
className: b?.className,
|
|
383
|
+
css: [ye, b?.css],
|
|
384
|
+
children: [
|
|
385
|
+
t.map(({ emoji: e, users: t }) => {
|
|
386
|
+
let n = t.includes(o), a = S?.get(e) ?? t.length, d = c.reactionCount(e, a, n), f = /* @__PURE__ */ y(ee, { children: [/* @__PURE__ */ v("span", {
|
|
387
|
+
"aria-hidden": "true",
|
|
388
|
+
children: e
|
|
389
|
+
}), /* @__PURE__ */ v("span", {
|
|
390
|
+
"aria-hidden": "true",
|
|
391
|
+
children: s.number.format(a)
|
|
392
|
+
})] });
|
|
393
|
+
return l ? /* @__PURE__ */ y("span", {
|
|
394
|
+
"data-part": "reaction",
|
|
395
|
+
css: xe,
|
|
396
|
+
children: [f, /* @__PURE__ */ v("span", {
|
|
397
|
+
css: r,
|
|
398
|
+
children: d
|
|
399
|
+
})]
|
|
400
|
+
}, e) : /* @__PURE__ */ v(i, {
|
|
401
|
+
variant: "outline",
|
|
402
|
+
size: "sm",
|
|
403
|
+
"data-part": "reaction",
|
|
404
|
+
"aria-label": d,
|
|
405
|
+
"aria-pressed": n,
|
|
406
|
+
disabled: u,
|
|
407
|
+
onClick: () => p(e),
|
|
408
|
+
css: be,
|
|
409
|
+
children: f
|
|
410
|
+
}, e);
|
|
411
|
+
}),
|
|
412
|
+
O ? /* @__PURE__ */ v(i, {
|
|
413
|
+
ref: le,
|
|
414
|
+
variant: "ghost",
|
|
415
|
+
size: "sm",
|
|
416
|
+
"aria-label": c.addReaction,
|
|
417
|
+
"aria-expanded": k,
|
|
418
|
+
"aria-controls": k ? _ : void 0,
|
|
419
|
+
disabled: u,
|
|
420
|
+
"data-action": "react",
|
|
421
|
+
onClick: () => f(!d),
|
|
422
|
+
css: Q,
|
|
423
|
+
children: we
|
|
424
|
+
}) : null,
|
|
425
|
+
k ? /* @__PURE__ */ v(De, {
|
|
426
|
+
overlay: x,
|
|
427
|
+
children: /* @__PURE__ */ y("div", {
|
|
428
|
+
...x ? P() : {},
|
|
429
|
+
ref: x ? A.setFloating : void 0,
|
|
430
|
+
style: x ? M : void 0,
|
|
431
|
+
dir: x && C.current ? C.current.ownerDocument.defaultView?.getComputedStyle(C.current).direction : void 0,
|
|
432
|
+
id: _,
|
|
433
|
+
role: "group",
|
|
434
|
+
"aria-label": c.reactions,
|
|
435
|
+
"data-ui": K(e, "picker"),
|
|
436
|
+
onKeyDown: I,
|
|
437
|
+
onBlur: (e) => {
|
|
438
|
+
x && !e.currentTarget.contains(e.relatedTarget) && e.relatedTarget !== C.current && f(!1);
|
|
439
|
+
},
|
|
440
|
+
css: Se,
|
|
441
|
+
children: [a.map((e, t) => /* @__PURE__ */ v(i, {
|
|
442
|
+
variant: "ghost",
|
|
443
|
+
size: "sm",
|
|
444
|
+
"data-part": "emoji",
|
|
445
|
+
"aria-label": c.reactWith(e),
|
|
446
|
+
tabIndex: t === Math.min(T, a.length - 1) ? 0 : -1,
|
|
447
|
+
autoFocus: t === 0,
|
|
448
|
+
disabled: u,
|
|
449
|
+
onFocus: () => E(t),
|
|
450
|
+
onClick: () => {
|
|
451
|
+
p(e), F();
|
|
452
|
+
},
|
|
453
|
+
css: Q,
|
|
454
|
+
children: /* @__PURE__ */ v("span", {
|
|
455
|
+
"aria-hidden": "true",
|
|
456
|
+
children: e
|
|
457
|
+
})
|
|
458
|
+
}, e)), /* @__PURE__ */ v(i, {
|
|
459
|
+
variant: "ghost",
|
|
460
|
+
size: "sm",
|
|
461
|
+
"aria-label": c.closeReactions,
|
|
462
|
+
onClick: F,
|
|
463
|
+
css: Q,
|
|
464
|
+
children: Te
|
|
465
|
+
})]
|
|
466
|
+
})
|
|
467
|
+
}) : null
|
|
468
|
+
]
|
|
469
|
+
});
|
|
470
|
+
}
|
|
471
|
+
function De({ overlay: e, children: t }) {
|
|
472
|
+
return e ? /* @__PURE__ */ v(u, { children: t }) : t;
|
|
473
|
+
}
|
|
474
|
+
function Oe(e, t) {
|
|
475
|
+
let n = e.slice(0, t), r = n.lastIndexOf(de);
|
|
476
|
+
if (r === -1 || r > 0 && !G.test(n[r - 1])) return null;
|
|
477
|
+
let i = n.slice(r + 1);
|
|
478
|
+
return G.test(i) ? null : {
|
|
479
|
+
start: r,
|
|
480
|
+
query: i
|
|
481
|
+
};
|
|
482
|
+
}
|
|
483
|
+
function ke(e, t, n) {
|
|
484
|
+
let r = t.toLocaleLowerCase(n);
|
|
485
|
+
return e.filter((e) => e.name.toLocaleLowerCase(n).split(G).some((e) => e.startsWith(r))).slice(0, U);
|
|
486
|
+
}
|
|
487
|
+
var Ae = {
|
|
488
|
+
ArrowDown: (e, t) => (e + 1) % t,
|
|
489
|
+
ArrowUp: (e, t) => (e - 1 + t) % t,
|
|
490
|
+
Home: () => 0,
|
|
491
|
+
End: (e, t) => t - 1
|
|
492
|
+
}, je = e({
|
|
493
|
+
display: "grid",
|
|
494
|
+
gridTemplateColumns: "auto minmax(0, 1fr)",
|
|
495
|
+
columnGap: "var(--thread-column-gap)",
|
|
496
|
+
alignItems: "start",
|
|
497
|
+
inlineSize: "100%",
|
|
498
|
+
"&[data-avatar=\"false\"]": { gridTemplateColumns: "minmax(0, 1fr)" }
|
|
499
|
+
}), Me = e({
|
|
500
|
+
display: "inline-flex",
|
|
501
|
+
"@container (max-width: 28rem)": { display: "none" }
|
|
502
|
+
}), Ne = e({
|
|
503
|
+
display: "grid",
|
|
504
|
+
rowGap: _.space[2],
|
|
505
|
+
minInlineSize: 0,
|
|
506
|
+
"@container (max-width: 28rem)": { gridColumn: "1 / -1" }
|
|
507
|
+
}), Pe = e({
|
|
508
|
+
display: "flex",
|
|
509
|
+
flexWrap: "wrap",
|
|
510
|
+
justifyContent: "flex-end",
|
|
511
|
+
gap: _.space[2]
|
|
512
|
+
}), Fe = e({ gap: _.space[2] }), Ie = {
|
|
513
|
+
sm: "sm",
|
|
514
|
+
md: "md"
|
|
515
|
+
}, Le = {
|
|
516
|
+
sm: 2,
|
|
517
|
+
md: 3
|
|
518
|
+
}, $ = {
|
|
519
|
+
sm: e({
|
|
520
|
+
"--thread-column-gap": _.space[2],
|
|
521
|
+
"--thread-avatar": _.space[6]
|
|
522
|
+
}),
|
|
523
|
+
md: e({
|
|
524
|
+
"--thread-column-gap": _.space[3],
|
|
525
|
+
"--thread-avatar": _.space[8]
|
|
526
|
+
})
|
|
527
|
+
};
|
|
528
|
+
function Re({ ui: e, draft: t, onDraftChange: n, onSubmit: r, onCancel: _, cancelOnEscape: ee = !0, cancelable: ae, label: se, placeholder: b, submitLabel: x, cancelLabel: S, mentionsLabel: C, people: w, locale: T, disabled: E, pending: D, autoFocus: O, size: k, author: A, textareaProps: j, submitProps: M, part: N, kind: P, submitOnEnter: le = !1, allowEmpty: F = !1, lockWhilePending: I = !1 }) {
|
|
529
|
+
let L = p(), R = h(null), z = h(null), B = h(null), [V, H] = g(null), [ue, U] = g(null), [G, q] = g({
|
|
530
|
+
query: "",
|
|
531
|
+
index: 0
|
|
532
|
+
}), J = V === null ? null : Oe(t, V), Y = J ? ke(w, J.query, T) : [], X = J !== null && !E && Y.length > 0 && ue !== J.start, Z = J && G.query === J.query ? Math.min(G.index, Y.length - 1) : 0, ge = `${L}-mentions`, _e = (e) => d(L, "person", e.id), { refs: ve, floatingStyles: ye } = oe({
|
|
533
|
+
open: X,
|
|
534
|
+
placement: "bottom-start",
|
|
535
|
+
middleware: [
|
|
536
|
+
re(fe),
|
|
537
|
+
ne({ padding: W }),
|
|
538
|
+
ie({ padding: W })
|
|
539
|
+
],
|
|
540
|
+
whileElementsMounted: te
|
|
541
|
+
}), be = ce([
|
|
542
|
+
z,
|
|
543
|
+
ve.setReference,
|
|
544
|
+
j?.ref
|
|
545
|
+
]);
|
|
546
|
+
m(() => {
|
|
547
|
+
B.current !== null && z.current && (z.current.setSelectionRange(B.current, B.current), B.current = null);
|
|
548
|
+
});
|
|
549
|
+
let xe = (e) => H(e.selectionStart === e.selectionEnd ? e.selectionStart : null), Q = (e) => {
|
|
550
|
+
if (!J) return;
|
|
551
|
+
let r = `${de}${e.name} `, i = J.start + 1 + J.query.length, a = t.slice(0, J.start) + r + t.slice(i), o = J.start + r.length;
|
|
552
|
+
B.current = o, H(o), n(a);
|
|
553
|
+
}, Se = () => {
|
|
554
|
+
let e = t.trim();
|
|
555
|
+
E || D || !F && e === "" || !R.current || r(e, R.current);
|
|
556
|
+
}, Ce = (e) => {
|
|
557
|
+
j?.onChange?.(e), n(e.currentTarget.value), xe(e.currentTarget);
|
|
558
|
+
}, we = (e) => {
|
|
559
|
+
j?.onSelect?.(e), xe(e.currentTarget);
|
|
560
|
+
}, Te = (e) => {
|
|
561
|
+
j?.onBlur?.(e), J && U(J.start);
|
|
562
|
+
}, Ee = (e) => {
|
|
563
|
+
if (j?.onKeyDown?.(e), e.defaultPrevented || pe(e)) return;
|
|
564
|
+
let t = !e.altKey && !e.ctrlKey && !e.metaKey && !e.shiftKey;
|
|
565
|
+
if (X && J) {
|
|
566
|
+
let n = t ? Ae[e.key] : void 0;
|
|
567
|
+
if (n) {
|
|
568
|
+
e.preventDefault(), q({
|
|
569
|
+
query: J.query,
|
|
570
|
+
index: n(Z, Y.length)
|
|
571
|
+
});
|
|
572
|
+
return;
|
|
573
|
+
}
|
|
574
|
+
if (t && (e.key === "Enter" || e.key === "Tab")) {
|
|
575
|
+
e.preventDefault(), Q(Y[Z]);
|
|
576
|
+
return;
|
|
577
|
+
}
|
|
578
|
+
if (e.key === "Escape") {
|
|
579
|
+
e.preventDefault(), e.stopPropagation(), U(J.start);
|
|
580
|
+
return;
|
|
581
|
+
}
|
|
582
|
+
}
|
|
583
|
+
e.key === "Enter" && (le ? t : (e.ctrlKey || e.metaKey) && !e.altKey && !e.shiftKey) ? (e.preventDefault(), Se()) : e.key === "Escape" && ee && _ && R.current && (e.preventDefault(), e.stopPropagation(), _(R.current));
|
|
584
|
+
}, De = !F && t.trim() === "", $ = A !== void 0;
|
|
585
|
+
return /* @__PURE__ */ y("div", {
|
|
586
|
+
ref: R,
|
|
587
|
+
"data-ui": K(e, "composer"),
|
|
588
|
+
"data-composer": P,
|
|
589
|
+
"data-avatar": $,
|
|
590
|
+
className: N?.className,
|
|
591
|
+
css: [je, N?.css],
|
|
592
|
+
children: [
|
|
593
|
+
$ ? /* @__PURE__ */ v("span", {
|
|
594
|
+
"aria-hidden": "true",
|
|
595
|
+
css: Me,
|
|
596
|
+
children: /* @__PURE__ */ v(a, {
|
|
597
|
+
name: A.name,
|
|
598
|
+
src: A.avatar,
|
|
599
|
+
size: me[k]
|
|
600
|
+
})
|
|
601
|
+
}) : null,
|
|
602
|
+
/* @__PURE__ */ y("div", {
|
|
603
|
+
css: Ne,
|
|
604
|
+
children: [/* @__PURE__ */ v(f, {
|
|
605
|
+
"aria-label": se,
|
|
606
|
+
placeholder: b,
|
|
607
|
+
size: Ie[k],
|
|
608
|
+
rows: Le[k],
|
|
609
|
+
autoResize: !0,
|
|
610
|
+
autoFocus: O,
|
|
611
|
+
...j,
|
|
612
|
+
ref: be,
|
|
613
|
+
value: t,
|
|
614
|
+
disabled: E || j?.disabled,
|
|
615
|
+
readOnly: I && D || j?.readOnly,
|
|
616
|
+
"aria-autocomplete": "list",
|
|
617
|
+
"aria-controls": X ? ge : j?.["aria-controls"],
|
|
618
|
+
"aria-activedescendant": X ? _e(Y[Z]) : void 0,
|
|
619
|
+
onChange: Ce,
|
|
620
|
+
onSelect: we,
|
|
621
|
+
onBlur: Te,
|
|
622
|
+
onKeyDown: Ee
|
|
623
|
+
}), /* @__PURE__ */ y("div", {
|
|
624
|
+
css: Pe,
|
|
625
|
+
children: [ae ? /* @__PURE__ */ v(i, {
|
|
626
|
+
variant: "ghost",
|
|
627
|
+
size: "sm",
|
|
628
|
+
disabled: E,
|
|
629
|
+
onClick: () => R.current && _?.(R.current),
|
|
630
|
+
children: S
|
|
631
|
+
}) : null, /* @__PURE__ */ v(i, {
|
|
632
|
+
variant: "solid",
|
|
633
|
+
tone: "accent",
|
|
634
|
+
size: "sm",
|
|
635
|
+
...M,
|
|
636
|
+
disabled: E || M?.disabled,
|
|
637
|
+
"aria-disabled": De ? !0 : M?.["aria-disabled"],
|
|
638
|
+
loading: D,
|
|
639
|
+
"data-action": "submit",
|
|
640
|
+
onClick: (e) => {
|
|
641
|
+
M?.onClick?.(e), e.defaultPrevented || Se();
|
|
642
|
+
},
|
|
643
|
+
children: x
|
|
644
|
+
})]
|
|
645
|
+
})]
|
|
646
|
+
}),
|
|
647
|
+
X ? /* @__PURE__ */ v(u, { children: /* @__PURE__ */ v("div", {
|
|
648
|
+
ref: ve.setFloating,
|
|
649
|
+
id: ge,
|
|
650
|
+
role: "listbox",
|
|
651
|
+
"aria-label": C,
|
|
652
|
+
"data-ui": K(e, "mentions"),
|
|
653
|
+
style: ye,
|
|
654
|
+
css: [c, s],
|
|
655
|
+
children: Y.map((t, n) => /* @__PURE__ */ y("div", {
|
|
656
|
+
id: _e(t),
|
|
657
|
+
role: "option",
|
|
658
|
+
"aria-selected": n === Z,
|
|
659
|
+
"data-active": n === Z ? "" : void 0,
|
|
660
|
+
"data-ui": K(e, "mention"),
|
|
661
|
+
onMouseDown: (e) => e.preventDefault(),
|
|
662
|
+
onClick: () => Q(t),
|
|
663
|
+
css: [
|
|
664
|
+
o,
|
|
665
|
+
l,
|
|
666
|
+
Fe
|
|
667
|
+
],
|
|
668
|
+
children: [/* @__PURE__ */ v("span", {
|
|
669
|
+
"aria-hidden": "true",
|
|
670
|
+
css: he,
|
|
671
|
+
children: /* @__PURE__ */ v(a, {
|
|
672
|
+
name: t.name,
|
|
673
|
+
src: t.avatar,
|
|
674
|
+
size: "sm"
|
|
675
|
+
})
|
|
676
|
+
}), t.name]
|
|
677
|
+
}, t.id))
|
|
678
|
+
}) }) : null
|
|
679
|
+
]
|
|
680
|
+
});
|
|
681
|
+
}
|
|
682
|
+
//#endregion
|
|
683
|
+
export { R as a, le as c, P as d, L as f, A as g, ue as h, $ as i, F as l, V as m, ve as n, B as o, j as p, Ee as r, z as s, Re as t, H as u };
|