@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,772 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { a as e, i as t } from "./css-BYJhdGh-.js";
|
|
3
|
+
import { n, r } from "./media-8yrN85VT.js";
|
|
4
|
+
import { t as i } from "./sx-BJXJ2xJK.js";
|
|
5
|
+
import { t as a } from "./use-controlled-state-DpeVQZNR.js";
|
|
6
|
+
import { t as o } from "./visually-hidden-DgVO3NaB.js";
|
|
7
|
+
import { t as ee } from "./renderable-DzcIj1Lo.js";
|
|
8
|
+
import { t as s } from "./button-C6OV0C7J.js";
|
|
9
|
+
import { t as c } from "./part-id-D0zksy32.js";
|
|
10
|
+
import { t as l } from "./card-C008OQCp.js";
|
|
11
|
+
import { a as u, c as d, d as f, f as te, g as p, h as m, i as ne, l as re, n as ie, o as ae, p as oe, r as se, s as ce, t as le, u as ue } from "./thread-parts-DfZNz70v.js";
|
|
12
|
+
import { useEffect as de, useId as fe, useLayoutEffect as h, useMemo as g, useRef as _, useState as v } from "react";
|
|
13
|
+
import { vars as y } from "@jfrader/tokens/vars";
|
|
14
|
+
import { Fragment as pe, jsx as b, jsxs as x } from "@emotion/react/jsx-runtime";
|
|
15
|
+
import { useMergeRefs as me } from "@floating-ui/react";
|
|
16
|
+
//#region src/components/comment-thread/comment-thread.tsx
|
|
17
|
+
var S = "comment-thread", C = "root", he = [
|
|
18
|
+
"👍",
|
|
19
|
+
"❤️",
|
|
20
|
+
"🎉",
|
|
21
|
+
"👀",
|
|
22
|
+
"🚀",
|
|
23
|
+
"✅"
|
|
24
|
+
], w = 2, ge = 3, _e = [], ve = [], ye = {
|
|
25
|
+
replyTo: null,
|
|
26
|
+
editing: null,
|
|
27
|
+
confirming: null,
|
|
28
|
+
picker: null,
|
|
29
|
+
drafts: {},
|
|
30
|
+
pending: {}
|
|
31
|
+
}, be = "@container (max-width: 28rem)", T = (e) => `reply:${e}`, E = (e) => `edit:${e}`, xe = () => crypto.randomUUID(), Se = (e) => JSON.stringify([...new Set(e)].sort());
|
|
32
|
+
function D(e, t) {
|
|
33
|
+
if (!(t in e)) return e;
|
|
34
|
+
let { [t]: n, ...r } = e;
|
|
35
|
+
return r;
|
|
36
|
+
}
|
|
37
|
+
function O(e, t) {
|
|
38
|
+
return {
|
|
39
|
+
...e,
|
|
40
|
+
drafts: D(e.drafts, t),
|
|
41
|
+
pending: D(e.pending, t),
|
|
42
|
+
replyTo: e.replyTo !== null && t === T(e.replyTo) ? null : e.replyTo,
|
|
43
|
+
editing: e.editing !== null && t === E(e.editing) ? null : e.editing
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
function Ce(e, t) {
|
|
47
|
+
let n = e;
|
|
48
|
+
for (let [r, i] of Object.entries(e.pending)) {
|
|
49
|
+
let e = t.entries.get(i.id);
|
|
50
|
+
(i.kind === "add" ? e !== void 0 : !e || e.comment.deleted || e.comment.body === i.body) && (n = O(n, r));
|
|
51
|
+
}
|
|
52
|
+
let r = (e) => e === null || k(t, e);
|
|
53
|
+
return r(n.replyTo) || (n = O(n, T(n.replyTo))), r(n.editing) || (n = O(n, E(n.editing))), r(n.confirming) || (n = {
|
|
54
|
+
...n,
|
|
55
|
+
confirming: null
|
|
56
|
+
}), r(n.picker) || (n = {
|
|
57
|
+
...n,
|
|
58
|
+
picker: null
|
|
59
|
+
}), n;
|
|
60
|
+
}
|
|
61
|
+
function k(e, t) {
|
|
62
|
+
let n = e.entries.get(t);
|
|
63
|
+
return n !== void 0 && !n.comment.deleted;
|
|
64
|
+
}
|
|
65
|
+
function we(e) {
|
|
66
|
+
return e.order.filter((t) => (e.entries.get(t).comment.replies?.length ?? 0) > 0);
|
|
67
|
+
}
|
|
68
|
+
function Te(e) {
|
|
69
|
+
let t = (t, n, r) => d(e, t, n, r);
|
|
70
|
+
return {
|
|
71
|
+
thread: "Comments",
|
|
72
|
+
composer: "Add a comment",
|
|
73
|
+
placeholder: "Write a comment",
|
|
74
|
+
resolve: "Resolve",
|
|
75
|
+
resolved: "Resolved",
|
|
76
|
+
reopen: "Reopen",
|
|
77
|
+
empty: "No comments yet",
|
|
78
|
+
reply: "Reply",
|
|
79
|
+
edit: "Edit",
|
|
80
|
+
delete: "Delete",
|
|
81
|
+
cancel: "Cancel",
|
|
82
|
+
send: "Send",
|
|
83
|
+
save: "Save",
|
|
84
|
+
edited: "Edited",
|
|
85
|
+
editComment: "Edit comment",
|
|
86
|
+
deleteConfirm: "Delete this comment?",
|
|
87
|
+
deletedText: "This comment was deleted.",
|
|
88
|
+
deletedComment: "Deleted comment",
|
|
89
|
+
hideReplies: "Hide replies",
|
|
90
|
+
cancelReply: "Cancel",
|
|
91
|
+
addReaction: "Add reaction",
|
|
92
|
+
closeReactions: "Close reactions",
|
|
93
|
+
reactions: "Reactions",
|
|
94
|
+
mentions: "People",
|
|
95
|
+
invalidTime: "Unknown time",
|
|
96
|
+
replyingTo: (e) => `Reply to ${e}`,
|
|
97
|
+
showReplies: (e) => `Show ${t(e, "reply", "replies")}`,
|
|
98
|
+
commentCount: (e) => t(e, "comment", "comments"),
|
|
99
|
+
peopleCount: (e) => t(e, "person", "people"),
|
|
100
|
+
newComments: (e) => t(e, "new comment", "new comments"),
|
|
101
|
+
reactWith: (e) => `React with ${e}`,
|
|
102
|
+
reactionCount: (e, n, r) => r ? `${e} ${t(n, "reaction", "reactions")}, including you` : `${e} ${t(n, "reaction", "reactions")}`
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
var Ee = e({
|
|
106
|
+
from: { opacity: 0 },
|
|
107
|
+
to: { opacity: 1 }
|
|
108
|
+
}), De = t({
|
|
109
|
+
minInlineSize: 0,
|
|
110
|
+
containerType: "inline-size",
|
|
111
|
+
fontFamily: y.font.sans,
|
|
112
|
+
fontSize: y.textSize.sm,
|
|
113
|
+
lineHeight: y.lineHeight.base,
|
|
114
|
+
color: y.color.text
|
|
115
|
+
}), Oe = {
|
|
116
|
+
sm: t({
|
|
117
|
+
"--comment-thread-gap": y.space[3],
|
|
118
|
+
"--comment-thread-indent": y.space[4]
|
|
119
|
+
}),
|
|
120
|
+
md: t({
|
|
121
|
+
"--comment-thread-gap": y.space[4],
|
|
122
|
+
"--comment-thread-indent": y.space[6]
|
|
123
|
+
})
|
|
124
|
+
}, ke = t({
|
|
125
|
+
display: "flex",
|
|
126
|
+
flexWrap: "wrap",
|
|
127
|
+
alignItems: "center",
|
|
128
|
+
justifyContent: "space-between",
|
|
129
|
+
gap: y.space[2]
|
|
130
|
+
}), Ae = t({
|
|
131
|
+
display: "grid",
|
|
132
|
+
gap: y.space[1],
|
|
133
|
+
minInlineSize: 0
|
|
134
|
+
}), je = t({ overflowWrap: "anywhere" }), Me = t({
|
|
135
|
+
margin: 0,
|
|
136
|
+
fontSize: y.textSize.xs,
|
|
137
|
+
color: y.color.textMuted
|
|
138
|
+
}), Ne = t({ "&[hidden]": { display: "none" } }), Pe = t({
|
|
139
|
+
display: "grid",
|
|
140
|
+
rowGap: "var(--comment-thread-gap)",
|
|
141
|
+
listStyle: "none",
|
|
142
|
+
margin: 0,
|
|
143
|
+
padding: 0
|
|
144
|
+
}), Fe = t({
|
|
145
|
+
display: "grid",
|
|
146
|
+
rowGap: y.space[2],
|
|
147
|
+
minInlineSize: 0,
|
|
148
|
+
"&[data-new]": {
|
|
149
|
+
animationName: Ee,
|
|
150
|
+
animationDuration: y.motion.duration.base,
|
|
151
|
+
animationTimingFunction: y.motion.easeStandard
|
|
152
|
+
},
|
|
153
|
+
[r]: { "&[data-new]": { animation: "none" } }
|
|
154
|
+
}), Ie = t({
|
|
155
|
+
margin: 0,
|
|
156
|
+
whiteSpace: "pre-wrap",
|
|
157
|
+
overflowWrap: "anywhere",
|
|
158
|
+
lineHeight: y.lineHeight.relaxed,
|
|
159
|
+
color: y.color.text,
|
|
160
|
+
"&[data-deleted]": {
|
|
161
|
+
color: y.color.textMuted,
|
|
162
|
+
fontStyle: "italic"
|
|
163
|
+
}
|
|
164
|
+
}), Le = t({
|
|
165
|
+
display: "flex",
|
|
166
|
+
flexWrap: "wrap",
|
|
167
|
+
alignItems: "center",
|
|
168
|
+
gap: y.space[1]
|
|
169
|
+
}), Re = t({
|
|
170
|
+
display: "flex",
|
|
171
|
+
flexWrap: "wrap",
|
|
172
|
+
alignItems: "center",
|
|
173
|
+
gap: y.space[2],
|
|
174
|
+
paddingBlock: y.space[2],
|
|
175
|
+
paddingInline: y.space[3],
|
|
176
|
+
border: `1px solid ${y.color.dangerBorder}`,
|
|
177
|
+
borderRadius: y.radius.md,
|
|
178
|
+
[n]: { borderColor: "CanvasText" }
|
|
179
|
+
}), ze = t({
|
|
180
|
+
flex: "1 1 auto",
|
|
181
|
+
fontWeight: y.fontWeight.medium
|
|
182
|
+
}), Be = t({
|
|
183
|
+
marginInlineStart: "calc(var(--thread-avatar) + var(--thread-column-gap))",
|
|
184
|
+
[be]: { marginInlineStart: 0 }
|
|
185
|
+
}), Ve = t({ justifySelf: "start" }), He = t({
|
|
186
|
+
display: "grid",
|
|
187
|
+
rowGap: "var(--comment-thread-gap)",
|
|
188
|
+
listStyle: "none",
|
|
189
|
+
margin: 0,
|
|
190
|
+
marginInlineStart: "calc(var(--thread-avatar) / 2 - 1px)",
|
|
191
|
+
padding: 0,
|
|
192
|
+
paddingInlineStart: "var(--comment-thread-indent)",
|
|
193
|
+
borderInlineStart: `2px solid ${y.color.border}`,
|
|
194
|
+
"&[hidden]": { display: "none" },
|
|
195
|
+
"&[data-capped]": {
|
|
196
|
+
marginInlineStart: 0,
|
|
197
|
+
paddingInlineStart: 0,
|
|
198
|
+
borderInlineStart: 0
|
|
199
|
+
},
|
|
200
|
+
[be]: { paddingInlineStart: y.space[3] },
|
|
201
|
+
[n]: { borderInlineStartColor: "GrayText" }
|
|
202
|
+
}), Ue = t({
|
|
203
|
+
margin: 0,
|
|
204
|
+
paddingBlock: y.space[4],
|
|
205
|
+
color: y.color.textMuted
|
|
206
|
+
}), We = t({
|
|
207
|
+
display: "flex",
|
|
208
|
+
flexWrap: "wrap",
|
|
209
|
+
alignItems: "center",
|
|
210
|
+
gap: y.space[3]
|
|
211
|
+
}), Ge = t({
|
|
212
|
+
flex: "1 1 12rem",
|
|
213
|
+
display: "flex",
|
|
214
|
+
flexWrap: "wrap",
|
|
215
|
+
alignItems: "center",
|
|
216
|
+
gap: y.space[2],
|
|
217
|
+
margin: 0,
|
|
218
|
+
color: y.color.textMuted,
|
|
219
|
+
overflowWrap: "anywhere"
|
|
220
|
+
}), Ke = t({
|
|
221
|
+
display: "inline-flex",
|
|
222
|
+
alignItems: "center",
|
|
223
|
+
gap: y.space[1],
|
|
224
|
+
minBlockSize: y.space[6],
|
|
225
|
+
paddingInline: y.space[2],
|
|
226
|
+
border: `1px solid ${y.color.borderStrong}`,
|
|
227
|
+
borderRadius: y.radius.full,
|
|
228
|
+
fontWeight: y.fontWeight.medium,
|
|
229
|
+
color: y.color.text,
|
|
230
|
+
[n]: { borderColor: "CanvasText" }
|
|
231
|
+
}), qe = t({
|
|
232
|
+
display: "block",
|
|
233
|
+
inlineSize: "1em",
|
|
234
|
+
blockSize: "1em"
|
|
235
|
+
}), Je = /* @__PURE__ */ b("svg", {
|
|
236
|
+
viewBox: "0 0 16 16",
|
|
237
|
+
fill: "none",
|
|
238
|
+
stroke: "currentColor",
|
|
239
|
+
strokeWidth: "2",
|
|
240
|
+
css: qe,
|
|
241
|
+
"aria-hidden": "true",
|
|
242
|
+
children: /* @__PURE__ */ b("path", {
|
|
243
|
+
d: "M3 8.5l3 3 7-7",
|
|
244
|
+
strokeLinecap: "round"
|
|
245
|
+
})
|
|
246
|
+
});
|
|
247
|
+
function A({ ref: e, value: t, defaultValue: n, onValueChange: r, currentUser: d, people: y, resolvedValue: be, defaultResolvedValue: Ee, onResolvedValueChange: qe, expandedValue: A, defaultExpandedValue: Ye, onExpandedValueChange: Xe, title: j, headingLevel: Ze = 3, reactions: Qe = he, maxDepth: M = w, now: N, locale: $e, timeZone: et = "UTC", getNewId: tt = xe, placeholder: nt, composerLabel: rt, disabled: P = !1, readOnly: F = !1, size: I = "md", labels: it, slotProps: L, className: at, sx: ot, onFocus: st, onBlur: ct, "aria-label": lt, "aria-labelledby": ut, "aria-describedby": dt, ...ft }) {
|
|
248
|
+
let R = fe(), z = _(null), pt = me([e, z]), { formatters: B, problems: mt } = g(() => f("CommentThread", $e, et), [$e, et]), V = {
|
|
249
|
+
...Te(B),
|
|
250
|
+
...it
|
|
251
|
+
}, H = p(N) ? N : null, ht = Number.isInteger(M) && M >= 0, gt = ht ? M : w, _t = g(() => m(Qe, (e) => e), [Qe]), vt = _(null), [U = _e, yt] = a(t, n ?? _e, (e) => r?.([...e], vt.current)), W = g(() => re(U), [U]), G = (e, t) => {
|
|
252
|
+
e !== U && (vt.current = t, yt(e));
|
|
253
|
+
}, [K = !1, bt] = a(be, Ee ?? !1, qe), q = _(null);
|
|
254
|
+
h(() => {
|
|
255
|
+
q.current = null;
|
|
256
|
+
}, [K]);
|
|
257
|
+
let [xt] = v(() => Ye ?? we(W)), [J = ve, St] = a(A, xt, (e) => Xe?.([...e])), Ct = new Set(J), wt = Se(J), Tt = _(null);
|
|
258
|
+
h(() => {
|
|
259
|
+
Tt.current = null;
|
|
260
|
+
}, [wt]);
|
|
261
|
+
let Et = (e) => {
|
|
262
|
+
let t = Se(e);
|
|
263
|
+
t !== wt && t !== Tt.current && (Tt.current = t, St(e));
|
|
264
|
+
}, [Dt, Y] = v(ye), X = Ce(Dt, W);
|
|
265
|
+
X !== Dt && Y(X);
|
|
266
|
+
let Ot = g(() => m(y ?? [...W.order.map((e) => W.entries.get(e).comment.author), d], (e) => e.id), [
|
|
267
|
+
y,
|
|
268
|
+
W,
|
|
269
|
+
d
|
|
270
|
+
]), Z = _(null), Q = _(null), kt = _(W.order), At = _(null), jt = _(/* @__PURE__ */ new Set()), [Mt, Nt] = v({
|
|
271
|
+
text: "",
|
|
272
|
+
key: 0
|
|
273
|
+
}), Pt = g(() => {
|
|
274
|
+
let e = At.current;
|
|
275
|
+
return new Set(e ? W.order.filter((t) => !e.has(t)) : []);
|
|
276
|
+
}, [W]), Ft = (e) => z.current?.querySelector(`[data-ui="${S}-item"][data-comment-id="${CSS.escape(e)}"]`), $ = (e, t) => Ft(e)?.querySelector(`:scope > article [data-action="${t}"]`), It = (e) => {
|
|
277
|
+
let t = Ft(e);
|
|
278
|
+
return [
|
|
279
|
+
":scope > article [data-action=\"reply\"]:not(:disabled)",
|
|
280
|
+
":scope > article [data-action]:not(:disabled)",
|
|
281
|
+
":scope > [data-part=\"toggle\"]"
|
|
282
|
+
].map((e) => t?.querySelector(e)).find(Boolean);
|
|
283
|
+
}, Lt = () => z.current?.querySelector(`[data-composer="${C}"] textarea:not(:disabled)`), Rt = (e) => {
|
|
284
|
+
let t = kt.current, n = e === null ? -1 : t.indexOf(e), r = e === null ? null : It(e);
|
|
285
|
+
if (r) r.focus();
|
|
286
|
+
else {
|
|
287
|
+
for (let e = 1; n !== -1 && e < t.length; e++) {
|
|
288
|
+
let r = [t[n + e], t[n - e]].filter((e) => e !== void 0).map(It).find(Boolean);
|
|
289
|
+
if (r) {
|
|
290
|
+
r.focus();
|
|
291
|
+
return;
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
Lt()?.focus();
|
|
295
|
+
}
|
|
296
|
+
};
|
|
297
|
+
h(() => {
|
|
298
|
+
let e = z.current;
|
|
299
|
+
if (!e) return;
|
|
300
|
+
let t = e.ownerDocument, n = t.activeElement, r = !n || n === t.body, i = Z.current;
|
|
301
|
+
if (i && !i.invoker.isConnected) {
|
|
302
|
+
if (Z.current = null, r) {
|
|
303
|
+
let e = i.target();
|
|
304
|
+
e ? e.focus() : Rt(i.commentId);
|
|
305
|
+
}
|
|
306
|
+
} else if (r && Q.current && !Q.current.element.isConnected) {
|
|
307
|
+
let { commentId: e } = Q.current;
|
|
308
|
+
Q.current = null, Rt(e);
|
|
309
|
+
}
|
|
310
|
+
let a = Q.current?.element;
|
|
311
|
+
if (a?.isConnected && (r || n === a)) {
|
|
312
|
+
let t = `[data-ui="${S}-replies"][hidden]`, n = null;
|
|
313
|
+
for (let e = a.closest(t); e; e = e.parentElement.closest(t)) n = e;
|
|
314
|
+
let r = n ? e.querySelector(`[aria-controls="${CSS.escape(n.id)}"]`) : null, i = a.closest(`[data-ui="${S}-content"][hidden]`) ? e.querySelector("[data-action=\"reopen\"]") : null;
|
|
315
|
+
(r ?? i)?.focus();
|
|
316
|
+
}
|
|
317
|
+
kt.current = W.order;
|
|
318
|
+
}), h(() => {
|
|
319
|
+
let e = At.current;
|
|
320
|
+
if (At.current = new Set(W.order), !e) return;
|
|
321
|
+
let t = W.order.filter((t) => !e.has(t) && !jt.current.has(t));
|
|
322
|
+
t.length > 0 && Nt((e) => ({
|
|
323
|
+
text: V.newComments(t.length),
|
|
324
|
+
key: e.key + 1
|
|
325
|
+
}));
|
|
326
|
+
}, [W]);
|
|
327
|
+
let zt = [
|
|
328
|
+
...mt,
|
|
329
|
+
...H === null ? [`CommentThread: now ${String(N)} is not a finite epoch-ms value; showing full dates.`] : [],
|
|
330
|
+
...ht ? [] : [`CommentThread: maxDepth ${String(M)} is not a nonnegative integer; using ${w}.`],
|
|
331
|
+
...W.duplicates.length > 0 ? [`CommentThread: duplicate comment ids ${JSON.stringify(W.duplicates)}; showing the first of each.`] : [],
|
|
332
|
+
...W.cyclic ? ["CommentThread: a comment appears among its own replies; the repeat is not shown."] : []
|
|
333
|
+
].join("\n");
|
|
334
|
+
de(() => {
|
|
335
|
+
process.env.NODE_ENV !== "production" && zt !== "" && console.error(zt);
|
|
336
|
+
}, [zt]);
|
|
337
|
+
let Bt = (e) => {
|
|
338
|
+
st?.(e);
|
|
339
|
+
let t = e.target.closest(`[data-ui="${S}-item"]`);
|
|
340
|
+
Q.current = {
|
|
341
|
+
element: e.target,
|
|
342
|
+
commentId: t?.dataset.commentId ?? null
|
|
343
|
+
}, Z.current && !Z.current.invoker.contains(e.target) && (Z.current = null);
|
|
344
|
+
}, Vt = (e) => {
|
|
345
|
+
ct?.(e);
|
|
346
|
+
let { target: t } = e;
|
|
347
|
+
queueMicrotask(() => {
|
|
348
|
+
t.isConnected && Q.current?.element === t && (Q.current = null, Z.current = null);
|
|
349
|
+
});
|
|
350
|
+
}, Ht = (e, t) => Y((n) => ({
|
|
351
|
+
...n,
|
|
352
|
+
drafts: {
|
|
353
|
+
...n.drafts,
|
|
354
|
+
[e]: t
|
|
355
|
+
},
|
|
356
|
+
pending: D(n.pending, e)
|
|
357
|
+
})), Ut = (e, t, n, r) => {
|
|
358
|
+
if (P || F || X.pending[e] || t !== null && !k(W, t)) return;
|
|
359
|
+
let i = te(W, t, gt);
|
|
360
|
+
if (i === void 0) return;
|
|
361
|
+
let a = {
|
|
362
|
+
id: tt(),
|
|
363
|
+
author: d,
|
|
364
|
+
body: n,
|
|
365
|
+
createdAt: H ?? Date.now(),
|
|
366
|
+
reactions: []
|
|
367
|
+
};
|
|
368
|
+
jt.current.add(a.id), Y((t) => ({
|
|
369
|
+
...t,
|
|
370
|
+
pending: {
|
|
371
|
+
...t.pending,
|
|
372
|
+
[e]: {
|
|
373
|
+
kind: "add",
|
|
374
|
+
id: a.id
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
})), t !== null && (Z.current = {
|
|
378
|
+
invoker: r,
|
|
379
|
+
target: () => $(t, "reply"),
|
|
380
|
+
commentId: t
|
|
381
|
+
}), G(u(U, i, a), {
|
|
382
|
+
type: "reply",
|
|
383
|
+
comment: a,
|
|
384
|
+
parentId: i
|
|
385
|
+
}), i !== null && !Ct.has(i) && Et([...J, i]);
|
|
386
|
+
}, Wt = () => Y((e) => e.pending[C] ? {
|
|
387
|
+
...e,
|
|
388
|
+
pending: D(e.pending, C)
|
|
389
|
+
} : O(e, C)), Gt = (e) => Y((t) => ({
|
|
390
|
+
...t,
|
|
391
|
+
replyTo: e,
|
|
392
|
+
confirming: null,
|
|
393
|
+
picker: null
|
|
394
|
+
})), Kt = (e, t) => {
|
|
395
|
+
Z.current = {
|
|
396
|
+
invoker: t,
|
|
397
|
+
target: () => $(e, "reply"),
|
|
398
|
+
commentId: e
|
|
399
|
+
}, Y((t) => O(t, T(e)));
|
|
400
|
+
}, qt = (e) => Y((t) => ({
|
|
401
|
+
...t,
|
|
402
|
+
editing: e.id,
|
|
403
|
+
confirming: null,
|
|
404
|
+
picker: null,
|
|
405
|
+
drafts: {
|
|
406
|
+
...t.drafts,
|
|
407
|
+
[E(e.id)]: e.body
|
|
408
|
+
}
|
|
409
|
+
})), Jt = (e, t) => {
|
|
410
|
+
Z.current = {
|
|
411
|
+
invoker: t,
|
|
412
|
+
target: () => $(e, "edit"),
|
|
413
|
+
commentId: e
|
|
414
|
+
}, Y((t) => O(t, E(e)));
|
|
415
|
+
}, Yt = (e, t, n) => {
|
|
416
|
+
let r = E(e.id);
|
|
417
|
+
P || F || X.pending[r] || !k(W, e.id) || (t === e.body ? Jt(e.id, n) : (Z.current = {
|
|
418
|
+
invoker: n,
|
|
419
|
+
target: () => $(e.id, "edit"),
|
|
420
|
+
commentId: e.id
|
|
421
|
+
}, Y((n) => ({
|
|
422
|
+
...n,
|
|
423
|
+
pending: {
|
|
424
|
+
...n.pending,
|
|
425
|
+
[r]: {
|
|
426
|
+
kind: "edit",
|
|
427
|
+
id: e.id,
|
|
428
|
+
body: t
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
})), G(ce(U, e.id, t), {
|
|
432
|
+
type: "edit",
|
|
433
|
+
id: e.id,
|
|
434
|
+
body: t
|
|
435
|
+
})));
|
|
436
|
+
}, Xt = (e, t) => {
|
|
437
|
+
Z.current = {
|
|
438
|
+
invoker: t,
|
|
439
|
+
target: () => $(e, "delete"),
|
|
440
|
+
commentId: e
|
|
441
|
+
}, Y((e) => ({
|
|
442
|
+
...e,
|
|
443
|
+
confirming: null
|
|
444
|
+
}));
|
|
445
|
+
}, Zt = (e, t) => {
|
|
446
|
+
Xt(e, t), !(P || F) && G(ae(U, e), {
|
|
447
|
+
type: "delete",
|
|
448
|
+
id: e
|
|
449
|
+
});
|
|
450
|
+
}, Qt = (e, t) => {
|
|
451
|
+
if (P || F) return;
|
|
452
|
+
let { comments: n, added: r } = ue(U, e, t, d.id);
|
|
453
|
+
G(n, {
|
|
454
|
+
type: "react",
|
|
455
|
+
id: e,
|
|
456
|
+
emoji: t,
|
|
457
|
+
added: r
|
|
458
|
+
});
|
|
459
|
+
}, $t = (e, t) => {
|
|
460
|
+
if (P || F || e === q.current) return;
|
|
461
|
+
q.current = e;
|
|
462
|
+
let n = e ? "reopen" : "resolve";
|
|
463
|
+
Z.current = {
|
|
464
|
+
invoker: t.currentTarget,
|
|
465
|
+
target: () => z.current?.querySelector(`[data-action="${n}"]`),
|
|
466
|
+
commentId: null
|
|
467
|
+
}, bt(e);
|
|
468
|
+
}, en = (e) => Et(Ct.has(e) ? J.filter((t) => t !== e) : [...J, e]), tn = W.order.filter((e) => k(W, e)), nn = m(tn.map((e) => W.entries.get(e).comment.author), (e) => e.id), rn = V.commentCount(tn.length), an = tn.length > 0 ? B.facts.format([rn, V.peopleCount(nn.length)]) : rn, on = W.order.length === 0, sn = `${R}-empty`, cn = `${R}-title`, ln = ee(j) && j !== "", un = [ut, ln ? cn : void 0].filter(Boolean).join(" ") || void 0, dn = [dt, on ? sn : void 0].filter(Boolean).join(" ") || void 0, fn = {
|
|
469
|
+
ui: S,
|
|
470
|
+
mentionsLabel: V.mentions,
|
|
471
|
+
people: Ot,
|
|
472
|
+
locale: $e,
|
|
473
|
+
disabled: P,
|
|
474
|
+
size: I,
|
|
475
|
+
textareaProps: L?.textarea,
|
|
476
|
+
submitProps: L?.send
|
|
477
|
+
}, pn = (e, t, n) => {
|
|
478
|
+
if (n.has(e) || W.entries.get(e.id)?.comment !== e) return null;
|
|
479
|
+
let { id: r } = e, i = e.deleted === !0, a = e.author.id === d.id, o = X.editing === r && !i, ee = X.confirming === r && !i, l = e.replies ?? _e, u = c(R, "replies", r), f = Ct.has(r), te = new Set(n).add(e), p = c(R, "confirm", r), m = (e) => {
|
|
480
|
+
e.key === "Escape" && (e.preventDefault(), e.stopPropagation(), Xt(r, e.currentTarget));
|
|
481
|
+
};
|
|
482
|
+
return /* @__PURE__ */ x("li", {
|
|
483
|
+
"data-ui": `${S}-item`,
|
|
484
|
+
"data-comment-id": r,
|
|
485
|
+
"data-depth": t,
|
|
486
|
+
"data-deleted": i ? "" : void 0,
|
|
487
|
+
"data-new": Pt.has(r) ? "" : void 0,
|
|
488
|
+
className: L?.item?.className,
|
|
489
|
+
css: [Fe, L?.item?.css],
|
|
490
|
+
children: [
|
|
491
|
+
/* @__PURE__ */ x(ie, {
|
|
492
|
+
ui: S,
|
|
493
|
+
author: e.author,
|
|
494
|
+
label: i ? V.deletedComment : void 0,
|
|
495
|
+
epoch: oe(e.createdAt),
|
|
496
|
+
now: H,
|
|
497
|
+
formatters: B,
|
|
498
|
+
invalidTimeLabel: V.invalidTime,
|
|
499
|
+
meta: e.edited && !i ? V.edited : null,
|
|
500
|
+
size: I,
|
|
501
|
+
baseId: R,
|
|
502
|
+
messageId: r,
|
|
503
|
+
slots: {
|
|
504
|
+
article: L?.article,
|
|
505
|
+
time: L?.time
|
|
506
|
+
},
|
|
507
|
+
children: [
|
|
508
|
+
o ? /* @__PURE__ */ b(le, {
|
|
509
|
+
...fn,
|
|
510
|
+
kind: "edit",
|
|
511
|
+
draft: X.drafts[E(r)] ?? e.body,
|
|
512
|
+
onDraftChange: (e) => Ht(E(r), e),
|
|
513
|
+
onSubmit: (t, n) => Yt(e, t, n),
|
|
514
|
+
onCancel: (e) => Jt(r, e),
|
|
515
|
+
cancelable: !0,
|
|
516
|
+
label: V.editComment,
|
|
517
|
+
submitLabel: V.save,
|
|
518
|
+
cancelLabel: V.cancel,
|
|
519
|
+
pending: X.pending[E(r)] !== void 0,
|
|
520
|
+
autoFocus: !0,
|
|
521
|
+
part: L?.composer
|
|
522
|
+
}) : /* @__PURE__ */ b("p", {
|
|
523
|
+
"data-ui": `${S}-body`,
|
|
524
|
+
"data-deleted": i ? "" : void 0,
|
|
525
|
+
className: L?.body?.className,
|
|
526
|
+
css: [Ie, L?.body?.css],
|
|
527
|
+
children: i ? V.deletedText : e.body
|
|
528
|
+
}),
|
|
529
|
+
i || o ? null : /* @__PURE__ */ b(se, {
|
|
530
|
+
ui: S,
|
|
531
|
+
reactions: e.reactions ?? [],
|
|
532
|
+
offered: _t,
|
|
533
|
+
currentUserId: d.id,
|
|
534
|
+
formatters: B,
|
|
535
|
+
labels: V,
|
|
536
|
+
readOnly: F,
|
|
537
|
+
disabled: P,
|
|
538
|
+
pickerOpen: X.picker === r,
|
|
539
|
+
onPickerOpenChange: (e) => Y((t) => ({
|
|
540
|
+
...t,
|
|
541
|
+
picker: e ? r : null,
|
|
542
|
+
confirming: null
|
|
543
|
+
})),
|
|
544
|
+
onToggle: (e) => Qt(r, e),
|
|
545
|
+
pickerId: c(R, "picker", r),
|
|
546
|
+
part: L?.reaction
|
|
547
|
+
}),
|
|
548
|
+
i || o || F ? null : ee ? /* @__PURE__ */ x("div", {
|
|
549
|
+
role: "group",
|
|
550
|
+
"aria-labelledby": p,
|
|
551
|
+
"data-ui": `${S}-confirm`,
|
|
552
|
+
onKeyDown: m,
|
|
553
|
+
css: Re,
|
|
554
|
+
children: [
|
|
555
|
+
/* @__PURE__ */ b("span", {
|
|
556
|
+
id: p,
|
|
557
|
+
css: ze,
|
|
558
|
+
children: V.deleteConfirm
|
|
559
|
+
}),
|
|
560
|
+
/* @__PURE__ */ b(s, {
|
|
561
|
+
variant: "ghost",
|
|
562
|
+
size: "sm",
|
|
563
|
+
autoFocus: !0,
|
|
564
|
+
onClick: (e) => Xt(r, e.currentTarget.parentElement),
|
|
565
|
+
children: V.cancel
|
|
566
|
+
}),
|
|
567
|
+
/* @__PURE__ */ b(s, {
|
|
568
|
+
variant: "solid",
|
|
569
|
+
tone: "danger",
|
|
570
|
+
size: "sm",
|
|
571
|
+
disabled: P,
|
|
572
|
+
onClick: (e) => Zt(r, e.currentTarget.parentElement),
|
|
573
|
+
children: V.delete
|
|
574
|
+
})
|
|
575
|
+
]
|
|
576
|
+
}, "confirm") : /* @__PURE__ */ x("div", {
|
|
577
|
+
"data-ui": `${S}-actions`,
|
|
578
|
+
className: L?.actions?.className,
|
|
579
|
+
css: [Le, L?.actions?.css],
|
|
580
|
+
children: [/* @__PURE__ */ b(s, {
|
|
581
|
+
variant: "ghost",
|
|
582
|
+
size: "sm",
|
|
583
|
+
"data-action": "reply",
|
|
584
|
+
"aria-expanded": X.replyTo === r,
|
|
585
|
+
disabled: P,
|
|
586
|
+
onClick: () => Gt(r),
|
|
587
|
+
children: V.reply
|
|
588
|
+
}), a ? /* @__PURE__ */ x(pe, { children: [/* @__PURE__ */ b(s, {
|
|
589
|
+
variant: "ghost",
|
|
590
|
+
size: "sm",
|
|
591
|
+
"data-action": "edit",
|
|
592
|
+
disabled: P,
|
|
593
|
+
onClick: () => qt(e),
|
|
594
|
+
children: V.edit
|
|
595
|
+
}), /* @__PURE__ */ b(s, {
|
|
596
|
+
variant: "ghost",
|
|
597
|
+
size: "sm",
|
|
598
|
+
tone: "danger",
|
|
599
|
+
"data-action": "delete",
|
|
600
|
+
disabled: P,
|
|
601
|
+
onClick: () => Y((e) => ({
|
|
602
|
+
...e,
|
|
603
|
+
confirming: r,
|
|
604
|
+
picker: null
|
|
605
|
+
})),
|
|
606
|
+
children: V.delete
|
|
607
|
+
})] }) : null]
|
|
608
|
+
}, "actions")
|
|
609
|
+
]
|
|
610
|
+
}),
|
|
611
|
+
X.replyTo === r && !i && !F ? /* @__PURE__ */ b("div", {
|
|
612
|
+
css: Be,
|
|
613
|
+
children: /* @__PURE__ */ b(le, {
|
|
614
|
+
...fn,
|
|
615
|
+
kind: "reply",
|
|
616
|
+
draft: X.drafts[T(r)] ?? "",
|
|
617
|
+
onDraftChange: (e) => Ht(T(r), e),
|
|
618
|
+
onSubmit: (e, t) => Ut(T(r), r, e, t),
|
|
619
|
+
onCancel: (e) => Kt(r, e),
|
|
620
|
+
cancelable: !0,
|
|
621
|
+
label: V.replyingTo(e.author.name),
|
|
622
|
+
placeholder: nt ?? V.placeholder,
|
|
623
|
+
submitLabel: V.send,
|
|
624
|
+
cancelLabel: V.cancelReply,
|
|
625
|
+
pending: X.pending[T(r)] !== void 0,
|
|
626
|
+
autoFocus: !0,
|
|
627
|
+
part: L?.composer
|
|
628
|
+
})
|
|
629
|
+
}) : null,
|
|
630
|
+
l.length > 0 ? /* @__PURE__ */ x(pe, { children: [/* @__PURE__ */ b(s, {
|
|
631
|
+
variant: "ghost",
|
|
632
|
+
size: "sm",
|
|
633
|
+
"data-part": "toggle",
|
|
634
|
+
"aria-expanded": f,
|
|
635
|
+
"aria-controls": u,
|
|
636
|
+
onClick: () => en(r),
|
|
637
|
+
css: [Ve, Be],
|
|
638
|
+
children: f ? V.hideReplies : V.showReplies(l.length)
|
|
639
|
+
}), /* @__PURE__ */ b("ul", {
|
|
640
|
+
role: "list",
|
|
641
|
+
id: u,
|
|
642
|
+
hidden: !f,
|
|
643
|
+
"data-ui": `${S}-replies`,
|
|
644
|
+
"data-capped": t + 1 > ge ? "" : void 0,
|
|
645
|
+
className: L?.replies?.className,
|
|
646
|
+
css: [He, L?.replies?.css],
|
|
647
|
+
children: l.map((e) => pn(e, t + 1, te))
|
|
648
|
+
})] }) : null
|
|
649
|
+
]
|
|
650
|
+
}, r);
|
|
651
|
+
};
|
|
652
|
+
return /* @__PURE__ */ b(i, {
|
|
653
|
+
className: at,
|
|
654
|
+
styles: [
|
|
655
|
+
De,
|
|
656
|
+
ne[I],
|
|
657
|
+
Oe[I]
|
|
658
|
+
],
|
|
659
|
+
sx: ot,
|
|
660
|
+
children: (e) => /* @__PURE__ */ x("section", {
|
|
661
|
+
...ft,
|
|
662
|
+
ref: pt,
|
|
663
|
+
"aria-label": lt ?? (un ? void 0 : V.thread),
|
|
664
|
+
"aria-labelledby": un,
|
|
665
|
+
"aria-describedby": dn,
|
|
666
|
+
"data-ui": S,
|
|
667
|
+
"data-size": I,
|
|
668
|
+
"data-state": K ? "resolved" : "open",
|
|
669
|
+
onFocus: Bt,
|
|
670
|
+
onBlur: Vt,
|
|
671
|
+
className: e,
|
|
672
|
+
children: [/* @__PURE__ */ x(l, { children: [
|
|
673
|
+
/* @__PURE__ */ x(l.Header, {
|
|
674
|
+
className: L?.header?.className,
|
|
675
|
+
css: [ke, L?.header?.css],
|
|
676
|
+
children: [/* @__PURE__ */ x("div", {
|
|
677
|
+
css: Ae,
|
|
678
|
+
children: [ln ? /* @__PURE__ */ b(l.Title, {
|
|
679
|
+
id: cn,
|
|
680
|
+
level: Ze,
|
|
681
|
+
className: L?.title?.className,
|
|
682
|
+
css: [je, L?.title?.css],
|
|
683
|
+
children: j
|
|
684
|
+
}) : null, /* @__PURE__ */ b("p", {
|
|
685
|
+
"data-ui": `${S}-count`,
|
|
686
|
+
css: Me,
|
|
687
|
+
children: an
|
|
688
|
+
})]
|
|
689
|
+
}), !K && !F ? /* @__PURE__ */ b(s, {
|
|
690
|
+
variant: "outline",
|
|
691
|
+
size: "sm",
|
|
692
|
+
"data-action": "resolve",
|
|
693
|
+
disabled: P,
|
|
694
|
+
startIcon: Je,
|
|
695
|
+
onClick: (e) => $t(!0, e),
|
|
696
|
+
children: V.resolve
|
|
697
|
+
}) : null]
|
|
698
|
+
}),
|
|
699
|
+
/* @__PURE__ */ x(l.Content, { children: [/* @__PURE__ */ b("div", {
|
|
700
|
+
"data-ui": `${S}-content`,
|
|
701
|
+
hidden: K,
|
|
702
|
+
css: Ne,
|
|
703
|
+
children: on ? /* @__PURE__ */ b("p", {
|
|
704
|
+
id: sn,
|
|
705
|
+
"data-ui": `${S}-empty`,
|
|
706
|
+
css: Ue,
|
|
707
|
+
children: V.empty
|
|
708
|
+
}) : /* @__PURE__ */ b("ul", {
|
|
709
|
+
role: "list",
|
|
710
|
+
"data-ui": `${S}-list`,
|
|
711
|
+
className: L?.list?.className,
|
|
712
|
+
css: [Pe, L?.list?.css],
|
|
713
|
+
children: U.map((e) => pn(e, 0, /* @__PURE__ */ new Set()))
|
|
714
|
+
})
|
|
715
|
+
}), K ? /* @__PURE__ */ x("div", {
|
|
716
|
+
"data-ui": `${S}-resolved`,
|
|
717
|
+
className: L?.resolved?.className,
|
|
718
|
+
css: [We, L?.resolved?.css],
|
|
719
|
+
children: [/* @__PURE__ */ x("p", {
|
|
720
|
+
css: Ge,
|
|
721
|
+
children: [
|
|
722
|
+
/* @__PURE__ */ x("span", {
|
|
723
|
+
css: Ke,
|
|
724
|
+
children: [Je, V.resolved]
|
|
725
|
+
}),
|
|
726
|
+
/* @__PURE__ */ b("span", { children: rn }),
|
|
727
|
+
nn.length > 0 ? /* @__PURE__ */ b("span", { children: B.people.format(nn.map((e) => e.name)) }) : null
|
|
728
|
+
]
|
|
729
|
+
}), F ? null : /* @__PURE__ */ b(s, {
|
|
730
|
+
variant: "outline",
|
|
731
|
+
size: "sm",
|
|
732
|
+
"data-action": "reopen",
|
|
733
|
+
disabled: P,
|
|
734
|
+
onClick: (e) => $t(!1, e),
|
|
735
|
+
children: V.reopen
|
|
736
|
+
})]
|
|
737
|
+
}) : null] }),
|
|
738
|
+
F ? null : /* @__PURE__ */ b(l.Footer, {
|
|
739
|
+
hidden: K,
|
|
740
|
+
css: Ne,
|
|
741
|
+
children: /* @__PURE__ */ b(le, {
|
|
742
|
+
...fn,
|
|
743
|
+
kind: C,
|
|
744
|
+
draft: X.drafts[C] ?? "",
|
|
745
|
+
onDraftChange: (e) => Ht(C, e),
|
|
746
|
+
onSubmit: (e, t) => Ut(C, null, e, t),
|
|
747
|
+
onCancel: Wt,
|
|
748
|
+
cancelOnEscape: !1,
|
|
749
|
+
cancelable: (X.drafts[C] ?? "") !== "" || X.pending[C] !== void 0,
|
|
750
|
+
label: rt ?? V.composer,
|
|
751
|
+
placeholder: nt ?? V.placeholder,
|
|
752
|
+
submitLabel: V.send,
|
|
753
|
+
cancelLabel: V.cancel,
|
|
754
|
+
pending: X.pending[C] !== void 0,
|
|
755
|
+
author: d,
|
|
756
|
+
part: L?.composer
|
|
757
|
+
})
|
|
758
|
+
})
|
|
759
|
+
] }), /* @__PURE__ */ b("div", {
|
|
760
|
+
role: "status",
|
|
761
|
+
"aria-atomic": "true",
|
|
762
|
+
"data-ui": `${S}-status`,
|
|
763
|
+
className: L?.status?.className,
|
|
764
|
+
css: [o, L?.status?.css],
|
|
765
|
+
children: Mt.text ? /* @__PURE__ */ b("span", { children: Mt.text }, Mt.key) : null
|
|
766
|
+
})]
|
|
767
|
+
})
|
|
768
|
+
});
|
|
769
|
+
}
|
|
770
|
+
A.displayName = "CommentThread";
|
|
771
|
+
//#endregion
|
|
772
|
+
export { A as t };
|